@osdk/client 2.95.0 → 2.96.0-main-8ae7abf314d15269ef90cd4c728c6be4db955750
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 +13 -0
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/index.js +2 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/public/experimental.js +0 -2
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js +0 -2
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/scenarios/ScenarioClient.js +15 -24
- package/build/browser/scenarios/ScenarioClient.js.map +1 -1
- package/build/browser/scenarios/createScenario.js +2 -4
- package/build/browser/scenarios/createScenario.js.map +1 -1
- package/build/browser/scenarios/withScenario.js +2 -4
- package/build/browser/scenarios/withScenario.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/{applyStreamingQuery-KCJOS7TV.cjs → applyStreamingQuery-EKQJ2HOP.cjs} +8 -8
- package/build/cjs/{applyStreamingQuery-KCJOS7TV.cjs.map → applyStreamingQuery-EKQJ2HOP.cjs.map} +1 -1
- package/build/cjs/{chunk-EV74MG67.cjs → chunk-2O4555WT.cjs} +85 -85
- package/build/cjs/{chunk-EV74MG67.cjs.map → chunk-2O4555WT.cjs.map} +1 -1
- package/build/cjs/{chunk-QDEI35QO.cjs → chunk-HVITOOBR.cjs} +16 -16
- package/build/cjs/{chunk-QDEI35QO.cjs.map → chunk-HVITOOBR.cjs.map} +1 -1
- package/build/cjs/{chunk-B2NX6A3J.cjs → chunk-OQXF4VWE.cjs} +2 -2
- package/build/cjs/{chunk-B2NX6A3J.cjs.map → chunk-OQXF4VWE.cjs.map} +1 -1
- package/build/cjs/{chunk-JBCRSB2X.cjs → chunk-PC6HZS3W.cjs} +68 -78
- package/build/cjs/chunk-PC6HZS3W.cjs.map +1 -0
- package/build/cjs/{chunk-ROZG5FTY.cjs → chunk-WT3PVLWG.cjs} +5 -5
- package/build/cjs/{chunk-ROZG5FTY.cjs.map → chunk-WT3PVLWG.cjs.map} +1 -1
- package/build/cjs/index.cjs +41 -12
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +204 -3
- package/build/cjs/public/experimental.cjs +7 -16
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +0 -1
- package/build/cjs/public/internal.cjs +10 -10
- package/build/cjs/public/observable.cjs +6 -6
- package/build/cjs/public/unstable-do-not-use.cjs +14 -23
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +0 -1
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/public/experimental.js +0 -2
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/public/unstable-do-not-use.js +0 -2
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/scenarios/ScenarioClient.js +15 -24
- package/build/esm/scenarios/ScenarioClient.js.map +1 -1
- package/build/esm/scenarios/createScenario.js +2 -4
- package/build/esm/scenarios/createScenario.js.map +1 -1
- package/build/esm/scenarios/withScenario.js +2 -4
- package/build/esm/scenarios/withScenario.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/index.d.ts +3 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/public/experimental.d.ts +0 -3
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/public/unstable-do-not-use.d.ts +0 -3
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/scenarios/ScenarioClient.d.ts +26 -26
- package/build/types/scenarios/ScenarioClient.d.ts.map +1 -1
- package/build/types/scenarios/createScenario.d.ts +4 -6
- package/build/types/scenarios/createScenario.d.ts.map +1 -1
- package/build/types/scenarios/withScenario.d.ts +4 -6
- package/build/types/scenarios/withScenario.d.ts.map +1 -1
- package/package.json +7 -7
- package/build/cjs/chunk-35RDHB5T.cjs +0 -36
- package/build/cjs/chunk-35RDHB5T.cjs.map +0 -1
- package/build/cjs/chunk-JBCRSB2X.cjs.map +0 -1
- package/build/cjs/withScenario-DuKtMIXk.d.cts +0 -209
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.96.0-main-8ae7abf314d15269ef90cd4c728c6be4db955750
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8ae7abf: Move scenario APIs to `@osdk/client`, rename `EXPERIMENTAL_ScenarioClient` to `ScenarioClient`, and rename `getEditedEntities`, `editedEntitiesAsyncIter`, and `EditedEntitiesPage` to `getEditedObjects`, `editedObjectsAsyncIter`, and `EditedObjectsPage`. Keep rebase, conflict methods, and the conflict page type in beta with an `EXPERIMENTAL_DO_NOT_USE_` prefix. Remove `getEditedLinkTypes`; use the `linkTypes` field from `getEditedEntityTypes()` instead.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @osdk/api@2.96.0-main-8ae7abf314d15269ef90cd4c728c6be4db955750
|
|
12
|
+
- @osdk/client.unstable@2.96.0-main-8ae7abf314d15269ef90cd4c728c6be4db955750
|
|
13
|
+
- @osdk/generator-converters@2.96.0-main-8ae7abf314d15269ef90cd4c728c6be4db955750
|
|
14
|
+
- @osdk/shared.test@2.65.1-main-8ae7abf314d15269ef90cd4c728c6be4db955750
|
|
15
|
+
|
|
3
16
|
## 2.95.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/build/browser/Client.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
export const additionalContext = Symbol("additionalContext");
|
|
22
22
|
|
|
23
23
|
// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
24
|
-
const MaxOsdkVersion = "2.
|
|
24
|
+
const MaxOsdkVersion = "2.96.0";
|
|
25
25
|
// END: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
26
26
|
|
|
27
27
|
const ErrorMessage = Symbol("ErrorMessage");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 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 type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n AgentDefinition,\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { AgentSignatureFromDef } from \"./agents/types.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /** @beta */\n <Q extends AgentDefinition<unknown>>(o: Q): AgentSignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.
|
|
1
|
+
{"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 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 type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n AgentDefinition,\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { AgentSignatureFromDef } from \"./agents/types.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /** @beta */\n <Q extends AgentDefinition<unknown>>(o: Q): AgentSignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.96.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6BA;;AAqIA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,QAAQ;AAC/B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
|
package/build/browser/index.js
CHANGED
|
@@ -22,6 +22,8 @@ export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
|
22
22
|
export { createClient } from "./createClient.js";
|
|
23
23
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
24
24
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
|
25
|
+
export { createScenario } from "./scenarios/createScenario.js";
|
|
26
|
+
export { withScenario } from "./scenarios/withScenario.js";
|
|
25
27
|
export { getWireObjectSet, isObjectSet } from "./objectSet/createObjectSet.js";
|
|
26
28
|
export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
|
|
27
29
|
export { createObjectSpecifierFromPrimaryKey, extractPrimaryKeyFromObjectSpecifier } from "./util/objectSpecifierUtils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","getWireObjectSet","isObjectSet","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 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/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CipherText,\n CipherTextValue,\n CompileTimeMetadata,\n CreateCipherText,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n Media,\n MediaFullMetadata,\n MediaItemMetadata,\n MediaMetadata,\n MediaReference,\n MediaUpload,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectCreateWirePropertyType,\n OsdkObjectPropertyType,\n OsdkObjectUpdatePropertyType,\n OsdkObjectUpdateWirePropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n UnknownMediaItemMetadata,\n UpdateCipherText,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nexport { getWireObjectSet, isObjectSet } from \"./objectSet/createObjectSet.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,QAAQ,WAAW;AAqDhC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","createScenario","withScenario","getWireObjectSet","isObjectSet","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 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/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CipherText,\n CipherTextValue,\n CompileTimeMetadata,\n CreateCipherText,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n Media,\n MediaFullMetadata,\n MediaItemMetadata,\n MediaMetadata,\n MediaReference,\n MediaUpload,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectCreateWirePropertyType,\n OsdkObjectPropertyType,\n OsdkObjectUpdatePropertyType,\n OsdkObjectUpdateWirePropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n UnknownMediaItemMetadata,\n UpdateCipherText,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\nexport { createScenario } from \"./scenarios/createScenario.js\";\nexport type {\n EditedLinksForObjectType,\n EditedLinksPage,\n EditedObjectsPage,\n EXPERIMENTAL_DO_NOT_USE_ConflictingObjectsPage,\n ScenarioClient,\n ScenarioEditedEntityTypes,\n} from \"./scenarios/ScenarioClient.js\";\nexport { withScenario } from \"./scenarios/withScenario.js\";\n\nexport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nexport { getWireObjectSet, isObjectSet } from \"./objectSet/createObjectSet.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,QAAQ,WAAW;AAqDhC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAErE,SAASC,cAAc,QAAQ,+BAA+B;AAS9D,SAASC,YAAY,QAAQ,6BAA6B;AAG1D,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,gCAAgC;AAE9E,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B;AAErC,SACEC,mCAAmC,EACnCC,oCAAoC,QAC/B,gCAAgC","ignoreList":[]}
|
|
@@ -17,6 +17,4 @@
|
|
|
17
17
|
export { AgentGetStateTimeoutError, AgentSendEventTimeoutError } from "@osdk/api/unstable";
|
|
18
18
|
export { createClientWithTransaction } from "../createClient.js";
|
|
19
19
|
export { createClientFromWriteableClient } from "../createClientFromWriteableClient.js";
|
|
20
|
-
export { createScenario } from "../scenarios/createScenario.js";
|
|
21
|
-
export { withScenario } from "../scenarios/withScenario.js";
|
|
22
20
|
//# sourceMappingURL=experimental.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":["AgentGetStateTimeoutError","AgentSendEventTimeoutError","createClientWithTransaction","createClientFromWriteableClient"
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["AgentGetStateTimeoutError","AgentSendEventTimeoutError","createClientWithTransaction","createClientFromWriteableClient"],"sources":["experimental.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\nexport type {\n AgentDefinition,\n AgentParam,\n AgentResult,\n AgentContextItem,\n AgentGetStateOptions,\n AgentSessionState,\n AgentSessionStatus,\n AgentSendEventOptions,\n AgentSession,\n} from \"@osdk/api/unstable\";\n\nexport {\n AgentGetStateTimeoutError,\n AgentSendEventTimeoutError,\n} from \"@osdk/api/unstable\";\n\nexport { createClientWithTransaction } from \"../createClient.js\";\nexport { createClientFromWriteableClient } from \"../createClientFromWriteableClient.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,SACEA,yBAAyB,EACzBC,0BAA0B,QACrB,oBAAoB;AAE3B,SAASC,2BAA2B,QAAQ,oBAAoB;AAChE,SAASC,+BAA+B,QAAQ,uCAAuC","ignoreList":[]}
|
|
@@ -18,8 +18,6 @@ export { augment } from "../object/fetchPage.js";
|
|
|
18
18
|
export { hydrateOsdkObject } from "../object/hydrateOsdkObject.js";
|
|
19
19
|
export { getWireObjectSet, isObjectSet } from "../objectSet/createObjectSet.js";
|
|
20
20
|
export { createClientWithSubscriptionConnection, createClientWithTransaction } from "../createClient.js";
|
|
21
|
-
export { createScenario } from "../scenarios/createScenario.js";
|
|
22
|
-
export { withScenario } from "../scenarios/withScenario.js";
|
|
23
21
|
export { applyShapeTransformations, applyShapeTransformationsToArray, buildObjectSetFromLinkDefByType, getLinkQueryOptions } from "../shapes/index.js";
|
|
24
22
|
|
|
25
23
|
/** @deprecated Import from `@osdk/client/observable` instead. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unstable-do-not-use.js","names":["augment","hydrateOsdkObject","getWireObjectSet","isObjectSet","createClientWithSubscriptionConnection","createClientWithTransaction","
|
|
1
|
+
{"version":3,"file":"unstable-do-not-use.js","names":["augment","hydrateOsdkObject","getWireObjectSet","isObjectSet","createClientWithSubscriptionConnection","createClientWithTransaction","applyShapeTransformations","applyShapeTransformationsToArray","buildObjectSetFromLinkDefByType","getLinkQueryOptions","createObservableClient"],"sources":["unstable-do-not-use.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { augment } from \"../object/fetchPage.js\";\nexport { hydrateOsdkObject } from \"../object/hydrateOsdkObject.js\";\nexport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\n\nexport {\n createClientWithSubscriptionConnection,\n createClientWithTransaction,\n} from \"../createClient.js\";\nexport type {\n CreateSubscriptionConnectionFn,\n SubscriptionConnection,\n} from \"../SubscriptionConnection.js\";\n\nexport {\n applyShapeTransformations,\n applyShapeTransformationsToArray,\n buildObjectSetFromLinkDefByType,\n getLinkQueryOptions,\n} from \"../shapes/index.js\";\n\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport { createObservableClient } from \"../observable/ObservableClient.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type {\n CacheEntry,\n CacheSnapshot,\n CanonicalizedOptions,\n CanonicalizeOptionsInput,\n ObservableClient,\n ObserveAggregationArgs,\n ObserveFunctionCallbackArgs,\n ObserveFunctionOptions,\n ObserveObjectCallbackArgs,\n ObserveObjectsCallbackArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../observable/ObservableClient.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { Observer } from \"../observable/ObservableClient/common.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { ObserveLinks } from \"../observable/ObservableClient/ObserveLink.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { QueryParameterType, QueryReturnType } from \"../queries/types.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,wBAAwB;AAChD,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAE/E,SACEC,sCAAsC,EACtCC,2BAA2B,QACtB,oBAAoB;AAM3B,SACEC,yBAAyB,EACzBC,gCAAgC,EAChCC,+BAA+B,EAC/BC,mBAAmB,QACd,oBAAoB;;AAE3B;;AAEA;AACA,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E;;AAeA;;AAEA;;AAEA","ignoreList":[]}
|
|
@@ -31,26 +31,26 @@ import { createClientFromContext } from "../createClient.js";
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* A page of edited object identifiers within a scenario for a given object type. Returned by
|
|
34
|
-
* {@link
|
|
34
|
+
* {@link ScenarioClient.getEditedObjects}. To load full property values, pass the primary keys back
|
|
35
35
|
* through the scenario client, e.g.
|
|
36
36
|
* `scenario(MyObject).where({ $primaryKey: { $in: keys } }).fetchPage()`.
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* A page of directed link instances edited within a scenario for a given source object type and link api name.
|
|
41
|
-
* Returned by {@link
|
|
41
|
+
* Returned by {@link ScenarioClient.getEditedLinks}. Source and target carry only `$primaryKey` + `$apiName`.
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* A page of object identifiers whose edits within a scenario conflict with edits to the scenario's base. Returned by
|
|
46
|
-
* {@link
|
|
46
|
+
* {@link ScenarioClient.EXPERIMENTAL_DO_NOT_USE_getConflictingObjects}. Results contain only `$primaryKey` + `$apiName`.
|
|
47
|
+
*
|
|
48
|
+
* @beta This is an experimental feature subject to change.
|
|
47
49
|
*/
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* A {@link Client} attached to an ontology scenario. All read and write operations performed via this client are
|
|
51
|
-
* scoped to that scenario. `
|
|
52
|
-
*
|
|
53
|
-
* @beta This is an experimental, unstable feature subject to change.
|
|
53
|
+
* scoped to that scenario. `ScenarioClient` is a superset of {@link Client}.
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
export function isScenarioClient(value) {
|
|
@@ -61,7 +61,7 @@ export function isScenarioClient(value) {
|
|
|
61
61
|
* Shared internal builder used by both {@link withScenario} and {@link createScenario}. Throws if the parent client
|
|
62
62
|
* is already inside a scenario. If the parent client has an active transaction, the transaction is ignored (a warning
|
|
63
63
|
* is logged) and the client is scoped to the scenario instead. Derives a {@link Client} from the parent's context via
|
|
64
|
-
* `createClientFromContext` and decorates it with {@link
|
|
64
|
+
* `createClientFromContext` and decorates it with {@link ScenarioClient}-only methods.
|
|
65
65
|
*
|
|
66
66
|
* @internal
|
|
67
67
|
*/
|
|
@@ -82,7 +82,7 @@ export function buildScenarioClient(parent, scenarioRid) {
|
|
|
82
82
|
clientCacheKey: {}
|
|
83
83
|
});
|
|
84
84
|
const innerCtx = inner[additionalContext];
|
|
85
|
-
async function
|
|
85
|
+
async function getEditedObjects(objectType, options) {
|
|
86
86
|
const ontologyRid = await innerCtx.ontologyRid;
|
|
87
87
|
const response = await OntologyScenarios.listScenarioEditedObjects(innerCtx, ontologyRid, scenarioRid, objectType.apiName, {
|
|
88
88
|
pageSize: options?.pageSize,
|
|
@@ -159,7 +159,7 @@ export function buildScenarioClient(parent, scenarioRid) {
|
|
|
159
159
|
getScenarioReference: {
|
|
160
160
|
value: () => scenarioRid
|
|
161
161
|
},
|
|
162
|
-
|
|
162
|
+
EXPERIMENTAL_DO_NOT_USE_rebase: {
|
|
163
163
|
value: async function () {
|
|
164
164
|
const ontologyRid = await innerCtx.ontologyRid;
|
|
165
165
|
await OntologyScenarios.rebaseScenario(innerCtx, ontologyRid, scenarioRid, {
|
|
@@ -179,15 +179,15 @@ export function buildScenarioClient(parent, scenarioRid) {
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
183
|
-
value:
|
|
182
|
+
getEditedObjects: {
|
|
183
|
+
value: getEditedObjects
|
|
184
184
|
},
|
|
185
|
-
|
|
185
|
+
editedObjectsAsyncIter: {
|
|
186
186
|
value: async function* (objectType, options) {
|
|
187
187
|
const seen = new Set();
|
|
188
188
|
let pageToken;
|
|
189
189
|
do {
|
|
190
|
-
const page = await
|
|
190
|
+
const page = await getEditedObjects(objectType, {
|
|
191
191
|
pageSize: options?.pageSize,
|
|
192
192
|
pageToken
|
|
193
193
|
});
|
|
@@ -201,15 +201,6 @@ export function buildScenarioClient(parent, scenarioRid) {
|
|
|
201
201
|
} while (pageToken != null);
|
|
202
202
|
}
|
|
203
203
|
},
|
|
204
|
-
getEditedLinkTypes: {
|
|
205
|
-
value: async function (sourceObjectType) {
|
|
206
|
-
const ontologyRid = await innerCtx.ontologyRid;
|
|
207
|
-
const response = await OntologyScenarios.listScenarioEditedLinkTypes(innerCtx, ontologyRid, scenarioRid, sourceObjectType.apiName, {
|
|
208
|
-
preview: true
|
|
209
|
-
});
|
|
210
|
-
return response.data;
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
204
|
getEditedLinks: {
|
|
214
205
|
value: getEditedLinks
|
|
215
206
|
},
|
|
@@ -228,10 +219,10 @@ export function buildScenarioClient(parent, scenarioRid) {
|
|
|
228
219
|
} while (pageToken != null);
|
|
229
220
|
}
|
|
230
221
|
},
|
|
231
|
-
|
|
222
|
+
EXPERIMENTAL_DO_NOT_USE_getConflictingObjects: {
|
|
232
223
|
value: getConflictingObjects
|
|
233
224
|
},
|
|
234
|
-
|
|
225
|
+
EXPERIMENTAL_DO_NOT_USE_conflictingObjectsAsyncIter: {
|
|
235
226
|
value: async function* (objectType, options) {
|
|
236
227
|
let pageToken;
|
|
237
228
|
do {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScenarioClient.js","names":["OntologyScenarios","additionalContext","createClientFromContext","isScenarioClient","value","getScenarioReference","buildScenarioClient","parent","scenarioRid","ctx","transactionId","console","warn","Error","inner","undefined","flushEdits","clientCacheKey","innerCtx","getEditedEntities","objectType","options","ontologyRid","response","listScenarioEditedObjects","apiName","pageSize","pageToken","preview","data","map","entry","wire","$apiName","__apiName","$primaryKey","__primaryKey","nextPageToken","getEditedLinks","sourceObjectType","linkType","listScenarioEditedLinks","sourceWire","sourceObject","source","linked","linkedObjects","targetWire","targetObject","target","push","getConflictingObjects","listScenarioConflictingObjects","objectTypeApiName","primaryKeyValue","Object","defineProperties","rebase","rebaseScenario","getEditedEntityTypes","listScenarioEditedEntityTypes","objectTypes","linkTypes","editedEntitiesAsyncIter","seen","Set","page","obj","key","has","add","getEditedLinkTypes","listScenarioEditedLinkTypes","editedLinksAsyncIter","link","conflictingObjectsAsyncIter","object"],"sources":["ScenarioClient.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 type {\n LinkTypeApiNamesFor,\n MinimalDirectedObjectLinkInstance,\n ObjectIdentifiers,\n ObjectOrInterfaceDefinition,\n ObjectTypeDefinition,\n PrimaryKeyType,\n} from \"@osdk/api\";\nimport { OntologyScenarios } from \"@osdk/foundry.ontologies\";\n\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport type { ClientCacheKey, MinimalClient } from \"../MinimalClientContext.js\";\n\n/**\n * The set of many-to-many link types modified within a scenario for one source object type. Returned as part of\n * {@link ScenarioEditedEntityTypes.linkTypes}.\n */\nexport interface EditedLinksForObjectType {\n objectTypeApiName: string;\n linkTypes: string[];\n}\n\n/**\n * The object types and link types that have been modified within a scenario. Only many-to-many link type edits are\n * surfaced via `linkTypes`; one-to-many edits surface as object edits on the object type that owns the foreign key\n * property.\n */\nexport interface ScenarioEditedEntityTypes {\n objectTypes: string[];\n linkTypes: EditedLinksForObjectType[];\n}\n\n/**\n * A page of edited object identifiers within a scenario for a given object type. Returned by\n * {@link EXPERIMENTAL_ScenarioClient.getEditedEntities}. To load full property values, pass the primary keys back\n * through the scenario client, e.g.\n * `scenario(MyObject).where({ $primaryKey: { $in: keys } }).fetchPage()`.\n */\nexport interface EditedEntitiesPage<Q extends ObjectTypeDefinition> {\n data: ObjectIdentifiers<Q>[];\n nextPageToken?: string;\n}\n\n/**\n * A page of directed link instances edited within a scenario for a given source object type and link api name.\n * Returned by {@link EXPERIMENTAL_ScenarioClient.getEditedLinks}. Source and target carry only `$primaryKey` + `$apiName`.\n */\nexport interface EditedLinksPage<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n> {\n data: MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[];\n nextPageToken?: string;\n}\n\n/**\n * A page of object identifiers whose edits within a scenario conflict with edits to the scenario's base. Returned by\n * {@link EXPERIMENTAL_ScenarioClient.getConflictingObjects}. Results contain only `$primaryKey` + `$apiName`.\n */\nexport interface ConflictingObjectsPage<Q extends ObjectTypeDefinition> {\n data: ObjectIdentifiers<Q>[];\n nextPageToken?: string;\n}\n\n/**\n * A {@link Client} attached to an ontology scenario. All read and write operations performed via this client are\n * scoped to that scenario. `EXPERIMENTAL_ScenarioClient` is a superset of {@link Client}.\n *\n * @beta This is an experimental, unstable feature subject to change.\n */\nexport interface EXPERIMENTAL_ScenarioClient extends Client {\n /**\n * The scenario RID this client is scoped to.\n */\n getScenarioReference(): string;\n\n /**\n * Rebase this scenario onto the latest data from its base\n */\n rebase(): Promise<void>;\n\n /**\n * List the object types and many-to-many link types that have been modified within this scenario. Useful as a\n * pre-step before paginating individual edited objects per type.\n */\n getEditedEntityTypes(): Promise<ScenarioEditedEntityTypes>;\n\n /**\n * Get a page of object identifiers that have been\n * edited within this scenario for the given object type. Use the scenario client to fetch full property values\n * if needed.\n *\n * @example\n * ```ts\n * let pageToken: string | undefined;\n * const keys: string[] = [];\n * do {\n * const page = await scenario.getEditedEntities(Doctor, { pageSize: 500, pageToken });\n * keys.push(...page.data.map(o => o.$primaryKey));\n * pageToken = page.nextPageToken;\n * } while (pageToken);\n * ```\n */\n getEditedEntities<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedEntitiesPage<Q>>;\n\n /**\n * Stream object identifiers for the objects edited within this scenario for the\n * given object type. Pages are fetched lazily and deduplicated by `$primaryKey` across pages (Funnel may return\n * duplicates).\n *\n * @example\n * ```ts\n * for await (const obj of scenario.editedEntitiesAsyncIter(Doctor, { pageSize: 500 })) {\n * // obj.$primaryKey is the unique key for this edited object\n * }\n * ```\n */\n editedEntitiesAsyncIter<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>>;\n\n /**\n * List the outgoing many-to-many link API names that have been modified within this scenario for the given\n * source object type. One-to-many link edits surface as object edits on the FK-owning side and are not returned\n * here.\n */\n getEditedLinkTypes<Q extends ObjectOrInterfaceDefinition>(\n sourceObjectType: Q,\n ): Promise<LinkTypeApiNamesFor<Q>[]>;\n\n /**\n * Get a page of directed link instances edited within this scenario for a given source object type and link\n * api name. The page form returns a flattened array of `{ source, target, linkType }` triples.\n */\n getEditedLinks<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedLinksPage<Q, LINK_TYPE_API_NAME>>;\n\n /**\n * Stream directed link instances edited within this scenario for a given source object type and link api name.\n * Pages are fetched lazily.\n *\n * @example\n * ```ts\n * for await (\n * const { source, target, linkType } of scenario.editedLinksAsyncIter(Doctor, \"treats\")\n * ) {\n * graph.addEdge(source, target, linkType);\n * }\n * ```\n */\n editedLinksAsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<\n MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>\n >;\n\n /**\n * Get a page of object identifiers whose scenario edits conflict with edits to the scenario's base for the given\n * object type. Conflict detection may report false positives when object versions change without user-visible data\n * changes. Results are a point-in-time check, and include only objects the caller may view and the backend can resolve,\n * and may become stale before merge. Use the base client and scenario client to load both object states for review.\n *\n * `pageSize` bounds the number of objects examined, not the number of conflicts returned, so a page may contain fewer\n * results than requested while still returning `nextPageToken`.\n */\n getConflictingObjects<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<ConflictingObjectsPage<Q>>;\n\n /**\n * Stream object identifiers for the objects whose scenario edits conflict with edits to the scenario's base for the\n * given object type. Pages are fetched lazily.\n *\n * @example\n * ```ts\n * for await (const obj of scenario.conflictingObjectsAsyncIter(Doctor, { pageSize: 500 })) {\n * // obj.$primaryKey identifies an object with a conflicting scenario edit\n * }\n * ```\n */\n conflictingObjectsAsyncIter<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>>;\n}\n\nexport function isScenarioClient(\n value: unknown,\n): value is EXPERIMENTAL_ScenarioClient {\n return (\n value != null &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n typeof (value as { getScenarioReference?: unknown })\n .getScenarioReference === \"function\"\n );\n}\n\n/**\n * Shared internal builder used by both {@link withScenario} and {@link createScenario}. Throws if the parent client\n * is already inside a scenario. If the parent client has an active transaction, the transaction is ignored (a warning\n * is logged) and the client is scoped to the scenario instead. Derives a {@link Client} from the parent's context via\n * `createClientFromContext` and decorates it with {@link EXPERIMENTAL_ScenarioClient}-only methods.\n *\n * @internal\n */\nexport function buildScenarioClient(\n parent: Client,\n scenarioRid: string,\n): EXPERIMENTAL_ScenarioClient {\n const ctx: MinimalClient = parent[additionalContext];\n\n if (ctx.transactionId != null) {\n // eslint-disable-next-line no-console\n console.warn(\n \"withScenario / createScenario: the supplied client has an active transaction. Ignoring the transaction and scoping to the scenario instead.\",\n );\n }\n if (ctx.scenarioRid != null) {\n throw new Error(\n \"withScenario / createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.\",\n );\n }\n\n const inner: Client = createClientFromContext({\n ...ctx,\n transactionId: undefined,\n flushEdits: undefined,\n scenarioRid,\n clientCacheKey: {} as ClientCacheKey,\n });\n\n const innerCtx: MinimalClient = inner[additionalContext];\n\n async function rebase(): Promise<void> {\n const ontologyRid = await innerCtx.ontologyRid;\n await OntologyScenarios.rebaseScenario(innerCtx, ontologyRid, scenarioRid, {\n preview: true,\n });\n }\n\n async function getEditedEntityTypes(): Promise<ScenarioEditedEntityTypes> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioEditedEntityTypes(\n innerCtx,\n ontologyRid,\n scenarioRid,\n { preview: true },\n );\n return {\n objectTypes: response.objectTypes,\n linkTypes: response.linkTypes,\n };\n }\n\n async function getEditedEntities<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedEntitiesPage<Q>> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioEditedObjects(\n innerCtx,\n ontologyRid,\n scenarioRid,\n objectType.apiName,\n {\n pageSize: options?.pageSize,\n pageToken: options?.pageToken,\n preview: true,\n },\n );\n const data: ObjectIdentifiers<Q>[] = response.data.map((entry) => {\n const wire = entry as { __apiName?: unknown; __primaryKey?: unknown };\n return {\n $apiName: wire.__apiName as Q[\"apiName\"],\n $primaryKey: wire.__primaryKey as PrimaryKeyType<Q>,\n };\n });\n return {\n data,\n nextPageToken: response.nextPageToken,\n };\n }\n\n async function* editedEntitiesAsyncIter<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>> {\n const seen = new Set<unknown>();\n let pageToken: string | undefined;\n do {\n const page = await getEditedEntities(objectType, {\n pageSize: options?.pageSize,\n pageToken,\n });\n for (const obj of page.data) {\n const key = obj.$primaryKey;\n if (seen.has(key)) continue;\n seen.add(key);\n yield obj;\n }\n pageToken = page.nextPageToken;\n } while (pageToken != null);\n }\n\n async function getEditedLinkTypes<Q extends ObjectOrInterfaceDefinition>(\n sourceObjectType: Q,\n ): Promise<LinkTypeApiNamesFor<Q>[]> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioEditedLinkTypes(\n innerCtx,\n ontologyRid,\n scenarioRid,\n sourceObjectType.apiName,\n { preview: true },\n );\n return response.data as LinkTypeApiNamesFor<Q>[];\n }\n\n async function getEditedLinks<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedLinksPage<Q, LINK_TYPE_API_NAME>> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioEditedLinks(\n innerCtx,\n ontologyRid,\n scenarioRid,\n sourceObjectType.apiName,\n linkType as string,\n {\n pageSize: options?.pageSize,\n pageToken: options?.pageToken,\n preview: true,\n },\n );\n\n const data: MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[] = [];\n for (const entry of response.data) {\n const sourceWire = entry.sourceObject as\n | { __apiName?: unknown; __primaryKey?: unknown }\n | undefined;\n if (sourceWire?.__apiName == null || sourceWire.__primaryKey == null) {\n continue;\n }\n const source = {\n $apiName: sourceWire.__apiName,\n $primaryKey: sourceWire.__primaryKey,\n } as MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[\"source\"];\n\n for (const linked of entry.linkedObjects) {\n const targetWire = linked.targetObject as\n | { __apiName?: unknown; __primaryKey?: unknown }\n | undefined;\n if (targetWire?.__apiName == null || targetWire.__primaryKey == null) {\n continue;\n }\n const target = {\n $apiName: targetWire.__apiName,\n $primaryKey: targetWire.__primaryKey,\n } as MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[\"target\"];\n\n data.push({\n source,\n target,\n linkType: ((linked.linkType as string | undefined) ??\n linkType) as LINK_TYPE_API_NAME,\n });\n }\n }\n\n return { data, nextPageToken: response.nextPageToken };\n }\n\n async function* editedLinksAsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<\n MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>\n > {\n let pageToken: string | undefined;\n do {\n const page = await getEditedLinks(sourceObjectType, linkType, {\n pageSize: options?.pageSize,\n pageToken,\n });\n for (const link of page.data) {\n yield link;\n }\n pageToken = page.nextPageToken;\n } while (pageToken != null);\n }\n\n async function getConflictingObjects<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<ConflictingObjectsPage<Q>> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioConflictingObjects(\n innerCtx,\n ontologyRid,\n scenarioRid,\n objectType.apiName,\n {\n pageSize: options?.pageSize,\n pageToken: options?.pageToken,\n preview: true,\n },\n );\n const data: ObjectIdentifiers<Q>[] = response.data.map((entry) => ({\n $apiName: entry.objectTypeApiName as Q[\"apiName\"],\n $primaryKey: entry.primaryKeyValue as PrimaryKeyType<Q>,\n }));\n return {\n data,\n nextPageToken: response.nextPageToken,\n };\n }\n\n async function* conflictingObjectsAsyncIter<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>> {\n let pageToken: string | undefined;\n do {\n const page = await getConflictingObjects(objectType, {\n pageSize: options?.pageSize,\n pageToken,\n });\n for (const object of page.data) {\n yield object;\n }\n pageToken = page.nextPageToken;\n } while (pageToken != null);\n }\n\n return Object.defineProperties(inner, {\n getScenarioReference: {\n value: () => scenarioRid,\n },\n rebase: {\n value: rebase,\n },\n getEditedEntityTypes: {\n value: getEditedEntityTypes,\n },\n getEditedEntities: {\n value: getEditedEntities,\n },\n editedEntitiesAsyncIter: {\n value: editedEntitiesAsyncIter,\n },\n getEditedLinkTypes: {\n value: getEditedLinkTypes,\n },\n getEditedLinks: {\n value: getEditedLinks,\n },\n editedLinksAsyncIter: {\n value: editedLinksAsyncIter,\n },\n getConflictingObjects: {\n value: getConflictingObjects,\n },\n conflictingObjectsAsyncIter: {\n value: conflictingObjectsAsyncIter,\n },\n }) as EXPERIMENTAL_ScenarioClient;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,iBAAiB,QAAQ,0BAA0B;AAE5D,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;;AAG5D;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAqIA,OAAO,SAASC,gBAAgBA,CAC9BC,KAAc,EACwB;EACtC,OACEA,KAAK,IAAI,IAAI,KACZ,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,UAAU,CAAC,IAC1D,OAAQA,KAAK,CACVC,oBAAoB,KAAK,UAAU;AAE1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,MAAc,EACdC,WAAmB,EACU;EAC7B,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AA+B,EAG/B;QACA,IAAIM,SAA6B;QACjC,GAAG;UACD,MAAMuC,IAAI,GAAG,MAAM5B,cAAc,CAACC,gBAAgB,EAAEC,QAAQ,EAAE;YAC5Dd,QAAQ,EAAEL,OAAO,EAAEK,QAAQ;YAC3BC;UACF,CAAC,CAAC;UACF,KAAK,MAAM+C,IAAI,IAAIR,IAAI,CAACrC,IAAI,EAAE;YAC5B,MAAM6C,IAAI;UACZ;UACA/C,SAAS,GAAGuC,IAAI,CAAC7B,aAAa;QAChC,CAAC,QAAQV,SAAS,IAAI,IAAI;MAC5B;IAqEE,CAAC;IACDwB,qBAAqB,EAAE;MACrB/C,KAAK,EAAE+C;IACT,CAAC;IACDwB,2BAA2B,EAAE;MAC3BvE,KAAK,EA9CT,gBAAAA,CACEgB,UAAa,EACbC,OAA+B,EACc;QAC7C,IAAIM,SAA6B;QACjC,GAAG;UACD,MAAMuC,IAAI,GAAG,MAAMf,qBAAqB,CAAC/B,UAAU,EAAE;YACnDM,QAAQ,EAAEL,OAAO,EAAEK,QAAQ;YAC3BC;UACF,CAAC,CAAC;UACF,KAAK,MAAMiD,MAAM,IAAIV,IAAI,CAACrC,IAAI,EAAE;YAC9B,MAAM+C,MAAM;UACd;UACAjD,SAAS,GAAGuC,IAAI,CAAC7B,aAAa;QAChC,CAAC,QAAQV,SAAS,IAAI,IAAI;MAC5B;IAgCE;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ScenarioClient.js","names":["OntologyScenarios","additionalContext","createClientFromContext","isScenarioClient","value","getScenarioReference","buildScenarioClient","parent","scenarioRid","ctx","transactionId","console","warn","Error","inner","undefined","flushEdits","clientCacheKey","innerCtx","getEditedObjects","objectType","options","ontologyRid","response","listScenarioEditedObjects","apiName","pageSize","pageToken","preview","data","map","entry","wire","$apiName","__apiName","$primaryKey","__primaryKey","nextPageToken","getEditedLinks","sourceObjectType","linkType","listScenarioEditedLinks","sourceWire","sourceObject","source","linked","linkedObjects","targetWire","targetObject","target","push","getConflictingObjects","listScenarioConflictingObjects","objectTypeApiName","primaryKeyValue","Object","defineProperties","EXPERIMENTAL_DO_NOT_USE_rebase","rebaseScenario","getEditedEntityTypes","listScenarioEditedEntityTypes","objectTypes","linkTypes","editedObjectsAsyncIter","seen","Set","page","obj","key","has","add","editedLinksAsyncIter","link","EXPERIMENTAL_DO_NOT_USE_getConflictingObjects","EXPERIMENTAL_DO_NOT_USE_conflictingObjectsAsyncIter","object"],"sources":["ScenarioClient.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 type {\n LinkTypeApiNamesFor,\n MinimalDirectedObjectLinkInstance,\n ObjectIdentifiers,\n ObjectOrInterfaceDefinition,\n ObjectTypeDefinition,\n PrimaryKeyType,\n} from \"@osdk/api\";\nimport { OntologyScenarios } from \"@osdk/foundry.ontologies\";\n\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientFromContext } from \"../createClient.js\";\nimport type { ClientCacheKey, MinimalClient } from \"../MinimalClientContext.js\";\n\n/**\n * The set of many-to-many link types modified within a scenario for one source object type. Returned as part of\n * {@link ScenarioEditedEntityTypes.linkTypes}.\n */\nexport interface EditedLinksForObjectType {\n objectTypeApiName: string;\n linkTypes: string[];\n}\n\n/**\n * The object types and link types that have been modified within a scenario. Only many-to-many link type edits are\n * surfaced via `linkTypes`; one-to-many edits surface as object edits on the object type that owns the foreign key\n * property.\n */\nexport interface ScenarioEditedEntityTypes {\n objectTypes: string[];\n linkTypes: EditedLinksForObjectType[];\n}\n\n/**\n * A page of edited object identifiers within a scenario for a given object type. Returned by\n * {@link ScenarioClient.getEditedObjects}. To load full property values, pass the primary keys back\n * through the scenario client, e.g.\n * `scenario(MyObject).where({ $primaryKey: { $in: keys } }).fetchPage()`.\n */\nexport interface EditedObjectsPage<Q extends ObjectTypeDefinition> {\n data: ObjectIdentifiers<Q>[];\n nextPageToken?: string;\n}\n\n/**\n * A page of directed link instances edited within a scenario for a given source object type and link api name.\n * Returned by {@link ScenarioClient.getEditedLinks}. Source and target carry only `$primaryKey` + `$apiName`.\n */\nexport interface EditedLinksPage<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n> {\n data: MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[];\n nextPageToken?: string;\n}\n\n/**\n * A page of object identifiers whose edits within a scenario conflict with edits to the scenario's base. Returned by\n * {@link ScenarioClient.EXPERIMENTAL_DO_NOT_USE_getConflictingObjects}. Results contain only `$primaryKey` + `$apiName`.\n *\n * @beta This is an experimental feature subject to change.\n */\nexport interface EXPERIMENTAL_DO_NOT_USE_ConflictingObjectsPage<\n Q extends ObjectTypeDefinition,\n> {\n data: ObjectIdentifiers<Q>[];\n nextPageToken?: string;\n}\n\n/**\n * A {@link Client} attached to an ontology scenario. All read and write operations performed via this client are\n * scoped to that scenario. `ScenarioClient` is a superset of {@link Client}.\n */\nexport interface ScenarioClient extends Client {\n /**\n * The scenario RID this client is scoped to.\n */\n getScenarioReference(): string;\n\n /**\n * Rebase this scenario onto the latest data from its base\n *\n * @beta This is an experimental feature subject to change.\n */\n EXPERIMENTAL_DO_NOT_USE_rebase(): Promise<void>;\n\n /**\n * List the object types and many-to-many link types that have been modified within this scenario. Useful as a\n * pre-step before paginating individual edited objects per type.\n */\n getEditedEntityTypes(): Promise<ScenarioEditedEntityTypes>;\n\n /**\n * Get a page of object identifiers that have been\n * edited within this scenario for the given object type. Use the scenario client to fetch full property values\n * if needed.\n *\n * @example\n * ```ts\n * let pageToken: string | undefined;\n * const keys: string[] = [];\n * do {\n * const page = await scenario.getEditedObjects(Doctor, { pageSize: 500, pageToken });\n * keys.push(...page.data.map(o => o.$primaryKey));\n * pageToken = page.nextPageToken;\n * } while (pageToken);\n * ```\n */\n getEditedObjects<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedObjectsPage<Q>>;\n\n /**\n * Stream object identifiers for the objects edited within this scenario for the\n * given object type. Pages are fetched lazily and deduplicated by `$primaryKey` across pages (Funnel may return\n * duplicates).\n *\n * @example\n * ```ts\n * for await (const obj of scenario.editedObjectsAsyncIter(Doctor, { pageSize: 500 })) {\n * // obj.$primaryKey is the unique key for this edited object\n * }\n * ```\n */\n editedObjectsAsyncIter<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>>;\n\n /**\n * Get a page of directed link instances edited within this scenario for a given source object type and link\n * api name. The page form returns a flattened array of `{ source, target, linkType }` triples.\n */\n getEditedLinks<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedLinksPage<Q, LINK_TYPE_API_NAME>>;\n\n /**\n * Stream directed link instances edited within this scenario for a given source object type and link api name.\n * Pages are fetched lazily.\n *\n * @example\n * ```ts\n * for await (\n * const { source, target, linkType } of scenario.editedLinksAsyncIter(Doctor, \"treats\")\n * ) {\n * graph.addEdge(source, target, linkType);\n * }\n * ```\n */\n editedLinksAsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<\n MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>\n >;\n\n /**\n * Get a page of object identifiers whose scenario edits conflict with edits to the scenario's base for the given\n * object type. Conflict detection may report false positives when object versions change without user-visible data\n * changes. Results are a point-in-time check, and include only objects the caller may view and the backend can resolve,\n * and may become stale before merge. Use the base client and scenario client to load both object states for review.\n *\n * `pageSize` bounds the number of objects examined, not the number of conflicts returned, so a page may contain fewer\n * results than requested while still returning `nextPageToken`.\n *\n * @beta This is an experimental feature subject to change.\n */\n EXPERIMENTAL_DO_NOT_USE_getConflictingObjects<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EXPERIMENTAL_DO_NOT_USE_ConflictingObjectsPage<Q>>;\n\n /**\n * Stream object identifiers for the objects whose scenario edits conflict with edits to the scenario's base for the\n * given object type. Pages are fetched lazily.\n *\n * @beta This is an experimental feature subject to change.\n *\n * @example\n * ```ts\n * for await (const obj of scenario.EXPERIMENTAL_DO_NOT_USE_conflictingObjectsAsyncIter(Doctor, { pageSize: 500 })) {\n * // obj.$primaryKey identifies an object with a conflicting scenario edit\n * }\n * ```\n */\n EXPERIMENTAL_DO_NOT_USE_conflictingObjectsAsyncIter<\n Q extends ObjectTypeDefinition,\n >(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>>;\n}\n\nexport function isScenarioClient(value: unknown): value is ScenarioClient {\n return (\n value != null &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n typeof (value as { getScenarioReference?: unknown })\n .getScenarioReference === \"function\"\n );\n}\n\n/**\n * Shared internal builder used by both {@link withScenario} and {@link createScenario}. Throws if the parent client\n * is already inside a scenario. If the parent client has an active transaction, the transaction is ignored (a warning\n * is logged) and the client is scoped to the scenario instead. Derives a {@link Client} from the parent's context via\n * `createClientFromContext` and decorates it with {@link ScenarioClient}-only methods.\n *\n * @internal\n */\nexport function buildScenarioClient(\n parent: Client,\n scenarioRid: string,\n): ScenarioClient {\n const ctx: MinimalClient = parent[additionalContext];\n\n if (ctx.transactionId != null) {\n // eslint-disable-next-line no-console\n console.warn(\n \"withScenario / createScenario: the supplied client has an active transaction. Ignoring the transaction and scoping to the scenario instead.\",\n );\n }\n if (ctx.scenarioRid != null) {\n throw new Error(\n \"withScenario / createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.\",\n );\n }\n\n const inner: Client = createClientFromContext({\n ...ctx,\n transactionId: undefined,\n flushEdits: undefined,\n scenarioRid,\n clientCacheKey: {} as ClientCacheKey,\n });\n\n const innerCtx: MinimalClient = inner[additionalContext];\n\n async function rebase(): Promise<void> {\n const ontologyRid = await innerCtx.ontologyRid;\n await OntologyScenarios.rebaseScenario(innerCtx, ontologyRid, scenarioRid, {\n preview: true,\n });\n }\n\n async function getEditedEntityTypes(): Promise<ScenarioEditedEntityTypes> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioEditedEntityTypes(\n innerCtx,\n ontologyRid,\n scenarioRid,\n { preview: true },\n );\n return {\n objectTypes: response.objectTypes,\n linkTypes: response.linkTypes,\n };\n }\n\n async function getEditedObjects<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedObjectsPage<Q>> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioEditedObjects(\n innerCtx,\n ontologyRid,\n scenarioRid,\n objectType.apiName,\n {\n pageSize: options?.pageSize,\n pageToken: options?.pageToken,\n preview: true,\n },\n );\n const data: ObjectIdentifiers<Q>[] = response.data.map((entry) => {\n const wire = entry as { __apiName?: unknown; __primaryKey?: unknown };\n return {\n $apiName: wire.__apiName as Q[\"apiName\"],\n $primaryKey: wire.__primaryKey as PrimaryKeyType<Q>,\n };\n });\n return {\n data,\n nextPageToken: response.nextPageToken,\n };\n }\n\n async function* editedObjectsAsyncIter<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>> {\n const seen = new Set<unknown>();\n let pageToken: string | undefined;\n do {\n const page = await getEditedObjects(objectType, {\n pageSize: options?.pageSize,\n pageToken,\n });\n for (const obj of page.data) {\n const key = obj.$primaryKey;\n if (seen.has(key)) continue;\n seen.add(key);\n yield obj;\n }\n pageToken = page.nextPageToken;\n } while (pageToken != null);\n }\n\n async function getEditedLinks<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EditedLinksPage<Q, LINK_TYPE_API_NAME>> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioEditedLinks(\n innerCtx,\n ontologyRid,\n scenarioRid,\n sourceObjectType.apiName,\n linkType as string,\n {\n pageSize: options?.pageSize,\n pageToken: options?.pageToken,\n preview: true,\n },\n );\n\n const data: MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[] = [];\n for (const entry of response.data) {\n const sourceWire = entry.sourceObject as\n | { __apiName?: unknown; __primaryKey?: unknown }\n | undefined;\n if (sourceWire?.__apiName == null || sourceWire.__primaryKey == null) {\n continue;\n }\n const source = {\n $apiName: sourceWire.__apiName,\n $primaryKey: sourceWire.__primaryKey,\n } as MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[\"source\"];\n\n for (const linked of entry.linkedObjects) {\n const targetWire = linked.targetObject as\n | { __apiName?: unknown; __primaryKey?: unknown }\n | undefined;\n if (targetWire?.__apiName == null || targetWire.__primaryKey == null) {\n continue;\n }\n const target = {\n $apiName: targetWire.__apiName,\n $primaryKey: targetWire.__primaryKey,\n } as MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>[\"target\"];\n\n data.push({\n source,\n target,\n linkType: ((linked.linkType as string | undefined) ??\n linkType) as LINK_TYPE_API_NAME,\n });\n }\n }\n\n return { data, nextPageToken: response.nextPageToken };\n }\n\n async function* editedLinksAsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n LINK_TYPE_API_NAME extends LinkTypeApiNamesFor<Q>,\n >(\n sourceObjectType: Q,\n linkType: LINK_TYPE_API_NAME,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<\n MinimalDirectedObjectLinkInstance<Q, LINK_TYPE_API_NAME>\n > {\n let pageToken: string | undefined;\n do {\n const page = await getEditedLinks(sourceObjectType, linkType, {\n pageSize: options?.pageSize,\n pageToken,\n });\n for (const link of page.data) {\n yield link;\n }\n pageToken = page.nextPageToken;\n } while (pageToken != null);\n }\n\n async function getConflictingObjects<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number; pageToken?: string },\n ): Promise<EXPERIMENTAL_DO_NOT_USE_ConflictingObjectsPage<Q>> {\n const ontologyRid = await innerCtx.ontologyRid;\n const response = await OntologyScenarios.listScenarioConflictingObjects(\n innerCtx,\n ontologyRid,\n scenarioRid,\n objectType.apiName,\n {\n pageSize: options?.pageSize,\n pageToken: options?.pageToken,\n preview: true,\n },\n );\n const data: ObjectIdentifiers<Q>[] = response.data.map((entry) => ({\n $apiName: entry.objectTypeApiName as Q[\"apiName\"],\n $primaryKey: entry.primaryKeyValue as PrimaryKeyType<Q>,\n }));\n return {\n data,\n nextPageToken: response.nextPageToken,\n };\n }\n\n async function* conflictingObjectsAsyncIter<Q extends ObjectTypeDefinition>(\n objectType: Q,\n options?: { pageSize?: number },\n ): AsyncIterableIterator<ObjectIdentifiers<Q>> {\n let pageToken: string | undefined;\n do {\n const page = await getConflictingObjects(objectType, {\n pageSize: options?.pageSize,\n pageToken,\n });\n for (const object of page.data) {\n yield object;\n }\n pageToken = page.nextPageToken;\n } while (pageToken != null);\n }\n\n return Object.defineProperties(inner, {\n getScenarioReference: {\n value: () => scenarioRid,\n },\n EXPERIMENTAL_DO_NOT_USE_rebase: {\n value: rebase,\n },\n getEditedEntityTypes: {\n value: getEditedEntityTypes,\n },\n getEditedObjects: {\n value: getEditedObjects,\n },\n editedObjectsAsyncIter: {\n value: editedObjectsAsyncIter,\n },\n getEditedLinks: {\n value: getEditedLinks,\n },\n editedLinksAsyncIter: {\n value: editedLinksAsyncIter,\n },\n EXPERIMENTAL_DO_NOT_USE_getConflictingObjects: {\n value: getConflictingObjects,\n },\n EXPERIMENTAL_DO_NOT_USE_conflictingObjectsAsyncIter: {\n value: conflictingObjectsAsyncIter,\n },\n }) as ScenarioClient;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,iBAAiB,QAAQ,0BAA0B;AAE5D,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,uBAAuB,QAAQ,oBAAoB;;AAG5D;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAoIA,OAAO,SAASC,gBAAgBA,CAACC,KAAc,EAA2B;EACxE,OACEA,KAAK,IAAI,IAAI,KACZ,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,UAAU,CAAC,IAC1D,OAAQA,KAAK,CACVC,oBAAoB,KAAK,UAAU;AAE1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,MAAc,EACdC,WAAmB,EACH;EAChB,MAAMC,GAAkB,GAAGF,MAAM,CAACN,iBAAiB,CAAC;EAEpD,IAAIQ,GAAG,CAACC,aAAa,IAAI,IAAI,EAAE;IAC7B;IACAC,OAAO,CAACC,IAAI,CACV,6IACF,CAAC;EACH;EACA,IAAIH,GAAG,CAACD,WAAW,IAAI,IAAI,EAAE;IAC3B,MAAM,IAAIK,KAAK,CACb,gHACF,CAAC;EACH;EAEA,MAAMC,KAAa,GAAGZ,uBAA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EAAEL,OAAO,EAAEK,QAAQ;YAC3BC;UACF,CAAC,CAAC;UACF,KAAK,MAAMgD,MAAM,IAAIT,IAAI,CAACrC,IAAI,EAAE;YAC9B,MAAM8C,MAAM;UACd;UACAhD,SAAS,GAAGuC,IAAI,CAAC7B,aAAa;QAChC,CAAC,QAAQV,SAAS,IAAI,IAAI;MAC5B;IA6BE;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -26,13 +26,11 @@ import { buildScenarioClient } from "./ScenarioClient.js";
|
|
|
26
26
|
* the transaction is ignored (a warning is logged) and the client is scoped to the new scenario. When the base
|
|
27
27
|
* client has a branch set, the newly minted scenario uses that branch as its base.
|
|
28
28
|
* @param options - Optional settings for the new scenario.
|
|
29
|
-
* @returns a {@link
|
|
30
|
-
*
|
|
31
|
-
* @beta This is an experimental, unstable feature subject to change.
|
|
29
|
+
* @returns a {@link ScenarioClient} bound to the freshly minted scenario RID.
|
|
32
30
|
*
|
|
33
31
|
* @example
|
|
34
32
|
* ```ts
|
|
35
|
-
* import { createScenario } from "@osdk/client
|
|
33
|
+
* import { createScenario } from "@osdk/client";
|
|
36
34
|
*
|
|
37
35
|
* const expireAfter = new Date(Date.now() + 60 * 60 * 1000);
|
|
38
36
|
* const scenario = await createScenario(client, { expireAfter });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createScenario.js","names":["OntologyScenarios","additionalContext","buildScenarioClient","createScenario","client","options","ctx","scenarioRid","Error","request","branch","base","type","expireAfter","toISOString","response","ontologyRid","preview"],"sources":["createScenario.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 {\n type CreateOntologyScenarioRequest,\n OntologyScenarios,\n} from \"@osdk/foundry.ontologies\";\n\nimport { additionalContext, type Client } from \"../Client.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"createScenario.js","names":["OntologyScenarios","additionalContext","buildScenarioClient","createScenario","client","options","ctx","scenarioRid","Error","request","branch","base","type","expireAfter","toISOString","response","ontologyRid","preview"],"sources":["createScenario.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 {\n type CreateOntologyScenarioRequest,\n OntologyScenarios,\n} from \"@osdk/foundry.ontologies\";\n\nimport { additionalContext, type Client } from \"../Client.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { buildScenarioClient, type ScenarioClient } from \"./ScenarioClient.js\";\n\n/**\n * Mint a fresh ontology scenario and return a client scoped to it.\n *\n * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)\n * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,\n * the transaction is ignored (a warning is logged) and the client is scoped to the new scenario. When the base\n * client has a branch set, the newly minted scenario uses that branch as its base.\n * @param options - Optional settings for the new scenario.\n * @returns a {@link ScenarioClient} bound to the freshly minted scenario RID.\n *\n * @example\n * ```ts\n * import { createScenario } from \"@osdk/client\";\n *\n * const expireAfter = new Date(Date.now() + 60 * 60 * 1000);\n * const scenario = await createScenario(client, { expireAfter });\n * const scenarioRid = scenario.getScenarioReference();\n * ```\n */\nexport async function createScenario(\n client: Client,\n options?: {\n expireAfter?: Date;\n },\n): Promise<ScenarioClient> {\n const ctx: MinimalClient = client[additionalContext];\n\n if (ctx.scenarioRid != null) {\n throw new Error(\n \"createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.\",\n );\n }\n\n const request: CreateOntologyScenarioRequest = {};\n\n if (ctx.branch != null) {\n request.base = { type: \"branch\", branch: ctx.branch };\n }\n\n if (options?.expireAfter != null) {\n request.expireAfter = options.expireAfter.toISOString();\n }\n\n const response = await OntologyScenarios.createScenario(\n ctx,\n await ctx.ontologyRid,\n request,\n { preview: true },\n );\n\n return buildScenarioClient(client, response.scenarioRid);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,iBAAiB,QACZ,0BAA0B;AAEjC,SAASC,iBAAiB,QAAqB,cAAc;AAE7D,SAASC,mBAAmB,QAA6B,qBAAqB;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,cAAcA,CAClCC,MAAc,EACdC,OAEC,EACwB;EACzB,MAAMC,GAAkB,GAAGF,MAAM,CAACH,iBAAiB,CAAC;EAEpD,IAAIK,GAAG,CAACC,WAAW,IAAI,IAAI,EAAE;IAC3B,MAAM,IAAIC,KAAK,CACb,iGACF,CAAC;EACH;EAEA,MAAMC,OAAsC,GAAG,CAAC,CAAC;EAEjD,IAAIH,GAAG,CAACI,MAAM,IAAI,IAAI,EAAE;IACtBD,OAAO,CAACE,IAAI,GAAG;MAAEC,IAAI,EAAE,QAAQ;MAAEF,MAAM,EAAEJ,GAAG,CAACI;IAAO,CAAC;EACvD;EAEA,IAAIL,OAAO,EAAEQ,WAAW,IAAI,IAAI,EAAE;IAChCJ,OAAO,CAACI,WAAW,GAAGR,OAAO,CAACQ,WAAW,CAACC,WAAW,CAAC,CAAC;EACzD;EAEA,MAAMC,QAAQ,GAAG,MAAMf,iBAAiB,CAACG,cAAc,CACrDG,GAAG,EACH,MAAMA,GAAG,CAACU,WAAW,EACrBP,OAAO,EACP;IAAEQ,OAAO,EAAE;EAAK,CAClB,CAAC;EAED,OAAOf,mBAAmB,CAACE,MAAM,EAAEW,QAAQ,CAACR,WAAW,CAAC;AAC1D","ignoreList":[]}
|
|
@@ -24,13 +24,11 @@ import { buildScenarioClient } from "./ScenarioClient.js";
|
|
|
24
24
|
* from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,
|
|
25
25
|
* the transaction is ignored (a warning is logged) and the client is scoped to the scenario.
|
|
26
26
|
* @param scenarioRid - The RID of the scenario to attach to.
|
|
27
|
-
* @returns a {@link
|
|
28
|
-
*
|
|
29
|
-
* @beta This is an experimental, unstable feature subject to change.
|
|
27
|
+
* @returns a {@link ScenarioClient} bound to `scenarioRid`.
|
|
30
28
|
*
|
|
31
29
|
* @example
|
|
32
30
|
* ```ts
|
|
33
|
-
* import { withScenario } from "@osdk/client
|
|
31
|
+
* import { withScenario } from "@osdk/client";
|
|
34
32
|
*
|
|
35
33
|
* const scenario = withScenario(client, "ri.actions..scenario.abc");
|
|
36
34
|
* const page = await scenario(Doctor).fetchPage();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withScenario.js","names":["buildScenarioClient","withScenario","client","scenarioRid"],"sources":["withScenario.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 type { Client } from \"../Client.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"withScenario.js","names":["buildScenarioClient","withScenario","client","scenarioRid"],"sources":["withScenario.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 type { Client } from \"../Client.js\";\nimport { buildScenarioClient, type ScenarioClient } from \"./ScenarioClient.js\";\n\n/**\n * Attach to an existing ontology scenario. Synchronous — no network call is made. The returned client scopes all\n * subsequent operations (`fetchPage`, `applyAction`, `executeFunction`, etc.) to the given `scenarioRid`.\n *\n * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)\n * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,\n * the transaction is ignored (a warning is logged) and the client is scoped to the scenario.\n * @param scenarioRid - The RID of the scenario to attach to.\n * @returns a {@link ScenarioClient} bound to `scenarioRid`.\n *\n * @example\n * ```ts\n * import { withScenario } from \"@osdk/client\";\n *\n * const scenario = withScenario(client, \"ri.actions..scenario.abc\");\n * const page = await scenario(Doctor).fetchPage();\n * await scenario(Schedule).applyAction({ doctor: page.data[0], shift: \"AM\" });\n * ```\n */\nexport function withScenario(\n client: Client,\n scenarioRid: string,\n): ScenarioClient {\n return buildScenarioClient(client, scenarioRid);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,mBAAmB,QAA6B,qBAAqB;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAC1BC,MAAc,EACdC,WAAmB,EACH;EAChB,OAAOH,mBAAmB,CAACE,MAAM,EAAEC,WAAW,CAAC;AACjD","ignoreList":[]}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export const USER_AGENT = `osdk-client/${"2.
|
|
18
|
-
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.
|
|
17
|
+
export const USER_AGENT = `osdk-client/${"2.96.0-main-8ae7abf314d15269ef90cd4c728c6be4db955750"}`;
|
|
18
|
+
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.96.0-main-8ae7abf314d15269ef90cd4c728c6be4db955750"}`;
|
|
19
19
|
//# sourceMappingURL=UserAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 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 USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 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 USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,uEAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GAAG,kFAAuD","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkHVITOOBR_cjs = require('./chunk-HVITOOBR.cjs');
|
|
4
|
+
var chunkOQXF4VWE_cjs = require('./chunk-OQXF4VWE.cjs');
|
|
5
5
|
var chunkB4UCZI2Z_cjs = require('./chunk-B4UCZI2Z.cjs');
|
|
6
6
|
require('./chunk-Q7SFCCGT.cjs');
|
|
7
7
|
|
|
@@ -17,19 +17,19 @@ async function* applyStreamingQuery(client, query, params) {
|
|
|
17
17
|
if (client.flushEdits != null) {
|
|
18
18
|
await client.flushEdits();
|
|
19
19
|
}
|
|
20
|
-
const response = await streamingExecute(
|
|
20
|
+
const response = await streamingExecute(chunkOQXF4VWE_cjs.addUserAgentHeader(client, query), query.apiName, {
|
|
21
21
|
ontology: await client.ontologyRid,
|
|
22
|
-
parameters: params ? await
|
|
22
|
+
parameters: params ? await chunkHVITOOBR_cjs.remapQueryParams(params, client, qd.parameters) : {},
|
|
23
23
|
version: query.isFixedVersion ? query.version : void 0,
|
|
24
24
|
branch: client.branch
|
|
25
25
|
}, {
|
|
26
26
|
transactionId: client.transactionId,
|
|
27
27
|
preview: true
|
|
28
28
|
});
|
|
29
|
-
const definitions = await
|
|
29
|
+
const definitions = await chunkHVITOOBR_cjs.getRequiredDefinitions(qd.output, client);
|
|
30
30
|
for await (const event of response) {
|
|
31
31
|
if (event.type !== "data") continue;
|
|
32
|
-
const remapped = await
|
|
32
|
+
const remapped = await chunkHVITOOBR_cjs.remapQueryResponse(client, qd.output, event.value, definitions);
|
|
33
33
|
if (qd.output.type === "array" && Array.isArray(remapped)) {
|
|
34
34
|
for (const item of remapped) {
|
|
35
35
|
yield item;
|
|
@@ -41,5 +41,5 @@ async function* applyStreamingQuery(client, query, params) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
exports.applyStreamingQuery = applyStreamingQuery;
|
|
44
|
-
//# sourceMappingURL=applyStreamingQuery-
|
|
45
|
-
//# sourceMappingURL=applyStreamingQuery-
|
|
44
|
+
//# sourceMappingURL=applyStreamingQuery-EKQJ2HOP.cjs.map
|
|
45
|
+
//# sourceMappingURL=applyStreamingQuery-EKQJ2HOP.cjs.map
|
package/build/cjs/{applyStreamingQuery-KCJOS7TV.cjs.map → applyStreamingQuery-EKQJ2HOP.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.87.0/node_modules/@osdk/foundry.functions/build/esm/v2/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentHeader","remapQueryParams","getRequiredDefinitions","remapQueryResponse"],"mappings":";;;;;;;;AAgFA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,mB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W,CAAA;AACrF,IAAA,IAAI,GAAG,MAAA,CAAO,IAAA,KAAS,WAAW,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACzD,MAAA,KAAA,MAAW,QAAQ,QAAA,EAAU;AAC3B,QAAA,MAAM,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-KCJOS7TV.cjs","sourcesContent":["/*\n * Copyright 2024 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 */\nimport { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this returns the highest semantic\n * version of the query, excluding pre-release versions. To resolve the most recently published version\n * instead, including pre-release versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query and returns the result as a single JSON object. By default, this executes\n * the highest semantic version of the query, excluding pre-release versions. To resolve the\n * most recently published version instead, including pre-release versions, set\n * `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint executes global (non-ontology-scoped) query functions. For ontology-scoped\n * functions, use the equivalent endpoint under\n * `/v2/ontologies/{ontology}/queries/{queryApiName}/execute`. For streaming or incremental\n * result delivery, use `streamingExecute`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _streamingExecuteEvents = [1, \"/v2/functions/queries/{0}/streamingExecuteEvents\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecuteEvents\n */\nexport function streamingExecuteEvents($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecuteEvents, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * Supports maps represented as arrays of key/value entries, including nested maps.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 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 Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentHeader } from \"../util/addUserAgentHeader.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentHeader(client, query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n const definitions = await getRequiredDefinitions(qd.output, client);\n for await (const event of response) {\n if (event.type !== \"data\") continue;\n const remapped = await remapQueryResponse(client, qd.output, event.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.87.0/node_modules/@osdk/foundry.functions/build/esm/v2/public/Query.js","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SAAS,QAAA,EAAU;AAClC,IAAA,IAAI,KAAA,CAAM,SAAS,MAAA,EAAQ;AAC3B,IAAA,MAAM,QAAA,GAAW,MAAMC,oCAAA,CAAmB,MAAA,EAAQ,GAAG,MAAA,EAAQ,KAAA,CAAM,OAAO,WAAW,CAAA;AACrF,IAAA,IAAI,GAAG,MAAA,CAAO,IAAA,KAAS,WAAW,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACzD,MAAA,KAAA,MAAW,QAAQ,QAAA,EAAU;AAC3B,QAAA,MAAM,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-EKQJ2HOP.cjs","sourcesContent":["/*\n * Copyright 2024 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 */\nimport { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this returns the highest semantic\n * version of the query, excluding pre-release versions. To resolve the most recently published version\n * instead, including pre-release versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query and returns the result as a single JSON object. By default, this executes\n * the highest semantic version of the query, excluding pre-release versions. To resolve the\n * most recently published version instead, including pre-release versions, set\n * `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint executes global (non-ontology-scoped) query functions. For ontology-scoped\n * functions, use the equivalent endpoint under\n * `/v2/ontologies/{ontology}/queries/{queryApiName}/execute`. For streaming or incremental\n * result delivery, use `streamingExecute`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _streamingExecuteEvents = [1, \"/v2/functions/queries/{0}/streamingExecuteEvents\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecuteEvents\n */\nexport function streamingExecuteEvents($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecuteEvents, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * Supports maps represented as arrays of key/value entries, including nested maps.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 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 Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentHeader } from \"../util/addUserAgentHeader.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentHeader(client, query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n const definitions = await getRequiredDefinitions(qd.output, client);\n for await (const event of response) {\n if (event.type !== \"data\") continue;\n const remapped = await remapQueryResponse(client, qd.output, event.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
|