diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a726929..a8ea4b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: - name: Get GitHub OIDC Token if: github.repository == 'stainless-sdks/morphik-typescript' id: github-oidc - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4fcfdf7..2b6f978 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.0" + ".": "1.9.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 5caaf1c..c31acdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 1.9.1 (2026-02-24) + +Full Changelog: [v1.9.0...v1.9.1](https://github.com/morphik-org/morphik-ts/compare/v1.9.0...v1.9.1) + +### Bug Fixes + +* **client:** avoid memory leak with abort signals ([d4ab61c](https://github.com/morphik-org/morphik-ts/commit/d4ab61c33f1d02a5253e27841bb775a6ceea147d)) +* **client:** avoid removing abort listener too early ([a4fdb09](https://github.com/morphik-org/morphik-ts/commit/a4fdb095674574af92643d5212923579b73f84cc)) +* **docs/contributing:** correct pnpm link command ([874ab6d](https://github.com/morphik-org/morphik-ts/commit/874ab6dd5315f49a5070a61b2c88f3ad009191ae)) + + +### Chores + +* **ci:** upgrade `actions/github-script` ([8513ce5](https://github.com/morphik-org/morphik-ts/commit/8513ce589bdffbd702a3cc9fa868ad499f216969)) +* **client:** do not parse responses with empty content-length ([3169d51](https://github.com/morphik-org/morphik-ts/commit/3169d51148b52561338eea977226341cfb7c0831)) +* **client:** restructure abort controller binding ([b48b2b0](https://github.com/morphik-org/morphik-ts/commit/b48b2b0502d295c9a0cb4955437caddccc995bea)) +* **internal/client:** fix form-urlencoded requests ([866c221](https://github.com/morphik-org/morphik-ts/commit/866c221aacbcf220b11e12b83feeacea9578645e)) +* **internal:** avoid type checking errors with ts-reset ([ba8958a](https://github.com/morphik-org/morphik-ts/commit/ba8958a36758e190e863d6a032583fdd263ef942)) +* **internal:** remove mock server code ([f64241c](https://github.com/morphik-org/morphik-ts/commit/f64241cbba49ce07de55752a373c796f1d5f30c5)) +* update mock server docs ([b5ae452](https://github.com/morphik-org/morphik-ts/commit/b5ae452777e9f154aac0185050dcf49cf9e97da3)) + ## 1.9.0 (2026-01-22) Full Changelog: [v1.8.0...v1.9.0](https://github.com/morphik-org/morphik-ts/compare/v1.8.0...v1.9.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 48b8212..159d843 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,17 +60,11 @@ $ yarn link morphik # With pnpm $ pnpm link --global $ cd ../my-package -$ pnpm link -—global morphik +$ pnpm link --global morphik ``` ## Running tests -Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. - -```sh -$ npx prism mock path/to/your/openapi.yml -``` - ```sh $ yarn run test ``` diff --git a/package.json b/package.json index 9e99c8b..9be4e39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "morphik", - "version": "1.9.0", + "version": "1.9.1", "description": "The official TypeScript library for the Morphik API", "author": "Morphik ", "types": "dist/index.d.ts", diff --git a/scripts/mock b/scripts/mock deleted file mode 100755 index 0b28f6e..0000000 --- a/scripts/mock +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd "$(dirname "$0")/.." - -if [[ -n "$1" && "$1" != '--'* ]]; then - URL="$1" - shift -else - URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" -fi - -# Check if the URL is empty -if [ -z "$URL" ]; then - echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" - exit 1 -fi - -echo "==> Starting mock server with URL ${URL}" - -# Run prism mock on the given spec -if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - - # Wait for server to come online - echo -n "Waiting for server" - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do - echo -n "." - sleep 0.1 - done - - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - - echo -else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" -fi diff --git a/scripts/test b/scripts/test index 7bce051..548da9b 100755 --- a/scripts/test +++ b/scripts/test @@ -4,53 +4,7 @@ set -e cd "$(dirname "$0")/.." -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 -} - -kill_server_on_port() { - pids=$(lsof -t -i tcp:"$1" || echo "") - if [ "$pids" != "" ]; then - kill "$pids" - echo "Stopped $pids." - fi -} - -function is_overriding_api_base_url() { - [ -n "$TEST_API_BASE_URL" ] -} - -if ! is_overriding_api_base_url && ! prism_is_running ; then - # When we exit this script, make sure to kill the background mock server process - trap 'kill_server_on_port 4010' EXIT - - # Start the dev server - ./scripts/mock --daemon -fi - -if is_overriding_api_base_url ; then - echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" - echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" - echo -e "running against your OpenAPI spec." - echo - echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" - echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" - echo - - exit 1 -else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" - echo -fi echo "==> Running tests" ./node_modules/.bin/jest "$@" diff --git a/src/client.ts b/src/client.ts index 2cc8776..0135bc0 100644 --- a/src/client.ts +++ b/src/client.ts @@ -534,7 +534,7 @@ export class Morphik { loggerFor(this).info(`${responseInfo} - ${retryMessage}`); const errText = await response.text().catch((err: any) => castToError(err).message); - const errJSON = safeJSON(errText); + const errJSON = safeJSON(errText) as any; const errMessage = errJSON ? undefined : errText; loggerFor(this).debug( @@ -575,9 +575,10 @@ export class Morphik { controller: AbortController, ): Promise { const { signal, method, ...options } = init || {}; - if (signal) signal.addEventListener('abort', () => controller.abort()); + const abort = this._makeAbort(controller); + if (signal) signal.addEventListener('abort', abort, { once: true }); - const timeout = setTimeout(() => controller.abort(), ms); + const timeout = setTimeout(abort, ms); const isReadableBody = ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || @@ -744,6 +745,12 @@ export class Morphik { return headers.values; } + private _makeAbort(controller: AbortController) { + // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure + // would capture all request options, and cause a memory leak. + return () => controller.abort(); + } + private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): { bodyHeaders: HeadersLike; body: BodyInit | undefined; @@ -776,6 +783,14 @@ export class Morphik { (Symbol.iterator in body && 'next' in body && typeof body.next === 'function')) ) { return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable) }; + } else if ( + typeof body === 'object' && + headers.values.get('content-type') === 'application/x-www-form-urlencoded' + ) { + return { + bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' }, + body: this.stringifyQuery(body as Record), + }; } else { return this.#encoder({ body, headers }); } diff --git a/src/internal/parse.ts b/src/internal/parse.ts index 7d779e9..c669569 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -29,6 +29,12 @@ export async function defaultParseResponse(client: Morphik, props: APIRespons const mediaType = contentType?.split(';')[0]?.trim(); const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json'); if (isJSON) { + const contentLength = response.headers.get('content-length'); + if (contentLength === '0') { + // if there is no content we can't do anything + return undefined as T; + } + const json = await response.json(); return json as T; } diff --git a/src/version.ts b/src/version.ts index d6d803f..96219a4 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '1.9.0'; // x-release-please-version +export const VERSION = '1.9.1'; // x-release-please-version diff --git a/tests/api-resources/api-keys.test.ts b/tests/api-resources/api-keys.test.ts index 54d1fed..6a5caf3 100644 --- a/tests/api-resources/api-keys.test.ts +++ b/tests/api-resources/api-keys.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource apiKeys', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.apiKeys.create({ api_key: 'api_key', provider: 'provider' }); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource apiKeys', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('create: required and optional params', async () => { const response = await client.apiKeys.create({ api_key: 'api_key', @@ -29,7 +29,7 @@ describe('resource apiKeys', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('list', async () => { const responsePromise = client.apiKeys.list(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/batch.test.ts b/tests/api-resources/batch.test.ts index e543e55..be84d4d 100644 --- a/tests/api-resources/batch.test.ts +++ b/tests/api-resources/batch.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource batch', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('retrieveChunks', async () => { const responsePromise = client.batch.retrieveChunks({}); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource batch', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('retrieveDocuments', async () => { const responsePromise = client.batch.retrieveDocuments({}); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/chat.test.ts b/tests/api-resources/chat.test.ts index a47f512..0ee5f55 100644 --- a/tests/api-resources/chat.test.ts +++ b/tests/api-resources/chat.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource chat', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('list', async () => { const responsePromise = client.chat.list(); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource chat', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect(client.chat.list({ limit: 1 }, { path: '/_stainless_unknown_path' })).rejects.toThrow( @@ -28,7 +28,7 @@ describe('resource chat', () => { ); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('retrieveHistory', async () => { const responsePromise = client.chat.retrieveHistory('chat_id'); const rawResponse = await responsePromise.asResponse(); @@ -40,7 +40,7 @@ describe('resource chat', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('updateTitle: only required params', async () => { const responsePromise = client.chat.updateTitle('chat_id', { title: 'title' }); const rawResponse = await responsePromise.asResponse(); @@ -52,7 +52,7 @@ describe('resource chat', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('updateTitle: required and optional params', async () => { const response = await client.chat.updateTitle('chat_id', { title: 'title' }); }); diff --git a/tests/api-resources/cloud.test.ts b/tests/api-resources/cloud.test.ts index 02a78dd..fc460ee 100644 --- a/tests/api-resources/cloud.test.ts +++ b/tests/api-resources/cloud.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource cloud', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('deleteApp: only required params', async () => { const responsePromise = client.cloud.deleteApp({ app_name: 'app_name' }); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource cloud', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('deleteApp: required and optional params', async () => { const response = await client.cloud.deleteApp({ app_name: 'app_name', @@ -28,7 +28,7 @@ describe('resource cloud', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('generateUri: only required params', async () => { const responsePromise = client.cloud.generateUri({ name: 'name' }); const rawResponse = await responsePromise.asResponse(); @@ -40,7 +40,7 @@ describe('resource cloud', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('generateUri: required and optional params', async () => { const response = await client.cloud.generateUri({ name: 'name', @@ -53,7 +53,7 @@ describe('resource cloud', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listApps', async () => { const responsePromise = client.cloud.listApps(); const rawResponse = await responsePromise.asResponse(); @@ -65,7 +65,7 @@ describe('resource cloud', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listApps: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -84,7 +84,7 @@ describe('resource cloud', () => { ).rejects.toThrow(Morphik.NotFoundError); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('renameApp: only required params', async () => { const responsePromise = client.cloud.renameApp({ new_name: 'new_name' }); const rawResponse = await responsePromise.asResponse(); @@ -96,7 +96,7 @@ describe('resource cloud', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('renameApp: required and optional params', async () => { const response = await client.cloud.renameApp({ new_name: 'new_name', @@ -106,7 +106,7 @@ describe('resource cloud', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('rotateAppToken', async () => { const responsePromise = client.cloud.rotateAppToken(); const rawResponse = await responsePromise.asResponse(); @@ -118,7 +118,7 @@ describe('resource cloud', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('rotateAppToken: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/documents.test.ts b/tests/api-resources/documents.test.ts index 1761d43..d32809f 100644 --- a/tests/api-resources/documents.test.ts +++ b/tests/api-resources/documents.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource documents', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('retrieve', async () => { const responsePromise = client.documents.retrieve('document_id'); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('list', async () => { const responsePromise = client.documents.list({}); const rawResponse = await responsePromise.asResponse(); @@ -32,7 +32,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('delete', async () => { const responsePromise = client.documents.delete('document_id'); const rawResponse = await responsePromise.asResponse(); @@ -44,7 +44,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('downloadFile', async () => { const responsePromise = client.documents.downloadFile('document_id'); const rawResponse = await responsePromise.asResponse(); @@ -56,7 +56,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getByFilename', async () => { const responsePromise = client.documents.getByFilename('filename'); const rawResponse = await responsePromise.asResponse(); @@ -68,7 +68,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getByFilename: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -84,7 +84,7 @@ describe('resource documents', () => { ).rejects.toThrow(Morphik.NotFoundError); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getDownloadURL', async () => { const responsePromise = client.documents.getDownloadURL('document_id'); const rawResponse = await responsePromise.asResponse(); @@ -96,7 +96,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getDownloadURL: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -104,7 +104,7 @@ describe('resource documents', () => { ).rejects.toThrow(Morphik.NotFoundError); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getStatus', async () => { const responsePromise = client.documents.getStatus('document_id'); const rawResponse = await responsePromise.asResponse(); @@ -116,7 +116,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getSummary', async () => { const responsePromise = client.documents.getSummary('document_id'); const rawResponse = await responsePromise.asResponse(); @@ -128,7 +128,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listDocs', async () => { const responsePromise = client.documents.listDocs({}); const rawResponse = await responsePromise.asResponse(); @@ -140,7 +140,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('pages: only required params', async () => { const responsePromise = client.documents.pages({ document_id: 'document_id', @@ -156,7 +156,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('pages: required and optional params', async () => { const response = await client.documents.pages({ document_id: 'document_id', @@ -166,7 +166,7 @@ describe('resource documents', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('updateFile: only required params', async () => { const responsePromise = client.documents.updateFile('document_id', { file: await toFile(Buffer.from('# my file contents'), 'README.md'), @@ -180,7 +180,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('updateFile: required and optional params', async () => { const response = await client.documents.updateFile('document_id', { file: await toFile(Buffer.from('# my file contents'), 'README.md'), @@ -190,7 +190,7 @@ describe('resource documents', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('updateMetadata', async () => { const responsePromise = client.documents.updateMetadata('document_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -202,7 +202,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('updateText: only required params', async () => { const responsePromise = client.documents.updateText('document_id', { content: 'content' }); const rawResponse = await responsePromise.asResponse(); @@ -214,7 +214,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('updateText: required and optional params', async () => { const response = await client.documents.updateText('document_id', { content: 'content', @@ -227,7 +227,7 @@ describe('resource documents', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('upsertSummary: only required params', async () => { const responsePromise = client.documents.upsertSummary('document_id', { content: 'content' }); const rawResponse = await responsePromise.asResponse(); @@ -239,7 +239,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('upsertSummary: required and optional params', async () => { const response = await client.documents.upsertSummary('document_id', { content: 'content', diff --git a/tests/api-resources/ee/connectors/auth.test.ts b/tests/api-resources/ee/connectors/auth.test.ts index 2c68a5e..6f8f705 100644 --- a/tests/api-resources/ee/connectors/auth.test.ts +++ b/tests/api-resources/ee/connectors/auth.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource auth', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('finalizeManualAuth: only required params', async () => { const responsePromise = client.ee.connectors.auth.finalizeManualAuth('connector_type', { credentials: { foo: 'bar' }, @@ -22,14 +22,14 @@ describe('resource auth', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('finalizeManualAuth: required and optional params', async () => { const response = await client.ee.connectors.auth.finalizeManualAuth('connector_type', { credentials: { foo: 'bar' }, }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getInitiateAuthURL', async () => { const responsePromise = client.ee.connectors.auth.getInitiateAuthURL('connector_type'); const rawResponse = await responsePromise.asResponse(); @@ -41,7 +41,7 @@ describe('resource auth', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getInitiateAuthURL: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/ee/connectors/connectors.test.ts b/tests/api-resources/ee/connectors/connectors.test.ts index e00531c..b383b65 100644 --- a/tests/api-resources/ee/connectors/connectors.test.ts +++ b/tests/api-resources/ee/connectors/connectors.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource connectors', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('disconnect: only required params', async () => { const responsePromise = client.ee.connectors.disconnect({ connector_type: 'connector_type' }); const rawResponse = await responsePromise.asResponse(); @@ -20,12 +20,12 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('disconnect: required and optional params', async () => { const response = await client.ee.connectors.disconnect({ connector_type: 'connector_type' }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('finalizeAuth: only required params', async () => { const responsePromise = client.ee.connectors.finalizeAuth({ auth_response_data: { foo: 'bar' }, @@ -40,7 +40,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('finalizeAuth: required and optional params', async () => { const response = await client.ee.connectors.finalizeAuth({ auth_response_data: { foo: 'bar' }, @@ -48,7 +48,7 @@ describe('resource connectors', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getAuthStatus', async () => { const responsePromise = client.ee.connectors.getAuthStatus('connector_type'); const rawResponse = await responsePromise.asResponse(); @@ -60,7 +60,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('handleOAuthCallback', async () => { const responsePromise = client.ee.connectors.handleOAuthCallback('connector_type'); const rawResponse = await responsePromise.asResponse(); @@ -72,7 +72,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('handleOAuthCallback: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -89,7 +89,7 @@ describe('resource connectors', () => { ).rejects.toThrow(Morphik.NotFoundError); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestFile: only required params', async () => { const responsePromise = client.ee.connectors.ingestFile('connector_type', { file_id: 'file_id' }); const rawResponse = await responsePromise.asResponse(); @@ -101,7 +101,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestFile: required and optional params', async () => { const response = await client.ee.connectors.ingestFile('connector_type', { file_id: 'file_id', @@ -110,7 +110,7 @@ describe('resource connectors', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestRepository: only required params', async () => { const responsePromise = client.ee.connectors.ingestRepository('connector_type', { repo_path: 'repo_path', @@ -124,7 +124,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestRepository: required and optional params', async () => { const response = await client.ee.connectors.ingestRepository('connector_type', { repo_path: 'repo_path', @@ -138,7 +138,7 @@ describe('resource connectors', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('initiateAuth: only required params', async () => { const responsePromise = client.ee.connectors.initiateAuth({ connector_type: 'connector_type' }); const rawResponse = await responsePromise.asResponse(); @@ -150,12 +150,12 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('initiateAuth: required and optional params', async () => { const response = await client.ee.connectors.initiateAuth({ connector_type: 'connector_type' }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listFiles', async () => { const responsePromise = client.ee.connectors.listFiles('connector_type'); const rawResponse = await responsePromise.asResponse(); @@ -167,7 +167,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listFiles: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -184,7 +184,7 @@ describe('resource connectors', () => { ).rejects.toThrow(Morphik.NotFoundError); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listFilesViaBody: only required params', async () => { const responsePromise = client.ee.connectors.listFilesViaBody({ connector_type: 'connector_type' }); const rawResponse = await responsePromise.asResponse(); @@ -196,7 +196,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listFilesViaBody: required and optional params', async () => { const response = await client.ee.connectors.listFilesViaBody({ connector_type: 'connector_type', @@ -205,7 +205,7 @@ describe('resource connectors', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('status: only required params', async () => { const responsePromise = client.ee.connectors.status({ connector_type: 'connector_type' }); const rawResponse = await responsePromise.asResponse(); @@ -217,7 +217,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('status: required and optional params', async () => { const response = await client.ee.connectors.status({ connector_type: 'connector_type' }); }); diff --git a/tests/api-resources/folders/documents.test.ts b/tests/api-resources/folders/documents.test.ts index 3d63d92..e7177f4 100644 --- a/tests/api-resources/folders/documents.test.ts +++ b/tests/api-resources/folders/documents.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource documents', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('add: only required params', async () => { const responsePromise = client.folders.documents.add('document_id', { folder_id_or_name: 'folder_id_or_name', @@ -22,14 +22,14 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('add: required and optional params', async () => { const response = await client.folders.documents.add('document_id', { folder_id_or_name: 'folder_id_or_name', }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('remove: only required params', async () => { const responsePromise = client.folders.documents.remove('document_id', { folder_id_or_name: 'folder_id_or_name', @@ -43,7 +43,7 @@ describe('resource documents', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('remove: required and optional params', async () => { const response = await client.folders.documents.remove('document_id', { folder_id_or_name: 'folder_id_or_name', diff --git a/tests/api-resources/folders/folders.test.ts b/tests/api-resources/folders/folders.test.ts index 30e9cf3..802e5da 100644 --- a/tests/api-resources/folders/folders.test.ts +++ b/tests/api-resources/folders/folders.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource folders', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.folders.create({ name: 'name' }); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('create: required and optional params', async () => { const response = await client.folders.create({ name: 'name', @@ -30,7 +30,7 @@ describe('resource folders', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('retrieve', async () => { const responsePromise = client.folders.retrieve('folder_id_or_name'); const rawResponse = await responsePromise.asResponse(); @@ -42,7 +42,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('list', async () => { const responsePromise = client.folders.list(); const rawResponse = await responsePromise.asResponse(); @@ -54,7 +54,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('delete', async () => { const responsePromise = client.folders.delete('folder_id_or_name'); const rawResponse = await responsePromise.asResponse(); @@ -66,7 +66,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('delete: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -74,7 +74,7 @@ describe('resource folders', () => { ).rejects.toThrow(Morphik.NotFoundError); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('details', async () => { const responsePromise = client.folders.details({}); const rawResponse = await responsePromise.asResponse(); @@ -86,7 +86,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('getSummary', async () => { const responsePromise = client.folders.getSummary('folder_id_or_name'); const rawResponse = await responsePromise.asResponse(); @@ -98,7 +98,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listSummaries', async () => { const responsePromise = client.folders.listSummaries(); const rawResponse = await responsePromise.asResponse(); @@ -110,7 +110,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('upsertSummary: only required params', async () => { const responsePromise = client.folders.upsertSummary('folder_id_or_name', { content: 'content' }); const rawResponse = await responsePromise.asResponse(); @@ -122,7 +122,7 @@ describe('resource folders', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('upsertSummary: required and optional params', async () => { const response = await client.folders.upsertSummary('folder_id_or_name', { content: 'content', diff --git a/tests/api-resources/ingest.test.ts b/tests/api-resources/ingest.test.ts index a13361b..7991aac 100644 --- a/tests/api-resources/ingest.test.ts +++ b/tests/api-resources/ingest.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource ingest', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('batchIngestFiles: only required params', async () => { const responsePromise = client.ingest.batchIngestFiles({ files: [await toFile(Buffer.from('# my file contents'), 'README.md')], @@ -22,7 +22,7 @@ describe('resource ingest', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('batchIngestFiles: required and optional params', async () => { const response = await client.ingest.batchIngestFiles({ files: [await toFile(Buffer.from('# my file contents'), 'README.md')], @@ -34,7 +34,7 @@ describe('resource ingest', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('documentQuery: only required params', async () => { const responsePromise = client.ingest.documentQuery({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), @@ -49,7 +49,7 @@ describe('resource ingest', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('documentQuery: required and optional params', async () => { const response = await client.ingest.documentQuery({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), @@ -59,7 +59,7 @@ describe('resource ingest', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestFile: only required params', async () => { const responsePromise = client.ingest.ingestFile({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), @@ -73,7 +73,7 @@ describe('resource ingest', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestFile: required and optional params', async () => { const response = await client.ingest.ingestFile({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), @@ -85,7 +85,7 @@ describe('resource ingest', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestText: only required params', async () => { const responsePromise = client.ingest.ingestText({ content: 'content' }); const rawResponse = await responsePromise.asResponse(); @@ -97,7 +97,7 @@ describe('resource ingest', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('ingestText: required and optional params', async () => { const response = await client.ingest.ingestText({ content: 'content', @@ -110,7 +110,7 @@ describe('resource ingest', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('requeue', async () => { const responsePromise = client.ingest.requeue({}); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/logs.test.ts b/tests/api-resources/logs.test.ts index af491b1..8544874 100644 --- a/tests/api-resources/logs.test.ts +++ b/tests/api-resources/logs.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource logs', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('list', async () => { const responsePromise = client.logs.list(); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource logs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/models.test.ts b/tests/api-resources/models.test.ts index 352aa8d..630fa6f 100644 --- a/tests/api-resources/models.test.ts +++ b/tests/api-resources/models.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource models', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.models.create({ config: { foo: 'bar' }, @@ -24,7 +24,7 @@ describe('resource models', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('create: required and optional params', async () => { const response = await client.models.create({ config: { foo: 'bar' }, @@ -33,7 +33,7 @@ describe('resource models', () => { }); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('list', async () => { const responsePromise = client.models.list(); const rawResponse = await responsePromise.asResponse(); @@ -45,7 +45,7 @@ describe('resource models', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('delete', async () => { const responsePromise = client.models.delete('model_id'); const rawResponse = await responsePromise.asResponse(); @@ -57,7 +57,7 @@ describe('resource models', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listAvailable', async () => { const responsePromise = client.models.listAvailable(); const rawResponse = await responsePromise.asResponse(); @@ -69,7 +69,7 @@ describe('resource models', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('listCustom', async () => { const responsePromise = client.models.listCustom(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/ping.test.ts b/tests/api-resources/ping.test.ts index 3896cb3..39e40fb 100644 --- a/tests/api-resources/ping.test.ts +++ b/tests/api-resources/ping.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource ping', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('check', async () => { const responsePromise = client.ping.check(); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource ping', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('status', async () => { const responsePromise = client.ping.status(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/query.test.ts b/tests/api-resources/query.test.ts index 2a5f365..2cab971 100644 --- a/tests/api-resources/query.test.ts +++ b/tests/api-resources/query.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource query', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('generateCompletion', async () => { const responsePromise = client.query.generateCompletion({}); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/retrieve/chunks.test.ts b/tests/api-resources/retrieve/chunks.test.ts index a416ad3..4d1fcb8 100644 --- a/tests/api-resources/retrieve/chunks.test.ts +++ b/tests/api-resources/retrieve/chunks.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource chunks', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('create', async () => { const responsePromise = client.retrieve.chunks.create({}); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource chunks', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('createGrouped', async () => { const responsePromise = client.retrieve.chunks.createGrouped({}); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/retrieve/retrieve.test.ts b/tests/api-resources/retrieve/retrieve.test.ts index ee00f2f..e801691 100644 --- a/tests/api-resources/retrieve/retrieve.test.ts +++ b/tests/api-resources/retrieve/retrieve.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource retrieve', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('createDocs', async () => { const responsePromise = client.retrieve.createDocs({}); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/search.test.ts b/tests/api-resources/search.test.ts index 51da190..7f96634 100644 --- a/tests/api-resources/search.test.ts +++ b/tests/api-resources/search.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource search', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('documents: only required params', async () => { const responsePromise = client.search.documents({ query: 'x' }); const rawResponse = await responsePromise.asResponse(); @@ -20,7 +20,7 @@ describe('resource search', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Prism tests are disabled + // Mock server tests are disabled test.skip('documents: required and optional params', async () => { const response = await client.search.documents({ query: 'x', diff --git a/tests/api-resources/usage.test.ts b/tests/api-resources/usage.test.ts index e4c007f..0676b90 100644 --- a/tests/api-resources/usage.test.ts +++ b/tests/api-resources/usage.test.ts @@ -8,7 +8,7 @@ const client = new Morphik({ }); describe('resource usage', () => { - // Prism tests are disabled + // Mock server tests are disabled test.skip('appStorageUsage', async () => { const responsePromise = client.usage.appStorageUsage(); const rawResponse = await responsePromise.asResponse();