@salesforce/lds-runtime-mobile 1.118.0 → 1.119.2

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.
@@ -1,5 +1,5 @@
1
- import type { Instrumentation } from 'o11y/client';
1
+ import { instrumentation } from './instrumentation';
2
2
  export { activity } from './activity';
3
3
  export { instrumentation } from './instrumentation';
4
4
  export { idleDetector } from './idleDetector';
5
- export declare function getInstrumentation(_name: string): Instrumentation;
5
+ export declare function getInstrumentation(_name: string): typeof instrumentation;
@@ -1,2 +1,5 @@
1
1
  import type { DraftQueue } from '@salesforce/lds-drafts';
2
- export declare function instrumentDraftQueue(queue: DraftQueue): void;
2
+ /**
3
+ * A HOF that returns an instrumented DraftQueue
4
+ */
5
+ export declare function instrumentDraftQueue(queue: DraftQueue): DraftQueue;
@@ -1,4 +1,6 @@
1
1
  export declare const O11Y_NAMESPACE_LDS_MOBILE = "lds-mobile";
2
+ export declare const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = "draft-queue-total-mergeActions-calls";
3
+ export declare const ldsMobileInstrumentation: import("o11y/dist/modules/o11y/client/interfaces").Instrumentation;
2
4
  export declare function reportGraphqlQueryParseError(err: unknown): void;
3
5
  export declare function reportGraphqlSqlEvalPreconditionError(err: unknown): void;
4
6
  export declare function reportGraphqlCreateSnapshotError(err: unknown): void;
@@ -6,7 +8,7 @@ export declare function reportGraphQlEvalDbReadDuration(duration: number): void;
6
8
  export declare function reportGraphqlAdapterError(errorCode: string): void;
7
9
  export declare function reportDraftActionEvent(state: 'added' | 'completed' | 'deleted' | 'updated' | 'failed'): void;
8
10
  export declare function reportDraftQueueState(state: 'started' | 'error' | 'waiting' | 'stopped'): void;
9
- export declare function reportDraftAwareContentDocumentVersionSythensizeError(err: unknown): void;
11
+ export declare function reportDraftAwareContentDocumentVersionSynthesizeError(err: unknown): void;
10
12
  export declare function reportDraftAwareContentVersionSynthesizeCalls(mimeType: string): void;
11
13
  /** Priming */
12
14
  export declare function reportPrimingSessionCreated(): void;
@@ -1,12 +1,12 @@
1
- type Operation = () => Promise<any>;
2
1
  export type WithInstrumentation = (operation: () => Promise<any>, config: InstrumentationConfig) => Promise<any>;
3
2
  export interface InstrumentationConfig {
4
3
  tags: Record<string, string>;
5
4
  metricName: string;
5
+ logError: boolean;
6
6
  }
7
7
  /**
8
- * Higher order function that instruments any async operation
9
- *
8
+ * HOF (high-order-function) that instruments any async operation. If the operation
9
+ * has an error then the hasError param will be set on the call to o11y.incrementCounter
10
+ * and an "errorMessage" tag containing the Error.message will be added to the tags.
10
11
  */
11
- export declare const withInstrumentation: (operation: Operation, config?: InstrumentationConfig) => Promise<any>;
12
- export {};
12
+ export declare const withInstrumentation: <T>(operation: () => Promise<T>, config?: InstrumentationConfig) => Promise<T>;
package/dist/main.js CHANGED
@@ -4346,54 +4346,27 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
4346
4346
  * For full license text, see the LICENSE.txt file
4347
4347
  */
4348
4348
 
