@salesforce/lds-worker-api 1.117.0 → 1.119.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.
@@ -751,4 +751,4 @@ if (process.env.NODE_ENV !== 'production') {
751
751
  }
752
752
 
753
753
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
754
- // version: 1.117.0-7509e1b29
754
+ // version: 1.119.1-91ad6f5b7
@@ -3776,7 +3776,7 @@ function withDefaultLuvio(callback) {
3776
3776
  }
3777
3777
  callbacks.push(callback);
3778
3778
  }
3779
- // version: 1.117.0-7509e1b29
3779
+ // version: 1.119.1-91ad6f5b7
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.117.0-7509e1b29
15203
+ // version: 1.119.1-91ad6f5b7
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.117.0-7509e1b29
16116
+ // version: 1.119.1-91ad6f5b7
16117
16117
 
16118
16118
  /**
16119
16119
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44347,7 +44347,7 @@ withDefaultLuvio((luvio) => {
44347
44347
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44348
44348
  });
44349
44349
  });
44350
- // version: 1.117.0-f5714bc6e
44350
+ // version: 1.119.1-6dfb07d0f
44351
44351
 
44352
44352
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44353
44353
 
@@ -48721,54 +48721,27 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
48721
48721
  * For full license text, see the LICENSE.txt file
48722
48722
  */
48723
48723
 
