@salesforce/lds-worker-api 1.377.0 → 1.378.0

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.
@@ -4274,7 +4274,7 @@ function withDefaultLuvio(callback) {
4274
4274
  }
4275
4275
  callbacks.push(callback);
4276
4276
  }
4277
- // version: 1.377.0-3c95caf11c
4277
+ // version: 1.378.0-0ab3d40d29
4278
4278
 
4279
4279
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4280
4280
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5318,7 +5318,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5318
5318
  const { apiFamily, name } = metadata;
5319
5319
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5320
5320
  }
5321
- // version: 1.377.0-3c95caf11c
5321
+ // version: 1.378.0-0ab3d40d29
5322
5322
 
5323
5323
  /**
5324
5324
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -34154,7 +34154,7 @@ withDefaultLuvio((luvio) => {
34154
34154
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
34155
34155
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
34156
34156
  });
34157
- // version: 1.377.0-b0d5c49e07
34157
+ // version: 1.378.0-63d7c07562
34158
34158
 
34159
34159
  function requestIdleDetectedCallback(_callback) { }
34160
34160
  function declareNotifierTaskSingle(_name) {
@@ -45659,6 +45659,15 @@ var graphqQueryFieldLimit = {
45659
45659
  },
45660
45660
  };
45661
45661
 
45662
+ var graphqlPartialEmitParity = {
45663
+ isOpen: function (e) {
45664
+ return e.fallback;
45665
+ },
45666
+ hasError: function () {
45667
+ return !0;
45668
+ },
45669
+ };
45670
+
45662
45671
  var caseSensitiveUserId = '005B0000000GR4OIAW';
45663
45672
 
45664
45673
  var ldsAdapterO11yLoggingGate = {
@@ -45806,47 +45815,47 @@ let Err$4 = class Err {
45806
45815
  };
45807
45816
  const ok$4 = (value) => new Ok$4(value);
45808
45817
  const err$4 = (err2) => new Err$4(err2);
45809
- function resolvedPromiseLike$4(result) {
45810
- if (isPromiseLike$4(result)) {
45818
+ function resolvedPromiseLike$5(result) {
45819
+ if (isPromiseLike$5(result)) {
45811
45820
  return result.then((nextResult) => nextResult);
45812
45821
  }
45813
45822
  return {
45814
45823
  then: (onFulfilled, _onRejected) => {
45815
45824
  try {
45816
- return resolvedPromiseLike$4(onFulfilled(result));
45825
+ return resolvedPromiseLike$5(onFulfilled(result));
45817
45826
  } catch (e) {
45818
45827
  if (onFulfilled === void 0) {
45819
- return resolvedPromiseLike$4(result);
45828
+ return resolvedPromiseLike$5(result);
45820
45829
  }
45821
- return rejectedPromiseLike$4(e);
45830
+ return rejectedPromiseLike$5(e);
45822
45831
  }
45823
45832
  }
45824
45833
  };
45825
45834
  }
45826
- function rejectedPromiseLike$4(reason) {
45827
- if (isPromiseLike$4(reason)) {
45835
+ function rejectedPromiseLike$5(reason) {
45836
+ if (isPromiseLike$5(reason)) {
45828
45837
  return reason.then((nextResult) => nextResult);
45829
45838
  }
45830
45839
  return {
45831
45840
  then: (_onFulfilled, onRejected) => {
45832
45841
  if (typeof onRejected === "function") {
45833
45842
  try {
45834
- return resolvedPromiseLike$4(onRejected(reason));
45843
+ return resolvedPromiseLike$5(onRejected(reason));
45835
45844
  } catch (e) {
45836
- return rejectedPromiseLike$4(e);
45845
+ return rejectedPromiseLike$5(e);
45837
45846
  }
45838
45847
  }
45839
- return rejectedPromiseLike$4(reason);
45848
+ return rejectedPromiseLike$5(reason);
45840
45849
  }
45841
45850
  };
45842
45851
  }
45843
- function isPromiseLike$4(x) {
45852
+ function isPromiseLike$5(x) {
45844
45853
  return typeof (x == null ? void 0 : x.then) === "function";
45845
45854
  }
45846
45855
  function racesync(values) {
45847
45856
  for (const value of values) {
45848
45857
  let settled = void 0;
45849
- if (isPromiseLike$4(value)) {
45858
+ if (isPromiseLike$5(value)) {
45850
45859
  value.then(
45851
45860
  (_) => {
45852
45861
  settled = value;
@@ -45856,7 +45865,7 @@ function racesync(values) {
45856
45865
  }
45857
45866
  );
45858
45867
  } else {
45859
- settled = resolvedPromiseLike$4(value);
45868
+ settled = resolvedPromiseLike$5(value);
45860
45869
  }
45861
45870
  if (settled !== void 0) {
45862
45871
  return settled;
@@ -46005,7 +46014,7 @@ function getServices(request, timeout = 3e4) {
46005
46014
  );
46006
46015
  }
46007
46016
  function setServices(services) {
46008
- waitForServices = resolvedPromiseLike$4(services);
46017
+ waitForServices = resolvedPromiseLike$5(services);
46009
46018
  servicesAvailable(services);
46010
46019
  }
46011
46020
 
@@ -61593,7 +61602,7 @@ const { hasOwnProperty: ObjectPrototypeHasOwnProperty$2 } = Object.prototype;
61593
61602
  // Deep merge that works on GraphQL data. It:
61594
61603
  // - recursively merges any Object properties that are present in both
61595
61604
  // - recursively merges arrays by deepMerging each Object item in the array (by index).
61596
- function deepMerge$2(target, ...sources) {
61605
+ function deepMerge$3(target, ...sources) {
61597
61606
  for (const source of sources) {
61598
61607
  for (const key in source) {
61599
61608
  if (ObjectPrototypeHasOwnProperty$2.call(source, key)) {
@@ -61614,7 +61623,7 @@ function deepMerge$2(target, ...sources) {
61614
61623
  !Array.isArray(targetItem) &&
61615
61624
  sourceItem instanceof Object &&
61616
61625
  !Array.isArray(sourceItem)) {
61617
- return deepMerge$2({}, targetItem, sourceItem);
61626
+ return deepMerge$3({}, targetItem, sourceItem);
61618
61627
  }
61619
61628
  else {
61620
61629
  return sourceItem;
@@ -61625,7 +61634,7 @@ function deepMerge$2(target, ...sources) {
61625
61634
  !Array.isArray(targetValue) &&
61626
61635
  sourceValue instanceof Object &&
61627
61636
  !Array.isArray(sourceValue)) {
61628
- deepMerge$2(targetValue, sourceValue);
61637
+ deepMerge$3(targetValue, sourceValue);
61629
61638
  }
61630
61639
  else {
61631
61640
  target[key] = sourceValue;
@@ -79243,7 +79252,7 @@ function selectCalculateSink$1(sink, field, buildSelectionForNodeFn, source, rea
79243
79252
  field.selectionSet?.selections.forEach((sel) => {
79244
79253
  const builtSelection = buildSelectionForNodeFn(source, reader, field, sel, variables, fragments, parentRecordId);
79245
79254
  if (builtSelection !== undefined) {
79246
- deepMerge$2(sink, builtSelection);
79255
+ deepMerge$3(sink, builtSelection);
79247
79256
  }
79248
79257
  });
79249
79258
  return sink;
@@ -81989,6 +81998,7 @@ function createContext(store, objectInfos, eventEmitter, settings, snapshot, map
81989
81998
  possibleStaleRecordMap: new Map(),
81990
81999
  draftFunctions,
81991
82000
  mappedCursors,
82001
+ missingFieldsMap: new Map(),
81992
82002
  };
81993
82003
  }
81994
82004
 
@@ -85590,8 +85600,17 @@ function addResolversToSchema(schema, polyFields) {
85590
85600
  field.resolve = connectionResolver;
85591
85601
  }
85592
85602
  else {
85593
- field.resolve = function recordFieldResolver({ recordRepresentation: record, }) {
85594
- return record.fields[field.name] || null;
85603
+ field.resolve = function recordFieldResolver({ recordRepresentation: record }, _args, { missingFieldsMap }) {
85604
+ const { id, fields } = record;
85605
+ const recordField = fields[field.name];
85606
+ // If the field is not present, add it to the missing fields map
85607
+ if (!recordField) {
85608
+ let missingFieldsSet = missingFieldsMap.get(id) ?? new Set();
85609
+ missingFieldsSet.add(field.name);
85610
+ missingFieldsMap.set(id, missingFieldsSet);
85611
+ return null;
85612
+ }
85613
+ return recordField;
85595
85614
  };
85596
85615
  }
85597
85616
  }
@@ -86182,6 +86201,7 @@ async function evaluate(config, observers, settings, objectInfos, store, snapsho
86182
86201
  result,
86183
86202
  seenRecordIds,
86184
86203
  possibleStaleRecordMap: contextValue.possibleStaleRecordMap,
86204
+ missingFieldsMap: contextValue.missingFieldsMap,
86185
86205
  };
86186
86206
  }
86187
86207
  finally {
@@ -88348,11 +88368,13 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
88348
88368
  let gqlResult;
88349
88369
  let seenRecordIds;
88350
88370
  let possibleStaleRecordMap;
88371
+ let missingFieldsMap;
88351
88372
  try {
88352
88373
  ({
88353
88374
  result: gqlResult,
88354
88375
  seenRecordIds,
88355
88376
  possibleStaleRecordMap,
88377
+ missingFieldsMap,
88356
88378
  } = await evaluate({
88357
88379
  ...config,
88358
88380
  //need to create another copy of the ast for future writes
@@ -88382,13 +88404,23 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
88382
88404
  const seenRecords = createSeenRecords(seenRecordIds, nonEvaluatedSnapshot);
88383
88405
  const recordId = generateUniqueRecordId();
88384
88406
  const rebuildWithLocalEval = async (originalSnapshot) => {
88385
- let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, } = await evaluate({
88407
+ let { result: rebuildResult, seenRecordIds, possibleStaleRecordMap, missingFieldsMap: rebuildMissingFieldsMap, } = await evaluate({
88386
88408
  ...config,
88387
88409
  query: injectedAST,
88388
88410
  }, observers, { userId }, objectInfoNeeded, store, originalSnapshot, graphqlSchemaCache, draftFunctions, mappedCursors);
88389
88411
  if (!rebuildResult.errors) {
88390
88412
  rebuildResult = removeSyntheticFields(rebuildResult, config.query);
88391
88413
  }
88414
+ // If the query includes any missing fields, we return an ErrorSnapshot
88415
+ // with a message that contains the missing fields for each record.
88416
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) &&
88417
+ rebuildMissingFieldsMap.size > 0) {
88418
+ const missingFieldsErrorSnapshot = createMissingFieldsErrorSnapshot(originalSnapshot, rebuildMissingFieldsMap);
88419
+ return {
88420
+ ...missingFieldsErrorSnapshot,
88421
+ rebuildWithLocalEval,
88422
+ };
88423
+ }
88392
88424
  let snapshotState = 'Fulfilled';
88393
88425
  if (possibleStaleRecordMap.size > 0) {
88394
88426
  initiateStaleRecordRefresh(luvio, possibleStaleRecordMap);
@@ -88423,6 +88455,10 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
88423
88455
  },
88424
88456
  };
88425
88457
  }
88458
+ // If the query includes any missing fields, we return an ErrorSnapshot
88459
+ if (graphqlPartialEmitParity.isOpen({ fallback: false }) && missingFieldsMap.size > 0) {
88460
+ return createMissingFieldsErrorSnapshot(nonEvaluatedSnapshot, missingFieldsMap);
88461
+ }
88426
88462
  // if the non-eval'ed snapshot was an error then we return a synthetic
88427
88463
  // Fulfilled snapshot (this only happens in this code path if
88428
88464
  // the error is network error or 504), otherwise we spread over
@@ -88479,6 +88515,30 @@ function makeGetRecordsConfig(keyMap) {
88479
88515
  records,
88480
88516
  };
88481
88517
  }
88518
+ /**
88519
+ * Creates an ErrorSnapshot with a message that contains the missing fields for each record.
88520
+ * @param originalSnapshot The original snapshot that is being rebuilt.
88521
+ * @param missingFieldsMap A map of record ids to the fields that are missing.
88522
+ * @returns An ErrorSnapshot with a message that contains the missing fields for each record.
88523
+ */
88524
+ function createMissingFieldsErrorSnapshot(originalSnapshot, missingFieldsMap) {
88525
+ const message = Array.from(missingFieldsMap)
88526
+ .map(([id, fields]) => `Missing fields for record ${id}: ${Array.from(fields).join(', ')}`)
88527
+ .join('; ');
88528
+ return {
88529
+ ...originalSnapshot,
88530
+ data: undefined,
88531
+ state: 'Error',
88532
+ error: {
88533
+ errorType: 'adapterError',
88534
+ error: [
88535
+ {
88536
+ message,
88537
+ },
88538
+ ],
88539
+ },
88540
+ };
88541
+ }
88482
88542
 
