@salesforce/lds-runtime-mobile 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.
- package/dist/__mocks__/o11y/client.d.ts +2 -2
- package/dist/instrumentation/instrumentDraftQueue.d.ts +4 -1
- package/dist/instrumentation/metrics.d.ts +3 -1
- package/dist/instrumentation/withInstrumentation.d.ts +5 -5
- package/dist/main.js +57 -46
- package/package.json +1 -1
- package/sfdc/__mocks__/o11y/client.d.ts +2 -2
- package/sfdc/instrumentation/instrumentDraftQueue.d.ts +4 -1
- package/sfdc/instrumentation/metrics.d.ts +3 -1
- package/sfdc/instrumentation/withInstrumentation.d.ts +5 -5
- package/sfdc/main.js +57 -46
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
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):
|
|
5
|
+
export declare function getInstrumentation(_name: string): typeof instrumentation;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { DraftQueue } from '@salesforce/lds-drafts';
|
|
2
|
-
|
|
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
|
|
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
|
-
*
|
|
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:
|
|
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,
|
|
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
|
|
4353
|
+
this.listeners = new Set();
|
|
4362
4354
|
}
|
|
4363
4355
|
get aborted() {
|
|
4364
4356
|
return this._aborted;
|
|
4365
4357
|
}
|
|
4366
|
-
addEventListener(
|
|
4367
|
-
|
|
4368
|
-
if (!listeners) {
|
|
4369
|
-
listeners = new Set();
|
|
4370
|
-
this.listeners.set(type, listeners);
|
|
4371
|
-
}
|
|
4372
|
-
listeners.add(listener);
|
|
4373
|
-
}
|
|
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
|
-
}
|
|
4358
|
+
addEventListener(listener) {
|
|
4359
|
+
this.listeners.add(listener);
|
|
4382
4360
|
}
|
|
4383
|
-
|
|
4384
|
-
|
|
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
|
|
4396
|
-
|
|
4367
|
+
for (const listener of this.listeners) {
|
|
4368
|
+
listener();
|
|
4369
|
+
}
|
|
4397
4370
|
}
|
|
4398
4371
|
}
|
|
4399
4372
|
}
|
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
15625
|
+
// version: 1.119.1-91ad6f5b7
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
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):
|
|
5
|
+
export declare function getInstrumentation(_name: string): typeof instrumentation;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { DraftQueue } from '@salesforce/lds-drafts';
|
|
2
|
-
|
|
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
|
|
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
|
-
*
|
|
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:
|
|
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,
|
|
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
|
|
4353
|
+
this.listeners = new Set();
|
|
4362
4354
|
}
|
|
4363
4355
|
get aborted() {
|
|
4364
4356
|
return this._aborted;
|
|
4365
4357
|
}
|
|
4366
|
-
addEventListener(
|
|
4367
|
-
|
|
4368
|
-
if (!listeners) {
|
|
4369
|
-
listeners = new Set();
|
|
4370
|
-
this.listeners.set(type, listeners);
|
|
4371
|
-
}
|
|
4372
|
-
listeners.add(listener);
|
|
4373
|
-
}
|
|
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
|
-
}
|
|
4358
|
+
addEventListener(listener) {
|
|
4359
|
+
this.listeners.add(listener);
|
|
4382
4360
|
}
|
|
4383
|
-
|
|
4384
|
-
|
|
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
|
|
4396
|
-
|
|
4367
|
+
for (const listener of this.listeners) {
|
|
4368
|
+
listener();
|
|
4369
|
+
}
|
|
4397
4370
|
}
|
|
4398
4371
|
}
|
|
4399
4372
|
}
|
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
15625
|
+
// version: 1.119.1-91ad6f5b7
|