@osdk/client 2.6.0-beta.7 → 2.6.0-beta.8

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 (38) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/build/browser/index.js.map +1 -1
  3. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +13 -15
  4. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  5. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +62 -0
  6. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  7. package/build/browser/object/mediaUpload.js +1 -1
  8. package/build/browser/object/mediaUpload.js.map +1 -1
  9. package/build/browser/util/UserAgent.js +2 -2
  10. package/build/browser/util/toDataValue.js +3 -2
  11. package/build/browser/util/toDataValue.js.map +1 -1
  12. package/build/browser/util/toDataValue.test.js +1 -1
  13. package/build/browser/util/toDataValue.test.js.map +1 -1
  14. package/build/cjs/{chunk-3LMKH6RS.cjs → chunk-HJV24UL2.cjs} +25 -35
  15. package/build/cjs/chunk-HJV24UL2.cjs.map +1 -0
  16. package/build/cjs/{chunk-4ZOXOCQX.cjs → chunk-PCNVSZXT.cjs} +133 -67
  17. package/build/cjs/chunk-PCNVSZXT.cjs.map +1 -0
  18. package/build/cjs/index.cjs +8 -8
  19. package/build/cjs/index.d.cts +1 -1
  20. package/build/cjs/public/internal.cjs +8 -8
  21. package/build/cjs/public/unstable-do-not-use.cjs +32 -32
  22. package/build/esm/index.js.map +1 -1
  23. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +13 -15
  24. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  25. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +62 -0
  26. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  27. package/build/esm/object/mediaUpload.js +1 -1
  28. package/build/esm/object/mediaUpload.js.map +1 -1
  29. package/build/esm/util/UserAgent.js +2 -2
  30. package/build/esm/util/toDataValue.js +3 -2
  31. package/build/esm/util/toDataValue.js.map +1 -1
  32. package/build/esm/util/toDataValue.test.js +1 -1
  33. package/build/esm/util/toDataValue.test.js.map +1 -1
  34. package/build/types/index.d.ts +1 -1
  35. package/build/types/index.d.ts.map +1 -1
  36. package/package.json +10 -9
  37. package/build/cjs/chunk-3LMKH6RS.cjs.map +0 -1
  38. package/build/cjs/chunk-4ZOXOCQX.cjs.map +0 -1
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunk3LMKH6RS_cjs = require('../chunk-3LMKH6RS.cjs');
3
+ var chunkHJV24UL2_cjs = require('../chunk-HJV24UL2.cjs');
4
4
  require('../chunk-Q7SFCCGT.cjs');
5
5
 
6
6
  // src/public-utils/createAndFetchTempObjectSetRid.ts
7
7
  async function createAndFetchTempObjectSetRid(client, objectSet) {
8
- const response = await chunk3LMKH6RS_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunk3LMKH6RS_cjs.additionalContext].ontologyRid, {
9
- objectSet: chunk3LMKH6RS_cjs.getWireObjectSet(objectSet)
8
+ const response = await chunkHJV24UL2_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkHJV24UL2_cjs.additionalContext].ontologyRid, {
9
+ objectSet: chunkHJV24UL2_cjs.getWireObjectSet(objectSet)
10
10
  });
11
11
  return response.objectSetRid;
12
12
  }
13
13
 
14
14
  // src/public-utils/hydrateObjectSetFromObjectRids.ts
