@salesforce/lds-worker-api 1.348.0 → 1.349.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.349.0-3d2a6c656b
|
|
@@ -4266,7 +4266,7 @@ function withDefaultLuvio(callback) {
|
|
|
4266
4266
|
}
|
|
4267
4267
|
callbacks.push(callback);
|
|
4268
4268
|
}
|
|
4269
|
-
// version: 1.
|
|
4269
|
+
// version: 1.349.0-3d2a6c656b
|
|
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.349.0-3d2a6c656b
|
|
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.349.0-2008e7132b
|
|
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
|
}
|
|
@@ -90896,7 +90909,15 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
|
|
|
90896
90909
|
generateSelect(batch) {
|
|
90897
90910
|
let fieldSet = new Set(batch.fields);
|
|
90898
90911
|
for (const field of requiredSoqlFields) {
|
|
90899
|
-
|
|
90912
|
+
if (batch.objectInfo.fields[field] !== undefined) {
|
|
90913
|
+
fieldSet.add(field);
|
|
90914
|
+
}
|
|
90915
|
+
}
|
|
90916
|
+
// determine if this object has multiple record types. if so, add RecordTypeId to the query.
|
|
90917
|
+
// if there is only a master record type, then requesting RecordTypeId will fail.
|
|
90918
|
+
const recordTypeInfos = batch.objectInfo.recordTypeInfos;
|
|
90919
|
+
if (Object.keys(recordTypeInfos).length > 1) {
|
|
90920
|
+
fieldSet.add('RecordTypeId');
|
|
90900
90921
|
}
|
|
90901
90922
|
const fields = Array.from(fieldSet);
|
|
90902
90923
|
// We will have SOQL format specific data types for us by adding a format() value.
|
|
@@ -90916,12 +90937,6 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
|
|
|
90916
90937
|
fields.push(`toLabel(${field}) ${field}___display`);
|
|
90917
90938
|
}
|
|
90918
90939
|
}
|
|
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
90940
|
const query = `SELECT ${fields.join(',')} FROM ${batch.type} `;
|
|
90926
90941
|
// console.log(`DUSTIN: soql batch query: ${query}`);
|
|
90927
90942
|
return query;
|
|
@@ -92571,17 +92586,183 @@ function isStoreRecordError(storeRecord) {
|
|
|
92571
92586
|
return storeRecord.__type === 'error';
|
|
92572
92587
|
}
|
|
92573
92588
|
|
|
92589
|
+
const instrumentation$2 = getInstrumentation();
|
|
92590
|
+
const ProductConsumed = {
|
|
92591
|
+
API_NAME: 'ProductConsumed',
|
|
92592
|
+
Fields: {
|
|
92593
|
+
PRODUCT_ITEM_ID: 'ProductItemId',
|
|
92594
|
+
QUANTITY_CONSUMED: 'QuantityConsumed',
|
|
92595
|
+
},
|
|
92596
|
+
};
|
|
92597
|
+
const ProductItem = {
|
|
92598
|
+
Fields: {
|
|
92599
|
+
QUANTITY_ON_HAND: 'QuantityOnHand',
|
|
92600
|
+
},
|
|
92601
|
+
};
|
|
92602
|
+
class ProductConsumedCreatedHook {
|
|
92603
|
+
constructor() {
|
|
92604
|
+
this.on = 'post';
|
|
92605
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92606
|
+
}
|
|
92607
|
+
async then(draftActionId, draftActionTimestamp, _draftRecordId, fields) {
|
|
92608
|
+
const productItemId = getProductItemId(fields);
|
|
92609
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92610
|
+
if (productItemId === undefined) {
|
|
92611
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92612
|
+
return [];
|
|
92613
|
+
}
|
|
92614
|
+
if (quantityConsumed === undefined) {
|
|
92615
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92616
|
+
return [];
|
|
92617
|
+
}
|
|
92618
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92619
|
+
const effect = {
|
|
92620
|
+
type: 'record-field-increment',
|
|
92621
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92622
|
+
value: -quantityConsumed,
|
|
92623
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92624
|
+
tag: draftActionId,
|
|
92625
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92626
|
+
timestamp: draftActionTimestamp,
|
|
92627
|
+
};
|
|
92628
|
+
return [effect];
|
|
92629
|
+
}
|
|
92630
|
+
}
|
|
92631
|
+
ProductConsumedCreatedHook.COUNTER_NAME = 'ProductConsumedCreatedHook';
|
|
92632
|
+
class ProductConsumedUpdatedHook {
|
|
92633
|
+
constructor(durableRecordStore) {
|
|
92634
|
+
this.durableRecordStore = durableRecordStore;
|
|
92635
|
+
this.on = 'patch';
|
|
92636
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92637
|
+
}
|
|
92638
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId, fields) {
|
|
92639
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92640
|
+
if (quantityConsumed === undefined) {
|
|
92641
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92642
|
+
return [];
|
|
92643
|
+
}
|
|
92644
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92645
|
+
if (originalRecord === undefined) {
|
|
92646
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92647
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} not found`);
|
|
92648
|
+
return [];
|
|
92649
|
+
}
|
|
92650
|
+
const originalProductItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92651
|
+
const originalQuantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92652
|
+
if (originalProductItemId === undefined) {
|
|
92653
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92654
|
+
return [];
|
|
92655
|
+
}
|
|
92656
|
+
if (originalQuantityConsumed === undefined) {
|
|
92657
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92658
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92659
|
+
return [];
|
|
92660
|
+
}
|
|
92661
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92662
|
+
const effect = {
|
|
92663
|
+
type: 'record-field-increment',
|
|
92664
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92665
|
+
value: originalQuantityConsumed - quantityConsumed,
|
|
92666
|
+
key: buildRecordRepKeyFromId$1(originalProductItemId),
|
|
92667
|
+
tag: draftActionId,
|
|
92668
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92669
|
+
timestamp: draftActionTimestamp,
|
|
92670
|
+
};
|
|
92671
|
+
return [effect];
|
|
92672
|
+
}
|
|
92673
|
+
}
|
|
92674
|
+
ProductConsumedUpdatedHook.COUNTER_NAME = 'ProductConsumedUpdatedHook';
|
|
92675
|
+
class ProductConsumedDeletedHook {
|
|
92676
|
+
constructor(durableRecordStore) {
|
|
92677
|
+
this.durableRecordStore = durableRecordStore;
|
|
92678
|
+
this.on = 'delete';
|
|
92679
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92680
|
+
}
|
|
92681
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId) {
|
|
92682
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92683
|
+
if (originalRecord === undefined) {
|
|
92684
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92685
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} not found`);
|
|
92686
|
+
return [];
|
|
92687
|
+
}
|
|
92688
|
+
const productItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92689
|
+
const quantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92690
|
+
if (productItemId === undefined) {
|
|
92691
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92692
|
+
return [];
|
|
92693
|
+
}
|
|
92694
|
+
if (quantityConsumed === undefined) {
|
|
92695
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92696
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92697
|
+
return [];
|
|
92698
|
+
}
|
|
92699
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Created);
|
|
92700
|
+
const effect = {
|
|
92701
|
+
type: 'record-field-increment',
|
|
92702
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92703
|
+
value: quantityConsumed,
|
|
92704
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92705
|
+
tag: draftActionId,
|
|
92706
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92707
|
+
timestamp: draftActionTimestamp,
|
|
92708
|
+
};
|
|
92709
|
+
return [effect];
|
|
92710
|
+
}
|
|
92711
|
+
}
|
|
92712
|
+
ProductConsumedDeletedHook.COUNTER_NAME = 'ProductConsumedDeletedHook';
|
|
92713
|
+
function getProductItemId(fields) {
|
|
92714
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92715
|
+
if (field === undefined || typeof field !== 'string') {
|
|
92716
|
+
return undefined;
|
|
92717
|
+
}
|
|
92718
|
+
return field;
|
|
92719
|
+
}
|
|
92720
|
+
function getProductItemIdFromRecordFields(fields) {
|
|
92721
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92722
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'string') {
|
|
92723
|
+
return undefined;
|
|
92724
|
+
}
|
|
92725
|
+
return field.value;
|
|
92726
|
+
}
|
|
92727
|
+
function getQuantityConsumed(fields) {
|
|
92728
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92729
|
+
if (field === undefined || typeof field !== 'number') {
|
|
92730
|
+
return undefined;
|
|
92731
|
+
}
|
|
92732
|
+
return field;
|
|
92733
|
+
}
|
|
92734
|
+
function getQuantityConsumedFromRecordFields(fields) {
|
|
92735
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92736
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'number') {
|
|
92737
|
+
return undefined;
|
|
92738
|
+
}
|
|
92739
|
+
return field.value;
|
|
92740
|
+
}
|
|
92741
|
+
var CounterResult;
|
|
92742
|
+
(function (CounterResult) {
|
|
92743
|
+
// A side effect was created.
|
|
92744
|
+
CounterResult["Created"] = "Created";
|
|
92745
|
+
// The hook exited early.
|
|
92746
|
+
CounterResult["Exited"] = "Exited";
|
|
92747
|
+
// An unexpected error occurred.
|
|
92748
|
+
CounterResult["Error"] = "Error";
|
|
92749
|
+
})(CounterResult || (CounterResult = {}));
|
|
92750
|
+
function incrementCounter(name, result) {
|
|
92751
|
+
instrumentation$2.incrementCounter('SFSSideEffect', 1, result == CounterResult.Error, {
|
|
92752
|
+
Name: name,
|
|
92753
|
+
Result: result,
|
|
92754
|
+
});
|
|
92755
|
+
}
|
|
92756
|
+
|
|
92574
92757
|
function createSfsSideEffectHooks(durableRecordStore) {
|
|
92575
|
-
if (
|
|
92576
|
-
return [
|
|
92758
|
+
if (productConsumedSideEffects.isOpen({ fallback: false })) {
|
|
92759
|
+
return [
|
|
92760
|
+
new ProductConsumedCreatedHook(),
|
|
92761
|
+
new ProductConsumedUpdatedHook(durableRecordStore),
|
|
92762
|
+
new ProductConsumedDeletedHook(durableRecordStore),
|
|
92763
|
+
];
|
|
92577
92764
|
}
|
|
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
|
-
];
|
|
92765
|
+
return [];
|
|
92585
92766
|
}
|
|
92586
92767
|
|
|
92587
92768
|
// so eslint doesn't complain about nimbus
|
|
@@ -92664,7 +92845,7 @@ function getRuntime() {
|
|
|
92664
92845
|
lazySideEffectService = new SideEffectService(lazyDurableRecordStore, lazyObjectInfoService, userId, formatDisplayValue);
|
|
92665
92846
|
const draftService = new UiApiDraftRecordService(() => lazyLuvio, lazyDurableStore, lazyObjectInfoService, newRecordId, lazySideEffectStore, lazyDurableRecordStore);
|
|
92666
92847
|
const uiApiRecordHandler = new UiApiActionHandler(() => lazyLuvio, lazyNetworkAdapter, lazyDraftQueue, getRecord, lazyObjectInfoService, isGenerated, draftService, lazySideEffectService, lazyDurableRecordStore);
|
|
92667
|
-
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks());
|
|
92848
|
+
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks(lazyDurableRecordStore));
|
|
92668
92849
|
const quickActionHandler = new QuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService, lazyObjectInfoService, getRecord);
|
|
92669
92850
|
const updateRecordQuickActionHandler = new UpdateRecordQuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService);
|
|
92670
92851
|
const contentDocumentCompositeActionHandler = new ContentDocumentCompositeRepresentationActionHandler(() => lazyLuvio, userId, draftService, lazyObjectInfoService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, NimbusBinaryStore, lazySideEffectService);
|
|
@@ -92772,7 +92953,7 @@ register$1({
|
|
|
92772
92953
|
id: '@salesforce/lds-network-adapter',
|
|
92773
92954
|
instrument: instrument$2,
|
|
92774
92955
|
});
|
|
92775
|
-
// version: 1.
|
|
92956
|
+
// version: 1.349.0-3d2a6c656b
|
|
92776
92957
|
|
|
92777
92958
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92778
92959
|
const { stringify, parse } = JSON;
|
|
@@ -116667,7 +116848,7 @@ register$1({
|
|
|
116667
116848
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116668
116849
|
instrument: instrument$1,
|
|
116669
116850
|
});
|
|
116670
|
-
// version: 1.
|
|
116851
|
+
// version: 1.349.0-2008e7132b
|
|
116671
116852
|
|
|
116672
116853
|
// On core the unstable adapters are re-exported with different names,
|
|
116673
116854
|
// we want to match them here.
|
|
@@ -116819,7 +117000,7 @@ withDefaultLuvio((luvio) => {
|
|
|
116819
117000
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
116820
117001
|
graphQLImperative = ldsAdapter;
|
|
116821
117002
|
});
|
|
116822
|
-
// version: 1.
|
|
117003
|
+
// version: 1.349.0-2008e7132b
|
|
116823
117004
|
|
|
116824
117005
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
116825
117006
|
__proto__: null,
|
|
@@ -117611,7 +117792,7 @@ const callbacks$1 = [];
|
|
|
117611
117792
|
function register(r) {
|
|
117612
117793
|
callbacks$1.forEach((callback) => callback(r));
|
|
117613
117794
|
}
|
|
117614
|
-
// version: 1.
|
|
117795
|
+
// version: 1.349.0-3d2a6c656b
|
|
117615
117796
|
|
|
117616
117797
|
/**
|
|
117617
117798
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118691,4 +118872,4 @@ const { luvio } = getRuntime();
|
|
|
118691
118872
|
setDefaultLuvio({ luvio });
|
|
118692
118873
|
|
|
118693
118874
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
118694
|
-
// version: 1.
|
|
118875
|
+
// version: 1.349.0-3d2a6c656b
|
|
@@ -4272,7 +4272,7 @@
|
|
|
4272
4272
|
}
|
|
4273
4273
|
callbacks.push(callback);
|
|
4274
4274
|
}
|
|
4275
|
-
// version: 1.
|
|
4275
|
+
// version: 1.349.0-3d2a6c656b
|
|
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.349.0-3d2a6c656b
|
|
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.349.0-2008e7132b
|
|
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
|
}
|
|
@@ -90902,7 +90915,15 @@
|
|
|
90902
90915
|
generateSelect(batch) {
|
|
90903
90916
|
let fieldSet = new Set(batch.fields);
|
|
90904
90917
|
for (const field of requiredSoqlFields) {
|
|
90905
|
-
|
|
90918
|
+
if (batch.objectInfo.fields[field] !== undefined) {
|
|
90919
|
+
fieldSet.add(field);
|
|
90920
|
+
}
|
|
90921
|
+
}
|
|
90922
|
+
// determine if this object has multiple record types. if so, add RecordTypeId to the query.
|
|
90923
|
+
// if there is only a master record type, then requesting RecordTypeId will fail.
|
|
90924
|
+
const recordTypeInfos = batch.objectInfo.recordTypeInfos;
|
|
90925
|
+
if (Object.keys(recordTypeInfos).length > 1) {
|
|
90926
|
+
fieldSet.add('RecordTypeId');
|
|
90906
90927
|
}
|
|
90907
90928
|
const fields = Array.from(fieldSet);
|
|
90908
90929
|
// We will have SOQL format specific data types for us by adding a format() value.
|
|
@@ -90922,12 +90943,6 @@
|
|
|
90922
90943
|
fields.push(`toLabel(${field}) ${field}___display`);
|
|
90923
90944
|
}
|
|
90924
90945
|
}
|
|
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
90946
|
const query = `SELECT ${fields.join(',')} FROM ${batch.type} `;
|
|
90932
90947
|
// console.log(`DUSTIN: soql batch query: ${query}`);
|
|
90933
90948
|
return query;
|
|
@@ -92577,17 +92592,183 @@
|
|
|
92577
92592
|
return storeRecord.__type === 'error';
|
|
92578
92593
|
}
|
|
92579
92594
|
|
|
92595
|
+
const instrumentation$2 = getInstrumentation();
|
|
92596
|
+
const ProductConsumed = {
|
|
92597
|
+
API_NAME: 'ProductConsumed',
|
|
92598
|
+
Fields: {
|
|
92599
|
+
PRODUCT_ITEM_ID: 'ProductItemId',
|
|
92600
|
+
QUANTITY_CONSUMED: 'QuantityConsumed',
|
|
92601
|
+
},
|
|
92602
|
+
};
|
|
92603
|
+
const ProductItem = {
|
|
92604
|
+
Fields: {
|
|
92605
|
+
QUANTITY_ON_HAND: 'QuantityOnHand',
|
|
92606
|
+
},
|
|
92607
|
+
};
|
|
92608
|
+
class ProductConsumedCreatedHook {
|
|
92609
|
+
constructor() {
|
|
92610
|
+
this.on = 'post';
|
|
92611
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92612
|
+
}
|
|
92613
|
+
async then(draftActionId, draftActionTimestamp, _draftRecordId, fields) {
|
|
92614
|
+
const productItemId = getProductItemId(fields);
|
|
92615
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92616
|
+
if (productItemId === undefined) {
|
|
92617
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92618
|
+
return [];
|
|
92619
|
+
}
|
|
92620
|
+
if (quantityConsumed === undefined) {
|
|
92621
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92622
|
+
return [];
|
|
92623
|
+
}
|
|
92624
|
+
incrementCounter(ProductConsumedCreatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92625
|
+
const effect = {
|
|
92626
|
+
type: 'record-field-increment',
|
|
92627
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92628
|
+
value: -quantityConsumed,
|
|
92629
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92630
|
+
tag: draftActionId,
|
|
92631
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92632
|
+
timestamp: draftActionTimestamp,
|
|
92633
|
+
};
|
|
92634
|
+
return [effect];
|
|
92635
|
+
}
|
|
92636
|
+
}
|
|
92637
|
+
ProductConsumedCreatedHook.COUNTER_NAME = 'ProductConsumedCreatedHook';
|
|
92638
|
+
class ProductConsumedUpdatedHook {
|
|
92639
|
+
constructor(durableRecordStore) {
|
|
92640
|
+
this.durableRecordStore = durableRecordStore;
|
|
92641
|
+
this.on = 'patch';
|
|
92642
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92643
|
+
}
|
|
92644
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId, fields) {
|
|
92645
|
+
const quantityConsumed = getQuantityConsumed(fields);
|
|
92646
|
+
if (quantityConsumed === undefined) {
|
|
92647
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92648
|
+
return [];
|
|
92649
|
+
}
|
|
92650
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92651
|
+
if (originalRecord === undefined) {
|
|
92652
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92653
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} not found`);
|
|
92654
|
+
return [];
|
|
92655
|
+
}
|
|
92656
|
+
const originalProductItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92657
|
+
const originalQuantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92658
|
+
if (originalProductItemId === undefined) {
|
|
92659
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92660
|
+
return [];
|
|
92661
|
+
}
|
|
92662
|
+
if (originalQuantityConsumed === undefined) {
|
|
92663
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Error);
|
|
92664
|
+
instrumentation$2.error(`SFS - ProductConsumedUpdatedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92665
|
+
return [];
|
|
92666
|
+
}
|
|
92667
|
+
incrementCounter(ProductConsumedUpdatedHook.COUNTER_NAME, CounterResult.Created);
|
|
92668
|
+
const effect = {
|
|
92669
|
+
type: 'record-field-increment',
|
|
92670
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92671
|
+
value: originalQuantityConsumed - quantityConsumed,
|
|
92672
|
+
key: buildRecordRepKeyFromId$1(originalProductItemId),
|
|
92673
|
+
tag: draftActionId,
|
|
92674
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92675
|
+
timestamp: draftActionTimestamp,
|
|
92676
|
+
};
|
|
92677
|
+
return [effect];
|
|
92678
|
+
}
|
|
92679
|
+
}
|
|
92680
|
+
ProductConsumedUpdatedHook.COUNTER_NAME = 'ProductConsumedUpdatedHook';
|
|
92681
|
+
class ProductConsumedDeletedHook {
|
|
92682
|
+
constructor(durableRecordStore) {
|
|
92683
|
+
this.durableRecordStore = durableRecordStore;
|
|
92684
|
+
this.on = 'delete';
|
|
92685
|
+
this.apiName = ProductConsumed.API_NAME;
|
|
92686
|
+
}
|
|
92687
|
+
async then(draftActionId, draftActionTimestamp, draftRecordId) {
|
|
92688
|
+
const originalRecord = await this.durableRecordStore.getRecord(buildRecordRepKeyFromId$1(draftRecordId));
|
|
92689
|
+
if (originalRecord === undefined) {
|
|
92690
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92691
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} not found`);
|
|
92692
|
+
return [];
|
|
92693
|
+
}
|
|
92694
|
+
const productItemId = getProductItemIdFromRecordFields(originalRecord.fields);
|
|
92695
|
+
const quantityConsumed = getQuantityConsumedFromRecordFields(originalRecord.fields);
|
|
92696
|
+
if (productItemId === undefined) {
|
|
92697
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Exited);
|
|
92698
|
+
return [];
|
|
92699
|
+
}
|
|
92700
|
+
if (quantityConsumed === undefined) {
|
|
92701
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Error);
|
|
92702
|
+
instrumentation$2.error(`SFS - ProductConsumedDeletedHook - Original record ${draftRecordId} QuantityConsumed not found`);
|
|
92703
|
+
return [];
|
|
92704
|
+
}
|
|
92705
|
+
incrementCounter(ProductConsumedDeletedHook.COUNTER_NAME, CounterResult.Created);
|
|
92706
|
+
const effect = {
|
|
92707
|
+
type: 'record-field-increment',
|
|
92708
|
+
fieldName: ProductItem.Fields.QUANTITY_ON_HAND,
|
|
92709
|
+
value: quantityConsumed,
|
|
92710
|
+
key: buildRecordRepKeyFromId$1(productItemId),
|
|
92711
|
+
tag: draftActionId,
|
|
92712
|
+
uniqueId: `${draftActionId}-ProductItem`,
|
|
92713
|
+
timestamp: draftActionTimestamp,
|
|
92714
|
+
};
|
|
92715
|
+
return [effect];
|
|
92716
|
+
}
|
|
92717
|
+
}
|
|
92718
|
+
ProductConsumedDeletedHook.COUNTER_NAME = 'ProductConsumedDeletedHook';
|
|
92719
|
+
function getProductItemId(fields) {
|
|
92720
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92721
|
+
if (field === undefined || typeof field !== 'string') {
|
|
92722
|
+
return undefined;
|
|
92723
|
+
}
|
|
92724
|
+
return field;
|
|
92725
|
+
}
|
|
92726
|
+
function getProductItemIdFromRecordFields(fields) {
|
|
92727
|
+
const field = fields[ProductConsumed.Fields.PRODUCT_ITEM_ID];
|
|
92728
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'string') {
|
|
92729
|
+
return undefined;
|
|
92730
|
+
}
|
|
92731
|
+
return field.value;
|
|
92732
|
+
}
|
|
92733
|
+
function getQuantityConsumed(fields) {
|
|
92734
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92735
|
+
if (field === undefined || typeof field !== 'number') {
|
|
92736
|
+
return undefined;
|
|
92737
|
+
}
|
|
92738
|
+
return field;
|
|
92739
|
+
}
|
|
92740
|
+
function getQuantityConsumedFromRecordFields(fields) {
|
|
92741
|
+
const field = fields[ProductConsumed.Fields.QUANTITY_CONSUMED];
|
|
92742
|
+
if (field === undefined || field.value === undefined || typeof field.value !== 'number') {
|
|
92743
|
+
return undefined;
|
|
92744
|
+
}
|
|
92745
|
+
return field.value;
|
|
92746
|
+
}
|
|
92747
|
+
var CounterResult;
|
|
92748
|
+
(function (CounterResult) {
|
|
92749
|
+
// A side effect was created.
|
|
92750
|
+
CounterResult["Created"] = "Created";
|
|
92751
|
+
// The hook exited early.
|
|
92752
|
+
CounterResult["Exited"] = "Exited";
|
|
92753
|
+
// An unexpected error occurred.
|
|
92754
|
+
CounterResult["Error"] = "Error";
|
|
92755
|
+
})(CounterResult || (CounterResult = {}));
|
|
92756
|
+
function incrementCounter(name, result) {
|
|
92757
|
+
instrumentation$2.incrementCounter('SFSSideEffect', 1, result == CounterResult.Error, {
|
|
92758
|
+
Name: name,
|
|
92759
|
+
Result: result,
|
|
92760
|
+
});
|
|
92761
|
+
}
|
|
92762
|
+
|
|
92580
92763
|
function createSfsSideEffectHooks(durableRecordStore) {
|
|
92581
|
-
if (
|
|
92582
|
-
return [
|
|
92764
|
+
if (productConsumedSideEffects.isOpen({ fallback: false })) {
|
|
92765
|
+
return [
|
|
92766
|
+
new ProductConsumedCreatedHook(),
|
|
92767
|
+
new ProductConsumedUpdatedHook(durableRecordStore),
|
|
92768
|
+
new ProductConsumedDeletedHook(durableRecordStore),
|
|
92769
|
+
];
|
|
92583
92770
|
}
|
|
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
|
-
];
|
|
92771
|
+
return [];
|
|
92591
92772
|
}
|
|
92592
92773
|
|
|
92593
92774
|
// so eslint doesn't complain about nimbus
|
|
@@ -92670,7 +92851,7 @@
|
|
|
92670
92851
|
lazySideEffectService = new SideEffectService(lazyDurableRecordStore, lazyObjectInfoService, userId, formatDisplayValue);
|
|
92671
92852
|
const draftService = new UiApiDraftRecordService(() => lazyLuvio, lazyDurableStore, lazyObjectInfoService, newRecordId, lazySideEffectStore, lazyDurableRecordStore);
|
|
92672
92853
|
const uiApiRecordHandler = new UiApiActionHandler(() => lazyLuvio, lazyNetworkAdapter, lazyDraftQueue, getRecord, lazyObjectInfoService, isGenerated, draftService, lazySideEffectService, lazyDurableRecordStore);
|
|
92673
|
-
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks());
|
|
92854
|
+
uiApiRecordHandler.setSideEffectHooks(createSfsSideEffectHooks(lazyDurableRecordStore));
|
|
92674
92855
|
const quickActionHandler = new QuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService, lazyObjectInfoService, getRecord);
|
|
92675
92856
|
const updateRecordQuickActionHandler = new UpdateRecordQuickActionExecutionRepresentationHandler(() => lazyLuvio, draftService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, lazySideEffectService);
|
|
92676
92857
|
const contentDocumentCompositeActionHandler = new ContentDocumentCompositeRepresentationActionHandler(() => lazyLuvio, userId, draftService, lazyObjectInfoService, lazyDraftQueue, lazyNetworkAdapter, isGenerated, NimbusBinaryStore, lazySideEffectService);
|
|
@@ -92778,7 +92959,7 @@
|
|
|
92778
92959
|
id: '@salesforce/lds-network-adapter',
|
|
92779
92960
|
instrument: instrument$2,
|
|
92780
92961
|
});
|
|
92781
|
-
// version: 1.
|
|
92962
|
+
// version: 1.349.0-3d2a6c656b
|
|
92782
92963
|
|
|
92783
92964
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92784
92965
|
const { stringify, parse } = JSON;
|
|
@@ -116673,7 +116854,7 @@
|
|
|
116673
116854
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116674
116855
|
instrument: instrument$1,
|
|
116675
116856
|
});
|
|
116676
|
-
// version: 1.
|
|
116857
|
+
// version: 1.349.0-2008e7132b
|
|
116677
116858
|
|
|
116678
116859
|
// On core the unstable adapters are re-exported with different names,
|
|
116679
116860
|
// we want to match them here.
|
|
@@ -116825,7 +117006,7 @@
|
|
|
116825
117006
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
116826
117007
|
graphQLImperative = ldsAdapter;
|
|
116827
117008
|
});
|
|
116828
|
-
// version: 1.
|
|
117009
|
+
// version: 1.349.0-2008e7132b
|
|
116829
117010
|
|
|
116830
117011
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
116831
117012
|
__proto__: null,
|
|
@@ -117617,7 +117798,7 @@
|
|
|
117617
117798
|
function register(r) {
|
|
117618
117799
|
callbacks$1.forEach((callback) => callback(r));
|
|
117619
117800
|
}
|
|
117620
|
-
// version: 1.
|
|
117801
|
+
// version: 1.349.0-3d2a6c656b
|
|
117621
117802
|
|
|
117622
117803
|
/**
|
|
117623
117804
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118716,4 +118897,4 @@
|
|
|
118716
118897
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
118717
118898
|
|
|
118718
118899
|
}));
|
|
118719
|
-
// version: 1.
|
|
118900
|
+
// version: 1.349.0-3d2a6c656b
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.349.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.349.0",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.349.0",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.349.0",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.349.0",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.349.0",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.349.0",
|
|
44
|
+
"@salesforce/lds-runtime-mobile": "^1.349.0",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.349.0",
|
|
46
46
|
"ajv": "^8.11.0",
|
|
47
47
|
"glob": "^7.1.5",
|
|
48
48
|
"nimbus-types": "^2.0.0-alpha1",
|