@salesforce/lds-worker-api 1.290.0 → 1.292.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.
Files changed (15) hide show
  1. package/dist/sfdc/es/ldsWorkerApi.js +1 -1
  2. package/dist/standalone/es/lds-worker-api.js +94 -16
  3. package/dist/standalone/umd/lds-worker-api.js +94 -16
  4. package/package.json +10 -10
  5. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/objectInfos/Aircraft-objectInfo.network-mock.json +107 -75
  6. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/objectInfos/Pilot-objectInfo.network-mock.json +22 -2
  7. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/Account.network-mock.json +138 -2
  8. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/AssignedResource.network-mock.json +72 -7
  9. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/Case.network-mock.json +168 -16
  10. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/ServiceAppointment.network-mock.json +258 -23
  11. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/ServiceResource.network-mock.json +106 -10
  12. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/TimeSheetEntry.network-mock.json +52 -2
  13. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/User.network-mock.json +440 -13
  14. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/WorkOrder.network-mock.json +160 -2
  15. package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/WorkType.network-mock.json +48 -2
@@ -1074,4 +1074,4 @@ if (process.env.NODE_ENV !== 'production') {
1074
1074
  }
1075
1075
 
1076
1076
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1077
- // version: 1.290.0-18c27a6e9
1077
+ // version: 1.292.0-db5dc5800
@@ -4190,7 +4190,7 @@ function withDefaultLuvio(callback) {
4190
4190
  }
4191
4191
  callbacks.push(callback);
4192
4192
  }
4193
- // version: 1.290.0-18c27a6e9
4193
+ // version: 1.292.0-db5dc5800
4194
4194
 
4195
4195
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4196
4196
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15698,7 +15698,7 @@ function gql(literals, ...subs) {
15698
15698
  }
15699
15699
  return superResult;
15700
15700
  }
15701
- // version: 1.290.0-18c27a6e9
15701
+ // version: 1.292.0-db5dc5800
15702
15702
 
15703
15703
  function unwrap(data) {
15704
15704
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16623,7 +16623,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16623
16623
  const { apiFamily, name } = metadata;
16624
16624
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16625
16625
  }
16626
- // version: 1.290.0-18c27a6e9
16626
+ // version: 1.292.0-db5dc5800
16627
16627
 
