@osdk/integration-testing 0.3.0 → 0.3.1-main-cde832a4faaad484ee77bfc194b10a2f9e62f867

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @osdk/integration-testing
2
2
 
3
+ ## 0.3.1-main-cde832a4faaad484ee77bfc194b10a2f9e62f867
4
+
5
+ ### Patch Changes
6
+
7
+ - cde832a: Warn instead of failing package installation when automatic Foundry CLI installation fails, and validate that it is installed when creating an integration client.
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  ### Minor Changes
@@ -17,11 +17,18 @@
17
17
  import fs from "node:fs/promises";
18
18
  import { createClient } from "@osdk/client";
19
19
  import { createMockClient } from "@osdk/unit-testing";
20
+ import invariant from "tiny-invariant";
20
21
  import { fetch as undiciFetch, Agent } from "undici";
22
+ import { checkFoundryCliVersion } from "./utils/foundry-cli.js";
21
23
 
22
24
  /** The definition kinds accepted by {@link Client}'s call signatures. */
23
25
 
24
26
  export async function createIntegrationClient(config) {
27
+ const foundryCli = await checkFoundryCliVersion();
28
+ !(foundryCli.type !== "not-found") ? process.env.NODE_ENV !== "production" ? invariant(false, "Foundry CLI must be installed before creating an integration client.") : invariant(false) : void 0;
29
+ return createIntegrationClientForRunningServer(config);
30
+ }
31
+ export async function createIntegrationClientForRunningServer(config) {
25
32
  const {
26
33
  baseUrl,
27
34
  metadata,
@@ -1 +1 @@
1
- {"version":3,"file":"createIntegrationClient.js","names":["fs","createClient","createMockClient","fetch","undiciFetch","Agent","createIntegrationClient","config","baseUrl","metadata","caCertPath","agent","connect","ca","readFile","rejectUnauthorized","realClient","ontology","rid","Promise","resolve","input","init","dispatcher","mockClient","client","Object","defineProperties","def","type","getOwnPropertyDescriptors","whenQuery","value","bind","undefined","clearStubs"],"sources":["createIntegrationClient.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\n\nimport type {\n ActionDefinition,\n InterfaceDefinition,\n ObjectTypeDefinition,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type { Experiment } from \"@osdk/api/unstable\";\nimport { createClient, type Client } from \"@osdk/client\";\nimport { createMockClient } from \"@osdk/unit-testing\";\nimport { fetch as undiciFetch, Agent } from \"undici\";\n\nimport type { IntegrationClient, IntegrationClientConfig } from \"./types.js\";\n\n/** The definition kinds accepted by {@link Client}'s call signatures. */\ntype ClientArg =\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition\n | QueryDefinition\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Experiment<any>;\n\nexport async function createIntegrationClient(\n config: IntegrationClientConfig,\n): Promise<IntegrationClient> {\n const { baseUrl, metadata, caCertPath } = config;\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n const realClient = createClient(\n baseUrl,\n metadata.ontology.rid,\n () => Promise.resolve(\"integration-client-token\"),\n {},\n fetchWithCert,\n );\n const mockClient = createMockClient();\n const clientInternal = ((def: ClientArg) => {\n switch (def.type) {\n case \"query\":\n return mockClient(def);\n case \"action\":\n return realClient(def);\n case \"interface\":\n return realClient(def);\n case \"object\":\n return realClient(def);\n case \"experiment\":\n default:\n return realClient(def);\n }\n }) as Client;\n const client = Object.defineProperties<IntegrationClient>(\n clientInternal as IntegrationClient,\n {\n ...Object.getOwnPropertyDescriptors(realClient),\n whenQuery: {\n value: mockClient.whenQuery.bind(undefined),\n },\n clearStubs: {\n value: mockClient.clearStubs.bind(undefined),\n },\n },\n );\n return client;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,kBAAkB;AASjC,SAASC,YAAY,QAAqB,cAAc;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,WAAW,EAAEC,KAAK,QAAQ,QAAQ;;AAIpD;;AASA,OAAO,eAAeC,uBAAuBA,CAC3CC,MAA+B,EACH;EAC5B,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,MAAMI,KAAK,GAAG,IAAIN,KAAK,CAAC;IACtBO,OAAO,EAAEF,UAAU,GACf;MACEG,EAAE,EAAE,MAAMb,EAAE,CAACc,QAAQ,CAACJ,UAAU;IAClC,CAAC,GACD;MACEK,kBAAkB,EAAE;IACtB;EACN,CAAC,CAAC;EAMF,MAAMC,UAAU,GAAGf,YAAY,CAC7BO,OAAO,EACPC,QAAQ,CAACQ,QAAQ,CAACC,GAAG,EACrB,MAAMC,OAAO,CAACC,OAAO,CAAC,0BAA0B,CAAC,EACjD,CAAC,CAAC,EATmB,CAACC,KAAK,EAAEC,IAAI,KACjClB,WAAW,CAACiB,KAAK,EAAE;IACjB,GAAGC,IAAI;IACPC,UAAU,EAAEZ;EACd,CAAC,CAOH,CAAC;EACD,MAAMa,UAAU,GAAGtB,gBAAgB,CAAC,CAAC;EAgBrC,MAAMuB,MAAM,GAAGC,MAAM,CAACC,gBAAgB,CAfbC,GAAc,IAAK;IAC1C,QAAQA,GAAG,CAACC,IAAI;MACd,KAAK,OAAO;QACV,OAAOL,UAAU,CAACI,GAAG,CAAC;MACxB,KAAK,QAAQ;QACX,OAAOZ,UAAU,CAACY,GAAG,CAAC;MACxB,KAAK,WAAW;QACd,OAAOZ,UAAU,CAACY,GAAG,CAAC;MACxB,KAAK,QAAQ;QACX,OAAOZ,UAAU,CAACY,GAAG,CAAC;MACxB,KAAK,YAAY;MACjB;QACE,OAAOZ,UAAU,CAACY,GAAG,CAAC;IAC1B;EACF,CAAC,EAGC;IACE,GAAGF,MAAM,CAACI,yBAAyB,CAACd,UAAU,CAAC;IAC/Ce,SAAS,EAAE;MACTC,KAAK,EAAER,UAAU,CAACO,SAAS,CAACE,IAAI,CAACC,SAAS;IAC5C,CAAC;IACDC,UAAU,EAAE;MACVH,KAAK,EAAER,UAAU,CAACW,UAAU,CAACF,IAAI,CAACC,SAAS;IAC7C;EACF,CACF,CAAC;EACD,OAAOT,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"createIntegrationClient.js","names":["fs","createClient","createMockClient","invariant","fetch","undiciFetch","Agent","checkFoundryCliVersion","createIntegrationClient","config","foundryCli","type","process","env","NODE_ENV","createIntegrationClientForRunningServer","baseUrl","metadata","caCertPath","agent","connect","ca","readFile","rejectUnauthorized","realClient","ontology","rid","Promise","resolve","input","init","dispatcher","mockClient","client","Object","defineProperties","def","getOwnPropertyDescriptors","whenQuery","value","bind","undefined","clearStubs"],"sources":["createIntegrationClient.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\n\nimport type {\n ActionDefinition,\n InterfaceDefinition,\n ObjectTypeDefinition,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type { Experiment } from \"@osdk/api/unstable\";\nimport { createClient, type Client } from \"@osdk/client\";\nimport { createMockClient } from \"@osdk/unit-testing\";\nimport invariant from \"tiny-invariant\";\nimport { fetch as undiciFetch, Agent } from \"undici\";\n\nimport type { IntegrationClient, IntegrationClientConfig } from \"./types.js\";\nimport { checkFoundryCliVersion } from \"./utils/foundry-cli.js\";\n\n/** The definition kinds accepted by {@link Client}'s call signatures. */\ntype ClientArg =\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition\n | QueryDefinition\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Experiment<any>;\n\nexport async function createIntegrationClient(\n config: IntegrationClientConfig,\n): Promise<IntegrationClient> {\n const foundryCli = await checkFoundryCliVersion();\n invariant(\n foundryCli.type !== \"not-found\",\n \"Foundry CLI must be installed before creating an integration client.\",\n );\n return createIntegrationClientForRunningServer(config);\n}\n\nexport async function createIntegrationClientForRunningServer(\n config: IntegrationClientConfig,\n): Promise<IntegrationClient> {\n const { baseUrl, metadata, caCertPath } = config;\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n const realClient = createClient(\n baseUrl,\n metadata.ontology.rid,\n () => Promise.resolve(\"integration-client-token\"),\n {},\n fetchWithCert,\n );\n const mockClient = createMockClient();\n const clientInternal = ((def: ClientArg) => {\n switch (def.type) {\n case \"query\":\n return mockClient(def);\n case \"action\":\n return realClient(def);\n case \"interface\":\n return realClient(def);\n case \"object\":\n return realClient(def);\n case \"experiment\":\n default:\n return realClient(def);\n }\n }) as Client;\n const client = Object.defineProperties<IntegrationClient>(\n clientInternal as IntegrationClient,\n {\n ...Object.getOwnPropertyDescriptors(realClient),\n whenQuery: {\n value: mockClient.whenQuery.bind(undefined),\n },\n clearStubs: {\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CAAC,CAOH,CAAC;EACD,MAAMa,UAAU,GAAG9B,gBAAgB,CAAC,CAAC;EAgBrC,MAAM+B,MAAM,GAAGC,MAAM,CAACC,gBAAgB,CAfbC,GAAc,IAAK;IAC1C,QAAQA,GAAG,CAACzB,IAAI;MACd,KAAK,OAAO;QACV,OAAOqB,UAAU,CAACI,GAAG,CAAC;MACxB,KAAK,QAAQ;QACX,OAAOZ,UAAU,CAACY,GAAG,CAAC;MACxB,KAAK,WAAW;QACd,OAAOZ,UAAU,CAACY,GAAG,CAAC;MACxB,KAAK,QAAQ;QACX,OAAOZ,UAAU,CAACY,GAAG,CAAC;MACxB,KAAK,YAAY;MACjB;QACE,OAAOZ,UAAU,CAACY,GAAG,CAAC;IAC1B;EACF,CAAC,EAGC;IACE,GAAGF,MAAM,CAACG,yBAAyB,CAACb,UAAU,CAAC;IAC/Cc,SAAS,EAAE;MACTC,KAAK,EAAEP,UAAU,CAACM,SAAS,CAACE,IAAI,CAACC,SAAS;IAC5C,CAAC;IACDC,UAAU,EAAE;MACVH,KAAK,EAAEP,UAAU,CAACU,UAAU,CAACF,IAAI,CAACC,SAAS;IAC7C;EACF,CACF,CAAC;EACD,OAAOR,MAAM;AACf","ignoreList":[]}
@@ -21,7 +21,7 @@ import invariant from "tiny-invariant";
21
21
  import { Agent, fetch as undiciFetch } from "undici";
22
22
  import { CliServiceLauncher } from "./cli-service/CliServiceLauncher.js";
23
23
  import { OntologyServer } from "./cli-service/OntologyServer.js";
24
- import { createIntegrationClient } from "./createIntegrationClient.js";
24
+ import { createIntegrationClientForRunningServer } from "./createIntegrationClient.js";
25
25
  import { createSeedClient } from "./createSeedClient.js";
26
26
  import { EMPTY_ONTOLOGY_BLOCK_DATA } from "./utils/empty-ontology-block.js";
27
27
  const transformMetadata = metadata => {
@@ -104,7 +104,7 @@ export async function createIntegrationServer(config) {
104
104
  if (client !== undefined) return client;
105
105
  const baseUrl = ontology.getUrl();
106
106
  !baseUrl ? process.env.NODE_ENV !== "production" ? invariant(false, "Ontology server is not ready") : invariant(false) : void 0;
107
- return client = await createIntegrationClient({
107
+ return client = await createIntegrationClientForRunningServer({
108
108
  baseUrl,
109
109
  metadata,
110
110
  caCertPath: ontology.getCaCertPath()
@@ -1 +1 @@
1
- {"version":3,"file":"createIntegrationServer.js","names":["fs","path","PreviewOntologyIrConverter","invariant","Agent","fetch","undiciFetch","CliServiceLauncher","OntologyServer","createIntegrationClient","createSeedClient","EMPTY_ONTOLOGY_BLOCK_DATA","transformMetadata","metadata","transformed","getPreviewFullMetadataFromBlockData","ontology","writeMetadata","args","metadataPath","previewMetadata","stringified","JSON","stringify","writeFile","createIntegrationServer","config","projectPath","process","cwd","foundryCliPath","testPath","mkdtemp","join","resolve","serviceLauncher","projectDir","register","client","seedClient","getOntologyUrl","getUrl","start","stop","rm","recursive","force","getSeedClient","undefined","baseUrl","env","NODE_ENV","caCertPath","getCaCertPath","agent","connect","ca","readFile","rejectUnauthorized","fetchFn","input","init","dispatcher","getClient"],"sources":["createIntegrationServer.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport type { PreviewOntologyFullMetadata } from \"@osdk/generator-converters.preview\";\nimport { PreviewOntologyIrConverter } from \"@osdk/generator-converters.preview\";\nimport invariant from \"tiny-invariant\";\nimport { Agent, fetch as undiciFetch } from \"undici\";\n\nimport { CliServiceLauncher } from \"./cli-service/CliServiceLauncher.js\";\nimport { OntologyServer } from \"./cli-service/OntologyServer.js\";\nimport { createIntegrationClient } from \"./createIntegrationClient.js\";\nimport { createSeedClient } from \"./createSeedClient.js\";\nimport type {\n IntegrationClient,\n IntegrationServer,\n IntegrationServerConfig,\n SeedClient,\n} from \"./types.js\";\nimport { EMPTY_ONTOLOGY_BLOCK_DATA } from \"./utils/empty-ontology-block.js\";\n\nconst transformMetadata = (\n metadata: OntologyFullMetadata,\n): PreviewOntologyFullMetadata => {\n const transformed =\n PreviewOntologyIrConverter.getPreviewFullMetadataFromBlockData(\n EMPTY_ONTOLOGY_BLOCK_DATA,\n metadata,\n );\n return {\n ...transformed,\n ontology: metadata.ontology,\n };\n};\n\nconst writeMetadata = async (args: {\n metadataPath: string;\n previewMetadata: PreviewOntologyFullMetadata;\n}) => {\n const { metadataPath, previewMetadata } = args;\n const stringified = JSON.stringify(previewMetadata);\n await fs.writeFile(metadataPath, stringified);\n};\nexport async function createIntegrationServer(\n config: IntegrationServerConfig,\n): Promise<IntegrationServer> {\n const { metadata, projectPath = process.cwd(), foundryCliPath } = config;\n\n const testPath = await fs.mkdtemp(path.join(projectPath, \".test-run-\"));\n const metadataPath = path.resolve(testPath, \"ontology-metadata.json\");\n const previewMetadata = transformMetadata(metadata);\n\n const serviceLauncher = new CliServiceLauncher({\n projectDir: testPath,\n foundryCliPath,\n });\n // write metadata to metadataPath for foundry cli to read from\n await writeMetadata({\n previewMetadata,\n metadataPath,\n });\n\n const ontology = serviceLauncher.register(\n new OntologyServer({\n projectPath: testPath,\n metadataPath,\n foundryCliPath,\n }),\n );\n\n // stateful cache of client and seed client\n let client: IntegrationClient | undefined;\n let seedClient: SeedClient | undefined;\n\n return {\n getOntologyUrl: () => ontology.getUrl(),\n start: async () => {\n await serviceLauncher.start();\n },\n stop: async () => {\n await serviceLauncher.stop();\n await fs.rm(testPath, { recursive: true, force: true });\n },\n getSeedClient: async () => {\n if (seedClient !== undefined) return seedClient;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n const caCertPath = ontology.getCaCertPath();\n invariant(caCertPath, \"Ontology server is not ready\");\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n return (seedClient = createSeedClient({\n baseUrl,\n metadata,\n fetchFn: fetchWithCert,\n }));\n },\n getClient: async () => {\n if (client !== undefined) return client;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n return (client = await createIntegrationClient({\n baseUrl,\n metadata,\n caCertPath: ontology.getCaCertPath(),\n }));\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,kBAAkB;AACjC,OAAOC,IAAI,MAAM,WAAW;AAI5B,SAASC,0BAA0B,QAAQ,oCAAoC;AAC/E,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,KAAK,EAAEC,KAAK,IAAIC,WAAW,QAAQ,QAAQ;AAEpD,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,gBAAgB,QAAQ,uBAAuB;AAOxD,SAASC,yBAAyB,QAAQ,iCAAiC;AAE3E,MAAMC,iBAAiB,GACrBC,QAA8B,IACE;EAChC,MAAMC,WAAW,GACfZ,0BAA0B,CAACa,mCAAmC,CAC5DJ,yBAAyB,EACzBE,QACF,CAAC;EACH,OAAO;IACL,GAAGC,WAAW;IACdE,QAAQ,EAAEH,QAAQ,CAACG;EACrB,CAAC;AACH,CAAC;AAED,MAAMC,aAAa,GAAG,MAAOC,IAG5B,IAAK;EACJ,MAAM;IAAEC,YAAY;IAAEC;EAAgB,CAA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uB,CAAC;QAC7CwC,OAAO;QACPpC,QAAQ;QACRuC,UAAU,EAAEpC,QAAQ,CAACqC,aAAa,CAAC;MACrC,CAAC,CAAC;IACJ;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"createIntegrationServer.js","names":["fs","path","PreviewOntologyIrConverter","invariant","Agent","fetch","undiciFetch","CliServiceLauncher","OntologyServer","createIntegrationClientForRunningServer","createSeedClient","EMPTY_ONTOLOGY_BLOCK_DATA","transformMetadata","metadata","transformed","getPreviewFullMetadataFromBlockData","ontology","writeMetadata","args","metadataPath","previewMetadata","stringified","JSON","stringify","writeFile","createIntegrationServer","config","projectPath","process","cwd","foundryCliPath","testPath","mkdtemp","join","resolve","serviceLauncher","projectDir","register","client","seedClient","getOntologyUrl","getUrl","start","stop","rm","recursive","force","getSeedClient","undefined","baseUrl","env","NODE_ENV","caCertPath","getCaCertPath","agent","connect","ca","readFile","rejectUnauthorized","fetchFn","input","init","dispatcher","getClient"],"sources":["createIntegrationServer.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport type { PreviewOntologyFullMetadata } from \"@osdk/generator-converters.preview\";\nimport { PreviewOntologyIrConverter } from \"@osdk/generator-converters.preview\";\nimport invariant from \"tiny-invariant\";\nimport { Agent, fetch as undiciFetch } from \"undici\";\n\nimport { CliServiceLauncher } from \"./cli-service/CliServiceLauncher.js\";\nimport { OntologyServer } from \"./cli-service/OntologyServer.js\";\nimport { createIntegrationClientForRunningServer } from \"./createIntegrationClient.js\";\nimport { createSeedClient } from \"./createSeedClient.js\";\nimport type {\n IntegrationClient,\n IntegrationServer,\n IntegrationServerConfig,\n SeedClient,\n} from \"./types.js\";\nimport { EMPTY_ONTOLOGY_BLOCK_DATA } from \"./utils/empty-ontology-block.js\";\n\nconst transformMetadata = (\n metadata: OntologyFullMetadata,\n): PreviewOntologyFullMetadata => {\n const transformed =\n PreviewOntologyIrConverter.getPreviewFullMetadataFromBlockData(\n EMPTY_ONTOLOGY_BLOCK_DATA,\n metadata,\n );\n return {\n ...transformed,\n ontology: metadata.ontology,\n };\n};\n\nconst writeMetadata = async (args: {\n metadataPath: string;\n previewMetadata: PreviewOntologyFullMetadata;\n}) => {\n const { metadataPath, previewMetadata } = args;\n const stringified = JSON.stringify(previewMetadata);\n await fs.writeFile(metadataPath, stringified);\n};\nexport async function createIntegrationServer(\n config: IntegrationServerConfig,\n): Promise<IntegrationServer> {\n const { metadata, projectPath = process.cwd(), foundryCliPath } = config;\n\n const testPath = await fs.mkdtemp(path.join(projectPath, \".test-run-\"));\n const metadataPath = path.resolve(testPath, \"ontology-metadata.json\");\n const previewMetadata = transformMetadata(metadata);\n\n const serviceLauncher = new CliServiceLauncher({\n projectDir: testPath,\n foundryCliPath,\n });\n // write metadata to metadataPath for foundry cli to read from\n await writeMetadata({\n previewMetadata,\n metadataPath,\n });\n\n const ontology = serviceLauncher.register(\n new OntologyServer({\n projectPath: testPath,\n metadataPath,\n foundryCliPath,\n }),\n );\n\n // stateful cache of client and seed client\n let client: IntegrationClient | undefined;\n let seedClient: SeedClient | undefined;\n\n return {\n getOntologyUrl: () => ontology.getUrl(),\n start: async () => {\n await serviceLauncher.start();\n },\n stop: async () => {\n await serviceLauncher.stop();\n await fs.rm(testPath, { recursive: true, force: true });\n },\n getSeedClient: async () => {\n if (seedClient !== undefined) return seedClient;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n const caCertPath = ontology.getCaCertPath();\n invariant(caCertPath, \"Ontology server is not ready\");\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n return (seedClient = createSeedClient({\n baseUrl,\n metadata,\n fetchFn: fetchWithCert,\n }));\n },\n getClient: async () => {\n if (client !== undefined) return client;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n return (client = await createIntegrationClientForRunningServer({\n baseUrl,\n metadata,\n caCertPath: ontology.getCaCertPath(),\n }));\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,kBAAkB;AACjC,OAAOC,IAAI,MAAM,WAAW;AAI5B,SAASC,0BAA0B,QAAQ,oCAAoC;AAC/E,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,KAAK,EAAEC,KAAK,IAAIC,WAAW,QAAQ,QAAQ;AAEpD,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,uCAAuC,QAAQ,8BAA8B;AACtF,SAASC,gBAAgB,QAAQ,uBAAuB;AAOxD,SAASC,yBAAyB,QAAQ,iCAAiC;AAE3E,MAAMC,iBAAiB,GACrBC,QAA8B,IACE;EAChC,MAAMC,WAAW,GACfZ,0BAA0B,CAACa,mCAAmC,CAC5DJ,yBAAyB,EACzBE,QACF,CAAC;EACH,OAAO;IACL,GAAGC,WAAW;IACdE,QAAQ,EAAEH,QAAQ,CAACG;EACrB,CAAC;AACH,CAAC;AAED,MAAMC,aAAa,GAAG,MAAOC,IAG5B,IAAK;EACJ,MAAM;IAAEC,YAAY;IAAEC;EAAg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,uCAAuC,CAAC;QAC7DwC,OAAO;QACPpC,QAAQ;QACRuC,UAAU,EAAEpC,QAAQ,CAACqC,aAAa,CAAC;MACrC,CAAC,CAAC;IACJ;EACF,CAAC;AACH","ignoreList":[]}
@@ -38,7 +38,11 @@ export const postinstall = async () => {
38
38
  return;
39
39
  case "not-found":
40
40
  consola.info(`Foundry CLI not found locally, attempting to install...`);
41
- await installFoundryCli();
41
+ try {
42
+ await installFoundryCli();
43
+ } catch (error) {
44
+ consola.warn(`Failed to install Foundry CLI. It must be installed before creating an integration client.`, error);
45
+ }
42
46
  }
43
47
  };
44
48
  //# sourceMappingURL=postinstall.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postinstall.js","names":["consola","invariant","checkFoundryCliVersion","MIN_FOUNDRY_CLI_VERSION","installFoundryCli","readGitRemoteUrl","postinstall","remote","info","result","type","version","warn","process","env","NODE_ENV"],"sources":["postinstall.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport consola from \"consola\";\nimport invariant from \"tiny-invariant\";\n\nimport {\n checkFoundryCliVersion,\n MIN_FOUNDRY_CLI_VERSION,\n} from \"../utils/foundry-cli.js\";\nimport { installFoundryCli } from \"./download.js\";\nimport { readGitRemoteUrl } from \"./gitRemote.js\";\n\nexport const postinstall = async (): Promise<void> => {\n const remote = await readGitRemoteUrl();\n if (\n remote === \"git@github.com:palantir/osdk-ts.git\" ||\n remote === \"https://github.com/palantir/osdk-ts.git\"\n ) {\n consola.info(`✅ In osdk-ts repo, skipping installation.`);\n return;\n }\n const result = await checkFoundryCliVersion();\n switch (result.type) {\n case \"installed\":\n consola.info(\n `✅ Foundry CLI (v${result.version}) is installed already, skipping installation.`,\n );\n return;\n case \"version-error\":\n consola.warn(\n `Foundry CLI is installed, but we could not probe its version.`,\n );\n return;\n case \"version-incompatible\":\n invariant(\n false,\n `Foundry CLI (v${result.version}) is installed already, but the minimum required version is ${MIN_FOUNDRY_CLI_VERSION}. Please run \"foundry update self\" to update foundry cli.`,\n );\n return;\n case \"not-found\":\n consola.info(`Foundry CLI not found locally, attempting to install...`);\n await installFoundryCli();\n return;\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,OAAO,MAAM,SAAS;AAC7B,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,gBAAgB,QAAQ,gBAAgB;AAEjD,OAAO,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAA2B;EACpD,MAAMC,MAAM,GAAG,MAAMF,gBAAgB,CAAC,CAAC;EACvC,IACEE,MAAM,KAAK,qCAAqC,IAChDA,MAAM,KAAK,yCAAyC,EACpD;IACAP,OAAO,CAACQ,IAAI,CAAC,2CAA2C,CAAC;IACzD;EACF;EACA,MAAMC,MAAM,GAAG,MAAMP,sBAAsB,CAAC,CAAC;EAC7C,QAAQO,MAAM,CAACC,IAAI;IACjB,KAAK,WAAW;MACdV,OAAO,CAACQ,IAAI,CACV,mBAAmBC,MAAM,CAACE,OAAO,gDACnC,CAAC;MACD;IACF,KAAK,eAAe;MAClBX,OAAO,CAACY,IAAI,CACV,+DACF,CAAC;MACD;IACF,KAAK,sBAAsB;MACzBC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAd,SAAS,QAEP,iBAAiBQ,MAAM,CAACE,OAAO,+DAA+DR,uBAAuB,2DAA2D,IAFlLF,SAAS;MAIT;IACF,KAAK,WAAW;MACdD,OAAO,CAACQ,IAAI,CAAC,yDAAyD,CAAC;MACvE,MAAMJ,iBAAiB,CAAC,CAAC;EAE7B;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"postinstall.js","names":["consola","invariant","checkFoundryCliVersion","MIN_FOUNDRY_CLI_VERSION","installFoundryCli","readGitRemoteUrl","postinstall","remote","info","result","type","version","warn","process","env","NODE_ENV","error"],"sources":["postinstall.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport consola from \"consola\";\nimport invariant from \"tiny-invariant\";\n\nimport {\n checkFoundryCliVersion,\n MIN_FOUNDRY_CLI_VERSION,\n} from \"../utils/foundry-cli.js\";\nimport { installFoundryCli } from \"./download.js\";\nimport { readGitRemoteUrl } from \"./gitRemote.js\";\n\nexport const postinstall = async (): Promise<void> => {\n const remote = await readGitRemoteUrl();\n if (\n remote === \"git@github.com:palantir/osdk-ts.git\" ||\n remote === \"https://github.com/palantir/osdk-ts.git\"\n ) {\n consola.info(`✅ In osdk-ts repo, skipping installation.`);\n return;\n }\n const result = await checkFoundryCliVersion();\n switch (result.type) {\n case \"installed\":\n consola.info(\n `✅ Foundry CLI (v${result.version}) is installed already, skipping installation.`,\n );\n return;\n case \"version-error\":\n consola.warn(\n `Foundry CLI is installed, but we could not probe its version.`,\n );\n return;\n case \"version-incompatible\":\n invariant(\n false,\n `Foundry CLI (v${result.version}) is installed already, but the minimum required version is ${MIN_FOUNDRY_CLI_VERSION}. Please run \"foundry update self\" to update foundry cli.`,\n );\n return;\n case \"not-found\":\n consola.info(`Foundry CLI not found locally, attempting to install...`);\n try {\n await installFoundryCli();\n } catch (error) {\n consola.warn(\n `Failed to install Foundry CLI. It must be installed before creating an integration client.`,\n error,\n );\n }\n return;\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,OAAO,MAAM,SAAS;AAC7B,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,gBAAgB,QAAQ,gBAAgB;AAEjD,OAAO,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAA2B;EACpD,MAAMC,MAAM,GAAG,MAAMF,gBAAgB,CAAC,CAAC;EACvC,IACEE,MAAM,KAAK,qCAAqC,IAChDA,MAAM,KAAK,yCAAyC,EACpD;IACAP,OAAO,CAACQ,IAAI,CAAC,2CAA2C,CAAC;IACzD;EACF;EACA,MAAMC,MAAM,GAAG,MAAMP,sBAAsB,CAAC,CAAC;EAC7C,QAAQO,MAAM,CAACC,IAAI;IACjB,KAAK,WAAW;MACdV,OAAO,CAACQ,IAAI,CACV,mBAAmBC,MAAM,CAACE,OAAO,gDACnC,CAAC;MACD;IACF,KAAK,eAAe;MAClBX,OAAO,CAACY,IAAI,CACV,+DACF,CAAC;MACD;IACF,KAAK,sBAAsB;MACzBC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAd,SAAS,QAEP,iBAAiBQ,MAAM,CAACE,OAAO,+DAA+DR,uBAAuB,2DAA2D,IAFlLF,SAAS;MAIT;IACF,KAAK,WAAW;MACdD,OAAO,CAACQ,IAAI,CAAC,yDAAyD,CAAC;MACvE,IAAI;QACF,MAAMJ,iBAAiB,CAAC,CAAC;MAC3B,CAAC,CAAC,OAAOY,KAAK,EAAE;QACdhB,OAAO,CAACY,IAAI,CACV,4FAA4F,EAC5FI,KACF,CAAC;MACH;EAEJ;AACF,CAAC","ignoreList":[]}
@@ -14,16 +14,16 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { exec } from "node:child_process";
17
+ import { execFile } from "node:child_process";
18
18
  import { promisify } from "node:util";
19
19
  import { gte, valid } from "semver";
20
20
  export const MIN_FOUNDRY_CLI_VERSION = "0.224.0";
21
21
  const FOUNDRY_VERSION_PATTERN = /cli (\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)/u;
22
22
  const parseFoundryVersion = stdout => stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];
23
23
  const versionIsAtMinimum = (version, min) => valid(version) != null && valid(min) != null && gte(version, min);
24
- const execAsync = promisify(exec);
24
+ const execFileAsync = promisify(execFile);
25
25
  export const checkFoundryCliVersion = () => {
26
- return execAsync("which foundry").then(() => execAsync("foundry --version")).then(({
26
+ return execFileAsync("foundry", ["--version"]).then(({
27
27
  stdout
28
28
  }) => {
29
29
  const version = parseFoundryVersion(stdout);
@@ -1 +1 @@
1
- {"version":3,"file":"foundry-cli.js","names":["exec","promisify","gte","valid","MIN_FOUNDRY_CLI_VERSION","FOUNDRY_VERSION_PATTERN","parseFoundryVersion","stdout","trim","match","versionIsAtMinimum","version","min","execAsync","checkFoundryCliVersion","then","type","isMin","catch"],"sources":["foundry-cli.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nimport { gte, valid } from \"semver\";\n\nexport const MIN_FOUNDRY_CLI_VERSION = \"0.224.0\";\n\nconst FOUNDRY_VERSION_PATTERN =\n /cli (\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)/u;\n\nexport type FoundryProbeResult =\n | {\n type: \"installed\";\n version: string;\n }\n | {\n type: \"version-incompatible\";\n version: string;\n }\n | {\n type: \"version-error\";\n }\n | {\n type: \"not-found\";\n };\n\nconst parseFoundryVersion = (stdout: string): string | undefined =>\n stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];\n\nconst versionIsAtMinimum = (version: string, min: string): boolean =>\n valid(version) != null && valid(min) != null && gte(version, min);\n\nconst execAsync = promisify(exec);\n\nexport const checkFoundryCliVersion = (): Promise<FoundryProbeResult> => {\n return execAsync(\"which foundry\")\n .then(() => execAsync(\"foundry --version\"))\n .then<FoundryProbeResult>(({ stdout }) => {\n const version = parseFoundryVersion(stdout);\n if (!version) return { type: \"version-error\" };\n const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);\n if (!isMin) return { type: \"version-incompatible\", version };\n return { type: \"installed\", version };\n })\n .catch<FoundryProbeResult>(() => ({ type: \"not-found\" }));\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,oBAAoB;AACzC,SAASC,SAAS,QAAQ,WAAW;AAErC,SAASC,GAAG,EAAEC,KAAK,QAAQ,QAAQ;AAEnC,OAAO,MAAMC,uBAAuB,GAAG,SAAS;AAEhD,MAAMC,uBAAuB,GAC3B,+DAA+D;AAkBjE,MAAMC,mBAAmB,GAAIC,MAAc,IACzCA,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAACJ,uBAAuB,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAMK,kBAAkB,GAAGA,CAACC,OAAe,EAAEC,GAAW,KACtDT,KAAK,CAACQ,OAAO,CAAC,IAAI,IAAI,IAAIR,KAAK,CAACS,GAAG,CAAC,IAAI,IAAI,IAAIV,GAAG,CAACS,OAAO,EAAEC,GAAG,CAAC;AAEnE,MAAMC,SAAS,GAAGZ,SAAS,CAACD,IAAI,CAAC;AAEjC,OAAO,MAAMc,sBAAsB,GAAGA,CAAA,KAAmC;EACvE,OAAOD,SAAS,CAAC,eAAe,CAAC,CAC9BE,IAAI,CAAC,MAAMF,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAC1CE,IAAI,CAAqB,CAAC;IAAER;EAAO,CAAC,KAAK;IACxC,MAAMI,OAAO,GAAGL,mBAAmB,CAACC,MAAM,CAAC;IAC3C,IAAI,CAACI,OAAO,EAAE,OAAO;MAAEK,IAAI,EAAE;IAAgB,CAAC;IAC9C,MAAMC,KAAK,GAAGP,kBAAkB,CAACC,OAAO,EAAEP,uBAAuB,CAAC;IAClE,IAAI,CAACa,KAAK,EAAE,OAAO;MAAED,IAAI,EAAE,sBAAsB;MAAEL;IAAQ,CAAC;IAC5D,OAAO;MAAEK,IAAI,EAAE,WAAW;MAAEL;IAAQ,CAAC;EACvC,CAAC,CAAC,CACDO,KAAK,CAAqB,OAAO;IAAEF,IAAI,EAAE;EAAY,CAAC,CAAC,CAAC;AAC7D,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"foundry-cli.js","names":["execFile","promisify","gte","valid","MIN_FOUNDRY_CLI_VERSION","FOUNDRY_VERSION_PATTERN","parseFoundryVersion","stdout","trim","match","versionIsAtMinimum","version","min","execFileAsync","checkFoundryCliVersion","then","type","isMin","catch"],"sources":["foundry-cli.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nimport { gte, valid } from \"semver\";\n\nexport const MIN_FOUNDRY_CLI_VERSION = \"0.224.0\";\n\nconst FOUNDRY_VERSION_PATTERN =\n /cli (\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)/u;\n\nexport type FoundryProbeResult =\n | {\n type: \"installed\";\n version: string;\n }\n | {\n type: \"version-incompatible\";\n version: string;\n }\n | {\n type: \"version-error\";\n }\n | {\n type: \"not-found\";\n };\n\nconst parseFoundryVersion = (stdout: string): string | undefined =>\n stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];\n\nconst versionIsAtMinimum = (version: string, min: string): boolean =>\n valid(version) != null && valid(min) != null && gte(version, min);\n\nconst execFileAsync = promisify(execFile);\n\nexport const checkFoundryCliVersion = (): Promise<FoundryProbeResult> => {\n return execFileAsync(\"foundry\", [\"--version\"])\n .then<FoundryProbeResult>(({ stdout }) => {\n const version = parseFoundryVersion(stdout);\n if (!version) return { type: \"version-error\" };\n const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);\n if (!isMin) return { type: \"version-incompatible\", version };\n return { type: \"installed\", version };\n })\n .catch<FoundryProbeResult>(() => ({ type: \"not-found\" }));\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,QAAQ,WAAW;AAErC,SAASC,GAAG,EAAEC,KAAK,QAAQ,QAAQ;AAEnC,OAAO,MAAMC,uBAAuB,GAAG,SAAS;AAEhD,MAAMC,uBAAuB,GAC3B,+DAA+D;AAkBjE,MAAMC,mBAAmB,GAAIC,MAAc,IACzCA,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAACJ,uBAAuB,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAMK,kBAAkB,GAAGA,CAACC,OAAe,EAAEC,GAAW,KACtDT,KAAK,CAACQ,OAAO,CAAC,IAAI,IAAI,IAAIR,KAAK,CAACS,GAAG,CAAC,IAAI,IAAI,IAAIV,GAAG,CAACS,OAAO,EAAEC,GAAG,CAAC;AAEnE,MAAMC,aAAa,GAAGZ,SAAS,CAACD,QAAQ,CAAC;AAEzC,OAAO,MAAMc,sBAAsB,GAAGA,CAAA,KAAmC;EACvE,OAAOD,aAAa,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,CAAC,CAC3CE,IAAI,CAAqB,CAAC;IAAER;EAAO,CAAC,KAAK;IACxC,MAAMI,OAAO,GAAGL,mBAAmB,CAACC,MAAM,CAAC;IAC3C,IAAI,CAACI,OAAO,EAAE,OAAO;MAAEK,IAAI,EAAE;IAAgB,CAAC;IAC9C,MAAMC,KAAK,GAAGP,kBAAkB,CAACC,OAAO,EAAEP,uBAAuB,CAAC;IAClE,IAAI,CAACa,KAAK,EAAE,OAAO;MAAED,IAAI,EAAE,sBAAsB;MAAEL;IAAQ,CAAC;IAC5D,OAAO;MAAEK,IAAI,EAAE,WAAW;MAAEL;IAAQ,CAAC;EACvC,CAAC,CAAC,CACDO,KAAK,CAAqB,OAAO;IAAEF,IAAI,EAAE;EAAY,CAAC,CAAC,CAAC;AAC7D,CAAC","ignoreList":[]}
@@ -3,17 +3,17 @@
3
3
  var fs3 = require('fs/promises');
4
4
  var client = require('@osdk/client');
5
5
  var unitTesting = require('@osdk/unit-testing');
6
+ var invariant5 = require('tiny-invariant');
6
7
  var undici = require('undici');
8
+ var child_process = require('child_process');
9
+ var util = require('util');
10
+ var semver = require('semver');
7
11
  var path4 = require('path');
8
12
  var generatorConverters_preview = require('@osdk/generator-converters.preview');
9
- var invariant4 = require('tiny-invariant');
10
13
  var promises = require('timers/promises');
11
- var child_process = require('child_process');
12
14
  var events = require('events');
13
15
  var conjureLite = require('conjure-lite');
14
16
  var seedHelpers = require('@osdk/seed-helpers');
15
- var util = require('util');
16
- var semver = require('semver');
17
17
 
18
18
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
19
 
@@ -36,15 +36,48 @@ function _interopNamespace(e) {
36
36
  }
37
37
 
38
38
  var fs3__namespace = /*#__PURE__*/_interopNamespace(fs3);
39
+ var invariant5__default = /*#__PURE__*/_interopDefault(invariant5);
39
40
  var path4__default = /*#__PURE__*/_interopDefault(path4);
40
- var invariant4__default = /*#__PURE__*/_interopDefault(invariant4);
41
41
 
42
42
  var __defProp = Object.defineProperty;
43
43
  var __export = (target, all) => {
44
44
  for (var name in all)
45
45
  __defProp(target, name, { get: all[name], enumerable: true });
46
46
  };
47
+ var MIN_FOUNDRY_CLI_VERSION = "0.224.0";
48
+ var FOUNDRY_VERSION_PATTERN = /cli (\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)/u;
49
+ var parseFoundryVersion = (stdout) => stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];
50
+ var versionIsAtMinimum = (version, min) => semver.valid(version) != null && semver.valid(min) != null && semver.gte(version, min);
51
+ var execFileAsync = util.promisify(child_process.execFile);
52
+ var checkFoundryCliVersion = () => {
53
+ return execFileAsync("foundry", ["--version"]).then(({
54
+ stdout
55
+ }) => {
56
+ const version = parseFoundryVersion(stdout);
57
+ if (!version) return {
58
+ type: "version-error"
59
+ };
60
+ const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);
61
+ if (!isMin) return {
62
+ type: "version-incompatible",
63
+ version
64
+ };
65
+ return {
66
+ type: "installed",
67
+ version
68
+ };
69
+ }).catch(() => ({
70
+ type: "not-found"
71
+ }));
72
+ };
73
+
74
+ // src/createIntegrationClient.ts
47
75
  async function createIntegrationClient(config) {
76
+ const foundryCli = await checkFoundryCliVersion();
77
+ !(foundryCli.type !== "not-found") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Foundry CLI must be installed before creating an integration client.") : invariant5__default.default(false) : void 0;
78
+ return createIntegrationClientForRunningServer(config);
79
+ }
80
+ async function createIntegrationClientForRunningServer(config) {
48
81
  const {
49
82
  baseUrl,
50
83
  metadata,
@@ -130,7 +163,7 @@ var FoundryCliService = class {
130
163
  }
131
164
  getContext() {
132
165
  const context = this.#context;
133
- !(context !== void 0) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `${this.name} is not registered with a CliServiceLauncher, so it has no discoverer or status server to consult`) : invariant4__default.default(false) : void 0;
166
+ !(context !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `${this.name} is not registered with a CliServiceLauncher, so it has no discoverer or status server to consult`) : invariant5__default.default(false) : void 0;
134
167
  return context;
135
168
  }
136
169
  attach(context) {
@@ -141,7 +174,7 @@ var FoundryCliService = class {
141
174
  return;
142
175
  }
143
176
  await this.getContext().discoverer.refresh();
144
- !!(await this.checkHealth()).ready ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `${this.name} is already running; stop it before starting a new one`) : invariant4__default.default(false) : void 0;
177
+ !!(await this.checkHealth()).ready ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `${this.name} is already running; stop it before starting a new one`) : invariant5__default.default(false) : void 0;
145
178
  await this.#spawn();
146
179
  }
147
180
  async #spawn() {
@@ -314,7 +347,7 @@ var ServiceDiscoverer = class {
314
347
  } catch {
315
348
  return void 0;
316
349
  }
317
- !parsed.url ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Service URL not found`) : invariant4__default.default(false) : void 0;
350
+ !parsed.url ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Service URL not found`) : invariant5__default.default(false) : void 0;
318
351
  this.#discovered.set(serviceName, parsed);
319
352
  return parsed;
320
353
  }
@@ -391,7 +424,7 @@ var StatusServer = class extends FoundryCliService {
391
424
  */
392
425
  async getServiceStatuses() {
393
426
  const baseUrl = this.getContext().discoverer.get("STATUS_SERVER")?.url;
394
- !baseUrl ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Cannot get service status because the status server is not discovered yet") : invariant4__default.default(false) : void 0;
427
+ !baseUrl ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Cannot get service status because the status server is not discovered yet") : invariant5__default.default(false) : void 0;
395
428
  this.#inFlight ??= StatusService_exports.getStatus({
396
429
  baseUrl,
397
430
  servicePath: ""
@@ -440,7 +473,7 @@ var CliServiceLauncher = class {
440
473
  if (existing === service) {
441
474
  return service;
442
475
  }
443
- !(existing === void 0) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `A different ${service.name} service is already registered`) : invariant4__default.default(false) : void 0;
476
+ !(existing === void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `A different ${service.name} service is already registered`) : invariant5__default.default(false) : void 0;
444
477
  this.#services.set(service.name, service);
445
478
  service.attach({
446
479
  discoverer: this.#discoverer,
@@ -509,9 +542,9 @@ var CliServiceLauncher = class {
509
542
  while (!health.ready) {
510
543
  const current = health;
511
544
  const notReady = () => `${service.name} is not ready (${current.state})${formatError(service, current)}`;
512
- !!current.terminal ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, notReady) : invariant4__default.default(false) : void 0;
513
- !(service.getExitInfo() === void 0) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, notReady) : invariant4__default.default(false) : void 0;
514
- !(Date.now() < deadline) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, () => `${service.name} is not ready (${current.state}) within ${DEFAULT_READY_TIMEOUT_MS}ms${formatError(service, current)}`) : invariant4__default.default(false) : void 0;
545
+ !!current.terminal ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, notReady) : invariant5__default.default(false) : void 0;
546
+ !(service.getExitInfo() === void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, notReady) : invariant5__default.default(false) : void 0;
547
+ !(Date.now() < deadline) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, () => `${service.name} is not ready (${current.state}) within ${DEFAULT_READY_TIMEOUT_MS}ms${formatError(service, current)}`) : invariant5__default.default(false) : void 0;
515
548
  await promises.setTimeout(HEALTH_POLL_INTERVAL_MS);
516
549
  await this.#discoverer.refresh();
517
550
  health = await service.checkHealth();
@@ -573,7 +606,7 @@ var CliServiceLauncher = class {
573
606
  return;
574
607
  }
575
608
  const cycleStart = walkedPath.indexOf(service.name);
576
- !(cycleStart === -1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, () => `Dependency cycle between services: ${[...walkedPath.slice(cycleStart), service.name].join(" -> ")}`) : invariant4__default.default(false) : void 0;
609
+ !(cycleStart === -1) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, () => `Dependency cycle between services: ${[...walkedPath.slice(cycleStart), service.name].join(" -> ")}`) : invariant5__default.default(false) : void 0;
577
610
  for (const dependency of this.#prerequisites(service)) {
578
611
  visit(dependency, [...walkedPath, service.name]);
579
612
  }
@@ -777,9 +810,9 @@ async function createIntegrationServer(config) {
777
810
  getSeedClient: async () => {
778
811
  if (seedClient !== void 0) return seedClient;
779
812
  const baseUrl = ontology.getUrl();
780
- !baseUrl ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Ontology server is not ready") : invariant4__default.default(false) : void 0;
813
+ !baseUrl ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Ontology server is not ready") : invariant5__default.default(false) : void 0;
781
814
  const caCertPath = ontology.getCaCertPath();
782
- !caCertPath ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Ontology server is not ready") : invariant4__default.default(false) : void 0;
815
+ !caCertPath ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Ontology server is not ready") : invariant5__default.default(false) : void 0;
783
816
  const agent = new undici.Agent({
784
817
  connect: caCertPath ? {
785
818
  ca: await fs3__namespace.default.readFile(caCertPath)
@@ -800,8 +833,8 @@ async function createIntegrationServer(config) {
800
833
  getClient: async () => {
801
834
  if (client !== void 0) return client;
802
835
  const baseUrl = ontology.getUrl();
803
- !baseUrl ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "Ontology server is not ready") : invariant4__default.default(false) : void 0;
804
- return client = await createIntegrationClient({
836
+ !baseUrl ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Ontology server is not ready") : invariant5__default.default(false) : void 0;
837
+ return client = await createIntegrationClientForRunningServer({
805
838
  baseUrl,
806
839
  metadata,
807
840
  caCertPath: ontology.getCaCertPath()
@@ -809,32 +842,6 @@ async function createIntegrationServer(config) {
809
842
  }
810
843
  };
811
844
  }
812
- var MIN_FOUNDRY_CLI_VERSION = "0.224.0";
813
- var FOUNDRY_VERSION_PATTERN = /cli (\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)/u;
814
- var parseFoundryVersion = (stdout) => stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];
815
- var versionIsAtMinimum = (version, min) => semver.valid(version) != null && semver.valid(min) != null && semver.gte(version, min);
816
- var execAsync = util.promisify(child_process.exec);
817
- var checkFoundryCliVersion = () => {
818
- return execAsync("which foundry").then(() => execAsync("foundry --version")).then(({
819
- stdout
820
- }) => {
821
- const version = parseFoundryVersion(stdout);
822
- if (!version) return {
823
- type: "version-error"
824
- };
825
- const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);
826
- if (!isMin) return {
827
- type: "version-incompatible",
828
- version
829
- };
830
- return {
831
- type: "installed",
832
- version
833
- };
834
- }).catch(() => ({
835
- type: "not-found"
836
- }));
837
- };
838
845
 
839
846
  exports.checkFoundryCliVersion = checkFoundryCliVersion;
840
847
  exports.createIntegrationClient = createIntegrationClient;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/createIntegrationClient.ts","../../src/cli-service/FoundryCliService.ts","../../src/utils/process.ts","../../src/utils/service.ts","../../src/cli-service/ServiceDiscoverer.ts","../../src/generated/cli/OntologySeedingService.ts","../../src/generated/cli/OntologySeedingService/setSeed.ts","../../src/generated/cli/StatusService.ts","../../src/generated/cli/StatusService/publishStatus.ts","../../src/generated/cli/StatusService/getStatus.ts","../../src/cli-service/StatusServer.ts","../../src/cli-service/CliServiceLauncher.ts","../../src/cli-service/OntologyServer.ts","../../src/createSeedClient.ts","../../src/utils/empty-ontology-block.ts","../../src/createIntegrationServer.ts","../../src/utils/foundry-cli.ts"],"names":["Agent","fs","undiciFetch","createClient","createMockClient","client","invariant","spawn","resolve","once","fs2","join","conjureFetch","path","setTimeout","isAbsolute","SeedBuilder","PreviewOntologyIrConverter","valid","gte","promisify","exec"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,eAAsB,wBAAwB,MAAA,EAAQ;AACpD,EAAA,MAAM;AAAA,IACJ,OAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,MAAA;AACJ,EAAA,MAAM,KAAA,GAAQ,IAAIA,YAAA,CAAM;AAAA,IACtB,SAAS,UAAA,GAAa;AAAA,MACpB,EAAA,EAAI,MAAMC,sBAAA,CAAG,QAAA,CAAS,UAAU;AAAA,KAClC,GAAI;AAAA,MACF,kBAAA,EAAoB;AAAA;AACtB,GACD,CAAA;AACD,EAAA,MAAM,aAAA,GAAgB,CAAC,KAAA,EAAO,IAAA,KAASC,aAAY,KAAA,EAAO;AAAA,IACxD,GAAG,IAAA;AAAA,IACH,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,MAAM,UAAA,GAAaC,mBAAA,CAAa,OAAA,EAAS,QAAA,CAAS,QAAA,CAAS,GAAA,EAAK,MAAM,OAAA,CAAQ,OAAA,CAAQ,0BAA0B,CAAA,EAAG,IAAI,aAAa,CAAA;AACpI,EAAA,MAAM,aAAaC,4BAAA,EAAiB;AACpC,EAAA,MAAM,iBAAiB,CAAA,GAAA,KAAO;AAC5B,IA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M,KAAA,GAAQ,kBAAA,CAAmB,OAAA,EAAS,uBAAuB,CAAA;AACjE,IAAA,IAAI,CAAC,OAAO,OAAO;AAAA,MACjB,IAAA,EAAM,sBAAA;AAAA,MACN;AAAA,KACF;AACA,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,WAAA;AAAA,MACN;AAAA,KACF;AAAA,EACF,CAAC,CAAA,CAAE,KAAA,CAAM,OAAO;AAAA,IACd,IAAA,EAAM;AAAA,GACR,CAAE,CAAA;AACJ","file":"index.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport { createClient } from \"@osdk/client\";\nimport { createMockClient } from \"@osdk/unit-testing\";\nimport { fetch as undiciFetch, Agent } from \"undici\";\n\n/** The definition kinds accepted by {@link Client}'s call signatures. */\n\nexport async function createIntegrationClient(config) {\n const {\n baseUrl,\n metadata,\n caCertPath\n } = config;\n const agent = new Agent({\n connect: caCertPath ? {\n ca: await fs.readFile(caCertPath)\n } : {\n rejectUnauthorized: false\n }\n });\n const fetchWithCert = (input, init) => undiciFetch(input, {\n ...init,\n dispatcher: agent\n });\n const realClient = createClient(baseUrl, metadata.ontology.rid, () => Promise.resolve(\"integration-client-token\"), {}, fetchWithCert);\n const mockClient = createMockClient();\n const clientInternal = def => {\n switch (def.type) {\n case \"query\":\n return mockClient(def);\n case \"action\":\n return realClient(def);\n case \"interface\":\n return realClient(def);\n case \"object\":\n return realClient(def);\n case \"experiment\":\n default:\n return realClient(def);\n }\n };\n const client = Object.defineProperties(clientInternal, {\n ...Object.getOwnPropertyDescriptors(realClient),\n whenQuery: {\n value: mockClient.whenQuery.bind(undefined)\n },\n clearStubs: {\n value: mockClient.clearStubs.bind(undefined)\n }\n });\n return client;\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { spawn } from \"node:child_process\";\nimport { once } from \"node:events\";\nimport invariant from \"tiny-invariant\";\nconst MAX_CAPTURED_STDERR_CHUNKS = 32;\nexport const DEFAULT_READY_TIMEOUT_MS = 30_000;\nexport const DEFAULT_STOP_GRACE_MS = 5_000;\n\n/**\n * The shared collaborators a service needs to answer questions about itself.\n * Injected by the launcher via {@link FoundryCliService.attach} so services do\n * not have to construct — or know how to reach — either one.\n */\n\nconst TERMINAL_STATES = new Set([\"FAILED\", \"STOPPED\"]);\n\n/**\n * One Foundry CLI service subprocess.\n *\n * Subclasses supply the `foundry` subcommand to run and, where the default is\n * wrong, how to tell that the service is up.\n *\n * Dependencies are declared but not enforced here: a service names what it needs\n * and {@link CliServiceLauncher} is what orders and awaits them.\n */\nexport class FoundryCliService {\n #foundryCliPath;\n #projectPath;\n #child;\n #context;\n #stderr = [];\n #exit;\n constructor(name, config) {\n this.name = name;\n this.dependencies = config.dependencies ?? [];\n this.#foundryCliPath = config.foundryCliPath ?? \"foundry\";\n this.#projectPath = config.projectPath;\n }\n getProjectPath() {\n return this.#projectPath;\n }\n getCaCertPath() {\n return this.#context?.discoverer.get(this.name)?.caCertPath ?? undefined;\n }\n getUrl() {\n return this.#context?.discoverer.get(this.name)?.url;\n }\n getExitInfo() {\n if (this.#exit === undefined) {\n return undefined;\n }\n const {\n code,\n signal\n } = this.#exit;\n return signal ?? `code ${code}`;\n }\n getCapturedStderr() {\n return this.#stderr.join(\"\").trim();\n }\n getContext() {\n const context = this.#context;\n !(context !== undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `${this.name} is not registered with a CliServiceLauncher, so it has ` + `no discoverer or status server to consult`) : invariant(false) : void 0;\n return context;\n }\n attach(context) {\n this.#context = context;\n }\n async start() {\n if (this.#child !== undefined) {\n return;\n }\n await this.getContext().discoverer.refresh();\n !!(await this.checkHealth()).ready ? process.env.NODE_ENV !== \"production\" ? invariant(false, `${this.name} is already running; stop it before starting a new one`) : invariant(false) : void 0;\n await this.#spawn();\n }\n async #spawn() {\n this.#exit = undefined;\n this.#stderr = [];\n const child = spawn(this.#foundryCliPath, [...this.getArgs()], {\n cwd: this.#projectPath\n });\n this.#child = child;\n child.stderr.setEncoding(\"utf-8\");\n child.stderr.on(\"data\", chunk => {\n if (this.#stderr.push(chunk) > MAX_CAPTURED_STDERR_CHUNKS) {\n this.#stderr.shift();\n }\n });\n child.stdout.resume(); // flush, since we don't read from stdout\n child.on(\"exit\", (code, signal) => {\n this.#exit = {\n code,\n signal\n };\n });\n await new Promise((resolve, reject) => {\n child.once(\"spawn\", resolve);\n child.once(\"error\", error => reject(new Error(`Failed to spawn ${this.name} via ${this.#foundryCliPath}`, {\n cause: error\n })));\n });\n }\n async checkHealth() {\n const {\n discoverer,\n statusServer\n } = this.getContext();\n const discovery = discoverer.get(this.name);\n if (typeof discovery === \"undefined\") {\n return {\n service: this.name,\n state: \"UNDISCOVERED\",\n ready: false,\n terminal: false\n };\n }\n const status = await statusServer.getServiceStatus(this.name);\n const state = status?.status ?? \"DISCOVERED\";\n return {\n service: this.name,\n state,\n ready: state === \"READY\",\n terminal: TERMINAL_STATES.has(state),\n url: discovery.url,\n ...(status?.message != null ? {\n message: status.message\n } : {})\n };\n }\n\n /**\n * Signal the service and wait for the process to actually be gone.\n */\n async stop() {\n const child = this.#child;\n this.#child = undefined;\n if (child === undefined || child.exitCode != null || child.signalCode != null) {\n return;\n }\n const exited = once(child, \"exit\");\n child.kill(\"SIGINT\");\n const escalation = setTimeout(() => {\n child.kill(\"SIGKILL\");\n }, DEFAULT_STOP_GRACE_MS);\n try {\n await exited;\n } finally {\n clearTimeout(escalation);\n }\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const isProcessAlive = pid => {\n try {\n process.kill(pid, 0);\n return true;\n } catch (err) {\n // EPERM means the process exists but is owned by another user.\n return err.code === \"EPERM\";\n }\n};","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst SERVICE_FILE_NAMES = {\n ONTOLOGY: \"ontology\",\n TYPESCRIPT_FUNCTIONS: \"typescript-functions\",\n PYTHON_FUNCTIONS: \"python-functions\",\n APP: \"app\",\n STATUS_SERVER: \"status-server\",\n PLATFORM_API_PROXY: \"platform-api-proxy\"\n};\nconst SERVICE_NAMES_BY_FILE_NAME = new Map(Object.entries(SERVICE_FILE_NAMES).map(([name, stem]) => [stem, name]));\nexport const serviceNameFromFileName = fileName => {\n const name = fileName.match(/^\\.?(?<name>.+)-discovery\\.json$/u)?.groups?.name;\n return name === undefined ? undefined : SERVICE_NAMES_BY_FILE_NAME.get(name);\n};\n\n/** The name a running service publishes its discovery record under. */\nexport const discoveryFileName = name => `.${SERVICE_FILE_NAMES[name]}-discovery.json`;","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport { isProcessAlive } from \"../utils/process.js\";\nimport { serviceNameFromFileName } from \"../utils/service.js\";\n/**\n * Reads the discovery files that running Foundry services publish into\n * `basePath`.\n */\nexport class ServiceDiscoverer {\n #basePath;\n #discovered = new Map();\n constructor(args) {\n this.#basePath = args.basePath;\n }\n get discoveryDir() {\n return this.#basePath;\n }\n async start() {\n await fs.mkdir(this.#basePath, {\n recursive: true\n });\n await this.refresh();\n }\n\n /**\n * Re-read every discovery file in the directory.\n */\n async refresh() {\n const fileNames = await fs.readdir(this.#basePath);\n const discoveries = await Promise.all(fileNames.map(fileName => this.#read(fileName)));\n return discoveries.filter(discovery => discovery !== undefined);\n }\n get(name) {\n const discovery = this.#discovered.get(name);\n if (typeof discovery === \"undefined\") {\n return undefined;\n }\n if (!isProcessAlive(discovery.pid)) {\n this.#discovered.delete(name); // Stale: the publisher died without cleaning up after itself.\n return undefined;\n }\n return discovery;\n }\n isDiscovered(name) {\n return this.get(name) !== undefined;\n }\n all() {\n const live = new Map();\n for (const name of this.#discovered.keys()) {\n const discovery = this.get(name);\n if (discovery !== undefined) {\n live.set(name, discovery);\n }\n }\n return live;\n }\n stop() {\n this.#discovered.clear();\n }\n async #read(fileName) {\n const serviceName = serviceNameFromFileName(fileName);\n if (typeof serviceName === \"undefined\") {\n return undefined;\n }\n let contents;\n try {\n contents = await fs.readFile(join(this.#basePath, fileName), \"utf-8\");\n } catch {\n this.#discovered.delete(serviceName);\n return undefined;\n }\n let parsed;\n try {\n parsed = JSON.parse(contents);\n } catch {\n return undefined;\n }\n !parsed.url ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Service URL not found`) : invariant(false) : void 0;\n this.#discovered.set(serviceName, parsed);\n return parsed;\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nexport { setSeed } from \"./OntologySeedingService/setSeed.js\";","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nimport { conjureFetch } from \"conjure-lite\";\n/**\n * Sets the seed state of the local ontology server. Succeeds with an\n * empty `200` response; failures surface as errors: 400 for a malformed\n * request body, 503 while the server is still starting, and 500 (with\n * the underlying detail) for seeding failures.\n */\nexport async function setSeed(ctx, seed) {\n return conjureFetch(ctx, `/seed`, \"PUT\", seed);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nexport { publishStatus } from \"./StatusService/publishStatus.js\";\nexport { getStatus } from \"./StatusService/getStatus.js\";","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nimport { conjureFetch } from \"conjure-lite\";\n/**\n * Publish a lifecycle event. Called by services whenever a status\n * transition occurs.\n */\nexport async function publishStatus(ctx, status) {\n return conjureFetch(ctx, `/status`, \"POST\", status);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nimport { conjureFetch } from \"conjure-lite\";\n/**\n * Return the current status of all services.\n */\nexport async function getStatus(ctx) {\n return conjureFetch(ctx, `/status`, \"GET\");\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport { StatusService } from \"../generated/cli/index.js\";\nimport { FoundryCliService } from \"./FoundryCliService.js\";\nconst HEALTH_REQUEST_TIMEOUT_MS = 2_000;\n/**\n * The local status server, and the health authority for every other service.\n */\nexport class StatusServer extends FoundryCliService {\n /** Shared by callers that ask while a fetch is already outstanding. */\n #inFlight;\n constructor(config) {\n super(\"STATUS_SERVER\", config);\n }\n getArgs() {\n // force project path to cwd\n return [\"start\", \"status-server\", \"--discovery-path\", path.resolve(this.getProjectPath(), \".palantir\")];\n }\n async checkHealth() {\n const discovery = this.getContext().discoverer.get(\"STATUS_SERVER\");\n if (discovery === undefined) {\n return {\n service: \"STATUS_SERVER\",\n state: \"UNDISCOVERED\",\n ready: false,\n terminal: false\n };\n }\n const healthy = await this.#isHealthy(discovery.url);\n return {\n service: \"STATUS_SERVER\",\n state: healthy ? \"READY\" : \"DISCOVERED\",\n ready: healthy,\n terminal: false,\n url: discovery.url\n };\n }\n async #isHealthy(baseUrl) {\n try {\n const response = await fetch(new URL(\"/api/health\", baseUrl), {\n signal: AbortSignal.timeout(HEALTH_REQUEST_TIMEOUT_MS)\n });\n if (!response.ok) {\n return false;\n }\n const body = await response.json();\n return body.status === \"healthy\";\n } catch {\n return false;\n }\n }\n\n /**\n * The lifecycle snapshot for every service.\n */\n async getServiceStatuses() {\n const baseUrl = this.getContext().discoverer.get(\"STATUS_SERVER\")?.url;\n !baseUrl ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Cannot get service status because the status server is not discovered yet\") : invariant(false) : void 0;\n this.#inFlight ??= StatusService.getStatus({\n baseUrl,\n servicePath: \"\"\n }).catch(() => undefined).finally(() => {\n this.#inFlight = undefined;\n });\n const result = await this.#inFlight;\n return result ?? [];\n }\n async getServiceStatus(name) {\n const statuses = await this.getServiceStatuses();\n return statuses.find(({\n service\n }) => service === name);\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path from \"node:path\";\nimport { setTimeout } from \"node:timers/promises\";\nimport invariant from \"tiny-invariant\";\nimport { DEFAULT_READY_TIMEOUT_MS } from \"./FoundryCliService.js\";\nimport { ServiceDiscoverer } from \"./ServiceDiscoverer.js\";\nimport { StatusServer } from \"./StatusServer.js\";\nconst HEALTH_POLL_INTERVAL_MS = 200;\n/**\n * Brings a set of Foundry services. Includes a status server by default.\n */\nexport class CliServiceLauncher {\n #discoverer;\n #statusServer;\n #services = new Map();\n\n /** Memoized in-flight starts, so a shared dependency is started once. */\n #starts = new Map();\n #started = false;\n constructor(config = {}) {\n const projectDir = config.projectDir ?? process.cwd();\n this.#discoverer = new ServiceDiscoverer({\n basePath: path.resolve(projectDir, \".palantir\")\n });\n this.#statusServer = config.statusServer ?? new StatusServer({\n projectPath: projectDir,\n foundryCliPath: config.foundryCliPath\n });\n this.register(this.#statusServer);\n }\n get services() {\n return [...this.#services.values()];\n }\n get(name) {\n return this.#services.get(name);\n }\n register(service) {\n const existing = this.#services.get(service.name);\n if (existing === service) {\n return service;\n }\n !(existing === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `A different ${service.name} service is already registered`) : invariant(false) : void 0;\n this.#services.set(service.name, service);\n service.attach({\n discoverer: this.#discoverer,\n statusServer: this.#statusServer\n });\n for (const dependency of service.dependencies) {\n this.register(dependency);\n }\n return service;\n }\n async start() {\n await this.#ensureDiscovering();\n this.#assertAcyclic();\n const results = await Promise.allSettled([...this.#services.values()].map(service => this.#start(service)));\n const failed = results.find(result => result.status === \"rejected\");\n if (failed !== undefined) {\n await this.stop();\n throw failed.reason;\n }\n }\n async startService(service) {\n this.register(service);\n await this.#ensureDiscovering();\n this.#assertAcyclic();\n await this.#start(service);\n }\n async #ensureDiscovering() {\n if (!this.#started) {\n await this.#discoverer.start();\n this.#started = true;\n }\n }\n async #start(service) {\n const runningPromise = this.#starts.get(service.name);\n if (typeof runningPromise !== \"undefined\") {\n return runningPromise;\n }\n const started = this.#startImmediate(service);\n this.#starts.set(service.name, started);\n try {\n await started;\n } catch (err) {\n this.#starts.delete(service.name);\n throw err;\n }\n }\n async #startImmediate(service) {\n await Promise.all(this.#prerequisites(service).map(dependency => this.#start(dependency)));\n await service.start();\n await this.waitUntilReady(service);\n }\n\n /**\n * Everything that must be ready before `service` may start: its declared\n * dependencies, plus the status server.\n */\n #prerequisites(service) {\n return service.name === this.#statusServer.name ? service.dependencies : [this.#statusServer, ...service.dependencies];\n }\n\n /**\n * Poll a service's health until it is ready, reaches a terminal state, or\n * exceeds its timeout.\n */\n async waitUntilReady(service) {\n const deadline = Date.now() + DEFAULT_READY_TIMEOUT_MS;\n let health = await service.checkHealth();\n while (!health.ready) {\n const current = health;\n const notReady = () => `${service.name} is not ready (${current.state})${formatError(service, current)}`;\n !!current.terminal ? process.env.NODE_ENV !== \"production\" ? invariant(false, notReady) : invariant(false) : void 0;\n !(service.getExitInfo() === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, notReady) : invariant(false) : void 0;\n !(Date.now() < deadline) ? process.env.NODE_ENV !== \"production\" ? invariant(false, () => `${service.name} is not ready (${current.state}) within ` + `${DEFAULT_READY_TIMEOUT_MS}ms${formatError(service, current)}`) : invariant(false) : void 0;\n await setTimeout(HEALTH_POLL_INTERVAL_MS);\n await this.#discoverer.refresh();\n health = await service.checkHealth();\n }\n return health;\n }\n async checkHealth() {\n await this.#discoverer.refresh();\n return Promise.all([...this.#services.values()].map(service => service.checkHealth()));\n }\n async checkDependencies(service) {\n await this.#discoverer.refresh();\n return Promise.all(service.dependencies.map(dependency => dependency.checkHealth()));\n }\n async dependenciesReady(service) {\n const healths = await this.checkDependencies(service);\n return healths.every(({\n ready\n }) => ready);\n }\n\n /**\n * Stop every service, dependents before their dependencies, waiting for each\n * process to be gone before the next is signalled.\n */\n async stop() {\n for (const service of this.#startupOrder().reverse()) {\n await service.stop();\n }\n this.#starts.clear();\n this.#discoverer.stop();\n this.#started = false;\n }\n\n /**\n * Registered services in a valid startup order: every service appears after\n * everything it depends on.\n */\n #startupOrder() {\n const ordered = [];\n const seen = new Set();\n const visit = service => {\n if (seen.has(service.name)) {\n return;\n }\n seen.add(service.name);\n for (const dependency of this.#prerequisites(service)) {\n visit(dependency);\n }\n ordered.push(service);\n };\n for (const service of this.#services.values()) {\n visit(service);\n }\n return ordered;\n }\n #assertAcyclic() {\n const settled = new Set();\n const visit = (service, walkedPath) => {\n if (settled.has(service.name)) {\n return;\n }\n const cycleStart = walkedPath.indexOf(service.name);\n !(cycleStart === -1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, () => `Dependency cycle between services: ${[...walkedPath.slice(cycleStart), service.name].join(\" -> \")}`) : invariant(false) : void 0;\n for (const dependency of this.#prerequisites(service)) {\n visit(dependency, [...walkedPath, service.name]);\n }\n settled.add(service.name);\n };\n for (const service of this.#services.values()) {\n visit(service, []);\n }\n }\n}\nconst formatError = (service, health) => {\n const parts = [];\n if (health.message != null && health.message.length > 0) {\n parts.push(health.message);\n }\n const exit = service.getExitInfo();\n if (exit !== undefined) {\n parts.push(`the process exited (${exit})`);\n }\n const stderr = service.getCapturedStderr();\n if (stderr.length > 0) {\n parts.push(`stderr:\\n${stderr}`);\n }\n return parts.length === 0 ? \"\" : `: ${parts.join(\"; \")}`;\n};","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path, { isAbsolute, resolve } from \"node:path\";\nimport { FoundryCliService } from \"./FoundryCliService.js\";\nexport class OntologyServer extends FoundryCliService {\n #metadataPath;\n constructor(config) {\n super(\"ONTOLOGY\", config);\n this.#metadataPath = isAbsolute(config.metadataPath) ? config.metadataPath : resolve(config.projectPath, config.metadataPath);\n }\n getMetadataPath() {\n return this.#metadataPath;\n }\n getArgs() {\n return [\"start\", \"ontology\", \"--skip-build\", \"--metadata\", this.#metadataPath, \"--discovery-path\", path.resolve(this.getProjectPath(), \".palantir\")];\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SeedBuilder } from \"@osdk/seed-helpers\";\nimport { OntologySeedingService } from \"./generated/cli/index.js\";\nexport function createSeedClient(config) {\n const {\n baseUrl,\n metadata,\n fetchFn\n } = config;\n const builder = new SeedBuilder(metadata);\n const seedClientFunction = async seed => {\n let result;\n if (typeof seed === \"function\") {\n result = seed(builder);\n } else {\n builder.addAll(seed);\n }\n await applySeed(builder.build());\n return result;\n };\n const applySeed = async seed => {\n const res = await OntologySeedingService.setSeed({\n baseUrl,\n servicePath: \"/api\",\n fetchFn\n }, seed);\n return res;\n };\n const seedClientUtils = {\n ref: (o, pk) => builder.ref(o, pk),\n addAll: async output => {\n builder.addAll(output);\n await applySeed(builder.build());\n },\n set: async output => {\n builder.set(output);\n await applySeed(builder.build());\n },\n create: async (o, props) => {\n const ref = builder.create(o, props);\n await applySeed(builder.build());\n return ref;\n },\n update: async (ref, props) => {\n const returnedRef = builder.update(ref, props);\n await applySeed(builder.build());\n return returnedRef;\n },\n delete: async ref => {\n builder.delete(ref);\n await applySeed(builder.build());\n },\n link: async (source, apiName, target) => {\n builder.link(source, apiName, target);\n await applySeed(builder.build());\n },\n unlink: async (source, apiName, target) => {\n builder.unlink(source, apiName, target);\n await applySeed(builder.build());\n }\n };\n return Object.defineProperties(seedClientFunction, Object.getOwnPropertyDescriptors(seedClientUtils));\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const EMPTY_ONTOLOGY_BLOCK_DATA = {\n objectTypes: {},\n sharedPropertyTypes: {},\n interfaceTypes: {},\n linkTypes: {},\n actionTypes: {},\n blockPermissionInformation: {\n actionTypes: {},\n objectTypes: {},\n linkTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {}\n },\n blockOutputCompassLocations: {},\n knownIdentifiers: {\n actionParameterIds: {},\n actionParameters: {},\n actionTypes: {},\n datasourceColumns: {},\n datasources: {},\n filesDatasources: {},\n functions: {},\n geotimeSeriesSyncs: {},\n groupIds: {},\n interfaceActionTypeConstraints: {},\n interfaceLinkTypes: {},\n interfaceParameterConstraints: {},\n interfacePropertyTypes: {},\n interfaceTypes: {},\n linkTypeIds: {},\n linkTypes: {},\n markings: {},\n objectPropertyTypeIdsToRids: {},\n objectTypeIds: {},\n objectTypes: {},\n propertyTypeIds: {},\n propertyTypes: {},\n sharedPropertyTypes: {},\n structFieldRidsToApiNames: {},\n timeSeriesSyncs: {},\n valueTypes: {},\n webhooks: {},\n workshopModules: {}\n },\n ruleSets: {}\n};","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { PreviewOntologyIrConverter } from \"@osdk/generator-converters.preview\";\nimport invariant from \"tiny-invariant\";\nimport { Agent, fetch as undiciFetch } from \"undici\";\nimport { CliServiceLauncher } from \"./cli-service/CliServiceLauncher.js\";\nimport { OntologyServer } from \"./cli-service/OntologyServer.js\";\nimport { createIntegrationClient } from \"./createIntegrationClient.js\";\nimport { createSeedClient } from \"./createSeedClient.js\";\nimport { EMPTY_ONTOLOGY_BLOCK_DATA } from \"./utils/empty-ontology-block.js\";\nconst transformMetadata = metadata => {\n const transformed = PreviewOntologyIrConverter.getPreviewFullMetadataFromBlockData(EMPTY_ONTOLOGY_BLOCK_DATA, metadata);\n return {\n ...transformed,\n ontology: metadata.ontology\n };\n};\nconst writeMetadata = async args => {\n const {\n metadataPath,\n previewMetadata\n } = args;\n const stringified = JSON.stringify(previewMetadata);\n await fs.writeFile(metadataPath, stringified);\n};\nexport async function createIntegrationServer(config) {\n const {\n metadata,\n projectPath = process.cwd(),\n foundryCliPath\n } = config;\n const testPath = await fs.mkdtemp(path.join(projectPath, \".test-run-\"));\n const metadataPath = path.resolve(testPath, \"ontology-metadata.json\");\n const previewMetadata = transformMetadata(metadata);\n const serviceLauncher = new CliServiceLauncher({\n projectDir: testPath,\n foundryCliPath\n });\n // write metadata to metadataPath for foundry cli to read from\n await writeMetadata({\n previewMetadata,\n metadataPath\n });\n const ontology = serviceLauncher.register(new OntologyServer({\n projectPath: testPath,\n metadataPath,\n foundryCliPath\n }));\n\n // stateful cache of client and seed client\n let client;\n let seedClient;\n return {\n getOntologyUrl: () => ontology.getUrl(),\n start: async () => {\n await serviceLauncher.start();\n },\n stop: async () => {\n await serviceLauncher.stop();\n await fs.rm(testPath, {\n recursive: true,\n force: true\n });\n },\n getSeedClient: async () => {\n if (seedClient !== undefined) return seedClient;\n const baseUrl = ontology.getUrl();\n !baseUrl ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Ontology server is not ready\") : invariant(false) : void 0;\n const caCertPath = ontology.getCaCertPath();\n !caCertPath ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Ontology server is not ready\") : invariant(false) : void 0;\n const agent = new Agent({\n connect: caCertPath ? {\n ca: await fs.readFile(caCertPath)\n } : {\n rejectUnauthorized: false\n }\n });\n const fetchWithCert = (input, init) => undiciFetch(input, {\n ...init,\n dispatcher: agent\n });\n return seedClient = createSeedClient({\n baseUrl,\n metadata,\n fetchFn: fetchWithCert\n });\n },\n getClient: async () => {\n if (client !== undefined) return client;\n const baseUrl = ontology.getUrl();\n !baseUrl ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Ontology server is not ready\") : invariant(false) : void 0;\n return client = await createIntegrationClient({\n baseUrl,\n metadata,\n caCertPath: ontology.getCaCertPath()\n });\n }\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { gte, valid } from \"semver\";\nexport const MIN_FOUNDRY_CLI_VERSION = \"0.224.0\";\nconst FOUNDRY_VERSION_PATTERN = /cli (\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)/u;\nconst parseFoundryVersion = stdout => stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];\nconst versionIsAtMinimum = (version, min) => valid(version) != null && valid(min) != null && gte(version, min);\nconst execAsync = promisify(exec);\nexport const checkFoundryCliVersion = () => {\n return execAsync(\"which foundry\").then(() => execAsync(\"foundry --version\")).then(({\n stdout\n }) => {\n const version = parseFoundryVersion(stdout);\n if (!version) return {\n type: \"version-error\"\n };\n const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);\n if (!isMin) return {\n type: \"version-incompatible\",\n version\n };\n return {\n type: \"installed\",\n version\n };\n }).catch(() => ({\n type: \"not-found\"\n }));\n};"]}
1
+ {"version":3,"sources":["../../src/utils/foundry-cli.ts","../../src/createIntegrationClient.ts","../../src/cli-service/FoundryCliService.ts","../../src/utils/process.ts","../../src/utils/service.ts","../../src/cli-service/ServiceDiscoverer.ts","../../src/generated/cli/OntologySeedingService.ts","../../src/generated/cli/OntologySeedingService/setSeed.ts","../../src/generated/cli/StatusService.ts","../../src/generated/cli/StatusService/publishStatus.ts","../../src/generated/cli/StatusService/getStatus.ts","../../src/cli-service/StatusServer.ts","../../src/cli-service/CliServiceLauncher.ts","../../src/cli-service/OntologyServer.ts","../../src/createSeedClient.ts","../../src/utils/empty-ontology-block.ts","../../src/createIntegrationServer.ts"],"names":["valid","gte","promisify","execFile","invariant","Agent","fs","undiciFetch","createClient","createMockClient","client","spawn","resolve","once","fs2","join","conjureFetch","path","setTimeout","isAbsolute","SeedBuilder","PreviewOntologyIrConverter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,IAAM,uBAAA,GAA0B,SAAA;AACvC,IAAM,uBAAA,GAA0B,+DAAA;AAChC,IAAM,mBAAA,GAAsB,YAAU,MAAA,CAAO,IAAA,GAAO,KAAA,CAAM,uBAAuB,IAAI,CAAC,CAAA;AACtF,IAAM,kBAAA,GAAqB,CAAC,OAAA,EAAS,GAAA,KAAQA,aAAM,OAAO,CAAA,IAAK,IAAA,IAAQA,YAAA,CAAM,GAAG,CAAA,IAAK,IAAA,IAAQC,UAAA,CAAI,SAAS,GAAG,CAAA;AAC7G,IAAM,aAAA,GAAgBC,eAAUC,sBAAQ,CAAA;AACjC,IAAM,yBAAyB,MAAM;AAC1C,EAAA,OAAO,cAAc,SAAA,EAAW,CAAC,WAAW,CAAC,CAAA,CAAE,KAAK,CAAC;AAAA,IACnD;AAAA,GACF,KAAM;AACJ,IAAA,MAAM,OAAA,GAAU,oBAAoB,MAAM,CAAA;AAC1C,IAAA,IAAI,CAAC,SAAS,OAAO;AAAA,MACnB,IAAA,EAAM;AAAA,KACR;AACA,IAAA,MAAM,KAAA,GAAQ,kBAAA,CAAmB,OAAA,EAAS,uBAAuB,CAAA;AACjE,IAAA,IAAI,CAAC,OAAO,OAAO;AAAA,MACjB,IAAA,EAAM,sBAAA;AAAA,MACN;AAAA,KACF;AACA,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,WAAA;AAAA,MACN;AAAA,KACF;AAAA,EACF,CAAC,CAAA,CAAE,KAAA,CAAM,OAAO;AAAA,IACd,IAAA,EAAM;AAAA,GACR,CAAE,CAAA;AACJ;;;ACnBA,eAAsB,w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,SAAS,MAAA,EAAO;AAChC,MAAA,CAAC,OAAA,GAAU,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,GAAeH,2BAAAA,CAAU,KAAA,EAAO,8BAA8B,CAAA,GAAIA,2BAAAA,CAAU,KAAK,CAAA,GAAI,MAAA;AACzH,MAAA,OAAO,MAAA,GAAS,MAAM,uCAAA,CAAwC;AAAA,QAC5D,OAAA;AAAA,QACA,QAAA;AAAA,QACA,UAAA,EAAY,SAAS,aAAA;AAAc,OACpC,CAAA;AAAA,IACH;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { gte, valid } from \"semver\";\nexport const MIN_FOUNDRY_CLI_VERSION = \"0.224.0\";\nconst FOUNDRY_VERSION_PATTERN = /cli (\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)/u;\nconst parseFoundryVersion = stdout => stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];\nconst versionIsAtMinimum = (version, min) => valid(version) != null && valid(min) != null && gte(version, min);\nconst execFileAsync = promisify(execFile);\nexport const checkFoundryCliVersion = () => {\n return execFileAsync(\"foundry\", [\"--version\"]).then(({\n stdout\n }) => {\n const version = parseFoundryVersion(stdout);\n if (!version) return {\n type: \"version-error\"\n };\n const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);\n if (!isMin) return {\n type: \"version-incompatible\",\n version\n };\n return {\n type: \"installed\",\n version\n };\n }).catch(() => ({\n type: \"not-found\"\n }));\n};","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport { createClient } from \"@osdk/client\";\nimport { createMockClient } from \"@osdk/unit-testing\";\nimport invariant from \"tiny-invariant\";\nimport { fetch as undiciFetch, Agent } from \"undici\";\nimport { checkFoundryCliVersion } from \"./utils/foundry-cli.js\";\n\n/** The definition kinds accepted by {@link Client}'s call signatures. */\n\nexport async function createIntegrationClient(config) {\n const foundryCli = await checkFoundryCliVersion();\n !(foundryCli.type !== \"not-found\") ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Foundry CLI must be installed before creating an integration client.\") : invariant(false) : void 0;\n return createIntegrationClientForRunningServer(config);\n}\nexport async function createIntegrationClientForRunningServer(config) {\n const {\n baseUrl,\n metadata,\n caCertPath\n } = config;\n const agent = new Agent({\n connect: caCertPath ? {\n ca: await fs.readFile(caCertPath)\n } : {\n rejectUnauthorized: false\n }\n });\n const fetchWithCert = (input, init) => undiciFetch(input, {\n ...init,\n dispatcher: agent\n });\n const realClient = createClient(baseUrl, metadata.ontology.rid, () => Promise.resolve(\"integration-client-token\"), {}, fetchWithCert);\n const mockClient = createMockClient();\n const clientInternal = def => {\n switch (def.type) {\n case \"query\":\n return mockClient(def);\n case \"action\":\n return realClient(def);\n case \"interface\":\n return realClient(def);\n case \"object\":\n return realClient(def);\n case \"experiment\":\n default:\n return realClient(def);\n }\n };\n const client = Object.defineProperties(clientInternal, {\n ...Object.getOwnPropertyDescriptors(realClient),\n whenQuery: {\n value: mockClient.whenQuery.bind(undefined)\n },\n clearStubs: {\n value: mockClient.clearStubs.bind(undefined)\n }\n });\n return client;\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { spawn } from \"node:child_process\";\nimport { once } from \"node:events\";\nimport invariant from \"tiny-invariant\";\nconst MAX_CAPTURED_STDERR_CHUNKS = 32;\nexport const DEFAULT_READY_TIMEOUT_MS = 30_000;\nexport const DEFAULT_STOP_GRACE_MS = 5_000;\n\n/**\n * The shared collaborators a service needs to answer questions about itself.\n * Injected by the launcher via {@link FoundryCliService.attach} so services do\n * not have to construct — or know how to reach — either one.\n */\n\nconst TERMINAL_STATES = new Set([\"FAILED\", \"STOPPED\"]);\n\n/**\n * One Foundry CLI service subprocess.\n *\n * Subclasses supply the `foundry` subcommand to run and, where the default is\n * wrong, how to tell that the service is up.\n *\n * Dependencies are declared but not enforced here: a service names what it needs\n * and {@link CliServiceLauncher} is what orders and awaits them.\n */\nexport class FoundryCliService {\n #foundryCliPath;\n #projectPath;\n #child;\n #context;\n #stderr = [];\n #exit;\n constructor(name, config) {\n this.name = name;\n this.dependencies = config.dependencies ?? [];\n this.#foundryCliPath = config.foundryCliPath ?? \"foundry\";\n this.#projectPath = config.projectPath;\n }\n getProjectPath() {\n return this.#projectPath;\n }\n getCaCertPath() {\n return this.#context?.discoverer.get(this.name)?.caCertPath ?? undefined;\n }\n getUrl() {\n return this.#context?.discoverer.get(this.name)?.url;\n }\n getExitInfo() {\n if (this.#exit === undefined) {\n return undefined;\n }\n const {\n code,\n signal\n } = this.#exit;\n return signal ?? `code ${code}`;\n }\n getCapturedStderr() {\n return this.#stderr.join(\"\").trim();\n }\n getContext() {\n const context = this.#context;\n !(context !== undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `${this.name} is not registered with a CliServiceLauncher, so it has ` + `no discoverer or status server to consult`) : invariant(false) : void 0;\n return context;\n }\n attach(context) {\n this.#context = context;\n }\n async start() {\n if (this.#child !== undefined) {\n return;\n }\n await this.getContext().discoverer.refresh();\n !!(await this.checkHealth()).ready ? process.env.NODE_ENV !== \"production\" ? invariant(false, `${this.name} is already running; stop it before starting a new one`) : invariant(false) : void 0;\n await this.#spawn();\n }\n async #spawn() {\n this.#exit = undefined;\n this.#stderr = [];\n const child = spawn(this.#foundryCliPath, [...this.getArgs()], {\n cwd: this.#projectPath\n });\n this.#child = child;\n child.stderr.setEncoding(\"utf-8\");\n child.stderr.on(\"data\", chunk => {\n if (this.#stderr.push(chunk) > MAX_CAPTURED_STDERR_CHUNKS) {\n this.#stderr.shift();\n }\n });\n child.stdout.resume(); // flush, since we don't read from stdout\n child.on(\"exit\", (code, signal) => {\n this.#exit = {\n code,\n signal\n };\n });\n await new Promise((resolve, reject) => {\n child.once(\"spawn\", resolve);\n child.once(\"error\", error => reject(new Error(`Failed to spawn ${this.name} via ${this.#foundryCliPath}`, {\n cause: error\n })));\n });\n }\n async checkHealth() {\n const {\n discoverer,\n statusServer\n } = this.getContext();\n const discovery = discoverer.get(this.name);\n if (typeof discovery === \"undefined\") {\n return {\n service: this.name,\n state: \"UNDISCOVERED\",\n ready: false,\n terminal: false\n };\n }\n const status = await statusServer.getServiceStatus(this.name);\n const state = status?.status ?? \"DISCOVERED\";\n return {\n service: this.name,\n state,\n ready: state === \"READY\",\n terminal: TERMINAL_STATES.has(state),\n url: discovery.url,\n ...(status?.message != null ? {\n message: status.message\n } : {})\n };\n }\n\n /**\n * Signal the service and wait for the process to actually be gone.\n */\n async stop() {\n const child = this.#child;\n this.#child = undefined;\n if (child === undefined || child.exitCode != null || child.signalCode != null) {\n return;\n }\n const exited = once(child, \"exit\");\n child.kill(\"SIGINT\");\n const escalation = setTimeout(() => {\n child.kill(\"SIGKILL\");\n }, DEFAULT_STOP_GRACE_MS);\n try {\n await exited;\n } finally {\n clearTimeout(escalation);\n }\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const isProcessAlive = pid => {\n try {\n process.kill(pid, 0);\n return true;\n } catch (err) {\n // EPERM means the process exists but is owned by another user.\n return err.code === \"EPERM\";\n }\n};","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst SERVICE_FILE_NAMES = {\n ONTOLOGY: \"ontology\",\n TYPESCRIPT_FUNCTIONS: \"typescript-functions\",\n PYTHON_FUNCTIONS: \"python-functions\",\n APP: \"app\",\n STATUS_SERVER: \"status-server\",\n PLATFORM_API_PROXY: \"platform-api-proxy\"\n};\nconst SERVICE_NAMES_BY_FILE_NAME = new Map(Object.entries(SERVICE_FILE_NAMES).map(([name, stem]) => [stem, name]));\nexport const serviceNameFromFileName = fileName => {\n const name = fileName.match(/^\\.?(?<name>.+)-discovery\\.json$/u)?.groups?.name;\n return name === undefined ? undefined : SERVICE_NAMES_BY_FILE_NAME.get(name);\n};\n\n/** The name a running service publishes its discovery record under. */\nexport const discoveryFileName = name => `.${SERVICE_FILE_NAMES[name]}-discovery.json`;","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport { isProcessAlive } from \"../utils/process.js\";\nimport { serviceNameFromFileName } from \"../utils/service.js\";\n/**\n * Reads the discovery files that running Foundry services publish into\n * `basePath`.\n */\nexport class ServiceDiscoverer {\n #basePath;\n #discovered = new Map();\n constructor(args) {\n this.#basePath = args.basePath;\n }\n get discoveryDir() {\n return this.#basePath;\n }\n async start() {\n await fs.mkdir(this.#basePath, {\n recursive: true\n });\n await this.refresh();\n }\n\n /**\n * Re-read every discovery file in the directory.\n */\n async refresh() {\n const fileNames = await fs.readdir(this.#basePath);\n const discoveries = await Promise.all(fileNames.map(fileName => this.#read(fileName)));\n return discoveries.filter(discovery => discovery !== undefined);\n }\n get(name) {\n const discovery = this.#discovered.get(name);\n if (typeof discovery === \"undefined\") {\n return undefined;\n }\n if (!isProcessAlive(discovery.pid)) {\n this.#discovered.delete(name); // Stale: the publisher died without cleaning up after itself.\n return undefined;\n }\n return discovery;\n }\n isDiscovered(name) {\n return this.get(name) !== undefined;\n }\n all() {\n const live = new Map();\n for (const name of this.#discovered.keys()) {\n const discovery = this.get(name);\n if (discovery !== undefined) {\n live.set(name, discovery);\n }\n }\n return live;\n }\n stop() {\n this.#discovered.clear();\n }\n async #read(fileName) {\n const serviceName = serviceNameFromFileName(fileName);\n if (typeof serviceName === \"undefined\") {\n return undefined;\n }\n let contents;\n try {\n contents = await fs.readFile(join(this.#basePath, fileName), \"utf-8\");\n } catch {\n this.#discovered.delete(serviceName);\n return undefined;\n }\n let parsed;\n try {\n parsed = JSON.parse(contents);\n } catch {\n return undefined;\n }\n !parsed.url ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Service URL not found`) : invariant(false) : void 0;\n this.#discovered.set(serviceName, parsed);\n return parsed;\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nexport { setSeed } from \"./OntologySeedingService/setSeed.js\";","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nimport { conjureFetch } from \"conjure-lite\";\n/**\n * Sets the seed state of the local ontology server. Succeeds with an\n * empty `200` response; failures surface as errors: 400 for a malformed\n * request body, 503 while the server is still starting, and 500 (with\n * the underlying detail) for seeding failures.\n */\nexport async function setSeed(ctx, seed) {\n return conjureFetch(ctx, `/seed`, \"PUT\", seed);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nexport { publishStatus } from \"./StatusService/publishStatus.js\";\nexport { getStatus } from \"./StatusService/getStatus.js\";","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nimport { conjureFetch } from \"conjure-lite\";\n/**\n * Publish a lifecycle event. Called by services whenever a status\n * transition occurs.\n */\nexport async function publishStatus(ctx, status) {\n return conjureFetch(ctx, `/status`, \"POST\", status);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**/\nimport { conjureFetch } from \"conjure-lite\";\n/**\n * Return the current status of all services.\n */\nexport async function getStatus(ctx) {\n return conjureFetch(ctx, `/status`, \"GET\");\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport { StatusService } from \"../generated/cli/index.js\";\nimport { FoundryCliService } from \"./FoundryCliService.js\";\nconst HEALTH_REQUEST_TIMEOUT_MS = 2_000;\n/**\n * The local status server, and the health authority for every other service.\n */\nexport class StatusServer extends FoundryCliService {\n /** Shared by callers that ask while a fetch is already outstanding. */\n #inFlight;\n constructor(config) {\n super(\"STATUS_SERVER\", config);\n }\n getArgs() {\n // force project path to cwd\n return [\"start\", \"status-server\", \"--discovery-path\", path.resolve(this.getProjectPath(), \".palantir\")];\n }\n async checkHealth() {\n const discovery = this.getContext().discoverer.get(\"STATUS_SERVER\");\n if (discovery === undefined) {\n return {\n service: \"STATUS_SERVER\",\n state: \"UNDISCOVERED\",\n ready: false,\n terminal: false\n };\n }\n const healthy = await this.#isHealthy(discovery.url);\n return {\n service: \"STATUS_SERVER\",\n state: healthy ? \"READY\" : \"DISCOVERED\",\n ready: healthy,\n terminal: false,\n url: discovery.url\n };\n }\n async #isHealthy(baseUrl) {\n try {\n const response = await fetch(new URL(\"/api/health\", baseUrl), {\n signal: AbortSignal.timeout(HEALTH_REQUEST_TIMEOUT_MS)\n });\n if (!response.ok) {\n return false;\n }\n const body = await response.json();\n return body.status === \"healthy\";\n } catch {\n return false;\n }\n }\n\n /**\n * The lifecycle snapshot for every service.\n */\n async getServiceStatuses() {\n const baseUrl = this.getContext().discoverer.get(\"STATUS_SERVER\")?.url;\n !baseUrl ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Cannot get service status because the status server is not discovered yet\") : invariant(false) : void 0;\n this.#inFlight ??= StatusService.getStatus({\n baseUrl,\n servicePath: \"\"\n }).catch(() => undefined).finally(() => {\n this.#inFlight = undefined;\n });\n const result = await this.#inFlight;\n return result ?? [];\n }\n async getServiceStatus(name) {\n const statuses = await this.getServiceStatuses();\n return statuses.find(({\n service\n }) => service === name);\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path from \"node:path\";\nimport { setTimeout } from \"node:timers/promises\";\nimport invariant from \"tiny-invariant\";\nimport { DEFAULT_READY_TIMEOUT_MS } from \"./FoundryCliService.js\";\nimport { ServiceDiscoverer } from \"./ServiceDiscoverer.js\";\nimport { StatusServer } from \"./StatusServer.js\";\nconst HEALTH_POLL_INTERVAL_MS = 200;\n/**\n * Brings a set of Foundry services. Includes a status server by default.\n */\nexport class CliServiceLauncher {\n #discoverer;\n #statusServer;\n #services = new Map();\n\n /** Memoized in-flight starts, so a shared dependency is started once. */\n #starts = new Map();\n #started = false;\n constructor(config = {}) {\n const projectDir = config.projectDir ?? process.cwd();\n this.#discoverer = new ServiceDiscoverer({\n basePath: path.resolve(projectDir, \".palantir\")\n });\n this.#statusServer = config.statusServer ?? new StatusServer({\n projectPath: projectDir,\n foundryCliPath: config.foundryCliPath\n });\n this.register(this.#statusServer);\n }\n get services() {\n return [...this.#services.values()];\n }\n get(name) {\n return this.#services.get(name);\n }\n register(service) {\n const existing = this.#services.get(service.name);\n if (existing === service) {\n return service;\n }\n !(existing === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `A different ${service.name} service is already registered`) : invariant(false) : void 0;\n this.#services.set(service.name, service);\n service.attach({\n discoverer: this.#discoverer,\n statusServer: this.#statusServer\n });\n for (const dependency of service.dependencies) {\n this.register(dependency);\n }\n return service;\n }\n async start() {\n await this.#ensureDiscovering();\n this.#assertAcyclic();\n const results = await Promise.allSettled([...this.#services.values()].map(service => this.#start(service)));\n const failed = results.find(result => result.status === \"rejected\");\n if (failed !== undefined) {\n await this.stop();\n throw failed.reason;\n }\n }\n async startService(service) {\n this.register(service);\n await this.#ensureDiscovering();\n this.#assertAcyclic();\n await this.#start(service);\n }\n async #ensureDiscovering() {\n if (!this.#started) {\n await this.#discoverer.start();\n this.#started = true;\n }\n }\n async #start(service) {\n const runningPromise = this.#starts.get(service.name);\n if (typeof runningPromise !== \"undefined\") {\n return runningPromise;\n }\n const started = this.#startImmediate(service);\n this.#starts.set(service.name, started);\n try {\n await started;\n } catch (err) {\n this.#starts.delete(service.name);\n throw err;\n }\n }\n async #startImmediate(service) {\n await Promise.all(this.#prerequisites(service).map(dependency => this.#start(dependency)));\n await service.start();\n await this.waitUntilReady(service);\n }\n\n /**\n * Everything that must be ready before `service` may start: its declared\n * dependencies, plus the status server.\n */\n #prerequisites(service) {\n return service.name === this.#statusServer.name ? service.dependencies : [this.#statusServer, ...service.dependencies];\n }\n\n /**\n * Poll a service's health until it is ready, reaches a terminal state, or\n * exceeds its timeout.\n */\n async waitUntilReady(service) {\n const deadline = Date.now() + DEFAULT_READY_TIMEOUT_MS;\n let health = await service.checkHealth();\n while (!health.ready) {\n const current = health;\n const notReady = () => `${service.name} is not ready (${current.state})${formatError(service, current)}`;\n !!current.terminal ? process.env.NODE_ENV !== \"production\" ? invariant(false, notReady) : invariant(false) : void 0;\n !(service.getExitInfo() === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, notReady) : invariant(false) : void 0;\n !(Date.now() < deadline) ? process.env.NODE_ENV !== \"production\" ? invariant(false, () => `${service.name} is not ready (${current.state}) within ` + `${DEFAULT_READY_TIMEOUT_MS}ms${formatError(service, current)}`) : invariant(false) : void 0;\n await setTimeout(HEALTH_POLL_INTERVAL_MS);\n await this.#discoverer.refresh();\n health = await service.checkHealth();\n }\n return health;\n }\n async checkHealth() {\n await this.#discoverer.refresh();\n return Promise.all([...this.#services.values()].map(service => service.checkHealth()));\n }\n async checkDependencies(service) {\n await this.#discoverer.refresh();\n return Promise.all(service.dependencies.map(dependency => dependency.checkHealth()));\n }\n async dependenciesReady(service) {\n const healths = await this.checkDependencies(service);\n return healths.every(({\n ready\n }) => ready);\n }\n\n /**\n * Stop every service, dependents before their dependencies, waiting for each\n * process to be gone before the next is signalled.\n */\n async stop() {\n for (const service of this.#startupOrder().reverse()) {\n await service.stop();\n }\n this.#starts.clear();\n this.#discoverer.stop();\n this.#started = false;\n }\n\n /**\n * Registered services in a valid startup order: every service appears after\n * everything it depends on.\n */\n #startupOrder() {\n const ordered = [];\n const seen = new Set();\n const visit = service => {\n if (seen.has(service.name)) {\n return;\n }\n seen.add(service.name);\n for (const dependency of this.#prerequisites(service)) {\n visit(dependency);\n }\n ordered.push(service);\n };\n for (const service of this.#services.values()) {\n visit(service);\n }\n return ordered;\n }\n #assertAcyclic() {\n const settled = new Set();\n const visit = (service, walkedPath) => {\n if (settled.has(service.name)) {\n return;\n }\n const cycleStart = walkedPath.indexOf(service.name);\n !(cycleStart === -1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, () => `Dependency cycle between services: ${[...walkedPath.slice(cycleStart), service.name].join(\" -> \")}`) : invariant(false) : void 0;\n for (const dependency of this.#prerequisites(service)) {\n visit(dependency, [...walkedPath, service.name]);\n }\n settled.add(service.name);\n };\n for (const service of this.#services.values()) {\n visit(service, []);\n }\n }\n}\nconst formatError = (service, health) => {\n const parts = [];\n if (health.message != null && health.message.length > 0) {\n parts.push(health.message);\n }\n const exit = service.getExitInfo();\n if (exit !== undefined) {\n parts.push(`the process exited (${exit})`);\n }\n const stderr = service.getCapturedStderr();\n if (stderr.length > 0) {\n parts.push(`stderr:\\n${stderr}`);\n }\n return parts.length === 0 ? \"\" : `: ${parts.join(\"; \")}`;\n};","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path, { isAbsolute, resolve } from \"node:path\";\nimport { FoundryCliService } from \"./FoundryCliService.js\";\nexport class OntologyServer extends FoundryCliService {\n #metadataPath;\n constructor(config) {\n super(\"ONTOLOGY\", config);\n this.#metadataPath = isAbsolute(config.metadataPath) ? config.metadataPath : resolve(config.projectPath, config.metadataPath);\n }\n getMetadataPath() {\n return this.#metadataPath;\n }\n getArgs() {\n return [\"start\", \"ontology\", \"--skip-build\", \"--metadata\", this.#metadataPath, \"--discovery-path\", path.resolve(this.getProjectPath(), \".palantir\")];\n }\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SeedBuilder } from \"@osdk/seed-helpers\";\nimport { OntologySeedingService } from \"./generated/cli/index.js\";\nexport function createSeedClient(config) {\n const {\n baseUrl,\n metadata,\n fetchFn\n } = config;\n const builder = new SeedBuilder(metadata);\n const seedClientFunction = async seed => {\n let result;\n if (typeof seed === \"function\") {\n result = seed(builder);\n } else {\n builder.addAll(seed);\n }\n await applySeed(builder.build());\n return result;\n };\n const applySeed = async seed => {\n const res = await OntologySeedingService.setSeed({\n baseUrl,\n servicePath: \"/api\",\n fetchFn\n }, seed);\n return res;\n };\n const seedClientUtils = {\n ref: (o, pk) => builder.ref(o, pk),\n addAll: async output => {\n builder.addAll(output);\n await applySeed(builder.build());\n },\n set: async output => {\n builder.set(output);\n await applySeed(builder.build());\n },\n create: async (o, props) => {\n const ref = builder.create(o, props);\n await applySeed(builder.build());\n return ref;\n },\n update: async (ref, props) => {\n const returnedRef = builder.update(ref, props);\n await applySeed(builder.build());\n return returnedRef;\n },\n delete: async ref => {\n builder.delete(ref);\n await applySeed(builder.build());\n },\n link: async (source, apiName, target) => {\n builder.link(source, apiName, target);\n await applySeed(builder.build());\n },\n unlink: async (source, apiName, target) => {\n builder.unlink(source, apiName, target);\n await applySeed(builder.build());\n }\n };\n return Object.defineProperties(seedClientFunction, Object.getOwnPropertyDescriptors(seedClientUtils));\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const EMPTY_ONTOLOGY_BLOCK_DATA = {\n objectTypes: {},\n sharedPropertyTypes: {},\n interfaceTypes: {},\n linkTypes: {},\n actionTypes: {},\n blockPermissionInformation: {\n actionTypes: {},\n objectTypes: {},\n linkTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {}\n },\n blockOutputCompassLocations: {},\n knownIdentifiers: {\n actionParameterIds: {},\n actionParameters: {},\n actionTypes: {},\n datasourceColumns: {},\n datasources: {},\n filesDatasources: {},\n functions: {},\n geotimeSeriesSyncs: {},\n groupIds: {},\n interfaceActionTypeConstraints: {},\n interfaceLinkTypes: {},\n interfaceParameterConstraints: {},\n interfacePropertyTypes: {},\n interfaceTypes: {},\n linkTypeIds: {},\n linkTypes: {},\n markings: {},\n objectPropertyTypeIdsToRids: {},\n objectTypeIds: {},\n objectTypes: {},\n propertyTypeIds: {},\n propertyTypes: {},\n sharedPropertyTypes: {},\n structFieldRidsToApiNames: {},\n timeSeriesSyncs: {},\n valueTypes: {},\n webhooks: {},\n workshopModules: {}\n },\n ruleSets: {}\n};","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { PreviewOntologyIrConverter } from \"@osdk/generator-converters.preview\";\nimport invariant from \"tiny-invariant\";\nimport { Agent, fetch as undiciFetch } from \"undici\";\nimport { CliServiceLauncher } from \"./cli-service/CliServiceLauncher.js\";\nimport { OntologyServer } from \"./cli-service/OntologyServer.js\";\nimport { createIntegrationClientForRunningServer } from \"./createIntegrationClient.js\";\nimport { createSeedClient } from \"./createSeedClient.js\";\nimport { EMPTY_ONTOLOGY_BLOCK_DATA } from \"./utils/empty-ontology-block.js\";\nconst transformMetadata = metadata => {\n const transformed = PreviewOntologyIrConverter.getPreviewFullMetadataFromBlockData(EMPTY_ONTOLOGY_BLOCK_DATA, metadata);\n return {\n ...transformed,\n ontology: metadata.ontology\n };\n};\nconst writeMetadata = async args => {\n const {\n metadataPath,\n previewMetadata\n } = args;\n const stringified = JSON.stringify(previewMetadata);\n await fs.writeFile(metadataPath, stringified);\n};\nexport async function createIntegrationServer(config) {\n const {\n metadata,\n projectPath = process.cwd(),\n foundryCliPath\n } = config;\n const testPath = await fs.mkdtemp(path.join(projectPath, \".test-run-\"));\n const metadataPath = path.resolve(testPath, \"ontology-metadata.json\");\n const previewMetadata = transformMetadata(metadata);\n const serviceLauncher = new CliServiceLauncher({\n projectDir: testPath,\n foundryCliPath\n });\n // write metadata to metadataPath for foundry cli to read from\n await writeMetadata({\n previewMetadata,\n metadataPath\n });\n const ontology = serviceLauncher.register(new OntologyServer({\n projectPath: testPath,\n metadataPath,\n foundryCliPath\n }));\n\n // stateful cache of client and seed client\n let client;\n let seedClient;\n return {\n getOntologyUrl: () => ontology.getUrl(),\n start: async () => {\n await serviceLauncher.start();\n },\n stop: async () => {\n await serviceLauncher.stop();\n await fs.rm(testPath, {\n recursive: true,\n force: true\n });\n },\n getSeedClient: async () => {\n if (seedClient !== undefined) return seedClient;\n const baseUrl = ontology.getUrl();\n !baseUrl ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Ontology server is not ready\") : invariant(false) : void 0;\n const caCertPath = ontology.getCaCertPath();\n !caCertPath ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Ontology server is not ready\") : invariant(false) : void 0;\n const agent = new Agent({\n connect: caCertPath ? {\n ca: await fs.readFile(caCertPath)\n } : {\n rejectUnauthorized: false\n }\n });\n const fetchWithCert = (input, init) => undiciFetch(input, {\n ...init,\n dispatcher: agent\n });\n return seedClient = createSeedClient({\n baseUrl,\n metadata,\n fetchFn: fetchWithCert\n });\n },\n getClient: async () => {\n if (client !== undefined) return client;\n const baseUrl = ontology.getUrl();\n !baseUrl ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Ontology server is not ready\") : invariant(false) : void 0;\n return client = await createIntegrationClientForRunningServer({\n baseUrl,\n metadata,\n caCertPath: ontology.getCaCertPath()\n });\n }\n };\n}"]}
@@ -17,11 +17,18 @@
17
17
  import fs from "node:fs/promises";
18
18
  import { createClient } from "@osdk/client";
19
19
  import { createMockClient } from "@osdk/unit-testing";
20
+ import invariant from "tiny-invariant";
20
21
  import { fetch as undiciFetch, Agent } from "undici";
22
+ import { checkFoundryCliVersion } from "./utils/foundry-cli.js";
21
23
 
22
24
  /** The definition kinds accepted by {@link Client}'s call signatures. */
23
25
 
24
26
  export async function createIntegrationClient(config) {
27
+ const foundryCli = await checkFoundryCliVersion();
28
+ !(foundryCli.type !== "not-found") ? process.env.NODE_ENV !== "production" ? invariant(false, "Foundry CLI must be installed before creating an integration client.") : invariant(false) : void 0;
29
+ return createIntegrationClientForRunningServer(config);
30
+ }
31
+ export async function createIntegrationClientForRunningServer(config) {
25
32
  const {
26
33
  baseUrl,
27
34
  metadata,
@@ -1 +1 @@
1
- {"version":3,"file":"createIntegrationClient.js","names":["fs","createClient","createMockClient","fetch","undiciFetch","Agent","createIntegrationClient","config","baseUrl","metadata","caCertPath","agent","connect","ca","readFile","rejectUnauthorized","realClient","ontology","rid","Promise","resolve","input","init","dispatcher","mockClient","client","Object","defineProperties","def","type","getOwnPropertyDescriptors","whenQuery","value","bind","undefined","clearStubs"],"sources":["createIntegrationClient.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\n\nimport type {\n ActionDefinition,\n InterfaceDefinition,\n ObjectTypeDefinition,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type { Experiment } from \"@osdk/api/unstable\";\nimport { createClient, type Client } from \"@osdk/client\";\nimport { createMockClient } from \"@osdk/unit-testing\";\nimport { fetch as undiciFetch, Agent } from \"undici\";\n\nimport type { IntegrationClient, IntegrationClientConfig } from \"./types.js\";\n\n/** The definition kinds accepted by {@link Client}'s call signatures. */\ntype ClientArg =\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition\n | QueryDefinition\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Experiment<any>;\n\nexport async function createIntegrationClient(\n config: IntegrationClientConfig,\n): Promise<IntegrationClient> {\n const { baseUrl, metadata, caCertPath } = config;\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n const realClient = createClient(\n baseUrl,\n metadata.ontology.rid,\n () => Promise.resolve(\"integration-client-token\"),\n {},\n fetchWithCert,\n );\n const mockClient = createMockClient();\n const clientInternal = ((def: ClientArg) => {\n switch (def.type) {\n case \"query\":\n return mockClient(def);\n case \"action\":\n return realClient(def);\n case \"interface\":\n return realClient(def);\n case \"object\":\n return realClient(def);\n case \"experiment\":\n default:\n return realClient(def);\n }\n }) as Client;\n const client = Object.defineProperties<IntegrationClient>(\n clientInternal as IntegrationClient,\n {\n ...Object.getOwnPropertyDescriptors(realClient),\n whenQuery: {\n value: mockClient.whenQuery.bind(undefined),\n },\n clearStubs: {\n value: mockClient.clearStubs.bind(undefined),\n },\n },\n );\n return client;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,kBAAkB;AASjC,SAASC,YAAY,QAAqB,cAAc;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,WAAW,EAAEC,KAAK,QAAQ,QAAQ;;AAIpD;;AASA,OAAO,eAAeC,uBAAuBA,CAC3CC,MAA+B,EACH;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C7C;EACF,CACF,CAAC;EACD,OAAOT,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"createIntegrationClient.js","names":["fs","createClient","createMockClient","invariant","fetch","undiciFetch","Agent","checkFoundryCliVersion","createIntegrationClient","config","foundryCli","type","process","env","NODE_ENV","createIntegrationClientForRunningServer","baseUrl","metadata","caCertPath","agent","connect","ca","readFile","rejectUnauthorized","realClient","ontology","rid","Promise","resolve","input","init","dispatcher","mockClient","client","Object","defineProperties","def","getOwnPropertyDescriptors","whenQuery","value","bind","undefined","clearStubs"],"sources":["createIntegrationClient.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\n\nimport type {\n ActionDefinition,\n InterfaceDefinition,\n ObjectTypeDefinition,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type { Experiment } from \"@osdk/api/unstable\";\nimport { createClient, type Client } from \"@osdk/client\";\nimport { createMockClient } from \"@osdk/unit-testing\";\nimport invariant from \"tiny-invariant\";\nimport { fetch as undiciFetch, Agent } from \"undici\";\n\nimport type { IntegrationClient, IntegrationClientConfig } from \"./types.js\";\nimport { checkFoundryCliVersion } from \"./utils/foundry-cli.js\";\n\n/** The definition kinds accepted by {@link Client}'s call signatures. */\ntype ClientArg =\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition\n | QueryDefinition\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Experiment<any>;\n\nexport async function createIntegrationClient(\n config: IntegrationClientConfig,\n): Promise<IntegrationClient> {\n const foundryCli = await checkFoundryCliVersion();\n invariant(\n foundryCli.type !== \"not-found\",\n \"Foundry CLI must be installed before creating an integration client.\",\n );\n return createIntegrationClientForRunningServer(config);\n}\n\nexport async function createIntegrationClientForRunningServer(\n config: IntegrationClientConfig,\n): Promise<IntegrationClient> {\n const { baseUrl, metadata, caCertPath } = config;\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n const realClient = createClient(\n baseUrl,\n metadata.ontology.rid,\n () => Promise.resolve(\"integration-client-token\"),\n {},\n fetchWithCert,\n );\n const mockClient = createMockClient();\n const clientInternal = ((def: ClientArg) => {\n switch (def.type) {\n case \"query\":\n return mockClient(def);\n case \"action\":\n return realClient(def);\n case \"interface\":\n return realClient(def);\n case \"object\":\n return realClient(def);\n case \"experiment\":\n default:\n return realClient(def);\n }\n }) as Client;\n const client = Object.defineProperties<IntegrationClient>(\n clientInternal as IntegrationClient,\n {\n ...Object.getOwnPropertyDescriptors(realClient),\n whenQuery: {\n value: mockClient.whenQuery.bind(undefined),\n },\n clearStubs: {\n value: mockClient.clearStubs.bind(undefined),\n },\n },\n );\n return client;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,EAAE,MAAM,kBAAkB;AASjC,SAASC,YAAY,QAAqB,cAAc;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,KAAK,IAAIC,WAAW,EAAEC,KAAK,QAAQ,QAAQ;AAGpD,SAASC,sBAAsB,QAAQ,wBAAwB;;AAE/D;;AASA,OAAO,eAAeC,uBAAuBA,CAC3CC,MAA+B,EACH;EAC5B,MAAMC,UAAU,GAAG,MAAMH,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C1B;EACF,CAAC,EAGC;IACE,GAAGF,MAAM,CAACG,yBAAyB,CAACb,UAAU,CAAC;IAC/Cc,SAAS,EAAE;MACTC,KAAK,EAAEP,UAAU,CAACM,SAAS,CAACE,IAAI,CAACC,SAAS;IAC5C,CAAC;IACDC,UAAU,EAAE;MACVH,KAAK,EAAEP,UAAU,CAACU,UAAU,CAACF,IAAI,CAACC,SAAS;IAC7C;EACF,CACF,CAAC;EACD,OAAOR,MAAM;AACf","ignoreList":[]}
@@ -21,7 +21,7 @@ import invariant from "tiny-invariant";
21
21
  import { Agent, fetch as undiciFetch } from "undici";
22
22
  import { CliServiceLauncher } from "./cli-service/CliServiceLauncher.js";
23
23
  import { OntologyServer } from "./cli-service/OntologyServer.js";
24
- import { createIntegrationClient } from "./createIntegrationClient.js";
24
+ import { createIntegrationClientForRunningServer } from "./createIntegrationClient.js";
25
25
  import { createSeedClient } from "./createSeedClient.js";
26
26
  import { EMPTY_ONTOLOGY_BLOCK_DATA } from "./utils/empty-ontology-block.js";
27
27
  const transformMetadata = metadata => {
@@ -104,7 +104,7 @@ export async function createIntegrationServer(config) {
104
104
  if (client !== undefined) return client;
105
105
  const baseUrl = ontology.getUrl();
106
106
  !baseUrl ? process.env.NODE_ENV !== "production" ? invariant(false, "Ontology server is not ready") : invariant(false) : void 0;
107
- return client = await createIntegrationClient({
107
+ return client = await createIntegrationClientForRunningServer({
108
108
  baseUrl,
109
109
  metadata,
110
110
  caCertPath: ontology.getCaCertPath()
@@ -1 +1 @@
1
- {"version":3,"file":"createIntegrationServer.js","names":["fs","path","PreviewOntologyIrConverter","invariant","Agent","fetch","undiciFetch","CliServiceLauncher","OntologyServer","createIntegrationClient","createSeedClient","EMPTY_ONTOLOGY_BLOCK_DATA","transformMetadata","metadata","transformed","getPreviewFullMetadataFromBlockData","ontology","writeMetadata","args","metadataPath","previewMetadata","stringified","JSON","stringify","writeFile","createIntegrationServer","config","projectPath","process","cwd","foundryCliPath","testPath","mkdtemp","join","resolve","serviceLauncher","projectDir","register","client","seedClient","getOntologyUrl","getUrl","start","stop","rm","recursive","force","getSeedClient","undefined","baseUrl","env","NODE_ENV","caCertPath","getCaCertPath","agent","connect","ca","readFile","rejectUnauthorized","fetchFn","input","init","dispatcher","getClient"],"sources":["createIntegrationServer.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport type { PreviewOntologyFullMetadata } from \"@osdk/generator-converters.preview\";\nimport { PreviewOntologyIrConverter } from \"@osdk/generator-converters.preview\";\nimport invariant from \"tiny-invariant\";\nimport { Agent, fetch as undiciFetch } from \"undici\";\n\nimport { CliServiceLauncher } from \"./cli-service/CliServiceLauncher.js\";\nimport { OntologyServer } from \"./cli-service/OntologyServer.js\";\nimport { createIntegrationClient } from \"./createIntegrationClient.js\";\nimport { createSeedClient } from \"./createSeedClient.js\";\nimport type {\n IntegrationClient,\n IntegrationServer,\n IntegrationServerConfig,\n SeedClient,\n} from \"./types.js\";\nimport { EMPTY_ONTOLOGY_BLOCK_DATA } from \"./utils/empty-ontology-block.js\";\n\nconst transformMetadata = (\n metadata: OntologyFullMetadata,\n): PreviewOntologyFullMetadata => {\n const transformed =\n PreviewOntologyIrConverter.getPreviewFullMetadataFromBlockData(\n EMPTY_ONTOLOGY_BLOCK_DATA,\n metadata,\n );\n return {\n ...transformed,\n ontology: metadata.ontology,\n };\n};\n\nconst writeMetadata = async (args: {\n metadataPath: string;\n previewMetadata: PreviewOntologyFullMetadata;\n}) => {\n const { metadataPath, previewMetadata } = args;\n const stringified = JSON.stringify(previewMetadata);\n await fs.writeFile(metadataPath, stringified);\n};\nexport async function createIntegrationServer(\n config: IntegrationServerConfig,\n): Promise<IntegrationServer> {\n const { metadata, projectPath = process.cwd(), foundryCliPath } = config;\n\n const testPath = await fs.mkdtemp(path.join(projectPath, \".test-run-\"));\n const metadataPath = path.resolve(testPath, \"ontology-metadata.json\");\n const previewMetadata = transformMetadata(metadata);\n\n const serviceLauncher = new CliServiceLauncher({\n projectDir: testPath,\n foundryCliPath,\n });\n // write metadata to metadataPath for foundry cli to read from\n await writeMetadata({\n previewMetadata,\n metadataPath,\n });\n\n const ontology = serviceLauncher.register(\n new OntologyServer({\n projectPath: testPath,\n metadataPath,\n foundryCliPath,\n }),\n );\n\n // stateful cache of client and seed client\n let client: IntegrationClient | undefined;\n let seedClient: SeedClient | undefined;\n\n return {\n getOntologyUrl: () => ontology.getUrl(),\n start: async () => {\n await serviceLauncher.start();\n },\n stop: async () => {\n await serviceLauncher.stop();\n await fs.rm(testPath, { recursive: true, force: true });\n },\n getSeedClient: async () => {\n if (seedClient !== undefined) return seedClient;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n const caCertPath = ontology.getCaCertPath();\n invariant(caCertPath, \"Ontology server is not ready\");\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n return (seedClient = createSeedClient({\n baseUrl,\n metadata,\n fetchFn: fetchWithCert,\n }));\n },\n getClient: async () => {\n if (client !== undefined) return client;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n return (client = await createIntegrationClient({\n baseUrl,\n metadata,\n caCertPath: ontology.getCaCertPath(),\n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AAAC,QAAA,oBAApBhD,SAAS,QAAa,8BAA8B,IAApDA,SAAS;MACT,MAAMmD,KAAK,GAAG,IAAIlD,KAAK,CAAC;QACtBmD,OAAO,EAAEH,UAAU,GACf;UACEI,EAAE,EAAE,MAAMxD,EAAE,CAACyD,QAAQ,CAACL,UAAU;QAClC,CAAC,GACD;UACEM,kBAAkB,EAAE;QACtB;MACN,CAAC,CAAC;MAMF,OAAQnB,UAAU,GAAG7B,gBAAgB,CAAC;QACpCuC,OAAO;QACPpC,QAAQ;QACR8C,OAAO,EARcA,CAACC,KAAK,EAAEC,IAAI,KACjCvD,WAAW,CAACsD,KAAK,EAAE;UACjB,GAAGC,IAAI;UACPC,UAAU,EAAER;QACd,CAAC;MAKH,CAAC,CAAC;IACJ,CAAC;IACDS,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,IAAIzB,MAAM,KAAKU,SAAS,EAAE,OAAOV,MAAM;MACvC,MAAMW,OAAO,GAAGjC,QAAQ,CAACyB,MAAM,CAAC,CAAC;MACjC,CAAUQ,OAAO,GAAArB,OAAA,CAAAsB,GAAA,CAAAC,QAAA,oBAAjBhD,SAAS,QAAU,8BAA8B,IAAjDA,SAAS;MACT,OAAQmC,MAAM,GAAG,MAAM7B,uBAAuB,CAAC;QAC7CwC,OAAO;QACPpC,QAAQ;QACRuC,UAAU,EAAEpC,QAAQ,CAACqC,aAAa,CAAC;MACrC,CAAC,CAAC;IACJ;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"createIntegrationServer.js","names":["fs","path","PreviewOntologyIrConverter","invariant","Agent","fetch","undiciFetch","CliServiceLauncher","OntologyServer","createIntegrationClientForRunningServer","createSeedClient","EMPTY_ONTOLOGY_BLOCK_DATA","transformMetadata","metadata","transformed","getPreviewFullMetadataFromBlockData","ontology","writeMetadata","args","metadataPath","previewMetadata","stringified","JSON","stringify","writeFile","createIntegrationServer","config","projectPath","process","cwd","foundryCliPath","testPath","mkdtemp","join","resolve","serviceLauncher","projectDir","register","client","seedClient","getOntologyUrl","getUrl","start","stop","rm","recursive","force","getSeedClient","undefined","baseUrl","env","NODE_ENV","caCertPath","getCaCertPath","agent","connect","ca","readFile","rejectUnauthorized","fetchFn","input","init","dispatcher","getClient"],"sources":["createIntegrationServer.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport type { PreviewOntologyFullMetadata } from \"@osdk/generator-converters.preview\";\nimport { PreviewOntologyIrConverter } from \"@osdk/generator-converters.preview\";\nimport invariant from \"tiny-invariant\";\nimport { Agent, fetch as undiciFetch } from \"undici\";\n\nimport { CliServiceLauncher } from \"./cli-service/CliServiceLauncher.js\";\nimport { OntologyServer } from \"./cli-service/OntologyServer.js\";\nimport { createIntegrationClientForRunningServer } from \"./createIntegrationClient.js\";\nimport { createSeedClient } from \"./createSeedClient.js\";\nimport type {\n IntegrationClient,\n IntegrationServer,\n IntegrationServerConfig,\n SeedClient,\n} from \"./types.js\";\nimport { EMPTY_ONTOLOGY_BLOCK_DATA } from \"./utils/empty-ontology-block.js\";\n\nconst transformMetadata = (\n metadata: OntologyFullMetadata,\n): PreviewOntologyFullMetadata => {\n const transformed =\n PreviewOntologyIrConverter.getPreviewFullMetadataFromBlockData(\n EMPTY_ONTOLOGY_BLOCK_DATA,\n metadata,\n );\n return {\n ...transformed,\n ontology: metadata.ontology,\n };\n};\n\nconst writeMetadata = async (args: {\n metadataPath: string;\n previewMetadata: PreviewOntologyFullMetadata;\n}) => {\n const { metadataPath, previewMetadata } = args;\n const stringified = JSON.stringify(previewMetadata);\n await fs.writeFile(metadataPath, stringified);\n};\nexport async function createIntegrationServer(\n config: IntegrationServerConfig,\n): Promise<IntegrationServer> {\n const { metadata, projectPath = process.cwd(), foundryCliPath } = config;\n\n const testPath = await fs.mkdtemp(path.join(projectPath, \".test-run-\"));\n const metadataPath = path.resolve(testPath, \"ontology-metadata.json\");\n const previewMetadata = transformMetadata(metadata);\n\n const serviceLauncher = new CliServiceLauncher({\n projectDir: testPath,\n foundryCliPath,\n });\n // write metadata to metadataPath for foundry cli to read from\n await writeMetadata({\n previewMetadata,\n metadataPath,\n });\n\n const ontology = serviceLauncher.register(\n new OntologyServer({\n projectPath: testPath,\n metadataPath,\n foundryCliPath,\n }),\n );\n\n // stateful cache of client and seed client\n let client: IntegrationClient | undefined;\n let seedClient: SeedClient | undefined;\n\n return {\n getOntologyUrl: () => ontology.getUrl(),\n start: async () => {\n await serviceLauncher.start();\n },\n stop: async () => {\n await serviceLauncher.stop();\n await fs.rm(testPath, { recursive: true, force: true });\n },\n getSeedClient: async () => {\n if (seedClient !== undefined) return seedClient;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n const caCertPath = ontology.getCaCertPath();\n invariant(caCertPath, \"Ontology server is not ready\");\n const agent = new Agent({\n connect: caCertPath\n ? {\n ca: await fs.readFile(caCertPath),\n }\n : {\n rejectUnauthorized: false,\n },\n });\n const fetchWithCert = ((input, init) =>\n undiciFetch(input, {\n ...init,\n dispatcher: agent,\n })) satisfies typeof undiciFetch as unknown as typeof fetch;\n return (seedClient = createSeedClient({\n baseUrl,\n metadata,\n fetchFn: fetchWithCert,\n }));\n },\n getClient: async () => {\n if (client !== undefined) return client;\n const baseUrl = ontology.getUrl();\n invariant(baseUrl, \"Ontology server is not ready\");\n return (client = await createIntegrationClientForRunningServer({\n baseUrl,\n metadata,\n caCertPath: ontology.getCaCertP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AAA,CAAAC,QAAA,oBAApBhD,SAAS,QAAa,8BAA8B,IAApDA,SAAS;MACT,MAAMmD,KAAK,GAAG,IAAIlD,KAAK,CAAC;QACtBmD,OAAO,EAAEH,UAAU,GACf;UACEI,EAAE,EAAE,MAAMxD,EAAE,CAACyD,QAAQ,CAACL,UAAU;QAClC,CAAC,GACD;UACEM,kBAAkB,EAAE;QACtB;MACN,CAAC,CAAC;MAMF,OAAQnB,UAAU,GAAG7B,gBAAgB,CAAC;QACpCuC,OAAO;QACPpC,QAAQ;QACR8C,OAAO,EARcA,CAACC,KAAK,EAAEC,IAAI,KACjCvD,WAAW,CAACsD,KAAK,EAAE;UACjB,GAAGC,IAAI;UACPC,UAAU,EAAER;QACd,CAAC;MAKH,CAAC,CAAC;IACJ,CAAC;IACDS,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,IAAIzB,MAAM,KAAKU,SAAS,EAAE,OAAOV,MAAM;MACvC,MAAMW,OAAO,GAAGjC,QAAQ,CAACyB,MAAM,CAAC,CAAC;MACjC,CAAUQ,OAAO,GAAArB,OAAA,CAAAsB,GAAA,CAAAC,QAAA,oBAAjBhD,SAAS,QAAU,8BAA8B,IAAjDA,SAAS;MACT,OAAQmC,MAAM,GAAG,MAAM7B,uCAAuC,CAAC;QAC7DwC,OAAO;QACPpC,QAAQ;QACRuC,UAAU,EAAEpC,QAAQ,CAACqC,aAAa,CAAC;MACrC,CAAC,CAAC;IACJ;EACF,CAAC;AACH","ignoreList":[]}
@@ -38,7 +38,11 @@ export const postinstall = async () => {
38
38
  return;
39
39
  case "not-found":
40
40
  consola.info(`Foundry CLI not found locally, attempting to install...`);
41
- await installFoundryCli();
41
+ try {
42
+ await installFoundryCli();
43
+ } catch (error) {
44
+ consola.warn(`Failed to install Foundry CLI. It must be installed before creating an integration client.`, error);
45
+ }
42
46
  }
43
47
  };
44
48
  //# sourceMappingURL=postinstall.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postinstall.js","names":["consola","invariant","checkFoundryCliVersion","MIN_FOUNDRY_CLI_VERSION","installFoundryCli","readGitRemoteUrl","postinstall","remote","info","result","type","version","warn","process","env","NODE_ENV"],"sources":["postinstall.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport consola from \"consola\";\nimport invariant from \"tiny-invariant\";\n\nimport {\n checkFoundryCliVersion,\n MIN_FOUNDRY_CLI_VERSION,\n} from \"../utils/foundry-cli.js\";\nimport { installFoundryCli } from \"./download.js\";\nimport { readGitRemoteUrl } from \"./gitRemote.js\";\n\nexport const postinstall = async (): Promise<void> => {\n const remote = await readGitRemoteUrl();\n if (\n remote === \"git@github.com:palantir/osdk-ts.git\" ||\n remote === \"https://github.com/palantir/osdk-ts.git\"\n ) {\n consola.info(`✅ In osdk-ts repo, skipping installation.`);\n return;\n }\n const result = await checkFoundryCliVersion();\n switch (result.type) {\n case \"installed\":\n consola.info(\n `✅ Foundry CLI (v${result.version}) is installed already, skipping installation.`,\n );\n return;\n case \"version-error\":\n consola.warn(\n `Foundry CLI is installed, but we could not probe its version.`,\n );\n return;\n case \"version-incompatible\":\n invariant(\n false,\n `Foundry CLI (v${result.version}) is installed already, but the minimum required version is ${MIN_FOUNDRY_CLI_VERSION}. Please run \"foundry update self\" to update foundry cli.`,\n );\n return;\n case \"not-found\":\n consola.info(`Foundry CLI not found locally, attempting to install...`);\n await installFoundryCli();\n return;\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,OAAO,MAAM,SAAS;AAC7B,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,gBAAgB,QAAQ,gBAAgB;AAEjD,OAAO,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAA2B;EACpD,MAAMC,MAAM,GAAG,MAAMF,gBAAgB,CAAC,CAAC;EACvC,IACEE,MAAM,KAAK,qCAAqC,IAChDA,MAAM,KAAK,yCAAyC,EACpD;IACAP,OAAO,CAACQ,IAAI,CAAC,2CAA2C,CAAC;IACzD;EACF;EACA,MAAMC,MAAM,GAAG,MAAMP,sBAAsB,CAAC,CAAC;EAC7C,QAAQO,MAAM,CAACC,IAAI;IACjB,KAAK,WAAW;MACdV,OAAO,CAACQ,IAAI,CACV,mBAAmBC,MAAM,CAACE,OAAO,gDACnC,CAAC;MACD;IACF,KAAK,eAAe;MAClBX,OAAO,CAACY,IAAI,CACV,+DACF,CAAC;MACD;IACF,KAAK,sBAAsB;MACzBC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAd,SAAS,QAEP,iBAAiBQ,MAAM,CAACE,OAAO,+DAA+DR,uBAAuB,2DAA2D,IAFlLF,SAAS;MAIT;IACF,KAAK,WAAW;MACdD,OAAO,CAACQ,IAAI,CAAC,yDAAyD,CAAC;MACvE,MAAMJ,iBAAiB,CAAC,CAAC;EAE7B;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"postinstall.js","names":["consola","invariant","checkFoundryCliVersion","MIN_FOUNDRY_CLI_VERSION","installFoundryCli","readGitRemoteUrl","postinstall","remote","info","result","type","version","warn","process","env","NODE_ENV","error"],"sources":["postinstall.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport consola from \"consola\";\nimport invariant from \"tiny-invariant\";\n\nimport {\n checkFoundryCliVersion,\n MIN_FOUNDRY_CLI_VERSION,\n} from \"../utils/foundry-cli.js\";\nimport { installFoundryCli } from \"./download.js\";\nimport { readGitRemoteUrl } from \"./gitRemote.js\";\n\nexport const postinstall = async (): Promise<void> => {\n const remote = await readGitRemoteUrl();\n if (\n remote === \"git@github.com:palantir/osdk-ts.git\" ||\n remote === \"https://github.com/palantir/osdk-ts.git\"\n ) {\n consola.info(`✅ In osdk-ts repo, skipping installation.`);\n return;\n }\n const result = await checkFoundryCliVersion();\n switch (result.type) {\n case \"installed\":\n consola.info(\n `✅ Foundry CLI (v${result.version}) is installed already, skipping installation.`,\n );\n return;\n case \"version-error\":\n consola.warn(\n `Foundry CLI is installed, but we could not probe its version.`,\n );\n return;\n case \"version-incompatible\":\n invariant(\n false,\n `Foundry CLI (v${result.version}) is installed already, but the minimum required version is ${MIN_FOUNDRY_CLI_VERSION}. Please run \"foundry update self\" to update foundry cli.`,\n );\n return;\n case \"not-found\":\n consola.info(`Foundry CLI not found locally, attempting to install...`);\n try {\n await installFoundryCli();\n } catch (error) {\n consola.warn(\n `Failed to install Foundry CLI. It must be installed before creating an integration client.`,\n error,\n );\n }\n return;\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,OAAO,MAAM,SAAS;AAC7B,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,gBAAgB,QAAQ,gBAAgB;AAEjD,OAAO,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAA2B;EACpD,MAAMC,MAAM,GAAG,MAAMF,gBAAgB,CAAC,CAAC;EACvC,IACEE,MAAM,KAAK,qCAAqC,IAChDA,MAAM,KAAK,yCAAyC,EACpD;IACAP,OAAO,CAACQ,IAAI,CAAC,2CAA2C,CAAC;IACzD;EACF;EACA,MAAMC,MAAM,GAAG,MAAMP,sBAAsB,CAAC,CAAC;EAC7C,QAAQO,MAAM,CAACC,IAAI;IACjB,KAAK,WAAW;MACdV,OAAO,CAACQ,IAAI,CACV,mBAAmBC,MAAM,CAACE,OAAO,gDACnC,CAAC;MACD;IACF,KAAK,eAAe;MAClBX,OAAO,CAACY,IAAI,CACV,+DACF,CAAC;MACD;IACF,KAAK,sBAAsB;MACzBC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAd,SAAS,QAEP,iBAAiBQ,MAAM,CAACE,OAAO,+DAA+DR,uBAAuB,2DAA2D,IAFlLF,SAAS;MAIT;IACF,KAAK,WAAW;MACdD,OAAO,CAACQ,IAAI,CAAC,yDAAyD,CAAC;MACvE,IAAI;QACF,MAAMJ,iBAAiB,CAAC,CAAC;MAC3B,CAAC,CAAC,OAAOY,KAAK,EAAE;QACdhB,OAAO,CAACY,IAAI,CACV,4FAA4F,EAC5FI,KACF,CAAC;MACH;EAEJ;AACF,CAAC","ignoreList":[]}
@@ -14,16 +14,16 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { exec } from "node:child_process";
17
+ import { execFile } from "node:child_process";
18
18
  import { promisify } from "node:util";
19
19
  import { gte, valid } from "semver";
20
20
  export const MIN_FOUNDRY_CLI_VERSION = "0.224.0";
21
21
  const FOUNDRY_VERSION_PATTERN = /cli (\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)/u;
22
22
  const parseFoundryVersion = stdout => stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];
23
23
  const versionIsAtMinimum = (version, min) => valid(version) != null && valid(min) != null && gte(version, min);
24
- const execAsync = promisify(exec);
24
+ const execFileAsync = promisify(execFile);
25
25
  export const checkFoundryCliVersion = () => {
26
- return execAsync("which foundry").then(() => execAsync("foundry --version")).then(({
26
+ return execFileAsync("foundry", ["--version"]).then(({
27
27
  stdout
28
28
  }) => {
29
29
  const version = parseFoundryVersion(stdout);
@@ -1 +1 @@
1
- {"version":3,"file":"foundry-cli.js","names":["exec","promisify","gte","valid","MIN_FOUNDRY_CLI_VERSION","FOUNDRY_VERSION_PATTERN","parseFoundryVersion","stdout","trim","match","versionIsAtMinimum","version","min","execAsync","checkFoundryCliVersion","then","type","isMin","catch"],"sources":["foundry-cli.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nimport { gte, valid } from \"semver\";\n\nexport const MIN_FOUNDRY_CLI_VERSION = \"0.224.0\";\n\nconst FOUNDRY_VERSION_PATTERN =\n /cli (\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)/u;\n\nexport type FoundryProbeResult =\n | {\n type: \"installed\";\n version: string;\n }\n | {\n type: \"version-incompatible\";\n version: string;\n }\n | {\n type: \"version-error\";\n }\n | {\n type: \"not-found\";\n };\n\nconst parseFoundryVersion = (stdout: string): string | undefined =>\n stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];\n\nconst versionIsAtMinimum = (version: string, min: string): boolean =>\n valid(version) != null && valid(min) != null && gte(version, min);\n\nconst execAsync = promisify(exec);\n\nexport const checkFoundryCliVersion = (): Promise<FoundryProbeResult> => {\n return execAsync(\"which foundry\")\n .then(() => execAsync(\"foundry --version\"))\n .then<FoundryProbeResult>(({ stdout }) => {\n const version = parseFoundryVersion(stdout);\n if (!version) return { type: \"version-error\" };\n const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);\n if (!isMin) return { type: \"version-incompatible\", version };\n return { type: \"installed\", version };\n })\n .catch<FoundryProbeResult>(() => ({ type: \"not-found\" }));\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,oBAAoB;AACzC,SAASC,SAAS,QAAQ,WAAW;AAErC,SAASC,GAAG,EAAEC,KAAK,QAAQ,QAAQ;AAEnC,OAAO,MAAMC,uBAAuB,GAAG,SAAS;AAEhD,MAAMC,uBAAuB,GAC3B,+DAA+D;AAkBjE,MAAMC,mBAAmB,GAAIC,MAAc,IACzCA,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAACJ,uBAAuB,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAMK,kBAAkB,GAAGA,CAACC,OAAe,EAAEC,GAAW,KACtDT,KAAK,CAACQ,OAAO,CAAC,IAAI,IAAI,IAAIR,KAAK,CAACS,GAAG,CAAC,IAAI,IAAI,IAAIV,GAAG,CAACS,OAAO,EAAEC,GAAG,CAAC;AAEnE,MAAMC,SAAS,GAAGZ,SAAS,CAACD,IAAI,CAAC;AAEjC,OAAO,MAAMc,sBAAsB,GAAGA,CAAA,KAAmC;EACvE,OAAOD,SAAS,CAAC,eAAe,CAAC,CAC9BE,IAAI,CAAC,MAAMF,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAC1CE,IAAI,CAAqB,CAAC;IAAER;EAAO,CAAC,KAAK;IACxC,MAAMI,OAAO,GAAGL,mBAAmB,CAACC,MAAM,CAAC;IAC3C,IAAI,CAACI,OAAO,EAAE,OAAO;MAAEK,IAAI,EAAE;IAAgB,CAAC;IAC9C,MAAMC,KAAK,GAAGP,kBAAkB,CAACC,OAAO,EAAEP,uBAAuB,CAAC;IAClE,IAAI,CAACa,KAAK,EAAE,OAAO;MAAED,IAAI,EAAE,sBAAsB;MAAEL;IAAQ,CAAC;IAC5D,OAAO;MAAEK,IAAI,EAAE,WAAW;MAAEL;IAAQ,CAAC;EACvC,CAAC,CAAC,CACDO,KAAK,CAAqB,OAAO;IAAEF,IAAI,EAAE;EAAY,CAAC,CAAC,CAAC;AAC7D,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"foundry-cli.js","names":["execFile","promisify","gte","valid","MIN_FOUNDRY_CLI_VERSION","FOUNDRY_VERSION_PATTERN","parseFoundryVersion","stdout","trim","match","versionIsAtMinimum","version","min","execFileAsync","checkFoundryCliVersion","then","type","isMin","catch"],"sources":["foundry-cli.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nimport { gte, valid } from \"semver\";\n\nexport const MIN_FOUNDRY_CLI_VERSION = \"0.224.0\";\n\nconst FOUNDRY_VERSION_PATTERN =\n /cli (\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)/u;\n\nexport type FoundryProbeResult =\n | {\n type: \"installed\";\n version: string;\n }\n | {\n type: \"version-incompatible\";\n version: string;\n }\n | {\n type: \"version-error\";\n }\n | {\n type: \"not-found\";\n };\n\nconst parseFoundryVersion = (stdout: string): string | undefined =>\n stdout.trim().match(FOUNDRY_VERSION_PATTERN)?.[1];\n\nconst versionIsAtMinimum = (version: string, min: string): boolean =>\n valid(version) != null && valid(min) != null && gte(version, min);\n\nconst execFileAsync = promisify(execFile);\n\nexport const checkFoundryCliVersion = (): Promise<FoundryProbeResult> => {\n return execFileAsync(\"foundry\", [\"--version\"])\n .then<FoundryProbeResult>(({ stdout }) => {\n const version = parseFoundryVersion(stdout);\n if (!version) return { type: \"version-error\" };\n const isMin = versionIsAtMinimum(version, MIN_FOUNDRY_CLI_VERSION);\n if (!isMin) return { type: \"version-incompatible\", version };\n return { type: \"installed\", version };\n })\n .catch<FoundryProbeResult>(() => ({ type: \"not-found\" }));\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,QAAQ,WAAW;AAErC,SAASC,GAAG,EAAEC,KAAK,QAAQ,QAAQ;AAEnC,OAAO,MAAMC,uBAAuB,GAAG,SAAS;AAEhD,MAAMC,uBAAuB,GAC3B,+DAA+D;AAkBjE,MAAMC,mBAAmB,GAAIC,MAAc,IACzCA,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAACJ,uBAAuB,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAMK,kBAAkB,GAAGA,CAACC,OAAe,EAAEC,GAAW,KACtDT,KAAK,CAACQ,OAAO,CAAC,IAAI,IAAI,IAAIR,KAAK,CAACS,GAAG,CAAC,IAAI,IAAI,IAAIV,GAAG,CAACS,OAAO,EAAEC,GAAG,CAAC;AAEnE,MAAMC,aAAa,GAAGZ,SAAS,CAACD,QAAQ,CAAC;AAEzC,OAAO,MAAMc,sBAAsB,GAAGA,CAAA,KAAmC;EACvE,OAAOD,aAAa,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,CAAC,CAC3CE,IAAI,CAAqB,CAAC;IAAER;EAAO,CAAC,KAAK;IACxC,MAAMI,OAAO,GAAGL,mBAAmB,CAACC,MAAM,CAAC;IAC3C,IAAI,CAACI,OAAO,EAAE,OAAO;MAAEK,IAAI,EAAE;IAAgB,CAAC;IAC9C,MAAMC,KAAK,GAAGP,kBAAkB,CAACC,OAAO,EAAEP,uBAAuB,CAAC;IAClE,IAAI,CAACa,KAAK,EAAE,OAAO;MAAED,IAAI,EAAE,sBAAsB;MAAEL;IAAQ,CAAC;IAC5D,OAAO;MAAEK,IAAI,EAAE,WAAW;MAAEL;IAAQ,CAAC;EACvC,CAAC,CAAC,CACDO,KAAK,CAAqB,OAAO;IAAEF,IAAI,EAAE;EAAY,CAAC,CAAC,CAAC;AAC7D,CAAC","ignoreList":[]}
@@ -1,2 +1,3 @@
1
1
  import type { IntegrationClient, IntegrationClientConfig } from "./types.js";
2
2
  export declare function createIntegrationClient(config: IntegrationClientConfig): Promise<IntegrationClient>;
3
+ export declare function createIntegrationClientForRunningServer(config: IntegrationClientConfig): Promise<IntegrationClient>;
@@ -1 +1 @@
1
- {"mappings":"AA6BA,cAAc,mBAAmB,+BAA+B,YAAa;AAW7E,OAAO,iBAAe,wBACpBA,QAAQ,0BACP,QAAQ","names":["config: IntegrationClientConfig"],"sources":["../../src/createIntegrationClient.ts"],"version":3,"file":"createIntegrationClient.d.ts"}
1
+ {"mappings":"AA8BA,cAAc,mBAAmB,+BAA+B,YAAa;AAY7E,OAAO,iBAAe,wBACpBA,QAAQ,0BACP,QAAQ;AASX,OAAO,iBAAe,wCACpBA,QAAQ,0BACP,QAAQ","names":["config: IntegrationClientConfig"],"sources":["../../src/createIntegrationClient.ts"],"version":3,"file":"createIntegrationClient.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/integration-testing",
3
- "version": "0.3.0",
3
+ "version": "0.3.1-main-cde832a4faaad484ee77bfc194b10a2f9e62f867",
4
4
  "description": "Integration-testing helpers for the Ontology SDK",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -50,10 +50,10 @@
50
50
  "@types/semver": "^7.7.1",
51
51
  "typescript": "~5.5.4",
52
52
  "vitest": "^3.2.4",
53
- "@osdk/monorepo.api-extractor": "~0.7.0",
54
53
  "@osdk/api": "~2.65.0",
55
- "@osdk/monorepo.tsconfig": "~0.7.0",
56
54
  "@osdk/client": "~2.65.0",
55
+ "@osdk/monorepo.api-extractor": "~0.7.0",
56
+ "@osdk/monorepo.tsconfig": "~0.7.0",
57
57
  "@osdk/seed-helpers": "~0.30.0"
58
58
  },
59
59
  "publishConfig": {