@salesforce/lds-worker-api 1.352.0 → 1.353.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sfdc/es/ldsWorkerApi.js +1 -1
- package/dist/sfdc/es/types/standalone-stubs/o11y.d.ts +3 -0
- package/dist/standalone/es/lds-worker-api.js +236 -182
- package/dist/standalone/es/types/standalone-stubs/o11y.d.ts +3 -0
- package/dist/standalone/umd/lds-worker-api.js +236 -182
- package/dist/standalone/umd/types/standalone-stubs/o11y.d.ts +3 -0
- package/package.json +9 -9
|
@@ -4266,7 +4266,7 @@ function withDefaultLuvio(callback) {
|
|
|
4266
4266
|
}
|
|
4267
4267
|
callbacks.push(callback);
|
|
4268
4268
|
}
|
|
4269
|
-
// version: 1.
|
|
4269
|
+
// version: 1.353.1-eeb55fde9b
|
|
4270
4270
|
|
|
4271
4271
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4272
4272
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -4840,7 +4840,7 @@ function safeSanitizeGraphQLConfigObject(config) {
|
|
|
4840
4840
|
}
|
|
4841
4841
|
|
|
4842
4842
|
// For use by callers within this module to instrument interesting things.
|
|
4843
|
-
let instrumentation$
|
|
4843
|
+
let instrumentation$5 = {
|
|
4844
4844
|
refreshCalled: (_fromSource) => { },
|
|
4845
4845
|
instrumentAdapter: (adapter, _metadata) => {
|
|
4846
4846
|
return adapter;
|
|
@@ -4855,20 +4855,20 @@ let instrumentation$4 = {
|
|
|
4855
4855
|
* @param newInstrumentation instrumentation hooks to be overridden
|
|
4856
4856
|
*/
|
|
4857
4857
|
function instrument$4(newInstrumentation) {
|
|
4858
|
-
instrumentation$
|
|
4858
|
+
instrumentation$5 = Object.assign(instrumentation$5, newInstrumentation);
|
|
4859
4859
|
}
|
|
4860
4860
|
|
|
4861
4861
|
let refresh$3;
|
|
4862
4862
|
function bindWireRefresh(luvio) {
|
|
4863
4863
|
const wireRefresh = bindWireRefresh$1(luvio);
|
|
4864
4864
|
refresh$3 = (data, apiFamily) => {
|
|
4865
|
-
instrumentation$
|
|
4865
|
+
instrumentation$5.refreshCalled(apiFamily);
|
|
4866
4866
|
return wireRefresh(data);
|
|
4867
4867
|
};
|
|
4868
4868
|
}
|
|
4869
4869
|
|
|
4870
4870
|
function createInstrumentedAdapter(adapter, metadata) {
|
|
4871
|
-
return instrumentation$
|
|
4871
|
+
return instrumentation$5.instrumentAdapter(adapter, metadata);
|
|
4872
4872
|
}
|
|
4873
4873
|
|
|
4874
4874
|
function createLDSAdapter(luvio, name, factory) {
|
|
@@ -5214,7 +5214,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
5214
5214
|
const { apiFamily, name } = metadata;
|
|
5215
5215
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5216
5216
|
}
|
|
5217
|
-
// version: 1.
|
|
5217
|
+
// version: 1.353.1-eeb55fde9b
|
|
5218
5218
|
|
|
5219
5219
|
/**
|
|
5220
5220
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -5826,7 +5826,7 @@ function ensureRegisteredOnce$2(registration) {
|
|
|
5826
5826
|
}
|
|
5827
5827
|
|
|
5828
5828
|
// For use by callers within this module to instrument interesting things.
|
|
5829
|
-
let instrumentation$
|
|
5829
|
+
let instrumentation$4 = {
|
|
5830
5830
|
/**
|
|
5831
5831
|
* Called when a set of record conflicts has been fully resolved. The
|
|
5832
5832
|
* parameter indicates the number of server requests that were needed
|
|
@@ -5875,7 +5875,7 @@ let instrumentation$3 = {
|
|
|
5875
5875
|
* @param newInstrumentation instrumentation hooks to be overridden
|
|
5876
5876
|
*/
|
|
5877
5877
|
function instrument$3(newInstrumentation) {
|
|
5878
|
-
instrumentation$
|
|
5878
|
+
instrumentation$4 = Object.assign(instrumentation$4, newInstrumentation);
|
|
5879
5879
|
}
|
|
5880
5880
|
|
|
5881
5881
|
const engineForPrefetcherMap = new Map();
|
|
@@ -9733,7 +9733,7 @@ function merge$3(existing, incoming, luvio, _path, recordConflictMap) {
|
|
|
9733
9733
|
incoming.recordTypeId === undefined ||
|
|
9734
9734
|
existing.recordTypeId === null ||
|
|
9735
9735
|
existing.recordTypeId === undefined) {
|
|
9736
|
-
instrumentation$
|
|
9736
|
+
instrumentation$4.recordTypeIdIsNull(incoming.apiName);
|
|
9737
9737
|
}
|
|
9738
9738
|
const recordDepKey = dependencyKeyBuilder$1({ recordId: existing.id });
|
|
9739
9739
|
const node = luvio.getNode(recordDepKey);
|
|
@@ -9758,12 +9758,12 @@ function merge$3(existing, incoming, luvio, _path, recordConflictMap) {
|
|
|
9758
9758
|
// }
|
|
9759
9759
|
// Adding instrumentation to see how frequently this occurs
|
|
9760
9760
|
if (existing.apiName !== incoming.apiName) {
|
|
9761
|
-
instrumentation$
|
|
9761
|
+
instrumentation$4.recordApiNameChanged(incoming.apiName, existing.apiName);
|
|
9762
9762
|
}
|
|
9763
9763
|
const incomingWeakEtagZero = incoming.weakEtag === 0;
|
|
9764
9764
|
const existingWeakEtagZero = existing.weakEtag === 0;
|
|
9765
9765
|
if (incomingWeakEtagZero || existingWeakEtagZero) {
|
|
9766
|
-
instrumentation$
|
|
9766
|
+
instrumentation$4.weakEtagZero(incomingWeakEtagZero, existingWeakEtagZero, incoming.apiName);
|
|
9767
9767
|
}
|
|
9768
9768
|
// TODO [W-6900085]: UIAPI returns weakEtag=0 when the record is >2 levels nested. For now
|
|
9769
9769
|
// we treat the record as mergeable.
|
|
@@ -9823,7 +9823,7 @@ function fixDisplayValue(existing, incoming, path) {
|
|
|
9823
9823
|
incomingValue !== null) {
|
|
9824
9824
|
incoming.displayValue = existing.displayValue;
|
|
9825
9825
|
const isSpanningRecord = typeof incomingValue === 'object';
|
|
9826
|
-
instrumentation$
|
|
9826
|
+
instrumentation$4.nullDisplayValueConflict({
|
|
9827
9827
|
entityName: path.parent.data.apiName,
|
|
9828
9828
|
fieldName: path.propertyName,
|
|
9829
9829
|
fieldType: isSpanningRecord ? 'spanning-record' : 'scalar',
|
|
@@ -10613,7 +10613,7 @@ function buildNetworkSnapshot$15(luvio, config, serverRequestCount = 0, options)
|
|
|
10613
10613
|
function resolveConflict$1(luvio, map) {
|
|
10614
10614
|
const ids = keys$7(map.conflicts);
|
|
10615
10615
|
if (ids.length === 0) {
|
|
10616
|
-
instrumentation$
|
|
10616
|
+
instrumentation$4.recordConflictsResolved(map.serverRequestCount);
|
|
10617
10617
|
return;
|
|
10618
10618
|
}
|
|
10619
10619
|
if (ids.length === 1) {
|
|
@@ -15446,7 +15446,7 @@ const notifyChangeFactory = (luvio) => {
|
|
|
15446
15446
|
serverRequestCount: 1,
|
|
15447
15447
|
}), body);
|
|
15448
15448
|
const result = luvio.storeBroadcast();
|
|
15449
|
-
instrumentation$
|
|
15449
|
+
instrumentation$4.getRecordNotifyChangeNetworkResult(existingWeakEtag !== body.weakEtag);
|
|
15450
15450
|
return result;
|
|
15451
15451
|
}, () => {
|
|
15452
15452
|
const cache = new StoreKeyMap();
|
|
@@ -15458,7 +15458,7 @@ const notifyChangeFactory = (luvio) => {
|
|
|
15458
15458
|
const errorSnapshot = luvio.errorSnapshot(error);
|
|
15459
15459
|
luvio.storeIngestError(key, errorSnapshot, RECORD_REPRESENTATION_ERROR_STORE_METADATA_PARAMS$1);
|
|
15460
15460
|
const result = luvio.storeBroadcast();
|
|
15461
|
-
instrumentation$
|
|
15461
|
+
instrumentation$4.getRecordNotifyChangeNetworkResult(null, true);
|
|
15462
15462
|
return result.then(() => errorSnapshot);
|
|
15463
15463
|
});
|
|
15464
15464
|
});
|
|
@@ -30077,7 +30077,7 @@ function createResourceRequest$e$1(config) {
|
|
|
30077
30077
|
method: 'post',
|
|
30078
30078
|
body: config.body,
|
|
30079
30079
|
urlParams: {},
|
|
30080
|
-
queryParams:
|
|
30080
|
+
queryParams: config.queryParams,
|
|
30081
30081
|
headers,
|
|
30082
30082
|
priority: 'normal',
|
|
30083
30083
|
};
|
|
@@ -30086,7 +30086,8 @@ function createResourceRequest$e$1(config) {
|
|
|
30086
30086
|
const adapterName$7$1 = 'executeBatchRecordOperations';
|
|
30087
30087
|
const executeBatchRecordOperations_ConfigPropertyMetadata = [
|
|
30088
30088
|
generateParamConfigMetadata$3('allOrNone', true, 2, 1, false),
|
|
30089
|
-
generateParamConfigMetadata$3('operations', true, 2, 4, true),
|
|
30089
|
+
generateParamConfigMetadata$3('operations', true, 2, 4, true),
|
|
30090
|
+
generateParamConfigMetadata$3('useDefaultRule', false, 1, 1, false), // Not Requred, QueryParam, Boolean, single
|
|
30090
30091
|
];
|
|
30091
30092
|
const executeBatchRecordOperations_ConfigPropertyNames =
|
|
30092
30093
|
/*#__PURE__*/ buildAdapterValidationConfig$3(adapterName$7$1, executeBatchRecordOperations_ConfigPropertyMetadata);
|
|
@@ -30122,6 +30123,11 @@ function batchUpdateRecordsTypeCheckConfig(untrustedConfig) {
|
|
|
30122
30123
|
if (untrustedConfigAllOrNone !== undefined && typeof untrustedConfigAllOrNone === 'boolean') {
|
|
30123
30124
|
config.allOrNone = untrustedConfigAllOrNone;
|
|
30124
30125
|
}
|
|
30126
|
+
const untrustedConfiguseDefaultRule = untrustedConfig.useDefaultRule;
|
|
30127
|
+
if (untrustedConfiguseDefaultRule !== undefined &&
|
|
30128
|
+
typeof untrustedConfiguseDefaultRule === 'boolean') {
|
|
30129
|
+
config.useDefaultRule = untrustedConfiguseDefaultRule;
|
|
30130
|
+
}
|
|
30125
30131
|
return config;
|
|
30126
30132
|
}
|
|
30127
30133
|
function validateAdapterConfig$a$1(untrustedConfig, configPropertyNames) {
|
|
@@ -33965,12 +33971,12 @@ withDefaultLuvio((luvio) => {
|
|
|
33965
33971
|
baseUpdateRelatedListInfo = createLDSAdapter(luvio, 'baseUpdateRelatedListInfo', updateRelatedListInfoAdapterFactory);
|
|
33966
33972
|
createLDSAdapter(luvio, 'baseUpdateRelatedListPreferences', updateRelatedListPreferencesAdapterFactory);
|
|
33967
33973
|
throttle(60, 60000, createLDSAdapter(luvio, 'getRecordNotifyChange', notifyChangeFactory), {
|
|
33968
|
-
allowFunction: instrumentation$
|
|
33969
|
-
dropFunction: instrumentation$
|
|
33974
|
+
allowFunction: instrumentation$4.getRecordNotifyChangeAllowed,
|
|
33975
|
+
dropFunction: instrumentation$4.getRecordNotifyChangeDropped,
|
|
33970
33976
|
});
|
|
33971
33977
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyRecordUpdateAvailable', notifyUpdateAvailableFactory$5), {
|
|
33972
|
-
allowFunction: instrumentation$
|
|
33973
|
-
dropFunction: instrumentation$
|
|
33978
|
+
allowFunction: instrumentation$4.notifyRecordUpdateAvailableAllowed,
|
|
33979
|
+
dropFunction: instrumentation$4.notifyRecordUpdateAvailableDropped,
|
|
33974
33980
|
});
|
|
33975
33981
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListViewSummaryUpdateAvailable', notifyUpdateAvailableFactory$2));
|
|
33976
33982
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoSummaryUpdateAvailable', notifyUpdateAvailableFactory$3));
|
|
@@ -33984,7 +33990,7 @@ withDefaultLuvio((luvio) => {
|
|
|
33984
33990
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33985
33991
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33986
33992
|
});
|
|
33987
|
-
// version: 1.
|
|
33993
|
+
// version: 1.353.1-4693659f9b
|
|
33988
33994
|
|
|
33989
33995
|
/**
|
|
33990
33996
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -45478,7 +45484,9 @@ const activity = {
|
|
|
45478
45484
|
function startActivity(_name) {
|
|
45479
45485
|
return activity;
|
|
45480
45486
|
}
|
|
45487
|
+
function log(_schema, _data) { }
|
|
45481
45488
|
const mockInstrumentation = {
|
|
45489
|
+
log,
|
|
45482
45490
|
startActivity,
|
|
45483
45491
|
error: () => { },
|
|
45484
45492
|
trackValue: (_operation, _value, _hasError, _tags) => { },
|
|
@@ -45604,7 +45612,7 @@ const { entries: entries$3, keys: keys$5 } = Object;
|
|
|
45604
45612
|
|
|
45605
45613
|
const UI_API_BASE_URI = '/services/data/v64.0/ui-api';
|
|
45606
45614
|
|
|
45607
|
-
let instrumentation$
|
|
45615
|
+
let instrumentation$2 = {
|
|
45608
45616
|
aggregateUiChunkCount: (_cb) => { },
|
|
45609
45617
|
aggregateUiConnectError: () => { },
|
|
45610
45618
|
duplicateRequest: (_cb) => { },
|
|
@@ -45616,7 +45624,7 @@ let instrumentation$1$1 = {
|
|
|
45616
45624
|
networkRateLimitExceeded: () => { },
|
|
45617
45625
|
};
|
|
45618
45626
|
function instrument$2(newInstrumentation) {
|
|
45619
|
-
instrumentation$
|
|
45627
|
+
instrumentation$2 = Object.assign(instrumentation$2, newInstrumentation);
|
|
45620
45628
|
}
|
|
45621
45629
|
|
|
45622
45630
|
const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
|
|
@@ -45686,7 +45694,7 @@ function mergeRecordFields$2(first, second) {
|
|
|
45686
45694
|
* would otherwise cause a query length exception.
|
|
45687
45695
|
*/
|
|
45688
45696
|
function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resourceRequest, resourceRequestContext) {
|
|
45689
|
-
instrumentation$
|
|
45697
|
+
instrumentation$2.getRecordAggregateInvoke();
|
|
45690
45698
|
return networkAdapter(resourceRequest, resourceRequestContext).then((resp) => {
|
|
45691
45699
|
const { body } = resp;
|
|
45692
45700
|
// This response body could be an executeAggregateUi, which we don't natively support.
|
|
@@ -45702,7 +45710,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
45702
45710
|
}
|
|
45703
45711
|
const merged = body.compositeResponse.reduce((seed, response) => {
|
|
45704
45712
|
if (response.httpStatusCode !== HttpStatusCode$1.Ok) {
|
|
45705
|
-
instrumentation$
|
|
45713
|
+
instrumentation$2.getRecordAggregateReject(() => recordId);
|
|
45706
45714
|
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
45707
45715
|
error: response.message,
|
|
45708
45716
|
});
|
|
@@ -45712,7 +45720,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
45712
45720
|
}
|
|
45713
45721
|
return mergeRecordFields$2(seed, response.body);
|
|
45714
45722
|
}, null);
|
|
45715
|
-
instrumentation$
|
|
45723
|
+
instrumentation$2.getRecordAggregateResolve(() => {
|
|
45716
45724
|
return {
|
|
45717
45725
|
recordId,
|
|
45718
45726
|
apiName: merged.apiName,
|
|
@@ -45720,7 +45728,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
45720
45728
|
});
|
|
45721
45729
|
return createOkResponse$1(merged);
|
|
45722
45730
|
}, (err) => {
|
|
45723
|
-
instrumentation$
|
|
45731
|
+
instrumentation$2.getRecordAggregateReject(() => recordId);
|
|
45724
45732
|
// rethrow error
|
|
45725
45733
|
throw err;
|
|
45726
45734
|
});
|
|
@@ -45798,7 +45806,7 @@ function buildAndDispatchGetRecordAggregateUi(recordId, req, params) {
|
|
|
45798
45806
|
const { networkAdapter, resourceRequest, resourceRequestContext } = req;
|
|
45799
45807
|
const compositeRequest = buildGetRecordByFieldsCompositeRequest(resourceRequest, params);
|
|
45800
45808
|
// W-12245125: Emit chunk size metrics
|
|
45801
|
-
instrumentation$
|
|
45809
|
+
instrumentation$2.aggregateUiChunkCount(() => compositeRequest.length);
|
|
45802
45810
|
const aggregateUiParams = {
|
|
45803
45811
|
compositeRequest,
|
|
45804
45812
|
};
|
|
@@ -46032,7 +46040,7 @@ function platformNetworkAdapter(baseNetworkAdapter) {
|
|
|
46032
46040
|
return (resourceRequest, resourceRequestContext) => {
|
|
46033
46041
|
if (!tokenBucket.take(1)) {
|
|
46034
46042
|
// We are hitting rate limiting, add some metrics
|
|
46035
|
-
instrumentation$
|
|
46043
|
+
instrumentation$2.networkRateLimitExceeded();
|
|
46036
46044
|
}
|
|
46037
46045
|
const salesforceRequest = {
|
|
46038
46046
|
networkAdapter: baseNetworkAdapter,
|
|
@@ -88646,40 +88654,11 @@ function normalizeError$1(err) {
|
|
|
88646
88654
|
}
|
|
88647
88655
|
return new Error(stringify$2(err));
|
|
88648
88656
|
}
|
|
88649
|
-
// metrics
|
|
88650
|
-
/** GraphQL */
|
|
88651
|
-
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
88652
|
-
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
88653
88657
|
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
88654
88658
|
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
88655
88659
|
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
88656
88660
|
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
88657
|
-
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
88658
|
-
/** Draft Queue */
|
|
88659
|
-
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
88660
|
-
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
88661
|
-
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
88662
|
-
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
88663
|
-
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
88664
|
-
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
88665
|
-
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
88666
|
-
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
88667
|
-
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
88668
|
-
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
88669
88661
|
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
88670
|
-
/** Content Document */
|
|
88671
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
88672
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
88673
|
-
/** Priming */
|
|
88674
|
-
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
88675
|
-
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
88676
|
-
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
88677
|
-
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
88678
|
-
// logs
|
|
88679
|
-
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
88680
|
-
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
88681
|
-
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
88682
|
-
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
88683
88662
|
const ldsMobileInstrumentation$2 = getInstrumentation();
|
|
88684
88663
|
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
88685
88664
|
__nimbus.plugins !== undefined &&
|
|
@@ -88687,35 +88666,15 @@ const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
|
88687
88666
|
? __nimbus.plugins.JSLoggerPlugin
|
|
88688
88667
|
: undefined;
|
|
88689
88668
|
function reportGraphqlQueryParseError(err) {
|
|
88690
|
-
|
|
88691
|
-
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
88692
|
-
// Metric
|
|
88693
|
-
reportGraphqlAdapterError(errorCode);
|
|
88694
|
-
// Log
|
|
88695
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88669
|
+
normalizeError$1(err);
|
|
88696
88670
|
}
|
|
88697
88671
|
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
88698
|
-
|
|
88699
|
-
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
88700
|
-
// Metric
|
|
88701
|
-
reportGraphqlAdapterError(errorCode);
|
|
88702
|
-
// Log
|
|
88703
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88672
|
+
normalizeError$1(err);
|
|
88704
88673
|
}
|
|
88705
88674
|
function reportGraphqlCreateSnapshotError(err) {
|
|
88706
|
-
|
|
88707
|
-
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
88708
|
-
// Metric
|
|
88709
|
-
reportGraphqlAdapterError(errorCode);
|
|
88710
|
-
// Log
|
|
88711
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88675
|
+
normalizeError$1(err);
|
|
88712
88676
|
}
|
|
88713
88677
|
function reportGraphQlEvalDbReadDuration(duration) {
|
|
88714
|
-
ldsMobileInstrumentation$2.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
88715
|
-
}
|
|
88716
|
-
function reportGraphqlAdapterError(errorCode) {
|
|
88717
|
-
// Increment overall count with errorCode as tag
|
|
88718
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
88719
88678
|
}
|
|
88720
88679
|
function reportGraphqlQueryInstrumentation(data) {
|
|
88721
88680
|
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
@@ -88727,52 +88686,15 @@ function reportGraphqlQueryInstrumentation(data) {
|
|
|
88727
88686
|
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
88728
88687
|
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
88729
88688
|
}
|
|
88730
|
-
function incrementGraphQLRefreshUndfined() {
|
|
88731
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
88732
|
-
}
|
|
88733
88689
|
function reportDraftActionEvent(state, draftCount, message) {
|
|
88734
88690
|
if (nimbusLogger) {
|
|
88735
88691
|
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
88736
88692
|
}
|
|
88737
|
-
switch (state) {
|
|
88738
|
-
case 'added':
|
|
88739
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
88740
|
-
break;
|
|
88741
|
-
case 'uploading':
|
|
88742
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
88743
|
-
break;
|
|
88744
|
-
case 'completed':
|
|
88745
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
88746
|
-
break;
|
|
88747
|
-
case 'deleted':
|
|
88748
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
88749
|
-
break;
|
|
88750
|
-
case 'failed':
|
|
88751
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
88752
|
-
break;
|
|
88753
|
-
case 'updated':
|
|
88754
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
88755
|
-
break;
|
|
88756
|
-
}
|
|
88757
88693
|
}
|
|
88758
88694
|
function reportDraftQueueState(state, draftCount) {
|
|
88759
88695
|
if (nimbusLogger) {
|
|
88760
88696
|
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
88761
88697
|
}
|
|
88762
|
-
switch (state) {
|
|
88763
|
-
case 'started':
|
|
88764
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
88765
|
-
break;
|
|
88766
|
-
case 'error':
|
|
88767
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
88768
|
-
break;
|
|
88769
|
-
case 'waiting':
|
|
88770
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
88771
|
-
break;
|
|
88772
|
-
case 'stopped':
|
|
88773
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
88774
|
-
break;
|
|
88775
|
-
}
|
|
88776
88698
|
}
|
|
88777
88699
|
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
88778
88700
|
let error;
|
|
@@ -88782,43 +88704,16 @@ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
|
88782
88704
|
else {
|
|
88783
88705
|
error = normalizeError$1(err);
|
|
88784
88706
|
}
|
|
88785
|
-
|
|
88786
|
-
const errorType = error.errorType;
|
|
88787
|
-
const tags = {
|
|
88788
|
-
errorCode,
|
|
88789
|
-
};
|
|
88790
|
-
if (errorType !== undefined) {
|
|
88791
|
-
tags.errorType = errorType;
|
|
88792
|
-
}
|
|
88793
|
-
// Metric
|
|
88794
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
88795
|
-
// Log
|
|
88796
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88707
|
+
error.errorType;
|
|
88797
88708
|
}
|
|
88798
88709
|
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
88799
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
88800
|
-
}
|
|
88801
|
-
/** Priming */
|
|
88802
|
-
function reportPrimingSessionCreated() {
|
|
88803
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
88804
88710
|
}
|
|
88805
88711
|
function reportPrimingError(errorType, recordCount) {
|
|
88806
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
88807
|
-
errorType,
|
|
88808
|
-
});
|
|
88809
|
-
}
|
|
88810
|
-
function reportPrimingSuccess(recordCount) {
|
|
88811
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
88812
88712
|
}
|
|
88813
88713
|
function reportPrimingConflict(resolutionType, recordCount) {
|
|
88814
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
88815
|
-
resolutionType,
|
|
88816
|
-
});
|
|
88817
88714
|
}
|
|
88818
88715
|
/** Network */
|
|
88819
88716
|
function reportChunkCandidateUrlLength(urlLength) {
|
|
88820
|
-
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
88821
|
-
ldsMobileInstrumentation$2.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
88822
88717
|
}
|
|
88823
88718
|
|
|
88824
88719
|
/**
|
|
@@ -88832,19 +88727,13 @@ const withInstrumentation = (operation, config) => {
|
|
|
88832
88727
|
return operation();
|
|
88833
88728
|
}
|
|
88834
88729
|
const { tags, metricName, logError } = config;
|
|
88835
|
-
let hasError = false;
|
|
88836
88730
|
return operation()
|
|
88837
88731
|
.catch((err) => {
|
|
88838
|
-
hasError = true;
|
|
88839
88732
|
const error = normalizeError$1(err);
|
|
88840
88733
|
tags['errorMessage'] = error.message;
|
|
88841
|
-
if (logError) {
|
|
88842
|
-
ldsMobileInstrumentation$2.error(error);
|
|
88843
|
-
}
|
|
88844
88734
|
throw err;
|
|
88845
88735
|
})
|
|
88846
88736
|
.finally(() => {
|
|
88847
|
-
ldsMobileInstrumentation$2.incrementCounter(metricName, 1, hasError, tags);
|
|
88848
88737
|
});
|
|
88849
88738
|
};
|
|
88850
88739
|
|
|
@@ -89184,9 +89073,6 @@ function instrumentGraphQLEval(adapter) {
|
|
|
89184
89073
|
case 'graphql-query-instrumentation':
|
|
89185
89074
|
reportGraphqlQueryInstrumentation(data.data);
|
|
89186
89075
|
break;
|
|
89187
|
-
case 'graphql-luvio-refresh-undefined':
|
|
89188
|
-
incrementGraphQLRefreshUndfined();
|
|
89189
|
-
break;
|
|
89190
89076
|
}
|
|
89191
89077
|
}
|
|
89192
89078
|
},
|
|
@@ -89909,6 +89795,8 @@ const NimbusBinaryStore = {
|
|
|
89909
89795
|
},
|
|
89910
89796
|
};
|
|
89911
89797
|
|
|
89798
|
+
const priming_session_batch={namespace:"sf.lds",name:"PrimingSessionBatch",pbjsSchema:{"nested":{"sf":{"nested":{"lds":{"nested":{"PrimingSessionBatch":{"fields":{"container":{"id":8,"type":"string"},"idCount":{"id":1,"type":"uint32"},"missingCount":{"id":3,"type":"uint32"},"wasFromPagination":{"id":5,"type":"bool"},"successCount":{"id":2,"type":"uint32"},"paginationCount":{"id":6,"type":"uint32"},"conflictedCount":{"id":4,"type":"uint32"},"ingestDuration":{"id":7,"type":"double"}}}}}}}}}};
|
|
89799
|
+
|
|
89912
89800
|
class EventEmitter {
|
|
89913
89801
|
constructor() {
|
|
89914
89802
|
// @ts-ignore typescript doesn't like us setting this to an empty object for some reason
|
|
@@ -90022,6 +89910,12 @@ function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
|
|
|
90022
89910
|
fieldUnion.push(`${fieldName}.Id`);
|
|
90023
89911
|
includesSpanningFields = true;
|
|
90024
89912
|
}
|
|
89913
|
+
else {
|
|
89914
|
+
// Field exists on record but not in object info.
|
|
89915
|
+
// Fall back to getRecords resolver in this case.
|
|
89916
|
+
fieldUnion.push(fieldName);
|
|
89917
|
+
includesSpanningFields = true;
|
|
89918
|
+
}
|
|
90025
89919
|
}
|
|
90026
89920
|
else {
|
|
90027
89921
|
fieldUnion.push(fieldName);
|
|
@@ -90247,8 +90141,16 @@ class ConflictPool {
|
|
|
90247
90141
|
}
|
|
90248
90142
|
}
|
|
90249
90143
|
|
|
90144
|
+
const instrumentation$1$1 = getInstrumentation();
|
|
90250
90145
|
const DEFAULT_BATCH_SIZE = 500;
|
|
90251
90146
|
const DEFAULT_CONCURRENCY = 6;
|
|
90147
|
+
const MAX_RETRY_COUNT = 2;
|
|
90148
|
+
const SESSION_BATCH_SIZE = 'priming-session-batch-size';
|
|
90149
|
+
const SESSION_CONCURRENCY_LIMIT = 'priming-session-concurrency-limit';
|
|
90150
|
+
const SESSION_ENQUEUE_RECORD_COUNT = 'priming-session-enqueue-record-count';
|
|
90151
|
+
const SESSION_INGEST_WRITTEN = 'priming-session-ingest-written-count';
|
|
90152
|
+
const SESSION_INGEST_CONFLICTED = 'priming-session-ingest-conflicted-count';
|
|
90153
|
+
const SESSION_INGEST_ERRORS = 'priming-session-ingest-error-count';
|
|
90252
90154
|
class PrimingSession extends EventEmitter {
|
|
90253
90155
|
constructor(config) {
|
|
90254
90156
|
super();
|
|
@@ -90260,6 +90162,9 @@ class PrimingSession extends EventEmitter {
|
|
|
90260
90162
|
this.ldsRecordRefresher = config.ldsRecordRefresher;
|
|
90261
90163
|
this.networkWorkerPool = new AsyncWorkerPool(this.concurrency);
|
|
90262
90164
|
this.conflictPool = new ConflictPool(config.store, this.objectInfoLoader);
|
|
90165
|
+
this.retryTracker = new Map();
|
|
90166
|
+
instrumentation$1$1.trackValue(SESSION_BATCH_SIZE, config.batchSize ? config.batchSize : 0);
|
|
90167
|
+
instrumentation$1$1.trackValue(SESSION_CONCURRENCY_LIMIT, config.concurrency ? config.concurrency : 0);
|
|
90263
90168
|
}
|
|
90264
90169
|
// function that enqueues priming work
|
|
90265
90170
|
async enqueue(work) {
|
|
@@ -90278,6 +90183,9 @@ class PrimingSession extends EventEmitter {
|
|
|
90278
90183
|
unavailableTypes,
|
|
90279
90184
|
});
|
|
90280
90185
|
if (unavailableIds.length > 0) {
|
|
90186
|
+
for (const id of unavailableIds) {
|
|
90187
|
+
this.retryTracker.delete(id);
|
|
90188
|
+
}
|
|
90281
90189
|
this.emit('error', {
|
|
90282
90190
|
ids: unavailableIds,
|
|
90283
90191
|
code: 'precondition-error',
|
|
@@ -90291,8 +90199,40 @@ class PrimingSession extends EventEmitter {
|
|
|
90291
90199
|
cancel() {
|
|
90292
90200
|
this.networkWorkerPool.cancel();
|
|
90293
90201
|
}
|
|
90294
|
-
|
|
90202
|
+
handleInstrumentation(activity, stats, errors) {
|
|
90203
|
+
const schema = priming_session_batch;
|
|
90204
|
+
const userData = {
|
|
90205
|
+
...stats,
|
|
90206
|
+
};
|
|
90207
|
+
if (errors.length) {
|
|
90208
|
+
for (const error in errors) {
|
|
90209
|
+
activity.error(error, schema, userData);
|
|
90210
|
+
}
|
|
90211
|
+
}
|
|
90212
|
+
else {
|
|
90213
|
+
activity.stop(schema, userData);
|
|
90214
|
+
}
|
|
90215
|
+
}
|
|
90216
|
+
enqueueBatches(batches, paginationCount = 0) {
|
|
90295
90217
|
for (const batch of batches) {
|
|
90218
|
+
instrumentation$1$1.trackValue(SESSION_ENQUEUE_RECORD_COUNT, batch.ids.length);
|
|
90219
|
+
const o11yActivity = instrumentation$1$1.startActivity('primingSessionBatch');
|
|
90220
|
+
let stats = {
|
|
90221
|
+
idCount: 0,
|
|
90222
|
+
successCount: 0,
|
|
90223
|
+
missingCount: 0,
|
|
90224
|
+
conflictedCount: 0,
|
|
90225
|
+
wasFromPagination: false,
|
|
90226
|
+
paginationCount: 0,
|
|
90227
|
+
ingestDuration: 0,
|
|
90228
|
+
container: '',
|
|
90229
|
+
};
|
|
90230
|
+
let errors = [];
|
|
90231
|
+
if (paginationCount > 0) {
|
|
90232
|
+
stats.wasFromPagination = true;
|
|
90233
|
+
stats.paginationCount = paginationCount;
|
|
90234
|
+
}
|
|
90235
|
+
stats.idCount = batch.ids.length;
|
|
90296
90236
|
const queuedTime = Date.now();
|
|
90297
90237
|
this.networkWorkerPool.push({
|
|
90298
90238
|
workFn: (abortController) => {
|
|
@@ -90302,6 +90242,9 @@ class PrimingSession extends EventEmitter {
|
|
|
90302
90242
|
.fetchRecordData(batch, abortController)
|
|
90303
90243
|
.then(async (results) => {
|
|
90304
90244
|
if (abortController.aborted) {
|
|
90245
|
+
for (const id of batch.ids) {
|
|
90246
|
+
this.retryTracker.delete(id);
|
|
90247
|
+
}
|
|
90305
90248
|
return;
|
|
90306
90249
|
}
|
|
90307
90250
|
this.emit('batch-fetched', {
|
|
@@ -90309,12 +90252,20 @@ class PrimingSession extends EventEmitter {
|
|
|
90309
90252
|
duration: Date.now() - workTime,
|
|
90310
90253
|
});
|
|
90311
90254
|
for (const result of results) {
|
|
90312
|
-
this.processFetchedRecords(result, abortController);
|
|
90255
|
+
const returnedError = this.processFetchedRecords(result, abortController, stats);
|
|
90256
|
+
if (returnedError) {
|
|
90257
|
+
errors.push(returnedError);
|
|
90258
|
+
}
|
|
90313
90259
|
}
|
|
90314
|
-
this.handlePaginations(results, batch);
|
|
90260
|
+
this.handlePaginations(results, batch, paginationCount);
|
|
90261
|
+
})
|
|
90262
|
+
.finally(() => {
|
|
90263
|
+
this.handleInstrumentation(o11yActivity, stats, errors);
|
|
90315
90264
|
});
|
|
90316
90265
|
},
|
|
90317
90266
|
cancelFn: () => {
|
|
90267
|
+
errors.push('cancelled');
|
|
90268
|
+
this.handleInstrumentation(o11yActivity, stats, errors);
|
|
90318
90269
|
this.emit('error', {
|
|
90319
90270
|
ids: batch.ids,
|
|
90320
90271
|
code: 'canceled',
|
|
@@ -90324,7 +90275,7 @@ class PrimingSession extends EventEmitter {
|
|
|
90324
90275
|
});
|
|
90325
90276
|
}
|
|
90326
90277
|
}
|
|
90327
|
-
handlePaginations(results, batch) {
|
|
90278
|
+
handlePaginations(results, batch, paginationCount) {
|
|
90328
90279
|
const ids = this.recordLoader.getMissingIdsWithPagination(results);
|
|
90329
90280
|
if (ids.size > 0) {
|
|
90330
90281
|
const batches = chunk(Array.from(ids), this.batchSize).map((chunkOfIds) => ({
|
|
@@ -90333,10 +90284,10 @@ class PrimingSession extends EventEmitter {
|
|
|
90333
90284
|
fields: batch.fields,
|
|
90334
90285
|
objectInfo: batch.objectInfo,
|
|
90335
90286
|
}));
|
|
90336
|
-
this.enqueueBatches(batches);
|
|
90287
|
+
this.enqueueBatches(batches, paginationCount + 1);
|
|
90337
90288
|
}
|
|
90338
90289
|
}
|
|
90339
|
-
processFetchedRecords(result, abortController) {
|
|
90290
|
+
processFetchedRecords(result, abortController, stats) {
|
|
90340
90291
|
if (result.ok === false) {
|
|
90341
90292
|
const { error } = result;
|
|
90342
90293
|
let primingError = 'unknown';
|
|
@@ -90351,10 +90302,14 @@ class PrimingSession extends EventEmitter {
|
|
|
90351
90302
|
code: primingError,
|
|
90352
90303
|
message: `${result.messages.join(',')}`,
|
|
90353
90304
|
});
|
|
90354
|
-
|
|
90305
|
+
for (const id of result.missingIds) {
|
|
90306
|
+
this.retryTracker.delete(id);
|
|
90307
|
+
}
|
|
90308
|
+
return error;
|
|
90355
90309
|
}
|
|
90356
90310
|
const { missingIds } = result;
|
|
90357
90311
|
if (missingIds.length > 0 && !this.recordLoader.isResultWithPagination(result)) {
|
|
90312
|
+
stats.missingCount = missingIds.length;
|
|
90358
90313
|
this.emit('error', {
|
|
90359
90314
|
ids: missingIds,
|
|
90360
90315
|
code: 'not-found',
|
|
@@ -90362,11 +90317,16 @@ class PrimingSession extends EventEmitter {
|
|
|
90362
90317
|
});
|
|
90363
90318
|
}
|
|
90364
90319
|
const { records } = result;
|
|
90320
|
+
stats.successCount = records.length;
|
|
90365
90321
|
const beforeWrite = Date.now();
|
|
90366
90322
|
// dispatch the write but DO NOT wait on it to unblock the network pool
|
|
90367
90323
|
this.recordIngestor
|
|
90368
90324
|
.insertRecords(records, false)
|
|
90369
90325
|
.then(({ written, conflicted, errors }) => {
|
|
90326
|
+
instrumentation$1$1.trackValue(SESSION_INGEST_WRITTEN, written.length);
|
|
90327
|
+
instrumentation$1$1.trackValue(SESSION_INGEST_CONFLICTED, conflicted.length);
|
|
90328
|
+
instrumentation$1$1.trackValue(SESSION_INGEST_ERRORS, errors.length);
|
|
90329
|
+
stats.conflictedCount = conflicted.length;
|
|
90370
90330
|
this.emit('batch-written', {
|
|
90371
90331
|
written,
|
|
90372
90332
|
conflicted,
|
|
@@ -90374,6 +90334,17 @@ class PrimingSession extends EventEmitter {
|
|
|
90374
90334
|
duration: Date.now() - beforeWrite,
|
|
90375
90335
|
});
|
|
90376
90336
|
if (abortController.aborted) {
|
|
90337
|
+
for (const id of written) {
|
|
90338
|
+
this.retryTracker.delete(id);
|
|
90339
|
+
}
|
|
90340
|
+
for (const id of conflicted) {
|
|
90341
|
+
this.retryTracker.delete(id);
|
|
90342
|
+
}
|
|
90343
|
+
for (const error of errors) {
|
|
90344
|
+
for (const id of error.ids) {
|
|
90345
|
+
this.retryTracker.delete(id);
|
|
90346
|
+
}
|
|
90347
|
+
}
|
|
90377
90348
|
return;
|
|
90378
90349
|
}
|
|
90379
90350
|
if (errors.length > 0) {
|
|
@@ -90383,11 +90354,17 @@ class PrimingSession extends EventEmitter {
|
|
|
90383
90354
|
code: 'unknown',
|
|
90384
90355
|
message: message,
|
|
90385
90356
|
});
|
|
90357
|
+
for (const id of ids) {
|
|
90358
|
+
this.retryTracker.delete(id);
|
|
90359
|
+
}
|
|
90386
90360
|
});
|
|
90387
90361
|
}
|
|
90388
90362
|
// now that the records are persisted, emit the primed event
|
|
90389
90363
|
if (written.length > 0) {
|
|
90390
90364
|
this.emit('primed', Array.from(written));
|
|
90365
|
+
for (const id of written) {
|
|
90366
|
+
this.retryTracker.delete(id);
|
|
90367
|
+
}
|
|
90391
90368
|
}
|
|
90392
90369
|
// if any records could not be written to the store because there were conflicts, handle the conflicts
|
|
90393
90370
|
if (conflicted.length > 0) {
|
|
@@ -90398,14 +90375,39 @@ class PrimingSession extends EventEmitter {
|
|
|
90398
90375
|
async handleWriteConflicts(records, conflicted, abortController) {
|
|
90399
90376
|
const result = await this.conflictPool.enqueueConflictedRecords(records.filter((x) => conflicted.includes(x.id)), abortController);
|
|
90400
90377
|
if (abortController.aborted) {
|
|
90378
|
+
for (const id of conflicted) {
|
|
90379
|
+
this.retryTracker.delete(id);
|
|
90380
|
+
}
|
|
90401
90381
|
return;
|
|
90402
90382
|
}
|
|
90403
|
-
if (
|
|
90383
|
+
if (keys$2$1(result.additionalWork.records).length > 0) {
|
|
90404
90384
|
this.emit('conflict', {
|
|
90405
90385
|
ids: Object.values(result.additionalWork.records).flatMap((record) => record.ids),
|
|
90406
90386
|
resolution: 'priming-refresh',
|
|
90407
90387
|
});
|
|
90408
|
-
|
|
90388
|
+
// we're re-enqueuing here, so apply retry limits which may change the batches
|
|
90389
|
+
let limitedResult = this.applyRetryLimits(result.additionalWork);
|
|
90390
|
+
this.enqueue(limitedResult.additionalWork);
|
|
90391
|
+
if (limitedResult.recordsNeedingRefetch.size > 0) {
|
|
90392
|
+
for (const key in keys$2$1(limitedResult.recordsNeedingRefetch)) {
|
|
90393
|
+
const value = limitedResult.recordsNeedingRefetch.get(key);
|
|
90394
|
+
if (result.recordsNeedingRefetch.has(key)) {
|
|
90395
|
+
let existing = result.recordsNeedingRefetch.get(key);
|
|
90396
|
+
existing = {
|
|
90397
|
+
// merge the ids
|
|
90398
|
+
ids: [...existing.ids, ...value.ids],
|
|
90399
|
+
// This is safe because they derive from the same
|
|
90400
|
+
// input, no chance of getting a new field in the
|
|
90401
|
+
// limited result
|
|
90402
|
+
fields: existing.fields,
|
|
90403
|
+
};
|
|
90404
|
+
result.recordsNeedingRefetch.set(key, existing);
|
|
90405
|
+
}
|
|
90406
|
+
else {
|
|
90407
|
+
result.recordsNeedingRefetch.set(key, value);
|
|
90408
|
+
}
|
|
90409
|
+
}
|
|
90410
|
+
}
|
|
90409
90411
|
}
|
|
90410
90412
|
if (result.resolvedRecords.length > 0) {
|
|
90411
90413
|
this.emit('conflict', {
|
|
@@ -90413,8 +90415,14 @@ class PrimingSession extends EventEmitter {
|
|
|
90413
90415
|
resolution: 'priming-merge',
|
|
90414
90416
|
});
|
|
90415
90417
|
this.emit('primed', result.resolvedRecords);
|
|
90418
|
+
for (const id of result.resolvedRecords) {
|
|
90419
|
+
this.retryTracker.delete(id);
|
|
90420
|
+
}
|
|
90416
90421
|
}
|
|
90417
90422
|
if (result.recordsToWrite.length > 0) {
|
|
90423
|
+
for (const record of result.recordsToWrite) {
|
|
90424
|
+
this.retryTracker.delete(record.id);
|
|
90425
|
+
}
|
|
90418
90426
|
const { written, errors, conflicted } = await this.recordIngestor.insertRecords(result.recordsToWrite, true);
|
|
90419
90427
|
if (written.length > 0) {
|
|
90420
90428
|
const ids = Array.from(written);
|
|
@@ -90441,10 +90449,16 @@ class PrimingSession extends EventEmitter {
|
|
|
90441
90449
|
if (result.recordsNeedingRefetch.size > 0) {
|
|
90442
90450
|
const { loaded, errored } = await this.ldsRecordRefresher.loadRecords(result.recordsNeedingRefetch);
|
|
90443
90451
|
if (loaded.length > 0) {
|
|
90452
|
+
for (const id of loaded) {
|
|
90453
|
+
this.retryTracker.delete(id);
|
|
90454
|
+
}
|
|
90444
90455
|
this.emit('conflict', { resolution: 'lds-refresh', ids: loaded });
|
|
90445
90456
|
this.emit('primed', loaded);
|
|
90446
90457
|
}
|
|
90447
90458
|
if (errored.length > 0) {
|
|
90459
|
+
for (const id of errored) {
|
|
90460
|
+
this.retryTracker.delete(id);
|
|
90461
|
+
}
|
|
90448
90462
|
this.emit('error', {
|
|
90449
90463
|
ids: errored,
|
|
90450
90464
|
code: 'unknown',
|
|
@@ -90453,6 +90467,50 @@ class PrimingSession extends EventEmitter {
|
|
|
90453
90467
|
}
|
|
90454
90468
|
}
|
|
90455
90469
|
}
|
|
90470
|
+
applyRetryLimits(primingWork) {
|
|
90471
|
+
// retryable work goes back into priming session
|
|
90472
|
+
let retryableWork = {
|
|
90473
|
+
type: 'record-fields',
|
|
90474
|
+
records: {},
|
|
90475
|
+
};
|
|
90476
|
+
// refetchable work gets delegated to getRecords
|
|
90477
|
+
let refetchableWork = new Map();
|
|
90478
|
+
for (const key of keys$2$1(primingWork.records)) {
|
|
90479
|
+
let work = primingWork.records[key];
|
|
90480
|
+
let limitedIds = [];
|
|
90481
|
+
for (const id of work.ids) {
|
|
90482
|
+
let retryCount = this.retryTracker.get(id) || 0;
|
|
90483
|
+
retryCount += 1;
|
|
90484
|
+
if (retryCount > MAX_RETRY_COUNT) {
|
|
90485
|
+
limitedIds.push(id);
|
|
90486
|
+
this.retryTracker.delete(id);
|
|
90487
|
+
}
|
|
90488
|
+
else {
|
|
90489
|
+
this.retryTracker.set(id, retryCount);
|
|
90490
|
+
}
|
|
90491
|
+
}
|
|
90492
|
+
if (limitedIds.length < work.ids.length) {
|
|
90493
|
+
retryableWork.records[key] = {
|
|
90494
|
+
ids: work.ids.filter((id) => limitedIds.indexOf(id) === -1),
|
|
90495
|
+
fields: work.fields,
|
|
90496
|
+
};
|
|
90497
|
+
}
|
|
90498
|
+
if (limitedIds.length > 0) {
|
|
90499
|
+
this.emit('retry-limit-reached', { ids: limitedIds });
|
|
90500
|
+
refetchableWork.set(key, {
|
|
90501
|
+
ids: limitedIds,
|
|
90502
|
+
fields: work.fields,
|
|
90503
|
+
});
|
|
90504
|
+
}
|
|
90505
|
+
}
|
|
90506
|
+
return {
|
|
90507
|
+
additionalWork: retryableWork,
|
|
90508
|
+
recordsNeedingRefetch: refetchableWork,
|
|
90509
|
+
resolvedRecords: [],
|
|
90510
|
+
recordsToWrite: [],
|
|
90511
|
+
errors: [],
|
|
90512
|
+
};
|
|
90513
|
+
}
|
|
90456
90514
|
async fetchMetadata(batches) {
|
|
90457
90515
|
const apiNames = Array.from(batches.reduce((acc, x) => {
|
|
90458
90516
|
return acc.add(x.type);
|
|
@@ -90460,20 +90518,20 @@ class PrimingSession extends EventEmitter {
|
|
|
90460
90518
|
const objectInfoMap = await this.objectInfoLoader.getObjectInfos(apiNames);
|
|
90461
90519
|
const unavailableTypes = apiNames.filter((x) => !objectInfoMap[x]);
|
|
90462
90520
|
const availableTypes = apiNames.filter((x) => objectInfoMap[x]);
|
|
90463
|
-
const
|
|
90521
|
+
const unavailableBatches = batches.filter((x) => unavailableTypes.includes(x.type));
|
|
90464
90522
|
const availableBatches = batches
|
|
90465
90523
|
.filter((x) => !unavailableTypes.includes(x.type))
|
|
90466
90524
|
.map((x) => {
|
|
90467
90525
|
return { ...x, objectInfo: objectInfoMap[x.type] };
|
|
90468
90526
|
});
|
|
90469
|
-
const unavailableIds =
|
|
90527
|
+
const unavailableIds = unavailableBatches.reduce((acc, x) => {
|
|
90470
90528
|
acc.push(...x.ids);
|
|
90471
90529
|
return acc;
|
|
90472
90530
|
}, []);
|
|
90473
90531
|
return {
|
|
90474
90532
|
apiNames,
|
|
90475
90533
|
availableBatches,
|
|
90476
|
-
|
|
90534
|
+
unavailableBatches,
|
|
90477
90535
|
unavailableTypes,
|
|
90478
90536
|
availableTypes,
|
|
90479
90537
|
unavailableIds,
|
|
@@ -90703,7 +90761,9 @@ class RecordLoaderGraphQL extends NetworkRecordLoader {
|
|
|
90703
90761
|
return acc;
|
|
90704
90762
|
}, {});
|
|
90705
90763
|
fields['Id'] = { value: id, displayValue: null };
|
|
90706
|
-
fields['RecordTypeId']
|
|
90764
|
+
if (objectInfo.fields['RecordTypeId'] !== undefined) {
|
|
90765
|
+
fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
|
|
90766
|
+
}
|
|
90707
90767
|
let recordTypeInfo = null;
|
|
90708
90768
|
if (recordTypeId !== null &&
|
|
90709
90769
|
objectInfo.recordTypeInfos &&
|
|
@@ -90998,12 +91058,10 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
|
|
|
90998
91058
|
}
|
|
90999
91059
|
|
|
91000
91060
|
function instrumentPrimingSession(session) {
|
|
91001
|
-
reportPrimingSessionCreated();
|
|
91002
91061
|
session.on('error', ({ code, ids }) => {
|
|
91003
91062
|
reportPrimingError(code, ids.length);
|
|
91004
91063
|
});
|
|
91005
91064
|
session.on('primed', ({ length }) => {
|
|
91006
|
-
reportPrimingSuccess(length);
|
|
91007
91065
|
});
|
|
91008
91066
|
session.on('conflict', ({ ids, resolution }) => {
|
|
91009
91067
|
reportPrimingConflict(resolution, ids.length);
|
|
@@ -92612,7 +92670,7 @@ function isStoreRecordError(storeRecord) {
|
|
|
92612
92670
|
return storeRecord.__type === 'error';
|
|
92613
92671
|
}
|
|
92614
92672
|
|
|
92615
|
-
const instrumentation$
|
|
92673
|
+
const instrumentation$3 = getInstrumentation();
|
|
92616
92674
|
const ProductConsumed = {
|
|
92617
92675
|
API_NAME: 'ProductConsumed',
|
|
92618
92676
|
Fields: {
|
|
@@ -92670,7 +92728,6 @@ class ProductConsumedUpdatedHook {
|
|
|
92670
92728
|
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92671
92729
|
if (originalRecord === undefined) {
|
|
92672
92730
|
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92673
|
-
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} not found`);
|
|
92674
92731
|
return [];
|
|
92675
92732
|
}
|
|
92676
92733
|
const originalProductItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
@@ -92681,7 +92738,6 @@ class ProductConsumedUpdatedHook {
|
|
|
92681
92738
|
}
|
|
92682
92739
|
if (originalQuantityConsumed === undefined) {
|
|
92683
92740
|
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92684
|
-
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92685
92741
|
return [];
|
|
92686
92742
|
}
|
|
92687
92743
|
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Created);
|
|
@@ -92708,7 +92764,6 @@ class ProductConsumedDeletedHook {
|
|
|
92708
92764
|
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92709
92765
|
if (originalRecord === undefined) {
|
|
92710
92766
|
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92711
|
-
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} not found`);
|
|
92712
92767
|
return [];
|
|
92713
92768
|
}
|
|
92714
92769
|
const productItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
@@ -92719,7 +92774,6 @@ class ProductConsumedDeletedHook {
|
|
|
92719
92774
|
}
|
|
92720
92775
|
if (quantityConsumed === undefined) {
|
|
92721
92776
|
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92722
|
-
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92723
92777
|
return [];
|
|
92724
92778
|
}
|
|
92725
92779
|
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Created);
|
|
@@ -92774,7 +92828,7 @@ var CounterResult;
|
|
|
92774
92828
|
CounterResult["Error"] = "Error";
|
|
92775
92829
|
})(CounterResult || (CounterResult = {}));
|
|
92776
92830
|
function incrementCounter(name, result) {
|
|
92777
|
-
instrumentation$
|
|
92831
|
+
instrumentation$3.incrementCounter('SFSSideEffect', 1, result == CounterResult.Error, {
|
|
92778
92832
|
Name: name,
|
|
92779
92833
|
Result: result,
|
|
92780
92834
|
});
|
|
@@ -92979,7 +93033,7 @@ register$1({
|
|
|
92979
93033
|
id: '@salesforce/lds-network-adapter',
|
|
92980
93034
|
instrument: instrument$2,
|
|
92981
93035
|
});
|
|
92982
|
-
// version: 1.
|
|
93036
|
+
// version: 1.353.1-eeb55fde9b
|
|
92983
93037
|
|
|
92984
93038
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92985
93039
|
const { stringify, parse } = JSON;
|
|
@@ -116874,7 +116928,7 @@ register$1({
|
|
|
116874
116928
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116875
116929
|
instrument: instrument$1,
|
|
116876
116930
|
});
|
|
116877
|
-
// version: 1.
|
|
116931
|
+
// version: 1.353.1-4693659f9b
|
|
116878
116932
|
|
|
116879
116933
|
// On core the unstable adapters are re-exported with different names,
|
|
116880
116934
|
// we want to match them here.
|
|
@@ -117026,7 +117080,7 @@ withDefaultLuvio((luvio) => {
|
|
|
117026
117080
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
117027
117081
|
graphQLImperative = ldsAdapter;
|
|
117028
117082
|
});
|
|
117029
|
-
// version: 1.
|
|
117083
|
+
// version: 1.353.1-4693659f9b
|
|
117030
117084
|
|
|
117031
117085
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
117032
117086
|
__proto__: null,
|
|
@@ -117818,7 +117872,7 @@ const callbacks$1 = [];
|
|
|
117818
117872
|
function register(r) {
|
|
117819
117873
|
callbacks$1.forEach((callback) => callback(r));
|
|
117820
117874
|
}
|
|
117821
|
-
// version: 1.
|
|
117875
|
+
// version: 1.353.1-eeb55fde9b
|
|
117822
117876
|
|
|
117823
117877
|
/**
|
|
117824
117878
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118898,4 +118952,4 @@ const { luvio } = getRuntime();
|
|
|
118898
118952
|
setDefaultLuvio({ luvio });
|
|
118899
118953
|
|
|
118900
118954
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
118901
|
-
// version: 1.
|
|
118955
|
+
// version: 1.353.1-eeb55fde9b
|