48724
- /* Ideally we would use AbortController but it does not exist in V8, if it is ever polyfilled we can swap for it */
48724
+ /* Ideally we would use AbortController but it does not exist in V8, this is a simplified version */
48725
48725
  class LdsAbortController {
48726
- constructor() {
48727
- this.signal = new AbortSignal();
48728
- }
48729
- abort() {
48730
- this.signal.abort();
48731
- }
48732
- }
48733
- class AbortSignal {
48734
48726
  constructor() {
48735
48727
  this._aborted = false;
48736
- this.listeners = new Map();
48728
+ this.listeners = new Set();
48737
48729
  }
48738
48730
  get aborted() {
48739
48731
  return this._aborted;
48740
48732
  }
48741
- addEventListener(type, listener) {
48742
- let listeners = this.listeners.get(type);
48743
- if (!listeners) {
48744
- listeners = new Set();
48745
- this.listeners.set(type, listeners);
48746
- }
48747
- listeners.add(listener);
48748
- }
48749
- removeEventListener(type, listener) {
48750
- const listeners = this.listeners.get(type);
48751
- if (listeners) {
48752
- listeners.delete(listener);
48753
- if (listeners.size === 0) {
48754
- this.listeners.delete(type);
48755
- }
48756
- }
48733
+ addEventListener(listener) {
48734
+ this.listeners.add(listener);
48757
48735
  }
48758
- dispatchEvent(event) {
48759
- const listeners = this.listeners.get(event.type);
48760
- if (listeners) {
48761
- for (const listener of listeners) {
48762
- listener(this, event);
48763
- }
48764
- }
48765
- return !event.defaultPrevented;
48736
+ removeEventListener(listener) {
48737
+ this.listeners.delete(listener);
48766
48738
  }
48767
48739
  abort() {
48768
48740
  if (!this.aborted) {
48769
48741
  this._aborted = true;
48770
- const abortEvent = new Event('abort');
48771
- this.dispatchEvent(abortEvent);
48742
+ for (const listener of this.listeners) {
48743
+ listener();
48744
+ }
48772
48745
  }
48773
48746
  }
48774
48747
  }
@@ -58351,6 +58324,7 @@ function normalizeError$1(err) {
58351
58324
  }
58352
58325
  return new Error(stringify$6(err));
58353
58326
  }
58327
+ const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
58354
58328
  const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
58355
58329
  function reportGraphqlQueryParseError(err) {
58356
58330
  normalizeError$1(err);
@@ -58363,7 +58337,7 @@ function reportGraphqlCreateSnapshotError(err) {
58363
58337
  }
58364
58338
  function reportGraphQlEvalDbReadDuration(duration) {
58365
58339
  }
58366
- function reportDraftAwareContentDocumentVersionSythensizeError(err) {
58340
+ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
58367
58341
  let error;
58368
58342
  if (err.body !== undefined) {
58369
58343
  error = err.body;
@@ -58385,6 +58359,30 @@ function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
58385
58359
  function reportPrimingError(errorType, recordCount) {
58386
58360
  }
58387
58361
 
58362
+ /**
58363
+ * HOF (high-order-function) that instruments any async operation. If the operation
58364
+ * has an error then the hasError param will be set on the call to o11y.incrementCounter
58365
+ * and an "errorMessage" tag containing the Error.message will be added to the tags.
58366
+ */
58367
+ const withInstrumentation = (operation, config) => {
58368
+ if (config === undefined) {
58369
+ // No instrumentation is needed for the method. Return as is.
58370
+ return operation();
58371
+ }
58372
+ const { tags, metricName, logError } = config;
58373
+ return operation()
58374
+ .catch((err) => {
58375
+ const error = normalizeError$1(err);
58376
+ tags['errorMessage'] = error.message;
58377
+ throw err;
58378
+ })
58379
+ .finally(() => {
58380
+ });
58381
+ };
58382
+
58383
+ /**
58384
+ * A HOF that returns an instrumented DraftQueue
58385
+ */
58388
58386
  function instrumentDraftQueue(queue) {
58389
58387
  queue.registerOnChangedListener((draftQueueEvent) => {
58390
58388
  switch (draftQueueEvent.type) {
@@ -58413,6 +58411,14 @@ function instrumentDraftQueue(queue) {
58413
58411
  }
58414
58412
  return Promise.resolve();
58415
58413
  });
58414
+ const mergeActions = function (targetActionId, sourceActionId) {
58415
+ return withInstrumentation(() => queue.mergeActions(targetActionId, sourceActionId), {
58416
+ metricName: DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS,
58417
+ tags: {},
58418
+ logError: false,
58419
+ });
58420
+ };
58421
+ return create$6(queue, { mergeActions: { value: mergeActions } });
58416
58422
  }
58417
58423
 
58418
58424
  // so eslint doesn't complain about nimbus
@@ -58423,8 +58429,7 @@ function buildLdsDraftQueue(durableStore) {
58423
58429
  return new NimbusDraftQueue();
58424
58430
  }
58425
58431
  const draftQueue = new DurableDraftQueue(new DurableDraftStore(durableStore));
58426
- instrumentDraftQueue(draftQueue);
58427
- return draftQueue;
58432
+ return instrumentDraftQueue(draftQueue);
58428
58433
  }
58429
58434
 
58430
58435
  /**
@@ -58653,7 +58658,7 @@ function instrumentContentDocumentVersionAdapter(adapter) {
58653
58658
  const { data } = customEvent;
58654
58659
  switch (data.type) {
58655
58660
  case 'create-content-document-and-version-synthesized-response-error':
58656
- reportDraftAwareContentDocumentVersionSythensizeError(data.error);
58661
+ reportDraftAwareContentDocumentVersionSynthesizeError(data.error);
58657
58662
  break;
58658
58663
  case 'create-content-document-and-version-synthesize-response-start': {
58659
58664
  reportDraftAwareContentVersionSynthesizeCalls(data.mimeType);
@@ -59307,7 +59312,7 @@ class PrimingSession extends EventEmitter {
59307
59312
  return this.recordLoader
59308
59313
  .fetchRecordData(batch, abortController)
59309
59314
  .then(async (result) => {
59310
- if (abortController.signal.aborted) {
59315
+ if (abortController.aborted) {
59311
59316
  return;
59312
59317
  }
59313
59318
  this.emit('batch-fetched', {
@@ -59346,7 +59351,7 @@ class PrimingSession extends EventEmitter {
59346
59351
  .reduce((a, b) => a.concat(b), []),
59347
59352
  duration: Date.now() - beforeWrite,
59348
59353
  });
59349
- if (abortController.signal.aborted) {
59354
+ if (abortController.aborted) {
59350
59355
  return;
59351
59356
  }
59352
59357
  if (errors.length > 0) {
@@ -59598,7 +59603,7 @@ class NimbusPrimingNetworkAdapter {
59598
59603
  let listener;
59599
59604
  const unregisterListener = () => {
59600
59605
  if (listener) {
59601
- abortController.signal.removeEventListener('abort', listener);
59606
+ abortController.removeEventListener(listener);
59602
59607
  }
59603
59608
  };
59604
59609
  __nimbus.plugins.LdsNetworkAdapter
@@ -59630,7 +59635,7 @@ class NimbusPrimingNetworkAdapter {
59630
59635
  listener = () => {
59631
59636
  __nimbus.plugins.LdsNetworkAdapter.cancelRequest(cancellationToken);
59632
59637
  };
59633
- abortController.signal.addEventListener('abort', listener);
59638
+ abortController.addEventListener(listener);
59634
59639
  });
59635
59640
  });
59636
59641
  }
@@ -59850,7 +59855,7 @@ register({
59850
59855
  id: '@salesforce/lds-network-adapter',
59851
59856
  instrument: instrument$1,
59852
59857
  });
59853
- // version: 1.117.0-7509e1b29
59858
+ // version: 1.119.1-91ad6f5b7
59854
59859
 
59855
59860
  const { create: create$2, keys: keys$2 } = Object;
59856
59861
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -75025,7 +75030,7 @@ register({
75025
75030
  configuration: { ...configurationForGraphQLAdapters },
75026
75031
  instrument,
75027
75032
  });
75028
- // version: 1.117.0-f5714bc6e
75033
+ // version: 1.119.1-6dfb07d0f
75029
75034
 
75030
75035
  // On core the unstable adapters are re-exported with different names,
75031
75036
 
@@ -77154,7 +77159,7 @@ withDefaultLuvio((luvio) => {
77154
77159
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
77155
77160
  graphQLImperative = ldsAdapter;
77156
77161
  });
77157
- // version: 1.117.0-f5714bc6e
77162
+ // version: 1.119.1-6dfb07d0f
77158
77163
 
77159
77164
  var gqlApi = /*#__PURE__*/Object.freeze({
77160
77165
  __proto__: null,
@@ -77836,4 +77841,4 @@ const { luvio } = getRuntime();
77836
77841
  setDefaultLuvio({ luvio });
77837
77842
 
77838
77843
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
77839
- // version: 1.117.0-7509e1b29
77844
+ // version: 1.119.1-91ad6f5b7
@@ -3782,7 +3782,7 @@
3782
3782
  }
3783
3783
  callbacks.push(callback);
3784
3784
  }
3785
- // version: 1.117.0-7509e1b29
3785
+ // version: 1.119.1-91ad6f5b7
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.117.0-7509e1b29
15209
+ // version: 1.119.1-91ad6f5b7
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.117.0-7509e1b29
16122
+ // version: 1.119.1-91ad6f5b7
16123
16123
 
16124
16124
  /**
16125
16125
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44353,7 +44353,7 @@
44353
44353
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44354
44354
  });
44355
44355
  });
44356
- // version: 1.117.0-f5714bc6e
44356
+ // version: 1.119.1-6dfb07d0f
44357
44357
 
44358
44358
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44359
44359
 
@@ -48727,54 +48727,27 @@
48727
48727
  * For full license text, see the LICENSE.txt file
48728
48728
  */
48729
48729
 
48730
- /* Ideally we would use AbortController but it does not exist in V8, if it is ever polyfilled we can swap for it */
48730
+ /* Ideally we would use AbortController but it does not exist in V8, this is a simplified version */
48731
48731
  class LdsAbortController {
48732
- constructor() {
48733
- this.signal = new AbortSignal();
48734
- }
48735
- abort() {
48736
- this.signal.abort();
48737
- }
48738
- }
48739
- class AbortSignal {
48740
48732
  constructor() {
48741
48733
  this._aborted = false;
48742
- this.listeners = new Map();
48734
+ this.listeners = new Set();
48743
48735
  }
48744
48736
  get aborted() {
48745
48737
  return this._aborted;
48746
48738
  }
48747
- addEventListener(type, listener) {
48748
- let listeners = this.listeners.get(type);
48749
- if (!listeners) {
48750
- listeners = new Set();
48751
- this.listeners.set(type, listeners);
48752
- }
48753
- listeners.add(listener);
48754
- }
48755
- removeEventListener(type, listener) {
48756
- const listeners = this.listeners.get(type);
48757
- if (listeners) {
48758
- listeners.delete(listener);
48759
- if (listeners.size === 0) {
48760
- this.listeners.delete(type);
48761
- }
48762
- }
48739
+ addEventListener(listener) {
48740
+ this.listeners.add(listener);
48763
48741
  }
48764
- dispatchEvent(event) {
48765
- const listeners = this.listeners.get(event.type);
48766
- if (listeners) {
48767
- for (const listener of listeners) {
48768
- listener(this, event);
48769
- }
48770
- }
48771
- return !event.defaultPrevented;
48742
+ removeEventListener(listener) {
48743
+ this.listeners.delete(listener);
48772
48744
  }
48773
48745
  abort() {
48774
48746
  if (!this.aborted) {
48775
48747
  this._aborted = true;
48776
- const abortEvent = new Event('abort');
48777
- this.dispatchEvent(abortEvent);
48748
+ for (const listener of this.listeners) {
48749
+ listener();
48750
+ }
48778
48751
  }
48779
48752
  }
48780
48753
  }
@@ -58357,6 +58330,7 @@
58357
58330
  }
58358
58331
  return new Error(stringify$6(err));
58359
58332
  }
58333
+ const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
58360
58334
  const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
58361
58335
  function reportGraphqlQueryParseError(err) {
58362
58336
  normalizeError$1(err);
@@ -58369,7 +58343,7 @@
58369
58343
  }
58370
58344
  function reportGraphQlEvalDbReadDuration(duration) {
58371
58345
  }
58372
- function reportDraftAwareContentDocumentVersionSythensizeError(err) {
58346
+ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
58373
58347
  let error;
58374
58348
  if (err.body !== undefined) {
58375
58349
  error = err.body;
@@ -58391,6 +58365,30 @@
58391
58365
  function reportPrimingError(errorType, recordCount) {
58392
58366
  }
58393
58367
 
58368
+ /**
58369
+ * HOF (high-order-function) that instruments any async operation. If the operation
58370
+ * has an error then the hasError param will be set on the call to o11y.incrementCounter
58371
+ * and an "errorMessage" tag containing the Error.message will be added to the tags.
58372
+ */
58373
+ const withInstrumentation = (operation, config) => {
58374
+ if (config === undefined) {
58375
+ // No instrumentation is needed for the method. Return as is.
58376
+ return operation();
58377
+ }
58378
+ const { tags, metricName, logError } = config;
58379
+ return operation()
58380
+ .catch((err) => {
58381
+ const error = normalizeError$1(err);
58382
+ tags['errorMessage'] = error.message;
58383
+ throw err;
58384
+ })
58385
+ .finally(() => {
58386
+ });
58387
+ };
58388
+
58389
+ /**
58390
+ * A HOF that returns an instrumented DraftQueue
58391
+ */
58394
58392
  function instrumentDraftQueue(queue) {
58395
58393
  queue.registerOnChangedListener((draftQueueEvent) => {
58396
58394
  switch (draftQueueEvent.type) {
@@ -58419,6 +58417,14 @@
58419
58417
  }
58420
58418
  return Promise.resolve();
58421
58419
  });
58420
+ const mergeActions = function (targetActionId, sourceActionId) {
58421
+ return withInstrumentation(() => queue.mergeActions(targetActionId, sourceActionId), {
58422
+ metricName: DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS,
58423
+ tags: {},
58424
+ logError: false,
58425
+ });
58426
+ };
58427
+ return create$6(queue, { mergeActions: { value: mergeActions } });
58422
58428
  }
58423
58429
 
58424
58430
  // so eslint doesn't complain about nimbus
@@ -58429,8 +58435,7 @@
58429
58435
  return new NimbusDraftQueue();
58430
58436
  }
58431
58437
  const draftQueue = new DurableDraftQueue(new DurableDraftStore(durableStore));
58432
- instrumentDraftQueue(draftQueue);
58433
- return draftQueue;
58438
+ return instrumentDraftQueue(draftQueue);
58434
58439
  }
58435
58440
 
58436
58441
  /**
@@ -58659,7 +58664,7 @@
58659
58664
  const { data } = customEvent;
58660
58665
  switch (data.type) {
58661
58666
  case 'create-content-document-and-version-synthesized-response-error':
58662
- reportDraftAwareContentDocumentVersionSythensizeError(data.error);
58667
+ reportDraftAwareContentDocumentVersionSynthesizeError(data.error);
58663
58668
  break;
58664
58669
  case 'create-content-document-and-version-synthesize-response-start': {
58665
58670
  reportDraftAwareContentVersionSynthesizeCalls(data.mimeType);
@@ -59313,7 +59318,7 @@
59313
59318
  return this.recordLoader
59314
59319
  .fetchRecordData(batch, abortController)
59315
59320
  .then(async (result) => {
59316
- if (abortController.signal.aborted) {
59321
+ if (abortController.aborted) {
59317
59322
  return;
59318
59323
  }
59319
59324
  this.emit('batch-fetched', {
@@ -59352,7 +59357,7 @@
59352
59357
  .reduce((a, b) => a.concat(b), []),
59353
59358
  duration: Date.now() - beforeWrite,
59354
59359
  });
59355
- if (abortController.signal.aborted) {
59360
+ if (abortController.aborted) {
59356
59361
  return;
59357
59362
  }
59358
59363
  if (errors.length > 0) {
@@ -59604,7 +59609,7 @@
59604
59609
  let listener;
59605
59610
  const unregisterListener = () => {
59606
59611
  if (listener) {
59607
- abortController.signal.removeEventListener('abort', listener);
59612
+ abortController.removeEventListener(listener);
59608
59613
  }
59609
59614
  };
59610
59615
  __nimbus.plugins.LdsNetworkAdapter
@@ -59636,7 +59641,7 @@
59636
59641
  listener = () => {
59637
59642
  __nimbus.plugins.LdsNetworkAdapter.cancelRequest(cancellationToken);
59638
59643
  };
59639
- abortController.signal.addEventListener('abort', listener);
59644
+ abortController.addEventListener(listener);
59640
59645
  });
59641
59646
  });
59642
59647
  }
@@ -59856,7 +59861,7 @@
59856
59861
  id: '@salesforce/lds-network-adapter',
59857
59862
  instrument: instrument$1,
59858
59863
  });
59859
- // version: 1.117.0-7509e1b29
59864
+ // version: 1.119.1-91ad6f5b7
59860
59865
 
59861
59866
  const { create: create$2, keys: keys$2 } = Object;
59862
59867
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -75031,7 +75036,7 @@
75031
75036
  configuration: { ...configurationForGraphQLAdapters },
75032
75037
  instrument,
75033
75038
  });
75034
- // version: 1.117.0-f5714bc6e
75039
+ // version: 1.119.1-6dfb07d0f
75035
75040
 
75036
75041
  // On core the unstable adapters are re-exported with different names,
75037
75042
 
@@ -77160,7 +77165,7 @@
77160
77165
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
77161
77166
  graphQLImperative = ldsAdapter;
77162
77167
  });
77163
- // version: 1.117.0-f5714bc6e
77168
+ // version: 1.119.1-6dfb07d0f
77164
77169
 
77165
77170
  var gqlApi = /*#__PURE__*/Object.freeze({
77166
77171
  __proto__: null,
@@ -77859,4 +77864,4 @@
77859
77864
  Object.defineProperty(exports, '__esModule', { value: true });
77860
77865
 
77861
77866
  }));
77862
- // version: 1.117.0-7509e1b29
77867
+ // version: 1.119.1-91ad6f5b7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.117.0",
3
+ "version": "1.119.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/umd/lds-worker-api.js",