@salesforce/lds-worker-api 1.112.2 → 1.114.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.
@@ -747,4 +747,4 @@ if (process.env.NODE_ENV !== 'production') {
747
747
  }
748
748
 
749
749
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
750
- // version: 1.112.2-9a4fdc6da
750
+ // version: 1.114.0-4ac6a5a61
@@ -3776,7 +3776,7 @@ function withDefaultLuvio(callback) {
3776
3776
  }
3777
3777
  callbacks.push(callback);
3778
3778
  }
3779
- // version: 1.112.2-9a4fdc6da
3779
+ // version: 1.114.0-4ac6a5a61
3780
3780
 
3781
3781
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3782
3782
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15200,7 +15200,7 @@ function parseAndVisit(source) {
15200
15200
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15201
15201
  return luvioDocumentNode;
15202
15202
  }
15203
- // version: 1.112.2-9a4fdc6da
15203
+ // version: 1.114.0-4ac6a5a61
15204
15204
 
15205
15205
  function unwrap(data) {
15206
15206
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16113,7 +16113,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16113
16113
  const { apiFamily, name } = metadata;
16114
16114
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16115
16115
  }
16116
- // version: 1.112.2-9a4fdc6da
16116
+ // version: 1.114.0-4ac6a5a61
16117
16117
 
16118
16118
  /**
16119
16119
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -21793,14 +21793,15 @@ function buildDefaultsKey(listRef) {
21793
21793
  * @param config getListUi config
21794
21794
  * @param serverResponse ListUiRepresentation from the server
21795
21795
  */
