@salesforce/lds-worker-api 1.159.1 → 1.160.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.
@@ -770,4 +770,4 @@ if (process.env.NODE_ENV !== 'production') {
770
770
  }
771
771
 
772
772
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
773
- // version: 1.159.1-0b4572813
773
+ // version: 1.160.1-fa935e9ee
@@ -3672,7 +3672,7 @@ class Luvio {
3672
3672
  return this.environment.buildStructuredKey(namespace, representationName, idValues);
3673
3673
  }
3674
3674
  }
3675
- // engine version: 0.143.5-e5a21255
3675
+ // engine version: 0.143.6-adb8408d
3676
3676
 
3677
3677
  /**
3678
3678
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3799,7 +3799,7 @@ function withDefaultLuvio(callback) {
3799
3799
  }
3800
3800
  callbacks.push(callback);
3801
3801
  }
3802
- // version: 1.159.1-0b4572813
3802
+ // version: 1.160.1-fa935e9ee
3803
3803
 
3804
3804
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3805
3805
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15232,7 +15232,7 @@ function parseAndVisit(source) {
15232
15232
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15233
15233
  return luvioDocumentNode;
15234
15234
  }
15235
- // version: 1.159.1-0b4572813
15235
+ // version: 1.160.1-fa935e9ee
15236
15236
 
15237
15237
  function unwrap(data) {
15238
15238
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16145,7 +16145,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16145
16145
  const { apiFamily, name } = metadata;
16146
16146
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16147
16147
  }
16148
- // version: 1.159.1-0b4572813
16148
+ // version: 1.160.1-fa935e9ee
16149
16149
 
16150
16150
  /**
16151
16151
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16228,7 +16228,7 @@ var FragmentReadResultState;
16228
16228
  ({
16229
16229
  state: FragmentReadResultState.Missing,
16230
16230
  });
16231
- // engine version: 0.143.5-e5a21255
16231
+ // engine version: 0.143.6-adb8408d
16232
16232
 
16233
16233
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16234
16234
 
@@ -22174,10 +22174,10 @@ function isErrorSnapshot(snapshot) {
22174
22174
  return snapshot.state === 'Error';
22175
22175
  }
22176
22176
 
22177
- const VERSION$10$1 = "c6347b2701bb8ffb0b6ca6c027011c57";
22177
+ const VERSION$10$1 = "3529c5f7d0eb2206c90a52c6d9f721d4";
22178
22178
  const RepresentationType$K = 'ListViewSummaryRepresentation';
22179
22179
  function keyBuilder$1L(luvio, config) {
22180
- return keyPrefix$1 + '::' + RepresentationType$K + ':' + config.id;
22180
+ return keyPrefix$1 + '::' + RepresentationType$K + ':' + (config.id === null ? '' : config.id);
22181
22181
  }
22182
22182
  function keyBuilderFromType$u(luvio, object) {
22183
22183
  const keyParams = {
@@ -22219,11 +22219,6 @@ function equals$P(existing, incoming) {
22219
22219
  if (!(existing_apiName === incoming_apiName)) {
22220
22220
  return false;
22221
22221
  }
22222
- const existing_id = existing.id;
22223
- const incoming_id = incoming.id;
22224
- if (!(existing_id === incoming_id)) {
22225
- return false;
22226
- }
22227
22222
  const existing_label = existing.label;
22228
22223
  const incoming_label = incoming.label;
22229
22224
  if (!(existing_label === incoming_label)) {
@@ -22234,6 +22229,11 @@ function equals$P(existing, incoming) {
22234
22229
  if (!(existing_listUiUrl === incoming_listUiUrl)) {
22235
22230
  return false;
22236
22231
  }
22232
+ const existing_id = existing.id;
22233
+ const incoming_id = incoming.id;
22234
+ if (!(existing_id === incoming_id)) {
22235
+ return false;
22236
+ }
22237
22237
  return true;
22238
22238
  }
22239
22239
  const ingest$D$1 = function ListViewSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
@@ -40106,7 +40106,7 @@ function ingestAndBroadcast(luvio, key, config, body) {
40106
40106
  return buildCachedSnapshot$5(luvio, config);
40107
40107
  });
40108
40108
  }
40109
- function clone$1(userLayoutState) {
40109
+ function clone$2(userLayoutState) {
40110
40110
  return parse$7(stringify$7(userLayoutState));
40111
40111
  }
40112
40112
  // Applies optimisticUpdate to layoutUserState
@@ -40129,7 +40129,7 @@ function optimisticUpdate(cachedLayoutUserState, layoutUserStateInput) {
40129
40129
  if (clonedLayoutUserState === undefined) {
40130
40130
  // We have to clone cachedLayoutUserState because this object is coming from
40131
40131
  // a snapshot, where it is frozen
40132
- clonedLayoutUserState = clone$1(cachedLayoutUserState);
40132
+ clonedLayoutUserState = clone$2(cachedLayoutUserState);
40133
40133
  // hold onto sectionUserStates from clonedLayoutUserState
40134
40134
  clonedLayoutUserStateSections = clonedLayoutUserState.sectionUserStates;
40135
40135
  }
@@ -44016,7 +44016,7 @@ withDefaultLuvio((luvio) => {
44016
44016
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44017
44017
  });
44018
44018
  });
44019
- // version: 1.159.1-3cc6c1f48
44019
+ // version: 1.160.1-06ddc4b32
44020
44020
 
44021
44021
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44022
44022
 
@@ -48992,10 +48992,56 @@ const { keys: keys$4, create: create$4, assign: assign$4, values: values$2 } = O
48992
48992
  const { stringify: stringify$4, parse: parse$4 } = JSON;
48993
48993
  const { isArray: isArray$3 } = Array;
48994
48994
 
48995
+ function clone$1(obj) {
48996
+ return parse$4(stringify$4(obj));
48997
+ }
48998
+
48999
+ /**
49000
+ * Generates a time-ordered, unique id to associate with a DraftAction. Ensures
49001
+ * no collisions with existing draft action IDs.
49002
+ */
49003
+ function generateUniqueDraftActionId(existingIds) {
49004
+ // new id in milliseconds with some extra digits for collisions
49005
+ let newId = new Date().getTime() * 100;
49006
+ const existingAsNumbers = existingIds
49007
+ .map((id) => parseInt(id, 10))
49008
+ .filter((parsed) => !isNaN(parsed));
49009
+ let counter = 0;
49010
+ while (existingAsNumbers.includes(newId)) {
49011
+ newId += 1;
49012
+ counter += 1;
49013
+ // if the counter is 100+ then somehow this method has been called 100
49014
+ // times in one millisecond
49015
+ if (counter >= 100) {
49016
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
49017
+ throw new Error('Unable to generate unique new draft ID');
49018
+ }
49019
+ }
49020
+ return newId.toString();
49021
+ }
49022
+ /**
49023
+ Use Math.random to generate v4 RFC4122 compliant uuid
49024
+ */
49025
+ function uuidv4() {
49026
+ const uuid = [];
49027
+ for (let i = 0; i < 32; i++) {
49028
+ const random = (Math.random() * 16) | 0;
49029
+ if (i === 8 || i === 12 || i === 16 || i === 20) {
49030
+ uuid.push('-');
49031
+ }
49032
+ uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
49033
+ }
49034
+ return uuid.join('');
49035
+ }
49036
+
49037
+ const IdempotencyKey = 'Idempotency-Key';
48995
49038
  function buildLuvioOverrideForDraftAdapters(luvio, handler, extractTargetIdFromCacheKey, options = {}) {
48996
49039
  // override this to create and enqueue a new draft action, and return synthetic response
48997
49040
  const dispatchResourceRequest = async function (resourceRequest, _context) {
48998
- const { data } = await handler.enqueue(resourceRequest).catch((err) => {
49041
+ const resourceRequestCopy = clone$1(resourceRequest);
49042
+ resourceRequestCopy.headers = resourceRequestCopy.headers || {};
49043
+ resourceRequestCopy.headers[IdempotencyKey] = uuidv4();
49044
+ const { data } = await handler.enqueue(resourceRequestCopy).catch((err) => {
48999
49045
  throw transformErrorToDraftSynthesisError(err);
49000
49046
  });
49001
49047
  if (data === undefined) {
@@ -49087,30 +49133,6 @@ async function clearDraftIdSegment(durableStore) {
49087
49133
  }
49088
49134
  }
49089
49135
 
49090
- /**
49091
- * Generates a time-ordered, unique id to associate with a DraftAction. Ensures
49092
- * no collisions with existing draft action IDs.
49093
- */
49094
- function generateUniqueDraftActionId(existingIds) {
49095
- // new id in milliseconds with some extra digits for collisions
49096
- let newId = new Date().getTime() * 100;
49097
- const existingAsNumbers = existingIds
49098
- .map((id) => parseInt(id, 10))
49099
- .filter((parsed) => !isNaN(parsed));
49100
- let counter = 0;
49101
- while (existingAsNumbers.includes(newId)) {
49102
- newId += 1;
49103
- counter += 1;
49104
- // if the counter is 100+ then somehow this method has been called 100
49105
- // times in one millisecond
49106
- if (counter >= 100) {
49107
- // eslint-disable-next-line @salesforce/lds/no-error-in-production
49108
- throw new Error('Unable to generate unique new draft ID');
49109
- }
49110
- }
49111
- return newId.toString();
49112
- }
49113
-
49114
49136
  var CustomActionResultType;
49115
49137
  (function (CustomActionResultType) {
49116
49138
  CustomActionResultType["SUCCESS"] = "SUCCESS";
@@ -60050,7 +60072,7 @@ register({
60050
60072
  id: '@salesforce/lds-network-adapter',
60051
60073
  instrument: instrument$1,
60052
60074
  });
60053
- // version: 1.159.1-0b4572813
60075
+ // version: 1.160.1-fa935e9ee
60054
60076
 
60055
60077
  const { create: create$2, keys: keys$2 } = Object;
60056
60078
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77532,7 +77554,7 @@ register({
77532
77554
  configuration: { ...configurationForGraphQLAdapters },
77533
77555
  instrument,
77534
77556
  });
77535
- // version: 1.159.1-3cc6c1f48
77557
+ // version: 1.160.1-06ddc4b32
77536
77558
 
77537
77559
  // On core the unstable adapters are re-exported with different names,
77538
77560
 
@@ -79779,7 +79801,7 @@ withDefaultLuvio((luvio) => {
79779
79801
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79780
79802
  graphQLImperative = ldsAdapter;
79781
79803
  });
79782
- // version: 1.159.1-3cc6c1f48
79804
+ // version: 1.160.1-06ddc4b32
79783
79805
 
79784
79806
  var gqlApi = /*#__PURE__*/Object.freeze({
79785
79807
  __proto__: null,
@@ -80468,4 +80490,4 @@ const { luvio } = getRuntime();
80468
80490
  setDefaultLuvio({ luvio });
80469
80491
 
80470
80492
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
80471
- // version: 1.159.1-0b4572813
80493
+ // version: 1.160.1-fa935e9ee
@@ -3678,7 +3678,7 @@
3678
3678
  return this.environment.buildStructuredKey(namespace, representationName, idValues);
3679
3679
  }
3680
3680
  }
3681
- // engine version: 0.143.5-e5a21255
3681
+ // engine version: 0.143.6-adb8408d
3682
3682
 
3683
3683
  /**
3684
3684
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3805,7 +3805,7 @@
3805
3805
  }
3806
3806
  callbacks.push(callback);
3807
3807
  }
3808
- // version: 1.159.1-0b4572813
3808
+ // version: 1.160.1-fa935e9ee
3809
3809
 
3810
3810
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3811
3811
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15238,7 +15238,7 @@
15238
15238
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15239
15239
  return luvioDocumentNode;
15240
15240
  }
15241
- // version: 1.159.1-0b4572813
15241
+ // version: 1.160.1-fa935e9ee
15242
15242
 
15243
15243
  function unwrap(data) {
15244
15244
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16151,7 +16151,7 @@
16151
16151
  const { apiFamily, name } = metadata;
16152
16152
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16153
16153
  }
16154
- // version: 1.159.1-0b4572813
16154
+ // version: 1.160.1-fa935e9ee
16155
16155
 
16156
16156
  /**
16157
16157
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16234,7 +16234,7 @@
16234
16234
  ({
16235
16235
  state: FragmentReadResultState.Missing,
16236
16236
  });
16237
- // engine version: 0.143.5-e5a21255
16237
+ // engine version: 0.143.6-adb8408d
16238
16238
 
16239
16239
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16240
16240
 
@@ -22180,10 +22180,10 @@
22180
22180
  return snapshot.state === 'Error';
22181
22181
  }
22182
22182
 
22183
- const VERSION$10$1 = "c6347b2701bb8ffb0b6ca6c027011c57";
22183
+ const VERSION$10$1 = "3529c5f7d0eb2206c90a52c6d9f721d4";
22184
22184
  const RepresentationType$K = 'ListViewSummaryRepresentation';
22185
22185
  function keyBuilder$1L(luvio, config) {
22186
- return keyPrefix$1 + '::' + RepresentationType$K + ':' + config.id;
22186
+ return keyPrefix$1 + '::' + RepresentationType$K + ':' + (config.id === null ? '' : config.id);
22187
22187
  }
22188
22188
  function keyBuilderFromType$u(luvio, object) {
22189
22189
  const keyParams = {
@@ -22225,11 +22225,6 @@
22225
22225
  if (!(existing_apiName === incoming_apiName)) {
22226
22226
  return false;
22227
22227
  }
22228
- const existing_id = existing.id;
22229
- const incoming_id = incoming.id;
22230
- if (!(existing_id === incoming_id)) {
22231
- return false;
22232
- }
22233
22228
  const existing_label = existing.label;
22234
22229
  const incoming_label = incoming.label;
22235
22230
  if (!(existing_label === incoming_label)) {
@@ -22240,6 +22235,11 @@
22240
22235
  if (!(existing_listUiUrl === incoming_listUiUrl)) {
22241
22236
  return false;
22242
22237
  }
22238
+ const existing_id = existing.id;
22239
+ const incoming_id = incoming.id;
22240
+ if (!(existing_id === incoming_id)) {
22241
+ return false;
22242
+ }
22243
22243
  return true;
22244
22244
  }
22245
22245
  const ingest$D$1 = function ListViewSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
@@ -40112,7 +40112,7 @@
40112
40112
  return buildCachedSnapshot$5(luvio, config);
40113
40113
  });
40114
40114
  }
40115
- function clone$1(userLayoutState) {
40115
+ function clone$2(userLayoutState) {
40116
40116
  return parse$7(stringify$7(userLayoutState));
40117
40117
  }
40118
40118
  // Applies optimisticUpdate to layoutUserState
@@ -40135,7 +40135,7 @@
40135
40135
  if (clonedLayoutUserState === undefined) {
40136
40136
  // We have to clone cachedLayoutUserState because this object is coming from
40137
40137
  // a snapshot, where it is frozen
40138
- clonedLayoutUserState = clone$1(cachedLayoutUserState);
40138
+ clonedLayoutUserState = clone$2(cachedLayoutUserState);
40139
40139
  // hold onto sectionUserStates from clonedLayoutUserState
40140
40140
  clonedLayoutUserStateSections = clonedLayoutUserState.sectionUserStates;
40141
40141
  }
@@ -44022,7 +44022,7 @@
44022
44022
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44023
44023
  });
44024
44024
  });
44025
- // version: 1.159.1-3cc6c1f48
44025
+ // version: 1.160.1-06ddc4b32
44026
44026
 
44027
44027
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44028
44028
 
@@ -48998,10 +48998,56 @@
48998
48998
  const { stringify: stringify$4, parse: parse$4 } = JSON;
48999
48999
  const { isArray: isArray$3 } = Array;
49000
49000
 
49001
+ function clone$1(obj) {
49002
+ return parse$4(stringify$4(obj));
49003
+ }
49004
+
49005
+ /**
49006
+ * Generates a time-ordered, unique id to associate with a DraftAction. Ensures
49007
+ * no collisions with existing draft action IDs.
49008
+ */
49009
+ function generateUniqueDraftActionId(existingIds) {
49010
+ // new id in milliseconds with some extra digits for collisions
49011
+ let newId = new Date().getTime() * 100;
49012
+ const existingAsNumbers = existingIds
49013
+ .map((id) => parseInt(id, 10))
49014
+ .filter((parsed) => !isNaN(parsed));
49015
+ let counter = 0;
49016
+ while (existingAsNumbers.includes(newId)) {
49017
+ newId += 1;
49018
+ counter += 1;
49019
+ // if the counter is 100+ then somehow this method has been called 100
49020
+ // times in one millisecond
49021
+ if (counter >= 100) {
49022
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
49023
+ throw new Error('Unable to generate unique new draft ID');
49024
+ }
49025
+ }
49026
+ return newId.toString();
49027
+ }
49028
+ /**
49029
+ Use Math.random to generate v4 RFC4122 compliant uuid
49030
+ */
49031
+ function uuidv4() {
49032
+ const uuid = [];
49033
+ for (let i = 0; i < 32; i++) {
49034
+ const random = (Math.random() * 16) | 0;
49035
+ if (i === 8 || i === 12 || i === 16 || i === 20) {
49036
+ uuid.push('-');
49037
+ }
49038
+ uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
49039
+ }
49040
+ return uuid.join('');
49041
+ }
49042
+
49043
+ const IdempotencyKey = 'Idempotency-Key';
49001
49044
  function buildLuvioOverrideForDraftAdapters(luvio, handler, extractTargetIdFromCacheKey, options = {}) {
49002
49045
  // override this to create and enqueue a new draft action, and return synthetic response
49003
49046
  const dispatchResourceRequest = async function (resourceRequest, _context) {
49004
- const { data } = await handler.enqueue(resourceRequest).catch((err) => {
49047
+ const resourceRequestCopy = clone$1(resourceRequest);
49048
+ resourceRequestCopy.headers = resourceRequestCopy.headers || {};
49049
+ resourceRequestCopy.headers[IdempotencyKey] = uuidv4();
49050
+ const { data } = await handler.enqueue(resourceRequestCopy).catch((err) => {
49005
49051
  throw transformErrorToDraftSynthesisError(err);
49006
49052
  });
49007
49053
  if (data === undefined) {
@@ -49093,30 +49139,6 @@
49093
49139
  }
49094
49140
  }
49095
49141
 
49096
- /**
49097
- * Generates a time-ordered, unique id to associate with a DraftAction. Ensures
49098
- * no collisions with existing draft action IDs.
49099
- */
49100
- function generateUniqueDraftActionId(existingIds) {
49101
- // new id in milliseconds with some extra digits for collisions
49102
- let newId = new Date().getTime() * 100;
49103
- const existingAsNumbers = existingIds
49104
- .map((id) => parseInt(id, 10))
49105
- .filter((parsed) => !isNaN(parsed));
49106
- let counter = 0;
49107
- while (existingAsNumbers.includes(newId)) {
49108
- newId += 1;
49109
- counter += 1;
49110
- // if the counter is 100+ then somehow this method has been called 100
49111
- // times in one millisecond
49112
- if (counter >= 100) {
49113
- // eslint-disable-next-line @salesforce/lds/no-error-in-production
49114
- throw new Error('Unable to generate unique new draft ID');
49115
- }
49116
- }
49117
- return newId.toString();
49118
- }
49119
-
49120
49142
  var CustomActionResultType;
49121
49143
  (function (CustomActionResultType) {
49122
49144
  CustomActionResultType["SUCCESS"] = "SUCCESS";
@@ -60056,7 +60078,7 @@
60056
60078
  id: '@salesforce/lds-network-adapter',
60057
60079
  instrument: instrument$1,
60058
60080
  });
60059
- // version: 1.159.1-0b4572813
60081
+ // version: 1.160.1-fa935e9ee
60060
60082
 
60061
60083
  const { create: create$2, keys: keys$2 } = Object;
60062
60084
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77538,7 +77560,7 @@
77538
77560
  configuration: { ...configurationForGraphQLAdapters },
77539
77561
  instrument,
77540
77562
  });
77541
- // version: 1.159.1-3cc6c1f48
77563
+ // version: 1.160.1-06ddc4b32
77542
77564
 
77543
77565
  // On core the unstable adapters are re-exported with different names,
77544
77566
 
@@ -79785,7 +79807,7 @@
79785
79807
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79786
79808
  graphQLImperative = ldsAdapter;
79787
79809
  });
79788
- // version: 1.159.1-3cc6c1f48
79810
+ // version: 1.160.1-06ddc4b32
79789
79811
 
79790
79812
  var gqlApi = /*#__PURE__*/Object.freeze({
79791
79813
  __proto__: null,
@@ -80491,4 +80513,4 @@
80491
80513
  Object.defineProperty(exports, '__esModule', { value: true });
80492
80514
 
80493
80515
  }));
80494
- // version: 1.159.1-0b4572813
80516
+ // version: 1.160.1-fa935e9ee
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.159.1",
3
+ "version": "1.160.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",