@salesforce/lds-worker-api 1.130.9 → 1.131.0-dev9

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,26 +20,26 @@ var SnapshotState$3;
20
20
  SnapshotState["Stale"] = "Stale";
21
21
  })(SnapshotState$3 || (SnapshotState$3 = {}));
22
22
 
23
- const { create: create$9, entries: entries$4, freeze: freeze$4, keys: keys$9, values: values$3 } = Object;
23
+ const { create: create$9, entries: entries$4, freeze: freeze$4, keys: keys$a, values: values$3 } = Object;
24
24
  const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
25
25
  const { isArray: isArray$a } = Array;
26
26
  const { push: push$4, indexOf, slice: slice$2 } = Array.prototype;
27
27
  const { parse: parse$9, stringify: stringify$9 } = JSON;
28
28
 
29
- function deepFreeze$R(value) {
29
+ function deepFreeze$S(value) {
30
30
  // No need to freeze primitives
31
31
  if (typeof value !== 'object' || value === null) {
32
32
  return;
33
33
  }
34
34
  if (isArray$a(value)) {
35
35
  for (let i = 0, len = value.length; i < len; i += 1) {
36
- deepFreeze$R(value[i]);
36
+ deepFreeze$S(value[i]);
37
37
  }
38
38
  }
39
39
  else {
40
- const keys$1 = keys$9(value);
40
+ const keys$1 = keys$a(value);
41
41
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
42
- deepFreeze$R(value[keys$1[i]]);
42
+ deepFreeze$S(value[keys$1[i]]);
43
43
  }
44
44
  }
45
45
  freeze$4(value);
@@ -61,7 +61,7 @@ function isPendingSnapshot$1(snapshot) {
61
61
  return snapshot.state === SnapshotState$3.Pending;
62
62
  }
63
63
  function createErrorSnapshot$1(error, refresh) {
64
- deepFreeze$R(error);
64
+ deepFreeze$S(error);
65
65
  const snap = {
66
66
  error,
67
67
  state: SnapshotState$3.Error,
@@ -298,7 +298,7 @@ function stableJSONStringify$3(node) {
298
298
  if (node === null) {
299
299
  return 'null';
300
300
  }
301
- const keys$1 = keys$9(node).sort();
301
+ const keys$1 = keys$a(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$9(this.records).length;
572
+ return keys$a(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$9(this.metadata);
578
+ const keys$1 = keys$a(this.metadata);
579
579
  const results = [];
580
580
  const hasNamespaceQuery = hasOwnProperty$3.call(query, 'namespace');
581
581
  const hasRepresentationNameQuery = hasOwnProperty$3.call(query, 'representationName');
@@ -600,9 +600,8 @@ class StringKeyInMemoryStore {
600
600
  }
601
601
  return results;
602
602
  }
603
- publish(recordId, record) {
603
+ put(recordId, record) {
604
604
  const { records, insertedIds, pendingTrimKeys, retainedIds } = this;
605
- // make sure we publish to the canonical record id in case it's been redirected
606
605
  const canonicalKey = this.getCanonicalRecordId(recordId);
607
606
  if (hasOwnProperty$3.call(records, canonicalKey) === false) {
608
607
  insertedIds[canonicalKey] = true;
@@ -615,6 +614,11 @@ class StringKeyInMemoryStore {
615
614
  if (retainedIds[canonicalKey] === undefined) {
616
615
  pendingTrimKeys.add(canonicalKey);
617
616
  }
617
+ }
618
+ publish(recordId, record) {
619
+ // make sure we publish to the canonical record id in case it's been redirected
620
+ const canonicalKey = this.getCanonicalRecordId(recordId);
621
+ this.put(canonicalKey, record);
618
622
  this.markVisited(canonicalKey);
619
623
  // TODO: Emit event for store publish once structured keys are used everywhere.
620
624
  }
@@ -651,7 +655,8 @@ class StringKeyInMemoryStore {
651
655
  if (key === canonicalKey) {
652
656
  throw new Error('cannot redirect a key to itself');
653
657
  }
654
- if (reverseRedirectKeys[canonicalKey] !== undefined) {
658
+ if (reverseRedirectKeys[canonicalKey] !== undefined &&
659
+ reverseRedirectKeys[canonicalKey] !== key) {
655
660
  throw new Error('cannot have multiple redirects keys point to the same canonical key');
656
661
  }
657
662
  if (redirectKeys[canonicalKey] !== undefined) {
@@ -667,8 +672,8 @@ class StringKeyInMemoryStore {
667
672
  // Note: we should always get the subscription references from this at the beginning
668
673
  // of the function, in case the reference changes (because of an unsubscribe)
669
674
  const { snapshotSubscriptions, watchSubscriptions, visitedIds, refreshedIds, insertedIds } = this;
670
- const allVisitedIds = keys$9(visitedIds);
671
- const allRefreshedIds = keys$9(refreshedIds);
675
+ const allVisitedIds = keys$a(visitedIds);
676
+ const allRefreshedIds = keys$a(refreshedIds);
672
677
  // Early exit if nothing has changed
673
678
  if (allVisitedIds.length === 0 && allRefreshedIds.length === 0) {
674
679
  return Promise.resolve();
@@ -823,14 +828,7 @@ class StringKeyInMemoryStore {
823
828
  // find and evict the canonical key
824
829
  const canonicalKey = this.getCanonicalRecordId(key);
825
830
  delete this.records[canonicalKey];
826
- this.visitedIds[canonicalKey] = true;
827
- // mark all redirects leading up to the canonical key as visited so
828
- // affected snapshots are updated
829
- let redirectKey = this.reverseRedirectKeys[canonicalKey];
830
- while (redirectKey !== undefined) {
831
- this.visitedIds[redirectKey] = true;
832
- redirectKey = this.reverseRedirectKeys[redirectKey];
833
- }
831
+ this.markVisited(canonicalKey);
834
832
  }
835
833
  /**
836
834
  * Deallocates data at the canonical key location for in-memory (L1) cache
@@ -1122,7 +1120,7 @@ function isPendingSnapshotWithNoOverlappingIds(snapshot, visitedIds, refreshedId
1122
1120
  hasOverlappingIds(snapshot, visitedIds) === false);
1123
1121
  }
1124
1122
  function getMatchingIds(partialKey, visitedIds) {
1125
- const keys$1 = keys$9(partialKey);
1123
+ const keys$1 = keys$a(partialKey);
1126
1124
  return visitedIds.filter((visitedId) => {
1127
1125
  return keys$1.every((key) => {
1128
1126
  return partialKey[key] === visitedId[key];
@@ -1208,9 +1206,9 @@ class InMemoryStore {
1208
1206
  }
1209
1207
  return results;
1210
1208
  }
1211
- publish(recordId, record) {
1209
+ put(recordId, record) {
1212
1210
  if (typeof recordId === 'string') {
1213
- this.fallbackStringKeyInMemoryStore.publish(recordId, record);
1211
+ this.fallbackStringKeyInMemoryStore.put(recordId, record);
1214
1212
  return;
1215
1213
  }
1216
1214
  const { recordsMap, insertedIdsSet, pendingTrims, retainedIdsMap } = this;
@@ -1227,6 +1225,14 @@ class InMemoryStore {
1227
1225
  if (retainedIdsMap.get(canonicalKey) === undefined) {
1228
1226
  pendingTrims.add(canonicalKey);
1229
1227
  }
1228
+ }
1229
+ publish(recordId, record) {
1230
+ if (typeof recordId === 'string') {
1231
+ this.fallbackStringKeyInMemoryStore.publish(recordId, record);
1232
+ return;
1233
+ }
1234
+ const canonicalKey = this.getCanonicalRecordId(recordId);
1235
+ this.put(canonicalKey, record);
1230
1236
  this.markVisited(canonicalKey);
1231
1237
  this.emitStorePublishEvent(recordId);
1232
1238
  }
@@ -1463,14 +1469,7 @@ class InMemoryStore {
1463
1469
  // find and evict the canonical key
1464
1470
  const canonicalKey = this.getCanonicalRecordId(key);
1465
1471
  this.recordsMap.delete(canonicalKey);
1466
- this.visitedIdsSet.add(canonicalKey);
1467
- // mark all redirects leading up to the canonical key as visited so
1468
- // affected snapshots are updated
1469
- let redirectKey = this.reverseRedirectKeysMap.get(canonicalKey);
1470
- while (redirectKey !== undefined) {
1471
- this.visitedIdsSet.add(redirectKey);
1472
- redirectKey = this.reverseRedirectKeysMap.get(redirectKey);
1473
- }
1472
+ this.markVisited(canonicalKey);
1474
1473
  }
1475
1474
  /**
1476
1475
  * Deallocates data at the canonical key location for in-memory (L1) cache
@@ -1748,8 +1747,8 @@ class InMemoryStore {
1748
1747
  } while (redirectKey !== undefined);
1749
1748
  }
1750
1749
  isUsingStringKeys() {
1751
- return (keys$9(this.fallbackStringKeyInMemoryStore.visitedIds).length !== 0 ||
1752
- keys$9(this.fallbackStringKeyInMemoryStore.refreshedIds).length !== 0);
1750
+ return (keys$a(this.fallbackStringKeyInMemoryStore.visitedIds).length !== 0 ||
1751
+ keys$a(this.fallbackStringKeyInMemoryStore.refreshedIds).length !== 0);
1753
1752
  }
1754
1753
  delegateToFallbackStringKeyStore(snapshot) {
1755
1754
  return !isErrorSnapshot$3(snapshot) && typeof snapshot.recordId === 'string';
@@ -1791,7 +1790,7 @@ class InMemoryStore {
1791
1790
  buildKeySchema(keyMetadata) {
1792
1791
  // pull NamespacedType type out of NormalizedKeyMetadata
1793
1792
  const { namespace: _ns, representationName: _rn, ...keyParamValues } = keyMetadata;
1794
- const keySchema = keys$9(keyParamValues).sort();
1793
+ const keySchema = keys$a(keyParamValues).sort();
1795
1794
  return ['namespace', 'representationName', ...keySchema];
1796
1795
  }
1797
1796
  }
@@ -2079,7 +2078,7 @@ class GraphNode {
2079
2078
  return value;
2080
2079
  }
2081
2080
  keys() {
2082
- return keys$9(this.data);
2081
+ return keys$a(this.data);
2083
2082
  }
2084
2083
  isScalar(propertyName) {
2085
2084
  // TODO W-6900046 - merge.ts casts these to any and manually sets `data`
@@ -2457,7 +2456,7 @@ class Reader {
2457
2456
  }
2458
2457
  }
2459
2458
  selectAllObject(record, data, visitedKeys) {
2460
- const recordKeys = keys$9(record);
2459
+ const recordKeys = keys$a(record);
2461
2460
  const { length } = recordKeys;
2462
2461
  for (let i = 0; i < length; i += 1) {
2463
2462
  const key = recordKeys[i];
@@ -2640,7 +2639,7 @@ class Reader {
2640
2639
  }
2641
2640
  const { baseSnapshotValue } = this.currentPath;
2642
2641
  if (isDefined$1(baseSnapshotValue)) {
2643
- this.snapshotChanged = keys$1.length !== keys$9(baseSnapshotValue).length;
2642
+ this.snapshotChanged = keys$1.length !== keys$a(baseSnapshotValue).length;
2644
2643
  }
2645
2644
  }
2646
2645
  checkIfChanged(value) {
@@ -2676,7 +2675,7 @@ class Reader {
2676
2675
  return this.markMissing();
2677
2676
  }
2678
2677
  const sink = (data[propertyName] = {});
2679
- const keys$1 = keys$9(obj);
2678
+ const keys$1 = keys$a(obj);
2680
2679
  this.checkIfObjectKeysLengthChanged(keys$1);
2681
2680
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
2682
2681
  const key = keys$1[i];
@@ -2688,7 +2687,7 @@ class Reader {
2688
2687
  }
2689
2688
  readLinkMap(propertyName, selection, record, data) {
2690
2689
  const map = record[propertyName];
2691
- const keys$1 = keys$9(map);
2690
+ const keys$1 = keys$a(map);
2692
2691
  const sink = {};
2693
2692
  this.checkIfObjectKeysLengthChanged(keys$1);
2694
2693
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
@@ -2818,7 +2817,7 @@ class Reader {
2818
2817
  return;
2819
2818
  }
2820
2819
  const sink = (data[propertyName] = {});
2821
- const keys$1 = keys$9(obj);
2820
+ const keys$1 = keys$a(obj);
2822
2821
  this.checkIfObjectKeysLengthChanged(keys$1);
2823
2822
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
2824
2823
  const key = keys$1[i];
@@ -3166,9 +3165,14 @@ class Environment {
3166
3165
  // since broadcast only deals with cached recordIds
3167
3166
  this.store.broadcastNonCachedSnapshot(key, errorSnapshot);
3168
3167
  }
3168
+ // Adds the given data to the store at the given key and marks the key as visited. Will cause subscribers to rebuild.
3169
3169
  storePublish(key, data) {
3170
3170
  this.store.publish(key, data);
3171
3171
  }
3172
+ // Adds the given data to the store at the given key (does NOT mark the key as visited). Will NOT cause subscribers to rebuild. NOTE: This should really only be used by internal Luvio APIs.
3173
+ storePut(key, data) {
3174
+ this.store.put(key, data);
3175
+ }
3172
3176
  storeRedirect(existingKey, redirectKey) {
3173
3177
  this.store.redirect(existingKey, redirectKey);
3174
3178
  }
@@ -3649,7 +3653,7 @@ class Luvio {
3649
3653
  return this.environment.buildStructuredKey(namespace, representationName, idValues);
3650
3654
  }
3651
3655
  }
3652
- // engine version: 0.138.8-480e18f2
3656
+ // engine version: 0.138.8-244.1-492a715e
3653
3657
 
3654
3658
  /**
3655
3659
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3776,7 +3780,7 @@ function withDefaultLuvio(callback) {
3776
3780
  }
3777
3781
  callbacks.push(callback);
3778
3782
  }
3779
- // version: 1.130.9-2d38b9869
3783
+ // version: 1.131.0-dev9-5f88f31bc
3780
3784
 
3781
3785
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3782
3786
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -3785,6 +3789,15 @@ function instrumentAdapter$1(createFunction, _metadata) {
3785
3789
  function setLdsNetworkAdapterInstrumentation(_networkAdapterRegistration) { }
3786
3790
  function instrumentLuvio(_context) { }
3787
3791
 
3792
+ var excludeStaleRecordsGate = {
3793
+ isOpen: function (e) {
3794
+ return e.fallback;
3795
+ },
3796
+ hasError: function () {
3797
+ return !0;
3798
+ },
3799
+ };
3800
+
3788
3801
  /**
3789
3802
  * Copyright (c) 2022, Salesforce, Inc.,
3790
3803
  * All rights reserved.
@@ -15200,7 +15213,7 @@ function parseAndVisit(source) {
15200
15213
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15201
15214
  return luvioDocumentNode;
15202
15215
  }
15203
- // version: 1.130.9-2d38b9869
15216
+ // version: 1.131.0-dev9-5f88f31bc
15204
15217
 
15205
15218
  function unwrap(data) {
15206
15219
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16113,7 +16126,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16113
16126
  const { apiFamily, name } = metadata;
16114
16127
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16115
16128
  }
16116
- // version: 1.130.9-2d38b9869
16129
+ // version: 1.131.0-dev9-5f88f31bc
16117
16130
 
16118
16131
  /**
16119
16132
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16196,7 +16209,7 @@ var FragmentReadResultState;
16196
16209
  ({
16197
16210
  state: FragmentReadResultState.Missing,
16198
16211
  });
16199
- // engine version: 0.138.8-480e18f2
16212
+ // engine version: 0.138.8-244.1-492a715e
16200
16213
 
16201
16214
  const { keys: ObjectKeys$3, freeze: ObjectFreeze$3, create: ObjectCreate$3 } = Object;
16202
16215
 
@@ -16542,7 +16555,7 @@ function getFetchResponseStatusText$1(status) {
16542
16555
  return `Unexpected HTTP Status Code: ${status}`;
16543
16556
  }
16544
16557
  }
16545
- function isUnfulfilledSnapshot$1(snapshot) {
16558
+ function isUnfulfilledSnapshot$1$1(snapshot) {
16546
16559
  return snapshot.state === SNAPSHOT_STATE_UNFULFILLED;
16547
16560
  }
16548
16561
  const keyPrefix$1 = 'UiApi';
@@ -16582,20 +16595,20 @@ function equalsObject$1(a, b, equalsProp) {
16582
16595
  }
16583
16596
  return true;
16584
16597
  }
16585
- function deepFreeze$P(value) {
16598
+ function deepFreeze$Q(value) {
16586
16599
  // No need to freeze primitives
16587
16600
  if (typeof value !== 'object' || value === null) {
16588
16601
  return;
16589
16602
  }
16590
16603
  if (ArrayIsArray$2(value)) {
16591
16604
  for (let i = 0, len = value.length; i < len; i += 1) {
16592
- deepFreeze$P(value[i]);
16605
+ deepFreeze$Q(value[i]);
16593
16606
  }
16594
16607
  }
16595
16608
  else {
16596
16609
  const keys = ObjectKeys$2(value);
16597
16610
  for (let i = 0, len = keys.length; i < len; i += 1) {
16598
- deepFreeze$P(value[keys[i]]);
16611
+ deepFreeze$Q(value[keys[i]]);
16599
16612
  }
16600
16613
  }
16601
16614
  ObjectFreeze$2(value);
@@ -16663,7 +16676,7 @@ const select$1G = function ListFilterByInfoRepresentationSelect() {
16663
16676
  ]
16664
16677
  };
16665
16678
  };
16666
- function deepFreeze$O(input) {
16679
+ function deepFreeze$P(input) {
16667
16680
  const input_operandLabels = input.operandLabels;
16668
16681
  ObjectFreeze$2(input_operandLabels);
16669
16682
  ObjectFreeze$2(input);
@@ -16741,7 +16754,7 @@ const select$1E = function ListOrderByInfoRepresentationSelect() {
16741
16754
  ]
16742
16755
  };
16743
16756
  };
16744
- function deepFreeze$N(input) {
16757
+ function deepFreeze$O(input) {
16745
16758
  ObjectFreeze$2(input);
16746
16759
  }
16747
16760
 
@@ -16765,7 +16778,7 @@ const select$1D = function ListUserPreferenceRepresentationSelect() {
16765
16778
  ]
16766
16779
  };
16767
16780
  };
16768
- function deepFreeze$M(input) {
16781
+ function deepFreeze$N(input) {
16769
16782
  const input_columnWidths = input.columnWidths;
16770
16783
  const input_columnWidths_keys = Object.keys(input_columnWidths);
16771
16784
  const input_columnWidths_length = input_columnWidths_keys.length;
@@ -16784,7 +16797,7 @@ function deepFreeze$M(input) {
16784
16797
  }
16785
16798
 
16786
16799
  const TTL$x = 900000;
16787
- const VERSION$18 = "ce51760eb46b65c484f42de806102162";
16800
+ const VERSION$18 = "69101560544e3433c988f3a2b202744b";
16788
16801
  const RepresentationType$Q = 'ListInfoRepresentation';
16789
16802
  function keyBuilder$1R(luvio, config) {
16790
16803
  return keyPrefix$1 + '::' + RepresentationType$Q + ':' + (config.listViewApiName === null ? '' : config.listViewApiName) + ':' + config.objectApiName + ':' + config.type;
@@ -16850,11 +16863,6 @@ const select$1C = function ListInfoRepresentationSelect() {
16850
16863
  kind: 'Object',
16851
16864
  selections: ListReferenceRepresentation__selections
16852
16865
  },
16853
- {
16854
- name: 'objectApiNames',
16855
- kind: 'Scalar',
16856
- plural: true
16857
- },
16858
16866
  {
16859
16867
  name: 'orderedByInfo',
16860
16868
  kind: 'Object',
@@ -16981,7 +16989,7 @@ function equals$V(existing, incoming) {
16981
16989
  }
16982
16990
  return true;
16983
16991
  }
16984
- function deepFreeze$L(input) {
16992
+ function deepFreeze$M(input) {
16985
16993
  ObjectFreeze$2(input);
16986
16994
  }
16987
16995
 
@@ -17041,10 +17049,10 @@ function equals$U(existing, incoming) {
17041
17049
  }
17042
17050
  return true;
17043
17051
  }
17044
- function deepFreeze$K(input) {
17052
+ function deepFreeze$L(input) {
17045
17053
  const input_value = input.value;
17046
17054
  if (input_value !== null && typeof input_value === 'object') {
17047
- deepFreeze$I(input_value);
17055
+ deepFreeze$J(input_value);
17048
17056
  }
17049
17057
  ObjectFreeze$2(input);
17050
17058
  }
@@ -17088,7 +17096,7 @@ function getTypeCacheKeys$Q(luvio, input, fullPathFactory) {
17088
17096
  return rootKeySet;
17089
17097
  }
17090
17098
 
17091
- const { assign: assign$6, create: create$7, freeze: freeze$3, keys: keys$8 } = Object;
17099
+ const { assign: assign$7, create: create$7, freeze: freeze$3, keys: keys$9 } = Object;
17092
17100
  const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
17093
17101
  const { split, endsWith } = String.prototype;
17094
17102
  const { isArray: isArray$8 } = Array;
@@ -17106,7 +17114,7 @@ const getTypeCacheKeys$P = (luvio, input, _fullPathFactory) => {
17106
17114
  mergeable: true,
17107
17115
  });
17108
17116
  const input_childRelationships = input.childRelationships;
17109
- const input_childRelationships_keys = keys$8(input_childRelationships);
17117
+ const input_childRelationships_keys = keys$9(input_childRelationships);
17110
17118
  const input_childRelationships_length = input_childRelationships_keys.length;
17111
17119
  for (let i = 0; i < input_childRelationships_length; i++) {
17112
17120
  const key = input_childRelationships_keys[i];
@@ -17114,7 +17122,7 @@ const getTypeCacheKeys$P = (luvio, input, _fullPathFactory) => {
17114
17122
  rootKeySet.merge(cacheKeys);
17115
17123
  }
17116
17124
  const input_fields = input.fields;
17117
- const input_fields_keys = keys$8(input_fields);
17125
+ const input_fields_keys = keys$9(input_fields);
17118
17126
  const input_fields_length = input_fields_keys.length;
17119
17127
  for (let i = 0; i < input_fields_length; i++) {
17120
17128
  const key = input_fields_keys[i];
@@ -17237,11 +17245,11 @@ function equals$T(existing, incoming) {
17237
17245
  }
17238
17246
  return true;
17239
17247
  }
17240
- function deepFreeze$J(input) {
17248
+ function deepFreeze$K(input) {
17241
17249
  const input_records = input.records;
17242
17250
  for (let i = 0; i < input_records.length; i++) {
17243
17251
  const input_records_item = input_records[i];
17244
- deepFreeze$I(input_records_item);
17252
+ deepFreeze$J(input_records_item);
17245
17253
  }
17246
17254
  ObjectFreeze$2(input_records);
17247
17255
  ObjectFreeze$2(input);
@@ -17534,14 +17542,14 @@ function equals$S(existing, incoming) {
17534
17542
  }
17535
17543
  return true;
17536
17544
  }
17537
- function deepFreeze$I(input) {
17545
+ function deepFreeze$J(input) {
17538
17546
  const input_childRelationships = input.childRelationships;
17539
17547
  const input_childRelationships_keys = Object.keys(input_childRelationships);
17540
17548
  const input_childRelationships_length = input_childRelationships_keys.length;
17541
17549
  for (let i = 0; i < input_childRelationships_length; i++) {
17542
17550
  const key = input_childRelationships_keys[i];
17543
17551
  const input_childRelationships_prop = input_childRelationships[key];
17544
- deepFreeze$J(input_childRelationships_prop);
17552
+ deepFreeze$K(input_childRelationships_prop);
17545
17553
  }
17546
17554
  ObjectFreeze$2(input_childRelationships);
17547
17555
  const input_fields = input.fields;
@@ -17550,12 +17558,12 @@ function deepFreeze$I(input) {
17550
17558
  for (let i = 0; i < input_fields_length; i++) {
17551
17559
  const key = input_fields_keys[i];
17552
17560
  const input_fields_prop = input_fields[key];
17553
- deepFreeze$K(input_fields_prop);
17561
+ deepFreeze$L(input_fields_prop);
17554
17562
  }
17555
17563
  ObjectFreeze$2(input_fields);
17556
17564
  const input_recordTypeInfo = input.recordTypeInfo;
17557
17565
  if (input_recordTypeInfo !== null && typeof input_recordTypeInfo === 'object') {
17558
- deepFreeze$L(input_recordTypeInfo);
17566
+ deepFreeze$M(input_recordTypeInfo);
17559
17567
  }
17560
17568
  ObjectFreeze$2(input);
17561
17569
  }
@@ -17615,7 +17623,7 @@ function dedupe(value) {
17615
17623
  for (let i = 0, len = value.length; i < len; i += 1) {
17616
17624
  result[value[i]] = true;
17617
17625
  }
17618
- return keys$8(result);
17626
+ return keys$9(result);
17619
17627
  }
17620
17628
  /**
17621
17629
  * @param source The array of string to filter
@@ -19063,7 +19071,7 @@ function convertRecordFieldsArrayToTrie(fields, optionalFields = []) {
19063
19071
  function createPathSelection(propertyName, fieldDefinition) {
19064
19072
  const fieldsSelection = [];
19065
19073
  const { children } = fieldDefinition;
19066
- const childrenKeys = keys$8(children);
19074
+ const childrenKeys = keys$9(children);
19067
19075
  for (let i = 0, len = childrenKeys.length; i < len; i += 1) {
19068
19076
  const childKey = childrenKeys[i];
19069
19077
  const childFieldDefinition = children[childKey];
@@ -19108,7 +19116,7 @@ function createPathSelection(propertyName, fieldDefinition) {
19108
19116
  */
19109
19117
  function createPathSelectionFromValue(fields) {
19110
19118
  const fieldsSelection = [];
19111
- const fieldNames = keys$8(fields);
19119
+ const fieldNames = keys$9(fields);
19112
19120
  for (let i = 0, len = fieldNames.length; i < len; i++) {
19113
19121
  const fieldName = fieldNames[i];
19114
19122
  const { value: fieldValue } = fields[fieldName];
@@ -19147,7 +19155,7 @@ function createPathSelectionFromValue(fields) {
19147
19155
  }
19148
19156
  function extractRecordFieldsRecursively(record) {
19149
19157
  const fields = [];
19150
- const fieldNames = keys$8(record.fields);
19158
+ const fieldNames = keys$9(record.fields);
19151
19159
  for (let i = 0, len = fieldNames.length; i < len; i++) {
19152
19160
  const fieldName = fieldNames[i];
19153
19161
  const { value: fieldValue } = record.fields[fieldName];
@@ -19335,7 +19343,7 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
19335
19343
  continue;
19336
19344
  }
19337
19345
  extractTrackedFieldsToTrie(spanningLink.data.__ref, spanning, next, config, spanningVisitedRecordIds, depth + 1);
19338
- if (keys$8(next.children).length > 0) {
19346
+ if (keys$9(next.children).length > 0) {
19339
19347
  current.children[key] = next;
19340
19348
  }
19341
19349
  else {
@@ -19387,13 +19395,13 @@ function isExternalLookupFieldKey(spanningNode) {
19387
19395
  return endsWith.call(spanningNode.scalar('apiName'), CUSTOM_EXTERNAL_OBJECT_FIELD_SUFFIX);
19388
19396
  }
19389
19397
  function convertTrieToFields(root) {
19390
- if (keys$8(root.children).length === 0) {
19398
+ if (keys$9(root.children).length === 0) {
19391
19399
  return [];
19392
19400
  }
19393
19401
  return convertTrieToFieldsRecursively(root);
19394
19402
  }
19395
19403
  function convertTrieToFieldsRecursively(root) {
19396
- const childKeys = keys$8(root.children);
19404
+ const childKeys = keys$9(root.children);
19397
19405
  if (childKeys.length === 0) {
19398
19406
  if (root.name === '') {
19399
19407
  return [];
@@ -19430,7 +19438,7 @@ const getObjectNameFromField = (field) => {
19430
19438
  function mergeFieldsTries(rootA, rootB) {
19431
19439
  const rootAchildren = rootA.children;
19432
19440
  const rootBchildren = rootB.children;
19433
- const childBKeys = keys$8(rootBchildren);
19441
+ const childBKeys = keys$9(rootBchildren);
19434
19442
  for (let i = 0, len = childBKeys.length; i < len; i++) {
19435
19443
  const childBKey = childBKeys[i];
19436
19444
  if (rootAchildren[childBKey] === undefined) {
@@ -19583,8 +19591,8 @@ function isSuperRecordFieldTrie(a, b) {
19583
19591
  }
19584
19592
  const childrenA = a.children;
19585
19593
  const childrenB = b.children;
19586
- const childKeysA = keys$8(childrenA);
19587
- const childKeysB = keys$8(childrenB);
19594
+ const childKeysA = keys$9(childrenA);
19595
+ const childKeysB = keys$9(childrenB);
19588
19596
  const childKeysBLength = childKeysB.length;
19589
19597
  if (childKeysBLength > childKeysA.length) {
19590
19598
  return false;
@@ -19608,7 +19616,7 @@ function mergePendingFields(newRecord, oldRecord) {
19608
19616
  // RecordRepresentationNormalized['fields'] to include `pending:true` property
19609
19617
  const mergedFields = { ...newRecord.fields };
19610
19618
  const merged = { ...newRecord, fields: mergedFields };
19611
- const existingFields = keys$8(oldRecord.fields);
19619
+ const existingFields = keys$9(oldRecord.fields);
19612
19620
  for (let i = 0, len = existingFields.length; i < len; i += 1) {
19613
19621
  const spanningFieldName = existingFields[i];
19614
19622
  if (newRecord.fields[spanningFieldName] === undefined) {
@@ -19741,7 +19749,7 @@ function merge$3(existing, incoming, luvio, _path, recordConflictMap) {
19741
19749
  if (isGraphNode(node)) {
19742
19750
  const dependencies = node.retrieve();
19743
19751
  if (dependencies !== null) {
19744
- const depKeys = keys$8(dependencies);
19752
+ const depKeys = keys$9(dependencies);
19745
19753
  for (let i = 0, len = depKeys.length; i < len; i++) {
19746
19754
  luvio.storeEvict(depKeys[i]);
19747
19755
  }
@@ -19888,7 +19896,7 @@ function addFieldsToStoreLink(fieldsTrie, optionalFieldsTrie, storeLink) {
19888
19896
  }
19889
19897
  for (let i = 0; i < fieldSubtries.length; i++) {
19890
19898
  const subtrie = fieldSubtries[i];
19891
- const fieldNames = keys$8(subtrie.children);
19899
+ const fieldNames = keys$9(subtrie.children);
19892
19900
  for (let i = 0; i < fieldNames.length; i++) {
19893
19901
  const fieldName = fieldNames[i];
19894
19902
  const childTrie = subtrie.children[fieldName];
@@ -20000,9 +20008,9 @@ function fulfill(existing, incoming) {
20000
20008
  return false;
20001
20009
  }
20002
20010
  }
20003
- const headersKeys = keys$8(headers);
20011
+ const headersKeys = keys$9(headers);
20004
20012
  const headersKeyLength = headersKeys.length;
20005
- if (headersKeyLength !== keys$8(existingHeaders).length) {
20013
+ if (headersKeyLength !== keys$9(existingHeaders).length) {
20006
20014
  return false;
20007
20015
  }
20008
20016
  for (let i = 0, len = headersKeyLength; i < len; i++) {
@@ -20774,7 +20782,7 @@ function buildNetworkSnapshot$V(luvio, config, serverRequestCount = 0, options)
20774
20782
 
20775
20783
  // iterate through the map to build configs for network calls
20776
20784
  function resolveConflict(luvio, map) {
20777
- const ids = keys$8(map.conflicts);
20785
+ const ids = keys$9(map.conflicts);
20778
20786
  if (ids.length === 0) {
20779
20787
  instrumentation$2.recordConflictsResolved(map.serverRequestCount);
20780
20788
  return;
@@ -21956,18 +21964,18 @@ function listFields(luvio, { fields = [], optionalFields = [], sortBy, }, listIn
21956
21964
  return {
21957
21965
  getRecordSelectionFieldSets() {
21958
21966
  const optionalPlusDefaultFields = { ...optionalFields_ };
21959
- const fields = keys$8(defaultFields_);
21967
+ const fields = keys$9(defaultFields_);
21960
21968
  for (let i = 0; i < fields.length; ++i) {
21961
21969
  const field = fields[i];
21962
21970
  if (!fields_[field] && !defaultServerFieldStatus.missingFields[field]) {
21963
21971
  optionalPlusDefaultFields[field] = true;
21964
21972
  }
21965
21973
  }
21966
- return [keys$8(fields_).sort(), keys$8(optionalPlusDefaultFields).sort()];
21974
+ return [keys$9(fields_).sort(), keys$9(optionalPlusDefaultFields).sort()];
21967
21975
  },
21968
21976
  processRecords(records) {
21969
21977
  const { missingFields } = defaultServerFieldStatus;
21970
- const fields = keys$8(missingFields);
21978
+ const fields = keys$9(missingFields);
21971
21979
  for (let i = 0; i < fields.length; ++i) {
21972
21980
  const field = fields[i], splitField = field.split('.').slice(1);
21973
21981
  for (let i = 0; i < records.length; ++i) {
@@ -22793,7 +22801,7 @@ function buildCachedSnapshotCachePolicy$I(context, storeLookup) {
22793
22801
  config,
22794
22802
  resolve: () => buildNetworkSnapshot$U(luvio, config, snapshotRefreshOptions$1)
22795
22803
  });
22796
- if (isUnfulfilledSnapshot$1(cacheSnapshot) && cacheSnapshot.data !== undefined) {
22804
+ if (isUnfulfilledSnapshot$1$1(cacheSnapshot) && cacheSnapshot.data !== undefined) {
22797
22805
  context.cacheSnapshot = cacheSnapshot;
22798
22806
  }
22799
22807
  return cacheSnapshot;
@@ -23679,39 +23687,39 @@ const factory$g = (luvio) => {
23679
23687
  return null;
23680
23688
  }, { contextId: contextId$4 });
23681
23689
  };
23682
- function deepFreeze$H(input) {
23690
+ function deepFreeze$I(input) {
23683
23691
  const input_junctionIdListNames = input.junctionIdListNames;
23684
23692
  ObjectFreeze$2(input_junctionIdListNames);
23685
23693
  const input_junctionReferenceTo = input.junctionReferenceTo;
23686
23694
  ObjectFreeze$2(input_junctionReferenceTo);
23687
23695
  ObjectFreeze$2(input);
23688
23696
  }
23689
- function deepFreeze$G(input) {
23697
+ function deepFreeze$H(input) {
23690
23698
  const input_controllingFields = input.controllingFields;
23691
23699
  ObjectFreeze$2(input_controllingFields);
23692
23700
  ObjectFreeze$2(input);
23693
23701
  }
23694
- function deepFreeze$F(input) {
23702
+ function deepFreeze$G(input) {
23695
23703
  const input_nameFields = input.nameFields;
23696
23704
  ObjectFreeze$2(input_nameFields);
23697
23705
  ObjectFreeze$2(input);
23698
23706
  }
23699
- function deepFreeze$E(input) {
23707
+ function deepFreeze$F(input) {
23700
23708
  const input_controllingFields = input.controllingFields;
23701
23709
  ObjectFreeze$2(input_controllingFields);
23702
23710
  const input_filteredLookupInfo = input.filteredLookupInfo;
23703
23711
  if (input_filteredLookupInfo !== null && typeof input_filteredLookupInfo === 'object') {
23704
- deepFreeze$G(input_filteredLookupInfo);
23712
+ deepFreeze$H(input_filteredLookupInfo);
23705
23713
  }
23706
23714
  const input_referenceToInfos = input.referenceToInfos;
23707
23715
  for (let i = 0; i < input_referenceToInfos.length; i++) {
23708
23716
  const input_referenceToInfos_item = input_referenceToInfos[i];
23709
- deepFreeze$F(input_referenceToInfos_item);
23717
+ deepFreeze$G(input_referenceToInfos_item);
23710
23718
  }
23711
23719
  ObjectFreeze$2(input_referenceToInfos);
23712
23720
  ObjectFreeze$2(input);
23713
23721
  }
23714
- function deepFreeze$D(input) {
23722
+ function deepFreeze$E(input) {
23715
23723
  ObjectFreeze$2(input);
23716
23724
  }
23717
23725
 
@@ -23841,11 +23849,11 @@ function equals$N(existing, incoming) {
23841
23849
  }
23842
23850
  return true;
23843
23851
  }
23844
- function deepFreeze$C(input) {
23852
+ function deepFreeze$D(input) {
23845
23853
  const input_childRelationships = input.childRelationships;
23846
23854
  for (let i = 0; i < input_childRelationships.length; i++) {
23847
23855
  const input_childRelationships_item = input_childRelationships[i];
23848
- deepFreeze$H(input_childRelationships_item);
23856
+ deepFreeze$I(input_childRelationships_item);
23849
23857
  }
23850
23858
  ObjectFreeze$2(input_childRelationships);
23851
23859
  const input_dependentFields = input.dependentFields;
@@ -23863,7 +23871,7 @@ function deepFreeze$C(input) {
23863
23871
  for (let i = 0; i < input_fields_length; i++) {
23864
23872
  const key = input_fields_keys[i];
23865
23873
  const input_fields_prop = input_fields[key];
23866
- deepFreeze$E(input_fields_prop);
23874
+ deepFreeze$F(input_fields_prop);
23867
23875
  }
23868
23876
  ObjectFreeze$2(input_fields);
23869
23877
  const input_nameFields = input.nameFields;
@@ -23874,12 +23882,12 @@ function deepFreeze$C(input) {
23874
23882
  for (let i = 0; i < input_recordTypeInfos_length; i++) {
23875
23883
  const key = input_recordTypeInfos_keys[i];
23876
23884
  const input_recordTypeInfos_prop = input_recordTypeInfos[key];
23877
- deepFreeze$L(input_recordTypeInfos_prop);
23885
+ deepFreeze$M(input_recordTypeInfos_prop);
23878
23886
  }
23879
23887
  ObjectFreeze$2(input_recordTypeInfos);
23880
23888
  const input_themeInfo = input.themeInfo;
23881
23889
  if (input_themeInfo !== null && typeof input_themeInfo === 'object') {
23882
- deepFreeze$D(input_themeInfo);
23890
+ deepFreeze$E(input_themeInfo);
23883
23891
  }
23884
23892
  ObjectFreeze$2(input);
23885
23893
  }
@@ -23893,7 +23901,7 @@ const ingest$B$1 = function ObjectInfoRepresentationIngest(input, path, luvio, s
23893
23901
  propertyName: path.propertyName,
23894
23902
  ttl: ttlToUse
23895
23903
  });
23896
- deepFreeze$C(input);
23904
+ deepFreeze$D(input);
23897
23905
  if (existingRecord === undefined || equals$N(existingRecord, incomingRecord) === false) {
23898
23906
  luvio.storePublish(key, incomingRecord);
23899
23907
  }
@@ -24082,7 +24090,7 @@ const getObjectInfoAdapterFactory = (luvio) => function UiApi__getObjectInfo(unt
24082
24090
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
24083
24091
  buildCachedSnapshotCachePolicy$H, buildNetworkSnapshotCachePolicy$I);
24084
24092
  };
24085
- function deepFreeze$B(input) {
24093
+ function deepFreeze$C(input) {
24086
24094
  ObjectFreeze$2(input);
24087
24095
  }
24088
24096
 
@@ -24095,32 +24103,32 @@ var DiscriminatorValues$4;
24095
24103
  DiscriminatorValues["Field"] = "Field";
24096
24104
  DiscriminatorValues["CustomLink"] = "CustomLink";
24097
24105
  })(DiscriminatorValues$4 || (DiscriminatorValues$4 = {}));
24098
- function deepFreeze$A(input) {
24106
+ function deepFreeze$B(input) {
24099
24107
  ObjectFreeze$2(input);
24100
24108
  }
24101
- function deepFreeze$z(input) {
24109
+ function deepFreeze$A(input) {
24102
24110
  const input_layoutComponents = input.layoutComponents;
24103
24111
  for (let i = 0; i < input_layoutComponents.length; i++) {
24104
24112
  const input_layoutComponents_item = input_layoutComponents[i];
24105
- deepFreeze$A(input_layoutComponents_item);
24113
+ deepFreeze$B(input_layoutComponents_item);
24106
24114
  }
24107
24115
  ObjectFreeze$2(input_layoutComponents);
24108
24116
  ObjectFreeze$2(input);
24109
24117
  }
24110
- function deepFreeze$y(input) {
24118
+ function deepFreeze$z(input) {
24111
24119
  const input_layoutItems = input.layoutItems;
24112
24120
  for (let i = 0; i < input_layoutItems.length; i++) {
24113
24121
  const input_layoutItems_item = input_layoutItems[i];
24114
- deepFreeze$z(input_layoutItems_item);
24122
+ deepFreeze$A(input_layoutItems_item);
24115
24123
  }
24116
24124
  ObjectFreeze$2(input_layoutItems);
24117
24125
  ObjectFreeze$2(input);
24118
24126
  }
24119
- function deepFreeze$x(input) {
24127
+ function deepFreeze$y(input) {
24120
24128
  const input_layoutRows = input.layoutRows;
24121
24129
  for (let i = 0; i < input_layoutRows.length; i++) {
24122
24130
  const input_layoutRows_item = input_layoutRows[i];
24123
- deepFreeze$y(input_layoutRows_item);
24131
+ deepFreeze$z(input_layoutRows_item);
24124
24132
  }
24125
24133
  ObjectFreeze$2(input_layoutRows);
24126
24134
  ObjectFreeze$2(input);
@@ -24191,17 +24199,17 @@ function equals$M(existing, incoming) {
24191
24199
  }
24192
24200
  return true;
24193
24201
  }
24194
- function deepFreeze$w(input) {
24202
+ function deepFreeze$x(input) {
24195
24203
  const input_saveOptions = input.saveOptions;
24196
24204
  for (let i = 0; i < input_saveOptions.length; i++) {
24197
24205
  const input_saveOptions_item = input_saveOptions[i];
24198
- deepFreeze$B(input_saveOptions_item);
24206
+ deepFreeze$C(input_saveOptions_item);
24199
24207
  }
24200
24208
  ObjectFreeze$2(input_saveOptions);
24201
24209
  const input_sections = input.sections;
24202
24210
  for (let i = 0; i < input_sections.length; i++) {
24203
24211
  const input_sections_item = input_sections[i];
24204
- deepFreeze$x(input_sections_item);
24212
+ deepFreeze$y(input_sections_item);
24205
24213
  }
24206
24214
  ObjectFreeze$2(input_sections);
24207
24215
  ObjectFreeze$2(input);
@@ -24216,7 +24224,7 @@ const ingest$A$1 = function RecordLayoutRepresentationIngest(input, path, luvio,
24216
24224
  propertyName: path.propertyName,
24217
24225
  ttl: ttlToUse
24218
24226
  });
24219
- deepFreeze$w(input);
24227
+ deepFreeze$x(input);
24220
24228
  if (existingRecord === undefined || equals$M(existingRecord, incomingRecord) === false) {
24221
24229
  luvio.storePublish(key, incomingRecord);
24222
24230
  }
@@ -24242,7 +24250,7 @@ function getTypeCacheKeys$H$1(luvio, input, fullPathFactory) {
24242
24250
  });
24243
24251
  return rootKeySet;
24244
24252
  }
24245
- function deepFreeze$v(input) {
24253
+ function deepFreeze$w(input) {
24246
24254
  ObjectFreeze$2(input);
24247
24255
  }
24248
24256
 
@@ -24293,14 +24301,14 @@ function equals$L(existing, incoming) {
24293
24301
  }
24294
24302
  return true;
24295
24303
  }
24296
- function deepFreeze$u(input) {
24304
+ function deepFreeze$v(input) {
24297
24305
  const input_sectionUserStates = input.sectionUserStates;
24298
24306
  const input_sectionUserStates_keys = Object.keys(input_sectionUserStates);
24299
24307
  const input_sectionUserStates_length = input_sectionUserStates_keys.length;
24300
24308
  for (let i = 0; i < input_sectionUserStates_length; i++) {
24301
24309
  const key = input_sectionUserStates_keys[i];
24302
24310
  const input_sectionUserStates_prop = input_sectionUserStates[key];
24303
- deepFreeze$v(input_sectionUserStates_prop);
24311
+ deepFreeze$w(input_sectionUserStates_prop);
24304
24312
  }
24305
24313
  ObjectFreeze$2(input_sectionUserStates);
24306
24314
  ObjectFreeze$2(input);
@@ -24315,7 +24323,7 @@ const ingest$z$1 = function RecordLayoutUserStateRepresentationIngest(input, pat
24315
24323
  propertyName: path.propertyName,
24316
24324
  ttl: ttlToUse
24317
24325
  });
24318
- deepFreeze$u(input);
24326
+ deepFreeze$v(input);
24319
24327
  if (existingRecord === undefined || equals$L(existingRecord, incomingRecord) === false) {
24320
24328
  luvio.storePublish(key, incomingRecord);
24321
24329
  }
@@ -24842,7 +24850,7 @@ function getMissingRecordLookupFields(record, objectInfo) {
24842
24850
  const lookupFields = {};
24843
24851
  const { apiName, fields: recordFields } = record;
24844
24852
  const { fields: objectInfoFields } = objectInfo;
24845
- const objectInfoFieldNames = keys$8(objectInfoFields);
24853
+ const objectInfoFieldNames = keys$9(objectInfoFields);
24846
24854
  for (let i = 0, len = objectInfoFieldNames.length; i < len; i += 1) {
24847
24855
  const fieldName = objectInfoFieldNames[i];
24848
24856
  const field = objectInfoFields[fieldName];
@@ -24861,12 +24869,12 @@ function getMissingRecordLookupFields(record, objectInfo) {
24861
24869
  const nameField = `${apiName}.${relationshipName}.${getNameField(objectInfo, fieldName)}`;
24862
24870
  lookupFields[nameField] = true;
24863
24871
  }
24864
- return keys$8(lookupFields);
24872
+ return keys$9(lookupFields);
24865
24873
  }
24866
24874
  function getRecordUiMissingRecordLookupFields(recordUi) {
24867
24875
  const { records, objectInfos } = recordUi;
24868
24876
  const recordLookupFields = {};
24869
- const recordIds = keys$8(records);
24877
+ const recordIds = keys$9(records);
24870
24878
  for (let i = 0, len = recordIds.length; i < len; i += 1) {
24871
24879
  const recordId = recordIds[i];
24872
24880
  const recordData = records[recordId];
@@ -24904,19 +24912,19 @@ function buildCachedSelectorKey(key) {
24904
24912
  }
24905
24913
  function eachLayout(recordUi, cb) {
24906
24914
  const { layouts } = recordUi;
24907
- const layoutApiNames = keys$8(layouts);
24915
+ const layoutApiNames = keys$9(layouts);
24908
24916
  for (let a = 0, len = layoutApiNames.length; a < len; a += 1) {
24909
24917
  const apiName = layoutApiNames[a];
24910
24918
  const apiNameData = layouts[apiName];
24911
- const recordTypeIds = keys$8(apiNameData);
24919
+ const recordTypeIds = keys$9(apiNameData);
24912
24920
  for (let b = 0, recordTypeIdsLen = recordTypeIds.length; b < recordTypeIdsLen; b += 1) {
24913
24921
  const recordTypeId = recordTypeIds[b];
24914
24922
  const recordTypeData = apiNameData[recordTypeId];
24915
- const layoutTypes = keys$8(recordTypeData);
24923
+ const layoutTypes = keys$9(recordTypeData);
24916
24924
  for (let c = 0, layoutTypesLen = layoutTypes.length; c < layoutTypesLen; c += 1) {
24917
24925
  const layoutType = layoutTypes[c];
24918
24926
  const layoutTypeData = recordTypeData[layoutType];
24919
- const modes = keys$8(layoutTypeData);
24927
+ const modes = keys$9(layoutTypeData);
24920
24928
  for (let d = 0, modesLen = modes.length; d < modesLen; d += 1) {
24921
24929
  const mode = modes[d];
24922
24930
  const layout = layoutTypeData[mode];
@@ -25127,7 +25135,7 @@ function publishDependencies(luvio, recordIds, depKeys) {
25127
25135
  const node = luvio.getNode(recordDepKey);
25128
25136
  if (isGraphNode(node)) {
25129
25137
  const recordDeps = node.retrieve();
25130
- assign$6(dependencies, recordDeps);
25138
+ assign$7(dependencies, recordDeps);
25131
25139
  }
25132
25140
  luvio.storePublish(recordDepKey, dependencies);
25133
25141
  }
@@ -25295,11 +25303,11 @@ const recordLayoutFragmentSelector = [
25295
25303
  ];
25296
25304
  function getFieldsFromLayoutMap(layoutMap, objectInfo) {
25297
25305
  let fields = [];
25298
- const layoutTypes = keys$8(layoutMap);
25306
+ const layoutTypes = keys$9(layoutMap);
25299
25307
  for (let i = 0, layoutTypesLen = layoutTypes.length; i < layoutTypesLen; i += 1) {
25300
25308
  const layoutType = layoutTypes[i];
25301
25309
  const modesMap = layoutMap[layoutType];
25302
- const modes = keys$8(modesMap);
25310
+ const modes = keys$9(modesMap);
25303
25311
  for (let m = 0, modesLen = modes.length; m < modesLen; m += 1) {
25304
25312
  const mode = modes[m];
25305
25313
  const modeKeys = getQualifiedFieldApiNamesFromLayout(modesMap[mode], objectInfo);
@@ -25516,7 +25524,7 @@ function makeRecordLayoutMap(luvio, config, apiName, recordTypeId, layoutTypes,
25516
25524
  }
25517
25525
  const { layoutType, mode, snapshot } = container;
25518
25526
  if (wrapper.layoutMap[layoutType] === undefined) {
25519
- wrapper.layoutMap = assign$6({}, wrapper.layoutMap, {
25527
+ wrapper.layoutMap = assign$7({}, wrapper.layoutMap, {
25520
25528
  [layoutType]: {},
25521
25529
  });
25522
25530
  }
@@ -25791,6 +25799,49 @@ function getTypeCacheKeys$F$1(luvio, input, fullPathFactory) {
25791
25799
  return rootKeySet;
25792
25800
  }
25793
25801
 
25802
+ function serializeFieldArguments$1(argumentNodes, variables) {
25803
+ const mutableArgumentNodes = Object.assign([], argumentNodes);
25804
+ return `args__(${mutableArgumentNodes.sort((a, b) => {
25805
+ const aName = a.name.value.toUpperCase();
25806
+ const bName = b.name.value.toUpperCase();
25807
+ return aName < bName ? -1 : (aName > bName) ? 1 : 0;
25808
+ }).map(node => serializeArgNode$1(node, variables)).join("::")})`;
25809
+ }
25810
+ function serializeArgNode$1(argumentNode, variables) {
25811
+ const argName = argumentNode.name.value;
25812
+ return `${argName}:${serializeValueNode$2(argumentNode.value, variables)}`;
25813
+ }
25814
+ function serializeValueNode$2(valueNode, variables) {
25815
+ switch (valueNode.kind) {
25816
+ case ("BooleanValue"):
25817
+ return valueNode.value + '';
25818
+ case ("IntValue"):
25819
+ case ("FloatValue"):
25820
+ case ("EnumValue"):
25821
+ case ("StringValue"):
25822
+ return valueNode.value;
25823
+ case ("ListValue"):
25824
+ const mutableValueNodeList = Object.assign([], valueNode.values);
25825
+ return mutableValueNodeList.sort((a, b) => {
25826
+ const aVal = serializeValueNode$2(a, variables).toUpperCase();
25827
+ const bVal = serializeValueNode$2(b, variables).toUpperCase();
25828
+ return aVal < bVal ? -1 : (aVal > bVal) ? 1 : 0;
25829
+ }).map((val, i) => serializeValueNode$2(val, variables) + `[${i}]`).join(',');
25830
+ case ("Variable"):
25831
+ const variableValue = variables[valueNode.name.value];
25832
+ return typeof variableValue === "string" ? variableValue : JSON.stringify(variableValue);
25833
+ case ("NullValue"):
25834
+ return "null";
25835
+ case ("ObjectValue"):
25836
+ const mutableFieldNodeList = Object.assign([], valueNode.fields);
25837
+ return mutableFieldNodeList.sort((a, b) => {
25838
+ const aName = a.name.value.toUpperCase();
25839
+ const bName = b.name.value.toUpperCase();
25840
+ return aName < bName ? -1 : (aName > bName) ? 1 : 0;
25841
+ }).map(field => field.name.value + ":" + serializeValueNode$2(field.value, variables)).join(',');
25842
+ }
25843
+ }
25844
+
25794
25845
  const VERSION$V = "3f49d751896cf66e6e29788d8880e2cc";
25795
25846
  const RepresentationType$D = 'PlatformActionRepresentation';
25796
25847
  function keyBuilder$1y(luvio, config) {
@@ -26527,9 +26578,9 @@ function equals$F(existing, incoming) {
26527
26578
  }
26528
26579
  return true;
26529
26580
  }
26530
- function deepFreeze$t(input) {
26581
+ function deepFreeze$u(input) {
26531
26582
  const input_layout = input.layout;
26532
- deepFreeze$w(input_layout);
26583
+ deepFreeze$x(input_layout);
26533
26584
  ObjectFreeze$2(input);
26534
26585
  }
26535
26586
  const ingest$t$1 = function QuickActionLayoutRepresentationIngest(input, path, luvio, store, timestamp) {
@@ -26542,7 +26593,7 @@ const ingest$t$1 = function QuickActionLayoutRepresentationIngest(input, path, l
26542
26593
  propertyName: path.propertyName,
26543
26594
  ttl: ttlToUse
26544
26595
  });
26545
- deepFreeze$t(input);
26596
+ deepFreeze$u(input);
26546
26597
  if (existingRecord === undefined || equals$F(existingRecord, incomingRecord) === false) {
26547
26598
  luvio.storePublish(key, incomingRecord);
26548
26599
  }
@@ -27185,7 +27236,7 @@ function equals$E(existing, incoming) {
27185
27236
  }
27186
27237
  return true;
27187
27238
  }
27188
- function deepFreeze$s(input) {
27239
+ function deepFreeze$t(input) {
27189
27240
  const input_records = input.records;
27190
27241
  ObjectFreeze$2(input_records);
27191
27242
  ObjectFreeze$2(input);
@@ -27200,7 +27251,7 @@ const ingest$s$1 = function ActionOverrideRepresentationIngest(input, path, luvi
27200
27251
  propertyName: path.propertyName,
27201
27252
  ttl: ttlToUse
27202
27253
  });
27203
- deepFreeze$s(input);
27254
+ deepFreeze$t(input);
27204
27255
  if (existingRecord === undefined || equals$E(existingRecord, incomingRecord) === false) {
27205
27256
  luvio.storePublish(key, incomingRecord);
27206
27257
  }
@@ -28226,7 +28277,7 @@ const getRecordEditActionsAdapterFactory = (luvio) => function UiApi__getRecordE
28226
28277
  buildCachedSnapshotCachePolicy$z, buildNetworkSnapshotCachePolicy$A);
28227
28278
  };
28228
28279
 
28229
- function validate$10(obj, path = 'ActionRelatedListSingleBatchInputRepresentation') {
28280
+ function validate$11(obj, path = 'ActionRelatedListSingleBatchInputRepresentation') {
28230
28281
  const v_error = (() => {
28231
28282
  if (typeof obj !== 'object' || ArrayIsArray$2(obj) || obj === null) {
28232
28283
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -28617,7 +28668,7 @@ function typeCheckConfig$K(untrustedConfig) {
28617
28668
  const untrustedConfig_relatedListsActionParameters_array = [];
28618
28669
  for (let i = 0, arrayLength = untrustedConfig_relatedListsActionParameters.length; i < arrayLength; i++) {
28619
28670
  const untrustedConfig_relatedListsActionParameters_item = untrustedConfig_relatedListsActionParameters[i];
28620
- const referenceActionRelatedListSingleBatchInputRepresentationValidationError = validate$10(untrustedConfig_relatedListsActionParameters_item);
28671
+ const referenceActionRelatedListSingleBatchInputRepresentationValidationError = validate$11(untrustedConfig_relatedListsActionParameters_item);
28621
28672
  if (referenceActionRelatedListSingleBatchInputRepresentationValidationError === null) {
28622
28673
  untrustedConfig_relatedListsActionParameters_array.push(untrustedConfig_relatedListsActionParameters_item);
28623
28674
  }
@@ -29152,14 +29203,14 @@ function equals$C(existing, incoming) {
29152
29203
  }
29153
29204
  return true;
29154
29205
  }
29155
- function deepFreeze$r(input) {
29206
+ function deepFreeze$s(input) {
29156
29207
  const input_attributes = input.attributes;
29157
29208
  const input_attributes_keys = Object.keys(input_attributes);
29158
29209
  const input_attributes_length = input_attributes_keys.length;
29159
29210
  for (let i = 0; i < input_attributes_length; i++) {
29160
29211
  const key = input_attributes_keys[i];
29161
29212
  const input_attributes_prop = input_attributes[key];
29162
- deepFreeze$P(input_attributes_prop);
29213
+ deepFreeze$Q(input_attributes_prop);
29163
29214
  }
29164
29215
  ObjectFreeze$2(input_attributes);
29165
29216
  const input_state = input.state;
@@ -29183,7 +29234,7 @@ const ingest$r$1 = function PageReferenceRepresentationIngest(input, path, luvio
29183
29234
  propertyName: path.propertyName,
29184
29235
  ttl: ttlToUse
29185
29236
  });
29186
- deepFreeze$r(input);
29237
+ deepFreeze$s(input);
29187
29238
  if (existingRecord === undefined || equals$C(existingRecord, incomingRecord) === false) {
29188
29239
  luvio.storePublish(key, incomingRecord);
29189
29240
  }
@@ -32946,24 +32997,24 @@ const getPicklistValuesAdapterFactory = (luvio) => function UiApi__getPicklistVa
32946
32997
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
32947
32998
  buildCachedSnapshotCachePolicy$l, buildNetworkSnapshotCachePolicy$m);
32948
32999
  };
32949
- function deepFreeze$q(input) {
33000
+ function deepFreeze$r(input) {
32950
33001
  const input_recordIds = input.recordIds;
32951
33002
  ObjectFreeze$2(input_recordIds);
32952
33003
  ObjectFreeze$2(input);
32953
33004
  }
32954
- function deepFreeze$p(input) {
33005
+ function deepFreeze$q(input) {
32955
33006
  const input_matchResultInfo = input.matchResultInfo;
32956
- deepFreeze$q(input_matchResultInfo);
33007
+ deepFreeze$r(input_matchResultInfo);
32957
33008
  ObjectFreeze$2(input);
32958
33009
  }
32959
- function deepFreeze$o(input) {
33010
+ function deepFreeze$p(input) {
32960
33011
  const input_duplicateResultInfos = input.duplicateResultInfos;
32961
33012
  const input_duplicateResultInfos_keys = Object.keys(input_duplicateResultInfos);
32962
33013
  const input_duplicateResultInfos_length = input_duplicateResultInfos_keys.length;
32963
33014
  for (let i = 0; i < input_duplicateResultInfos_length; i++) {
32964
33015
  const key = input_duplicateResultInfos_keys[i];
32965
33016
  const input_duplicateResultInfos_prop = input_duplicateResultInfos[key];
32966
- deepFreeze$p(input_duplicateResultInfos_prop);
33017
+ deepFreeze$q(input_duplicateResultInfos_prop);
32967
33018
  }
32968
33019
  ObjectFreeze$2(input_duplicateResultInfos);
32969
33020
  const input_recordIds = input.recordIds;
@@ -32991,13 +33042,13 @@ function equals$u(existing, incoming) {
32991
33042
  }
32992
33043
  return true;
32993
33044
  }
32994
- function deepFreeze$n(input) {
33045
+ function deepFreeze$o(input) {
32995
33046
  const input_duplicateRules = input.duplicateRules;
32996
33047
  ObjectFreeze$2(input_duplicateRules);
32997
33048
  const input_matches = input.matches;
32998
33049
  for (let i = 0; i < input_matches.length; i++) {
32999
33050
  const input_matches_item = input_matches[i];
33000
- deepFreeze$o(input_matches_item);
33051
+ deepFreeze$p(input_matches_item);
33001
33052
  }
33002
33053
  ObjectFreeze$2(input_matches);
33003
33054
  ObjectFreeze$2(input);
@@ -33012,7 +33063,7 @@ const ingest$j$1 = function DuplicatesRepresentationIngest(input, path, luvio, s
33012
33063
  propertyName: path.propertyName,
33013
33064
  ttl: ttlToUse
33014
33065
  });
33015
- deepFreeze$n(input);
33066
+ deepFreeze$o(input);
33016
33067
  if (existingRecord === undefined || equals$u(existingRecord, incomingRecord) === false) {
33017
33068
  luvio.storePublish(key, incomingRecord);
33018
33069
  }
@@ -34357,7 +34408,7 @@ function typeCheckConfig$u(untrustedConfig) {
34357
34408
  }
34358
34409
  }
34359
34410
  if (records.length > 0) {
34360
- assign$6(config, { records });
34411
+ assign$7(config, { records });
34361
34412
  }
34362
34413
  }
34363
34414
  return config;
@@ -34528,7 +34579,7 @@ function equals$j(existing, incoming) {
34528
34579
  }
34529
34580
  return true;
34530
34581
  }
34531
- function deepFreeze$m(input) {
34582
+ function deepFreeze$n(input) {
34532
34583
  ObjectFreeze$2(input);
34533
34584
  }
34534
34585
 
@@ -35191,7 +35242,7 @@ const getRelatedListCountAdapterFactory = (luvio) => function UiApi__getRelatedL
35191
35242
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
35192
35243
  buildCachedSnapshotCachePolicy$g, buildNetworkSnapshotCachePolicy$h);
35193
35244
  };
35194
- function deepFreeze$l(input) {
35245
+ function deepFreeze$m(input) {
35195
35246
  const input_picklistValues = input.picklistValues;
35196
35247
  for (let i = 0; i < input_picklistValues.length; i++) {
35197
35248
  const input_picklistValues_item = input_picklistValues[i];
@@ -35327,11 +35378,11 @@ function equals$h(existing, incoming) {
35327
35378
  }
35328
35379
  return true;
35329
35380
  }
35330
- function deepFreeze$k(input) {
35381
+ function deepFreeze$l(input) {
35331
35382
  const input_displayColumns = input.displayColumns;
35332
35383
  for (let i = 0; i < input_displayColumns.length; i++) {
35333
35384
  const input_displayColumns_item = input_displayColumns[i];
35334
- deepFreeze$l(input_displayColumns_item);
35385
+ deepFreeze$m(input_displayColumns_item);
35335
35386
  }
35336
35387
  ObjectFreeze$2(input_displayColumns);
35337
35388
  const input_fields = input.fields;
@@ -35339,11 +35390,11 @@ function deepFreeze$k(input) {
35339
35390
  const input_filteredByInfo = input.filteredByInfo;
35340
35391
  for (let i = 0; i < input_filteredByInfo.length; i++) {
35341
35392
  const input_filteredByInfo_item = input_filteredByInfo[i];
35342
- deepFreeze$O(input_filteredByInfo_item);
35393
+ deepFreeze$P(input_filteredByInfo_item);
35343
35394
  }
35344
35395
  ObjectFreeze$2(input_filteredByInfo);
35345
35396
  const input_listReference = input.listReference;
35346
- deepFreeze$m(input_listReference);
35397
+ deepFreeze$n(input_listReference);
35347
35398
  const input_objectApiNames = input.objectApiNames;
35348
35399
  ObjectFreeze$2(input_objectApiNames);
35349
35400
  const input_optionalFields = input.optionalFields;
@@ -35351,11 +35402,11 @@ function deepFreeze$k(input) {
35351
35402
  const input_orderedByInfo = input.orderedByInfo;
35352
35403
  for (let i = 0; i < input_orderedByInfo.length; i++) {
35353
35404
  const input_orderedByInfo_item = input_orderedByInfo[i];
35354
- deepFreeze$N(input_orderedByInfo_item);
35405
+ deepFreeze$O(input_orderedByInfo_item);
35355
35406
  }
35356
35407
  ObjectFreeze$2(input_orderedByInfo);
35357
35408
  const input_userPreferences = input.userPreferences;
35358
- deepFreeze$M(input_userPreferences);
35409
+ deepFreeze$N(input_userPreferences);
35359
35410
  ObjectFreeze$2(input);
35360
35411
  }
35361
35412
  const ingest$b$1 = function RelatedListInfoRepresentationIngest(input, path, luvio, store, timestamp) {
@@ -35368,7 +35419,7 @@ const ingest$b$1 = function RelatedListInfoRepresentationIngest(input, path, luv
35368
35419
  propertyName: path.propertyName,
35369
35420
  ttl: ttlToUse
35370
35421
  });
35371
- deepFreeze$k(input);
35422
+ deepFreeze$l(input);
35372
35423
  if (existingRecord === undefined || equals$h(existingRecord, incomingRecord) === false) {
35373
35424
  luvio.storePublish(key, incomingRecord);
35374
35425
  }
@@ -35853,10 +35904,10 @@ const getRelatedListInfoBatchAdapterFactory = (luvio) => function UiApi__getRela
35853
35904
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
35854
35905
  buildCachedSnapshotCachePolicy$f, buildNetworkSnapshotCachePolicy$g);
35855
35906
  };
35856
- function deepFreeze$j(input) {
35907
+ function deepFreeze$k(input) {
35857
35908
  const input_themeInfo = input.themeInfo;
35858
35909
  if (input_themeInfo !== null && typeof input_themeInfo === 'object') {
35859
- deepFreeze$D(input_themeInfo);
35910
+ deepFreeze$E(input_themeInfo);
35860
35911
  }
35861
35912
  ObjectFreeze$2(input);
35862
35913
  }
@@ -35906,11 +35957,11 @@ function equals$g(existing, incoming) {
35906
35957
  }
35907
35958
  return true;
35908
35959
  }
35909
- function deepFreeze$i(input) {
35960
+ function deepFreeze$j(input) {
35910
35961
  const input_relatedLists = input.relatedLists;
35911
35962
  for (let i = 0; i < input_relatedLists.length; i++) {
35912
35963
  const input_relatedLists_item = input_relatedLists[i];
35913
- deepFreeze$j(input_relatedLists_item);
35964
+ deepFreeze$k(input_relatedLists_item);
35914
35965
  }
35915
35966
  ObjectFreeze$2(input_relatedLists);
35916
35967
  ObjectFreeze$2(input);
@@ -35925,7 +35976,7 @@ const ingest$a$1 = function RelatedListSummaryInfoCollectionRepresentationIngest
35925
35976
  propertyName: path.propertyName,
35926
35977
  ttl: ttlToUse
35927
35978
  });
35928
- deepFreeze$i(input);
35979
+ deepFreeze$j(input);
35929
35980
  if (existingRecord === undefined || equals$g(existingRecord, incomingRecord) === false) {
35930
35981
  luvio.storePublish(key, incomingRecord);
35931
35982
  }
@@ -36293,7 +36344,7 @@ const getRelatedListInfoAdapterFactory = (luvio) => function UiApi__getRelatedLi
36293
36344
  buildCachedSnapshotCachePolicy$d, buildNetworkSnapshotCachePolicy$e);
36294
36345
  };
36295
36346
 
36296
- function validate$t(obj, path = 'ListOrderedByInfoInputRepresentation') {
36347
+ function validate$u(obj, path = 'ListOrderedByInfoInputRepresentation') {
36297
36348
  const v_error = (() => {
36298
36349
  if (typeof obj !== 'object' || ArrayIsArray$2(obj) || obj === null) {
36299
36350
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -36312,7 +36363,7 @@ function validate$t(obj, path = 'ListOrderedByInfoInputRepresentation') {
36312
36363
  return v_error === undefined ? null : v_error;
36313
36364
  }
36314
36365
 
36315
- function validate$s(obj, path = 'ListUserPreferenceInputRepresentation') {
36366
+ function validate$t(obj, path = 'ListUserPreferenceInputRepresentation') {
36316
36367
  const v_error = (() => {
36317
36368
  if (typeof obj !== 'object' || ArrayIsArray$2(obj) || obj === null) {
36318
36369
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -36444,7 +36495,7 @@ function typeCheckConfig$o(untrustedConfig) {
36444
36495
  const untrustedConfig_orderedByInfo_array = [];
36445
36496
  for (let i = 0, arrayLength = untrustedConfig_orderedByInfo.length; i < arrayLength; i++) {
36446
36497
  const untrustedConfig_orderedByInfo_item = untrustedConfig_orderedByInfo[i];
36447
- const referenceListOrderedByInfoInputRepresentationValidationError = validate$t(untrustedConfig_orderedByInfo_item);
36498
+ const referenceListOrderedByInfoInputRepresentationValidationError = validate$u(untrustedConfig_orderedByInfo_item);
36448
36499
  if (referenceListOrderedByInfoInputRepresentationValidationError === null) {
36449
36500
  untrustedConfig_orderedByInfo_array.push(untrustedConfig_orderedByInfo_item);
36450
36501
  }
@@ -36452,7 +36503,7 @@ function typeCheckConfig$o(untrustedConfig) {
36452
36503
  config.orderedByInfo = untrustedConfig_orderedByInfo_array;
36453
36504
  }
36454
36505
  const untrustedConfig_userPreferences = untrustedConfig.userPreferences;
36455
- const referenceListUserPreferenceInputRepresentationValidationError = validate$s(untrustedConfig_userPreferences);
36506
+ const referenceListUserPreferenceInputRepresentationValidationError = validate$t(untrustedConfig_userPreferences);
36456
36507
  if (referenceListUserPreferenceInputRepresentationValidationError === null) {
36457
36508
  config.userPreferences = untrustedConfig_userPreferences;
36458
36509
  }
@@ -36479,7 +36530,7 @@ function buildNetworkSnapshot$m(luvio, config, options) {
36479
36530
  return luvio.storeBroadcast().then(() => snapshot);
36480
36531
  }, () => getResponseCacheKeys$k(luvio, resourceParams, response.body));
36481
36532
  }, (response) => {
36482
- deepFreeze$P(response);
36533
+ deepFreeze$Q(response);
36483
36534
  throw response;
36484
36535
  });
36485
36536
  }
@@ -36523,7 +36574,7 @@ function equals$f(existing, incoming) {
36523
36574
  }
36524
36575
  return true;
36525
36576
  }
36526
- function deepFreeze$h(input) {
36577
+ function deepFreeze$i(input) {
36527
36578
  const input_columnWidths = input.columnWidths;
36528
36579
  const input_columnWidths_keys = Object.keys(input_columnWidths);
36529
36580
  const input_columnWidths_length = input_columnWidths_keys.length;
@@ -36541,7 +36592,7 @@ function deepFreeze$h(input) {
36541
36592
  const input_orderedBy = input.orderedBy;
36542
36593
  for (let i = 0; i < input_orderedBy.length; i++) {
36543
36594
  const input_orderedBy_item = input_orderedBy[i];
36544
- deepFreeze$N(input_orderedBy_item);
36595
+ deepFreeze$O(input_orderedBy_item);
36545
36596
  }
36546
36597
  ObjectFreeze$2(input_orderedBy);
36547
36598
  ObjectFreeze$2(input);
@@ -36556,7 +36607,7 @@ const ingest$9$1 = function RelatedListUserPreferencesRepresentationIngest(input
36556
36607
  propertyName: path.propertyName,
36557
36608
  ttl: ttlToUse
36558
36609
  });
36559
- deepFreeze$h(input);
36610
+ deepFreeze$i(input);
36560
36611
  if (existingRecord === undefined || equals$f(existingRecord, incomingRecord) === false) {
36561
36612
  luvio.storePublish(key, incomingRecord);
36562
36613
  }
@@ -37208,7 +37259,7 @@ function typeCheckConfig$l(untrustedConfig) {
37208
37259
  const untrustedConfig_orderedBy_array = [];
37209
37260
  for (let i = 0, arrayLength = untrustedConfig_orderedBy.length; i < arrayLength; i++) {
37210
37261
  const untrustedConfig_orderedBy_item = untrustedConfig_orderedBy[i];
37211
- const referenceListOrderedByInfoInputRepresentationValidationError = validate$t(untrustedConfig_orderedBy_item);
37262
+ const referenceListOrderedByInfoInputRepresentationValidationError = validate$u(untrustedConfig_orderedBy_item);
37212
37263
  if (referenceListOrderedByInfoInputRepresentationValidationError === null) {
37213
37264
  untrustedConfig_orderedBy_array.push(untrustedConfig_orderedBy_item);
37214
37265
  }
@@ -37237,7 +37288,7 @@ function buildNetworkSnapshot$j(luvio, config, options) {
37237
37288
  return luvio.storeBroadcast().then(() => snapshot);
37238
37289
  }, () => getResponseCacheKeys$h(luvio, resourceParams, response.body));
37239
37290
  }, (response) => {
37240
- deepFreeze$P(response);
37291
+ deepFreeze$Q(response);
37241
37292
  throw response;
37242
37293
  });
37243
37294
  }
@@ -37252,7 +37303,7 @@ const updateRelatedListPreferencesAdapterFactory = (luvio) => {
37252
37303
  };
37253
37304
  };
37254
37305
 
37255
- function validate$q(obj, path = 'RelatedListRecordsSingleBatchInputRepresentation') {
37306
+ function validate$r(obj, path = 'RelatedListRecordsSingleBatchInputRepresentation') {
37256
37307
  const v_error = (() => {
37257
37308
  if (typeof obj !== 'object' || ArrayIsArray$2(obj) || obj === null) {
37258
37309
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -38226,7 +38277,7 @@ function typeCheckConfig$k(untrustedConfig) {
38226
38277
  const untrustedConfig_relatedListParameters_array = [];
38227
38278
  for (let i = 0, arrayLength = untrustedConfig_relatedListParameters.length; i < arrayLength; i++) {
38228
38279
  const untrustedConfig_relatedListParameters_item = untrustedConfig_relatedListParameters[i];
38229
- const referenceRelatedListRecordsSingleBatchInputRepresentationValidationError = validate$q(untrustedConfig_relatedListParameters_item);
38280
+ const referenceRelatedListRecordsSingleBatchInputRepresentationValidationError = validate$r(untrustedConfig_relatedListParameters_item);
38230
38281
  if (referenceRelatedListRecordsSingleBatchInputRepresentationValidationError === null) {
38231
38282
  untrustedConfig_relatedListParameters_array.push(untrustedConfig_relatedListParameters_item);
38232
38283
  }
@@ -38539,7 +38590,7 @@ function buildCachedSnapshotCachePolicy$9(context, storeLookup) {
38539
38590
  config,
38540
38591
  resolve: () => buildNetworkSnapshot$h(luvio, config, snapshotRefreshOptions$1)
38541
38592
  });
38542
- if (isUnfulfilledSnapshot$1(cacheSnapshot) && cacheSnapshot.data !== undefined) {
38593
+ if (isUnfulfilledSnapshot$1$1(cacheSnapshot) && cacheSnapshot.data !== undefined) {
38543
38594
  context.cacheSnapshot = cacheSnapshot;
38544
38595
  }
38545
38596
  return cacheSnapshot;
@@ -38572,7 +38623,7 @@ const select$k$1 = function SearchFilterOptionRepresentationSelect() {
38572
38623
  ]
38573
38624
  };
38574
38625
  };
38575
- function deepFreeze$g(input) {
38626
+ function deepFreeze$h(input) {
38576
38627
  ObjectFreeze$2(input);
38577
38628
  }
38578
38629
 
@@ -39009,11 +39060,11 @@ function equals$a(existing, incoming) {
39009
39060
  }
39010
39061
  return true;
39011
39062
  }
39012
- function deepFreeze$f(input) {
39063
+ function deepFreeze$g(input) {
39013
39064
  const input_options = input.options;
39014
39065
  for (let i = 0; i < input_options.length; i++) {
39015
39066
  const input_options_item = input_options[i];
39016
- deepFreeze$g(input_options_item);
39067
+ deepFreeze$h(input_options_item);
39017
39068
  }
39018
39069
  ObjectFreeze$2(input_options);
39019
39070
  ObjectFreeze$2(input);
@@ -39028,7 +39079,7 @@ const ingest$6$1 = function SearchFilterOptionCollectionRepresentationIngest(inp
39028
39079
  propertyName: path.propertyName,
39029
39080
  ttl: ttlToUse
39030
39081
  });
39031
- deepFreeze$f(input);
39082
+ deepFreeze$g(input);
39032
39083
  if (existingRecord === undefined || equals$a(existingRecord, incomingRecord) === false) {
39033
39084
  luvio.storePublish(key, incomingRecord);
39034
39085
  }
@@ -39221,28 +39272,28 @@ const getSearchFilterOptionsAdapterFactory = (luvio) => function UiApi__getSearc
39221
39272
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
39222
39273
  buildCachedSnapshotCachePolicy$7, buildNetworkSnapshotCachePolicy$8);
39223
39274
  };
39224
- function deepFreeze$e(input) {
39275
+ function deepFreeze$f(input) {
39225
39276
  const input_displayFields = input.displayFields;
39226
39277
  ObjectFreeze$2(input_displayFields);
39227
39278
  ObjectFreeze$2(input);
39228
39279
  }
39229
- function deepFreeze$d(input) {
39280
+ function deepFreeze$e(input) {
39230
39281
  const input_matchingFields = input.matchingFields;
39231
39282
  ObjectFreeze$2(input_matchingFields);
39232
39283
  ObjectFreeze$2(input);
39233
39284
  }
39234
- function deepFreeze$c(input) {
39285
+ function deepFreeze$d(input) {
39235
39286
  const input_displayLayout = input.displayLayout;
39236
- deepFreeze$e(input_displayLayout);
39287
+ deepFreeze$f(input_displayLayout);
39237
39288
  const input_matchingInfo = input.matchingInfo;
39238
- deepFreeze$d(input_matchingInfo);
39289
+ deepFreeze$e(input_matchingInfo);
39239
39290
  ObjectFreeze$2(input);
39240
39291
  }
39241
- function deepFreeze$b(input) {
39292
+ function deepFreeze$c(input) {
39242
39293
  const input_fullSearchInfo = input.fullSearchInfo;
39243
- deepFreeze$c(input_fullSearchInfo);
39294
+ deepFreeze$d(input_fullSearchInfo);
39244
39295
  const input_suggestionsInfo = input.suggestionsInfo;
39245
- deepFreeze$c(input_suggestionsInfo);
39296
+ deepFreeze$d(input_suggestionsInfo);
39246
39297
  ObjectFreeze$2(input);
39247
39298
  }
39248
39299
 
@@ -39276,14 +39327,14 @@ function equals$9(existing, incoming) {
39276
39327
  }
39277
39328
  return true;
39278
39329
  }
39279
- function deepFreeze$a(input) {
39330
+ function deepFreeze$b(input) {
39280
39331
  const input_targetInfo = input.targetInfo;
39281
39332
  const input_targetInfo_keys = Object.keys(input_targetInfo);
39282
39333
  const input_targetInfo_length = input_targetInfo_keys.length;
39283
39334
  for (let i = 0; i < input_targetInfo_length; i++) {
39284
39335
  const key = input_targetInfo_keys[i];
39285
39336
  const input_targetInfo_prop = input_targetInfo[key];
39286
- deepFreeze$b(input_targetInfo_prop);
39337
+ deepFreeze$c(input_targetInfo_prop);
39287
39338
  }
39288
39339
  ObjectFreeze$2(input_targetInfo);
39289
39340
  ObjectFreeze$2(input);
@@ -39298,7 +39349,7 @@ const ingest$5$1 = function LookupMetadataRepresentationIngest(input, path, luvi
39298
39349
  propertyName: path.propertyName,
39299
39350
  ttl: ttlToUse
39300
39351
  });
39301
- deepFreeze$a(input);
39352
+ deepFreeze$b(input);
39302
39353
  if (existingRecord === undefined || equals$9(existingRecord, incomingRecord) === false) {
39303
39354
  luvio.storePublish(key, incomingRecord);
39304
39355
  }
@@ -39483,11 +39534,11 @@ const getLookupMetadataAdapterFactory = (luvio) => function UiApi__getLookupMeta
39483
39534
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
39484
39535
  buildCachedSnapshotCachePolicy$6, buildNetworkSnapshotCachePolicy$7);
39485
39536
  };
39486
- function deepFreeze$9(input) {
39537
+ function deepFreeze$a(input) {
39487
39538
  ObjectFreeze$2(input);
39488
39539
  }
39489
39540
 
39490
- function deepFreeze$8(input) {
39541
+ function deepFreeze$9(input) {
39491
39542
  const input_fields = input.fields;
39492
39543
  const input_fields_keys = Object.keys(input_fields);
39493
39544
  const input_fields_length = input_fields_keys.length;
@@ -39498,57 +39549,66 @@ function deepFreeze$8(input) {
39498
39549
  ObjectFreeze$2(input);
39499
39550
  }
39500
39551
 
39501
- function deepFreeze$7(input) {
39552
+ function deepFreeze$8(input) {
39502
39553
  ObjectFreeze$2(input);
39503
39554
  }
39504
39555
 
39505
- function deepFreeze$6(input) {
39556
+ function deepFreeze$7(input) {
39506
39557
  const input_highlightInfo = input.highlightInfo;
39507
39558
  if (input_highlightInfo !== undefined) {
39508
- deepFreeze$8(input_highlightInfo);
39559
+ deepFreeze$9(input_highlightInfo);
39509
39560
  }
39510
39561
  const input_record = input.record;
39511
- deepFreeze$I(input_record);
39562
+ deepFreeze$J(input_record);
39512
39563
  const input_searchInfo = input.searchInfo;
39513
- deepFreeze$7(input_searchInfo);
39564
+ deepFreeze$8(input_searchInfo);
39514
39565
  ObjectFreeze$2(input);
39515
39566
  }
39516
- function deepFreeze$5(input) {
39567
+ function deepFreeze$6(input) {
39517
39568
  const input_error = input.error;
39518
39569
  if (input_error !== null && typeof input_error === 'object') {
39519
- deepFreeze$9(input_error);
39570
+ deepFreeze$a(input_error);
39520
39571
  }
39521
39572
  const input_orderBy = input.orderBy;
39522
39573
  for (let i = 0; i < input_orderBy.length; i++) {
39523
39574
  const input_orderBy_item = input_orderBy[i];
39524
- deepFreeze$N(input_orderBy_item);
39575
+ deepFreeze$O(input_orderBy_item);
39525
39576
  }
39526
39577
  ObjectFreeze$2(input_orderBy);
39527
39578
  const input_records = input.records;
39528
39579
  for (let i = 0; i < input_records.length; i++) {
39529
39580
  const input_records_item = input_records[i];
39530
- deepFreeze$6(input_records_item);
39581
+ deepFreeze$7(input_records_item);
39531
39582
  }
39532
39583
  ObjectFreeze$2(input_records);
39533
39584
  const input_relatedObjectApiNames = input.relatedObjectApiNames;
39534
39585
  ObjectFreeze$2(input_relatedObjectApiNames);
39535
39586
  ObjectFreeze$2(input);
39536
39587
  }
39537
- function deepFreeze$4(input) {
39588
+ function deepFreeze$5(input) {
39538
39589
  const input_results = input.results;
39539
39590
  for (let i = 0; i < input_results.length; i++) {
39540
39591
  const input_results_item = input_results[i];
39541
- deepFreeze$5(input_results_item);
39592
+ deepFreeze$6(input_results_item);
39542
39593
  }
39543
39594
  ObjectFreeze$2(input_results);
39544
39595
  ObjectFreeze$2(input);
39545
39596
  }
39597
+ function deepFreeze$4(input) {
39598
+ ObjectFreeze$2(input);
39599
+ }
39546
39600
  function deepFreeze$3(input) {
39601
+ const input_records = input.records;
39602
+ for (let i = 0; i < input_records.length; i++) {
39603
+ const input_records_item = input_records[i];
39604
+ deepFreeze$4(input_records_item);
39605
+ }
39606
+ ObjectFreeze$2(input_records);
39547
39607
  ObjectFreeze$2(input);
39548
39608
  }
39549
39609
 
39550
39610
  const TTL$6 = 200;
39551
- const VERSION$8$1 = "9760c93d10288bb6889882c757514189";
39611
+ const VERSION$8$1 = "da21e889922062e90012ba48c4a733e2";
39552
39612
  const RepresentationType$9 = 'SearchResultsSummaryRepresentation';
39553
39613
  function keyBuilder$f$1(luvio, config) {
39554
39614
  return keyPrefix$1 + '::' + RepresentationType$9 + ':' + config.query;
@@ -39579,7 +39639,7 @@ function equals$8(existing, incoming) {
39579
39639
  function deepFreeze$2$1(input) {
39580
39640
  const input_keywordSearchResults = input.keywordSearchResults;
39581
39641
  if (input_keywordSearchResults !== null && typeof input_keywordSearchResults === 'object') {
39582
- deepFreeze$4(input_keywordSearchResults);
39642
+ deepFreeze$5(input_keywordSearchResults);
39583
39643
  }
39584
39644
  const input_qnaResult = input.qnaResult;
39585
39645
  if (input_qnaResult !== null && typeof input_qnaResult === 'object') {
@@ -39908,7 +39968,7 @@ function equals$7(existing, incoming) {
39908
39968
  }
39909
39969
  function deepFreeze$1$1(input) {
39910
39970
  const input_keywordSearchResult = input.keywordSearchResult;
39911
- deepFreeze$5(input_keywordSearchResult);
39971
+ deepFreeze$6(input_keywordSearchResult);
39912
39972
  ObjectFreeze$2(input);
39913
39973
  }
39914
39974
  const ingest$3$1 = function KeywordSearchResultsSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
@@ -40274,7 +40334,7 @@ function buildNetworkSnapshot$b(luvio, config, options) {
40274
40334
  return luvio.storeBroadcast().then(() => snapshot);
40275
40335
  }, () => getResponseCacheKeys$9(luvio, resourceParams, response.body));
40276
40336
  }, (response) => {
40277
- deepFreeze$P(response);
40337
+ deepFreeze$Q(response);
40278
40338
  throw response;
40279
40339
  });
40280
40340
  }
@@ -40418,7 +40478,7 @@ function buildNetworkSnapshot$a(luvio, config, options) {
40418
40478
  return luvio.storeBroadcast().then(() => snapshot);
40419
40479
  }, () => getResponseCacheKeys$8(luvio, resourceParams, response.body));
40420
40480
  }, (response) => {
40421
- deepFreeze$P(response);
40481
+ deepFreeze$Q(response);
40422
40482
  throw response;
40423
40483
  });
40424
40484
  }
@@ -40435,20 +40495,20 @@ const performQuickActionAdapterFactory = (luvio) => {
40435
40495
 
40436
40496
  const factory$c = performQuickActionAdapterFactory;
40437
40497
 
40438
- function deepFreeze$Q(value) {
40498
+ function deepFreeze$R(value) {
40439
40499
  // No need to freeze primitives
40440
40500
  if (typeof value !== 'object' || value === null) {
40441
40501
  return;
40442
40502
  }
40443
40503
  if (isArray$8(value)) {
40444
40504
  for (let i = 0, len = value.length; i < len; i += 1) {
40445
- deepFreeze$Q(value[i]);
40505
+ deepFreeze$R(value[i]);
40446
40506
  }
40447
40507
  }
40448
40508
  else {
40449
- const keys$1 = keys$8(value);
40509
+ const keys$1 = keys$9(value);
40450
40510
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
40451
- deepFreeze$Q(value[keys$1[i]]);
40511
+ deepFreeze$R(value[keys$1[i]]);
40452
40512
  }
40453
40513
  }
40454
40514
  freeze$3(value);
@@ -40504,7 +40564,7 @@ function updateLayoutUserState$1(luvio, config, key, updateRequest) {
40504
40564
  const { body } = response;
40505
40565
  return luvio.handleSuccessResponse(() => ingestAndBroadcast(luvio, key, config, body), () => getTypeCacheKeys$G$1(luvio, body));
40506
40566
  }, (err) => {
40507
- deepFreeze$Q(err);
40567
+ deepFreeze$R(err);
40508
40568
  throw err;
40509
40569
  });
40510
40570
  }
@@ -40528,7 +40588,7 @@ function optimisticUpdate(cachedLayoutUserState, layoutUserStateInput) {
40528
40588
  let clonedLayoutUserStateSections;
40529
40589
  const { sectionUserStates } = layoutUserStateInput;
40530
40590
  const { sectionUserStates: cachedSectionUserStates } = cachedLayoutUserState;
40531
- const sectionUserStateKeys = keys$8(sectionUserStates);
40591
+ const sectionUserStateKeys = keys$9(sectionUserStates);
40532
40592
  for (let i = 0, len = sectionUserStateKeys.length; i < len; i += 1) {
40533
40593
  const sectionId = sectionUserStateKeys[i];
40534
40594
  if (cachedSectionUserStates[sectionId] === undefined) {
@@ -40824,7 +40884,7 @@ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
40824
40884
  config,
40825
40885
  resolve: () => buildNetworkSnapshot$9(luvio, config, snapshotRefreshOptions$1)
40826
40886
  });
40827
- if (isUnfulfilledSnapshot$1(cacheSnapshot) && cacheSnapshot.data !== undefined) {
40887
+ if (isUnfulfilledSnapshot$1$1(cacheSnapshot) && cacheSnapshot.data !== undefined) {
40828
40888
  context.cacheSnapshot = cacheSnapshot;
40829
40889
  }
40830
40890
  return cacheSnapshot;
@@ -41098,7 +41158,7 @@ function buildNetworkSnapshot$8(luvio, config, options) {
41098
41158
  .map((targetApiName) => body.lookupResults[targetApiName].records)
41099
41159
  .reduce((allRecords, records) => allRecords.concat(records), [])
41100
41160
  .forEach((record) => removeEtags(record));
41101
- deepFreeze$Q(body);
41161
+ deepFreeze$R(body);
41102
41162
  return Promise.resolve({
41103
41163
  state: 'Fulfilled',
41104
41164
  recordId: key,
@@ -41268,7 +41328,7 @@ const factory$8 = (luvio) => {
41268
41328
  return luvio.storeBroadcast().then(() => snapshot);
41269
41329
  }, () => getTypeCacheKeys$n$1(luvio, body));
41270
41330
  }, (err) => {
41271
- deepFreeze$Q(err);
41331
+ deepFreeze$R(err);
41272
41332
  throw err;
41273
41333
  });
41274
41334
  };
@@ -43126,7 +43186,7 @@ function buildNetworkSnapshot$4(luvio, config) {
43126
43186
  return luvio.dispatchResourceRequest(request).then((response) => {
43127
43187
  return luvio.handleSuccessResponse(() => onResponseSuccess$1(luvio, response, recordIngest, conflictMap), () => getResponseCacheKeys$3(luvio, resourceParams, response.body));
43128
43188
  }, (err) => {
43129
- deepFreeze$Q(err);
43189
+ deepFreeze$R(err);
43130
43190
  throw err;
43131
43191
  });
43132
43192
  }
@@ -43227,7 +43287,7 @@ function buildNetworkSnapshot$3(luvio, config, options) {
43227
43287
  return luvio.storeBroadcast();
43228
43288
  }, () => getResponseCacheKeys$2$1(luvio, resourceParams));
43229
43289
  }, (response) => {
43230
- deepFreeze$P(response);
43290
+ deepFreeze$Q(response);
43231
43291
  throw response;
43232
43292
  });
43233
43293
  }
@@ -43461,7 +43521,7 @@ function buildNetworkSnapshot$2$1(luvio, config, clientOptions) {
43461
43521
  return luvio.dispatchResourceRequest(request).then((response) => {
43462
43522
  return luvio.handleSuccessResponse(() => onResponseSuccess(luvio, response, recordId, recordIngest, conflictMap), () => getResponseCacheKeys$1$1(luvio, resourceParams, response.body));
43463
43523
  }, (err) => {
43464
- deepFreeze$Q(err);
43524
+ deepFreeze$R(err);
43465
43525
  throw err;
43466
43526
  });
43467
43527
  }
@@ -43717,7 +43777,7 @@ function buildNetworkSnapshot$1$1(luvio, config, options) {
43717
43777
  return luvio.storeBroadcast().then(() => snapshot);
43718
43778
  }, () => getResponseCacheKeys$T(luvio, {}, response.body));
43719
43779
  }, (response) => {
43720
- deepFreeze$P(response);
43780
+ deepFreeze$Q(response);
43721
43781
  throw response;
43722
43782
  });
43723
43783
  }
@@ -43784,7 +43844,7 @@ function buildNetworkSnapshot$X(luvio, config, options) {
43784
43844
  return luvio.storeBroadcast().then(() => snapshot);
43785
43845
  }, () => getResponseCacheKeys$T(luvio, resourceParams, response.body));
43786
43846
  }, (response) => {
43787
- deepFreeze$P(response);
43847
+ deepFreeze$Q(response);
43788
43848
  throw response;
43789
43849
  });
43790
43850
  }
@@ -44412,7 +44472,7 @@ withDefaultLuvio((luvio) => {
44412
44472
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44413
44473
  });
44414
44474
  });
44415
- // version: 1.130.9-a2fbc710a
44475
+ // version: 1.131.0-dev9-9940b321d
44416
44476
 
44417
44477
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44418
44478
 
@@ -44438,6 +44498,15 @@ const idleDetector = {
44438
44498
  declarePollableTaskMulti,
44439
44499
  };
44440
44500
 
44501
+ var ldsUseShortUrlGate = {
44502
+ isOpen: function (e) {
44503
+ return e.fallback;
44504
+ },
44505
+ hasError: function () {
44506
+ return !0;
44507
+ },
44508
+ };
44509
+
44441
44510
  var LOCALE = 'en-US';
44442
44511
 
44443
44512
  var CURRENCY = 'USD';
@@ -44475,6 +44544,33 @@ function formattingOptions(pattern) {
44475
44544
  return pattern;
44476
44545
  }
44477
44546
 
44547
+ var eagerEvalValidAt = {
44548
+ isOpen: function (e) {
44549
+ return e.fallback;
44550
+ },
44551
+ hasError: function () {
44552
+ return !0;
44553
+ },
44554
+ };
44555
+
44556
+ var eagerEvalStaleWhileRevalidate = {
44557
+ isOpen: function (e) {
44558
+ return e.fallback;
44559
+ },
44560
+ hasError: function () {
44561
+ return !0;
44562
+ },
44563
+ };
44564
+
44565
+ var eagerEvalDefaultCachePolicy = {
44566
+ isOpen: function (e) {
44567
+ return e.fallback;
44568
+ },
44569
+ hasError: function () {
44570
+ return !0;
44571
+ },
44572
+ };
44573
+
44478
44574
  /**
44479
44575
  * Copyright (c) 2022, Salesforce, Inc.,
44480
44576
  * All rights reserved.
@@ -44490,7 +44586,7 @@ function formattingOptions(pattern) {
44490
44586
  const { parse: parse$5, stringify: stringify$5 } = JSON;
44491
44587
  const { join: join$2, push: push$2, unshift } = Array.prototype;
44492
44588
  const { isArray: isArray$6 } = Array;
44493
- const { entries: entries$3, keys: keys$6 } = Object;
44589
+ const { entries: entries$3, keys: keys$7 } = Object;
44494
44590
 
44495
44591
  const UI_API_BASE_URI = '/services/data/v58.0/ui-api';
44496
44592
 
@@ -44555,7 +44651,7 @@ function isSpanningRecord$1(fieldValue) {
44555
44651
  function mergeRecordFields$1(first, second) {
44556
44652
  const { fields: targetFields } = first;
44557
44653
  const { fields: sourceFields } = second;
44558
- const fieldNames = keys$6(sourceFields);
44654
+ const fieldNames = keys$7(sourceFields);
44559
44655
  for (let i = 0, len = fieldNames.length; i < len; i += 1) {
44560
44656
  const fieldName = fieldNames[i];
44561
44657
  const sourceField = sourceFields[fieldName];
@@ -44958,8 +45054,9 @@ function isDeprecatedDurableStoreEntry(durableRecord) {
44958
45054
  return false;
44959
45055
  }
44960
45056
  const DefaultDurableSegment = 'DEFAULT';
45057
+ const RedirectDurableSegment = 'REDIRECT_KEYS';
44961
45058
 
44962
- const { keys: keys$5, create: create$5, assign: assign$4, freeze: freeze$1$1 } = Object;
45059
+ const { keys: keys$6, create: create$5, assign: assign$5, freeze: freeze$1$1 } = Object;
44963
45060
  const { isArray: isArray$5 } = Array;
44964
45061
 
44965
45062
  //Durable store error instrumentation key
@@ -44994,7 +45091,7 @@ function deepFreeze$2(value) {
44994
45091
  }
44995
45092
  }
44996
45093
  else {
44997
- const keys$1 = keys$5(value);
45094
+ const keys$1 = keys$6(value);
44998
45095
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
44999
45096
  deepFreeze$2(value[keys$1[i]]);
45000
45097
  }
@@ -45017,13 +45114,13 @@ function isStoreEntryError(storeRecord) {
45017
45114
  * @param pendingWriter the PendingWriter (this is going away soon)
45018
45115
  * @returns
45019
45116
  */
45020
- function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
45117
+ function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
45021
45118
  const revivedKeys = new StoreKeySet();
45022
45119
  let hadUnexpectedShape = false;
45023
45120
  if (durableRecords === undefined) {
45024
45121
  return { revivedKeys, hadUnexpectedShape };
45025
45122
  }
45026
- const durableKeys = keys$5(durableRecords);
45123
+ const durableKeys = keys$6(durableRecords);
45027
45124
  if (durableKeys.length === 0) {
45028
45125
  // no records to revive
45029
45126
  return { revivedKeys, hadUnexpectedShape };
@@ -45055,7 +45152,7 @@ function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
45055
45152
  // freeze errors on way into L1
45056
45153
  deepFreeze$2(data.error);
45057
45154
  }
45058
- publish(key, data);
45155
+ put(key, data);
45059
45156
  revivedKeys.add(key);
45060
45157
  }
45061
45158
  return { revivedKeys, hadUnexpectedShape };
@@ -45095,7 +45192,7 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, reviveMetrics =
45095
45192
  // TODO [W-10072584]: instead of implicitly using L1 we should take in
45096
45193
  // publish and publishMetadata funcs, so callers can decide where to
45097
45194
  // revive to (like they pass in how to do the buildL1Snapshot)
45098
- baseEnvironment.storePublish.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
45195
+ baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
45099
45196
  // if the data coming back from DS had an unexpected shape then just
45100
45197
  // return the L1 snapshot
45101
45198
  if (hadUnexpectedShape === true) {
@@ -45197,7 +45294,7 @@ class DurableTTLStore {
45197
45294
  overrides,
45198
45295
  };
45199
45296
  }
45200
- const keys$1 = keys$5(entries);
45297
+ const keys$1 = keys$6(entries);
45201
45298
  for (let i = 0, len = keys$1.length; i < len; i++) {
45202
45299
  const key = keys$1[i];
45203
45300
  const entry = entries[key];
@@ -45228,14 +45325,14 @@ function copy(source) {
45228
45325
  }
45229
45326
  return { ...source };
45230
45327
  }
45231
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
45328
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = []) {
45232
45329
  const durableRecords = create$5(null);
45233
45330
  const evictedRecords = create$5(null);
45234
45331
  const { records, metadata: storeMetadata, visitedIds, refreshedIds, } = store.fallbackStringKeyInMemoryStore;
45235
45332
  // TODO: W-8909393 Once metadata is stored in its own segment we need to
45236
45333
  // call setEntries for the visitedIds on default segment and call setEntries
45237
45334
  // on the metadata segment for the refreshedIds
45238
- const keys$1 = keys$5({ ...visitedIds, ...refreshedIds });
45335
+ const keys$1 = keys$6({ ...visitedIds, ...refreshedIds });
45239
45336
  for (let i = 0, len = keys$1.length; i < len; i += 1) {
45240
45337
  const key = keys$1[i];
45241
45338
  const record = records[key];
@@ -45257,9 +45354,9 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
45257
45354
  };
45258
45355
  }
45259
45356
  }
45260
- const durableStoreOperations = [];
45357
+ const durableStoreOperations = additionalDurableStoreOperations;
45261
45358
  // publishes
45262
- const recordKeys = keys$5(durableRecords);
45359
+ const recordKeys = keys$6(durableRecords);
45263
45360
  if (recordKeys.length > 0) {
45264
45361
  durableStoreOperations.push({
45265
45362
  type: 'setEntries',
@@ -45267,8 +45364,20 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
45267
45364
  segment: DefaultDurableSegment,
45268
45365
  });
45269
45366
  }
45367
+ // redirects
45368
+ redirects.forEach((value, key) => {
45369
+ durableStoreOperations.push({
45370
+ type: 'setEntries',
45371
+ entries: {
45372
+ [key]: {
45373
+ data: { key, redirect: value },
45374
+ },
45375
+ },
45376
+ segment: RedirectDurableSegment,
45377
+ });
45378
+ });
45270
45379
  // evicts
45271
- const evictedKeys = keys$5(evictedRecords);
45380
+ const evictedKeys = keys$6(evictedRecords);
45272
45381
  if (evictedKeys.length > 0) {
45273
45382
  durableStoreOperations.push({
45274
45383
  type: 'evictEntries',
@@ -45312,6 +45421,19 @@ function buildIngestStagingStore(environment) {
45312
45421
  return environment.storeBuildIngestionStagingStore();
45313
45422
  }
45314
45423
 
45424
+ async function reviveRedirects(durableStore, env) {
45425
+ const entries = await durableStore.getAllEntries(RedirectDurableSegment);
45426
+ if (entries) {
45427
+ for (const durableEntry of Object.keys(entries)) {
45428
+ const entry = entries[durableEntry];
45429
+ const { data: { key, redirect }, } = entry;
45430
+ if (entry) {
45431
+ env.storeRedirect(key, redirect);
45432
+ }
45433
+ }
45434
+ }
45435
+ }
45436
+
45315
45437
  const AdapterContextSegment = 'ADAPTER-CONTEXT';
45316
45438
  const ADAPTER_CONTEXT_ID_SUFFIX = '__NAMED_CONTEXT';
45317
45439
  async function reviveOrCreateContext(adapterId, durableStore, durableStoreErrorHandler, contextStores, pendingContextStoreKeys, onContextLoaded) {
@@ -45349,7 +45471,7 @@ async function reviveOrCreateContext(adapterId, durableStore, durableStoreErrorH
45349
45471
  }
45350
45472
  return contextReturn();
45351
45473
  }
45352
- function isUnfulfilledSnapshot(cachedSnapshotResult) {
45474
+ function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
45353
45475
  if (cachedSnapshotResult === undefined) {
45354
45476
  return false;
45355
45477
  }
@@ -45374,13 +45496,18 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45374
45496
  // event. If this instance of makeDurable caused that L2 write we can ignore that
45375
45497
  // on change event. This Set helps us do that.
45376
45498
  const pendingContextStoreKeys = new Set();
45499
+ // redirects that need to be flushed to the durable store
45500
+ const pendingStoreRedirects = new Map();
45377
45501
  const contextStores = create$5(null);
45378
45502
  let initializationPromise = new Promise((resolve) => {
45379
45503
  const finish = () => {
45380
45504
  resolve();
45381
45505
  initializationPromise = undefined;
45382
45506
  };
45383
- reviveTTLOverrides(durableTTLStore, environment).then(finish);
45507
+ Promise.all([
45508
+ reviveTTLOverrides(durableTTLStore, environment),
45509
+ reviveRedirects(durableStore, environment),
45510
+ ]).then(finish);
45384
45511
  });
45385
45512
  //instrumentation for durable store errors
45386
45513
  const durableStoreErrorHandler = handleDurableStoreRejection(instrumentation);
@@ -45393,6 +45520,8 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45393
45520
  const unsubscribe = durableStore.registerOnChangedListener(async (changes) => {
45394
45521
  const defaultSegmentKeys = [];
45395
45522
  const adapterContextSegmentKeys = [];
45523
+ const redirectSegmentKeys = [];
45524
+ let shouldBroadcast = false;
45396
45525
  for (let i = 0, len = changes.length; i < len; i++) {
45397
45526
  const change = changes[i];
45398
45527
  // we only care about changes to the data which is stored in the default
@@ -45403,6 +45532,20 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45403
45532
  else if (change.segment === AdapterContextSegment) {
45404
45533
  adapterContextSegmentKeys.push(...change.ids);
45405
45534
  }
45535
+ else if (change.segment === RedirectDurableSegment) {
45536
+ redirectSegmentKeys.push(...change.ids);
45537
+ }
45538
+ }
45539
+ if (redirectSegmentKeys.length > 0) {
45540
+ const redirectEntries = await durableStore.getEntries(redirectSegmentKeys, RedirectDurableSegment);
45541
+ if (redirectEntries !== undefined) {
45542
+ const redirectKeys = Object.keys(redirectEntries);
45543
+ for (const key of redirectKeys) {
45544
+ const redirectData = redirectEntries[key];
45545
+ environment.storeRedirect(redirectData.data.key, redirectData.data.redirect);
45546
+ shouldBroadcast = true;
45547
+ }
45548
+ }
45406
45549
  }
45407
45550
  // process adapter context changes
45408
45551
  const adapterContextKeysFromDifferentInstance = [];
@@ -45422,7 +45565,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45422
45565
  try {
45423
45566
  const entries = await durableStore.getEntries(adapterContextKeysFromDifferentInstance, AdapterContextSegment);
45424
45567
  if (entries !== undefined) {
45425
- const entryKeys = keys$5(entries);
45568
+ const entryKeys = keys$6(entries);
45426
45569
  for (let i = 0, len = entryKeys.length; i < len; i++) {
45427
45570
  const entryKey = entryKeys[i];
45428
45571
  const entry = entries[entryKey];
@@ -45439,10 +45582,6 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45439
45582
  if (defaultSegmentKeysLength > 0) {
45440
45583
  for (let i = 0; i < defaultSegmentKeysLength; i++) {
45441
45584
  const key = defaultSegmentKeys[i];
45442
- const canonical = environment.storeGetCanonicalKey(key);
45443
- if (canonical !== key) {
45444
- continue;
45445
- }
45446
45585
  // TODO: W-8909393 If expiration is the only thing that changed we should not evict the data... so
45447
45586
  // if we stored expiration and data at different keys (or same keys in different segments)
45448
45587
  // then we could know if only the expiration has changed and we wouldn't need to evict
@@ -45450,6 +45589,9 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45450
45589
  // call base environment storeEvict so this evict is not tracked for durable deletion
45451
45590
  environment.storeEvict(key);
45452
45591
  }
45592
+ shouldBroadcast = true;
45593
+ }
45594
+ if (shouldBroadcast) {
45453
45595
  await environment.storeBroadcast(rebuildSnapshot, environment.snapshotAvailable);
45454
45596
  }
45455
45597
  });
@@ -45500,12 +45642,13 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45500
45642
  // call the base storeBroadcast
45501
45643
  return publishChangesToDurableStore();
45502
45644
  };
45503
- const publishChangesToDurableStore = function () {
45645
+ const publishChangesToDurableStore = function (additionalDurableStoreOperations) {
45504
45646
  validateNotDisposed();
45505
45647
  if (ingestStagingStore === null) {
45506
45648
  return Promise.resolve();
45507
45649
  }
45508
- const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
45650
+ const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations);
45651
+ pendingStoreRedirects.clear();
45509
45652
  ingestStagingStore = null;
45510
45653
  return promise;
45511
45654
  };
@@ -45587,6 +45730,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45587
45730
  };
45588
45731
  const storeRedirect = function (existingKey, canonicalKey) {
45589
45732
  validateNotDisposed();
45733
+ pendingStoreRedirects.set(existingKey, canonicalKey);
45590
45734
  // call redirect on staging store so "old" keys are removed from L2 on
45591
45735
  // the next publishChangesToDurableStore. NOTE: we don't need to call
45592
45736
  // redirect on the base environment store because staging store and base
@@ -45632,7 +45776,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
45632
45776
  const snapshot = buildCachedSnapshot(injectedBuildSnapshotContext, injectedStoreLookup, luvio);
45633
45777
  // if the adapter attempted to do an L1 lookup and it was unfulfilled
45634
45778
  // then we can attempt an L2 lookup
45635
- if (isUnfulfilledSnapshot(snapshot)) {
45779
+ if (isUnfulfilledSnapshot$1(snapshot)) {
45636
45780
  const start = Date.now();
45637
45781
  emitDurableEnvironmentAdapterEvent({ type: 'l2-revive-start' }, adapterRequestContext.eventObservers);
45638
45782
  const revivedSnapshot = reviveSnapshot(environment, durableStore, snapshot, durableStoreErrorHandler, () => injectedStoreLookup(snapshot.select, snapshot.refresh)).then((result) => {
@@ -46239,6 +46383,12 @@ function getRelationshipInfo(apiName, fieldName, infoMap) {
46239
46383
  function stringLiteral(value, safe = false, isCaseSensitive = false) {
46240
46384
  return { type: ValueType.StringLiteral, value, safe, isCaseSensitive };
46241
46385
  }
46386
+ function isStringLiteral(expression) {
46387
+ return expression.type === ValueType.StringLiteral;
46388
+ }
46389
+ function isStringArray(expression) {
46390
+ return expression.type === ValueType.StringArray;
46391
+ }
46242
46392
  function comparison(left, operator, right) {
46243
46393
  return { type: PredicateType$1.comparison, left, right, operator };
46244
46394
  }
@@ -46498,7 +46648,7 @@ function comparisonOperatorToSql(operator) {
46498
46648
  case ComparisonOperator.eq:
46499
46649
  return '=';
46500
46650
  case ComparisonOperator.ne:
46501
- return '!=';
46651
+ return 'IS NOT';
46502
46652
  case ComparisonOperator.gt:
46503
46653
  return '>';
46504
46654
  case ComparisonOperator.gte:
@@ -46538,9 +46688,13 @@ const recordSuffix = 'edges';
46538
46688
  const pathPrefix = '$';
46539
46689
  const recordsCTE = 'recordsCTE';
46540
46690
  const MultiPickListValueSeparator$1 = ';';
46691
+ const recordCTESQL = excludeStaleRecordsGate.isOpen({ fallback: false })
46692
+ ? `WITH ${recordsCTE} AS NOT materialized ` +
46693
+ `(select data, metadata from lds_data where key like 'UiApi::RecordRepresentation:%')`
46694
+ : `WITH ${recordsCTE} AS NOT materialized ` +
46695
+ `(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`;
46541
46696
  function cteSql() {
46542
- return (`WITH ${recordsCTE} AS NOT materialized ` +
46543
- `(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`);
46697
+ return recordCTESQL;
46544
46698
  }
46545
46699
  function computeSql(rootQuery) {
46546
46700
  const fields = rootQuery.connections.map((connection) => {
@@ -46817,6 +46971,14 @@ function expressionToSql(expression, targetDataType, operator) {
46817
46971
  if (expression.subfield === 'displayValue' && targetDataType === 'Boolean') {
46818
46972
  return { sql: 'null', bindings: [] };
46819
46973
  }
46974
+ // metadata extract is somewhat different than a data extract
46975
+ if (expression.metadata === true) {
46976
+ let sql = `json_extract("${expression.jsonAlias}".metadata, '${pathPrefix}.${expression.field}')`;
46977
+ if (targetDataType !== undefined) {
46978
+ sql = coerceToTargetDataType(sql, targetDataType);
46979
+ }
46980
+ return { sql, bindings: [] };
46981
+ }
46820
46982
  let path = extractPath(expression.field, expression.subfield);
46821
46983
  // For multiple picklist includes/excluding filtering, we need to prefix and suffix the field value with ';'
46822
46984
  // to make the match safe.
@@ -47009,6 +47171,9 @@ function compoundOperatorToSql(operator) {
47009
47171
  }
47010
47172
  }
47011
47173
 
47174
+ const { isArray: isArray$4 } = Array;
47175
+ const { keys: keys$5 } = Object;
47176
+
47012
47177
  function isListValueNode(node) {
47013
47178
  return node.kind === 'ListValue';
47014
47179
  }
@@ -47061,13 +47226,13 @@ function isScalarDataType(type) {
47061
47226
  const NotOperator = 'not';
47062
47227
  const { eq, ne, gt, gte, lt, lte, nin, like, includes, excludes } = ComparisonOperator;
47063
47228
  const inOp = ComparisonOperator.in;
47064
- function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperator = CompoundOperator.and, joins) {
47229
+ function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperator = CompoundOperator.and, joins, draftFunctions) {
47065
47230
  const results = fieldValues
47066
47231
  .map((value) => {
47067
47232
  if (!isObjectValueNode$1(value)) {
47068
47233
  return [failure([message('Parent filter node should be an object.')])];
47069
47234
  }
47070
- return Object.entries(value.fields).map(([key, value]) => filter(key, value, joinAlias, apiName, input, joins));
47235
+ return Object.entries(value.fields).map(([key, value]) => filter(key, value, joinAlias, apiName, input, joins, draftFunctions));
47071
47236
  })
47072
47237
  .reduce(flatten$1, []);
47073
47238
  const failures = results.filter(isFailure).reduce(flatMap$1(errors), []);
@@ -47089,22 +47254,22 @@ function fieldsToFilters(fieldValues, joinAlias, apiName, input, compoundOperato
47089
47254
  return success({ predicate: resolvedPredicate });
47090
47255
  }
47091
47256
  //{where: {Field: ... | and: ... | or: ... | not: ...}}
47092
- function recordFilter(where, joinAlias, apiName, input, joins) {
47257
+ function recordFilter(where, joinAlias, apiName, input, joins, draftFunctions) {
47093
47258
  if (where === undefined) {
47094
47259
  return success(undefined);
47095
47260
  }
47096
47261
  // when 'recordFilter' starts, there is no 'NotPredicated'
47097
- return fieldsToFilters([where.value], joinAlias, apiName, input, CompoundOperator.and, joins).map((result) => result.predicate === undefined || isEmptyPredicate(result.predicate) ? undefined : result);
47262
+ return fieldsToFilters([where.value], joinAlias, apiName, input, CompoundOperator.and, joins, draftFunctions).map((result) => result.predicate === undefined || isEmptyPredicate(result.predicate) ? undefined : result);
47098
47263
  }
47099
- function filter(name, value, tableAlias, apiName, input, joins) {
47264
+ function filter(name, value, tableAlias, apiName, input, joins, draftFunctions) {
47100
47265
  if (isCompoundOperator(name)) {
47101
47266
  if (!isListValueNode(value)) {
47102
47267
  return failure([message(`Value for ${name} node must be a list.`)]);
47103
47268
  }
47104
- return compoundPredicate(name, value, tableAlias, apiName, input, joins);
47269
+ return compoundPredicate(name, value, tableAlias, apiName, input, joins, draftFunctions);
47105
47270
  }
47106
47271
  if (name === NotOperator) {
47107
- const children = fieldsToFilters([value], tableAlias, apiName, input, CompoundOperator.and, joins);
47272
+ const children = fieldsToFilters([value], tableAlias, apiName, input, CompoundOperator.and, joins, draftFunctions);
47108
47273
  // take the children of a not predicate
47109
47274
  // and wrap them all inside it
47110
47275
  return children.flatMap((container) => {
@@ -47122,10 +47287,10 @@ function filter(name, value, tableAlias, apiName, input, joins) {
47122
47287
  if (!isObjectValueNode$1(value)) {
47123
47288
  return failure([message('Filter node must be an object or list.')]);
47124
47289
  }
47125
- return fieldFilter(name, value, tableAlias, apiName, input, joins);
47290
+ return fieldFilter(name, value, tableAlias, apiName, input, joins, draftFunctions);
47126
47291
  }
47127
- function compoundPredicate(operator, list, joinAlias, apiName, input, joins) {
47128
- return fieldsToFilters(list.values, joinAlias, apiName, input, operator, joins);
47292
+ function compoundPredicate(operator, list, joinAlias, apiName, input, joins, draftFunctions) {
47293
+ return fieldsToFilters(list.values, joinAlias, apiName, input, operator, joins, draftFunctions);
47129
47294
  }
47130
47295
  /**
47131
47296
  * spans a FieldNode with its ObjectValueNode is passed. All the predicates is added into the 'join' array.
@@ -47136,7 +47301,7 @@ function compoundPredicate(operator, list, joinAlias, apiName, input, joins) {
47136
47301
  * @param joins
47137
47302
  * @returns undefined predicate
47138
47303
  */
47139
- function spanningFilter(fieldInfo, fieldNode, alias, input, joins) {
47304
+ function spanningFilter(fieldInfo, fieldNode, alias, input, joins, draftFunctions) {
47140
47305
  const { apiName: fieldName, referenceToInfos, relationshipName } = fieldInfo;
47141
47306
  const referenceInfo = referenceToInfos[0];
47142
47307
  const jsonAlias = `${alias}.${relationshipName}`;
@@ -47155,7 +47320,7 @@ function spanningFilter(fieldInfo, fieldNode, alias, input, joins) {
47155
47320
  joins.push(join);
47156
47321
  // moves constraint predicate to where
47157
47322
  const constraintPredicates = [];
47158
- const filterResult = fieldsToFilters([fieldNode], jsonAlias, apiName, input, CompoundOperator.and, joins);
47323
+ const filterResult = fieldsToFilters([fieldNode], jsonAlias, apiName, input, CompoundOperator.and, joins, draftFunctions);
47159
47324
  if (filterResult.isSuccess === false) {
47160
47325
  return filterResult;
47161
47326
  }
@@ -47167,7 +47332,11 @@ function spanningFilter(fieldInfo, fieldNode, alias, input, joins) {
47167
47332
  });
47168
47333
  return success({ predicate: combinePredicates(constraintPredicates, CompoundOperator.and) });
47169
47334
  }
47170
- function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
47335
+ function isIDValueField$1(fieldInfo) {
47336
+ return (fieldInfo.apiName === 'Id' ||
47337
+ (fieldInfo.referenceToInfos !== undefined && fieldInfo.referenceToInfos.length > 0));
47338
+ }
47339
+ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins, draftFunctions) {
47171
47340
  const fieldInfoResult = getFieldInfo(apiName, fieldName, input);
47172
47341
  if (fieldInfoResult.isSuccess === false) {
47173
47342
  return failure([fieldInfoResult.error]);
@@ -47177,8 +47346,9 @@ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
47177
47346
  return failure([message(`Field ${fieldName} for type ${apiName} not found.`)]);
47178
47347
  }
47179
47348
  if (fieldInfo.dataType === 'Reference' && fieldInfo.relationshipName === fieldName) {
47180
- return spanningFilter(fieldInfo, fieldNode, alias, input, joins);
47349
+ return spanningFilter(fieldInfo, fieldNode, alias, input, joins, draftFunctions);
47181
47350
  }
47351
+ const idProcessingNeeded = isIDValueField$1(fieldInfo);
47182
47352
  const extract = {
47183
47353
  type: ValueType.Extract,
47184
47354
  jsonAlias: alias,
@@ -47266,7 +47436,29 @@ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
47266
47436
  children,
47267
47437
  };
47268
47438
  }
47269
- return comparison(extract, op.operator, op.value);
47439
+ const rightOperand = op.value;
47440
+ if (idProcessingNeeded) {
47441
+ if (isStringLiteral(rightOperand)) {
47442
+ if (rightOperand.value !== null) {
47443
+ if (draftFunctions.isDraftId(rightOperand.value)) {
47444
+ rightOperand.value = draftFunctions.getCanonicalId(rightOperand.value);
47445
+ }
47446
+ }
47447
+ }
47448
+ else if (isStringArray(rightOperand)) {
47449
+ if (rightOperand.value !== null) {
47450
+ rightOperand.value = rightOperand.value.map((originalId) => {
47451
+ if (originalId !== null) {
47452
+ if (draftFunctions.isDraftId(originalId)) {
47453
+ return draftFunctions.getCanonicalId(originalId);
47454
+ }
47455
+ }
47456
+ return originalId;
47457
+ });
47458
+ }
47459
+ }
47460
+ }
47461
+ return comparison(extract, op.operator, rightOperand);
47270
47462
  });
47271
47463
  const combined = combinePredicates(comparisons.concat(...dateFunction.value), CompoundOperator.and);
47272
47464
  const container = {
@@ -47473,7 +47665,11 @@ function operatorWithValue(operator, valueNode, objectInfoDataType) {
47473
47665
  }
47474
47666
  if (objectInfoDataType === 'Double') {
47475
47667
  if (isScalarOperatorType(operator)) {
47476
- return is(valueNode, 'FloatValue')
47668
+ // allow a float/double value to be passed
47669
+ // also allow an integer to be passed to a double, but not a double to an integer
47670
+ const isFloatOrInt = is(valueNode, 'FloatValue') ||
47671
+ is(valueNode, 'IntValue');
47672
+ return isFloatOrInt
47477
47673
  ? success({
47478
47674
  type: 'DoubleOperator',
47479
47675
  operator,
@@ -48362,7 +48558,7 @@ function recordQuery(selection, apiName, alias, predicates, input) {
48362
48558
  const orderByJoins = [];
48363
48559
  const orderByResult = parseOrderBy(orderByArg, alias, apiName, input.objectInfoMap, orderByJoins);
48364
48560
  const filterJoins = [];
48365
- const whereResult = recordFilter(whereArg, alias, apiName, input.objectInfoMap, filterJoins);
48561
+ const whereResult = recordFilter(whereArg, alias, apiName, input.objectInfoMap, filterJoins, input.draftFunctions);
48366
48562
  const scopeJoins = [];
48367
48563
  const scopeResult = scopeFilter(scopeArg, alias, apiName, input, scopeJoins);
48368
48564
  let additionalPredicates = [];
@@ -48410,6 +48606,33 @@ function recordQuery(selection, apiName, alias, predicates, input) {
48410
48606
  const draftsField = { type: FieldType.Scalar, extract, path: 'node._drafts' };
48411
48607
  const idExtract = { type: ValueType.Extract, jsonAlias: alias, field: 'Id' };
48412
48608
  const idField = { type: FieldType.Scalar, extract: idExtract, path: 'node.Id' };
48609
+ // When the exclude stale records gate is open and there is a root timestamp
48610
+ // in the parser input, inject an additional predicate to limit the search
48611
+ // to records that either have drafts associated to them or were ingested at
48612
+ // least as recently as the query.
48613
+ if (excludeStaleRecordsGate.isOpen({ fallback: false }) && input.rootTimestamp !== undefined) {
48614
+ const timestampCheck = {
48615
+ type: PredicateType$1.comparison,
48616
+ left: {
48617
+ type: ValueType.Extract,
48618
+ jsonAlias: alias,
48619
+ field: 'ingestionTimestamp',
48620
+ metadata: true,
48621
+ },
48622
+ operator: ComparisonOperator.gte,
48623
+ right: { type: ValueType.IntLiteral, value: input.rootTimestamp },
48624
+ };
48625
+ const isDraft = {
48626
+ type: PredicateType$1.nullComparison,
48627
+ left: { type: ValueType.Extract, jsonAlias: alias, field: 'drafts' },
48628
+ operator: NullComparisonOperator.isNot,
48629
+ };
48630
+ predicates.push({
48631
+ type: PredicateType$1.compound,
48632
+ operator: CompoundOperator.or,
48633
+ children: [timestampCheck, isDraft],
48634
+ });
48635
+ }
48413
48636
  return queryContainer(internalFields, alias, apiName, predicates).map((result) => {
48414
48637
  const { fields, predicates } = result;
48415
48638
  const allFields = removeDuplicateFields(fields.concat(...[draftsField, idField]));
@@ -48458,6 +48681,20 @@ function rootRecordQuery(selection, input) {
48458
48681
  if (input.objectInfoMap[alias] === undefined) {
48459
48682
  return failure([missingObjectInfo(apiName)]);
48460
48683
  }
48684
+ // When the exclude stale records gate is open and the query has an
48685
+ // ingestion timestamp in its cache metadata, associate that with the input
48686
+ // so it can later be used to limit the search to records were ingested at
48687
+ // least as recently as the query.
48688
+ if (excludeStaleRecordsGate.isOpen({ fallback: false })) {
48689
+ const key = input.connectionKeyBuilder(selection, input.config.variables);
48690
+ const queryMetadata = input.metadata[key];
48691
+ // If there is no metadata for this query or it somehow lacks a timestamp
48692
+ // skip setting the root timestamp
48693
+ if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
48694
+ // subtract 10ms from timestamp to account for ingestion processing time
48695
+ input.rootTimestamp = queryMetadata.ingestionTimestamp - 10;
48696
+ }
48697
+ }
48461
48698
  return recordQuery(selection, alias, apiName, [], input);
48462
48699
  }
48463
48700
  function rootQuery(recordNodes, input) {
@@ -48524,27 +48761,19 @@ function generateVariableGQLQuery(document, variables) {
48524
48761
  ? node.arguments
48525
48762
  .map((args) => {
48526
48763
  const { value, name } = args;
48764
+ //The variable is on the top level, for example `where: ${filter}`
48527
48765
  if (is(value, 'Variable')) {
48528
- const variable = variables[value.name];
48529
- if (variable) {
48530
- const jsonString = JSON.stringify(variable);
48531
- const buildRecordQueryString = (name, query, transform) => {
48532
- return `${name}: ${transform(query)}`;
48533
- };
48534
- switch (name) {
48535
- case 'scope':
48536
- case 'orderBy':
48537
- return buildRecordQueryString(name, jsonString, removeAllQuotations);
48538
- default:
48539
- return buildRecordQueryString(name, jsonString, removeQuotationsFromKeys);
48540
- }
48541
- }
48542
- return '';
48766
+ return generateVariableNodeQuery(value, name, name, variables);
48767
+ }
48768
+ else if (isObjectValueNode$1(value)) {
48769
+ return generateVariableSubQuery(value, name, name, variables);
48543
48770
  }
48544
48771
  })
48545
48772
  .filter(Boolean)
48546
48773
  : undefined;
48547
- return gqlArguments ? `${node.name}(${gqlArguments.join(',')}) { Id }` : '';
48774
+ return gqlArguments
48775
+ ? `${node.name} ${gqlArguments.length > 0 ? '(' + gqlArguments.join(',') + ')' : ''} { Id }`
48776
+ : '';
48548
48777
  })
48549
48778
  //remove empty strings
48550
48779
  .filter(Boolean)
@@ -48554,6 +48783,51 @@ function generateVariableGQLQuery(document, variables) {
48554
48783
  return [accu.slice(0, 1), query, accu.slice(1, length)].join('');
48555
48784
  }, '{ }'));
48556
48785
  }
48786
+ /**
48787
+ * Given a LuvioValueNode, generates a sql with its variable node replaced with actual value.
48788
+ * @param valueNode G
48789
+ * @param name
48790
+ * @param type
48791
+ * @param variables
48792
+ * @returns
48793
+ */
48794
+ function generateVariableSubQuery(valueNode, name, type, variables) {
48795
+ switch (valueNode.kind) {
48796
+ case Kind.OBJECT: {
48797
+ // For example, `{ Id: { eq: $draftId } }` is a `ObjectValueNode`, which has field keys 'Id'
48798
+ const resultQuery = keys$5(valueNode.fields)
48799
+ .map((key) => generateVariableSubQuery(valueNode.fields[key], key, type, variables))
48800
+ .filter((subquery) => subquery.length > 0)
48801
+ .join(',');
48802
+ if (resultQuery.length > 0) {
48803
+ return `${name}: {${resultQuery}}`;
48804
+ }
48805
+ return resultQuery;
48806
+ }
48807
+ case Kind.VARIABLE:
48808
+ return generateVariableNodeQuery(valueNode, name, type, variables);
48809
+ default:
48810
+ return '';
48811
+ }
48812
+ }
48813
+ // Generate a sql for the variable node with its actual value.
48814
+ function generateVariableNodeQuery(value, name, type, variables) {
48815
+ const variable = variables[value.name];
48816
+ if (variable) {
48817
+ const jsonString = JSON.stringify(variable);
48818
+ const buildRecordQueryString = (name, query, transform) => {
48819
+ return `${name}: ${transform(query)}`;
48820
+ };
48821
+ switch (type) {
48822
+ case 'scope':
48823
+ case 'orderBy':
48824
+ return buildRecordQueryString(name, jsonString, removeAllQuotations);
48825
+ default:
48826
+ return buildRecordQueryString(name, jsonString, removeQuotationsFromKeys);
48827
+ }
48828
+ }
48829
+ return '';
48830
+ }
48557
48831
  /**
48558
48832
  * Given an AST with variables
48559
48833
  * Swap out the LuvioArgumentNodes on the original AST with ones generated from its variables.
@@ -48572,14 +48846,43 @@ function swapVariableArguments(document, variables) {
48572
48846
  const { name } = node;
48573
48847
  const first = allArgumentRecords.find((n) => n.name === name);
48574
48848
  if (first) {
48575
- // if we had arguments that did not contain variables we still want those
48576
- first.arguments = flatten$1(first.arguments
48577
- ? first.arguments.filter((x) => x.value.kind !== 'Variable')
48578
- : [], node.arguments ? node.arguments : []);
48849
+ const swappedArgments = swapArgumentWithVariableNodes(node.arguments, first.arguments);
48850
+ first.arguments = swappedArgments ? swappedArgments : [];
48579
48851
  }
48580
48852
  });
48581
48853
  }
48582
48854
  }
48855
+ // Replaces the variable node in original LuvioArgumentNode with the actual value in the swapped node with the same path.
48856
+ function swapArgumentWithVariableNodes(swapped, original) {
48857
+ if (swapped === undefined || original === undefined) {
48858
+ return original;
48859
+ }
48860
+ return original.map((x) => {
48861
+ const targetNode = swapped.find((y) => y.name === x.name);
48862
+ if (targetNode === undefined) {
48863
+ return x;
48864
+ }
48865
+ if (x.value.kind === 'Variable') {
48866
+ return targetNode;
48867
+ }
48868
+ swapValueNodeWithVariableNodes(x.value, targetNode.value);
48869
+ return x;
48870
+ });
48871
+ }
48872
+ function swapValueNodeWithVariableNodes(original, swapped) {
48873
+ if (original.kind === Kind.OBJECT) {
48874
+ for (const key of keys$5(original.fields)) {
48875
+ if (isObjectValueNode$1(swapped) && swapped.fields[key]) {
48876
+ if (is(original.fields[key], 'Variable')) {
48877
+ original.fields[key] = swapped.fields[key];
48878
+ }
48879
+ else {
48880
+ swapValueNodeWithVariableNodes(original.fields[key], swapped.fields[key]);
48881
+ }
48882
+ }
48883
+ }
48884
+ }
48885
+ }
48583
48886
  //find top level record queries
48584
48887
  function findRecordSelections$1(document) {
48585
48888
  return document.definitions
@@ -48614,12 +48917,24 @@ class StoreEvalPreconditioner {
48614
48917
  * Missing object info records triggers the objectInfoService (same instance shared with Drafts code), to
48615
48918
  * use the getObjectInfos adapter to efficiently fetch the necessary records.
48616
48919
  */
48617
- async createRootQuery(config, objectInfoService, userId) {
48920
+ async createRootQuery(config, objectInfoService, userId, draftFunctions, connectionKeyBuilder, sqliteStore) {
48618
48921
  const { query: ast, variables } = config;
48619
48922
  swapVariableArguments(ast, variables);
48620
48923
  // Parse out top-level record queries types we know we will need, since spanning fields will
48621
48924
  // require at least this top level record present to resolve relationship lookups
48622
- const topLevelNeededRecords = findRecordSelections$1(ast).map((selection) => selection.name);
48925
+ const recordSelections = findRecordSelections$1(ast);
48926
+ let metadata = {};
48927
+ if (excludeStaleRecordsGate.isOpen({ fallback: false })) {
48928
+ const keys = recordSelections.map((rs) => connectionKeyBuilder(rs, variables));
48929
+ let sqlResult = await sqliteStore.query(`select key, metadata from lds_data where key in (${keys
48930
+ .map(() => '?')
48931
+ .join(',')})`, keys);
48932
+ metadata = sqlResult.rows.reduce((metadata, row) => {
48933
+ metadata[row[0]] = JSON.parse(row[1]);
48934
+ return metadata;
48935
+ }, {});
48936
+ }
48937
+ const topLevelNeededRecords = recordSelections.map((selection) => selection.name);
48623
48938
  // Seed the initial list of things to fetch
48624
48939
  const neededObjectInfos = new Set(topLevelNeededRecords);
48625
48940
  // Seed the list of things we've _tried_ to fetch. As we iterate and
@@ -48659,8 +48974,12 @@ class StoreEvalPreconditioner {
48659
48974
  };
48660
48975
  // Attempt to parse the AST given what we know already...
48661
48976
  astTransformResult = transform(ast, {
48977
+ config,
48662
48978
  userId,
48663
48979
  objectInfoMap,
48980
+ draftFunctions,
48981
+ connectionKeyBuilder,
48982
+ metadata,
48664
48983
  });
48665
48984
  if (astTransformResult.isSuccess === false) {
48666
48985
  for (const error of astTransformResult.error) {
@@ -48698,8 +49017,6 @@ class StoreEvalPreconditioner {
48698
49017
  }
48699
49018
  }
48700
49019
 
48701
- const { isArray: isArray$4 } = Array;
48702
-
48703
49020
  /**
48704
49021
  * Checks a GraphQL-shaped network response for errors, returning true if it does
48705
49022
  * and false otherwise
@@ -48737,15 +49054,15 @@ async function evaluateSqlite(query, eventEmitter, store) {
48737
49054
  return { data, seenRecords };
48738
49055
  }
48739
49056
  const wrapStartEndEvents = (storeEval) => {
48740
- return async (config, nonEvaluatedSnapshotOrPromise, observers) => {
49057
+ return async (config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder) => {
48741
49058
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
48742
49059
  eventEmitter({ type: 'graphql-eval-start' });
48743
- const snapshot = await storeEval(config, nonEvaluatedSnapshotOrPromise, observers);
49060
+ const snapshot = await storeEval(config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder);
48744
49061
  eventEmitter({ type: 'graphql-eval-end' });
48745
49062
  return snapshot;
48746
49063
  };
48747
49064
  };
48748
- function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService) {
49065
+ function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService, draftFunctions) {
48749
49066
  // if the store does not support eval then use the noop version
48750
49067
  if (sqliteStore.isEvalSupported() === false) {
48751
49068
  return noopStoreEval;
@@ -48753,7 +49070,7 @@ function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService) {
48753
49070
  const preconditioner = new StoreEvalPreconditioner();
48754
49071
  return makeStoreEval(preconditioner, objectInfoService, userId, async () => {
48755
49072
  return undefined;
48756
- }, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore));
49073
+ }, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore), draftFunctions, sqliteStore);
48757
49074
  }
48758
49075
  async function noopStoreEval(_config, nonEvaluatedSnapshotOrPromise, _observers) {
48759
49076
  return nonEvaluatedSnapshotOrPromise;
@@ -48772,8 +49089,8 @@ function isErrorSnapshotThatShouldGetReturnedToCaller$1(snapshot) {
48772
49089
  function generateUniqueRecordId$1() {
48773
49090
  return `${GRAPHQL_ROOT_KEY$1}${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
48774
49091
  }
48775
- function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator) {
48776
- const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers) => {
49092
+ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator, draftFunctions, sqliteStore) {
49093
+ const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder) => {
48777
49094
  const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
48778
49095
  // the non-eval'ed input could either be a snapshot or promise of one so
48779
49096
  // await it here to normalize the input to a snapshot
@@ -48802,7 +49119,7 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
48802
49119
  context = await contextProvider();
48803
49120
  // Ensures ObjectInfo metadata is available for the request. Sourcing records from L1/L2/Network
48804
49121
  // is delegated to the getObjectInfo adapter via objectInfoService
48805
- rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId);
49122
+ rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId, draftFunctions, connectionKeyBuilder, sqliteStore);
48806
49123
  }
48807
49124
  catch (error) {
48808
49125
  eventEmitter({
@@ -48833,7 +49150,7 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
48833
49150
  try {
48834
49151
  const { data, seenRecords } = await queryEvaluator(rootQuery, context, eventEmitter);
48835
49152
  const rebuildWithStoreEval = ((originalSnapshot) => {
48836
- return storeEval(config, originalSnapshot, observers);
49153
+ return storeEval(config, originalSnapshot, observers, connectionKeyBuilder);
48837
49154
  });
48838
49155
  const recordId = generateUniqueRecordId$1();
48839
49156
  // if the non-eval'ed snapshot was an error then we return a synthetic
@@ -49132,7 +49449,7 @@ function createDraftSynthesisErrorResponse(message = 'failed to synthesize draft
49132
49449
  return new DraftErrorFetchResponse(HttpStatusCode$1.BadRequest, error);
49133
49450
  }
49134
49451
 
49135
- const { keys: keys$4, create: create$4, assign: assign$3, values: values$1 } = Object;
49452
+ const { keys: keys$4, create: create$4, assign: assign$4, values: values$1 } = Object;
49136
49453
  const { stringify: stringify$4, parse: parse$4 } = JSON;
49137
49454
  const { isArray: isArray$3 } = Array;
49138
49455
 
@@ -49179,7 +49496,6 @@ function buildLuvioOverrideForDraftAdapters(luvio, handler, extractTargetIdFromC
49179
49496
  }
49180
49497
 
49181
49498
  const DraftIdMappingKeyPrefix240 = 'DraftIdMapping::';
49182
- const DraftKeyMappingKeyPrefix = 'DraftKeyMapping::V2::';
49183
49499
  const DRAFT_ID_MAPPINGS_SEGMENT = 'DRAFT_ID_MAPPINGS';
49184
49500
  function isLegacyDraftIdMapping(key, data) {
49185
49501
  return key.startsWith(DraftIdMappingKeyPrefix240);
@@ -49189,9 +49505,6 @@ function isLegacyDraftIdMapping(key, data) {
49189
49505
  function getRecordKeyForId$1(id) {
49190
49506
  return `UiApi::RecordRepresentation:${id}`;
49191
49507
  }
49192
- function generateDraftIdMappingKey(draftIdMapping) {
49193
- return `${DraftKeyMappingKeyPrefix}${draftIdMapping.draftKey}::${draftIdMapping.canonicalKey}`;
49194
- }
49195
49508
  /**
49196
49509
  *
49197
49510
  * @param mappingIds (optional) requested mapping ids, if undefined all will be retrieved
@@ -49225,6 +49538,15 @@ async function getDraftIdMappings(durableStore, mappingIds) {
49225
49538
  }
49226
49539
  return mappings;
49227
49540
  }
49541
+ async function clearDraftIdSegment(durableStore) {
49542
+ const entries = await durableStore.getAllEntries(DRAFT_ID_MAPPINGS_SEGMENT);
49543
+ if (entries) {
49544
+ const keys$1 = keys$4(entries);
49545
+ if (keys$1.length > 0) {
49546
+ await durableStore.evictEntries(keys$1, DRAFT_ID_MAPPINGS_SEGMENT);
49547
+ }
49548
+ }
49549
+ }
49228
49550
 
49229
49551
  /**
49230
49552
  * Generates a time-ordered, unique id to associate with a DraftAction. Ensures
@@ -49315,9 +49637,6 @@ function customActionHandler(executor, id, draftQueue) {
49315
49637
  });
49316
49638
  return queueOperations;
49317
49639
  };
49318
- const getRedirectMappings = (_action) => {
49319
- return undefined;
49320
- };
49321
49640
  return {
49322
49641
  handlerId: id,
49323
49642
  enqueue: (data) => {
@@ -49329,7 +49648,6 @@ function customActionHandler(executor, id, draftQueue) {
49329
49648
  handleReplaceAction: () => {
49330
49649
  throw Error('replaceAction not supported for custom actions');
49331
49650
  },
49332
- getRedirectMappings,
49333
49651
  handleActionRemoved: () => Promise.resolve(),
49334
49652
  handleActionCompleted: () => Promise.resolve(),
49335
49653
  handleActionEnqueued: () => Promise.resolve(),
@@ -49504,17 +49822,11 @@ class DurableDraftQueue {
49504
49822
  const handler = this.getHandler(action.handler);
49505
49823
  let queue = await this.getQueueActions();
49506
49824
  const queueOperations = handler.getQueueOperationsForCompletingDrafts(queue, action);
49507
- const idAndKeyMappings = handler.getRedirectMappings(action);
49508
- const keyMappings = idAndKeyMappings === undefined
49509
- ? undefined
49510
- : idAndKeyMappings.map((m) => {
49511
- return { draftKey: m.draftKey, canonicalKey: m.canonicalKey };
49512
- });
49513
- await this.draftStore.completeAction(queueOperations, keyMappings);
49514
- queue = await this.getQueueActions();
49825
+ // write the queue operations to the store prior to ingesting the result
49826
+ await this.draftStore.completeAction(queueOperations);
49827
+ await handler.handleActionCompleted(action, queueOperations, values$1(this.handlers));
49515
49828
  this.retryIntervalMilliseconds = 0;
49516
49829
  this.uploadingActionId = undefined;
49517
- await handler.handleActionCompleted(action, queueOperations, queue, values$1(this.handlers));
49518
49830
  await this.notifyChangedListeners({
49519
49831
  type: DraftQueueEventType.ActionCompleted,
49520
49832
  action,
@@ -49833,7 +50145,7 @@ class DurableDraftStore {
49833
50145
  };
49834
50146
  return this.enqueueAction(deleteAction);
49835
50147
  }
49836
- completeAction(queueOperations, mappings) {
50148
+ completeAction(queueOperations) {
49837
50149
  const action = () => {
49838
50150
  const durableStoreOperations = [];
49839
50151
  const { draftStore } = this;
@@ -49866,18 +50178,6 @@ class DurableDraftStore {
49866
50178
  });
49867
50179
  }
49868
50180
  }
49869
- if (mappings !== undefined) {
49870
- const entries = {};
49871
- for (const mapping of mappings) {
49872
- const mappingKey = generateDraftIdMappingKey(mapping);
49873
- entries[mappingKey] = { data: mapping };
49874
- }
49875
- durableStoreOperations.push({
49876
- entries,
49877
- type: 'setEntries',
49878
- segment: DRAFT_ID_MAPPINGS_SEGMENT,
49879
- });
49880
- }
49881
50181
  return this.durableStore.batchOperations(durableStoreOperations);
49882
50182
  };
49883
50183
  return this.enqueueAction(action);
@@ -50142,7 +50442,7 @@ class AbstractResourceRequestActionHandler {
50142
50442
  },
50143
50443
  ];
50144
50444
  }
50145
- async handleActionCompleted(action, queueOperations, _queue, allHandlers) {
50445
+ async handleActionCompleted(action, queueOperations, allHandlers) {
50146
50446
  const { data: request, tag } = action;
50147
50447
  const { method } = request;
50148
50448
  if (method === 'delete') {
@@ -50219,6 +50519,8 @@ class AbstractResourceRequestActionHandler {
50219
50519
  };
50220
50520
  // overlay metadata
50221
50521
  merged.metadata = { ...targetMetadata, ...sourceMetadata };
50522
+ // put status back to pending to auto upload if queue is active and targed is at the head.
50523
+ merged.status = DraftActionStatus.Pending;
50222
50524
  return merged;
50223
50525
  }
50224
50526
  shouldDeleteActionByTagOnRemoval(action) {
@@ -50254,11 +50556,18 @@ class AbstractResourceRequestActionHandler {
50254
50556
  async ingestResponses(responses, action) {
50255
50557
  const luvio = this.getLuvio();
50256
50558
  await luvio.handleSuccessResponse(() => {
50559
+ if (action.status === DraftActionStatus.Completed) {
50560
+ const mappings = this.getRedirectMappings(action);
50561
+ if (mappings) {
50562
+ mappings.forEach((mapping) => {
50563
+ luvio.storeRedirect(mapping.draftKey, mapping.canonicalKey);
50564
+ });
50565
+ }
50566
+ }
50257
50567
  for (const entry of responses) {
50258
50568
  const { response, synchronousIngest } = entry;
50259
50569
  synchronousIngest(response, action);
50260
50570
  }
50261
- // must call base broadcast
50262
50571
  return luvio.storeBroadcast();
50263
50572
  },
50264
50573
  // getTypeCacheKeysRecord uses the response, not the full path factory
@@ -50586,6 +50895,8 @@ class DraftManager {
50586
50895
 
50587
50896
  function makeEnvironmentDraftAware(luvio, env, durableStore, handlers, draftQueue) {
50588
50897
  const draftMetadata = {};
50898
+ // in 246 luvio took charge of persisting redirect mappings, this needs to stick around
50899
+ // for a couple of releases to support older environments
50589
50900
  // setup existing store redirects when bootstrapping the environment
50590
50901
  (async () => {
50591
50902
  const mappings = await getDraftIdMappings(durableStore);
@@ -50593,23 +50904,9 @@ function makeEnvironmentDraftAware(luvio, env, durableStore, handlers, draftQueu
50593
50904
  const { draftKey, canonicalKey } = mapping;
50594
50905
  env.storeRedirect(draftKey, canonicalKey);
50595
50906
  });
50907
+ await env.storeBroadcast(env.rebuildSnapshot, env.snapshotAvailable);
50908
+ await clearDraftIdSegment(durableStore);
50596
50909
  })();
50597
- durableStore.registerOnChangedListener(async (changes) => {
50598
- const draftIdMappingsIds = [];
50599
- for (let i = 0, len = changes.length; i < len; i++) {
50600
- const change = changes[i];
50601
- if (change.segment === DRAFT_ID_MAPPINGS_SEGMENT) {
50602
- draftIdMappingsIds.push(...change.ids);
50603
- }
50604
- }
50605
- if (draftIdMappingsIds.length > 0) {
50606
- const mappings = await getDraftIdMappings(durableStore, draftIdMappingsIds);
50607
- mappings.forEach((mapping) => {
50608
- const { draftKey, canonicalKey } = mapping;
50609
- env.storeRedirect(draftKey, canonicalKey);
50610
- });
50611
- }
50612
- });
50613
50910
  const handleSuccessResponse = async function (ingestAndBroadcastFunc, getResponseCacheKeysFunc) {
50614
50911
  const queue = await draftQueue.getQueueActions();
50615
50912
  if (queue.length === 0) {
@@ -50677,16 +50974,23 @@ function makeEnvironmentDraftAware(luvio, env, durableStore, handlers, draftQueu
50677
50974
 
50678
50975
  const API_NAMESPACE = 'UiApi';
50679
50976
  const RECORD_REPRESENTATION_NAME$1 = 'RecordRepresentation';
50977
+ const RECORD_VIEW_ENTITY_REPRESENTATION_NAME = 'RecordViewEntityRepresentation';
50680
50978
  const RECORD_ID_PREFIX = `${API_NAMESPACE}::${RECORD_REPRESENTATION_NAME$1}:`;
50979
+ const RECORD_VIEW_ENTITY_ID_PREFIX = `${API_NAMESPACE}::${RECORD_VIEW_ENTITY_REPRESENTATION_NAME}:Name:`;
50681
50980
  const RECORD_FIELDS_KEY_JUNCTION = '__fields__';
50682
50981
  function isStoreKeyRecordId(key) {
50683
50982
  return key.indexOf(RECORD_ID_PREFIX) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION) === -1;
50684
50983
  }
50984
+ function isStoreKeyRecordViewEntity(key) {
50985
+ return (key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX) > -1 &&
50986
+ key.indexOf(RECORD_FIELDS_KEY_JUNCTION) === -1);
50987
+ }
50685
50988
  function isStoreKeyRecordField(key) {
50686
50989
  return key.indexOf(RECORD_ID_PREFIX) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION) > -1;
50687
50990
  }
50688
50991
  function extractRecordIdFromStoreKey(key) {
50689
- if (key === undefined || key.indexOf(RECORD_ID_PREFIX) === -1) {
50992
+ if (key === undefined ||
50993
+ (key.indexOf(RECORD_ID_PREFIX) === -1 && key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX) === -1)) {
50690
50994
  return undefined;
50691
50995
  }
50692
50996
  const parts = key.split(':');
@@ -50701,7 +51005,8 @@ function isStoreRecordError(storeRecord) {
50701
51005
  }
50702
51006
  function isEntryDurableRecordRepresentation(entry, key) {
50703
51007
  // Either a DurableRecordRepresentation or StoreRecordError can live at a record key
50704
- return isStoreKeyRecordId(key) && entry.data.__type === undefined;
51008
+ return ((isStoreKeyRecordId(key) || isStoreKeyRecordViewEntity(key)) &&
51009
+ entry.data.__type === undefined);
50705
51010
  }
50706
51011
 
50707
51012
  /**
@@ -50837,7 +51142,7 @@ function isArrayLike(x) {
50837
51142
  (x.length === 0 || (x.length > 0 && Object.prototype.hasOwnProperty.call(x, x.length - 1))));
50838
51143
  }
50839
51144
 
50840
- const { create: create$3, keys: keys$3, values, entries: entries$2 } = Object;
51145
+ const { create: create$3, keys: keys$3, values, entries: entries$2, assign: assign$3 } = Object;
50841
51146
  const { stringify: stringify$3, parse: parse$3 } = JSON;
50842
51147
  const { isArray: isArray$2 } = Array;
50843
51148
 
@@ -51276,6 +51581,10 @@ function dateTimeRange(input, op, field, alias) {
51276
51581
  };
51277
51582
  }
51278
51583
 
51584
+ const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
51585
+ const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
51586
+ const JSON_EXTRACT_PATH_DRAFTS = '$.drafts';
51587
+
51279
51588
  const MultiPickListValueSeparator = ';';
51280
51589
  function filterToPredicates(where, recordType, alias, objectInfoMap, joins, draftFunctions) {
51281
51590
  if (!where)
@@ -51337,7 +51646,7 @@ function filterToPredicates(where, recordType, alias, objectInfoMap, joins, draf
51337
51646
  return [
51338
51647
  {
51339
51648
  alias: childAlias,
51340
- leftPath: '$.apiName',
51649
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
51341
51650
  operator: '=',
51342
51651
  value: entityName,
51343
51652
  dataType: 'String',
@@ -51637,15 +51946,10 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
51637
51946
  // If an explicit collating sequence is required on an IN operator it should be applied to the left operand,
51638
51947
  // like this: "x COLLATE NOCASE IN (y,z, ...)".
51639
51948
  const nullCheck = `json_extract("${alias}".data, '${leftPath}') ${operator === 'IN' ? 'IS' : 'IS NOT'} ?`;
51640
- //if we only have a null in/nin then dont add the IN (y, z, ...)
51641
- if (valueBinding.length > 0) {
51642
- sql = `json_extract("${alias}".data, '${leftPath}')${isCaseSensitive === true ? '' : ` COLLATE NOCASE`} ${operator} ${questionSql} ${includesNull ? `OR ${nullCheck}` : ''}`;
51643
- }
51644
- else {
51645
- sql = `${includesNull ? nullCheck : ''}`;
51646
- }
51949
+ sql = `json_extract("${alias}".data, '${leftPath}')${isCaseSensitive === true ? '' : ` COLLATE NOCASE`} ${operator} ${questionSql}`;
51647
51950
  binding.push(...valueBinding);
51648
51951
  if (includesNull) {
51952
+ sql = `(${sql} OR ${nullCheck})`;
51649
51953
  binding.push(null);
51650
51954
  }
51651
51955
  }
@@ -51793,11 +52097,18 @@ function buildQuery(config) {
51793
52097
  const joins = buildJoins(config);
51794
52098
  const predicates = buildPredicates(config);
51795
52099
  const orderBy = buildOrderBy(config);
52100
+ const staleRecordsSql = excludeStaleRecordsGate.isOpen({ fallback: false })
52101
+ ? `AND (
52102
+ json_extract("${config.alias}".metadata, '${JSON_EXTRACT_PATH_INGESTION_TIMESTAMP}') >= ?
52103
+ OR json_extract("${config.alias}".data, '${JSON_EXTRACT_PATH_DRAFTS}') IS NOT NULL
52104
+ )`
52105
+ : '';
51796
52106
  const sql = `
51797
52107
  SELECT "${config.alias}".data
51798
52108
  FROM lds_data "${config.alias}" ${joins.sql}
51799
52109
  WHERE "${config.alias}".key like 'UiApi::RecordRepresentation:%'
51800
- AND json_extract("${config.alias}".data, '$.apiName') = ?
52110
+ AND json_extract("${config.alias}".data, '${JSON_EXTRACT_PATH_INGESTION_APINAME}') = ?
52111
+ ${staleRecordsSql}
51801
52112
  ${predicates.sql}
51802
52113
  ${orderBy.sql}
51803
52114
  LIMIT ?
@@ -51810,6 +52121,7 @@ function buildQuery(config) {
51810
52121
  ...joins.bindings,
51811
52122
  // the api name for the main record type
51812
52123
  config.alias,
52124
+ ...(excludeStaleRecordsGate.isOpen({ fallback: false }) ? [config.ingestionTimestamp] : []),
51813
52125
  // where clause and parent scope bindings
51814
52126
  ...predicates.bindings,
51815
52127
  // limit binding
@@ -51835,19 +52147,33 @@ function buildJoins(config) {
51835
52147
  if (allJoins.length === 0)
51836
52148
  return { sql, bindings };
51837
52149
  sql = allJoins.reduce((joinAccumulator, join) => {
52150
+ let timestampAdded = false;
51838
52151
  const joinConditions = join.conditions.reduce((conditionAccumulator, condition) => {
51839
52152
  let joined_sql;
52153
+ const joinMetadataTimestamp = excludeStaleRecordsGate.isOpen({ fallback: false })
52154
+ ? ` AND (json_extract("${join.alias}".metadata, '${JSON_EXTRACT_PATH_INGESTION_TIMESTAMP}') >= ? OR json_extract("${join.alias}".data, '${JSON_EXTRACT_PATH_DRAFTS}') IS NOT NULL)`
52155
+ : '';
51840
52156
  // predicate on a value, use the newly joined table
51841
52157
  if ('type' in condition) {
51842
52158
  const { sql, binding } = predicateToSQL(condition, join.alias);
51843
- joined_sql = ` AND ${sql}`;
52159
+ joined_sql = ` AND ${sql}${timestampAdded ? '' : joinMetadataTimestamp}`;
51844
52160
  bindings.push(...binding);
52161
+ if (excludeStaleRecordsGate.isOpen({ fallback: false }) &&
52162
+ timestampAdded === false) {
52163
+ bindings.push(config.ingestionTimestamp);
52164
+ timestampAdded = true;
52165
+ }
51845
52166
  }
51846
52167
  else {
51847
52168
  // predicate on a path
51848
52169
  const left = ` AND json_extract("${join.to}".data, '${condition.leftPath}')`;
51849
52170
  const right = `json_extract("${join.alias}".data, '${condition.rightPath}')`;
51850
- joined_sql = `${left} = ${right}`;
52171
+ joined_sql = `${left} = ${right}${timestampAdded ? '' : joinMetadataTimestamp}`;
52172
+ if (excludeStaleRecordsGate.isOpen({ fallback: false }) &&
52173
+ timestampAdded === false) {
52174
+ bindings.push(config.ingestionTimestamp);
52175
+ timestampAdded = true;
52176
+ }
51851
52177
  }
51852
52178
  conditionAccumulator += joined_sql;
51853
52179
  return conditionAccumulator;
@@ -52526,7 +52852,7 @@ function orderByToPredicate(orderBy, recordType, alias, objectInfoMap, joins) {
52526
52852
  function pathForKey(key) {
52527
52853
  switch (key) {
52528
52854
  case 'ApiName':
52529
- return '$.apiName';
52855
+ return JSON_EXTRACT_PATH_INGESTION_APINAME;
52530
52856
  case 'WeakEtag':
52531
52857
  return '$.weakEtag';
52532
52858
  case 'Id':
@@ -52548,7 +52874,7 @@ function scopeToJoins(scope = '', settings) {
52548
52874
  {
52549
52875
  type: PredicateType.single,
52550
52876
  alias: 'ServiceAppointment_AssignedResource',
52551
- leftPath: '$.apiName',
52877
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
52552
52878
  operator: '=',
52553
52879
  value: 'AssignedResource',
52554
52880
  dataType: 'String',
@@ -52569,7 +52895,7 @@ function scopeToJoins(scope = '', settings) {
52569
52895
  {
52570
52896
  type: PredicateType.single,
52571
52897
  alias: 'ServiceAppointment_AssignedResource_ServiceResource',
52572
- leftPath: '$.apiName',
52898
+ leftPath: JSON_EXTRACT_PATH_INGESTION_APINAME,
52573
52899
  operator: '=',
52574
52900
  value: 'ServiceResource',
52575
52901
  dataType: 'String',
@@ -52674,14 +53000,21 @@ function addResolversToSchema(schema, polyFields) {
52674
53000
  // Fields of the `RecordQuery` type are the record queries for the entity types
52675
53001
  // supported for the org
52676
53002
  for (const recordQuery of fields) {
52677
- recordQuery.resolve = function recordConnectionResolver(record, args) {
53003
+ recordQuery.resolve = async function recordConnectionResolver(record, args, { query }, info) {
53004
+ const { name: currentFieldName } = recordQuery;
53005
+ let ingestionTimestamp = 0;
53006
+ if (excludeStaleRecordsGate.isOpen({ fallback: false })) {
53007
+ // at our record query we fetch each ingestion time stamp and pass it down to each lower resolver to query against
53008
+ ingestionTimestamp = await fetchIngestionTimeStampFromDatabase(currentFieldName, info, args, query);
53009
+ }
52678
53010
  // In the SF schema, the relevant arguments are passed into RecordQuery fields, but actually used
52679
53011
  // down in the edge resolvers. For this resolver, we can just return what was passed in
52680
53012
  // to make it available to the next execution step
52681
53013
  return {
52682
53014
  parentArgs: args,
52683
53015
  parentRecord: record,
52684
- currentFieldName: recordQuery.name,
53016
+ currentFieldName,
53017
+ ingestionTimestamp,
52685
53018
  };
52686
53019
  };
52687
53020
  }
@@ -52727,10 +53060,11 @@ function addResolversToSchema(schema, polyFields) {
52727
53060
  // }
52728
53061
  for (const field of fields) {
52729
53062
  if (field.name === 'node') {
52730
- field.resolve = function nodeResolver(record, _args, { seenRecordIds }) {
53063
+ field.resolve = function nodeResolver(obj, _args, { seenRecordIds }) {
53064
+ const { record, ingestionTimestamp } = obj;
52731
53065
  const recordRepresentation = parse$3(record);
52732
53066
  seenRecordIds.add(recordRepresentation.id);
52733
- return recordRepresentation;
53067
+ return { recordRepresentation, ingestionTimestamp };
52734
53068
  };
52735
53069
  }
52736
53070
  }
@@ -52753,40 +53087,40 @@ function addResolversToSchema(schema, polyFields) {
52753
53087
  for (const field of fields) {
52754
53088
  switch (field.name) {
52755
53089
  case 'Id':
52756
- field.resolve = (record) => record.id;
53090
+ field.resolve = ({ recordRepresentation: record }) => record.id;
52757
53091
  break;
52758
53092
  case 'ApiName':
52759
- field.resolve = (record) => record.apiName;
53093
+ field.resolve = ({ recordRepresentation: record }) => record.apiName;
52760
53094
  break;
52761
53095
  case 'WeakEtag':
52762
- field.resolve = (record) => record.weakEtag;
53096
+ field.resolve = ({ recordRepresentation: record }) => record.weakEtag;
52763
53097
  break;
52764
53098
  case '_drafts':
52765
- field.resolve = (record) => {
53099
+ field.resolve = ({ recordRepresentation: record, }) => {
52766
53100
  return record.drafts ? record.drafts : null;
52767
53101
  };
52768
53102
  break;
52769
53103
  case 'LastModifiedById':
52770
- field.resolve = (record) => {
53104
+ field.resolve = ({ recordRepresentation: record }) => {
52771
53105
  return record.lastModifiedById
52772
53106
  ? { value: record.lastModifiedById }
52773
53107
  : null;
52774
53108
  };
52775
53109
  break;
52776
53110
  case 'LastModifiedDate':
52777
- field.resolve = (record) => {
53111
+ field.resolve = ({ recordRepresentation: record }) => {
52778
53112
  return record.lastModifiedDate
52779
53113
  ? { value: record.lastModifiedDate }
52780
53114
  : null;
52781
53115
  };
52782
53116
  break;
52783
53117
  case 'SystemModstamp':
52784
- field.resolve = (record) => {
53118
+ field.resolve = ({ recordRepresentation: record }) => {
52785
53119
  return record.systemModstamp ? { value: record.systemModstamp } : null;
52786
53120
  };
52787
53121
  break;
52788
53122
  case 'RecordTypeId':
52789
- field.resolve = (record) => {
53123
+ field.resolve = ({ recordRepresentation: record }) => {
52790
53124
  return record.recordTypeId ? { value: record.recordTypeId } : null;
52791
53125
  };
52792
53126
  break;
@@ -52798,7 +53132,17 @@ function addResolversToSchema(schema, polyFields) {
52798
53132
  .getInterfaces()
52799
53133
  .find((iface) => iface.name === 'Record')) ||
52800
53134
  (recordFieldType && recordFieldType.name === 'Record')) {
52801
- field.resolve = function relationResolver(record, _args, { Record, seenRecordIds }) {
53135
+ field.resolve = async function relationResolver(obj, _args, { Record, seenRecordIds }) {
53136
+ const fetchRecordOrNull = async (key) => {
53137
+ const recordRepresentation = await Record.load(key);
53138
+ return recordRepresentation !== null
53139
+ ? {
53140
+ recordRepresentation,
53141
+ ingestionTimestamp,
53142
+ }
53143
+ : null;
53144
+ };
53145
+ const { recordRepresentation: record, ingestionTimestamp } = obj;
52802
53146
  const fieldName = field.name.endsWith('__r')
52803
53147
  ? field.name.replace('__r', '__c')
52804
53148
  : field.name;
@@ -52808,26 +53152,28 @@ function addResolversToSchema(schema, polyFields) {
52808
53152
  if (!id)
52809
53153
  return null;
52810
53154
  if (id['__ref'] !== undefined) {
52811
- return Record.load(record.fields[`${field.name}Id`].value);
53155
+ return fetchRecordOrNull(record.fields[`${field.name}Id`].value);
52812
53156
  }
52813
53157
  seenRecordIds.add(id);
52814
- return Record.load(id);
53158
+ return fetchRecordOrNull(id);
52815
53159
  };
52816
53160
  }
52817
53161
  else if (isObjectType(recordFieldType) &&
52818
53162
  field.type.name.endsWith('Connection')) {
52819
53163
  // spanning field to a connection
52820
- field.resolve = (record, args, { seenRecordIds }) => {
52821
- seenRecordIds.add(record.id);
53164
+ field.resolve = async ({ recordRepresentation, ingestionTimestamp }, args, { seenRecordIds }) => {
53165
+ seenRecordIds.add(recordRepresentation.id);
53166
+ const { name: currentFieldName } = field;
52822
53167
  return {
52823
53168
  parentArgs: args,
52824
- parentRecord: record,
52825
- currentFieldName: field.name,
53169
+ parentRecord: recordRepresentation,
53170
+ currentFieldName,
53171
+ ingestionTimestamp,
52826
53172
  };
52827
53173
  };
52828
53174
  }
52829
53175
  else {
52830
- field.resolve = function recordFieldResolver(record) {
53176
+ field.resolve = function recordFieldResolver({ recordRepresentation: record, }) {
52831
53177
  return record.fields[field.name] || null;
52832
53178
  };
52833
53179
  }
@@ -52839,7 +53185,7 @@ function addResolversToSchema(schema, polyFields) {
52839
53185
  if (recordInterface !== undefined && baseRecord !== undefined) {
52840
53186
  // Applys 'resolveType' of GraphQLInterfaceType to 'Record' interface. Since all the heterogenous types are named as 'apiName', the type with same name as the loaded record 'apiName' property is the type wanted.
52841
53187
  // GraphQL executor would match InLineFragment' condition with type and keeps the deeper level field resolving going.
52842
- recordInterface.resolveType = function (value) {
53188
+ recordInterface.resolveType = function ({ recordRepresentation: value, }) {
52843
53189
  const targetType = polyTypes.find((type) => type.name === value.apiName);
52844
53190
  return targetType === undefined ? baseRecord : targetType;
52845
53191
  };
@@ -52847,7 +53193,7 @@ function addResolversToSchema(schema, polyFields) {
52847
53193
  return schema;
52848
53194
  }
52849
53195
  async function connectionEdgeResolver(obj, _args, context) {
52850
- const { parentArgs = {}, parentRecord, currentFieldName } = obj;
53196
+ const { parentArgs = {}, parentRecord, currentFieldName, ingestionTimestamp } = obj;
52851
53197
  const { query, objectInfos, draftFunctions } = context;
52852
53198
  let joins = [];
52853
53199
  let alias = currentFieldName;
@@ -52878,10 +53224,19 @@ async function connectionEdgeResolver(obj, _args, context) {
52878
53224
  predicates,
52879
53225
  orderBy: orderByToPredicate(parentArgs.orderBy, alias, alias, context.objectInfos),
52880
53226
  limit: parentArgs.first,
53227
+ ingestionTimestamp,
52881
53228
  };
52882
53229
  const { sql, bindings } = buildQuery(queryConfig);
52883
53230
  const results = await query(sql, bindings);
52884
- return results.rows.map((row) => row[0]);
53231
+ //map each sql result with the ingestion timestamp to pass it down a level
53232
+ return results.rows
53233
+ .map((row) => row[0])
53234
+ .map((record) => {
53235
+ return {
53236
+ record,
53237
+ ingestionTimestamp,
53238
+ };
53239
+ });
52885
53240
  }
52886
53241
  /**
52887
53242
  * Converts a childRelationship into a predicate
@@ -52907,6 +53262,53 @@ function isRecordType(type) {
52907
53262
  const interfaces = type.getInterfaces();
52908
53263
  return Boolean(interfaces.find((iface) => iface.name === 'Record'));
52909
53264
  }
53265
+ /**
53266
+ * Builds the top level record query key based on AST data
53267
+ * @param operation
53268
+ * @param variables
53269
+ * @param argumentNodes
53270
+ * @param currentFieldName
53271
+ * @returns
53272
+ */
53273
+ function buildKeyStringForRecordQuery(variables, argumentNodes, currentFieldName) {
53274
+ const filteredArgumentNodes = assign$3([], argumentNodes).filter((node) => node.name.value !== 'first' && node.name.value !== 'after');
53275
+ const argumentString = filteredArgumentNodes.length > 0
53276
+ ? `__${serializeFieldArguments$1(filteredArgumentNodes, variables)}`
53277
+ : '';
53278
+ return `UiApi::GraphQLRepresentation__uiapi__query__${currentFieldName}${argumentString}`;
53279
+ }
53280
+ /**
53281
+ * fetches a query level ingestion time stamp from the L2 cache
53282
+ * if no query has been seen then the timestamp is 0
53283
+ * @param apiName
53284
+ * @param info
53285
+ * @param args
53286
+ * @param query
53287
+ * @returns
53288
+ */
53289
+ async function fetchIngestionTimeStampFromDatabase(apiName, info, args, query) {
53290
+ const { variableValues } = info;
53291
+ // if we cannot find the query key in the database then default to 0 as we assume we have not seen the query
53292
+ // and all the data is not stale
53293
+ let ingestionTimestamp = 0;
53294
+ if (info.fieldNodes.length > 0 && info.fieldNodes[0].arguments !== undefined) {
53295
+ const key = buildKeyStringForRecordQuery(
53296
+ // join varables passed from query to the argument variables given from the AST
53297
+ { ...variableValues, ...args }, info.fieldNodes[0].arguments, apiName);
53298
+ const sql = `
53299
+ SELECT json_extract(metadata, '${JSON_EXTRACT_PATH_INGESTION_TIMESTAMP}')
53300
+ FROM lds_data
53301
+ WHERE key IS ?
53302
+ `;
53303
+ const results = await query(sql, [key]);
53304
+ const [timestamp] = results.rows.map((row) => row[0]);
53305
+ if (timestamp !== null && typeof timestamp === 'number') {
53306
+ //go back 10 ms to adjust for margin of error when top level query is stored and when raml objects are stored
53307
+ ingestionTimestamp = timestamp - 10;
53308
+ }
53309
+ }
53310
+ return ingestionTimestamp;
53311
+ }
52910
53312
 
52911
53313
  const baseTypeDefinitions = /* GraphQL */ `
52912
53314
  schema {
@@ -56208,6 +56610,15 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
56208
56610
  links,
56209
56611
  };
56210
56612
  }
56613
+ function getDenormalizedKey(originalKey, recordId, luvio) {
56614
+ // this will likely need to be handled when moving to structured keys
56615
+ // note record view entities dont have an associated keybuilder. They get ingested as records to a different key format
56616
+ // see the override for how they are handled packages/lds-adapters-uiapi/src/raml-artifacts/types/RecordRepresentation/keyBuilderFromType.ts
56617
+ if (originalKey.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX)) {
56618
+ return RECORD_VIEW_ENTITY_ID_PREFIX + recordId;
56619
+ }
56620
+ return keyBuilder$1Q(luvio, { recordId });
56621
+ }
56211
56622
  function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata) {
56212
56623
  const getEntries = function (entries, segment) {
56213
56624
  // this HOF only inspects records in the default segment
@@ -56222,14 +56633,24 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
56222
56633
  const filteredEntryIds = [];
56223
56634
  // map of records to avoid requesting duplicate record keys when requesting both records and fields
56224
56635
  const recordEntries = {};
56636
+ const recordViewEntries = {};
56225
56637
  for (let i = 0, len = entriesLength; i < len; i++) {
56226
56638
  const id = entries[i];
56227
56639
  const recordId = extractRecordIdFromStoreKey(id);
56228
56640
  if (recordId !== undefined) {
56229
- if (recordEntries[recordId] === undefined) {
56230
- const key = keyBuilder$1Q(luvio, { recordId });
56231
- recordEntries[recordId] = true;
56232
- filteredEntryIds.push(key);
56641
+ if (id.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX)) {
56642
+ if (recordViewEntries[recordId] === undefined) {
56643
+ const key = getDenormalizedKey(id, recordId, luvio);
56644
+ recordViewEntries[recordId] = true;
56645
+ filteredEntryIds.push(key);
56646
+ }
56647
+ }
56648
+ else {
56649
+ if (recordEntries[recordId] === undefined) {
56650
+ const key = getDenormalizedKey(id, recordId, luvio);
56651
+ recordEntries[recordId] = true;
56652
+ filteredEntryIds.push(key);
56653
+ }
56233
56654
  }
56234
56655
  }
56235
56656
  else {
@@ -56263,6 +56684,7 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
56263
56684
  const putEntries = create$2$1(null);
56264
56685
  const keys$1 = keys$2$1(entries);
56265
56686
  const putRecords = {};
56687
+ const putRecordViews = {};
56266
56688
  const storeRecords = getStoreRecords !== undefined ? getStoreRecords() : {};
56267
56689
  const storeMetadata = getStoreMetadata !== undefined ? getStoreMetadata() : {};
56268
56690
  for (let i = 0, len = keys$1.length; i < len; i++) {
@@ -56271,10 +56693,18 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
56271
56693
  const recordId = extractRecordIdFromStoreKey(key);
56272
56694
  // do not put normalized field values
56273
56695
  if (recordId !== undefined) {
56274
- const recordKey = keyBuilder$1Q(luvio, { recordId });
56275
- if (putRecords[recordId] === true) {
56276
- continue;
56696
+ const isRecordView = key.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX);
56697
+ if (isRecordView) {
56698
+ if (putRecordViews[recordId] === true) {
56699
+ continue;
56700
+ }
56277
56701
  }
56702
+ else {
56703
+ if (putRecords[recordId] === true) {
56704
+ continue;
56705
+ }
56706
+ }
56707
+ const recordKey = getDenormalizedKey(key, recordId, luvio);
56278
56708
  const recordEntries = entries;
56279
56709
  const entry = recordEntries[recordKey];
56280
56710
  let record = entry && entry.data;
@@ -56286,7 +56716,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
56286
56716
  continue;
56287
56717
  }
56288
56718
  }
56289
- putRecords[recordId] = true;
56719
+ if (isRecordView) {
56720
+ putRecordViews[recordId] = true;
56721
+ }
56722
+ else {
56723
+ putRecords[recordId] = true;
56724
+ }
56290
56725
  if (isStoreRecordError(record)) {
56291
56726
  putEntries[recordKey] = value;
56292
56727
  continue;
@@ -56364,6 +56799,19 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
56364
56799
  });
56365
56800
  }
56366
56801
 
56802
+ /**
56803
+ * This function takes an unknown error and normalizes it to an Error object
56804
+ */
56805
+ function normalizeError$1(error) {
56806
+ if (typeof error === 'object' && error instanceof Error) {
56807
+ return error;
56808
+ }
56809
+ else if (typeof error === 'string') {
56810
+ return new Error(error);
56811
+ }
56812
+ return new Error(stringify$2(error));
56813
+ }
56814
+
56367
56815
  const PERFORM_QUICK_ACTION_ENDPOINT_REGEX = /^\/ui-api\/actions\/perform-quick-action\/.*$/;
56368
56816
  /**
56369
56817
  * Checks if a provided resource request is a POST operation on the record
@@ -56382,7 +56830,7 @@ function performQuickActionDraftEnvironment(luvio, env, handler) {
56382
56830
  return env.dispatchResourceRequest(request, context, eventObservers);
56383
56831
  }
56384
56832
  const { data } = await handler.enqueue(request).catch((err) => {
56385
- throw createDraftSynthesisErrorResponse(err.message);
56833
+ throw createDraftSynthesisErrorResponse(normalizeError$1(err).message);
56386
56834
  });
56387
56835
  if (data === undefined) {
56388
56836
  return Promise.reject(createDraftSynthesisErrorResponse());
@@ -56719,7 +57167,7 @@ function generateUniqueRecordId() {
56719
57167
  return `UiApi::GraphQLRepresentation:${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
56720
57168
  }
56721
57169
  // Recursively replace draft ids with canonical ids
56722
- const replaceDraftIdsInVariables = (variables, draftFunctions, unmappedDraftIDs) => {
57170
+ const replaceDraftIdsInVariables$1 = (variables, draftFunctions, unmappedDraftIDs) => {
56723
57171
  const replace = (object) => {
56724
57172
  if (typeof object === 'string') {
56725
57173
  if (!draftFunctions.isDraftId(object)) {
@@ -56776,7 +57224,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
56776
57224
  unmappedDraftIDs,
56777
57225
  } = await injectSyntheticFields(copy, objectInfoService, draftFunctions, config.variables));
56778
57226
  if (config.variables) {
56779
- config.variables = replaceDraftIdsInVariables(config.variables, draftFunctions, unmappedDraftIDs);
57227
+ config.variables = replaceDraftIdsInVariables$1(config.variables, draftFunctions, unmappedDraftIDs);
56780
57228
  }
56781
57229
  }
56782
57230
  catch (throwable) {
@@ -56809,6 +57257,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
56809
57257
  query: injectedAST,
56810
57258
  },
56811
57259
  luvio,
57260
+ gqlEval: true,
56812
57261
  }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
56813
57262
  if (isErrorSnapshotThatShouldGetReturnedToCaller(nonEvaluatedSnapshot)) {
56814
57263
  return nonEvaluatedSnapshot;
@@ -57936,6 +58385,10 @@ class ScopedFieldsCollection {
57936
58385
  }
57937
58386
 
57938
58387
  const MAX_STRING_LENGTH_PER_CHUNK = 10000;
58388
+ //Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
58389
+ //https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
58390
+ //Due to we don't know the domain ResourceRequest, here we give 8000
58391
+ const MAX_URL_LENGTH = 8000;
57939
58392
  const PARSE_ERROR = 'PARSE_AGGREGATE_UI_RESPONSE_ERROR';
57940
58393
  function isErrorResponse(response) {
57941
58394
  return response.httpStatusCode >= 400;
@@ -58014,8 +58467,8 @@ function buildAggregateUiUrl(params, resourceRequest) {
58014
58467
  }
58015
58468
  return `${resourceRequest.baseUri}${resourceRequest.basePath}?${join$1.call(queryString, '&')}`;
58016
58469
  }
58017
- function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray) {
58018
- return fieldsArray.length + optionalFieldsArray.length >= MAX_STRING_LENGTH_PER_CHUNK;
58470
+ function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray, maxLengthPerChunk) {
58471
+ return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
58019
58472
  }
58020
58473
  function isSpanningRecord(fieldValue) {
58021
58474
  return fieldValue !== null && typeof fieldValue === 'object';
@@ -58078,14 +58531,15 @@ function createAggregateBatchRequestInfo(resourceRequest, endpoint) {
58078
58531
  if (fieldsArray.length === 0 && optionalFieldsArray.length === 0) {
58079
58532
  return undefined;
58080
58533
  }
58534
+ const allowedMaxStringLengthPerChunk = getMaxLengthPerChunkAllowed(resourceRequest);
58081
58535
  const fieldsString = fieldsArray.join(',');
58082
58536
  const optionalFieldsString = optionalFieldsArray.join(',');
58083
- const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString);
58537
+ const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString, allowedMaxStringLengthPerChunk);
58084
58538
  if (!shouldUseAggregate) {
58085
58539
  return undefined;
58086
58540
  }
58087
- const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(MAX_STRING_LENGTH_PER_CHUNK);
58088
- const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(MAX_STRING_LENGTH_PER_CHUNK);
58541
+ const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(allowedMaxStringLengthPerChunk);
58542
+ const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(allowedMaxStringLengthPerChunk);
58089
58543
  return {
58090
58544
  fieldCollection,
58091
58545
  optionalFieldCollection,
@@ -58158,6 +58612,25 @@ function isGetRequestForEndpoint(endpoint, request) {
58158
58612
  function arrayOrEmpty(array) {
58159
58613
  return array !== undefined && isArray$7(array) ? array : [];
58160
58614
  }
58615
+ /**
58616
+ * Calculate the max lengh per chunk.
58617
+ * If useShortUrlGate is open, allow max chunk size is MAX_URL_LENGTH - the url without fields and optional fields in url.
58618
+ * Otherwise MAX_STRING_LENGTH_PER_CHUNK
58619
+ * @param resourceRequest
58620
+ * @returns
58621
+ */
58622
+ function getMaxLengthPerChunkAllowed(request) {
58623
+ if (!ldsUseShortUrlGate.isOpen({ fallback: false })) {
58624
+ return MAX_STRING_LENGTH_PER_CHUNK;
58625
+ }
58626
+ // Too much work to get exact length of the final url, so use stringified json to get the rough length.
58627
+ const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
58628
+ request.baseUri.length +
58629
+ (request.urlParams ? stringify$1$1(request.urlParams).length : 0) +
58630
+ stringify$1$1({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
58631
+ // MAX_URL_LENGTH - full lenght without fields, optionalFields
58632
+ return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
58633
+ }
58161
58634
 
58162
58635
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
58163
58636
  const referenceId$3 = 'LDS_Records_AggregateUi';
@@ -58362,7 +58835,7 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter) {
58362
58835
  }, networkAdapter);
58363
58836
  }
58364
58837
 
58365
- const { keys: keys$7, create: create$6, assign: assign$5, entries } = Object;
58838
+ const { keys: keys$8, create: create$6, assign: assign$6, entries } = Object;
58366
58839
  const { stringify: stringify$6, parse: parse$6 } = JSON;
58367
58840
  const { push, join, slice } = Array.prototype;
58368
58841
 
@@ -58378,15 +58851,15 @@ class NimbusDraftQueue {
58378
58851
  enqueue(handlerId, data) {
58379
58852
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
58380
58853
  if (callProxyMethod === undefined) {
58381
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
58854
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
58382
58855
  }
58383
58856
  const serializedAction = stringify$6([handlerId, data]);
58384
58857
  return new Promise((resolve, reject) => {
58385
58858
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
58386
58859
  const response = parse$6(serializedActionResponse);
58387
58860
  resolve(response);
58388
- }, (serializedError) => {
58389
- reject(parse$6(serializedError));
58861
+ }, (errorMessage) => {
58862
+ reject(new Error(errorMessage));
58390
58863
  });
58391
58864
  });
58392
58865
  }
@@ -58396,18 +58869,18 @@ class NimbusDraftQueue {
58396
58869
  return Promise.resolve;
58397
58870
  }
58398
58871
  processNextAction() {
58399
- return Promise.reject('Cannot call processNextAction from the NimbusDraftQueue');
58872
+ return Promise.reject(new Error('Cannot call processNextAction from the NimbusDraftQueue'));
58400
58873
  }
58401
58874
  getQueueActions() {
58402
58875
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
58403
58876
  if (callProxyMethod === undefined) {
58404
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
58877
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
58405
58878
  }
58406
58879
  return new Promise((resolve, reject) => {
58407
58880
  callProxyMethod('getQueueActions', stringify$6([]), (serializedQueue) => {
58408
58881
  resolve(parse$6(serializedQueue));
58409
- }, (serializedError) => {
58410
- reject(parse$6(serializedError));
58882
+ }, (errorMessage) => {
58883
+ reject(new Error(errorMessage));
58411
58884
  });
58412
58885
  });
58413
58886
  }
@@ -58435,32 +58908,32 @@ class NimbusDraftQueue {
58435
58908
  throw new Error('Cannot call getQueueState from the NimbusDraftQueue');
58436
58909
  }
58437
58910
  removeDraftAction(_actionId) {
58438
- return Promise.reject('Cannot call removeDraftAction from the NimbusDraftQueue');
58911
+ return Promise.reject(new Error('Cannot call removeDraftAction from the NimbusDraftQueue'));
58439
58912
  }
58440
58913
  startQueue() {
58441
- return Promise.reject('Cannot call startQueue from the NimbusDraftQueue');
58914
+ return Promise.reject(new Error('Cannot call startQueue from the NimbusDraftQueue'));
58442
58915
  }
58443
58916
  stopQueue() {
58444
- return Promise.reject('Cannot call stopQueue from the NimbusDraftQueue');
58917
+ return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
58445
58918
  }
58446
58919
  replaceAction(_actionId, _withActionId) {
58447
- return Promise.reject('Cannot call replaceAction from the NimbusDraftQueue');
58920
+ return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
58448
58921
  }
58449
58922
  mergeActions(_targetActionId, _sourceActionId) {
58450
- return Promise.reject('Cannot call mergeActions from the NimbusDraftQueue');
58923
+ return Promise.reject(new Error('Cannot call mergeActions from the NimbusDraftQueue'));
58451
58924
  }
58452
58925
  setMetadata(_actionId, _metadata) {
58453
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
58926
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
58454
58927
  }
58455
58928
  addHandler(_handler) {
58456
58929
  // no-op -- all registration occurs against concrete draft queue
58457
58930
  return Promise.resolve();
58458
58931
  }
58459
58932
  addCustomHandler(_id, _executor) {
58460
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
58933
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
58461
58934
  }
58462
58935
  removeHandler(_id) {
58463
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
58936
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
58464
58937
  }
58465
58938
  }
58466
58939
 
@@ -58483,7 +58956,7 @@ function attachObserversToAdapterRequestContext(observers, adapterRequestContext
58483
58956
  * @param err Unknown object to sanitize
58484
58957
  * @returns an instance of error
58485
58958
  */
58486
- function normalizeError$1(err) {
58959
+ function normalizeError$2(err) {
58487
58960
  if (err instanceof Error) {
58488
58961
  return err;
58489
58962
  }
@@ -58495,13 +58968,13 @@ function normalizeError$1(err) {
58495
58968
  const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
58496
58969
  const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
58497
58970
  function reportGraphqlQueryParseError(err) {
58498
- normalizeError$1(err);
58971
+ normalizeError$2(err);
58499
58972
  }
58500
58973
  function reportGraphqlSqlEvalPreconditionError(err) {
58501
- normalizeError$1(err);
58974
+ normalizeError$2(err);
58502
58975
  }
58503
58976
  function reportGraphqlCreateSnapshotError(err) {
58504
- normalizeError$1(err);
58977
+ normalizeError$2(err);
58505
58978
  }
58506
58979
  function reportGraphQlEvalDbReadDuration(duration) {
58507
58980
  }
@@ -58511,7 +58984,7 @@ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
58511
58984
  error = err.body;
58512
58985
  }
58513
58986
  else {
58514
- error = normalizeError$1(err);
58987
+ error = normalizeError$2(err);
58515
58988
  }
58516
58989
  const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
58517
58990
  const errorType = error.errorType;
@@ -58540,7 +59013,7 @@ const withInstrumentation = (operation, config) => {
58540
59013
  const { tags, metricName, logError } = config;
58541
59014
  return operation()
58542
59015
  .catch((err) => {
58543
- const error = normalizeError$1(err);
59016
+ const error = normalizeError$2(err);
58544
59017
  tags['errorMessage'] = error.message;
58545
59018
  throw err;
58546
59019
  })
@@ -58922,7 +59395,7 @@ class LdsDataTable {
58922
59395
  },
58923
59396
  conflictColumns: this.conflictColumnNames,
58924
59397
  columns: this.columnNames,
58925
- rows: keys$7(entries).reduce((rows, key) => {
59398
+ rows: keys$8(entries).reduce((rows, key) => {
58926
59399
  const entry = entries[key];
58927
59400
  const { data, metadata } = entry;
58928
59401
  const row = [key, stringify$6(data), metadata ? stringify$6(metadata) : null];
@@ -58983,7 +59456,7 @@ class AbstractKeyValueDataTable {
58983
59456
  },
58984
59457
  conflictColumns: this.conflictColumnNames,
58985
59458
  columns: this.columnNames,
58986
- rows: keys$7(entries).reduce((rows, key) => {
59459
+ rows: keys$8(entries).reduce((rows, key) => {
58987
59460
  const entry = entries[key];
58988
59461
  rows.push([key, stringify$6(entry.data)]);
58989
59462
  return rows;
@@ -59068,7 +59541,7 @@ class LdsInternalDataTable {
59068
59541
  },
59069
59542
  conflictColumns: this.conflictColumnNames,
59070
59543
  columns: this.columnNames,
59071
- rows: keys$7(entries).reduce((rows, key) => {
59544
+ rows: keys$8(entries).reduce((rows, key) => {
59072
59545
  const entry = entries[key];
59073
59546
  const { data, metadata } = entry;
59074
59547
  const row = [key, stringify$6(data)];
@@ -59152,7 +59625,7 @@ class NimbusSqliteStore {
59152
59625
  registerOnChangedListener(listener) {
59153
59626
  let unsubscribeId = undefined;
59154
59627
  this.plugin
59155
- .registerOnChangedListener((changes) => {
59628
+ .registerOnChangedListener(async (changes) => {
59156
59629
  const durableChanges = changes.map((c) => {
59157
59630
  return {
59158
59631
  type: c.type === 'upsert' ? 'setEntries' : 'evictEntries',
@@ -59161,7 +59634,7 @@ class NimbusSqliteStore {
59161
59634
  segment: c.context.segment,
59162
59635
  };
59163
59636
  });
59164
- listener(durableChanges);
59637
+ await listener(durableChanges);
59165
59638
  })
59166
59639
  .then((unsub) => {
59167
59640
  unsubscribeId = unsub;
@@ -59267,8 +59740,17 @@ function formatDisplayValue(value, datatype) {
59267
59740
  }
59268
59741
  }
59269
59742
 
59270
- //TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
59743
+ function isUnfulfilledSnapshot(cachedSnapshotResult) {
59744
+ if (cachedSnapshotResult === undefined) {
59745
+ return false;
59746
+ }
59747
+ if ('then' in cachedSnapshotResult) {
59748
+ return false;
59749
+ }
59750
+ return cachedSnapshotResult.state === 'Unfulfilled';
59751
+ }
59271
59752
  function makeEnvironmentGraphqlAware(environment) {
59753
+ //TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
59272
59754
  const rebuildSnapshot = function (snapshot, onRebuild) {
59273
59755
  if (isStoreEvalSnapshot(snapshot)) {
59274
59756
  snapshot.rebuildWithStoreEval(snapshot).then((rebuilt) => {
@@ -59284,8 +59766,72 @@ function makeEnvironmentGraphqlAware(environment) {
59284
59766
  }
59285
59767
  return environment.rebuildSnapshot(snapshot, onRebuild);
59286
59768
  };
59769
+ const applyCachePolicy = function (luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot) {
59770
+ // Early exit for non-evaluating adapters
59771
+ let graphqlBuildSnapshotContext = buildSnapshotContext;
59772
+ if (graphqlBuildSnapshotContext.gqlEval !== true) {
59773
+ return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot);
59774
+ }
59775
+ var localBuildCachedSnapshot = buildCachedSnapshot;
59776
+ const hoistUnfulfilledToStale = (context, storeLookup, luvio) => {
59777
+ const upstream = buildCachedSnapshot(context, storeLookup, luvio);
59778
+ if (upstream === undefined)
59779
+ return upstream;
59780
+ if (isUnfulfilledSnapshot(upstream)) {
59781
+ return {
59782
+ ...upstream,
59783
+ data: upstream.data || {},
59784
+ state: 'Stale',
59785
+ };
59786
+ }
59787
+ else if ('then' in upstream) {
59788
+ return upstream.then((snapshot) => {
59789
+ if (snapshot === undefined)
59790
+ return snapshot;
59791
+ if (isUnfulfilledSnapshot(snapshot)) {
59792
+ return {
59793
+ ...snapshot,
59794
+ data: snapshot.data || {},
59795
+ state: 'Stale',
59796
+ };
59797
+ }
59798
+ return snapshot;
59799
+ });
59800
+ }
59801
+ return upstream;
59802
+ };
59803
+ const { cachePolicy } = adapterRequestContext;
59804
+ if (eagerEvalValidAt.isOpen({ fallback: false }) &&
59805
+ cachePolicy &&
59806
+ cachePolicy.type === 'valid-at' &&
59807
+ cachePolicy.timestamp === 0 &&
59808
+ cachePolicy.basePolicy &&
59809
+ cachePolicy.basePolicy.type === 'stale-while-revalidate') {
59810
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
59811
+ }
59812
+ if (eagerEvalStaleWhileRevalidate.isOpen({ fallback: false }) &&
59813
+ cachePolicy &&
59814
+ cachePolicy.type === 'stale-while-revalidate' &&
59815
+ cachePolicy.staleDurationSeconds >= Number.MAX_SAFE_INTEGER) {
59816
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
59817
+ }
59818
+ if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) &&
59819
+ (cachePolicy === undefined || cachePolicy === null)) {
59820
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
59821
+ }
59822
+ return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
59823
+ };
59287
59824
  return create$6(environment, {
59288
59825
  rebuildSnapshot: { value: rebuildSnapshot },
59826
+ applyCachePolicy: { value: applyCachePolicy },
59827
+ defaultCachePolicy: {
59828
+ get() {
59829
+ return environment.defaultCachePolicy;
59830
+ },
59831
+ set(value) {
59832
+ environment.defaultCachePolicy = value;
59833
+ },
59834
+ },
59289
59835
  });
59290
59836
  }
59291
59837
 
@@ -59934,8 +60480,17 @@ function getRuntime() {
59934
60480
  lazyObjectInfoService = new ObjectInfoService(getObjectInfo, getObjectInfos, internalAdapterDurableStore);
59935
60481
  // set storeEval function for lds-adapters-graghql to use
59936
60482
  withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
59937
- const { configuration: { setStoreEval }, } = registration;
59938
- setStoreEval(sqliteStoreEvalFactory(userId, lazyBaseDurableStore, lazyObjectInfoService));
60483
+ const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
60484
+ const getCanonicalId = (id) => {
60485
+ var _a;
60486
+ return ((_a = extractRecordIdFromStoreKey(lazyLuvio.storeGetCanonicalKey(RECORD_ID_PREFIX + id))) !== null && _a !== void 0 ? _a : id);
60487
+ };
60488
+ const draftFuncs = {
60489
+ isDraftId: isGenerated,
60490
+ getCanonicalId,
60491
+ };
60492
+ setStoreEval(sqliteStoreEvalFactory(userId, lazyBaseDurableStore, lazyObjectInfoService, draftFuncs));
60493
+ setDraftFunctions(draftFuncs);
59939
60494
  });
59940
60495
  // creates a durable store that denormalizes scalar fields for records
59941
60496
  let getIngestRecords;
@@ -60024,7 +60579,7 @@ register({
60024
60579
  id: '@salesforce/lds-network-adapter',
60025
60580
  instrument: instrument$1,
60026
60581
  });
60027
- // version: 1.130.9-2d38b9869
60582
+ // version: 1.131.0-dev9-5f88f31bc
60028
60583
 
60029
60584
  const { create: create$2, keys: keys$2 } = Object;
60030
60585
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -74332,7 +74887,7 @@ register({
74332
74887
  configuration: { ...configurationForGraphQLAdapters },
74333
74888
  instrument,
74334
74889
  });
74335
- // version: 1.130.9-a2fbc710a
74890
+ // version: 1.131.0-dev9-9940b321d
74336
74891
 
74337
74892
  // On core the unstable adapters are re-exported with different names,
74338
74893
 
@@ -75723,10 +76278,14 @@ function validate(ast, variables) {
75723
76278
  }
75724
76279
 
75725
76280
  let storeEval = undefined;
76281
+ let draftFunctions = undefined;
75726
76282
  const configuration = {
75727
76283
  setStoreEval: function (storeEvalArg) {
75728
76284
  storeEval = storeEvalArg;
75729
76285
  },
76286
+ setDraftFunctions: function (draftFuncs) {
76287
+ draftFunctions = draftFuncs;
76288
+ },
75730
76289
  };
75731
76290
 
75732
76291
  const assignedToMe = {
@@ -75812,6 +76371,78 @@ function shouldInjectFields(ast) {
75812
76371
  function injectFieldsGQL(ast) {
75813
76372
  return injectScopeFields(ast);
75814
76373
  }
76374
+ function swapIdsOfDocumentNode(documentnode, draftFunctions) {
76375
+ const recordNodes = findRecordSelections(documentnode);
76376
+ recordNodes.forEach((recordConnection) => {
76377
+ swapIdsOfFieldNode(recordConnection, draftFunctions);
76378
+ });
76379
+ return documentnode;
76380
+ }
76381
+ function swapIdsOfFieldNode(selectionNode, draftFunctions) {
76382
+ if (isCustomFieldNode(selectionNode) &&
76383
+ selectionNode.type === 'Connection' &&
76384
+ selectionNode.arguments !== undefined &&
76385
+ selectionNode.arguments.some((argment) => argment.name === 'where')) {
76386
+ const swappedArguments = selectionNode.arguments.map((argument) => {
76387
+ if (argument.name === 'where') {
76388
+ return {
76389
+ ...argument,
76390
+ value: swapIdsOfValueNode(argument.value, draftFunctions.isDraftId, draftFunctions.getCanonicalId),
76391
+ };
76392
+ }
76393
+ else {
76394
+ return argument;
76395
+ }
76396
+ });
76397
+ selectionNode.arguments = swappedArguments;
76398
+ }
76399
+ if (selectionNode.luvioSelections !== undefined) {
76400
+ for (const childSelectionNode of selectionNode.luvioSelections) {
76401
+ if (isCustomFieldNode(childSelectionNode) ||
76402
+ isObjectFieldSelection(childSelectionNode)) {
76403
+ swapIdsOfFieldNode(childSelectionNode, draftFunctions);
76404
+ }
76405
+ }
76406
+ }
76407
+ }
76408
+ function swapIdsOfValueNode(valueNode, isDraftId, idMapper) {
76409
+ switch (valueNode.kind) {
76410
+ case Kind.OBJECT: {
76411
+ const swappedObjectValueNode = {};
76412
+ for (const key of keys(valueNode.fields)) {
76413
+ swappedObjectValueNode[key] = swapIdsOfValueNode(valueNode.fields[key], isDraftId, idMapper);
76414
+ }
76415
+ return {
76416
+ kind: 'ObjectValue',
76417
+ fields: swappedObjectValueNode,
76418
+ };
76419
+ }
76420
+ case Kind.LIST: {
76421
+ const listValueNodes = [];
76422
+ for (const child of valueNode.values) {
76423
+ listValueNodes.push(swapIdsOfValueNode(child, isDraftId, idMapper));
76424
+ }
76425
+ return {
76426
+ kind: 'ListValue',
76427
+ values: listValueNodes,
76428
+ };
76429
+ }
76430
+ case Kind.STRING: {
76431
+ if (!isDraftId(valueNode.value)) {
76432
+ return valueNode;
76433
+ }
76434
+ return {
76435
+ kind: 'StringValue',
76436
+ value: idMapper(valueNode.value),
76437
+ block: false,
76438
+ };
76439
+ }
76440
+ default:
76441
+ return {
76442
+ ...valueNode,
76443
+ };
76444
+ }
76445
+ }
75815
76446
  function injectScopeFields(ast) {
75816
76447
  const modifiedDocumentNode = {
75817
76448
  kind: 'Document',
@@ -76392,6 +77023,34 @@ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext)
76392
77023
  }
76393
77024
  return buildNetworkSnapshot(luvio, config, fragment, dispatchOptions);
76394
77025
  }
77026
+ const replaceDraftIdsInVariables = (variables, draftFunctions) => {
77027
+ const replace = (object) => {
77028
+ if (typeof object === 'string') {
77029
+ if (!draftFunctions.isDraftId(object)) {
77030
+ return object;
77031
+ }
77032
+ return draftFunctions.getCanonicalId(object);
77033
+ }
77034
+ else if (isArray(object)) {
77035
+ return object.map(replace);
77036
+ }
77037
+ else if (typeof object === 'object' && object !== null) {
77038
+ let source = object;
77039
+ return keys(source).reduce((acc, key) => {
77040
+ acc[key] = replace(source[key]);
77041
+ return acc;
77042
+ }, {});
77043
+ }
77044
+ else {
77045
+ return object;
77046
+ }
77047
+ };
77048
+ let newVariables = keys(variables).reduce((acc, key) => {
77049
+ acc[key] = replace(variables[key]);
77050
+ return acc;
77051
+ }, {});
77052
+ return newVariables;
77053
+ };
76395
77054
  const graphQLAdapterFactory = (luvio) => {
76396
77055
  const uiApiGraphQLAdapter = factory$1(luvio);
76397
77056
  function graphql(untrustedConfig, requestContext) {
@@ -76416,19 +77075,33 @@ const graphQLAdapterFactory = (luvio) => {
76416
77075
  const validatedConfigWithInjection = fieldInjectionRequired
76417
77076
  ? graphqlConfigWithInjectedAST(validatedConfig)
76418
77077
  : validatedConfig;
76419
- const fragment = createFragment(luvio, validatedConfigWithInjection.query, variables);
77078
+ const sanitizedConfig = draftFunctions !== undefined
77079
+ ? sanitizeConfig(validatedConfigWithInjection, draftFunctions)
77080
+ : validatedConfigWithInjection;
77081
+ if (sanitizedConfig.variables && draftFunctions !== undefined) {
77082
+ const variablesWithSwappedDraftIds = replaceDraftIdsInVariables(sanitizedConfig.variables, draftFunctions);
77083
+ sanitizedConfig.variables = variablesWithSwappedDraftIds;
77084
+ validatedConfig.variables = variablesWithSwappedDraftIds;
77085
+ }
77086
+ const fragment = createFragment(luvio, sanitizedConfig.query, sanitizedConfig.variables);
76420
77087
  const context = {
76421
- config: validatedConfigWithInjection,
77088
+ config: sanitizedConfig,
76422
77089
  fragment,
76423
77090
  luvio,
76424
77091
  };
77092
+ // NOTE: For evaluating environments, set a context property to let the
77093
+ // environment detect that eval will happen and to check varous gates
77094
+ // for eval behavior customizations.
77095
+ if (storeEval !== undefined) {
77096
+ context.gqlEval = true;
77097
+ }
76425
77098
  const snapshotOrPromiseFromCachePolicy = luvio.applyCachePolicy(requestContext || {}, context, buildCachedSnapshot, buildNetworkSnapshotCachePolicy);
76426
77099
  if (storeEval !== undefined) {
76427
77100
  const observers = requestContext && requestContext.eventObservers
76428
77101
  ? requestContext.eventObservers
76429
77102
  : [];
76430
- // uses the original ast to do the eval to avoid fields not needed by users
76431
- return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers);
77103
+ // uses the original ast to do the eval to avoid fields not needed by users. The draftID swapping happens when filters transform to predicates.
77104
+ return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers, keyBuilder);
76432
77105
  }
76433
77106
  return snapshotOrPromiseFromCachePolicy;
76434
77107
  }
@@ -76444,6 +77117,15 @@ function graphqlConfigWithInjectedAST(graphqlConfig) {
76444
77117
  query: modifiedAST,
76445
77118
  };
76446
77119
  }
77120
+ function sanitizeConfig(graphqlConfig, draftFunctions) {
77121
+ const { query } = graphqlConfig;
77122
+ const astCopy = parse(stringify(query));
77123
+ const modifiedAST = swapIdsOfDocumentNode(astCopy, draftFunctions);
77124
+ return {
77125
+ ...graphqlConfig,
77126
+ query: modifiedAST,
77127
+ };
77128
+ }
76447
77129
  // make sure to register the configuration whenever this module loads
76448
77130
  register({ id: '@salesforce/lds-adapters-graphql', configuration });
76449
77131
 
@@ -76461,7 +77143,7 @@ withDefaultLuvio((luvio) => {
76461
77143
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76462
77144
  graphQLImperative = ldsAdapter;
76463
77145
  });
76464
- // version: 1.130.9-a2fbc710a
77146
+ // version: 1.131.0-dev9-9940b321d
76465
77147
 
76466
77148
  var gqlApi = /*#__PURE__*/Object.freeze({
76467
77149
  __proto__: null,
@@ -76613,7 +77295,7 @@ function buildAdapterRequestContext(nativeRequestContext) {
76613
77295
  cachePolicy: buildCachePolicy(cachePolicy),
76614
77296
  priority,
76615
77297
  };
76616
- if (observabilityContext !== undefined) {
77298
+ if (observabilityContext !== undefined && observabilityContext !== null) {
76617
77299
  requestContext.requestCorrelator = {
76618
77300
  observabilityContext,
76619
77301
  };
@@ -77071,24 +77753,21 @@ const allowList = ['enqueue', 'getQueueActions'];
77071
77753
  * to the instance of the lds-drafts' DraftQueue implementation
77072
77754
  */
77073
77755
  const nimbusDraftQueue = {
77074
- callProxyMethod(methodName, serializedArgsArray, resultCallback, errorCallback) {
77756
+ callProxyMethod(methodName, serializedArgsArray, resultCallback,
77757
+ // NOTE: the other side of the proxy is expecting an error message string
77758
+ // (not a JSON serialized Error object)
77759
+ errorCallback) {
77075
77760
  const method = draftQueue[methodName];
77076
77761
  if (method === undefined) {
77077
- return errorCallback(stringify$1({
77078
- message: 'Method does not exist on the draft queue',
77079
- }));
77762
+ return errorCallback('Method does not exist on the draft queue');
77080
77763
  }
77081
77764
  if (allowList.includes(methodName) === false) {
77082
- return errorCallback(stringify$1({
77083
- message: `Method ${methodName} is not available for proxy invocation`,
77084
- }));
77765
+ return errorCallback(`Method ${methodName} is not available for proxy invocation`);
77085
77766
  }
77086
77767
  const parsedArgs = parse$1(serializedArgsArray);
77087
77768
  // TODO [W-9933226]: we should validate the argument list based on which method is being called
77088
77769
  if (isArray$1(parsedArgs) === false) {
77089
- return errorCallback(stringify$1({
77090
- message: 'expected array argument list',
77091
- }));
77770
+ return errorCallback('expected array argument list');
77092
77771
  }
77093
77772
  let methodResult = undefined;
77094
77773
  try {
@@ -77100,7 +77779,7 @@ const nimbusDraftQueue = {
77100
77779
  }
77101
77780
  }
77102
77781
  catch (err) {
77103
- return errorCallback(stringify$1(err));
77782
+ return errorCallback(normalizeError(err).message);
77104
77783
  }
77105
77784
  if (methodResult.then === undefined) {
77106
77785
  return resultCallback(stringify$1(methodResult));
@@ -77110,7 +77789,7 @@ const nimbusDraftQueue = {
77110
77789
  resultCallback(stringify$1(result));
77111
77790
  })
77112
77791
  .catch((err) => {
77113
- errorCallback(stringify$1(err));
77792
+ errorCallback(normalizeError(err).message);
77114
77793
  });
77115
77794
  },
77116
77795
  };
@@ -77153,4 +77832,4 @@ const { luvio } = getRuntime();
77153
77832
  setDefaultLuvio({ luvio });
77154
77833
 
77155
77834
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
77156
- // version: 1.130.9-2d38b9869
77835
+ // version: 1.131.0-dev9-5f88f31bc