@salesforce/lds-worker-api 1.136.6 → 1.136.7

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.
@@ -26,7 +26,7 @@
26
26
  SnapshotState["Stale"] = "Stale";
27
27
  })(SnapshotState$3 || (SnapshotState$3 = {}));
28
28
 
29
- const { create: create$a, entries: entries$4, freeze: freeze$5, keys: keys$a, values: values$3 } = Object;
29
+ const { create: create$a, entries: entries$4, freeze: freeze$5, keys: keys$b, values: values$3 } = Object;
30
30
  const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
31
31
  const { isArray: isArray$9 } = Array;
32
32
  const { push: push$4, indexOf, slice: slice$2 } = Array.prototype;
@@ -43,7 +43,7 @@
43
43
  }
44
44
  }
45
45
  else {
46
- const keys$1 = keys$a(value);
46
+ const keys$1 = keys$b(value);
47
47
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
48
48
  deepFreeze(value[keys$1[i]]);
49
49
  }
@@ -304,7 +304,7 @@
304
304
  if (node === null) {
305
305
  return 'null';
306
306
  }
307
- const keys$1 = keys$a(node).sort();
307
+ const keys$1 = keys$b(node).sort();
308
308
  out = '';
309
309
  for (i = 0; i < keys$1.length; i++) {
310
310
  const key = keys$1[i];
@@ -575,13 +575,13 @@
575
575
  return this.records[this.getCanonicalRecordId(key)];
576
576
  }
577
577
  getNumEntries() {
578
- return keys$a(this.records).length;
578
+ return keys$b(this.records).length;
579
579
  }
580
580
  readMetadata(key) {
581
581
  return this.metadata[this.getCanonicalRecordId(key)];
582
582
  }
583
583
  readMetadataWhere(query) {
584
- const keys$1 = keys$a(this.metadata);
584
+ const keys$1 = keys$b(this.metadata);
585
585
  const results = [];
586
586
  const hasNamespaceQuery = hasOwnProperty$3.call(query, 'namespace');
587
587
  const hasRepresentationNameQuery = hasOwnProperty$3.call(query, 'representationName');
@@ -677,8 +677,8 @@
677
677
  // Note: we should always get the subscription references from this at the beginning
678
678
  // of the function, in case the reference changes (because of an unsubscribe)
679
679
  const { snapshotSubscriptions, watchSubscriptions, visitedIds, refreshedIds, insertedIds } = this;
680
- const allVisitedIds = keys$a(visitedIds);
681
- const allRefreshedIds = keys$a(refreshedIds);
680
+ const allVisitedIds = keys$b(visitedIds);
681
+ const allRefreshedIds = keys$b(refreshedIds);
682
682
  // Early exit if nothing has changed
683
683
  if (allVisitedIds.length === 0 && allRefreshedIds.length === 0) {
684
684
  return Promise.resolve();
@@ -1125,7 +1125,7 @@
1125
1125
  hasOverlappingIds(snapshot, visitedIds) === false);
1126
1126
  }
1127
1127
  function getMatchingIds(partialKey, visitedIds) {
1128
- const keys$1 = keys$a(partialKey);
1128
+ const keys$1 = keys$b(partialKey);
1129
1129
  return visitedIds.filter((visitedId) => {
1130
1130
  return keys$1.every((key) => {
1131
1131
  return partialKey[key] === visitedId[key];
@@ -1752,8 +1752,8 @@
1752
1752
  } while (redirectKey !== undefined);
1753
1753
  }
1754
1754
  isUsingStringKeys() {
1755
- return (keys$a(this.fallbackStringKeyInMemoryStore.visitedIds).length !== 0 ||
1756
- keys$a(this.fallbackStringKeyInMemoryStore.refreshedIds).length !== 0);
1755
+ return (keys$b(this.fallbackStringKeyInMemoryStore.visitedIds).length !== 0 ||
1756
+ keys$b(this.fallbackStringKeyInMemoryStore.refreshedIds).length !== 0);
1757
1757
  }
1758
1758
  delegateToFallbackStringKeyStore(snapshot) {
1759
1759
  return !isErrorSnapshot$3(snapshot) && typeof snapshot.recordId === 'string';
@@ -1795,7 +1795,7 @@
1795
1795
  buildKeySchema(keyMetadata) {
1796
1796
  // pull NamespacedType type out of NormalizedKeyMetadata
1797
1797
  const { namespace: _ns, representationName: _rn, ...keyParamValues } = keyMetadata;
1798
- const keySchema = keys$a(keyParamValues).sort();
1798
+ const keySchema = keys$b(keyParamValues).sort();
1799
1799
  return ['namespace', 'representationName', ...keySchema];
1800
1800
  }
1801
1801
  }
@@ -2083,7 +2083,7 @@
2083
2083
  return value;
2084
2084
  }
2085
2085
  keys() {
2086
- return keys$a(this.data);
2086
+ return keys$b(this.data);
2087
2087
  }
2088
2088
  isScalar(propertyName) {
2089
2089
  // TODO W-6900046 - merge.ts casts these to any and manually sets `data`
@@ -2462,7 +2462,7 @@
2462
2462
  }
2463
2463
  }
2464
2464
  selectAllObject(record, data, visitedKeys) {
2465
- const recordKeys = keys$a(record);
2465
+ const recordKeys = keys$b(record);
2466
2466
  const { length } = recordKeys;
2467
2467
  for (let i = 0; i < length; i += 1) {
2468
2468
  const key = recordKeys[i];
@@ -2643,7 +2643,7 @@
2643
2643
  }
2644
2644
  const { baseSnapshotValue } = this.currentPath;
2645
2645
  if (isDefined$1(baseSnapshotValue)) {
2646
- this.snapshotChanged = keys$1.length !== keys$a(baseSnapshotValue).length;
2646
+ this.snapshotChanged = keys$1.length !== keys$b(baseSnapshotValue).length;
2647
2647
  }
2648
2648
  }
2649
2649
  checkIfChanged(value) {
@@ -2681,7 +2681,7 @@
2681
2681
  return this.markMissing();
2682
2682
  }
2683
2683
  const sink = (data[propertyName] = {});
2684
- const keys$1 = keys$a(obj);
2684
+ const keys$1 = keys$b(obj);
2685
2685
  this.checkIfObjectKeysLengthChanged(keys$1);
2686
2686
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
2687
2687
  const key = keys$1[i];
@@ -2692,7 +2692,7 @@
2692
2692
  }
2693
2693
  readLinkMap(propertyName, selection, record, data) {
2694
2694
  const map = record[propertyName];
2695
- const keys$1 = keys$a(map);
2695
+ const keys$1 = keys$b(map);
2696
2696
  const sink = {};
2697
2697
  this.checkIfObjectKeysLengthChanged(keys$1);
2698
2698
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
@@ -2820,7 +2820,7 @@
2820
2820
  return;
2821
2821
  }
2822
2822
  const sink = (data[propertyName] = {});
2823
- const keys$1 = keys$a(obj);
2823
+ const keys$1 = keys$b(obj);
2824
2824
  this.checkIfObjectKeysLengthChanged(keys$1);
2825
2825
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
2826
2826
  const key = keys$1[i];
@@ -3503,13 +3503,13 @@
3503
3503
  // undefined values on the injected networkAdapter. So we do it here, on
3504
3504
  // the API that those adapters call to dispatch their ResourceRequests.
3505
3505
  const { queryParams, urlParams } = mergedResourceRequest;
