@salesforce/lds-worker-api 1.428.0-dev14 → 1.428.0-dev15
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.
|
@@ -3289,7 +3289,7 @@
|
|
|
3289
3289
|
}
|
|
3290
3290
|
}
|
|
3291
3291
|
}
|
|
3292
|
-
function isFetchResponse(error) {
|
|
3292
|
+
function isFetchResponse$1(error) {
|
|
3293
3293
|
return error !== null && typeof error === 'object' && 'status' in error;
|
|
3294
3294
|
}
|
|
3295
3295
|
/**
|
|
@@ -3368,7 +3368,7 @@
|
|
|
3368
3368
|
// the new network adapter behavior
|
|
3369
3369
|
return reject(
|
|
3370
3370
|
// legacy network adapter check
|
|
3371
|
-
isFetchResponse(error)
|
|
3371
|
+
isFetchResponse$1(error)
|
|
3372
3372
|
? {
|
|
3373
3373
|
...error,
|
|
3374
3374
|
errorType: 'fetchResponse',
|
|
@@ -4280,7 +4280,7 @@
|
|
|
4280
4280
|
}
|
|
4281
4281
|
callbacks.push(callback);
|
|
4282
4282
|
}
|
|
4283
|
-
// version: 1.428.0-
|
|
4283
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
4284
4284
|
|
|
4285
4285
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4286
4286
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5324,7 +5324,7 @@
|
|
|
5324
5324
|
const { apiFamily, name } = metadata;
|
|
5325
5325
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5326
5326
|
}
|
|
5327
|
-
// version: 1.428.0-
|
|
5327
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
5328
5328
|
|
|
5329
5329
|
function isSupportedEntity(_objectApiName) {
|
|
5330
5330
|
return true;
|
|
@@ -32616,9 +32616,9 @@
|
|
|
32616
32616
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
32617
32617
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
32618
32618
|
});
|
|
32619
|
-
// version: 1.428.0-
|
|
32619
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
32620
32620
|
|
|
32621
|
-
var
|
|
32621
|
+
var draftQueueMaxRetryAttemptsGate = {
|
|
32622
32622
|
isOpen: function (e) {
|
|
32623
32623
|
return e.fallback;
|
|
32624
32624
|
},
|
|
@@ -32670,6 +32670,15 @@
|
|
|
32670
32670
|
return mockInstrumentation;
|
|
32671
32671
|
};
|
|
32672
32672
|
|
|
32673
|
+
var allowUpdatesForNonCachedRecords = {
|
|
32674
|
+
isOpen: function (e) {
|
|
32675
|
+
return e.fallback;
|
|
32676
|
+
},
|
|
32677
|
+
hasError: function () {
|
|
32678
|
+
return !0;
|
|
32679
|
+
},
|
|
32680
|
+
};
|
|
32681
|
+
|
|
32673
32682
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
32674
32683
|
|
|
32675
32684
|
/**
|
|
@@ -47840,6 +47849,13 @@
|
|
|
47840
47849
|
}
|
|
47841
47850
|
|
|
47842
47851
|
const DRAFT_SEGMENT = 'DRAFT';
|
|
47852
|
+
/**
|
|
47853
|
+
* Metadata key under which an action's upload retry-attempt count is persisted.
|
|
47854
|
+
* Lives in the action's durable `metadata` bag so the count survives app restarts
|
|
47855
|
+
* (the in-memory backoff interval resets on every startQueue()). Written by the
|
|
47856
|
+
* action handler on each retry and cleared when an action is manually retried.
|
|
47857
|
+
*/
|
|
47858
|
+
const DRAFT_ACTION_RETRY_COUNT_METADATA_KEY = 'retryCount';
|
|
47843
47859
|
class DurableDraftQueue {
|
|
47844
47860
|
getHandler(id) {
|
|
47845
47861
|
const handler = this.handlers[id];
|
|
@@ -48198,10 +48214,14 @@
|
|
|
48198
48214
|
if (!isDraftError(target)) {
|
|
48199
48215
|
throw Error(`Action ${actionId} is not in Error state`);
|
|
48200
48216
|
}
|
|
48217
|
+
// A manual retry is a fresh start: clear the persisted upload retry-attempt
|
|
48218
|
+
// count so the action doesn't immediately re-cap after a single failure.
|
|
48219
|
+
const { [DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: _retryCount, ...metadataWithoutRetryCount } = target.metadata || {};
|
|
48201
48220
|
let pendingAction = {
|
|
48202
48221
|
...target,
|
|
48203
48222
|
status: DraftActionStatus.Pending,
|
|
48204
48223
|
error: undefined,
|
|
48224
|
+
metadata: metadataWithoutRetryCount,
|
|
48205
48225
|
};
|
|
48206
48226
|
await this.draftStore.writeAction(pendingAction);
|
|
48207
48227
|
await this.notifyChangedListeners({
|
|
@@ -79609,6 +79629,322 @@
|
|
|
79609
79629
|
return create$3(adapterSpecificEnvironments, {});
|
|
79610
79630
|
}
|
|
79611
79631
|
|
|
79632
|
+
/**
|
|
79633
|
+
* This function takes an unknown error and normalizes it to an Error object
|
|
79634
|
+
*/
|
|
79635
|
+
function normalizeError$1(error) {
|
|
79636
|
+
if (typeof error === 'object' && error instanceof Error) {
|
|
79637
|
+
return error;
|
|
79638
|
+
}
|
|
79639
|
+
else if (typeof error === 'string') {
|
|
79640
|
+
return new Error(error);
|
|
79641
|
+
}
|
|
79642
|
+
return new Error(stringify$5(error));
|
|
79643
|
+
}
|
|
79644
|
+
/**
|
|
79645
|
+
* Maximum number of times an action's upload will be retried before the action is
|
|
79646
|
+
* transitioned to Error and surfaced to the consumer. Caps the otherwise-unbounded
|
|
79647
|
+
* retry loop that can wedge the single-worker draft queue when an upload fails
|
|
79648
|
+
* deterministically on every dispatch. Only enforced when the
|
|
79649
|
+
* `lmr.draft-queue-max-retry-attempts` gate is open.
|
|
79650
|
+
*/
|
|
79651
|
+
const MAX_RETRY_ATTEMPTS = 5;
|
|
79652
|
+
const MAX_RETRY_ERROR_CODE = 'MAX_RETRY_ATTEMPTS_EXCEEDED';
|
|
79653
|
+
function isFetchResponse(failure) {
|
|
79654
|
+
// The union is exactly FetchResponse | Error, so "not an Error" is the FetchResponse.
|
|
79655
|
+
// This is safer than duck-typing on status/ok: a custom Error subclass that happens to
|
|
79656
|
+
// carry those properties would be misclassified by a structural check.
|
|
79657
|
+
return !(failure instanceof Error);
|
|
79658
|
+
}
|
|
79659
|
+
/**
|
|
79660
|
+
* Builds the FetchResponse-shaped error attached to an action that has exhausted its
|
|
79661
|
+
* upload retries. Shaped like a real network error response (status/statusText/ok/
|
|
79662
|
+
* headers/body) so downstream consumers (DraftManager, queue instrumentation) that
|
|
79663
|
+
* read `action.error.status`/`.body`/etc. behave consistently with a server error.
|
|
79664
|
+
*
|
|
79665
|
+
* The failure that caused the final attempt — a non-ok response (HTTP path) or a thrown
|
|
79666
|
+
* error (catch path) — is folded into the body so the surfaced error says WHAT failed,
|
|
79667
|
+
* not merely that the attempt cap was reached.
|
|
79668
|
+
*/
|
|
79669
|
+
function buildMaxRetryError(lastFailure) {
|
|
79670
|
+
const capMessage = `Draft action exceeded ${MAX_RETRY_ATTEMPTS} upload retry attempts`;
|
|
79671
|
+
if (isFetchResponse(lastFailure)) {
|
|
79672
|
+
// Preserve the server's own error detail (status + body) so the surfaced error
|
|
79673
|
+
// carries the last response that caused us to give up retrying.
|
|
79674
|
+
return {
|
|
79675
|
+
status: HttpStatusCode$2.ServerError,
|
|
79676
|
+
statusText: capMessage,
|
|
79677
|
+
ok: false,
|
|
79678
|
+
headers: {},
|
|
79679
|
+
body: {
|
|
79680
|
+
errorCode: MAX_RETRY_ERROR_CODE,
|
|
79681
|
+
message: `${capMessage}. Last response: status=${lastFailure.status} ${lastFailure.statusText}`,
|
|
79682
|
+
lastResponseStatus: lastFailure.status,
|
|
79683
|
+
lastResponseBody: lastFailure.body,
|
|
79684
|
+
},
|
|
79685
|
+
};
|
|
79686
|
+
}
|
|
79687
|
+
return {
|
|
79688
|
+
status: HttpStatusCode$2.ServerError,
|
|
79689
|
+
statusText: capMessage,
|
|
79690
|
+
ok: false,
|
|
79691
|
+
headers: {},
|
|
79692
|
+
body: {
|
|
79693
|
+
errorCode: MAX_RETRY_ERROR_CODE,
|
|
79694
|
+
message: `${capMessage}. Last error: ${lastFailure.name}: ${lastFailure.message}`,
|
|
79695
|
+
lastErrorName: lastFailure.name,
|
|
79696
|
+
lastErrorMessage: lastFailure.message,
|
|
79697
|
+
},
|
|
79698
|
+
};
|
|
79699
|
+
}
|
|
79700
|
+
|
|
79701
|
+
function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
|
|
79702
|
+
if (adapterRequestContext === undefined) {
|
|
79703
|
+
return { eventObservers: observers };
|
|
79704
|
+
}
|
|
79705
|
+
if (adapterRequestContext.eventObservers === undefined) {
|
|
79706
|
+
return { ...adapterRequestContext, eventObservers: observers };
|
|
79707
|
+
}
|
|
79708
|
+
return {
|
|
79709
|
+
...adapterRequestContext,
|
|
79710
|
+
eventObservers: adapterRequestContext.eventObservers.concat(observers),
|
|
79711
|
+
};
|
|
79712
|
+
}
|
|
79713
|
+
/**
|
|
79714
|
+
* Use this method to sanitize the unknown error object when
|
|
79715
|
+
* we are unsure of the type of the error thrown
|
|
79716
|
+
*
|
|
79717
|
+
* @param err Unknown object to sanitize
|
|
79718
|
+
* @returns an instance of error
|
|
79719
|
+
*/
|
|
79720
|
+
function normalizeError$2(err) {
|
|
79721
|
+
if (err instanceof Error) {
|
|
79722
|
+
return err;
|
|
79723
|
+
}
|
|
79724
|
+
else if (typeof err === 'string') {
|
|
79725
|
+
return new Error(err);
|
|
79726
|
+
}
|
|
79727
|
+
return new Error(stringify$5(err));
|
|
79728
|
+
}
|
|
79729
|
+
// metrics
|
|
79730
|
+
/** GraphQL */
|
|
79731
|
+
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
79732
|
+
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
79733
|
+
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
79734
|
+
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
79735
|
+
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
79736
|
+
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
79737
|
+
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
79738
|
+
/** Draft Queue */
|
|
79739
|
+
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
79740
|
+
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
79741
|
+
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
79742
|
+
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
79743
|
+
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
79744
|
+
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
79745
|
+
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
79746
|
+
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
79747
|
+
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
79748
|
+
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
79749
|
+
const DRAFT_QUEUE_ACTION_UPLOAD_ERROR = 'draft-queue-action-upload-error';
|
|
79750
|
+
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
79751
|
+
/** Content Document */
|
|
79752
|
+
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
79753
|
+
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
79754
|
+
/** Priming */
|
|
79755
|
+
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
79756
|
+
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
79757
|
+
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
79758
|
+
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
79759
|
+
// logs
|
|
79760
|
+
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
79761
|
+
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
79762
|
+
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
79763
|
+
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
79764
|
+
/** Garbage Collection */
|
|
79765
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT = 'garbage-collection-aggressive-trim-count';
|
|
79766
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED = 'garbage-collection-aggressive-trim-records-trimmed';
|
|
79767
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM = 'garbage-collection-aggressive-trim-total-records-before-trim';
|
|
79768
|
+
const ldsMobileInstrumentation$2 = getInstrumentation();
|
|
79769
|
+
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
79770
|
+
__nimbus.plugins !== undefined &&
|
|
79771
|
+
__nimbus.plugins.JSLoggerPlugin !== undefined
|
|
79772
|
+
? __nimbus.plugins.JSLoggerPlugin
|
|
79773
|
+
: undefined;
|
|
79774
|
+
function reportGraphqlQueryParseError(err) {
|
|
79775
|
+
const error = normalizeError$2(err);
|
|
79776
|
+
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
79777
|
+
// Metric
|
|
79778
|
+
reportGraphqlAdapterError(errorCode);
|
|
79779
|
+
// Log
|
|
79780
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79781
|
+
}
|
|
79782
|
+
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
79783
|
+
const error = normalizeError$2(err);
|
|
79784
|
+
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
79785
|
+
// Metric
|
|
79786
|
+
reportGraphqlAdapterError(errorCode);
|
|
79787
|
+
// Log
|
|
79788
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79789
|
+
}
|
|
79790
|
+
function reportGraphqlCreateSnapshotError(err) {
|
|
79791
|
+
const error = normalizeError$2(err);
|
|
79792
|
+
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
79793
|
+
// Metric
|
|
79794
|
+
reportGraphqlAdapterError(errorCode);
|
|
79795
|
+
// Log
|
|
79796
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79797
|
+
}
|
|
79798
|
+
function reportGraphQlEvalDbReadDuration(duration) {
|
|
79799
|
+
ldsMobileInstrumentation$2.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
79800
|
+
}
|
|
79801
|
+
function reportGraphqlAdapterError(errorCode) {
|
|
79802
|
+
// Increment overall count with errorCode as tag
|
|
79803
|
+
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
79804
|
+
}
|
|
79805
|
+
function reportGraphqlQueryInstrumentation(data) {
|
|
79806
|
+
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
79807
|
+
const recordBuckets = [
|
|
79808
|
+
1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
|
|
79809
|
+
];
|
|
79810
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
|
|
79811
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
|
|
79812
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
79813
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
79814
|
+
}
|
|
79815
|
+
function incrementGraphQLRefreshUndfined() {
|
|
79816
|
+
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
79817
|
+
}
|
|
79818
|
+
function reportDraftActionEvent(state, draftCount, message) {
|
|
79819
|
+
if (nimbusLogger) {
|
|
79820
|
+
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
79821
|
+
}
|
|
79822
|
+
switch (state) {
|
|
79823
|
+
case 'added':
|
|
79824
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
79825
|
+
break;
|
|
79826
|
+
case 'uploading':
|
|
79827
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
79828
|
+
break;
|
|
79829
|
+
case 'completed':
|
|
79830
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
79831
|
+
break;
|
|
79832
|
+
case 'deleted':
|
|
79833
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
79834
|
+
break;
|
|
79835
|
+
case 'failed':
|
|
79836
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
79837
|
+
break;
|
|
79838
|
+
case 'updated':
|
|
79839
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
79840
|
+
break;
|
|
79841
|
+
}
|
|
79842
|
+
}
|
|
79843
|
+
/**
|
|
79844
|
+
* Reports an exception thrown while uploading a draft action. The thrown error is
|
|
79845
|
+
* otherwise swallowed by the upload handler's retry path, leaving the failure
|
|
79846
|
+
* invisible in telemetry; this surfaces it to o11y (log + counter) so a deterministic
|
|
79847
|
+
* upload failure can be diagnosed instead of silently retried forever.
|
|
79848
|
+
*
|
|
79849
|
+
* PII: the device log line carries only the handler id, retry attempt, and the error
|
|
79850
|
+
* NAME (e.g. "TypeError") — never the free-text error message, which can embed record
|
|
79851
|
+
* ids (URL path segments) or server field-validation strings. The full normalized error
|
|
79852
|
+
* (message + stack) is handed only to `ldsMobileInstrumentation.error`, the structured
|
|
79853
|
+
* o11y error pipeline responsible for scrubbing/handling that detail. Also does NOT log
|
|
79854
|
+
* the action's targetId/tag or any request body/field values.
|
|
79855
|
+
*/
|
|
79856
|
+
function reportDraftActionUploadError(error, handlerId, attempt) {
|
|
79857
|
+
const normalized = normalizeError$2(error);
|
|
79858
|
+
if (nimbusLogger) {
|
|
79859
|
+
nimbusLogger.logError(`Draft action upload error: handler=${handlerId}, attempt=${attempt}, name=${normalized.name}`);
|
|
79860
|
+
}
|
|
79861
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOAD_ERROR, 1, true, {
|
|
79862
|
+
handlerId,
|
|
79863
|
+
});
|
|
79864
|
+
ldsMobileInstrumentation$2.error(normalized, DRAFT_QUEUE_ACTION_UPLOAD_ERROR);
|
|
79865
|
+
}
|
|
79866
|
+
function reportDraftQueueState(state, draftCount) {
|
|
79867
|
+
if (nimbusLogger) {
|
|
79868
|
+
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
79869
|
+
}
|
|
79870
|
+
switch (state) {
|
|
79871
|
+
case 'started':
|
|
79872
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
79873
|
+
break;
|
|
79874
|
+
case 'error':
|
|
79875
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
79876
|
+
break;
|
|
79877
|
+
case 'waiting':
|
|
79878
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
79879
|
+
break;
|
|
79880
|
+
case 'stopped':
|
|
79881
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
79882
|
+
break;
|
|
79883
|
+
}
|
|
79884
|
+
}
|
|
79885
|
+
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
79886
|
+
let error;
|
|
79887
|
+
if (err.body !== undefined) {
|
|
79888
|
+
error = err.body;
|
|
79889
|
+
}
|
|
79890
|
+
else {
|
|
79891
|
+
error = normalizeError$2(err);
|
|
79892
|
+
}
|
|
79893
|
+
const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
|
|
79894
|
+
const errorType = error.errorType;
|
|
79895
|
+
const tags = {
|
|
79896
|
+
errorCode,
|
|
79897
|
+
};
|
|
79898
|
+
if (errorType !== undefined) {
|
|
79899
|
+
tags.errorType = errorType;
|
|
79900
|
+
}
|
|
79901
|
+
// Metric
|
|
79902
|
+
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
79903
|
+
// Log
|
|
79904
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79905
|
+
}
|
|
79906
|
+
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
79907
|
+
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
79908
|
+
}
|
|
79909
|
+
/** Priming */
|
|
79910
|
+
function reportPrimingSessionCreated() {
|
|
79911
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
79912
|
+
}
|
|
79913
|
+
function reportPrimingError(errorType, recordCount) {
|
|
79914
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
79915
|
+
errorType,
|
|
79916
|
+
});
|
|
79917
|
+
}
|
|
79918
|
+
function reportPrimingSuccess(recordCount) {
|
|
79919
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
79920
|
+
}
|
|
79921
|
+
function reportPrimingConflict(resolutionType, recordCount) {
|
|
79922
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
79923
|
+
resolutionType,
|
|
79924
|
+
});
|
|
79925
|
+
}
|
|
79926
|
+
/** Network */
|
|
79927
|
+
function reportChunkCandidateUrlLength(urlLength) {
|
|
79928
|
+
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
79929
|
+
ldsMobileInstrumentation$2.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
79930
|
+
}
|
|
79931
|
+
/** Garbage Collection */
|
|
79932
|
+
function reportAggressiveTrimTriggered(trimCount, beforeTrimRecordCount, totalRecordsTrimmed) {
|
|
79933
|
+
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT, trimCount);
|
|
79934
|
+
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM, beforeTrimRecordCount);
|
|
79935
|
+
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED, totalRecordsTrimmed);
|
|
79936
|
+
}
|
|
79937
|
+
/** One Store Cache Purge */
|
|
79938
|
+
const ONESTORE_CACHE_PURGING_RECORDS_PURGED = 'onestore-cache-purging-records-purged';
|
|
79939
|
+
const ONESTORE_CACHE_PURGING_RECORDS_ERROR = 'onestore-cache-purging-records-error';
|
|
79940
|
+
function reportOneStoreRecordsPurgedFromCache(recordsPurged) {
|
|
79941
|
+
ldsMobileInstrumentation$2.trackValue(ONESTORE_CACHE_PURGING_RECORDS_PURGED, recordsPurged);
|
|
79942
|
+
}
|
|
79943
|
+
function reportOneStoreCachePurgingError(error) {
|
|
79944
|
+
const errorMessage = normalizeError$2(error);
|
|
79945
|
+
ldsMobileInstrumentation$2.error(errorMessage, ONESTORE_CACHE_PURGING_RECORDS_ERROR);
|
|
79946
|
+
}
|
|
79947
|
+
|
|
79612
79948
|
const HTTP_HEADER_RETRY_AFTER = 'Retry-After';
|
|
79613
79949
|
const HTTP_HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
|
79614
79950
|
const ERROR_CODE_IDEMPOTENCY_FEATURE_NOT_ENABLED = 'IDEMPOTENCY_FEATURE_NOT_ENABLED';
|
|
@@ -79759,20 +80095,89 @@
|
|
|
79759
80095
|
shouldRetry = true;
|
|
79760
80096
|
actionDataChanged = true;
|
|
79761
80097
|
}
|
|
79762
|
-
|
|
79763
|
-
|
|
79764
|
-
|
|
80098
|
+
if (shouldRetry) {
|
|
80099
|
+
// Funnel the retry through the cap: when the gate is open this persists
|
|
80100
|
+
// the attempt count and errors out once the cap is hit; when the gate is
|
|
80101
|
+
// closed it behaves exactly as before. The non-ok response is the failure
|
|
80102
|
+
// that would otherwise be retried.
|
|
80103
|
+
await this.retryOrCap(updatedAction, response, actionErrored, retryDelayInMs, actionDataChanged);
|
|
80104
|
+
}
|
|
80105
|
+
else {
|
|
80106
|
+
await actionErrored({
|
|
79765
80107
|
...updatedAction,
|
|
79766
80108
|
error: response,
|
|
79767
80109
|
status: DraftActionStatus.Error,
|
|
79768
|
-
},
|
|
80110
|
+
}, false, retryDelayInMs, actionDataChanged);
|
|
80111
|
+
}
|
|
79769
80112
|
return ProcessActionResult.ACTION_ERRORED;
|
|
79770
80113
|
}
|
|
79771
80114
|
catch (e) {
|
|
79772
|
-
|
|
80115
|
+
// #3 (ungated): the thrown exception is otherwise swallowed here, leaving a
|
|
80116
|
+
// deterministic upload failure invisible in telemetry. Surface it to o11y
|
|
80117
|
+
// before deciding whether to retry.
|
|
80118
|
+
const error = normalizeError$1(e);
|
|
80119
|
+
const attempt = this.getUploadRetryCount(action) + 1;
|
|
80120
|
+
reportDraftActionUploadError(error, this.handlerId, attempt);
|
|
80121
|
+
await this.retryOrCap(action, error, actionErrored);
|
|
79773
80122
|
return ProcessActionResult.NETWORK_ERROR;
|
|
79774
80123
|
}
|
|
79775
80124
|
}
|
|
80125
|
+
/**
|
|
80126
|
+
* Reads the persisted upload retry-attempt count from the action's durable metadata
|
|
80127
|
+
* bag. The count lives in metadata (rather than in-memory) so it survives app
|
|
80128
|
+
* restarts and queue re-creation — the failure modes that let the unbounded retry
|
|
80129
|
+
* loop run for days.
|
|
80130
|
+
*/
|
|
80131
|
+
getUploadRetryCount(action) {
|
|
80132
|
+
const parsed = Number(action.metadata?.[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]);
|
|
80133
|
+
// Guard against a missing/corrupt persisted value: a NaN, fractional, or negative
|
|
80134
|
+
// count must never weaken the cap. Floor to a non-negative integer, defaulting to 0.
|
|
80135
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
80136
|
+
return 0;
|
|
80137
|
+
}
|
|
80138
|
+
return Math.floor(parsed);
|
|
80139
|
+
}
|
|
80140
|
+
/**
|
|
80141
|
+
* Enforces the upload retry-attempt cap around the queue's `actionErrored` callback.
|
|
80142
|
+
* Both retry paths — a retryable HTTP error and a thrown exception — funnel through
|
|
80143
|
+
* here.
|
|
80144
|
+
*
|
|
80145
|
+
* The entire cap behavior is gated behind `lmr.draft-queue-max-retry-attempts`. When
|
|
80146
|
+
* the gate is CLOSED this is a transparent passthrough: it issues the same
|
|
80147
|
+
* `actionErrored(action, true, ...)` retry the queue made before this change, and
|
|
80148
|
+
* writes no extra metadata. When the gate is OPEN it persists an incremented attempt
|
|
80149
|
+
* count to the action's durable metadata and, once the action has failed
|
|
80150
|
+
* {@link MAX_RETRY_ATTEMPTS} times, transitions it to Error (carrying a
|
|
80151
|
+
* FetchResponse-shaped error that names the failure that exhausted the retries)
|
|
80152
|
+
* instead of scheduling yet another retry.
|
|
80153
|
+
*/
|
|
80154
|
+
async retryOrCap(action, lastFailure, actionErrored, retryDelayInMs, actionDataChanged) {
|
|
80155
|
+
if (!draftQueueMaxRetryAttemptsGate.isOpen({ fallback: false })) {
|
|
80156
|
+
// Gate closed: preserve the pre-existing unbounded-retry behavior exactly.
|
|
80157
|
+
await actionErrored(action, true, retryDelayInMs, actionDataChanged);
|
|
80158
|
+
return;
|
|
80159
|
+
}
|
|
80160
|
+
const attempt = this.getUploadRetryCount(action) + 1;
|
|
80161
|
+
if (attempt >= MAX_RETRY_ATTEMPTS) {
|
|
80162
|
+
await actionErrored({
|
|
80163
|
+
...action,
|
|
80164
|
+
error: buildMaxRetryError(lastFailure),
|
|
80165
|
+
status: DraftActionStatus.Error,
|
|
80166
|
+
}, false);
|
|
80167
|
+
return;
|
|
80168
|
+
}
|
|
80169
|
+
// Persist the incremented attempt count so it survives restarts. Forcing
|
|
80170
|
+
// actionDataChanged ensures the queue writes the updated metadata before the
|
|
80171
|
+
// action is rescheduled for retry.
|
|
80172
|
+
const retryingAction = {
|
|
80173
|
+
...action,
|
|
80174
|
+
metadata: {
|
|
80175
|
+
...action.metadata,
|
|
80176
|
+
[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: String(attempt),
|
|
80177
|
+
},
|
|
80178
|
+
};
|
|
80179
|
+
await actionErrored(retryingAction, true, retryDelayInMs, true);
|
|
80180
|
+
}
|
|
79776
80181
|
async handleActionEnqueued(action) {
|
|
79777
80182
|
const impactedKeys = await this.recordService.setSideEffectsForActions([action]);
|
|
79778
80183
|
await this.recordService.reapplyRecordSideEffects(impactedKeys);
|
|
@@ -79936,6 +80341,13 @@
|
|
|
79936
80341
|
this.isActionOfType(sourceAction)) {
|
|
79937
80342
|
targetAction.status = DraftActionStatus.Pending;
|
|
79938
80343
|
targetAction.data = sourceAction.data;
|
|
80344
|
+
// Replacing an action's data re-queues it as a fresh upload, so the persisted
|
|
80345
|
+
// upload retry-attempt count must not carry over — otherwise a previously-
|
|
80346
|
+
// throttled action could immediately re-hit the cap on its first new attempt.
|
|
80347
|
+
// (Mirrors the same clear in mergeActions.)
|
|
80348
|
+
if (targetAction.metadata !== undefined) {
|
|
80349
|
+
delete targetAction.metadata[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY];
|
|
80350
|
+
}
|
|
79939
80351
|
return targetAction;
|
|
79940
80352
|
}
|
|
79941
80353
|
else {
|
|
@@ -79975,6 +80387,11 @@
|
|
|
79975
80387
|
}
|
|
79976
80388
|
// overlay metadata
|
|
79977
80389
|
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
80390
|
+
// A merge folds new user data into the action and re-queues it as a fresh upload,
|
|
80391
|
+
// so the persisted upload retry-attempt count must not carry over — otherwise a
|
|
80392
|
+
// previously-throttled action could immediately re-hit the cap on its first new
|
|
80393
|
+
// attempt.
|
|
80394
|
+
delete merged.metadata[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY];
|
|
79978
80395
|
// put status back to pending to auto upload if queue is active and targed is at the head.
|
|
79979
80396
|
merged.status = DraftActionStatus.Pending;
|
|
79980
80397
|
return merged;
|
|
@@ -80585,229 +81002,6 @@
|
|
|
80585
81002
|
}
|
|
80586
81003
|
}
|
|
80587
81004
|
|
|
80588
|
-
function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
|
|
80589
|
-
if (adapterRequestContext === undefined) {
|
|
80590
|
-
return { eventObservers: observers };
|
|
80591
|
-
}
|
|
80592
|
-
if (adapterRequestContext.eventObservers === undefined) {
|
|
80593
|
-
return { ...adapterRequestContext, eventObservers: observers };
|
|
80594
|
-
}
|
|
80595
|
-
return {
|
|
80596
|
-
...adapterRequestContext,
|
|
80597
|
-
eventObservers: adapterRequestContext.eventObservers.concat(observers),
|
|
80598
|
-
};
|
|
80599
|
-
}
|
|
80600
|
-
/**
|
|
80601
|
-
* Use this method to sanitize the unknown error object when
|
|
80602
|
-
* we are unsure of the type of the error thrown
|
|
80603
|
-
*
|
|
80604
|
-
* @param err Unknown object to sanitize
|
|
80605
|
-
* @returns an instance of error
|
|
80606
|
-
*/
|
|
80607
|
-
function normalizeError$1(err) {
|
|
80608
|
-
if (err instanceof Error) {
|
|
80609
|
-
return err;
|
|
80610
|
-
}
|
|
80611
|
-
else if (typeof err === 'string') {
|
|
80612
|
-
return new Error(err);
|
|
80613
|
-
}
|
|
80614
|
-
return new Error(stringify$5(err));
|
|
80615
|
-
}
|
|
80616
|
-
// metrics
|
|
80617
|
-
/** GraphQL */
|
|
80618
|
-
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
80619
|
-
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
80620
|
-
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
80621
|
-
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
80622
|
-
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
80623
|
-
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
80624
|
-
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
80625
|
-
/** Draft Queue */
|
|
80626
|
-
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
80627
|
-
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
80628
|
-
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
80629
|
-
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
80630
|
-
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
80631
|
-
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
80632
|
-
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
80633
|
-
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
80634
|
-
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
80635
|
-
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
80636
|
-
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
80637
|
-
/** Content Document */
|
|
80638
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
80639
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
80640
|
-
/** Priming */
|
|
80641
|
-
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
80642
|
-
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
80643
|
-
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
80644
|
-
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
80645
|
-
// logs
|
|
80646
|
-
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
80647
|
-
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
80648
|
-
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
80649
|
-
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
80650
|
-
/** Garbage Collection */
|
|
80651
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT = 'garbage-collection-aggressive-trim-count';
|
|
80652
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED = 'garbage-collection-aggressive-trim-records-trimmed';
|
|
80653
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM = 'garbage-collection-aggressive-trim-total-records-before-trim';
|
|
80654
|
-
const ldsMobileInstrumentation$2 = getInstrumentation();
|
|
80655
|
-
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
80656
|
-
__nimbus.plugins !== undefined &&
|
|
80657
|
-
__nimbus.plugins.JSLoggerPlugin !== undefined
|
|
80658
|
-
? __nimbus.plugins.JSLoggerPlugin
|
|
80659
|
-
: undefined;
|
|
80660
|
-
function reportGraphqlQueryParseError(err) {
|
|
80661
|
-
const error = normalizeError$1(err);
|
|
80662
|
-
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
80663
|
-
// Metric
|
|
80664
|
-
reportGraphqlAdapterError(errorCode);
|
|
80665
|
-
// Log
|
|
80666
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80667
|
-
}
|
|
80668
|
-
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
80669
|
-
const error = normalizeError$1(err);
|
|
80670
|
-
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
80671
|
-
// Metric
|
|
80672
|
-
reportGraphqlAdapterError(errorCode);
|
|
80673
|
-
// Log
|
|
80674
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80675
|
-
}
|
|
80676
|
-
function reportGraphqlCreateSnapshotError(err) {
|
|
80677
|
-
const error = normalizeError$1(err);
|
|
80678
|
-
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
80679
|
-
// Metric
|
|
80680
|
-
reportGraphqlAdapterError(errorCode);
|
|
80681
|
-
// Log
|
|
80682
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80683
|
-
}
|
|
80684
|
-
function reportGraphQlEvalDbReadDuration(duration) {
|
|
80685
|
-
ldsMobileInstrumentation$2.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
80686
|
-
}
|
|
80687
|
-
function reportGraphqlAdapterError(errorCode) {
|
|
80688
|
-
// Increment overall count with errorCode as tag
|
|
80689
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
80690
|
-
}
|
|
80691
|
-
function reportGraphqlQueryInstrumentation(data) {
|
|
80692
|
-
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
80693
|
-
const recordBuckets = [
|
|
80694
|
-
1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
|
|
80695
|
-
];
|
|
80696
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
|
|
80697
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
|
|
80698
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
80699
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
80700
|
-
}
|
|
80701
|
-
function incrementGraphQLRefreshUndfined() {
|
|
80702
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
80703
|
-
}
|
|
80704
|
-
function reportDraftActionEvent(state, draftCount, message) {
|
|
80705
|
-
if (nimbusLogger) {
|
|
80706
|
-
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
80707
|
-
}
|
|
80708
|
-
switch (state) {
|
|
80709
|
-
case 'added':
|
|
80710
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
80711
|
-
break;
|
|
80712
|
-
case 'uploading':
|
|
80713
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
80714
|
-
break;
|
|
80715
|
-
case 'completed':
|
|
80716
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
80717
|
-
break;
|
|
80718
|
-
case 'deleted':
|
|
80719
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
80720
|
-
break;
|
|
80721
|
-
case 'failed':
|
|
80722
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
80723
|
-
break;
|
|
80724
|
-
case 'updated':
|
|
80725
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
80726
|
-
break;
|
|
80727
|
-
}
|
|
80728
|
-
}
|
|
80729
|
-
function reportDraftQueueState(state, draftCount) {
|
|
80730
|
-
if (nimbusLogger) {
|
|
80731
|
-
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
80732
|
-
}
|
|
80733
|
-
switch (state) {
|
|
80734
|
-
case 'started':
|
|
80735
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
80736
|
-
break;
|
|
80737
|
-
case 'error':
|
|
80738
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
80739
|
-
break;
|
|
80740
|
-
case 'waiting':
|
|
80741
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
80742
|
-
break;
|
|
80743
|
-
case 'stopped':
|
|
80744
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
80745
|
-
break;
|
|
80746
|
-
}
|
|
80747
|
-
}
|
|
80748
|
-
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
80749
|
-
let error;
|
|
80750
|
-
if (err.body !== undefined) {
|
|
80751
|
-
error = err.body;
|
|
80752
|
-
}
|
|
80753
|
-
else {
|
|
80754
|
-
error = normalizeError$1(err);
|
|
80755
|
-
}
|
|
80756
|
-
const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
|
|
80757
|
-
const errorType = error.errorType;
|
|
80758
|
-
const tags = {
|
|
80759
|
-
errorCode,
|
|
80760
|
-
};
|
|
80761
|
-
if (errorType !== undefined) {
|
|
80762
|
-
tags.errorType = errorType;
|
|
80763
|
-
}
|
|
80764
|
-
// Metric
|
|
80765
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
80766
|
-
// Log
|
|
80767
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80768
|
-
}
|
|
80769
|
-
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
80770
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
80771
|
-
}
|
|
80772
|
-
/** Priming */
|
|
80773
|
-
function reportPrimingSessionCreated() {
|
|
80774
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
80775
|
-
}
|
|
80776
|
-
function reportPrimingError(errorType, recordCount) {
|
|
80777
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
80778
|
-
errorType,
|
|
80779
|
-
});
|
|
80780
|
-
}
|
|
80781
|
-
function reportPrimingSuccess(recordCount) {
|
|
80782
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
80783
|
-
}
|
|
80784
|
-
function reportPrimingConflict(resolutionType, recordCount) {
|
|
80785
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
80786
|
-
resolutionType,
|
|
80787
|
-
});
|
|
80788
|
-
}
|
|
80789
|
-
/** Network */
|
|
80790
|
-
function reportChunkCandidateUrlLength(urlLength) {
|
|
80791
|
-
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
80792
|
-
ldsMobileInstrumentation$2.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
80793
|
-
}
|
|
80794
|
-
/** Garbage Collection */
|
|
80795
|
-
function reportAggressiveTrimTriggered(trimCount, beforeTrimRecordCount, totalRecordsTrimmed) {
|
|
80796
|
-
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT, trimCount);
|
|
80797
|
-
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM, beforeTrimRecordCount);
|
|
80798
|
-
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED, totalRecordsTrimmed);
|
|
80799
|
-
}
|
|
80800
|
-
/** One Store Cache Purge */
|
|
80801
|
-
const ONESTORE_CACHE_PURGING_RECORDS_PURGED = 'onestore-cache-purging-records-purged';
|
|
80802
|
-
const ONESTORE_CACHE_PURGING_RECORDS_ERROR = 'onestore-cache-purging-records-error';
|
|
80803
|
-
function reportOneStoreRecordsPurgedFromCache(recordsPurged) {
|
|
80804
|
-
ldsMobileInstrumentation$2.trackValue(ONESTORE_CACHE_PURGING_RECORDS_PURGED, recordsPurged);
|
|
80805
|
-
}
|
|
80806
|
-
function reportOneStoreCachePurgingError(error) {
|
|
80807
|
-
const errorMessage = normalizeError$1(error);
|
|
80808
|
-
ldsMobileInstrumentation$2.error(errorMessage, ONESTORE_CACHE_PURGING_RECORDS_ERROR);
|
|
80809
|
-
}
|
|
80810
|
-
|
|
80811
81005
|
const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
|
|
80812
81006
|
class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
|
|
80813
81007
|
constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService, objectInfoService, getRecord) {
|
|
@@ -89429,7 +89623,7 @@
|
|
|
89429
89623
|
return operation()
|
|
89430
89624
|
.catch((err) => {
|
|
89431
89625
|
hasError = true;
|
|
89432
|
-
const error = normalizeError$
|
|
89626
|
+
const error = normalizeError$2(err);
|
|
89433
89627
|
tags['errorMessage'] = error.message;
|
|
89434
89628
|
if (logError) {
|
|
89435
89629
|
ldsMobileInstrumentation$2.error(error);
|
|
@@ -96248,7 +96442,7 @@
|
|
|
96248
96442
|
},
|
|
96249
96443
|
};
|
|
96250
96444
|
}
|
|
96251
|
-
// version: 1.428.0-
|
|
96445
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
96252
96446
|
|
|
96253
96447
|
/**
|
|
96254
96448
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96274,7 +96468,7 @@
|
|
|
96274
96468
|
},
|
|
96275
96469
|
};
|
|
96276
96470
|
}
|
|
96277
|
-
// version: 1.428.0-
|
|
96471
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
96278
96472
|
|
|
96279
96473
|
/*!
|
|
96280
96474
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -99008,7 +99202,7 @@
|
|
|
99008
99202
|
id: '@salesforce/lds-network-adapter',
|
|
99009
99203
|
instrument: instrument$2,
|
|
99010
99204
|
});
|
|
99011
|
-
// version: 1.428.0-
|
|
99205
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
99012
99206
|
|
|
99013
99207
|
const { create: create$2, keys: keys$2 } = Object;
|
|
99014
99208
|
const { stringify, parse } = JSON;
|
|
@@ -106566,6 +106760,11 @@
|
|
|
106566
106760
|
Object.entries(this.latestUsedRecordIdToWeakEtagMap).forEach(([recordId, oneStoreRecordWeakEtag]) => {
|
|
106567
106761
|
const normalizedLuvioRecord = this.services.luvioUiapiRecords.getNormalizedLuvioRecord(recordId, reader);
|
|
106568
106762
|
if (!normalizedLuvioRecord) {
|
|
106763
|
+
// A record that was present when this snapshot was read
|
|
106764
|
+
// is now absent from the Luvio store (e.g. evicted by a
|
|
106765
|
+
// uiRecordApi deleteRecord). Its disappearance changes the
|
|
106766
|
+
// result set, so treat it as a change and re-emit.
|
|
106767
|
+
dataChanged = true;
|
|
106569
106768
|
return;
|
|
106570
106769
|
}
|
|
106571
106770
|
const luvioRecordWeakEtag = normalizedLuvioRecord.weakEtag;
|
|
@@ -107067,7 +107266,7 @@
|
|
|
107067
107266
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
107068
107267
|
}
|
|
107069
107268
|
}
|
|
107070
|
-
// version: 1.428.0-
|
|
107269
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
107071
107270
|
|
|
107072
107271
|
function createFragmentMap(documentNode) {
|
|
107073
107272
|
const fragments = {};
|
|
@@ -136304,7 +136503,7 @@
|
|
|
136304
136503
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
136305
136504
|
instrument: instrument$1,
|
|
136306
136505
|
});
|
|
136307
|
-
// version: 1.428.0-
|
|
136506
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
136308
136507
|
|
|
136309
136508
|
// On core the unstable adapters are re-exported with different names,
|
|
136310
136509
|
// we want to match them here.
|
|
@@ -136456,7 +136655,7 @@
|
|
|
136456
136655
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
136457
136656
|
graphQLImperative = ldsAdapter;
|
|
136458
136657
|
});
|
|
136459
|
-
// version: 1.428.0-
|
|
136658
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
136460
136659
|
|
|
136461
136660
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
136462
136661
|
__proto__: null,
|
|
@@ -137255,7 +137454,7 @@
|
|
|
137255
137454
|
function register(r) {
|
|
137256
137455
|
callbacks$1.forEach((callback) => callback(r));
|
|
137257
137456
|
}
|
|
137258
|
-
// version: 1.428.0-
|
|
137457
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
137259
137458
|
|
|
137260
137459
|
/**
|
|
137261
137460
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -138592,4 +138791,4 @@
|
|
|
138592
138791
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
138593
138792
|
|
|
138594
138793
|
}));
|
|
138595
|
-
// version: 1.428.0-
|
|
138794
|
+
// version: 1.428.0-dev15-45ce8e1de5
|