@salesforce/lds-worker-api 1.348.1 → 1.350.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.
|
@@ -1128,4 +1128,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
1130
1130
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
1131
|
-
// version: 1.
|
|
1131
|
+
// version: 1.350.0-c9c684f956
|
|
@@ -4266,7 +4266,7 @@ function withDefaultLuvio(callback) {
|
|
|
4266
4266
|
}
|
|
4267
4267
|
callbacks.push(callback);
|
|
4268
4268
|
}
|
|
4269
|
-
// version: 1.
|
|
4269
|
+
// version: 1.350.0-c9c684f956
|
|
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) {
|
|
@@ -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.350.0-c9c684f956
|
|
5218
5218
|
|
|
5219
5219
|
/**
|
|
5220
5220
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -29832,6 +29832,7 @@ const getKeywordSearchResults_ConfigPropertyMetadata$1 = [
|
|
|
29832
29832
|
generateParamConfigMetadata$3('objectApiName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29833
29833
|
generateParamConfigMetadata$3('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29834
29834
|
generateParamConfigMetadata$3('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
29835
|
+
generateParamConfigMetadata$3('dataCategories', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29835
29836
|
generateParamConfigMetadata$3('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29836
29837
|
generateParamConfigMetadata$3('pageSize', false, 2 /* Body */, 3 /* Integer */),
|
|
29837
29838
|
generateParamConfigMetadata$3('pageToken', false, 2 /* Body */, 0 /* String */),
|
|
@@ -29846,6 +29847,18 @@ function keyBuilder$a$2(luvio, config) {
|
|
|
29846
29847
|
function typeCheckConfig$c$1(untrustedConfig) {
|
|
29847
29848
|
const config = {};
|
|
29848
29849
|
typeCheckConfig$18(untrustedConfig, config, getKeywordSearchResults_ConfigPropertyMetadata$1);
|
|
29850
|
+
const untrustedConfig_dataCategories = untrustedConfig.dataCategories;
|
|
29851
|
+
if (ArrayIsArray$1$1(untrustedConfig_dataCategories)) {
|
|
29852
|
+
const untrustedConfig_dataCategories_array = [];
|
|
29853
|
+
for (let i = 0, arrayLength = untrustedConfig_dataCategories.length; i < arrayLength; i++) {
|
|
29854
|
+
const untrustedConfig_dataCategories_item = untrustedConfig_dataCategories[i];
|
|
29855
|
+
const referenceSearchDataCategoryInputRepresentationValidationError = validate$n(untrustedConfig_dataCategories_item);
|
|
29856
|
+
if (referenceSearchDataCategoryInputRepresentationValidationError === null) {
|
|
29857
|
+
untrustedConfig_dataCategories_array.push(untrustedConfig_dataCategories_item);
|
|
29858
|
+
}
|
|
29859
|
+
}
|
|
29860
|
+
config.dataCategories = untrustedConfig_dataCategories_array;
|
|
29861
|
+
}
|
|
29849
29862
|
const untrustedConfig_filters = untrustedConfig.filters;
|
|
29850
29863
|
if (ArrayIsArray$1$1(untrustedConfig_filters)) {
|
|
29851
29864
|
const untrustedConfig_filters_array = [];
|
|
@@ -33971,7 +33984,7 @@ withDefaultLuvio((luvio) => {
|
|
|
33971
33984
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33972
33985
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33973
33986
|
});
|
|
33974
|
-
// version: 1.
|
|
33987
|
+
// version: 1.350.0-4e181805d5
|
|
33975
33988
|
|
|
33976
33989
|
/**
|
|
33977
33990
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -45561,7 +45574,7 @@ var graphqlL2AdapterGate = {
|
|
|
45561
45574
|
},
|
|
45562
45575
|
};
|
|
45563
45576
|
|
|
45564
|
-
var
|
|
45577
|
+
var productConsumedSideEffects = {
|
|
45565
45578
|
isOpen: function (e) {
|
|
45566
45579
|
return e.fallback;
|
|
45567
45580
|
},
|
|
@@ -45591,7 +45604,7 @@ const { entries: entries$3, keys: keys$5 } = Object;
|
|
|
45591
45604
|
|
|
45592
45605
|
const UI_API_BASE_URI = '/services/data/v64.0/ui-api';
|
|
45593
45606
|
|
|
45594
|
-
let instrumentation$
|
|
45607
|
+
let instrumentation$1$1 = {
|
|
45595
45608
|
aggregateUiChunkCount: (_cb) => { },
|
|
45596
45609
|
aggregateUiConnectError: () => { },
|
|
45597
45610
|
duplicateRequest: (_cb) => { },
|
|
@@ -45603,7 +45616,7 @@ let instrumentation$2 = {
|
|
|
45603
45616
|
networkRateLimitExceeded: () => { },
|
|
45604
45617
|
};
|
|
45605
45618
|
function instrument$2(newInstrumentation) {
|
|
45606
|
-
instrumentation$
|
|
45619
|
+
instrumentation$1$1 = Object.assign(instrumentation$1$1, newInstrumentation);
|
|
45607
45620
|
}
|
|
45608
45621
|
|
|
45609
45622
|
const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
|
|
@@ -45673,7 +45686,7 @@ function mergeRecordFields$2(first, second) {
|
|
|
45673
45686
|
* would otherwise cause a query length exception.
|
|
45674
45687
|
*/
|
|
45675
45688
|
function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resourceRequest, resourceRequestContext) {
|
|
45676
|
-
instrumentation$
|
|
45689
|
+
instrumentation$1$1.getRecordAggregateInvoke();
|
|
45677
45690
|
return networkAdapter(resourceRequest, resourceRequestContext).then((resp) => {
|
|
45678
45691
|
const { body } = resp;
|
|
45679
45692
|
// This response body could be an executeAggregateUi, which we don't natively support.
|
|
@@ -45689,7 +45702,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
45689
45702
|
}
|
|
45690
45703
|
const merged = body.compositeResponse.reduce((seed, response) => {
|
|
45691
45704
|
if (response.httpStatusCode !== HttpStatusCode$1.Ok) {
|
|
45692
|
-
instrumentation$
|
|
45705
|
+
instrumentation$1$1.getRecordAggregateReject(() => recordId);
|
|
45693
45706
|
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
45694
45707
|
error: response.message,
|
|
45695
45708
|
});
|
|
@@ -45699,7 +45712,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
45699
45712
|
}
|
|
45700
45713
|
return mergeRecordFields$2(seed, response.body);
|
|
45701
45714
|
}, null);
|
|
45702
|
-
instrumentation$
|
|
45715
|
+
instrumentation$1$1.getRecordAggregateResolve(() => {
|
|
45703
45716
|
return {
|
|
45704
45717
|
recordId,
|
|
45705
45718
|
apiName: merged.apiName,
|
|
@@ -45707,7 +45720,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
45707
45720
|
});
|
|
45708
45721
|
return createOkResponse$1(merged);
|
|
45709
45722
|
}, (err) => {
|
|
45710
|
-
instrumentation$
|
|
45723
|
+
instrumentation$1$1.getRecordAggregateReject(() => recordId);
|
|
45711
45724
|
// rethrow error
|
|
45712
45725
|
throw err;
|
|
45713
45726
|
});
|
|
@@ -45785,7 +45798,7 @@ function buildAndDispatchGetRecordAggregateUi(recordId, req, params) {
|
|
|
45785
45798
|
const { networkAdapter, resourceRequest, resourceRequestContext } = req;
|
|
45786
45799
|
const compositeRequest = buildGetRecordByFieldsCompositeRequest(resourceRequest, params);
|
|
45787
45800
|
// W-12245125: Emit chunk size metrics
|
|
45788
|
-
instrumentation$
|
|
45801
|
+
instrumentation$1$1.aggregateUiChunkCount(() => compositeRequest.length);
|
|
45789
45802
|
const aggregateUiParams = {
|
|
45790
45803
|
compositeRequest,
|
|
45791
45804
|
};
|
|
@@ -46019,7 +46032,7 @@ function platformNetworkAdapter(baseNetworkAdapter) {
|
|
|
46019
46032
|
return (resourceRequest, resourceRequestContext) => {
|
|
46020
46033
|
if (!tokenBucket.take(1)) {
|
|
46021
46034
|
// We are hitting rate limiting, add some metrics
|
|
46022
|
-
instrumentation$
|
|
46035
|
+
instrumentation$1$1.networkRateLimitExceeded();
|
|
46023
46036
|
}
|
|
46024
46037
|
const salesforceRequest = {
|
|
46025
46038
|
networkAdapter: baseNetworkAdapter,
|
|
@@ -79975,7 +79988,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
79975
79988
|
}
|
|
79976
79989
|
}
|
|
79977
79990
|
for (const trigger of hookTriggers) {
|
|
79978
|
-
const hookEffects = await trigger.then(action.id, action.timestamp, action.targetId, action.data.body
|
|
79991
|
+
const hookEffects = await trigger.then(action.id, action.timestamp, action.targetId, action.data.body?.fields ?? {});
|
|
79979
79992
|
for (const hookEffect of hookEffects) {
|
|
79980
79993
|
effects.push(hookEffect);
|
|
79981
79994
|
}
|
|
@@ -90298,6 +90311,7 @@ class PrimingSession extends EventEmitter {
|
|
|
90298
90311
|
for (const result of results) {
|
|
90299
90312
|
this.processFetchedRecords(result, abortController);
|
|
90300
90313
|
}
|
|
90314
|
+
this.handlePaginations(results, batch);
|
|
90301
90315
|
});
|
|
90302
90316
|
},
|
|
90303
90317
|
cancelFn: () => {
|
|
@@ -90310,6 +90324,18 @@ class PrimingSession extends EventEmitter {
|
|
|
90310
90324
|
});
|
|
90311
90325
|
}
|
|
90312
90326
|
}
|
|
90327
|
+
handlePaginations(results, batch) {
|
|
90328
|
+
const ids = this.recordLoader.getMissingIdsWithPagination(results);
|
|
90329
|
+
if (ids.size > 0) {
|
|
90330
|
+
const batches = chunk(Array.from(ids), this.batchSize).map((chunkOfIds) => ({
|
|
90331
|
+
type: batch.type,
|
|
90332
|
+
ids: chunkOfIds,
|
|
90333
|
+
fields: batch.fields,
|
|
90334
|
+
objectInfo: batch.objectInfo,
|
|
90335
|
+
}));
|
|
90336
|
+
this.enqueueBatches(batches);
|
|
90337
|
+
}
|
|
90338
|
+
}
|
|
90313
90339
|
processFetchedRecords(result, abortController) {
|
|
90314
90340
|
if (result.ok === false) {
|
|
90315
90341
|
const { error } = result;
|
|
@@ -90328,7 +90354,7 @@ class PrimingSession extends EventEmitter {
|
|
|
90328
90354
|
return;
|
|
90329
90355
|
}
|
|
90330
90356
|
const { missingIds } = result;
|
|
90331
|
-
if (missingIds.length > 0) {
|
|
90357
|
+
if (missingIds.length > 0 && !this.recordLoader.isResultWithPagination(result)) {
|
|
90332
90358
|
this.emit('error', {
|
|
90333
90359
|
ids: missingIds,
|
|
90334
90360
|
code: 'not-found',
|
|
@@ -90537,6 +90563,18 @@ class NetworkRecordLoader {
|
|
|
90537
90563
|
}
|
|
90538
90564
|
}
|
|
90539
90565
|
}
|
|
90566
|
+
isResultWithPagination(result) {
|
|
90567
|
+
return 'paginationToken' in result;
|
|
90568
|
+
}
|
|
90569
|
+
getMissingIdsWithPagination(results) {
|
|
90570
|
+
const ids = new Set();
|
|
90571
|
+
results.forEach((result) => {
|
|
90572
|
+
if (this.isResultWithPagination(result)) {
|
|
90573
|
+
result.missingIds.forEach((id) => ids.add(id));
|
|
90574
|
+
}
|
|
90575
|
+
});
|
|
90576
|
+
return ids;
|
|
90577
|
+
}
|
|
90540
90578
|
async sendRequest(request, abortController) {
|
|
90541
90579
|
let response = await this.networkAdapter.sendRequest(request, abortController);
|
|
90542
90580
|
if (response.status < 200 || response.status > 299) {
|
|
@@ -90896,7 +90934,15 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
|
|
|
90896
90934
|
generateSelect(batch) {
|
|
90897
90935
|
let fieldSet = new Set(batch.fields);
|
|
90898
90936
|
for (const field of requiredSoqlFields) {
|
|
90899
|
-
|
|
90937
|
+
if (batch.objectInfo.fields[field] !== undefined) {
|
|
90938
|
+
fieldSet.add(field);
|
|
90939
|
+
}
|
|
90940
|
+
}
|
|
90941
|
+
// determine if this object has multiple record types. if so, add RecordTypeId to the query.
|
|
90942
|
+
// if there is only a master record type, then requesting RecordTypeId will fail.
|
|
90943
|
+
const recordTypeInfos = batch.objectInfo.recordTypeInfos;
|
|
90944
|
+
if (Object.keys(recordTypeInfos).length > 1) {
|
|
90945
|
+
fieldSet.add('RecordTypeId');
|
|
90900
90946
|
}
|
|
90901
90947
|
const fields = Array.from(fieldSet);
|
|
90902
90948
|
// We will have SOQL format specific data types for us by adding a format() value.
|
|
@@ -90916,12 +90962,6 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
|
|
|
90916
90962
|
fields.push(`toLabel(${field}) ${field}___display`);
|
|
90917
90963
|
}
|
|
90918
90964
|
}
|
|
90919
|
-
// determine if this object has multiple record types. if so, add RecordTypeId to the query.
|
|
90920
|
-
// if there is only a master record type, then requesting RecordTypeId will fail.
|
|
90921
|
-
const recordTypeInfos = batch.objectInfo.recordTypeInfos;
|
|
90922
|
-
if (Object.keys(recordTypeInfos).length > 1) {
|
|
90923
|
-
fields.push('RecordTypeId');
|
|
90924
|
-
}
|
|
90925
90965
|
const query = `SELECT ${fields.join(',')} FROM ${batch.type} `;
|
|
90926
90966
|
// console.log(`DUSTIN: soql batch query: ${query}`);
|
|
90927
90967
|
return query;
|
|
@@ -90952,6 +90992,7 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
|
|
|
90952
90992
|
ok: true,
|
|
90953
90993
|
records,
|
|
90954
90994
|
missingIds: Array.from(missingRecordIds),
|
|
90995
|
+
...(queryResult.nextRecordsUrl && { paginationToken: queryResult.nextRecordsUrl }),
|
|
90955
90996
|
};
|
|
90956
90997
|
}
|
|
90957
90998
|
}
|
|
@@ -92571,17 +92612,183 @@ function isStoreRecordError(storeRecord) {
|
|
|
92571
92612
|
return storeRecord.__type === 'error';
|
|
92572
92613
|
}
|
|
92573
92614
|
|
|
92615
|
+
const instrumentation$2 = getInstrumentation();
|
|
92616
|
+
const ProductConsumed = {
|
|
92617
|
+
API_NAME: 'ProductConsumed',
|
|
92618
|
+
Fields: {
|
|
92619
|
+
PRODUCT_ITEM_ID: 'ProductItemId',
|
|
92620
|
+
QUANTITY_CONSUMED: 'QuantityConsumed',
|
|
92621
|
+
},
|
|
92622
|
+
};
|
|
92623
|
+
const ProductItem = {
|
|
92624
|
+
Fields: {
|
|
92625
|
+
QUANTITY_ON_HAND: 'QuantityOnHand',
|
|
92626
|
+
},
|
|
92627
|
+
};
|
|
92628
|
+
class ProductConsumedCreatedHook {
|
|
92629
|
+
constructor() {
|
|
92630
|
+
this.on = 'post';
|
|
92631
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92632
|
+
}
|
|
92633
|
+
async then(draftActionId, draftActionTimestamp, _draftRecordId, fields) {
|
|
92634
|
+
const productItemId = getProductItemId(fields);
|
|
92635
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92636
|
+
if (productItemId === undefined) {
|
|
92637
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92638
|
+
return [];
|
|
92639
|
+
}
|
|
92640
|
+
if (quantityConsumed === undefined) {
|
|
92641
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92642
|
+
return [];
|
|
92643
|
+
}
|
|
92644
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92645
|
+
const effect = {
|
|
92646
|
+
type: 'record-field-increment',
|
|
92647
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92648
|
+
value: -quantityConsumed,
|
|
92649
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92650
|
+
tag: draftActionId,
|
|
92651
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92652
|
+
timestamp: draftActionTimestamp,
|
|
92653
|
+
};
|
|
92654
|
+
return [effect];
|
|
92655
|
+
}
|
|
92656
|
+
}
|
|
92657
|
+
ProductConsumedCreatedHook.COUNTER_NAME = 'ProductConsumedCreatedHook';
|
|
92658
|
+
class ProductConsumedUpdatedHook {
|
|
92659
|
+
constructor(durableRecordStore) {
|
|
92660
|
+
this.durableRecordStore = durableRecordStore;
|
|
92661
|
+
this.on = 'patch';
|
|
92662
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92663
|
+
}
|
|
92664
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId, fields) {
|
|
92665
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92666
|
+
if (quantityConsumed === undefined) {
|
|
92667
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92668
|
+
return [];
|
|
92669
|
+
}
|
|
92670
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92671
|
+
if (originalRecord === undefined) {
|
|
92672
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92673
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} not found`);
|
|
92674
|
+
return [];
|
|
92675
|
+
}
|
|
92676
|
+
const originalProductItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92677
|
+
const originalQuantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92678
|
+
if (originalProductItemId === undefined) {
|
|
92679
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92680
|
+
return [];
|
|
92681
|
+
}
|
|
92682
|
+
if (originalQuantityConsumed === undefined) {
|
|
92683
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92684
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92685
|
+
return [];
|
|
92686
|
+
}
|
|
92687
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92688
|
+
const effect = {
|
|
92689
|
+
type: 'record-field-increment',
|
|
92690
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92691
|
+
value: originalQuantityConsumed - quantityConsumed,
|
|
92692
|
+
key: buildRecordRepKeyFromId$1(originalProductItemId),
|
|
92693
|
+
tag: draftActionId,
|
|
92694
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92695
|
+
timestamp: draftActionTimestamp,
|
|
92696
|
+
};
|
|
92697
|
+
return [effect];
|
|
92698
|
+
}
|
|
92699
|
+
}
|
|
92700
|
+
ProductConsumedUpdatedHook.COUNTER_NAME = 'ProductConsumedUpdatedHook';
|
|
92701
|
+
class ProductConsumedDeletedHook {
|
|
92702
|
+
constructor(durableRecordStore) {
|
|
92703
|
+
this.durableRecordStore = durableRecordStore;
|
|
92704
|
+
this.on = 'delete';
|
|
92705
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92706
|
+
}
|
|
92707
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId) {
|
|
92708
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92709
|
+
if (originalRecord === undefined) {
|
|
92710
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92711
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} not found`);
|
|
92712
|
+
return [];
|
|
92713
|
+
}
|
|
92714
|
+
const productItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92715
|
+
const quantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92716
|
+
if (productItemId === undefined) {
|
|
92717
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92718
|
+
return [];
|
|
92719
|
+
}
|
|
92720
|
+
if (quantityConsumed === undefined) {
|
|
92721
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92722
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92723
|
+
return [];
|
|
92724
|
+
}
|
|
92725
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Created);
|
|
92726
|
+
const effect = {
|
|
92727
|
+
type: 'record-field-increment',
|
|
92728
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92729
|
+
value: quantityConsumed,
|
|
92730
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92731
|
+
tag: draftActionId,
|
|
92732
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92733
|
+
timestamp: draftActionTimestamp,
|
|
92734
|
+
};
|
|
92735
|
+
return [effect];
|
|
92736
|
+
}
|
|
92737
|
+
}
|
|
92738
|
+
ProductConsumedDeletedHook.COUNTER_NAME = 'ProductConsumedDeletedHook';
|
|
92739
|
+
function getProductItemId(fields) {
|
|
92740
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92741
|
+
if (field === undefined || typeof field !== 'string') {
|
|
92742
|
+
return undefined;
|
|
92743
|
+
}
|
|
92744
|
+
return field;
|
|
92745
|
+
}
|
|
92746
|
+
function getProductItemIdFromRecordFields(fields) {
|
|
92747
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92748
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'string') {
|
|
92749
|
+
return undefined;
|
|
92750
|
+
}
|
|
92751
|
+
return field.value;
|
|
92752
|
+
}
|
|
92753
|
+
function getQuantityConsumed(fields) {
|
|
92754
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92755
|
+
if (field === undefined || typeof field !== 'number') {
|
|
92756
|
+
return undefined;
|
|
92757
|
+
}
|
|
92758
|
+
return field;
|
|
92759
|
+
}
|
|
92760
|
+
function getQuantityConsumedFromRecordFields(fields) {
|
|
92761
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92762
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'number') {
|
|
92763
|
+
return undefined;
|
|
92764
|
+
}
|
|
92765
|
+
return field.value;
|
|
92766
|
+
}
|
|
92767
|
+
var CounterResult;
|
|
92768
|
+
(function (CounterResult) {
|
|
92769
|
+
// A side effect was created.
|
|
92770
|
+
CounterResult["Created"] = "Created";
|
|
92771
|
+
// The hook exited early.
|
|
92772
|
+
CounterResult["Exited"] = "Exited";
|
|
92773
|
+
// An unexpected error occurred.
|
|
92774
|
+
CounterResult["Error"] = "Error";
|
|
92775
|
+
})(CounterResult || (CounterResult = {}));
|
|
92776
|
+
function incrementCounter(name, result) {
|
|
92777
|
+
instrumentation$2.incrementCounter('SFSSideEffect', 1, result == CounterResult.Error, {
|
|
92778
|
+
Name: name,
|
|
92779
|
+
Result: result,
|
|
92780
|
+
});
|
|
92781
|
+
}
|
|
92782
|
+
|
|
92574
92783
|
function createSfsSideEffectHooks(durableRecordStore) {
|
|
92575
|
-
if (
|
|
92576
|
-
return [
|
|
92784
|
+
if (productConsumedSideEffects.isOpen({ fallback: false })) {
|
|
92785
|
+
return [
|
|
92786
|
+
new ProductConsumedCreatedHook(),
|
|
92787
|
+
new ProductConsumedUpdatedHook(durableRecordStore),
|
|
92788
|
+
new ProductConsumedDeletedHook(durableRecordStore),
|
|
92789
|
+
];
|
|
92577
92790
|
}
|
|
92578
|
-
return [
|
|
92579
|
-
// SFS FSCore needs to implement code to bypass it's existing "side effect" code for Product Consumed.
|
|
92580
|
-
// W-17683696 is the work that will enable the code below after FSCore's W-17422735 is completed.
|
|
92581
|
-
// new ProductConsumedCreatedHook(),
|
|
92582
|
-
// new ProductConsumedUpdatedHook(durableRecordStore),
|
|
92583
|
-
// new ProductConsumedDeletedHook(durableRecordStore),
|
|
92584
|
-
];
|
|
92791
|
+
return [];
|
|
92585
92792
|
}
|
|
92586
92793
|
|
|
92587
92794
|
// so eslint doesn't complain about nimbus
|
|
@@ -92664,7 +92871,7 @@ function getRuntime() {
|
|
|
92664
92871
|
lazySideEffectService = new SideEffectService(lazyDurableRecordStore, lazyObjectInfoService, userId, formatDisplayValue);
|
|
92665
92872
|
const draftService = new UiApiDraftRecordService(() => lazyLuvio, lazyDurableStore, lazyObjectInfoService, newRecordId, lazySideEffectStore, lazyDurableRecordStore);
|
|
92666
92873
|
const uiApiRecordHandler = new UiApiActionHandler(() => lazyLuvio, lazyNetworkAdapter, lazyDraftQueue, getRecord, lazyObjectInfoService, isGenerated, draftService, lazySideEffectService, lazyDurableRecordStore);
|
|
92667
|
-
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks());
|
|
92874
|
+
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks(lazyDurableRecordStore));
|
|
92668
92875
|
const quickActionHandler = new QuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService, lazyObjectInfoService, getRecord);
|
|
92669
92876
|
const updateRecordQuickActionHandler = new UpdateRecordQuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService);
|
|
92670
92877
|
const contentDocumentCompositeActionHandler = new ContentDocumentCompositeRepresentationActionHandler(() => lazyLuvio, userId, draftService, lazyObjectInfoService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, NimbusBinaryStore, lazySideEffectService);
|
|
@@ -92772,7 +92979,7 @@ register$1({
|
|
|
92772
92979
|
id: '@salesforce/lds-network-adapter',
|
|
92773
92980
|
instrument: instrument$2,
|
|
92774
92981
|
});
|
|
92775
|
-
// version: 1.
|
|
92982
|
+
// version: 1.350.0-c9c684f956
|
|
92776
92983
|
|
|
92777
92984
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92778
92985
|
const { stringify, parse } = JSON;
|
|
@@ -116667,7 +116874,7 @@ register$1({
|
|
|
116667
116874
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116668
116875
|
instrument: instrument$1,
|
|
116669
116876
|
});
|
|
116670
|
-
// version: 1.
|
|
116877
|
+
// version: 1.350.0-4e181805d5
|
|
116671
116878
|
|
|
116672
116879
|
// On core the unstable adapters are re-exported with different names,
|
|
116673
116880
|
// we want to match them here.
|
|
@@ -116819,7 +117026,7 @@ withDefaultLuvio((luvio) => {
|
|
|
116819
117026
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
116820
117027
|
graphQLImperative = ldsAdapter;
|
|
116821
117028
|
});
|
|
116822
|
-
// version: 1.
|
|
117029
|
+
// version: 1.350.0-4e181805d5
|
|
116823
117030
|
|
|
116824
117031
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
116825
117032
|
__proto__: null,
|
|
@@ -117611,7 +117818,7 @@ const callbacks$1 = [];
|
|
|
117611
117818
|
function register(r) {
|
|
117612
117819
|
callbacks$1.forEach((callback) => callback(r));
|
|
117613
117820
|
}
|
|
117614
|
-
// version: 1.
|
|
117821
|
+
// version: 1.350.0-c9c684f956
|
|
117615
117822
|
|
|
117616
117823
|
/**
|
|
117617
117824
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118691,4 +118898,4 @@ const { luvio } = getRuntime();
|
|
|
118691
118898
|
setDefaultLuvio({ luvio });
|
|
118692
118899
|
|
|
118693
118900
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
118694
|
-
// version: 1.
|
|
118901
|
+
// version: 1.350.0-c9c684f956
|
|
@@ -4272,7 +4272,7 @@
|
|
|
4272
4272
|
}
|
|
4273
4273
|
callbacks.push(callback);
|
|
4274
4274
|
}
|
|
4275
|
-
// version: 1.
|
|
4275
|
+
// version: 1.350.0-c9c684f956
|
|
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) {
|
|
@@ -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.350.0-c9c684f956
|
|
5224
5224
|
|
|
5225
5225
|
/**
|
|
5226
5226
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -29838,6 +29838,7 @@
|
|
|
29838
29838
|
generateParamConfigMetadata$3('objectApiName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29839
29839
|
generateParamConfigMetadata$3('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29840
29840
|
generateParamConfigMetadata$3('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
29841
|
+
generateParamConfigMetadata$3('dataCategories', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29841
29842
|
generateParamConfigMetadata$3('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29842
29843
|
generateParamConfigMetadata$3('pageSize', false, 2 /* Body */, 3 /* Integer */),
|
|
29843
29844
|
generateParamConfigMetadata$3('pageToken', false, 2 /* Body */, 0 /* String */),
|
|
@@ -29852,6 +29853,18 @@
|
|
|
29852
29853
|
function typeCheckConfig$c$1(untrustedConfig) {
|
|
29853
29854
|
const config = {};
|
|
29854
29855
|
typeCheckConfig$18(untrustedConfig, config, getKeywordSearchResults_ConfigPropertyMetadata$1);
|
|
29856
|
+
const untrustedConfig_dataCategories = untrustedConfig.dataCategories;
|
|
29857
|
+
if (ArrayIsArray$1$1(untrustedConfig_dataCategories)) {
|
|
29858
|
+
const untrustedConfig_dataCategories_array = [];
|
|
29859
|
+
for (let i = 0, arrayLength = untrustedConfig_dataCategories.length; i < arrayLength; i++) {
|
|
29860
|
+
const untrustedConfig_dataCategories_item = untrustedConfig_dataCategories[i];
|
|
29861
|
+
const referenceSearchDataCategoryInputRepresentationValidationError = validate$n(untrustedConfig_dataCategories_item);
|
|
29862
|
+
if (referenceSearchDataCategoryInputRepresentationValidationError === null) {
|
|
29863
|
+
untrustedConfig_dataCategories_array.push(untrustedConfig_dataCategories_item);
|
|
29864
|
+
}
|
|
29865
|
+
}
|
|
29866
|
+
config.dataCategories = untrustedConfig_dataCategories_array;
|
|
29867
|
+
}
|
|
29855
29868
|
const untrustedConfig_filters = untrustedConfig.filters;
|
|
29856
29869
|
if (ArrayIsArray$1$1(untrustedConfig_filters)) {
|
|
29857
29870
|
const untrustedConfig_filters_array = [];
|
|
@@ -33977,7 +33990,7 @@
|
|
|
33977
33990
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33978
33991
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33979
33992
|
});
|
|
33980
|
-
// version: 1.
|
|
33993
|
+
// version: 1.350.0-4e181805d5
|
|
33981
33994
|
|
|
33982
33995
|
/**
|
|
33983
33996
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -45567,7 +45580,7 @@
|
|
|
45567
45580
|
},
|
|
45568
45581
|
};
|
|
45569
45582
|
|
|
45570
|
-
var
|
|
45583
|
+
var productConsumedSideEffects = {
|
|
45571
45584
|
isOpen: function (e) {
|
|
45572
45585
|
return e.fallback;
|
|
45573
45586
|
},
|
|
@@ -45597,7 +45610,7 @@
|
|
|
45597
45610
|
|
|
45598
45611
|
const UI_API_BASE_URI = '/services/data/v64.0/ui-api';
|
|
45599
45612
|
|
|
45600
|
-
let instrumentation$
|
|
45613
|
+
let instrumentation$1$1 = {
|
|
45601
45614
|
aggregateUiChunkCount: (_cb) => { },
|
|
45602
45615
|
aggregateUiConnectError: () => { },
|
|
45603
45616
|
duplicateRequest: (_cb) => { },
|
|
@@ -45609,7 +45622,7 @@
|
|
|
45609
45622
|
networkRateLimitExceeded: () => { },
|
|
45610
45623
|
};
|
|
45611
45624
|
function instrument$2(newInstrumentation) {
|
|
45612
|
-
instrumentation$
|
|
45625
|
+
instrumentation$1$1 = Object.assign(instrumentation$1$1, newInstrumentation);
|
|
45613
45626
|
}
|
|
45614
45627
|
|
|
45615
45628
|
const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
|
|
@@ -45679,7 +45692,7 @@
|
|
|
45679
45692
|
* would otherwise cause a query length exception.
|
|
45680
45693
|
*/
|
|
45681
45694
|
function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resourceRequest, resourceRequestContext) {
|
|
45682
|
-
instrumentation$
|
|
45695
|
+
instrumentation$1$1.getRecordAggregateInvoke();
|
|
45683
45696
|
return networkAdapter(resourceRequest, resourceRequestContext).then((resp) => {
|
|
45684
45697
|
const { body } = resp;
|
|
45685
45698
|
// This response body could be an executeAggregateUi, which we don't natively support.
|
|
@@ -45695,7 +45708,7 @@
|
|
|
45695
45708
|
}
|
|
45696
45709
|
const merged = body.compositeResponse.reduce((seed, response) => {
|
|
45697
45710
|
if (response.httpStatusCode !== HttpStatusCode$1.Ok) {
|
|
45698
|
-
instrumentation$
|
|
45711
|
+
instrumentation$1$1.getRecordAggregateReject(() => recordId);
|
|
45699
45712
|
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
45700
45713
|
error: response.message,
|
|
45701
45714
|
});
|
|
@@ -45705,7 +45718,7 @@
|
|
|
45705
45718
|
}
|
|
45706
45719
|
return mergeRecordFields$2(seed, response.body);
|
|
45707
45720
|
}, null);
|
|
45708
|
-
instrumentation$
|
|
45721
|
+
instrumentation$1$1.getRecordAggregateResolve(() => {
|
|
45709
45722
|
return {
|
|
45710
45723
|
recordId,
|
|
45711
45724
|
apiName: merged.apiName,
|
|
@@ -45713,7 +45726,7 @@
|
|
|
45713
45726
|
});
|
|
45714
45727
|
return createOkResponse$1(merged);
|
|
45715
45728
|
}, (err) => {
|
|
45716
|
-
instrumentation$
|
|
45729
|
+
instrumentation$1$1.getRecordAggregateReject(() => recordId);
|
|
45717
45730
|
// rethrow error
|
|
45718
45731
|
throw err;
|
|
45719
45732
|
});
|
|
@@ -45791,7 +45804,7 @@
|
|
|
45791
45804
|
const { networkAdapter, resourceRequest, resourceRequestContext } = req;
|
|
45792
45805
|
const compositeRequest = buildGetRecordByFieldsCompositeRequest(resourceRequest, params);
|
|
45793
45806
|
// W-12245125: Emit chunk size metrics
|
|
45794
|
-
instrumentation$
|
|
45807
|
+
instrumentation$1$1.aggregateUiChunkCount(() => compositeRequest.length);
|
|
45795
45808
|
const aggregateUiParams = {
|
|
45796
45809
|
compositeRequest,
|
|
45797
45810
|
};
|
|
@@ -46025,7 +46038,7 @@
|
|
|
46025
46038
|
return (resourceRequest, resourceRequestContext) => {
|
|
46026
46039
|
if (!tokenBucket.take(1)) {
|
|
46027
46040
|
// We are hitting rate limiting, add some metrics
|
|
46028
|
-
instrumentation$
|
|
46041
|
+
instrumentation$1$1.networkRateLimitExceeded();
|
|
46029
46042
|
}
|
|
46030
46043
|
const salesforceRequest = {
|
|
46031
46044
|
networkAdapter: baseNetworkAdapter,
|
|
@@ -79981,7 +79994,7 @@
|
|
|
79981
79994
|
}
|
|
79982
79995
|
}
|
|
79983
79996
|
for (const trigger of hookTriggers) {
|
|
79984
|
-
const hookEffects = await trigger.then(action.id, action.timestamp, action.targetId, action.data.body
|
|
79997
|
+
const hookEffects = await trigger.then(action.id, action.timestamp, action.targetId, action.data.body?.fields ?? {});
|
|
79985
79998
|
for (const hookEffect of hookEffects) {
|
|
79986
79999
|
effects.push(hookEffect);
|
|
79987
80000
|
}
|
|
@@ -90304,6 +90317,7 @@
|
|
|
90304
90317
|
for (const result of results) {
|
|
90305
90318
|
this.processFetchedRecords(result, abortController);
|
|
90306
90319
|
}
|
|
90320
|
+
this.handlePaginations(results, batch);
|
|
90307
90321
|
});
|
|
90308
90322
|
},
|
|
90309
90323
|
cancelFn: () => {
|
|
@@ -90316,6 +90330,18 @@
|
|
|
90316
90330
|
});
|
|
90317
90331
|
}
|
|
90318
90332
|
}
|
|
90333
|
+
handlePaginations(results, batch) {
|
|
90334
|
+
const ids = this.recordLoader.getMissingIdsWithPagination(results);
|
|
90335
|
+
if (ids.size > 0) {
|
|
90336
|
+
const batches = chunk(Array.from(ids), this.batchSize).map((chunkOfIds) => ({
|
|
90337
|
+
type: batch.type,
|
|
90338
|
+
ids: chunkOfIds,
|
|
90339
|
+
fields: batch.fields,
|
|
90340
|
+
objectInfo: batch.objectInfo,
|
|
90341
|
+
}));
|
|
90342
|
+
this.enqueueBatches(batches);
|
|
90343
|
+
}
|
|
90344
|
+
}
|
|
90319
90345
|
processFetchedRecords(result, abortController) {
|
|
90320
90346
|
if (result.ok === false) {
|
|
90321
90347
|
const { error } = result;
|
|
@@ -90334,7 +90360,7 @@
|
|
|
90334
90360
|
return;
|
|
90335
90361
|
}
|
|
90336
90362
|
const { missingIds } = result;
|
|
90337
|
-
if (missingIds.length > 0) {
|
|
90363
|
+
if (missingIds.length > 0 && !this.recordLoader.isResultWithPagination(result)) {
|
|
90338
90364
|
this.emit('error', {
|
|
90339
90365
|
ids: missingIds,
|
|
90340
90366
|
code: 'not-found',
|
|
@@ -90543,6 +90569,18 @@
|
|
|
90543
90569
|
}
|
|
90544
90570
|
}
|
|
90545
90571
|
}
|
|
90572
|
+
isResultWithPagination(result) {
|
|
90573
|
+
return 'paginationToken' in result;
|
|
90574
|
+
}
|
|
90575
|
+
getMissingIdsWithPagination(results) {
|
|
90576
|
+
const ids = new Set();
|
|
90577
|
+
results.forEach((result) => {
|
|
90578
|
+
if (this.isResultWithPagination(result)) {
|
|
90579
|
+
result.missingIds.forEach((id) => ids.add(id));
|
|
90580
|
+
}
|
|
90581
|
+
});
|
|
90582
|
+
return ids;
|
|
90583
|
+
}
|
|
90546
90584
|
async sendRequest(request, abortController) {
|
|
90547
90585
|
let response = await this.networkAdapter.sendRequest(request, abortController);
|
|
90548
90586
|
if (response.status < 200 || response.status > 299) {
|
|
@@ -90902,7 +90940,15 @@
|
|
|
90902
90940
|
generateSelect(batch) {
|
|
90903
90941
|
let fieldSet = new Set(batch.fields);
|
|
90904
90942
|
for (const field of requiredSoqlFields) {
|
|
90905
|
-
|
|
90943
|
+
if (batch.objectInfo.fields[field] !== undefined) {
|
|
90944
|
+
fieldSet.add(field);
|
|
90945
|
+
}
|
|
90946
|
+
}
|
|
90947
|
+
// determine if this object has multiple record types. if so, add RecordTypeId to the query.
|
|
90948
|
+
// if there is only a master record type, then requesting RecordTypeId will fail.
|
|
90949
|
+
const recordTypeInfos = batch.objectInfo.recordTypeInfos;
|
|
90950
|
+
if (Object.keys(recordTypeInfos).length > 1) {
|
|
90951
|
+
fieldSet.add('RecordTypeId');
|
|
90906
90952
|
}
|
|
90907
90953
|
const fields = Array.from(fieldSet);
|
|
90908
90954
|
// We will have SOQL format specific data types for us by adding a format() value.
|
|
@@ -90922,12 +90968,6 @@
|
|
|
90922
90968
|
fields.push(`toLabel(${field}) ${field}___display`);
|
|
90923
90969
|
}
|
|
90924
90970
|
}
|
|
90925
|
-
// determine if this object has multiple record types. if so, add RecordTypeId to the query.
|
|
90926
|
-
// if there is only a master record type, then requesting RecordTypeId will fail.
|
|
90927
|
-
const recordTypeInfos = batch.objectInfo.recordTypeInfos;
|
|
90928
|
-
if (Object.keys(recordTypeInfos).length > 1) {
|
|
90929
|
-
fields.push('RecordTypeId');
|
|
90930
|
-
}
|
|
90931
90971
|
const query = `SELECT ${fields.join(',')} FROM ${batch.type} `;
|
|
90932
90972
|
// console.log(`DUSTIN: soql batch query: ${query}`);
|
|
90933
90973
|
return query;
|
|
@@ -90958,6 +90998,7 @@
|
|
|
90958
90998
|
ok: true,
|
|
90959
90999
|
records,
|
|
90960
91000
|
missingIds: Array.from(missingRecordIds),
|
|
91001
|
+
...(queryResult.nextRecordsUrl && { paginationToken: queryResult.nextRecordsUrl }),
|
|
90961
91002
|
};
|
|
90962
91003
|
}
|
|
90963
91004
|
}
|
|
@@ -92577,17 +92618,183 @@
|
|
|
92577
92618
|
return storeRecord.__type === 'error';
|
|
92578
92619
|
}
|
|
92579
92620
|
|
|
92621
|
+
const instrumentation$2 = getInstrumentation();
|
|
92622
|
+
const ProductConsumed = {
|
|
92623
|
+
API_NAME: 'ProductConsumed',
|
|
92624
|
+
Fields: {
|
|
92625
|
+
PRODUCT_ITEM_ID: 'ProductItemId',
|
|
92626
|
+
QUANTITY_CONSUMED: 'QuantityConsumed',
|
|
92627
|
+
},
|
|
92628
|
+
};
|
|
92629
|
+
const ProductItem = {
|
|
92630
|
+
Fields: {
|
|
92631
|
+
QUANTITY_ON_HAND: 'QuantityOnHand',
|
|
92632
|
+
},
|
|
92633
|
+
};
|
|
92634
|
+
class ProductConsumedCreatedHook {
|
|
92635
|
+
constructor() {
|
|
92636
|
+
this.on = 'post';
|
|
92637
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92638
|
+
}
|
|
92639
|
+
async then(draftActionId, draftActionTimestamp, _draftRecordId, fields) {
|
|
92640
|
+
const productItemId = getProductItemId(fields);
|
|
92641
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92642
|
+
if (productItemId === undefined) {
|
|
92643
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92644
|
+
return [];
|
|
92645
|
+
}
|
|
92646
|
+
if (quantityConsumed === undefined) {
|
|
92647
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92648
|
+
return [];
|
|
92649
|
+
}
|
|
92650
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92651
|
+
const effect = {
|
|
92652
|
+
type: 'record-field-increment',
|
|
92653
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92654
|
+
value: -quantityConsumed,
|
|
92655
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92656
|
+
tag: draftActionId,
|
|
92657
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92658
|
+
timestamp: draftActionTimestamp,
|
|
92659
|
+
};
|
|
92660
|
+
return [effect];
|
|
92661
|
+
}
|
|
92662
|
+
}
|
|
92663
|
+
ProductConsumedCreatedHook.COUNTER_NAME = 'ProductConsumedCreatedHook';
|
|
92664
|
+
class ProductConsumedUpdatedHook {
|
|
92665
|
+
constructor(durableRecordStore) {
|
|
92666
|
+
this.durableRecordStore = durableRecordStore;
|
|
92667
|
+
this.on = 'patch';
|
|
92668
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92669
|
+
}
|
|
92670
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId, fields) {
|
|
92671
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92672
|
+
if (quantityConsumed === undefined) {
|
|
92673
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92674
|
+
return [];
|
|
92675
|
+
}
|
|
92676
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92677
|
+
if (originalRecord === undefined) {
|
|
92678
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92679
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} not found`);
|
|
92680
|
+
return [];
|
|
92681
|
+
}
|
|
92682
|
+
const originalProductItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92683
|
+
const originalQuantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92684
|
+
if (originalProductItemId === undefined) {
|
|
92685
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92686
|
+
return [];
|
|
92687
|
+
}
|
|
92688
|
+
if (originalQuantityConsumed === undefined) {
|
|
92689
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92690
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92691
|
+
return [];
|
|
92692
|
+
}
|
|
92693
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92694
|
+
const effect = {
|
|
92695
|
+
type: 'record-field-increment',
|
|
92696
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92697
|
+
value: originalQuantityConsumed - quantityConsumed,
|
|
92698
|
+
key: buildRecordRepKeyFromId$1(originalProductItemId),
|
|
92699
|
+
tag: draftActionId,
|
|
92700
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92701
|
+
timestamp: draftActionTimestamp,
|
|
92702
|
+
};
|
|
92703
|
+
return [effect];
|
|
92704
|
+
}
|
|
92705
|
+
}
|
|
92706
|
+
ProductConsumedUpdatedHook.COUNTER_NAME = 'ProductConsumedUpdatedHook';
|
|
92707
|
+
class ProductConsumedDeletedHook {
|
|
92708
|
+
constructor(durableRecordStore) {
|
|
92709
|
+
this.durableRecordStore = durableRecordStore;
|
|
92710
|
+
this.on = 'delete';
|
|
92711
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92712
|
+
}
|
|
92713
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId) {
|
|
92714
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92715
|
+
if (originalRecord === undefined) {
|
|
92716
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92717
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} not found`);
|
|
92718
|
+
return [];
|
|
92719
|
+
}
|
|
92720
|
+
const productItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92721
|
+
const quantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92722
|
+
if (productItemId === undefined) {
|
|
92723
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92724
|
+
return [];
|
|
92725
|
+
}
|
|
92726
|
+
if (quantityConsumed === undefined) {
|
|
92727
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92728
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92729
|
+
return [];
|
|
92730
|
+
}
|
|
92731
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Created);
|
|
92732
|
+
const effect = {
|
|
92733
|
+
type: 'record-field-increment',
|
|
92734
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92735
|
+
value: quantityConsumed,
|
|
92736
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92737
|
+
tag: draftActionId,
|
|
92738
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92739
|
+
timestamp: draftActionTimestamp,
|
|
92740
|
+
};
|
|
92741
|
+
return [effect];
|
|
92742
|
+
}
|
|
92743
|
+
}
|
|
92744
|
+
ProductConsumedDeletedHook.COUNTER_NAME = 'ProductConsumedDeletedHook';
|
|
92745
|
+
function getProductItemId(fields) {
|
|
92746
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92747
|
+
if (field === undefined || typeof field !== 'string') {
|
|
92748
|
+
return undefined;
|
|
92749
|
+
}
|
|
92750
|
+
return field;
|
|
92751
|
+
}
|
|
92752
|
+
function getProductItemIdFromRecordFields(fields) {
|
|
92753
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92754
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'string') {
|
|
92755
|
+
return undefined;
|
|
92756
|
+
}
|
|
92757
|
+
return field.value;
|
|
92758
|
+
}
|
|
92759
|
+
function getQuantityConsumed(fields) {
|
|
92760
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92761
|
+
if (field === undefined || typeof field !== 'number') {
|
|
92762
|
+
return undefined;
|
|
92763
|
+
}
|
|
92764
|
+
return field;
|
|
92765
|
+
}
|
|
92766
|
+
function getQuantityConsumedFromRecordFields(fields) {
|
|
92767
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92768
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'number') {
|
|
92769
|
+
return undefined;
|
|
92770
|
+
}
|
|
92771
|
+
return field.value;
|
|
92772
|
+
}
|
|
92773
|
+
var CounterResult;
|
|
92774
|
+
(function (CounterResult) {
|
|
92775
|
+
// A side effect was created.
|
|
92776
|
+
CounterResult["Created"] = "Created";
|
|
92777
|
+
// The hook exited early.
|
|
92778
|
+
CounterResult["Exited"] = "Exited";
|
|
92779
|
+
// An unexpected error occurred.
|
|
92780
|
+
CounterResult["Error"] = "Error";
|
|
92781
|
+
})(CounterResult || (CounterResult = {}));
|
|
92782
|
+
function incrementCounter(name, result) {
|
|
92783
|
+
instrumentation$2.incrementCounter('SFSSideEffect', 1, result == CounterResult.Error, {
|
|
92784
|
+
Name: name,
|
|
92785
|
+
Result: result,
|
|
92786
|
+
});
|
|
92787
|
+
}
|
|
92788
|
+
|
|
92580
92789
|
function createSfsSideEffectHooks(durableRecordStore) {
|
|
92581
|
-
if (
|
|
92582
|
-
return [
|
|
92790
|
+
if (productConsumedSideEffects.isOpen({ fallback: false })) {
|
|
92791
|
+
return [
|
|
92792
|
+
new ProductConsumedCreatedHook(),
|
|
92793
|
+
new ProductConsumedUpdatedHook(durableRecordStore),
|
|
92794
|
+
new ProductConsumedDeletedHook(durableRecordStore),
|
|
92795
|
+
];
|
|
92583
92796
|
}
|
|
92584
|
-
return [
|
|
92585
|
-
// SFS FSCore needs to implement code to bypass it's existing "side effect" code for Product Consumed.
|
|
92586
|
-
// W-17683696 is the work that will enable the code below after FSCore's W-17422735 is completed.
|
|
92587
|
-
// new ProductConsumedCreatedHook(),
|
|
92588
|
-
// new ProductConsumedUpdatedHook(durableRecordStore),
|
|
92589
|
-
// new ProductConsumedDeletedHook(durableRecordStore),
|
|
92590
|
-
];
|
|
92797
|
+
return [];
|
|
92591
92798
|
}
|
|
92592
92799
|
|
|
92593
92800
|
// so eslint doesn't complain about nimbus
|
|
@@ -92670,7 +92877,7 @@
|
|
|
92670
92877
|
lazySideEffectService = new SideEffectService(lazyDurableRecordStore, lazyObjectInfoService, userId, formatDisplayValue);
|
|
92671
92878
|
const draftService = new UiApiDraftRecordService(() => lazyLuvio, lazyDurableStore, lazyObjectInfoService, newRecordId, lazySideEffectStore, lazyDurableRecordStore);
|
|
92672
92879
|
const uiApiRecordHandler = new UiApiActionHandler(() => lazyLuvio, lazyNetworkAdapter, lazyDraftQueue, getRecord, lazyObjectInfoService, isGenerated, draftService, lazySideEffectService, lazyDurableRecordStore);
|
|
92673
|
-
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks());
|
|
92880
|
+
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks(lazyDurableRecordStore));
|
|
92674
92881
|
const quickActionHandler = new QuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService, lazyObjectInfoService, getRecord);
|
|
92675
92882
|
const updateRecordQuickActionHandler = new UpdateRecordQuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService);
|
|
92676
92883
|
const contentDocumentCompositeActionHandler = new ContentDocumentCompositeRepresentationActionHandler(() => lazyLuvio, userId, draftService, lazyObjectInfoService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, NimbusBinaryStore, lazySideEffectService);
|
|
@@ -92778,7 +92985,7 @@
|
|
|
92778
92985
|
id: '@salesforce/lds-network-adapter',
|
|
92779
92986
|
instrument: instrument$2,
|
|
92780
92987
|
});
|
|
92781
|
-
// version: 1.
|
|
92988
|
+
// version: 1.350.0-c9c684f956
|
|
92782
92989
|
|
|
92783
92990
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92784
92991
|
const { stringify, parse } = JSON;
|
|
@@ -116673,7 +116880,7 @@
|
|
|
116673
116880
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116674
116881
|
instrument: instrument$1,
|
|
116675
116882
|
});
|
|
116676
|
-
// version: 1.
|
|
116883
|
+
// version: 1.350.0-4e181805d5
|
|
116677
116884
|
|
|
116678
116885
|
// On core the unstable adapters are re-exported with different names,
|
|
116679
116886
|
// we want to match them here.
|
|
@@ -116825,7 +117032,7 @@
|
|
|
116825
117032
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
116826
117033
|
graphQLImperative = ldsAdapter;
|
|
116827
117034
|
});
|
|
116828
|
-
// version: 1.
|
|
117035
|
+
// version: 1.350.0-4e181805d5
|
|
116829
117036
|
|
|
116830
117037
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
116831
117038
|
__proto__: null,
|
|
@@ -117617,7 +117824,7 @@
|
|
|
117617
117824
|
function register(r) {
|
|
117618
117825
|
callbacks$1.forEach((callback) => callback(r));
|
|
117619
117826
|
}
|
|
117620
|
-
// version: 1.
|
|
117827
|
+
// version: 1.350.0-c9c684f956
|
|
117621
117828
|
|
|
117622
117829
|
/**
|
|
117623
117830
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118716,4 +118923,4 @@
|
|
|
118716
118923
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
118717
118924
|
|
|
118718
118925
|
}));
|
|
118719
|
-
// version: 1.
|
|
118926
|
+
// version: 1.350.0-c9c684f956
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.350.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/es/lds-worker-api.js",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
|
|
38
|
-
"@salesforce/lds-adapters-graphql": "^1.
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
40
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
41
|
-
"@salesforce/lds-drafts": "^1.
|
|
42
|
-
"@salesforce/lds-graphql-parser": "^1.
|
|
43
|
-
"@salesforce/lds-luvio-engine": "^1.
|
|
44
|
-
"@salesforce/lds-runtime-mobile": "^1.
|
|
45
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
38
|
+
"@salesforce/lds-adapters-graphql": "^1.350.0",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.350.0",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.350.0",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.350.0",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.350.0",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.350.0",
|
|
44
|
+
"@salesforce/lds-runtime-mobile": "^1.350.0",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.350.0",
|
|
46
46
|
"ajv": "^8.11.0",
|
|
47
47
|
"glob": "^7.1.5",
|
|
48
48
|
"nimbus-types": "^2.0.0-alpha1",
|