3506
- for (const paramKey of keys$a(queryParams)) {
3506
+ for (const paramKey of keys$b(queryParams)) {
3507
3507
  const value = queryParams[paramKey];
3508
3508
  if (value === undefined) {
3509
3509
  delete queryParams[paramKey];
3510
3510
  }
3511
3511
  }
3512
- for (const paramKey of keys$a(urlParams)) {
3512
+ for (const paramKey of keys$b(urlParams)) {
3513
3513
  const value = urlParams[paramKey];
3514
3514
  if (value === undefined) {
3515
3515
  delete urlParams[paramKey];
@@ -3803,7 +3803,7 @@
3803
3803
  }
3804
3804
  callbacks.push(callback);
3805
3805
  }
3806
- // version: 1.136.6-0f5ec3ee7
3806
+ // version: 1.136.7-777657471
3807
3807
 
3808
3808
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3809
3809
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15227,7 +15227,7 @@
15227
15227
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15228
15228
  return luvioDocumentNode;
15229
15229
  }
15230
- // version: 1.136.6-0f5ec3ee7
15230
+ // version: 1.136.7-777657471
15231
15231
 
15232
15232
  function unwrap(data) {
15233
15233
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16140,7 +16140,7 @@
16140
16140
  const { apiFamily, name } = metadata;
16141
16141
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16142
16142
  }
16143
- // version: 1.136.6-0f5ec3ee7
16143
+ // version: 1.136.7-777657471
16144
16144
 
16145
16145
  /**
16146
16146
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16227,7 +16227,7 @@
16227
16227
 
16228
16228
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16229
16229
 
16230
- const { assign: assign$7, create: create$8, freeze: freeze$4, keys: keys$9 } = Object;
16230
+ const { assign: assign$7, create: create$8, freeze: freeze$4, keys: keys$a } = Object;
16231
16231
 
16232
16232
  ObjectCreate$3(null);
16233
16233
 
@@ -17065,7 +17065,7 @@
17065
17065
  return rootKeySet;
17066
17066
  }
17067
17067
 
17068
- const { assign: assign$6, create: create$7, freeze: freeze$3, keys: keys$8 } = Object;
17068
+ const { assign: assign$6, create: create$7, freeze: freeze$3, keys: keys$9 } = Object;
17069
17069
  const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
17070
17070
  const { split, endsWith } = String.prototype;
17071
17071
  const { isArray: isArray$7 } = Array;
@@ -17083,7 +17083,7 @@
17083
17083
  mergeable: true,
17084
17084
  });
17085
17085
  const input_childRelationships = input.childRelationships;
17086
- const input_childRelationships_keys = keys$8(input_childRelationships);
17086
+ const input_childRelationships_keys = keys$9(input_childRelationships);
17087
17087
  const input_childRelationships_length = input_childRelationships_keys.length;
17088
17088
  for (let i = 0; i < input_childRelationships_length; i++) {
17089
17089
  const key = input_childRelationships_keys[i];
@@ -17091,7 +17091,7 @@
17091
17091
  rootKeySet.merge(cacheKeys);
17092
17092
  }
17093
17093
  const input_fields = input.fields;
17094
- const input_fields_keys = keys$8(input_fields);
17094
+ const input_fields_keys = keys$9(input_fields);
17095
17095
  const input_fields_length = input_fields_keys.length;
17096
17096
  for (let i = 0; i < input_fields_length; i++) {
17097
17097
  const key = input_fields_keys[i];
@@ -17558,7 +17558,7 @@
17558
17558
  for (let i = 0, len = value.length; i < len; i += 1) {
17559
17559
  result[value[i]] = true;
17560
17560
  }
17561
- return keys$8(result);
17561
+ return keys$9(result);
17562
17562
  }
17563
17563
  /**
17564
17564
  * @param source The array of string to filter
@@ -19006,7 +19006,7 @@
19006
19006
  function createPathSelection(propertyName, fieldDefinition) {
19007
19007
  const fieldsSelection = [];
19008
19008
  const { children } = fieldDefinition;
19009
- const childrenKeys = keys$8(children);
19009
+ const childrenKeys = keys$9(children);
19010
19010
  for (let i = 0, len = childrenKeys.length; i < len; i += 1) {
19011
19011
  const childKey = childrenKeys[i];
19012
19012
  const childFieldDefinition = children[childKey];
@@ -19051,7 +19051,7 @@
19051
19051
  */
19052
19052
  function createPathSelectionFromValue(fields) {
19053
19053
  const fieldsSelection = [];
19054
- const fieldNames = keys$8(fields);
19054
+ const fieldNames = keys$9(fields);
19055
19055
  for (let i = 0, len = fieldNames.length; i < len; i++) {
19056
19056
  const fieldName = fieldNames[i];
19057
19057
  const { value: fieldValue } = fields[fieldName];
@@ -19090,7 +19090,7 @@
19090
19090
  }
19091
19091
  function extractRecordFieldsRecursively(record) {
19092
19092
  const fields = [];
19093
- const fieldNames = keys$8(record.fields);
19093
+ const fieldNames = keys$9(record.fields);
19094
19094
  for (let i = 0, len = fieldNames.length; i < len; i++) {
19095
19095
  const fieldName = fieldNames[i];
19096
19096
  const { value: fieldValue } = record.fields[fieldName];
@@ -19278,7 +19278,7 @@
19278
19278
  continue;
19279
19279
  }
19280
19280
  extractTrackedFieldsToTrie(spanningLink.data.__ref, spanning, next, config, spanningVisitedRecordIds, depth + 1);
19281
- if (keys$8(next.children).length > 0) {
19281
+ if (keys$9(next.children).length > 0) {
19282
19282
  current.children[key] = next;
19283
19283
  }
19284
19284
  else {
@@ -19330,13 +19330,13 @@
19330
19330
  return endsWith.call(spanningNode.scalar('apiName'), CUSTOM_EXTERNAL_OBJECT_FIELD_SUFFIX);
19331
19331
  }
19332
19332
  function convertTrieToFields(root) {
19333
- if (keys$8(root.children).length === 0) {
19333
+ if (keys$9(root.children).length === 0) {
19334
19334
  return [];
19335
19335
  }
19336
19336
  return convertTrieToFieldsRecursively(root);
19337
19337
  }
19338
19338
  function convertTrieToFieldsRecursively(root) {
19339
- const childKeys = keys$8(root.children);
19339
+ const childKeys = keys$9(root.children);
19340
19340
  if (childKeys.length === 0) {
19341
19341
  if (root.name === '') {
19342
19342
  return [];
@@ -19373,7 +19373,7 @@
19373
19373
  function mergeFieldsTries(rootA, rootB) {
19374
19374
  const rootAchildren = rootA.children;
19375
19375
  const rootBchildren = rootB.children;
19376
- const childBKeys = keys$8(rootBchildren);
19376
+ const childBKeys = keys$9(rootBchildren);
19377
19377
  for (let i = 0, len = childBKeys.length; i < len; i++) {
19378
19378
  const childBKey = childBKeys[i];
19379
19379
  if (rootAchildren[childBKey] === undefined) {
@@ -19526,8 +19526,8 @@
19526
19526
  }
19527
19527
  const childrenA = a.children;
19528
19528
  const childrenB = b.children;
19529
- const childKeysA = keys$8(childrenA);
19530
- const childKeysB = keys$8(childrenB);
19529
+ const childKeysA = keys$9(childrenA);
19530
+ const childKeysB = keys$9(childrenB);
19531
19531
  const childKeysBLength = childKeysB.length;
19532
19532
  if (childKeysBLength > childKeysA.length) {
19533
19533
  return false;
@@ -19551,7 +19551,7 @@
19551
19551
  // RecordRepresentationNormalized['fields'] to include `pending:true` property
19552
19552
  const mergedFields = { ...newRecord.fields };
19553
19553
  const merged = { ...newRecord, fields: mergedFields };
19554
- const existingFields = keys$8(oldRecord.fields);
19554
+ const existingFields = keys$9(oldRecord.fields);
19555
19555
  for (let i = 0, len = existingFields.length; i < len; i += 1) {
19556
19556
  const spanningFieldName = existingFields[i];
19557
19557
  if (newRecord.fields[spanningFieldName] === undefined) {
@@ -19684,7 +19684,7 @@
19684
19684
  if (isGraphNode(node)) {
19685
19685
  const dependencies = node.retrieve();
19686
19686
  if (dependencies !== null) {
19687
- const depKeys = keys$8(dependencies);
19687
+ const depKeys = keys$9(dependencies);
19688
19688
  for (let i = 0, len = depKeys.length; i < len; i++) {
19689
19689
  luvio.storeEvict(depKeys[i]);
19690
19690
  }
@@ -19831,7 +19831,7 @@
19831
19831
  }
19832
19832
  for (let i = 0; i < fieldSubtries.length; i++) {
19833
19833
  const subtrie = fieldSubtries[i];
19834
- const fieldNames = keys$8(subtrie.children);
19834
+ const fieldNames = keys$9(subtrie.children);
19835
19835
  for (let i = 0; i < fieldNames.length; i++) {
19836
19836
  const fieldName = fieldNames[i];
19837
19837
  const childTrie = subtrie.children[fieldName];
@@ -19943,9 +19943,9 @@
19943
19943
  return false;
19944
19944
  }
19945
19945
  }
19946
- const headersKeys = keys$8(headers);
19946
+ const headersKeys = keys$9(headers);
19947
19947
  const headersKeyLength = headersKeys.length;
19948
- if (headersKeyLength !== keys$8(existingHeaders).length) {
19948
+ if (headersKeyLength !== keys$9(existingHeaders).length) {
19949
19949
  return false;
19950
19950
  }
19951
19951
  for (let i = 0, len = headersKeyLength; i < len; i++) {
@@ -20714,7 +20714,7 @@
20714
20714
 
20715
20715
  // iterate through the map to build configs for network calls
20716
20716
  function resolveConflict(luvio, map) {
20717
- const ids = keys$8(map.conflicts);
20717
+ const ids = keys$9(map.conflicts);
20718
20718
  if (ids.length === 0) {
20719
20719
  instrumentation$2.recordConflictsResolved(map.serverRequestCount);
20720
20720
  return;
@@ -21894,18 +21894,18 @@
21894
21894
  return {
21895
21895
  getRecordSelectionFieldSets() {
21896
21896
  const optionalPlusDefaultFields = { ...optionalFields_ };
21897
- const fields = keys$8(defaultFields_);
21897
+ const fields = keys$9(defaultFields_);
21898
21898
  for (let i = 0; i < fields.length; ++i) {
21899
21899
  const field = fields[i];
21900
21900
  if (!fields_[field] && !defaultServerFieldStatus.missingFields[field]) {
21901
21901
  optionalPlusDefaultFields[field] = true;
21902
21902
  }
21903
21903
  }
21904
- return [keys$8(fields_).sort(), keys$8(optionalPlusDefaultFields).sort()];
21904
+ return [keys$9(fields_).sort(), keys$9(optionalPlusDefaultFields).sort()];
21905
21905
  },
21906
21906
  processRecords(records) {
21907
21907
  const { missingFields } = defaultServerFieldStatus;
21908
- const fields = keys$8(missingFields);
21908
+ const fields = keys$9(missingFields);
21909
21909
  for (let i = 0; i < fields.length; ++i) {
21910
21910
  const field = fields[i], splitField = field.split('.').slice(1);
21911
21911
  for (let i = 0; i < records.length; ++i) {
@@ -24638,7 +24638,7 @@
24638
24638
  const lookupFields = {};
24639
24639
  const { apiName, fields: recordFields } = record;
24640
24640
  const { fields: objectInfoFields } = objectInfo;
24641
- const objectInfoFieldNames = keys$8(objectInfoFields);
24641
+ const objectInfoFieldNames = keys$9(objectInfoFields);
24642
24642
  for (let i = 0, len = objectInfoFieldNames.length; i < len; i += 1) {
24643
24643
  const fieldName = objectInfoFieldNames[i];
24644
24644
  const field = objectInfoFields[fieldName];
@@ -24657,12 +24657,12 @@
24657
24657
  const nameField = `${apiName}.${relationshipName}.${getNameField(objectInfo, fieldName)}`;
24658
24658
  lookupFields[nameField] = true;
24659
24659
  }
24660
- return keys$8(lookupFields);
24660
+ return keys$9(lookupFields);
24661
24661
  }
24662
24662
  function getRecordUiMissingRecordLookupFields(recordUi) {
24663
24663
  const { records, objectInfos } = recordUi;
24664
24664
  const recordLookupFields = {};
24665
- const recordIds = keys$8(records);
24665
+ const recordIds = keys$9(records);
24666
24666
  for (let i = 0, len = recordIds.length; i < len; i += 1) {
24667
24667
  const recordId = recordIds[i];
24668
24668
  const recordData = records[recordId];
@@ -24700,19 +24700,19 @@
24700
24700
  }
24701
24701
  function eachLayout(recordUi, cb) {
24702
24702
  const { layouts } = recordUi;
24703
- const layoutApiNames = keys$8(layouts);
24703
+ const layoutApiNames = keys$9(layouts);
24704
24704
  for (let a = 0, len = layoutApiNames.length; a < len; a += 1) {
24705
24705
  const apiName = layoutApiNames[a];
24706
24706
  const apiNameData = layouts[apiName];
24707
- const recordTypeIds = keys$8(apiNameData);
24707
+ const recordTypeIds = keys$9(apiNameData);
24708
24708
  for (let b = 0, recordTypeIdsLen = recordTypeIds.length; b < recordTypeIdsLen; b += 1) {
24709
24709
  const recordTypeId = recordTypeIds[b];
24710
24710
  const recordTypeData = apiNameData[recordTypeId];
24711
- const layoutTypes = keys$8(recordTypeData);
24711
+ const layoutTypes = keys$9(recordTypeData);
24712
24712
  for (let c = 0, layoutTypesLen = layoutTypes.length; c < layoutTypesLen; c += 1) {
24713
24713
  const layoutType = layoutTypes[c];
24714
24714
  const layoutTypeData = recordTypeData[layoutType];
24715
- const modes = keys$8(layoutTypeData);
24715
+ const modes = keys$9(layoutTypeData);
24716
24716
  for (let d = 0, modesLen = modes.length; d < modesLen; d += 1) {
24717
24717
  const mode = modes[d];
24718
24718
  const layout = layoutTypeData[mode];
@@ -25091,11 +25091,11 @@
25091
25091
  ];
25092
25092
  function getFieldsFromLayoutMap(layoutMap, objectInfo) {
25093
25093
  let fields = [];
25094
- const layoutTypes = keys$8(layoutMap);
25094
+ const layoutTypes = keys$9(layoutMap);
25095
25095
  for (let i = 0, layoutTypesLen = layoutTypes.length; i < layoutTypesLen; i += 1) {
25096
25096
  const layoutType = layoutTypes[i];
25097
25097
  const modesMap = layoutMap[layoutType];
25098
- const modes = keys$8(modesMap);
25098
+ const modes = keys$9(modesMap);
25099
25099
  for (let m = 0, modesLen = modes.length; m < modesLen; m += 1) {
25100
25100
  const mode = modes[m];
25101
25101
  const modeKeys = getQualifiedFieldApiNamesFromLayout(modesMap[mode], objectInfo);
@@ -40023,7 +40023,7 @@
40023
40023
  let clonedLayoutUserStateSections;
40024
40024
  const { sectionUserStates } = layoutUserStateInput;
40025
40025
  const { sectionUserStates: cachedSectionUserStates } = cachedLayoutUserState;
40026
- const sectionUserStateKeys = keys$8(sectionUserStates);
40026
+ const sectionUserStateKeys = keys$9(sectionUserStates);
40027
40027
  for (let i = 0, len = sectionUserStateKeys.length; i < len; i += 1) {
40028
40028
  const sectionId = sectionUserStateKeys[i];
40029
40029
  if (cachedSectionUserStates[sectionId] === undefined) {
@@ -43907,7 +43907,7 @@
43907
43907
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
43908
43908
  });
43909
43909
  });
43910
- // version: 1.136.6-acf28210f
43910
+ // version: 1.136.7-ae23b4cbb
43911
43911
 
43912
43912
  var caseSensitiveUserId = '005B0000000GR4OIAW';
43913
43913
 
@@ -43985,7 +43985,7 @@
43985
43985
  const { parse: parse$5, stringify: stringify$5 } = JSON;
43986
43986
  const { join: join$2, push: push$2, unshift } = Array.prototype;
43987
43987
  const { isArray: isArray$5 } = Array;
43988
- const { entries: entries$3, keys: keys$6 } = Object;
43988
+ const { entries: entries$3, keys: keys$7 } = Object;
43989
43989
 
43990
43990
  const UI_API_BASE_URI = '/services/data/v59.0/ui-api';
43991
43991
 
@@ -44050,7 +44050,7 @@
44050
44050
  function mergeRecordFields$1(first, second) {
44051
44051
  const { fields: targetFields } = first;
44052
44052
  const { fields: sourceFields } = second;
44053
- const fieldNames = keys$6(sourceFields);
44053
+ const fieldNames = keys$7(sourceFields);
44054
44054
  for (let i = 0, len = fieldNames.length; i < len; i += 1) {
44055
44055
  const fieldName = fieldNames[i];
44056
44056
  const sourceField = sourceFields[fieldName];
@@ -44454,7 +44454,7 @@
44454
44454
  }
44455
44455
  const DefaultDurableSegment = 'DEFAULT';
44456
44456
 
44457
- const { keys: keys$5, create: create$5, assign: assign$4, freeze: freeze$1$1 } = Object;
44457
+ const { keys: keys$6, create: create$5, assign: assign$4, freeze: freeze$1$1 } = Object;
44458
44458
 
44459
44459
  //Durable store error instrumentation key
44460
44460
  const DURABLE_STORE_ERROR = 'durable-store-error';
@@ -44498,7 +44498,7 @@
44498
44498
  if (durableRecords === undefined) {
44499
44499
  return { revivedKeys, hadUnexpectedShape };
44500
44500
  }
44501
- const durableKeys = keys$5(durableRecords);
44501
+ const durableKeys = keys$6(durableRecords);
44502
44502
  if (durableKeys.length === 0) {
44503
44503
  // no records to revive
44504
44504
  return { revivedKeys, hadUnexpectedShape };
@@ -44672,7 +44672,7 @@
44672
44672
  overrides,
44673
44673
  };
44674
44674
  }
44675
- const keys$1 = keys$5(entries);
44675
+ const keys$1 = keys$6(entries);
44676
44676
  for (let i = 0, len = keys$1.length; i < len; i++) {
44677
44677
  const key = keys$1[i];
44678
44678
  const entry = entries[key];
@@ -44700,7 +44700,7 @@
44700
44700
  // TODO: W-8909393 Once metadata is stored in its own segment we need to
44701
44701
  // call setEntries for the visitedIds on default segment and call setEntries
44702
44702
  // on the metadata segment for the refreshedIds
44703
- const keys$1 = keys$5({ ...visitedIds, ...refreshedIds });
44703
+ const keys$1 = keys$6({ ...visitedIds, ...refreshedIds });
44704
44704
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
44705
44705
  const key = keys$1[i];
44706
44706
  const record = records[key];
@@ -44722,7 +44722,7 @@
44722
44722
  }
44723
44723
  const durableStoreOperations = [];
44724
44724
  // publishes
44725
- const recordKeys = keys$5(durableRecords);
44725
+ const recordKeys = keys$6(durableRecords);
44726
44726
  if (recordKeys.length > 0) {
44727
44727
  durableStoreOperations.push({
44728
44728
  type: 'setEntries',
@@ -44731,7 +44731,7 @@
44731
44731
  });
44732
44732
  }
44733
44733
  // evicts
44734
- const evictedKeys = keys$5(evictedRecords);
44734
+ const evictedKeys = keys$6(evictedRecords);
44735
44735
  if (evictedKeys.length > 0) {
44736
44736
  durableStoreOperations.push({
44737
44737
  type: 'evictEntries',
@@ -44885,7 +44885,7 @@
44885
44885
  try {
44886
44886
  const entries = await durableStore.getEntries(adapterContextKeysFromDifferentInstance, AdapterContextSegment);
44887
44887
  if (entries !== undefined) {
44888
- const entryKeys = keys$5(entries);
44888
+ const entryKeys = keys$6(entries);
44889
44889
  for (let i = 0, len = entryKeys.length; i < len; i++) {
44890
44890
  const entryKey = entryKeys[i];
44891
44891
  const entry = entries[entryKey];
@@ -45702,6 +45702,12 @@
45702
45702
  function stringLiteral(value, safe = false, isCaseSensitive = false) {
45703
45703
  return { type: ValueType.StringLiteral, value, safe, isCaseSensitive };
45704
45704
  }
45705
+ function isStringLiteral(expression) {
45706
+ return expression.type === ValueType.StringLiteral;
45707
+ }
45708
+ function isStringArray(expression) {
45709
+ return expression.type === ValueType.StringArray;
45710
+ }
45705
45711
  function comparison(left, operator, right) {
45706
45712
  return { type: PredicateType$1.comparison, left, right, operator };
45707
45713
  }
@@ -46472,6 +46478,9 @@
46472
46478
  }
46473
46479
  }
46474
46480
 
46481
+ const { isArray: isArray$4 } = Array;
46482
+ const { keys: keys$5 } = Object;
46483
+
46475
46484
  function isListValueNode(node) {
46476
46485
  return node.kind === 'ListValue';
46477
46486
  }
@@ -46524,13 +46533,13 @@
46524
46533
  const NotOperator = 'not';
46525
46534
  const { eq, ne, gt, gte, lt, lte, nin, like, includes, excludes } = ComparisonOperator;
46526
46535
  const inOp = ComparisonOperator.in;
46527
- function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperator = CompoundOperator.and, joins) {
46536
+ function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperator = CompoundOperator.and, joins, draftFunctions) {
46528
46537
  const results = fieldValues
46529
46538
  .map((value) => {
46530
46539
  if (!isObjectValueNode$1(value)) {
46531
46540
  return [failure([message('Parent filter node should be an object.')])];
46532
46541
  }
46533
- return Object.entries(value.fields).map(([key, value]) => filter(key, value, joinAlias, apiName, input, joins));
46542
+ return Object.entries(value.fields).map(([key, value]) => filter(key, value, joinAlias, apiName, input, joins, draftFunctions));
46534
46543
  })
46535
46544
  .reduce(flatten$1, []);
46536
46545
  const failures = results.filter(isFailure).reduce(flatMap$1(errors), []);
@@ -46552,22 +46561,22 @@
46552
46561
  return success({ predicate: resolvedPredicate });
46553
46562
  }
46554
46563
  //{where: {Field: ... | and: ... | or: ... | not: ...}}
46555
- function recordFilter(where, joinAlias, apiName, input, joins) {
46564
+ function recordFilter(where, joinAlias, apiName, input, joins, draftFunctions) {
46556
46565
  if (where === undefined) {
46557
46566
  return success(undefined);
46558
46567
  }
46559
46568
  // when 'recordFilter' starts, there is no 'NotPredicated'
46560
- return fieldsToFilters([where.value], joinAlias, apiName, input, CompoundOperator.and, joins).map((result) => result.predicate === undefined || isEmptyPredicate(result.predicate) ? undefined : result);
46569
+ return fieldsToFilters([where.value], joinAlias, apiName, input, CompoundOperator.and, joins, draftFunctions).map((result) => result.predicate === undefined || isEmptyPredicate(result.predicate) ? undefined : result);
46561
46570
  }
46562
- function filter(name, value, tableAlias, apiName, input, joins) {
46571
+ function filter(name, value, tableAlias, apiName, input, joins, draftFunctions) {
46563
46572
  if (isCompoundOperator(name)) {
46564
46573
  if (!isListValueNode(value)) {
46565
46574
  return failure([message(`Value for ${name} node must be a list.`)]);
46566
46575
  }
46567
- return compoundPredicate(name, value, tableAlias, apiName, input, joins);
46576
+ return compoundPredicate(name, value, tableAlias, apiName, input, joins, draftFunctions);
46568
46577
  }
46569
46578
  if (name === NotOperator) {
46570
- const children = fieldsToFilters([value], tableAlias, apiName, input, CompoundOperator.and, joins);
46579
+ const children = fieldsToFilters([value], tableAlias, apiName, input, CompoundOperator.and, joins, draftFunctions);
46571
46580
  // take the children of a not predicate
46572
46581
  // and wrap them all inside it
46573
46582
  return children.flatMap((container) => {
@@ -46585,10 +46594,10 @@
46585
46594
  if (!isObjectValueNode$1(value)) {
46586
46595
  return failure([message('Filter node must be an object or list.')]);
46587
46596
  }
46588
- return fieldFilter(name, value, tableAlias, apiName, input, joins);
46597
+ return fieldFilter(name, value, tableAlias, apiName, input, joins, draftFunctions);
46589
46598
  }
46590
- function compoundPredicate(operator, list, joinAlias, apiName, input, joins) {
46591
- return fieldsToFilters(list.values, joinAlias, apiName, input, operator, joins);
46599
+ function compoundPredicate(operator, list, joinAlias, apiName, input, joins, draftFunctions) {
46600
+ return fieldsToFilters(list.values, joinAlias, apiName, input, operator, joins, draftFunctions);
46592
46601
  }
46593
46602
  /**
46594
46603
  * spans a FieldNode with its ObjectValueNode is passed. All the predicates is added into the 'join' array.
@@ -46599,7 +46608,7 @@
46599
46608
  * @param joins
46600
46609
  * @returns undefined predicate
46601
46610
  */
46602
- function spanningFilter(fieldInfo, fieldNode, alias, input, joins) {
46611
+ function spanningFilter(fieldInfo, fieldNode, alias, input, joins, draftFunctions) {
46603
46612
  const { apiName: fieldName, referenceToInfos, relationshipName } = fieldInfo;
46604
46613
  const referenceInfo = referenceToInfos[0];
46605
46614
  const jsonAlias = `${alias}.${relationshipName}`;
@@ -46618,7 +46627,7 @@
46618
46627
  joins.push(join);
46619
46628
  // moves constraint predicate to where
46620
46629
  const constraintPredicates = [];
46621
- const filterResult = fieldsToFilters([fieldNode], jsonAlias, apiName, input, CompoundOperator.and, joins);
46630
+ const filterResult = fieldsToFilters([fieldNode], jsonAlias, apiName, input, CompoundOperator.and, joins, draftFunctions);
46622
46631
  if (filterResult.isSuccess === false) {
46623
46632
  return filterResult;
46624
46633
  }
@@ -46630,7 +46639,11 @@
46630
46639
  });
46631
46640
  return success({ predicate: combinePredicates(constraintPredicates, CompoundOperator.and) });
46632
46641
  }
46633
- function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
46642
+ function isIDValueField$1(fieldInfo) {
46643
+ return (fieldInfo.apiName === 'Id' ||
46644
+ (fieldInfo.referenceToInfos !== undefined && fieldInfo.referenceToInfos.length > 0));
46645
+ }
46646
+ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins, draftFunctions) {
46634
46647
  const fieldInfoResult = getFieldInfo(apiName, fieldName, input);
46635
46648
  if (fieldInfoResult.isSuccess === false) {
46636
46649
  return failure([fieldInfoResult.error]);
@@ -46640,8 +46653,9 @@
46640
46653
  return failure([message(`Field ${fieldName} for type ${apiName} not found.`)]);
46641
46654
  }
46642
46655
  if (fieldInfo.dataType === 'Reference' && fieldInfo.relationshipName === fieldName) {
46643
- return spanningFilter(fieldInfo, fieldNode, alias, input, joins);
46656
+ return spanningFilter(fieldInfo, fieldNode, alias, input, joins, draftFunctions);
46644
46657
  }
46658
+ const idProcessingNeeded = isIDValueField$1(fieldInfo);
46645
46659
  const extract = {
46646
46660
  type: ValueType.Extract,
46647
46661
  jsonAlias: alias,
@@ -46732,7 +46746,29 @@
46732
46746
  children,
46733
46747
  };
46734
46748
  }
46735
- return comparison(extract, op.operator, op.value);
46749
+ const rightOperand = op.value;
46750
+ if (idProcessingNeeded) {
46751
+ if (isStringLiteral(rightOperand)) {
46752
+ if (rightOperand.value !== null) {
46753
+ if (draftFunctions.isDraftId(rightOperand.value)) {
46754
+ rightOperand.value = draftFunctions.getCanonicalId(rightOperand.value);
46755
+ }
46756
+ }
46757
+ }
46758
+ else if (isStringArray(rightOperand)) {
46759
+ if (rightOperand.value !== null) {
46760
+ rightOperand.value = rightOperand.value.map((originalId) => {
46761
+ if (originalId !== null) {
46762
+ if (draftFunctions.isDraftId(originalId)) {
46763
+ return draftFunctions.getCanonicalId(originalId);
46764
+ }
46765
+ }
46766
+ return originalId;
46767
+ });
46768
+ }
46769
+ }
46770
+ }
46771
+ return comparison(extract, op.operator, rightOperand);
46736
46772
  });
46737
46773
  const combined = combinePredicates(comparisons.concat(...dateFunction.value), CompoundOperator.and);
46738
46774
  const container = {
@@ -47834,7 +47870,7 @@
47834
47870
  const orderByJoins = [];
47835
47871
  const orderByResult = parseOrderBy(orderByArg, alias, apiName, input.objectInfoMap, orderByJoins);
47836
47872
  const filterJoins = [];
47837
- const whereResult = recordFilter(whereArg, alias, apiName, input.objectInfoMap, filterJoins);
47873
+ const whereResult = recordFilter(whereArg, alias, apiName, input.objectInfoMap, filterJoins, input.draftFunctions);
47838
47874
  const scopeJoins = [];
47839
47875
  const scopeResult = scopeFilter(scopeArg, alias, apiName, input, scopeJoins);
47840
47876
  let additionalPredicates = [];
@@ -47996,27 +48032,19 @@
47996
48032
  ? node.arguments
47997
48033
  .map((args) => {
47998
48034
  const { value, name } = args;
48035
+ //The variable is on the top level, for example `where: ${filter}`
47999
48036
  if (is(value, 'Variable')) {
48000
- const variable = variables[value.name];
48001
- if (variable) {
48002
- const jsonString = JSON.stringify(variable);
48003
- const buildRecordQueryString = (name, query, transform) => {
48004
- return `${name}: ${transform(query)}`;
48005
- };
48006
- switch (name) {
48007
- case 'scope':
48008
- case 'orderBy':
48009
- return buildRecordQueryString(name, jsonString, removeAllQuotations);
48010
- default:
48011
- return buildRecordQueryString(name, jsonString, removeQuotationsFromKeys);
48012
- }
48013
- }
48014
- return '';
48037
+ return generateVariableNodeQuery(value, name, name, variables);
48038
+ }
48039
+ else if (isObjectValueNode$1(value)) {
48040
+ return generateVariableSubQuery(value, name, name, variables);
48015
48041
  }
48016
48042
  })
48017
48043
  .filter(Boolean)
48018
48044
  : undefined;
48019
- return gqlArguments ? `${node.name}(${gqlArguments.join(',')}) { Id }` : '';
48045
+ return gqlArguments
48046
+ ? `${node.name} ${gqlArguments.length > 0 ? '(' + gqlArguments.join(',') + ')' : ''} { Id }`
48047
+ : '';
48020
48048
  })
48021
48049
  //remove empty strings
48022
48050
  .filter(Boolean)
@@ -48026,6 +48054,51 @@
48026
48054
  return [accu.slice(0, 1), query, accu.slice(1, length)].join('');
48027
48055
  }, '{ }'));
48028
48056
  }
48057
+ /**
48058
+ * Given a LuvioValueNode, generates a sql with its variable node replaced with actual value.
48059
+ * @param valueNode G
48060
+ * @param name
48061
+ * @param type
48062
+ * @param variables
48063
+ * @returns
48064
+ */
48065
+ function generateVariableSubQuery(valueNode, name, type, variables) {
48066
+ switch (valueNode.kind) {
48067
+ case Kind.OBJECT: {
48068
+ // For example, `{ Id: { eq: $draftId } }` is a `ObjectValueNode`, which has field keys 'Id'
48069
+ const resultQuery = keys$5(valueNode.fields)
48070
+ .map((key) => generateVariableSubQuery(valueNode.fields[key], key, type, variables))
48071
+ .filter((subquery) => subquery.length > 0)
48072
+ .join(',');
48073
+ if (resultQuery.length > 0) {
48074
+ return `${name}: {${resultQuery}}`;
48075
+ }
48076
+ return resultQuery;
48077
+ }
48078
+ case Kind.VARIABLE:
48079
+ return generateVariableNodeQuery(valueNode, name, type, variables);
48080
+ default:
48081
+ return '';
48082
+ }
48083
+ }
48084
+ // Generate a sql for the variable node with its actual value.
48085
+ function generateVariableNodeQuery(value, name, type, variables) {
48086
+ const variable = variables[value.name];
48087
+ if (variable) {
48088
+ const jsonString = JSON.stringify(variable);
48089
+ const buildRecordQueryString = (name, query, transform) => {
48090
+ return `${name}: ${transform(query)}`;
48091
+ };
48092
+ switch (type) {
48093
+ case 'scope':
48094
+ case 'orderBy':
48095
+ return buildRecordQueryString(name, jsonString, removeAllQuotations);
48096
+ default:
48097
+ return buildRecordQueryString(name, jsonString, removeQuotationsFromKeys);
48098
+ }
48099
+ }
48100
+ return '';
48101
+ }
48029
48102
  /**
48030
48103
  * Given an AST with variables
48031
48104
  * Swap out the LuvioArgumentNodes on the original AST with ones generated from its variables.
@@ -48044,14 +48117,43 @@
48044
48117
  const { name } = node;
48045
48118
  const first = allArgumentRecords.find((n) => n.name === name);
48046
48119
  if (first) {
48047
- // if we had arguments that did not contain variables we still want those
48048
- first.arguments = flatten$1(first.arguments
48049
- ? first.arguments.filter((x) => x.value.kind !== 'Variable')
48050
- : [], node.arguments ? node.arguments : []);
48120
+ const swappedArgments = swapArgumentWithVariableNodes(node.arguments, first.arguments);
48121
+ first.arguments = swappedArgments ? swappedArgments : [];
48051
48122
  }
48052
48123
  });
48053
48124
  }
48054
48125
  }
48126
+ // Replaces the variable node in original LuvioArgumentNode with the actual value in the swapped node with the same path.
48127
+ function swapArgumentWithVariableNodes(swapped, original) {
48128
+ if (swapped === undefined || original === undefined) {
48129
+ return original;
48130
+ }
48131
+ return original.map((x) => {
48132
+ const targetNode = swapped.find((y) => y.name === x.name);
48133
+ if (targetNode === undefined) {
48134
+ return x;
48135
+ }
48136
+ if (x.value.kind === 'Variable') {
48137
+ return targetNode;
48138
+ }
48139
+ swapValueNodeWithVariableNodes(x.value, targetNode.value);
48140
+ return x;
48141
+ });
48142
+ }
48143
+ function swapValueNodeWithVariableNodes(original, swapped) {
48144
+ if (original.kind === Kind.OBJECT) {
48145
+ for (const key of keys$5(original.fields)) {
48146
+ if (isObjectValueNode$1(swapped) && swapped.fields[key]) {
48147
+ if (is(original.fields[key], 'Variable')) {
48148
+ original.fields[key] = swapped.fields[key];
48149
+ }
48150
+ else {
48151
+ swapValueNodeWithVariableNodes(original.fields[key], swapped.fields[key]);
48152
+ }
48153
+ }
48154
+ }
48155
+ }
48156
+ }
48055
48157
  //find top level record queries
48056
48158
  function findRecordSelections$1(document) {
48057
48159
  return document.definitions
@@ -48086,7 +48188,7 @@
48086
48188
  * Missing object info records triggers the objectInfoService (same instance shared with Drafts code), to
48087
48189
  * use the getObjectInfos adapter to efficiently fetch the necessary records.
48088
48190
  */
48089
- async createRootQuery(config, objectInfoService, userId) {
48191
+ async createRootQuery(config, objectInfoService, userId, draftFunctions) {
48090
48192
  const { query: ast, variables } = config;
48091
48193
  swapVariableArguments(ast, variables);
48092
48194
  // Parse out top-level record queries types we know we will need, since spanning fields will
@@ -48133,6 +48235,7 @@
48133
48235
  astTransformResult = transform(ast, {
48134
48236
  userId,
48135
48237
  objectInfoMap,
48238
+ draftFunctions,
48136
48239
  });
48137
48240
  if (astTransformResult.isSuccess === false) {
48138
48241
  for (const error of astTransformResult.error) {
@@ -48170,8 +48273,6 @@
48170
48273
  }
48171
48274
  }
48172
48275
 
48173
- const { isArray: isArray$4 } = Array;
48174
-
48175
48276
  /**
48176
48277
  * Checks a GraphQL-shaped network response for errors, returning true if it does
48177
48278
  * and false otherwise
@@ -48217,7 +48318,7 @@
48217
48318
  return snapshot;
48218
48319
  };
48219
48320
  };
48220
- function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService) {
48321
+ function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService, draftFunctions) {
48221
48322
  // if the store does not support eval then use the noop version
48222
48323
  if (sqliteStore.isEvalSupported() === false) {
48223
48324
  return noopStoreEval;
@@ -48225,7 +48326,7 @@
48225
48326
  const preconditioner = new StoreEvalPreconditioner();
48226
48327
  return makeStoreEval(preconditioner, objectInfoService, userId, async () => {
48227
48328
  return undefined;
48228
- }, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore));
48329
+ }, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore), draftFunctions);
48229
48330
  }
48230
48331
  async function noopStoreEval(_config, nonEvaluatedSnapshotOrPromise, _observers) {
48231
48332
  return nonEvaluatedSnapshotOrPromise;
@@ -48244,7 +48345,7 @@
48244
48345
  function generateUniqueRecordId$1() {
48245
48346
  return `${GRAPHQL_ROOT_KEY$1}${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
48246
48347
  }
48247
- function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator) {
48348
+ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator, draftFunctions) {
48248
48349
  const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers) => {
48249
48350
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
48250
48351
  // the non-eval'ed input could either be a snapshot or promise of one so
@@ -48274,7 +48375,7 @@
48274
48375
  context = await contextProvider();
48275
48376
  // Ensures ObjectInfo metadata is available for the request. Sourcing records from L1/L2/Network
48276
48377
  // is delegated to the getObjectInfo adapter via objectInfoService
48277
- rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId);
48378
+ rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId, draftFunctions);
48278
48379
  }
48279
48380
  catch (error) {
48280
48381
  eventEmitter({
@@ -56228,7 +56329,7 @@
56228
56329
  return `UiApi::GraphQLRepresentation:${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
56229
56330
  }
56230
56331
  // Recursively replace draft ids with canonical ids
56231
- const replaceDraftIdsInVariables = (variables, draftFunctions, unmappedDraftIDs) => {
56332
+ const replaceDraftIdsInVariables$1 = (variables, draftFunctions, unmappedDraftIDs) => {
56232
56333
  const replace = (object) => {
56233
56334
  if (typeof object === 'string') {
56234
56335
  if (!draftFunctions.isDraftId(object)) {
@@ -56285,7 +56386,7 @@
56285
56386
  unmappedDraftIDs,
56286
56387
  } = await injectSyntheticFields(copy, objectInfoService, draftFunctions, config.variables));
56287
56388
  if (config.variables) {
56288
- config.variables = replaceDraftIdsInVariables(config.variables, draftFunctions, unmappedDraftIDs);
56389
+ config.variables = replaceDraftIdsInVariables$1(config.variables, draftFunctions, unmappedDraftIDs);
56289
56390
  }
56290
56391
  }
56291
56392
  catch (throwable) {
@@ -57871,7 +57972,7 @@
57871
57972
  }, networkAdapter);
57872
57973
  }
57873
57974
 
57874
- const { keys: keys$7, create: create$6, assign: assign$5, entries } = Object;
57975
+ const { keys: keys$8, create: create$6, assign: assign$5, entries } = Object;
57875
57976
  const { stringify: stringify$6, parse: parse$6 } = JSON;
57876
57977
  const { push, join, slice } = Array.prototype;
57877
57978
 
@@ -58431,7 +58532,7 @@
58431
58532
  },
58432
58533
  conflictColumns: this.conflictColumnNames,
58433
58534
  columns: this.columnNames,
58434
- rows: keys$7(entries).reduce((rows, key) => {
58535
+ rows: keys$8(entries).reduce((rows, key) => {
58435
58536
  const entry = entries[key];
58436
58537
  const { data, metadata } = entry;
58437
58538
  const row = [key, stringify$6(data), metadata ? stringify$6(metadata) : null];
@@ -58492,7 +58593,7 @@
58492
58593
  },
58493
58594
  conflictColumns: this.conflictColumnNames,
58494
58595
  columns: this.columnNames,
58495
- rows: keys$7(entries).reduce((rows, key) => {
58596
+ rows: keys$8(entries).reduce((rows, key) => {
58496
58597
  const entry = entries[key];
58497
58598
  rows.push([key, stringify$6(entry.data)]);
58498
58599
  return rows;
@@ -58577,7 +58678,7 @@
58577
58678
  },
58578
58679
  conflictColumns: this.conflictColumnNames,
58579
58680
  columns: this.columnNames,
58580
- rows: keys$7(entries).reduce((rows, key) => {
58681
+ rows: keys$8(entries).reduce((rows, key) => {
58581
58682
  const entry = entries[key];
58582
58683
  const { data, metadata } = entry;
58583
58684
  const row = [key, stringify$6(data)];
@@ -59441,11 +59542,6 @@
59441
59542
  getIngestMetadataForInternalAdapters =
59442
59543
  internalAdapterDurableEnvironment.getIngestStagingStoreRecords;
59443
59544
  lazyObjectInfoService = new ObjectInfoService(getObjectInfo, getObjectInfos, internalAdapterDurableStore);
59444
- // set storeEval function for lds-adapters-graghql to use
59445
- withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
59446
- const { configuration: { setStoreEval }, } = registration;
59447
- setStoreEval(sqliteStoreEvalFactory(userId, lazyBaseDurableStore, lazyObjectInfoService));
59448
- });
59449
59545
  // creates a durable store that denormalizes scalar fields for records
59450
59546
  let getIngestRecords;
59451
59547
  let getIngestMetadata;
@@ -59484,6 +59580,20 @@
59484
59580
  setupMobileInstrumentation();
59485
59581
  // If the inspection nimbus plugin is configured, inspection is enabled otherwise this is a no-op
59486
59582
  setupInspection(lazyLuvio);
59583
+ // set storeEval function for lds-adapters-graghql to use
59584
+ withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
59585
+ const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
59586
+ const getCanonicalId = (id) => {
59587
+ var _a;
59588
+ return ((_a = extractRecordIdFromStoreKey(lazyLuvio.storeGetCanonicalKey(RECORD_ID_PREFIX + id))) !== null && _a !== void 0 ? _a : id);
59589
+ };
59590
+ const draftFuncs = {
59591
+ isDraftId: isGenerated,
59592
+ getCanonicalId,
59593
+ };
59594
+ setStoreEval(sqliteStoreEvalFactory(userId, lazyBaseDurableStore, lazyObjectInfoService, draftFuncs));
59595
+ setDraftFunctions(draftFuncs);
59596
+ });
59487
59597
  // on core the graphql configuration is split so we need to set configureUIAPIGraphQL both in the
59488
59598
  // graphql registration and the uiapi for off core
59489
59599
  const configureUIAPIGraphQL = (registration) => {
@@ -59533,7 +59643,7 @@
59533
59643
  id: '@salesforce/lds-network-adapter',
59534
59644
  instrument: instrument$1,
59535
59645
  });
59536
- // version: 1.136.6-0f5ec3ee7
59646
+ // version: 1.136.7-777657471
59537
59647
 
59538
59648
  const { create: create$2, keys: keys$2 } = Object;
59539
59649
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -73967,7 +74077,7 @@
73967
74077
  configuration: { ...configurationForGraphQLAdapters },
73968
74078
  instrument,
73969
74079
  });
73970
- // version: 1.136.6-acf28210f
74080
+ // version: 1.136.7-ae23b4cbb
73971
74081
 
73972
74082
  // On core the unstable adapters are re-exported with different names,
73973
74083
 
@@ -75339,10 +75449,14 @@
75339
75449
  }
75340
75450
 
75341
75451
  let storeEval = undefined;
75452
+ let draftFunctions = undefined;
75342
75453
  const configuration = {
75343
75454
  setStoreEval: function (storeEvalArg) {
75344
75455
  storeEval = storeEvalArg;
75345
75456
  },
75457
+ setDraftFunctions: function (draftFuncs) {
75458
+ draftFunctions = draftFuncs;
75459
+ },
75346
75460
  };
75347
75461
 
75348
75462
  const assignedToMe = {
@@ -75428,6 +75542,78 @@
75428
75542
  function injectFieldsGQL(ast) {
75429
75543
  return injectScopeFields(ast);
75430
75544
  }
75545
+ function swapIdsOfDocumentNode(documentnode, draftFunctions) {
75546
+ const recordNodes = findRecordSelections(documentnode);
75547
+ recordNodes.forEach((recordConnection) => {
75548
+ swapIdsOfFieldNode(recordConnection, draftFunctions);
75549
+ });
75550
+ return documentnode;
75551
+ }
75552
+ function swapIdsOfFieldNode(selectionNode, draftFunctions) {
75553
+ if (isCustomFieldNode(selectionNode) &&
75554
+ selectionNode.type === 'Connection' &&
75555
+ selectionNode.arguments !== undefined &&
75556
+ selectionNode.arguments.some((argment) => argment.name === 'where')) {
75557
+ const swappedArguments = selectionNode.arguments.map((argument) => {
75558
+ if (argument.name === 'where') {
75559
+ return {
75560
+ ...argument,
75561
+ value: swapIdsOfValueNode(argument.value, draftFunctions.isDraftId, draftFunctions.getCanonicalId),
75562
+ };
75563
+ }
75564
+ else {
75565
+ return argument;
75566
+ }
75567
+ });
75568
+ selectionNode.arguments = swappedArguments;
75569
+ }
75570
+ if (selectionNode.luvioSelections !== undefined) {
75571
+ for (const childSelectionNode of selectionNode.luvioSelections) {
75572
+ if (isCustomFieldNode(childSelectionNode) ||
75573
+ isObjectFieldSelection(childSelectionNode)) {
75574
+ swapIdsOfFieldNode(childSelectionNode, draftFunctions);
75575
+ }
75576
+ }
75577
+ }
75578
+ }
75579
+ function swapIdsOfValueNode(valueNode, isDraftId, idMapper) {
75580
+ switch (valueNode.kind) {
75581
+ case Kind.OBJECT: {
75582
+ const swappedObjectValueNode = {};
75583
+ for (const key of keys(valueNode.fields)) {
75584
+ swappedObjectValueNode[key] = swapIdsOfValueNode(valueNode.fields[key], isDraftId, idMapper);
75585
+ }
75586
+ return {
75587
+ kind: 'ObjectValue',
75588
+ fields: swappedObjectValueNode,
75589
+ };
75590
+ }
75591
+ case Kind.LIST: {
75592
+ const listValueNodes = [];
75593
+ for (const child of valueNode.values) {
75594
+ listValueNodes.push(swapIdsOfValueNode(child, isDraftId, idMapper));
75595
+ }
75596
+ return {
75597
+ kind: 'ListValue',
75598
+ values: listValueNodes,
75599
+ };
75600
+ }
75601
+ case Kind.STRING: {
75602
+ if (!isDraftId(valueNode.value)) {
75603
+ return valueNode;
75604
+ }
75605
+ return {
75606
+ kind: 'StringValue',
75607
+ value: idMapper(valueNode.value),
75608
+ block: false,
75609
+ };
75610
+ }
75611
+ default:
75612
+ return {
75613
+ ...valueNode,
75614
+ };
75615
+ }
75616
+ }
75431
75617
  function injectScopeFields(ast) {
75432
75618
  const modifiedDocumentNode = {
75433
75619
  kind: 'Document',
@@ -76009,6 +76195,34 @@
76009
76195
  }
76010
76196
  return buildNetworkSnapshot(luvio, config, fragment, dispatchOptions);
76011
76197
  }
76198
+ const replaceDraftIdsInVariables = (variables, draftFunctions) => {
76199
+ const replace = (object) => {
76200
+ if (typeof object === 'string') {
76201
+ if (!draftFunctions.isDraftId(object)) {
76202
+ return object;
76203
+ }
76204
+ return draftFunctions.getCanonicalId(object);
76205
+ }
76206
+ else if (isArray(object)) {
76207
+ return object.map(replace);
76208
+ }
76209
+ else if (typeof object === 'object' && object !== null) {
76210
+ let source = object;
76211
+ return keys(source).reduce((acc, key) => {
76212
+ acc[key] = replace(source[key]);
76213
+ return acc;
76214
+ }, {});
76215
+ }
76216
+ else {
76217
+ return object;
76218
+ }
76219
+ };
76220
+ let newVariables = keys(variables).reduce((acc, key) => {
76221
+ acc[key] = replace(variables[key]);
76222
+ return acc;
76223
+ }, {});
76224
+ return newVariables;
76225
+ };
76012
76226
  const graphQLAdapterFactory = (luvio) => {
76013
76227
  const uiApiGraphQLAdapter = factory$1(luvio);
76014
76228
  function graphql(untrustedConfig, requestContext) {
@@ -76033,9 +76247,17 @@
76033
76247
  const validatedConfigWithInjection = fieldInjectionRequired
76034
76248
  ? graphqlConfigWithInjectedAST(validatedConfig)
76035
76249
  : validatedConfig;
76036
- const fragment = createFragment(luvio, validatedConfigWithInjection.query, variables);
76250
+ const sanitizedConfig = draftFunctions !== undefined
76251
+ ? sanitizeConfig(validatedConfigWithInjection, draftFunctions)
76252
+ : validatedConfigWithInjection;
76253
+ if (sanitizedConfig.variables && draftFunctions !== undefined) {
76254
+ const variablesWithSwappedDraftIds = replaceDraftIdsInVariables(sanitizedConfig.variables, draftFunctions);
76255
+ sanitizedConfig.variables = variablesWithSwappedDraftIds;
76256
+ validatedConfig.variables = variablesWithSwappedDraftIds;
76257
+ }
76258
+ const fragment = createFragment(luvio, sanitizedConfig.query, sanitizedConfig.variables);
76037
76259
  const context = {
76038
- config: validatedConfigWithInjection,
76260
+ config: sanitizedConfig,
76039
76261
  fragment,
76040
76262
  luvio,
76041
76263
  };
@@ -76044,7 +76266,7 @@
76044
76266
  const observers = requestContext && requestContext.eventObservers
76045
76267
  ? requestContext.eventObservers
76046
76268
  : [];
76047
- // uses the original ast to do the eval to avoid fields not needed by users
76269
+ // uses the original ast to do the eval to avoid fields not needed by users. The draftID swapping happens when filters transform to predicates.
76048
76270
  return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers);
76049
76271
  }
76050
76272
  return snapshotOrPromiseFromCachePolicy;
@@ -76061,6 +76283,15 @@
76061
76283
  query: modifiedAST,
76062
76284
  };
76063
76285
  }
76286
+ function sanitizeConfig(graphqlConfig, draftFunctions) {
76287
+ const { query } = graphqlConfig;
76288
+ const astCopy = parse(stringify(query));
76289
+ const modifiedAST = swapIdsOfDocumentNode(astCopy, draftFunctions);
76290
+ return {
76291
+ ...graphqlConfig,
76292
+ query: modifiedAST,
76293
+ };
76294
+ }
76064
76295
  // make sure to register the configuration whenever this module loads
76065
76296
  register({ id: '@salesforce/lds-adapters-graphql', configuration });
76066
76297
 
@@ -76078,7 +76309,7 @@
76078
76309
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76079
76310
  graphQLImperative = ldsAdapter;
76080
76311
  });
76081
- // version: 1.136.6-acf28210f
76312
+ // version: 1.136.7-ae23b4cbb
76082
76313
 
76083
76314
  var gqlApi = /*#__PURE__*/Object.freeze({
76084
76315
  __proto__: null,
@@ -76784,4 +77015,4 @@
76784
77015
  Object.defineProperty(exports, '__esModule', { value: true });
76785
77016
 
76786
77017
  }));
76787
- // version: 1.136.6-0f5ec3ee7
77018
+ // version: 1.136.7-777657471