@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.
|
@@ -3283,7 +3283,7 @@ function resolveCachePolicy(cachePolicy, defaultCachePolicy) {
|
|
|
3283
3283
|
}
|
|
3284
3284
|
}
|
|
3285
3285
|
}
|
|
3286
|
-
function isFetchResponse(error) {
|
|
3286
|
+
function isFetchResponse$1(error) {
|
|
3287
3287
|
return error !== null && typeof error === 'object' && 'status' in error;
|
|
3288
3288
|
}
|
|
3289
3289
|
/**
|
|
@@ -3362,7 +3362,7 @@ class Environment {
|
|
|
3362
3362
|
// the new network adapter behavior
|
|
3363
3363
|
return reject(
|
|
3364
3364
|
// legacy network adapter check
|
|
3365
|
-
isFetchResponse(error)
|
|
3365
|
+
isFetchResponse$1(error)
|
|
3366
3366
|
? {
|
|
3367
3367
|
...error,
|
|
3368
3368
|
errorType: 'fetchResponse',
|
|
@@ -4274,7 +4274,7 @@ function withDefaultLuvio(callback) {
|
|
|
4274
4274
|
}
|
|
4275
4275
|
callbacks.push(callback);
|
|
4276
4276
|
}
|
|
4277
|
-
// version: 1.428.0-
|
|
4277
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
4278
4278
|
|
|
4279
4279
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4280
4280
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5318,7 +5318,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
5318
5318
|
const { apiFamily, name } = metadata;
|
|
5319
5319
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5320
5320
|
}
|
|
5321
|
-
// version: 1.428.0-
|
|
5321
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
5322
5322
|
|
|
5323
5323
|
function isSupportedEntity(_objectApiName) {
|
|
5324
5324
|
return true;
|
|
@@ -32610,9 +32610,9 @@ withDefaultLuvio((luvio) => {
|
|
|
32610
32610
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
32611
32611
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
32612
32612
|
});
|
|
32613
|
-
// version: 1.428.0-
|
|
32613
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
32614
32614
|
|
|
32615
|
-
var
|
|
32615
|
+
var draftQueueMaxRetryAttemptsGate = {
|
|
32616
32616
|
isOpen: function (e) {
|
|
32617
32617
|
return e.fallback;
|
|
32618
32618
|
},
|
|
@@ -32664,6 +32664,15 @@ const getInstrumentation = () => {
|
|
|
32664
32664
|
return mockInstrumentation;
|
|
32665
32665
|
};
|
|
32666
32666
|
|
|
32667
|
+
var allowUpdatesForNonCachedRecords = {
|
|
32668
|
+
isOpen: function (e) {
|
|
32669
|
+
return e.fallback;
|
|
32670
|
+
},
|
|
32671
|
+
hasError: function () {
|
|
32672
|
+
return !0;
|
|
32673
|
+
},
|
|
32674
|
+
};
|
|
32675
|
+
|
|
32667
32676
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
32668
32677
|
|
|
32669
32678
|
/**
|
|
@@ -47834,6 +47843,13 @@ function customActionHandler(executor, id, draftQueue) {
|
|
|
47834
47843
|
}
|
|
47835
47844
|
|
|
47836
47845
|
const DRAFT_SEGMENT = 'DRAFT';
|
|
47846
|
+
/**
|
|
47847
|
+
* Metadata key under which an action's upload retry-attempt count is persisted.
|
|
47848
|
+
* Lives in the action's durable `metadata` bag so the count survives app restarts
|
|
47849
|
+
* (the in-memory backoff interval resets on every startQueue()). Written by the
|
|
47850
|
+
* action handler on each retry and cleared when an action is manually retried.
|
|
47851
|
+
*/
|
|
47852
|
+
const DRAFT_ACTION_RETRY_COUNT_METADATA_KEY = 'retryCount';
|
|
47837
47853
|
class DurableDraftQueue {
|
|
47838
47854
|
getHandler(id) {
|
|
47839
47855
|
const handler = this.handlers[id];
|
|
@@ -48192,10 +48208,14 @@ class DurableDraftQueue {
|
|
|
48192
48208
|
if (!isDraftError(target)) {
|
|
48193
48209
|
throw Error(`Action ${actionId} is not in Error state`);
|
|
48194
48210
|
}
|
|
48211
|
+
// A manual retry is a fresh start: clear the persisted upload retry-attempt
|
|
48212
|
+
// count so the action doesn't immediately re-cap after a single failure.
|
|
48213
|
+
const { [DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: _retryCount, ...metadataWithoutRetryCount } = target.metadata || {};
|
|
48195
48214
|
let pendingAction = {
|
|
48196
48215
|
...target,
|
|
48197
48216
|
status: DraftActionStatus.Pending,
|
|
48198
48217
|
error: undefined,
|
|
48218
|
+
metadata: metadataWithoutRetryCount,
|
|
48199
48219
|
};
|
|
48200
48220
|
await this.draftStore.writeAction(pendingAction);
|
|
48201
48221
|
await this.notifyChangedListeners({
|
|
@@ -79603,6 +79623,322 @@ function makeEnvironmentUiApiRecordDraftAware(luvio, options, env) {
|
|
|
79603
79623
|
return create$3(adapterSpecificEnvironments, {});
|
|
79604
79624
|
}
|
|
79605
79625
|
|
|
79626
|
+
/**
|
|
79627
|
+
* This function takes an unknown error and normalizes it to an Error object
|
|
79628
|
+
*/
|
|
79629
|
+
function normalizeError$1(error) {
|
|
79630
|
+
if (typeof error === 'object' && error instanceof Error) {
|
|
79631
|
+
return error;
|
|
79632
|
+
}
|
|
79633
|
+
else if (typeof error === 'string') {
|
|
79634
|
+
return new Error(error);
|
|
79635
|
+
}
|
|
79636
|
+
return new Error(stringify$5(error));
|
|
79637
|
+
}
|
|
79638
|
+
/**
|
|
79639
|
+
* Maximum number of times an action's upload will be retried before the action is
|
|
79640
|
+
* transitioned to Error and surfaced to the consumer. Caps the otherwise-unbounded
|
|
79641
|
+
* retry loop that can wedge the single-worker draft queue when an upload fails
|
|
79642
|
+
* deterministically on every dispatch. Only enforced when the
|
|
79643
|
+
* `lmr.draft-queue-max-retry-attempts` gate is open.
|
|
79644
|
+
*/
|
|
79645
|
+
const MAX_RETRY_ATTEMPTS = 5;
|
|
79646
|
+
const MAX_RETRY_ERROR_CODE = 'MAX_RETRY_ATTEMPTS_EXCEEDED';
|
|
79647
|
+
function isFetchResponse(failure) {
|
|
79648
|
+
// The union is exactly FetchResponse | Error, so "not an Error" is the FetchResponse.
|
|
79649
|
+
// This is safer than duck-typing on status/ok: a custom Error subclass that happens to
|
|
79650
|
+
// carry those properties would be misclassified by a structural check.
|
|
79651
|
+
return !(failure instanceof Error);
|
|
79652
|
+
}
|
|
79653
|
+
/**
|
|
79654
|
+
* Builds the FetchResponse-shaped error attached to an action that has exhausted its
|
|
79655
|
+
* upload retries. Shaped like a real network error response (status/statusText/ok/
|
|
79656
|
+
* headers/body) so downstream consumers (DraftManager, queue instrumentation) that
|
|
79657
|
+
* read `action.error.status`/`.body`/etc. behave consistently with a server error.
|
|
79658
|
+
*
|
|
79659
|
+
* The failure that caused the final attempt — a non-ok response (HTTP path) or a thrown
|
|
79660
|
+
* error (catch path) — is folded into the body so the surfaced error says WHAT failed,
|
|
79661
|
+
* not merely that the attempt cap was reached.
|
|
79662
|
+
*/
|
|
79663
|
+
function buildMaxRetryError(lastFailure) {
|
|
79664
|
+
const capMessage = `Draft action exceeded ${MAX_RETRY_ATTEMPTS} upload retry attempts`;
|
|
79665
|
+
if (isFetchResponse(lastFailure)) {
|
|
79666
|
+
// Preserve the server's own error detail (status + body) so the surfaced error
|
|
79667
|
+
// carries the last response that caused us to give up retrying.
|
|
79668
|
+
return {
|
|
79669
|
+
status: HttpStatusCode$2.ServerError,
|
|
79670
|
+
statusText: capMessage,
|
|
79671
|
+
ok: false,
|
|
79672
|
+
headers: {},
|
|
79673
|
+
body: {
|
|
79674
|
+
errorCode: MAX_RETRY_ERROR_CODE,
|
|
79675
|
+
message: `${capMessage}. Last response: status=${lastFailure.status} ${lastFailure.statusText}`,
|
|
79676
|
+
lastResponseStatus: lastFailure.status,
|
|
79677
|
+
lastResponseBody: lastFailure.body,
|
|
79678
|
+
},
|
|
79679
|
+
};
|
|
79680
|
+
}
|
|
79681
|
+
return {
|
|
79682
|
+
status: HttpStatusCode$2.ServerError,
|
|
79683
|
+
statusText: capMessage,
|
|
79684
|
+
ok: false,
|
|
79685
|
+
headers: {},
|
|
79686
|
+
body: {
|
|
79687
|
+
errorCode: MAX_RETRY_ERROR_CODE,
|
|
79688
|
+
message: `${capMessage}. Last error: ${lastFailure.name}: ${lastFailure.message}`,
|
|
79689
|
+
lastErrorName: lastFailure.name,
|
|
79690
|
+
lastErrorMessage: lastFailure.message,
|
|
79691
|
+
},
|
|
79692
|
+
};
|
|
79693
|
+
}
|
|
79694
|
+
|
|
79695
|
+
function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
|
|
79696
|
+
if (adapterRequestContext === undefined) {
|
|
79697
|
+
return { eventObservers: observers };
|
|
79698
|
+
}
|
|
79699
|
+
if (adapterRequestContext.eventObservers === undefined) {
|
|
79700
|
+
return { ...adapterRequestContext, eventObservers: observers };
|
|
79701
|
+
}
|
|
79702
|
+
return {
|
|
79703
|
+
...adapterRequestContext,
|
|
79704
|
+
eventObservers: adapterRequestContext.eventObservers.concat(observers),
|
|
79705
|
+
};
|
|
79706
|
+
}
|
|
79707
|
+
/**
|
|
79708
|
+
* Use this method to sanitize the unknown error object when
|
|
79709
|
+
* we are unsure of the type of the error thrown
|
|
79710
|
+
*
|
|
79711
|
+
* @param err Unknown object to sanitize
|
|
79712
|
+
* @returns an instance of error
|
|
79713
|
+
*/
|
|
79714
|
+
function normalizeError$2(err) {
|
|
79715
|
+
if (err instanceof Error) {
|
|
79716
|
+
return err;
|
|
79717
|
+
}
|
|
79718
|
+
else if (typeof err === 'string') {
|
|
79719
|
+
return new Error(err);
|
|
79720
|
+
}
|
|
79721
|
+
return new Error(stringify$5(err));
|
|
79722
|
+
}
|
|
79723
|
+
// metrics
|
|
79724
|
+
/** GraphQL */
|
|
79725
|
+
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
79726
|
+
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
79727
|
+
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
79728
|
+
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
79729
|
+
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
79730
|
+
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
79731
|
+
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
79732
|
+
/** Draft Queue */
|
|
79733
|
+
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
79734
|
+
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
79735
|
+
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
79736
|
+
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
79737
|
+
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
79738
|
+
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
79739
|
+
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
79740
|
+
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
79741
|
+
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
79742
|
+
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
79743
|
+
const DRAFT_QUEUE_ACTION_UPLOAD_ERROR = 'draft-queue-action-upload-error';
|
|
79744
|
+
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
79745
|
+
/** Content Document */
|
|
79746
|
+
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
79747
|
+
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
79748
|
+
/** Priming */
|
|
79749
|
+
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
79750
|
+
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
79751
|
+
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
79752
|
+
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
79753
|
+
// logs
|
|
79754
|
+
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
79755
|
+
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
79756
|
+
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
79757
|
+
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
79758
|
+
/** Garbage Collection */
|
|
79759
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT = 'garbage-collection-aggressive-trim-count';
|
|
79760
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED = 'garbage-collection-aggressive-trim-records-trimmed';
|
|
79761
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM = 'garbage-collection-aggressive-trim-total-records-before-trim';
|
|
79762
|
+
const ldsMobileInstrumentation$2 = getInstrumentation();
|
|
79763
|
+
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
79764
|
+
__nimbus.plugins !== undefined &&
|
|
79765
|
+
__nimbus.plugins.JSLoggerPlugin !== undefined
|
|
79766
|
+
? __nimbus.plugins.JSLoggerPlugin
|
|
79767
|
+
: undefined;
|
|
79768
|
+
function reportGraphqlQueryParseError(err) {
|
|
79769
|
+
const error = normalizeError$2(err);
|
|
79770
|
+
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
79771
|
+
// Metric
|
|
79772
|
+
reportGraphqlAdapterError(errorCode);
|
|
79773
|
+
// Log
|
|
79774
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79775
|
+
}
|
|
79776
|
+
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
79777
|
+
const error = normalizeError$2(err);
|
|
79778
|
+
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
79779
|
+
// Metric
|
|
79780
|
+
reportGraphqlAdapterError(errorCode);
|
|
79781
|
+
// Log
|
|
79782
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79783
|
+
}
|
|
79784
|
+
function reportGraphqlCreateSnapshotError(err) {
|
|
79785
|
+
const error = normalizeError$2(err);
|
|
79786
|
+
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
79787
|
+
// Metric
|
|
79788
|
+
reportGraphqlAdapterError(errorCode);
|
|
79789
|
+
// Log
|
|
79790
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79791
|
+
}
|
|
79792
|
+
function reportGraphQlEvalDbReadDuration(duration) {
|
|
79793
|
+
ldsMobileInstrumentation$2.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
79794
|
+
}
|
|
79795
|
+
function reportGraphqlAdapterError(errorCode) {
|
|
79796
|
+
// Increment overall count with errorCode as tag
|
|
79797
|
+
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
79798
|
+
}
|
|
79799
|
+
function reportGraphqlQueryInstrumentation(data) {
|
|
79800
|
+
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
79801
|
+
const recordBuckets = [
|
|
79802
|
+
1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
|
|
79803
|
+
];
|
|
79804
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
|
|
79805
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
|
|
79806
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
79807
|
+
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
79808
|
+
}
|
|
79809
|
+
function incrementGraphQLRefreshUndfined() {
|
|
79810
|
+
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
79811
|
+
}
|
|
79812
|
+
function reportDraftActionEvent(state, draftCount, message) {
|
|
79813
|
+
if (nimbusLogger) {
|
|
79814
|
+
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
79815
|
+
}
|
|
79816
|
+
switch (state) {
|
|
79817
|
+
case 'added':
|
|
79818
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
79819
|
+
break;
|
|
79820
|
+
case 'uploading':
|
|
79821
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
79822
|
+
break;
|
|
79823
|
+
case 'completed':
|
|
79824
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
79825
|
+
break;
|
|
79826
|
+
case 'deleted':
|
|
79827
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
79828
|
+
break;
|
|
79829
|
+
case 'failed':
|
|
79830
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
79831
|
+
break;
|
|
79832
|
+
case 'updated':
|
|
79833
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
79834
|
+
break;
|
|
79835
|
+
}
|
|
79836
|
+
}
|
|
79837
|
+
/**
|
|
79838
|
+
* Reports an exception thrown while uploading a draft action. The thrown error is
|
|
79839
|
+
* otherwise swallowed by the upload handler's retry path, leaving the failure
|
|
79840
|
+
* invisible in telemetry; this surfaces it to o11y (log + counter) so a deterministic
|
|
79841
|
+
* upload failure can be diagnosed instead of silently retried forever.
|
|
79842
|
+
*
|
|
79843
|
+
* PII: the device log line carries only the handler id, retry attempt, and the error
|
|
79844
|
+
* NAME (e.g. "TypeError") — never the free-text error message, which can embed record
|
|
79845
|
+
* ids (URL path segments) or server field-validation strings. The full normalized error
|
|
79846
|
+
* (message + stack) is handed only to `ldsMobileInstrumentation.error`, the structured
|
|
79847
|
+
* o11y error pipeline responsible for scrubbing/handling that detail. Also does NOT log
|
|
79848
|
+
* the action's targetId/tag or any request body/field values.
|
|
79849
|
+
*/
|
|
79850
|
+
function reportDraftActionUploadError(error, handlerId, attempt) {
|
|
79851
|
+
const normalized = normalizeError$2(error);
|
|
79852
|
+
if (nimbusLogger) {
|
|
79853
|
+
nimbusLogger.logError(`Draft action upload error: handler=${handlerId}, attempt=${attempt}, name=${normalized.name}`);
|
|
79854
|
+
}
|
|
79855
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOAD_ERROR, 1, true, {
|
|
79856
|
+
handlerId,
|
|
79857
|
+
});
|
|
79858
|
+
ldsMobileInstrumentation$2.error(normalized, DRAFT_QUEUE_ACTION_UPLOAD_ERROR);
|
|
79859
|
+
}
|
|
79860
|
+
function reportDraftQueueState(state, draftCount) {
|
|
79861
|
+
if (nimbusLogger) {
|
|
79862
|
+
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
79863
|
+
}
|
|
79864
|
+
switch (state) {
|
|
79865
|
+
case 'started':
|
|
79866
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
79867
|
+
break;
|
|
79868
|
+
case 'error':
|
|
79869
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
79870
|
+
break;
|
|
79871
|
+
case 'waiting':
|
|
79872
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
79873
|
+
break;
|
|
79874
|
+
case 'stopped':
|
|
79875
|
+
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
79876
|
+
break;
|
|
79877
|
+
}
|
|
79878
|
+
}
|
|
79879
|
+
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
79880
|
+
let error;
|
|
79881
|
+
if (err.body !== undefined) {
|
|
79882
|
+
error = err.body;
|
|
79883
|
+
}
|
|
79884
|
+
else {
|
|
79885
|
+
error = normalizeError$2(err);
|
|
79886
|
+
}
|
|
79887
|
+
const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
|
|
79888
|
+
const errorType = error.errorType;
|
|
79889
|
+
const tags = {
|
|
79890
|
+
errorCode,
|
|
79891
|
+
};
|
|
79892
|
+
if (errorType !== undefined) {
|
|
79893
|
+
tags.errorType = errorType;
|
|
79894
|
+
}
|
|
79895
|
+
// Metric
|
|
79896
|
+
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
79897
|
+
// Log
|
|
79898
|
+
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
79899
|
+
}
|
|
79900
|
+
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
79901
|
+
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
79902
|
+
}
|
|
79903
|
+
/** Priming */
|
|
79904
|
+
function reportPrimingSessionCreated() {
|
|
79905
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
79906
|
+
}
|
|
79907
|
+
function reportPrimingError(errorType, recordCount) {
|
|
79908
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
79909
|
+
errorType,
|
|
79910
|
+
});
|
|
79911
|
+
}
|
|
79912
|
+
function reportPrimingSuccess(recordCount) {
|
|
79913
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
79914
|
+
}
|
|
79915
|
+
function reportPrimingConflict(resolutionType, recordCount) {
|
|
79916
|
+
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
79917
|
+
resolutionType,
|
|
79918
|
+
});
|
|
79919
|
+
}
|
|
79920
|
+
/** Network */
|
|
79921
|
+
function reportChunkCandidateUrlLength(urlLength) {
|
|
79922
|
+
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
79923
|
+
ldsMobileInstrumentation$2.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
79924
|
+
}
|
|
79925
|
+
/** Garbage Collection */
|
|
79926
|
+
function reportAggressiveTrimTriggered(trimCount, beforeTrimRecordCount, totalRecordsTrimmed) {
|
|
79927
|
+
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT, trimCount);
|
|
79928
|
+
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM, beforeTrimRecordCount);
|
|
79929
|
+
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED, totalRecordsTrimmed);
|
|
79930
|
+
}
|
|
79931
|
+
/** One Store Cache Purge */
|
|
79932
|
+
const ONESTORE_CACHE_PURGING_RECORDS_PURGED = 'onestore-cache-purging-records-purged';
|
|
79933
|
+
const ONESTORE_CACHE_PURGING_RECORDS_ERROR = 'onestore-cache-purging-records-error';
|
|
79934
|
+
function reportOneStoreRecordsPurgedFromCache(recordsPurged) {
|
|
79935
|
+
ldsMobileInstrumentation$2.trackValue(ONESTORE_CACHE_PURGING_RECORDS_PURGED, recordsPurged);
|
|
79936
|
+
}
|
|
79937
|
+
function reportOneStoreCachePurgingError(error) {
|
|
79938
|
+
const errorMessage = normalizeError$2(error);
|
|
79939
|
+
ldsMobileInstrumentation$2.error(errorMessage, ONESTORE_CACHE_PURGING_RECORDS_ERROR);
|
|
79940
|
+
}
|
|
79941
|
+
|
|
79606
79942
|
const HTTP_HEADER_RETRY_AFTER = 'Retry-After';
|
|
79607
79943
|
const HTTP_HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
|
79608
79944
|
const ERROR_CODE_IDEMPOTENCY_FEATURE_NOT_ENABLED = 'IDEMPOTENCY_FEATURE_NOT_ENABLED';
|
|
@@ -79753,20 +80089,89 @@ class AbstractResourceRequestActionHandler {
|
|
|
79753
80089
|
shouldRetry = true;
|
|
79754
80090
|
actionDataChanged = true;
|
|
79755
80091
|
}
|
|
79756
|
-
|
|
79757
|
-
|
|
79758
|
-
|
|
80092
|
+
if (shouldRetry) {
|
|
80093
|
+
// Funnel the retry through the cap: when the gate is open this persists
|
|
80094
|
+
// the attempt count and errors out once the cap is hit; when the gate is
|
|
80095
|
+
// closed it behaves exactly as before. The non-ok response is the failure
|
|
80096
|
+
// that would otherwise be retried.
|
|
80097
|
+
await this.retryOrCap(updatedAction, response, actionErrored, retryDelayInMs, actionDataChanged);
|
|
80098
|
+
}
|
|
80099
|
+
else {
|
|
80100
|
+
await actionErrored({
|
|
79759
80101
|
...updatedAction,
|
|
79760
80102
|
error: response,
|
|
79761
80103
|
status: DraftActionStatus.Error,
|
|
79762
|
-
},
|
|
80104
|
+
}, false, retryDelayInMs, actionDataChanged);
|
|
80105
|
+
}
|
|
79763
80106
|
return ProcessActionResult.ACTION_ERRORED;
|
|
79764
80107
|
}
|
|
79765
80108
|
catch (e) {
|
|
79766
|
-
|
|
80109
|
+
// #3 (ungated): the thrown exception is otherwise swallowed here, leaving a
|
|
80110
|
+
// deterministic upload failure invisible in telemetry. Surface it to o11y
|
|
80111
|
+
// before deciding whether to retry.
|
|
80112
|
+
const error = normalizeError$1(e);
|
|
80113
|
+
const attempt = this.getUploadRetryCount(action) + 1;
|
|
80114
|
+
reportDraftActionUploadError(error, this.handlerId, attempt);
|
|
80115
|
+
await this.retryOrCap(action, error, actionErrored);
|
|
79767
80116
|
return ProcessActionResult.NETWORK_ERROR;
|
|
79768
80117
|
}
|
|
79769
80118
|
}
|
|
80119
|
+
/**
|
|
80120
|
+
* Reads the persisted upload retry-attempt count from the action's durable metadata
|
|
80121
|
+
* bag. The count lives in metadata (rather than in-memory) so it survives app
|
|
80122
|
+
* restarts and queue re-creation — the failure modes that let the unbounded retry
|
|
80123
|
+
* loop run for days.
|
|
80124
|
+
*/
|
|
80125
|
+
getUploadRetryCount(action) {
|
|
80126
|
+
const parsed = Number(action.metadata?.[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]);
|
|
80127
|
+
// Guard against a missing/corrupt persisted value: a NaN, fractional, or negative
|
|
80128
|
+
// count must never weaken the cap. Floor to a non-negative integer, defaulting to 0.
|
|
80129
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
80130
|
+
return 0;
|
|
80131
|
+
}
|
|
80132
|
+
return Math.floor(parsed);
|
|
80133
|
+
}
|
|
80134
|
+
/**
|
|
80135
|
+
* Enforces the upload retry-attempt cap around the queue's `actionErrored` callback.
|
|
80136
|
+
* Both retry paths — a retryable HTTP error and a thrown exception — funnel through
|
|
80137
|
+
* here.
|
|
80138
|
+
*
|
|
80139
|
+
* The entire cap behavior is gated behind `lmr.draft-queue-max-retry-attempts`. When
|
|
80140
|
+
* the gate is CLOSED this is a transparent passthrough: it issues the same
|
|
80141
|
+
* `actionErrored(action, true, ...)` retry the queue made before this change, and
|
|
80142
|
+
* writes no extra metadata. When the gate is OPEN it persists an incremented attempt
|
|
80143
|
+
* count to the action's durable metadata and, once the action has failed
|
|
80144
|
+
* {@link MAX_RETRY_ATTEMPTS} times, transitions it to Error (carrying a
|
|
80145
|
+
* FetchResponse-shaped error that names the failure that exhausted the retries)
|
|
80146
|
+
* instead of scheduling yet another retry.
|
|
80147
|
+
*/
|
|
80148
|
+
async retryOrCap(action, lastFailure, actionErrored, retryDelayInMs, actionDataChanged) {
|
|
80149
|
+
if (!draftQueueMaxRetryAttemptsGate.isOpen({ fallback: false })) {
|
|
80150
|
+
// Gate closed: preserve the pre-existing unbounded-retry behavior exactly.
|
|
80151
|
+
await actionErrored(action, true, retryDelayInMs, actionDataChanged);
|
|
80152
|
+
return;
|
|
80153
|
+
}
|
|
80154
|
+
const attempt = this.getUploadRetryCount(action) + 1;
|
|
80155
|
+
if (attempt >= MAX_RETRY_ATTEMPTS) {
|
|
80156
|
+
await actionErrored({
|
|
80157
|
+
...action,
|
|
80158
|
+
error: buildMaxRetryError(lastFailure),
|
|
80159
|
+
status: DraftActionStatus.Error,
|
|
80160
|
+
}, false);
|
|
80161
|
+
return;
|
|
80162
|
+
}
|
|
80163
|
+
// Persist the incremented attempt count so it survives restarts. Forcing
|
|
80164
|
+
// actionDataChanged ensures the queue writes the updated metadata before the
|
|
80165
|
+
// action is rescheduled for retry.
|
|
80166
|
+
const retryingAction = {
|
|
80167
|
+
...action,
|
|
80168
|
+
metadata: {
|
|
80169
|
+
...action.metadata,
|
|
80170
|
+
[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: String(attempt),
|
|
80171
|
+
},
|
|
80172
|
+
};
|
|
80173
|
+
await actionErrored(retryingAction, true, retryDelayInMs, true);
|
|
80174
|
+
}
|
|
79770
80175
|
async handleActionEnqueued(action) {
|
|
79771
80176
|
const impactedKeys = await this.recordService.setSideEffectsForActions([action]);
|
|
79772
80177
|
await this.recordService.reapplyRecordSideEffects(impactedKeys);
|
|
@@ -79930,6 +80335,13 @@ class AbstractResourceRequestActionHandler {
|
|
|
79930
80335
|
this.isActionOfType(sourceAction)) {
|
|
79931
80336
|
targetAction.status = DraftActionStatus.Pending;
|
|
79932
80337
|
targetAction.data = sourceAction.data;
|
|
80338
|
+
// Replacing an action's data re-queues it as a fresh upload, so the persisted
|
|
80339
|
+
// upload retry-attempt count must not carry over — otherwise a previously-
|
|
80340
|
+
// throttled action could immediately re-hit the cap on its first new attempt.
|
|
80341
|
+
// (Mirrors the same clear in mergeActions.)
|
|
80342
|
+
if (targetAction.metadata !== undefined) {
|
|
80343
|
+
delete targetAction.metadata[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY];
|
|
80344
|
+
}
|
|
79933
80345
|
return targetAction;
|
|
79934
80346
|
}
|
|
79935
80347
|
else {
|
|
@@ -79969,6 +80381,11 @@ class AbstractResourceRequestActionHandler {
|
|
|
79969
80381
|
}
|
|
79970
80382
|
// overlay metadata
|
|
79971
80383
|
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
80384
|
+
// A merge folds new user data into the action and re-queues it as a fresh upload,
|
|
80385
|
+
// so the persisted upload retry-attempt count must not carry over — otherwise a
|
|
80386
|
+
// previously-throttled action could immediately re-hit the cap on its first new
|
|
80387
|
+
// attempt.
|
|
80388
|
+
delete merged.metadata[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY];
|
|
79972
80389
|
// put status back to pending to auto upload if queue is active and targed is at the head.
|
|
79973
80390
|
merged.status = DraftActionStatus.Pending;
|
|
79974
80391
|
return merged;
|
|
@@ -80579,229 +80996,6 @@ class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
80579
80996
|
}
|
|
80580
80997
|
}
|
|
80581
80998
|
|
|
80582
|
-
function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
|
|
80583
|
-
if (adapterRequestContext === undefined) {
|
|
80584
|
-
return { eventObservers: observers };
|
|
80585
|
-
}
|
|
80586
|
-
if (adapterRequestContext.eventObservers === undefined) {
|
|
80587
|
-
return { ...adapterRequestContext, eventObservers: observers };
|
|
80588
|
-
}
|
|
80589
|
-
return {
|
|
80590
|
-
...adapterRequestContext,
|
|
80591
|
-
eventObservers: adapterRequestContext.eventObservers.concat(observers),
|
|
80592
|
-
};
|
|
80593
|
-
}
|
|
80594
|
-
/**
|
|
80595
|
-
* Use this method to sanitize the unknown error object when
|
|
80596
|
-
* we are unsure of the type of the error thrown
|
|
80597
|
-
*
|
|
80598
|
-
* @param err Unknown object to sanitize
|
|
80599
|
-
* @returns an instance of error
|
|
80600
|
-
*/
|
|
80601
|
-
function normalizeError$1(err) {
|
|
80602
|
-
if (err instanceof Error) {
|
|
80603
|
-
return err;
|
|
80604
|
-
}
|
|
80605
|
-
else if (typeof err === 'string') {
|
|
80606
|
-
return new Error(err);
|
|
80607
|
-
}
|
|
80608
|
-
return new Error(stringify$5(err));
|
|
80609
|
-
}
|
|
80610
|
-
// metrics
|
|
80611
|
-
/** GraphQL */
|
|
80612
|
-
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
80613
|
-
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
80614
|
-
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
80615
|
-
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
80616
|
-
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
80617
|
-
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
80618
|
-
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
80619
|
-
/** Draft Queue */
|
|
80620
|
-
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
80621
|
-
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
80622
|
-
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
80623
|
-
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
80624
|
-
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
80625
|
-
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
80626
|
-
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
80627
|
-
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
80628
|
-
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
80629
|
-
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
80630
|
-
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
80631
|
-
/** Content Document */
|
|
80632
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
80633
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
80634
|
-
/** Priming */
|
|
80635
|
-
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
80636
|
-
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
80637
|
-
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
80638
|
-
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
80639
|
-
// logs
|
|
80640
|
-
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
80641
|
-
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
80642
|
-
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
80643
|
-
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
80644
|
-
/** Garbage Collection */
|
|
80645
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT = 'garbage-collection-aggressive-trim-count';
|
|
80646
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED = 'garbage-collection-aggressive-trim-records-trimmed';
|
|
80647
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM = 'garbage-collection-aggressive-trim-total-records-before-trim';
|
|
80648
|
-
const ldsMobileInstrumentation$2 = getInstrumentation();
|
|
80649
|
-
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
80650
|
-
__nimbus.plugins !== undefined &&
|
|
80651
|
-
__nimbus.plugins.JSLoggerPlugin !== undefined
|
|
80652
|
-
? __nimbus.plugins.JSLoggerPlugin
|
|
80653
|
-
: undefined;
|
|
80654
|
-
function reportGraphqlQueryParseError(err) {
|
|
80655
|
-
const error = normalizeError$1(err);
|
|
80656
|
-
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
80657
|
-
// Metric
|
|
80658
|
-
reportGraphqlAdapterError(errorCode);
|
|
80659
|
-
// Log
|
|
80660
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80661
|
-
}
|
|
80662
|
-
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
80663
|
-
const error = normalizeError$1(err);
|
|
80664
|
-
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
80665
|
-
// Metric
|
|
80666
|
-
reportGraphqlAdapterError(errorCode);
|
|
80667
|
-
// Log
|
|
80668
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80669
|
-
}
|
|
80670
|
-
function reportGraphqlCreateSnapshotError(err) {
|
|
80671
|
-
const error = normalizeError$1(err);
|
|
80672
|
-
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
80673
|
-
// Metric
|
|
80674
|
-
reportGraphqlAdapterError(errorCode);
|
|
80675
|
-
// Log
|
|
80676
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80677
|
-
}
|
|
80678
|
-
function reportGraphQlEvalDbReadDuration(duration) {
|
|
80679
|
-
ldsMobileInstrumentation$2.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
80680
|
-
}
|
|
80681
|
-
function reportGraphqlAdapterError(errorCode) {
|
|
80682
|
-
// Increment overall count with errorCode as tag
|
|
80683
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
80684
|
-
}
|
|
80685
|
-
function reportGraphqlQueryInstrumentation(data) {
|
|
80686
|
-
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
80687
|
-
const recordBuckets = [
|
|
80688
|
-
1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
|
|
80689
|
-
];
|
|
80690
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
|
|
80691
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
|
|
80692
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
80693
|
-
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
80694
|
-
}
|
|
80695
|
-
function incrementGraphQLRefreshUndfined() {
|
|
80696
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
80697
|
-
}
|
|
80698
|
-
function reportDraftActionEvent(state, draftCount, message) {
|
|
80699
|
-
if (nimbusLogger) {
|
|
80700
|
-
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
80701
|
-
}
|
|
80702
|
-
switch (state) {
|
|
80703
|
-
case 'added':
|
|
80704
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
80705
|
-
break;
|
|
80706
|
-
case 'uploading':
|
|
80707
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
80708
|
-
break;
|
|
80709
|
-
case 'completed':
|
|
80710
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
80711
|
-
break;
|
|
80712
|
-
case 'deleted':
|
|
80713
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
80714
|
-
break;
|
|
80715
|
-
case 'failed':
|
|
80716
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
80717
|
-
break;
|
|
80718
|
-
case 'updated':
|
|
80719
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
80720
|
-
break;
|
|
80721
|
-
}
|
|
80722
|
-
}
|
|
80723
|
-
function reportDraftQueueState(state, draftCount) {
|
|
80724
|
-
if (nimbusLogger) {
|
|
80725
|
-
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
80726
|
-
}
|
|
80727
|
-
switch (state) {
|
|
80728
|
-
case 'started':
|
|
80729
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
80730
|
-
break;
|
|
80731
|
-
case 'error':
|
|
80732
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
80733
|
-
break;
|
|
80734
|
-
case 'waiting':
|
|
80735
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
80736
|
-
break;
|
|
80737
|
-
case 'stopped':
|
|
80738
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
80739
|
-
break;
|
|
80740
|
-
}
|
|
80741
|
-
}
|
|
80742
|
-
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
80743
|
-
let error;
|
|
80744
|
-
if (err.body !== undefined) {
|
|
80745
|
-
error = err.body;
|
|
80746
|
-
}
|
|
80747
|
-
else {
|
|
80748
|
-
error = normalizeError$1(err);
|
|
80749
|
-
}
|
|
80750
|
-
const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
|
|
80751
|
-
const errorType = error.errorType;
|
|
80752
|
-
const tags = {
|
|
80753
|
-
errorCode,
|
|
80754
|
-
};
|
|
80755
|
-
if (errorType !== undefined) {
|
|
80756
|
-
tags.errorType = errorType;
|
|
80757
|
-
}
|
|
80758
|
-
// Metric
|
|
80759
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
80760
|
-
// Log
|
|
80761
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
80762
|
-
}
|
|
80763
|
-
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
80764
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
80765
|
-
}
|
|
80766
|
-
/** Priming */
|
|
80767
|
-
function reportPrimingSessionCreated() {
|
|
80768
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
80769
|
-
}
|
|
80770
|
-
function reportPrimingError(errorType, recordCount) {
|
|
80771
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
80772
|
-
errorType,
|
|
80773
|
-
});
|
|
80774
|
-
}
|
|
80775
|
-
function reportPrimingSuccess(recordCount) {
|
|
80776
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
80777
|
-
}
|
|
80778
|
-
function reportPrimingConflict(resolutionType, recordCount) {
|
|
80779
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
80780
|
-
resolutionType,
|
|
80781
|
-
});
|
|
80782
|
-
}
|
|
80783
|
-
/** Network */
|
|
80784
|
-
function reportChunkCandidateUrlLength(urlLength) {
|
|
80785
|
-
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
80786
|
-
ldsMobileInstrumentation$2.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
80787
|
-
}
|
|
80788
|
-
/** Garbage Collection */
|
|
80789
|
-
function reportAggressiveTrimTriggered(trimCount, beforeTrimRecordCount, totalRecordsTrimmed) {
|
|
80790
|
-
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT, trimCount);
|
|
80791
|
-
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM, beforeTrimRecordCount);
|
|
80792
|
-
ldsMobileInstrumentation$2.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED, totalRecordsTrimmed);
|
|
80793
|
-
}
|
|
80794
|
-
/** One Store Cache Purge */
|
|
80795
|
-
const ONESTORE_CACHE_PURGING_RECORDS_PURGED = 'onestore-cache-purging-records-purged';
|
|
80796
|
-
const ONESTORE_CACHE_PURGING_RECORDS_ERROR = 'onestore-cache-purging-records-error';
|
|
80797
|
-
function reportOneStoreRecordsPurgedFromCache(recordsPurged) {
|
|
80798
|
-
ldsMobileInstrumentation$2.trackValue(ONESTORE_CACHE_PURGING_RECORDS_PURGED, recordsPurged);
|
|
80799
|
-
}
|
|
80800
|
-
function reportOneStoreCachePurgingError(error) {
|
|
80801
|
-
const errorMessage = normalizeError$1(error);
|
|
80802
|
-
ldsMobileInstrumentation$2.error(errorMessage, ONESTORE_CACHE_PURGING_RECORDS_ERROR);
|
|
80803
|
-
}
|
|
80804
|
-
|
|
80805
80999
|
const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
|
|
80806
81000
|
class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
|
|
80807
81001
|
constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService, objectInfoService, getRecord) {
|
|
@@ -89423,7 +89617,7 @@ const withInstrumentation = (operation, config) => {
|
|
|
89423
89617
|
return operation()
|
|
89424
89618
|
.catch((err) => {
|
|
89425
89619
|
hasError = true;
|
|
89426
|
-
const error = normalizeError$
|
|
89620
|
+
const error = normalizeError$2(err);
|
|
89427
89621
|
tags['errorMessage'] = error.message;
|
|
89428
89622
|
if (logError) {
|
|
89429
89623
|
ldsMobileInstrumentation$2.error(error);
|
|
@@ -96242,7 +96436,7 @@ function buildServiceDescriptor$b(luvio) {
|
|
|
96242
96436
|
},
|
|
96243
96437
|
};
|
|
96244
96438
|
}
|
|
96245
|
-
// version: 1.428.0-
|
|
96439
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
96246
96440
|
|
|
96247
96441
|
/**
|
|
96248
96442
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96268,7 +96462,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
96268
96462
|
},
|
|
96269
96463
|
};
|
|
96270
96464
|
}
|
|
96271
|
-
// version: 1.428.0-
|
|
96465
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
96272
96466
|
|
|
96273
96467
|
/*!
|
|
96274
96468
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -99002,7 +99196,7 @@ register$1({
|
|
|
99002
99196
|
id: '@salesforce/lds-network-adapter',
|
|
99003
99197
|
instrument: instrument$2,
|
|
99004
99198
|
});
|
|
99005
|
-
// version: 1.428.0-
|
|
99199
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
99006
99200
|
|
|
99007
99201
|
const { create: create$2, keys: keys$2 } = Object;
|
|
99008
99202
|
const { stringify, parse } = JSON;
|
|
@@ -106560,6 +106754,11 @@ function buildCommandClass(baseClass) {
|
|
|
106560
106754
|
Object.entries(this.latestUsedRecordIdToWeakEtagMap).forEach(([recordId, oneStoreRecordWeakEtag]) => {
|
|
106561
106755
|
const normalizedLuvioRecord = this.services.luvioUiapiRecords.getNormalizedLuvioRecord(recordId, reader);
|
|
106562
106756
|
if (!normalizedLuvioRecord) {
|
|
106757
|
+
// A record that was present when this snapshot was read
|
|
106758
|
+
// is now absent from the Luvio store (e.g. evicted by a
|
|
106759
|
+
// uiRecordApi deleteRecord). Its disappearance changes the
|
|
106760
|
+
// result set, so treat it as a change and re-emit.
|
|
106761
|
+
dataChanged = true;
|
|
106563
106762
|
return;
|
|
106564
106763
|
}
|
|
106565
106764
|
const luvioRecordWeakEtag = normalizedLuvioRecord.weakEtag;
|
|
@@ -107061,7 +107260,7 @@ function registerCallback(cb) {
|
|
|
107061
107260
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
107062
107261
|
}
|
|
107063
107262
|
}
|
|
107064
|
-
// version: 1.428.0-
|
|
107263
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
107065
107264
|
|
|
107066
107265
|
function createFragmentMap(documentNode) {
|
|
107067
107266
|
const fragments = {};
|
|
@@ -136298,7 +136497,7 @@ register$1({
|
|
|
136298
136497
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
136299
136498
|
instrument: instrument$1,
|
|
136300
136499
|
});
|
|
136301
|
-
// version: 1.428.0-
|
|
136500
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
136302
136501
|
|
|
136303
136502
|
// On core the unstable adapters are re-exported with different names,
|
|
136304
136503
|
// we want to match them here.
|
|
@@ -136450,7 +136649,7 @@ withDefaultLuvio((luvio) => {
|
|
|
136450
136649
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
136451
136650
|
graphQLImperative = ldsAdapter;
|
|
136452
136651
|
});
|
|
136453
|
-
// version: 1.428.0-
|
|
136652
|
+
// version: 1.428.0-dev15-28143ecbad
|
|
136454
136653
|
|
|
136455
136654
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
136456
136655
|
__proto__: null,
|
|
@@ -137249,7 +137448,7 @@ const callbacks$1 = [];
|
|
|
137249
137448
|
function register(r) {
|
|
137250
137449
|
callbacks$1.forEach((callback) => callback(r));
|
|
137251
137450
|
}
|
|
137252
|
-
// version: 1.428.0-
|
|
137451
|
+
// version: 1.428.0-dev15-45ce8e1de5
|
|
137253
137452
|
|
|
137254
137453
|
/**
|
|
137255
137454
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -138565,4 +138764,4 @@ const { luvio } = getRuntime();
|
|
|
138565
138764
|
setDefaultLuvio({ luvio });
|
|
138566
138765
|
|
|
138567
138766
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
138568
|
-
// version: 1.428.0-
|
|
138767
|
+
// version: 1.428.0-dev15-45ce8e1de5
|