@salesforce/lds-runtime-mobile 1.281.0 → 1.283.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 +107 -31
- package/package.json +18 -18
- package/sfdc/main.js +107 -31
package/dist/main.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { withRegistration, register } from '@salesforce/lds-default-luvio';
|
|
19
19
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from '@salesforce/lds-instrumentation';
|
|
20
|
-
import { HttpStatusCode, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from '@luvio/engine';
|
|
20
|
+
import { HttpStatusCode, setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from '@luvio/engine';
|
|
21
21
|
import excludeStaleRecordsGate from '@salesforce/gate/lds.graphqlEvalExcludeStaleRecords';
|
|
22
22
|
import { parseAndVisit, Kind, buildSchema, isObjectType, defaultFieldResolver, visit, execute, parse as parse$7, extendSchema, isScalarType } from '@luvio/graphql-parser';
|
|
23
23
|
import { RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, getRecordId18, RECORD_REPRESENTATION_NAME, extractRecordIdFromStoreKey, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, RECORD_VIEW_ENTITY_ID_PREFIX, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion, getRecordsAdapterFactory } from '@salesforce/lds-adapters-uiapi';
|
|
@@ -1019,7 +1019,9 @@ function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
|
|
|
1019
1019
|
* @param durableStore A DurableStore implementation
|
|
1020
1020
|
* @param instrumentation An instrumentation function implementation
|
|
1021
1021
|
*/
|
|
1022
|
-
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, }) {
|
|
1022
|
+
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
|
|
1023
|
+
// runtimes can choose to disable deepFreeze, e.g. headless mobile runtime
|
|
1024
|
+
setBypassDeepFreeze(disableDeepFreeze);
|
|
1023
1025
|
let stagingStore = null;
|
|
1024
1026
|
const durableTTLStore = new DurableTTLStore(durableStore);
|
|
1025
1027
|
const mergeKeysPromiseMap = new Map();
|
|
@@ -5512,6 +5514,10 @@ class DurableDraftQueue {
|
|
|
5512
5514
|
switch (result) {
|
|
5513
5515
|
case ProcessActionResult.BLOCKED_ON_ERROR:
|
|
5514
5516
|
this.state = DraftQueueState.Error;
|
|
5517
|
+
await this.notifyChangedListeners({
|
|
5518
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
5519
|
+
state: this.state,
|
|
5520
|
+
});
|
|
5515
5521
|
return Promise.reject();
|
|
5516
5522
|
default:
|
|
5517
5523
|
return Promise.resolve();
|
|
@@ -7967,6 +7973,9 @@ function sanitizePredicateIDValue(value, draftFunction) {
|
|
|
7967
7973
|
if (isArray$2(value)) {
|
|
7968
7974
|
return value.map((singleValue) => sanitizePredicateIDValue(singleValue, draftFunction));
|
|
7969
7975
|
}
|
|
7976
|
+
else if (typeof value === 'string' && value === '') {
|
|
7977
|
+
return value;
|
|
7978
|
+
}
|
|
7970
7979
|
else {
|
|
7971
7980
|
const coercedId = getRecordId18(value);
|
|
7972
7981
|
if (coercedId !== undefined) {
|
|
@@ -8040,6 +8049,9 @@ function createSinglePredicate(val, operator, field, alias) {
|
|
|
8040
8049
|
else if (field.apiName === 'weakEtag') {
|
|
8041
8050
|
leftPath = '$.weakEtag';
|
|
8042
8051
|
}
|
|
8052
|
+
else if (field.apiName === 'RecordTypeId') {
|
|
8053
|
+
leftPath = '$.recordTypeId';
|
|
8054
|
+
}
|
|
8043
8055
|
return {
|
|
8044
8056
|
alias,
|
|
8045
8057
|
leftPath,
|
|
@@ -8686,19 +8698,7 @@ function isCapableRelationship(node) {
|
|
|
8686
8698
|
});
|
|
8687
8699
|
}
|
|
8688
8700
|
}
|
|
8689
|
-
|
|
8690
|
-
if (!node.selectionSet)
|
|
8691
|
-
return false;
|
|
8692
|
-
return node.selectionSet.selections.some((selection) => {
|
|
8693
|
-
if (selection.kind !== Kind.FIELD && selection.kind !== Kind.INLINE_FRAGMENT)
|
|
8694
|
-
return false;
|
|
8695
|
-
// example: Account { Id }
|
|
8696
|
-
if (selection.kind === Kind.FIELD && selection.name.value === 'Id')
|
|
8697
|
-
return true;
|
|
8698
|
-
return selection.selectionSet !== undefined;
|
|
8699
|
-
});
|
|
8700
|
-
}
|
|
8701
|
-
return false;
|
|
8701
|
+
return isInlineFragmentNode(node);
|
|
8702
8702
|
}
|
|
8703
8703
|
/**
|
|
8704
8704
|
* checks if the 'ArgumentNode' is a specific scope type
|
|
@@ -11325,7 +11325,8 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
|
|
|
11325
11325
|
* @param objectInfos
|
|
11326
11326
|
* @returns
|
|
11327
11327
|
*/
|
|
11328
|
-
function injectFieldsForDisplayValue(
|
|
11328
|
+
function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
|
|
11329
|
+
const { selectionSet } = topNode;
|
|
11329
11330
|
if (selectionSet === undefined)
|
|
11330
11331
|
return [];
|
|
11331
11332
|
let displayValueNameFields = [];
|
|
@@ -11338,6 +11339,10 @@ function injectFieldsForDisplayValue({ selectionSet }, parentNode, objectInfos)
|
|
|
11338
11339
|
displayValue = node;
|
|
11339
11340
|
break;
|
|
11340
11341
|
}
|
|
11342
|
+
if (isInlineFragmentNode(node)) {
|
|
11343
|
+
const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
|
|
11344
|
+
displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
|
|
11345
|
+
}
|
|
11341
11346
|
}
|
|
11342
11347
|
if (displayValue !== undefined) {
|
|
11343
11348
|
const apiName = parentNode.name.value;
|
|
@@ -11407,10 +11412,17 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
|
|
|
11407
11412
|
// example: TimeSheetId { value }
|
|
11408
11413
|
relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
|
|
11409
11414
|
}
|
|
11415
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
|
|
11416
|
+
...parent,
|
|
11417
|
+
name: {
|
|
11418
|
+
...parent.name,
|
|
11419
|
+
value: targetRelationship.childObjectApiName,
|
|
11420
|
+
},
|
|
11421
|
+
}, objectInfos));
|
|
11410
11422
|
}
|
|
11411
11423
|
}
|
|
11412
11424
|
}
|
|
11413
|
-
displayValueNameFields
|
|
11425
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
|
|
11414
11426
|
}
|
|
11415
11427
|
}
|
|
11416
11428
|
return [
|
|
@@ -11663,6 +11675,10 @@ function removeSyntheticFields(result, query) {
|
|
|
11663
11675
|
// build our output from the original result set
|
|
11664
11676
|
// so we keep any other results that are not included in a record query
|
|
11665
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 };
|
|
11666
11682
|
const outputApiParent = output.data.uiapi.query;
|
|
11667
11683
|
const keys$1 = keys$4(nodeJson);
|
|
11668
11684
|
keys$1.forEach((recordName) => {
|
|
@@ -13766,11 +13782,14 @@ const replaceDraftIdsInVariables = (variables, draftFunctions, unmappedDraftIDs)
|
|
|
13766
13782
|
};
|
|
13767
13783
|
// create the runtime cache for the graphql schema when the factory creates the adapter
|
|
13768
13784
|
const graphqlSchemaCache = new CachedGraphQLSchema();
|
|
13769
|
-
function
|
|
13770
|
-
|
|
13785
|
+
function getCanonicalIdFunction(luvio) {
|
|
13786
|
+
return (id) => {
|
|
13771
13787
|
var _a;
|
|
13772
13788
|
return ((_a = extractRecordIdFromStoreKey(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX + id))) !== null && _a !== void 0 ? _a : id);
|
|
13773
13789
|
};
|
|
13790
|
+
}
|
|
13791
|
+
function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
|
|
13792
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13774
13793
|
return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13775
13794
|
//create a copy to not accidentally modify the AST in the astResolver map of luvio
|
|
13776
13795
|
const copy = parse$3(stringify$3(config.query));
|
|
@@ -13920,9 +13939,61 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
13920
13939
|
return resultSnapshot;
|
|
13921
13940
|
};
|
|
13922
13941
|
}
|
|
13923
|
-
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
|
|
13942
|
+
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
|
|
13924
13943
|
return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13925
|
-
|
|
13944
|
+
const batchQueryCopy = config.batchQuery.map((query) => clone(query));
|
|
13945
|
+
let injectedBatchQuery = [];
|
|
13946
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13947
|
+
const draftFunctions = {
|
|
13948
|
+
isDraftId,
|
|
13949
|
+
getCanonicalId,
|
|
13950
|
+
};
|
|
13951
|
+
// return error snapshot if fails injecting fields into grapqhBatch batchQuery
|
|
13952
|
+
try {
|
|
13953
|
+
injectedBatchQuery = await Promise.all(batchQueryCopy.map((query) => injectSyntheticFields(query.query, objectInfoService, draftFunctions, query.variables)));
|
|
13954
|
+
}
|
|
13955
|
+
catch (error) {
|
|
13956
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
13957
|
+
return {
|
|
13958
|
+
data: undefined,
|
|
13959
|
+
state: 'Error',
|
|
13960
|
+
error: {
|
|
13961
|
+
errorType: 'adapterError',
|
|
13962
|
+
error: {
|
|
13963
|
+
message,
|
|
13964
|
+
},
|
|
13965
|
+
},
|
|
13966
|
+
};
|
|
13967
|
+
}
|
|
13968
|
+
const injectedConfig = {
|
|
13969
|
+
batchQuery: injectedBatchQuery.map((query, index) => {
|
|
13970
|
+
return {
|
|
13971
|
+
query: query.modifiedAST,
|
|
13972
|
+
variables: config.batchQuery[index].variables,
|
|
13973
|
+
};
|
|
13974
|
+
}),
|
|
13975
|
+
};
|
|
13976
|
+
const snapshot = (await luvio.applyCachePolicy(requestContext, { config: injectedConfig, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
|
|
13977
|
+
if (snapshot.state === 'Error') {
|
|
13978
|
+
return snapshot;
|
|
13979
|
+
}
|
|
13980
|
+
// remove injected fields from response.
|
|
13981
|
+
const data = snapshot.data;
|
|
13982
|
+
const userResults = data.results.map((compositeResult, index) => {
|
|
13983
|
+
if (compositeResult.statusCode === HttpStatusCode.Ok) {
|
|
13984
|
+
return {
|
|
13985
|
+
result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
|
|
13986
|
+
statusCode: compositeResult.statusCode,
|
|
13987
|
+
};
|
|
13988
|
+
}
|
|
13989
|
+
return compositeResult;
|
|
13990
|
+
});
|
|
13991
|
+
return {
|
|
13992
|
+
...snapshot,
|
|
13993
|
+
data: {
|
|
13994
|
+
results: userResults,
|
|
13995
|
+
},
|
|
13996
|
+
};
|
|
13926
13997
|
};
|
|
13927
13998
|
}
|
|
13928
13999
|
|
|
@@ -16109,9 +16180,9 @@ function instrumentAdapter(adapter, metadata) {
|
|
|
16109
16180
|
}
|
|
16110
16181
|
}
|
|
16111
16182
|
return instrumentAdapter$1(instrumentedMobileAdapter, metadata, {
|
|
16112
|
-
trackL1Hits:
|
|
16113
|
-
trackL2Hits:
|
|
16114
|
-
trackCacheMisses:
|
|
16183
|
+
trackL1Hits: false,
|
|
16184
|
+
trackL2Hits: false,
|
|
16185
|
+
trackCacheMisses: false,
|
|
16115
16186
|
reportObserver: (report) => {
|
|
16116
16187
|
for (const observer of reportObservers) {
|
|
16117
16188
|
observer(report);
|
|
@@ -17000,13 +17071,13 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
|
|
|
17000
17071
|
// since none of the changed fields are part of the incoming record
|
|
17001
17072
|
if (missingFields.every((field) => {
|
|
17002
17073
|
const referenceFieldName = findReferenceFieldForSpanningField(field, objectInfo);
|
|
17003
|
-
if (referenceFieldName
|
|
17004
|
-
return (incomingRecord.fields[referenceFieldName].value ===
|
|
17005
|
-
existingRecord.fields[referenceFieldName].value);
|
|
17006
|
-
}
|
|
17007
|
-
else {
|
|
17074
|
+
if (referenceFieldName === undefined) {
|
|
17008
17075
|
return false;
|
|
17009
17076
|
}
|
|
17077
|
+
return (existingRecord.fields[referenceFieldName] &&
|
|
17078
|
+
incomingRecord.fields[referenceFieldName] &&
|
|
17079
|
+
incomingRecord.fields[referenceFieldName].value ===
|
|
17080
|
+
existingRecord.fields[referenceFieldName].value);
|
|
17010
17081
|
})) {
|
|
17011
17082
|
return {
|
|
17012
17083
|
ok: true,
|
|
@@ -17885,6 +17956,9 @@ class LdsPrimingRecordRefresher {
|
|
|
17885
17956
|
optionalFields: value.fields.map((f) => `${_apiName}.${f}`),
|
|
17886
17957
|
},
|
|
17887
17958
|
],
|
|
17959
|
+
}, {
|
|
17960
|
+
cachePolicy: { type: 'no-cache' },
|
|
17961
|
+
priority: 'background',
|
|
17888
17962
|
}));
|
|
17889
17963
|
});
|
|
17890
17964
|
const promiseResults = await allSettled(promises);
|
|
@@ -17989,6 +18063,8 @@ function getRuntime() {
|
|
|
17989
18063
|
const durableEnv = makeDurable(gqlEnv, {
|
|
17990
18064
|
durableStore: recordDenormingStore,
|
|
17991
18065
|
enableDurableMetadataRefresh: ldsMetadataRefreshEnabled.isOpen({ fallback: false }),
|
|
18066
|
+
// disable luvio deep freeze in headless environments
|
|
18067
|
+
disableDeepFreeze: typeof window === 'undefined',
|
|
17992
18068
|
});
|
|
17993
18069
|
getIngestRecords = durableEnv.getIngestStagingStoreRecords;
|
|
17994
18070
|
getIngestMetadata = durableEnv.getIngestStagingStoreMetadata;
|
|
@@ -18044,7 +18120,7 @@ function getRuntime() {
|
|
|
18044
18120
|
setDraftAwareGraphQLAdapter(
|
|
18045
18121
|
// return a draft aware graphql adapter here
|
|
18046
18122
|
draftAwareGraphQLAdapter);
|
|
18047
|
-
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
|
|
18123
|
+
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
|
|
18048
18124
|
setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
|
|
18049
18125
|
};
|
|
18050
18126
|
const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
|
|
@@ -18094,4 +18170,4 @@ register({
|
|
|
18094
18170
|
});
|
|
18095
18171
|
|
|
18096
18172
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
18097
|
-
// version: 1.
|
|
18173
|
+
// version: 1.283.0-a330da944
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-mobile",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.283.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.283.0",
|
|
36
|
+
"@salesforce/lds-bindings": "^1.283.0",
|
|
37
|
+
"@salesforce/lds-instrumentation": "^1.283.0",
|
|
38
|
+
"@salesforce/lds-priming": "^1.283.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.283.0",
|
|
44
|
+
"@salesforce/lds-drafts": "^1.283.0",
|
|
45
|
+
"@salesforce/lds-drafts-adapters-uiapi": "^1.283.0",
|
|
46
|
+
"@salesforce/lds-graphql-eval": "^1.283.0",
|
|
47
|
+
"@salesforce/lds-network-adapter": "^1.283.0",
|
|
48
|
+
"@salesforce/lds-network-nimbus": "^1.283.0",
|
|
49
|
+
"@salesforce/lds-store-binary": "^1.283.0",
|
|
50
|
+
"@salesforce/lds-store-nimbus": "^1.283.0",
|
|
51
|
+
"@salesforce/lds-store-sql": "^1.283.0",
|
|
52
|
+
"@salesforce/lds-utils-adapters": "^1.283.0",
|
|
53
|
+
"@salesforce/nimbus-plugin-lds": "^1.283.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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { withRegistration, register } from 'native/ldsEngineMobile';
|
|
19
19
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from 'force/ldsInstrumentation';
|
|
20
|
-
import { HttpStatusCode, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from 'force/luvioEngine';
|
|
20
|
+
import { HttpStatusCode, setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from 'force/luvioEngine';
|
|
21
21
|
import excludeStaleRecordsGate from '@salesforce/gate/lds.graphqlEvalExcludeStaleRecords';
|
|
22
22
|
import { parseAndVisit, Kind, buildSchema, isObjectType, defaultFieldResolver, visit, execute, parse as parse$7, extendSchema, isScalarType } from 'force/ldsGraphqlParser';
|
|
23
23
|
import { RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, getRecordId18, RECORD_REPRESENTATION_NAME, extractRecordIdFromStoreKey, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, RECORD_VIEW_ENTITY_ID_PREFIX, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion, getRecordsAdapterFactory } from 'force/ldsAdaptersUiapi';
|
|
@@ -1019,7 +1019,9 @@ function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
|
|
|
1019
1019
|
* @param durableStore A DurableStore implementation
|
|
1020
1020
|
* @param instrumentation An instrumentation function implementation
|
|
1021
1021
|
*/
|
|
1022
|
-
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, }) {
|
|
1022
|
+
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
|
|
1023
|
+
// runtimes can choose to disable deepFreeze, e.g. headless mobile runtime
|
|
1024
|
+
setBypassDeepFreeze(disableDeepFreeze);
|
|
1023
1025
|
let stagingStore = null;
|
|
1024
1026
|
const durableTTLStore = new DurableTTLStore(durableStore);
|
|
1025
1027
|
const mergeKeysPromiseMap = new Map();
|
|
@@ -5512,6 +5514,10 @@ class DurableDraftQueue {
|
|
|
5512
5514
|
switch (result) {
|
|
5513
5515
|
case ProcessActionResult.BLOCKED_ON_ERROR:
|
|
5514
5516
|
this.state = DraftQueueState.Error;
|
|
5517
|
+
await this.notifyChangedListeners({
|
|
5518
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
5519
|
+
state: this.state,
|
|
5520
|
+
});
|
|
5515
5521
|
return Promise.reject();
|
|
5516
5522
|
default:
|
|
5517
5523
|
return Promise.resolve();
|
|
@@ -7967,6 +7973,9 @@ function sanitizePredicateIDValue(value, draftFunction) {
|
|
|
7967
7973
|
if (isArray$2(value)) {
|
|
7968
7974
|
return value.map((singleValue) => sanitizePredicateIDValue(singleValue, draftFunction));
|
|
7969
7975
|
}
|
|
7976
|
+
else if (typeof value === 'string' && value === '') {
|
|
7977
|
+
return value;
|
|
7978
|
+
}
|
|
7970
7979
|
else {
|
|
7971
7980
|
const coercedId = getRecordId18(value);
|
|
7972
7981
|
if (coercedId !== undefined) {
|
|
@@ -8040,6 +8049,9 @@ function createSinglePredicate(val, operator, field, alias) {
|
|
|
8040
8049
|
else if (field.apiName === 'weakEtag') {
|
|
8041
8050
|
leftPath = '$.weakEtag';
|
|
8042
8051
|
}
|
|
8052
|
+
else if (field.apiName === 'RecordTypeId') {
|
|
8053
|
+
leftPath = '$.recordTypeId';
|
|
8054
|
+
}
|
|
8043
8055
|
return {
|
|
8044
8056
|
alias,
|
|
8045
8057
|
leftPath,
|
|
@@ -8686,19 +8698,7 @@ function isCapableRelationship(node) {
|
|
|
8686
8698
|
});
|
|
8687
8699
|
}
|
|
8688
8700
|
}
|
|
8689
|
-
|
|
8690
|
-
if (!node.selectionSet)
|
|
8691
|
-
return false;
|
|
8692
|
-
return node.selectionSet.selections.some((selection) => {
|
|
8693
|
-
if (selection.kind !== Kind.FIELD && selection.kind !== Kind.INLINE_FRAGMENT)
|
|
8694
|
-
return false;
|
|
8695
|
-
// example: Account { Id }
|
|
8696
|
-
if (selection.kind === Kind.FIELD && selection.name.value === 'Id')
|
|
8697
|
-
return true;
|
|
8698
|
-
return selection.selectionSet !== undefined;
|
|
8699
|
-
});
|
|
8700
|
-
}
|
|
8701
|
-
return false;
|
|
8701
|
+
return isInlineFragmentNode(node);
|
|
8702
8702
|
}
|
|
8703
8703
|
/**
|
|
8704
8704
|
* checks if the 'ArgumentNode' is a specific scope type
|
|
@@ -11325,7 +11325,8 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
|
|
|
11325
11325
|
* @param objectInfos
|
|
11326
11326
|
* @returns
|
|
11327
11327
|
*/
|
|
11328
|
-
function injectFieldsForDisplayValue(
|
|
11328
|
+
function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
|
|
11329
|
+
const { selectionSet } = topNode;
|
|
11329
11330
|
if (selectionSet === undefined)
|
|
11330
11331
|
return [];
|
|
11331
11332
|
let displayValueNameFields = [];
|
|
@@ -11338,6 +11339,10 @@ function injectFieldsForDisplayValue({ selectionSet }, parentNode, objectInfos)
|
|
|
11338
11339
|
displayValue = node;
|
|
11339
11340
|
break;
|
|
11340
11341
|
}
|
|
11342
|
+
if (isInlineFragmentNode(node)) {
|
|
11343
|
+
const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
|
|
11344
|
+
displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
|
|
11345
|
+
}
|
|
11341
11346
|
}
|
|
11342
11347
|
if (displayValue !== undefined) {
|
|
11343
11348
|
const apiName = parentNode.name.value;
|
|
@@ -11407,10 +11412,17 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
|
|
|
11407
11412
|
// example: TimeSheetId { value }
|
|
11408
11413
|
relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
|
|
11409
11414
|
}
|
|
11415
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
|
|
11416
|
+
...parent,
|
|
11417
|
+
name: {
|
|
11418
|
+
...parent.name,
|
|
11419
|
+
value: targetRelationship.childObjectApiName,
|
|
11420
|
+
},
|
|
11421
|
+
}, objectInfos));
|
|
11410
11422
|
}
|
|
11411
11423
|
}
|
|
11412
11424
|
}
|
|
11413
|
-
displayValueNameFields
|
|
11425
|
+
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
|
|
11414
11426
|
}
|
|
11415
11427
|
}
|
|
11416
11428
|
return [
|
|
@@ -11663,6 +11675,10 @@ function removeSyntheticFields(result, query) {
|
|
|
11663
11675
|
// build our output from the original result set
|
|
11664
11676
|
// so we keep any other results that are not included in a record query
|
|
11665
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 };
|
|
11666
11682
|
const outputApiParent = output.data.uiapi.query;
|
|
11667
11683
|
const keys$1 = keys$4(nodeJson);
|
|
11668
11684
|
keys$1.forEach((recordName) => {
|
|
@@ -13766,11 +13782,14 @@ const replaceDraftIdsInVariables = (variables, draftFunctions, unmappedDraftIDs)
|
|
|
13766
13782
|
};
|
|
13767
13783
|
// create the runtime cache for the graphql schema when the factory creates the adapter
|
|
13768
13784
|
const graphqlSchemaCache = new CachedGraphQLSchema();
|
|
13769
|
-
function
|
|
13770
|
-
|
|
13785
|
+
function getCanonicalIdFunction(luvio) {
|
|
13786
|
+
return (id) => {
|
|
13771
13787
|
var _a;
|
|
13772
13788
|
return ((_a = extractRecordIdFromStoreKey(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX + id))) !== null && _a !== void 0 ? _a : id);
|
|
13773
13789
|
};
|
|
13790
|
+
}
|
|
13791
|
+
function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
|
|
13792
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13774
13793
|
return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13775
13794
|
//create a copy to not accidentally modify the AST in the astResolver map of luvio
|
|
13776
13795
|
const copy = parse$3(stringify$3(config.query));
|
|
@@ -13920,9 +13939,61 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
13920
13939
|
return resultSnapshot;
|
|
13921
13940
|
};
|
|
13922
13941
|
}
|
|
13923
|
-
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
|
|
13942
|
+
function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
|
|
13924
13943
|
return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
|
|
13925
|
-
|
|
13944
|
+
const batchQueryCopy = config.batchQuery.map((query) => clone(query));
|
|
13945
|
+
let injectedBatchQuery = [];
|
|
13946
|
+
const getCanonicalId = getCanonicalIdFunction(luvio);
|
|
13947
|
+
const draftFunctions = {
|
|
13948
|
+
isDraftId,
|
|
13949
|
+
getCanonicalId,
|
|
13950
|
+
};
|
|
13951
|
+
// return error snapshot if fails injecting fields into grapqhBatch batchQuery
|
|
13952
|
+
try {
|
|
13953
|
+
injectedBatchQuery = await Promise.all(batchQueryCopy.map((query) => injectSyntheticFields(query.query, objectInfoService, draftFunctions, query.variables)));
|
|
13954
|
+
}
|
|
13955
|
+
catch (error) {
|
|
13956
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
13957
|
+
return {
|
|
13958
|
+
data: undefined,
|
|
13959
|
+
state: 'Error',
|
|
13960
|
+
error: {
|
|
13961
|
+
errorType: 'adapterError',
|
|
13962
|
+
error: {
|
|
13963
|
+
message,
|
|
13964
|
+
},
|
|
13965
|
+
},
|
|
13966
|
+
};
|
|
13967
|
+
}
|
|
13968
|
+
const injectedConfig = {
|
|
13969
|
+
batchQuery: injectedBatchQuery.map((query, index) => {
|
|
13970
|
+
return {
|
|
13971
|
+
query: query.modifiedAST,
|
|
13972
|
+
variables: config.batchQuery[index].variables,
|
|
13973
|
+
};
|
|
13974
|
+
}),
|
|
13975
|
+
};
|
|
13976
|
+
const snapshot = (await luvio.applyCachePolicy(requestContext, { config: injectedConfig, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
|
|
13977
|
+
if (snapshot.state === 'Error') {
|
|
13978
|
+
return snapshot;
|
|
13979
|
+
}
|
|
13980
|
+
// remove injected fields from response.
|
|
13981
|
+
const data = snapshot.data;
|
|
13982
|
+
const userResults = data.results.map((compositeResult, index) => {
|
|
13983
|
+
if (compositeResult.statusCode === HttpStatusCode.Ok) {
|
|
13984
|
+
return {
|
|
13985
|
+
result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
|
|
13986
|
+
statusCode: compositeResult.statusCode,
|
|
13987
|
+
};
|
|
13988
|
+
}
|
|
13989
|
+
return compositeResult;
|
|
13990
|
+
});
|
|
13991
|
+
return {
|
|
13992
|
+
...snapshot,
|
|
13993
|
+
data: {
|
|
13994
|
+
results: userResults,
|
|
13995
|
+
},
|
|
13996
|
+
};
|
|
13926
13997
|
};
|
|
13927
13998
|
}
|
|
13928
13999
|
|
|
@@ -16109,9 +16180,9 @@ function instrumentAdapter(adapter, metadata) {
|
|
|
16109
16180
|
}
|
|
16110
16181
|
}
|
|
16111
16182
|
return instrumentAdapter$1(instrumentedMobileAdapter, metadata, {
|
|
16112
|
-
trackL1Hits:
|
|
16113
|
-
trackL2Hits:
|
|
16114
|
-
trackCacheMisses:
|
|
16183
|
+
trackL1Hits: false,
|
|
16184
|
+
trackL2Hits: false,
|
|
16185
|
+
trackCacheMisses: false,
|
|
16115
16186
|
reportObserver: (report) => {
|
|
16116
16187
|
for (const observer of reportObservers) {
|
|
16117
16188
|
observer(report);
|
|
@@ -17000,13 +17071,13 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
|
|
|
17000
17071
|
// since none of the changed fields are part of the incoming record
|
|
17001
17072
|
if (missingFields.every((field) => {
|
|
17002
17073
|
const referenceFieldName = findReferenceFieldForSpanningField(field, objectInfo);
|
|
17003
|
-
if (referenceFieldName
|
|
17004
|
-
return (incomingRecord.fields[referenceFieldName].value ===
|
|
17005
|
-
existingRecord.fields[referenceFieldName].value);
|
|
17006
|
-
}
|
|
17007
|
-
else {
|
|
17074
|
+
if (referenceFieldName === undefined) {
|
|
17008
17075
|
return false;
|
|
17009
17076
|
}
|
|
17077
|
+
return (existingRecord.fields[referenceFieldName] &&
|
|
17078
|
+
incomingRecord.fields[referenceFieldName] &&
|
|
17079
|
+
incomingRecord.fields[referenceFieldName].value ===
|
|
17080
|
+
existingRecord.fields[referenceFieldName].value);
|
|
17010
17081
|
})) {
|
|
17011
17082
|
return {
|
|
17012
17083
|
ok: true,
|
|
@@ -17885,6 +17956,9 @@ class LdsPrimingRecordRefresher {
|
|
|
17885
17956
|
optionalFields: value.fields.map((f) => `${_apiName}.${f}`),
|
|
17886
17957
|
},
|
|
17887
17958
|
],
|
|
17959
|
+
}, {
|
|
17960
|
+
cachePolicy: { type: 'no-cache' },
|
|
17961
|
+
priority: 'background',
|
|
17888
17962
|
}));
|
|
17889
17963
|
});
|
|
17890
17964
|
const promiseResults = await allSettled(promises);
|
|
@@ -17989,6 +18063,8 @@ function getRuntime() {
|
|
|
17989
18063
|
const durableEnv = makeDurable(gqlEnv, {
|
|
17990
18064
|
durableStore: recordDenormingStore,
|
|
17991
18065
|
enableDurableMetadataRefresh: ldsMetadataRefreshEnabled.isOpen({ fallback: false }),
|
|
18066
|
+
// disable luvio deep freeze in headless environments
|
|
18067
|
+
disableDeepFreeze: typeof window === 'undefined',
|
|
17992
18068
|
});
|
|
17993
18069
|
getIngestRecords = durableEnv.getIngestStagingStoreRecords;
|
|
17994
18070
|
getIngestMetadata = durableEnv.getIngestStagingStoreMetadata;
|
|
@@ -18044,7 +18120,7 @@ function getRuntime() {
|
|
|
18044
18120
|
setDraftAwareGraphQLAdapter(
|
|
18045
18121
|
// return a draft aware graphql adapter here
|
|
18046
18122
|
draftAwareGraphQLAdapter);
|
|
18047
|
-
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
|
|
18123
|
+
const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
|
|
18048
18124
|
setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
|
|
18049
18125
|
};
|
|
18050
18126
|
const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
|
|
@@ -18094,4 +18170,4 @@ register({
|
|
|
18094
18170
|
});
|
|
18095
18171
|
|
|
18096
18172
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
18097
|
-
// version: 1.
|
|
18173
|
+
// version: 1.283.0-a330da944
|