@salesforce/lds-worker-api 1.377.0 → 1.377.1

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.
@@ -4280,7 +4280,7 @@
4280
4280
  }
4281
4281
  callbacks.push(callback);
4282
4282
  }
4283
- // version: 1.377.0-3c95caf11c
4283
+ // version: 1.377.1-dadb6358f3
4284
4284
 
4285
4285
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4286
4286
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5324,7 +5324,7 @@
5324
5324
  const { apiFamily, name } = metadata;
5325
5325
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5326
5326
  }
5327
- // version: 1.377.0-3c95caf11c
5327
+ // version: 1.377.1-dadb6358f3
5328
5328
 
5329
5329
  /**
5330
5330
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -34160,7 +34160,7 @@
34160
34160
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
34161
34161
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
34162
34162
  });
34163
- // version: 1.377.0-b0d5c49e07
34163
+ // version: 1.377.1-db77d3f339
34164
34164
 
34165
34165
  function requestIdleDetectedCallback(_callback) { }
34166
34166
  function declareNotifierTaskSingle(_name) {
@@ -45665,6 +45665,15 @@
45665
45665
  },
45666
45666
  };
45667
45667
 
45668
+ var graphqlPartialEmitParity = {
45669
+ isOpen: function (e) {
45670
+ return e.fallback;
45671
+ },
45672
+ hasError: function () {
45673
+ return !0;
45674
+ },
45675
+ };
45676
+
45668
45677
  var caseSensitiveUserId = '005B0000000GR4OIAW';
45669
45678
 
45670
45679
  var ldsAdapterO11yLoggingGate = {
@@ -45812,47 +45821,47 @@
45812
45821
  };
45813
45822
  const ok$4 = (value) => new Ok$4(value);
45814
45823
  const err$4 = (err2) => new Err$4(err2);
45815
- function resolvedPromiseLike$4(result) {
45816
- if (isPromiseLike$4(result)) {
45824
+ function resolvedPromiseLike$5(result) {
45825
+ if (isPromiseLike$5(result)) {
45817
45826
  return result.then((nextResult) => nextResult);
45818
45827
  }
45819
45828
  return {
45820
45829
  then: (onFulfilled, _onRejected) => {
45821
45830
  try {
45822
- return resolvedPromiseLike$4(onFulfilled(result));
45831
+ return resolvedPromiseLike$5(onFulfilled(result));
45823
45832
  } catch (e) {
45824
45833
  if (onFulfilled === void 0) {
45825
- return resolvedPromiseLike$4(result);
45834
+ return resolvedPromiseLike$5(result);
45826
45835
  }
45827
- return rejectedPromiseLike$4(e);
45836
+ return rejectedPromiseLike$5(e);
45828
45837
  }
45829
45838
  }
45830
45839
  };
45831
45840
  }
45832
- function rejectedPromiseLike$4(reason) {
45833
- if (isPromiseLike$4(reason)) {
45841
+ function rejectedPromiseLike$5(reason) {
45842
+ if (isPromiseLike$5(reason)) {
45834
45843
  return reason.then((nextResult) => nextResult);
45835
45844
  }
45836
45845
  return {
45837
45846
  then: (_onFulfilled, onRejected) => {
45838
45847
  if (typeof onRejected === "function") {
45839
45848
  try {
45840
- return resolvedPromiseLike$4(onRejected(reason));
45849
+ return resolvedPromiseLike$5(onRejected(reason));
45841
45850
  } catch (e) {
45842
- return rejectedPromiseLike$4(e);
45851
+ return rejectedPromiseLike$5(e);
45843
45852
  }
45844
45853
  }
45845
- return rejectedPromiseLike$4(reason);
45854
+ return rejectedPromiseLike$5(reason);
45846
45855
  }
45847
45856
  };
45848
45857
  }
45849
- function isPromiseLike$4(x) {
45858
+ function isPromiseLike$5(x) {
45850
45859
  return typeof (x == null ? void 0 : x.then) === "function";
45851
45860
  }
45852
45861
  function racesync(values) {
45853
45862
  for (const value of values) {
45854
45863
  let settled = void 0;
45855
- if (isPromiseLike$4(value)) {
45864
+ if (isPromiseLike$5(value)) {
45856
45865
  value.then(
45857
45866
  (_) => {
45858
45867
  settled = value;
@@ -45862,7 +45871,7 @@
45862
45871
  }
45863
45872
  );
45864
45873
  } else {
45865
- settled = resolvedPromiseLike$4(value);
45874
+ settled = resolvedPromiseLike$5(value);
45866
45875
  }
45867
45876
  if (settled !== void 0) {
45868
45877
  return settled;
@@ -46011,7 +46020,7 @@
46011
46020
  );
46012
46021
  }
46013
46022
  function setServices(services) {
46014
- waitForServices = resolvedPromiseLike$4(services);
46023
+ waitForServices = resolvedPromiseLike$5(services);
46015
46024
  servicesAvailable(services);
46016
46025
  }
46017
46026
 
@@ -61599,7 +61608,7 @@
61599
61608
  // Deep merge that works on GraphQL data. It:
61600
61609
  // - recursively merges any Object properties that are present in both
61601
61610
  // - recursively merges arrays by deepMerging each Object item in the array (by index).
61602
- function deepMerge$2(target, ...sources) {
61611
+ function deepMerge$3(target, ...sources) {
61603
61612
  for (const source of sources) {
61604
61613
  for (const key in source) {
61605
61614
  if (ObjectPrototypeHasOwnProperty$2.call(source, key)) {
@@ -61620,7 +61629,7 @@
61620
61629
  !Array.isArray(targetItem) &&
61621
61630
  sourceItem instanceof Object &&
61622
61631
  !Array.isArray(sourceItem)) {
61623
- return deepMerge$2({}, targetItem, sourceItem);
61632
+ return deepMerge$3({}, targetItem, sourceItem);
61624
61633
  }
61625
61634
  else {
61626
61635
  return sourceItem;
@@ -61631,7 +61640,7 @@
61631
61640
  !Array.isArray(targetValue) &&
61632
61641
  sourceValue instanceof Object &&
61633
61642
  !Array.isArray(sourceValue)) {
61634
- deepMerge$2(targetValue, sourceValue);
61643
+ deepMerge$3(targetValue, sourceValue);
61635
61644
  }
61636
61645
  else {
61637
61646
  target[key] = sourceValue;
@@ -79249,7 +79258,7 @@
79249
79258
  field.selectionSet?.selections.forEach((sel) => {
79250
79259
  const builtSelection = buildSelectionForNodeFn(source, reader, field, sel, variables, fragments, parentRecordId);
79251
79260
  if (builtSelection !== undefined) {
79252
- deepMerge$2(sink, builtSelection);
79261
+ deepMerge$3(sink, builtSelection);
79253
79262
  }
79254
79263
  });
79255
79264
  return sink;
@@ -81995,6 +82004,7 @@
81995
82004
  possibleStaleRecordMap: new Map(),
81996
82005
  draftFunctions,
81997
82006
  mappedCursors,
82007
+ missingFieldsMap: new Map(),
81998
82008
  };
81999
82009
  }
82000
82010
 
@@ -85596,8 +85606,17 @@
85596
85606
  field.resolve = connectionResolver;
85597
85607
  }
85598
85608
  else {
85599
- field.resolve = function recordFieldResolver({ recordRepresentation: record, }) {
85600
- return record.fields[field.name] || null;
85609
+ field.resolve = function recordFieldResolver({ recordRepresentation: record }, _args, { missingFieldsMap }) {
85610
+ const { id, fields } = record;
85611
+ const recordField = fields[field.name];
85612
+ // If the field is not present, add it to the missing fields map
85613
+ if (!recordField) {
85614
+ let missingFieldsSet = missingFieldsMap.get(id) ?? new Set();
85615
+ missingFieldsSet.add(field.name);
85616
+ missingFieldsMap.set(id, missingFieldsSet);
85617
+ return null;
85618
+ }
85619
+ return recordField;
85601
85620
  };
85602
85621
  }
85603
85622
  }
@@ -86188,6 +86207,7 @@
86188
86207
  result,
86189
86208
  seenRecordIds,
86190
86209
  possibleStaleRecordMap: contextValue.possibleStaleRecordMap,
86210
+ missingFieldsMap: contextValue.missingFieldsMap,
86191
86211
  };
86192
86212
  }
86193
86213
  finally {
@@ -87015,9 +87035,9 @@
87015
87035
  }
87016
87036
  // spanning field needs to have the directive with 'parentRelationship'
87017
87037
  const directives = isSpanning && !isInlineFragment ? [parentRelationshipDirective] : [];
87018
- let idField = isSpanning && !isPolymorphicField ? [createFieldNode('Id')] : [];
87038
+ let idField = isSpanning && !isPolymorphicField ? [createFieldNode$1('Id')] : [];
87019
87039
  // This variable change to InlineFragment if 'isInlineFragment' is true
87020
- let sel = createFieldNode(fieldName);
87040
+ let sel = createFieldNode$1(fieldName);
87021
87041
  // Check if fields is valid
87022
87042
  if (apiNames.length === 1 && !isInlineFragment) {
87023
87043
  const objectInfo = objectInfos[apiNames[0]];
@@ -87063,7 +87083,7 @@
87063
87083
  idField = [];
87064
87084
  }
87065
87085
  if (isInlineFragment && !isTypeNameExisting) {
87066
- idField.push(createFieldNode('__typename'));
87086
+ idField.push(createFieldNode$1('__typename'));
87067
87087
  }
87068
87088
  //Inject Conditions: 1. Same field does not exist 2. Same fields has different children. 3. Filter spanning field does not have Id. 4. InLineFragment does not have the '__typename' field
87069
87089
  if (!existingFields ||
@@ -87130,7 +87150,7 @@
87130
87150
  .filter(isFieldNode)
87131
87151
  .filter((subNode) => subNode.name.value === relationField);
87132
87152
  if (!existingRelationFields || existingRelationFields.length === 0) {
87133
- injectedSelections.push(createFieldNode(relationField, FieldValueNodeSelectionSet));
87153
+ injectedSelections.push(createFieldNode$1(relationField, FieldValueNodeSelectionSet));
87134
87154
  }
87135
87155
  }
87136
87156
  }
@@ -87221,7 +87241,7 @@
87221
87241
  .filter(isFieldNode)
87222
87242
  .filter((subNode) => subNode.name.value === 'value');
87223
87243
  return !existingValueFields || existingValueFields.length === 0
87224
- ? [createFieldNode('value')]
87244
+ ? [createFieldNode$1('value')]
87225
87245
  : [];
87226
87246
  }
87227
87247
  function updateIDInfo(fieldNode, idState, draftFunctions) {
@@ -87302,20 +87322,20 @@
87302
87322
  .filter(isFieldNode)
87303
87323
  .filter((subNode) => subNode.name.value === relationshipId);
87304
87324
  if (existingRelationFields.length === 0) {
87305
- parentInjectedNodes.push(createFieldNode(relationshipId, FieldValueNodeSelectionSet));
87325
+ parentInjectedNodes.push(createFieldNode$1(relationshipId, FieldValueNodeSelectionSet));
87306
87326
  }
87307
87327
  }
87308
87328
  // For polymorphic fields, the Id field is excluded.
87309
87329
  const excludeId = isPolymorphicFieldPath(curPath, pathToObjectApiNamesMap, objectInfos);
87310
87330
  const idSelection = [];
87311
87331
  if (!excludeId && hasIdNode === false) {
87312
- idSelection.push(createFieldNode('Id'));
87332
+ idSelection.push(createFieldNode$1('Id'));
87313
87333
  }
87314
87334
  // Inject '__typename' for InlineFragment. '__typename' field acts as a reference to concrete type of a polymorphic field or a standard field in the returned GQL response, which equals to
87315
87335
  // `typedCondition` of the InlineFragment in the query AST. It is used to match JSON response with AST node. For more detail, please reference 'removeSyntheticFields'.
87316
87336
  if (isInlineFragmentNode(selection) &&
87317
87337
  !selection.selectionSet.selections.find((selection) => isFieldNode(selection) && selection.name.value === '__typename')) {
87318
- idSelection.push(createFieldNode('__typename'));
87338
+ idSelection.push(createFieldNode$1('__typename'));
87319
87339
  }
87320
87340
  // 'ServiceAppointment' --> 'Contact' --> 'Id', Inject 'Contact' with Id. 'Id' field is at the sub level.
87321
87341
  if (idSelection.length > 0 || subInjectedSelections.length > 0) {
@@ -87359,7 +87379,7 @@
87359
87379
  objectInfo.nameFields !== undefined &&
87360
87380
  objectInfo.nameFields.length > 0) {
87361
87381
  displayValueNameFields = objectInfo.nameFields.map((fieldName) => {
87362
- return createFieldNode(fieldName, FieldValueNodeSelectionSet);
87382
+ return createFieldNode$1(fieldName, FieldValueNodeSelectionSet);
87363
87383
  });
87364
87384
  }
87365
87385
  }
@@ -87390,7 +87410,7 @@
87390
87410
  if (parentNode.name.value === 'node') {
87391
87411
  const idNode = findIdFieldNode(parentNode);
87392
87412
  if (idNode === false) {
87393
- rootQueryIdField.push(createFieldNode('Id'));
87413
+ rootQueryIdField.push(createFieldNode$1('Id'));
87394
87414
  }
87395
87415
  }
87396
87416
  // example { node { Id } }. The operation happens at the 'edges' -> 'node' level of the 'childRelationship' field
@@ -87418,7 +87438,7 @@
87418
87438
  .filter(isFieldNode)
87419
87439
  .some((sibling) => sibling.name.value === injectedParentFieldName)) {
87420
87440
  // example: TimeSheetId { value }
87421
- relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
87441
+ relatedIdForChildRelationship.push(createFieldNode$1(injectedParentFieldName, FieldValueNodeSelectionSet));
87422
87442
  }
87423
87443
  displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
87424
87444
  }
@@ -87870,7 +87890,7 @@
87870
87890
  * @param selectionSet
87871
87891
  * @returns
87872
87892
  */
