Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate SDK from axios to KY #27

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: Fix type import
  • Loading branch information
sidharthv96 committed Aug 23, 2024
commit 502c24e7c3395e1cfae713a3820052cdb3070b5b
2 changes: 1 addition & 1 deletion packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OAuth2Client, generateCodeVerifier } from '@badgateway/oauth2-client';
import ky, { KyInstance } from 'ky';
import ky, { type KyInstance } from 'ky';
import { v4 as uuid } from 'uuid';
import { OAuthError, RequiredParameterMissingError } from './errors.js';
import type {
@@ -196,7 +196,7 @@
}

public async createDocument(projectID: string) {
const newDocument = await this.api.post<MCDocument>(

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, macos-latest)

src/index.e2e.test.ts > createDocument > should create document in project

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:104:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, macos-latest)

src/index.e2e.test.ts > setDocument > should set document

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:119:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, macos-latest)

src/index.e2e.test.ts > setDocument > should throw an error on invalid data

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:142:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, macos-latest)

src/index.e2e.test.ts > deleteDocument > should delete document

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:157:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, macos-latest)

src/index.e2e.test.ts > getDocument > should get diagram

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:171:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > createDocument > should create document in project

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:104:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > setDocument > should set document

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:119:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > setDocument > should throw an error on invalid data

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:142:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > deleteDocument > should delete document

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:157:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > getDocument > should get diagram

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:171:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > createDocument > should create document in project

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:104:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > setDocument > should set document

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:119:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > setDocument > should throw an error on invalid data

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:142:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > deleteDocument > should delete document

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:157:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }

Check failure on line 199 in packages/sdk/src/index.ts

GitHub Actions / test (18.18.x, sdk, ubuntu-latest)

src/index.e2e.test.ts > getDocument > should get diagram

TypeError: fetch failed ❯ function_ ../../node_modules/.pnpm/ky@1.7.1/node_modules/ky/source/core/Ky.ts:38:19 ❯ MermaidChart.createDocument src/index.ts:199:25 ❯ src/index.e2e.test.ts:171:25 Caused by: RequestContentLengthMismatchError: Request body length does not match content-length header ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' }
URLS.rest.projects.get(projectID).documents,
{ json: {} }, // force sending empty JSON to avoid triggering CSRF check
);
Loading
Oops, something went wrong.