4349
- /* Ideally we would use AbortController but it does not exist in V8, if it is ever polyfilled we can swap for it */
4349
+ /* Ideally we would use AbortController but it does not exist in V8, this is a simplified version */
4350
4350
  class LdsAbortController {
4351
- constructor() {
4352
- this.signal = new AbortSignal();
4353
- }
4354
- abort() {
4355
- this.signal.abort();
4356
- }
4357
- }
4358
- class AbortSignal {
4359
4351
  constructor() {
4360
4352
  this._aborted = false;
4361
- this.listeners = new Map();
4353
+ this.listeners = new Set();
4362
4354
  }
4363
4355
  get aborted() {
4364
4356
  return this._aborted;
4365
4357
  }
4366
- addEventListener(type, listener) {
4367
- let listeners = this.listeners.get(type);
4368
- if (!listeners) {
4369
- listeners = new Set();
4370
- this.listeners.set(type, listeners);
4371
- }
4372
- listeners.add(listener);
4358
+ addEventListener(listener) {
4359
+ this.listeners.add(listener);
4373
4360
  }
4374
- removeEventListener(type, listener) {
4375
- const listeners = this.listeners.get(type);
4376
- if (listeners) {
4377
- listeners.delete(listener);
4378
- if (listeners.size === 0) {
4379
- this.listeners.delete(type);
4380
- }
4381
- }
4382
- }
4383
- dispatchEvent(event) {
4384
- const listeners = this.listeners.get(event.type);
4385
- if (listeners) {
4386
- for (const listener of listeners) {
4387
- listener(this, event);
4388
- }
4389
- }
4390
- return !event.defaultPrevented;
4361
+ removeEventListener(listener) {
4362
+ this.listeners.delete(listener);
4391
4363
  }
4392
4364
  abort() {
4393
4365
  if (!this.aborted) {
4394
4366
  this._aborted = true;
4395
- const abortEvent = new Event('abort');
4396
- this.dispatchEvent(abortEvent);
4367
+ for (const listener of this.listeners) {
4368
+ listener();
4369
+ }
4397
4370
  }
4398
4371
  }
4399
4372
  }
@@ -8412,7 +8385,7 @@ const baseTypeDefinitions = /* GraphQL */ `
8412
8385
  ApiName: String!
8413
8386
  WeakEtag: Long!
8414
8387
  DisplayValue: String
8415
- LastModifiedById: StringValue
8388
+ LastModifiedById: IDValue
8416
8389
  LastModifiedDate: DateTimeValue
8417
8390
  SystemModstamp: DateTimeValue
8418
8391
  RecordTypeId: IDValue
@@ -8423,7 +8396,7 @@ const baseTypeDefinitions = /* GraphQL */ `
8423
8396
  Id: ID!
8424
8397
  ApiName: String!
8425
8398
  DisplayValue: String
8426
- LastModifiedById: StringValue
8399
+ LastModifiedById: IDValue
8427
8400
  LastModifiedDate: DateTimeValue
8428
8401
  RecordTypeId: IDValue
8429
8402
  SystemModstamp: DateTimeValue
@@ -8773,7 +8746,6 @@ const fieldsStaticallyAdded = [
8773
8746
  'LastModifiedDate',
8774
8747
  'RecordTypeId',
8775
8748
  'SystemModstamp',
8776
- 'SystemModstamp',
8777
8749
  'WeakEtag',
8778
8750
  ];
8779
8751
  function generateRecordQueries(objectInfos) {
@@ -8798,9 +8770,9 @@ function generateRecordQueries(objectInfos) {
8798
8770
  }
8799
8771
  }
8800
8772
  for (const field of values(objectInfo.fields)) {
8801
- if (fieldsStaticallyAdded.includes(field.apiName))
8802
- continue;
8803
- fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
8773
+ if (!fieldsStaticallyAdded.includes(field.apiName)) {
8774
+ fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
8775
+ }
8804
8776
  // For spanning parent relationships with no union types
8805
8777
  if (field.referenceToInfos.length === 1) {
8806
8778
  const [relation] = field.referenceToInfos;
@@ -8829,7 +8801,7 @@ function generateRecordQueries(objectInfos) {
8829
8801
  type ${apiName} implements Record {
8830
8802
  ApiName: String!
8831
8803
  DisplayValue: String
8832
- LastModifiedById: StringValue
8804
+ LastModifiedById: IDValue
8833
8805
  LastModifiedDate: DateTimeValue
8834
8806
  RecordTypeId: IDValue
8835
8807
  SystemModstamp: DateTimeValue
@@ -8865,11 +8837,12 @@ function dataTypeToType(objectInfoDataType, apiName) {
8865
8837
  }
8866
8838
  switch (objectInfoDataType) {
8867
8839
  case 'String':
8868
- case 'Reference':
8869
8840
  case 'Phone':
8870
8841
  case 'Email':
8871
8842
  case 'TextArea':
8872
8843
  return 'StringValue';
8844
+ case 'Reference':
8845
+ return 'IDValue';
8873
8846
  case 'Double':
8874
8847
  return 'DoubleValue';
8875
8848
  case 'Boolean':
@@ -14007,8 +13980,9 @@ const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
14007
13980
  const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
14008
13981
  const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
14009
13982
  const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
13983
+ const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
14010
13984
  /** Content Document */
14011
- const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-sythesize-calls';
13985
+ const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
14012
13986
  const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
14013
13987
  /** Priming */
14014
13988
  const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
@@ -14086,7 +14060,7 @@ function reportDraftQueueState(state) {
14086
14060
  break;
14087
14061
  }
14088
14062
  }
14089
- function reportDraftAwareContentDocumentVersionSythensizeError(err) {
14063
+ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
14090
14064
  let error;
14091
14065
  if (err.body !== undefined) {
14092
14066
  error = err.body;
@@ -14123,6 +14097,36 @@ function reportPrimingSuccess(recordCount) {
14123
14097
  ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
14124
14098
  }
14125
14099
 
14100
+ /**
14101
+ * HOF (high-order-function) that instruments any async operation. If the operation
14102
+ * has an error then the hasError param will be set on the call to o11y.incrementCounter
14103
+ * and an "errorMessage" tag containing the Error.message will be added to the tags.
14104
+ */
14105
+ const withInstrumentation = (operation, config) => {
14106
+ if (config === undefined) {
14107
+ // No instrumentation is needed for the method. Return as is.
14108
+ return operation();
14109
+ }
14110
+ const { tags, metricName, logError } = config;
14111
+ let hasError = false;
14112
+ return operation()
14113
+ .catch((err) => {
14114
+ hasError = true;
14115
+ const error = normalizeError(err);
14116
+ tags['errorMessage'] = error.message;
14117
+ if (logError) {
14118
+ ldsMobileInstrumentation.error(error);
14119
+ }
14120
+ throw err;
14121
+ })
14122
+ .finally(() => {
14123
+ ldsMobileInstrumentation.incrementCounter(metricName, 1, hasError, tags);
14124
+ });
14125
+ };
14126
+
14127
+ /**
14128
+ * A HOF that returns an instrumented DraftQueue
14129
+ */
14126
14130
  function instrumentDraftQueue(queue) {
14127
14131
  queue.registerOnChangedListener((draftQueueEvent) => {
14128
14132
  switch (draftQueueEvent.type) {
@@ -14160,6 +14164,14 @@ function instrumentDraftQueue(queue) {
14160
14164
  }
14161
14165
  return Promise.resolve();
14162
14166
  });
14167
+ const mergeActions = function (targetActionId, sourceActionId) {
14168
+ return withInstrumentation(() => queue.mergeActions(targetActionId, sourceActionId), {
14169
+ metricName: DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS,
14170
+ tags: {},
14171
+ logError: false,
14172
+ });
14173
+ };
14174
+ return create(queue, { mergeActions: { value: mergeActions } });
14163
14175
  }
14164
14176
 
14165
14177
  // so eslint doesn't complain about nimbus
@@ -14170,8 +14182,7 @@ function buildLdsDraftQueue(durableStore) {
14170
14182
  return new NimbusDraftQueue();
14171
14183
  }
14172
14184
  const draftQueue = new DurableDraftQueue(new DurableDraftStore(durableStore));
14173
- instrumentDraftQueue(draftQueue);
14174
- return draftQueue;
14185
+ return instrumentDraftQueue(draftQueue);
14175
14186
  }
14176
14187
 
14177
14188
  /**
@@ -14400,7 +14411,7 @@ function instrumentContentDocumentVersionAdapter(adapter) {
14400
14411
  const { data } = customEvent;
14401
14412
  switch (data.type) {
14402
14413
  case 'create-content-document-and-version-synthesized-response-error':
14403
- reportDraftAwareContentDocumentVersionSythensizeError(data.error);
14414
+ reportDraftAwareContentDocumentVersionSynthesizeError(data.error);
14404
14415
  break;
14405
14416
  case 'create-content-document-and-version-synthesize-response-start': {
14406
14417
  reportDraftAwareContentVersionSynthesizeCalls(data.mimeType);
@@ -15063,7 +15074,7 @@ class PrimingSession extends EventEmitter {
15063
15074
  return this.recordLoader
15064
15075
  .fetchRecordData(batch, abortController)
15065
15076
  .then(async (result) => {
15066
- if (abortController.signal.aborted) {
15077
+ if (abortController.aborted) {
15067
15078
  return;
15068
15079
  }
15069
15080
  this.emit('batch-fetched', {
@@ -15102,7 +15113,7 @@ class PrimingSession extends EventEmitter {
15102
15113
  .reduce((a, b) => a.concat(b), []),
15103
15114
  duration: Date.now() - beforeWrite,
15104
15115
  });
15105
- if (abortController.signal.aborted) {
15116
+ if (abortController.aborted) {
15106
15117
  return;
15107
15118
  }
15108
15119
  if (errors.length > 0) {
@@ -15356,7 +15367,7 @@ class NimbusPrimingNetworkAdapter {
15356
15367
  let listener;
15357
15368
  const unregisterListener = () => {
15358
15369
  if (listener) {
15359
- abortController.signal.removeEventListener('abort', listener);
15370
+ abortController.removeEventListener(listener);
15360
15371
  }
15361
15372
  };
15362
15373
  __nimbus.plugins.LdsNetworkAdapter
@@ -15388,7 +15399,7 @@ class NimbusPrimingNetworkAdapter {
15388
15399
  listener = () => {
15389
15400
  __nimbus.plugins.LdsNetworkAdapter.cancelRequest(cancellationToken);
15390
15401
  };
15391
- abortController.signal.addEventListener('abort', listener);
15402
+ abortController.addEventListener(listener);
15392
15403
  });
15393
15404
  });
15394
15405
  }
@@ -15611,4 +15622,4 @@ register({
15611
15622
  });
15612
15623
 
15613
15624
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
15614
- // version: 1.118.0-ad6b2cf1f
15625
+ // version: 1.119.2-208b74730
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.118.0",
3
+ "version": "1.119.2",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -1,5 +1,5 @@
1
- import type { Instrumentation } from 'o11y/client';
1
+ import { instrumentation } from './instrumentation';
2
2
  export { activity } from './activity';
3
3
  export { instrumentation } from './instrumentation';
4
4
  export { idleDetector } from './idleDetector';
5
- export declare function getInstrumentation(_name: string): Instrumentation;
5
+ export declare function getInstrumentation(_name: string): typeof instrumentation;
@@ -1,2 +1,5 @@
1
1
  import type { DraftQueue } from '@salesforce/lds-drafts';
2
- export declare function instrumentDraftQueue(queue: DraftQueue): void;
2
+ /**
3
+ * A HOF that returns an instrumented DraftQueue
4
+ */
5
+ export declare function instrumentDraftQueue(queue: DraftQueue): DraftQueue;
@@ -1,4 +1,6 @@
1
1
  export declare const O11Y_NAMESPACE_LDS_MOBILE = "lds-mobile";
2
+ export declare const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = "draft-queue-total-mergeActions-calls";
3
+ export declare const ldsMobileInstrumentation: import("o11y/dist/modules/o11y/client/interfaces").Instrumentation;
2
4
  export declare function reportGraphqlQueryParseError(err: unknown): void;
3
5
  export declare function reportGraphqlSqlEvalPreconditionError(err: unknown): void;
4
6
  export declare function reportGraphqlCreateSnapshotError(err: unknown): void;
@@ -6,7 +8,7 @@ export declare function reportGraphQlEvalDbReadDuration(duration: number): void;
6
8
  export declare function reportGraphqlAdapterError(errorCode: string): void;
7
9
  export declare function reportDraftActionEvent(state: 'added' | 'completed' | 'deleted' | 'updated' | 'failed'): void;
8
10
  export declare function reportDraftQueueState(state: 'started' | 'error' | 'waiting' | 'stopped'): void;
9
- export declare function reportDraftAwareContentDocumentVersionSythensizeError(err: unknown): void;
11
+ export declare function reportDraftAwareContentDocumentVersionSynthesizeError(err: unknown): void;
10
12
  export declare function reportDraftAwareContentVersionSynthesizeCalls(mimeType: string): void;
11
13
  /** Priming */
12
14
  export declare function reportPrimingSessionCreated(): void;
@@ -1,12 +1,12 @@
1
- type Operation = () => Promise<any>;
2
1
  export type WithInstrumentation = (operation: () => Promise<any>, config: InstrumentationConfig) => Promise<any>;
3
2
  export interface InstrumentationConfig {
4
3
  tags: Record<string, string>;
5
4
  metricName: string;
5
+ logError: boolean;
6
6
  }
7
7
  /**
8
- * Higher order function that instruments any async operation
9
- *
8
+ * HOF (high-order-function) that instruments any async operation. If the operation
9
+ * has an error then the hasError param will be set on the call to o11y.incrementCounter
10
+ * and an "errorMessage" tag containing the Error.message will be added to the tags.
10
11
  */
11
- export declare const withInstrumentation: (operation: Operation, config?: InstrumentationConfig) => Promise<any>;
12
- export {};
12
+ export declare const withInstrumentation: <T>(operation: () => Promise<T>, config?: InstrumentationConfig) => Promise<T>;
package/sfdc/main.js CHANGED
@@ -4346,54 +4346,27 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
4346
4346
  * For full license text, see the LICENSE.txt file
4347
4347
  */
4348
4348
 
4349
- /* Ideally we would use AbortController but it does not exist in V8, if it is ever polyfilled we can swap for it */
4349
+ /* Ideally we would use AbortController but it does not exist in V8, this is a simplified version */
4350
4350
  class LdsAbortController {
4351
- constructor() {
4352
- this.signal = new AbortSignal();
4353
- }
4354
- abort() {
4355
- this.signal.abort();
4356
- }
4357
- }
4358
- class AbortSignal {
4359
4351
  constructor() {
4360
4352
  this._aborted = false;
4361
- this.listeners = new Map();
4353
+ this.listeners = new Set();
4362
4354
  }
4363
4355
  get aborted() {
4364
4356
  return this._aborted;
4365
4357
  }
4366
- addEventListener(type, listener) {
4367
- let listeners = this.listeners.get(type);
4368
- if (!listeners) {
4369
- listeners = new Set();
4370
- this.listeners.set(type, listeners);
4371
- }
4372
- listeners.add(listener);
4358
+ addEventListener(listener) {
4359
+ this.listeners.add(listener);
4373
4360
  }
4374
- removeEventListener(type, listener) {
4375
- const listeners = this.listeners.get(type);
4376
- if (listeners) {
4377
- listeners.delete(listener);
4378
- if (listeners.size === 0) {
4379
- this.listeners.delete(type);
4380
- }
4381
- }
4382
- }
4383
- dispatchEvent(event) {
4384
- const listeners = this.listeners.get(event.type);
4385
- if (listeners) {
4386
- for (const listener of listeners) {
4387
- listener(this, event);
4388
- }
4389
- }
4390
- return !event.defaultPrevented;
4361
+ removeEventListener(listener) {
4362
+ this.listeners.delete(listener);
4391
4363
  }
4392
4364
  abort() {
4393
4365
  if (!this.aborted) {
4394
4366
  this._aborted = true;
4395
- const abortEvent = new Event('abort');
4396
- this.dispatchEvent(abortEvent);
4367
+ for (const listener of this.listeners) {
4368
+ listener();
4369
+ }
4397
4370
  }
4398
4371
  }
4399
4372
  }
@@ -8412,7 +8385,7 @@ const baseTypeDefinitions = /* GraphQL */ `
8412
8385
  ApiName: String!
8413
8386
  WeakEtag: Long!
8414
8387
  DisplayValue: String
8415
- LastModifiedById: StringValue
8388
+ LastModifiedById: IDValue
8416
8389
  LastModifiedDate: DateTimeValue
8417
8390
  SystemModstamp: DateTimeValue
8418
8391
  RecordTypeId: IDValue
@@ -8423,7 +8396,7 @@ const baseTypeDefinitions = /* GraphQL */ `
8423
8396
  Id: ID!
8424
8397
  ApiName: String!
8425
8398
  DisplayValue: String
8426
- LastModifiedById: StringValue
8399
+ LastModifiedById: IDValue
8427
8400
  LastModifiedDate: DateTimeValue
8428
8401
  RecordTypeId: IDValue
8429
8402
  SystemModstamp: DateTimeValue
@@ -8773,7 +8746,6 @@ const fieldsStaticallyAdded = [
8773
8746
  'LastModifiedDate',
8774
8747
  'RecordTypeId',
8775
8748
  'SystemModstamp',
8776
- 'SystemModstamp',
8777
8749
  'WeakEtag',
8778
8750
  ];
8779
8751
  function generateRecordQueries(objectInfos) {
@@ -8798,9 +8770,9 @@ function generateRecordQueries(objectInfos) {
8798
8770
  }
8799
8771
  }
8800
8772
  for (const field of values(objectInfo.fields)) {
8801
- if (fieldsStaticallyAdded.includes(field.apiName))
8802
- continue;
8803
- fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
8773
+ if (!fieldsStaticallyAdded.includes(field.apiName)) {
8774
+ fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
8775
+ }
8804
8776
  // For spanning parent relationships with no union types
8805
8777
  if (field.referenceToInfos.length === 1) {
8806
8778
  const [relation] = field.referenceToInfos;
@@ -8829,7 +8801,7 @@ function generateRecordQueries(objectInfos) {
8829
8801
  type ${apiName} implements Record {
8830
8802
  ApiName: String!
8831
8803
  DisplayValue: String
8832
- LastModifiedById: StringValue
8804
+ LastModifiedById: IDValue
8833
8805
  LastModifiedDate: DateTimeValue
8834
8806
  RecordTypeId: IDValue
8835
8807
  SystemModstamp: DateTimeValue
@@ -8865,11 +8837,12 @@ function dataTypeToType(objectInfoDataType, apiName) {
8865
8837
  }
8866
8838
  switch (objectInfoDataType) {
8867
8839
  case 'String':
8868
- case 'Reference':
8869
8840
  case 'Phone':
8870
8841
  case 'Email':
8871
8842
  case 'TextArea':
8872
8843
  return 'StringValue';
8844
+ case 'Reference':
8845
+ return 'IDValue';
8873
8846
  case 'Double':
8874
8847
  return 'DoubleValue';
8875
8848
  case 'Boolean':
@@ -14007,8 +13980,9 @@ const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
14007
13980
  const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
14008
13981
  const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
14009
13982
  const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
13983
+ const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
14010
13984
  /** Content Document */
14011
- const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-sythesize-calls';
13985
+ const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
14012
13986
  const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
14013
13987
  /** Priming */
14014
13988
  const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
@@ -14086,7 +14060,7 @@ function reportDraftQueueState(state) {
14086
14060
  break;
14087
14061
  }
14088
14062
  }
14089
- function reportDraftAwareContentDocumentVersionSythensizeError(err) {
14063
+ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
14090
14064
  let error;
14091
14065
  if (err.body !== undefined) {
14092
14066
  error = err.body;
@@ -14123,6 +14097,36 @@ function reportPrimingSuccess(recordCount) {
14123
14097
  ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
14124
14098
  }
14125
14099
 
14100
+ /**
14101
+ * HOF (high-order-function) that instruments any async operation. If the operation
14102
+ * has an error then the hasError param will be set on the call to o11y.incrementCounter
14103
+ * and an "errorMessage" tag containing the Error.message will be added to the tags.
14104
+ */
14105
+ const withInstrumentation = (operation, config) => {
14106
+ if (config === undefined) {
14107
+ // No instrumentation is needed for the method. Return as is.
14108
+ return operation();
14109
+ }
14110
+ const { tags, metricName, logError } = config;
14111
+ let hasError = false;
14112
+ return operation()
14113
+ .catch((err) => {
14114
+ hasError = true;
14115
+ const error = normalizeError(err);
14116
+ tags['errorMessage'] = error.message;
14117
+ if (logError) {
14118
+ ldsMobileInstrumentation.error(error);
14119
+ }
14120
+ throw err;
14121
+ })
14122
+ .finally(() => {
14123
+ ldsMobileInstrumentation.incrementCounter(metricName, 1, hasError, tags);
14124
+ });
14125
+ };
14126
+
14127
+ /**
14128
+ * A HOF that returns an instrumented DraftQueue
14129
+ */
14126
14130
  function instrumentDraftQueue(queue) {
14127
14131
  queue.registerOnChangedListener((draftQueueEvent) => {
14128
14132
  switch (draftQueueEvent.type) {
@@ -14160,6 +14164,14 @@ function instrumentDraftQueue(queue) {
14160
14164
  }
14161
14165
  return Promise.resolve();
14162
14166
  });
14167
+ const mergeActions = function (targetActionId, sourceActionId) {
14168
+ return withInstrumentation(() => queue.mergeActions(targetActionId, sourceActionId), {
14169
+ metricName: DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS,
14170
+ tags: {},
14171
+ logError: false,
14172
+ });
14173
+ };
14174
+ return create(queue, { mergeActions: { value: mergeActions } });
14163
14175
  }
14164
14176
 
14165
14177
  // so eslint doesn't complain about nimbus
@@ -14170,8 +14182,7 @@ function buildLdsDraftQueue(durableStore) {
14170
14182
  return new NimbusDraftQueue();
14171
14183
  }
14172
14184
  const draftQueue = new DurableDraftQueue(new DurableDraftStore(durableStore));
14173
- instrumentDraftQueue(draftQueue);
14174
- return draftQueue;
14185
+ return instrumentDraftQueue(draftQueue);
14175
14186
  }
14176
14187
 
14177
14188
  /**
@@ -14400,7 +14411,7 @@ function instrumentContentDocumentVersionAdapter(adapter) {
14400
14411
  const { data } = customEvent;
14401
14412
  switch (data.type) {
14402
14413
  case 'create-content-document-and-version-synthesized-response-error':
14403
- reportDraftAwareContentDocumentVersionSythensizeError(data.error);
14414
+ reportDraftAwareContentDocumentVersionSynthesizeError(data.error);
14404
14415
  break;
14405
14416
  case 'create-content-document-and-version-synthesize-response-start': {
14406
14417
  reportDraftAwareContentVersionSynthesizeCalls(data.mimeType);
@@ -15063,7 +15074,7 @@ class PrimingSession extends EventEmitter {
15063
15074
  return this.recordLoader
15064
15075
  .fetchRecordData(batch, abortController)
15065
15076
  .then(async (result) => {
15066
- if (abortController.signal.aborted) {
15077
+ if (abortController.aborted) {
15067
15078
  return;
15068
15079
  }
15069
15080
  this.emit('batch-fetched', {
@@ -15102,7 +15113,7 @@ class PrimingSession extends EventEmitter {
15102
15113
  .reduce((a, b) => a.concat(b), []),
15103
15114
  duration: Date.now() - beforeWrite,
15104
15115
  });
15105
- if (abortController.signal.aborted) {
15116
+ if (abortController.aborted) {
15106
15117
  return;
15107
15118
  }
15108
15119
  if (errors.length > 0) {
@@ -15356,7 +15367,7 @@ class NimbusPrimingNetworkAdapter {
15356
15367
  let listener;
15357
15368
  const unregisterListener = () => {
15358
15369
  if (listener) {
15359
- abortController.signal.removeEventListener('abort', listener);
15370
+ abortController.removeEventListener(listener);
15360
15371
  }
15361
15372
  };
15362
15373
  __nimbus.plugins.LdsNetworkAdapter
@@ -15388,7 +15399,7 @@ class NimbusPrimingNetworkAdapter {
15388
15399
  listener = () => {
15389
15400
  __nimbus.plugins.LdsNetworkAdapter.cancelRequest(cancellationToken);
15390
15401
  };
15391
- abortController.signal.addEventListener('abort', listener);
15402
+ abortController.addEventListener(listener);
15392
15403
  });
15393
15404
  });
15394
15405
  }
@@ -15611,4 +15622,4 @@ register({
15611
15622
  });
15612
15623
 
15613
15624
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
15614
- // version: 1.118.0-ad6b2cf1f
15625
+ // version: 1.119.2-208b74730