87873
- function createFieldNode(nameValue, selectionSet) {
87893
+ function createFieldNode$1(nameValue, selectionSet) {
87874
87894
  return {
87875
87895
  kind: Kind$3.FIELD,
87876
87896
  name: {
@@ -88354,11 +88374,13 @@
88354
88374
  let gqlResult;
88355
88375
  let seenRecordIds;
88356
88376
  let possibleStaleRecordMap;
88377
+ let missingFieldsMap;
88357
88378
  try {
88358
88379
  ({
88359
88380
  result: gqlResult,
88360
88381
  seenRecordIds,
88361
88382
  possibleStaleRecordMap,
88383
+ missingFieldsMap,
88362
88384
  } = await evaluate({
88363
88385
  ...config,
88364
88386
  //need to create another copy of the ast for future writes
@@ -88388,13 +88410,23 @@
88388
88410
  const seenRecords = createSeenRecords(seenRecordIds, nonEvaluatedSnapshot);
88389
88411
  const recordId = generateUniqueRecordId();
88390
88412
  const rebuildWithLocalEval = async (originalSnapshot) => {
88391
- let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, } = await evaluate({
88413
+ let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, missingFieldsMap: rebuildMissingFieldsMap, } = await evaluate({
88392
88414
  ...config,
88393
88415
  query: injectedAST,
88394
88416
  }, observers, { userId }, objectInfoNeeded, store, originalSnapshot, graphqlSchemaCache, draftFunctions, mappedCursors);
88395
88417
  if (!rebuildResult.errors) {
88396
88418
  rebuildResult = removeSyntheticFields(rebuildResult, config.query);
88397
88419
  }
88420
+ // If the query includes any missing fields, we return an ErrorSnapshot
88421
+ // with a message that contains the missing fields for each record.
88422
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) &&
88423
+ rebuildMissingFieldsMap.size > 0) {
88424
+ const missingFieldsErrorSnapshot = createMissingFieldsErrorSnapshot(originalSnapshot, rebuildMissingFieldsMap);
88425
+ return {
88426
+ ...missingFieldsErrorSnapshot,
88427
+ rebuildWithLocalEval,
88428
+ };
88429
+ }
88398
88430
  let snapshotState = 'Fulfilled';
88399
88431
  if (possibleStaleRecordMap.size > 0) {
88400
88432
  initiateStaleRecordRefresh(luvio, possibleStaleRecordMap);
@@ -88429,6 +88461,10 @@
88429
88461
  },
88430
88462
  };
88431
88463
  }
88464
+ // If the query includes any missing fields, we return an ErrorSnapshot
88465
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) && missingFieldsMap.size > 0) {
88466
+ return createMissingFieldsErrorSnapshot(nonEvaluatedSnapshot, missingFieldsMap);
88467
+ }
88432
88468
  // if the non-eval'ed snapshot was an error then we return a synthetic
88433
88469
  // Fulfilled snapshot (this only happens in this code path if
88434
88470
  // the error is network error or 504), otherwise we spread over
@@ -88485,6 +88521,30 @@
88485
88521
  records,
88486
88522
  };
88487
88523
  }
88524
+ /**
88525
+ * Creates an ErrorSnapshot with a message that contains the missing fields for each record.
88526
+ * @param originalSnapshot The original snapshot that is being rebuilt.
88527
+ * @param missingFieldsMap A map of record ids to the fields that are missing.
88528
+ * @returns An ErrorSnapshot with a message that contains the missing fields for each record.
88529
+ */
88530
+ function createMissingFieldsErrorSnapshot(originalSnapshot, missingFieldsMap) {
88531
+ const message = Array.from(missingFieldsMap)
88532
+ .map(([id, fields]) => `Missing fields for record ${id}: ${Array.from(fields).join(', ')}`)
88533
+ .join('; ');
88534
+ return {
88535
+ ...originalSnapshot,
88536
+ data: undefined,
88537
+ state: 'Error',
88538
+ error: {
88539
+ errorType: 'adapterError',
88540
+ error: [
88541
+ {
88542
+ message,
88543
+ },
88544
+ ],
88545
+ },
88546
+ };
88547
+ }
88488
88548
 
88489
88549
  function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy) {
88490
88550
  return async function environmentAwareGraphQLBatchAdapter(config, requestContext = {}) {
@@ -93884,13 +93944,13 @@
93884
93944
  }
93885
93945
  return new Error(typeof x === "string" ? x : JSON.stringify(x));
93886
93946
  }
