@salesforce/lds-runtime-mobile 1.444.0 → 1.446.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +503 -464
- package/dist/types/drafts/AbstractResourceRequestActionHandler.d.ts +22 -0
- package/dist/types/drafts/utils/error.d.ts +29 -0
- package/dist/types/instrumentation/metrics.d.ts +14 -0
- package/dist/types/utils/observabilityContext.d.ts +10 -0
- package/package.json +35 -36
- package/sfdc/main.js +503 -464
- package/sfdc/types/drafts/AbstractResourceRequestActionHandler.d.ts +22 -0
- package/sfdc/types/drafts/utils/error.d.ts +29 -0
- package/sfdc/types/instrumentation/metrics.d.ts +14 -0
- package/sfdc/types/utils/observabilityContext.d.ts +10 -0
package/dist/main.js
CHANGED
|
@@ -19,8 +19,9 @@ import { withRegistration, register } from '@salesforce/lds-default-luvio';
|
|
|
19
19
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from '@salesforce/lds-instrumentation';
|
|
20
20
|
import { HttpStatusCode as HttpStatusCode$1, setBypassDeepFreeze, StoreKeySet, StringKeyInMemoryStore, Reader, serializeStructuredKey, deepFreeze as deepFreeze$1, emitAdapterEvent, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$h, createResourceParams as createResourceParams$h, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$f, resolveLink, createCustomAdapterEventEmitter, isFileReference, Environment, Luvio, InMemoryStore } from '@luvio/engine';
|
|
21
21
|
import { isSupportedEntity, configuration, getObjectInfoAdapterFactory, RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, extractRecordIdFromStoreKey, buildRecordRepKeyFromId, keyBuilderRecord, RecordRepresentationTTL, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, getRecordId18 as getRecordId18$1, getRecordsAdapterFactory as getRecordsAdapterFactory$1, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationVersion } from '@salesforce/lds-adapters-uiapi';
|
|
22
|
-
import
|
|
22
|
+
import draftQueueMaxRetryAttemptsGate from '@salesforce/gate/lmr.draft-queue-max-retry-attempts';
|
|
23
23
|
import { getInstrumentation, idleDetector } from 'o11y/client';
|
|
24
|
+
import allowUpdatesForNonCachedRecords from '@salesforce/gate/lmr.allowUpdatesForNonCachedRecords';
|
|
24
25
|
import caseSensitiveUserId from '@salesforce/user/Id';
|
|
25
26
|
import { Kind as Kind$1, visit as visit$1, isObjectType, defaultFieldResolver, buildSchema, parse as parse$8, extendSchema, isScalarType, execute, print } from '@luvio/graphql-parser';
|
|
26
27
|
import graphqlRelationshipFieldsPerf from '@salesforce/gate/lds.graphqlRelationshipFieldsPerf';
|
|
@@ -2345,6 +2346,13 @@ function customActionHandler(executor, id, draftQueue) {
|
|
|
2345
2346
|
}
|
|
2346
2347
|
|
|
2347
2348
|
const DRAFT_SEGMENT = 'DRAFT';
|
|
2349
|
+
/**
|
|
2350
|
+
* Metadata key under which an action's upload retry-attempt count is persisted.
|
|
2351
|
+
* Lives in the action's durable `metadata` bag so the count survives app restarts
|
|
2352
|
+
* (the in-memory backoff interval resets on every startQueue()). Written by the
|
|
2353
|
+
* action handler on each retry and cleared when an action is manually retried.
|
|
2354
|
+
*/
|
|
2355
|
+
const DRAFT_ACTION_RETRY_COUNT_METADATA_KEY = 'retryCount';
|
|
2348
2356
|
class DurableDraftQueue {
|
|
2349
2357
|
getHandler(id) {
|
|
2350
2358
|
const handler = this.handlers[id];
|
|
@@ -2713,10 +2721,14 @@ class DurableDraftQueue {
|
|
|
2713
2721
|
if (!isDraftError(target)) {
|
|
2714
2722
|
throw Error(`Action ${actionId} is not in Error state`);
|
|
2715
2723
|
}
|
|
2724
|
+
// A manual retry is a fresh start: clear the persisted upload retry-attempt
|
|
2725
|
+
// count so the action doesn't immediately re-cap after a single failure.
|
|
2726
|
+
const { [DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: _retryCount, ...metadataWithoutRetryCount } = target.metadata || {};
|
|
2716
2727
|
let pendingAction = {
|
|
2717
2728
|
...target,
|
|
2718
2729
|
status: DraftActionStatus.Pending,
|
|
2719
2730
|
error: undefined,
|
|
2731
|
+
metadata: metadataWithoutRetryCount,
|
|
2720
2732
|
};
|
|
2721
2733
|
await this.draftStore.writeAction(pendingAction);
|
|
2722
2734
|
await this.notifyChangedListeners({
|
|
@@ -3475,7 +3487,7 @@ const snapshotRefreshOptions = {
|
|
|
3475
3487
|
* @param data Data to be JSON-stringified.
|
|
3476
3488
|
* @returns JSON.stringified value with consistent ordering of keys.
|
|
3477
3489
|
*/
|
|
3478
|
-
function stableJSONStringify
|
|
3490
|
+
function stableJSONStringify(node) {
|
|
3479
3491
|
// This is for Date values.
|
|
3480
3492
|
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
3481
3493
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -3498,7 +3510,7 @@ function stableJSONStringify$1(node) {
|
|
|
3498
3510
|
if (i) {
|
|
3499
3511
|
out += ',';
|
|
3500
3512
|
}
|
|
3501
|
-
out += stableJSONStringify
|
|
3513
|
+
out += stableJSONStringify(node[i]) || 'null';
|
|
3502
3514
|
}
|
|
3503
3515
|
return out + ']';
|
|
3504
3516
|
}
|
|
@@ -3509,7 +3521,7 @@ function stableJSONStringify$1(node) {
|
|
|
3509
3521
|
out = '';
|
|
3510
3522
|
for (i = 0; i < keys.length; i++) {
|
|
3511
3523
|
const key = keys[i];
|
|
3512
|
-
const value = stableJSONStringify
|
|
3524
|
+
const value = stableJSONStringify(node[key]);
|
|
3513
3525
|
if (!value) {
|
|
3514
3526
|
continue;
|
|
3515
3527
|
}
|
|
@@ -40792,7 +40804,7 @@ function ingestTypeWithStrategy(astNode, state, isCursorConnectionType, { key, i
|
|
|
40792
40804
|
}
|
|
40793
40805
|
if (existingData !== undefined && existingData !== null && ObjectPrototypeHasOwnProperty$1.call(existingData, "__type") === false) {
|
|
40794
40806
|
const mergedData = mergeData(existingData, newData);
|
|
40795
|
-
if (!equalsObject(existingData, mergedData, (propA, propB) => stableJSONStringify
|
|
40807
|
+
if (!equalsObject(existingData, mergedData, (propA, propB) => stableJSONStringify(propA) === stableJSONStringify(propB))) { // naive impl
|
|
40796
40808
|
luvio.storePublish(key, mergedData);
|
|
40797
40809
|
}
|
|
40798
40810
|
}
|
|
@@ -42139,6 +42151,324 @@ function makeEnvironmentUiApiRecordDraftAware(luvio, options, env) {
|
|
|
42139
42151
|
return create$3(adapterSpecificEnvironments, {});
|
|
42140
42152
|
}
|
|
42141
42153
|
|
|
42154
|
+
/**
|
|
42155
|
+
* This function takes an unknown error and normalizes it to an Error object
|
|
42156
|
+
*/
|
|
42157
|
+
function normalizeError$1(error) {
|
|
42158
|
+
if (typeof error === 'object' && error instanceof Error) {
|
|
42159
|
+
return error;
|
|
42160
|
+
}
|
|
42161
|
+
else if (typeof error === 'string') {
|
|
42162
|
+
return new Error(error);
|
|
42163
|
+
}
|
|
42164
|
+
return new Error(stringify$5(error));
|
|
42165
|
+
}
|
|
42166
|
+
/**
|
|
42167
|
+
* Maximum number of times an action's upload will be retried before the action is
|
|
42168
|
+
* transitioned to Error and surfaced to the consumer. Caps the otherwise-unbounded
|
|
42169
|
+
* retry loop that can wedge the single-worker draft queue when an upload fails
|
|
42170
|
+
* deterministically on every dispatch. Only enforced when the
|
|
42171
|
+
* `lmr.draft-queue-max-retry-attempts` gate is open.
|
|
42172
|
+
*/
|
|
42173
|
+
const MAX_RETRY_ATTEMPTS = 5;
|
|
42174
|
+
const MAX_RETRY_ERROR_CODE = 'MAX_RETRY_ATTEMPTS_EXCEEDED';
|
|
42175
|
+
function isFetchResponse(failure) {
|
|
42176
|
+
// The union is exactly FetchResponse | Error, so "not an Error" is the FetchResponse.
|
|
42177
|
+
// This is safer than duck-typing on status/ok: a custom Error subclass that happens to
|
|
42178
|
+
// carry those properties would be misclassified by a structural check.
|
|
42179
|
+
return !(failure instanceof Error);
|
|
42180
|
+
}
|
|
42181
|
+
/**
|
|
42182
|
+
* Builds the FetchResponse-shaped error attached to an action that has exhausted its
|
|
42183
|
+
* upload retries. Shaped like a real network error response (status/statusText/ok/
|
|
42184
|
+
* headers/body) so downstream consumers (DraftManager, queue instrumentation) that
|
|
42185
|
+
* read `action.error.status`/`.body`/etc. behave consistently with a server error.
|
|
42186
|
+
*
|
|
42187
|
+
* The failure that caused the final attempt — a non-ok response (HTTP path) or a thrown
|
|
42188
|
+
* error (catch path) — is folded into the body so the surfaced error says WHAT failed,
|
|
42189
|
+
* not merely that the attempt cap was reached.
|
|
42190
|
+
*/
|
|
42191
|
+
function buildMaxRetryError(lastFailure) {
|
|
42192
|
+
const capMessage = `Draft action exceeded ${MAX_RETRY_ATTEMPTS} upload retry attempts`;
|
|
42193
|
+
if (isFetchResponse(lastFailure)) {
|
|
42194
|
+
// Preserve the server's own error detail (status + body) so the surfaced error
|
|
42195
|
+
// carries the last response that caused us to give up retrying.
|
|
42196
|
+
return {
|
|
42197
|
+
status: HttpStatusCode$1.ServerError,
|
|
42198
|
+
statusText: capMessage,
|
|
42199
|
+
ok: false,
|
|
42200
|
+
headers: {},
|
|
42201
|
+
body: {
|
|
42202
|
+
errorCode: MAX_RETRY_ERROR_CODE,
|
|
42203
|
+
message: `${capMessage}. Last response: status=${lastFailure.status} ${lastFailure.statusText}`,
|
|
42204
|
+
lastResponseStatus: lastFailure.status,
|
|
42205
|
+
lastResponseBody: lastFailure.body,
|
|
42206
|
+
},
|
|
42207
|
+
};
|
|
42208
|
+
}
|
|
42209
|
+
return {
|
|
42210
|
+
status: HttpStatusCode$1.ServerError,
|
|
42211
|
+
statusText: capMessage,
|
|
42212
|
+
ok: false,
|
|
42213
|
+
headers: {},
|
|
42214
|
+
body: {
|
|
42215
|
+
errorCode: MAX_RETRY_ERROR_CODE,
|
|
42216
|
+
message: `${capMessage}. Last error: ${lastFailure.name}: ${lastFailure.message}`,
|
|
42217
|
+
lastErrorName: lastFailure.name,
|
|
42218
|
+
lastErrorMessage: lastFailure.message,
|
|
42219
|
+
},
|
|
42220
|
+
};
|
|
42221
|
+
}
|
|
42222
|
+
|
|
42223
|
+
function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
|
|
42224
|
+
if (adapterRequestContext === undefined) {
|
|
42225
|
+
return { eventObservers: observers };
|
|
42226
|
+
}
|
|
42227
|
+
if (adapterRequestContext.eventObservers === undefined) {
|
|
42228
|
+
return { ...adapterRequestContext, eventObservers: observers };
|
|
42229
|
+
}
|
|
42230
|
+
return {
|
|
42231
|
+
...adapterRequestContext,
|
|
42232
|
+
eventObservers: adapterRequestContext.eventObservers.concat(observers),
|
|
42233
|
+
};
|
|
42234
|
+
}
|
|
42235
|
+
/**
|
|
42236
|
+
* Use this method to sanitize the unknown error object when
|
|
42237
|
+
* we are unsure of the type of the error thrown
|
|
42238
|
+
*
|
|
42239
|
+
* @param err Unknown object to sanitize
|
|
42240
|
+
* @returns an instance of error
|
|
42241
|
+
*/
|
|
42242
|
+
function normalizeError(err) {
|
|
42243
|
+
if (err instanceof Error) {
|
|
42244
|
+
return err;
|
|
42245
|
+
}
|
|
42246
|
+
else if (typeof err === 'string') {
|
|
42247
|
+
return new Error(err);
|
|
42248
|
+
}
|
|
42249
|
+
return new Error(stringify$5(err));
|
|
42250
|
+
}
|
|
42251
|
+
|
|
42252
|
+
const O11Y_NAMESPACE_LDS_MOBILE = 'lds-mobile';
|
|
42253
|
+
// metrics
|
|
42254
|
+
/** GraphQL */
|
|
42255
|
+
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
42256
|
+
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
42257
|
+
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
42258
|
+
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
42259
|
+
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
42260
|
+
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
42261
|
+
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
42262
|
+
/** Draft Queue */
|
|
42263
|
+
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
42264
|
+
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
42265
|
+
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
42266
|
+
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
42267
|
+
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
42268
|
+
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
42269
|
+
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
42270
|
+
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
42271
|
+
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
42272
|
+
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
42273
|
+
const DRAFT_QUEUE_ACTION_UPLOAD_ERROR = 'draft-queue-action-upload-error';
|
|
42274
|
+
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
42275
|
+
/** Content Document */
|
|
42276
|
+
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
42277
|
+
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
42278
|
+
/** Priming */
|
|
42279
|
+
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
42280
|
+
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
42281
|
+
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
42282
|
+
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
42283
|
+
// logs
|
|
42284
|
+
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
42285
|
+
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
42286
|
+
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
42287
|
+
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
42288
|
+
/** Garbage Collection */
|
|
42289
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT = 'garbage-collection-aggressive-trim-count';
|
|
42290
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED = 'garbage-collection-aggressive-trim-records-trimmed';
|
|
42291
|
+
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM = 'garbage-collection-aggressive-trim-total-records-before-trim';
|
|
42292
|
+
const ldsMobileInstrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
|
|
42293
|
+
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
42294
|
+
__nimbus.plugins !== undefined &&
|
|
42295
|
+
__nimbus.plugins.JSLoggerPlugin !== undefined
|
|
42296
|
+
? __nimbus.plugins.JSLoggerPlugin
|
|
42297
|
+
: undefined;
|
|
42298
|
+
function reportGraphqlQueryParseError(err) {
|
|
42299
|
+
const error = normalizeError(err);
|
|
42300
|
+
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
42301
|
+
// Metric
|
|
42302
|
+
reportGraphqlAdapterError(errorCode);
|
|
42303
|
+
// Log
|
|
42304
|
+
ldsMobileInstrumentation.error(error, errorCode);
|
|
42305
|
+
}
|
|
42306
|
+
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
42307
|
+
const error = normalizeError(err);
|
|
42308
|
+
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
42309
|
+
// Metric
|
|
42310
|
+
reportGraphqlAdapterError(errorCode);
|
|
42311
|
+
// Log
|
|
42312
|
+
ldsMobileInstrumentation.error(error, errorCode);
|
|
42313
|
+
}
|
|
42314
|
+
function reportGraphqlCreateSnapshotError(err) {
|
|
42315
|
+
const error = normalizeError(err);
|
|
42316
|
+
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
42317
|
+
// Metric
|
|
42318
|
+
reportGraphqlAdapterError(errorCode);
|
|
42319
|
+
// Log
|
|
42320
|
+
ldsMobileInstrumentation.error(error, errorCode);
|
|
42321
|
+
}
|
|
42322
|
+
function reportGraphQlEvalDbReadDuration(duration) {
|
|
42323
|
+
ldsMobileInstrumentation.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
42324
|
+
}
|
|
42325
|
+
function reportGraphqlAdapterError(errorCode) {
|
|
42326
|
+
// Increment overall count with errorCode as tag
|
|
42327
|
+
ldsMobileInstrumentation.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
42328
|
+
}
|
|
42329
|
+
function reportGraphqlQueryInstrumentation(data) {
|
|
42330
|
+
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
42331
|
+
const recordBuckets = [
|
|
42332
|
+
1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
|
|
42333
|
+
];
|
|
42334
|
+
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
|
|
42335
|
+
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
|
|
42336
|
+
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
42337
|
+
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
42338
|
+
}
|
|
42339
|
+
function incrementGraphQLRefreshUndfined() {
|
|
42340
|
+
ldsMobileInstrumentation.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
42341
|
+
}
|
|
42342
|
+
function reportDraftActionEvent(state, draftCount, message) {
|
|
42343
|
+
if (nimbusLogger) {
|
|
42344
|
+
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
42345
|
+
}
|
|
42346
|
+
switch (state) {
|
|
42347
|
+
case 'added':
|
|
42348
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
42349
|
+
break;
|
|
42350
|
+
case 'uploading':
|
|
42351
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
42352
|
+
break;
|
|
42353
|
+
case 'completed':
|
|
42354
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
42355
|
+
break;
|
|
42356
|
+
case 'deleted':
|
|
42357
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
42358
|
+
break;
|
|
42359
|
+
case 'failed':
|
|
42360
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
42361
|
+
break;
|
|
42362
|
+
case 'updated':
|
|
42363
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
42364
|
+
break;
|
|
42365
|
+
}
|
|
42366
|
+
}
|
|
42367
|
+
/**
|
|
42368
|
+
* Reports an exception thrown while uploading a draft action. The thrown error is
|
|
42369
|
+
* otherwise swallowed by the upload handler's retry path, leaving the failure
|
|
42370
|
+
* invisible in telemetry; this surfaces it to o11y (log + counter) so a deterministic
|
|
42371
|
+
* upload failure can be diagnosed instead of silently retried forever.
|
|
42372
|
+
*
|
|
42373
|
+
* PII: the device log line carries only the handler id, retry attempt, and the error
|
|
42374
|
+
* NAME (e.g. "TypeError") — never the free-text error message, which can embed record
|
|
42375
|
+
* ids (URL path segments) or server field-validation strings. The full normalized error
|
|
42376
|
+
* (message + stack) is handed only to `ldsMobileInstrumentation.error`, the structured
|
|
42377
|
+
* o11y error pipeline responsible for scrubbing/handling that detail. Also does NOT log
|
|
42378
|
+
* the action's targetId/tag or any request body/field values.
|
|
42379
|
+
*/
|
|
42380
|
+
function reportDraftActionUploadError(error, handlerId, attempt) {
|
|
42381
|
+
const normalized = normalizeError(error);
|
|
42382
|
+
if (nimbusLogger) {
|
|
42383
|
+
nimbusLogger.logError(`Draft action upload error: handler=${handlerId}, attempt=${attempt}, name=${normalized.name}`);
|
|
42384
|
+
}
|
|
42385
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOAD_ERROR, 1, true, {
|
|
42386
|
+
handlerId,
|
|
42387
|
+
});
|
|
42388
|
+
ldsMobileInstrumentation.error(normalized, DRAFT_QUEUE_ACTION_UPLOAD_ERROR);
|
|
42389
|
+
}
|
|
42390
|
+
function reportDraftQueueState(state, draftCount) {
|
|
42391
|
+
if (nimbusLogger) {
|
|
42392
|
+
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
42393
|
+
}
|
|
42394
|
+
switch (state) {
|
|
42395
|
+
case 'started':
|
|
42396
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
42397
|
+
break;
|
|
42398
|
+
case 'error':
|
|
42399
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
42400
|
+
break;
|
|
42401
|
+
case 'waiting':
|
|
42402
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
42403
|
+
break;
|
|
42404
|
+
case 'stopped':
|
|
42405
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
42406
|
+
break;
|
|
42407
|
+
}
|
|
42408
|
+
}
|
|
42409
|
+
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
42410
|
+
let error;
|
|
42411
|
+
if (err.body !== undefined) {
|
|
42412
|
+
error = err.body;
|
|
42413
|
+
}
|
|
42414
|
+
else {
|
|
42415
|
+
error = normalizeError(err);
|
|
42416
|
+
}
|
|
42417
|
+
const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
|
|
42418
|
+
const errorType = error.errorType;
|
|
42419
|
+
const tags = {
|
|
42420
|
+
errorCode,
|
|
42421
|
+
};
|
|
42422
|
+
if (errorType !== undefined) {
|
|
42423
|
+
tags.errorType = errorType;
|
|
42424
|
+
}
|
|
42425
|
+
// Metric
|
|
42426
|
+
ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
42427
|
+
// Log
|
|
42428
|
+
ldsMobileInstrumentation.error(error, errorCode);
|
|
42429
|
+
}
|
|
42430
|
+
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
42431
|
+
ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
42432
|
+
}
|
|
42433
|
+
/** Priming */
|
|
42434
|
+
function reportPrimingSessionCreated() {
|
|
42435
|
+
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
42436
|
+
}
|
|
42437
|
+
function reportPrimingError(errorType, recordCount) {
|
|
42438
|
+
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
42439
|
+
errorType,
|
|
42440
|
+
});
|
|
42441
|
+
}
|
|
42442
|
+
function reportPrimingSuccess(recordCount) {
|
|
42443
|
+
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
42444
|
+
}
|
|
42445
|
+
function reportPrimingConflict(resolutionType, recordCount) {
|
|
42446
|
+
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
42447
|
+
resolutionType,
|
|
42448
|
+
});
|
|
42449
|
+
}
|
|
42450
|
+
/** Network */
|
|
42451
|
+
function reportChunkCandidateUrlLength(urlLength) {
|
|
42452
|
+
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
42453
|
+
ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
42454
|
+
}
|
|
42455
|
+
/** Garbage Collection */
|
|
42456
|
+
function reportAggressiveTrimTriggered(trimCount, beforeTrimRecordCount, totalRecordsTrimmed) {
|
|
42457
|
+
ldsMobileInstrumentation.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT, trimCount);
|
|
42458
|
+
ldsMobileInstrumentation.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM, beforeTrimRecordCount);
|
|
42459
|
+
ldsMobileInstrumentation.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED, totalRecordsTrimmed);
|
|
42460
|
+
}
|
|
42461
|
+
/** One Store Cache Purge */
|
|
42462
|
+
const ONESTORE_CACHE_PURGING_RECORDS_PURGED = 'onestore-cache-purging-records-purged';
|
|
42463
|
+
const ONESTORE_CACHE_PURGING_RECORDS_ERROR = 'onestore-cache-purging-records-error';
|
|
42464
|
+
function reportOneStoreRecordsPurgedFromCache(recordsPurged) {
|
|
42465
|
+
ldsMobileInstrumentation.trackValue(ONESTORE_CACHE_PURGING_RECORDS_PURGED, recordsPurged);
|
|
42466
|
+
}
|
|
42467
|
+
function reportOneStoreCachePurgingError(error) {
|
|
42468
|
+
const errorMessage = normalizeError(error);
|
|
42469
|
+
ldsMobileInstrumentation.error(errorMessage, ONESTORE_CACHE_PURGING_RECORDS_ERROR);
|
|
42470
|
+
}
|
|
42471
|
+
|
|
42142
42472
|
const HTTP_HEADER_RETRY_AFTER = 'Retry-After';
|
|
42143
42473
|
const HTTP_HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
|
42144
42474
|
const ERROR_CODE_IDEMPOTENCY_FEATURE_NOT_ENABLED = 'IDEMPOTENCY_FEATURE_NOT_ENABLED';
|
|
@@ -42292,20 +42622,89 @@ class AbstractResourceRequestActionHandler {
|
|
|
42292
42622
|
shouldRetry = true;
|
|
42293
42623
|
actionDataChanged = true;
|
|
42294
42624
|
}
|
|
42295
|
-
|
|
42296
|
-
|
|
42297
|
-
|
|
42625
|
+
if (shouldRetry) {
|
|
42626
|
+
// Funnel the retry through the cap: when the gate is open this persists
|
|
42627
|
+
// the attempt count and errors out once the cap is hit; when the gate is
|
|
42628
|
+
// closed it behaves exactly as before. The non-ok response is the failure
|
|
42629
|
+
// that would otherwise be retried.
|
|
42630
|
+
await this.retryOrCap(updatedAction, response, actionErrored, retryDelayInMs, actionDataChanged);
|
|
42631
|
+
}
|
|
42632
|
+
else {
|
|
42633
|
+
await actionErrored({
|
|
42298
42634
|
...updatedAction,
|
|
42299
42635
|
error: response,
|
|
42300
42636
|
status: DraftActionStatus.Error,
|
|
42301
|
-
},
|
|
42637
|
+
}, false, retryDelayInMs, actionDataChanged);
|
|
42638
|
+
}
|
|
42302
42639
|
return ProcessActionResult.ACTION_ERRORED;
|
|
42303
42640
|
}
|
|
42304
42641
|
catch (e) {
|
|
42305
|
-
|
|
42642
|
+
// #3 (ungated): the thrown exception is otherwise swallowed here, leaving a
|
|
42643
|
+
// deterministic upload failure invisible in telemetry. Surface it to o11y
|
|
42644
|
+
// before deciding whether to retry.
|
|
42645
|
+
const error = normalizeError$1(e);
|
|
42646
|
+
const attempt = this.getUploadRetryCount(action) + 1;
|
|
42647
|
+
reportDraftActionUploadError(error, this.handlerId, attempt);
|
|
42648
|
+
await this.retryOrCap(action, error, actionErrored);
|
|
42306
42649
|
return ProcessActionResult.NETWORK_ERROR;
|
|
42307
42650
|
}
|
|
42308
42651
|
}
|
|
42652
|
+
/**
|
|
42653
|
+
* Reads the persisted upload retry-attempt count from the action's durable metadata
|
|
42654
|
+
* bag. The count lives in metadata (rather than in-memory) so it survives app
|
|
42655
|
+
* restarts and queue re-creation — the failure modes that let the unbounded retry
|
|
42656
|
+
* loop run for days.
|
|
42657
|
+
*/
|
|
42658
|
+
getUploadRetryCount(action) {
|
|
42659
|
+
const parsed = Number(action.metadata?.[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]);
|
|
42660
|
+
// Guard against a missing/corrupt persisted value: a NaN, fractional, or negative
|
|
42661
|
+
// count must never weaken the cap. Floor to a non-negative integer, defaulting to 0.
|
|
42662
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
42663
|
+
return 0;
|
|
42664
|
+
}
|
|
42665
|
+
return Math.floor(parsed);
|
|
42666
|
+
}
|
|
42667
|
+
/**
|
|
42668
|
+
* Enforces the upload retry-attempt cap around the queue's `actionErrored` callback.
|
|
42669
|
+
* Both retry paths — a retryable HTTP error and a thrown exception — funnel through
|
|
42670
|
+
* here.
|
|
42671
|
+
*
|
|
42672
|
+
* The entire cap behavior is gated behind `lmr.draft-queue-max-retry-attempts`. When
|
|
42673
|
+
* the gate is CLOSED this is a transparent passthrough: it issues the same
|
|
42674
|
+
* `actionErrored(action, true, ...)` retry the queue made before this change, and
|
|
42675
|
+
* writes no extra metadata. When the gate is OPEN it persists an incremented attempt
|
|
42676
|
+
* count to the action's durable metadata and, once the action has failed
|
|
42677
|
+
* {@link MAX_RETRY_ATTEMPTS} times, transitions it to Error (carrying a
|
|
42678
|
+
* FetchResponse-shaped error that names the failure that exhausted the retries)
|
|
42679
|
+
* instead of scheduling yet another retry.
|
|
42680
|
+
*/
|
|
42681
|
+
async retryOrCap(action, lastFailure, actionErrored, retryDelayInMs, actionDataChanged) {
|
|
42682
|
+
if (!draftQueueMaxRetryAttemptsGate.isOpen({ fallback: false })) {
|
|
42683
|
+
// Gate closed: preserve the pre-existing unbounded-retry behavior exactly.
|
|
42684
|
+
await actionErrored(action, true, retryDelayInMs, actionDataChanged);
|
|
42685
|
+
return;
|
|
42686
|
+
}
|
|
42687
|
+
const attempt = this.getUploadRetryCount(action) + 1;
|
|
42688
|
+
if (attempt >= MAX_RETRY_ATTEMPTS) {
|
|
42689
|
+
await actionErrored({
|
|
42690
|
+
...action,
|
|
42691
|
+
error: buildMaxRetryError(lastFailure),
|
|
42692
|
+
status: DraftActionStatus.Error,
|
|
42693
|
+
}, false);
|
|
42694
|
+
return;
|
|
42695
|
+
}
|
|
42696
|
+
// Persist the incremented attempt count so it survives restarts. Forcing
|
|
42697
|
+
// actionDataChanged ensures the queue writes the updated metadata before the
|
|
42698
|
+
// action is rescheduled for retry.
|
|
42699
|
+
const retryingAction = {
|
|
42700
|
+
...action,
|
|
42701
|
+
metadata: {
|
|
42702
|
+
...action.metadata,
|
|
42703
|
+
[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: String(attempt),
|
|
42704
|
+
},
|
|
42705
|
+
};
|
|
42706
|
+
await actionErrored(retryingAction, true, retryDelayInMs, true);
|
|
42707
|
+
}
|
|
42309
42708
|
async handleActionEnqueued(action) {
|
|
42310
42709
|
const impactedKeys = await this.recordService.setSideEffectsForActions([action]);
|
|
42311
42710
|
await this.recordService.reapplyRecordSideEffects(impactedKeys);
|
|
@@ -42469,6 +42868,13 @@ class AbstractResourceRequestActionHandler {
|
|
|
42469
42868
|
this.isActionOfType(sourceAction)) {
|
|
42470
42869
|
targetAction.status = DraftActionStatus.Pending;
|
|
42471
42870
|
targetAction.data = sourceAction.data;
|
|
42871
|
+
// Replacing an action's data re-queues it as a fresh upload, so the persisted
|
|
42872
|
+
// upload retry-attempt count must not carry over — otherwise a previously-
|
|
42873
|
+
// throttled action could immediately re-hit the cap on its first new attempt.
|
|
42874
|
+
// (Mirrors the same clear in mergeActions.)
|
|
42875
|
+
if (targetAction.metadata !== undefined) {
|
|
42876
|
+
delete targetAction.metadata[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY];
|
|
42877
|
+
}
|
|
42472
42878
|
return targetAction;
|
|
42473
42879
|
}
|
|
42474
42880
|
else {
|
|
@@ -42519,6 +42925,11 @@ class AbstractResourceRequestActionHandler {
|
|
|
42519
42925
|
}
|
|
42520
42926
|
// overlay metadata
|
|
42521
42927
|
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
42928
|
+
// A merge folds new user data into the action and re-queues it as a fresh upload,
|
|
42929
|
+
// so the persisted upload retry-attempt count must not carry over — otherwise a
|
|
42930
|
+
// previously-throttled action could immediately re-hit the cap on its first new
|
|
42931
|
+
// attempt.
|
|
42932
|
+
delete merged.metadata[DRAFT_ACTION_RETRY_COUNT_METADATA_KEY];
|
|
42522
42933
|
// put status back to pending to auto upload if queue is active and targed is at the head.
|
|
42523
42934
|
merged.status = DraftActionStatus.Pending;
|
|
42524
42935
|
return merged;
|
|
@@ -43130,231 +43541,6 @@ class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
43130
43541
|
}
|
|
43131
43542
|
}
|
|
43132
43543
|
|
|
43133
|
-
function attachObserversToAdapterRequestContext(observers, adapterRequestContext) {
|
|
43134
|
-
if (adapterRequestContext === undefined) {
|
|
43135
|
-
return { eventObservers: observers };
|
|
43136
|
-
}
|
|
43137
|
-
if (adapterRequestContext.eventObservers === undefined) {
|
|
43138
|
-
return { ...adapterRequestContext, eventObservers: observers };
|
|
43139
|
-
}
|
|
43140
|
-
return {
|
|
43141
|
-
...adapterRequestContext,
|
|
43142
|
-
eventObservers: adapterRequestContext.eventObservers.concat(observers),
|
|
43143
|
-
};
|
|
43144
|
-
}
|
|
43145
|
-
/**
|
|
43146
|
-
* Use this method to sanitize the unknown error object when
|
|
43147
|
-
* we are unsure of the type of the error thrown
|
|
43148
|
-
*
|
|
43149
|
-
* @param err Unknown object to sanitize
|
|
43150
|
-
* @returns an instance of error
|
|
43151
|
-
*/
|
|
43152
|
-
function normalizeError(err) {
|
|
43153
|
-
if (err instanceof Error) {
|
|
43154
|
-
return err;
|
|
43155
|
-
}
|
|
43156
|
-
else if (typeof err === 'string') {
|
|
43157
|
-
return new Error(err);
|
|
43158
|
-
}
|
|
43159
|
-
return new Error(stringify$5(err));
|
|
43160
|
-
}
|
|
43161
|
-
|
|
43162
|
-
const O11Y_NAMESPACE_LDS_MOBILE = 'lds-mobile';
|
|
43163
|
-
// metrics
|
|
43164
|
-
/** GraphQL */
|
|
43165
|
-
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
43166
|
-
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
43167
|
-
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
43168
|
-
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
43169
|
-
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
43170
|
-
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
43171
|
-
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
43172
|
-
/** Draft Queue */
|
|
43173
|
-
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
43174
|
-
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
43175
|
-
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
43176
|
-
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
43177
|
-
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
43178
|
-
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
43179
|
-
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
43180
|
-
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
43181
|
-
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
43182
|
-
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
43183
|
-
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
43184
|
-
/** Content Document */
|
|
43185
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
43186
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
43187
|
-
/** Priming */
|
|
43188
|
-
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
43189
|
-
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
43190
|
-
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
43191
|
-
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
43192
|
-
// logs
|
|
43193
|
-
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
43194
|
-
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
43195
|
-
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
43196
|
-
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
43197
|
-
/** Garbage Collection */
|
|
43198
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT = 'garbage-collection-aggressive-trim-count';
|
|
43199
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED = 'garbage-collection-aggressive-trim-records-trimmed';
|
|
43200
|
-
const GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM = 'garbage-collection-aggressive-trim-total-records-before-trim';
|
|
43201
|
-
const ldsMobileInstrumentation = getInstrumentation(O11Y_NAMESPACE_LDS_MOBILE);
|
|
43202
|
-
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
43203
|
-
__nimbus.plugins !== undefined &&
|
|
43204
|
-
__nimbus.plugins.JSLoggerPlugin !== undefined
|
|
43205
|
-
? __nimbus.plugins.JSLoggerPlugin
|
|
43206
|
-
: undefined;
|
|
43207
|
-
function reportGraphqlQueryParseError(err) {
|
|
43208
|
-
const error = normalizeError(err);
|
|
43209
|
-
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
43210
|
-
// Metric
|
|
43211
|
-
reportGraphqlAdapterError(errorCode);
|
|
43212
|
-
// Log
|
|
43213
|
-
ldsMobileInstrumentation.error(error, errorCode);
|
|
43214
|
-
}
|
|
43215
|
-
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
43216
|
-
const error = normalizeError(err);
|
|
43217
|
-
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
43218
|
-
// Metric
|
|
43219
|
-
reportGraphqlAdapterError(errorCode);
|
|
43220
|
-
// Log
|
|
43221
|
-
ldsMobileInstrumentation.error(error, errorCode);
|
|
43222
|
-
}
|
|
43223
|
-
function reportGraphqlCreateSnapshotError(err) {
|
|
43224
|
-
const error = normalizeError(err);
|
|
43225
|
-
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
43226
|
-
// Metric
|
|
43227
|
-
reportGraphqlAdapterError(errorCode);
|
|
43228
|
-
// Log
|
|
43229
|
-
ldsMobileInstrumentation.error(error, errorCode);
|
|
43230
|
-
}
|
|
43231
|
-
function reportGraphQlEvalDbReadDuration(duration) {
|
|
43232
|
-
ldsMobileInstrumentation.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
43233
|
-
}
|
|
43234
|
-
function reportGraphqlAdapterError(errorCode) {
|
|
43235
|
-
// Increment overall count with errorCode as tag
|
|
43236
|
-
ldsMobileInstrumentation.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
43237
|
-
}
|
|
43238
|
-
function reportGraphqlQueryInstrumentation(data) {
|
|
43239
|
-
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
43240
|
-
const recordBuckets = [
|
|
43241
|
-
1, 5, 10, 20, 50, 100, 1000, 2000, 5000, 10000, 50000, 100000, 1000000,
|
|
43242
|
-
];
|
|
43243
|
-
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_ROOT_QUERY_COUNT, data.rootQueryCount, queryBuckets);
|
|
43244
|
-
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_TOTAL_QUERY_COUNT, data.totalQueryCount, queryBuckets);
|
|
43245
|
-
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
43246
|
-
ldsMobileInstrumentation.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
43247
|
-
}
|
|
43248
|
-
function incrementGraphQLRefreshUndfined() {
|
|
43249
|
-
ldsMobileInstrumentation.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
43250
|
-
}
|
|
43251
|
-
function reportDraftActionEvent(state, draftCount, message) {
|
|
43252
|
-
if (nimbusLogger) {
|
|
43253
|
-
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
43254
|
-
}
|
|
43255
|
-
switch (state) {
|
|
43256
|
-
case 'added':
|
|
43257
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
43258
|
-
break;
|
|
43259
|
-
case 'uploading':
|
|
43260
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
43261
|
-
break;
|
|
43262
|
-
case 'completed':
|
|
43263
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
43264
|
-
break;
|
|
43265
|
-
case 'deleted':
|
|
43266
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
43267
|
-
break;
|
|
43268
|
-
case 'failed':
|
|
43269
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
43270
|
-
break;
|
|
43271
|
-
case 'updated':
|
|
43272
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
43273
|
-
break;
|
|
43274
|
-
}
|
|
43275
|
-
}
|
|
43276
|
-
function reportDraftQueueState(state, draftCount) {
|
|
43277
|
-
if (nimbusLogger) {
|
|
43278
|
-
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
43279
|
-
}
|
|
43280
|
-
switch (state) {
|
|
43281
|
-
case 'started':
|
|
43282
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
43283
|
-
break;
|
|
43284
|
-
case 'error':
|
|
43285
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
43286
|
-
break;
|
|
43287
|
-
case 'waiting':
|
|
43288
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
43289
|
-
break;
|
|
43290
|
-
case 'stopped':
|
|
43291
|
-
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
43292
|
-
break;
|
|
43293
|
-
}
|
|
43294
|
-
}
|
|
43295
|
-
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
43296
|
-
let error;
|
|
43297
|
-
if (err.body !== undefined) {
|
|
43298
|
-
error = err.body;
|
|
43299
|
-
}
|
|
43300
|
-
else {
|
|
43301
|
-
error = normalizeError(err);
|
|
43302
|
-
}
|
|
43303
|
-
const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
|
|
43304
|
-
const errorType = error.errorType;
|
|
43305
|
-
const tags = {
|
|
43306
|
-
errorCode,
|
|
43307
|
-
};
|
|
43308
|
-
if (errorType !== undefined) {
|
|
43309
|
-
tags.errorType = errorType;
|
|
43310
|
-
}
|
|
43311
|
-
// Metric
|
|
43312
|
-
ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
43313
|
-
// Log
|
|
43314
|
-
ldsMobileInstrumentation.error(error, errorCode);
|
|
43315
|
-
}
|
|
43316
|
-
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
43317
|
-
ldsMobileInstrumentation.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
43318
|
-
}
|
|
43319
|
-
/** Priming */
|
|
43320
|
-
function reportPrimingSessionCreated() {
|
|
43321
|
-
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
43322
|
-
}
|
|
43323
|
-
function reportPrimingError(errorType, recordCount) {
|
|
43324
|
-
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
43325
|
-
errorType,
|
|
43326
|
-
});
|
|
43327
|
-
}
|
|
43328
|
-
function reportPrimingSuccess(recordCount) {
|
|
43329
|
-
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
43330
|
-
}
|
|
43331
|
-
function reportPrimingConflict(resolutionType, recordCount) {
|
|
43332
|
-
ldsMobileInstrumentation.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
43333
|
-
resolutionType,
|
|
43334
|
-
});
|
|
43335
|
-
}
|
|
43336
|
-
/** Network */
|
|
43337
|
-
function reportChunkCandidateUrlLength(urlLength) {
|
|
43338
|
-
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
43339
|
-
ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
43340
|
-
}
|
|
43341
|
-
/** Garbage Collection */
|
|
43342
|
-
function reportAggressiveTrimTriggered(trimCount, beforeTrimRecordCount, totalRecordsTrimmed) {
|
|
43343
|
-
ldsMobileInstrumentation.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_COUNT, trimCount);
|
|
43344
|
-
ldsMobileInstrumentation.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_TOTAL_RECORDS_BEFORE_TRIM, beforeTrimRecordCount);
|
|
43345
|
-
ldsMobileInstrumentation.trackValue(GARBAGE_COLLECTION_AGGRESSIVE_TRIM_RECORDS_TRIMMED, totalRecordsTrimmed);
|
|
43346
|
-
}
|
|
43347
|
-
/** One Store Cache Purge */
|
|
43348
|
-
const ONESTORE_CACHE_PURGING_RECORDS_PURGED = 'onestore-cache-purging-records-purged';
|
|
43349
|
-
const ONESTORE_CACHE_PURGING_RECORDS_ERROR = 'onestore-cache-purging-records-error';
|
|
43350
|
-
function reportOneStoreRecordsPurgedFromCache(recordsPurged) {
|
|
43351
|
-
ldsMobileInstrumentation.trackValue(ONESTORE_CACHE_PURGING_RECORDS_PURGED, recordsPurged);
|
|
43352
|
-
}
|
|
43353
|
-
function reportOneStoreCachePurgingError(error) {
|
|
43354
|
-
const errorMessage = normalizeError(error);
|
|
43355
|
-
ldsMobileInstrumentation.error(errorMessage, ONESTORE_CACHE_PURGING_RECORDS_ERROR);
|
|
43356
|
-
}
|
|
43357
|
-
|
|
43358
43544
|
const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
|
|
43359
43545
|
class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
|
|
43360
43546
|
constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService, objectInfoService, getRecord) {
|
|
@@ -43534,6 +43720,18 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
|
|
|
43534
43720
|
return customEvent.namespace === CONTENT_DOCUMENT_AND_VERSION_NAMESPACE;
|
|
43535
43721
|
}
|
|
43536
43722
|
|
|
43723
|
+
/**
|
|
43724
|
+
* lds-worker-api packs the user action's ObservabilityContext into
|
|
43725
|
+
* `requestContext.requestCorrelator = { observabilityContext }`. This helper
|
|
43726
|
+
* unwraps it for draft-aware adapter wrappers, which forward the context to
|
|
43727
|
+
* the action handler so retry network spans can be parented to the
|
|
43728
|
+
* originating user action.
|
|
43729
|
+
*/
|
|
43730
|
+
function extractObservabilityContext(requestContext) {
|
|
43731
|
+
const correlator = requestContext?.requestCorrelator;
|
|
43732
|
+
return correlator?.observabilityContext;
|
|
43733
|
+
}
|
|
43734
|
+
|
|
43537
43735
|
function chunkToBase64(chunk) {
|
|
43538
43736
|
const bytes = new Uint8Array(chunk);
|
|
43539
43737
|
const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
|
|
@@ -43616,7 +43814,10 @@ function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore,
|
|
|
43616
43814
|
if (actionHandler.hasIdempotencySupport()) {
|
|
43617
43815
|
resourceRequest.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
43618
43816
|
}
|
|
43619
|
-
const
|
|
43817
|
+
const observabilityContext = extractObservabilityContext(requestContext);
|
|
43818
|
+
const action = await actionHandler
|
|
43819
|
+
.enqueue(resourceRequest, observabilityContext)
|
|
43820
|
+
.catch(async (error) => {
|
|
43620
43821
|
eventEmitter({
|
|
43621
43822
|
type: 'create-content-document-and-version-synthesized-response-error',
|
|
43622
43823
|
handle,
|
|
@@ -43982,21 +44183,23 @@ function getDescriptionFromResourceRequest(request) {
|
|
|
43982
44183
|
return undefined;
|
|
43983
44184
|
}
|
|
43984
44185
|
|
|
43985
|
-
/* istanbul ignore file - covered by integration tests */
|
|
43986
44186
|
/**
|
|
43987
44187
|
* @param luvio The runtime's luvio instance
|
|
43988
44188
|
* @param actionHandler The UIAPI Record action handler. NOTE: this adapter doesn't
|
|
43989
44189
|
* register it with the DraftQueue, runtime should set that up
|
|
43990
44190
|
*/
|
|
43991
44191
|
function createRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
|
|
43992
|
-
return async function createRecordDraftAdapter(config, createResourceRequest) {
|
|
44192
|
+
return async function createRecordDraftAdapter(config, createResourceRequest, requestContext) {
|
|
43993
44193
|
const request = createResourceRequest(config);
|
|
43994
44194
|
if (actionHandler.hasIdempotencySupport()) {
|
|
43995
44195
|
request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
43996
44196
|
}
|
|
43997
44197
|
request.queryParams = request.queryParams || {};
|
|
43998
44198
|
request.queryParams['includeFieldsInBody'] = true;
|
|
43999
|
-
const
|
|
44199
|
+
const observabilityContext = extractObservabilityContext(requestContext);
|
|
44200
|
+
const action = await actionHandler
|
|
44201
|
+
.enqueue(request, observabilityContext)
|
|
44202
|
+
.catch((err) => {
|
|
44000
44203
|
throw transformErrorToDraftSynthesisError(err);
|
|
44001
44204
|
});
|
|
44002
44205
|
let record = await durableRecordStore.getRecord(action.tag);
|
|
@@ -44076,34 +44279,34 @@ function updateRecordDraftAdapterFactory(actionHandler, durableRecordStore, obje
|
|
|
44076
44279
|
};
|
|
44077
44280
|
}
|
|
44078
44281
|
|
|
44079
|
-
/* istanbul ignore file - covered by integration tests */
|
|
44080
44282
|
/**
|
|
44081
44283
|
* @param luvio The runtime's luvio instance
|
|
44082
44284
|
* @param actionHandler The UIAPI Record action handler. NOTE: this adapter doesn't
|
|
44083
44285
|
* register it with the DraftQueue, runtime should set that up
|
|
44084
44286
|
*/
|
|
44085
44287
|
function deleteRecordDraftAdapterFactory(actionHandler) {
|
|
44086
|
-
return async function deleteRecordDraftAdapter(config, buildResourceRequest) {
|
|
44288
|
+
return async function deleteRecordDraftAdapter(config, buildResourceRequest, requestContext) {
|
|
44087
44289
|
const request = buildResourceRequest(config);
|
|
44088
44290
|
if (actionHandler.hasIdempotencySupport()) {
|
|
44089
44291
|
request.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
44090
44292
|
}
|
|
44091
|
-
|
|
44293
|
+
const observabilityContext = extractObservabilityContext(requestContext);
|
|
44294
|
+
await actionHandler.enqueue(request, observabilityContext).catch((err) => {
|
|
44092
44295
|
throw transformErrorToDraftSynthesisError(err);
|
|
44093
44296
|
});
|
|
44094
44297
|
};
|
|
44095
44298
|
}
|
|
44096
44299
|
|
|
44097
|
-
/* istanbul ignore file - covered by integration tests */
|
|
44098
44300
|
/**
|
|
44099
44301
|
* @param luvio The runtime's luvio instance
|
|
44100
44302
|
* @param actionHandler The UIAPI Record action handler. NOTE: this adapter doesn't
|
|
44101
44303
|
* register it with the DraftQueue, runtime should set that up
|
|
44102
44304
|
*/
|
|
44103
44305
|
function performQuickActionDraftAdapterFactory(actionHandler, userId) {
|
|
44104
|
-
return async function performQuickActionDraftAdapter(config, createResourceRequest) {
|
|
44306
|
+
return async function performQuickActionDraftAdapter(config, createResourceRequest, requestContext) {
|
|
44105
44307
|
const request = createResourceRequest(config);
|
|
44106
|
-
const
|
|
44308
|
+
const observabilityContext = extractObservabilityContext(requestContext);
|
|
44309
|
+
const action = await actionHandler.enqueue(request, observabilityContext).catch((err) => {
|
|
44107
44310
|
const error = transformErrorToDraftSynthesisError(err);
|
|
44108
44311
|
deepFreeze$1(error);
|
|
44109
44312
|
throw error;
|
|
@@ -44130,16 +44333,18 @@ function performQuickActionDraftAdapterFactory(actionHandler, userId) {
|
|
|
44130
44333
|
};
|
|
44131
44334
|
}
|
|
44132
44335
|
|
|
44133
|
-
/* istanbul ignore file - covered by integration tests */
|
|
44134
44336
|
/**
|
|
44135
44337
|
* @param luvio The runtime's luvio instance
|
|
44136
44338
|
* @param actionHandler The UIAPI Record action handler. NOTE: this adapter doesn't
|
|
44137
44339
|
* register it with the DraftQueue, runtime should set that up
|
|
44138
44340
|
*/
|
|
44139
44341
|
function performUpdateRecordQuickActionDraftAdapterFactory(actionHandler, userId) {
|
|
44140
|
-
return async function performUpdateRecordQuickActionDraftAdapter(config, createResourceRequest) {
|
|
44342
|
+
return async function performUpdateRecordQuickActionDraftAdapter(config, createResourceRequest, requestContext) {
|
|
44141
44343
|
const request = createResourceRequest(config);
|
|
44142
|
-
const
|
|
44344
|
+
const observabilityContext = extractObservabilityContext(requestContext);
|
|
44345
|
+
const action = await actionHandler
|
|
44346
|
+
.enqueue(request, observabilityContext)
|
|
44347
|
+
.catch((err) => {
|
|
44143
44348
|
const error = transformErrorToDraftSynthesisError(err);
|
|
44144
44349
|
deepFreeze$1(error);
|
|
44145
44350
|
throw error;
|
|
@@ -51327,6 +51532,7 @@ function buildNimbusNetworkPluginRequest(resourceRequest, resourceRequestContext
|
|
|
51327
51532
|
let observabilityContext = null;
|
|
51328
51533
|
if (resourceRequestContext !== undefined &&
|
|
51329
51534
|
resourceRequestContext.requestCorrelator !== undefined &&
|
|
51535
|
+
resourceRequestContext.requestCorrelator !== null &&
|
|
51330
51536
|
resourceRequestContext.requestCorrelator.observabilityContext !==
|
|
51331
51537
|
undefined) {
|
|
51332
51538
|
({ observabilityContext = null } =
|
|
@@ -56544,7 +56750,9 @@ function buildSubscribableResult$1(result, subscribe, refresh) {
|
|
|
56544
56750
|
}
|
|
56545
56751
|
function resolvedPromiseLike$2(result) {
|
|
56546
56752
|
if (isPromiseLike$2(result)) {
|
|
56547
|
-
return result.then(
|
|
56753
|
+
return result.then(
|
|
56754
|
+
(nextResult) => nextResult
|
|
56755
|
+
);
|
|
56548
56756
|
}
|
|
56549
56757
|
return {
|
|
56550
56758
|
then: (onFulfilled, _onRejected) => {
|
|
@@ -56561,7 +56769,9 @@ function resolvedPromiseLike$2(result) {
|
|
|
56561
56769
|
}
|
|
56562
56770
|
function rejectedPromiseLike$2(reason) {
|
|
56563
56771
|
if (isPromiseLike$2(reason)) {
|
|
56564
|
-
return reason.then(
|
|
56772
|
+
return reason.then(
|
|
56773
|
+
(nextResult) => nextResult
|
|
56774
|
+
);
|
|
56565
56775
|
}
|
|
56566
56776
|
return {
|
|
56567
56777
|
then: (_onFulfilled, onRejected) => {
|
|
@@ -56618,49 +56828,6 @@ function deepEquals$1(x, y) {
|
|
|
56618
56828
|
}
|
|
56619
56829
|
return x === y;
|
|
56620
56830
|
}
|
|
56621
|
-
function stableJSONStringify(node) {
|
|
56622
|
-
if (node && node.toJSON && typeof node.toJSON === "function") {
|
|
56623
|
-
node = node.toJSON();
|
|
56624
|
-
}
|
|
56625
|
-
if (node === void 0) {
|
|
56626
|
-
return;
|
|
56627
|
-
}
|
|
56628
|
-
if (typeof node === "number") {
|
|
56629
|
-
return isFinite(node) ? "" + node : "null";
|
|
56630
|
-
}
|
|
56631
|
-
if (typeof node !== "object") {
|
|
56632
|
-
return stringify$2(node);
|
|
56633
|
-
}
|
|
56634
|
-
let i;
|
|
56635
|
-
let out;
|
|
56636
|
-
if (isArray$1(node)) {
|
|
56637
|
-
out = "[";
|
|
56638
|
-
for (i = 0; i < node.length; i++) {
|
|
56639
|
-
if (i) {
|
|
56640
|
-
out += ",";
|
|
56641
|
-
}
|
|
56642
|
-
out += stableJSONStringify(node[i]) || "null";
|
|
56643
|
-
}
|
|
56644
|
-
return out + "]";
|
|
56645
|
-
}
|
|
56646
|
-
if (node === null) {
|
|
56647
|
-
return "null";
|
|
56648
|
-
}
|
|
56649
|
-
const objKeys = keys(node).sort();
|
|
56650
|
-
out = "";
|
|
56651
|
-
for (i = 0; i < objKeys.length; i++) {
|
|
56652
|
-
const key = objKeys[i];
|
|
56653
|
-
const value = stableJSONStringify(node[key]);
|
|
56654
|
-
if (!value) {
|
|
56655
|
-
continue;
|
|
56656
|
-
}
|
|
56657
|
-
if (out) {
|
|
56658
|
-
out += ",";
|
|
56659
|
-
}
|
|
56660
|
-
out += stringify$2(key) + ":" + value;
|
|
56661
|
-
}
|
|
56662
|
-
return "{" + out + "}";
|
|
56663
|
-
}
|
|
56664
56831
|
function toError(x) {
|
|
56665
56832
|
if (x instanceof Error) {
|
|
56666
56833
|
return x;
|
|
@@ -56681,16 +56848,16 @@ var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
|
56681
56848
|
return HttpStatusCode2;
|
|
56682
56849
|
})(HttpStatusCode || {});
|
|
56683
56850
|
function getFetchResponseFromAuraError(err2) {
|
|
56684
|
-
|
|
56685
|
-
|
|
56686
|
-
data =
|
|
56687
|
-
if (
|
|
56688
|
-
data.id =
|
|
56851
|
+
const auraError = err2;
|
|
56852
|
+
if (auraError.data !== void 0 && auraError.data.statusCode !== void 0) {
|
|
56853
|
+
const data = auraError.data;
|
|
56854
|
+
if (auraError.id !== void 0) {
|
|
56855
|
+
data.id = auraError.id;
|
|
56689
56856
|
}
|
|
56690
56857
|
return new FetchResponse(data.statusCode, data);
|
|
56691
56858
|
}
|
|
56692
56859
|
return new FetchResponse(500, {
|
|
56693
|
-
error: err2
|
|
56860
|
+
error: err2?.message
|
|
56694
56861
|
});
|
|
56695
56862
|
}
|
|
56696
56863
|
function getStatusText(status) {
|
|
@@ -56732,9 +56899,10 @@ function deepFreeze(value) {
|
|
|
56732
56899
|
deepFreeze(value[i]);
|
|
56733
56900
|
}
|
|
56734
56901
|
} else {
|
|
56735
|
-
const
|
|
56902
|
+
const record = value;
|
|
56903
|
+
const keys$1 = keys(record);
|
|
56736
56904
|
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
56737
|
-
deepFreeze(
|
|
56905
|
+
deepFreeze(record[keys$1[i]]);
|
|
56738
56906
|
}
|
|
56739
56907
|
}
|
|
56740
56908
|
freeze(value);
|
|
@@ -56808,7 +56976,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
56808
56976
|
async afterRequestHooks(_options) {
|
|
56809
56977
|
}
|
|
56810
56978
|
};
|
|
56811
|
-
function buildServiceDescriptor$
|
|
56979
|
+
function buildServiceDescriptor$m() {
|
|
56812
56980
|
return {
|
|
56813
56981
|
type: "networkCommandBaseClass",
|
|
56814
56982
|
version: "1.0",
|
|
@@ -56914,7 +57082,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
56914
57082
|
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
56915
57083
|
}
|
|
56916
57084
|
}
|
|
56917
|
-
function buildServiceDescriptor$
|
|
57085
|
+
function buildServiceDescriptor$l() {
|
|
56918
57086
|
return {
|
|
56919
57087
|
type: "auraNetworkCommandBaseClass",
|
|
56920
57088
|
version: "1.0",
|
|
@@ -56956,7 +57124,9 @@ function buildSubscribableResult(result, subscribe, refresh) {
|
|
|
56956
57124
|
}
|
|
56957
57125
|
function resolvedPromiseLike$1(result) {
|
|
56958
57126
|
if (isPromiseLike$1(result)) {
|
|
56959
|
-
return result.then(
|
|
57127
|
+
return result.then(
|
|
57128
|
+
(nextResult) => nextResult
|
|
57129
|
+
);
|
|
56960
57130
|
}
|
|
56961
57131
|
return {
|
|
56962
57132
|
then: (onFulfilled, _onRejected) => {
|
|
@@ -56973,7 +57143,9 @@ function resolvedPromiseLike$1(result) {
|
|
|
56973
57143
|
}
|
|
56974
57144
|
function rejectedPromiseLike$1(reason) {
|
|
56975
57145
|
if (isPromiseLike$1(reason)) {
|
|
56976
|
-
return reason.then(
|
|
57146
|
+
return reason.then(
|
|
57147
|
+
(nextResult) => nextResult
|
|
57148
|
+
);
|
|
56977
57149
|
}
|
|
56978
57150
|
return {
|
|
56979
57151
|
then: (_onFulfilled, onRejected) => {
|
|
@@ -57467,7 +57639,7 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
|
|
|
57467
57639
|
};
|
|
57468
57640
|
}
|
|
57469
57641
|
|
|
57470
|
-
|
|
57642
|
+
class AuraCacheControlCommand extends CacheControlCommand {
|
|
57471
57643
|
constructor(services) {
|
|
57472
57644
|
super(services);
|
|
57473
57645
|
this.services = services;
|
|
@@ -57569,8 +57741,8 @@ let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheContr
|
|
|
57569
57741
|
(reason) => err$1(toError(reason))
|
|
57570
57742
|
);
|
|
57571
57743
|
}
|
|
57572
|
-
}
|
|
57573
|
-
class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand
|
|
57744
|
+
}
|
|
57745
|
+
class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
57574
57746
|
constructor(services) {
|
|
57575
57747
|
super(services);
|
|
57576
57748
|
this.services = services;
|
|
@@ -57594,7 +57766,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand$1 {
|
|
|
57594
57766
|
return resolvedPromiseLike$2(void 0);
|
|
57595
57767
|
}
|
|
57596
57768
|
}
|
|
57597
|
-
function buildServiceDescriptor$
|
|
57769
|
+
function buildServiceDescriptor$k() {
|
|
57598
57770
|
return {
|
|
57599
57771
|
type: "auraNormalizedCacheControlCommand",
|
|
57600
57772
|
version: "1.0",
|
|
@@ -57602,144 +57774,6 @@ function buildServiceDescriptor$l() {
|
|
|
57602
57774
|
};
|
|
57603
57775
|
}
|
|
57604
57776
|
|
|
57605
|
-
class AuraCacheControlCommand extends CacheControlCommand {
|
|
57606
|
-
constructor(services) {
|
|
57607
|
-
super(services);
|
|
57608
|
-
this.services = services;
|
|
57609
|
-
this.actionConfig = {
|
|
57610
|
-
background: false,
|
|
57611
|
-
hotspot: true,
|
|
57612
|
-
longRunning: false,
|
|
57613
|
-
storable: false
|
|
57614
|
-
};
|
|
57615
|
-
this.networkPreference = "aura";
|
|
57616
|
-
}
|
|
57617
|
-
get fetchParams() {
|
|
57618
|
-
throw new Error(
|
|
57619
|
-
"Fetch parameters must be specified when using HTTP transport on an Aura adapter"
|
|
57620
|
-
);
|
|
57621
|
-
}
|
|
57622
|
-
shouldUseAuraNetwork() {
|
|
57623
|
-
return this.services.auraNetwork !== void 0 && (this.networkPreference === "aura" || !this.services.fetch);
|
|
57624
|
-
}
|
|
57625
|
-
shouldUseFetch() {
|
|
57626
|
-
return this.services.fetch !== void 0 && (this.networkPreference === "http" || !this.services.auraNetwork);
|
|
57627
|
-
}
|
|
57628
|
-
requestFromNetwork() {
|
|
57629
|
-
if (this.shouldUseAuraNetwork()) {
|
|
57630
|
-
return this.convertAuraResponseToData(
|
|
57631
|
-
this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig),
|
|
57632
|
-
(errs) => this.coerceAuraErrors(errs)
|
|
57633
|
-
);
|
|
57634
|
-
} else if (this.shouldUseFetch()) {
|
|
57635
|
-
const params = this.fetchParams;
|
|
57636
|
-
try {
|
|
57637
|
-
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
57638
|
-
} catch (reason) {
|
|
57639
|
-
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
57640
|
-
}
|
|
57641
|
-
}
|
|
57642
|
-
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
57643
|
-
}
|
|
57644
|
-
coerceAuraErrors(auraErrors) {
|
|
57645
|
-
return toError(auraErrors[0]);
|
|
57646
|
-
}
|
|
57647
|
-
async coerceError(errorResponse) {
|
|
57648
|
-
return toError(errorResponse.statusText);
|
|
57649
|
-
}
|
|
57650
|
-
processAuraReturnValue(auraReturnValue) {
|
|
57651
|
-
return ok$1(auraReturnValue);
|
|
57652
|
-
}
|
|
57653
|
-
processFetchReturnValue(json) {
|
|
57654
|
-
return ok$1(json);
|
|
57655
|
-
}
|
|
57656
|
-
convertAuraResponseToData(responsePromise, coerceError) {
|
|
57657
|
-
return responsePromise.then((response) => {
|
|
57658
|
-
return this.processAuraReturnValue(response.getReturnValue());
|
|
57659
|
-
}).finally(() => {
|
|
57660
|
-
try {
|
|
57661
|
-
this.afterRequestHooks({ statusCode: 200 });
|
|
57662
|
-
} catch {
|
|
57663
|
-
}
|
|
57664
|
-
}).catch((error) => {
|
|
57665
|
-
if (!error) {
|
|
57666
|
-
return err$1(toError("Failed to get error from response"));
|
|
57667
|
-
}
|
|
57668
|
-
if (!error.getError) {
|
|
57669
|
-
return err$1(toError(error));
|
|
57670
|
-
}
|
|
57671
|
-
const actionErrors = error.getError();
|
|
57672
|
-
if (actionErrors.length > 0) {
|
|
57673
|
-
return err$1(coerceError(actionErrors));
|
|
57674
|
-
}
|
|
57675
|
-
return err$1(toError("Error fetching component"));
|
|
57676
|
-
});
|
|
57677
|
-
}
|
|
57678
|
-
convertFetchResponseToData(response) {
|
|
57679
|
-
return response.then(
|
|
57680
|
-
(response2) => {
|
|
57681
|
-
if (response2.ok) {
|
|
57682
|
-
return response2.json().then(
|
|
57683
|
-
(json) => {
|
|
57684
|
-
return this.processFetchReturnValue(json);
|
|
57685
|
-
},
|
|
57686
|
-
(reason) => err$1(toError(reason))
|
|
57687
|
-
).finally(() => {
|
|
57688
|
-
try {
|
|
57689
|
-
this.afterRequestHooks({ statusCode: response2.status });
|
|
57690
|
-
} catch {
|
|
57691
|
-
}
|
|
57692
|
-
});
|
|
57693
|
-
} else {
|
|
57694
|
-
return this.coerceError(response2).then((coercedError) => {
|
|
57695
|
-
return err$1(coercedError);
|
|
57696
|
-
}).finally(() => {
|
|
57697
|
-
try {
|
|
57698
|
-
this.afterRequestHooks({ statusCode: response2.status });
|
|
57699
|
-
} catch {
|
|
57700
|
-
}
|
|
57701
|
-
});
|
|
57702
|
-
}
|
|
57703
|
-
},
|
|
57704
|
-
(reason) => err$1(toError(reason))
|
|
57705
|
-
);
|
|
57706
|
-
}
|
|
57707
|
-
}
|
|
57708
|
-
class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
|
|
57709
|
-
constructor(services) {
|
|
57710
|
-
super(services);
|
|
57711
|
-
this.services = services;
|
|
57712
|
-
}
|
|
57713
|
-
readFromCache(cache) {
|
|
57714
|
-
const data = cache.get(this.buildKey())?.value;
|
|
57715
|
-
if (data === void 0) {
|
|
57716
|
-
return resolvedPromiseLike$2(err$1(new Error("Failed to find data in cache")));
|
|
57717
|
-
}
|
|
57718
|
-
return resolvedPromiseLike$2(ok$1(data));
|
|
57719
|
-
}
|
|
57720
|
-
writeToCache(cache, networkResult) {
|
|
57721
|
-
if (networkResult.isOk()) {
|
|
57722
|
-
cache.set(this.buildKey(), {
|
|
57723
|
-
value: networkResult.value,
|
|
57724
|
-
metadata: {
|
|
57725
|
-
cacheControl: this.buildCacheControlMetadata(networkResult.value)
|
|
57726
|
-
}
|
|
57727
|
-
});
|
|
57728
|
-
}
|
|
57729
|
-
return resolvedPromiseLike$2(void 0);
|
|
57730
|
-
}
|
|
57731
|
-
buildKey() {
|
|
57732
|
-
return `{"endpoint":${this.endpoint},"params":${stableJSONStringify(this.auraParams)}}`;
|
|
57733
|
-
}
|
|
57734
|
-
}
|
|
57735
|
-
function buildServiceDescriptor$k() {
|
|
57736
|
-
return {
|
|
57737
|
-
type: "auraResourceCacheControlCommand",
|
|
57738
|
-
version: "1.0",
|
|
57739
|
-
service: AuraResourceCacheControlCommand
|
|
57740
|
-
};
|
|
57741
|
-
}
|
|
57742
|
-
|
|
57743
57777
|
class NetworkCommand extends BaseCommand {
|
|
57744
57778
|
constructor(services) {
|
|
57745
57779
|
super();
|
|
@@ -57783,16 +57817,16 @@ class NetworkCommand extends BaseCommand {
|
|
|
57783
57817
|
}
|
|
57784
57818
|
}
|
|
57785
57819
|
function isAbortableCommand(command) {
|
|
57786
|
-
return "isAbortableCommand" in command && command.isAbortableCommand === true;
|
|
57820
|
+
return !!command && typeof command === "object" && "isAbortableCommand" in command && command.isAbortableCommand === true;
|
|
57787
57821
|
}
|
|
57788
57822
|
function hasFetchParams(command) {
|
|
57789
|
-
return command && typeof command === "object" && "fetchParams" in command;
|
|
57823
|
+
return !!command && typeof command === "object" && "fetchParams" in command;
|
|
57790
57824
|
}
|
|
57791
57825
|
function createAbortableDecorator(command, options) {
|
|
57792
|
-
|
|
57826
|
+
const signal = options?.signal;
|
|
57827
|
+
if (!signal || !(signal instanceof AbortSignal)) {
|
|
57793
57828
|
return command;
|
|
57794
57829
|
}
|
|
57795
|
-
const { signal } = options;
|
|
57796
57830
|
if (isAbortableCommand(command)) {
|
|
57797
57831
|
if (process.env.NODE_ENV !== "production") {
|
|
57798
57832
|
console.warn(
|
|
@@ -57803,14 +57837,15 @@ function createAbortableDecorator(command, options) {
|
|
|
57803
57837
|
}
|
|
57804
57838
|
if (!hasFetchParams(command)) {
|
|
57805
57839
|
if (process.env.NODE_ENV !== "production") {
|
|
57840
|
+
const commandName = typeof command === "object" && command !== null ? command.constructor.name : typeof command;
|
|
57806
57841
|
console.warn(
|
|
57807
|
-
`Command ${
|
|
57842
|
+
`Command ${commandName} does not support fetch operations. AbortSignal will be ignored.`
|
|
57808
57843
|
);
|
|
57809
57844
|
}
|
|
57810
57845
|
return command;
|
|
57811
57846
|
}
|
|
57812
57847
|
try {
|
|
57813
|
-
|
|
57848
|
+
const handler = {
|
|
57814
57849
|
get(target, prop, receiver) {
|
|
57815
57850
|
if (prop === "isAbortableCommand") {
|
|
57816
57851
|
return true;
|
|
@@ -57819,8 +57854,8 @@ function createAbortableDecorator(command, options) {
|
|
|
57819
57854
|
return signal;
|
|
57820
57855
|
}
|
|
57821
57856
|
if (prop === "fetchParams") {
|
|
57822
|
-
const originalFetchParams = target
|
|
57823
|
-
const isInternal = target
|
|
57857
|
+
const originalFetchParams = Reflect.get(target, prop, receiver);
|
|
57858
|
+
const isInternal = Reflect.get(target, "isInternalExecution", receiver) === true;
|
|
57824
57859
|
if (typeof originalFetchParams === "function") {
|
|
57825
57860
|
return function(...args) {
|
|
57826
57861
|
const originalReturnValue = originalFetchParams.apply(this, args);
|
|
@@ -57846,7 +57881,8 @@ function createAbortableDecorator(command, options) {
|
|
|
57846
57881
|
}
|
|
57847
57882
|
return Reflect.has(target, prop);
|
|
57848
57883
|
}
|
|
57849
|
-
}
|
|
57884
|
+
};
|
|
57885
|
+
return new Proxy(command, handler);
|
|
57850
57886
|
} catch (error) {
|
|
57851
57887
|
if (process.env.NODE_ENV !== "production") {
|
|
57852
57888
|
console.error(
|
|
@@ -58941,7 +58977,7 @@ function buildServiceDescriptor$b(luvio) {
|
|
|
58941
58977
|
},
|
|
58942
58978
|
};
|
|
58943
58979
|
}
|
|
58944
|
-
// version: 1.
|
|
58980
|
+
// version: 1.446.0-f73bd65030
|
|
58945
58981
|
|
|
58946
58982
|
/**
|
|
58947
58983
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -58967,7 +59003,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
58967
59003
|
},
|
|
58968
59004
|
};
|
|
58969
59005
|
}
|
|
58970
|
-
// version: 1.
|
|
59006
|
+
// version: 1.446.0-f73bd65030
|
|
58971
59007
|
|
|
58972
59008
|
function findExecutableOperation(input) {
|
|
58973
59009
|
const operations = input.query.definitions.filter(
|
|
@@ -59767,7 +59803,7 @@ function findSchemaAtPath(document, ref) {
|
|
|
59767
59803
|
let path = "#";
|
|
59768
59804
|
for (const key of keys) {
|
|
59769
59805
|
path = `${path}/${key}`;
|
|
59770
|
-
if (current[key] === void 0) {
|
|
59806
|
+
if (typeof current !== "object" || current === null || current[key] === void 0) {
|
|
59771
59807
|
throw new InvalidRefError(
|
|
59772
59808
|
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
59773
59809
|
);
|
|
@@ -60830,7 +60866,9 @@ function addAllToSet(targetSet, sourceSet) {
|
|
|
60830
60866
|
}
|
|
60831
60867
|
function resolvedPromiseLike(result) {
|
|
60832
60868
|
if (isPromiseLike(result)) {
|
|
60833
|
-
return result.then(
|
|
60869
|
+
return result.then(
|
|
60870
|
+
(nextResult) => nextResult
|
|
60871
|
+
);
|
|
60834
60872
|
}
|
|
60835
60873
|
return {
|
|
60836
60874
|
then: (onFulfilled, _onRejected) => {
|
|
@@ -60847,7 +60885,9 @@ function resolvedPromiseLike(result) {
|
|
|
60847
60885
|
}
|
|
60848
60886
|
function rejectedPromiseLike(reason) {
|
|
60849
60887
|
if (isPromiseLike(reason)) {
|
|
60850
|
-
return reason.then(
|
|
60888
|
+
return reason.then(
|
|
60889
|
+
(nextResult) => nextResult
|
|
60890
|
+
);
|
|
60851
60891
|
}
|
|
60852
60892
|
return {
|
|
60853
60893
|
then: (_onFulfilled, onRejected) => {
|
|
@@ -61369,12 +61409,11 @@ function initializeOneStore(sqliteStore, luvio) {
|
|
|
61369
61409
|
buildNimbusFetchServiceDescriptor(),
|
|
61370
61410
|
buildServiceDescriptor$f(instrumentationServiceDescriptor.service),
|
|
61371
61411
|
// NOTE: These do not directly depend on Aura, and are necessary for HTTP fallback support.
|
|
61372
|
-
buildServiceDescriptor$m(),
|
|
61373
61412
|
buildServiceDescriptor$l(),
|
|
61374
61413
|
buildServiceDescriptor$k(),
|
|
61375
61414
|
buildServiceDescriptor$g(cacheServiceDescriptor.service, nimbusSqliteOneStoreCacheServiceDescriptor.service, instrumentationServiceDescriptor.service),
|
|
61376
61415
|
buildServiceDescriptor$j(),
|
|
61377
|
-
buildServiceDescriptor$
|
|
61416
|
+
buildServiceDescriptor$m(),
|
|
61378
61417
|
buildServiceDescriptor$i(),
|
|
61379
61418
|
buildServiceDescriptor$d(),
|
|
61380
61419
|
buildServiceDescriptor$9(),
|
|
@@ -61653,4 +61692,4 @@ register({
|
|
|
61653
61692
|
});
|
|
61654
61693
|
|
|
61655
61694
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, initializeOneStore, registerReportObserver, reportGraphqlQueryParseError };
|
|
61656
|
-
// version: 1.
|
|
61695
|
+
// version: 1.446.0-f73bd65030
|