@salesforce/lwc-adapters-uiapi 1.110.2 → 1.111.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 +59 -6
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -345,7 +345,7 @@ var FragmentReadResultState;
|
|
|
345
345
|
({
|
|
346
346
|
state: FragmentReadResultState.Missing,
|
|
347
347
|
});
|
|
348
|
-
// engine version: 0.
|
|
348
|
+
// engine version: 0.136.5-77eb3bb4
|
|
349
349
|
|
|
350
350
|
/**
|
|
351
351
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -13273,6 +13273,35 @@ function trimEdges(edges, startOffset, endOffset) {
|
|
|
13273
13273
|
}
|
|
13274
13274
|
}
|
|
13275
13275
|
return trimmedEdges;
|
|
13276
|
+
}
|
|
13277
|
+
function optimizePagination(metadata, firstArgName, afterArgName, variables) {
|
|
13278
|
+
if (typeof metadata === 'object' && metadata !== null && offsetFromToken(metadata, variables[afterArgName]) >= 0) {
|
|
13279
|
+
// optimize only if after cursor is unspecified in the request or it's already loaded in metadata
|
|
13280
|
+
const length = Object.keys(metadata).length;
|
|
13281
|
+
const lastTokenAndOffset = tokenForAtMost(metadata, length);
|
|
13282
|
+
if (lastTokenAndOffset !== undefined) {
|
|
13283
|
+
const [token, offset] = lastTokenAndOffset;
|
|
13284
|
+
variables[firstArgName + '_original'] = variables[firstArgName];
|
|
13285
|
+
variables[afterArgName + '_original'] = variables[afterArgName];
|
|
13286
|
+
variables[firstArgName] -= variables[afterArgName] === null ? (offset + 1) : (offset - 1);
|
|
13287
|
+
variables[afterArgName] = token;
|
|
13288
|
+
}
|
|
13289
|
+
}
|
|
13290
|
+
}
|
|
13291
|
+
function revertPaginationOptimization(variables) {
|
|
13292
|
+
if (variables) {
|
|
13293
|
+
const toBeRemoved = [];
|
|
13294
|
+
for (const key in variables) {
|
|
13295
|
+
if (key.endsWith('_original')) {
|
|
13296
|
+
const origKey = key.substring(0, key.length - '_original'.length);
|
|
13297
|
+
if (Object.prototype.hasOwnProperty.call(variables, origKey)) {
|
|
13298
|
+
variables[origKey] = variables[key];
|
|
13299
|
+
toBeRemoved.push(key);
|
|
13300
|
+
}
|
|
13301
|
+
}
|
|
13302
|
+
}
|
|
13303
|
+
toBeRemoved.forEach((k) => delete variables[k]);
|
|
13304
|
+
}
|
|
13276
13305
|
}
|
|
13277
13306
|
|
|
13278
13307
|
const TTL$y = 30000;
|
|
@@ -44479,7 +44508,7 @@ function ingest$p(astNode, state) {
|
|
|
44479
44508
|
});
|
|
44480
44509
|
}
|
|
44481
44510
|
function selectType$h(typename, sel, fieldData, reader, key, sink, variables, fragments) {
|
|
44482
|
-
var _a, _b, _c;
|
|
44511
|
+
var _a, _b, _c, _d, _e;
|
|
44483
44512
|
if (fieldData === null) {
|
|
44484
44513
|
reader.assignScalar(key, sink, fieldData);
|
|
44485
44514
|
return sink;
|
|
@@ -45098,6 +45127,12 @@ function selectType$h(typename, sel, fieldData, reader, key, sink, variables, fr
|
|
|
45098
45127
|
const listIsComplete = ((metadata === null || metadata === void 0 ? void 0 : metadata.__END__) !== undefined);
|
|
45099
45128
|
let trimmedEdges = [];
|
|
45100
45129
|
let maxOffset = undefined;
|
|
45130
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
45131
|
+
const afterArgIsUnknownToLuvio = afterArgVal !== undefined && (startOffset === undefined || endOffset === undefined);
|
|
45132
|
+
if (afterArgIsUnknownToLuvio) {
|
|
45133
|
+
throw new RangeError("after argument value '" + afterArgVal + "' is unknown in the list. Check that non-paging arguments are constant when paginating.");
|
|
45134
|
+
}
|
|
45135
|
+
}
|
|
45101
45136
|
if (totalEdges === 0 && listIsComplete) {
|
|
45102
45137
|
// We have an empty edge list
|
|
45103
45138
|
// If after token was specified, it will never be a good cursor, so defer to a cache miss
|
|
@@ -45137,6 +45172,10 @@ function selectType$h(typename, sel, fieldData, reader, key, sink, variables, fr
|
|
|
45137
45172
|
if (trimmedEdges === undefined || !listHasEnoughItems) {
|
|
45138
45173
|
reader.markMissingLink(fieldData.__ref);
|
|
45139
45174
|
reader.markMissing();
|
|
45175
|
+
// optimize pagination when "first" and "after" args are part of the variable
|
|
45176
|
+
if (((_c = firstArg === null || firstArg === void 0 ? void 0 : firstArg.value) === null || _c === void 0 ? void 0 : _c.kind) === 'Variable' && ((_d = afterArg === null || afterArg === void 0 ? void 0 : afterArg.value) === null || _d === void 0 ? void 0 : _d.kind) === 'Variable') {
|
|
45177
|
+
optimizePagination(metadata, firstArg.value.name.value, afterArg.value.name.value, variables);
|
|
45178
|
+
}
|
|
45140
45179
|
return;
|
|
45141
45180
|
}
|
|
45142
45181
|
}
|
|
@@ -45150,7 +45189,7 @@ function selectType$h(typename, sel, fieldData, reader, key, sink, variables, fr
|
|
|
45150
45189
|
const result = select$o(sel, variables, fragments)(paginatedData, reader);
|
|
45151
45190
|
const pageInfo = createPageInfo(result === null || result === void 0 ? void 0 : result.edges, startOffset, endOffset, maxOffset, metadata);
|
|
45152
45191
|
if (pageInfo !== undefined) {
|
|
45153
|
-
const selectedPageInfo = selectPageInfo$1((
|
|
45192
|
+
const selectedPageInfo = selectPageInfo$1((_e = sel.selectionSet) === null || _e === void 0 ? void 0 : _e.selections, fragments, pageInfo);
|
|
45154
45193
|
if (selectedPageInfo !== undefined) {
|
|
45155
45194
|
reader.assignNonScalar(result, 'pageInfo', selectedPageInfo);
|
|
45156
45195
|
}
|
|
@@ -46787,7 +46826,7 @@ function getFieldData$e(source, sel, variables) {
|
|
|
46787
46826
|
}
|
|
46788
46827
|
}
|
|
46789
46828
|
function selectType$e(typename, sel, fieldData, reader, key, sink, variables, fragments) {
|
|
46790
|
-
var _a, _b, _c;
|
|
46829
|
+
var _a, _b, _c, _d, _e;
|
|
46791
46830
|
if (fieldData === null) {
|
|
46792
46831
|
reader.assignScalar(key, sink, fieldData);
|
|
46793
46832
|
return sink;
|
|
@@ -46826,6 +46865,12 @@ function selectType$e(typename, sel, fieldData, reader, key, sink, variables, fr
|
|
|
46826
46865
|
const listIsComplete = ((metadata === null || metadata === void 0 ? void 0 : metadata.__END__) !== undefined);
|
|
46827
46866
|
let trimmedEdges = [];
|
|
46828
46867
|
let maxOffset = undefined;
|
|
46868
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
46869
|
+
const afterArgIsUnknownToLuvio = afterArgVal !== undefined && (startOffset === undefined || endOffset === undefined);
|
|
46870
|
+
if (afterArgIsUnknownToLuvio) {
|
|
46871
|
+
throw new RangeError("after argument value '" + afterArgVal + "' is unknown in the list. Check that non-paging arguments are constant when paginating.");
|
|
46872
|
+
}
|
|
46873
|
+
}
|
|
46829
46874
|
if (totalEdges === 0 && listIsComplete) {
|
|
46830
46875
|
// We have an empty edge list
|
|
46831
46876
|
// If after token was specified, it will never be a good cursor, so defer to a cache miss
|
|
@@ -46865,6 +46910,10 @@ function selectType$e(typename, sel, fieldData, reader, key, sink, variables, fr
|
|
|
46865
46910
|
if (trimmedEdges === undefined || !listHasEnoughItems) {
|
|
46866
46911
|
reader.markMissingLink(fieldData.__ref);
|
|
46867
46912
|
reader.markMissing();
|
|
46913
|
+
// optimize pagination when "first" and "after" args are part of the variable
|
|
46914
|
+
if (((_c = firstArg === null || firstArg === void 0 ? void 0 : firstArg.value) === null || _c === void 0 ? void 0 : _c.kind) === 'Variable' && ((_d = afterArg === null || afterArg === void 0 ? void 0 : afterArg.value) === null || _d === void 0 ? void 0 : _d.kind) === 'Variable') {
|
|
46915
|
+
optimizePagination(metadata, firstArg.value.name.value, afterArg.value.name.value, variables);
|
|
46916
|
+
}
|
|
46868
46917
|
return;
|
|
46869
46918
|
}
|
|
46870
46919
|
}
|
|
@@ -46878,7 +46927,7 @@ function selectType$e(typename, sel, fieldData, reader, key, sink, variables, fr
|
|
|
46878
46927
|
const result = select$o(sel, variables, fragments)(paginatedData, reader);
|
|
46879
46928
|
const pageInfo = createPageInfo(result === null || result === void 0 ? void 0 : result.edges, startOffset, endOffset, maxOffset, metadata);
|
|
46880
46929
|
if (pageInfo !== undefined) {
|
|
46881
|
-
const selectedPageInfo = selectPageInfo((
|
|
46930
|
+
const selectedPageInfo = selectPageInfo((_e = sel.selectionSet) === null || _e === void 0 ? void 0 : _e.selections, fragments, pageInfo);
|
|
46882
46931
|
if (selectedPageInfo !== undefined) {
|
|
46883
46932
|
reader.assignNonScalar(result, 'pageInfo', selectedPageInfo);
|
|
46884
46933
|
}
|
|
@@ -53291,7 +53340,8 @@ function serializeValueNode(valueNode, variables) {
|
|
|
53291
53340
|
return aVal < bVal ? -1 : (aVal > bVal) ? 1 : 0;
|
|
53292
53341
|
}).map((val, i) => serializeValueNode(val, variables) + `[${i}]`).join(',');
|
|
53293
53342
|
case ("Variable"):
|
|
53294
|
-
|
|
53343
|
+
const variableValue = variables[valueNode.name.value];
|
|
53344
|
+
return typeof variableValue === "string" ? variableValue : JSON.stringify(variableValue);
|
|
53295
53345
|
case ("NullValue"):
|
|
53296
53346
|
return "null";
|
|
53297
53347
|
case ("ObjectValue"):
|
|
@@ -54066,6 +54116,9 @@ function ingestSuccess$5(luvio, config, resourceParams, response, snapshotRefres
|
|
|
54066
54116
|
const key = keyBuilder$d();
|
|
54067
54117
|
const { query, variables } = resourceParams.body;
|
|
54068
54118
|
luvio.storeIngest(key, ingest$7(query, variables), body);
|
|
54119
|
+
// revert the optimized pagination variables back to its original so that subsequent store lookup will include all records, not just the ones loaded by an optimized query
|
|
54120
|
+
// see optimizePagination for initial update to optimize the query
|
|
54121
|
+
revertPaginationOptimization(variables);
|
|
54069
54122
|
const snapshot = luvio.storeLookup({
|
|
54070
54123
|
recordId: key,
|
|
54071
54124
|
node: select$7(luvio, config),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lwc-adapters-uiapi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.111.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "UIAPI adapters with LWC bindings",
|
|
6
6
|
"module": "dist/main.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"clean": "rm -rf dist src/generated"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@luvio/engine": "0.
|
|
35
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
34
|
+
"@luvio/engine": "0.136.5",
|
|
35
|
+
"@salesforce/lds-adapters-uiapi": "^1.111.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@luvio/lwc-luvio": "0.
|
|
39
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
38
|
+
"@luvio/lwc-luvio": "0.136.5",
|
|
39
|
+
"@salesforce/lds-default-luvio": "^1.111.0"
|
|
40
40
|
}
|
|
41
41
|
}
|