15
15
  function hydrateObjectSetFromObjectRids(client, definition, rids) {
16
- return chunk3LMKH6RS_cjs.createObjectSet(definition, client[chunk3LMKH6RS_cjs.additionalContext], {
16
+ return chunkHJV24UL2_cjs.createObjectSet(definition, client[chunkHJV24UL2_cjs.additionalContext], {
17
17
  type: "intersect",
18
18
  objectSets: [definition.type === "interface" ? {
19
19
  type: "interfaceBase",
@@ -33,7 +33,7 @@ function asMutableArray(array) {
33
33
 
34
34
  // src/public-utils/hydrateObjectSetFromRid.ts
35
35
  function hydrateObjectSetFromRid(client, definition, rid) {
36
- return chunk3LMKH6RS_cjs.createObjectSet(definition, client[chunk3LMKH6RS_cjs.additionalContext], {
36
+ return chunkHJV24UL2_cjs.createObjectSet(definition, client[chunkHJV24UL2_cjs.additionalContext], {
37
37
  type: "intersect",
38
38
  objectSets: [definition.type === "interface" ? {
39
39
  type: "interfaceBase",
@@ -74,7 +74,7 @@ var levelStyles = {
74
74
  color: "orange"
75
75
  })
76
76
  };
77
- var BrowserLogger = class _BrowserLogger extends chunk3LMKH6RS_cjs.BaseLogger {
77
+ var BrowserLogger = class _BrowserLogger extends chunkHJV24UL2_cjs.BaseLogger {
78
78
  constructor(bindings = {}, options = {}) {
79
79
  super(bindings, {
80
80
  ...options,
@@ -100,11 +100,11 @@ var BrowserLogger = class _BrowserLogger extends chunk3LMKH6RS_cjs.BaseLogger {
100
100
 
101
101
  Object.defineProperty(exports, "MinimalLogger", {
102
102
  enumerable: true,
103
- get: function () { return chunk3LMKH6RS_cjs.MinimalLogger; }
103
+ get: function () { return chunkHJV24UL2_cjs.MinimalLogger; }
104
104
  });
105
105
  Object.defineProperty(exports, "hydrateAttachmentFromRid", {
106
106
  enumerable: true,
107
- get: function () { return chunk3LMKH6RS_cjs.hydrateAttachmentFromRid; }
107
+ get: function () { return chunkHJV24UL2_cjs.hydrateAttachmentFromRid; }
108
108
  });
109
109
  exports.BrowserLogger = BrowserLogger;
110
110
  exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk4ZOXOCQX_cjs = require('../chunk-4ZOXOCQX.cjs');
4
- var chunk3LMKH6RS_cjs = require('../chunk-3LMKH6RS.cjs');
3
+ var chunkPCNVSZXT_cjs = require('../chunk-PCNVSZXT.cjs');
4
+ var chunkHJV24UL2_cjs = require('../chunk-HJV24UL2.cjs');
5
5
  require('../chunk-Q7SFCCGT.cjs');
6
6
  var trie = require('@wry/trie');
7
7
  var deepEqual = require('fast-deep-equal');
@@ -139,7 +139,7 @@ var WhereClauseCanonicalizer = class {
139
139
  var whereCanonicalizer = new WhereClauseCanonicalizer();
140
140
  var orderByCanonicalizer = new OrderByCanonicalizer();
141
141
  function computeObjectSetCacheKey(objectSet, options) {
142
- const keyParts = ["objectSet", chunk3LMKH6RS_cjs.getWireObjectSet(objectSet)];
142
+ const keyParts = ["objectSet", chunkHJV24UL2_cjs.getWireObjectSet(objectSet)];
143
143
  if (!options) {
144
144
  return JSON.stringify(keyParts);
145
145
  }
@@ -151,13 +151,13 @@ function computeObjectSetCacheKey(objectSet, options) {
151
151
  keyParts.push("props", propKeys);
152
152
  }
153
153
  if (options.union && options.union.length > 0) {
154
- keyParts.push("union", options.union.map((os) => chunk3LMKH6RS_cjs.getWireObjectSet(os)));
154
+ keyParts.push("union", options.union.map((os) => chunkHJV24UL2_cjs.getWireObjectSet(os)));
155
155
  }
156
156
  if (options.intersect && options.intersect.length > 0) {
157
- keyParts.push("intersect", options.intersect.map((os) => chunk3LMKH6RS_cjs.getWireObjectSet(os)));
157
+ keyParts.push("intersect", options.intersect.map((os) => chunkHJV24UL2_cjs.getWireObjectSet(os)));
158
158
  }
159
159
  if (options.subtract && options.subtract.length > 0) {
160
- keyParts.push("subtract", options.subtract.map((os) => chunk3LMKH6RS_cjs.getWireObjectSet(os)));
160
+ keyParts.push("subtract", options.subtract.map((os) => chunkHJV24UL2_cjs.getWireObjectSet(os)));
161
161
  }
162
162
  if (options.pivotTo) {
163
163
  keyParts.push("pivotTo", options.pivotTo);
@@ -316,7 +316,7 @@ var OptimisticJob = class {
316
316
  return this;
317
317
  },
318
318
  createObject(type, pk, properties) {
319
- const create = store.client[chunk3LMKH6RS_cjs.additionalContext].objectFactory2(store.client[chunk3LMKH6RS_cjs.additionalContext], [{
319
+ const create = store.client[chunkHJV24UL2_cjs.additionalContext].objectFactory2(store.client[chunkHJV24UL2_cjs.additionalContext], [{
320
320
  $primaryKey: pk,
321
321
  $apiName: type.apiName,
322
322
  $objectType: type.apiName,
@@ -1014,7 +1014,7 @@ var Query = class {
1014
1014
  this.store = store;
1015
1015
  this.cacheKeys = store.cacheKeys;
1016
1016
  this.#subject = observable;
1017
- this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger : store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
1017
+ this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkHJV24UL2_cjs.additionalContext].logger : store.client[chunkHJV24UL2_cjs.additionalContext].logger?.child({}, {
1018
1018
  msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
1019
1019
  }));
1020
1020
  }
@@ -1722,7 +1722,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
1722
1722
  batch.changes.modified.add(this.cacheKey);
1723
1723
  }
1724
1724
  constructor(store, subject, cacheKey, opts) {
1725
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
1725
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkHJV24UL2_cjs.additionalContext].logger?.child({}, {
1726
1726
  msgPrefix: `SpecificLinkQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
1727
1727
  }) : void 0);
1728
1728
  [this.#sourceApiName, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
@@ -1739,7 +1739,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
1739
1739
  type: "object",
1740
1740
  apiName: this.#sourceApiName
1741
1741
  };
1742
- const sourceMetadata = await client[chunk3LMKH6RS_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
1742
+ const sourceMetadata = await client[chunkHJV24UL2_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
1743
1743
  const sourceQuery = client(sourceObjectDef).where({
1744
1744
  [sourceMetadata.primaryKeyApiName]: this.#sourcePk
1745
1745
  });
@@ -1803,7 +1803,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
1803
1803
  return this.revalidate(true);
1804
1804
  } else {
1805
1805
  return (async () => {
1806
- const sourceMetadata = await this.store.client[chunk3LMKH6RS_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
1806
+ const sourceMetadata = await this.store.client[chunkHJV24UL2_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
1807
1807
  const linkDef = sourceMetadata.links?.[this.#linkName];
1808
1808
  if (!linkDef || linkDef.targetType !== objectType) return;
1809
1809
  const promise = this.revalidate(true);
@@ -1941,7 +1941,7 @@ var ListQuery = class extends BaseListQuery {
1941
1941
  batch.changes.registerList(this.cacheKey);
1942
1942
  }
1943
1943
  constructor(store, subject, apiName, cacheKey, opts) {
1944
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
1944
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkHJV24UL2_cjs.additionalContext].logger?.child({}, {
1945
1945
  msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
1946
1946
  }) : void 0);
1947
1947
  this.apiName = apiName;
@@ -2207,7 +2207,7 @@ var InterfaceListQuery = class extends ListQuery {
2207
2207
  }
2208
2208
  extractRelevantObjects(changes) {
2209
2209
  const matchesApiName = ([, object]) => {
2210
- return this.apiName in object[chunk4ZOXOCQX_cjs.ObjectDefRef].interfaceMap;
2210
+ return this.apiName in object[chunkPCNVSZXT_cjs.ObjectDefRef].interfaceMap;
2211
2211
  };
2212
2212
  const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
2213
2213
  const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
@@ -2228,7 +2228,7 @@ var InterfaceListQuery = class extends ListQuery {
2228
2228
  async function reloadDataAsFullObjects(client, data) {
2229
2229
  const groups = groupBy__default.default(data, (x) => x.$objectType);
2230
2230
  const objectTypeToPrimaryKeyToObject = Object.fromEntries(await Promise.all(Object.entries(groups).map(async ([apiName, objects]) => {
2231
- const objectDef = objects[0][chunk4ZOXOCQX_cjs.UnderlyingOsdkObject][chunk4ZOXOCQX_cjs.ObjectDefRef];
2231
+ const objectDef = objects[0][chunkPCNVSZXT_cjs.UnderlyingOsdkObject][chunkPCNVSZXT_cjs.ObjectDefRef];
2232
2232
  const where = {
2233
2233
  [objectDef.primaryKeyApiName]: {
2234
2234
  $in: objects.map((x) => x.$primaryKey)
@@ -2520,7 +2520,7 @@ var BulkObjectLoader = class {
2520
2520
  #maxEntries;
2521
2521
  constructor(client, maxWait = 25, maxEntries = 100) {
2522
2522
  this.#client = client;
2523
- this.#logger = client[chunk3LMKH6RS_cjs.additionalContext].logger;
2523
+ this.#logger = client[chunkHJV24UL2_cjs.additionalContext].logger;
2524
2524
  this.#maxWait = maxWait;
2525
2525
  this.#maxEntries = maxEntries;
2526
2526
  }
@@ -2588,7 +2588,7 @@ var ObjectQuery = class extends Query {
2588
2588
  #apiName;
2589
2589
  #pk;
2590
2590
  constructor(store, subject, type, pk, cacheKey, opts) {
2591
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
2591
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkHJV24UL2_cjs.additionalContext].logger?.child({}, {
2592
2592
  msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
2593
2593
  }) : void 0);
2594
2594
  this.#apiName = type;
@@ -2732,7 +2732,7 @@ var ObjectSetQuery = class extends BaseListQuery {
2732
2732
  #composedObjectSet;
2733
2733
  #objectTypes;
2734
2734
  constructor(store, subject, baseObjectSetWire, operations, cacheKey, opts) {
2735
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
2735
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkHJV24UL2_cjs.additionalContext].logger?.child({}, {
2736
2736
  msgPrefix: `ObjectSetQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
2737
2737
  }) : void 0);
2738
2738
  this.#baseObjectSetWire = baseObjectSetWire;
@@ -2775,7 +2775,7 @@ var ObjectSetQuery = class extends BaseListQuery {
2775
2775
  }
2776
2776
  if (opts.union) {
2777
2777
  for (const os of opts.union) {
2778
- const wire = chunk3LMKH6RS_cjs.getWireObjectSet(os);
2778
+ const wire = chunkHJV24UL2_cjs.getWireObjectSet(os);
2779
2779
  if (wire.type) {
2780
2780
  types.add(wire.type);
2781
2781
  }
@@ -2783,7 +2783,7 @@ var ObjectSetQuery = class extends BaseListQuery {
2783
2783
  }
2784
2784
  if (opts.intersect) {
2785
2785
  for (const os of opts.intersect) {
2786
- const wire = chunk3LMKH6RS_cjs.getWireObjectSet(os);
2786
+ const wire = chunkHJV24UL2_cjs.getWireObjectSet(os);
2787
2787
  if (wire.type) {
2788
2788
  types.add(wire.type);
2789
2789
  }
@@ -2791,7 +2791,7 @@ var ObjectSetQuery = class extends BaseListQuery {
2791
2791
  }
2792
2792
  if (opts.subtract) {
2793
2793
  for (const os of opts.subtract) {
2794
- const wire = chunk3LMKH6RS_cjs.getWireObjectSet(os);
2794
+ const wire = chunkHJV24UL2_cjs.getWireObjectSet(os);
2795
2795
  if (wire.type) {
2796
2796
  types.add(wire.type);
2797
2797
  }
@@ -2872,7 +2872,7 @@ var ObjectSetHelper = class extends AbstractHelper {
2872
2872
  const {
2873
2873
  baseObjectSet
2874
2874
  } = options;
2875
- const baseObjectSetWire = JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(baseObjectSet));
2875
+ const baseObjectSetWire = JSON.stringify(chunkHJV24UL2_cjs.getWireObjectSet(baseObjectSet));
2876
2876
  const operations = this.buildCanonicalizedOperations(options);
2877
2877
  const objectSetCacheKey = this.cacheKeys.get("objectSet", baseObjectSetWire, operations);
2878
2878
  return this.store.queries.get(objectSetCacheKey, () => {
@@ -2888,13 +2888,13 @@ var ObjectSetHelper = class extends AbstractHelper {
2888
2888
  operations.withProperties = Object.keys(options.withProperties).sort();
2889
2889
  }
2890
2890
  if (options.union && options.union.length > 0) {
2891
- operations.union = options.union.map((os) => JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(os)));
2891
+ operations.union = options.union.map((os) => JSON.stringify(chunkHJV24UL2_cjs.getWireObjectSet(os)));
2892
2892
  }
2893
2893
  if (options.intersect && options.intersect.length > 0) {
2894
- operations.intersect = options.intersect.map((os) => JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(os)));
2894
+ operations.intersect = options.intersect.map((os) => JSON.stringify(chunkHJV24UL2_cjs.getWireObjectSet(os)));
2895
2895
  }
2896
2896
  if (options.subtract && options.subtract.length > 0) {
2897
- operations.subtract = options.subtract.map((os) => JSON.stringify(chunk3LMKH6RS_cjs.getWireObjectSet(os)));
2897
+ operations.subtract = options.subtract.map((os) => JSON.stringify(chunkHJV24UL2_cjs.getWireObjectSet(os)));
2898
2898
  }
2899
2899
  if (options.pivotTo) {
2900
2900
  operations.pivotTo = options.pivotTo;
@@ -2971,7 +2971,7 @@ var RdpCanonicalizer = class extends CachingCanonicalizer {
2971
2971
  apiName: "__rdp_canonicalizer_holder__"
2972
2972
  };
2973
2973
  for (const [key, rdpFunction] of Object.entries(rdp)) {
2974
- const builder = chunk3LMKH6RS_cjs.createWithPropertiesObjectSet(
2974
+ const builder = chunkHJV24UL2_cjs.createWithPropertiesObjectSet(
2975
2975
  objectTypeHolder,
2976
2976
  {
2977
2977
  type: "methodInput"
@@ -3020,7 +3020,7 @@ var Store = class {
3020
3020
  subjects = this.layers.subjects;
3021
3021
  // these are hopefully temporary
3022
3022
  constructor(client) {
3023
- this.logger = client[chunk3LMKH6RS_cjs.additionalContext].logger?.child({}, {
3023
+ this.logger = client[chunkHJV24UL2_cjs.additionalContext].logger?.child({}, {
3024
3024
  msgPrefix: "Store"
3025
3025
  });
3026
3026
  this.client = client;
@@ -3281,10 +3281,10 @@ var Store = class {
3281
3281
 
3282
3282
  // src/observable/ObservableClient.ts
3283
3283
  function createObservableClient(client) {
3284
- const tweakedClient = chunk4ZOXOCQX_cjs.createClientFromContext({
3285
- ...client[chunk3LMKH6RS_cjs.additionalContext],
3286
- fetch: shared_net_fetch.createFetchHeaderMutator(client[chunk3LMKH6RS_cjs.additionalContext].fetch, (headers) => {
3287
- headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunk4ZOXOCQX_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
3284
+ const tweakedClient = chunkPCNVSZXT_cjs.createClientFromContext({
3285
+ ...client[chunkHJV24UL2_cjs.additionalContext],
3286
+ fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkHJV24UL2_cjs.additionalContext].fetch, (headers) => {
3287
+ headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunkPCNVSZXT_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
3288
3288
  return headers;
3289
3289
  })
3290
3290
  });
@@ -3327,11 +3327,11 @@ function getOsdkConfig(ontologyRid) {
3327
3327
 
3328
3328
  Object.defineProperty(exports, "createClientWithTransaction", {
3329
3329
  enumerable: true,
3330
- get: function () { return chunk4ZOXOCQX_cjs.createClientWithTransaction; }
3330
+ get: function () { return chunkPCNVSZXT_cjs.createClientWithTransaction; }
3331
3331
  });
3332
3332
  Object.defineProperty(exports, "augment", {
3333
3333
  enumerable: true,
3334
- get: function () { return chunk3LMKH6RS_cjs.augment; }
3334
+ get: function () { return chunkHJV24UL2_cjs.augment; }
3335
3335
  });
3336
3336
  exports.computeObjectSetCacheKey = computeObjectSetCacheKey;
3337
3337
  exports.createObservableClient = createObservableClient;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isOk","NULL_VALUE","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk, NULL_VALUE } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,EAAEC,UAAU,QAAQ,WAAW;AAuC5C,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B;AAErC,SACEC,mCAAmC,EACnCC,oCAAoC,QAC/B,gCAAgC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["isOk","NULL_VALUE","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC","createObjectSpecifierFromPrimaryKey","extractPrimaryKeyFromObjectSpecifier"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { isOk, NULL_VALUE } from \"@osdk/api\";\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n DerivedProperty,\n InterfaceDefinition,\n InterfaceMetadata,\n Logger,\n MediaReference,\n MediaUpload,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n\nexport {\n createObjectSpecifierFromPrimaryKey,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./util/objectSpecifierUtils.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,IAAI,EAAEC,UAAU,QAAQ,WAAW;AAyC5C,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B;AAErC,SACEC,mCAAmC,EACnCC,oCAAoC,QAC/B,gCAAgC","ignoreList":[]}
@@ -93,6 +93,8 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
93
93
  // e.g. `where({ name: { $eq: "foo", $ne: "bar" } })` is invalid currently
94
94
  const hasDollarSign = keysOfFilter.some(key => key.startsWith("$"));
95
95
  !(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.") : invariant(false) : void 0;
96
+
97
+ // Struct
96
98
  if (!hasDollarSign) {
97
99
  const structFilter = Object.entries(filter);
98
100
  !(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot filter on more than one struct field in the same clause, need to use an and clause") : invariant(false) : void 0;
@@ -104,6 +106,17 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
104
106
  }
105
107
  const firstKey = keysOfFilter[0];
106
108
  !(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
109
+
110
+ // Struct array
111
+ if (firstKey === "$contains" && filter[firstKey] instanceof Object) {
112
+ const structFilter = Object.entries(filter[firstKey]);
113
+ !(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot filter on more than one struct field in the same clause, need to use an and clause") : invariant(false) : void 0;
114
+ const structFieldApiName = structFilter[0][0];
115
+ return handleWherePair(structFilter[0], objectOrInterface, {
116
+ propertyApiName: fieldName,
117
+ structFieldApiName
118
+ });
119
+ }
107
120
  if (firstKey === "$ne") {
108
121
  return {
109
122
  type: "not",
@@ -134,21 +147,6 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
134
147
  fuzzy: typeof filter[firstKey] === "string" ? false : filter[firstKey]["fuzzySearch"] ?? false
135
148
  };
136
149
  }
137
- if (firstKey === "$contains" && filter[firstKey] instanceof Object) {
138
- const structFilter = Object.entries(filter[firstKey]);
139
- !(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot filter on more than one struct field in the same clause, need to use an and clause") : invariant(false) : void 0;
140
- const structFieldApiName = structFilter[0][0];
141
- !(structFilter[0][1] != null && Object.keys(structFilter[0][1]).length === 1 && "$eq" in structFilter[0][1]) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot filter on a struct field in an array with anything other than a single $eq") : invariant(false) : void 0;
142
- return {
143
- type: "contains",
144
- propertyIdentifier: {
145
- type: "structField",
146
- propertyApiName: fieldName,
147
- structFieldApiName
148
- },
149
- value: structFilter[0][1]["$eq"]
150
- };
151
- }
152
150
  return {
153
151
  type: firstKey.substring(1),
154
152
  ...(propertyIdentifier != null && {
@@ -1 +1 @@
1
- {"version":3,"file":"modernToLegacyWhereClause.js","names":["invariant","fullyQualifyPropName","makeGeoFilterIntersects","makeGeoFilterWithin","isAndClause","whereClause","$and","undefined","isOrClause","$or","isNotClause","$not","modernToLegacyWhereClause","objectOrInterface","rdpNames","parts","Object","entries","map","key","value","length","modernToLegacyWhereClauseInner","type","v","process","env","NODE_ENV","clause","handleWherePair","fieldName","filter","structFieldSelector","isRdp","has","propertyIdentifier","apiName","propertyApiName","field","keysOfFilter","keys","hasDollarSign","some","startsWith","structFilter","structFieldApiName","firstKey","substring","fuzzy"],"sources":["modernToLegacyWhereClause.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 AndWhereClause,\n NotWhereClause,\n ObjectOrInterfaceDefinition,\n OrWhereClause,\n PossibleWhereClauseFilters,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\n\nimport type {\n PropertyIdentifier,\n SearchJsonQueryV2,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { fullyQualifyPropName } from \"./fullyQualifyPropName.js\";\nimport { makeGeoFilterIntersects } from \"./makeGeoFilterIntersects.js\";\nimport { makeGeoFilterWithin } from \"./makeGeoFilterWithin.js\";\n\ntype DropDollarSign<T extends `$${string}`> = T extends `$${infer U}` ? U\n : never;\n\nfunction isAndClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is AndWhereClause<T, RDPs> {\n return \"$and\" in whereClause && whereClause.$and !== undefined;\n}\n\nfunction isOrClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is OrWhereClause<T, RDPs> {\n return \"$or\" in whereClause && whereClause.$or !== undefined;\n}\n\nfunction isNotClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is NotWhereClause<T, RDPs> {\n return \"$not\" in whereClause && whereClause.$not !== undefined;\n}\n\n/** @internal */\nexport function modernToLegacyWhereClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause).map(([key, value]) => ({\n [key]: value,\n })) as WhereClause<T, RDPs>[];\n if (parts.length === 1) {\n return modernToLegacyWhereClauseInner(\n whereClause,\n objectOrInterface,\n rdpNames,\n );\n }\n return {\n type: \"and\",\n value: parts.map<SearchJsonQueryV2>(\n v => modernToLegacyWhereClauseInner(v, objectOrInterface, rdpNames),\n ),\n };\n}\n\n/** @internal */\nexport function modernToLegacyWhereClauseInner<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause);\n\n invariant(parts.length === 1, \"Invalid where clause provided.\");\n\n if (isAndClause(whereClause)) {\n return {\n type: \"and\",\n value: (whereClause.$and as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isOrClause(whereClause)) {\n return {\n type: \"or\",\n value: (whereClause.$or as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isNotClause(whereClause)) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(\n whereClause.$not as WhereClause<T, RDPs>,\n objectOrInterface,\n rdpNames,\n ),\n };\n }\n\n return handleWherePair(parts[0], objectOrInterface, undefined, rdpNames);\n}\n\nfunction handleWherePair(\n [fieldName, filter]: [string, any],\n objectOrInterface: ObjectOrInterfaceDefinition,\n structFieldSelector?: { propertyApiName: string; structFieldApiName: string },\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n invariant(\n filter != null,\n \"Defined key values are only allowed when they are not undefined.\",\n );\n\n const isRdp = !structFieldSelector && rdpNames?.has(fieldName);\n\n const propertyIdentifier: PropertyIdentifier | undefined = isRdp\n ? {\n type: \"property\",\n apiName: fieldName,\n }\n : structFieldSelector != null\n ? {\n type: \"structField\",\n ...structFieldSelector,\n propertyApiName: fullyQualifyPropName(\n structFieldSelector.propertyApiName,\n objectOrInterface,\n ),\n }\n : undefined;\n\n const field = !isRdp && structFieldSelector == null\n ? fullyQualifyPropName(fieldName, objectOrInterface)\n : undefined;\n\n invariant(\n field == null\n || propertyIdentifier == null && (field != null || isRdp != null),\n \"Encountered error constructing where clause: field and propertyIdentifier cannot both be defined\",\n );\n\n if (\n typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\"\n ) {\n return {\n type: \"eq\",\n ...(propertyIdentifier != null\n && { propertyIdentifier }),\n field,\n value: filter,\n };\n }\n\n const keysOfFilter = Object.keys(filter);\n\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(\n !hasDollarSign\n || keysOfFilter.length === 1,\n \"A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.\",\n );\n\n if (!hasDollarSign) {\n const structFilter = Object.entries(filter);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = keysOfFilter[0];\n return handleWherePair(Object.entries(filter)[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n }, rdpNames);\n }\n\n const firstKey = keysOfFilter[0] as PossibleWhereClauseFilters;\n invariant(filter[firstKey] != null);\n\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey],\n },\n };\n }\n\n if (firstKey === \"$within\") {\n return makeGeoFilterWithin(filter[firstKey], propertyIdentifier, field);\n }\n if (firstKey === \"$intersects\") {\n return makeGeoFilterIntersects(filter[firstKey], propertyIdentifier, field);\n }\n\n if (firstKey === \"$containsAllTerms\" || firstKey === \"$containsAnyTerm\") {\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: typeof filter[firstKey] === \"string\"\n ? filter[firstKey]\n : filter[firstKey][\"term\"],\n fuzzy: typeof filter[firstKey] === \"string\"\n ? false\n : filter[firstKey][\"fuzzySearch\"] ?? false,\n };\n }\n\n if (firstKey === \"$contains\" && filter[firstKey] instanceof Object) {\n const structFilter: [string, any][] = Object.entries(filter[firstKey]);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = structFilter[0][0];\n invariant(\n structFilter[0][1] != null\n && Object.keys(structFilter[0][1]).length === 1\n && \"$eq\" in structFilter[0][1],\n \"Cannot filter on a struct field in an array with anything other than a single $eq\",\n );\n return {\n type: \"contains\",\n propertyIdentifier: {\n type: \"structField\",\n propertyApiName: fieldName,\n structFieldApiName,\n },\n value: structFilter[0][1][\"$eq\"],\n };\n }\n\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey] as any,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,mBAAmB,QAAQ,0BAA0B;AAK9D,SAASC,WAAWA,CAIlBC,WAAiC,EACO;EACxC,OAAO,MAAM,IAAIA,WAAW,IAAIA,WAAW,CAACC,IAAI,KAAKC,SAAS;AAChE;AAEA,SAASC,UAAUA,CAIjBH,WAAiC,EACM;EACvC,OAAO,KAAK,IAAIA,WAAW,IAAIA,WAAW,CAACI,GAAG,KAAKF,SAAS;AAC9D;AAEA,SAASG,WAAWA,CAIlBL,WAAiC,EACO;EACxC,OAAO,MAAM,IAAIA,WAAW,IAAIA,WAAW,CAACM,IAAI,KAAKJ,SAAS;AAChE;;AAEA;AACA,O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,CAAC,CAAC;IACtE,EACEF,YAAY,CAACvB,MAAM,KAAK,CAAC,IAAAI,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD3B3B,SAAS,QAEP,2FAA2F,IAF7FA,SAAS;IAIT,MAAM6C,kBAAkB,GAAGD,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,EACEA,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,IACrB5B,MAAM,CAACwB,IAAI,CAACI,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAACvB,MAAM,KAAK,CAAC,IAC5C,KAAK,IAAIuB,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAAnB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAHlC3B,SAAS,QAIP,mFAAmF,IAJrFA,SAAS;IAMT,OAAO;MACLuB,IAAI,EAAE,UAAU;MAChBY,kBAAkB,EAAE;QAClBZ,IAAI,EAAE,aAAa;QACnBc,eAAe,EAAEP,SAAS;QAC1Be;MACF,CAAC;MACDzB,KAAK,EAAEwB,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;IACjC,CAAC;EACH;EAEA,OAAO;IACLrB,IAAI,EAAEuB,QAAQ,CAACC,SAAS,CAAC,CAAC,CAAoC;IAC9D,IAAIZ,kBAAkB,IAAI,IAAI,IAAI;MAAEA;IAAmB,CAAC,CAAC;IACzDG,KAAK;IACLlB,KAAK,EAAEW,MAAM,CAACe,QAAQ;EACxB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"modernToLegacyWhereClause.js","names":["invariant","fullyQualifyPropName","makeGeoFilterIntersects","makeGeoFilterWithin","isAndClause","whereClause","$and","undefined","isOrClause","$or","isNotClause","$not","modernToLegacyWhereClause","objectOrInterface","rdpNames","parts","Object","entries","map","key","value","length","modernToLegacyWhereClauseInner","type","v","process","env","NODE_ENV","clause","handleWherePair","fieldName","filter","structFieldSelector","isRdp","has","propertyIdentifier","apiName","propertyApiName","field","keysOfFilter","keys","hasDollarSign","some","startsWith","structFilter","structFieldApiName","firstKey","substring","fuzzy"],"sources":["modernToLegacyWhereClause.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 AndWhereClause,\n NotWhereClause,\n ObjectOrInterfaceDefinition,\n OrWhereClause,\n PossibleWhereClauseFilters,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\n\nimport type {\n PropertyIdentifier,\n SearchJsonQueryV2,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { fullyQualifyPropName } from \"./fullyQualifyPropName.js\";\nimport { makeGeoFilterIntersects } from \"./makeGeoFilterIntersects.js\";\nimport { makeGeoFilterWithin } from \"./makeGeoFilterWithin.js\";\n\ntype DropDollarSign<T extends `$${string}`> = T extends `$${infer U}` ? U\n : never;\n\nfunction isAndClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is AndWhereClause<T, RDPs> {\n return \"$and\" in whereClause && whereClause.$and !== undefined;\n}\n\nfunction isOrClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is OrWhereClause<T, RDPs> {\n return \"$or\" in whereClause && whereClause.$or !== undefined;\n}\n\nfunction isNotClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is NotWhereClause<T, RDPs> {\n return \"$not\" in whereClause && whereClause.$not !== undefined;\n}\n\n/** @internal */\nexport function modernToLegacyWhereClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause).map(([key, value]) => ({\n [key]: value,\n })) as WhereClause<T, RDPs>[];\n if (parts.length === 1) {\n return modernToLegacyWhereClauseInner(\n whereClause,\n objectOrInterface,\n rdpNames,\n );\n }\n return {\n type: \"and\",\n value: parts.map<SearchJsonQueryV2>(\n v => modernToLegacyWhereClauseInner(v, objectOrInterface, rdpNames),\n ),\n };\n}\n\n/** @internal */\nexport function modernToLegacyWhereClauseInner<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause);\n\n invariant(parts.length === 1, \"Invalid where clause provided.\");\n\n if (isAndClause(whereClause)) {\n return {\n type: \"and\",\n value: (whereClause.$and as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isOrClause(whereClause)) {\n return {\n type: \"or\",\n value: (whereClause.$or as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isNotClause(whereClause)) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(\n whereClause.$not as WhereClause<T, RDPs>,\n objectOrInterface,\n rdpNames,\n ),\n };\n }\n\n return handleWherePair(parts[0], objectOrInterface, undefined, rdpNames);\n}\n\nfunction handleWherePair(\n [fieldName, filter]: [string, any],\n objectOrInterface: ObjectOrInterfaceDefinition,\n structFieldSelector?: { propertyApiName: string; structFieldApiName: string },\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n invariant(\n filter != null,\n \"Defined key values are only allowed when they are not undefined.\",\n );\n\n const isRdp = !structFieldSelector && rdpNames?.has(fieldName);\n\n const propertyIdentifier: PropertyIdentifier | undefined = isRdp\n ? {\n type: \"property\",\n apiName: fieldName,\n }\n : structFieldSelector != null\n ? {\n type: \"structField\",\n ...structFieldSelector,\n propertyApiName: fullyQualifyPropName(\n structFieldSelector.propertyApiName,\n objectOrInterface,\n ),\n }\n : undefined;\n\n const field = !isRdp && structFieldSelector == null\n ? fullyQualifyPropName(fieldName, objectOrInterface)\n : undefined;\n\n invariant(\n field == null\n || propertyIdentifier == null && (field != null || isRdp != null),\n \"Encountered error constructing where clause: field and propertyIdentifier cannot both be defined\",\n );\n\n if (\n typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\"\n ) {\n return {\n type: \"eq\",\n ...(propertyIdentifier != null\n && { propertyIdentifier }),\n field,\n value: filter,\n };\n }\n\n const keysOfFilter = Object.keys(filter);\n\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(\n !hasDollarSign\n || keysOfFilter.length === 1,\n \"A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.\",\n );\n\n // Struct\n if (!hasDollarSign) {\n const structFilter = Object.entries(filter);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = keysOfFilter[0];\n return handleWherePair(Object.entries(filter)[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n }, rdpNames);\n }\n\n const firstKey = keysOfFilter[0] as PossibleWhereClauseFilters;\n invariant(filter[firstKey] != null);\n\n // Struct array\n if (firstKey === \"$contains\" && filter[firstKey] instanceof Object) {\n const structFilter: [string, any][] = Object.entries(filter[firstKey]);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = structFilter[0][0];\n\n return handleWherePair(structFilter[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n });\n }\n\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey],\n },\n };\n }\n\n if (firstKey === \"$within\") {\n return makeGeoFilterWithin(filter[firstKey], propertyIdentifier, field);\n }\n if (firstKey === \"$intersects\") {\n return makeGeoFilterIntersects(filter[firstKey], propertyIdentifier, field);\n }\n\n if (firstKey === \"$containsAllTerms\" || firstKey === \"$containsAnyTerm\") {\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: typeof filter[firstKey] === \"string\"\n ? filter[firstKey]\n : filter[firstKey][\"term\"],\n fuzzy: typeof filter[firstKey] === \"string\"\n ? false\n : filter[firstKey][\"fuzzySearch\"] ?? false,\n };\n }\n\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey] as any,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,mBAAmB,QAAQ,0BAA0B;AAK9D,SAASC,WAAWA,CAIlBC,WAAiC,EACO;EACxC,OAAO,MAAM,IAAIA,WAAW,IAAIA,WAAW,CAACC,IAAI,KAAKC,SAAS;AAChE;AAEA,SAASC,UAAUA,CA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AACe,QAAQ,CAAC,EAAEX,kBAAkB,EAAEG,KAAK,CAAC;EAC7E;EAEA,IAAIQ,QAAQ,KAAK,mBAAmB,IAAIA,QAAQ,KAAK,kBAAkB,EAAE;IACvE,OAAO;MACLvB,IAAI,EAAEuB,QAAQ,CAACC,SAAS,CAAC,CAAC,CAAoC;MAC9D,IAAIZ,kBAAkB,IAAI,IAAI,IAAI;QAAEA;MAAmB,CAAC,CAAC;MACzDG,KAAK;MACLlB,KAAK,EAAE,OAAOW,MAAM,CAACe,QAAQ,CAAC,KAAK,QAAQ,GACvCf,MAAM,CAACe,QAAQ,CAAC,GAChBf,MAAM,CAACe,QAAQ,CAAC,CAAC,MAAM,CAAC;MAC5BE,KAAK,EAAE,OAAOjB,MAAM,CAACe,QAAQ,CAAC,KAAK,QAAQ,GACvC,KAAK,GACLf,MAAM,CAACe,QAAQ,CAAC,CAAC,aAAa,CAAC,IAAI;IACzC,CAAC;EACH;EAEA,OAAO;IACLvB,IAAI,EAAEuB,QAAQ,CAACC,SAAS,CAAC,CAAC,CAAoC;IAC9D,IAAIZ,kBAAkB,IAAI,IAAI,IAAI;MAAEA;IAAmB,CAAC,CAAC;IACzDG,KAAK;IACLlB,KAAK,EAAEW,MAAM,CAACe,QAAQ;EACxB,CAAC;AACH","ignoreList":[]}
@@ -907,6 +907,68 @@ describe(modernToLegacyWhereClause, () => {
907
907
  }
908
908
  `);
909
909
  });
910
+ it("converts struct arrays correctly", () => {
911
+ expect(modernToLegacyWhereClause({
912
+ $and: [{
913
+ addressArray: {
914
+ $contains: {
915
+ zipCode: {
916
+ $gte: 10001
917
+ }
918
+ }
919
+ }
920
+ }, {
921
+ addressArray: {
922
+ $contains: {
923
+ location: {
924
+ $within: [1, 2, 3, 4]
925
+ }
926
+ }
927
+ }
928
+ }]
929
+ }, BgaoNflPlayer)).toMatchInlineSnapshot(`
930
+ {
931
+ "type": "and",
932
+ "value": [
933
+ {
934
+ "field": undefined,
935
+ "propertyIdentifier": {
936
+ "propertyApiName": "addressArray",
937
+ "structFieldApiName": "zipCode",
938
+ "type": "structField",
939
+ },
940
+ "type": "gte",
941
+ "value": 10001,
942
+ },
943
+ {
944
+ "field": undefined,
945
+ "propertyIdentifier": {
946
+ "propertyApiName": "addressArray",
947
+ "structFieldApiName": "location",
948
+ "type": "structField",
949
+ },
950
+ "type": "withinBoundingBox",
951
+ "value": {
952
+ "bottomRight": {
953
+ "coordinates": [
954
+ 3,
955
+ 2,
956
+ ],
957
+ "type": "Point",
958
+ },
959
+ "topLeft": {
960
+ "coordinates": [
961
+ 1,
962
+ 4,
963
+ ],
964
+ "type": "Point",
965
+ },
966
+ },
967
+ },
968
+ ],
969
+ }
970
+ `);
971
+ });
910
972
  });
911
973
  describe("multiple checks", () => {
912
974
  it("properly handles multiple simple where checks", () => {