@osdk/client 2.35.0 → 2.36.0

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/scenarios/ScenarioClient.js +5 -3
  5. package/build/browser/scenarios/ScenarioClient.js.map +1 -1
  6. package/build/browser/scenarios/createScenario.js +3 -5
  7. package/build/browser/scenarios/createScenario.js.map +1 -1
  8. package/build/browser/scenarios/withScenario.js +2 -1
  9. package/build/browser/scenarios/withScenario.js.map +1 -1
  10. package/build/browser/util/UserAgent.js +2 -2
  11. package/build/cjs/{applyStreamingQuery-IWZCZA6J.cjs → applyStreamingQuery-RK2N6TJ5.cjs} +9 -9
  12. package/build/cjs/{applyStreamingQuery-IWZCZA6J.cjs.map → applyStreamingQuery-RK2N6TJ5.cjs.map} +1 -1
  13. package/build/cjs/{chunk-A4LQCGPA.cjs → chunk-53ODHT6J.cjs} +47 -47
  14. package/build/cjs/{chunk-A4LQCGPA.cjs.map → chunk-53ODHT6J.cjs.map} +1 -1
  15. package/build/cjs/{chunk-CWBZEZQC.cjs → chunk-QUF62D2S.cjs} +76 -76
  16. package/build/cjs/{chunk-CWBZEZQC.cjs.map → chunk-QUF62D2S.cjs.map} +1 -1
  17. package/build/cjs/{chunk-LWT7AZZD.cjs → chunk-VD4QAB27.cjs} +13 -13
  18. package/build/cjs/{chunk-LWT7AZZD.cjs.map → chunk-VD4QAB27.cjs.map} +1 -1
  19. package/build/cjs/{chunk-ZLUXOM2B.cjs → chunk-ZSQBDK7L.cjs} +2 -2
  20. package/build/cjs/{chunk-ZLUXOM2B.cjs.map → chunk-ZSQBDK7L.cjs.map} +1 -1
  21. package/build/cjs/index.cjs +11 -11
  22. package/build/cjs/public/experimental.cjs +6 -6
  23. package/build/cjs/public/internal.cjs +7 -7
  24. package/build/cjs/public/observable.cjs +5 -5
  25. package/build/cjs/public/unstable-do-not-use.cjs +14 -17
  26. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  27. package/build/cjs/public/unstable-do-not-use.d.cts +5 -3
  28. package/build/esm/Client.js +1 -1
  29. package/build/esm/Client.js.map +1 -1
  30. package/build/esm/scenarios/ScenarioClient.js +5 -3
  31. package/build/esm/scenarios/ScenarioClient.js.map +1 -1
  32. package/build/esm/scenarios/createScenario.js +3 -5
  33. package/build/esm/scenarios/createScenario.js.map +1 -1
  34. package/build/esm/scenarios/withScenario.js +2 -1
  35. package/build/esm/scenarios/withScenario.js.map +1 -1
  36. package/build/esm/util/UserAgent.js +2 -2
  37. package/build/types/Client.d.ts +1 -1
  38. package/build/types/scenarios/createScenario.d.ts +3 -2
  39. package/build/types/scenarios/createScenario.d.ts.map +1 -1
  40. package/build/types/scenarios/withScenario.d.ts +2 -1
  41. package/build/types/scenarios/withScenario.d.ts.map +1 -1
  42. package/package.json +6 -6
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkA4LQCGPA_cjs = require('./chunk-A4LQCGPA.cjs');
3
+ var chunk53ODHT6J_cjs = require('./chunk-53ODHT6J.cjs');
4
4
  require('./chunk-YJG67XL4.cjs');
5
5
  require('./chunk-TQUNF2DZ.cjs');
6
6
  require('./chunk-CEBSLQQC.cjs');
7
7
  require('./chunk-PIWGMK3H.cjs');
8
- var chunkLWT7AZZD_cjs = require('./chunk-LWT7AZZD.cjs');
9
- var chunkZLUXOM2B_cjs = require('./chunk-ZLUXOM2B.cjs');
8
+ var chunkVD4QAB27_cjs = require('./chunk-VD4QAB27.cjs');
9
+ var chunkZSQBDK7L_cjs = require('./chunk-ZSQBDK7L.cjs');
10
10
  require('./chunk-ROJIXXGF.cjs');
11
11
  require('./chunk-H6PXPU6F.cjs');
12
12
  require('./chunk-Q7SFCCGT.cjs');
@@ -20,7 +20,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
20
20
  var invariant__default = /*#__PURE__*/_interopDefault(invariant);
21
21
 
22
22
  function createPlatformClient(baseUrl, tokenProvider, options = void 0, fetchFn = fetch) {
23
- return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, chunkA4LQCGPA_cjs.USER_AGENT, fetchFn);
23
+ return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, chunk53ODHT6J_cjs.USER_AGENT, fetchFn);
24
24
  }
25
25
  var isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