16628
16628
  /**
16629
16629
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -24660,7 +24660,7 @@ const factory$h = (luvio) => {
24660
24660
  };
24661
24661
 
24662
24662
  const TTL$w = 900000;
24663
- const VERSION$12$1 = "ec9370a0cd56f4769fe9ec5cd942ff30";
24663
+ const VERSION$12$1 = "2302a71ca718abb60353eb88dedb1c12";
24664
24664
  const RepresentationType$N = 'ObjectInfoRepresentation';
24665
24665
  function keyBuilder$1V(luvio, config) {
24666
24666
  return keyPrefix$2 + '::' + RepresentationType$N + ':' + config.apiName;
@@ -24699,6 +24699,10 @@ const select$1G = function ObjectInfoRepresentationSelect() {
24699
24699
  kind: 'Object',
24700
24700
  opaque: true
24701
24701
  },
24702
+ {
24703
+ name: 'compactLayoutable',
24704
+ kind: 'Scalar'
24705
+ },
24702
24706
  {
24703
24707
  name: 'createable',
24704
24708
  kind: 'Scalar'
@@ -24763,6 +24767,10 @@ const select$1G = function ObjectInfoRepresentationSelect() {
24763
24767
  kind: 'Object',
24764
24768
  opaque: true
24765
24769
  },
24770
+ {
24771
+ name: 'searchLayoutable',
24772
+ kind: 'Scalar'
24773
+ },
24766
24774
  {
24767
24775
  name: 'searchable',
24768
24776
  kind: 'Scalar'
@@ -29638,7 +29646,7 @@ function getTypeCacheKeys$z$1(rootKeySet, luvio, input, fullPathFactory) {
29638
29646
  }
29639
29647
 
29640
29648
  const TTL$n = 300000;
29641
- const VERSION$O$1 = "b33c534240965bedfcf073228d48b940";
29649
+ const VERSION$O$1 = "0cd492fdd6c713c206ef53dc02175f71";
29642
29650
  const RepresentationType$x = 'AppRepresentation';
29643
29651
  function keyBuilder$1k(luvio, config) {
29644
29652
  return keyPrefix$2 + '::' + RepresentationType$x + ':' + (config.appId === null ? '' : config.appId);
@@ -29729,6 +29737,10 @@ const select$1g$1 = function AppRepresentationSelect() {
29729
29737
  name: 'isNavTabPersistenceDisabled',
29730
29738
  kind: 'Scalar'
29731
29739
  },
29740
+ {
29741
+ name: 'isOmniPinnedViewEnabled',
29742
+ kind: 'Scalar'
29743
+ },
29732
29744
  {
29733
29745
  name: 'label',
29734
29746
  kind: 'Scalar'
@@ -29784,6 +29796,11 @@ function equals$E(existing, incoming) {
29784
29796
  if (!(existing_isNavTabPersistenceDisabled === incoming_isNavTabPersistenceDisabled)) {
29785
29797
  return false;
29786
29798
  }
29799
+ const existing_isOmniPinnedViewEnabled = existing.isOmniPinnedViewEnabled;
29800
+ const incoming_isOmniPinnedViewEnabled = incoming.isOmniPinnedViewEnabled;
29801
+ if (!(existing_isOmniPinnedViewEnabled === incoming_isOmniPinnedViewEnabled)) {
29802
+ return false;
29803
+ }
29787
29804
  const existing_selected = existing.selected;
29788
29805
  const incoming_selected = incoming.selected;
29789
29806
  if (!(existing_selected === incoming_selected)) {
@@ -38013,7 +38030,7 @@ function generateClientToken(offset) {
38013
38030
  }
38014
38031
  // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
38015
38032
  // base64 character set, plus padding character (=)
38016
- const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
38033
+ const b64$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
38017
38034
  function base64Encode(input) {
38018
38035
  let bitmap, a, b, c;
38019
38036
  let result = "", i = 0;
@@ -38025,8 +38042,8 @@ function base64Encode(input) {
38025
38042
  throw new TypeError("Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. " + input);
38026
38043
  }
38027
38044
  bitmap = (a << 16) | (b << 8) | c;
38028
- result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63)
38029
- + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
38045
+ result += b64$1.charAt(bitmap >> 18 & 63) + b64$1.charAt(bitmap >> 12 & 63)
38046
+ + b64$1.charAt(bitmap >> 6 & 63) + b64$1.charAt(bitmap & 63);
38030
38047
  }
38031
38048
  // If there's need of padding, replace the last 'A's with equal signs
38032
38049
  return rest ? result.slice(0, rest - 3) + "===".substring(rest) : result;
@@ -42927,7 +42944,14 @@ const createRecord_ConfigPropertyMetadata = [
42927
42944
  const createResourceParams$4 = /*#__PURE__*/ createResourceParams$13(createRecord_ConfigPropertyMetadata);
42928
42945
 
