@salesforce/lds-runtime-mobile 1.282.0 → 1.284.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +115 -38
- package/dist/types/observer/setupObserver.d.ts +1 -0
- package/package.json +18 -18
- package/sfdc/main.js +115 -38
- package/sfdc/types/observer/setupObserver.d.ts +1 -0
- package/dist/types/inspection/setupInspection.d.ts +0 -2
- package/sfdc/types/inspection/setupInspection.d.ts +0 -2
package/dist/main.js
CHANGED
|
@@ -5514,6 +5514,10 @@ class DurableDraftQueue {
|
|
|
5514
5514
|
switch (result) {
|
|
5515
5515
|
case ProcessActionResult.BLOCKED_ON_ERROR:
|
|
5516
5516
|
this.state = DraftQueueState.Error;
|
|
5517
|
+
await this.notifyChangedListeners({
|
|
5518
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
5519
|
+
state: this.state,
|
|
5520
|
+
});
|
|
5517
5521
|
return Promise.reject();
|
|
5518
5522
|
default:
|
|
5519
5523
|
return Promise.resolve();
|
|
@@ -8045,6 +8049,9 @@ function createSinglePredicate(val, operator, field, alias) {
|
|
|
8045
8049
|
else if (field.apiName === 'weakEtag') {
|
|
8046
8050
|
leftPath = '$.weakEtag';
|
|
8047
8051
|
}
|
|
8052
|
+
else if (field.apiName === 'RecordTypeId') {
|
|
8053
|
+
leftPath = '$.recordTypeId';
|
|
8054
|
+
}
|
|
8048
8055
|
return {
|
|
8049
8056
|
alias,
|
|
8050
8057
|
leftPath,
|
|
@@ -11318,7 +11325,7 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
|
|
|
11318
11325
|
* @param objectInfos
|
|
11319
11326
|
* @returns
|
|
11320
11327
|
*/
|
|
11321
|
-
function injectFieldsForDisplayValue(topNode,
|
|
11328
|
+
function injectFieldsForDisplayValue(topNode, apiName, objectInfos) {
|
|
11322
11329
|
const { selectionSet } = topNode;
|
|
11323
11330
|
if (selectionSet === undefined)
|
|
11324
11331
|
return [];
|
|
@@ -11332,13 +11339,8 @@ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
|
|
|
11332
11339
|
displayValue = node;
|
|
11333
11340
|
break;
|
|
11334
11341
|
}
|
|
11335
|
-
if (isInlineFragmentNode(node)) {
|
|
11336
|
-
const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
|
|
11337
|
-
displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
|
|
11338
|
-
}
|
|
11339
11342
|
}
|
|
11340
11343
|
if (displayValue !== undefined) {
|
|
11341
|
-
const apiName = parentNode.name.value;
|
|
11342
11344
|
const objectInfo = objectInfos[apiName];
|
|
11343
11345
|
if (objectInfo !== undefined &&
|
|
11344
11346
|
objectInfo.nameFields !== undefined &&
|
|
@@ -11405,19 +11407,24 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
|
|
|
11405
11407
|
// example: TimeSheetId { value }
|
|
11406
11408
|
relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
|
|
11407
11409
|
}
|
|
11408
|
-
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode,
|
|
11409
|
-
...parent,
|
|
11410
|
-
name: {
|
|
11411
|
-
...parent.name,
|
|
11412
|
-
value: targetRelationship.childObjectApiName,
|
|
11413
|
-
},
|
|
11414
|
-
}, objectInfos));
|
|
11410
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
|
|
11415
11411
|
}
|
|
11416
11412
|
}
|
|
11417
11413
|
}
|
|
11418
|
-
|
|
11414
|
+
else {
|
|
11415
|
+
let apiName = parent.name.value;
|
|
11416
|
+
if (pathToObjectApiNamesMap[parentPath] !== undefined &&
|
|
11417
|
+
pathToObjectApiNamesMap[parentPath].length === 1) {
|
|
11418
|
+
apiName = pathToObjectApiNamesMap[parentPath][0];
|
|
11419
|
+
}
|
|
11420
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
|
|
11421
|
+
}
|
|
11419
11422
|
}
|
|
11420
11423
|
}
|
|
11424
|
+
else if (isInlineFragmentNode(parentNode) && parentNode.typeCondition !== undefined) {
|
|
11425
|
+
const { typeCondition: { name: { value: apiName }, }, } = parentNode;
|
|
11426
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
|
|
11427
|
+
}
|
|
11421
11428
|
return [
|
|
11422
11429
|
...rootQueryIdField,
|
|
11423
11430
|
...flat(parentRelaltionships),
|
|
@@ -11668,6 +11675,10 @@ function removeSyntheticFields(result, query) {
|
|
|
11668
11675
|
// build our output from the original result set
|
|
11669
11676
|
// so we keep any other results that are not included in a record query
|
|
11670
11677
|
const output = { ...result };
|
|
11678
|
+
// graphqlBatch return deep frozon object, need to spread out new writeable copy for injected field removal
|
|
11679
|
+
output.data = { ...output.data };
|
|
11680
|
+
output.data.uiapi = { ...output.data.uiapi };
|
|
11681
|
+
output.data.uiapi.query = { ...output.data.uiapi.query };
|
|
11671
11682
|
const outputApiParent = output.data.uiapi.query;
|
|
11672
11683
|
const keys$1 = keys$4(nodeJson);
|
|
11673
11684
|
keys$1.forEach((recordName) => {
|
|
@@ -13098,6 +13109,9 @@ function normalizeRecordFields(key, entry) {
|
|
|
13098
13109
|
* Transforms a record for storage in the durable store. The transformation involves denormalizing
|
|
13099
13110
|
* scalar fields and persisting link metadata to transform back into a normalized representation
|
|
13100
13111
|
*
|
|
13112
|
+
* If the record contains pending fields this will return undefined as pending records do not get persisted
|
|
13113
|
+
* to the durable store. There should be a refresh operation outbound that will bring in the updated record.
|
|
13114
|
+
*
|
|
13101
13115
|
* @param normalizedRecord Record containing normalized field links
|
|
13102
13116
|
* @param recordStore a store containing referenced record fields
|
|
13103
13117
|
*/
|
|
@@ -13112,7 +13126,9 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
|
|
|
13112
13126
|
// pending fields get filtered out of the durable store
|
|
13113
13127
|
const { pending } = field;
|
|
13114
13128
|
if (pending === true) {
|
|
13115
|
-
|
|
13129
|
+
// do not write records with pending fields to the durable store
|
|
13130
|
+
// there should be a refresh operation outbound that will bring in the updated record
|
|
13131
|
+
return undefined;
|
|
13116
13132
|
}
|
|
13117
13133
|
const { __ref } = field;
|
|
13118
13134
|
if (__ref !== undefined) {
|
|
@@ -13278,10 +13294,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
13278
13294
|
};
|
|
13279
13295
|
}
|
|
13280
13296
|
const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13297
|
+
if (denormalizedRecord !== undefined) {
|
|
13298
|
+
putEntries[recordKey] = {
|
|
13299
|
+
data: denormalizedRecord,
|
|
13300
|
+
metadata,
|
|
13301
|
+
};
|
|
13302
|
+
}
|
|
13285
13303
|
}
|
|
13286
13304
|
else {
|
|
13287
13305
|
putEntries[key] = value;
|
|
@@ -13771,11 +13789,14 @@ const replaceDraftIdsInVariables = (variables, draftFunctions, unmappedDraftIDs)
|
|
|
13771
13789
|
};
|
|
13772
13790
|
// create the runtime cache for the graphql schema when the factory creates the adapter
|
|
13773
13791
|
const graphqlSchemaCache = new CachedGraphQLSchema();
|
|
13774
|
-
function
|
|
13775
|
-
|
|
13792
|
+
function getCanonicalIdFunction(luvio) {
|
|
13793
|
+
return (id) => {
|
|
13776
13794
|
var _a;
|
|
13777
13795
|
return ((_a = extractRecordIdFromStoreKey(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX + id))) !== null && _a !== void 0 ? _a : id);
|
|
13778
13796
|
};
|
|
13797
|
+
}
|
|
13798
|
+
function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
|
|
13799
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13779
13800
|
return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13780
13801
|
//create a copy to not accidentally modify the AST in the astResolver map of luvio
|
|
13781
13802
|
const copy = parse$3(stringify$3(config.query));
|
|
@@ -13925,9 +13946,61 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
13925
13946
|
return resultSnapshot;
|
|
13926
13947
|
};
|
|
13927
13948
|
}
|
|
13928
|
-
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
|
|
13949
|
+
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
|
|
13929
13950
|
return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13930
|
-
|
|
13951
|
+
const batchQueryCopy = config.batchQuery.map((query) => clone(query));
|
|
13952
|
+
let injectedBatchQuery = [];
|
|
13953
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13954
|
+
const draftFunctions = {
|
|
13955
|
+
isDraftId,
|
|
13956
|
+
getCanonicalId,
|
|
13957
|
+
};
|
|
13958
|
+
// return error snapshot if fails injecting fields into grapqhBatch batchQuery
|
|
13959
|
+
try {
|
|
13960
|
+
injectedBatchQuery = await Promise.all(batchQueryCopy.map((query) => injectSyntheticFields(query.query, objectInfoService, draftFunctions, query.variables)));
|
|
13961
|
+
}
|
|
13962
|
+
catch (error) {
|
|
13963
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
13964
|
+
return {
|
|
13965
|
+
data: undefined,
|
|
13966
|
+
state: 'Error',
|
|
13967
|
+
error: {
|
|
13968
|
+
errorType: 'adapterError',
|
|
13969
|
+
error: {
|
|
13970
|
+
message,
|
|
13971
|
+
},
|
|
13972
|
+
},
|
|
13973
|
+
};
|
|
13974
|
+
}
|
|
13975
|
+
const injectedConfig = {
|
|
13976
|
+
batchQuery: injectedBatchQuery.map((query, index) => {
|
|
13977
|
+
return {
|
|
13978
|
+
query: query.modifiedAST,
|
|
13979
|
+
variables: config.batchQuery[index].variables,
|
|
13980
|
+
};
|
|
13981
|
+
}),
|
|
13982
|
+
};
|
|
13983
|
+
const snapshot = (await luvio.applyCachePolicy(requestContext, { config: injectedConfig, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
|
|
13984
|
+
if (snapshot.state === 'Error') {
|
|
13985
|
+
return snapshot;
|
|
13986
|
+
}
|
|
13987
|
+
// remove injected fields from response.
|
|
13988
|
+
const data = snapshot.data;
|
|
13989
|
+
const userResults = data.results.map((compositeResult, index) => {
|
|
13990
|
+
if (compositeResult.statusCode === HttpStatusCode.Ok) {
|
|
13991
|
+
return {
|
|
13992
|
+
result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
|
|
13993
|
+
statusCode: compositeResult.statusCode,
|
|
13994
|
+
};
|
|
13995
|
+
}
|
|
13996
|
+
return compositeResult;
|
|
13997
|
+
});
|
|
13998
|
+
return {
|
|
13999
|
+
...snapshot,
|
|
14000
|
+
data: {
|
|
14001
|
+
results: userResults,
|
|
14002
|
+
},
|
|
14003
|
+
};
|
|
13931
14004
|
};
|
|
13932
14005
|
}
|
|
13933
14006
|
|
|
@@ -16802,17 +16875,6 @@ const NimbusBinaryStore = {
|
|
|
16802
16875
|
},
|
|
16803
16876
|
};
|
|
16804
16877
|
|
|
16805
|
-
function setupInspection(luvio) {
|
|
16806
|
-
if (__nimbus.plugins.LdsInspectorPlugin !== undefined) {
|
|
16807
|
-
// when inspection is enabled, make luvio available as a global
|
|
16808
|
-
// eslint-disable-next-line no-undef
|
|
16809
|
-
globalThis.luvio = luvio;
|
|
16810
|
-
registerReportObserver((report) => {
|
|
16811
|
-
__nimbus.plugins.LdsInspectorPlugin.sendAdapterReport(stringify$1(report));
|
|
16812
|
-
});
|
|
16813
|
-
}
|
|
16814
|
-
}
|
|
16815
|
-
|
|
16816
16878
|
/**
|
|
16817
16879
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
16818
16880
|
* All rights reserved.
|
|
@@ -17936,6 +17998,21 @@ function primingSessionFactory(config) {
|
|
|
17936
17998
|
return instrumentPrimingSession(session);
|
|
17937
17999
|
}
|
|
17938
18000
|
|
|
18001
|
+
// so eslint doesn't complain about nimbus
|
|
18002
|
+
/* global __nimbus */
|
|
18003
|
+
function setupObserver() {
|
|
18004
|
+
if (__nimbus.plugins.LdsObserverPlugin !== undefined) {
|
|
18005
|
+
registerReportObserver((report) => {
|
|
18006
|
+
__nimbus.plugins.LdsObserverPlugin.logAdapterExecution({
|
|
18007
|
+
name: report.adapterName,
|
|
18008
|
+
serializedConfig: stringify$1(report.config),
|
|
18009
|
+
status: report.result,
|
|
18010
|
+
duration: report.executionTime,
|
|
18011
|
+
});
|
|
18012
|
+
});
|
|
18013
|
+
}
|
|
18014
|
+
}
|
|
18015
|
+
|
|
17939
18016
|
// so eslint doesn't complain about nimbus
|
|
17940
18017
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17941
18018
|
/* global __nimbus */
|
|
@@ -18030,8 +18107,8 @@ function getRuntime() {
|
|
|
18030
18107
|
lazyGetRecords = getRecordsAdapterFactory(lazyLuvio);
|
|
18031
18108
|
// Currently instruments store runtime perf
|
|
18032
18109
|
setupMobileInstrumentation(lazyLuvio, store);
|
|
18033
|
-
// If the
|
|
18034
|
-
|
|
18110
|
+
// If the observer nimbus plugin is configured, observation is enabled otherwise this is a no-op
|
|
18111
|
+
setupObserver();
|
|
18035
18112
|
// set storeEval function for lds-adapters-graghql to use
|
|
18036
18113
|
withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
|
|
18037
18114
|
const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
|
|
@@ -18054,7 +18131,7 @@ function getRuntime() {
|
|
|
18054
18131
|
setDraftAwareGraphQLAdapter(
|
|
18055
18132
|
// return a draft aware graphql adapter here
|
|
18056
18133
|
draftAwareGraphQLAdapter);
|
|
18057
|
-
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
|
|
18134
|
+
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
|
|
18058
18135
|
setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
|
|
18059
18136
|
};
|
|
18060
18137
|
const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
|
|
@@ -18104,4 +18181,4 @@ register({
|
|
|
18104
18181
|
});
|
|
18105
18182
|
|
|
18106
18183
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
18107
|
-
// version: 1.
|
|
18184
|
+
// version: 1.284.0-a7e8dc51c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupObserver(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-mobile",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.284.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS runtime for mobile/hybrid environments.",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -32,25 +32,25 @@
|
|
|
32
32
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
36
|
-
"@salesforce/lds-bindings": "^1.
|
|
37
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
38
|
-
"@salesforce/lds-priming": "^1.
|
|
35
|
+
"@salesforce/lds-adapters-uiapi": "^1.284.0",
|
|
36
|
+
"@salesforce/lds-bindings": "^1.284.0",
|
|
37
|
+
"@salesforce/lds-instrumentation": "^1.284.0",
|
|
38
|
+
"@salesforce/lds-priming": "^1.284.0",
|
|
39
39
|
"@salesforce/user": "0.0.21",
|
|
40
40
|
"o11y": "244.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@salesforce/lds-adapters-graphql": "^1.
|
|
44
|
-
"@salesforce/lds-drafts": "^1.
|
|
45
|
-
"@salesforce/lds-drafts-adapters-uiapi": "^1.
|
|
46
|
-
"@salesforce/lds-graphql-eval": "^1.
|
|
47
|
-
"@salesforce/lds-network-adapter": "^1.
|
|
48
|
-
"@salesforce/lds-network-nimbus": "^1.
|
|
49
|
-
"@salesforce/lds-store-binary": "^1.
|
|
50
|
-
"@salesforce/lds-store-nimbus": "^1.
|
|
51
|
-
"@salesforce/lds-store-sql": "^1.
|
|
52
|
-
"@salesforce/lds-utils-adapters": "^1.
|
|
53
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
43
|
+
"@salesforce/lds-adapters-graphql": "^1.284.0",
|
|
44
|
+
"@salesforce/lds-drafts": "^1.284.0",
|
|
45
|
+
"@salesforce/lds-drafts-adapters-uiapi": "^1.284.0",
|
|
46
|
+
"@salesforce/lds-graphql-eval": "^1.284.0",
|
|
47
|
+
"@salesforce/lds-network-adapter": "^1.284.0",
|
|
48
|
+
"@salesforce/lds-network-nimbus": "^1.284.0",
|
|
49
|
+
"@salesforce/lds-store-binary": "^1.284.0",
|
|
50
|
+
"@salesforce/lds-store-nimbus": "^1.284.0",
|
|
51
|
+
"@salesforce/lds-store-sql": "^1.284.0",
|
|
52
|
+
"@salesforce/lds-utils-adapters": "^1.284.0",
|
|
53
|
+
"@salesforce/nimbus-plugin-lds": "^1.284.0",
|
|
54
54
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
55
55
|
"wait-for-expect": "^3.0.2"
|
|
56
56
|
},
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"path": "./dist/main.js",
|
|
60
60
|
"maxSize": {
|
|
61
61
|
"none": "800 kB",
|
|
62
|
-
"min": "
|
|
62
|
+
"min": "322 kB",
|
|
63
63
|
"compressed": "150 kB"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"path": "./sfdc/main.js",
|
|
68
68
|
"maxSize": {
|
|
69
69
|
"none": "800 kB",
|
|
70
|
-
"min": "
|
|
70
|
+
"min": "322 kB",
|
|
71
71
|
"compressed": "150 kB"
|
|
72
72
|
}
|
|
73
73
|
}
|
package/sfdc/main.js
CHANGED
|
@@ -5514,6 +5514,10 @@ class DurableDraftQueue {
|
|
|
5514
5514
|
switch (result) {
|
|
5515
5515
|
case ProcessActionResult.BLOCKED_ON_ERROR:
|
|
5516
5516
|
this.state = DraftQueueState.Error;
|
|
5517
|
+
await this.notifyChangedListeners({
|
|
5518
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
5519
|
+
state: this.state,
|
|
5520
|
+
});
|
|
5517
5521
|
return Promise.reject();
|
|
5518
5522
|
default:
|
|
5519
5523
|
return Promise.resolve();
|
|
@@ -8045,6 +8049,9 @@ function createSinglePredicate(val, operator, field, alias) {
|
|
|
8045
8049
|
else if (field.apiName === 'weakEtag') {
|
|
8046
8050
|
leftPath = '$.weakEtag';
|
|
8047
8051
|
}
|
|
8052
|
+
else if (field.apiName === 'RecordTypeId') {
|
|
8053
|
+
leftPath = '$.recordTypeId';
|
|
8054
|
+
}
|
|
8048
8055
|
return {
|
|
8049
8056
|
alias,
|
|
8050
8057
|
leftPath,
|
|
@@ -11318,7 +11325,7 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
|
|
|
11318
11325
|
* @param objectInfos
|
|
11319
11326
|
* @returns
|
|
11320
11327
|
*/
|
|
11321
|
-
function injectFieldsForDisplayValue(topNode,
|
|
11328
|
+
function injectFieldsForDisplayValue(topNode, apiName, objectInfos) {
|
|
11322
11329
|
const { selectionSet } = topNode;
|
|
11323
11330
|
if (selectionSet === undefined)
|
|
11324
11331
|
return [];
|
|
@@ -11332,13 +11339,8 @@ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
|
|
|
11332
11339
|
displayValue = node;
|
|
11333
11340
|
break;
|
|
11334
11341
|
}
|
|
11335
|
-
if (isInlineFragmentNode(node)) {
|
|
11336
|
-
const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
|
|
11337
|
-
displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
|
|
11338
|
-
}
|
|
11339
11342
|
}
|
|
11340
11343
|
if (displayValue !== undefined) {
|
|
11341
|
-
const apiName = parentNode.name.value;
|
|
11342
11344
|
const objectInfo = objectInfos[apiName];
|
|
11343
11345
|
if (objectInfo !== undefined &&
|
|
11344
11346
|
objectInfo.nameFields !== undefined &&
|
|
@@ -11405,19 +11407,24 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
|
|
|
11405
11407
|
// example: TimeSheetId { value }
|
|
11406
11408
|
relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
|
|
11407
11409
|
}
|
|
11408
|
-
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode,
|
|
11409
|
-
...parent,
|
|
11410
|
-
name: {
|
|
11411
|
-
...parent.name,
|
|
11412
|
-
value: targetRelationship.childObjectApiName,
|
|
11413
|
-
},
|
|
11414
|
-
}, objectInfos));
|
|
11410
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
|
|
11415
11411
|
}
|
|
11416
11412
|
}
|
|
11417
11413
|
}
|
|
11418
|
-
|
|
11414
|
+
else {
|
|
11415
|
+
let apiName = parent.name.value;
|
|
11416
|
+
if (pathToObjectApiNamesMap[parentPath] !== undefined &&
|
|
11417
|
+
pathToObjectApiNamesMap[parentPath].length === 1) {
|
|
11418
|
+
apiName = pathToObjectApiNamesMap[parentPath][0];
|
|
11419
|
+
}
|
|
11420
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
|
|
11421
|
+
}
|
|
11419
11422
|
}
|
|
11420
11423
|
}
|
|
11424
|
+
else if (isInlineFragmentNode(parentNode) && parentNode.typeCondition !== undefined) {
|
|
11425
|
+
const { typeCondition: { name: { value: apiName }, }, } = parentNode;
|
|
11426
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
|
|
11427
|
+
}
|
|
11421
11428
|
return [
|
|
11422
11429
|
...rootQueryIdField,
|
|
11423
11430
|
...flat(parentRelaltionships),
|
|
@@ -11668,6 +11675,10 @@ function removeSyntheticFields(result, query) {
|
|
|
11668
11675
|
// build our output from the original result set
|
|
11669
11676
|
// so we keep any other results that are not included in a record query
|
|
11670
11677
|
const output = { ...result };
|
|
11678
|
+
// graphqlBatch return deep frozon object, need to spread out new writeable copy for injected field removal
|
|
11679
|
+
output.data = { ...output.data };
|
|
11680
|
+
output.data.uiapi = { ...output.data.uiapi };
|
|
11681
|
+
output.data.uiapi.query = { ...output.data.uiapi.query };
|
|
11671
11682
|
const outputApiParent = output.data.uiapi.query;
|
|
11672
11683
|
const keys$1 = keys$4(nodeJson);
|
|
11673
11684
|
keys$1.forEach((recordName) => {
|
|
@@ -13098,6 +13109,9 @@ function normalizeRecordFields(key, entry) {
|
|
|
13098
13109
|
* Transforms a record for storage in the durable store. The transformation involves denormalizing
|
|
13099
13110
|
* scalar fields and persisting link metadata to transform back into a normalized representation
|
|
13100
13111
|
*
|
|
13112
|
+
* If the record contains pending fields this will return undefined as pending records do not get persisted
|
|
13113
|
+
* to the durable store. There should be a refresh operation outbound that will bring in the updated record.
|
|
13114
|
+
*
|
|
13101
13115
|
* @param normalizedRecord Record containing normalized field links
|
|
13102
13116
|
* @param recordStore a store containing referenced record fields
|
|
13103
13117
|
*/
|
|
@@ -13112,7 +13126,9 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
|
|
|
13112
13126
|
// pending fields get filtered out of the durable store
|
|
13113
13127
|
const { pending } = field;
|
|
13114
13128
|
if (pending === true) {
|
|
13115
|
-
|
|
13129
|
+
// do not write records with pending fields to the durable store
|
|
13130
|
+
// there should be a refresh operation outbound that will bring in the updated record
|
|
13131
|
+
return undefined;
|
|
13116
13132
|
}
|
|
13117
13133
|
const { __ref } = field;
|
|
13118
13134
|
if (__ref !== undefined) {
|
|
@@ -13278,10 +13294,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
13278
13294
|
};
|
|
13279
13295
|
}
|
|
13280
13296
|
const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13297
|
+
if (denormalizedRecord !== undefined) {
|
|
13298
|
+
putEntries[recordKey] = {
|
|
13299
|
+
data: denormalizedRecord,
|
|
13300
|
+
metadata,
|
|
13301
|
+
};
|
|
13302
|
+
}
|
|
13285
13303
|
}
|
|
13286
13304
|
else {
|
|
13287
13305
|
putEntries[key] = value;
|
|
@@ -13771,11 +13789,14 @@ const replaceDraftIdsInVariables = (variables, draftFunctions, unmappedDraftIDs)
|
|
|
13771
13789
|
};
|
|
13772
13790
|
// create the runtime cache for the graphql schema when the factory creates the adapter
|
|
13773
13791
|
const graphqlSchemaCache = new CachedGraphQLSchema();
|
|
13774
|
-
function
|
|
13775
|
-
|
|
13792
|
+
function getCanonicalIdFunction(luvio) {
|
|
13793
|
+
return (id) => {
|
|
13776
13794
|
var _a;
|
|
13777
13795
|
return ((_a = extractRecordIdFromStoreKey(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX + id))) !== null && _a !== void 0 ? _a : id);
|
|
13778
13796
|
};
|
|
13797
|
+
}
|
|
13798
|
+
function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
|
|
13799
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13779
13800
|
return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13780
13801
|
//create a copy to not accidentally modify the AST in the astResolver map of luvio
|
|
13781
13802
|
const copy = parse$3(stringify$3(config.query));
|
|
@@ -13925,9 +13946,61 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
13925
13946
|
return resultSnapshot;
|
|
13926
13947
|
};
|
|
13927
13948
|
}
|
|
13928
|
-
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
|
|
13949
|
+
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
|
|
13929
13950
|
return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13930
|
-
|
|
13951
|
+
const batchQueryCopy = config.batchQuery.map((query) => clone(query));
|
|
13952
|
+
let injectedBatchQuery = [];
|
|
13953
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13954
|
+
const draftFunctions = {
|
|
13955
|
+
isDraftId,
|
|
13956
|
+
getCanonicalId,
|
|
13957
|
+
};
|
|
13958
|
+
// return error snapshot if fails injecting fields into grapqhBatch batchQuery
|
|
13959
|
+
try {
|
|
13960
|
+
injectedBatchQuery = await Promise.all(batchQueryCopy.map((query) => injectSyntheticFields(query.query, objectInfoService, draftFunctions, query.variables)));
|
|
13961
|
+
}
|
|
13962
|
+
catch (error) {
|
|
13963
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
13964
|
+
return {
|
|
13965
|
+
data: undefined,
|
|
13966
|
+
state: 'Error',
|
|
13967
|
+
error: {
|
|
13968
|
+
errorType: 'adapterError',
|
|
13969
|
+
error: {
|
|
13970
|
+
message,
|
|
13971
|
+
},
|
|
13972
|
+
},
|
|
13973
|
+
};
|
|
13974
|
+
}
|
|
13975
|
+
const injectedConfig = {
|
|
13976
|
+
batchQuery: injectedBatchQuery.map((query, index) => {
|
|
13977
|
+
return {
|
|
13978
|
+
query: query.modifiedAST,
|
|
13979
|
+
variables: config.batchQuery[index].variables,
|
|
13980
|
+
};
|
|
13981
|
+
}),
|
|
13982
|
+
};
|
|
13983
|
+
const snapshot = (await luvio.applyCachePolicy(requestContext, { config: injectedConfig, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
|
|
13984
|
+
if (snapshot.state === 'Error') {
|
|
13985
|
+
return snapshot;
|
|
13986
|
+
}
|
|
13987
|
+
// remove injected fields from response.
|
|
13988
|
+
const data = snapshot.data;
|
|
13989
|
+
const userResults = data.results.map((compositeResult, index) => {
|
|
13990
|
+
if (compositeResult.statusCode === HttpStatusCode.Ok) {
|
|
13991
|
+
return {
|
|
13992
|
+
result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
|
|
13993
|
+
statusCode: compositeResult.statusCode,
|
|
13994
|
+
};
|
|
13995
|
+
}
|
|
13996
|
+
return compositeResult;
|
|
13997
|
+
});
|
|
13998
|
+
return {
|
|
13999
|
+
...snapshot,
|
|
14000
|
+
data: {
|
|
14001
|
+
results: userResults,
|
|
14002
|
+
},
|
|
14003
|
+
};
|
|
13931
14004
|
};
|
|
13932
14005
|
}
|
|
13933
14006
|
|
|
@@ -16802,17 +16875,6 @@ const NimbusBinaryStore = {
|
|
|
16802
16875
|
},
|
|
16803
16876
|
};
|
|
16804
16877
|
|
|
16805
|
-
function setupInspection(luvio) {
|
|
16806
|
-
if (__nimbus.plugins.LdsInspectorPlugin !== undefined) {
|
|
16807
|
-
// when inspection is enabled, make luvio available as a global
|
|
16808
|
-
// eslint-disable-next-line no-undef
|
|
16809
|
-
globalThis.luvio = luvio;
|
|
16810
|
-
registerReportObserver((report) => {
|
|
16811
|
-
__nimbus.plugins.LdsInspectorPlugin.sendAdapterReport(stringify$1(report));
|
|
16812
|
-
});
|
|
16813
|
-
}
|
|
16814
|
-
}
|
|
16815
|
-
|
|
16816
16878
|
/**
|
|
16817
16879
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
16818
16880
|
* All rights reserved.
|
|
@@ -17936,6 +17998,21 @@ function primingSessionFactory(config) {
|
|
|
17936
17998
|
return instrumentPrimingSession(session);
|
|
17937
17999
|
}
|
|
17938
18000
|
|
|
18001
|
+
// so eslint doesn't complain about nimbus
|
|
18002
|
+
/* global __nimbus */
|
|
18003
|
+
function setupObserver() {
|
|
18004
|
+
if (__nimbus.plugins.LdsObserverPlugin !== undefined) {
|
|
18005
|
+
registerReportObserver((report) => {
|
|
18006
|
+
__nimbus.plugins.LdsObserverPlugin.logAdapterExecution({
|
|
18007
|
+
name: report.adapterName,
|
|
18008
|
+
serializedConfig: stringify$1(report.config),
|
|
18009
|
+
status: report.result,
|
|
18010
|
+
duration: report.executionTime,
|
|
18011
|
+
});
|
|
18012
|
+
});
|
|
18013
|
+
}
|
|
18014
|
+
}
|
|
18015
|
+
|
|
17939
18016
|
// so eslint doesn't complain about nimbus
|
|
17940
18017
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17941
18018
|
/* global __nimbus */
|
|
@@ -18030,8 +18107,8 @@ function getRuntime() {
|
|
|
18030
18107
|
lazyGetRecords = getRecordsAdapterFactory(lazyLuvio);
|
|
18031
18108
|
// Currently instruments store runtime perf
|
|
18032
18109
|
setupMobileInstrumentation(lazyLuvio, store);
|
|
18033
|
-
// If the
|
|
18034
|
-
|
|
18110
|
+
// If the observer nimbus plugin is configured, observation is enabled otherwise this is a no-op
|
|
18111
|
+
setupObserver();
|
|
18035
18112
|
// set storeEval function for lds-adapters-graghql to use
|
|
18036
18113
|
withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
|
|
18037
18114
|
const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
|
|
@@ -18054,7 +18131,7 @@ function getRuntime() {
|
|
|
18054
18131
|
setDraftAwareGraphQLAdapter(
|
|
18055
18132
|
// return a draft aware graphql adapter here
|
|
18056
18133
|
draftAwareGraphQLAdapter);
|
|
18057
|
-
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
|
|
18134
|
+
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
|
|
18058
18135
|
setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
|
|
18059
18136
|
};
|
|
18060
18137
|
const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
|
|
@@ -18104,4 +18181,4 @@ register({
|
|
|
18104
18181
|
});
|
|
18105
18182
|
|
|
18106
18183
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
18107
|
-
// version: 1.
|
|
18184
|
+
// version: 1.284.0-a7e8dc51c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupObserver(): void;
|