88483
88543
  function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy) {
88484
88544
  return async function environmentAwareGraphQLBatchAdapter(config, requestContext = {}) {
@@ -93878,13 +93938,13 @@ function toError(x) {
93878
93938
  }
93879
93939
  return new Error(typeof x === "string" ? x : JSON.stringify(x));
93880
93940
  }
93881
- class InternalError extends Error {
93941
+ let InternalError$1 = class InternalError extends Error {
93882
93942
  constructor(data) {
93883
93943
  super();
93884
93944
  this.data = data;
93885
93945
  this.type = "internal";
93886
93946
  }
93887
- }
93947
+ };
93888
93948
  class UserVisibleError extends Error {
93889
93949
  constructor(data) {
93890
93950
  super();
@@ -93956,7 +94016,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
93956
94016
  async afterRequestHooks(_options) {
93957
94017
  }
93958
94018
  };
93959
- function buildServiceDescriptor$g() {
94019
+ function buildServiceDescriptor$h() {
93960
94020
  return {
93961
94021
  type: "networkCommandBaseClass",
93962
94022
  version: "1.0",
@@ -94058,7 +94118,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
94058
94118
  return resolvedPromiseLike$3(err$1$1(toError("Aura/Fetch network services not found")));
94059
94119
  }
94060
94120
  }
94061
- function buildServiceDescriptor$f() {
94121
+ function buildServiceDescriptor$g() {
94062
94122
  return {
94063
94123
  type: "auraNetworkCommandBaseClass",
94064
94124
  version: "1.0",
@@ -94558,7 +94618,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand$1 {
94558
94618
  return resolvedPromiseLike$3(void 0);
94559
94619
  }
94560
94620
  }
94561
- function buildServiceDescriptor$e() {
94621
+ function buildServiceDescriptor$f() {
94562
94622
  return {
94563
94623
  type: "auraNormalizedCacheControlCommand",
94564
94624
  version: "1.0",
@@ -94704,7 +94764,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
94704
94764
  return `{"endpoint":${this.endpoint},"params":${stableJSONStringify$2(this.auraParams)}}`;
94705
94765
  }
94706
94766
  }
94707
- function buildServiceDescriptor$d() {
94767
+ function buildServiceDescriptor$e() {
94708
94768
  return {
94709
94769
  type: "auraResourceCacheControlCommand",
94710
94770
  version: "1.0",
@@ -94811,7 +94871,7 @@ class FetchNetworkCommand extends NetworkCommand {
94811
94871
  );
94812
94872
  }
94813
94873
  }
94814
- function buildServiceDescriptor$c() {
94874
+ function buildServiceDescriptor$d() {
94815
94875
  return {
94816
94876
  type: "fetchNetworkCommandBaseClass",
94817
94877
  version: "1.0",
@@ -94900,7 +94960,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
94900
94960
  return resolvedPromiseLike$3(void 0);
94901
94961
  }
94902
94962
  }
94903
- function buildServiceDescriptor$b() {
94963
+ function buildServiceDescriptor$c() {
94904
94964
  return {
94905
94965
  type: "httpNormalizedCacheControlCommand",
94906
94966
  version: "1.0",
@@ -95153,7 +95213,7 @@ let DefaultCache$1 = class DefaultCache {
95153
95213
  return new FixedTimeWritableCache$1(this, generatedTime);
95154
95214
  }
95155
95215
  };
95156
- function buildServiceDescriptor$a() {
95216
+ function buildServiceDescriptor$b() {
95157
95217
  return {
95158
95218
  type: "cache",
95159
95219
  version: "1.0",
@@ -95321,7 +95381,7 @@ class CacheController {
95321
95381
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
95322
95382
  }
95323
95383
  }
95324
- function buildServiceDescriptor$9(cache, cacheInclusionPolicy) {
95384
+ function buildServiceDescriptor$a(cache, cacheInclusionPolicy) {
95325
95385
  return {
95326
95386
  type: "cacheController",
95327
95387
  version: "1.0",
@@ -95367,7 +95427,7 @@ function buildInstrumentCommand(services) {
95367
95427
  };
95368
95428
  };
95369
95429
  }
95370
- function buildServiceDescriptor$8(instrumentation) {
95430
+ function buildServiceDescriptor$9(instrumentation) {
95371
95431
  return {
95372
95432
  type: "instrumentCommand",
95373
95433
  version: "1.0",
@@ -95637,7 +95697,7 @@ class O11yInstrumentation {
95637
95697
  this.metrics = new O11yOTelMetricsAPI(this.services);
95638
95698
  }
95639
95699
  }
95640
- function buildServiceDescriptor$7(logger) {
95700
+ function buildServiceDescriptor$8(logger) {
95641
95701
  return {
95642
95702
  type: "instrumentation",
95643
95703
  version: "1.0",
@@ -95747,7 +95807,7 @@ class DefaultPubSubService {
95747
95807
  return matchingSubscriptions;
95748
95808
  }
95749
95809
  }
95750
- function buildServiceDescriptor$6() {
95810
+ function buildServiceDescriptor$7() {
95751
95811
  return {
95752
95812
  type: "pubSub",
95753
95813
  version: "1.0",
@@ -95771,7 +95831,7 @@ class FeatureFlagsService {
95771
95831
  return this.flags.get(flagName) || defaultValue;
95772
95832
  }
95773
95833
  }
95774
- function buildServiceDescriptor$5() {
95834
+ function buildServiceDescriptor$6() {
95775
95835
  return {
95776
95836
  version: "1.0",
95777
95837
  service: new FeatureFlagsService(),
@@ -95812,7 +95872,7 @@ function buildServiceDescriptor$5() {
95812
95872
  * };
95813
95873
  * ```
95814
95874
  */
95815
- function buildServiceDescriptor$4(luvio) {
95875
+ function buildServiceDescriptor$5(luvio) {
95816
95876
  return {
95817
95877
  type: 'luvio',
95818
95878
  version: '1.0',
@@ -95821,7 +95881,33 @@ function buildServiceDescriptor$4(luvio) {
95821
95881
  },
95822
95882
  };
95823
95883
  }
95824
- // version: 1.377.0-b0d5c49e07
95884
+ // version: 1.378.0-63d7c07562
95885
+
95886
+ /**
95887
+ * Copyright (c) 2022, Salesforce, Inc.,
95888
+ * All rights reserved.
95889
+ * For full license text, see the LICENSE.txt file
95890
+ */
95891
+
95892
+ /*
95893
+ * ATTENTION!
95894
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
95895
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
95896
+ * Any changes made to this file in p4 will be automatically overwritten.
95897
+ * *******************************************************************************************
95898
+ */
95899
+ /* proxy-compat-disable */
95900
+ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvioRecord) {
95901
+ return {
95902
+ type: 'luvioUiapiRecords',
95903
+ version: '1.0',
95904
+ service: {
95905
+ notifyRecordUpdateAvailable,
95906
+ getNormalizedLuvioRecord,
95907
+ },
95908
+ };
95909
+ }
95910
+ // version: 1.378.0-63d7c07562
95825
95911
 
95826
95912
  /*!
95827
95913
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96688,7 +96774,7 @@ function findExecutableOperation$1(input) {
96688
96774
  }
96689
96775
  return err$1$1(new Error("Multiple operations found in query, and no operation name provided"));
96690
96776
  }
96691
- function buildGraphQLInputExtension(input) {
96777
+ function buildGraphQLInputExtension$1(input) {
96692
96778
  const operationResult = findExecutableOperation$1(input);
96693
96779
  if (operationResult.isErr()) {
96694
96780
  return err$1$1(operationResult.error);
@@ -96731,7 +96817,7 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
96731
96817
  return this.documentRootType;
96732
96818
  }
96733
96819
  buildQuery() {
96734
- const extensionResult = buildGraphQLInputExtension(this.config);
96820
+ const extensionResult = buildGraphQLInputExtension$1(this.config);
96735
96821
  if (extensionResult.isErr()) {
96736
96822
  throw extensionResult.error;
96737
96823
  }
@@ -96840,12 +96926,12 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
96840
96926
  return augmentedQueryResult.value;
96841
96927
  }
96842
96928
  buildWriteInput(data) {
96843
- const extensionResult = buildGraphQLInputExtension({
96929
+ const extensionResult = buildGraphQLInputExtension$1({
96844
96930
  ...this.config,
96845
96931
  query: this.buildRequestQuery()
96846
96932
  });
96847
96933
  if (extensionResult.isErr()) {
96848
- throw new InternalError(extensionResult.error);
96934
+ throw new InternalError$1(extensionResult.error);
96849
96935
  }
96850
96936
  return { data: data.data, ...extensionResult.value };
96851
96937
  }
@@ -96890,7 +96976,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
96890
96976
  return this.documentRootType;
96891
96977
  }
96892
96978
  buildQuery() {
96893
- const extensionResult = buildGraphQLInputExtension(this.config);
96979
+ const extensionResult = buildGraphQLInputExtension$1(this.config);
96894
96980
  if (extensionResult.isErr()) {
96895
96981
  throw extensionResult.error;
96896
96982
  }
@@ -96934,12 +97020,12 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
96934
97020
  return augmentedQueryResult.value;
96935
97021
  }
96936
97022
  buildWriteInput(data) {
96937
- const extensionResult = buildGraphQLInputExtension({
97023
+ const extensionResult = buildGraphQLInputExtension$1({
96938
97024
  ...this.config,
96939
97025
  query: this.buildRequestQuery()
96940
97026
  });
96941
97027
  if (extensionResult.isErr()) {
96942
- throw new InternalError(extensionResult.error);
97028
+ throw new InternalError$1(extensionResult.error);
96943
97029
  }
96944
97030
  return { data: data.data, ...extensionResult.value };
96945
97031
  }
@@ -97182,41 +97268,41 @@ function setDifference(setA, setB) {
97182
97268
  }
97183
97269
  return differenceSet;
97184
97270
  }
97185
- function resolvedPromiseLike(result) {
97186
- if (isPromiseLike(result)) {
97271
+ function resolvedPromiseLike$4(result) {
97272
+ if (isPromiseLike$4(result)) {
97187
97273
  return result.then((nextResult) => nextResult);
97188
97274
  }
97189
97275
  return {
97190
97276
  then: (onFulfilled, _onRejected) => {
97191
97277
  try {
97192
- return resolvedPromiseLike(onFulfilled(result));
97278
+ return resolvedPromiseLike$4(onFulfilled(result));
97193
97279
  } catch (e) {
97194
97280
  if (onFulfilled === void 0) {
97195
- return resolvedPromiseLike(result);
97281
+ return resolvedPromiseLike$4(result);
97196
97282
  }
97197
- return rejectedPromiseLike(e);
97283
+ return rejectedPromiseLike$4(e);
97198
97284
  }
97199
97285
  }
97200
97286
  };
97201
97287
  }
97202
- function rejectedPromiseLike(reason) {
97203
- if (isPromiseLike(reason)) {
97288
+ function rejectedPromiseLike$4(reason) {
97289
+ if (isPromiseLike$4(reason)) {
97204
97290
  return reason.then((nextResult) => nextResult);
97205
97291
  }
97206
97292
  return {
97207
97293
  then: (_onFulfilled, onRejected) => {
97208
97294
  if (typeof onRejected === "function") {
97209
97295
  try {
97210
- return resolvedPromiseLike(onRejected(reason));
97296
+ return resolvedPromiseLike$4(onRejected(reason));
97211
97297
  } catch (e) {
97212
- return rejectedPromiseLike(e);
97298
+ return rejectedPromiseLike$4(e);
97213
97299
  }
97214
97300
  }
97215
- return rejectedPromiseLike(reason);
97301
+ return rejectedPromiseLike$4(reason);
97216
97302
  }
97217
97303
  };
97218
97304
  }
97219
- function isPromiseLike(x) {
97305
+ function isPromiseLike$4(x) {
97220
97306
  return typeof (x == null ? void 0 : x.then) === "function";
97221
97307
  }
97222
97308
  /*!
@@ -97505,7 +97591,7 @@ class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
97505
97591
  tempL1.keysUpdated.forEach((key) => keysToReviveRecordableCache.get(key));
97506
97592
  tempL1.missingKeysRead.forEach((key) => keysToReviveRecordableCache.get(key));
97507
97593
  const missingKeys = keysToReviveRecordableCache.missingKeysRead;
97508
- const revivePromiseLike = missingKeys.size > 0 ? this.revive(missingKeys, l1).then(() => void 0) : resolvedPromiseLike(void 0);
97594
+ const revivePromiseLike = missingKeys.size > 0 ? this.revive(missingKeys, l1).then(() => void 0) : resolvedPromiseLike$4(void 0);
97509
97595
  return revivePromiseLike.then(() => {
97510
97596
  const recordableCache = l1.record();
97511
97597
  return writeToL1(recordableCache).then((result) => {
@@ -97698,10 +97784,10 @@ function initializeOneStore(sqliteStore) {
97698
97784
  globalThis.performance = { now: () => Date.now() };
97699
97785
  }
97700
97786
  const loggerService = new ConsoleLogger('ERROR');
97701
- const cacheServiceDescriptor = buildServiceDescriptor$a();
97702
- const instrumentationServiceDescriptor = buildServiceDescriptor$7(loggerService);
97787
+ const cacheServiceDescriptor = buildServiceDescriptor$b();
97788
+ const instrumentationServiceDescriptor = buildServiceDescriptor$8(loggerService);
97703
97789
  const nimbusSqliteOneStoreCacheServiceDescriptor = buildNimbusDurableCacheInclusionPolicyService(cacheServiceDescriptor.service, new NimbusSqliteOneStoreCache(sqliteStore));
97704
- const featureFlagsServiceDescriptor = buildServiceDescriptor$5();
97790
+ const featureFlagsServiceDescriptor = buildServiceDescriptor$6();
97705
97791
  const featureFlagsService = featureFlagsServiceDescriptor.service;
97706
97792
  // This disables the OneStore GraphQL in this runtime
97707
97793
  // We made the decision to continue using the Luvio based version in Mobile
@@ -97711,21 +97797,22 @@ function initializeOneStore(sqliteStore) {
97711
97797
  const services = [
97712
97798
  instrumentationServiceDescriptor,
97713
97799
  buildNimbusFetchServiceDescriptor(),
97714
- buildServiceDescriptor$8(instrumentationServiceDescriptor.service),
97800
+ buildServiceDescriptor$9(instrumentationServiceDescriptor.service),
97715
97801
  // NOTE: These do not directly depend on Aura, and are necessary for HTTP fallback support.
97802
+ buildServiceDescriptor$g(),
97716
97803
  buildServiceDescriptor$f(),
97717
97804
  buildServiceDescriptor$e(),
97805
+ buildServiceDescriptor$a(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
97718
97806
  buildServiceDescriptor$d(),
97719
- buildServiceDescriptor$9(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service),
97807
+ buildServiceDescriptor$h(),
97720
97808
  buildServiceDescriptor$c(),
97721
- buildServiceDescriptor$g(),
97722
- buildServiceDescriptor$b(),
97723
- buildServiceDescriptor$6(),
97809
+ buildServiceDescriptor$7(),
97724
97810
  buildServiceDescriptor$3(),
97725
97811
  buildServiceDescriptor$2(),
97726
97812
  featureFlagsServiceDescriptor,
97727
97813
  // Luvio service won't be used since we set the useOneStoreGraphQL flag to false
97728
- buildServiceDescriptor$4({}),
97814
+ buildServiceDescriptor$5({}),
97815
+ buildServiceDescriptor$4({}, {}),
97729
97816
  // TODO[@W-18753648]: See note above.
97730
97817
  // buildStreamingCommandServiceDescriptor(),
97731
97818
  // buildNdJsonServiceDescriptor(),
@@ -97936,7 +98023,7 @@ register$1({
97936
98023
  id: '@salesforce/lds-network-adapter',
97937
98024
  instrument: instrument$2,
97938
98025
  });
97939
- // version: 1.377.0-3c95caf11c
98026
+ // version: 1.378.0-0ab3d40d29
97940
98027
 
97941
98028
  const { create: create$3, keys: keys$3 } = Object;
97942
98029
  const { stringify: stringify$1, parse } = JSON;
@@ -98800,11 +98887,7 @@ function extractVariableValue(variableName, variableDefinitions) {
98800
98887
  if (variable.definition.defaultValue) {
98801
98888
  return extractValue(variable.definition.defaultValue, variableDefinitions);
98802
98889
  }
98803
- return err$4(
98804
- new Error(
98805
- `Variable '${variableName}' was defined but no value was provided and no default value exists`
98806
- )
98807
- );
98890
+ return ok$4(void 0);
98808
98891
  }
98809
98892
  function validateExpectedType(value, expectedType) {
98810
98893
  if (!expectedType) {
@@ -98826,7 +98909,7 @@ function validateExpectedType(value, expectedType) {
98826
98909
  new Error(`Expected ${expectedTypeString}, but got ${actualType}: ${JSON.stringify(value)}`)
98827
98910
  );
98828
98911
  }
98829
- function deepMerge$1(target, ...sources) {
98912
+ function deepMerge$2(target, ...sources) {
98830
98913
  for (const source of sources) {
98831
98914
  for (const key in source) {
98832
98915
  if (hasOwnProperty$2.call(source, key)) {
@@ -98842,13 +98925,13 @@ function deepMerge$1(target, ...sources) {
98842
98925
  } else if (sourceItem === void 0) {
98843
98926
  return targetItem;
98844
98927
  } else if (targetItem instanceof Object && !Array.isArray(targetItem) && sourceItem instanceof Object && !Array.isArray(sourceItem)) {
98845
- return deepMerge$1({}, targetItem, sourceItem);
98928
+ return deepMerge$2({}, targetItem, sourceItem);
98846
98929
  } else {
98847
98930
  return sourceItem;
98848
98931
  }
98849
98932
  });
98850
98933
  } else if (targetValue instanceof Object && !Array.isArray(targetValue) && sourceValue instanceof Object && !Array.isArray(sourceValue)) {
98851
- deepMerge$1(
98934
+ deepMerge$2(
98852
98935
  targetValue,
98853
98936
  sourceValue
98854
98937
  );
@@ -98882,6 +98965,32 @@ function findExecutableOperation(input) {
98882
98965
  }
98883
98966
  return err$4(new Error("Multiple operations found in query, and no operation name provided"));
98884
98967
  }
98968
+ function buildGraphQLInputExtension(input) {
98969
+ const operationResult = findExecutableOperation(input);
98970
+ if (operationResult.isErr()) {
98971
+ return err$4(operationResult.error);
98972
+ }
98973
+ const operation = operationResult.value;
98974
+ const selections = operation.selectionSet.selections;
98975
+ const variableDefinitions = operation.variableDefinitions;
98976
+ const variables = (variableDefinitions == null ? void 0 : variableDefinitions.reduce((prev, def) => {
98977
+ var _a;
98978
+ prev[def.variable.name.value] = {
98979
+ definition: def,
98980
+ value: (_a = input.variables) == null ? void 0 : _a[def.variable.name.value]
98981
+ };
98982
+ return prev;
98983
+ }, {})) || {};
98984
+ const fragments = input.query.definitions.filter((def) => def.kind === "FragmentDefinition").reduce((prev, fragment) => {
98985
+ prev[fragment.name.value] = fragment;
98986
+ return prev;
98987
+ }, {});
98988
+ return ok$4({
98989
+ selections,
98990
+ request: { definitions: { variables, fragments } },
98991
+ parentFieldSelection: void 0
98992
+ });
98993
+ }
98885
98994
  function buildUniqueAugmentedFieldSelection(newSelection, selections, fragments) {
98886
98995
  var _a;
98887
98996
  const baseAlias = ((_a = newSelection.alias) == null ? void 0 : _a.value) || newSelection.name.value;
@@ -98988,6 +99097,243 @@ function shouldSkip(selection, variables) {
98988
99097
  }
98989
99098
  return ok$4(false);
98990
99099
  }
99100
+ class BaseScalarFieldDef {
99101
+ constructor(nullable) {
99102
+ this.nullable = nullable;
99103
+ }
99104
+ write(_cache, input) {
99105
+ if (input.data === void 0) {
99106
+ return ok$4({ type: "missing" });
99107
+ }
99108
+ if (input.data === null) {
99109
+ if (!this.nullable) {
99110
+ return err$4([
99111
+ {
99112
+ type: "unknown",
99113
+ error: new Error(
99114
+ `Got a null value for non-nullable field "${input.selection.name.value}"`
99115
+ )
99116
+ }
99117
+ ]);
99118
+ }
99119
+ }
99120
+ return ok$4({ type: "data", data: input.data });
99121
+ }
99122
+ read(_cache, input) {
99123
+ const normalizedData = input.normalizedData;
99124
+ if (normalizedData.type === "missing") {
99125
+ return ok$4(void 0);
99126
+ }
99127
+ return ok$4(normalizedData.data);
99128
+ }
99129
+ augmentSelections(input) {
99130
+ return input;
99131
+ }
99132
+ buildFieldKey(selection, variables) {
99133
+ return buildFieldKey(selection.name.value, selection.arguments, variables);
99134
+ }
99135
+ }
99136
+ class BaseArrayFieldDef {
99137
+ constructor(items, nullable) {
99138
+ this.items = items;
99139
+ this.nullable = nullable;
99140
+ }
99141
+ augmentSelections(input) {
99142
+ return this.items.augmentSelections(input);
99143
+ }
99144
+ buildFieldKey(selection, variables) {
99145
+ return this.items.buildFieldKey(selection, variables);
99146
+ }
99147
+ write(cache, input) {
99148
+ if (input.data === void 0) {
99149
+ return ok$4({ type: "missing" });
99150
+ }
99151
+ if (input.data === null) {
99152
+ if (!this.nullable) {
99153
+ return err$4([
99154
+ {
99155
+ type: "unknown",
99156
+ error: new Error(
99157
+ `Got a null value for non-nullable field "${input.selection.name.value}"`
99158
+ )
99159
+ }
99160
+ ]);
99161
+ }
99162
+ return ok$4({ type: "data", data: input.data });
99163
+ }
99164
+ if (!Array.isArray(input.data)) {
99165
+ return err$4([
99166
+ {
99167
+ type: "unknown",
99168
+ error: new Error(
99169
+ `Got a non array value for array field "${input.selection.name.value}"`
99170
+ )
99171
+ }
99172
+ ]);
99173
+ }
99174
+ const arrayNormalizationErrors = [];
99175
+ const normalizedArray = [];
99176
+ input.data.forEach((item, index) => {
99177
+ var _a;
99178
+ const existingItemData = (_a = input.existingNormalizedData) == null ? void 0 : _a[index];
99179
+ const normalizedItemResult = this.items.write(cache, {
99180
+ ...input,
99181
+ data: item,
99182
+ existingNormalizedData: existingItemData,
99183
+ request: input.request,
99184
+ selection: input.selection
99185
+ });
99186
+ if (normalizedItemResult.isOk()) {
99187
+ normalizedArray.push(normalizedItemResult.value);
99188
+ } else {
99189
+ arrayNormalizationErrors.push(...normalizedItemResult.error);
99190
+ }
99191
+ });
99192
+ if (arrayNormalizationErrors.length > 0) {
99193
+ return err$4(arrayNormalizationErrors);
99194
+ }
99195
+ return ok$4({ type: "data", data: normalizedArray });
99196
+ }
99197
+ read(cache, input) {
99198
+ const normalizedData = input.normalizedData;
99199
+ if (normalizedData.type === "missing") {
99200
+ return ok$4(void 0);
99201
+ }
99202
+ if (normalizedData.data === null) {
99203
+ if (!this.nullable) {
99204
+ return err$4([
99205
+ {
99206
+ type: "unknown",
99207
+ error: new Error(
99208
+ `Got a null value for non-nullable field "${input.selection.name.value}"`
99209
+ )
99210
+ }
99211
+ ]);
99212
+ }
99213
+ return ok$4({ type: "data", data: null });
99214
+ }
99215
+ if (!Array.isArray(normalizedData.data)) {
99216
+ return err$4([
99217
+ {
99218
+ type: "unknown",
99219
+ error: new Error(
99220
+ `Got a non array value for array field "${input.selection.name.value}"`
99221
+ )
99222
+ }
99223
+ ]);
99224
+ }
99225
+ const arrayDenormalizationErrors = [];
99226
+ const denormalizedArray = [];
99227
+ normalizedData.data.forEach((item) => {
99228
+ const denormalizedItemResult = this.items.read(cache, {
99229
+ ...input,
99230
+ normalizedData: item,
99231
+ request: input.request,
99232
+ selection: input.selection
99233
+ });
99234
+ if (denormalizedItemResult.isOk()) {
99235
+ denormalizedArray.push(denormalizedItemResult.value);
99236
+ } else {
99237
+ arrayDenormalizationErrors.push(...denormalizedItemResult.error);
99238
+ }
99239
+ });
99240
+ if (arrayDenormalizationErrors.length > 0) {
99241
+ return err$4(arrayDenormalizationErrors);
99242
+ }
99243
+ return ok$4(denormalizedArray);
99244
+ }
99245
+ }
99246
+ class BaseObjectFieldDef {
99247
+ constructor(repository, nullable) {
99248
+ this.repository = repository;
99249
+ this.nullable = nullable;
99250
+ }
99251
+ augmentSelections(input) {
99252
+ return this.repository.augmentSelections(input);
99253
+ }
99254
+ buildFieldKey(selection, variables) {
99255
+ return this.repository.buildFieldKey(selection, variables);
99256
+ }
99257
+ write(cache, input) {
99258
+ var _a;
99259
+ if (!input.selection.selectionSet) {
99260
+ return err$4([
99261
+ {
99262
+ type: "unknown",
99263
+ error: new Error(
99264
+ `Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
99265
+ )
99266
+ }
99267
+ ]);
99268
+ }
99269
+ if (input.data === void 0) {
99270
+ return ok$4({ type: "missing" });
99271
+ }
99272
+ if (input.data === null) {
99273
+ if (!this.nullable) {
99274
+ return err$4([
99275
+ {
99276
+ type: "unknown",
99277
+ error: new Error(
99278
+ `Got a null value for non-nullable field "${input.selection.name.value}"`
99279
+ )
99280
+ }
99281
+ ]);
99282
+ }
99283
+ return ok$4({ type: "data", data: null });
99284
+ }
99285
+ const writeResult = this.repository.write(cache, {
99286
+ ...input,
99287
+ data: input.data,
99288
+ existingNormalizedData: (_a = input.existingNormalizedData) == null ? void 0 : _a.data,
99289
+ request: input.request,
99290
+ selections: input.selection.selectionSet.selections,
99291
+ parentFieldSelection: input.selection
99292
+ });
99293
+ if (writeResult.isErr()) {
99294
+ return writeResult;
99295
+ }
99296
+ return ok$4({ type: "data", data: writeResult.value });
99297
+ }
99298
+ read(cache, input) {
99299
+ var _a;
99300
+ if (!input.selection.selectionSet) {
99301
+ return err$4([
99302
+ {
99303
+ type: "unknown",
99304
+ error: new Error(
99305
+ `Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
99306
+ )
99307
+ }
99308
+ ]);
99309
+ }
99310
+ const normalizedData = input.normalizedData;
99311
+ if (normalizedData.type === "missing") {
99312
+ return ok$4(void 0);
99313
+ }
99314
+ if (normalizedData.data === null) {
99315
+ if (!this.nullable) {
99316
+ return err$4([
99317
+ {
99318
+ type: "unknown",
99319
+ error: new Error(
99320
+ `Got a null value for non-nullable field "${input.selection.name.value}"`
99321
+ )
99322
+ }
99323
+ ]);
99324
+ }
99325
+ return ok$4(null);
99326
+ }
99327
+ return this.repository.read(cache, {
99328
+ ...input,
99329
+ normalizedData: normalizedData.data,
99330
+ request: input.request,
99331
+ selections: (_a = input.selection.selectionSet) == null ? void 0 : _a.selections,
99332
+ parentFieldSelection: input.selection
99333
+ });
99334
+ }
99335
+ }
99336
+ const missingFieldDef = new BaseScalarFieldDef(false);
98991
99337
  class BaseGraphQLTypeRepository {
98992
99338
  equals(x, y) {
98993
99339
  return deepEquals$2(x, y);
@@ -99108,7 +99454,7 @@ class BaseGraphQLTypeRepository {
99108
99454
  const errors = [];
99109
99455
  for (const selection of input.selections) {
99110
99456
  if (selection.kind === Kind.FIELD) {
99111
- deepMerge$1(
99457
+ deepMerge$2(
99112
99458
  normalized,
99113
99459
  this.normalizeFieldSelection(cache, input, selection, errors)
99114
99460
  );
@@ -99129,7 +99475,7 @@ class BaseGraphQLTypeRepository {
99129
99475
  ]
99130
99476
  };
99131
99477
  }
99132
- deepMerge$1(normalized, this.normalizeFragment(cache, input, fragment, errors));
99478
+ deepMerge$2(normalized, this.normalizeFragment(cache, input, fragment, errors));
99133
99479
  }
99134
99480
  }
99135
99481
  return buildReadWriteResult(normalized, errors);
@@ -99223,7 +99569,7 @@ class BaseGraphQLTypeRepository {
99223
99569
  const denormalized = {};
99224
99570
  for (const selection of input.selections) {
99225
99571
  if (selection.kind === Kind.FIELD) {
99226
- deepMerge$1(
99572
+ deepMerge$2(
99227
99573
  denormalized,
99228
99574
  this.denormalizeFieldSelection(cache, input, selection, errors)
99229
99575
  );
@@ -99244,7 +99590,7 @@ class BaseGraphQLTypeRepository {
99244
99590
  ]
99245
99591
  };
99246
99592
  }
99247
- deepMerge$1(denormalized, this.denormalizeFragment(cache, input, fragment, errors));
99593
+ deepMerge$2(denormalized, this.denormalizeFragment(cache, input, fragment, errors));
99248
99594
  }
99249
99595
  }
99250
99596
  return buildReadWriteResult(denormalized, errors);
@@ -99352,9 +99698,23 @@ class BaseGraphQLTypeRepository {
99352
99698
  }
99353
99699
  return {};
99354
99700
  }
99355
- getFieldDef(_input, selection) {
99701
+ getFieldDef(input, selection) {
99702
+ var _a, _b, _c;
99356
99703
  const canonicalFieldName = selection.name.value;
99357
- return this.fields[canonicalFieldName];
99704
+ const fieldDef = this.fields[canonicalFieldName];
99705
+ if (fieldDef) {
99706
+ return fieldDef;
99707
+ }
99708
+ const dataInstanceFieldName = ((_a = selection.alias) == null ? void 0 : _a.value) ?? selection.name.value;
99709
+ if (input === void 0) {
99710
+ return void 0;
99711
+ }
99712
+ if ("data" in input && input.data[dataInstanceFieldName] === void 0) {
99713
+ return missingFieldDef;
99714
+ } else if ("normalizedData" in input && ((_c = (_b = input.normalizedData) == null ? void 0 : _b[dataInstanceFieldName]) == null ? void 0 : _c.type) === "missing") {
99715
+ return missingFieldDef;
99716
+ }
99717
+ return void 0;
99358
99718
  }
99359
99719
  shouldProcessFragment(fragment, variables) {
99360
99720
  const shouldSkipResult = shouldSkip(fragment, variables);
@@ -99460,7 +99820,7 @@ class IdentifiableGraphQLTypeRepository extends IdentifiableTypeRepository {
99460
99820
  return normalizeDataResult;
99461
99821
  }
99462
99822
  return ok$4(
99463
- deepMerge$1(
99823
+ deepMerge$2(
99464
99824
  {},
99465
99825
  (existingNormalizedData == null ? void 0 : existingNormalizedData.value) || {},
99466
99826
  normalizeDataResult.value
@@ -99736,245 +100096,6 @@ function augmentUnionLikeSelections(input, possibleTypes) {
99736
100096
  });
99737
100097
  return { selections: augmentedSelections, fragments: augmentedFragments };
99738
100098
  }
99739
- class BaseScalarFieldDef {
99740
- constructor(nullable) {
99741
- this.nullable = nullable;
99742
- this.type = "scalar";
99743
- }
99744
- write(_cache, input) {
99745
- if (input.data === void 0) {
99746
- return ok$4({ type: "missing" });
99747
- }
99748
- if (input.data === null) {
99749
- if (!this.nullable) {
99750
- return err$4([
99751
- {
99752
- type: "unknown",
99753
- error: new Error(
99754
- `Got a null value for non-nullable field "${input.selection.name.value}"`
99755
- )
99756
- }
99757
- ]);
99758
- }
99759
- }
99760
- return ok$4({ type: "data", data: input.data });
99761
- }
99762
- read(_cache, input) {
99763
- const normalizedData = input.normalizedData;
99764
- if (normalizedData.type === "missing") {
99765
- return ok$4(void 0);
99766
- }
99767
- return ok$4(normalizedData.data);
99768
- }
99769
- augmentSelections(input) {
99770
- return input;
99771
- }
99772
- buildFieldKey(selection, variables) {
99773
- return buildFieldKey(selection.name.value, selection.arguments, variables);
99774
- }
99775
- }
99776
- class BaseArrayFieldDef {
99777
- constructor(items, nullable) {
99778
- this.items = items;
99779
- this.nullable = nullable;
99780
- this.type = "array";
99781
- }
99782
- augmentSelections(input) {
99783
- return this.items.augmentSelections(input);
99784
- }
99785
- buildFieldKey(selection, variables) {
99786
- return this.items.buildFieldKey(selection, variables);
99787
- }
99788
- write(cache, input) {
99789
- if (input.data === void 0) {
99790
- return ok$4({ type: "missing" });
99791
- }
99792
- if (input.data === null) {
99793
- if (!this.nullable) {
99794
- return err$4([
99795
- {
99796
- type: "unknown",
99797
- error: new Error(
99798
- `Got a null value for non-nullable field "${input.selection.name.value}"`
99799
- )
99800
- }
99801
- ]);
99802
- }
99803
- return ok$4({ type: "data", data: input.data });
99804
- }
99805
- if (!Array.isArray(input.data)) {
99806
- return err$4([
99807
- {
99808
- type: "unknown",
99809
- error: new Error(
99810
- `Got a non array value for array field "${input.selection.name.value}"`
99811
- )
99812
- }
99813
- ]);
99814
- }
99815
- const arrayNormalizationErrors = [];
99816
- const normalizedArray = [];
99817
- input.data.forEach((item, index) => {
99818
- var _a;
99819
- const existingItemData = (_a = input.existingNormalizedData) == null ? void 0 : _a[index];
99820
- const normalizedItemResult = this.items.write(cache, {
99821
- ...input,
99822
- data: item,
99823
- existingNormalizedData: existingItemData,
99824
- request: input.request,
99825
- selection: input.selection
99826
- });
99827
- if (normalizedItemResult.isOk()) {
99828
- normalizedArray.push(normalizedItemResult.value);
99829
- } else {
99830
- arrayNormalizationErrors.push(...normalizedItemResult.error);
99831
- }
99832
- });
99833
- if (arrayNormalizationErrors.length > 0) {
99834
- return err$4(arrayNormalizationErrors);
99835
- }
99836
- return ok$4({ type: "data", data: normalizedArray });
99837
- }
99838
- read(cache, input) {
99839
- const normalizedData = input.normalizedData;
99840
- if (normalizedData.type === "missing") {
99841
- return ok$4(void 0);
99842
- }
99843
- if (normalizedData.data === null) {
99844
- if (!this.nullable) {
99845
- return err$4([
99846
- {
99847
- type: "unknown",
99848
- error: new Error(
99849
- `Got a null value for non-nullable field "${input.selection.name.value}"`
99850
- )
99851
- }
99852
- ]);
99853
- }
99854
- return ok$4({ type: "data", data: null });
99855
- }
99856
- if (!Array.isArray(normalizedData.data)) {
99857
- return err$4([
99858
- {
99859
- type: "unknown",
99860
- error: new Error(
99861
- `Got a non array value for array field "${input.selection.name.value}"`
99862
- )
99863
- }
99864
- ]);
99865
- }
99866
- const arrayDenormalizationErrors = [];
99867
- const denormalizedArray = [];
99868
- normalizedData.data.forEach((item) => {
99869
- const denormalizedItemResult = this.items.read(cache, {
99870
- ...input,
99871
- normalizedData: item,
99872
- request: input.request,
99873
- selection: input.selection
99874
- });
99875
- if (denormalizedItemResult.isOk()) {
99876
- denormalizedArray.push(denormalizedItemResult.value);
99877
- } else {
99878
- arrayDenormalizationErrors.push(...denormalizedItemResult.error);
99879
- }
99880
- });
99881
- if (arrayDenormalizationErrors.length > 0) {
99882
- return err$4(arrayDenormalizationErrors);
99883
- }
99884
- return ok$4(denormalizedArray);
99885
- }
99886
- }
99887
- class BaseObjectFieldDef {
99888
- constructor(repository, nullable) {
99889
- this.repository = repository;
99890
- this.nullable = nullable;
99891
- this.type = "object";
99892
- }
99893
- augmentSelections(input) {
99894
- return this.repository.augmentSelections(input);
99895
- }
99896
- buildFieldKey(selection, variables) {
99897
- return this.repository.buildFieldKey(selection, variables);
99898
- }
99899
- write(cache, input) {
99900
- var _a;
99901
- if (!input.selection.selectionSet) {
99902
- return err$4([
99903
- {
99904
- type: "unknown",
99905
- error: new Error(
99906
- `Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
99907
- )
99908
- }
99909
- ]);
99910
- }
99911
- if (input.data === void 0) {
99912
- return ok$4({ type: "missing" });
99913
- }
99914
- if (input.data === null) {
99915
- if (!this.nullable) {
99916
- return err$4([
99917
- {
99918
- type: "unknown",
99919
- error: new Error(
99920
- `Got a null value for non-nullable field "${input.selection.name.value}"`
99921
- )
99922
- }
99923
- ]);
99924
- }
99925
- return ok$4({ type: "data", data: null });
99926
- }
99927
- const writeResult = this.repository.write(cache, {
99928
- ...input,
99929
- data: input.data,
99930
- existingNormalizedData: (_a = input.existingNormalizedData) == null ? void 0 : _a.data,
99931
- request: input.request,
99932
- selections: input.selection.selectionSet.selections,
99933
- parentFieldSelection: input.selection
99934
- });
99935
- if (writeResult.isErr()) {
99936
- return writeResult;
99937
- }
99938
- return ok$4({ type: "data", data: writeResult.value });
99939
- }
99940
- read(cache, input) {
99941
- var _a;
99942
- if (!input.selection.selectionSet) {
99943
- return err$4([
99944
- {
99945
- type: "unknown",
99946
- error: new Error(
99947
- `Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
99948
- )
99949
- }
99950
- ]);
99951
- }
99952
- const normalizedData = input.normalizedData;
99953
- if (normalizedData.type === "missing") {
99954
- return ok$4(void 0);
99955
- }
99956
- if (normalizedData.data === null) {
99957
- if (!this.nullable) {
99958
- return err$4([
99959
- {
99960
- type: "unknown",
99961
- error: new Error(
99962
- `Got a null value for non-nullable field "${input.selection.name.value}"`
99963
- )
99964
- }
99965
- ]);
99966
- }
99967
- return ok$4(null);
99968
- }
99969
- return this.repository.read(cache, {
99970
- ...input,
99971
- normalizedData: normalizedData.data,
99972
- request: input.request,
99973
- selections: (_a = input.selection.selectionSet) == null ? void 0 : _a.selections,
99974
- parentFieldSelection: input.selection
99975
- });
99976
- }
99977
- }
99978
100099
  const GraphQLQueryJsonSchema = {
99979
100100
  type: "object",
99980
100101
  properties: {
@@ -100275,10 +100396,10 @@ function emitGraphQLResult(callback, result) {
100275
100396
  return;
100276
100397
  }
100277
100398
  if ("subscribe" in result.value) {
100278
- callback(result.value.data);
100399
+ callback(formatGraphQLData(result.value.data));
100279
100400
  return;
100280
100401
  }
100281
- callback(result.value);
100402
+ callback(formatGraphQLData(result.value));
100282
100403
  }
100283
100404
  function resolveAst(ast) {
100284
100405
  const result = astResolver(ast);
@@ -100287,6 +100408,18 @@ function resolveAst(ast) {
100287
100408
  }
100288
100409
  return result;
100289
100410
  }
100411
+ function formatGraphQLData(data) {
100412
+ if (data.errors === void 0 || data.errors.length === 0) {
100413
+ return {
100414
+ data: data.data,
100415
+ errors: void 0
100416
+ };
100417
+ }
100418
+ return {
100419
+ data: data.data,
100420
+ errors: data.errors
100421
+ };
100422
+ }
100290
100423
  class GraphQLCommandWireAdapterConstructor extends CommandWireAdapterConstructor {
100291
100424
  emit(result) {
100292
100425
  try {
@@ -100365,7 +100498,7 @@ function buildAsyncGraphQLImperativeLegacyInvoker(getCommand) {
100365
100498
  };
100366
100499
  return { invoke, subscribe };
100367
100500
  }
100368
- // version: 1.377.0-b0d5c49e07
100501
+ // version: 1.378.0-63d7c07562
100369
100502
 
100370
100503
  class Analytics__AnalyticsBrowseRepository extends UnidentifiableGraphQLTypeRepository {
100371
100504
  constructor(services, typeRegistry) {
@@ -101541,7 +101674,7 @@ class PolymorphicAggregateParentRelationshipRepository extends BaseUnionReposito
101541
101674
  }
101542
101675
  }
101543
101676
 
101544
- class PolymorphicParentRelationshipRepository extends BaseUnionRepository {
101677
+ let PolymorphicParentRelationshipRepository$1 = class PolymorphicParentRelationshipRepository extends BaseUnionRepository {
101545
101678
  constructor(services, typeRegistry) {
101546
101679
  super(services);
101547
101680
  this.services = services;
@@ -101558,7 +101691,7 @@ class PolymorphicParentRelationshipRepository extends BaseUnionRepository {
101558
101691
  __typename: new BaseScalarFieldDef(false),
101559
101692
  };
101560
101693
  }
101561
- }
101694
+ };
101562
101695
 
101563
101696
  class QueryRepository extends GraphQLDocumentRootTypeRepository {
101564
101697
  constructor(services, typeRegistry) {
@@ -102596,7 +102729,7 @@ class GraphQLTypeRegistry {
102596
102729
  this._Base64Value = new Base64ValueRepository(this.services, this);
102597
102730
  this._JSONValue = new JSONValueRepository(this.services, this);
102598
102731
  this._PolymorphicParentRelationship =
102599
- new PolymorphicParentRelationshipRepository(this.services, this);
102732
+ new PolymorphicParentRelationshipRepository$1(this.services, this);
102600
102733
  this._CompoundField = new CompoundFieldRepository$1(this.services, this);
102601
102734
  this._AnyType = new AnyTypeRepository(this.services, this);
102602
102735
  this._RecordRepresentation =
@@ -103049,6 +103182,50 @@ class Err {
103049
103182
  }
103050
103183
  const ok = (value) => new Ok(value);
103051
103184
  const err = (err2) => new Err(err2);
103185
+ function resolvedPromiseLike(result) {
103186
+ if (isPromiseLike(result)) {
103187
+ return result.then((nextResult) => nextResult);
103188
+ }
103189
+ return {
103190
+ then: (onFulfilled, _onRejected) => {
103191
+ try {
103192
+ return resolvedPromiseLike(onFulfilled(result));
103193
+ } catch (e) {
103194
+ if (onFulfilled === void 0) {
103195
+ return resolvedPromiseLike(result);
103196
+ }
103197
+ return rejectedPromiseLike(e);
103198
+ }
103199
+ }
103200
+ };
103201
+ }
103202
+ function rejectedPromiseLike(reason) {
103203
+ if (isPromiseLike(reason)) {
103204
+ return reason.then((nextResult) => nextResult);
103205
+ }
103206
+ return {
103207
+ then: (_onFulfilled, onRejected) => {
103208
+ if (typeof onRejected === "function") {
103209
+ try {
103210
+ return resolvedPromiseLike(onRejected(reason));
103211
+ } catch (e) {
103212
+ return rejectedPromiseLike(e);
103213
+ }
103214
+ }
103215
+ return rejectedPromiseLike(reason);
103216
+ }
103217
+ };
103218
+ }
103219
+ function isPromiseLike(x) {
103220
+ return typeof (x == null ? void 0 : x.then) === "function";
103221
+ }
103222
+ class InternalError extends Error {
103223
+ constructor(data) {
103224
+ super();
103225
+ this.data = data;
103226
+ this.type = "internal";
103227
+ }
103228
+ }
103052
103229
 
103053
103230
  function buildGenericTypeFieldDef(selection, fields, staticFieldNames, typename) {
103054
103231
  // If the field is not a category field, return the base field def for the field
@@ -103056,8 +103233,6 @@ function buildGenericTypeFieldDef(selection, fields, staticFieldNames, typename)
103056
103233
  return fields[selection.name.value];
103057
103234
  }
103058
103235
  return {
103059
- type: 'object',
103060
- nullable: true,
103061
103236
  read: (cache, input) => {
103062
103237
  if (!input.selection.selectionSet) {
103063
103238
  return err([
@@ -103071,6 +103246,9 @@ function buildGenericTypeFieldDef(selection, fields, staticFieldNames, typename)
103071
103246
  if (normalizedData.type === 'missing') {
103072
103247
  return ok(undefined);
103073
103248
  }
103249
+ if (normalizedData.data === null) {
103250
+ return ok(null);
103251
+ }
103074
103252
  const fieldCategory = normalizedData.fieldCategory;
103075
103253
  const fieldDef = fields[fieldCategory];
103076
103254
  if (!fieldDef) {
@@ -103095,6 +103273,9 @@ function buildGenericTypeFieldDef(selection, fields, staticFieldNames, typename)
103095
103273
  if (input.data === undefined) {
103096
103274
  return ok({ type: 'missing' });
103097
103275
  }
103276
+ if (input.data === null) {
103277
+ return ok({ type: 'data', data: null });
103278
+ }
103098
103279
  const fieldCategory = getFieldCategoryFromData(input.data);
103099
103280
  const fieldDef = fields[fieldCategory];
103100
103281
  if (!fieldDef) {
@@ -103113,7 +103294,6 @@ function buildGenericTypeFieldDef(selection, fields, staticFieldNames, typename)
103113
103294
  },
103114
103295
  buildFieldKey: (selection, variables) => buildFieldKey(selection.name.value, selection.arguments, variables),
103115
103296
  augmentSelections: (input) => input,
103116
- repository: {}, // This shouldn't be part of the interface
103117
103297
  };
103118
103298
  }
103119
103299
  function getFieldCategoryFromData(data) {
@@ -103165,13 +103345,38 @@ class RecordRepresentationRepository extends RecordRepresentationRepository$1 {
103165
103345
  return this._graphqlRepositoryOverride;
103166
103346
  }
103167
103347
  write(cache, input) {
103168
- const result = super.write(cache, input);
103169
- input.data.Id;
103348
+ let overridenInput = input;
103349
+ // If ID exists in the data but wasn't asked for, its from the extensions, and we should normalize it
103350
+ if (input.data.Id !== undefined &&
103351
+ input.selections.find((selection) => selection.kind === 'Field' && selection.name.value === 'Id')) {
103352
+ overridenInput = {
103353
+ ...input,
103354
+ selections: [
103355
+ ...input.selections,
103356
+ { kind: 'Field', name: { kind: 'Name', value: 'Id' } },
103357
+ ],
103358
+ };
103359
+ }
103360
+ const result = super.write(cache, overridenInput);
103361
+ const recordId = input.data.Id;
103362
+ const luvioRecord = input.getNormalizedLuvioRecord(recordId, input.reader);
103363
+ if (luvioRecord?.weakEtag &&
103364
+ input.data?.WeakEtag &&
103365
+ luvioRecord.weakEtag !== input.data.WeakEtag) {
103366
+ input.luvioRecordIdsToInvalidate.push(recordId);
103367
+ }
103170
103368
  return result;
103171
103369
  }
103172
103370
  read(cache, input) {
103173
103371
  const result = super.read(cache, input);
103174
- // TODO: read luvio record to track subscription
103372
+ const idData = super.read(cache, {
103373
+ ...input,
103374
+ selections: [{ kind: 'Field', name: { kind: 'Name', value: 'Id' } }],
103375
+ });
103376
+ if (idData.isOk()) {
103377
+ // Read the record to track subscription
103378
+ input.getNormalizedLuvioRecord(idData.value.Id, input.reader);
103379
+ }
103175
103380
  return result;
103176
103381
  }
103177
103382
  }
@@ -103299,8 +103504,6 @@ class RecordQueryAggregateRepository extends RecordQueryAggregateRepository$1 {
103299
103504
  }
103300
103505
 
103301
103506
  const blobTypeDef = {
103302
- type: 'scalar',
103303
- nullable: true,
103304
103507
  read: (_cache, input) => {
103305
103508
  return ok({
103306
103509
  data: input.data,
@@ -103410,6 +103613,14 @@ class SetupRecordAggregateRepository extends Setup__SetupRecordAggregateReposito
103410
103613
  }
103411
103614
  }
103412
103615
 
103616
+ class PolymorphicParentRelationshipRepository extends PolymorphicParentRelationshipRepository$1 {
103617
+ getTypeDiscriminator(data, _selections) {
103618
+ // Hardcoded to record representation since that's the only type of parent
103619
+ // relationship possible
103620
+ return 'RecordRepresentation';
103621
+ }
103622
+ }
103623
+
103413
103624
  class CustomGraphQLTypeRegistry extends GraphQLTypeRegistry {
103414
103625
  constructor(services) {
103415
103626
  super(services);
@@ -103422,6 +103633,7 @@ class CustomGraphQLTypeRegistry extends GraphQLTypeRegistry {
103422
103633
  this._SetupQueryAggregate = new SetupQueryAggregateRepository(services, this);
103423
103634
  this._SetupQuery = new SetupQueryRepository(services, this);
103424
103635
  this._SetupRecordAggregate = new SetupRecordAggregateRepository(services, this);
103636
+ this._PolymorphicParentRelationship = new PolymorphicParentRelationshipRepository(services, this);
103425
103637
  }
103426
103638
  get CompoundField() {
103427
103639
  return this._CompoundField;
@@ -103450,9 +103662,78 @@ class CustomGraphQLTypeRegistry extends GraphQLTypeRegistry {
103450
103662
  get SetupRecordAggregate() {
103451
103663
  return this._SetupRecordAggregate;
103452
103664
  }
103665
+ get PolymorphicParentRelationship() {
103666
+ return this._PolymorphicParentRelationship;
103667
+ }
103453
103668
  }
103454
103669
 
103455
103670
  const CONFIG_SCHEMA = GraphQLQueryJsonSchema;
103671
+
103672
+ function mergeResponseWithExtensions(response) {
103673
+ return {
103674
+ data: deepMerge$1(response.data, response.extensions?.lds || {}),
103675
+ ...(response.errors && { errors: response.errors }),
103676
+ };
103677
+ }
103678
+ function deepMerge$1(data, extensions) {
103679
+ const dataType = typeof data;
103680
+ const extensionsType = typeof extensions;
103681
+ if (dataType === 'function' || extensionsType === 'function') {
103682
+ throw new Error('Cannot merge functions');
103683
+ }
103684
+ if (dataType === 'undefined' || data === undefined) {
103685
+ return extensions;
103686
+ }
103687
+ if (extensionsType === 'undefined' || extensions === undefined) {
103688
+ return data;
103689
+ }
103690
+ if (dataType === 'string' ||
103691
+ dataType === 'number' ||
103692
+ dataType === 'boolean' ||
103693
+ dataType === 'bigint' ||
103694
+ dataType === 'symbol' ||
103695
+ extensionsType === 'string' ||
103696
+ extensionsType === 'number' ||
103697
+ extensionsType === 'boolean' ||
103698
+ extensionsType === 'bigint' ||
103699
+ extensionsType === 'symbol' ||
103700
+ data === null ||
103701
+ extensions === null) {
103702
+ // if either is a scalar, prefer data
103703
+ return data;
103704
+ }
103705
+ // data and extensions are both objects or arrays
103706
+ // if data is an array but extensions is not, prefer data
103707
+ const dataIsArray = Array.isArray(data);
103708
+ const extensionsIsArray = Array.isArray(extensions);
103709
+ // if one is an array and the other is not, prefer data
103710
+ if ((dataIsArray && !extensionsIsArray) || (!dataIsArray && extensionsIsArray)) {
103711
+ return data;
103712
+ }
103713
+ // if both are arrays, merge them, maintaining the length of data
103714
+ if (dataIsArray && extensionsIsArray) {
103715
+ return data.map((item, index) => deepMerge$1(item, extensions[index]));
103716
+ }
103717
+ // if both are objects, merge them
103718
+ // get the keys of both objects
103719
+ const dataKeys = Object.keys(data);
103720
+ const extensionsKeys = Object.keys(extensions);
103721
+ // get the keys that are in both objects
103722
+ const commonKeys = dataKeys.filter((key) => extensionsKeys.includes(key));
103723
+ // get the keys that are in data but not in extensions
103724
+ const dataKeysNotInExtensions = dataKeys.filter((key) => !extensionsKeys.includes(key));
103725
+ // get the keys that are in extensions but not in data
103726
+ const extensionsKeysNotInData = extensionsKeys.filter((key) => !dataKeys.includes(key));
103727
+ return {
103728
+ ...Object.fromEntries(commonKeys.map((key) => [
103729
+ key,
103730
+ deepMerge$1(data[key], extensions[key]),
103731
+ ])),
103732
+ ...Object.fromEntries(dataKeysNotInExtensions.map((key) => [key, data[key]])),
103733
+ ...Object.fromEntries(extensionsKeysNotInData.map((key) => [key, extensions[key]])),
103734
+ };
103735
+ }
103736
+
103456
103737
  function buildCommandClass(baseClass) {
103457
103738
  return class extends baseClass {
103458
103739
  constructor(config, documentRootType, services) {
@@ -103460,21 +103741,167 @@ function buildCommandClass(baseClass) {
103460
103741
  this.config = config;
103461
103742
  this.documentRootType = documentRootType;
103462
103743
  this.services = services;
103463
- this.endpoint = "RecordUiController.executeGraphQL";
103464
- this.operationType = "graphql";
103744
+ this.endpoint = 'RecordUiController.executeGraphQL';
103745
+ }
103746
+ get url() {
103747
+ return '/graphql';
103465
103748
  }
103466
103749
  get cacheControlStrategyConfig() {
103467
103750
  return {
103468
- type: "max-age",
103751
+ type: 'max-age',
103469
103752
  requestMaxAge: 60,
103470
103753
  now: Date.now() / 1000,
103471
103754
  };
103472
103755
  }
103473
- get url() {
103474
- return "/graphql";
103475
- }
103476
103756
  get auraBodyWrapperName() {
103477
- return "queryInput";
103757
+ return 'queryInput';
103758
+ }
103759
+ get auraParams() {
103760
+ const params = super.auraParams;
103761
+ const body = params[this.auraBodyWrapperName];
103762
+ return {
103763
+ ...params,
103764
+ [this.auraBodyWrapperName]: {
103765
+ ...body,
103766
+ extensions: {
103767
+ ldsRequiredFields: true,
103768
+ },
103769
+ },
103770
+ };
103771
+ }
103772
+ get fetchParams() {
103773
+ const [url, params] = super.fetchParams;
103774
+ const body = JSON.parse(params.body);
103775
+ const modifiedBody = {
103776
+ ...body,
103777
+ extensions: {
103778
+ ldsRequiredFields: true,
103779
+ },
103780
+ };
103781
+ return [
103782
+ url,
103783
+ {
103784
+ ...params,
103785
+ body: JSON.stringify(modifiedBody),
103786
+ },
103787
+ ];
103788
+ }
103789
+ buildWriteInput(data) {
103790
+ this.latestLuvioRecordIdsToInvalidate = [];
103791
+ const augmentedResponse = mergeResponseWithExtensions(data);
103792
+ const extensionResult = buildGraphQLInputExtension({
103793
+ ...this.config,
103794
+ query: this.buildRequestQuery(),
103795
+ });
103796
+ if (extensionResult.isErr()) {
103797
+ throw new InternalError(extensionResult.error);
103798
+ }
103799
+ return {
103800
+ data: augmentedResponse.data,
103801
+ ...extensionResult.value,
103802
+ luvioRecordIdsToInvalidate: this.latestLuvioRecordIdsToInvalidate,
103803
+ };
103804
+ }
103805
+ readFromCache(cache) {
103806
+ let readFromCacheResult = undefined;
103807
+ try {
103808
+ const luvioService = this.services.luvio;
103809
+ const luvioInstance = luvioService.luvio;
103810
+ // Create a Luvio reader and get the latest snapshot
103811
+ this.latestLuvioSnapshot = luvioInstance.storeLookup({
103812
+ recordId: 'onestore-graphql',
103813
+ node: {
103814
+ kind: 'Fragment',
103815
+ reader: true,
103816
+ synthetic: true,
103817
+ read: (reader) => {
103818
+ readFromCacheResult = this.buildResultType().query(cache, {
103819
+ ...this.buildQuery(),
103820
+ reader,
103821
+ getNormalizedLuvioRecord: this.services.luvioUiapiRecords.getNormalizedLuvioRecord,
103822
+ });
103823
+ return readFromCacheResult;
103824
+ },
103825
+ },
103826
+ variables: {},
103827
+ });
103828
+ }
103829
+ catch (error) {
103830
+ return resolvedPromiseLike(err(error));
103831
+ }
103832
+ const readResult = readFromCacheResult;
103833
+ if (readResult === undefined) {
103834
+ return resolvedPromiseLike(err(new Error('No result from query')));
103835
+ }
103836
+ // Convert ReadResult to Result<any, Error>
103837
+ if (readResult.isErr()) {
103838
+ return resolvedPromiseLike(err(new Error('Failed to find data in cache')));
103839
+ }
103840
+ return resolvedPromiseLike(ok(readResult.value));
103841
+ }
103842
+ writeToCache(cache, networkResult) {
103843
+ try {
103844
+ const luvioService = this.services.luvio;
103845
+ const luvioInstance = luvioService.luvio;
103846
+ // Create a Luvio reader to allow the record representation type to lookup records in luvio
103847
+ // and mark them as needing invalidation when necessary
103848
+ luvioInstance.storeLookup({
103849
+ recordId: 'onestore-graphql',
103850
+ node: {
103851
+ kind: 'Fragment',
103852
+ reader: true,
103853
+ synthetic: true,
103854
+ read: (reader) => {
103855
+ if (networkResult.isOk()) {
103856
+ return this.buildResultType().write(cache.buildFixedTimeWritableCache(Date.now() / 1000), {
103857
+ ...this.buildWriteInput(networkResult.value),
103858
+ reader,
103859
+ getNormalizedLuvioRecord: this.services.luvioUiapiRecords
103860
+ .getNormalizedLuvioRecord,
103861
+ });
103862
+ }
103863
+ },
103864
+ },
103865
+ variables: {},
103866
+ });
103867
+ }
103868
+ catch (error) {
103869
+ // swallow error
103870
+ }
103871
+ return resolvedPromiseLike(undefined);
103872
+ }
103873
+ execute() {
103874
+ // Clear snapshot and unsubscribe from any existing subscriptions at the beginning of execute calls
103875
+ this.latestLuvioSnapshot = undefined;
103876
+ this.latestLuvioRecordIdsToInvalidate = undefined;
103877
+ if (this.unsubscribeFromLuvioSnapshot) {
103878
+ this.unsubscribeFromLuvioSnapshot();
103879
+ this.unsubscribeFromLuvioSnapshot = undefined;
103880
+ }
103881
+ const result = super.execute();
103882
+ result.then((_) => {
103883
+ if (this.latestLuvioRecordIdsToInvalidate &&
103884
+ this.latestLuvioRecordIdsToInvalidate.length > 0) {
103885
+ return this.services.luvioUiapiRecords.notifyRecordUpdateAvailable(this.latestLuvioRecordIdsToInvalidate.map((recordId) => ({ recordId })));
103886
+ }
103887
+ });
103888
+ return result;
103889
+ }
103890
+ subscribeToKeysUsed() {
103891
+ super.subscribeToKeysUsed();
103892
+ // Subscribe to luvio cache changes using the stored snapshot
103893
+ if (this.latestLuvioSnapshot) {
103894
+ try {
103895
+ const luvioService = this.services.luvio;
103896
+ const luvioInstance = luvioService.luvio;
103897
+ // Subscribe to changes using the stored snapshot
103898
+ this.unsubscribeFromLuvioSnapshot = luvioInstance.storeSubscribe(this.latestLuvioSnapshot, (_) => {
103899
+ // If any records used change at the top level, refresh all the data
103900
+ this.refresh();
103901
+ });
103902
+ }
103903
+ catch (error) { }
103904
+ }
103478
103905
  }
103479
103906
  };
103480
103907
  }
@@ -103518,6 +103945,10 @@ const serviceRequirements = {
103518
103945
  version: '1.0',
103519
103946
  optional: true,
103520
103947
  },
103948
+ luvioUiapiRecords: {
103949
+ type: 'luvioUiapiRecords',
103950
+ version: '1.0',
103951
+ },
103521
103952
  };
103522
103953
  let provisionedCallback;
103523
103954
  getServices(serviceRequirements).then((services) => {
@@ -103553,7 +103984,7 @@ function registerCallback(cb) {
103553
103984
  cb(graphql$1, graphql_imperative$1, useOneStoreGraphQL);
103554
103985
  }
103555
103986
  }
103556
- // version: 1.377.0-b0d5c49e07
103987
+ // version: 1.378.0-63d7c07562
103557
103988
 
103558
103989
  function createFragmentMap(documentNode) {
103559
103990
  const fragments = {};
@@ -130048,7 +130479,7 @@ function refreshGraphQL(data) {
130048
130479
  }
130049
130480
  return refresh$3(data, 'refreshUiApi');
130050
130481
  }
130051
- // version: 1.377.0-b0d5c49e07
130482
+ // version: 1.378.0-63d7c07562
130052
130483
 
130053
130484
  // On core the unstable adapters are re-exported with different names,
130054
130485
  // we want to match them here.
@@ -130200,7 +130631,7 @@ withDefaultLuvio((luvio) => {
130200
130631
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
130201
130632
  graphQLImperative = ldsAdapter;
130202
130633
  });
130203
- // version: 1.377.0-b0d5c49e07
130634
+ // version: 1.378.0-63d7c07562
130204
130635
 
130205
130636
  var gqlApi = /*#__PURE__*/Object.freeze({
130206
130637
  __proto__: null,
@@ -130999,7 +131430,7 @@ const callbacks$1 = [];
130999
131430
  function register(r) {
131000
131431
  callbacks$1.forEach((callback) => callback(r));
131001
131432
  }
131002
- // version: 1.377.0-3c95caf11c
131433
+ // version: 1.378.0-0ab3d40d29
131003
131434
 
131004
131435
  /**
131005
131436
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -132315,4 +132746,4 @@ const { luvio } = getRuntime();
132315
132746
  setDefaultLuvio({ luvio });
132316
132747
 
132317
132748
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
132318
- // version: 1.377.0-3c95caf11c
132749
+ // version: 1.378.0-0ab3d40d29