21796
- function addServerDefaults(config, serverResponse, context) {
21797
- const { records: { sortBy }, info: { listReference }, } = serverResponse;
21798
- if (config.sortBy !== undefined || sortBy === null) {
21796
+ function addServerDefaults(config, records, listReference, context) {
21797
+ // If the request already contains the potential default information,
21798
+ // or the response does not come back with a default
21799
+ if (config.sortBy !== undefined || records.sortBy === null) {
21799
21800
  return;
21800
21801
  }
21801
21802
  const key = buildDefaultsKey(listReference);
21802
21803
  const currentDefaults = context.get(key) || {};
21803
- context.set(key, { ...currentDefaults, sortBy });
21804
+ context.set(key, { ...currentDefaults, sortBy: records.sortBy });
21804
21805
  }
21805
21806
  /**
21806
21807
  * Returns default values observed on previous requests for a list.
@@ -21950,11 +21951,14 @@ function keyBuilder$1L(luvio, params) {
21950
21951
  // Fetch listReference from internal store to better ensure a cache hit regardless of listViewApiName or listViewId
21951
21952
  const listReference = getListReference(query, context$1);
21952
21953
  if (listReference !== undefined) {
21954
+ // Check and use any default values returned from the server (i.e. sortBy)
21955
+ const config = { ...params.urlParams, ...params.queryParams };
21956
+ const defaults = getServerDefaults(config, context$1);
21953
21957
  return keyBuilder$1N(luvio, {
21954
21958
  objectApiName: listReference.objectApiName,
21955
21959
  listViewApiName: listReference.listViewApiName,
21956
21960
  listViewId: listReference.id,
21957
- sortBy: params.queryParams.sortBy || [],
21961
+ sortBy: params.queryParams.sortBy || defaults.sortBy || [],
21958
21962
  });
21959
21963
  }
21960
21964
  // If there are no matching entries in the store, then we haven't fetched any data for this list view yet.
@@ -23338,7 +23342,7 @@ function onResourceSuccess_getListUi(luvio, context, config, response) {
23338
23342
  // remember the id/name of this list
23339
23343
  addListReference(listReference, context);
23340
23344
  // remember any default values that the server filled in
23341
- addServerDefaults(config, body, context);
23345
+ addServerDefaults(config, body.records, listReference, context);
23342
23346
  // build the selector while the list info is still easily accessible
23343
23347
  const fragment = buildListUiFragment(config, context, fields);
23344
23348
  luvio.storeIngest(listUiKey, ingest$E$1, body);
@@ -40735,6 +40739,7 @@ function onFetchResponseSuccess$1$1(luvio, config, resourceParams, response) {
40735
40739
  // Note: The original listReference will remain unchanged in the response.
40736
40740
  mutatedListRef.id = body.listInfoETag;
40737
40741
  addListReferenceWithId(mutatedListRef, context, body.listReference.id);
40742
+ addServerDefaults(config, body, originalListRef, context);
40738
40743
  }
40739
40744
  return onFetchResponseSuccess$2$1(luvio, config, resourceParams, response);
40740
40745
  }
@@ -44301,7 +44306,7 @@ withDefaultLuvio((luvio) => {
44301
44306
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44302
44307
  });
44303
44308
  });
44304
- // version: 1.112.2-9a4fdc6da
44309
+ // version: 1.114.0-16d81e7
44305
44310
 
44306
44311
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44307
44312
 
@@ -59778,7 +59783,7 @@ register({
59778
59783
  id: '@salesforce/lds-network-adapter',
59779
59784
  instrument: instrument$1,
59780
59785
  });
59781
- // version: 1.112.2-9a4fdc6da
59786
+ // version: 1.114.0-4ac6a5a61
59782
59787
 
59783
59788
  const { create: create$2, keys: keys$2 } = Object;
59784
59789
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77504,7 +77509,7 @@ register({
77504
77509
  configuration: { ...configurationForGraphQLAdapters },
77505
77510
  instrument,
77506
77511
  });
77507
- // version: 1.112.2-9a4fdc6da
77512
+ // version: 1.114.0-16d81e7
77508
77513
 
77509
77514
  // On core the unstable adapters are re-exported with different names,
77510
77515
 
@@ -79633,7 +79638,7 @@ withDefaultLuvio((luvio) => {
79633
79638
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79634
79639
  graphQLImperative = ldsAdapter;
79635
79640
  });
79636
- // version: 1.112.2-9a4fdc6da
79641
+ // version: 1.114.0-16d81e7
79637
79642
 
79638
79643
  var gqlApi = /*#__PURE__*/Object.freeze({
79639
79644
  __proto__: null,
@@ -80311,4 +80316,4 @@ const { luvio } = getRuntime();
80311
80316
  setDefaultLuvio({ luvio });
80312
80317
 
80313
80318
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
80314
- // version: 1.112.2-9a4fdc6da
80319
+ // version: 1.114.0-4ac6a5a61
@@ -3782,7 +3782,7 @@
3782
3782
  }
3783
3783
  callbacks.push(callback);
3784
3784
  }
3785
- // version: 1.112.2-9a4fdc6da
3785
+ // version: 1.114.0-4ac6a5a61
3786
3786
 
3787
3787
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3788
3788
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15206,7 +15206,7 @@
15206
15206
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15207
15207
  return luvioDocumentNode;
15208
15208
  }
15209
- // version: 1.112.2-9a4fdc6da
15209
+ // version: 1.114.0-4ac6a5a61
15210
15210
 
15211
15211
  function unwrap(data) {
15212
15212
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16119,7 +16119,7 @@
16119
16119
  const { apiFamily, name } = metadata;
16120
16120
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16121
16121
  }
16122
- // version: 1.112.2-9a4fdc6da
16122
+ // version: 1.114.0-4ac6a5a61
16123
16123
 
16124
16124
  /**
16125
16125
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -21799,14 +21799,15 @@
21799
21799
  * @param config getListUi config
21800
21800
  * @param serverResponse ListUiRepresentation from the server
21801
21801
  */
21802
- function addServerDefaults(config, serverResponse, context) {
21803
- const { records: { sortBy }, info: { listReference }, } = serverResponse;
21804
- if (config.sortBy !== undefined || sortBy === null) {
21802
+ function addServerDefaults(config, records, listReference, context) {
21803
+ // If the request already contains the potential default information,
21804
+ // or the response does not come back with a default
21805
+ if (config.sortBy !== undefined || records.sortBy === null) {
21805
21806
  return;
21806
21807
  }
21807
21808
  const key = buildDefaultsKey(listReference);
21808
21809
  const currentDefaults = context.get(key) || {};
21809
- context.set(key, { ...currentDefaults, sortBy });
21810
+ context.set(key, { ...currentDefaults, sortBy: records.sortBy });
21810
21811
  }
21811
21812
  /**
21812
21813
  * Returns default values observed on previous requests for a list.
@@ -21956,11 +21957,14 @@
21956
21957
  // Fetch listReference from internal store to better ensure a cache hit regardless of listViewApiName or listViewId
21957
21958
  const listReference = getListReference(query, context$1);
21958
21959
  if (listReference !== undefined) {
21960
+ // Check and use any default values returned from the server (i.e. sortBy)
21961
+ const config = { ...params.urlParams, ...params.queryParams };
21962
+ const defaults = getServerDefaults(config, context$1);
21959
21963
  return keyBuilder$1N(luvio, {
21960
21964
  objectApiName: listReference.objectApiName,
21961
21965
  listViewApiName: listReference.listViewApiName,
21962
21966
  listViewId: listReference.id,
21963
- sortBy: params.queryParams.sortBy || [],
21967
+ sortBy: params.queryParams.sortBy || defaults.sortBy || [],
21964
21968
  });
21965
21969
  }
21966
21970
  // If there are no matching entries in the store, then we haven't fetched any data for this list view yet.
@@ -23344,7 +23348,7 @@
23344
23348
  // remember the id/name of this list
23345
23349
  addListReference(listReference, context);
23346
23350
  // remember any default values that the server filled in
23347
- addServerDefaults(config, body, context);
23351
+ addServerDefaults(config, body.records, listReference, context);
23348
23352
  // build the selector while the list info is still easily accessible
23349
23353
  const fragment = buildListUiFragment(config, context, fields);
23350
23354
  luvio.storeIngest(listUiKey, ingest$E$1, body);
@@ -40741,6 +40745,7 @@
40741
40745
  // Note: The original listReference will remain unchanged in the response.
40742
40746
  mutatedListRef.id = body.listInfoETag;
40743
40747
  addListReferenceWithId(mutatedListRef, context, body.listReference.id);
40748
+ addServerDefaults(config, body, originalListRef, context);
40744
40749
  }
40745
40750
  return onFetchResponseSuccess$2$1(luvio, config, resourceParams, response);
40746
40751
  }
@@ -44307,7 +44312,7 @@
44307
44312
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44308
44313
  });
44309
44314
  });
44310
- // version: 1.112.2-9a4fdc6da
44315
+ // version: 1.114.0-16d81e7
44311
44316
 
44312
44317
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44313
44318
 
@@ -59784,7 +59789,7 @@
59784
59789
  id: '@salesforce/lds-network-adapter',
59785
59790
  instrument: instrument$1,
59786
59791
  });
59787
- // version: 1.112.2-9a4fdc6da
59792
+ // version: 1.114.0-4ac6a5a61
59788
59793
 
59789
59794
  const { create: create$2, keys: keys$2 } = Object;
59790
59795
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77510,7 +77515,7 @@
77510
77515
  configuration: { ...configurationForGraphQLAdapters },
77511
77516
  instrument,
77512
77517
  });
77513
- // version: 1.112.2-9a4fdc6da
77518
+ // version: 1.114.0-16d81e7
77514
77519
 
77515
77520
  // On core the unstable adapters are re-exported with different names,
77516
77521
 
@@ -79639,7 +79644,7 @@
79639
79644
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79640
79645
  graphQLImperative = ldsAdapter;
79641
79646
  });
79642
- // version: 1.112.2-9a4fdc6da
79647
+ // version: 1.114.0-16d81e7
79643
79648
 
79644
79649
  var gqlApi = /*#__PURE__*/Object.freeze({
79645
79650
  __proto__: null,
@@ -80334,4 +80339,4 @@
80334
80339
  Object.defineProperty(exports, '__esModule', { value: true });
80335
80340
 
80336
80341
  }));
80337
- // version: 1.112.2-9a4fdc6da
80342
+ // version: 1.114.0-4ac6a5a61
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.112.2",
3
+ "version": "1.114.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/umd/lds-worker-api.js",
@@ -37,15 +37,15 @@
37
37
  "@luvio/engine": "0.137.1",
38
38
  "@luvio/environments": "0.137.1",
39
39
  "@oat-sa/rollup-plugin-wildcard-external": "^0.1.0",
40
- "@salesforce/lds-adapters-graphql": "^1.112.2",
41
- "@salesforce/lds-adapters-uiapi": "^1.112.2",
42
- "@salesforce/lds-default-luvio": "^1.112.2",
43
- "@salesforce/lds-drafts": "^1.112.2",
44
- "@salesforce/lds-graphql-parser": "^1.112.2",
45
- "@salesforce/lds-luvio-engine": "^1.112.2",
46
- "@salesforce/lds-priming": "^1.112.2",
47
- "@salesforce/lds-runtime-mobile": "^1.112.2",
48
- "@salesforce/nimbus-plugin-lds": "^1.112.2",
40
+ "@salesforce/lds-adapters-graphql": "^1.114.0",
41
+ "@salesforce/lds-adapters-uiapi": "^1.114.0",
42
+ "@salesforce/lds-default-luvio": "^1.114.0",
43
+ "@salesforce/lds-drafts": "^1.114.0",
44
+ "@salesforce/lds-graphql-parser": "^1.114.0",
45
+ "@salesforce/lds-luvio-engine": "^1.114.0",
46
+ "@salesforce/lds-priming": "^1.114.0",
47
+ "@salesforce/lds-runtime-mobile": "^1.114.0",
48
+ "@salesforce/nimbus-plugin-lds": "^1.114.0",
49
49
  "ajv": "^8.11.0",
50
50
  "glob": "^7.1.5",
51
51
  "nimbus-types": "^2.0.0-alpha1",
@@ -1,3 +1,5 @@
1
+ /*eslint-env es2020 */
2
+
1
3
  let rows = [];
2
4
  let workOrderRecordId;
3
5
  for (let i = 1; i <= 500; i++) {
@@ -234,7 +236,7 @@ for (let i = 1; i <= 500; i++) {
234
236
  ]);
235
237
  }
236
238
 
237
- global.__nimbus.plugins.LdsSqliteStore.batchOperations(
239
+ globalThis.__nimbus.plugins.LdsSqliteStore.batchOperations(
238
240
  [
239
241
  {
240
242
  type: 'upsert',