42929
42946
  function onResponseSuccess(luvio, response, recordIngest, conflictMap) {
42930
- const { body } = response;
42947
+ const { body, status } = response;
42948
+ if (status === HttpStatusCode$1.NoContent) {
42949
+ const syntheticSnapshot = {
42950
+ state: 'Fulfilled',
42951
+ data: {},
42952
+ };
42953
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
42954
+ }
42931
42955
  const selections = buildSelectionFromRecord(body);
42932
42956
  const key = keyBuilder$26(luvio, {
42933
42957
  recordId: body.id,
@@ -43179,6 +43203,14 @@ function buildNetworkSnapshot$2$1(luvio, config, clientOptions) {
43179
43203
  const recordIngest = createRecordIngest(fieldTrie, optionalFieldTrie, conflictMap);
43180
43204
  return luvio.dispatchResourceRequest(request).then((response) => {
43181
43205
  return luvio.handleSuccessResponse(() => {
43206
+ if (response.status === HttpStatusCode$1.NoContent) {
43207
+ const syntheticSnapshot = {
43208
+ state: 'Fulfilled',
43209
+ data: {},
43210
+ };
43211
+ luvio.storeEvict(keyBuilder$26(luvio, { recordId }));
43212
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
43213
+ }
43182
43214
  const snapshot = ingestRecordResponse(luvio, response, recordId, recordIngest, conflictMap);
43183
43215
  return luvio.storeBroadcast().then(() => snapshot);
43184
43216
  }, () => {
@@ -44188,7 +44220,7 @@ withDefaultLuvio((luvio) => {
44188
44220
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44189
44221
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44190
44222
  });
44191
- // version: 1.290.0-e2ccd0161
44223
+ // version: 1.292.0-5ad1fe2ca
44192
44224
 
44193
44225
  var ldsIdempotencyWriteDisabled = {
44194
44226
  isOpen: function (e) {
@@ -53407,6 +53439,32 @@ async function readIngestionTimestampForKey(key, query) {
53407
53439
  return ingestionTimestamp;
53408
53440
  }
53409
53441
 
53442
+ // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
53443
+ // base64 character set, plus padding character (=)
53444
+ const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
53445
+ function btoaPolyfill(input) {
53446
+ let bitmap, a, b, c;
53447
+ let result = '', i = 0;
53448
+ const rest = input.length % 3; // To determine the final padding
53449
+ for (; i < input.length;) {
53450
+ if ((a = input.charCodeAt(i++)) > 255 ||
53451
+ (b = input.charCodeAt(i++)) > 255 ||
53452
+ (c = input.charCodeAt(i++)) > 255) {
53453
+ throw new TypeError('Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. ' +
53454
+ input);
53455
+ }
53456
+ bitmap = (a << 16) | (b << 8) | c;
53457
+ result +=
53458
+ b64.charAt((bitmap >> 18) & 63) +
53459
+ b64.charAt((bitmap >> 12) & 63) +
53460
+ b64.charAt((bitmap >> 6) & 63) +
53461
+ b64.charAt(bitmap & 63);
53462
+ }
53463
+ // If there's need of padding, replace the last 'A's with equal signs
53464
+ return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
53465
+ }
53466
+ const base64encode = typeof btoa === 'function' ? btoa : btoaPolyfill;
53467
+
53410
53468
  function findSpanningField(name) {
53411
53469
  return (field) => {
53412
53470
  return (field.apiName === name ||
@@ -53688,6 +53746,11 @@ function addResolversToSchema(schema, polyFields) {
53688
53746
  return { recordRepresentation, ingestionTimestamp };
53689
53747
  };
53690
53748
  }
53749
+ else if (field.name === 'cursor') {
53750
+ field.resolve = function ({ index }) {
53751
+ return base64encode(`v1:${index}`);
53752
+ };
53753
+ }
53691
53754
  }
53692
53755
  }
53693
53756
  if (isRecordType(type)) {
@@ -53904,10 +53967,11 @@ async function connectionEdgeResolver(obj, _args, context) {
53904
53967
  //map each sql result with the ingestion timestamp to pass it down a level
53905
53968
  return results.rows
53906
53969
  .map((row) => row[0])
53907
- .map((record) => {
53970
+ .map((record, index) => {
53908
53971
  return {
53909
53972
  record,
53910
53973
  ingestionTimestamp,
53974
+ index,
53911
53975
  };
53912
53976
  });
53913
53977
  }
@@ -62056,6 +62120,20 @@ class SqlitePrimingStore {
62056
62120
  async writeBatch(records, overwrite) {
62057
62121
  const idsToPrime = new Set();
62058
62122
  const written = [];
62123
+ if (overwrite === true) {
62124
+ // if overwrite is true we need to raise change notifications so use the batchOperations
62125
+ const operations = {};
62126
+ for (const { record, metadata } of records) {
62127
+ const key = keyBuilder$26(this.getLuvio(), { recordId: record.id });
62128
+ idsToPrime.add(record.id);
62129
+ operations[key] = {
62130
+ data: record,
62131
+ metadata: { ...metadata, metadataVersion: DURABLE_METADATA_VERSION },
62132
+ };
62133
+ }
62134
+ await this.store.setEntries(operations, DefaultDurableSegment);
62135
+ return { written: Array.from(idsToPrime), conflicted: [], errors: [] };
62136
+ }
62059
62137
  const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
62060
62138
  .map((_) => `(?,?,?)`)
62061
62139
  .join(',')} returning key;`;
@@ -62421,7 +62499,7 @@ register$1({
62421
62499
  id: '@salesforce/lds-network-adapter',
62422
62500
  instrument: instrument$2,
62423
62501
  });
62424
- // version: 1.290.0-18c27a6e9
62502
+ // version: 1.292.0-db5dc5800
62425
62503
 
62426
62504
  const { create: create$3, keys: keys$3 } = Object;
62427
62505
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82485,7 +82563,7 @@ register$1({
82485
82563
  configuration: { ...configurationForGraphQLAdapters$1 },
82486
82564
  instrument: instrument$1,
82487
82565
  });
82488
- // version: 1.290.0-e2ccd0161
82566
+ // version: 1.292.0-5ad1fe2ca
82489
82567
 
82490
82568
  // On core the unstable adapters are re-exported with different names,
82491
82569
  // we want to match them here.
@@ -84741,7 +84819,7 @@ withDefaultLuvio((luvio) => {
84741
84819
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84742
84820
  graphQLImperative = ldsAdapter;
84743
84821
  });
84744
- // version: 1.290.0-e2ccd0161
84822
+ // version: 1.292.0-5ad1fe2ca
84745
84823
 
84746
84824
  var gqlApi = /*#__PURE__*/Object.freeze({
84747
84825
  __proto__: null,
@@ -85479,7 +85557,7 @@ const callbacks$1 = [];
85479
85557
  function register(r) {
85480
85558
  callbacks$1.forEach((callback) => callback(r));
85481
85559
  }
85482
- // version: 1.290.0-18c27a6e9
85560
+ // version: 1.292.0-db5dc5800
85483
85561
 
85484
85562
  /**
85485
85563
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90441,4 +90519,4 @@ const { luvio } = getRuntime();
90441
90519
  setDefaultLuvio({ luvio });
90442
90520
 
90443
90521
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
90444
- // version: 1.290.0-18c27a6e9
90522
+ // version: 1.292.0-db5dc5800
@@ -4196,7 +4196,7 @@
4196
4196
  }
4197
4197
  callbacks.push(callback);
4198
4198
  }
4199
- // version: 1.290.0-18c27a6e9
4199
+ // version: 1.292.0-db5dc5800
4200
4200
 
4201
4201
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4202
4202
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15704,7 +15704,7 @@
15704
15704
  }
15705
15705
  return superResult;
15706
15706
  }
15707
- // version: 1.290.0-18c27a6e9
15707
+ // version: 1.292.0-db5dc5800
15708
15708
 
15709
15709
  function unwrap(data) {
15710
15710
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16629,7 +16629,7 @@
16629
16629
  const { apiFamily, name } = metadata;
16630
16630
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16631
16631
  }
16632
- // version: 1.290.0-18c27a6e9
16632
+ // version: 1.292.0-db5dc5800
16633
16633
 
16634
16634
  /**
16635
16635
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -24666,7 +24666,7 @@
24666
24666
  };
24667
24667
 
24668
24668
  const TTL$w = 900000;
24669
- const VERSION$12$1 = "ec9370a0cd56f4769fe9ec5cd942ff30";
24669
+ const VERSION$12$1 = "2302a71ca718abb60353eb88dedb1c12";
24670
24670
  const RepresentationType$N = 'ObjectInfoRepresentation';
24671
24671
  function keyBuilder$1V(luvio, config) {
24672
24672
  return keyPrefix$2 + '::' + RepresentationType$N + ':' + config.apiName;
@@ -24705,6 +24705,10 @@
24705
24705
  kind: 'Object',
24706
24706
  opaque: true
24707
24707
  },
24708
+ {
24709
+ name: 'compactLayoutable',
24710
+ kind: 'Scalar'
24711
+ },
24708
24712
  {
24709
24713
  name: 'createable',
24710
24714
  kind: 'Scalar'
@@ -24769,6 +24773,10 @@
24769
24773
  kind: 'Object',
24770
24774
  opaque: true
24771
24775
  },
24776
+ {
24777
+ name: 'searchLayoutable',
24778
+ kind: 'Scalar'
24779
+ },
24772
24780
  {
24773
24781
  name: 'searchable',
24774
24782
  kind: 'Scalar'
@@ -29644,7 +29652,7 @@
29644
29652
  }
29645
29653
 
29646
29654
  const TTL$n = 300000;
29647
- const VERSION$O$1 = "b33c534240965bedfcf073228d48b940";
29655
+ const VERSION$O$1 = "0cd492fdd6c713c206ef53dc02175f71";
29648
29656
  const RepresentationType$x = 'AppRepresentation';
29649
29657
  function keyBuilder$1k(luvio, config) {
29650
29658
  return keyPrefix$2 + '::' + RepresentationType$x + ':' + (config.appId === null ? '' : config.appId);
@@ -29735,6 +29743,10 @@
29735
29743
  name: 'isNavTabPersistenceDisabled',
29736
29744
  kind: 'Scalar'
29737
29745
  },
29746
+ {
29747
+ name: 'isOmniPinnedViewEnabled',
29748
+ kind: 'Scalar'
29749
+ },
29738
29750
  {
29739
29751
  name: 'label',
29740
29752
  kind: 'Scalar'
@@ -29790,6 +29802,11 @@
29790
29802
  if (!(existing_isNavTabPersistenceDisabled === incoming_isNavTabPersistenceDisabled)) {
29791
29803
  return false;
29792
29804
  }
29805
+ const existing_isOmniPinnedViewEnabled = existing.isOmniPinnedViewEnabled;
29806
+ const incoming_isOmniPinnedViewEnabled = incoming.isOmniPinnedViewEnabled;
29807
+ if (!(existing_isOmniPinnedViewEnabled === incoming_isOmniPinnedViewEnabled)) {
29808
+ return false;
29809
+ }
29793
29810
  const existing_selected = existing.selected;
29794
29811
  const incoming_selected = incoming.selected;
29795
29812
  if (!(existing_selected === incoming_selected)) {
@@ -38019,7 +38036,7 @@
38019
38036
  }
38020
38037
  // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
38021
38038
  // base64 character set, plus padding character (=)
38022
- const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
38039
+ const b64$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
38023
38040
  function base64Encode(input) {
38024
38041
  let bitmap, a, b, c;
38025
38042
  let result = "", i = 0;
@@ -38031,8 +38048,8 @@
38031
38048
  throw new TypeError("Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. " + input);
38032
38049
  }
38033
38050
  bitmap = (a << 16) | (b << 8) | c;
38034
- result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63)
38035
- + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
38051
+ result += b64$1.charAt(bitmap >> 18 & 63) + b64$1.charAt(bitmap >> 12 & 63)
38052
+ + b64$1.charAt(bitmap >> 6 & 63) + b64$1.charAt(bitmap & 63);
38036
38053
  }
38037
38054
  // If there's need of padding, replace the last 'A's with equal signs
38038
38055
  return rest ? result.slice(0, rest - 3) + "===".substring(rest) : result;
@@ -42933,7 +42950,14 @@
42933
42950
  const createResourceParams$4 = /*#__PURE__*/ createResourceParams$13(createRecord_ConfigPropertyMetadata);
42934
42951
 
42935
42952
  function onResponseSuccess(luvio, response, recordIngest, conflictMap) {
42936
- const { body } = response;
42953
+ const { body, status } = response;
42954
+ if (status === HttpStatusCode$1.NoContent) {
42955
+ const syntheticSnapshot = {
42956
+ state: 'Fulfilled',
42957
+ data: {},
42958
+ };
42959
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
42960
+ }
42937
42961
  const selections = buildSelectionFromRecord(body);
42938
42962
  const key = keyBuilder$26(luvio, {
42939
42963
  recordId: body.id,
@@ -43185,6 +43209,14 @@
43185
43209
  const recordIngest = createRecordIngest(fieldTrie, optionalFieldTrie, conflictMap);
43186
43210
  return luvio.dispatchResourceRequest(request).then((response) => {
43187
43211
  return luvio.handleSuccessResponse(() => {
43212
+ if (response.status === HttpStatusCode$1.NoContent) {
43213
+ const syntheticSnapshot = {
43214
+ state: 'Fulfilled',
43215
+ data: {},
43216
+ };
43217
+ luvio.storeEvict(keyBuilder$26(luvio, { recordId }));
43218
+ return luvio.storeBroadcast().then(() => syntheticSnapshot);
43219
+ }
43188
43220
  const snapshot = ingestRecordResponse(luvio, response, recordId, recordIngest, conflictMap);
43189
43221
  return luvio.storeBroadcast().then(() => snapshot);
43190
43222
  }, () => {
@@ -44194,7 +44226,7 @@
44194
44226
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44195
44227
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44196
44228
  });
44197
- // version: 1.290.0-e2ccd0161
44229
+ // version: 1.292.0-5ad1fe2ca
44198
44230
 
44199
44231
  var ldsIdempotencyWriteDisabled = {
44200
44232
  isOpen: function (e) {
@@ -53413,6 +53445,32 @@
53413
53445
  return ingestionTimestamp;
53414
53446
  }
53415
53447
 
53448
+ // Code lifted from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
53449
+ // base64 character set, plus padding character (=)
53450
+ const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
53451
+ function btoaPolyfill(input) {
53452
+ let bitmap, a, b, c;
53453
+ let result = '', i = 0;
53454
+ const rest = input.length % 3; // To determine the final padding
53455
+ for (; i < input.length;) {
53456
+ if ((a = input.charCodeAt(i++)) > 255 ||
53457
+ (b = input.charCodeAt(i++)) > 255 ||
53458
+ (c = input.charCodeAt(i++)) > 255) {
53459
+ throw new TypeError('Failed base64ToAscii encoding: The string to be encoded contains characters outside of the Latin1 range. ' +
53460
+ input);
53461
+ }
53462
+ bitmap = (a << 16) | (b << 8) | c;
53463
+ result +=
53464
+ b64.charAt((bitmap >> 18) & 63) +
53465
+ b64.charAt((bitmap >> 12) & 63) +
53466
+ b64.charAt((bitmap >> 6) & 63) +
53467
+ b64.charAt(bitmap & 63);
53468
+ }
53469
+ // If there's need of padding, replace the last 'A's with equal signs
53470
+ return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
53471
+ }
53472
+ const base64encode = typeof btoa === 'function' ? btoa : btoaPolyfill;
53473
+
53416
53474
  function findSpanningField(name) {
53417
53475
  return (field) => {
53418
53476
  return (field.apiName === name ||
@@ -53694,6 +53752,11 @@
53694
53752
  return { recordRepresentation, ingestionTimestamp };
53695
53753
  };
53696
53754
  }
53755
+ else if (field.name === 'cursor') {
53756
+ field.resolve = function ({ index }) {
53757
+ return base64encode(`v1:${index}`);
53758
+ };
53759
+ }
53697
53760
  }
53698
53761
  }
53699
53762
  if (isRecordType(type)) {
@@ -53910,10 +53973,11 @@
53910
53973
  //map each sql result with the ingestion timestamp to pass it down a level
53911
53974
  return results.rows
53912
53975
  .map((row) => row[0])
53913
- .map((record) => {
53976
+ .map((record, index) => {
53914
53977
  return {
53915
53978
  record,
53916
53979
  ingestionTimestamp,
53980
+ index,
53917
53981
  };
53918
53982
  });
53919
53983
  }
@@ -62062,6 +62126,20 @@
62062
62126
  async writeBatch(records, overwrite) {
62063
62127
  const idsToPrime = new Set();
62064
62128
  const written = [];
62129
+ if (overwrite === true) {
62130
+ // if overwrite is true we need to raise change notifications so use the batchOperations
62131
+ const operations = {};
62132
+ for (const { record, metadata } of records) {
62133
+ const key = keyBuilder$26(this.getLuvio(), { recordId: record.id });
62134
+ idsToPrime.add(record.id);
62135
+ operations[key] = {
62136
+ data: record,
62137
+ metadata: { ...metadata, metadataVersion: DURABLE_METADATA_VERSION },
62138
+ };
62139
+ }
62140
+ await this.store.setEntries(operations, DefaultDurableSegment);
62141
+ return { written: Array.from(idsToPrime), conflicted: [], errors: [] };
62142
+ }
62065
62143
  const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
62066
62144
  .map((_) => `(?,?,?)`)
62067
62145
  .join(',')} returning key;`;
@@ -62427,7 +62505,7 @@
62427
62505
  id: '@salesforce/lds-network-adapter',
62428
62506
  instrument: instrument$2,
62429
62507
  });
62430
- // version: 1.290.0-18c27a6e9
62508
+ // version: 1.292.0-db5dc5800
62431
62509
 
62432
62510
  const { create: create$3, keys: keys$3 } = Object;
62433
62511
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82491,7 +82569,7 @@
82491
82569
  configuration: { ...configurationForGraphQLAdapters$1 },
82492
82570
  instrument: instrument$1,
82493
82571
  });
82494
- // version: 1.290.0-e2ccd0161
82572
+ // version: 1.292.0-5ad1fe2ca
82495
82573
 
82496
82574
  // On core the unstable adapters are re-exported with different names,
82497
82575
  // we want to match them here.
@@ -84747,7 +84825,7 @@
84747
84825
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84748
84826
  graphQLImperative = ldsAdapter;
84749
84827
  });
84750
- // version: 1.290.0-e2ccd0161
84828
+ // version: 1.292.0-5ad1fe2ca
84751
84829
 
84752
84830
  var gqlApi = /*#__PURE__*/Object.freeze({
84753
84831
  __proto__: null,
@@ -85485,7 +85563,7 @@
85485
85563
  function register(r) {
85486
85564
  callbacks$1.forEach((callback) => callback(r));
85487
85565
  }
85488
- // version: 1.290.0-18c27a6e9
85566
+ // version: 1.292.0-db5dc5800
85489
85567
 
85490
85568
  /**
85491
85569
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90466,4 +90544,4 @@
90466
90544
  exports.subscribeToAdapter = subscribeToAdapter;
90467
90545
 
90468
90546
  }));
90469
- // version: 1.290.0-18c27a6e9
90547
+ // version: 1.292.0-db5dc5800
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.290.0",
3
+ "version": "1.292.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,15 +35,15 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.290.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.290.0",
40
- "@salesforce/lds-default-luvio": "^1.290.0",
41
- "@salesforce/lds-drafts": "^1.290.0",
42
- "@salesforce/lds-graphql-parser": "^1.290.0",
43
- "@salesforce/lds-luvio-engine": "^1.290.0",
44
- "@salesforce/lds-priming": "^1.290.0",
45
- "@salesforce/lds-runtime-mobile": "^1.290.0",
46
- "@salesforce/nimbus-plugin-lds": "^1.290.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.292.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.292.0",
40
+ "@salesforce/lds-default-luvio": "^1.292.0",
41
+ "@salesforce/lds-drafts": "^1.292.0",
42
+ "@salesforce/lds-graphql-parser": "^1.292.0",
43
+ "@salesforce/lds-luvio-engine": "^1.292.0",
44
+ "@salesforce/lds-priming": "^1.292.0",
45
+ "@salesforce/lds-runtime-mobile": "^1.292.0",
46
+ "@salesforce/nimbus-plugin-lds": "^1.292.0",
47
47
  "ajv": "^8.11.0",
48
48
  "glob": "^7.1.5",
49
49
  "nimbus-types": "^2.0.0-alpha1",