@salesforce/lds-worker-api 1.152.3 → 1.153.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.
|
@@ -770,4 +770,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
770
770
|
}
|
|
771
771
|
|
|
772
772
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
773
|
-
// version: 1.
|
|
773
|
+
// version: 1.153.0-8e8a8177b
|
|
@@ -3799,7 +3799,7 @@ function withDefaultLuvio(callback) {
|
|
|
3799
3799
|
}
|
|
3800
3800
|
callbacks.push(callback);
|
|
3801
3801
|
}
|
|
3802
|
-
// version: 1.
|
|
3802
|
+
// version: 1.153.0-8e8a8177b
|
|
3803
3803
|
|
|
3804
3804
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3805
3805
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -3808,6 +3808,15 @@ function instrumentAdapter$1(createFunction, _metadata) {
|
|
|
3808
3808
|
function setLdsNetworkAdapterInstrumentation(_networkAdapterRegistration) { }
|
|
3809
3809
|
function instrumentLuvio(_context) { }
|
|
3810
3810
|
|
|
3811
|
+
var excludeStaleRecordsGate = {
|
|
3812
|
+
isOpen: function (e) {
|
|
3813
|
+
return e.fallback;
|
|
3814
|
+
},
|
|
3815
|
+
hasError: function () {
|
|
3816
|
+
return !0;
|
|
3817
|
+
},
|
|
3818
|
+
};
|
|
3819
|
+
|
|
3811
3820
|
/**
|
|
3812
3821
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3813
3822
|
* All rights reserved.
|
|
@@ -15223,7 +15232,7 @@ function parseAndVisit(source) {
|
|
|
15223
15232
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15224
15233
|
return luvioDocumentNode;
|
|
15225
15234
|
}
|
|
15226
|
-
// version: 1.
|
|
15235
|
+
// version: 1.153.0-8e8a8177b
|
|
15227
15236
|
|
|
15228
15237
|
function unwrap(data) {
|
|
15229
15238
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16136,7 +16145,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16136
16145
|
const { apiFamily, name } = metadata;
|
|
16137
16146
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16138
16147
|
}
|
|
16139
|
-
// version: 1.
|
|
16148
|
+
// version: 1.153.0-8e8a8177b
|
|
16140
16149
|
|
|
16141
16150
|
/**
|
|
16142
16151
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44007,7 +44016,7 @@ withDefaultLuvio((luvio) => {
|
|
|
44007
44016
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44008
44017
|
});
|
|
44009
44018
|
});
|
|
44010
|
-
// version: 1.
|
|
44019
|
+
// version: 1.153.0-d6fe530aa
|
|
44011
44020
|
|
|
44012
44021
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44013
44022
|
|
|
@@ -46196,9 +46205,13 @@ const recordSuffix = 'edges';
|
|
|
46196
46205
|
const pathPrefix = '$';
|
|
46197
46206
|
const recordsCTE = 'recordsCTE';
|
|
46198
46207
|
const MultiPickListValueSeparator$1 = ';';
|
|
46208
|
+
const recordCTESQL = excludeStaleRecordsGate.isOpen({ fallback: false })
|
|
46209
|
+
? `WITH ${recordsCTE} AS NOT materialized ` +
|
|
46210
|
+
`(select data, metadata from lds_data where key like 'UiApi::RecordRepresentation:%')`
|
|
46211
|
+
: `WITH ${recordsCTE} AS NOT materialized ` +
|
|
46212
|
+
`(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`;
|
|
46199
46213
|
function cteSql() {
|
|
46200
|
-
return
|
|
46201
|
-
`(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`);
|
|
46214
|
+
return recordCTESQL;
|
|
46202
46215
|
}
|
|
46203
46216
|
function computeSql(rootQuery) {
|
|
46204
46217
|
const fields = rootQuery.connections.map((connection) => {
|
|
@@ -46475,6 +46488,14 @@ function expressionToSql(expression, targetDataType, operator) {
|
|
|
46475
46488
|
if (expression.subfield === 'displayValue' && targetDataType === 'Boolean') {
|
|
46476
46489
|
return { sql: 'null', bindings: [] };
|
|
46477
46490
|
}
|
|
46491
|
+
// metadata extract is somewhat different than a data extract
|
|
46492
|
+
if (expression.metadata === true) {
|
|
46493
|
+
let sql = `json_extract("${expression.jsonAlias}".metadata, '${pathPrefix}.${expression.field}')`;
|
|
46494
|
+
if (targetDataType !== undefined) {
|
|
46495
|
+
sql = coerceToTargetDataType(sql, targetDataType);
|
|
46496
|
+
}
|
|
46497
|
+
return { sql, bindings: [] };
|
|
46498
|
+
}
|
|
46478
46499
|
let path = extractPath(expression.field, expression.subfield);
|
|
46479
46500
|
// For multiple picklist includes/excluding filtering, we need to prefix and suffix the field value with ';'
|
|
46480
46501
|
// to make the match safe.
|
|
@@ -48111,6 +48132,39 @@ function recordQuery(selection, apiName, alias, predicates, input) {
|
|
|
48111
48132
|
const draftsField = { type: FieldType.Scalar, extract, path: 'node._drafts' };
|
|
48112
48133
|
const idExtract = { type: ValueType.Extract, jsonAlias: alias, field: 'Id' };
|
|
48113
48134
|
const idField = { type: FieldType.Scalar, extract: idExtract, path: 'node.Id' };
|
|
48135
|
+
// When the exclude stale records gate is open, inject an additional predicate
|
|
48136
|
+
// to limit the search to records that either have drafts associated to them or
|
|
48137
|
+
// were ingested at least as recently as the query.
|
|
48138
|
+
if (excludeStaleRecordsGate.isOpen({ fallback: false })) {
|
|
48139
|
+
const key = input.connectionKeyBuilder(selection, input.config.variables);
|
|
48140
|
+
const queryMetadata = input.metadata[key];
|
|
48141
|
+
// If there is no metadata for this query or it somehow lacks a timestamp
|
|
48142
|
+
// skip adding the additional predicates
|
|
48143
|
+
if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
|
|
48144
|
+
const timestamp = queryMetadata.ingestionTimestamp;
|
|
48145
|
+
const timestampCheck = {
|
|
48146
|
+
type: PredicateType$1.comparison,
|
|
48147
|
+
left: {
|
|
48148
|
+
type: ValueType.Extract,
|
|
48149
|
+
jsonAlias: alias,
|
|
48150
|
+
field: 'ingestionTimestamp',
|
|
48151
|
+
metadata: true,
|
|
48152
|
+
},
|
|
48153
|
+
operator: ComparisonOperator.gte,
|
|
48154
|
+
right: { type: ValueType.IntLiteral, value: timestamp },
|
|
48155
|
+
};
|
|
48156
|
+
const isDraft = {
|
|
48157
|
+
type: PredicateType$1.nullComparison,
|
|
48158
|
+
left: { type: ValueType.Extract, jsonAlias: alias, field: 'drafts' },
|
|
48159
|
+
operator: NullComparisonOperator.isNot,
|
|
48160
|
+
};
|
|
48161
|
+
predicates.push({
|
|
48162
|
+
type: PredicateType$1.compound,
|
|
48163
|
+
operator: CompoundOperator.or,
|
|
48164
|
+
children: [timestampCheck, isDraft],
|
|
48165
|
+
});
|
|
48166
|
+
}
|
|
48167
|
+
}
|
|
48114
48168
|
return queryContainer(internalFields, alias, apiName, predicates).map((result) => {
|
|
48115
48169
|
const { fields, predicates } = result;
|
|
48116
48170
|
const allFields = removeDuplicateFields(fields.concat(...[draftsField, idField]));
|
|
@@ -48381,12 +48435,24 @@ class StoreEvalPreconditioner {
|
|
|
48381
48435
|
* Missing object info records triggers the objectInfoService (same instance shared with Drafts code), to
|
|
48382
48436
|
* use the getObjectInfos adapter to efficiently fetch the necessary records.
|
|
48383
48437
|
*/
|
|
48384
|
-
async createRootQuery(config, objectInfoService, userId, draftFunctions) {
|
|
48438
|
+
async createRootQuery(config, objectInfoService, userId, draftFunctions, connectionKeyBuilder, sqliteStore) {
|
|
48385
48439
|
const { query: ast, variables } = config;
|
|
48386
48440
|
swapVariableArguments(ast, variables);
|
|
48387
48441
|
// Parse out top-level record queries types we know we will need, since spanning fields will
|
|
48388
48442
|
// require at least this top level record present to resolve relationship lookups
|
|
48389
|
-
const
|
|
48443
|
+
const recordSelections = findRecordSelections$1(ast);
|
|
48444
|
+
let metadata = {};
|
|
48445
|
+
if (excludeStaleRecordsGate.isOpen({ fallback: false })) {
|
|
48446
|
+
const keys = recordSelections.map((rs) => connectionKeyBuilder(rs, variables));
|
|
48447
|
+
let sqlResult = await sqliteStore.query(`select key, metadata from lds_data where key in (${keys
|
|
48448
|
+
.map(() => '?')
|
|
48449
|
+
.join(',')})`, keys);
|
|
48450
|
+
metadata = sqlResult.rows.reduce((metadata, row) => {
|
|
48451
|
+
metadata[row[0]] = JSON.parse(row[1]);
|
|
48452
|
+
return metadata;
|
|
48453
|
+
}, {});
|
|
48454
|
+
}
|
|
48455
|
+
const topLevelNeededRecords = recordSelections.map((selection) => selection.name);
|
|
48390
48456
|
// Seed the initial list of things to fetch
|
|
48391
48457
|
const neededObjectInfos = new Set(topLevelNeededRecords);
|
|
48392
48458
|
// Seed the list of things we've _tried_ to fetch. As we iterate and
|
|
@@ -48426,9 +48492,12 @@ class StoreEvalPreconditioner {
|
|
|
48426
48492
|
};
|
|
48427
48493
|
// Attempt to parse the AST given what we know already...
|
|
48428
48494
|
astTransformResult = transform(ast, {
|
|
48495
|
+
config,
|
|
48429
48496
|
userId,
|
|
48430
48497
|
objectInfoMap,
|
|
48431
48498
|
draftFunctions,
|
|
48499
|
+
connectionKeyBuilder,
|
|
48500
|
+
metadata,
|
|
48432
48501
|
});
|
|
48433
48502
|
if (astTransformResult.isSuccess === false) {
|
|
48434
48503
|
for (const error of astTransformResult.error) {
|
|
@@ -48503,10 +48572,10 @@ async function evaluateSqlite(query, eventEmitter, store) {
|
|
|
48503
48572
|
return { data, seenRecords };
|
|
48504
48573
|
}
|
|
48505
48574
|
const wrapStartEndEvents = (storeEval) => {
|
|
48506
|
-
return async (config, nonEvaluatedSnapshotOrPromise, observers) => {
|
|
48575
|
+
return async (config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder) => {
|
|
48507
48576
|
const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
|
|
48508
48577
|
eventEmitter({ type: 'graphql-eval-start' });
|
|
48509
|
-
const snapshot = await storeEval(config, nonEvaluatedSnapshotOrPromise, observers);
|
|
48578
|
+
const snapshot = await storeEval(config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder);
|
|
48510
48579
|
eventEmitter({ type: 'graphql-eval-end' });
|
|
48511
48580
|
return snapshot;
|
|
48512
48581
|
};
|
|
@@ -48519,7 +48588,7 @@ function sqliteStoreEvalFactory(userId, sqliteStore, objectInfoService, draftFun
|
|
|
48519
48588
|
const preconditioner = new StoreEvalPreconditioner();
|
|
48520
48589
|
return makeStoreEval(preconditioner, objectInfoService, userId, async () => {
|
|
48521
48590
|
return undefined;
|
|
48522
|
-
}, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore), draftFunctions);
|
|
48591
|
+
}, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore), draftFunctions, sqliteStore);
|
|
48523
48592
|
}
|
|
48524
48593
|
async function noopStoreEval(_config, nonEvaluatedSnapshotOrPromise, _observers) {
|
|
48525
48594
|
return nonEvaluatedSnapshotOrPromise;
|
|
@@ -48538,8 +48607,8 @@ function isErrorSnapshotThatShouldGetReturnedToCaller$1(snapshot) {
|
|
|
48538
48607
|
function generateUniqueRecordId$1() {
|
|
48539
48608
|
return `${GRAPHQL_ROOT_KEY$1}${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
|
|
48540
48609
|
}
|
|
48541
|
-
function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator, draftFunctions) {
|
|
48542
|
-
const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers) => {
|
|
48610
|
+
function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator, draftFunctions, sqliteStore) {
|
|
48611
|
+
const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder) => {
|
|
48543
48612
|
const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
|
|
48544
48613
|
// the non-eval'ed input could either be a snapshot or promise of one so
|
|
48545
48614
|
// await it here to normalize the input to a snapshot
|
|
@@ -48568,7 +48637,7 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
|
|
|
48568
48637
|
context = await contextProvider();
|
|
48569
48638
|
// Ensures ObjectInfo metadata is available for the request. Sourcing records from L1/L2/Network
|
|
48570
48639
|
// is delegated to the getObjectInfo adapter via objectInfoService
|
|
48571
|
-
rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId, draftFunctions);
|
|
48640
|
+
rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId, draftFunctions, connectionKeyBuilder, sqliteStore);
|
|
48572
48641
|
}
|
|
48573
48642
|
catch (error) {
|
|
48574
48643
|
eventEmitter({
|
|
@@ -48599,7 +48668,7 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
|
|
|
48599
48668
|
try {
|
|
48600
48669
|
const { data, seenRecords } = await queryEvaluator(rootQuery, context, eventEmitter);
|
|
48601
48670
|
const rebuildWithStoreEval = ((originalSnapshot) => {
|
|
48602
|
-
return storeEval(config, originalSnapshot, observers);
|
|
48671
|
+
return storeEval(config, originalSnapshot, observers, connectionKeyBuilder);
|
|
48603
48672
|
});
|
|
48604
48673
|
const recordId = generateUniqueRecordId$1();
|
|
48605
48674
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
@@ -59629,7 +59698,7 @@ register({
|
|
|
59629
59698
|
id: '@salesforce/lds-network-adapter',
|
|
59630
59699
|
instrument: instrument$1,
|
|
59631
59700
|
});
|
|
59632
|
-
// version: 1.
|
|
59701
|
+
// version: 1.153.0-8e8a8177b
|
|
59633
59702
|
|
|
59634
59703
|
const { create: create$2, keys: keys$2 } = Object;
|
|
59635
59704
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -80474,7 +80543,7 @@ register({
|
|
|
80474
80543
|
configuration: { ...configurationForGraphQLAdapters },
|
|
80475
80544
|
instrument,
|
|
80476
80545
|
});
|
|
80477
|
-
// version: 1.
|
|
80546
|
+
// version: 1.153.0-d6fe530aa
|
|
80478
80547
|
|
|
80479
80548
|
// On core the unstable adapters are re-exported with different names,
|
|
80480
80549
|
|
|
@@ -82679,7 +82748,7 @@ const graphQLAdapterFactory = (luvio) => {
|
|
|
82679
82748
|
? requestContext.eventObservers
|
|
82680
82749
|
: [];
|
|
82681
82750
|
// uses the original ast to do the eval to avoid fields not needed by users. The draftID swapping happens when filters transform to predicates.
|
|
82682
|
-
return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers);
|
|
82751
|
+
return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers, keyBuilder);
|
|
82683
82752
|
}
|
|
82684
82753
|
return snapshotOrPromiseFromCachePolicy;
|
|
82685
82754
|
}
|
|
@@ -82721,7 +82790,7 @@ withDefaultLuvio((luvio) => {
|
|
|
82721
82790
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
82722
82791
|
graphQLImperative = ldsAdapter;
|
|
82723
82792
|
});
|
|
82724
|
-
// version: 1.
|
|
82793
|
+
// version: 1.153.0-d6fe530aa
|
|
82725
82794
|
|
|
82726
82795
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
82727
82796
|
__proto__: null,
|
|
@@ -83410,4 +83479,4 @@ const { luvio } = getRuntime();
|
|
|
83410
83479
|
setDefaultLuvio({ luvio });
|
|
83411
83480
|
|
|
83412
83481
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
83413
|
-
// version: 1.
|
|
83482
|
+
// version: 1.153.0-8e8a8177b
|
|
@@ -3805,7 +3805,7 @@
|
|
|
3805
3805
|
}
|
|
3806
3806
|
callbacks.push(callback);
|
|
3807
3807
|
}
|
|
3808
|
-
// version: 1.
|
|
3808
|
+
// version: 1.153.0-8e8a8177b
|
|
3809
3809
|
|
|
3810
3810
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3811
3811
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -3814,6 +3814,15 @@
|
|
|
3814
3814
|
function setLdsNetworkAdapterInstrumentation(_networkAdapterRegistration) { }
|
|
3815
3815
|
function instrumentLuvio(_context) { }
|
|
3816
3816
|
|
|
3817
|
+
var excludeStaleRecordsGate = {
|
|
3818
|
+
isOpen: function (e) {
|
|
3819
|
+
return e.fallback;
|
|
3820
|
+
},
|
|
3821
|
+
hasError: function () {
|
|
3822
|
+
return !0;
|
|
3823
|
+
},
|
|
3824
|
+
};
|
|
3825
|
+
|
|
3817
3826
|
/**
|
|
3818
3827
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3819
3828
|
* All rights reserved.
|
|
@@ -15229,7 +15238,7 @@
|
|
|
15229
15238
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15230
15239
|
return luvioDocumentNode;
|
|
15231
15240
|
}
|
|
15232
|
-
// version: 1.
|
|
15241
|
+
// version: 1.153.0-8e8a8177b
|
|
15233
15242
|
|
|
15234
15243
|
function unwrap(data) {
|
|
15235
15244
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16142,7 +16151,7 @@
|
|
|
16142
16151
|
const { apiFamily, name } = metadata;
|
|
16143
16152
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16144
16153
|
}
|
|
16145
|
-
// version: 1.
|
|
16154
|
+
// version: 1.153.0-8e8a8177b
|
|
16146
16155
|
|
|
16147
16156
|
/**
|
|
16148
16157
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44013,7 +44022,7 @@
|
|
|
44013
44022
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44014
44023
|
});
|
|
44015
44024
|
});
|
|
44016
|
-
// version: 1.
|
|
44025
|
+
// version: 1.153.0-d6fe530aa
|
|
44017
44026
|
|
|
44018
44027
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44019
44028
|
|
|
@@ -46202,9 +46211,13 @@
|
|
|
46202
46211
|
const pathPrefix = '$';
|
|
46203
46212
|
const recordsCTE = 'recordsCTE';
|
|
46204
46213
|
const MultiPickListValueSeparator$1 = ';';
|
|
46214
|
+
const recordCTESQL = excludeStaleRecordsGate.isOpen({ fallback: false })
|
|
46215
|
+
? `WITH ${recordsCTE} AS NOT materialized ` +
|
|
46216
|
+
`(select data, metadata from lds_data where key like 'UiApi::RecordRepresentation:%')`
|
|
46217
|
+
: `WITH ${recordsCTE} AS NOT materialized ` +
|
|
46218
|
+
`(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`;
|
|
46205
46219
|
function cteSql() {
|
|
46206
|
-
return
|
|
46207
|
-
`(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`);
|
|
46220
|
+
return recordCTESQL;
|
|
46208
46221
|
}
|
|
46209
46222
|
function computeSql(rootQuery) {
|
|
46210
46223
|
const fields = rootQuery.connections.map((connection) => {
|
|
@@ -46481,6 +46494,14 @@
|
|
|
46481
46494
|
if (expression.subfield === 'displayValue' && targetDataType === 'Boolean') {
|
|
46482
46495
|
return { sql: 'null', bindings: [] };
|
|
46483
46496
|
}
|
|
46497
|
+
// metadata extract is somewhat different than a data extract
|
|
46498
|
+
if (expression.metadata === true) {
|
|
46499
|
+
let sql = `json_extract("${expression.jsonAlias}".metadata, '${pathPrefix}.${expression.field}')`;
|
|
46500
|
+
if (targetDataType !== undefined) {
|
|
46501
|
+
sql = coerceToTargetDataType(sql, targetDataType);
|
|
46502
|
+
}
|
|
46503
|
+
return { sql, bindings: [] };
|
|
46504
|
+
}
|
|
46484
46505
|
let path = extractPath(expression.field, expression.subfield);
|
|
46485
46506
|
// For multiple picklist includes/excluding filtering, we need to prefix and suffix the field value with ';'
|
|
46486
46507
|
// to make the match safe.
|
|
@@ -48117,6 +48138,39 @@
|
|
|
48117
48138
|
const draftsField = { type: FieldType.Scalar, extract, path: 'node._drafts' };
|
|
48118
48139
|
const idExtract = { type: ValueType.Extract, jsonAlias: alias, field: 'Id' };
|
|
48119
48140
|
const idField = { type: FieldType.Scalar, extract: idExtract, path: 'node.Id' };
|
|
48141
|
+
// When the exclude stale records gate is open, inject an additional predicate
|
|
48142
|
+
// to limit the search to records that either have drafts associated to them or
|
|
48143
|
+
// were ingested at least as recently as the query.
|
|
48144
|
+
if (excludeStaleRecordsGate.isOpen({ fallback: false })) {
|
|
48145
|
+
const key = input.connectionKeyBuilder(selection, input.config.variables);
|
|
48146
|
+
const queryMetadata = input.metadata[key];
|
|
48147
|
+
// If there is no metadata for this query or it somehow lacks a timestamp
|
|
48148
|
+
// skip adding the additional predicates
|
|
48149
|
+
if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
|
|
48150
|
+
const timestamp = queryMetadata.ingestionTimestamp;
|
|
48151
|
+
const timestampCheck = {
|
|
48152
|
+
type: PredicateType$1.comparison,
|
|
48153
|
+
left: {
|
|
48154
|
+
type: ValueType.Extract,
|
|
48155
|
+
jsonAlias: alias,
|
|
48156
|
+
field: 'ingestionTimestamp',
|
|
48157
|
+
metadata: true,
|
|
48158
|
+
},
|
|
48159
|
+
operator: ComparisonOperator.gte,
|
|
48160
|
+
right: { type: ValueType.IntLiteral, value: timestamp },
|
|
48161
|
+
};
|
|
48162
|
+
const isDraft = {
|
|
48163
|
+
type: PredicateType$1.nullComparison,
|
|
48164
|
+
left: { type: ValueType.Extract, jsonAlias: alias, field: 'drafts' },
|
|
48165
|
+
operator: NullComparisonOperator.isNot,
|
|
48166
|
+
};
|
|
48167
|
+
predicates.push({
|
|
48168
|
+
type: PredicateType$1.compound,
|
|
48169
|
+
operator: CompoundOperator.or,
|
|
48170
|
+
children: [timestampCheck, isDraft],
|
|
48171
|
+
});
|
|
48172
|
+
}
|
|
48173
|
+
}
|
|
48120
48174
|
return queryContainer(internalFields, alias, apiName, predicates).map((result) => {
|
|
48121
48175
|
const { fields, predicates } = result;
|
|
48122
48176
|
const allFields = removeDuplicateFields(fields.concat(...[draftsField, idField]));
|
|
@@ -48387,12 +48441,24 @@
|
|
|
48387
48441
|
* Missing object info records triggers the objectInfoService (same instance shared with Drafts code), to
|
|
48388
48442
|
* use the getObjectInfos adapter to efficiently fetch the necessary records.
|
|
48389
48443
|
*/
|
|
48390
|
-
async createRootQuery(config, objectInfoService, userId, draftFunctions) {
|
|
48444
|
+
async createRootQuery(config, objectInfoService, userId, draftFunctions, connectionKeyBuilder, sqliteStore) {
|
|
48391
48445
|
const { query: ast, variables } = config;
|
|
48392
48446
|
swapVariableArguments(ast, variables);
|
|
48393
48447
|
// Parse out top-level record queries types we know we will need, since spanning fields will
|
|
48394
48448
|
// require at least this top level record present to resolve relationship lookups
|
|
48395
|
-
const
|
|
48449
|
+
const recordSelections = findRecordSelections$1(ast);
|
|
48450
|
+
let metadata = {};
|
|
48451
|
+
if (excludeStaleRecordsGate.isOpen({ fallback: false })) {
|
|
48452
|
+
const keys = recordSelections.map((rs) => connectionKeyBuilder(rs, variables));
|
|
48453
|
+
let sqlResult = await sqliteStore.query(`select key, metadata from lds_data where key in (${keys
|
|
48454
|
+
.map(() => '?')
|
|
48455
|
+
.join(',')})`, keys);
|
|
48456
|
+
metadata = sqlResult.rows.reduce((metadata, row) => {
|
|
48457
|
+
metadata[row[0]] = JSON.parse(row[1]);
|
|
48458
|
+
return metadata;
|
|
48459
|
+
}, {});
|
|
48460
|
+
}
|
|
48461
|
+
const topLevelNeededRecords = recordSelections.map((selection) => selection.name);
|
|
48396
48462
|
// Seed the initial list of things to fetch
|
|
48397
48463
|
const neededObjectInfos = new Set(topLevelNeededRecords);
|
|
48398
48464
|
// Seed the list of things we've _tried_ to fetch. As we iterate and
|
|
@@ -48432,9 +48498,12 @@
|
|
|
48432
48498
|
};
|
|
48433
48499
|
// Attempt to parse the AST given what we know already...
|
|
48434
48500
|
astTransformResult = transform(ast, {
|
|
48501
|
+
config,
|
|
48435
48502
|
userId,
|
|
48436
48503
|
objectInfoMap,
|
|
48437
48504
|
draftFunctions,
|
|
48505
|
+
connectionKeyBuilder,
|
|
48506
|
+
metadata,
|
|
48438
48507
|
});
|
|
48439
48508
|
if (astTransformResult.isSuccess === false) {
|
|
48440
48509
|
for (const error of astTransformResult.error) {
|
|
@@ -48509,10 +48578,10 @@
|
|
|
48509
48578
|
return { data, seenRecords };
|
|
48510
48579
|
}
|
|
48511
48580
|
const wrapStartEndEvents = (storeEval) => {
|
|
48512
|
-
return async (config, nonEvaluatedSnapshotOrPromise, observers) => {
|
|
48581
|
+
return async (config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder) => {
|
|
48513
48582
|
const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
|
|
48514
48583
|
eventEmitter({ type: 'graphql-eval-start' });
|
|
48515
|
-
const snapshot = await storeEval(config, nonEvaluatedSnapshotOrPromise, observers);
|
|
48584
|
+
const snapshot = await storeEval(config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder);
|
|
48516
48585
|
eventEmitter({ type: 'graphql-eval-end' });
|
|
48517
48586
|
return snapshot;
|
|
48518
48587
|
};
|
|
@@ -48525,7 +48594,7 @@
|
|
|
48525
48594
|
const preconditioner = new StoreEvalPreconditioner();
|
|
48526
48595
|
return makeStoreEval(preconditioner, objectInfoService, userId, async () => {
|
|
48527
48596
|
return undefined;
|
|
48528
|
-
}, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore), draftFunctions);
|
|
48597
|
+
}, (query, _context, eventEmitter) => evaluateSqlite(query, eventEmitter, sqliteStore), draftFunctions, sqliteStore);
|
|
48529
48598
|
}
|
|
48530
48599
|
async function noopStoreEval(_config, nonEvaluatedSnapshotOrPromise, _observers) {
|
|
48531
48600
|
return nonEvaluatedSnapshotOrPromise;
|
|
@@ -48544,8 +48613,8 @@
|
|
|
48544
48613
|
function generateUniqueRecordId$1() {
|
|
48545
48614
|
return `${GRAPHQL_ROOT_KEY$1}${Date.now() + Math.random().toFixed(5).split('.')[1]}`;
|
|
48546
48615
|
}
|
|
48547
|
-
function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator, draftFunctions) {
|
|
48548
|
-
const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers) => {
|
|
48616
|
+
function makeStoreEval(preconditioner, objectInfoService, userId, contextProvider, queryEvaluator, draftFunctions, sqliteStore) {
|
|
48617
|
+
const storeEval = async (config, nonEvaluatedSnapshotOrPromise, observers, connectionKeyBuilder) => {
|
|
48549
48618
|
const eventEmitter = createCustomAdapterEventEmitter(GRAPHQL_EVAL_NAMESPACE$1, observers);
|
|
48550
48619
|
// the non-eval'ed input could either be a snapshot or promise of one so
|
|
48551
48620
|
// await it here to normalize the input to a snapshot
|
|
@@ -48574,7 +48643,7 @@
|
|
|
48574
48643
|
context = await contextProvider();
|
|
48575
48644
|
// Ensures ObjectInfo metadata is available for the request. Sourcing records from L1/L2/Network
|
|
48576
48645
|
// is delegated to the getObjectInfo adapter via objectInfoService
|
|
48577
|
-
rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId, draftFunctions);
|
|
48646
|
+
rootQuery = await preconditioner.createRootQuery(config, objectInfoService, userId, draftFunctions, connectionKeyBuilder, sqliteStore);
|
|
48578
48647
|
}
|
|
48579
48648
|
catch (error) {
|
|
48580
48649
|
eventEmitter({
|
|
@@ -48605,7 +48674,7 @@
|
|
|
48605
48674
|
try {
|
|
48606
48675
|
const { data, seenRecords } = await queryEvaluator(rootQuery, context, eventEmitter);
|
|
48607
48676
|
const rebuildWithStoreEval = ((originalSnapshot) => {
|
|
48608
|
-
return storeEval(config, originalSnapshot, observers);
|
|
48677
|
+
return storeEval(config, originalSnapshot, observers, connectionKeyBuilder);
|
|
48609
48678
|
});
|
|
48610
48679
|
const recordId = generateUniqueRecordId$1();
|
|
48611
48680
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
@@ -59635,7 +59704,7 @@
|
|
|
59635
59704
|
id: '@salesforce/lds-network-adapter',
|
|
59636
59705
|
instrument: instrument$1,
|
|
59637
59706
|
});
|
|
59638
|
-
// version: 1.
|
|
59707
|
+
// version: 1.153.0-8e8a8177b
|
|
59639
59708
|
|
|
59640
59709
|
const { create: create$2, keys: keys$2 } = Object;
|
|
59641
59710
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -80480,7 +80549,7 @@
|
|
|
80480
80549
|
configuration: { ...configurationForGraphQLAdapters },
|
|
80481
80550
|
instrument,
|
|
80482
80551
|
});
|
|
80483
|
-
// version: 1.
|
|
80552
|
+
// version: 1.153.0-d6fe530aa
|
|
80484
80553
|
|
|
80485
80554
|
// On core the unstable adapters are re-exported with different names,
|
|
80486
80555
|
|
|
@@ -82685,7 +82754,7 @@
|
|
|
82685
82754
|
? requestContext.eventObservers
|
|
82686
82755
|
: [];
|
|
82687
82756
|
// uses the original ast to do the eval to avoid fields not needed by users. The draftID swapping happens when filters transform to predicates.
|
|
82688
|
-
return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers);
|
|
82757
|
+
return storeEval(validatedConfig, snapshotOrPromiseFromCachePolicy, observers, keyBuilder);
|
|
82689
82758
|
}
|
|
82690
82759
|
return snapshotOrPromiseFromCachePolicy;
|
|
82691
82760
|
}
|
|
@@ -82727,7 +82796,7 @@
|
|
|
82727
82796
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
82728
82797
|
graphQLImperative = ldsAdapter;
|
|
82729
82798
|
});
|
|
82730
|
-
// version: 1.
|
|
82799
|
+
// version: 1.153.0-d6fe530aa
|
|
82731
82800
|
|
|
82732
82801
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
82733
82802
|
__proto__: null,
|
|
@@ -83433,4 +83502,4 @@
|
|
|
83433
83502
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
83434
83503
|
|
|
83435
83504
|
}));
|
|
83436
|
-
// version: 1.
|
|
83505
|
+
// version: 1.153.0-8e8a8177b
|