@salesforce/lds-worker-api 1.349.0 → 1.351.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.
@@ -1128,4 +1128,4 @@ if (process.env.NODE_ENV !== 'production') {
1128
1128
  }
1129
1129
 
1130
1130
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1131
- // version: 1.349.0-3d2a6c656b
1131
+ // version: 1.351.0-0449b64264
@@ -4266,7 +4266,7 @@ function withDefaultLuvio(callback) {
4266
4266
  }
4267
4267
  callbacks.push(callback);
4268
4268
  }
4269
- // version: 1.349.0-3d2a6c656b
4269
+ // version: 1.351.0-0449b64264
4270
4270
 
4271
4271
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4272
4272
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5214,7 +5214,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5214
5214
  const { apiFamily, name } = metadata;
5215
5215
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5216
5216
  }
5217
- // version: 1.349.0-3d2a6c656b
5217
+ // version: 1.351.0-0449b64264
5218
5218
 
5219
5219
  /**
5220
5220
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -33984,7 +33984,7 @@ withDefaultLuvio((luvio) => {
33984
33984
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33985
33985
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33986
33986
  });
33987
- // version: 1.349.0-2008e7132b
33987
+ // version: 1.351.0-6576e8aaf1
33988
33988
 
33989
33989
  /**
33990
33990
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90311,6 +90311,7 @@ class PrimingSession extends EventEmitter {
90311
90311
  for (const result of results) {
90312
90312
  this.processFetchedRecords(result, abortController);
90313
90313
  }
90314
+ this.handlePaginations(results, batch);
90314
90315
  });
90315
90316
  },
90316
90317
  cancelFn: () => {
@@ -90323,6 +90324,18 @@ class PrimingSession extends EventEmitter {
90323
90324
  });
90324
90325
  }
90325
90326
  }
90327
+ handlePaginations(results, batch) {
90328
+ const ids = this.recordLoader.getMissingIdsWithPagination(results);
90329
+ if (ids.size > 0) {
90330
+ const batches = chunk(Array.from(ids), this.batchSize).map((chunkOfIds) => ({
90331
+ type: batch.type,
90332
+ ids: chunkOfIds,
90333
+ fields: batch.fields,
90334
+ objectInfo: batch.objectInfo,
90335
+ }));
90336
+ this.enqueueBatches(batches);
90337
+ }
90338
+ }
90326
90339
  processFetchedRecords(result, abortController) {
90327
90340
  if (result.ok === false) {
90328
90341
  const { error } = result;
@@ -90341,7 +90354,7 @@ class PrimingSession extends EventEmitter {
90341
90354
  return;
90342
90355
  }
90343
90356
  const { missingIds } = result;
90344
- if (missingIds.length > 0) {
90357
+ if (missingIds.length > 0 && !this.recordLoader.isResultWithPagination(result)) {
90345
90358
  this.emit('error', {
90346
90359
  ids: missingIds,
90347
90360
  code: 'not-found',
@@ -90550,6 +90563,18 @@ class NetworkRecordLoader {
90550
90563
  }
90551
90564
  }
90552
90565
  }
90566
+ isResultWithPagination(result) {
90567
+ return 'paginationToken' in result;
90568
+ }
90569
+ getMissingIdsWithPagination(results) {
90570
+ const ids = new Set();
90571
+ results.forEach((result) => {
90572
+ if (this.isResultWithPagination(result)) {
90573
+ result.missingIds.forEach((id) => ids.add(id));
90574
+ }
90575
+ });
90576
+ return ids;
90577
+ }
90553
90578
  async sendRequest(request, abortController) {
90554
90579
  let response = await this.networkAdapter.sendRequest(request, abortController);
90555
90580
  if (response.status < 200 || response.status > 299) {
@@ -90967,6 +90992,7 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
90967
90992
  ok: true,
90968
90993
  records,
90969
90994
  missingIds: Array.from(missingRecordIds),
90995
+ ...(queryResult.nextRecordsUrl && { paginationToken: queryResult.nextRecordsUrl }),
90970
90996
  };
90971
90997
  }
90972
90998
  }
@@ -92953,7 +92979,7 @@ register$1({
92953
92979
  id: '@salesforce/lds-network-adapter',
92954
92980
  instrument: instrument$2,
92955
92981
  });
92956
- // version: 1.349.0-3d2a6c656b
92982
+ // version: 1.351.0-0449b64264
92957
92983
 
92958
92984
  const { create: create$2, keys: keys$2 } = Object;
92959
92985
  const { stringify, parse } = JSON;
@@ -116848,7 +116874,7 @@ register$1({
116848
116874
  configuration: { ...configurationForGraphQLAdapters$1 },
116849
116875
  instrument: instrument$1,
116850
116876
  });
116851
- // version: 1.349.0-2008e7132b
116877
+ // version: 1.351.0-6576e8aaf1
116852
116878
 
116853
116879
  // On core the unstable adapters are re-exported with different names,
116854
116880
  // we want to match them here.
@@ -117000,7 +117026,7 @@ withDefaultLuvio((luvio) => {
117000
117026
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
117001
117027
  graphQLImperative = ldsAdapter;
117002
117028
  });
117003
- // version: 1.349.0-2008e7132b
117029
+ // version: 1.351.0-6576e8aaf1
117004
117030
 
117005
117031
  var gqlApi = /*#__PURE__*/Object.freeze({
117006
117032
  __proto__: null,
@@ -117792,7 +117818,7 @@ const callbacks$1 = [];
117792
117818
  function register(r) {
117793
117819
  callbacks$1.forEach((callback) => callback(r));
117794
117820
  }
117795
- // version: 1.349.0-3d2a6c656b
117821
+ // version: 1.351.0-0449b64264
117796
117822
 
117797
117823
  /**
117798
117824
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -118872,4 +118898,4 @@ const { luvio } = getRuntime();
118872
118898
  setDefaultLuvio({ luvio });
118873
118899
 
118874
118900
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
118875
- // version: 1.349.0-3d2a6c656b
118901
+ // version: 1.351.0-0449b64264
@@ -4272,7 +4272,7 @@
4272
4272
  }
4273
4273
  callbacks.push(callback);
4274
4274
  }
4275
- // version: 1.349.0-3d2a6c656b
4275
+ // version: 1.351.0-0449b64264
4276
4276
 
4277
4277
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4278
4278
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5220,7 +5220,7 @@
5220
5220
  const { apiFamily, name } = metadata;
5221
5221
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5222
5222
  }
5223
- // version: 1.349.0-3d2a6c656b
5223
+ // version: 1.351.0-0449b64264
5224
5224
 
5225
5225
  /**
5226
5226
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -33990,7 +33990,7 @@
33990
33990
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33991
33991
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33992
33992
  });
33993
- // version: 1.349.0-2008e7132b
33993
+ // version: 1.351.0-6576e8aaf1
33994
33994
 
33995
33995
  /**
33996
33996
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90317,6 +90317,7 @@
90317
90317
  for (const result of results) {
90318
90318
  this.processFetchedRecords(result, abortController);
90319
90319
  }
90320
+ this.handlePaginations(results, batch);
90320
90321
  });
90321
90322
  },
90322
90323
  cancelFn: () => {
@@ -90329,6 +90330,18 @@
90329
90330
  });
90330
90331
  }
90331
90332
  }
90333
+ handlePaginations(results, batch) {
90334
+ const ids = this.recordLoader.getMissingIdsWithPagination(results);
90335
+ if (ids.size > 0) {
90336
+ const batches = chunk(Array.from(ids), this.batchSize).map((chunkOfIds) => ({
90337
+ type: batch.type,
90338
+ ids: chunkOfIds,
90339
+ fields: batch.fields,
90340
+ objectInfo: batch.objectInfo,
90341
+ }));
90342
+ this.enqueueBatches(batches);
90343
+ }
90344
+ }
90332
90345
  processFetchedRecords(result, abortController) {
90333
90346
  if (result.ok === false) {
90334
90347
  const { error } = result;
@@ -90347,7 +90360,7 @@
90347
90360
  return;
90348
90361
  }
90349
90362
  const { missingIds } = result;
90350
- if (missingIds.length > 0) {
90363
+ if (missingIds.length > 0 && !this.recordLoader.isResultWithPagination(result)) {
90351
90364
  this.emit('error', {
90352
90365
  ids: missingIds,
90353
90366
  code: 'not-found',
@@ -90556,6 +90569,18 @@
90556
90569
  }
90557
90570
  }
90558
90571
  }
90572
+ isResultWithPagination(result) {
90573
+ return 'paginationToken' in result;
90574
+ }
90575
+ getMissingIdsWithPagination(results) {
90576
+ const ids = new Set();
90577
+ results.forEach((result) => {
90578
+ if (this.isResultWithPagination(result)) {
90579
+ result.missingIds.forEach((id) => ids.add(id));
90580
+ }
90581
+ });
90582
+ return ids;
90583
+ }
90559
90584
  async sendRequest(request, abortController) {
90560
90585
  let response = await this.networkAdapter.sendRequest(request, abortController);
90561
90586
  if (response.status < 200 || response.status > 299) {
@@ -90973,6 +90998,7 @@
90973
90998
  ok: true,
90974
90999
  records,
90975
91000
  missingIds: Array.from(missingRecordIds),
91001
+ ...(queryResult.nextRecordsUrl && { paginationToken: queryResult.nextRecordsUrl }),
90976
91002
  };
90977
91003
  }
90978
91004
  }
@@ -92959,7 +92985,7 @@
92959
92985
  id: '@salesforce/lds-network-adapter',
92960
92986
  instrument: instrument$2,
92961
92987
  });
92962
- // version: 1.349.0-3d2a6c656b
92988
+ // version: 1.351.0-0449b64264
92963
92989
 
92964
92990
  const { create: create$2, keys: keys$2 } = Object;
92965
92991
  const { stringify, parse } = JSON;
@@ -116854,7 +116880,7 @@
116854
116880
  configuration: { ...configurationForGraphQLAdapters$1 },
116855
116881
  instrument: instrument$1,
116856
116882
  });
116857
- // version: 1.349.0-2008e7132b
116883
+ // version: 1.351.0-6576e8aaf1
116858
116884
 
116859
116885
  // On core the unstable adapters are re-exported with different names,
116860
116886
  // we want to match them here.
@@ -117006,7 +117032,7 @@
117006
117032
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
117007
117033
  graphQLImperative = ldsAdapter;
117008
117034
  });
117009
- // version: 1.349.0-2008e7132b
117035
+ // version: 1.351.0-6576e8aaf1
117010
117036
 
117011
117037
  var gqlApi = /*#__PURE__*/Object.freeze({
117012
117038
  __proto__: null,
@@ -117798,7 +117824,7 @@
117798
117824
  function register(r) {
117799
117825
  callbacks$1.forEach((callback) => callback(r));
117800
117826
  }
117801
- // version: 1.349.0-3d2a6c656b
117827
+ // version: 1.351.0-0449b64264
117802
117828
 
117803
117829
  /**
117804
117830
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -118897,4 +118923,4 @@
118897
118923
  exports.subscribeToAdapter = subscribeToAdapter;
118898
118924
 
118899
118925
  }));
118900
- // version: 1.349.0-3d2a6c656b
118926
+ // version: 1.351.0-0449b64264
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.349.0",
3
+ "version": "1.351.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.349.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.349.0",
40
- "@salesforce/lds-default-luvio": "^1.349.0",
41
- "@salesforce/lds-drafts": "^1.349.0",
42
- "@salesforce/lds-graphql-parser": "^1.349.0",
43
- "@salesforce/lds-luvio-engine": "^1.349.0",
44
- "@salesforce/lds-runtime-mobile": "^1.349.0",
45
- "@salesforce/nimbus-plugin-lds": "^1.349.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.351.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.351.0",
40
+ "@salesforce/lds-default-luvio": "^1.351.0",
41
+ "@salesforce/lds-drafts": "^1.351.0",
42
+ "@salesforce/lds-graphql-parser": "^1.351.0",
43
+ "@salesforce/lds-luvio-engine": "^1.351.0",
44
+ "@salesforce/lds-runtime-mobile": "^1.351.0",
45
+ "@salesforce/nimbus-plugin-lds": "^1.351.0",
46
46
  "ajv": "^8.11.0",
47
47
  "glob": "^7.1.5",
48
48
  "nimbus-types": "^2.0.0-alpha1",