@salesforce/lds-worker-api 1.136.6 → 1.136.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.
@@ -20,7 +20,7 @@ var SnapshotState$3;
20
20
  SnapshotState["Stale"] = "Stale";
21
21
  })(SnapshotState$3 || (SnapshotState$3 = {}));
22
22
 
23
- const { create: create$a, entries: entries$4, freeze: freeze$5, keys: keys$a, values: values$3 } = Object;
23
+ const { create: create$a, entries: entries$4, freeze: freeze$5, keys: keys$b, values: values$3 } = Object;
24
24
  const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
25
25
  const { isArray: isArray$9 } = Array;
26
26
  const { push: push$4, indexOf, slice: slice$2 } = Array.prototype;
@@ -37,7 +37,7 @@ function deepFreeze(value) {
37
37
  }
38
38
  }
39
39
  else {
40
- const keys$1 = keys$a(value);
40
+ const keys$1 = keys$b(value);
41
41
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
42
42
  deepFreeze(value[keys$1[i]]);
43
43
  }
@@ -298,7 +298,7 @@ function stableJSONStringify$3(node) {
298
298
  if (node === null) {
299
299
  return 'null';
300
300
  }
301
- const keys$1 = keys$a(node).sort();
301
+ const keys$1 = keys$b(node).sort();
302
302
  out = '';
303
303
  for (i = 0; i < keys$1.length; i++) {
304
304
  const key = keys$1[i];
@@ -569,13 +569,13 @@ class StringKeyInMemoryStore {
569
569
  return this.records[this.getCanonicalRecordId(key)];
570
570
  }
571
571
  getNumEntries() {
572
- return keys$a(this.records).length;
572
+ return keys$b(this.records).length;
573
573
  }
574
574
  readMetadata(key) {
575
575
  return this.metadata[this.getCanonicalRecordId(key)];
576
576
  }
577
577
  readMetadataWhere(query) {
578
- const keys$1 = keys$a(this.metadata);
578
+ const keys$1 = keys$b(this.metadata);
579
579
  const results = [];
580
580
  const hasNamespaceQuery = hasOwnProperty$3.call(query, 'namespace');
581
581
  const hasRepresentationNameQuery = hasOwnProperty$3.call(query, 'representationName');
@@ -671,8 +671,8 @@ class StringKeyInMemoryStore {
671
671
  // Note: we should always get the subscription references from this at the beginning
672
672
  // of the function, in case the reference changes (because of an unsubscribe)
673
673
  const { snapshotSubscriptions, watchSubscriptions, visitedIds, refreshedIds, insertedIds } = this;
674
- const allVisitedIds = keys$a(visitedIds);
675
- const allRefreshedIds = keys$a(refreshedIds);
674
+ const allVisitedIds = keys$b(visitedIds);
675
+ const allRefreshedIds = keys$b(refreshedIds);
676
676
  // Early exit if nothing has changed
677
677
  if (allVisitedIds.length === 0 && allRefreshedIds.length === 0) {
678
678
  return Promise.resolve();
@@ -1119,7 +1119,7 @@ function isPendingSnapshotWithNoOverlappingIds(snapshot, visitedIds, refreshedId
1119
1119
  hasOverlappingIds(snapshot, visitedIds) === false);
1120
1120
  }
1121
1121
  function getMatchingIds(partialKey, visitedIds) {
1122
- const keys$1 = keys$a(partialKey);
1122
+ const keys$1 = keys$b(partialKey);
1123
1123
  return visitedIds.filter((visitedId) => {
1124
1124
  return keys$1.every((key) => {
1125
1125
  return partialKey[key] === visitedId[key];
@@ -1746,8 +1746,8 @@ class InMemoryStore {
1746
1746
  } while (redirectKey !== undefined);
1747
1747
  }
1748
1748
  isUsingStringKeys() {
1749
- return (keys$a(this.fallbackStringKeyInMemoryStore.visitedIds).length !== 0 ||
1750
- keys$a(this.fallbackStringKeyInMemoryStore.refreshedIds).length !== 0);
1749
+ return (keys$b(this.fallbackStringKeyInMemoryStore.visitedIds).length !== 0 ||
1750
+ keys$b(this.fallbackStringKeyInMemoryStore.refreshedIds).length !== 0);
1751
1751
  }
1752
1752
  delegateToFallbackStringKeyStore(snapshot) {
1753
1753
  return !isErrorSnapshot$3(snapshot) && typeof snapshot.recordId === 'string';
@@ -1789,7 +1789,7 @@ class InMemoryStore {
1789
1789
  buildKeySchema(keyMetadata) {
1790
1790
  // pull NamespacedType type out of NormalizedKeyMetadata
1791
1791
  const { namespace: _ns, representationName: _rn, ...keyParamValues } = keyMetadata;
1792
- const keySchema = keys$a(keyParamValues).sort();
1792
+ const keySchema = keys$b(keyParamValues).sort();
1793
1793
  return ['namespace', 'representationName', ...keySchema];
1794
1794
  }
1795
1795
  }
@@ -2077,7 +2077,7 @@ class GraphNode {
2077
2077
  return value;
2078
2078
  }
2079
2079
  keys() {
2080
- return keys$a(this.data);
2080
+ return keys$b(this.data);
2081
2081
  }
2082
2082
  isScalar(propertyName) {
2083
2083
  // TODO W-6900046 - merge.ts casts these to any and manually sets `data`
@@ -2456,7 +2456,7 @@ class Reader {
2456
2456
  }
2457
2457
  }
2458
2458
  selectAllObject(record, data, visitedKeys) {
2459
- const recordKeys = keys$a(record);
2459
+ const recordKeys = keys$b(record);
2460
2460
  const { length } = recordKeys;
2461
2461
  for (let i = 0; i < length; i += 1) {
2462
2462
  const key = recordKeys[i];
@@ -2637,7 +2637,7 @@ class Reader {
2637
2637
  }
2638
2638
  const { baseSnapshotValue } = this.currentPath;
2639
2639
  if (isDefined$1(baseSnapshotValue)) {
2640
- this.snapshotChanged = keys$1.length !== keys$a(baseSnapshotValue).length;
2640
+ this.snapshotChanged = keys$1.length !== keys$b(baseSnapshotValue).length;
2641
2641
  }
2642
2642
  }
2643
2643
  checkIfChanged(value) {
@@ -2675,7 +2675,7 @@ class Reader {
2675
2675
  return this.markMissing();
2676
2676
  }
2677
2677
  const sink = (data[propertyName] = {});
2678
- const keys$1 = keys$a(obj);
2678
+ const keys$1 = keys$b(obj);
2679
2679
  this.checkIfObjectKeysLengthChanged(keys$1);
2680
2680
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
2681
2681
  const key = keys$1[i];
@@ -2686,7 +2686,7 @@ class Reader {
2686
2686
  }
2687
2687
  readLinkMap(propertyName, selection, record, data) {
2688
2688
  const map = record[propertyName];
2689
- const keys$1 = keys$a(map);
2689
+ const keys$1 = keys$b(map);
2690
2690
  const sink = {};
2691
2691
  this.checkIfObjectKeysLengthChanged(keys$1);
2692
2692
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
@@ -2814,7 +2814,7 @@ class Reader {
2814
2814
  return;
2815
2815
  }
2816
2816
  const sink = (data[propertyName] = {});
2817
- const keys$1 = keys$a(obj);
2817
+ const keys$1 = keys$b(obj);
2818
2818
  this.checkIfObjectKeysLengthChanged(keys$1);
2819
2819
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
2820
2820
  const key = keys$1[i];
@@ -3497,13 +3497,13 @@ class Luvio {
3497
3497
  // undefined values on the injected networkAdapter. So we do it here, on
3498
3498
  // the API that those adapters call to dispatch their ResourceRequests.
3499
3499
  const { queryParams, urlParams } = mergedResourceRequest;
3500
- for (const paramKey of keys$a(queryParams)) {
3500
+ for (const paramKey of keys$b(queryParams)) {
3501
3501
  const value = queryParams[paramKey];
3502
3502
  if (value === undefined) {
3503
3503
  delete queryParams[paramKey];
3504
3504
  }
3505
3505
  }
3506
- for (const paramKey of keys$a(urlParams)) {
3506
+ for (const paramKey of keys$b(urlParams)) {
3507
3507
  const value = urlParams[paramKey];
3508
3508
  if (value === undefined) {
3509
3509
  delete urlParams[paramKey];
@@ -3797,7 +3797,7 @@ function withDefaultLuvio(callback) {
3797
3797
  }
3798
3798
  callbacks.push(callback);
3799
3799
  }
3800
- // version: 1.136.6-0f5ec3ee7
3800
+ // version: 1.136.8-1a1062e42
3801
3801
 
3802
3802
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3803
3803
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15221,7 +15221,7 @@ function parseAndVisit(source) {
15221
15221
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15222
15222
  return luvioDocumentNode;
15223
15223
  }
15224
- // version: 1.136.6-0f5ec3ee7
15224
+ // version: 1.136.8-1a1062e42
15225
15225
 
15226
15226
  function unwrap(data) {
15227
15227
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16134,7 +16134,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16134
16134
  const { apiFamily, name } = metadata;
16135
16135
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16136
16136
  }
16137
- // version: 1.136.6-0f5ec3ee7
16137
+ // version: 1.136.8-1a1062e42
16138
16138
 
16139
16139
  /**
16140
16140
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16221,7 +16221,7 @@ var FragmentReadResultState;
16221
16221
 
16222
16222
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16223
16223
 
16224
- const { assign: assign$7, create: create$8, freeze: freeze$4, keys: keys$9 } = Object;
16224
+ const { assign: assign$7, create: create$8, freeze: freeze$4, keys: keys$a } = Object;
16225
16225
 
16226
16226
  ObjectCreate$3(null);
16227
16227
 
@@ -17059,7 +17059,7 @@ function getTypeCacheKeys$Q(luvio, input, fullPathFactory) {
17059
17059
  return rootKeySet;
17060
17060
  }
17061
17061
 
17062
- const { assign: assign$6, create: create$7, freeze: freeze$3, keys: keys$8 } = Object;
17062
+ const { assign: assign$6, create: create$7, freeze: freeze$3, keys: keys$9 } = Object;
17063
17063
  const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
17064
17064
  const { split, endsWith } = String.prototype;
17065
17065
  const { isArray: isArray$7 } = Array;
@@ -17077,7 +17077,7 @@ const getTypeCacheKeys$P = (luvio, input, _fullPathFactory) => {
17077
17077
  mergeable: true,
17078
17078
  });
17079
17079
  const input_childRelationships = input.childRelationships;
17080
- const input_childRelationships_keys = keys$8(input_childRelationships);
17080
+ const input_childRelationships_keys = keys$9(input_childRelationships);
17081
17081
  const input_childRelationships_length = input_childRelationships_keys.length;
17082
17082
  for (let i = 0; i < input_childRelationships_length; i++) {
17083
17083
  const key = input_childRelationships_keys[i];
@@ -17085,7 +17085,7 @@ const getTypeCacheKeys$P = (luvio, input, _fullPathFactory) => {
17085
17085
  rootKeySet.merge(cacheKeys);
17086
17086
  }
17087
17087
  const input_fields = input.fields;
17088
- const input_fields_keys = keys$8(input_fields);
17088
+ const input_fields_keys = keys$9(input_fields);
17089
17089
  const input_fields_length = input_fields_keys.length;
17090
17090
  for (let i = 0; i < input_fields_length; i++) {
17091
17091
  const key = input_fields_keys[i];
@@ -17552,7 +17552,7 @@ function dedupe(value) {
17552
17552
  for (let i = 0, len = value.length; i < len; i += 1) {
17553
17553
  result[value[i]] = true;
17554
17554
  }
17555
- return keys$8(result);
17555
+ return keys$9(result);
17556
17556
  }
17557
17557
  /**
17558
17558
  * @param source The array of string to filter
@@ -19000,7 +19000,7 @@ function convertRecordFieldsArrayToTrie(fields, optionalFields = []) {
19000
19000
  function createPathSelection(propertyName, fieldDefinition) {
19001
19001
  const fieldsSelection = [];
19002
19002
  const { children } = fieldDefinition;
19003
- const childrenKeys = keys$8(children);
19003
+ const childrenKeys = keys$9(children);
19004
19004
  for (let i = 0, len = childrenKeys.length; i < len; i += 1) {
19005
19005
  const childKey = childrenKeys[i];
19006
19006
  const childFieldDefinition = children[childKey];
@@ -19045,7 +19045,7 @@ function createPathSelection(propertyName, fieldDefinition) {
19045
19045
  */
19046
19046
  function createPathSelectionFromValue(fields) {
19047
19047
  const fieldsSelection = [];
19048
- const fieldNames = keys$8(fields);
19048
+ const fieldNames = keys$9(fields);
19049
19049
  for (let i = 0, len = fieldNames.length; i < len; i++) {
19050
19050
  const fieldName = fieldNames[i];
19051
19051
  const { value: fieldValue } = fields[fieldName];
@@ -19084,7 +19084,7 @@ function createPathSelectionFromValue(fields) {
19084
19084
  }
19085
19085
  function extractRecordFieldsRecursively(record) {
19086
19086
  const fields = [];
19087
- const fieldNames = keys$8(record.fields);
19087
+ const fieldNames = keys$9(record.fields);
19088
19088
  for (let i = 0, len = fieldNames.length; i < len; i++) {
19089
19089
  const fieldName = fieldNames[i];
19090
19090
  const { value: fieldValue } = record.fields[fieldName];
@@ -19272,7 +19272,7 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
19272
19272
  continue;
19273
19273
  }
19274
19274
  extractTrackedFieldsToTrie(spanningLink.data.__ref, spanning, next, config, spanningVisitedRecordIds, depth + 1);
19275
- if (keys$8(next.children).length > 0) {
19275
+ if (keys$9(next.children).length > 0) {
19276
19276
  current.children[key] = next;
19277
19277
  }
19278
19278
  else {
@@ -19324,13 +19324,13 @@ function isExternalLookupFieldKey(spanningNode) {
19324
19324
  return endsWith.call(spanningNode.scalar('apiName'), CUSTOM_EXTERNAL_OBJECT_FIELD_SUFFIX);
19325
19325
  }
19326
19326
  function convertTrieToFields(root) {
19327
- if (keys$8(root.children).length === 0) {
19327
+ if (keys$9(root.children).length === 0) {
19328
19328
  return [];
19329
19329
  }
19330
19330
  return convertTrieToFieldsRecursively(root);
19331
19331
  }
19332
19332
  function convertTrieToFieldsRecursively(root) {
19333
- const childKeys = keys$8(root.children);
19333
+ const childKeys = keys$9(root.children);
19334
19334
  if (childKeys.length === 0) {
19335
19335
  if (root.name === '') {
19336
19336
  return [];
@@ -19367,7 +19367,7 @@ const getObjectNameFromField = (field) => {
19367
19367
  function mergeFieldsTries(rootA, rootB) {
19368
19368
  const rootAchildren = rootA.children;
19369
19369
  const rootBchildren = rootB.children;
19370
- const childBKeys = keys$8(rootBchildren);
19370
+ const childBKeys = keys$9(rootBchildren);
19371
19371
  for (let i = 0, len = childBKeys.length; i < len; i++) {
19372
19372
  const childBKey = childBKeys[i];
19373
19373
  if (rootAchildren[childBKey] === undefined) {
@@ -19520,8 +19520,8 @@ function isSuperRecordFieldTrie(a, b) {
19520
19520
  }
19521
19521
  const childrenA = a.children;
19522
19522
  const childrenB = b.children;
19523
- const childKeysA = keys$8(childrenA);
19524
- const childKeysB = keys$8(childrenB);
19523
+ const childKeysA = keys$9(childrenA);
19524
+ const childKeysB = keys$9(childrenB);
19525
19525
  const childKeysBLength = childKeysB.length;
19526
19526
  if (childKeysBLength > childKeysA.length) {
19527
19527
  return false;
@@ -19545,7 +19545,7 @@ function mergePendingFields(newRecord, oldRecord) {
19545
19545
  // RecordRepresentationNormalized['fields'] to include `pending:true` property
19546
19546
  const mergedFields = { ...newRecord.fields };
19547
19547
  const merged = { ...newRecord, fields: mergedFields };
19548
- const existingFields = keys$8(oldRecord.fields);
19548
+ const existingFields = keys$9(oldRecord.fields);
19549
19549
  for (let i = 0, len = existingFields.length; i < len; i += 1) {
19550
19550
  const spanningFieldName = existingFields[i];
19551
19551
  if (newRecord.fields[spanningFieldName] === undefined) {
@@ -19678,7 +19678,7 @@ function merge$3(existing, incoming, luvio, _path, recordConflictMap) {
19678
19678
  if (isGraphNode(node)) {
19679
19679
  const dependencies = node.retrieve();
19680
19680
  if (dependencies !== null) {
19681
- const depKeys = keys$8(dependencies);
19681
+ const depKeys = keys$9(dependencies);
19682
19682
  for (let i = 0, len = depKeys.length; i < len; i++) {
19683
19683
  luvio.storeEvict(depKeys[i]);
19684
19684
  }
@@ -19825,7 +19825,7 @@ function addFieldsToStoreLink(fieldsTrie, optionalFieldsTrie, storeLink) {
19825
19825
  }
19826
19826
  for (let i = 0; i < fieldSubtries.length; i++) {
19827
19827
  const subtrie = fieldSubtries[i];
19828
- const fieldNames = keys$8(subtrie.children);
19828
+ const fieldNames = keys$9(subtrie.children);
19829
19829
  for (let i = 0; i < fieldNames.length; i++) {
19830
19830
  const fieldName = fieldNames[i];
19831
19831
  const childTrie = subtrie.children[fieldName];
@@ -19937,9 +19937,9 @@ function fulfill(existing, incoming) {
19937
19937
  return false;
19938
19938
  }
19939
19939
  }
19940
- const headersKeys = keys$8(headers);
19940
+ const headersKeys = keys$9(headers);
19941
19941
  const headersKeyLength = headersKeys.length;
19942
- if (headersKeyLength !== keys$8(existingHeaders).length) {
19942
+ if (headersKeyLength !== keys$9(existingHeaders).length) {
19943
19943
  return false;
19944
19944
  }
19945
19945
  for (let i = 0, len = headersKeyLength; i < len; i++) {
@@ -20708,7 +20708,7 @@ function buildNetworkSnapshot$V(luvio, config, serverRequestCount = 0, options)
20708
20708
 
20709
20709
  // iterate through the map to build configs for network calls
20710
20710
  function resolveConflict(luvio, map) {
20711
- const ids = keys$8(map.conflicts);
20711
+ const ids = keys$9(map.conflicts);
20712
20712
  if (ids.length === 0) {
20713
20713
  instrumentation$2.recordConflictsResolved(map.serverRequestCount);
20714
20714
  return;
@@ -21888,18 +21888,18 @@ function listFields(luvio, { fields = [], optionalFields = [], sortBy, }, listIn
21888
21888
  return {
21889
21889
  getRecordSelectionFieldSets() {
21890
21890
  const optionalPlusDefaultFields = { ...optionalFields_ };
21891
- const fields = keys$8(defaultFields_);
21891
+ const fields = keys$9(defaultFields_);
21892
21892
  for (let i = 0; i < fields.length; ++i) {
21893
21893
  const field = fields[i];
21894
21894
  if (!fields_[field] && !defaultServerFieldStatus.missingFields[field]) {
21895
21895
  optionalPlusDefaultFields[field] = true;
21896
21896
  }
21897
21897
  }
21898
- return [keys$8(fields_).sort(), keys$8(optionalPlusDefaultFields).sort()];
21898
+ return [keys$9(fields_).sort(), keys$9(optionalPlusDefaultFields).sort()];
21899
21899
  },
21900
21900
  processRecords(records) {
21901
21901
  const { missingFields } = defaultServerFieldStatus;
21902
- const fields = keys$8(missingFields);
21902
+ const fields = keys$9(missingFields);
21903
21903
  for (let i = 0; i < fields.length; ++i) {
21904
21904
  const field = fields[i], splitField = field.split('.').slice(1);
21905
21905
  for (let i = 0; i < records.length; ++i) {
@@ -24632,7 +24632,7 @@ function getMissingRecordLookupFields(record, objectInfo) {
24632
24632
  const lookupFields = {};
24633
24633
  const { apiName, fields: recordFields } = record;
24634
24634
  const { fields: objectInfoFields } = objectInfo;
24635
- const objectInfoFieldNames = keys$8(objectInfoFields);
24635
+ const objectInfoFieldNames = keys$9(objectInfoFields);
24636
24636
  for (let i = 0, len = objectInfoFieldNames.length; i < len; i += 1) {
24637
24637
  const fieldName = objectInfoFieldNames[i];
24638
24638
  const field = objectInfoFields[fieldName];
@@ -24651,12 +24651,12 @@ function getMissingRecordLookupFields(record, objectInfo) {
24651
24651
  const nameField = `${apiName}.${relationshipName}.${getNameField(objectInfo, fieldName)}`;
24652
24652
  lookupFields[nameField] = true;
24653
24653
  }
24654
- return keys$8(lookupFields);
24654
+ return keys$9(lookupFields);
24655
24655
  }
24656
24656
  function getRecordUiMissingRecordLookupFields(recordUi) {
24657
24657
  const { records, objectInfos } = recordUi;
24658
24658
  const recordLookupFields = {};
24659
- const recordIds = keys$8(records);
24659
+ const recordIds = keys$9(records);
24660
24660
  for (let i = 0, len = recordIds.length; i < len; i += 1) {
24661
24661
  const recordId = recordIds[i];
24662
24662
  const recordData = records[recordId];
@@ -24694,19 +24694,19 @@ function buildCachedSelectorKey(key) {
24694
24694
  }
24695
24695
  function eachLayout(recordUi, cb) {
24696
24696
  const { layouts } = recordUi;
24697
- const layoutApiNames = keys$8(layouts);
24697
+ const layoutApiNames = keys$9(layouts);
24698
24698
  for (let a = 0, len = layoutApiNames.length; a < len; a += 1) {
24699
24699
  const apiName = layoutApiNames[a];
24700
24700
  const apiNameData = layouts[apiName];
24701
- const recordTypeIds = keys$8(apiNameData);
24701
+ const recordTypeIds = keys$9(apiNameData);
24702
24702
  for (let b = 0, recordTypeIdsLen = recordTypeIds.length; b < recordTypeIdsLen; b += 1) {
24703
24703
  const recordTypeId = recordTypeIds[b];
24704
24704
  const recordTypeData = apiNameData[recordTypeId];
24705
- const layoutTypes = keys$8(recordTypeData);
24705
+ const layoutTypes = keys$9(recordTypeData);
24706
24706
  for (let c = 0, layoutTypesLen = layoutTypes.length; c < layoutTypesLen; c += 1) {
24707
24707
  const layoutType = layoutTypes[c];
24708
24708
  const layoutTypeData = recordTypeData[layoutType];
24709
- const modes = keys$8(layoutTypeData);
24709
+ const modes = keys$9(layoutTypeData);
24710
24710
  for (let d = 0, modesLen = modes.length; d < modesLen; d += 1) {
24711
24711
  const mode = modes[d];
24712
24712
  const layout = layoutTypeData[mode];
@@ -25085,11 +25085,11 @@ const recordLayoutFragmentSelector = [
25085
25085
  ];
25086
25086
  function getFieldsFromLayoutMap(layoutMap, objectInfo) {
25087
25087
  let fields = [];
25088
- const layoutTypes = keys$8(layoutMap);
25088
+ const layoutTypes = keys$9(layoutMap);
25089
25089
  for (let i = 0, layoutTypesLen = layoutTypes.length; i < layoutTypesLen; i += 1) {
25090
25090
  const layoutType = layoutTypes[i];
25091
25091
  const modesMap = layoutMap[layoutType];
25092
- const modes = keys$8(modesMap);
25092
+ const modes = keys$9(modesMap);
25093
25093
  for (let m = 0, modesLen = modes.length; m < modesLen; m += 1) {
25094
25094
  const mode = modes[m];
25095
25095
  const modeKeys = getQualifiedFieldApiNamesFromLayout(modesMap[mode], objectInfo);
@@ -29195,10 +29195,10 @@ function getTypeCacheKeys$x$1(luvio, input, fullPathFactory) {
29195
29195
  }
29196
29196
 
29197
29197
  const TTL$l = 300000;
29198
- const VERSION$N$1 = "38ee38ead5262047cfa7604e8bf72d4b";
29198
+ const VERSION$N$1 = "1781f2d3d4e413cf0c681774d82d02cd";
29199
29199
  const RepresentationType$v = 'AppRepresentation';
29200
29200
  function keyBuilder$17(luvio, config) {
29201
- return keyPrefix$1 + '::' + RepresentationType$v + ':' + config.appId;
29201
+ return keyPrefix$1 + '::' + RepresentationType$v + ':' + (config.appId === null ? '' : config.appId);
29202
29202
  }
29203
29203
  function keyBuilderFromType$j(luvio, object) {
29204
29204
  const keyParams = {
@@ -29346,11 +29346,6 @@ function equals$A(existing, incoming) {
29346
29346
  if (!(existing_selected === incoming_selected)) {
29347
29347
  return false;
29348
29348
  }
29349
- const existing_appId = existing.appId;
29350
- const incoming_appId = incoming.appId;
29351
- if (!(existing_appId === incoming_appId)) {
29352
- return false;
29353
- }
29354
29349
  const existing_developerName = existing.developerName;
29355
29350
  const incoming_developerName = incoming.developerName;
29356
29351
  if (!(existing_developerName === incoming_developerName)) {
@@ -29386,6 +29381,11 @@ function equals$A(existing, incoming) {
29386
29381
  if (!(existing_type === incoming_type)) {
29387
29382
  return false;
29388
29383
  }
29384
+ const existing_appId = existing.appId;
29385
+ const incoming_appId = incoming.appId;
29386
+ if (!(existing_appId === incoming_appId)) {
29387
+ return false;
29388
+ }
29389
29389
  const existing_description = existing.description;
29390
29390
  const incoming_description = incoming.description;
29391
29391
  if (!(existing_description === incoming_description)) {
@@ -40017,7 +40017,7 @@ function optimisticUpdate(cachedLayoutUserState, layoutUserStateInput) {
40017
40017
  let clonedLayoutUserStateSections;
40018
40018
  const { sectionUserStates } = layoutUserStateInput;
40019
40019
  const { sectionUserStates: cachedSectionUserStates } = cachedLayoutUserState;
40020
- const sectionUserStateKeys = keys$8(sectionUserStates);
40020
+ const sectionUserStateKeys = keys$9(sectionUserStates);
40021
40021
  for (let i = 0, len = sectionUserStateKeys.length; i < len; i += 1) {
40022
40022
  const sectionId = sectionUserStateKeys[i];
40023
40023
  if (cachedSectionUserStates[sectionId] === undefined) {
@@ -43901,7 +43901,7 @@ withDefaultLuvio((luvio) => {
43901
43901
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
43902
43902
  });
43903
43903
  });
43904
- // version: 1.136.6-acf28210f
43904
+ // version: 1.136.8-449f5be71
43905
43905
 
43906
43906
  var caseSensitiveUserId = '005B0000000GR4OIAW';
43907
43907
 
@@ -43979,7 +43979,7 @@ function formattingOptions(pattern) {
43979
43979
  const { parse: parse$5, stringify: stringify$5 } = JSON;
43980
43980
  const { join: join$2, push: push$2, unshift } = Array.prototype;
43981
43981
  const { isArray: isArray$5 } = Array;
43982
- const { entries: entries$3, keys: keys$6 } = Object;
43982
+ const { entries: entries$3, keys: keys$7 } = Object;
43983
43983
 
43984
43984
  const UI_API_BASE_URI = '/services/data/v59.0/ui-api';
43985
43985
 
@@ -44044,7 +44044,7 @@ function isSpanningRecord$1(fieldValue) {
44044
44044
  function mergeRecordFields$1(first, second) {
44045
44045
  const { fields: targetFields } = first;
44046
44046
  const { fields: sourceFields } = second;
44047
- const fieldNames = keys$6(sourceFields);
44047
+ const fieldNames = keys$7(sourceFields);
44048
44048
  for (let i = 0, len = fieldNames.length; i < len; i += 1) {
44049
44049
  const fieldName = fieldNames[i];
44050
44050
  const sourceField = sourceFields[fieldName];
@@ -44448,7 +44448,7 @@ function isDeprecatedDurableStoreEntry(durableRecord) {
44448
44448
  }
44449
44449
  const DefaultDurableSegment = 'DEFAULT';
44450
44450
 
44451
- const { keys: keys$5, create: create$5, assign: assign$4, freeze: freeze$1$1 } = Object;
44451
+ const { keys: keys$6, create: create$5, assign: assign$4, freeze: freeze$1$1 } = Object;
44452
44452
 
44453
44453
  //Durable store error instrumentation key
44454
44454
  const DURABLE_STORE_ERROR = 'durable-store-error';
@@ -44492,7 +44492,7 @@ function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
44492
44492
  if (durableRecords === undefined) {
44493
44493
  return { revivedKeys, hadUnexpectedShape };
44494
44494
  }
44495
- const durableKeys = keys$5(durableRecords);
44495
+ const durableKeys = keys$6(durableRecords);
44496
44496
  if (durableKeys.length === 0) {
44497
44497
  // no records to revive
44498
44498
  return { revivedKeys, hadUnexpectedShape };
@@ -44666,7 +44666,7 @@ class DurableTTLStore {
44666
44666
  overrides,
44667
44667
  };
44668
44668
  }
44669
- const keys$1 = keys$5(entries);
44669
+ const keys$1 = keys$6(entries);
44670
44670
  for (let i = 0, len = keys$1.length; i < len; i++) {
44671
44671
  const key = keys$1[i];
44672
44672
  const entry = entries[key];
@@ -44694,7 +44694,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
44694
44694
  // TODO: W-8909393 Once metadata is stored in its own segment we need to
44695
44695
  // call setEntries for the visitedIds on default segment and call setEntries
44696
44696
  // on the metadata segment for the refreshedIds
44697
- const keys$1 = keys$5({ ...visitedIds, ...refreshedIds });
44697
+ const keys$1 = keys$6({ ...visitedIds, ...refreshedIds });
44698
44698
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
44699
44699
  const key = keys$1[i];
44700
44700
  const record = records[key];
@@ -44716,7 +44716,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
44716
44716
  }
44717
44717
  const durableStoreOperations = [];
44718
44718
  // publishes
44719
- const recordKeys = keys$5(durableRecords);
44719
+ const recordKeys = keys$6(durableRecords);
44720
44720
  if (recordKeys.length > 0) {
44721
44721
  durableStoreOperations.push({
44722
44722
  type: 'setEntries',
@@ -44725,7 +44725,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
44725
44725
  });
44726
44726
  }
44727
44727
  // evicts
44728
- const evictedKeys = keys$5(evictedRecords);
44728
+ const evictedKeys = keys$6(evictedRecords);
44729
44729
  if (evictedKeys.length > 0) {
44730
44730
  durableStoreOperations.push({
44731
44731
  type: 'evictEntries',
@@ -44879,7 +44879,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
44879
44879
  try {
44880
44880
  const entries = await durableStore.getEntries(adapterContextKeysFromDifferentInstance, AdapterContextSegment);
44881
44881
  if (entries !== undefined) {
44882
- const entryKeys = keys$5(entries);
44882
+ const entryKeys = keys$6(entries);
44883
44883
  for (let i = 0, len = entryKeys.length; i < len; i++) {
44884
44884
  const entryKey = entryKeys[i];
44885
44885
  const entry = entries[entryKey];
@@ -45696,6 +45696,12 @@ function getRelationshipInfo(apiName, fieldName, infoMap) {
45696
45696
  function stringLiteral(value, safe = false, isCaseSensitive = false) {
45697
45697
  return { type: ValueType.StringLiteral, value, safe, isCaseSensitive };
45698
45698
  }
45699
+ function isStringLiteral(expression) {
45700
+ return expression.type === ValueType.StringLiteral;
45701
+ }
45702
+ function isStringArray(expression) {
45703
+ return expression.type === ValueType.StringArray;
45704
+ }
45699
45705
  function comparison(left, operator, right) {
45700
45706
  return { type: PredicateType$1.comparison, left, right, operator };
45701
45707
  }
@@ -46466,6 +46472,9 @@ function compoundOperatorToSql(operator) {
46466
46472
  }
46467
46473
  }
46468
46474
 
46475
+ const { isArray: isArray$4 } = Array;
46476
+ const { keys: keys$5 } = Object;
46477
+
46469
46478
  function isListValueNode(node) {
46470
46479
  return node.kind === 'ListValue';
46471
46480
  }
@@ -46518,13 +46527,13 @@ function isScalarDataType(type) {
46518
46527
  const NotOperator = 'not';
46519
46528
  const { eq, ne, gt, gte, lt, lte, nin, like, includes, excludes } = ComparisonOperator;
46520
46529
  const inOp = ComparisonOperator.in;
46521
- function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperator = CompoundOperator.and, joins) {
46530
+ function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperator = CompoundOperator.and, joins, draftFunctions) {
46522
46531
  const results = fieldValues
46523
46532
  .map((value) => {
46524
46533
  if (!isObjectValueNode$1(value)) {
46525
46534
  return [failure([message('Parent filter node should be an object.')])];
46526
46535
  }
46527
- return Object.entries(value.fields).map(([key, value]) => filter(key, value, joinAlias, apiName, input, joins));
46536
+ return Object.entries(value.fields).map(([key, value]) => filter(key, value, joinAlias, apiName, input, joins, draftFunctions));
46528
46537
  })
46529
46538
  .reduce(flatten$1, []);
46530
46539
  const failures = results.filter(isFailure).reduce(flatMap$1(errors), []);
@@ -46546,22 +46555,22 @@ function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperato
46546
46555
  return success({ predicate: resolvedPredicate });
46547
46556
  }
46548
46557
  //{where: {Field: ... | and: ... | or: ... | not: ...}}
46549
- function recordFilter(where, joinAlias, apiName, input, joins) {
46558
+ function recordFilter(where, joinAlias, apiName, input, joins, draftFunctions) {
46550
46559
  if (where === undefined) {
46551
46560
  return success(undefined);
46552
46561
  }
46553
46562
  // when 'recordFilter' starts, there is no 'NotPredicated'
46554
- return fieldsToFilters([where.value], joinAlias, apiName, input, CompoundOperator.and, joins).map((result) => result.predicate === undefined || isEmptyPredicate(result.predicate) ? undefined : result);
46563
+ return fieldsToFilters([where.value], joinAlias, apiName, input, CompoundOperator.and, joins, draftFunctions).map((result) => result.predicate === undefined || isEmptyPredicate(result.predicate) ? undefined : result);
46555
46564
  }
46556
- function filter(name, value, tableAlias, apiName, input, joins) {
46565
+ function filter(name, value, tableAlias, apiName, input, joins, draftFunctions) {
46557
46566
  if (isCompoundOperator(name)) {
46558
46567
  if (!isListValueNode(value)) {
46559
46568
  return failure([message(`Value for ${name} node must be a list.`)]);
46560
46569
  }
46561
- return compoundPredicate(name, value, tableAlias, apiName, input, joins);
46570
+ return compoundPredicate(name, value, tableAlias, apiName, input, joins, draftFunctions);
46562
46571
  }
46563
46572
  if (name === NotOperator) {
46564
- const children = fieldsToFilters([value], tableAlias, apiName, input, CompoundOperator.and, joins);
46573
+ const children = fieldsToFilters([value], tableAlias, apiName, input, CompoundOperator.and, joins, draftFunctions);
46565
46574
  // take the children of a not predicate
46566
46575
  // and wrap them all inside it
46567
46576
  return children.flatMap((container) => {
@@ -46579,10 +46588,10 @@ function filter(name, value, tableAlias, apiName, input, joins) {
46579
46588
  if (!isObjectValueNode$1(value)) {
46580
46589
  return failure([message('Filter node must be an object or list.')]);
46581
46590
  }
46582
- return fieldFilter(name, value, tableAlias, apiName, input, joins);
46591
+ return fieldFilter(name, value, tableAlias, apiName, input, joins, draftFunctions);
46583
46592
  }
46584
- function compoundPredicate(operator, list, joinAlias, apiName, input, joins) {
46585
- return fieldsToFilters(list.values, joinAlias, apiName, input, operator, joins);
46593
+ function compoundPredicate(operator, list, joinAlias, apiName, input, joins, draftFunctions) {
46594
+ return fieldsToFilters(list.values, joinAlias, apiName, input, operator, joins, draftFunctions);
46586
46595
  }
46587
46596
  /**
46588
46597
  * spans a FieldNode with its ObjectValueNode is passed. All the predicates is added into the 'join' array.
@@ -46593,7 +46602,7 @@ function compoundPredicate(operator, list, joinAlias, apiName, input, joins) {
46593
46602
  * @param joins
46594
46603
  * @returns undefined predicate
46595
46604
  */
46596
- function spanningFilter(fieldInfo, fieldNode, alias, input, joins) {
46605
+ function spanningFilter(fieldInfo, fieldNode, alias, input, joins, draftFunctions) {
46597
46606
  const { apiName: fieldName, referenceToInfos, relationshipName } = fieldInfo;
46598
46607
  const referenceInfo = referenceToInfos[0];
46599
46608
  const jsonAlias = `${alias}.${relationshipName}`;
@@ -46612,7 +46621,7 @@ function spanningFilter(fieldInfo, fieldNode, alias, input, joins) {
46612
46621
  joins.push(join);
46613
46622
  // moves constraint predicate to where
46614
46623
  const constraintPredicates = [];
46615
- const filterResult = fieldsToFilters([fieldNode], jsonAlias, apiName, input, CompoundOperator.and, joins);
46624
+ const filterResult = fieldsToFilters([fieldNode], jsonAlias, apiName, input, CompoundOperator.and, joins, draftFunctions);
46616
46625
  if (filterResult.isSuccess === false) {
46617
46626
  return filterResult;
46618
46627
  }
@@ -46624,7 +46633,11 @@ function spanningFilter(fieldInfo, fieldNode, alias, input, joins) {
46624
46633
  });
46625
46634
  return success({ predicate: combinePredicates(constraintPredicates, CompoundOperator.and) });
46626
46635
  }
46627
- function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
46636
+ function isIDValueField$1(fieldInfo) {
46637
+ return (fieldInfo.apiName === 'Id' ||
46638
+ (fieldInfo.referenceToInfos !== undefined && fieldInfo.referenceToInfos.length > 0));
46639
+ }
46640
+ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins, draftFunctions) {
46628
46641
  const fieldInfoResult = getFieldInfo(apiName, fieldName, input);
46629
46642
  if (fieldInfoResult.isSuccess === false) {
46630
46643
  return failure([fieldInfoResult.error]);
@@ -46634,8 +46647,9 @@ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
46634
46647
  return failure([message(`Field ${fieldName} for type ${apiName} not found.`)]);
46635
46648
  }
46636
46649
  if (fieldInfo.dataType === 'Reference' && fieldInfo.relationshipName === fieldName) {
46637
- return spanningFilter(fieldInfo, fieldNode, alias, input, joins);
46650
+ return spanningFilter(fieldInfo, fieldNode, alias, input, joins, draftFunctions);
46638
46651
  }
46652
+ const idProcessingNeeded = isIDValueField$1(fieldInfo);
46639
46653
  const extract = {
46640
46654
  type: ValueType.Extract,
46641
46655
  jsonAlias: alias,
@@ -46726,7 +46740,29 @@ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
46726
46740
  children,
46727
46741
  };
46728
46742
  }
46729
- return comparison(extract, op.operator, op.value);
46743
+ const rightOperand = op.value;
46744
+ if (idProcessingNeeded) {
46745
+ if (isStringLiteral(rightOperand)) {
46746
+ if (rightOperand.value !== null) {
46747
+ if (draftFunctions.isDraftId(rightOperand.value)) {
46748
+ rightOperand.value = draftFunctions.getCanonicalId(rightOperand.value);
46749
+ }
46750
+ }
46751
+ }
46752
+ else if (isStringArray(rightOperand)) {
46753
+ if (rightOperand.value !== null) {
46754
+ rightOperand.value = rightOperand.value.map((originalId) => {
46755
+ if (originalId !== null) {
46756
+ if (draftFunctions.isDraftId(originalId)) {
46757
+ return draftFunctions.getCanonicalId(originalId);
46758
+ }
46759
+ }
46760
+ return originalId;
46761
+ });
46762
+ }
46763
+ }
46764
+ }
46765
+ return comparison(extract, op.operator, rightOperand);
46730
46766
  });
46731
46767
  const combined = combinePredicates(comparisons.concat(...dateFunction.value), CompoundOperator.and);
46732
46768
  const container = {
@@ -47828,7 +47864,7 @@ function recordQuery(selection, apiName, alias, predicates, input) {
47828
47864
  const orderByJoins = [];
47829
47865
  const orderByResult = parseOrderBy(orderByArg, alias, apiName, input.objectInfoMap, orderByJoins);
47830
47866
  const filterJoins = [];
47831
- const whereResult = recordFilter(whereArg, alias, apiName, input.objectInfoMap, filterJoins);
47867
+ const whereResult = recordFilter(whereArg, alias, apiName, input.objectInfoMap, filterJoins, input.draftFunctions);
47832
47868
  const scopeJoins = [];
47833
47869
  const scopeResult = scopeFilter(scopeArg, alias, apiName, input, scopeJoins);
47834
47870
  let additionalPredicates = [];
@@ -47990,27 +48026,19 @@ function generateVariableGQLQuery(document, variables) {
47990
48026
  ? node.arguments
47991
48027
  .map((args) => {
47992
48028
  const { value, name } = args;
48029
+ //The variable is on the top level, for example `where: ${filter}`
47993
48030
  if (is(value, 'Variable')) {
47994
- const variable = variables[value.name];
47995
- if (variable) {
47996
- const jsonString = JSON.stringify(variable);
47997
- const buildRecordQueryString = (name, query, transform) => {
47998
- return `${name}: ${transform(query)}`;
47999
- };
48000
- switch (name) {
48001
- case 'scope':
48002
- case 'orderBy':
48003
- return buildRecordQueryString(name, jsonString, removeAllQuotations);
48004
- default:
48005
- return buildRecordQueryString(name, jsonString, removeQuotationsFromKeys);
48006
- }
48007
- }
48008
- return '';
48031
+ return generateVariableNodeQuery(value, name, name, variables);
48032
+ }
48033
+ else if (isObjectValueNode$1(value)) {
48034
+ return generateVariableSubQuery(value, name, name, variables);
48009
48035
  }
48010
48036
  })
48011
48037
  .filter(Boolean)
48012
48038
  : undefined;
48013
- return gqlArguments ? `${node.name}(${gqlArguments.join(',')}) { Id }` : '';
48039
+ return gqlArguments
48040
+ ? `${node.name} ${gqlArguments.length > 0 ? '(' + gqlArguments.join(',') + ')' : ''} { Id }`
48041
+ : '';
48014
48042
  })
48015
48043
  //remove empty strings
48016
48044
  .filter(Boolean)
@@ -48020,6 +48048,51 @@ function generateVariableGQLQuery(document, variables) {
48020
48048
  return [accu.slice(0, 1), query, accu.slice(1, length)].join('');
48021
48049
  }, '{ }'));
48022
48050
  }
48051
+ /**
48052
+ * Given a LuvioValueNode, generates a sql with its variable node replaced with actual value.
48053
+ * @param valueNode G
48054
+ * @param name
48055
+ * @param type
48056
+ * @param variables
48057
+ * @returns
48058
+ */
48059
+ function generateVariableSubQuery(valueNode, name, type, variables) {
48060
+ switch (valueNode.kind) {
48061
+ case Kind.OBJECT: {
48062
+ // For example, `{ Id: { eq: $draftId } }` is a `ObjectValueNode`, which has field keys 'Id'
48063
+ const resultQuery = keys$5(valueNode.fields)
48064
+ .map((key) => generateVariableSubQuery(valueNode.fields[key], key, type, variables))
48065
+ .filter((subquery) => subquery.length > 0)
48066
+ .join(',');
48067
+ if (resultQuery.length > 0) {
48068
+ return `${name}: {${resultQuery}}`;
48069
+ }
48070
+ return resultQuery;
48071
+ }
48072
+ case Kind.VARIABLE:
48073
+ return generateVariableNodeQuery(valueNode, name, type, variables);
48074
+ default:
48075
+ return '';
48076
+ }
48077
+ }
48078
+ // Generate a sql for the variable node with its actual value.
48079
+ function generateVariableNodeQuery(value, name, type, variables) {
48080
+ const variable = variables[value.name];
48081
+ if (variable) {
48082
+ const jsonString = JSON.stringify(variable);
48083
+ const buildRecordQueryString = (name, query, transform) => {
48084
+ return `${name}: ${transform(query)}`;
48085
+ };
48086
+ switch (type) {
48087
+ case 'scope':
48088
+ case 'orderBy':
48089
+ return buildRecordQueryString(name, jsonString, removeAllQuotations);
48090
+ default:
48091
+ return buildRecordQueryString(name, jsonString, removeQuotationsFromKeys);
48092
+ }
48093
+ }
48094
+ return '';
48095
+ }
48023
48096
  /**
48024
48097
  * Given an AST with variables
48025
48098
  * Swap out the LuvioArgumentNodes on the original AST with ones generated from its variables.
@@ -48038,14 +48111,43 @@ function swapVariableArguments(document, variables) {
48038
48111
  const { name } = node;
48039
48112
  const first = allArgumentRecords.find((n) => n.name === name);
48040
48113
  if (first) {
48041
- // if we had arguments that did not contain variables we still want those
48042
- first.arguments = flatten$1(first.arguments
48043
- ? first.arguments.filter((x) => x.value.kind !== 'Variable')
48044
- : [], node.arguments ? node.arguments : []);
48114
+ const swappedArgments = swapArgumentWithVariableNodes(node.arguments, first.arguments);
48115
+ first.arguments = swappedArgments ? swappedArgments : [];
48045
48116
  }
48046
48117
  });
48047
48118
  }
48048
48119
  }
48120
+ // Replaces the variable node in original LuvioArgumentNode with the actual value in the swapped node with the same path.
48121
+ function swapArgumentWithVariableNodes(swapped, original) {
48122
+ if (swapped === undefined || original === undefined) {
48123
+ return original;
48124
+ }
48125
+ return original.map((x) => {
48126
+ const targetNode = swapped.find((y) => y.name === x.name);
48127
+ if (targetNode === undefined) {
48128
+ return x;
48129
+ }
48130
+ if (x.value.kind === 'Variable') {
48131
+ return targetNode;
48132
+ }
48133
+ swapValueNodeWithVariableNodes(x.value, targetNode.value);
48134
+ return x;
48135
+ });
48136
+ }
48137
+ function swapValueNodeWithVariableNodes(original, swapped) {
48138
+ if (original.kind === Kind.OBJECT) {
48139
+ for (const key of keys$5(original.fields)) {
48140
+ if (isObjectValueNode$1(swapped) && swapped.fields[key]) {
48141
+ if (is(original.fields[key], 'Variable')) {
48142
+ original.fields[key] = swapped.fields[key];
48143
+ }
48144
+ else {
48145
+ swapValueNodeWithVariableNodes(original.fields[key], swapped.fields[key]);
48146
+ }
48147
+ }
48148
+ }
48149
+ }
48150
+ }
48049
48151
  //find top level record queries
48050
48152
  function findRecordSelections$1(document) {
48051
48153
  return document.definitions
@@ -48080,7 +48182,7 @@ class StoreEvalPreconditioner {
48080
48182
  * Missing object info records triggers the objectInfoService (same instance shared with Drafts code), to
48081
48183
  * use the getObjectInfos adapter to efficiently fetch the necessary records.
48082
48184
  */
48083
- async createRootQuery(config, objectInfoService, userId) {
48185
+ async createRootQuery(config, objectInfoService, userId, draftFunctions) {
48084
48186
  const { query: ast, variables } = config;
48085
48187
  swapVariableArguments(ast, variables);
48086
48188
  // Parse out top-level record queries types we know we will need, since spanning fields will
@@ -48127,6 +48229,7 @@ class StoreEvalPreconditioner {
48127
48229
  astTransformResult = transform(ast, {
48128
48230
  userId,
48129
48231
  objectInfoMap,
48232
+ draftFunctions,
48130
48233
  });
48131
48234
  if (astTransformResult.isSuccess === false) {
48132
48235
  for (const error of astTransformResult.error) {
@@ -48164,8 +48267,6 @@ class StoreEvalPreconditioner {
48164
48267
  }
48165
48268
  }
48166
48269
 
48167
- const { isArray: isArray$4 } = Array;
48168
-
48169
48270
  /**
48170
48271
  * Checks a GraphQL-shaped network response for errors, returning true if it does
48171
48272
  * and false otherwise
@@ -48211,7 +48312,7 @@ const wrapStartEndEvents = (storeEval) => {
48211
48312
  return snapshot;
48212
48313
  };
48213
48314
  };
48214
- function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService) {
48315
+ function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService, draftFunctions) {
48215
48316
  // if the store does not support eval then use the noop version
48216
48317
  if (sqliteStore.isEvalSupported() === false) {
48217
48318
  return noopStoreEval;
@@ -48219,7 +48320,7 @@ function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService) {
48219
48320
  const preconditioner = new StoreEvalPreconditioner();
48220
48321
  return makeStoreEval(preconditioner, objectInfoService, userId, async () => {
48221
48322
  return undefined;
48222
- }, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore));
48323
+ }, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore), draftFunctions);
48223
48324
  }
48224
48325
  async function noopStoreEval(_config, nonEvaluatedSnapshotOrPromise, _observers) {
48225
48326
  return nonEvaluatedSnapshotOrPromise;
@@ -48238,7 +48339,7 @@ function isErrorSnapshotThatShouldGetReturnedToCaller$1(snapshot) {
48238
48339
  function generateUniqueRecordId$1() {
48239
48340
  return `${GRAPHQL_ROOT_KEY$1}${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
48240
48341
  }
48241
- function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator) {
48342
+ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator, draftFunctions) {
48242
48343
  const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers) => {
48243
48344
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
48244
48345
  // the non-eval'ed input could either be a snapshot or promise of one so
@@ -48268,7 +48369,7 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
48268
48369
  context = await contextProvider();
48269
48370
  // Ensures ObjectInfo metadata is available for the request. Sourcing records from L1/L2/Network
48270
48371
  // is delegated to the getObjectInfo adapter via objectInfoService
48271
- rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId);
48372
+ rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId, draftFunctions);
48272
48373
  }
48273
48374
  catch (error) {
48274
48375
  eventEmitter({
@@ -56222,7 +56323,7 @@ function generateUniqueRecordId() {
56222
56323
  return `UiApi::GraphQLRepresentation:${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
56223
56324
  }
56224
56325
  // Recursively replace draft ids with canonical ids
56225
- const replaceDraftIdsInVariables = (variables, draftFunctions, unmappedDraftIDs) => {
56326
+ const replaceDraftIdsInVariables$1 = (variables, draftFunctions, unmappedDraftIDs) => {
56226
56327
  const replace = (object) => {
56227
56328
  if (typeof object === 'string') {
56228
56329
  if (!draftFunctions.isDraftId(object)) {
@@ -56279,7 +56380,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
56279
56380
  unmappedDraftIDs,
56280
56381
  } = await injectSyntheticFields(copy, objectInfoService, draftFunctions, config.variables));
56281
56382
  if (config.variables) {
56282
- config.variables = replaceDraftIdsInVariables(config.variables, draftFunctions, unmappedDraftIDs);
56383
+ config.variables = replaceDraftIdsInVariables$1(config.variables, draftFunctions, unmappedDraftIDs);
56283
56384
  }
56284
56385
  }
56285
56386
  catch (throwable) {
@@ -57865,7 +57966,7 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter) {
57865
57966
  }, networkAdapter);
57866
57967
  }
57867
57968
 
57868
- const { keys: keys$7, create: create$6, assign: assign$5, entries } = Object;
57969
+ const { keys: keys$8, create: create$6, assign: assign$5, entries } = Object;
57869
57970
  const { stringify: stringify$6, parse: parse$6 } = JSON;
57870
57971
  const { push, join, slice } = Array.prototype;
57871
57972
 
@@ -58425,7 +58526,7 @@ class LdsDataTable {
58425
58526
  },
58426
58527
  conflictColumns: this.conflictColumnNames,
58427
58528
  columns: this.columnNames,
58428
- rows: keys$7(entries).reduce((rows, key) => {
58529
+ rows: keys$8(entries).reduce((rows, key) => {
58429
58530
  const entry = entries[key];
58430
58531
  const { data, metadata } = entry;
58431
58532
  const row = [key, stringify$6(data), metadata ? stringify$6(metadata) : null];
@@ -58486,7 +58587,7 @@ class AbstractKeyValueDataTable {
58486
58587
  },
58487
58588
  conflictColumns: this.conflictColumnNames,
58488
58589
  columns: this.columnNames,
58489
- rows: keys$7(entries).reduce((rows, key) => {
58590
+ rows: keys$8(entries).reduce((rows, key) => {
58490
58591
  const entry = entries[key];
58491
58592
  rows.push([key, stringify$6(entry.data)]);
58492
58593
  return rows;
@@ -58571,7 +58672,7 @@ class LdsInternalDataTable {
58571
58672
  },
58572
58673
  conflictColumns: this.conflictColumnNames,
58573
58674
  columns: this.columnNames,
58574
- rows: keys$7(entries).reduce((rows, key) => {
58675
+ rows: keys$8(entries).reduce((rows, key) => {
58575
58676
  const entry = entries[key];
58576
58677
  const { data, metadata } = entry;
58577
58678
  const row = [key, stringify$6(data)];
@@ -59435,11 +59536,6 @@ function getRuntime() {
59435
59536
  getIngestMetadataForInternalAdapters =
59436
59537
  internalAdapterDurableEnvironment.getIngestStagingStoreRecords;
59437
59538
  lazyObjectInfoService = new ObjectInfoService(getObjectInfo, getObjectInfos, internalAdapterDurableStore);
59438
- // set storeEval function for lds-adapters-graghql to use
59439
- withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
59440
- const { configuration: { setStoreEval }, } = registration;
59441
- setStoreEval(sqliteStoreEvalFactory(userId, lazyBaseDurableStore, lazyObjectInfoService));
59442
- });
59443
59539
  // creates a durable store that denormalizes scalar fields for records
59444
59540
  let getIngestRecords;
59445
59541
  let getIngestMetadata;
@@ -59478,6 +59574,20 @@ function getRuntime() {
59478
59574
  setupMobileInstrumentation();
59479
59575
  // If the inspection nimbus plugin is configured, inspection is enabled otherwise this is a no-op
59480
59576
  setupInspection(lazyLuvio);
59577
+ // set storeEval function for lds-adapters-graghql to use
59578
+ withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
59579
+ const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
59580
+ const getCanonicalId = (id) => {
59581
+ var _a;
59582
+ return ((_a = extractRecordIdFromStoreKey(lazyLuvio.storeGetCanonicalKey(RECORD_ID_PREFIX + id))) !== null && _a !== void 0 ? _a : id);
59583
+ };
59584
+ const draftFuncs = {
59585
+ isDraftId: isGenerated,
59586
+ getCanonicalId,
59587
+ };
59588
+ setStoreEval(sqliteStoreEvalFactory(userId, lazyBaseDurableStore, lazyObjectInfoService, draftFuncs));
59589
+ setDraftFunctions(draftFuncs);
59590
+ });
59481
59591
  // on core the graphql configuration is split so we need to set configureUIAPIGraphQL both in the
59482
59592
  // graphql registration and the uiapi for off core
59483
59593
  const configureUIAPIGraphQL = (registration) => {
@@ -59527,7 +59637,7 @@ register({
59527
59637
  id: '@salesforce/lds-network-adapter',
59528
59638
  instrument: instrument$1,
59529
59639
  });
59530
- // version: 1.136.6-0f5ec3ee7
59640
+ // version: 1.136.8-1a1062e42
59531
59641
 
59532
59642
  const { create: create$2, keys: keys$2 } = Object;
59533
59643
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -73961,7 +74071,7 @@ register({
73961
74071
  configuration: { ...configurationForGraphQLAdapters },
73962
74072
  instrument,
73963
74073
  });
73964
- // version: 1.136.6-acf28210f
74074
+ // version: 1.136.8-449f5be71
73965
74075
 
73966
74076
  // On core the unstable adapters are re-exported with different names,
73967
74077
 
@@ -75333,10 +75443,14 @@ function validate(ast, variables) {
75333
75443
  }
75334
75444
 
75335
75445
  let storeEval = undefined;
75446
+ let draftFunctions = undefined;
75336
75447
  const configuration = {
75337
75448
  setStoreEval: function (storeEvalArg) {
75338
75449
  storeEval = storeEvalArg;
75339
75450
  },
75451
+ setDraftFunctions: function (draftFuncs) {
75452
+ draftFunctions = draftFuncs;
75453
+ },
75340
75454
  };
75341
75455
 
75342
75456
  const assignedToMe = {
@@ -75422,6 +75536,78 @@ function shouldInjectFields(ast) {
75422
75536
  function injectFieldsGQL(ast) {
75423
75537
  return injectScopeFields(ast);
75424
75538
  }
75539
+ function swapIdsOfDocumentNode(documentnode, draftFunctions) {
75540
+ const recordNodes = findRecordSelections(documentnode);
75541
+ recordNodes.forEach((recordConnection) => {
75542
+ swapIdsOfFieldNode(recordConnection, draftFunctions);
75543
+ });
75544
+ return documentnode;
75545
+ }
75546
+ function swapIdsOfFieldNode(selectionNode, draftFunctions) {
75547
+ if (isCustomFieldNode(selectionNode) &&
75548
+ selectionNode.type === 'Connection' &&
75549
+ selectionNode.arguments !== undefined &&
75550
+ selectionNode.arguments.some((argment) => argment.name === 'where')) {
75551
+ const swappedArguments = selectionNode.arguments.map((argument) => {
75552
+ if (argument.name === 'where') {
75553
+ return {
75554
+ ...argument,
75555
+ value: swapIdsOfValueNode(argument.value, draftFunctions.isDraftId, draftFunctions.getCanonicalId),
75556
+ };
75557
+ }
75558
+ else {
75559
+ return argument;
75560
+ }
75561
+ });
75562
+ selectionNode.arguments = swappedArguments;
75563
+ }
75564
+ if (selectionNode.luvioSelections !== undefined) {
75565
+ for (const childSelectionNode of selectionNode.luvioSelections) {
75566
+ if (isCustomFieldNode(childSelectionNode) ||
75567
+ isObjectFieldSelection(childSelectionNode)) {
75568
+ swapIdsOfFieldNode(childSelectionNode, draftFunctions);
75569
+ }
75570
+ }
75571
+ }
75572
+ }
75573
+ function swapIdsOfValueNode(valueNode, isDraftId, idMapper) {
75574
+ switch (valueNode.kind) {
75575
+ case Kind.OBJECT: {
75576
+ const swappedObjectValueNode = {};
75577
+ for (const key of keys(valueNode.fields)) {
75578
+ swappedObjectValueNode[key] = swapIdsOfValueNode(valueNode.fields[key], isDraftId, idMapper);
75579
+ }
75580
+ return {
75581
+ kind: 'ObjectValue',
75582
+ fields: swappedObjectValueNode,
75583
+ };
75584
+ }
75585
+ case Kind.LIST: {
75586
+ const listValueNodes = [];
75587
+ for (const child of valueNode.values) {
75588
+ listValueNodes.push(swapIdsOfValueNode(child, isDraftId, idMapper));
75589
+ }
75590
+ return {
75591
+ kind: 'ListValue',
75592
+ values: listValueNodes,
75593
+ };
75594
+ }
75595
+ case Kind.STRING: {
75596
+ if (!isDraftId(valueNode.value)) {
75597
+ return valueNode;
75598
+ }
75599
+ return {
75600
+ kind: 'StringValue',
75601
+ value: idMapper(valueNode.value),
75602
+ block: false,
75603
+ };
75604
+ }
75605
+ default:
75606
+ return {
75607
+ ...valueNode,
75608
+ };
75609
+ }
75610
+ }
75425
75611
  function injectScopeFields(ast) {
75426
75612
  const modifiedDocumentNode = {
75427
75613
  kind: 'Document',
@@ -76003,6 +76189,34 @@ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext)
76003
76189
  }
76004
76190
  return buildNetworkSnapshot(luvio, config, fragment, dispatchOptions);
76005
76191
  }
76192
+ const replaceDraftIdsInVariables = (variables, draftFunctions) => {
76193
+ const replace = (object) => {
76194
+ if (typeof object === 'string') {
76195
+ if (!draftFunctions.isDraftId(object)) {
76196
+ return object;
76197
+ }
76198
+ return draftFunctions.getCanonicalId(object);
76199
+ }
76200
+ else if (isArray(object)) {
76201
+ return object.map(replace);
76202
+ }
76203
+ else if (typeof object === 'object' && object !== null) {
76204
+ let source = object;
76205
+ return keys(source).reduce((acc, key) => {
76206
+ acc[key] = replace(source[key]);
76207
+ return acc;
76208
+ }, {});
76209
+ }
76210
+ else {
76211
+ return object;
76212
+ }
76213
+ };
76214
+ let newVariables = keys(variables).reduce((acc, key) => {
76215
+ acc[key] = replace(variables[key]);
76216
+ return acc;
76217
+ }, {});
76218
+ return newVariables;
76219
+ };
76006
76220
  const graphQLAdapterFactory = (luvio) => {
76007
76221
  const uiApiGraphQLAdapter = factory$1(luvio);
76008
76222
  function graphql(untrustedConfig, requestContext) {
@@ -76027,9 +76241,17 @@ const graphQLAdapterFactory = (luvio) => {
76027
76241
  const validatedConfigWithInjection = fieldInjectionRequired
76028
76242
  ? graphqlConfigWithInjectedAST(validatedConfig)
76029
76243
  : validatedConfig;
76030
- const fragment = createFragment(luvio, validatedConfigWithInjection.query, variables);
76244
+ const sanitizedConfig = draftFunctions !== undefined
76245
+ ? sanitizeConfig(validatedConfigWithInjection, draftFunctions)
76246
+ : validatedConfigWithInjection;
76247
+ if (sanitizedConfig.variables && draftFunctions !== undefined) {
76248
+ const variablesWithSwappedDraftIds = replaceDraftIdsInVariables(sanitizedConfig.variables, draftFunctions);
76249
+ sanitizedConfig.variables = variablesWithSwappedDraftIds;
76250
+ validatedConfig.variables = variablesWithSwappedDraftIds;
76251
+ }
76252
+ const fragment = createFragment(luvio, sanitizedConfig.query, sanitizedConfig.variables);
76031
76253
  const context = {
76032
- config: validatedConfigWithInjection,
76254
+ config: sanitizedConfig,
76033
76255
  fragment,
76034
76256
  luvio,
76035
76257
  };
@@ -76038,7 +76260,7 @@ const graphQLAdapterFactory = (luvio) => {
76038
76260
  const observers = requestContext && requestContext.eventObservers
76039
76261
  ? requestContext.eventObservers
76040
76262
  : [];
76041
- // uses the original ast to do the eval to avoid fields not needed by users
76263
+ // uses the original ast to do the eval to avoid fields not needed by users. The draftID swapping happens when filters transform to predicates.
76042
76264
  return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers);
76043
76265
  }
76044
76266
  return snapshotOrPromiseFromCachePolicy;
@@ -76055,6 +76277,15 @@ function graphqlConfigWithInjectedAST(graphqlConfig) {
76055
76277
  query: modifiedAST,
76056
76278
  };
76057
76279
  }
76280
+ function sanitizeConfig(graphqlConfig, draftFunctions) {
76281
+ const { query } = graphqlConfig;
76282
+ const astCopy = parse(stringify(query));
76283
+ const modifiedAST = swapIdsOfDocumentNode(astCopy, draftFunctions);
76284
+ return {
76285
+ ...graphqlConfig,
76286
+ query: modifiedAST,
76287
+ };
76288
+ }
76058
76289
  // make sure to register the configuration whenever this module loads
76059
76290
  register({ id: '@salesforce/lds-adapters-graphql', configuration });
76060
76291
 
@@ -76072,7 +76303,7 @@ withDefaultLuvio((luvio) => {
76072
76303
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76073
76304
  graphQLImperative = ldsAdapter;
76074
76305
  });
76075
- // version: 1.136.6-acf28210f
76306
+ // version: 1.136.8-449f5be71
76076
76307
 
76077
76308
  var gqlApi = /*#__PURE__*/Object.freeze({
76078
76309
  __proto__: null,
@@ -76761,4 +76992,4 @@ const { luvio } = getRuntime();
76761
76992
  setDefaultLuvio({ luvio });
76762
76993
 
76763
76994
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
76764
- // version: 1.136.6-0f5ec3ee7
76995
+ // version: 1.136.8-1a1062e42