@salesforce/lds-worker-api 1.226.0 → 1.227.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.
@@ -795,4 +795,4 @@ if (process.env.NODE_ENV !== 'production') {
795
795
  }
796
796
 
797
797
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
798
- // version: 1.226.0-abf13e106
798
+ // version: 1.227.1-9eac9f138
@@ -3841,7 +3841,7 @@ function createResourceParamsImpl(config, configMetadata) {
3841
3841
  }
3842
3842
  return resourceParams;
3843
3843
  }
3844
- // engine version: 0.144.8-6b791a2d
3844
+ // engine version: 0.145.0-a2297ae0
3845
3845
 
3846
3846
  /**
3847
3847
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3968,7 +3968,7 @@ function withDefaultLuvio(callback) {
3968
3968
  }
3969
3969
  callbacks.push(callback);
3970
3970
  }
3971
- // version: 1.226.0-abf13e106
3971
+ // version: 1.227.1-9eac9f138
3972
3972
 
3973
3973
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3974
3974
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15211,7 +15211,7 @@ const astResolver = function (astReference) {
15211
15211
  * @param subs - all other substitutions
15212
15212
  * @returns an opaque reference to the parsed document
15213
15213
  */
15214
- function gql(literals, ...subs) {
15214
+ function gql$1(literals, ...subs) {
15215
15215
  let inputString;
15216
15216
  let inputSubstitutionFragments;
15217
15217
  if (!literals) {
@@ -15401,7 +15401,35 @@ function parseAndVisit(source) {
15401
15401
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15402
15402
  return luvioDocumentNode;
15403
15403
  }
15404
- // version: 1.226.0-abf13e106
15404
+
15405
+ function validateDocument(root) {
15406
+ const validationMessages = [];
15407
+ const { definitions } = root;
15408
+ for (let i = 0; i < definitions.length; i++) {
15409
+ const definition = definitions[i];
15410
+ if (definition.kind === 'OperationDefinition') {
15411
+ const { operation, name } = definition;
15412
+ if (operation !== 'query') {
15413
+ validationMessages.push(`Unsupported ${operation} ${name ? `(${name.value}) ` : ''}operation.`);
15414
+ }
15415
+ }
15416
+ }
15417
+ return validationMessages;
15418
+ }
15419
+ function gql(literals, ...subs) {
15420
+ const superResult = gql$1(literals, ...subs);
15421
+ if (superResult !== null) {
15422
+ const root = astResolver(superResult);
15423
+ if (root !== undefined) {
15424
+ const errors = validateDocument(root);
15425
+ if (errors.length > 0) {
15426
+ throw new SyntaxError(`There are unsupported operations in the graphql query:\n${errors.join('\n')}`);
15427
+ }
15428
+ }
15429
+ }
15430
+ return superResult;
15431
+ }
15432
+ // version: 1.227.1-9eac9f138
15405
15433
 
15406
15434
  function unwrap(data) {
15407
15435
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16324,7 +16352,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16324
16352
  const { apiFamily, name } = metadata;
16325
16353
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16326
16354
  }
16327
- // version: 1.226.0-abf13e106
16355
+ // version: 1.227.1-9eac9f138
16328
16356
 
16329
16357
  /**
16330
16358
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16423,7 +16451,7 @@ var TypeCheckShapes;
16423
16451
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
16424
16452
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
16425
16453
  })(TypeCheckShapes || (TypeCheckShapes = {}));
16426
- // engine version: 0.144.8-6b791a2d
16454
+ // engine version: 0.145.0-a2297ae0
16427
16455
 
16428
16456
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16429
16457
 
@@ -41117,7 +41145,7 @@ withDefaultLuvio((luvio) => {
41117
41145
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListViewSummaryUpdateAvailable', notifyUpdateAvailableFactory$1));
41118
41146
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory));
41119
41147
  });
41120
- // version: 1.226.0-0f13e1701
41148
+ // version: 1.227.1-a3108f583
41121
41149
 
41122
41150
  var caseSensitiveUserId = '005B0000000GR4OIAW';
41123
41151
 
@@ -41721,6 +41749,8 @@ function isDeprecatedDurableStoreEntry(durableRecord) {
41721
41749
  }
41722
41750
  const DefaultDurableSegment = 'DEFAULT';
41723
41751
  const RedirectDurableSegment = 'REDIRECT_KEYS';
41752
+ const MessagingDurableSegment = 'MESSAGING';
41753
+ const MessageNotifyStoreUpdateAvailable = 'notifyStoreUpdateAvailable';
41724
41754
 
41725
41755
  const { keys: keys$7, create: create$6, assign: assign$6, freeze: freeze$1$1 } = Object;
41726
41756
 
@@ -42156,6 +42186,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
42156
42186
  const defaultSegmentKeys = [];
42157
42187
  const adapterContextSegmentKeys = [];
42158
42188
  const redirectSegmentKeys = [];
42189
+ const messagingSegmentKeys = [];
42159
42190
  let shouldBroadcast = false;
42160
42191
  for (let i = 0, len = changes.length; i < len; i++) {
42161
42192
  const change = changes[i];
@@ -42170,6 +42201,9 @@ function makeDurable(environment, { durableStore, instrumentation }) {
42170
42201
  else if (change.segment === RedirectDurableSegment) {
42171
42202
  redirectSegmentKeys.push(...change.ids);
42172
42203
  }
42204
+ else if (change.segment === MessagingDurableSegment) {
42205
+ messagingSegmentKeys.push(...change.ids);
42206
+ }
42173
42207
  }
42174
42208
  if (redirectSegmentKeys.length > 0) {
42175
42209
  const redirectEntries = await durableStore.getEntries(redirectSegmentKeys, RedirectDurableSegment);
@@ -42229,6 +42263,20 @@ function makeDurable(environment, { durableStore, instrumentation }) {
42229
42263
  if (shouldBroadcast) {
42230
42264
  await environment.storeBroadcast(rebuildSnapshot, environment.snapshotAvailable);
42231
42265
  }
42266
+ // if having notifyStoreUpdateAvailable msg, then pull the message body out from store
42267
+ // and call environment.notifyStoreUpdateAvailable
42268
+ if (messagingSegmentKeys.includes(MessageNotifyStoreUpdateAvailable)) {
42269
+ const entries = await durableStore.getEntries([MessageNotifyStoreUpdateAvailable], MessagingDurableSegment);
42270
+ if (entries !== undefined) {
42271
+ const notifyEntry = entries[MessageNotifyStoreUpdateAvailable];
42272
+ if (notifyEntry !== undefined) {
42273
+ const keys = notifyEntry.data;
42274
+ if (keys.length > 0) {
42275
+ environment.notifyStoreUpdateAvailable(keys);
42276
+ }
42277
+ }
42278
+ }
42279
+ }
42232
42280
  });
42233
42281
  const dispose = function () {
42234
42282
  validateNotDisposed();
@@ -42564,6 +42612,39 @@ function makeDurable(environment, { durableStore, instrumentation }) {
42564
42612
  return entries;
42565
42613
  });
42566
42614
  };
42615
+ // flag entries specified by keys in durable store as expired.
42616
+ // send a notifyStoreUpdateAvailable message through durable store set entries to
42617
+ // indirectly triggers all js environments to refresh snapshots if overlapping with keys.
42618
+ const notifyStoreUpdateAvailable = async function (keys$1) {
42619
+ validateNotDisposed();
42620
+ const entryKeys = keys$1.map(serializeStructuredKey);
42621
+ const entries = await durableStore.getEntries(entryKeys, DefaultDurableSegment);
42622
+ if (entries === undefined || keys$7(entries).length === 0) {
42623
+ return environment.notifyStoreUpdateAvailable(keys$1);
42624
+ }
42625
+ const now = Date.now();
42626
+ let needWriteBack = false;
42627
+ for (let i = 0; i < entryKeys.length; i++) {
42628
+ const key = entryKeys[i];
42629
+ const entry = entries[key];
42630
+ if (entry !== undefined) {
42631
+ const storeEntry = entry;
42632
+ if (storeEntry.metadata !== undefined) {
42633
+ storeEntry.metadata = {
42634
+ ...storeEntry.metadata,
42635
+ expirationTimestamp: now,
42636
+ };
42637
+ }
42638
+ needWriteBack = true;
42639
+ }
42640
+ }
42641
+ if (needWriteBack) {
42642
+ await durableStore.setEntries(entries, DefaultDurableSegment);
42643
+ }
42644
+ // push a notifyStoreUpdateAvailable message with entryKeys as data into messaging segment
42645
+ await durableStore.setEntries({ notifyStoreUpdateAvailable: { data: entryKeys } }, MessagingDurableSegment);
42646
+ return Promise.resolve(undefined);
42647
+ };
42567
42648
  // set the default cache policy of the base environment
42568
42649
  environment.setDefaultCachePolicy({
42569
42650
  type: 'stale-while-revalidate',
@@ -42594,6 +42675,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
42594
42675
  handleSuccessResponse: { value: handleSuccessResponse },
42595
42676
  handleErrorResponse: { value: handleErrorResponse },
42596
42677
  getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
42678
+ notifyStoreUpdateAvailable: { value: notifyStoreUpdateAvailable },
42597
42679
  });
42598
42680
  }
42599
42681
 
@@ -57715,7 +57797,7 @@ register({
57715
57797
  id: '@salesforce/lds-network-adapter',
57716
57798
  instrument: instrument$1,
57717
57799
  });
57718
- // version: 1.226.0-abf13e106
57800
+ // version: 1.227.1-9eac9f138
57719
57801
 
57720
57802
  const { create: create$2, keys: keys$2 } = Object;
57721
57803
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -75993,7 +76075,7 @@ register({
75993
76075
  configuration: { ...configurationForGraphQLAdapters },
75994
76076
  instrument,
75995
76077
  });
75996
- // version: 1.226.0-0f13e1701
76078
+ // version: 1.227.1-a3108f583
75997
76079
 
75998
76080
  // On core the unstable adapters are re-exported with different names,
75999
76081
 
@@ -78240,7 +78322,7 @@ withDefaultLuvio((luvio) => {
78240
78322
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
78241
78323
  graphQLImperative = ldsAdapter;
78242
78324
  });
78243
- // version: 1.226.0-0f13e1701
78325
+ // version: 1.227.1-a3108f583
78244
78326
 
78245
78327
  var gqlApi = /*#__PURE__*/Object.freeze({
78246
78328
  __proto__: null,
@@ -78954,4 +79036,4 @@ const { luvio } = getRuntime();
78954
79036
  setDefaultLuvio({ luvio });
78955
79037
 
78956
79038
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
78957
- // version: 1.226.0-abf13e106
79039
+ // version: 1.227.1-9eac9f138
@@ -3847,7 +3847,7 @@
3847
3847
  }
3848
3848
  return resourceParams;
3849
3849
  }
3850
- // engine version: 0.144.8-6b791a2d
3850
+ // engine version: 0.145.0-a2297ae0
3851
3851
 
3852
3852
  /**
3853
3853
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3974,7 +3974,7 @@
3974
3974
  }
3975
3975
  callbacks.push(callback);
3976
3976
  }
3977
- // version: 1.226.0-abf13e106
3977
+ // version: 1.227.1-9eac9f138
3978
3978
 
3979
3979
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3980
3980
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15217,7 +15217,7 @@
15217
15217
  * @param subs - all other substitutions
15218
15218
  * @returns an opaque reference to the parsed document
15219
15219
  */
15220
- function gql(literals, ...subs) {
15220
+ function gql$1(literals, ...subs) {
15221
15221
  let inputString;
15222
15222
  let inputSubstitutionFragments;
15223
15223
  if (!literals) {
@@ -15407,7 +15407,35 @@
15407
15407
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15408
15408
  return luvioDocumentNode;
15409
15409
  }
15410
- // version: 1.226.0-abf13e106
15410
+
15411
+ function validateDocument(root) {
15412
+ const validationMessages = [];
15413
+ const { definitions } = root;
15414
+ for (let i = 0; i < definitions.length; i++) {
15415
+ const definition = definitions[i];
15416
+ if (definition.kind === 'OperationDefinition') {
15417
+ const { operation, name } = definition;
15418
+ if (operation !== 'query') {
15419
+ validationMessages.push(`Unsupported ${operation} ${name ? `(${name.value}) ` : ''}operation.`);
15420
+ }
15421
+ }
15422
+ }
15423
+ return validationMessages;
15424
+ }
15425
+ function gql(literals, ...subs) {
15426
+ const superResult = gql$1(literals, ...subs);
15427
+ if (superResult !== null) {
15428
+ const root = astResolver(superResult);
15429
+ if (root !== undefined) {
15430
+ const errors = validateDocument(root);
15431
+ if (errors.length > 0) {
15432
+ throw new SyntaxError(`There are unsupported operations in the graphql query:\n${errors.join('\n')}`);
15433
+ }
15434
+ }
15435
+ }
15436
+ return superResult;
15437
+ }
15438
+ // version: 1.227.1-9eac9f138
15411
15439
 
15412
15440
  function unwrap(data) {
15413
15441
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16330,7 +16358,7 @@
16330
16358
  const { apiFamily, name } = metadata;
16331
16359
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16332
16360
  }
16333
- // version: 1.226.0-abf13e106
16361
+ // version: 1.227.1-9eac9f138
16334
16362
 
16335
16363
  /**
16336
16364
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16429,7 +16457,7 @@
16429
16457
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
16430
16458
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
16431
16459
  })(TypeCheckShapes || (TypeCheckShapes = {}));
16432
- // engine version: 0.144.8-6b791a2d
16460
+ // engine version: 0.145.0-a2297ae0
16433
16461
 
16434
16462
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16435
16463
 
@@ -41123,7 +41151,7 @@
41123
41151
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListViewSummaryUpdateAvailable', notifyUpdateAvailableFactory$1));
41124
41152
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory));
41125
41153
  });
41126
- // version: 1.226.0-0f13e1701
41154
+ // version: 1.227.1-a3108f583
41127
41155
 
41128
41156
  var caseSensitiveUserId = '005B0000000GR4OIAW';
41129
41157
 
@@ -41727,6 +41755,8 @@
41727
41755
  }
41728
41756
  const DefaultDurableSegment = 'DEFAULT';
41729
41757
  const RedirectDurableSegment = 'REDIRECT_KEYS';
41758
+ const MessagingDurableSegment = 'MESSAGING';
41759
+ const MessageNotifyStoreUpdateAvailable = 'notifyStoreUpdateAvailable';
41730
41760
 
41731
41761
  const { keys: keys$7, create: create$6, assign: assign$6, freeze: freeze$1$1 } = Object;
41732
41762
 
@@ -42162,6 +42192,7 @@
42162
42192
  const defaultSegmentKeys = [];
42163
42193
  const adapterContextSegmentKeys = [];
42164
42194
  const redirectSegmentKeys = [];
42195
+ const messagingSegmentKeys = [];
42165
42196
  let shouldBroadcast = false;
42166
42197
  for (let i = 0, len = changes.length; i < len; i++) {
42167
42198
  const change = changes[i];
@@ -42176,6 +42207,9 @@
42176
42207
  else if (change.segment === RedirectDurableSegment) {
42177
42208
  redirectSegmentKeys.push(...change.ids);
42178
42209
  }
42210
+ else if (change.segment === MessagingDurableSegment) {
42211
+ messagingSegmentKeys.push(...change.ids);
42212
+ }
42179
42213
  }
42180
42214
  if (redirectSegmentKeys.length > 0) {
42181
42215
  const redirectEntries = await durableStore.getEntries(redirectSegmentKeys, RedirectDurableSegment);
@@ -42235,6 +42269,20 @@
42235
42269
  if (shouldBroadcast) {
42236
42270
  await environment.storeBroadcast(rebuildSnapshot, environment.snapshotAvailable);
42237
42271
  }
42272
+ // if having notifyStoreUpdateAvailable msg, then pull the message body out from store
42273
+ // and call environment.notifyStoreUpdateAvailable
42274
+ if (messagingSegmentKeys.includes(MessageNotifyStoreUpdateAvailable)) {
42275
+ const entries = await durableStore.getEntries([MessageNotifyStoreUpdateAvailable], MessagingDurableSegment);
42276
+ if (entries !== undefined) {
42277
+ const notifyEntry = entries[MessageNotifyStoreUpdateAvailable];
42278
+ if (notifyEntry !== undefined) {
42279
+ const keys = notifyEntry.data;
42280
+ if (keys.length > 0) {
42281
+ environment.notifyStoreUpdateAvailable(keys);
42282
+ }
42283
+ }
42284
+ }
42285
+ }
42238
42286
  });
42239
42287
  const dispose = function () {
42240
42288
  validateNotDisposed();
@@ -42570,6 +42618,39 @@
42570
42618
  return entries;
42571
42619
  });
42572
42620
  };
42621
+ // flag entries specified by keys in durable store as expired.
42622
+ // send a notifyStoreUpdateAvailable message through durable store set entries to
42623
+ // indirectly triggers all js environments to refresh snapshots if overlapping with keys.
42624
+ const notifyStoreUpdateAvailable = async function (keys$1) {
42625
+ validateNotDisposed();
42626
+ const entryKeys = keys$1.map(serializeStructuredKey);
42627
+ const entries = await durableStore.getEntries(entryKeys, DefaultDurableSegment);
42628
+ if (entries === undefined || keys$7(entries).length === 0) {
42629
+ return environment.notifyStoreUpdateAvailable(keys$1);
42630
+ }
42631
+ const now = Date.now();
42632
+ let needWriteBack = false;
42633
+ for (let i = 0; i < entryKeys.length; i++) {
42634
+ const key = entryKeys[i];
42635
+ const entry = entries[key];
42636
+ if (entry !== undefined) {
42637
+ const storeEntry = entry;
42638
+ if (storeEntry.metadata !== undefined) {
42639
+ storeEntry.metadata = {
42640
+ ...storeEntry.metadata,
42641
+ expirationTimestamp: now,
42642
+ };
42643
+ }
42644
+ needWriteBack = true;
42645
+ }
42646
+ }
42647
+ if (needWriteBack) {
42648
+ await durableStore.setEntries(entries, DefaultDurableSegment);
42649
+ }
42650
+ // push a notifyStoreUpdateAvailable message with entryKeys as data into messaging segment
42651
+ await durableStore.setEntries({ notifyStoreUpdateAvailable: { data: entryKeys } }, MessagingDurableSegment);
42652
+ return Promise.resolve(undefined);
42653
+ };
42573
42654
  // set the default cache policy of the base environment
42574
42655
  environment.setDefaultCachePolicy({
42575
42656
  type: 'stale-while-revalidate',
@@ -42600,6 +42681,7 @@
42600
42681
  handleSuccessResponse: { value: handleSuccessResponse },
42601
42682
  handleErrorResponse: { value: handleErrorResponse },
42602
42683
  getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
42684
+ notifyStoreUpdateAvailable: { value: notifyStoreUpdateAvailable },
42603
42685
  });
42604
42686
  }
42605
42687
 
@@ -57721,7 +57803,7 @@
57721
57803
  id: '@salesforce/lds-network-adapter',
57722
57804
  instrument: instrument$1,
57723
57805
  });
57724
- // version: 1.226.0-abf13e106
57806
+ // version: 1.227.1-9eac9f138
57725
57807
 
57726
57808
  const { create: create$2, keys: keys$2 } = Object;
57727
57809
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -75999,7 +76081,7 @@
75999
76081
  configuration: { ...configurationForGraphQLAdapters },
76000
76082
  instrument,
76001
76083
  });
76002
- // version: 1.226.0-0f13e1701
76084
+ // version: 1.227.1-a3108f583
76003
76085
 
76004
76086
  // On core the unstable adapters are re-exported with different names,
76005
76087
 
@@ -78246,7 +78328,7 @@
78246
78328
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
78247
78329
  graphQLImperative = ldsAdapter;
78248
78330
  });
78249
- // version: 1.226.0-0f13e1701
78331
+ // version: 1.227.1-a3108f583
78250
78332
 
78251
78333
  var gqlApi = /*#__PURE__*/Object.freeze({
78252
78334
  __proto__: null,
@@ -78977,4 +79059,4 @@
78977
79059
  Object.defineProperty(exports, '__esModule', { value: true });
78978
79060
 
78979
79061
  }));
78980
- // version: 1.226.0-abf13e106
79062
+ // version: 1.227.1-9eac9f138
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.226.0",
3
+ "version": "1.227.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",