diff --git a/.changeset/modern-forks-grab.md b/.changeset/modern-forks-grab.md new file mode 100644 index 000000000..4faf8a3d4 --- /dev/null +++ b/.changeset/modern-forks-grab.md @@ -0,0 +1,5 @@ +--- +"@osdk/client": patch +--- + +Fix URL for experimental method diff --git a/packages/client/src/__unstable/ConjureSupport.ts b/packages/client/src/__unstable/ConjureSupport.ts index 9e67eb723..a253eef99 100644 --- a/packages/client/src/__unstable/ConjureSupport.ts +++ b/packages/client/src/__unstable/ConjureSupport.ts @@ -74,7 +74,7 @@ export class MetadataClient { constructor(client: MinimalClient) { this.#client = client; - this.#ctx = makeConjureContext(client, "/ontology-metadata/api"); + this.#ctx = makeConjureContext(client, "ontology-metadata/api"); this.#client.ontologyProvider.getObjectDefinition; this.#logger = this.#client.logger?.child({ diff --git a/packages/client/src/__unstable/createBulkLinksAsyncIterFactory.ts b/packages/client/src/__unstable/createBulkLinksAsyncIterFactory.ts index a3e0f4001..780c31102 100644 --- a/packages/client/src/__unstable/createBulkLinksAsyncIterFactory.ts +++ b/packages/client/src/__unstable/createBulkLinksAsyncIterFactory.ts @@ -111,7 +111,7 @@ export function createBulkLinksAsyncIterFactory(ctx: MinimalClient) { const bulkLinksIter = pageRequestAsAsyncIter( getBulkLinksPage.bind( undefined, - makeConjureContext(ctx, "/object-set-service/api"), + makeConjureContext(ctx, "object-set-service/api"), ), getResults, applyPageToken, diff --git a/packages/client/src/createClient.test.ts b/packages/client/src/createClient.test.ts index c95452eb6..a0500a304 100644 --- a/packages/client/src/createClient.test.ts +++ b/packages/client/src/createClient.test.ts @@ -14,13 +14,16 @@ * limitations under the License. */ +import { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "@osdk/api/unstable"; import { Task } from "@osdk/client.test.ontology"; import * as SharedClientContext from "@osdk/shared.client.impl"; import { mockFetchResponse, MockOntology } from "@osdk/shared.test"; import type { MockedFunction } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import { metadataCacheClient } from "./__unstable/ConjureSupport.js"; import type { Client } from "./Client.js"; import { createClient } from "./createClient.js"; +import * as MakeConjureContext from "./ontology/makeConjureContext.js"; import { USER_AGENT } from "./util/UserAgent.js"; describe(createClient, () => { @@ -72,7 +75,7 @@ describe(createClient, () => { describe("check url formatting", () => { it("urls are correctly formatted", async () => { const spy = vi.spyOn(SharedClientContext, "createSharedClientContext"); - createClient( + const client = createClient( "https://mock.com", MockOntology.metadata.ontologyRid, async () => "Token", @@ -107,6 +110,23 @@ describe(createClient, () => { fetchFunction, ); expect(spy.mock.calls[3][0]).toBe("https://mock3.com/stuff/first/foo/"); + + const conjureContextSpy = vi.spyOn( + MakeConjureContext, + "makeConjureContext", + ); + + metadataCacheClient( + { + baseUrl: "https://mock4.com/", + ontologyProvider: { getObjectDefinition: async () => ({}) }, + } as any, + ); + + expect( + conjureContextSpy.mock.results[0].value["baseUrl"] + + conjureContextSpy.mock.results[0].value["servicePath"], + ).toBe("https://mock4.com/ontology-metadata/api"); }); }); });