26
26
  var extractDate = (dateTime) => {
@@ -44,31 +44,31 @@ var extractDateFromIsoString = (dateTime) => {
44
44
 
45
45
  Object.defineProperty(exports, "ActionValidationError", {
46
46
  enumerable: true,
47
- get: function () { return chunkA4LQCGPA_cjs.ActionValidationError; }
47
+ get: function () { return chunk53ODHT6J_cjs.ActionValidationError; }
48
48
  });
49
49
  Object.defineProperty(exports, "createClient", {
50
50
  enumerable: true,
51
- get: function () { return chunkA4LQCGPA_cjs.createClient; }
51
+ get: function () { return chunk53ODHT6J_cjs.createClient; }
52
52
  });
53
53
  Object.defineProperty(exports, "createAttachmentUpload", {
54
54
  enumerable: true,
55
- get: function () { return chunkLWT7AZZD_cjs.createAttachmentUpload; }
55
+ get: function () { return chunkVD4QAB27_cjs.createAttachmentUpload; }
56
56
  });
57
57
  Object.defineProperty(exports, "createObjectSpecifierFromPrimaryKey", {
58
58
  enumerable: true,
59
- get: function () { return chunkLWT7AZZD_cjs.createObjectSpecifierFromPrimaryKey; }
59
+ get: function () { return chunkVD4QAB27_cjs.createObjectSpecifierFromPrimaryKey; }
60
60
  });
61
61
  Object.defineProperty(exports, "extractPrimaryKeyFromObjectSpecifier", {
62
62
  enumerable: true,
63
- get: function () { return chunkLWT7AZZD_cjs.extractPrimaryKeyFromObjectSpecifier; }
63
+ get: function () { return chunkVD4QAB27_cjs.extractPrimaryKeyFromObjectSpecifier; }
64
64
  });
65
65
  Object.defineProperty(exports, "getWireObjectSet", {
66
66
  enumerable: true,
67
- get: function () { return chunkZLUXOM2B_cjs.getWireObjectSet; }
67
+ get: function () { return chunkZSQBDK7L_cjs.getWireObjectSet; }
68
68
  });
69
69
  Object.defineProperty(exports, "isObjectSet", {
70
70
  enumerable: true,
71
- get: function () { return chunkZLUXOM2B_cjs.isObjectSet; }
71
+ get: function () { return chunkZSQBDK7L_cjs.isObjectSet; }
72
72
  });
73
73
  Object.defineProperty(exports, "isOk", {
74
74
  enumerable: true,
@@ -1,28 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var chunkA4LQCGPA_cjs = require('../chunk-A4LQCGPA.cjs');
3
+ var chunk53ODHT6J_cjs = require('../chunk-53ODHT6J.cjs');
4
4
  require('../chunk-YJG67XL4.cjs');
5
5
  require('../chunk-TQUNF2DZ.cjs');
6
6
  require('../chunk-CEBSLQQC.cjs');
7
7
  require('../chunk-PIWGMK3H.cjs');
8
- require('../chunk-LWT7AZZD.cjs');
9
- var chunkZLUXOM2B_cjs = require('../chunk-ZLUXOM2B.cjs');
8
+ require('../chunk-VD4QAB27.cjs');
9
+ var chunkZSQBDK7L_cjs = require('../chunk-ZSQBDK7L.cjs');
10
10
  require('../chunk-ROJIXXGF.cjs');
11
11
  require('../chunk-H6PXPU6F.cjs');
12
12
  require('../chunk-Q7SFCCGT.cjs');
13
13
 
14
14
  // src/createClientFromWriteableClient.ts
15
15
  function createClientFromWriteableClient(writeableClient, options) {
16
- const ctx = writeableClient[chunkZLUXOM2B_cjs.additionalContext];
16
+ const ctx = writeableClient[chunkZSQBDK7L_cjs.additionalContext];
17
17
  if (ctx.transactionId === void 0 || ctx.flushEdits === void 0) {
18
18
  throw new Error("createClientFromWriteableClient: provided client has no active transaction");
19
19
  }
20
- return chunkA4LQCGPA_cjs.createClientWithTransaction(options?.transactionId ?? ctx.transactionId, ctx.flushEdits, options?.baseUrl ?? ctx.baseUrl, options?.ontologyRid ?? ctx.ontologyRid, options?.tokenProvider ?? ctx.tokenProvider);
20
+ return chunk53ODHT6J_cjs.createClientWithTransaction(options?.transactionId ?? ctx.transactionId, ctx.flushEdits, options?.baseUrl ?? ctx.baseUrl, options?.ontologyRid ?? ctx.ontologyRid, options?.tokenProvider ?? ctx.tokenProvider);
21
21
  }
22
22
 
23
23
  Object.defineProperty(exports, "createClientWithTransaction", {
24
24
  enumerable: true,
25
- get: function () { return chunkA4LQCGPA_cjs.createClientWithTransaction; }
25
+ get: function () { return chunk53ODHT6J_cjs.createClientWithTransaction; }
26
26
  });
27
27
  exports.createClientFromWriteableClient = createClientFromWriteableClient;
28
28
  //# sourceMappingURL=experimental.cjs.map
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkTQUNF2DZ_cjs = require('../chunk-TQUNF2DZ.cjs');
4
- var chunkZLUXOM2B_cjs = require('../chunk-ZLUXOM2B.cjs');
4
+ var chunkZSQBDK7L_cjs = require('../chunk-ZSQBDK7L.cjs');
5
5
  require('../chunk-ROJIXXGF.cjs');
6
6
  require('../chunk-H6PXPU6F.cjs');
7
7
  require('../chunk-Q7SFCCGT.cjs');
8
8
 
9
9
  // src/public-utils/createAndFetchTempObjectSetRid.ts
10
10
  async function createAndFetchTempObjectSetRid(client, objectSet) {
11
- const response = await chunkZLUXOM2B_cjs.createTemporary(client, await client[chunkZLUXOM2B_cjs.additionalContext].ontologyRid, {
12
- objectSet: chunkZLUXOM2B_cjs.getWireObjectSet(objectSet)
11
+ const response = await chunkZSQBDK7L_cjs.createTemporary(client, await client[chunkZSQBDK7L_cjs.additionalContext].ontologyRid, {
12
+ objectSet: chunkZSQBDK7L_cjs.getWireObjectSet(objectSet)
13
13
  });
14
14
  return response.objectSetRid;
15
15
  }
16
16
 
17
17
  // src/public-utils/hydrateObjectSetFromObjectRids.ts
18
18
  function hydrateObjectSetFromObjectRids(client, definition, rids) {
19
- return chunkZLUXOM2B_cjs.createObjectSet(definition, client[chunkZLUXOM2B_cjs.additionalContext], {
19
+ return chunkZSQBDK7L_cjs.createObjectSet(definition, client[chunkZSQBDK7L_cjs.additionalContext], {
20
20
  type: "intersect",
21
21
  objectSets: [definition.type === "interface" ? {
22
22
  type: "interfaceBase",
@@ -36,7 +36,7 @@ function asMutableArray(array) {
36
36
 
37
37
  // src/public-utils/hydrateObjectSetFromRid.ts
38
38
  function hydrateObjectSetFromRid(client, definition, rid) {
39
- return chunkZLUXOM2B_cjs.createObjectSet(definition, client[chunkZLUXOM2B_cjs.additionalContext], {
39
+ return chunkZSQBDK7L_cjs.createObjectSet(definition, client[chunkZSQBDK7L_cjs.additionalContext], {
40
40
  type: "intersect",
41
41
  objectSets: [definition.type === "interface" ? {
42
42
  type: "interfaceBase",
@@ -107,11 +107,11 @@ Object.defineProperty(exports, "MinimalLogger", {
107
107
  });
108
108
  Object.defineProperty(exports, "createMediaFromReference", {
109
109
  enumerable: true,
110
- get: function () { return chunkZLUXOM2B_cjs.createMediaFromReference; }
110
+ get: function () { return chunkZSQBDK7L_cjs.createMediaFromReference; }
111
111
  });
112
112
  Object.defineProperty(exports, "hydrateAttachmentFromRid", {
113
113
  enumerable: true,
114
- get: function () { return chunkZLUXOM2B_cjs.hydrateAttachmentFromRid; }
114
+ get: function () { return chunkZSQBDK7L_cjs.hydrateAttachmentFromRid; }
115
115
  });
116
116
  exports.BrowserLogger = BrowserLogger;
117
117
  exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkCWBZEZQC_cjs = require('../chunk-CWBZEZQC.cjs');
4
- require('../chunk-A4LQCGPA.cjs');
3
+ var chunkQUF62D2S_cjs = require('../chunk-QUF62D2S.cjs');
4
+ require('../chunk-53ODHT6J.cjs');
5
5
  require('../chunk-YJG67XL4.cjs');
6
6
  require('../chunk-TQUNF2DZ.cjs');
7
7
  require('../chunk-CEBSLQQC.cjs');
8
8
  require('../chunk-PIWGMK3H.cjs');
9
- require('../chunk-LWT7AZZD.cjs');
10
- require('../chunk-ZLUXOM2B.cjs');
9
+ require('../chunk-VD4QAB27.cjs');
10
+ require('../chunk-ZSQBDK7L.cjs');
11
11
  require('../chunk-ROJIXXGF.cjs');
12
12
  require('../chunk-H6PXPU6F.cjs');
13
13
  require('../chunk-Q7SFCCGT.cjs');
@@ -16,7 +16,7 @@ require('../chunk-Q7SFCCGT.cjs');
16
16
 
17
17
  Object.defineProperty(exports, "createObservableClient", {
18
18
  enumerable: true,
19
- get: function () { return chunkCWBZEZQC_cjs.createObservableClient; }
19
+ get: function () { return chunkQUF62D2S_cjs.createObservableClient; }
20
20
  });
21
21
  //# sourceMappingURL=observable.cjs.map
22
22
  //# sourceMappingURL=observable.cjs.map
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkCWBZEZQC_cjs = require('../chunk-CWBZEZQC.cjs');
4
- var chunkA4LQCGPA_cjs = require('../chunk-A4LQCGPA.cjs');
3
+ var chunkQUF62D2S_cjs = require('../chunk-QUF62D2S.cjs');
4
+ var chunk53ODHT6J_cjs = require('../chunk-53ODHT6J.cjs');
5
5
  require('../chunk-YJG67XL4.cjs');
6
6
  require('../chunk-TQUNF2DZ.cjs');
7
7
  require('../chunk-CEBSLQQC.cjs');
8
8
  require('../chunk-PIWGMK3H.cjs');
9
- require('../chunk-LWT7AZZD.cjs');
10
- var chunkZLUXOM2B_cjs = require('../chunk-ZLUXOM2B.cjs');
9
+ require('../chunk-VD4QAB27.cjs');
10
+ var chunkZSQBDK7L_cjs = require('../chunk-ZSQBDK7L.cjs');
11
11
  require('../chunk-ROJIXXGF.cjs');
12
12
  require('../chunk-H6PXPU6F.cjs');
13
13
  require('../chunk-Q7SFCCGT.cjs');
@@ -49,14 +49,11 @@ function getOsdkConfig(ontologyRid) {
49
49
 
50
50
  // src/scenarios/createScenario.ts
51
51
  async function createScenario(client) {
52
- const ctx = client[chunkZLUXOM2B_cjs.additionalContext];
53
- if (ctx.transactionId != null) {
54
- throw new Error("createScenario: the supplied client already has an active transaction. Scenarios cannot be nested on transactions.");
55
- }
52
+ const ctx = client[chunkZSQBDK7L_cjs.additionalContext];
56
53
  if (ctx.scenarioRid != null) {
57
54
  throw new Error("createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.");
58
55
  }
59
- const response = await chunkA4LQCGPA_cjs.OntologyScenario_exports.createScenario(ctx, await ctx.ontologyRid, ctx.branch != null ? {
56
+ const response = await chunk53ODHT6J_cjs.OntologyScenario_exports.createScenario(ctx, await ctx.ontologyRid, ctx.branch != null ? {
60
57
  base: {
61
58
  type: "branch",
62
59
  branch: ctx.branch
@@ -64,12 +61,12 @@ async function createScenario(client) {
64
61
  } : {}, {
65
62
  preview: true
66
63
  });
67
- return chunkA4LQCGPA_cjs.buildScenarioClient(client, response.scenarioRid);
64
+ return chunk53ODHT6J_cjs.buildScenarioClient(client, response.scenarioRid);
68
65
  }
69
66
 
70
67
  // src/scenarios/withScenario.ts
71
68
  function withScenario(client, scenarioRid) {
72
- return chunkA4LQCGPA_cjs.buildScenarioClient(client, scenarioRid);
69
+ return chunk53ODHT6J_cjs.buildScenarioClient(client, scenarioRid);
73
70
  }
74
71
 
75
72
  // src/shapes/applyShapeTransformations.ts
@@ -195,7 +192,7 @@ function getLinkQueryOptions(linkDef, sourceObject, pageSize) {
195
192
  return options;
196
193
  }
197
194
  async function buildObjectSetFromLinkDefByType(client, sourceType, sourcePrimaryKey, linkDef) {
198
- const metadata = await client[chunkZLUXOM2B_cjs.additionalContext].ontologyProvider.getObjectDefinition(sourceType.apiName);
195
+ const metadata = await client[chunkZSQBDK7L_cjs.additionalContext].ontologyProvider.getObjectDefinition(sourceType.apiName);
199
196
  const pkFieldName = metadata.primaryKeyApiName;
200
197
  let objectSet = client(sourceType).where({
201
198
  [pkFieldName]: sourcePrimaryKey
@@ -254,23 +251,23 @@ function resolveSymbolBindings(value, sourcePrimaryKey) {
254
251
 
255
252
  Object.defineProperty(exports, "createObservableClient", {
256
253
  enumerable: true,
257
- get: function () { return chunkCWBZEZQC_cjs.createObservableClient; }
254
+ get: function () { return chunkQUF62D2S_cjs.createObservableClient; }
258
255
  });
259
256
  Object.defineProperty(exports, "createClientWithTransaction", {
260
257
  enumerable: true,
261
- get: function () { return chunkA4LQCGPA_cjs.createClientWithTransaction; }
258
+ get: function () { return chunk53ODHT6J_cjs.createClientWithTransaction; }
262
259
  });
263
260
  Object.defineProperty(exports, "augment", {
264
261
  enumerable: true,
265
- get: function () { return chunkZLUXOM2B_cjs.augment; }
262
+ get: function () { return chunkZSQBDK7L_cjs.augment; }
266
263
  });
267
264
  Object.defineProperty(exports, "getWireObjectSet", {
268
265
  enumerable: true,
269
- get: function () { return chunkZLUXOM2B_cjs.getWireObjectSet; }
266
+ get: function () { return chunkZSQBDK7L_cjs.getWireObjectSet; }
270
267
  });
271
268
  Object.defineProperty(exports, "isObjectSet", {
272
269
  enumerable: true,
273
- get: function () { return chunkZLUXOM2B_cjs.isObjectSet; }
270
+ get: function () { return chunkZSQBDK7L_cjs.isObjectSet; }
274
271
  });
275
272
  exports.applyShapeTransformations = applyShapeTransformations;
276
273
  exports.applyShapeTransformationsToArray = applyShapeTransformationsToArray;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/public-utils/osdkConfig.ts","../../../src/scenarios/createScenario.ts","../../../src/scenarios/withScenario.ts","../../../src/shapes/applyShapeTransformations.ts","../../../src/shapes/buildObjectSetFromLinkDef.ts"],"names":["additionalContext","OntologyScenario_exports","buildScenarioClient","isSourcePkSymbol"],"mappings":";;;;;;;;;;;;;;;;AAgBO,SAAS,kBAAkB,IAAA,EAAM;AACtC,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,aAAA,CAAc,CAAA,WAAA,EAAc,IAAI,CAAA,EAAA,CAAI,CAAA;AAC7D,EAAA,MAAM,GAAA,GAAM,OAAA,GAAU,OAAA,CAAQ,YAAA,CAAa,SAAS,CAAA,GAAI,IAAA;AACxD,EAAA,IAAI,OAAO,IAAA,EAAM;AACf,IAAA,MAAM,IAAI,KAAA,CAA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A,EAAM,gBAAgB,CAAC,CAAA;AAAA,EACxE;AACA,EAAA,IAAI,KAAA,IAAS,IAAA,IAAQ,OAAO,KAAA,KAAU,QAAA,EAAU;AAC9C,IAAA,MAAM,SAAS,EAAC;AAChB,IAAA,KAAA,MAAW,CAAC,GAAA,EAAK,GAAG,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC9C,MAAA,MAAA,CAAO,GAAG,CAAA,GAAI,qBAAA,CAAsB,GAAA,EAAK,gBAAgB,CAAA;AAAA,IAC3D;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA;AACT","file":"unstable-do-not-use.cjs","sourcesContent":["/*\n * Copyright 2025 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 function getMetaTagContent(name) {\n const element = document.querySelector(`meta[name=\"${name}\"]`);\n const val = element ? element.getAttribute(\"content\") : null;\n if (val == null) {\n throw new Error(`Missing meta tag: ${name}`);\n }\n return val;\n}\nfunction getViteEnvVar(name) {\n const val = import.meta.env[name];\n if (val == null) {\n throw new Error(`Missing environment variable: ${name}`);\n }\n return val;\n}\nfunction isProduction() {\n return process.env.NODE_ENV === \"production\";\n}\nfunction getConfigValue(metaTagName, viteEnvVarName) {\n return isProduction() ? getMetaTagContent(metaTagName) : getViteEnvVar(viteEnvVarName);\n}\nfunction getOntologyRid(ontologyRid) {\n return isProduction() ? getMetaTagContent(\"osdk-ontologyRid\") : ontologyRid;\n}\nexport function getOsdkConfig(ontologyRid) {\n return {\n clientId: getConfigValue(\"osdk-clientId\", \"VITE_FOUNDRY_CLIENT_ID\"),\n redirectUrl: getConfigValue(\"osdk-redirectUrl\", \"VITE_FOUNDRY_REDIRECT_URL\"),\n foundryUrl: getConfigValue(\"osdk-foundryUrl\", \"VITE_FOUNDRY_API_URL\"),\n ontologyRid: getOntologyRid(ontologyRid)\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyScenarios } from \"@osdk/foundry.ontologies\";\nimport { additionalContext } from \"../Client.js\";\nimport { buildScenarioClient } 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 or transaction. When the base client has a\n * branch set, the newly minted scenario uses that branch as its base.\n * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { createScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const scenario = await createScenario(client);\n * const scenarioRid = scenario.getScenarioReference();\n * ```\n */\nexport async function createScenario(client) {\n const ctx = client[additionalContext];\n if (ctx.transactionId != null) {\n throw new Error(\"createScenario: the supplied client already has an active transaction. Scenarios cannot be nested on transactions.\");\n }\n if (ctx.scenarioRid != null) {\n throw new Error(\"createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.\");\n }\n const response = await OntologyScenarios.createScenario(ctx, await ctx.ontologyRid, ctx.branch != null ? {\n base: {\n type: \"branch\",\n branch: ctx.branch\n }\n } : {}, {\n preview: true\n });\n return buildScenarioClient(client, response.scenarioRid);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { buildScenarioClient } 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 or transaction.\n * @param scenarioRid - The RID of the scenario to attach to.\n * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to `scenarioRid`.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { withScenario } from \"@osdk/client/unstable-do-not-use\";\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(client, scenarioRid) {\n return buildScenarioClient(client, scenarioRid);\n}","/*\n * Copyright 2025 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 function applyShapeTransformations(shape, rawObject) {\n if (rawObject === undefined) {\n return {\n data: undefined,\n dropped: false,\n violations: []\n };\n }\n const primaryKey = rawObject.$primaryKey;\n const transformedProps = {};\n const requireProps = [];\n\n // Phase 1-3: filter (dropIfNull), apply defaults and transforms\n // Collect require props to check after cloning\n for (const prop of Object.keys(shape.__props)) {\n const config = shape.__props[prop];\n if (!config) {\n continue;\n }\n const originalValue = rawObject[prop];\n const op = config.nullabilityOp;\n switch (op.type) {\n case \"dropIfNull\":\n {\n if (originalValue == null) {\n return {\n data: undefined,\n dropped: true,\n violations: [{\n property: prop,\n primaryKey,\n constraint: \"dropIfNull\"\n }]\n };\n }\n break;\n }\n case \"withDefault\":\n {\n transformedProps[prop] = originalValue ?? op.defaultValue;\n break;\n }\n case \"withTransform\":\n {\n try {\n transformedProps[prop] = op.transform(originalValue);\n } catch (e) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.error(`Shape transform error for property \"${prop}\":`, e);\n }\n return {\n data: undefined,\n dropped: false,\n violations: [{\n property: prop,\n primaryKey,\n constraint: \"transformError\"\n }]\n };\n }\n break;\n }\n case \"require\":\n {\n // Collect for phase 4 - check after clone with transforms applied\n requireProps.push(prop);\n break;\n }\n case \"select\":\n break;\n default:\n {\n const _exhaustive = op;\n }\n }\n }\n\n // Clone the object with transformed properties if any were modified\n const clonedObject = Object.keys(transformedProps).length > 0 ? rawObject.$clone(transformedProps) : rawObject;\n\n // Phase 4: check require constraints on the transformed object.\n // This allows withDefault + require to work together correctly.\n const violations = [];\n for (const prop of requireProps) {\n const value = clonedObject[prop];\n if (value == null) {\n violations.push({\n property: prop,\n primaryKey,\n constraint: \"require\"\n });\n }\n }\n if (violations.length > 0) {\n return {\n data: undefined,\n dropped: false,\n violations\n };\n }\n return {\n data: clonedObject,\n dropped: false,\n violations: []\n };\n}\nexport function applyShapeTransformationsToArray(shape, rawObjects) {\n const results = [];\n let droppedCount = 0;\n const allViolations = [];\n for (const rawObject of rawObjects) {\n const result = applyShapeTransformations(shape, rawObject);\n if (result.dropped) {\n droppedCount++;\n } else if (result.data !== undefined) {\n results.push(result.data);\n }\n allViolations.push(...result.violations);\n }\n return {\n data: results,\n droppedCount,\n violations: allViolations\n };\n}","/*\n * Copyright 2025 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 { isSourcePkSymbol } from \"@osdk/api/unstable\";\nimport { additionalContext } from \"../Client.js\";\n\n/**\n * Extracts query options from a link definition for use with observeObjectSet.\n * Uses common infrastructure for symbol resolution and orderBy conversion.\n */\n\nexport function getLinkQueryOptions(linkDef, sourceObject, pageSize) {\n const options = {};\n if (linkDef.where) {\n options.where = resolveSymbolBindings(linkDef.where, sourceObject.$primaryKey);\n }\n if (linkDef.orderBy && linkDef.orderBy.length > 0) {\n options.orderBy = orderByToMap(linkDef.orderBy);\n }\n\n // Apply limit as page size (if specified)\n if (linkDef.limit !== undefined) {\n options.pageSize = linkDef.limit;\n } else if (pageSize !== undefined) {\n options.pageSize = pageSize;\n }\n return options;\n}\n\n/**\n * Builds an ObjectSet from a link definition using the source type definition.\n * Delegates to buildObjectSetFromDef for consistent behavior.\n *\n * @param client - The OSDK client\n * @param sourceType - The source type definition\n * @param sourcePrimaryKey - The primary key of the source object\n * @param linkDef - The link definition to execute\n * @returns A Promise resolving to an ObjectSet that can be used with observeObjectSet\n */\nexport async function buildObjectSetFromLinkDefByType(client, sourceType, sourcePrimaryKey, linkDef) {\n const metadata = await client[additionalContext].ontologyProvider.getObjectDefinition(sourceType.apiName);\n const pkFieldName = metadata.primaryKeyApiName;\n let objectSet = client(sourceType).where({\n [pkFieldName]: sourcePrimaryKey\n });\n for (const segment of linkDef.segments) {\n if (segment.type === \"pivotTo\") {\n objectSet = objectSet.pivotTo(segment.linkName);\n }\n }\n if (linkDef.setOperations && linkDef.setOperations.length > 0) {\n const otherObjectSets = await Promise.all(linkDef.setOperations.map(setOp => buildObjectSetFromLinkDefByType(client, sourceType, sourcePrimaryKey, setOp.other)));\n for (let i = 0; i < linkDef.setOperations.length; i++) {\n const setOp = linkDef.setOperations[i];\n const otherObjectSet = otherObjectSets[i];\n switch (setOp.type) {\n case \"union\":\n objectSet = objectSet.union(otherObjectSet);\n break;\n case \"intersect\":\n objectSet = objectSet.intersect(otherObjectSet);\n break;\n case \"subtract\":\n objectSet = objectSet.subtract(otherObjectSet);\n break;\n default:\n {\n const _exhaustive = setOp.type;\n }\n }\n }\n }\n return objectSet;\n}\nfunction orderByToMap(orderBy) {\n const result = {};\n for (const entry of orderBy) {\n result[entry.property] = entry.direction;\n }\n return result;\n}\nfunction resolveSymbolBindings(value, sourcePrimaryKey) {\n if (isSourcePkSymbol(value)) {\n return sourcePrimaryKey;\n }\n if (Array.isArray(value)) {\n return value.map(item => resolveSymbolBindings(item, sourcePrimaryKey));\n }\n if (value != null && typeof value === \"object\") {\n const result = {};\n for (const [key, val] of Object.entries(value)) {\n result[key] = resolveSymbolBindings(val, sourcePrimaryKey);\n }\n return result;\n }\n return value;\n}"]}
1
+ {"version":3,"sources":["../../../src/public-utils/osdkConfig.ts","../../../src/scenarios/createScenario.ts","../../../src/scenarios/withScenario.ts","../../../src/shapes/applyShapeTransformations.ts","../../../src/shapes/buildObjectSetFromLinkDef.ts"],"names":["additionalContext","OntologyScenario_exports","buildScenarioClient","isSourcePkSymbol"],"mappings":";;;;;;;;;;;;;;;;AAgBO,SAAS,kBAAkB,IAAA,EAAM;AACtC,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,aAAA,CAAc,CAAA,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Q,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,MAAM,GAAA,CAAI,CAAA,IAAA,KAAQ,qBAAA,CAAsB,IAAA,EAAM,gBAAgB,CAAC,CAAA;AAAA,EACxE;AACA,EAAA,IAAI,KAAA,IAAS,IAAA,IAAQ,OAAO,KAAA,KAAU,QAAA,EAAU;AAC9C,IAAA,MAAM,SAAS,EAAC;AAChB,IAAA,KAAA,MAAW,CAAC,GAAA,EAAK,GAAG,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC9C,MAAA,MAAA,CAAO,GAAG,CAAA,GAAI,qBAAA,CAAsB,GAAA,EAAK,gBAAgB,CAAA;AAAA,IAC3D;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA;AACT","file":"unstable-do-not-use.cjs","sourcesContent":["/*\n * Copyright 2025 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 function getMetaTagContent(name) {\n const element = document.querySelector(`meta[name=\"${name}\"]`);\n const val = element ? element.getAttribute(\"content\") : null;\n if (val == null) {\n throw new Error(`Missing meta tag: ${name}`);\n }\n return val;\n}\nfunction getViteEnvVar(name) {\n const val = import.meta.env[name];\n if (val == null) {\n throw new Error(`Missing environment variable: ${name}`);\n }\n return val;\n}\nfunction isProduction() {\n return process.env.NODE_ENV === \"production\";\n}\nfunction getConfigValue(metaTagName, viteEnvVarName) {\n return isProduction() ? getMetaTagContent(metaTagName) : getViteEnvVar(viteEnvVarName);\n}\nfunction getOntologyRid(ontologyRid) {\n return isProduction() ? getMetaTagContent(\"osdk-ontologyRid\") : ontologyRid;\n}\nexport function getOsdkConfig(ontologyRid) {\n return {\n clientId: getConfigValue(\"osdk-clientId\", \"VITE_FOUNDRY_CLIENT_ID\"),\n redirectUrl: getConfigValue(\"osdk-redirectUrl\", \"VITE_FOUNDRY_REDIRECT_URL\"),\n foundryUrl: getConfigValue(\"osdk-foundryUrl\", \"VITE_FOUNDRY_API_URL\"),\n ontologyRid: getOntologyRid(ontologyRid)\n };\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyScenarios } from \"@osdk/foundry.ontologies\";\nimport { additionalContext } from \"../Client.js\";\nimport { buildScenarioClient } 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 * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { createScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const scenario = await createScenario(client);\n * const scenarioRid = scenario.getScenarioReference();\n * ```\n */\nexport async function createScenario(client) {\n const ctx = client[additionalContext];\n if (ctx.scenarioRid != null) {\n throw new Error(\"createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.\");\n }\n const response = await OntologyScenarios.createScenario(ctx, await ctx.ontologyRid, ctx.branch != null ? {\n base: {\n type: \"branch\",\n branch: ctx.branch\n }\n } : {}, {\n preview: true\n });\n return buildScenarioClient(client, response.scenarioRid);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { buildScenarioClient } 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 EXPERIMENTAL_ScenarioClient} bound to `scenarioRid`.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { withScenario } from \"@osdk/client/unstable-do-not-use\";\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(client, scenarioRid) {\n return buildScenarioClient(client, scenarioRid);\n}","/*\n * Copyright 2025 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 function applyShapeTransformations(shape, rawObject) {\n if (rawObject === undefined) {\n return {\n data: undefined,\n dropped: false,\n violations: []\n };\n }\n const primaryKey = rawObject.$primaryKey;\n const transformedProps = {};\n const requireProps = [];\n\n // Phase 1-3: filter (dropIfNull), apply defaults and transforms\n // Collect require props to check after cloning\n for (const prop of Object.keys(shape.__props)) {\n const config = shape.__props[prop];\n if (!config) {\n continue;\n }\n const originalValue = rawObject[prop];\n const op = config.nullabilityOp;\n switch (op.type) {\n case \"dropIfNull\":\n {\n if (originalValue == null) {\n return {\n data: undefined,\n dropped: true,\n violations: [{\n property: prop,\n primaryKey,\n constraint: \"dropIfNull\"\n }]\n };\n }\n break;\n }\n case \"withDefault\":\n {\n transformedProps[prop] = originalValue ?? op.defaultValue;\n break;\n }\n case \"withTransform\":\n {\n try {\n transformedProps[prop] = op.transform(originalValue);\n } catch (e) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.error(`Shape transform error for property \"${prop}\":`, e);\n }\n return {\n data: undefined,\n dropped: false,\n violations: [{\n property: prop,\n primaryKey,\n constraint: \"transformError\"\n }]\n };\n }\n break;\n }\n case \"require\":\n {\n // Collect for phase 4 - check after clone with transforms applied\n requireProps.push(prop);\n break;\n }\n case \"select\":\n break;\n default:\n {\n const _exhaustive = op;\n }\n }\n }\n\n // Clone the object with transformed properties if any were modified\n const clonedObject = Object.keys(transformedProps).length > 0 ? rawObject.$clone(transformedProps) : rawObject;\n\n // Phase 4: check require constraints on the transformed object.\n // This allows withDefault + require to work together correctly.\n const violations = [];\n for (const prop of requireProps) {\n const value = clonedObject[prop];\n if (value == null) {\n violations.push({\n property: prop,\n primaryKey,\n constraint: \"require\"\n });\n }\n }\n if (violations.length > 0) {\n return {\n data: undefined,\n dropped: false,\n violations\n };\n }\n return {\n data: clonedObject,\n dropped: false,\n violations: []\n };\n}\nexport function applyShapeTransformationsToArray(shape, rawObjects) {\n const results = [];\n let droppedCount = 0;\n const allViolations = [];\n for (const rawObject of rawObjects) {\n const result = applyShapeTransformations(shape, rawObject);\n if (result.dropped) {\n droppedCount++;\n } else if (result.data !== undefined) {\n results.push(result.data);\n }\n allViolations.push(...result.violations);\n }\n return {\n data: results,\n droppedCount,\n violations: allViolations\n };\n}","/*\n * Copyright 2025 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 { isSourcePkSymbol } from \"@osdk/api/unstable\";\nimport { additionalContext } from \"../Client.js\";\n\n/**\n * Extracts query options from a link definition for use with observeObjectSet.\n * Uses common infrastructure for symbol resolution and orderBy conversion.\n */\n\nexport function getLinkQueryOptions(linkDef, sourceObject, pageSize) {\n const options = {};\n if (linkDef.where) {\n options.where = resolveSymbolBindings(linkDef.where, sourceObject.$primaryKey);\n }\n if (linkDef.orderBy && linkDef.orderBy.length > 0) {\n options.orderBy = orderByToMap(linkDef.orderBy);\n }\n\n // Apply limit as page size (if specified)\n if (linkDef.limit !== undefined) {\n options.pageSize = linkDef.limit;\n } else if (pageSize !== undefined) {\n options.pageSize = pageSize;\n }\n return options;\n}\n\n/**\n * Builds an ObjectSet from a link definition using the source type definition.\n * Delegates to buildObjectSetFromDef for consistent behavior.\n *\n * @param client - The OSDK client\n * @param sourceType - The source type definition\n * @param sourcePrimaryKey - The primary key of the source object\n * @param linkDef - The link definition to execute\n * @returns A Promise resolving to an ObjectSet that can be used with observeObjectSet\n */\nexport async function buildObjectSetFromLinkDefByType(client, sourceType, sourcePrimaryKey, linkDef) {\n const metadata = await client[additionalContext].ontologyProvider.getObjectDefinition(sourceType.apiName);\n const pkFieldName = metadata.primaryKeyApiName;\n let objectSet = client(sourceType).where({\n [pkFieldName]: sourcePrimaryKey\n });\n for (const segment of linkDef.segments) {\n if (segment.type === \"pivotTo\") {\n objectSet = objectSet.pivotTo(segment.linkName);\n }\n }\n if (linkDef.setOperations && linkDef.setOperations.length > 0) {\n const otherObjectSets = await Promise.all(linkDef.setOperations.map(setOp => buildObjectSetFromLinkDefByType(client, sourceType, sourcePrimaryKey, setOp.other)));\n for (let i = 0; i < linkDef.setOperations.length; i++) {\n const setOp = linkDef.setOperations[i];\n const otherObjectSet = otherObjectSets[i];\n switch (setOp.type) {\n case \"union\":\n objectSet = objectSet.union(otherObjectSet);\n break;\n case \"intersect\":\n objectSet = objectSet.intersect(otherObjectSet);\n break;\n case \"subtract\":\n objectSet = objectSet.subtract(otherObjectSet);\n break;\n default:\n {\n const _exhaustive = setOp.type;\n }\n }\n }\n }\n return objectSet;\n}\nfunction orderByToMap(orderBy) {\n const result = {};\n for (const entry of orderBy) {\n result[entry.property] = entry.direction;\n }\n return result;\n}\nfunction resolveSymbolBindings(value, sourcePrimaryKey) {\n if (isSourcePkSymbol(value)) {\n return sourcePrimaryKey;\n }\n if (Array.isArray(value)) {\n return value.map(item => resolveSymbolBindings(item, sourcePrimaryKey));\n }\n if (value != null && typeof value === \"object\") {\n const result = {};\n for (const [key, val] of Object.entries(value)) {\n result[key] = resolveSymbolBindings(val, sourcePrimaryKey);\n }\n return result;\n }\n return value;\n}"]}
@@ -143,8 +143,9 @@ interface EXPERIMENTAL_ScenarioClient extends Client {
143
143
  * Mint a fresh ontology scenario and return a client scoped to it.
144
144
  *
145
145
  * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)
146
- * from. Throws at runtime if the client is already scoped to a scenario or transaction. When the base client has a
147
- * branch set, the newly minted scenario uses that branch as its base.
146
+ * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,
147
+ * the transaction is ignored (a warning is logged) and the client is scoped to the new scenario. When the base
148
+ * client has a branch set, the newly minted scenario uses that branch as its base.
148
149
  * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.
149
150
  *
150
151
  * @beta This is an experimental, unstable feature subject to change.
@@ -164,7 +165,8 @@ declare function createScenario(client: Client): Promise<EXPERIMENTAL_ScenarioCl
164
165
  * subsequent operations (`fetchPage`, `applyAction`, `executeFunction`, etc.) to the given `scenarioRid`.
165
166
  *
166
167
  * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)
167
- * from. Throws at runtime if the client is already scoped to a scenario or transaction.
168
+ * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,
169
+ * the transaction is ignored (a warning is logged) and the client is scoped to the scenario.
168
170
  * @param scenarioRid - The RID of the scenario to attach to.
169
171
  * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to `scenarioRid`.
170
172
  *
@@ -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.35.0";
24
+ const MaxOsdkVersion = "2.36.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 Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.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> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\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\"] ? 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\"] ? 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>>(\n o: Q,\n ): 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>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const ref = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference)\n * .createMediaReference({ data: blob, fileName: \"media.mp4\", objectType: Employee, propertyType: \"photo\" });\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.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): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? 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.35.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;;AA0BA;;AA8HA;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":[]}
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 Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.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> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\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\"] ? 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\"] ? 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>>(\n o: Q,\n ): 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>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const ref = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference)\n * .createMediaReference({ data: blob, fileName: \"media.mp4\", objectType: Employee, propertyType: \"photo\" });\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.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): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? 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.36.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;;AA0BA;;AA8HA;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":[]}
@@ -53,8 +53,9 @@ export function isScenarioClient(value) {
53
53
  }
54
54
 
55
55
  /**
56
- * Shared internal builder used by both {@link withScenario} and {@link createScenario}. Validates the parent client
57
- * is not already inside a scenario or transaction, then constructs a fresh {@link Client} via
56
+ * Shared internal builder used by both {@link withScenario} and {@link createScenario}. Throws if the parent client
57
+ * is already inside a scenario. If the parent client has an active transaction, the transaction is ignored (a warning
58
+ * is logged) and the client is scoped to the scenario instead. Constructs a fresh {@link Client} via
58
59
  * `createClientWithScenario` and decorates it with {@link EXPERIMENTAL_ScenarioClient}-only methods.
59
60
  *
60
61
  * @internal
@@ -62,7 +63,8 @@ export function isScenarioClient(value) {
62
63
  export function buildScenarioClient(parent, scenarioRid) {
63
64
  const ctx = parent[additionalContext];
64
65
  if (ctx.transactionId != null) {
65
- throw new Error("withScenario / createScenario: the supplied client already has an active transaction. Scenarios cannot be nested on transactions.");
66
+ // eslint-disable-next-line no-console
67
+ console.warn("withScenario / createScenario: the supplied client has an active transaction. Ignoring the transaction and scoping to the scenario instead.");
66
68
  }
67
69
  if (ctx.scenarioRid != null) {
68
70
  throw new Error("withScenario / createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.");
@@ -1 +1 @@
1
- {"version":3,"file":"ScenarioClient.js","names":["OntologyScenarios","additionalContext","createClientWithScenario","isScenarioClient","value","getScenarioReference","buildScenarioClient","parent","scenarioRid","ctx","transactionId","Error","inner","baseUrl","ontologyRid","tokenProvider","logger","UNSTABLE_DO_NOT_USE_BRANCH","branch","fetch","innerCtx","getEditedEntities","objectType","options","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","Object","defineProperties","getEditedEntityTypes","listScenarioEditedEntityTypes","objectTypes","linkTypes","editedEntitiesAsyncIter","seen","Set","page","obj","key","has","add","getEditedLinkTypes","listScenarioEditedLinkTypes","editedLinksAsyncIter","link"],"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\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientWithScenario } from \"../createClient.js\";\nimport type { 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 {@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 * 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\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}. Validates the parent client\n * is not already inside a scenario or transaction, then constructs a fresh {@link Client} via\n * `createClientWithScenario` 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 throw new Error(\n \"withScenario / createScenario: the supplied client already has an active transaction. Scenarios cannot be nested on transactions.\",\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 = createClientWithScenario(\n scenarioRid,\n ctx.baseUrl,\n ctx.ontologyRid,\n ctx.tokenProvider,\n {\n logger: ctx.logger,\n UNSTABLE_DO_NOT_USE_BRANCH: ctx.branch,\n },\n ctx.fetch,\n );\n\n const innerCtx: MinimalClient = inner[additionalContext];\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 return Object.defineProperties(inner, {\n getScenarioReference: {\n value: () => scenarioRid,\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 }) 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;AAC5D,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,wBAAwB,QAAQ,oBAAoB;;AAG7D;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAkGA,OAAO,SAASC,gBAAgBA,CAC9BC,KAAc,EACwB;EACtC,OACEA,KAAK,IAAI,IAAI,KACT,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,UAAU,CAAC,IAC1D,OAAQA,KAAK,CACXC,oBAAoB,KAAK,UAAU;AAE5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,MAAc,EACdC,WAAmB,EACU;EAC7B,MAAMC,GAAkB,GAAGF,MAAM,CAACN,iBAAiB,CAAC;EAEpD,IAAIQ,GAAG,CAACC,aAAa,IAAI,IAAI,EAAE;IAC7B,MAAM,IAAIC,KAAK,CACb,mIACF,CAAC;EACH;EACA,IAAIF,GAAG,CAACD,WAAW,IAAI,I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OAAO,EACxB;UAAEG,OAAO,EAAE;QAAK,CAClB,CAAC;QACD,OAAOL,QAAQ,CAACM,IAAI;MACtB;IAmGE,CAAC;IACDS,cAAc,EAAE;MACdnC,KAAK,EAAEmC;IACT,CAAC;IACD6B,oBAAoB,EAAE;MACpBhE,KAAK,EA3CT,gBAAAA,CAIEoC,gBAAmB,EACnBC,QAA4B,EAC5BlB,OAA+B,EAG/B;QACA,IAAIK,SAA6B;QACjC,GAAG;UACD,MAAMiC,IAAI,GAAG,MAAMtB,cAAc,CAACC,gBAAgB,EAAEC,QAAQ,EAAE;YAC5Dd,QAAQ,EAAEJ,OAAO,EAAEI,QAAQ;YAC3BC;UACF,CAAC,CAAC;UACF,KAAK,MAAMyC,IAAI,IAAIR,IAAI,CAAC/B,IAAI,EAAE;YAC5B,MAAMuC,IAAI;UACZ;UACAzC,SAAS,GAAGiC,IAAI,CAACvB,aAAa;QAChC,CAAC,QAAQV,SAAS,IAAI,IAAI;MAC5B;IAuBE;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"ScenarioClient.js","names":["OntologyScenarios","additionalContext","createClientWithScenario","isScenarioClient","value","getScenarioReference","buildScenarioClient","parent","scenarioRid","ctx","transactionId","console","warn","Error","inner","baseUrl","ontologyRid","tokenProvider","logger","UNSTABLE_DO_NOT_USE_BRANCH","branch","fetch","innerCtx","getEditedEntities","objectType","options","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","Object","defineProperties","getEditedEntityTypes","listScenarioEditedEntityTypes","objectTypes","linkTypes","editedEntitiesAsyncIter","seen","Set","page","obj","key","has","add","getEditedLinkTypes","listScenarioEditedLinkTypes","editedLinksAsyncIter","link"],"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\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport { createClientWithScenario } from \"../createClient.js\";\nimport type { 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 {@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 * 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\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. Constructs a fresh {@link Client} via\n * `createClientWithScenario` 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 = createClientWithScenario(\n scenarioRid,\n ctx.baseUrl,\n ctx.ontologyRid,\n ctx.tokenProvider,\n {\n logger: ctx.logger,\n UNSTABLE_DO_NOT_USE_BRANCH: ctx.branch,\n },\n ctx.fetch,\n );\n\n const innerCtx: MinimalClient = inner[additionalContext];\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 return Object.defineProperties(inner, {\n getScenarioReference: {\n value: () => scenarioRid,\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 }) 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;AAC5D,SAASC,iBAAiB,QAAqB,cAAc;AAC7D,SAASC,wBAAwB,QAAQ,oBAAoB;;AAG7D;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;;AAkGA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GD,GAAG,CAAC1B,WAAW;YAC3B,IAAIuB,IAAI,CAACK,GAAG,CAACD,GAAG,CAAC,EAAE;YACnBJ,IAAI,CAACM,GAAG,CAACF,GAAG,CAAC;YACb,MAAMD,GAAG;UACX;UACAlC,SAAS,GAAGiC,IAAI,CAACvB,aAAa;QAChC,CAAC,QAAQV,SAAS,IAAI,IAAI;MAC5B;IA8GE,CAAC;IACDsC,kBAAkB,EAAE;MAClBhE,KAAK,EA9GT,eAAAA,CACEsC,gBAAmB,EACgB;QACnC,MAAM1B,WAAW,GAAG,MAAMM,QAAQ,CAACN,WAAW;QAC9C,MAAMU,QAAQ,GAAG,MAAM1B,iBAAiB,CAACqE,2BAA2B,CAClE/C,QAAQ,EACRN,WAAW,EACXR,WAAW,EACXkC,gBAAgB,CAACd,OAAO,EACxB;UAAEG,OAAO,EAAE;QAAK,CAClB,CAAC;QACD,OAAOL,QAAQ,CAACM,IAAI;MACtB;IAmGE,CAAC;IACDS,cAAc,EAAE;MACdrC,KAAK,EAAEqC;IACT,CAAC;IACD6B,oBAAoB,EAAE;MACpBlE,KAAK,EA3CT,gBAAAA,CAIEsC,gBAAmB,EACnBC,QAA4B,EAC5BlB,OAA+B,EAG/B;QACA,IAAIK,SAA6B;QACjC,GAAG;UACD,MAAMiC,IAAI,GAAG,MAAMtB,cAAc,CAACC,gBAAgB,EAAEC,QAAQ,EAAE;YAC5Dd,QAAQ,EAAEJ,OAAO,EAAEI,QAAQ;YAC3BC;UACF,CAAC,CAAC;UACF,KAAK,MAAMyC,IAAI,IAAIR,IAAI,CAAC/B,IAAI,EAAE;YAC5B,MAAMuC,IAAI;UACZ;UACAzC,SAAS,GAAGiC,IAAI,CAACvB,aAAa;QAChC,CAAC,QAAQV,SAAS,IAAI,IAAI;MAC5B;IAuBE;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -22,8 +22,9 @@ import { buildScenarioClient } from "./ScenarioClient.js";
22
22
  * Mint a fresh ontology scenario and return a client scoped to it.
23
23
  *
24
24
  * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)
25
- * from. Throws at runtime if the client is already scoped to a scenario or transaction. When the base client has a
26
- * branch set, the newly minted scenario uses that branch as its base.
25
+ * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,
26
+ * the transaction is ignored (a warning is logged) and the client is scoped to the new scenario. When the base
27
+ * client has a branch set, the newly minted scenario uses that branch as its base.
27
28
  * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.
28
29
  *
29
30
  * @beta This is an experimental, unstable feature subject to change.
@@ -38,9 +39,6 @@ import { buildScenarioClient } from "./ScenarioClient.js";
38
39
  */
39
40
  export async function createScenario(client) {
40
41
  const ctx = client[additionalContext];
41
- if (ctx.transactionId != null) {
42
- throw new Error("createScenario: the supplied client already has an active transaction. Scenarios cannot be nested on transactions.");
43
- }
44
42
  if (ctx.scenarioRid != null) {
45
43
  throw new Error("createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.");
46
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createScenario.js","names":["OntologyScenarios","additionalContext","buildScenarioClient","createScenario","client","ctx","transactionId","Error","scenarioRid","response","ontologyRid","branch","base","type","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 { OntologyScenarios } from \"@osdk/foundry.ontologies\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n buildScenarioClient,\n type EXPERIMENTAL_ScenarioClient,\n} 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 or transaction. When the base client has a\n * branch set, the newly minted scenario uses that branch as its base.\n * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { createScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const scenario = await createScenario(client);\n * const scenarioRid = scenario.getScenarioReference();\n * ```\n */\nexport async function createScenario(\n client: Client,\n): Promise<EXPERIMENTAL_ScenarioClient> {\n const ctx: MinimalClient = client[additionalContext];\n\n if (ctx.transactionId != null) {\n throw new Error(\n \"createScenario: the supplied client already has an active transaction. Scenarios cannot be nested on transactions.\",\n );\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 response = await OntologyScenarios.createScenario(\n ctx,\n await ctx.ontologyRid,\n ctx.branch != null\n ? { base: { type: \"branch\", branch: ctx.branch } }\n : {},\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,SAASA,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,iBAAiB,QAAqB,cAAc;AAE7D,SACEC,mBAAmB,QAEd,qBAAqB;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,cAAcA,CAClCC,MAAc,EACwB;EACtC,MAAMC,GAAkB,GAAGD,MAAM,CAACH,iBAAiB,CAAC;EAEpD,IAAII,GAAG,CAACC,aAAa,IAAI,IAAI,EAAE;IAC7B,MAAM,IAAIC,KAAK,CACb,oHACF,CAAC;EACH;EACA,IAAIF,GAAG,CAACG,WAAW,IAAI,IAAI,EAAE;IAC3B,MAAM,IAAID,KAAK,CACb,iGACF,CAAC;EACH;EAEA,MAAME,QAAQ,GAAG,MAAMT,iBAAiB,CAACG,cAAc,CACrDE,GAAG,EACH,MAAMA,GAAG,CAACK,WAAW,EACrBL,GAAG,CAACM,MAAM,IAAI,IAAI,GACd;IAAEC,IAAI,EAAE;MAAEC,IAAI,EAAE,QAAQ;MAAEF,MAAM,EAAEN,GAAG,CAACM;IAAO;EAAE,CAAC,GAChD,CAAC,CAAC,EACN;IAAEG,OAAO,EAAE;EAAK,CAClB,CAAC;EAED,OAAOZ,mBAAmB,CAACE,MAAM,EAAEK,QAAQ,CAACD,WAAW,CAAC;AAC1D","ignoreList":[]}
1
+ {"version":3,"file":"createScenario.js","names":["OntologyScenarios","additionalContext","buildScenarioClient","createScenario","client","ctx","scenarioRid","Error","response","ontologyRid","branch","base","type","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 { OntologyScenarios } from \"@osdk/foundry.ontologies\";\nimport { additionalContext, type Client } from \"../Client.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n buildScenarioClient,\n type EXPERIMENTAL_ScenarioClient,\n} 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 * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { createScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const scenario = await createScenario(client);\n * const scenarioRid = scenario.getScenarioReference();\n * ```\n */\nexport async function createScenario(\n client: Client,\n): Promise<EXPERIMENTAL_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 response = await OntologyScenarios.createScenario(\n ctx,\n await ctx.ontologyRid,\n ctx.branch != null\n ? { base: { type: \"branch\", branch: ctx.branch } }\n : {},\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,SAASA,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,iBAAiB,QAAqB,cAAc;AAE7D,SACEC,mBAAmB,QAEd,qBAAqB;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,cAAcA,CAClCC,MAAc,EACwB;EACtC,MAAMC,GAAkB,GAAGD,MAAM,CAACH,iBAAiB,CAAC;EAEpD,IAAII,GAAG,CAACC,WAAW,IAAI,IAAI,EAAE;IAC3B,MAAM,IAAIC,KAAK,CACb,iGACF,CAAC;EACH;EAEA,MAAMC,QAAQ,GAAG,MAAMR,iBAAiB,CAACG,cAAc,CACrDE,GAAG,EACH,MAAMA,GAAG,CAACI,WAAW,EACrBJ,GAAG,CAACK,MAAM,IAAI,IAAI,GACd;IAAEC,IAAI,EAAE;MAAEC,IAAI,EAAE,QAAQ;MAAEF,MAAM,EAAEL,GAAG,CAACK;IAAO;EAAE,CAAC,GAChD,CAAC,CAAC,EACN;IAAEG,OAAO,EAAE;EAAK,CAClB,CAAC;EAED,OAAOX,mBAAmB,CAACE,MAAM,EAAEI,QAAQ,CAACF,WAAW,CAAC;AAC1D","ignoreList":[]}