@salesforce/lds-worker-api 1.352.0 → 1.353.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/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
|
@@ -4272,7 +4272,7 @@
|
|
|
4272
4272
|
}
|
|
4273
4273
|
callbacks.push(callback);
|
|
4274
4274
|
}
|
|
4275
|
-
// version: 1.
|
|
4275
|
+
// version: 1.353.0-cc9b469dc4
|
|
4276
4276
|
|
|
4277
4277
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4278
4278
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -4846,7 +4846,7 @@
|
|
|
4846
4846
|
}
|
|
4847
4847
|
|
|
4848
4848
|
// For use by callers within this module to instrument interesting things.
|
|
4849
|
-
let instrumentation$
|
|
4849
|
+
let instrumentation$5 = {
|
|
4850
4850
|
refreshCalled: (_fromSource) => { },
|
|
4851
4851
|
instrumentAdapter: (adapter, _metadata) => {
|
|
4852
4852
|
return adapter;
|
|
@@ -4861,20 +4861,20 @@
|
|
|
4861
4861
|
* @param newInstrumentation instrumentation hooks to be overridden
|
|
4862
4862
|
*/
|
|
4863
4863
|
function instrument$4(newInstrumentation) {
|
|
4864
|
-
instrumentation$
|
|
4864
|
+
instrumentation$5 = Object.assign(instrumentation$5, newInstrumentation);
|
|
4865
4865
|
}
|
|
4866
4866
|
|
|
4867
4867
|
let refresh$3;
|
|
4868
4868
|
function bindWireRefresh(luvio) {
|
|
4869
4869
|
const wireRefresh = bindWireRefresh$1(luvio);
|
|
4870
4870
|
refresh$3 = (data, apiFamily) => {
|
|
4871
|
-
instrumentation$
|
|
4871
|
+
instrumentation$5.refreshCalled(apiFamily);
|
|
4872
4872
|
return wireRefresh(data);
|
|
4873
4873
|
};
|
|
4874
4874
|
}
|
|
4875
4875
|
|
|
4876
4876
|
function createInstrumentedAdapter(adapter, metadata) {
|
|
4877
|
-
return instrumentation$
|
|
4877
|
+
return instrumentation$5.instrumentAdapter(adapter, metadata);
|
|
4878
4878
|
}
|
|
4879
4879
|
|
|
4880
4880
|
function createLDSAdapter(luvio, name, factory) {
|
|
@@ -5220,7 +5220,7 @@
|
|
|
5220
5220
|
const { apiFamily, name } = metadata;
|
|
5221
5221
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5222
5222
|
}
|
|
5223
|
-
// version: 1.
|
|
5223
|
+
// version: 1.353.0-cc9b469dc4
|
|
5224
5224
|
|
|
5225
5225
|
/**
|
|
5226
5226
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -5832,7 +5832,7 @@
|
|
|
5832
5832
|
}
|
|
5833
5833
|
|
|
5834
5834
|
// For use by callers within this module to instrument interesting things.
|
|
5835
|
-
let instrumentation$
|
|
5835
|
+
let instrumentation$4 = {
|
|
5836
5836
|
/**
|
|
5837
5837
|
* Called when a set of record conflicts has been fully resolved. The
|
|
5838
5838
|
* parameter indicates the number of server requests that were needed
|
|
@@ -5881,7 +5881,7 @@
|
|
|
5881
5881
|
* @param newInstrumentation instrumentation hooks to be overridden
|
|
5882
5882
|
*/
|
|
5883
5883
|
function instrument$3(newInstrumentation) {
|
|
5884
|
-
instrumentation$
|
|
5884
|
+
instrumentation$4 = Object.assign(instrumentation$4, newInstrumentation);
|
|
5885
5885
|
}
|
|
5886
5886
|
|
|
5887
5887
|
const engineForPrefetcherMap = new Map();
|
|
@@ -9739,7 +9739,7 @@
|
|
|
9739
9739
|
incoming.recordTypeId === undefined ||
|
|
9740
9740
|
existing.recordTypeId === null ||
|
|
9741
9741
|
existing.recordTypeId === undefined) {
|
|
9742
|
-
instrumentation$
|
|
9742
|
+
instrumentation$4.recordTypeIdIsNull(incoming.apiName);
|
|
9743
9743
|
}
|
|
9744
9744
|
const recordDepKey = dependencyKeyBuilder$1({ recordId: existing.id });
|
|
9745
9745
|
const node = luvio.getNode(recordDepKey);
|
|
@@ -9764,12 +9764,12 @@
|
|
|
9764
9764
|
// }
|
|
9765
9765
|
// Adding instrumentation to see how frequently this occurs
|
|
9766
9766
|
if (existing.apiName !== incoming.apiName) {
|
|
9767
|
-
instrumentation$
|
|
9767
|
+
instrumentation$4.recordApiNameChanged(incoming.apiName, existing.apiName);
|
|
9768
9768
|
}
|
|
9769
9769
|
const incomingWeakEtagZero = incoming.weakEtag === 0;
|
|
9770
9770
|
const existingWeakEtagZero = existing.weakEtag === 0;
|
|
9771
9771
|
if (incomingWeakEtagZero || existingWeakEtagZero) {
|
|
9772
|
-
instrumentation$
|
|
9772
|
+
instrumentation$4.weakEtagZero(incomingWeakEtagZero, existingWeakEtagZero, incoming.apiName);
|
|
9773
9773
|
}
|
|
9774
9774
|
// TODO [W-6900085]: UIAPI returns weakEtag=0 when the record is >2 levels nested. For now
|
|
9775
9775
|
// we treat the record as mergeable.
|
|
@@ -9829,7 +9829,7 @@
|
|
|
9829
9829
|
incomingValue !== null) {
|
|
9830
9830
|
incoming.displayValue = existing.displayValue;
|
|
9831
9831
|
const isSpanningRecord = typeof incomingValue === 'object';
|
|
9832
|
-
instrumentation$
|
|
9832
|
+
instrumentation$4.nullDisplayValueConflict({
|
|
9833
9833
|
entityName: path.parent.data.apiName,
|
|
9834
9834
|
fieldName: path.propertyName,
|
|
9835
9835
|
fieldType: isSpanningRecord ? 'spanning-record' : 'scalar',
|
|
@@ -10619,7 +10619,7 @@
|
|
|
10619
10619
|
function resolveConflict$1(luvio, map) {
|
|
10620
10620
|
const ids = keys$7(map.conflicts);
|
|
10621
10621
|
if (ids.length === 0) {
|
|
10622
|
-
instrumentation$
|
|
10622
|
+
instrumentation$4.recordConflictsResolved(map.serverRequestCount);
|
|
10623
10623
|
return;
|
|
10624
10624
|
}
|
|
10625
10625
|
if (ids.length === 1) {
|
|
@@ -15452,7 +15452,7 @@
|
|
|
15452
15452
|
serverRequestCount: 1,
|
|
15453
15453
|
}), body);
|
|
15454
15454
|
const result = luvio.storeBroadcast();
|
|
15455
|
-
instrumentation$
|
|
15455
|
+
instrumentation$4.getRecordNotifyChangeNetworkResult(existingWeakEtag !== body.weakEtag);
|
|
15456
15456
|
return result;
|
|
15457
15457
|
}, () => {
|
|
15458
15458
|
const cache = new StoreKeyMap();
|
|
@@ -15464,7 +15464,7 @@
|
|
|
15464
15464
|
const errorSnapshot = luvio.errorSnapshot(error);
|
|
15465
15465
|
luvio.storeIngestError(key, errorSnapshot, RECORD_REPRESENTATION_ERROR_STORE_METADATA_PARAMS$1);
|
|
15466
15466
|
const result = luvio.storeBroadcast();
|
|
15467
|
-
instrumentation$
|
|
15467
|
+
instrumentation$4.getRecordNotifyChangeNetworkResult(null, true);
|
|
15468
15468
|
return result.then(() => errorSnapshot);
|
|
15469
15469
|
});
|
|
15470
15470
|
});
|
|
@@ -30083,7 +30083,7 @@
|
|
|
30083
30083
|
method: 'post',
|
|
30084
30084
|
body: config.body,
|
|
30085
30085
|
urlParams: {},
|
|
30086
|
-
queryParams:
|
|
30086
|
+
queryParams: config.queryParams,
|
|
30087
30087
|
headers,
|
|
30088
30088
|
priority: 'normal',
|
|
30089
30089
|
};
|
|
@@ -30092,7 +30092,8 @@
|
|
|
30092
30092
|
const adapterName$7$1 = 'executeBatchRecordOperations';
|
|
30093
30093
|
const executeBatchRecordOperations_ConfigPropertyMetadata = [
|
|
30094
30094
|
generateParamConfigMetadata$3('allOrNone', true, 2, 1, false),
|
|
30095
|
-
generateParamConfigMetadata$3('operations', true, 2, 4, true),
|
|
30095
|
+
generateParamConfigMetadata$3('operations', true, 2, 4, true),
|
|
30096
|
+
generateParamConfigMetadata$3('useDefaultRule', false, 1, 1, false), // Not Requred, QueryParam, Boolean, single
|
|
30096
30097
|
];
|
|
30097
30098
|
const executeBatchRecordOperations_ConfigPropertyNames =
|
|
30098
30099
|
/*#__PURE__*/ buildAdapterValidationConfig$3(adapterName$7$1, executeBatchRecordOperations_ConfigPropertyMetadata);
|
|
@@ -30128,6 +30129,11 @@
|
|
|
30128
30129
|
if (untrustedConfigAllOrNone !== undefined && typeof untrustedConfigAllOrNone === 'boolean') {
|
|
30129
30130
|
config.allOrNone = untrustedConfigAllOrNone;
|
|
30130
30131
|
}
|
|
30132
|
+
const untrustedConfiguseDefaultRule = untrustedConfig.useDefaultRule;
|
|
30133
|
+
if (untrustedConfiguseDefaultRule !== undefined &&
|
|
30134
|
+
typeof untrustedConfiguseDefaultRule === 'boolean') {
|
|
30135
|
+
config.useDefaultRule = untrustedConfiguseDefaultRule;
|
|
30136
|
+
}
|
|
30131
30137
|
return config;
|
|
30132
30138
|
}
|
|
30133
30139
|
function validateAdapterConfig$a$1(untrustedConfig, configPropertyNames) {
|
|
@@ -33971,12 +33977,12 @@
|
|
|
33971
33977
|
baseUpdateRelatedListInfo = createLDSAdapter(luvio, 'baseUpdateRelatedListInfo', updateRelatedListInfoAdapterFactory);
|
|
33972
33978
|
createLDSAdapter(luvio, 'baseUpdateRelatedListPreferences', updateRelatedListPreferencesAdapterFactory);
|
|
33973
33979
|
throttle(60, 60000, createLDSAdapter(luvio, 'getRecordNotifyChange', notifyChangeFactory), {
|
|
33974
|
-
allowFunction: instrumentation$
|
|
33975
|
-
dropFunction: instrumentation$
|
|
33980
|
+
allowFunction: instrumentation$4.getRecordNotifyChangeAllowed,
|
|
33981
|
+
dropFunction: instrumentation$4.getRecordNotifyChangeDropped,
|
|
33976
33982
|
});
|
|
33977
33983
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyRecordUpdateAvailable', notifyUpdateAvailableFactory$5), {
|
|
33978
|
-
allowFunction: instrumentation$
|
|
33979
|
-
dropFunction: instrumentation$
|
|
33984
|
+
allowFunction: instrumentation$4.notifyRecordUpdateAvailableAllowed,
|
|
33985
|
+
dropFunction: instrumentation$4.notifyRecordUpdateAvailableDropped,
|
|
33980
33986
|
});
|
|
33981
33987
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListViewSummaryUpdateAvailable', notifyUpdateAvailableFactory$2));
|
|
33982
33988
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoSummaryUpdateAvailable', notifyUpdateAvailableFactory$3));
|
|
@@ -33990,7 +33996,7 @@
|
|
|
33990
33996
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33991
33997
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33992
33998
|
});
|
|
33993
|
-
// version: 1.
|
|
33999
|
+
// version: 1.353.0-330d59cfcb
|
|
33994
34000
|
|
|
33995
34001
|
/**
|
|
33996
34002
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -45484,7 +45490,9 @@
|
|
|
45484
45490
|
function startActivity(_name) {
|
|
45485
45491
|
return activity;
|
|
45486
45492
|
}
|
|
45493
|
+
function log(_schema, _data) { }
|
|
45487
45494
|
const mockInstrumentation = {
|
|
45495
|
+
log,
|
|
45488
45496
|
startActivity,
|
|
45489
45497
|
error: () => { },
|
|
45490
45498
|
trackValue: (_operation, _value, _hasError, _tags) => { },
|
|
@@ -45610,7 +45618,7 @@
|
|
|
45610
45618
|
|
|
45611
45619
|
const UI_API_BASE_URI = '/services/data/v64.0/ui-api';
|
|
45612
45620
|
|
|
45613
|
-
let instrumentation$
|
|
45621
|
+
let instrumentation$2 = {
|
|
45614
45622
|
aggregateUiChunkCount: (_cb) => { },
|
|
45615
45623
|
aggregateUiConnectError: () => { },
|
|
45616
45624
|
duplicateRequest: (_cb) => { },
|
|
@@ -45622,7 +45630,7 @@
|
|
|
45622
45630
|
networkRateLimitExceeded: () => { },
|
|
45623
45631
|
};
|
|
45624
45632
|
function instrument$2(newInstrumentation) {
|
|
45625
|
-
instrumentation$
|
|
45633
|
+
instrumentation$2 = Object.assign(instrumentation$2, newInstrumentation);
|
|
45626
45634
|
}
|
|
45627
45635
|
|
|
45628
45636
|
const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
|
|
@@ -45692,7 +45700,7 @@
|
|
|
45692
45700
|
* would otherwise cause a query length exception.
|
|
45693
45701
|
*/
|
|
45694
45702
|
function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resourceRequest, resourceRequestContext) {
|
|
45695
|
-
instrumentation$
|
|
45703
|
+
instrumentation$2.getRecordAggregateInvoke();
|
|
45696
45704
|
return networkAdapter(resourceRequest, resourceRequestContext).then((resp) => {
|
|
45697
45705
|
const { body } = resp;
|
|
45698
45706
|
// This response body could be an executeAggregateUi, which we don't natively support.
|
|
@@ -45708,7 +45716,7 @@
|
|
|
45708
45716
|
}
|
|
45709
45717
|
const merged = body.compositeResponse.reduce((seed, response) => {
|
|
45710
45718
|
if (response.httpStatusCode !== HttpStatusCode$1.Ok) {
|
|
45711
|
-
instrumentation$
|
|
45719
|
+
instrumentation$2.getRecordAggregateReject(() => recordId);
|
|
45712
45720
|
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
45713
45721
|
error: response.message,
|
|
45714
45722
|
});
|
|
@@ -45718,7 +45726,7 @@
|
|
|
45718
45726
|
}
|
|
45719
45727
|
return mergeRecordFields$2(seed, response.body);
|
|
45720
45728
|
}, null);
|
|
45721
|
-
instrumentation$
|
|
45729
|
+
instrumentation$2.getRecordAggregateResolve(() => {
|
|
45722
45730
|
return {
|
|
45723
45731
|
recordId,
|
|
45724
45732
|
apiName: merged.apiName,
|
|
@@ -45726,7 +45734,7 @@
|
|
|
45726
45734
|
});
|
|
45727
45735
|
return createOkResponse$1(merged);
|
|
45728
45736
|
}, (err) => {
|
|
45729
|
-
instrumentation$
|
|
45737
|
+
instrumentation$2.getRecordAggregateReject(() => recordId);
|
|
45730
45738
|
// rethrow error
|
|
45731
45739
|
throw err;
|
|
45732
45740
|
});
|
|
@@ -45804,7 +45812,7 @@
|
|
|
45804
45812
|
const { networkAdapter, resourceRequest, resourceRequestContext } = req;
|
|
45805
45813
|
const compositeRequest = buildGetRecordByFieldsCompositeRequest(resourceRequest, params);
|
|
45806
45814
|
// W-12245125: Emit chunk size metrics
|
|
45807
|
-
instrumentation$
|
|
45815
|
+
instrumentation$2.aggregateUiChunkCount(() => compositeRequest.length);
|
|
45808
45816
|
const aggregateUiParams = {
|
|
45809
45817
|
compositeRequest,
|
|
45810
45818
|
};
|
|
@@ -46038,7 +46046,7 @@
|
|
|
46038
46046
|
return (resourceRequest, resourceRequestContext) => {
|
|
46039
46047
|
if (!tokenBucket.take(1)) {
|
|
46040
46048
|
// We are hitting rate limiting, add some metrics
|
|
46041
|
-
instrumentation$
|
|
46049
|
+
instrumentation$2.networkRateLimitExceeded();
|
|
46042
46050
|
}
|
|
46043
46051
|
const salesforceRequest = {
|
|
46044
46052
|
networkAdapter: baseNetworkAdapter,
|
|
@@ -88652,40 +88660,11 @@
|
|
|
88652
88660
|
}
|
|
88653
88661
|
return new Error(stringify$2(err));
|
|
88654
88662
|
}
|
|
88655
|
-
// metrics
|
|
88656
|
-
/** GraphQL */
|
|
88657
|
-
const GRAPHQL_EVAL_ERROR = 'gql-eval-error';
|
|
88658
|
-
const GRAPHQL_EVAL_DB_READ_DURATION = 'gql-eval-db-read-duration';
|
|
88659
88663
|
const GRAPHQL_EVAL_ROOT_QUERY_COUNT = 'gql-eval-root-query-count';
|
|
88660
88664
|
const GRAPHQL_EVAL_TOTAL_QUERY_COUNT = 'gql-eval-total-query-count';
|
|
88661
88665
|
const GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT = 'gql-eval-max-child-count';
|
|
88662
88666
|
const GRAPHQL_EVAL_QUERY_RECORD_COUNT = 'gql-eval-query-record-count';
|
|
88663
|
-
const GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED = 'gql-snapshot-refresh-undefined';
|
|
88664
|
-
/** Draft Queue */
|
|
88665
|
-
const DRAFT_QUEUE_STATE_STARTED = 'draft-queue-state-started';
|
|
88666
|
-
const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
88667
|
-
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
88668
|
-
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
88669
|
-
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
88670
|
-
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
88671
|
-
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
88672
|
-
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
88673
|
-
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
88674
|
-
const DRAFT_QUEUE_ACTION_FAILED = 'draft-queue-action-failed';
|
|
88675
88667
|
const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
|
|
88676
|
-
/** Content Document */
|
|
88677
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS = 'content-document-version-total-synthesize-calls';
|
|
88678
|
-
const CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR = 'create-content-document-version-draft-synthesize-error';
|
|
88679
|
-
/** Priming */
|
|
88680
|
-
const PRIMING_TOTAL_SESSION_COUNT = 'priming-total-session-count';
|
|
88681
|
-
const PRIMING_TOTAL_ERROR_COUNT = 'priming-total-error-count';
|
|
88682
|
-
const PRIMING_TOTAL_PRIMED_COUNT = 'priming-total-primed-count';
|
|
88683
|
-
const PRIMING_TOTAL_CONFLICT_COUNT = 'priming-total-conflict-count';
|
|
88684
|
-
// logs
|
|
88685
|
-
const GRAPHQL_QUERY_PARSE_ERROR = 'gql-query-parse-error';
|
|
88686
|
-
const GRAPHQL_SQL_EVAL_PRECONDITION_ERROR = 'gql-sql-pre-eval-error';
|
|
88687
|
-
const GRAPHQL_CREATE_SNAPSHOT_ERROR = 'gql-create-snapshot-error';
|
|
88688
|
-
const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
|
|
88689
88668
|
const ldsMobileInstrumentation$2 = getInstrumentation();
|
|
88690
88669
|
const nimbusLogger = typeof __nimbus !== 'undefined' &&
|
|
88691
88670
|
__nimbus.plugins !== undefined &&
|
|
@@ -88693,35 +88672,15 @@
|
|
|
88693
88672
|
? __nimbus.plugins.JSLoggerPlugin
|
|
88694
88673
|
: undefined;
|
|
88695
88674
|
function reportGraphqlQueryParseError(err) {
|
|
88696
|
-
|
|
88697
|
-
const errorCode = GRAPHQL_QUERY_PARSE_ERROR;
|
|
88698
|
-
// Metric
|
|
88699
|
-
reportGraphqlAdapterError(errorCode);
|
|
88700
|
-
// Log
|
|
88701
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88675
|
+
normalizeError$1(err);
|
|
88702
88676
|
}
|
|
88703
88677
|
function reportGraphqlSqlEvalPreconditionError(err) {
|
|
88704
|
-
|
|
88705
|
-
const errorCode = GRAPHQL_SQL_EVAL_PRECONDITION_ERROR;
|
|
88706
|
-
// Metric
|
|
88707
|
-
reportGraphqlAdapterError(errorCode);
|
|
88708
|
-
// Log
|
|
88709
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88678
|
+
normalizeError$1(err);
|
|
88710
88679
|
}
|
|
88711
88680
|
function reportGraphqlCreateSnapshotError(err) {
|
|
88712
|
-
|
|
88713
|
-
const errorCode = GRAPHQL_CREATE_SNAPSHOT_ERROR;
|
|
88714
|
-
// Metric
|
|
88715
|
-
reportGraphqlAdapterError(errorCode);
|
|
88716
|
-
// Log
|
|
88717
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88681
|
+
normalizeError$1(err);
|
|
88718
88682
|
}
|
|
88719
88683
|
function reportGraphQlEvalDbReadDuration(duration) {
|
|
88720
|
-
ldsMobileInstrumentation$2.trackValue(GRAPHQL_EVAL_DB_READ_DURATION, duration);
|
|
88721
|
-
}
|
|
88722
|
-
function reportGraphqlAdapterError(errorCode) {
|
|
88723
|
-
// Increment overall count with errorCode as tag
|
|
88724
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_EVAL_ERROR, 1, true, { errorCode });
|
|
88725
88684
|
}
|
|
88726
88685
|
function reportGraphqlQueryInstrumentation(data) {
|
|
88727
88686
|
const queryBuckets = [1, 2, 3, 4, 5, 10, 20, 50, 100];
|
|
@@ -88733,52 +88692,15 @@
|
|
|
88733
88692
|
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_MAX_CHILD_RELATIONSHIPS_COUNT, data.maxChildRelationships, queryBuckets);
|
|
88734
88693
|
ldsMobileInstrumentation$2.bucketValue(GRAPHQL_EVAL_QUERY_RECORD_COUNT, data.requestedRecordCount, recordBuckets);
|
|
88735
88694
|
}
|
|
88736
|
-
function incrementGraphQLRefreshUndfined() {
|
|
88737
|
-
ldsMobileInstrumentation$2.incrementCounter(GRAPHQL_SNAPSHOT_REFRESH_UNDEFINED);
|
|
88738
|
-
}
|
|
88739
88695
|
function reportDraftActionEvent(state, draftCount, message) {
|
|
88740
88696
|
if (nimbusLogger) {
|
|
88741
88697
|
nimbusLogger.logInfo(`Draft action event: ${state}, depth: ${draftCount}${message ? `, message: ${message}` : ''}`);
|
|
88742
88698
|
}
|
|
88743
|
-
switch (state) {
|
|
88744
|
-
case 'added':
|
|
88745
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
88746
|
-
break;
|
|
88747
|
-
case 'uploading':
|
|
88748
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
88749
|
-
break;
|
|
88750
|
-
case 'completed':
|
|
88751
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
88752
|
-
break;
|
|
88753
|
-
case 'deleted':
|
|
88754
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_DELETED);
|
|
88755
|
-
break;
|
|
88756
|
-
case 'failed':
|
|
88757
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_FAILED, 1, true);
|
|
88758
|
-
break;
|
|
88759
|
-
case 'updated':
|
|
88760
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_ACTION_UPDATED);
|
|
88761
|
-
break;
|
|
88762
|
-
}
|
|
88763
88699
|
}
|
|
88764
88700
|
function reportDraftQueueState(state, draftCount) {
|
|
88765
88701
|
if (nimbusLogger) {
|
|
88766
88702
|
nimbusLogger.logInfo(`Draft state changed: ${state}, depth: ${draftCount}`);
|
|
88767
88703
|
}
|
|
88768
|
-
switch (state) {
|
|
88769
|
-
case 'started':
|
|
88770
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STARTED);
|
|
88771
|
-
break;
|
|
88772
|
-
case 'error':
|
|
88773
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_ERROR, 1, true);
|
|
88774
|
-
break;
|
|
88775
|
-
case 'waiting':
|
|
88776
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_WAITING);
|
|
88777
|
-
break;
|
|
88778
|
-
case 'stopped':
|
|
88779
|
-
ldsMobileInstrumentation$2.incrementCounter(DRAFT_QUEUE_STATE_STOPPED);
|
|
88780
|
-
break;
|
|
88781
|
-
}
|
|
88782
88704
|
}
|
|
88783
88705
|
function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
|
|
88784
88706
|
let error;
|
|
@@ -88788,43 +88710,16 @@
|
|
|
88788
88710
|
else {
|
|
88789
88711
|
error = normalizeError$1(err);
|
|
88790
88712
|
}
|
|
88791
|
-
|
|
88792
|
-
const errorType = error.errorType;
|
|
88793
|
-
const tags = {
|
|
88794
|
-
errorCode,
|
|
88795
|
-
};
|
|
88796
|
-
if (errorType !== undefined) {
|
|
88797
|
-
tags.errorType = errorType;
|
|
88798
|
-
}
|
|
88799
|
-
// Metric
|
|
88800
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_DRAFT_SYNTHESIZE_ERROR, 1, true, tags);
|
|
88801
|
-
// Log
|
|
88802
|
-
ldsMobileInstrumentation$2.error(error, errorCode);
|
|
88713
|
+
error.errorType;
|
|
88803
88714
|
}
|
|
88804
88715
|
function reportDraftAwareContentVersionSynthesizeCalls(mimeType) {
|
|
88805
|
-
ldsMobileInstrumentation$2.incrementCounter(CREATE_CONTENT_DOCUMENT_AND_VERSION_TOTAL_SYNTHESIZE_CALLS, 1, undefined, { mimeType });
|
|
88806
|
-
}
|
|
88807
|
-
/** Priming */
|
|
88808
|
-
function reportPrimingSessionCreated() {
|
|
88809
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_SESSION_COUNT, 1, undefined, {});
|
|
88810
88716
|
}
|
|
88811
88717
|
function reportPrimingError(errorType, recordCount) {
|
|
88812
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_ERROR_COUNT, recordCount, undefined, {
|
|
88813
|
-
errorType,
|
|
88814
|
-
});
|
|
88815
|
-
}
|
|
88816
|
-
function reportPrimingSuccess(recordCount) {
|
|
88817
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_PRIMED_COUNT, recordCount, undefined);
|
|
88818
88718
|
}
|
|
88819
88719
|
function reportPrimingConflict(resolutionType, recordCount) {
|
|
88820
|
-
ldsMobileInstrumentation$2.incrementCounter(PRIMING_TOTAL_CONFLICT_COUNT, recordCount, undefined, {
|
|
88821
|
-
resolutionType,
|
|
88822
|
-
});
|
|
88823
88720
|
}
|
|
88824
88721
|
/** Network */
|
|
88825
88722
|
function reportChunkCandidateUrlLength(urlLength) {
|
|
88826
|
-
const buckets = [8000, 10000, 12000, 14000, 16000];
|
|
88827
|
-
ldsMobileInstrumentation$2.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
|
|
88828
88723
|
}
|
|
88829
88724
|
|
|
88830
88725
|
/**
|
|
@@ -88838,19 +88733,13 @@
|
|
|
88838
88733
|
return operation();
|
|
88839
88734
|
}
|
|
88840
88735
|
const { tags, metricName, logError } = config;
|
|
88841
|
-
let hasError = false;
|
|
88842
88736
|
return operation()
|
|
88843
88737
|
.catch((err) => {
|
|
88844
|
-
hasError = true;
|
|
88845
88738
|
const error = normalizeError$1(err);
|
|
88846
88739
|
tags['errorMessage'] = error.message;
|
|
88847
|
-
if (logError) {
|
|
88848
|
-
ldsMobileInstrumentation$2.error(error);
|
|
88849
|
-
}
|
|
88850
88740
|
throw err;
|
|
88851
88741
|
})
|
|
88852
88742
|
.finally(() => {
|
|
88853
|
-
ldsMobileInstrumentation$2.incrementCounter(metricName, 1, hasError, tags);
|
|
88854
88743
|
});
|
|
88855
88744
|
};
|
|
88856
88745
|
|
|
@@ -89190,9 +89079,6 @@
|
|
|
89190
89079
|
case 'graphql-query-instrumentation':
|
|
89191
89080
|
reportGraphqlQueryInstrumentation(data.data);
|
|
89192
89081
|
break;
|
|
89193
|
-
case 'graphql-luvio-refresh-undefined':
|
|
89194
|
-
incrementGraphQLRefreshUndfined();
|
|
89195
|
-
break;
|
|
89196
89082
|
}
|
|
89197
89083
|
}
|
|
89198
89084
|
},
|
|
@@ -89915,6 +89801,8 @@
|
|
|
89915
89801
|
},
|
|
89916
89802
|
};
|
|
89917
89803
|
|
|
89804
|
+
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"}}}}}}}}}};
|
|
89805
|
+
|
|
89918
89806
|
class EventEmitter {
|
|
89919
89807
|
constructor() {
|
|
89920
89808
|
// @ts-ignore typescript doesn't like us setting this to an empty object for some reason
|
|
@@ -90028,6 +89916,12 @@
|
|
|
90028
89916
|
fieldUnion.push(`${fieldName}.Id`);
|
|
90029
89917
|
includesSpanningFields = true;
|
|
90030
89918
|
}
|
|
89919
|
+
else {
|
|
89920
|
+
// Field exists on record but not in object info.
|
|
89921
|
+
// Fall back to getRecords resolver in this case.
|
|
89922
|
+
fieldUnion.push(fieldName);
|
|
89923
|
+
includesSpanningFields = true;
|
|
89924
|
+
}
|
|
90031
89925
|
}
|
|
90032
89926
|
else {
|
|
90033
89927
|
fieldUnion.push(fieldName);
|
|
@@ -90253,8 +90147,16 @@
|
|
|
90253
90147
|
}
|
|
90254
90148
|
}
|
|
90255
90149
|
|
|
90150
|
+
const instrumentation$1$1 = getInstrumentation();
|
|
90256
90151
|
const DEFAULT_BATCH_SIZE = 500;
|
|
90257
90152
|
const DEFAULT_CONCURRENCY = 6;
|
|
90153
|
+
const MAX_RETRY_COUNT = 2;
|
|
90154
|
+
const SESSION_BATCH_SIZE = 'priming-session-batch-size';
|
|
90155
|
+
const SESSION_CONCURRENCY_LIMIT = 'priming-session-concurrency-limit';
|
|
90156
|
+
const SESSION_ENQUEUE_RECORD_COUNT = 'priming-session-enqueue-record-count';
|
|
90157
|
+
const SESSION_INGEST_WRITTEN = 'priming-session-ingest-written-count';
|
|
90158
|
+
const SESSION_INGEST_CONFLICTED = 'priming-session-ingest-conflicted-count';
|
|
90159
|
+
const SESSION_INGEST_ERRORS = 'priming-session-ingest-error-count';
|
|
90258
90160
|
class PrimingSession extends EventEmitter {
|
|
90259
90161
|
constructor(config) {
|
|
90260
90162
|
super();
|
|
@@ -90266,6 +90168,9 @@
|
|
|
90266
90168
|
this.ldsRecordRefresher = config.ldsRecordRefresher;
|
|
90267
90169
|
this.networkWorkerPool = new AsyncWorkerPool(this.concurrency);
|
|
90268
90170
|
this.conflictPool = new ConflictPool(config.store, this.objectInfoLoader);
|
|
90171
|
+
this.retryTracker = new Map();
|
|
90172
|
+
instrumentation$1$1.trackValue(SESSION_BATCH_SIZE, config.batchSize ? config.batchSize : 0);
|
|
90173
|
+
instrumentation$1$1.trackValue(SESSION_CONCURRENCY_LIMIT, config.concurrency ? config.concurrency : 0);
|
|
90269
90174
|
}
|
|
90270
90175
|
// function that enqueues priming work
|
|
90271
90176
|
async enqueue(work) {
|
|
@@ -90284,6 +90189,9 @@
|
|
|
90284
90189
|
unavailableTypes,
|
|
90285
90190
|
});
|
|
90286
90191
|
if (unavailableIds.length > 0) {
|
|
90192
|
+
for (const id of unavailableIds) {
|
|
90193
|
+
this.retryTracker.delete(id);
|
|
90194
|
+
}
|
|
90287
90195
|
this.emit('error', {
|
|
90288
90196
|
ids: unavailableIds,
|
|
90289
90197
|
code: 'precondition-error',
|
|
@@ -90297,8 +90205,40 @@
|
|
|
90297
90205
|
cancel() {
|
|
90298
90206
|
this.networkWorkerPool.cancel();
|
|
90299
90207
|
}
|
|
90300
|
-
|
|
90208
|
+
handleInstrumentation(activity, stats, errors) {
|
|
90209
|
+
const schema = priming_session_batch;
|
|
90210
|
+
const userData = {
|
|
90211
|
+
...stats,
|
|
90212
|
+
};
|
|
90213
|
+
if (errors.length) {
|
|
90214
|
+
for (const error in errors) {
|
|
90215
|
+
activity.error(error, schema, userData);
|
|
90216
|
+
}
|
|
90217
|
+
}
|
|
90218
|
+
else {
|
|
90219
|
+
activity.stop(schema, userData);
|
|
90220
|
+
}
|
|
90221
|
+
}
|
|
90222
|
+
enqueueBatches(batches, paginationCount = 0) {
|
|
90301
90223
|
for (const batch of batches) {
|
|
90224
|
+
instrumentation$1$1.trackValue(SESSION_ENQUEUE_RECORD_COUNT, batch.ids.length);
|
|
90225
|
+
const o11yActivity = instrumentation$1$1.startActivity('primingSessionBatch');
|
|
90226
|
+
let stats = {
|
|
90227
|
+
idCount: 0,
|
|
90228
|
+
successCount: 0,
|
|
90229
|
+
missingCount: 0,
|
|
90230
|
+
conflictedCount: 0,
|
|
90231
|
+
wasFromPagination: false,
|
|
90232
|
+
paginationCount: 0,
|
|
90233
|
+
ingestDuration: 0,
|
|
90234
|
+
container: '',
|
|
90235
|
+
};
|
|
90236
|
+
let errors = [];
|
|
90237
|
+
if (paginationCount > 0) {
|
|
90238
|
+
stats.wasFromPagination = true;
|
|
90239
|
+
stats.paginationCount = paginationCount;
|
|
90240
|
+
}
|
|
90241
|
+
stats.idCount = batch.ids.length;
|
|
90302
90242
|
const queuedTime = Date.now();
|
|
90303
90243
|
this.networkWorkerPool.push({
|
|
90304
90244
|
workFn: (abortController) => {
|
|
@@ -90308,6 +90248,9 @@
|
|
|
90308
90248
|
.fetchRecordData(batch, abortController)
|
|
90309
90249
|
.then(async (results) => {
|
|
90310
90250
|
if (abortController.aborted) {
|
|
90251
|
+
for (const id of batch.ids) {
|
|
90252
|
+
this.retryTracker.delete(id);
|
|
90253
|
+
}
|
|
90311
90254
|
return;
|
|
90312
90255
|
}
|
|
90313
90256
|
this.emit('batch-fetched', {
|
|
@@ -90315,12 +90258,20 @@
|
|
|
90315
90258
|
duration: Date.now() - workTime,
|
|
90316
90259
|
});
|
|
90317
90260
|
for (const result of results) {
|
|
90318
|
-
this.processFetchedRecords(result, abortController);
|
|
90261
|
+
const returnedError = this.processFetchedRecords(result, abortController, stats);
|
|
90262
|
+
if (returnedError) {
|
|
90263
|
+
errors.push(returnedError);
|
|
90264
|
+
}
|
|
90319
90265
|
}
|
|
90320
|
-
this.handlePaginations(results, batch);
|
|
90266
|
+
this.handlePaginations(results, batch, paginationCount);
|
|
90267
|
+
})
|
|
90268
|
+
.finally(() => {
|
|
90269
|
+
this.handleInstrumentation(o11yActivity, stats, errors);
|
|
90321
90270
|
});
|
|
90322
90271
|
},
|
|
90323
90272
|
cancelFn: () => {
|
|
90273
|
+
errors.push('cancelled');
|
|
90274
|
+
this.handleInstrumentation(o11yActivity, stats, errors);
|
|
90324
90275
|
this.emit('error', {
|
|
90325
90276
|
ids: batch.ids,
|
|
90326
90277
|
code: 'canceled',
|
|
@@ -90330,7 +90281,7 @@
|
|
|
90330
90281
|
});
|
|
90331
90282
|
}
|
|
90332
90283
|
}
|
|
90333
|
-
handlePaginations(results, batch) {
|
|
90284
|
+
handlePaginations(results, batch, paginationCount) {
|
|
90334
90285
|
const ids = this.recordLoader.getMissingIdsWithPagination(results);
|
|
90335
90286
|
if (ids.size > 0) {
|
|
90336
90287
|
const batches = chunk(Array.from(ids), this.batchSize).map((chunkOfIds) => ({
|
|
@@ -90339,10 +90290,10 @@
|
|
|
90339
90290
|
fields: batch.fields,
|
|
90340
90291
|
objectInfo: batch.objectInfo,
|
|
90341
90292
|
}));
|
|
90342
|
-
this.enqueueBatches(batches);
|
|
90293
|
+
this.enqueueBatches(batches, paginationCount + 1);
|
|
90343
90294
|
}
|
|
90344
90295
|
}
|
|
90345
|
-
processFetchedRecords(result, abortController) {
|
|
90296
|
+
processFetchedRecords(result, abortController, stats) {
|
|
90346
90297
|
if (result.ok === false) {
|
|
90347
90298
|
const { error } = result;
|
|
90348
90299
|
let primingError = 'unknown';
|
|
@@ -90357,10 +90308,14 @@
|
|
|
90357
90308
|
code: primingError,
|
|
90358
90309
|
message: `${result.messages.join(',')}`,
|
|
90359
90310
|
});
|
|
90360
|
-
|
|
90311
|
+
for (const id of result.missingIds) {
|
|
90312
|
+
this.retryTracker.delete(id);
|
|
90313
|
+
}
|
|
90314
|
+
return error;
|
|
90361
90315
|
}
|
|
90362
90316
|
const { missingIds } = result;
|
|
90363
90317
|
if (missingIds.length > 0 && !this.recordLoader.isResultWithPagination(result)) {
|
|
90318
|
+
stats.missingCount = missingIds.length;
|
|
90364
90319
|
this.emit('error', {
|
|
90365
90320
|
ids: missingIds,
|
|
90366
90321
|
code: 'not-found',
|
|
@@ -90368,11 +90323,16 @@
|
|
|
90368
90323
|
});
|
|
90369
90324
|
}
|
|
90370
90325
|
const { records } = result;
|
|
90326
|
+
stats.successCount = records.length;
|
|
90371
90327
|
const beforeWrite = Date.now();
|
|
90372
90328
|
// dispatch the write but DO NOT wait on it to unblock the network pool
|
|
90373
90329
|
this.recordIngestor
|
|
90374
90330
|
.insertRecords(records, false)
|
|
90375
90331
|
.then(({ written, conflicted, errors }) => {
|
|
90332
|
+
instrumentation$1$1.trackValue(SESSION_INGEST_WRITTEN, written.length);
|
|
90333
|
+
instrumentation$1$1.trackValue(SESSION_INGEST_CONFLICTED, conflicted.length);
|
|
90334
|
+
instrumentation$1$1.trackValue(SESSION_INGEST_ERRORS, errors.length);
|
|
90335
|
+
stats.conflictedCount = conflicted.length;
|
|
90376
90336
|
this.emit('batch-written', {
|
|
90377
90337
|
written,
|
|
90378
90338
|
conflicted,
|
|
@@ -90380,6 +90340,17 @@
|
|
|
90380
90340
|
duration: Date.now() - beforeWrite,
|
|
90381
90341
|
});
|
|
90382
90342
|
if (abortController.aborted) {
|
|
90343
|
+
for (const id of written) {
|
|
90344
|
+
this.retryTracker.delete(id);
|
|
90345
|
+
}
|
|
90346
|
+
for (const id of conflicted) {
|
|
90347
|
+
this.retryTracker.delete(id);
|
|
90348
|
+
}
|
|
90349
|
+
for (const error of errors) {
|
|
90350
|
+
for (const id of error.ids) {
|
|
90351
|
+
this.retryTracker.delete(id);
|
|
90352
|
+
}
|
|
90353
|
+
}
|
|
90383
90354
|
return;
|
|
90384
90355
|
}
|
|
90385
90356
|
if (errors.length > 0) {
|
|
@@ -90389,11 +90360,17 @@
|
|
|
90389
90360
|
code: 'unknown',
|
|
90390
90361
|
message: message,
|
|
90391
90362
|
});
|
|
90363
|
+
for (const id of ids) {
|
|
90364
|
+
this.retryTracker.delete(id);
|
|
90365
|
+
}
|
|
90392
90366
|
});
|
|
90393
90367
|
}
|
|
90394
90368
|
// now that the records are persisted, emit the primed event
|
|
90395
90369
|
if (written.length > 0) {
|
|
90396
90370
|
this.emit('primed', Array.from(written));
|
|
90371
|
+
for (const id of written) {
|
|
90372
|
+
this.retryTracker.delete(id);
|
|
90373
|
+
}
|
|
90397
90374
|
}
|
|
90398
90375
|
// if any records could not be written to the store because there were conflicts, handle the conflicts
|
|
90399
90376
|
if (conflicted.length > 0) {
|
|
@@ -90404,14 +90381,39 @@
|
|
|
90404
90381
|
async handleWriteConflicts(records, conflicted, abortController) {
|
|
90405
90382
|
const result = await this.conflictPool.enqueueConflictedRecords(records.filter((x) => conflicted.includes(x.id)), abortController);
|
|
90406
90383
|
if (abortController.aborted) {
|
|
90384
|
+
for (const id of conflicted) {
|
|
90385
|
+
this.retryTracker.delete(id);
|
|
90386
|
+
}
|
|
90407
90387
|
return;
|
|
90408
90388
|
}
|
|
90409
|
-
if (
|
|
90389
|
+
if (keys$2$1(result.additionalWork.records).length > 0) {
|
|
90410
90390
|
this.emit('conflict', {
|
|
90411
90391
|
ids: Object.values(result.additionalWork.records).flatMap((record) => record.ids),
|
|
90412
90392
|
resolution: 'priming-refresh',
|
|
90413
90393
|
});
|
|
90414
|
-
|
|
90394
|
+
// we're re-enqueuing here, so apply retry limits which may change the batches
|
|
90395
|
+
let limitedResult = this.applyRetryLimits(result.additionalWork);
|
|
90396
|
+
this.enqueue(limitedResult.additionalWork);
|
|
90397
|
+
if (limitedResult.recordsNeedingRefetch.size > 0) {
|
|
90398
|
+
for (const key in keys$2$1(limitedResult.recordsNeedingRefetch)) {
|
|
90399
|
+
const value = limitedResult.recordsNeedingRefetch.get(key);
|
|
90400
|
+
if (result.recordsNeedingRefetch.has(key)) {
|
|
90401
|
+
let existing = result.recordsNeedingRefetch.get(key);
|
|
90402
|
+
existing = {
|
|
90403
|
+
// merge the ids
|
|
90404
|
+
ids: [...existing.ids, ...value.ids],
|
|
90405
|
+
// This is safe because they derive from the same
|
|
90406
|
+
// input, no chance of getting a new field in the
|
|
90407
|
+
// limited result
|
|
90408
|
+
fields: existing.fields,
|
|
90409
|
+
};
|
|
90410
|
+
result.recordsNeedingRefetch.set(key, existing);
|
|
90411
|
+
}
|
|
90412
|
+
else {
|
|
90413
|
+
result.recordsNeedingRefetch.set(key, value);
|
|
90414
|
+
}
|
|
90415
|
+
}
|
|
90416
|
+
}
|
|
90415
90417
|
}
|
|
90416
90418
|
if (result.resolvedRecords.length > 0) {
|
|
90417
90419
|
this.emit('conflict', {
|
|
@@ -90419,8 +90421,14 @@
|
|
|
90419
90421
|
resolution: 'priming-merge',
|
|
90420
90422
|
});
|
|
90421
90423
|
this.emit('primed', result.resolvedRecords);
|
|
90424
|
+
for (const id of result.resolvedRecords) {
|
|
90425
|
+
this.retryTracker.delete(id);
|
|
90426
|
+
}
|
|
90422
90427
|
}
|
|
90423
90428
|
if (result.recordsToWrite.length > 0) {
|
|
90429
|
+
for (const record of result.recordsToWrite) {
|
|
90430
|
+
this.retryTracker.delete(record.id);
|
|
90431
|
+
}
|
|
90424
90432
|
const { written, errors, conflicted } = await this.recordIngestor.insertRecords(result.recordsToWrite, true);
|
|
90425
90433
|
if (written.length > 0) {
|
|
90426
90434
|
const ids = Array.from(written);
|
|
@@ -90447,10 +90455,16 @@
|
|
|
90447
90455
|
if (result.recordsNeedingRefetch.size > 0) {
|
|
90448
90456
|
const { loaded, errored } = await this.ldsRecordRefresher.loadRecords(result.recordsNeedingRefetch);
|
|
90449
90457
|
if (loaded.length > 0) {
|
|
90458
|
+
for (const id of loaded) {
|
|
90459
|
+
this.retryTracker.delete(id);
|
|
90460
|
+
}
|
|
90450
90461
|
this.emit('conflict', { resolution: 'lds-refresh', ids: loaded });
|
|
90451
90462
|
this.emit('primed', loaded);
|
|
90452
90463
|
}
|
|
90453
90464
|
if (errored.length > 0) {
|
|
90465
|
+
for (const id of errored) {
|
|
90466
|
+
this.retryTracker.delete(id);
|
|
90467
|
+
}
|
|
90454
90468
|
this.emit('error', {
|
|
90455
90469
|
ids: errored,
|
|
90456
90470
|
code: 'unknown',
|
|
@@ -90459,6 +90473,50 @@
|
|
|
90459
90473
|
}
|
|
90460
90474
|
}
|
|
90461
90475
|
}
|
|
90476
|
+
applyRetryLimits(primingWork) {
|
|
90477
|
+
// retryable work goes back into priming session
|
|
90478
|
+
let retryableWork = {
|
|
90479
|
+
type: 'record-fields',
|
|
90480
|
+
records: {},
|
|
90481
|
+
};
|
|
90482
|
+
// refetchable work gets delegated to getRecords
|
|
90483
|
+
let refetchableWork = new Map();
|
|
90484
|
+
for (const key of keys$2$1(primingWork.records)) {
|
|
90485
|
+
let work = primingWork.records[key];
|
|
90486
|
+
let limitedIds = [];
|
|
90487
|
+
for (const id of work.ids) {
|
|
90488
|
+
let retryCount = this.retryTracker.get(id) || 0;
|
|
90489
|
+
retryCount += 1;
|
|
90490
|
+
if (retryCount > MAX_RETRY_COUNT) {
|
|
90491
|
+
limitedIds.push(id);
|
|
90492
|
+
this.retryTracker.delete(id);
|
|
90493
|
+
}
|
|
90494
|
+
else {
|
|
90495
|
+
this.retryTracker.set(id, retryCount);
|
|
90496
|
+
}
|
|
90497
|
+
}
|
|
90498
|
+
if (limitedIds.length < work.ids.length) {
|
|
90499
|
+
retryableWork.records[key] = {
|
|
90500
|
+
ids: work.ids.filter((id) => limitedIds.indexOf(id) === -1),
|
|
90501
|
+
fields: work.fields,
|
|
90502
|
+
};
|
|
90503
|
+
}
|
|
90504
|
+
if (limitedIds.length > 0) {
|
|
90505
|
+
this.emit('retry-limit-reached', { ids: limitedIds });
|
|
90506
|
+
refetchableWork.set(key, {
|
|
90507
|
+
ids: limitedIds,
|
|
90508
|
+
fields: work.fields,
|
|
90509
|
+
});
|
|
90510
|
+
}
|
|
90511
|
+
}
|
|
90512
|
+
return {
|
|
90513
|
+
additionalWork: retryableWork,
|
|
90514
|
+
recordsNeedingRefetch: refetchableWork,
|
|
90515
|
+
resolvedRecords: [],
|
|
90516
|
+
recordsToWrite: [],
|
|
90517
|
+
errors: [],
|
|
90518
|
+
};
|
|
90519
|
+
}
|
|
90462
90520
|
async fetchMetadata(batches) {
|
|
90463
90521
|
const apiNames = Array.from(batches.reduce((acc, x) => {
|
|
90464
90522
|
return acc.add(x.type);
|
|
@@ -90466,20 +90524,20 @@
|
|
|
90466
90524
|
const objectInfoMap = await this.objectInfoLoader.getObjectInfos(apiNames);
|
|
90467
90525
|
const unavailableTypes = apiNames.filter((x) => !objectInfoMap[x]);
|
|
90468
90526
|
const availableTypes = apiNames.filter((x) => objectInfoMap[x]);
|
|
90469
|
-
const
|
|
90527
|
+
const unavailableBatches = batches.filter((x) => unavailableTypes.includes(x.type));
|
|
90470
90528
|
const availableBatches = batches
|
|
90471
90529
|
.filter((x) => !unavailableTypes.includes(x.type))
|
|
90472
90530
|
.map((x) => {
|
|
90473
90531
|
return { ...x, objectInfo: objectInfoMap[x.type] };
|
|
90474
90532
|
});
|
|
90475
|
-
const unavailableIds =
|
|
90533
|
+
const unavailableIds = unavailableBatches.reduce((acc, x) => {
|
|
90476
90534
|
acc.push(...x.ids);
|
|
90477
90535
|
return acc;
|
|
90478
90536
|
}, []);
|
|
90479
90537
|
return {
|
|
90480
90538
|
apiNames,
|
|
90481
90539
|
availableBatches,
|
|
90482
|
-
|
|
90540
|
+
unavailableBatches,
|
|
90483
90541
|
unavailableTypes,
|
|
90484
90542
|
availableTypes,
|
|
90485
90543
|
unavailableIds,
|
|
@@ -90709,7 +90767,9 @@
|
|
|
90709
90767
|
return acc;
|
|
90710
90768
|
}, {});
|
|
90711
90769
|
fields['Id'] = { value: id, displayValue: null };
|
|
90712
|
-
fields['RecordTypeId']
|
|
90770
|
+
if (objectInfo.fields['RecordTypeId'] !== undefined) {
|
|
90771
|
+
fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
|
|
90772
|
+
}
|
|
90713
90773
|
let recordTypeInfo = null;
|
|
90714
90774
|
if (recordTypeId !== null &&
|
|
90715
90775
|
objectInfo.recordTypeInfos &&
|
|
@@ -91004,12 +91064,10 @@
|
|
|
91004
91064
|
}
|
|
91005
91065
|
|
|
91006
91066
|
function instrumentPrimingSession(session) {
|
|
91007
|
-
reportPrimingSessionCreated();
|
|
91008
91067
|
session.on('error', ({ code, ids }) => {
|
|
91009
91068
|
reportPrimingError(code, ids.length);
|
|
91010
91069
|
});
|
|
91011
91070
|
session.on('primed', ({ length }) => {
|
|
91012
|
-
reportPrimingSuccess(length);
|
|
91013
91071
|
});
|
|
91014
91072
|
session.on('conflict', ({ ids, resolution }) => {
|
|
91015
91073
|
reportPrimingConflict(resolution, ids.length);
|
|
@@ -92618,7 +92676,7 @@
|
|
|
92618
92676
|
return storeRecord.__type === 'error';
|
|
92619
92677
|
}
|
|
92620
92678
|
|
|
92621
|
-
const instrumentation$
|
|
92679
|
+
const instrumentation$3 = getInstrumentation();
|
|
92622
92680
|
const ProductConsumed = {
|
|
92623
92681
|
API_NAME: 'ProductConsumed',
|
|
92624
92682
|
Fields: {
|
|
@@ -92676,7 +92734,6 @@
|
|
|
92676
92734
|
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92677
92735
|
if (originalRecord === undefined) {
|
|
92678
92736
|
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92679
|
-
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} not found`);
|
|
92680
92737
|
return [];
|
|
92681
92738
|
}
|
|
92682
92739
|
const originalProductItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
@@ -92687,7 +92744,6 @@
|
|
|
92687
92744
|
}
|
|
92688
92745
|
if (originalQuantityConsumed === undefined) {
|
|
92689
92746
|
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92690
|
-
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92691
92747
|
return [];
|
|
92692
92748
|
}
|
|
92693
92749
|
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Created);
|
|
@@ -92714,7 +92770,6 @@
|
|
|
92714
92770
|
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92715
92771
|
if (originalRecord === undefined) {
|
|
92716
92772
|
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92717
|
-
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} not found`);
|
|
92718
92773
|
return [];
|
|
92719
92774
|
}
|
|
92720
92775
|
const productItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
@@ -92725,7 +92780,6 @@
|
|
|
92725
92780
|
}
|
|
92726
92781
|
if (quantityConsumed === undefined) {
|
|
92727
92782
|
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92728
|
-
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92729
92783
|
return [];
|
|
92730
92784
|
}
|
|
92731
92785
|
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Created);
|
|
@@ -92780,7 +92834,7 @@
|
|
|
92780
92834
|
CounterResult["Error"] = "Error";
|
|
92781
92835
|
})(CounterResult || (CounterResult = {}));
|
|
92782
92836
|
function incrementCounter(name, result) {
|
|
92783
|
-
instrumentation$
|
|
92837
|
+
instrumentation$3.incrementCounter('SFSSideEffect', 1, result == CounterResult.Error, {
|
|
92784
92838
|
Name: name,
|
|
92785
92839
|
Result: result,
|
|
92786
92840
|
});
|
|
@@ -92985,7 +93039,7 @@
|
|
|
92985
93039
|
id: '@salesforce/lds-network-adapter',
|
|
92986
93040
|
instrument: instrument$2,
|
|
92987
93041
|
});
|
|
92988
|
-
// version: 1.
|
|
93042
|
+
// version: 1.353.0-cc9b469dc4
|
|
92989
93043
|
|
|
92990
93044
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92991
93045
|
const { stringify, parse } = JSON;
|
|
@@ -116880,7 +116934,7 @@
|
|
|
116880
116934
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116881
116935
|
instrument: instrument$1,
|
|
116882
116936
|
});
|
|
116883
|
-
// version: 1.
|
|
116937
|
+
// version: 1.353.0-330d59cfcb
|
|
116884
116938
|
|
|
116885
116939
|
// On core the unstable adapters are re-exported with different names,
|
|
116886
116940
|
// we want to match them here.
|
|
@@ -117032,7 +117086,7 @@
|
|
|
117032
117086
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
117033
117087
|
graphQLImperative = ldsAdapter;
|
|
117034
117088
|
});
|
|
117035
|
-
// version: 1.
|
|
117089
|
+
// version: 1.353.0-330d59cfcb
|
|
117036
117090
|
|
|
117037
117091
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
117038
117092
|
__proto__: null,
|
|
@@ -117824,7 +117878,7 @@
|
|
|
117824
117878
|
function register(r) {
|
|
117825
117879
|
callbacks$1.forEach((callback) => callback(r));
|
|
117826
117880
|
}
|
|
117827
|
-
// version: 1.
|
|
117881
|
+
// version: 1.353.0-cc9b469dc4
|
|
117828
117882
|
|
|
117829
117883
|
/**
|
|
117830
117884
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118923,4 +118977,4 @@
|
|
|
118923
118977
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
118924
118978
|
|
|
118925
118979
|
}));
|
|
118926
|
-
// version: 1.
|
|
118980
|
+
// version: 1.353.0-cc9b469dc4
|