@osdk/client 2.7.0-beta.2 → 2.7.0-beta.3

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 (57) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/build/browser/fetchMetadata.test.js +11 -0
  3. package/build/browser/fetchMetadata.test.js.map +1 -1
  4. package/build/browser/object/AttachmentUpload.js +1 -1
  5. package/build/browser/object/AttachmentUpload.js.map +1 -1
  6. package/build/browser/object/convertWireToOsdkObjects.js +15 -3
  7. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  8. package/build/browser/object/convertWireToOsdkObjects.test.js +132 -4
  9. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  10. package/build/browser/object/fetchPage.js +2 -2
  11. package/build/browser/object/fetchPage.js.map +1 -1
  12. package/build/browser/object/fetchPage.test.js.map +1 -1
  13. package/build/browser/object/mediaUpload.js +1 -1
  14. package/build/browser/object/mediaUpload.js.map +1 -1
  15. package/build/browser/objectSet/InterfaceObjectSet.test.js +1 -1
  16. package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
  17. package/build/browser/objectSet/ObjectSet.test.js +1 -0
  18. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  19. package/build/browser/observable/ObservableClient.js.map +1 -1
  20. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  21. package/build/browser/util/UserAgent.js +2 -2
  22. package/build/cjs/{chunk-VYHIAGVJ.cjs → chunk-C47MWNFV.cjs} +4 -4
  23. package/build/cjs/chunk-C47MWNFV.cjs.map +1 -0
  24. package/build/cjs/{chunk-R5RI54KA.cjs → chunk-WEN63HAL.cjs} +74 -70
  25. package/build/cjs/chunk-WEN63HAL.cjs.map +1 -0
  26. package/build/cjs/index.cjs +8 -8
  27. package/build/cjs/public/internal.cjs +8 -8
  28. package/build/cjs/public/unstable-do-not-use.cjs +33 -33
  29. package/build/cjs/public/unstable-do-not-use.d.cts +2 -2
  30. package/build/esm/fetchMetadata.test.js +11 -0
  31. package/build/esm/fetchMetadata.test.js.map +1 -1
  32. package/build/esm/object/AttachmentUpload.js +1 -1
  33. package/build/esm/object/AttachmentUpload.js.map +1 -1
  34. package/build/esm/object/convertWireToOsdkObjects.js +15 -3
  35. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  36. package/build/esm/object/convertWireToOsdkObjects.test.js +132 -4
  37. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  38. package/build/esm/object/fetchPage.js +2 -2
  39. package/build/esm/object/fetchPage.js.map +1 -1
  40. package/build/esm/object/fetchPage.test.js.map +1 -1
  41. package/build/esm/object/mediaUpload.js +1 -1
  42. package/build/esm/object/mediaUpload.js.map +1 -1
  43. package/build/esm/objectSet/InterfaceObjectSet.test.js +1 -1
  44. package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
  45. package/build/esm/objectSet/ObjectSet.test.js +1 -0
  46. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  47. package/build/esm/observable/ObservableClient.js.map +1 -1
  48. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  49. package/build/esm/util/UserAgent.js +2 -2
  50. package/build/types/object/AttachmentUpload.d.ts.map +1 -1
  51. package/build/types/object/convertWireToOsdkObjects.d.ts +4 -4
  52. package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
  53. package/build/types/observable/ObservableClient.d.ts +2 -2
  54. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  55. package/package.json +5 -5
  56. package/build/cjs/chunk-R5RI54KA.cjs.map +0 -1
  57. package/build/cjs/chunk-VYHIAGVJ.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkVYHIAGVJ_cjs = require('../chunk-VYHIAGVJ.cjs');
3
+ var chunkC47MWNFV_cjs = require('../chunk-C47MWNFV.cjs');
4
4
  var chunk6SCDLAU2_cjs = require('../chunk-6SCDLAU2.cjs');
5
5
 
6
6
  // src/public/internal.ts
@@ -9,8 +9,8 @@ chunk6SCDLAU2_cjs.init_cjs_shims();
9
9
  // src/public-utils/createAndFetchTempObjectSetRid.ts
10
10
  chunk6SCDLAU2_cjs.init_cjs_shims();
11
11
  async function createAndFetchTempObjectSetRid(client, objectSet) {
12
- const response = await chunkVYHIAGVJ_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkVYHIAGVJ_cjs.additionalContext].ontologyRid, {
13
- objectSet: chunkVYHIAGVJ_cjs.getWireObjectSet(objectSet)
12
+ const response = await chunkC47MWNFV_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkC47MWNFV_cjs.additionalContext].ontologyRid, {
13
+ objectSet: chunkC47MWNFV_cjs.getWireObjectSet(objectSet)
14
14
  });
15
15
  return response.objectSetRid;
16
16
  }