93887
- class InternalError extends Error {
93947
+ let InternalError$1 = class InternalError extends Error {
93888
93948
  constructor(data) {
93889
93949
  super();
93890
93950
  this.data = data;
93891
93951
  this.type = "internal";
93892
93952
  }
93893
- }
93953
+ };
93894
93954
  class UserVisibleError extends Error {
93895
93955
  constructor(data) {
93896
93956
  super();
@@ -93962,7 +94022,7 @@
93962
94022
  async afterRequestHooks(_options) {
93963
94023
  }
93964
94024
  };
93965
- function buildServiceDescriptor$g() {
94025
+ function buildServiceDescriptor$h() {
93966
94026
  return {
93967
94027
  type: "networkCommandBaseClass",
93968
94028
  version: "1.0",
@@ -94064,7 +94124,7 @@
94064
94124
  return resolvedPromiseLike$3(err$1$1(toError("Aura/Fetch network services not found")));
94065
94125
  }
94066
94126
  }
94067
- function buildServiceDescriptor$f() {
94127
+ function buildServiceDescriptor$g() {
94068
94128
  return {
94069
94129
  type: "auraNetworkCommandBaseClass",
94070
94130
  version: "1.0",
@@ -94564,7 +94624,7 @@
94564
94624
  return resolvedPromiseLike$3(void 0);
94565
94625
  }
94566
94626
  }
94567
- function buildServiceDescriptor$e() {
94627
+ function buildServiceDescriptor$f() {
94568
94628
  return {
94569
94629
  type: "auraNormalizedCacheControlCommand",
94570
94630
  version: "1.0",
@@ -94710,7 +94770,7 @@
94710
94770
  return `{"endpoint":${this.endpoint},"params":${stableJSONStringify$2(this.auraParams)}}`;
94711
94771
  }
94712
94772
  }
94713
- function buildServiceDescriptor$d() {
94773
+ function buildServiceDescriptor$e() {
94714
94774
  return {
94715
94775
  type: "auraResourceCacheControlCommand",
94716
94776
  version: "1.0",
@@ -94817,7 +94877,7 @@
94817
94877
  );
94818
94878
  }
94819
94879
  }
94820
- function buildServiceDescriptor$c() {
94880
+ function buildServiceDescriptor$d() {
94821
94881
  return {
94822
94882
  type: "fetchNetworkCommandBaseClass",
94823
94883
  version: "1.0",
@@ -94906,7 +94966,7 @@
94906
94966
  return resolvedPromiseLike$3(void 0);
94907
94967
  }
94908
94968
  }
94909
- function buildServiceDescriptor$b() {
94969
+ function buildServiceDescriptor$c() {
94910
94970
  return {
94911
94971
  type: "httpNormalizedCacheControlCommand",
94912
94972
  version: "1.0",
@@ -95159,7 +95219,7 @@
95159
95219
  return new FixedTimeWritableCache$1(this, generatedTime);
95160
95220
  }
95161
95221
  };
95162
- function buildServiceDescriptor$a() {
95222
+ function buildServiceDescriptor$b() {
95163
95223
  return {
95164
95224
  type: "cache",
95165
95225
  version: "1.0",
@@ -95327,7 +95387,7 @@
95327
95387
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
95328
95388
  }
95329
95389
  }
95330
- function buildServiceDescriptor$9(cache, cacheInclusionPolicy) {
95390
+ function buildServiceDescriptor$a(cache, cacheInclusionPolicy) {
95331
95391
  return {
95332
95392
  type: "cacheController",
95333
95393
  version: "1.0",
@@ -95373,7 +95433,7 @@
95373
95433
  };
95374
95434
  };
95375
95435
  }
95376
- function buildServiceDescriptor$8(instrumentation) {
95436
+ function buildServiceDescriptor$9(instrumentation) {
95377
95437
  return {
95378
95438
  type: "instrumentCommand",
95379
95439
  version: "1.0",
@@ -95643,7 +95703,7 @@
95643
95703
  this.metrics = new O11yOTelMetricsAPI(this.services);
95644
95704
  }
95645
95705
  }
95646
- function buildServiceDescriptor$7(logger) {
95706
+ function buildServiceDescriptor$8(logger) {
95647
95707
  return {
95648
95708
  type: "instrumentation",
95649
95709
  version: "1.0",
@@ -95753,7 +95813,7 @@
95753
95813
  return matchingSubscriptions;
95754
95814
  }
95755
95815
  }
95756
- function buildServiceDescriptor$6() {
95816
+ function buildServiceDescriptor$7() {
95757
95817
  return {
95758
95818
  type: "pubSub",
95759
95819
  version: "1.0",
@@ -95777,7 +95837,7 @@
95777
95837
  return this.flags.get(flagName) || defaultValue;
95778
95838
  }
95779
95839
  }
95780
- function buildServiceDescriptor$5() {
95840
+ function buildServiceDescriptor$6() {
95781
95841
  return {
95782
95842
  version: "1.0",
95783
95843
  service: new FeatureFlagsService(),
@@ -95818,7 +95878,7 @@
95818
95878
  * };
95819
95879
  * ```
95820
95880
  */
95821
- function buildServiceDescriptor$4(luvio) {
95881
+ function buildServiceDescriptor$5(luvio) {
95822
95882
  return {
95823
95883
  type: 'luvio',
95824
95884
  version: '1.0',
@@ -95827,7 +95887,33 @@
95827
95887
  },
95828
95888
  };
95829
95889
  }
95830
- // version: 1.377.0-b0d5c49e07
95890
+ // version: 1.377.1-db77d3f339
95891
+
95892
+ /**
95893
+ * Copyright (c) 2022, Salesforce, Inc.,
95894
+ * All rights reserved.
95895
+ * For full license text, see the LICENSE.txt file
95896
+ */
95897
+
95898
+ /*
95899
+ * ATTENTION!
95900
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
95901
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
95902
+ * Any changes made to this file in p4 will be automatically overwritten.
95903
+ * *******************************************************************************************
95904
+ */
95905
+ /* proxy-compat-disable */
95906
+ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvioRecord) {
95907
+ return {
95908
+ type: 'luvioUiapiRecords',
95909
+ version: '1.0',
95910
+ service: {
95911
+ notifyRecordUpdateAvailable,
95912
+ getNormalizedLuvioRecord,
95913
+ },
95914
+ };
95915
+ }
95916
+ // version: 1.377.1-db77d3f339
95831
95917
 
95832
95918
  /*!
95833
95919
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96694,7 +96780,7 @@
96694
96780
  }
96695
96781
  return err$1$1(new Error("Multiple operations found in query, and no operation name provided"));
96696
96782
  }
96697
- function buildGraphQLInputExtension(input) {
96783
+ function buildGraphQLInputExtension$1(input) {
96698
96784
  const operationResult = findExecutableOperation$1(input);
96699
96785
  if (operationResult.isErr()) {
96700
96786
  return err$1$1(operationResult.error);
@@ -96737,7 +96823,7 @@
96737
96823
  return this.documentRootType;
96738
96824
  }
96739
96825
  buildQuery() {
96740
- const extensionResult = buildGraphQLInputExtension(this.config);
96826
+ const extensionResult = buildGraphQLInputExtension$1(this.config);
96741
96827
  if (extensionResult.isErr()) {
96742
96828
  throw extensionResult.error;
96743
96829
  }
@@ -96846,12 +96932,12 @@
96846
96932
  return augmentedQueryResult.value;
96847
96933
  }
96848
96934
  buildWriteInput(data) {
96849
- const extensionResult = buildGraphQLInputExtension({
96935
+ const extensionResult = buildGraphQLInputExtension$1({
96850
96936
  ...this.config,
96851
96937
  query: this.buildRequestQuery()
96852
96938
  });
96853
96939
  if (extensionResult.isErr()) {
96854
- throw new InternalError(extensionResult.error);
96940
+ throw new InternalError$1(extensionResult.error);
96855
96941
  }
96856
96942
  return { data: data.data, ...extensionResult.value };
96857
96943
  }
@@ -96896,7 +96982,7 @@
96896
96982
  return this.documentRootType;
96897
96983
  }
96898
96984
  buildQuery() {
96899
- const extensionResult = buildGraphQLInputExtension(this.config);
96985
+ const extensionResult = buildGraphQLInputExtension$1(this.config);
96900
96986
  if (extensionResult.isErr()) {
96901
96987
  throw extensionResult.error;
96902
96988
  }
@@ -96940,12 +97026,12 @@
96940
97026
  return augmentedQueryResult.value;
96941
97027
  }
96942
97028
  buildWriteInput(data) {
96943
- const extensionResult = buildGraphQLInputExtension({
97029
+ const extensionResult = buildGraphQLInputExtension$1({
96944
97030
  ...this.config,
96945
97031
  query: this.buildRequestQuery()
96946
97032
  });
96947
97033
  if (extensionResult.isErr()) {
96948
- throw new InternalError(extensionResult.error);
97034
+ throw new InternalError$1(extensionResult.error);
96949
97035
  }
96950
97036
  return { data: data.data, ...extensionResult.value };
96951
97037
  }
@@ -97188,41 +97274,41 @@
97188
97274
  }
97189
97275
  return differenceSet;
97190
97276
  }
97191
- function resolvedPromiseLike(result) {
97192
- if (isPromiseLike(result)) {
97277
+ function resolvedPromiseLike$4(result) {
97278
+ if (isPromiseLike$4(result)) {
97193
97279
  return result.then((nextResult) => nextResult);
97194
97280
  }
97195
97281
  return {
97196
97282
  then: (onFulfilled, _onRejected) => {
97197
97283
  try {
97198
- return resolvedPromiseLike(onFulfilled(result));
97284
+ return resolvedPromiseLike$4(onFulfilled(result));
97199
97285
  } catch (e) {
97200
97286
  if (onFulfilled === void 0) {
97201
- return resolvedPromiseLike(result);
97287
+ return resolvedPromiseLike$4(result);
97202
97288
  }
97203
- return rejectedPromiseLike(e);
97289
+ return rejectedPromiseLike$4(e);
97204
97290
  }
97205
97291
  }
97206
97292
  };
97207
97293
  }
97208
- function rejectedPromiseLike(reason) {
97209
- if (isPromiseLike(reason)) {
97294
+ function rejectedPromiseLike$4(reason) {
97295
+ if (isPromiseLike$4(reason)) {
97210
97296
  return reason.then((nextResult) => nextResult);
97211
97297
  }
97212
97298
  return {
97213
97299
  then: (_onFulfilled, onRejected) => {
97214
97300
  if (typeof onRejected === "function") {
97215
97301
  try {
97216
- return resolvedPromiseLike(onRejected(reason));
97302
+ return resolvedPromiseLike$4(onRejected(reason));
97217
97303
  } catch (e) {
97218
- return rejectedPromiseLike(e);
97304
+ return rejectedPromiseLike$4(e);
97219
97305
  }
97220
97306
  }
97221
- return rejectedPromiseLike(reason);
97307
+ return rejectedPromiseLike$4(reason);
97222
97308
  }
97223
97309
  };
97224
97310
  }
97225
- function isPromiseLike(x) {
97311
+ function isPromiseLike$4(x) {
97226
97312
  return typeof (x == null ? void 0 : x.then) === "function";
97227
97313
  }
97228
97314
  /*!
@@ -97511,7 +97597,7 @@
97511
97597
  tempL1.keysUpdated.forEach((key) => keysToReviveRecordableCache.get(key));
97512
97598
  tempL1.missingKeysRead.forEach((key) => keysToReviveRecordableCache.get(key));
97513
97599
  const missingKeys = keysToReviveRecordableCache.missingKeysRead;
97514
- const revivePromiseLike = missingKeys.size > 0 ? this.revive(missingKeys, l1).then(() => void 0) : resolvedPromiseLike(void 0);
97600
+ const revivePromiseLike = missingKeys.size > 0 ? this.revive(missingKeys, l1).then(() => void 0) : resolvedPromiseLike$4(void 0);
97515
97601
  return revivePromiseLike.then(() => {
97516
97602
  const recordableCache = l1.record();
97517
97603
  return writeToL1(recordableCache).then((result) => {
@@ -97704,10 +97790,10 @@
97704
97790
  globalThis.performance = { now: () => Date.now() };
97705
97791
  }
97706
97792
  const loggerService = new ConsoleLogger('ERROR');
97707
- const cacheServiceDescriptor = buildServiceDescriptor$a();
97708
- const instrumentationServiceDescriptor = buildServiceDescriptor$7(loggerService);
97793
+ const cacheServiceDescriptor = buildServiceDescriptor$b();
97794
+ const instrumentationServiceDescriptor = buildServiceDescriptor$8(loggerService);
97709
97795
  const nimbusSqliteOneStoreCacheServiceDescriptor = buildNimbusDurableCacheInclusionPolicyService(cacheServiceDescriptor.service, new NimbusSqliteOneStoreCache(sqliteStore));
97710
- const featureFlagsServiceDescriptor = buildServiceDescriptor$5();
97796
+ const featureFlagsServiceDescriptor = buildServiceDescriptor$6();
97711
97797
  const featureFlagsService = featureFlagsServiceDescriptor.service;
97712
97798
  // This disables the OneStore GraphQL in this runtime
97713
97799
  // We made the decision to continue using the Luvio based version in Mobile
@@ -97717,21 +97803,22 @@
97717
97803
  const services = [
97718
97804
  instrumentationServiceDescriptor,
97719
97805
  buildNimbusFetchServiceDescriptor(),
97720
- buildServiceDescriptor$8(instrumentationServiceDescriptor.service),
97806
+ buildServiceDescriptor$9(instrumentationServiceDescriptor.service),
97721
97807
  // NOTE: These do not directly depend on Aura, and are necessary for HTTP fallback support.
97808
+ buildServiceDescriptor$g(),
97722
97809
  buildServiceDescriptor$f(),
97723
97810
  buildServiceDescriptor$e(),
97811
+ buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
97724
97812
  buildServiceDescriptor$d(),
97725
- buildServiceDescriptor$9(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
97813
+ buildServiceDescriptor$h(),
97726
97814
  buildServiceDescriptor$c(),
97727
- buildServiceDescriptor$g(),
97728
- buildServiceDescriptor$b(),
97729
- buildServiceDescriptor$6(),
97815
+ buildServiceDescriptor$7(),
97730
97816
  buildServiceDescriptor$3(),
97731
97817
  buildServiceDescriptor$2(),
97732
97818
  featureFlagsServiceDescriptor,
97733
97819
  // Luvio service won't be used since we set the useOneStoreGraphQL flag to false
97734
- buildServiceDescriptor$4({}),
97820
+ buildServiceDescriptor$5({}),
97821
+ buildServiceDescriptor$4({}, {}),
97735
97822
  // TODO[@W-18753648]: See note above.
97736
97823
  // buildStreamingCommandServiceDescriptor(),
97737
97824
  // buildNdJsonServiceDescriptor(),
@@ -97942,7 +98029,7 @@
97942
98029
  id: '@salesforce/lds-network-adapter',
97943
98030
  instrument: instrument$2,
97944
98031
  });
97945
- // version: 1.377.0-3c95caf11c
98032
+ // version: 1.377.1-dadb6358f3
97946
98033
 
97947
98034
  const { create: create$3, keys: keys$3 } = Object;
97948
98035
  const { stringify: stringify$1, parse } = JSON;
@@ -98832,7 +98919,7 @@
98832
98919
  new Error(`Expected ${expectedTypeString}, but got ${actualType}: ${JSON.stringify(value)}`)
98833
98920
  );
98834
98921
  }
98835
- function deepMerge$1(target, ...sources) {
98922
+ function deepMerge$2(target, ...sources) {
98836
98923
  for (const source of sources) {
98837
98924
  for (const key in source) {
98838
98925
  if (hasOwnProperty$2.call(source, key)) {
@@ -98848,13 +98935,13 @@
98848
98935
  } else if (sourceItem === void 0) {
98849
98936
  return targetItem;
98850
98937
  } else if (targetItem instanceof Object && !Array.isArray(targetItem) && sourceItem instanceof Object && !Array.isArray(sourceItem)) {
98851
- return deepMerge$1({}, targetItem, sourceItem);
98938
+ return deepMerge$2({}, targetItem, sourceItem);
98852
98939
  } else {
98853
98940
  return sourceItem;
98854
98941
  }
98855
98942
  });
98856
98943
  } else if (targetValue instanceof Object && !Array.isArray(targetValue) && sourceValue instanceof Object && !Array.isArray(sourceValue)) {
98857
- deepMerge$1(
98944
+ deepMerge$2(
98858
98945
  targetValue,
98859
98946
  sourceValue
98860
98947
  );
@@ -98888,6 +98975,32 @@
98888
98975
  }
98889
98976
  return err$4(new Error("Multiple operations found in query, and no operation name provided"));
98890
98977
  }
98978
+ function buildGraphQLInputExtension(input) {
98979
+ const operationResult = findExecutableOperation(input);
98980
+ if (operationResult.isErr()) {
98981
+ return err$4(operationResult.error);
98982
+ }
98983
+ const operation = operationResult.value;
98984
+ const selections = operation.selectionSet.selections;
98985
+ const variableDefinitions = operation.variableDefinitions;
98986
+ const variables = (variableDefinitions == null ? void 0 : variableDefinitions.reduce((prev, def) => {
98987
+ var _a;
98988
+ prev[def.variable.name.value] = {
98989
+ definition: def,
98990
+ value: (_a = input.variables) == null ? void 0 : _a[def.variable.name.value]
98991
+ };
98992
+ return prev;
98993
+ }, {})) || {};
98994
+ const fragments = input.query.definitions.filter((def) => def.kind === "FragmentDefinition").reduce((prev, fragment) => {
98995
+ prev[fragment.name.value] = fragment;
98996
+ return prev;
98997
+ }, {});
98998
+ return ok$4({
98999
+ selections,
99000
+ request: { definitions: { variables, fragments } },
99001
+ parentFieldSelection: void 0
99002
+ });
99003
+ }
98891
99004
  function buildUniqueAugmentedFieldSelection(newSelection, selections, fragments) {
98892
99005
  var _a;
98893
99006
  const baseAlias = ((_a = newSelection.alias) == null ? void 0 : _a.value) || newSelection.name.value;
@@ -99114,7 +99227,7 @@
99114
99227
  const errors = [];
99115
99228
  for (const selection of input.selections) {
99116
99229
  if (selection.kind === Kind.FIELD) {
99117
- deepMerge$1(
99230
+ deepMerge$2(
99118
99231
  normalized,
99119
99232
  this.normalizeFieldSelection(cache, input, selection, errors)
99120
99233
  );
@@ -99135,7 +99248,7 @@
99135
99248
  ]
99136
99249
  };
99137
99250
  }
99138
- deepMerge$1(normalized, this.normalizeFragment(cache, input, fragment, errors));
99251
+ deepMerge$2(normalized, this.normalizeFragment(cache, input, fragment, errors));
99139
99252
  }
99140
99253
  }
99141
99254
  return buildReadWriteResult(normalized, errors);
@@ -99229,7 +99342,7 @@
99229
99342
  const denormalized = {};
99230
99343
  for (const selection of input.selections) {
99231
99344
  if (selection.kind === Kind.FIELD) {
99232
- deepMerge$1(
99345
+ deepMerge$2(
99233
99346
  denormalized,
99234
99347
  this.denormalizeFieldSelection(cache, input, selection, errors)
99235
99348
  );
@@ -99250,7 +99363,7 @@
99250
99363
  ]
99251
99364
  };
99252
99365
  }
99253
- deepMerge$1(denormalized, this.denormalizeFragment(cache, input, fragment, errors));
99366
+ deepMerge$2(denormalized, this.denormalizeFragment(cache, input, fragment, errors));
99254
99367
  }
99255
99368
  }
99256
99369
  return buildReadWriteResult(denormalized, errors);
@@ -99466,7 +99579,7 @@
99466
99579
  return normalizeDataResult;
99467
99580
  }
99468
99581
  return ok$4(
99469
- deepMerge$1(
99582
+ deepMerge$2(
99470
99583
  {},
99471
99584
  (existingNormalizedData == null ? void 0 : existingNormalizedData.value) || {},
99472
99585
  normalizeDataResult.value
@@ -100371,7 +100484,7 @@
100371
100484
  };
100372
100485
  return { invoke, subscribe };
100373
100486
  }
100374
- // version: 1.377.0-b0d5c49e07
100487
+ // version: 1.377.1-db77d3f339
100375
100488
 
100376
100489
  class Analytics__AnalyticsBrowseRepository extends UnidentifiableGraphQLTypeRepository {
100377
100490
  constructor(services, typeRegistry) {
@@ -103055,6 +103168,50 @@
103055
103168
  }
103056
103169
  const ok = (value) => new Ok(value);
103057
103170
  const err = (err2) => new Err(err2);
103171
+ function resolvedPromiseLike(result) {
103172
+ if (isPromiseLike(result)) {
103173
+ return result.then((nextResult) => nextResult);
103174
+ }
103175
+ return {
103176
+ then: (onFulfilled, _onRejected) => {
103177
+ try {
103178
+ return resolvedPromiseLike(onFulfilled(result));
103179
+ } catch (e) {
103180
+ if (onFulfilled === void 0) {
103181
+ return resolvedPromiseLike(result);
103182
+ }
103183
+ return rejectedPromiseLike(e);
103184
+ }
103185
+ }
103186
+ };
103187
+ }
103188
+ function rejectedPromiseLike(reason) {
103189
+ if (isPromiseLike(reason)) {
103190
+ return reason.then((nextResult) => nextResult);
103191
+ }
103192
+ return {
103193
+ then: (_onFulfilled, onRejected) => {
103194
+ if (typeof onRejected === "function") {
103195
+ try {
103196
+ return resolvedPromiseLike(onRejected(reason));
103197
+ } catch (e) {
103198
+ return rejectedPromiseLike(e);
103199
+ }
103200
+ }
103201
+ return rejectedPromiseLike(reason);
103202
+ }
103203
+ };
103204
+ }
103205
+ function isPromiseLike(x) {
103206
+ return typeof (x == null ? void 0 : x.then) === "function";
103207
+ }
103208
+ class InternalError extends Error {
103209
+ constructor(data) {
103210
+ super();
103211
+ this.data = data;
103212
+ this.type = "internal";
103213
+ }
103214
+ }
103058
103215
 
103059
103216
  function buildGenericTypeFieldDef(selection, fields, staticFieldNames, typename) {
103060
103217
  // If the field is not a category field, return the base field def for the field
@@ -103172,12 +103329,25 @@
103172
103329
  }
103173
103330
  write(cache, input) {
103174
103331
  const result = super.write(cache, input);
103175
- input.data.Id;
103332
+ const recordId = input.data.Id;
103333
+ const luvioRecord = input.getNormalizedLuvioRecord(recordId, input.reader);
103334
+ if (luvioRecord?.weakEtag &&
103335
+ input.data?.WeakEtag &&
103336
+ luvioRecord.weakEtag !== input.data.WeakEtag) {
103337
+ input.luvioRecordIdsToInvalidate.push(recordId);
103338
+ }
103176
103339
  return result;
103177
103340
  }
103178
103341
  read(cache, input) {
103179
103342
  const result = super.read(cache, input);
103180
- // TODO: read luvio record to track subscription
103343
+ const idData = super.read(cache, {
103344
+ ...input,
103345
+ selections: [{ kind: 'Field', name: { kind: 'Name', value: 'Id' } }],
103346
+ });
103347
+ if (idData.isOk()) {
103348
+ // Read the record to track subscription
103349
+ input.getNormalizedLuvioRecord(idData.value.Id, input.reader);
103350
+ }
103181
103351
  return result;
103182
103352
  }
103183
103353
  }
@@ -103459,6 +103629,155 @@
103459
103629
  }
103460
103630
 
103461
103631
  const CONFIG_SCHEMA = GraphQLQueryJsonSchema;
103632
+
103633
+ // Fields with arguments need to be aliased to avoid a potential conflict.
103634
+ const ALIASED_FIELDS = {
103635
+ ldsRecordTypeId: {
103636
+ kind: Kind$1.FIELD,
103637
+ name: {
103638
+ kind: Kind$1.NAME,
103639
+ value: 'RecordTypeId',
103640
+ },
103641
+ arguments: [
103642
+ {
103643
+ kind: Kind$1.ARGUMENT,
103644
+ name: {
103645
+ kind: Kind$1.NAME,
103646
+ value: 'fallback',
103647
+ },
103648
+ value: {
103649
+ kind: Kind$1.BOOLEAN,
103650
+ value: true,
103651
+ },
103652
+ },
103653
+ ],
103654
+ alias: {
103655
+ kind: Kind$1.NAME,
103656
+ value: 'ldsRecordTypeId',
103657
+ },
103658
+ },
103659
+ };
103660
+ // TODO: export graphql's deepMerge from @luvio/graphql-normalization? Promote to @luvio/utils?
103661
+ function deepMerge$1(target, source) {
103662
+ if (source === null || source === undefined)
103663
+ return target;
103664
+ if (target === null || target === undefined)
103665
+ return source;
103666
+ if (typeof source !== 'object' || typeof target !== 'object') {
103667
+ return source;
103668
+ }
103669
+ if (Array.isArray(source)) {
103670
+ return source;
103671
+ }
103672
+ const result = { ...target };
103673
+ for (const key of Object.keys(source)) {
103674
+ if (key === 'extensions') {
103675
+ // Skip extensions key from final result
103676
+ continue;
103677
+ }
103678
+ if (source[key] !== null &&
103679
+ typeof source[key] === 'object' &&
103680
+ !Array.isArray(source[key])) {
103681
+ result[key] = deepMerge$1(result[key], source[key]);
103682
+ }
103683
+ else {
103684
+ result[key] = source[key];
103685
+ }
103686
+ }
103687
+ return result;
103688
+ }
103689
+ function createFieldNode(name, data) {
103690
+ if (name === '__genericTypename') {
103691
+ return undefined;
103692
+ }
103693
+ const baseField = ALIASED_FIELDS[name] ?? {
103694
+ kind: Kind$1.FIELD,
103695
+ name: {
103696
+ kind: Kind$1.NAME,
103697
+ value: name,
103698
+ },
103699
+ };
103700
+ if (typeof data === 'object' && data !== null && data !== undefined) {
103701
+ if (Array.isArray(data)) {
103702
+ // For arrays, we need to merge the structure from all non-null elements
103703
+ // to capture the full schema, not just the first element
103704
+ let mergedStructure = {};
103705
+ for (const item of data) {
103706
+ if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
103707
+ mergedStructure = deepMerge$1(mergedStructure, item);
103708
+ }
103709
+ }
103710
+ if (Object.keys(mergedStructure).length > 0) {
103711
+ baseField.selectionSet = {
103712
+ kind: Kind$1.SELECTION_SET,
103713
+ selections: Object.entries(mergedStructure)
103714
+ .map(([key, value]) => createFieldNode(key, value))
103715
+ .filter((node) => node !== undefined),
103716
+ };
103717
+ }
103718
+ }
103719
+ else {
103720
+ baseField.selectionSet = {
103721
+ kind: Kind$1.SELECTION_SET,
103722
+ selections: Object.entries(data)
103723
+ .map(([key, value]) => createFieldNode(key, value))
103724
+ .filter((node) => node !== undefined),
103725
+ };
103726
+ }
103727
+ }
103728
+ return baseField;
103729
+ }
103730
+ function createASTFromExtensions(extensions) {
103731
+ const fieldNodes = Object.entries(extensions)
103732
+ .map(([field, value]) => createFieldNode(field, value))
103733
+ .filter((node) => node !== undefined);
103734
+ return {
103735
+ kind: Kind$1.SELECTION_SET,
103736
+ selections: fieldNodes,
103737
+ };
103738
+ }
103739
+ function mergeASTs(query, extensionsAST) {
103740
+ return {
103741
+ ...query,
103742
+ definitions: query.definitions.map((def) => {
103743
+ if (def.kind === Kind$1.OPERATION_DEFINITION) {
103744
+ return {
103745
+ ...def,
103746
+ selectionSet: {
103747
+ kind: Kind$1.SELECTION_SET,
103748
+ selections: [...def.selectionSet.selections, ...extensionsAST.selections],
103749
+ },
103750
+ };
103751
+ }
103752
+ return def;
103753
+ }),
103754
+ };
103755
+ }
103756
+ /**
103757
+ * Augments a query with the extensions from a response. The general algorithm is:
103758
+ * 1. Create an AST from just the extensions.
103759
+ * 2. Deep merge the extensions AST into the query AST.
103760
+ * 3. Deep merge the extensions into the response data.
103761
+ * 4. Return the augmented query and response.
103762
+ * @param query - The query to augment.
103763
+ * @param response - The response to augment the query with.
103764
+ * @returns The augmented query and response.
103765
+ */
103766
+ function augmentQueryByResponse(query, response) {
103767
+ const extensions = response.extensions?.lds || {};
103768
+ const extensionsAST = createASTFromExtensions(extensions);
103769
+ const augmentedQuery = mergeASTs(query, extensionsAST);
103770
+ // Deep merge extensions into data, removing extensions key from result
103771
+ const mergedData = deepMerge$1(response.data, extensions);
103772
+ return {
103773
+ query: augmentedQuery,
103774
+ response: {
103775
+ data: mergedData,
103776
+ ...(response.errors && { errors: response.errors }),
103777
+ },
103778
+ };
103779
+ }
103780
+
103462
103781
  function buildCommandClass(baseClass) {
103463
103782
  return class extends baseClass {
103464
103783
  constructor(config, documentRootType, services) {
@@ -103466,21 +103785,169 @@
103466
103785
  this.config = config;
103467
103786
  this.documentRootType = documentRootType;
103468
103787
  this.services = services;
103469
- this.endpoint = "RecordUiController.executeGraphQL";
103470
- this.operationType = "graphql";
103788
+ this.endpoint = 'RecordUiController.executeGraphQL';
103789
+ }
103790
+ get url() {
103791
+ return '/graphql';
103471
103792
  }
103472
103793
  get cacheControlStrategyConfig() {
103473
103794
  return {
103474
- type: "max-age",
103795
+ type: 'max-age',
103475
103796
  requestMaxAge: 60,
103476
103797
  now: Date.now() / 1000,
103477
103798
  };
103478
103799
  }
103479
- get url() {
103480
- return "/graphql";
103481
- }
103482
103800
  get auraBodyWrapperName() {
103483
- return "queryInput";
103801
+ return 'queryInput';
103802
+ }
103803
+ get auraParams() {
103804
+ const params = super.auraParams;
103805
+ const body = params[this.auraBodyWrapperName];
103806
+ return {
103807
+ ...params,
103808
+ [this.auraBodyWrapperName]: {
103809
+ ...body,
103810
+ extensions: {
103811
+ ldsRequiredFields: true,
103812
+ },
103813
+ },
103814
+ };
103815
+ }
103816
+ get fetchParams() {
103817
+ const [url, params] = super.fetchParams;
103818
+ const body = JSON.parse(params.body);
103819
+ const modifiedBody = {
103820
+ ...body,
103821
+ extensions: {
103822
+ ldsRequiredFields: true,
103823
+ },
103824
+ };
103825
+ return [
103826
+ url,
103827
+ {
103828
+ ...params,
103829
+ body: JSON.stringify(modifiedBody),
103830
+ },
103831
+ ];
103832
+ }
103833
+ buildWriteInput(data) {
103834
+ this.latestLuvioRecordIdsToInvalidate = [];
103835
+ const baseQuery = this.buildRequestQuery();
103836
+ const { query: augmentedQuery, response: augmentedData } = augmentQueryByResponse(baseQuery, data);
103837
+ const extensionResult = buildGraphQLInputExtension({
103838
+ ...this.config,
103839
+ query: augmentedQuery,
103840
+ });
103841
+ if (extensionResult.isErr()) {
103842
+ throw new InternalError(extensionResult.error);
103843
+ }
103844
+ return {
103845
+ data: augmentedData.data,
103846
+ ...extensionResult.value,
103847
+ luvioRecordIdsToInvalidate: this.latestLuvioRecordIdsToInvalidate,
103848
+ };
103849
+ }
103850
+ readFromCache(cache) {
103851
+ let readFromCacheResult = undefined;
103852
+ try {
103853
+ const luvioService = this.services.luvio;
103854
+ const luvioInstance = luvioService.luvio;
103855
+ // Create a Luvio reader and get the latest snapshot
103856
+ this.latestLuvioSnapshot = luvioInstance.storeLookup({
103857
+ recordId: 'onestore-graphql',
103858
+ node: {
103859
+ kind: 'Fragment',
103860
+ reader: true,
103861
+ synthetic: true,
103862
+ read: (reader) => {
103863
+ readFromCacheResult = this.buildResultType().query(cache, {
103864
+ ...this.buildQuery(),
103865
+ reader,
103866
+ getNormalizedLuvioRecord: this.services.luvioUiapiRecords.getNormalizedLuvioRecord,
103867
+ });
103868
+ return readFromCacheResult;
103869
+ },
103870
+ },
103871
+ variables: {},
103872
+ });
103873
+ }
103874
+ catch (error) {
103875
+ return resolvedPromiseLike(err(error));
103876
+ }
103877
+ const readResult = readFromCacheResult;
103878
+ if (readResult === undefined) {
103879
+ return resolvedPromiseLike(err(new Error('No result from query')));
103880
+ }
103881
+ // Convert ReadResult to Result<any, Error>
103882
+ if (readResult.isErr()) {
103883
+ return resolvedPromiseLike(err(new Error('Failed to find data in cache')));
103884
+ }
103885
+ return resolvedPromiseLike(ok(readResult.value));
103886
+ }
103887
+ writeToCache(cache, networkResult) {
103888
+ try {
103889
+ const luvioService = this.services.luvio;
103890
+ const luvioInstance = luvioService.luvio;
103891
+ // Create a Luvio reader to allow the record representation type to lookup records in luvio
103892
+ // and mark them as needing invalidation when necessary
103893
+ luvioInstance.storeLookup({
103894
+ recordId: 'onestore-graphql',
103895
+ node: {
103896
+ kind: 'Fragment',
103897
+ reader: true,
103898
+ synthetic: true,
103899
+ read: (reader) => {
103900
+ if (networkResult.isOk()) {
103901
+ const x = this.buildResultType().write(cache.buildFixedTimeWritableCache(Date.now() / 1000), {
103902
+ ...this.buildWriteInput(networkResult.value),
103903
+ reader,
103904
+ getNormalizedLuvioRecord: this.services.luvioUiapiRecords
103905
+ .getNormalizedLuvioRecord,
103906
+ });
103907
+ }
103908
+ },
103909
+ },
103910
+ variables: {},
103911
+ });
103912
+ }
103913
+ catch (error) {
103914
+ // swallow error
103915
+ console.error(error);
103916
+ }
103917
+ return resolvedPromiseLike(undefined);
103918
+ }
103919
+ execute() {
103920
+ // Clear snapshot and unsubscribe from any existing subscriptions at the beginning of execute calls
103921
+ this.latestLuvioSnapshot = undefined;
103922
+ this.latestLuvioRecordIdsToInvalidate = undefined;
103923
+ if (this.unsubscribeFromLuvioSnapshot) {
103924
+ this.unsubscribeFromLuvioSnapshot();
103925
+ this.unsubscribeFromLuvioSnapshot = undefined;
103926
+ }
103927
+ const result = super.execute();
103928
+ result.then((_) => {
103929
+ if (this.latestLuvioRecordIdsToInvalidate &&
103930
+ this.latestLuvioRecordIdsToInvalidate.length > 0) {
103931
+ return this.services.luvioUiapiRecords.notifyRecordUpdateAvailable(this.latestLuvioRecordIdsToInvalidate.map((recordId) => ({ recordId })));
103932
+ }
103933
+ });
103934
+ return result;
103935
+ }
103936
+ subscribeToKeysUsed() {
103937
+ super.subscribeToKeysUsed();
103938
+ // Subscribe to luvio cache changes using the stored snapshot
103939
+ if (this.latestLuvioSnapshot) {
103940
+ try {
103941
+ const luvioService = this.services.luvio;
103942
+ const luvioInstance = luvioService.luvio;
103943
+ // Subscribe to changes using the stored snapshot
103944
+ this.unsubscribeFromLuvioSnapshot = luvioInstance.storeSubscribe(this.latestLuvioSnapshot, (_) => {
103945
+ // If any records used change at the top level, refresh all the data
103946
+ this.refresh();
103947
+ });
103948
+ }
103949
+ catch (error) { }
103950
+ }
103484
103951
  }
103485
103952
  };
103486
103953
  }
@@ -103524,6 +103991,10 @@
103524
103991
  version: '1.0',
103525
103992
  optional: true,
103526
103993
  },
103994
+ luvioUiapiRecords: {
103995
+ type: 'luvioUiapiRecords',
103996
+ version: '1.0',
103997
+ },
103527
103998
  };
103528
103999
  let provisionedCallback;
103529
104000
  getServices(serviceRequirements).then((services) => {
@@ -103559,7 +104030,7 @@
103559
104030
  cb(graphql$1, graphql_imperative$1, useOneStoreGraphQL);
103560
104031
  }
103561
104032
  }
103562
- // version: 1.377.0-b0d5c49e07
104033
+ // version: 1.377.1-db77d3f339
103563
104034
 
103564
104035
  function createFragmentMap(documentNode) {
103565
104036
  const fragments = {};
@@ -130054,7 +130525,7 @@
130054
130525
  }
130055
130526
  return refresh$3(data, 'refreshUiApi');
130056
130527
  }
130057
- // version: 1.377.0-b0d5c49e07
130528
+ // version: 1.377.1-db77d3f339
130058
130529
 
130059
130530
  // On core the unstable adapters are re-exported with different names,
130060
130531
  // we want to match them here.
@@ -130206,7 +130677,7 @@
130206
130677
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
130207
130678
  graphQLImperative = ldsAdapter;
130208
130679
  });
130209
- // version: 1.377.0-b0d5c49e07
130680
+ // version: 1.377.1-db77d3f339
130210
130681
 
130211
130682
  var gqlApi = /*#__PURE__*/Object.freeze({
130212
130683
  __proto__: null,
@@ -131005,7 +131476,7 @@
131005
131476
  function register(r) {
131006
131477
  callbacks$1.forEach((callback) => callback(r));
131007
131478
  }
131008
- // version: 1.377.0-3c95caf11c
131479
+ // version: 1.377.1-dadb6358f3
131009
131480
 
131010
131481
  /**
131011
131482
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -132342,4 +132813,4 @@
132342
132813
  exports.subscribeToAdapter = subscribeToAdapter;
132343
132814
 
132344
132815
  }));
132345
- // version: 1.377.0-3c95caf11c
132816
+ // version: 1.377.1-dadb6358f3