@@ -18,7 +18,7 @@ async function createAndFetchTempObjectSetRid(client, objectSet) {
18
18
  // src/public-utils/hydrateObjectSetFromObjectRids.ts
19
19
  chunk6SCDLAU2_cjs.init_cjs_shims();
20
20
  function hydrateObjectSetFromObjectRids(client, definition, rids) {
21
- return chunkVYHIAGVJ_cjs.createObjectSet(definition, client[chunkVYHIAGVJ_cjs.additionalContext], {
21
+ return chunkC47MWNFV_cjs.createObjectSet(definition, client[chunkC47MWNFV_cjs.additionalContext], {
22
22
  type: "intersect",
23
23
  objectSets: [definition.type === "interface" ? {
24
24
  type: "interfaceBase",
@@ -39,7 +39,7 @@ function asMutableArray(array) {
39
39
  // src/public-utils/hydrateObjectSetFromRid.ts
40
40
  chunk6SCDLAU2_cjs.init_cjs_shims();
41
41
  function hydrateObjectSetFromRid(client, definition, rid) {
42
- return chunkVYHIAGVJ_cjs.createObjectSet(definition, client[chunkVYHIAGVJ_cjs.additionalContext], {
42
+ return chunkC47MWNFV_cjs.createObjectSet(definition, client[chunkC47MWNFV_cjs.additionalContext], {
43
43
  type: "intersect",
44
44
  objectSets: [definition.type === "interface" ? {
45
45
  type: "interfaceBase",
@@ -81,7 +81,7 @@ var levelStyles = {
81
81
  color: "orange"
82
82
  })
83
83
  };
84
- var BrowserLogger = class _BrowserLogger extends chunkVYHIAGVJ_cjs.BaseLogger {
84
+ var BrowserLogger = class _BrowserLogger extends chunkC47MWNFV_cjs.BaseLogger {
85
85
  constructor(bindings = {}, options = {}) {
86
86
  super(bindings, {
87
87
  ...options,
@@ -107,11 +107,11 @@ var BrowserLogger = class _BrowserLogger extends chunkVYHIAGVJ_cjs.BaseLogger {
107
107
 
108
108
  Object.defineProperty(exports, "MinimalLogger", {
109
109
  enumerable: true,
110
- get: function () { return chunkVYHIAGVJ_cjs.MinimalLogger; }
110
+ get: function () { return chunkC47MWNFV_cjs.MinimalLogger; }
111
111
  });
112
112
  Object.defineProperty(exports, "hydrateAttachmentFromRid", {
113
113
  enumerable: true,
114
- get: function () { return chunkVYHIAGVJ_cjs.hydrateAttachmentFromRid; }
114
+ get: function () { return chunkC47MWNFV_cjs.hydrateAttachmentFromRid; }
115
115
  });
116
116
  exports.BrowserLogger = BrowserLogger;
117
117
  exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkR5RI54KA_cjs = require('../chunk-R5RI54KA.cjs');
4
- var chunkVYHIAGVJ_cjs = require('../chunk-VYHIAGVJ.cjs');
3
+ var chunkWEN63HAL_cjs = require('../chunk-WEN63HAL.cjs');
4
+ var chunkC47MWNFV_cjs = require('../chunk-C47MWNFV.cjs');
5
5
  var chunk6SCDLAU2_cjs = require('../chunk-6SCDLAU2.cjs');
6
6
  var trie = require('@wry/trie');
7
7
  var deepEqual = require('fast-deep-equal');
@@ -153,7 +153,7 @@ var WhereClauseCanonicalizer = class {
153
153
  var whereCanonicalizer = new WhereClauseCanonicalizer();
154
154
  var orderByCanonicalizer = new OrderByCanonicalizer();
155
155
  function computeObjectSetCacheKey(objectSet, options) {
156
- const keyParts = ["objectSet", chunkVYHIAGVJ_cjs.getWireObjectSet(objectSet)];
156
+ const keyParts = ["objectSet", chunkC47MWNFV_cjs.getWireObjectSet(objectSet)];
157
157
  if (!options) {
158
158
  return JSON.stringify(keyParts);
159
159
  }
@@ -165,13 +165,13 @@ function computeObjectSetCacheKey(objectSet, options) {
165
165
  keyParts.push("props", propKeys);
166
166
  }
167
167
  if (options.union && options.union.length > 0) {
168
- keyParts.push("union", options.union.map((os) => chunkVYHIAGVJ_cjs.getWireObjectSet(os)));
168
+ keyParts.push("union", options.union.map((os) => chunkC47MWNFV_cjs.getWireObjectSet(os)));
169
169
  }
170
170
  if (options.intersect && options.intersect.length > 0) {
171
- keyParts.push("intersect", options.intersect.map((os) => chunkVYHIAGVJ_cjs.getWireObjectSet(os)));
171
+ keyParts.push("intersect", options.intersect.map((os) => chunkC47MWNFV_cjs.getWireObjectSet(os)));
172
172
  }
173
173
  if (options.subtract && options.subtract.length > 0) {
174
- keyParts.push("subtract", options.subtract.map((os) => chunkVYHIAGVJ_cjs.getWireObjectSet(os)));
174
+ keyParts.push("subtract", options.subtract.map((os) => chunkC47MWNFV_cjs.getWireObjectSet(os)));
175
175
  }
176
176
  if (options.pivotTo) {
177
177
  keyParts.push("pivotTo", options.pivotTo);
@@ -351,7 +351,7 @@ var OptimisticJob = class {
351
351
  return this;
352
352
  },
353
353
  createObject(type, pk, properties) {
354
- const create = store.client[chunkVYHIAGVJ_cjs.additionalContext].objectFactory2(store.client[chunkVYHIAGVJ_cjs.additionalContext], [{
354
+ const create = store.client[chunkC47MWNFV_cjs.additionalContext].objectFactory2(store.client[chunkC47MWNFV_cjs.additionalContext], [{
355
355
  $primaryKey: pk,
356
356
  $apiName: type.apiName,
357
357
  $objectType: type.apiName,
@@ -569,7 +569,7 @@ var Query = class {
569
569
  this.store = store;
570
570
  this.cacheKeys = store.cacheKeys;
571
571
  this.#subject = observable;
572
- this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkVYHIAGVJ_cjs.additionalContext].logger : store.client[chunkVYHIAGVJ_cjs.additionalContext].logger?.child({}, {
572
+ this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkC47MWNFV_cjs.additionalContext].logger : store.client[chunkC47MWNFV_cjs.additionalContext].logger?.child({}, {
573
573
  msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
574
574
  }));
575
575
  }
@@ -727,7 +727,7 @@ var Query = class {
727
727
  // src/observable/internal/aggregation/AggregationQuery.ts
728
728
  var AggregationQuery = class extends Query {
729
729
  constructor(store, subject, cacheKey, opts) {
730
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVYHIAGVJ_cjs.additionalContext].logger?.child({}, {
730
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkC47MWNFV_cjs.additionalContext].logger?.child({}, {
731
731
  msgPrefix: `AggregationQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
732
732
  }) : void 0);
733
733
  this.apiName = cacheKey.otherKeys[API_NAME_IDX];
@@ -1978,7 +1978,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
1978
1978
  batch.changes.modified.add(this.cacheKey);
1979
1979
  }
1980
1980
  constructor(store, subject, cacheKey, opts) {
1981
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVYHIAGVJ_cjs.additionalContext].logger?.child({}, {
1981
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkC47MWNFV_cjs.additionalContext].logger?.child({}, {
1982
1982
  msgPrefix: `SpecificLinkQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
1983
1983
  }) : void 0);
1984
1984
  [this.#sourceApiName, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
@@ -1994,7 +1994,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
1994
1994
  type: "object",
1995
1995
  apiName: this.#sourceApiName
1996
1996
  };
1997
- const sourceMetadata = await client[chunkVYHIAGVJ_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
1997
+ const sourceMetadata = await client[chunkC47MWNFV_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
1998
1998
  if (this.#orderBy && Object.keys(this.#orderBy).length > 0) {
1999
1999
  const linkDef = sourceMetadata.links?.[this.#linkName];
2000
2000
  if (!linkDef?.targetType) {
@@ -2065,7 +2065,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
2065
2065
  return this.revalidate(true);
2066
2066
  } else {
2067
2067
  return (async () => {
2068
- const sourceMetadata = await this.store.client[chunkVYHIAGVJ_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
2068
+ const sourceMetadata = await this.store.client[chunkC47MWNFV_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
2069
2069
  const linkDef = sourceMetadata.links?.[this.#linkName];
2070
2070
  if (!linkDef || linkDef.targetType !== objectType) return;
2071
2071
  const promise = this.revalidate(true);
@@ -2217,7 +2217,7 @@ var ListQuery = class extends BaseListQuery {
2217
2217
  batch.changes.registerList(this.cacheKey);
2218
2218
  }
2219
2219
  constructor(store, subject, apiName, cacheKey, opts) {
2220
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVYHIAGVJ_cjs.additionalContext].logger?.child({}, {
2220
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkC47MWNFV_cjs.additionalContext].logger?.child({}, {
2221
2221
  msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
2222
2222
  }) : void 0);
2223
2223
  this.apiName = apiName;
@@ -2497,7 +2497,7 @@ var InterfaceListQuery = class extends ListQuery {
2497
2497
  }
2498
2498
  extractRelevantObjects(changes) {
2499
2499
  const matchesApiName = ([, object]) => {
2500
- return this.apiName in object[chunkR5RI54KA_cjs.ObjectDefRef].interfaceMap;
2500
+ return this.apiName in object[chunkWEN63HAL_cjs.ObjectDefRef].interfaceMap;
2501
2501
  };
2502
2502
  const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
2503
2503
  const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
@@ -2518,7 +2518,7 @@ var InterfaceListQuery = class extends ListQuery {
2518
2518
  async function reloadDataAsFullObjects(client, data) {
2519
2519
  const groups = groupBy__default.default(data, (x) => x.$objectType);
2520
2520
  const objectTypeToPrimaryKeyToObject = Object.fromEntries(await Promise.all(Object.entries(groups).map(async ([apiName, objects]) => {
2521
- const objectDef = objects[0][chunkR5RI54KA_cjs.UnderlyingOsdkObject][chunkR5RI54KA_cjs.ObjectDefRef];
2521
+ const objectDef = objects[0][chunkWEN63HAL_cjs.UnderlyingOsdkObject][chunkWEN63HAL_cjs.ObjectDefRef];
2522
2522
  const where = {
2523
2523
  [objectDef.primaryKeyApiName]: {
2524
2524
  $in: objects.map((x) => x.$primaryKey)
@@ -2871,7 +2871,7 @@ var BulkObjectLoader = class {
2871
2871
  #maxEntries;
2872
2872
  constructor(client, maxWait = 25, maxEntries = 100) {
2873
2873
  this.#client = client;
2874
- this.#logger = client[chunkVYHIAGVJ_cjs.additionalContext].logger;
2874
+ this.#logger = client[chunkC47MWNFV_cjs.additionalContext].logger;
2875
2875
  this.#maxWait = maxWait;
2876
2876
  this.#maxEntries = maxEntries;
2877
2877
  }
@@ -2939,7 +2939,7 @@ var ObjectQuery = class extends Query {
2939
2939
  #apiName;
2940
2940
  #pk;
2941
2941
  constructor(store, subject, type, pk, cacheKey, opts) {
2942
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVYHIAGVJ_cjs.additionalContext].logger?.child({}, {
2942
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkC47MWNFV_cjs.additionalContext].logger?.child({}, {
2943
2943
  msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
2944
2944
  }) : void 0);
2945
2945
  this.#apiName = type;
@@ -3087,7 +3087,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3087
3087
  #composedObjectSet;
3088
3088
  #objectTypes;
3089
3089
  constructor(store, subject, baseObjectSetWire, operations, cacheKey, opts) {
3090
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVYHIAGVJ_cjs.additionalContext].logger?.child({}, {
3090
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkC47MWNFV_cjs.additionalContext].logger?.child({}, {
3091
3091
  msgPrefix: `ObjectSetQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
3092
3092
  }) : void 0);
3093
3093
  this.#baseObjectSetWire = baseObjectSetWire;
@@ -3136,7 +3136,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3136
3136
  }
3137
3137
  if (opts.union) {
3138
3138
  for (const os of opts.union) {
3139
- const wire = chunkVYHIAGVJ_cjs.getWireObjectSet(os);
3139
+ const wire = chunkC47MWNFV_cjs.getWireObjectSet(os);
3140
3140
  if (wire.type) {
3141
3141
  types.add(wire.type);
3142
3142
  }
@@ -3144,7 +3144,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3144
3144
  }
3145
3145
  if (opts.intersect) {
3146
3146
  for (const os of opts.intersect) {
3147
- const wire = chunkVYHIAGVJ_cjs.getWireObjectSet(os);
3147
+ const wire = chunkC47MWNFV_cjs.getWireObjectSet(os);
3148
3148
  if (wire.type) {
3149
3149
  types.add(wire.type);
3150
3150
  }
@@ -3152,7 +3152,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3152
3152
  }
3153
3153
  if (opts.subtract) {
3154
3154
  for (const os of opts.subtract) {
3155
- const wire = chunkVYHIAGVJ_cjs.getWireObjectSet(os);
3155
+ const wire = chunkC47MWNFV_cjs.getWireObjectSet(os);
3156
3156
  if (wire.type) {
3157
3157
  types.add(wire.type);
3158
3158
  }
@@ -3233,7 +3233,7 @@ var ObjectSetHelper = class extends AbstractHelper {
3233
3233
  const {
3234
3234
  baseObjectSet
3235
3235
  } = options;
3236
- const baseObjectSetWire = JSON.stringify(chunkVYHIAGVJ_cjs.getWireObjectSet(baseObjectSet));
3236
+ const baseObjectSetWire = JSON.stringify(chunkC47MWNFV_cjs.getWireObjectSet(baseObjectSet));
3237
3237
  const operations = this.buildCanonicalizedOperations(options);
3238
3238
  const objectSetCacheKey = this.cacheKeys.get("objectSet", baseObjectSetWire, operations);
3239
3239
  return this.store.queries.get(objectSetCacheKey, () => {
@@ -3249,13 +3249,13 @@ var ObjectSetHelper = class extends AbstractHelper {
3249
3249
  operations.withProperties = Object.keys(options.withProperties).sort();
3250
3250
  }
3251
3251
  if (options.union && options.union.length > 0) {
3252
- operations.union = options.union.map((os) => JSON.stringify(chunkVYHIAGVJ_cjs.getWireObjectSet(os)));
3252
+ operations.union = options.union.map((os) => JSON.stringify(chunkC47MWNFV_cjs.getWireObjectSet(os)));
3253
3253
  }
3254
3254
  if (options.intersect && options.intersect.length > 0) {
3255
- operations.intersect = options.intersect.map((os) => JSON.stringify(chunkVYHIAGVJ_cjs.getWireObjectSet(os)));
3255
+ operations.intersect = options.intersect.map((os) => JSON.stringify(chunkC47MWNFV_cjs.getWireObjectSet(os)));
3256
3256
  }
3257
3257
  if (options.subtract && options.subtract.length > 0) {
3258
- operations.subtract = options.subtract.map((os) => JSON.stringify(chunkVYHIAGVJ_cjs.getWireObjectSet(os)));
3258
+ operations.subtract = options.subtract.map((os) => JSON.stringify(chunkC47MWNFV_cjs.getWireObjectSet(os)));
3259
3259
  }
3260
3260
  if (options.pivotTo) {
3261
3261
  operations.pivotTo = options.pivotTo;
@@ -3327,7 +3327,7 @@ var RdpCanonicalizer = class extends CachingCanonicalizer {
3327
3327
  apiName: "__rdp_canonicalizer_holder__"
3328
3328
  };
3329
3329
  for (const [key, rdpFunction] of Object.entries(rdp)) {
3330
- const builder = chunkVYHIAGVJ_cjs.createWithPropertiesObjectSet(
3330
+ const builder = chunkC47MWNFV_cjs.createWithPropertiesObjectSet(
3331
3331
  objectTypeHolder,
3332
3332
  {
3333
3333
  type: "methodInput"
@@ -3378,7 +3378,7 @@ var Store = class {
3378
3378
  subjects = this.layers.subjects;
3379
3379
  // these are hopefully temporary
3380
3380
  constructor(client) {
3381
- this.logger = client[chunkVYHIAGVJ_cjs.additionalContext].logger?.child({}, {
3381
+ this.logger = client[chunkC47MWNFV_cjs.additionalContext].logger?.child({}, {
3382
3382
  msgPrefix: "Store"
3383
3383
  });
3384
3384
  this.client = client;
@@ -3644,10 +3644,10 @@ var Store = class {
3644
3644
 
3645
3645
  // src/observable/ObservableClient.ts
3646
3646
  function createObservableClient(client) {
3647
- const tweakedClient = chunkR5RI54KA_cjs.createClientFromContext({
3648
- ...client[chunkVYHIAGVJ_cjs.additionalContext],
3649
- fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkVYHIAGVJ_cjs.additionalContext].fetch, (headers) => {
3650
- headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunkR5RI54KA_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
3647
+ const tweakedClient = chunkWEN63HAL_cjs.createClientFromContext({
3648
+ ...client[chunkC47MWNFV_cjs.additionalContext],
3649
+ fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkC47MWNFV_cjs.additionalContext].fetch, (headers) => {
3650
+ headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunkWEN63HAL_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
3651
3651
  return headers;
3652
3652
  })
3653
3653
  });
@@ -3691,11 +3691,11 @@ function getOsdkConfig(ontologyRid) {
3691
3691
 
3692
3692
  Object.defineProperty(exports, "createClientWithTransaction", {
3693
3693
  enumerable: true,
3694
- get: function () { return chunkR5RI54KA_cjs.createClientWithTransaction; }
3694
+ get: function () { return chunkWEN63HAL_cjs.createClientWithTransaction; }
3695
3695
  });
3696
3696
  Object.defineProperty(exports, "augment", {
3697
3697
  enumerable: true,
3698
- get: function () { return chunkVYHIAGVJ_cjs.augment; }
3698
+ get: function () { return chunkC47MWNFV_cjs.augment; }
3699
3699
  });
3700
3700
  exports.computeObjectSetCacheKey = computeObjectSetCacheKey;
3701
3701
  exports.createObservableClient = createObservableClient;
@@ -1,4 +1,4 @@
1
- import { ObjectOrInterfaceDefinition, PropertyKeys, Augment, ObjectTypeDefinition, InterfaceDefinition, WirePropertyTypes, WhereClause, DerivedProperty, ObjectSet, LinkNames, BaseObjectSet, CompileTimeMetadata, PrimaryKeyType, Osdk, SimplePropertyDef, AggregateOpts, AggregationsResults, ActionDefinition, ActionValidationResponse } from '@osdk/api';
1
+ import { ObjectOrInterfaceDefinition, PropertyKeys, Augment, ObjectTypeDefinition, InterfaceDefinition, WirePropertyTypes, WhereClause, DerivedProperty, ObjectSet, LinkNames, BaseObjectSet, CompileTimeMetadata, PrimaryKeyType, Osdk, SimplePropertyDef, AggregateOpts, AggregationsResults, ActionDefinition, ActionEditResponse, ActionValidationResponse } from '@osdk/api';
2
2
  import { C as Client, A as ActionSignatureFromDef } from '../Client-DaUJl7jZ.cjs';
3
3
  export { a as createClientWithTransaction } from '../createClient-CPUYdECn.cjs';
4
4
  import '@osdk/shared.client';
@@ -318,7 +318,7 @@ interface ObservableClient extends ObserveLinks {
318
318
  * - On success, server data replaces optimistic data
319
319
  * - On failure, optimistic changes automatically roll back
320
320
  */
321
- applyAction: <Q extends ActionDefinition<any>>(action: Q, args: Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0] | Array<Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0]>, opts?: ObservableClient.ApplyActionOptions) => Promise<unknown>;
321
+ applyAction: <Q extends ActionDefinition<any>>(action: Q, args: Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0] | Array<Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0]>, opts?: ObservableClient.ApplyActionOptions) => Promise<ActionEditResponse>;
322
322
  /**
323
323
  * Validate action parameters without executing the action.
324
324
  *
@@ -49,12 +49,14 @@ describe("FetchMetadata", () => {
49
49
  ],
50
50
  "interfaceMap": {
51
51
  "FooInterface": {
52
+ "fooIdp": "office",
52
53
  "fooSpt": "fullName",
53
54
  },
54
55
  },
55
56
  "inverseInterfaceMap": {
56
57
  "FooInterface": {
57
58
  "fullName": "fooSpt",
59
+ "office": "fooIdp",
58
60
  },
59
61
  },
60
62
  "links": {
@@ -200,6 +202,15 @@ describe("FetchMetadata", () => {
200
202
  },
201
203
  },
202
204
  "properties": {
205
+ "fooIdp": {
206
+ "description": "A Foo IDP",
207
+ "displayName": "Foo IDP",
208
+ "multiplicity": false,
209
+ "nullable": true,
210
+ "type": "string",
211
+ "valueFormatting": undefined,
212
+ "valueTypeApiName": undefined,
213
+ },
203
214
  "fooSpt": {
204
215
  "description": "A foo",
205
216
  "displayName": "Foo",
@@ -1 +1 @@
1
- {"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n \"visitedOffices\": {\n \"multiplicity\": true,\n \"targetType\": \"Office\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"skillSet\": {\n \"description\": \"The skills of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"skillSetEmbedding\": {\n \"description\": \"Vectorized skill set\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"vector\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {\n \"toBar\": {\n \"multiplicity\": true,\n \"targetType\": \"interface\",\n \"targetTypeApiName\": \"BarInterface\",\n },\n },\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooIdp\": \"office\",\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n \"office\": \"fooIdp\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n \"visitedOffices\": {\n \"multiplicity\": true,\n \"targetType\": \"Office\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"skillSet\": {\n \"description\": \"The skills of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"skillSetEmbedding\": {\n \"description\": \"Vectorized skill set\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"vector\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {\n \"toBar\": {\n \"multiplicity\": true,\n \"targetType\": \"interface\",\n \"targetTypeApiName\": \"BarInterface\",\n },\n },\n \"properties\": {\n \"fooIdp\": {\n \"description\": \"A Foo IDP\",\n \"displayName\": \"Foo IDP\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  export function isAttachmentUpload(o) {
18
- return typeof o === `object` && "name" in o && "data" in o && o.data instanceof Blob;
18
+ return typeof o === "object" && o != null && "name" in o && typeof o.name === "string" && "data" in o && o.data instanceof Blob && !("fileName" in o);
19
19
  }
20
20
  export function isAttachmentFile(o) {
21
21
  return typeof o === "object" && o instanceof Blob && "name" in o;
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentUpload.js","names":["isAttachmentUpload","o","data","Blob","isAttachmentFile","createAttachmentUpload","name"],"sources":["AttachmentUpload.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 { AttachmentUpload } from \"@osdk/api\";\n\nexport function isAttachmentUpload(o: any): o is AttachmentUpload {\n return typeof o === `object` && \"name\" in o && \"data\" in o\n && o.data instanceof Blob;\n}\n\nexport function isAttachmentFile(\n o: any,\n): o is Blob & { readonly name: string } {\n return typeof o === \"object\" && o instanceof Blob && \"name\" in o;\n}\n\nexport function createAttachmentUpload(\n data: Blob,\n name: string,\n): AttachmentUpload {\n return { data, name };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,kBAAkBA,CAACC,CAAM,EAAyB;EAChE,OAAO,OAAOA,CAAC,KAAK,QAAQ,IAAI,MAAM,IAAIA,CAAC,IAAI,MAAM,IAAIA,CAAC,IACrDA,CAAC,CAACC,IAAI,YAAYC,IAAI;AAC7B;AAEA,OAAO,SAASC,gBAAgBA,CAC9BH,CAAM,EACiC;EACvC,OAAO,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,YAAYE,IAAI,IAAI,MAAM,IAAIF,CAAC;AAClE;AAEA,OAAO,SAASI,sBAAsBA,CACpCH,IAAU,EACVI,IAAY,EACM;EAClB,OAAO;IAAEJ,IAAI;IAAEI;EAAK,CAAC;AACvB","ignoreList":[]}
1
+ {"version":3,"file":"AttachmentUpload.js","names":["isAttachmentUpload","o","name","data","Blob","isAttachmentFile","createAttachmentUpload"],"sources":["AttachmentUpload.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 { AttachmentUpload } from \"@osdk/api\";\n\nexport function isAttachmentUpload(o: any): o is AttachmentUpload {\n return typeof o === \"object\"\n && o != null\n && \"name\" in o\n && typeof o.name === \"string\"\n && \"data\" in o\n && o.data instanceof Blob\n && !(\"fileName\" in o);\n}\n\nexport function isAttachmentFile(\n o: any,\n): o is Blob & { readonly name: string } {\n return typeof o === \"object\" && o instanceof Blob && \"name\" in o;\n}\n\nexport function createAttachmentUpload(\n data: Blob,\n name: string,\n): AttachmentUpload {\n return { data, name };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,kBAAkBA,CAACC,CAAM,EAAyB;EAChE,OAAO,OAAOA,CAAC,KAAK,QAAQ,IACvBA,CAAC,IAAI,IAAI,IACT,MAAM,IAAIA,CAAC,IACX,OAAOA,CAAC,CAACC,IAAI,KAAK,QAAQ,IAC1B,MAAM,IAAID,CAAC,IACXA,CAAC,CAACE,IAAI,YAAYC,IAAI,IACtB,EAAE,UAAU,IAAIH,CAAC,CAAC;AACzB;AAEA,OAAO,SAASI,gBAAgBA,CAC9BJ,CAAM,EACiC;EACvC,OAAO,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,YAAYG,IAAI,IAAI,MAAM,IAAIH,CAAC;AAClE;AAEA,OAAO,SAASK,sBAAsBA,CACpCH,IAAU,EACVD,IAAY,EACM;EAClB,OAAO;IAAEC,IAAI;IAAED;EAAK,CAAC;AACvB","ignoreList":[]}
@@ -70,14 +70,17 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
70
70
  /**
71
71
  * @internal
72
72
  */
73
- export async function convertWireToOsdkObjects2(client, objects, interfaceApiName, derivedPropertyTypeByName, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}) {
73
+ export async function convertWireToOsdkObjects2(client, objects, interfaceApiName, derivedPropertyTypeByName, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}, interfaceToObjectTypeMappingsV2 = {}) {
74
74
  fixObjectPropertiesInPlace(objects, forceRemoveRid);
75
- const isInterfaceScoped = Object.keys(interfaceToObjectTypeMappings).length > 0;
75
+
76
+ // prefer V2 mappings if non-empty, otherwise fall back to V1
77
+ const effectiveMappings = Object.keys(interfaceToObjectTypeMappingsV2).length > 0 ? convertInterfaceToObjectTypeMappingsV2ToV1(interfaceToObjectTypeMappingsV2) : interfaceToObjectTypeMappings;
78
+ const isInterfaceScoped = Object.keys(effectiveMappings).length > 0;
76
79
  const ret = [];
77
80
  for (const rawObj of objects) {
78
81
  const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
79
82
  !objectDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : invariant(false) : void 0;
80
- const interfaceToObjMapping = interfaceApiName && isInterfaceScoped ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] : undefined;
83
+ const interfaceToObjMapping = interfaceApiName && isInterfaceScoped ? effectiveMappings[interfaceApiName][rawObj.$apiName] : undefined;
81
84
  const ifaceSelected = interfaceApiName && interfaceToObjMapping ? selectedProps ? Object.keys(interfaceToObjMapping).filter(val => {
82
85
  selectedProps?.includes(interfaceToObjMapping[val]);
83
86
  }) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] : undefined;
@@ -198,4 +201,13 @@ function fixObjectPropertiesInPlace(objs, forceRemoveRid) {
198
201
  delete obj.__title;
199
202
  }
200
203
  }
204
+
205
+ /**
206
+ * Converts interfaceToObjectTypeMappingsV2 format to the V1 format.
207
+ * V2 format: { interfaceProp: { type: "localPropertyImplementation", propertyApiName: "objectProp" } }
208
+ * V1 format: { interfaceProp: "objectProp" }
209
+ */
210
+ function convertInterfaceToObjectTypeMappingsV2ToV1(mappingsV2) {
211
+ return Object.fromEntries(Object.entries(mappingsV2).map(([interfaceApiName, objectTypeMappingsV2]) => [interfaceApiName, Object.fromEntries(Object.entries(objectTypeMappingsV2).map(([objectTypeName, propertyMappings]) => [objectTypeName, Object.fromEntries(Object.entries(propertyMappings).filter(([, impl]) => impl.type === "localPropertyImplementation").map(([interfaceProp, impl]) => [interfaceProp, impl.propertyApiName]))]))]));
212
+ }
201
213
  //# sourceMappingURL=convertWireToOsdkObjects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","derivedPropertyTypesByName","selectedProps","strictNonNull","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","process","env","NODE_ENV","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","convertWireToOsdkObjects2","derivedPropertyTypeByName","interfaceToObjectTypeMappings","isInterfaceScoped","length","interfaceToObjMapping","filter","val","includes","values","primaryKeyApiName","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","$primaryKey","def","obj","propsToCheck","propName","nullable","logger","debug","$objectType","warning","warn","console","error","objs","__rid","$rid","__score","$score","__apiName","__primaryKey","$title","__title"],"sources":["convertWireToOsdkObjects.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 InterfaceMetadata,\n NullabilityAdherence,\n ObjectMetadata,\n} from \"@osdk/api\";\nimport type {\n InterfaceToObjectTypeMappings,\n InterfaceTypeApiName,\n OntologyObjectV2,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n type FetchedObjectTypeDefinition,\n} from \"../ontology/OntologyProvider.js\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\nimport type { InterfaceHolder } from \"./convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"./convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"./SimpleOsdkProperties.js\";\n\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n forceRemoveRid: boolean = false,\n derivedPropertyTypesByName: DerivedPropertyRuntimeMetadata,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n // remove the __ prefixed properties and convert them to $ prefixed.\n // updates in place\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n\n objProps = convertInterfacePropNamesToObjectPropNames(\n objectDef,\n ifaceDef.apiName,\n ifaceSelected,\n );\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypesByName,\n );\n if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n): Promise<Array<InterfaceHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n): Promise<Array<ObjectHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n): Promise<Array<ObjectHolder | InterfaceHolder>>;\n/**\n * @internal\n */\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid: boolean = false,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n interfaceToObjectTypeMappings: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n > = {},\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n const isInterfaceScoped =\n Object.keys(interfaceToObjectTypeMappings).length > 0;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n const interfaceToObjMapping = (interfaceApiName\n && isInterfaceScoped)\n ? interfaceToObjectTypeMappings[\n interfaceApiName as InterfaceTypeApiName\n ][\n rawObj.$apiName\n ]\n : undefined;\n\n const ifaceSelected = interfaceApiName && interfaceToObjMapping\n ? (selectedProps\n ? Object.keys(interfaceToObjMapping).filter(\n val => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n },\n )\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ])\n : undefined;\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n\n objProps = ifaceSelected;\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypeByName,\n );\n if (\n interfaceApiName && isInterfaceScoped\n ) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\n/**\n * @internal\n *\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nexport function convertInterfacePropNamesToObjectPropNames(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n ifacePropsToMap: readonly string[],\n): string[] {\n return ifacePropsToMap.map((ifaceProp) =>\n objectDef.interfaceMap[interfaceApiName][ifaceProp]\n );\n}\n\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n rawObj: OntologyObjectV2,\n) {\n const newProps: Record<string, any> = {};\n for (\n const [sptProp, regularProp] of Object.entries(\n objectDef.interfaceMap[interfaceApiName],\n )\n ) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\n\nfunction isConforming(\n client: MinimalClient,\n def:\n | InterfaceMetadata\n | ObjectMetadata,\n obj: OntologyObjectV2,\n propsToCheck: readonly string[],\n) {\n for (const propName of propsToCheck) {\n if (\n propName in def.properties && def.properties[propName].nullable === false\n && obj[propName] == null\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug(\n {\n obj: {\n $apiName: obj[\"$apiName\"],\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n },\n `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`,\n );\n }\n return false;\n }\n }\n return true;\n}\n\nfunction invariantInterfacesAsViews(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n client: MinimalClient,\n): asserts objectDef is typeof objectDef & { interfaceMap: {} } {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning =\n \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n } else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\n\nfunction fixObjectPropertiesInPlace(\n objs: OntologyObjectV2[],\n forceRemoveRid: boolean,\n): asserts objs is SimpleOsdkProperties[] {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n\n if (obj.__score) {\n obj.$score = obj.__score;\n delete obj.__score;\n }\n\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName ??= obj.__apiName;\n\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.$apiName;\n\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey ??= obj.__primaryKey;\n obj.$title ??= obj.__title;\n\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAOA,SAAS,MAAM,gBAAgB;AAMtC,SAASC,gBAAgB,QAAQ,gDAAgD;AAKjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAC5CC,MAAqB,EACrBC,OAA2B,EAC3BC,gBAAoC,EACpCC,cAAuB,GAAG,KAAK,EAC/BC,0BAA0D,EAC1DC,aAAqC,EACrCC,aAAmC,GAAG,KAAK,EACK;EAChD;EACA;EACAC,0BAA0B,CAACN,OAAO,EAAEE,cAAc,CAAC;EAEnD,MAAMK,QAAQ,GAAGN,gBAAgB,GAC7B,MAAMF,MAAM,CAACS,gBAAgB,CAACC,sBAAsB,CAACR,gBAAgB,CAAC,GACtES,SAAS;EACb,MAAMC,aAAa,GAAGJ,QAAQ,GACzBH,aAAa,IAAIQ,MAAM,CAACC,IAAI,CAACN,QAAQ,CAACO,UAAU,CAAC,GAClDJ,SAAS;EAEb,MAAMK,GAAG,GAAG,EAAE;EACd,KAAK,MAAMC,MAAM,IAAIhB,OAAO,EAAE;IAC5B,MAAMiB,SAAS,GAAG,MAAMlB,MAAM,CAACS,gBAAgB,CAACU,mBAAm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{"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","derivedPropertyTypesByName","selectedProps","strictNonNull","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","process","env","NODE_ENV","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","convertWireToOsdkObjects2","derivedPropertyTypeByName","interfaceToObjectTypeMappings","interfaceToObjectTypeMappingsV2","effectiveMappings","length","convertInterfaceToObjectTypeMappingsV2ToV1","isInterfaceScoped","interfaceToObjMapping","filter","val","includes","values","primaryKeyApiName","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","$primaryKey","def","obj","propsToCheck","propName","nullable","logger","debug","$objectType","warning","warn","console","error","objs","__rid","$rid","__score","$score","__apiName","__primaryKey","$title","__title","mappingsV2","fromEntries","objectTypeMappingsV2","objectTypeName","propertyMappings","impl","type","interfaceProp","propertyApiName"],"sources":["convertWireToOsdkObjects.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 InterfaceMetadata,\n NullabilityAdherence,\n ObjectMetadata,\n} from \"@osdk/api\";\nimport type {\n InterfaceToObjectTypeMappings,\n InterfaceToObjectTypeMappingsV2,\n InterfaceTypeApiName,\n OntologyObjectV2,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n type FetchedObjectTypeDefinition,\n} from \"../ontology/OntologyProvider.js\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\nimport type { InterfaceHolder } from \"./convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"./convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"./SimpleOsdkProperties.js\";\n\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n forceRemoveRid: boolean = false,\n derivedPropertyTypesByName: DerivedPropertyRuntimeMetadata,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n // remove the __ prefixed properties and convert them to $ prefixed.\n // updates in place\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n\n objProps = convertInterfacePropNamesToObjectPropNames(\n objectDef,\n ifaceDef.apiName,\n ifaceSelected,\n );\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypesByName,\n );\n if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<InterfaceHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<ObjectHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<ObjectHolder | InterfaceHolder>>;\n/**\n * @internal\n */\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid: boolean = false,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n interfaceToObjectTypeMappings: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n > = {},\n interfaceToObjectTypeMappingsV2: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n > = {},\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n // prefer V2 mappings if non-empty, otherwise fall back to V1\n const effectiveMappings =\n Object.keys(interfaceToObjectTypeMappingsV2).length > 0\n ? convertInterfaceToObjectTypeMappingsV2ToV1(\n interfaceToObjectTypeMappingsV2,\n )\n : interfaceToObjectTypeMappings;\n\n const isInterfaceScoped = Object.keys(effectiveMappings).length > 0;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n const interfaceToObjMapping = (interfaceApiName && isInterfaceScoped)\n ? effectiveMappings[interfaceApiName as InterfaceTypeApiName][\n rawObj.$apiName\n ]\n : undefined;\n\n const ifaceSelected = interfaceApiName && interfaceToObjMapping\n ? (selectedProps\n ? Object.keys(interfaceToObjMapping).filter(\n val => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n },\n )\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ])\n : undefined;\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n\n objProps = ifaceSelected;\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypeByName,\n );\n if (\n interfaceApiName && isInterfaceScoped\n ) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\n/**\n * @internal\n *\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nexport function convertInterfacePropNamesToObjectPropNames(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n ifacePropsToMap: readonly string[],\n): string[] {\n return ifacePropsToMap.map((ifaceProp) =>\n objectDef.interfaceMap[interfaceApiName][ifaceProp]\n );\n}\n\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n rawObj: OntologyObjectV2,\n) {\n const newProps: Record<string, any> = {};\n for (\n const [sptProp, regularProp] of Object.entries(\n objectDef.interfaceMap[interfaceApiName],\n )\n ) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\n\nfunction isConforming(\n client: MinimalClient,\n def:\n | InterfaceMetadata\n | ObjectMetadata,\n obj: OntologyObjectV2,\n propsToCheck: readonly string[],\n) {\n for (const propName of propsToCheck) {\n if (\n propName in def.properties && def.properties[propName].nullable === false\n && obj[propName] == null\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug(\n {\n obj: {\n $apiName: obj[\"$apiName\"],\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n },\n `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`,\n );\n }\n return false;\n }\n }\n return true;\n}\n\nfunction invariantInterfacesAsViews(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n client: MinimalClient,\n): asserts objectDef is typeof objectDef & { interfaceMap: {} } {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning =\n \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n } else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\n\nfunction fixObjectPropertiesInPlace(\n objs: OntologyObjectV2[],\n forceRemoveRid: boolean,\n): asserts objs is SimpleOsdkProperties[] {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n\n if (obj.__score) {\n obj.$score = obj.__score;\n delete obj.__score;\n }\n\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName ??= obj.__apiName;\n\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.$apiName;\n\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey ??= obj.__primaryKey;\n obj.$title ??= obj.__title;\n\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n\n/**\n * Converts interfaceToObjectTypeMappingsV2 format to the V1 format.\n * V2 format: { interfaceProp: { type: \"localPropertyImplementation\", propertyApiName: \"objectProp\" } }\n * V1 format: { interfaceProp: \"objectProp\" }\n */\nfunction convertInterfaceToObjectTypeMappingsV2ToV1(\n mappingsV2: Record<InterfaceTypeApiName, InterfaceToObjectTypeMappingsV2>,\n): Record<InterfaceTypeApiName, InterfaceToObjectTypeMappings> {\n return Object.fromEntries(\n Object.entries(mappingsV2).map((\n [interfaceApiName, objectTypeMappingsV2],\n ) => [\n interfaceApiName,\n Object.fromEntries(\n Object.entries(objectTypeMappingsV2).map((\n [objectTypeName, propertyMappings],\n ) => [\n objectTypeName,\n Object.fromEntries(\n Object.entries(propertyMappings)\n .filter(([, impl]) => impl.type === \"localPropertyImplementation\")\n .map((\n [interfaceProp, impl],\n ) => [interfaceProp, impl.propertyApiName]),\n ),\n ]),\n ),\n ]),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAOA,SAAS,MAAM,gBAAgB;AAMtC,SAASC,gBAAgB,QAAQ,gDAAgD;AAKjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAC5CC,MAAqB,EACrBC,OAA2B,EAC3BC,gBAAoC,EACpCC,cAAuB,GAAG,KAAK,EAC/BC,0BAA0D,EAC1DC,aAAqC,EACrCC,aAAmC,GAAG,KAAK,EACK;EAChD;EACA;EACAC,0BAA0B,CAACN,OAAO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