@salesforce/lwc-adapters-uiapi 1.142.0 → 1.143.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 +83 -69
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -364,7 +364,7 @@ var FragmentReadResultState;
|
|
|
364
364
|
({
|
|
365
365
|
state: FragmentReadResultState.Missing,
|
|
366
366
|
});
|
|
367
|
-
// engine version: 0.
|
|
367
|
+
// engine version: 0.142.4-be29f4f3
|
|
368
368
|
|
|
369
369
|
/**
|
|
370
370
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -7576,6 +7576,20 @@ function buildQueryTypeStringKey(args) {
|
|
|
7576
7576
|
return `${keyPrefix}::${schemaName}::${queryTypeName}[${serializeOperationNode(operationNode, variables, fragmentMap)}]`;
|
|
7577
7577
|
}
|
|
7578
7578
|
|
|
7579
|
+
/**
|
|
7580
|
+
* @description Spec compliant way to retrieve the correct Operation from the Document that Luvio should operate on. https://spec.graphql.org/June2018/#sec-Named-Operation-Definitions
|
|
7581
|
+
* @param document
|
|
7582
|
+
* @param operationName
|
|
7583
|
+
* @returns The Operation in the GraphQL document we should use for the current call.
|
|
7584
|
+
*/
|
|
7585
|
+
function getOperationFromDocument(document, operationName) {
|
|
7586
|
+
const operations = document.definitions.filter((def) => def.kind === 'OperationDefinition');
|
|
7587
|
+
if (operationName) {
|
|
7588
|
+
return operations.find((def) => def.name !== undefined && def.name.value === operationName);
|
|
7589
|
+
}
|
|
7590
|
+
return operations[0]; // If a named operation is not provided, we return the first one
|
|
7591
|
+
}
|
|
7592
|
+
|
|
7579
7593
|
/**
|
|
7580
7594
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
7581
7595
|
* All rights reserved.
|
|
@@ -57314,43 +57328,38 @@ function getInContextFragmentType(fragment, fragmentMap) {
|
|
|
57314
57328
|
const TTL$5 = 900000;
|
|
57315
57329
|
const VERSION$b = "b440235e7e724631f92002fe50e3e096";
|
|
57316
57330
|
const RepresentationType$c = 'GraphQLRepresentation';
|
|
57317
|
-
function select$8(luvio,
|
|
57318
|
-
const
|
|
57331
|
+
function select$8(luvio, document, variables, operationName) {
|
|
57332
|
+
const operationToExecute = getOperationFromDocument(document, operationName);
|
|
57319
57333
|
return {
|
|
57320
57334
|
kind: 'Fragment',
|
|
57321
57335
|
synthetic: true,
|
|
57322
57336
|
reader: true,
|
|
57323
57337
|
read: (builder) => {
|
|
57324
57338
|
builder.enterPath('data');
|
|
57325
|
-
let sink = {};
|
|
57326
|
-
const fragments = createFragmentMap(query);
|
|
57327
|
-
for (let i = 0, len = definitions.length; i < len; i += 1) {
|
|
57328
|
-
const def = definitions[i];
|
|
57329
|
-
if (def.kind === 'OperationDefinition') {
|
|
57330
|
-
const queryTypeRecordId = keyBuilder$e(luvio, def, variables, fragments);
|
|
57331
|
-
const snapshot = builder.read({
|
|
57332
|
-
recordId: queryTypeRecordId,
|
|
57333
|
-
node: {
|
|
57334
|
-
kind: 'Fragment',
|
|
57335
|
-
private: [],
|
|
57336
|
-
opaque: true,
|
|
57337
|
-
version: VERSION$c
|
|
57338
|
-
},
|
|
57339
|
-
variables: {}
|
|
57340
|
-
});
|
|
57341
|
-
if (snapshot.data === undefined) {
|
|
57342
|
-
builder.markMissingLink(queryTypeRecordId);
|
|
57343
|
-
break;
|
|
57344
|
-
}
|
|
57345
|
-
const data = select$9(def, variables, fragments)(snapshot.data, builder, queryTypeRecordId);
|
|
57346
|
-
sink = {
|
|
57347
|
-
...sink,
|
|
57348
|
-
...data,
|
|
57349
|
-
};
|
|
57350
|
-
}
|
|
57351
|
-
}
|
|
57352
57339
|
const gqlData = {};
|
|
57353
|
-
|
|
57340
|
+
if (operationToExecute === undefined) {
|
|
57341
|
+
builder.markMissing(); // Never give a cache hit for an undefined operation
|
|
57342
|
+
return gqlData;
|
|
57343
|
+
}
|
|
57344
|
+
const fragments = createFragmentMap(document);
|
|
57345
|
+
const queryTypeRecordId = keyBuilder$e(luvio, operationToExecute, variables, fragments);
|
|
57346
|
+
const snapshot = builder.read({
|
|
57347
|
+
recordId: queryTypeRecordId,
|
|
57348
|
+
node: {
|
|
57349
|
+
kind: 'Fragment',
|
|
57350
|
+
private: [],
|
|
57351
|
+
opaque: true,
|
|
57352
|
+
version: VERSION$c
|
|
57353
|
+
},
|
|
57354
|
+
variables: {}
|
|
57355
|
+
});
|
|
57356
|
+
if (snapshot.data === undefined) {
|
|
57357
|
+
builder.markMissingLink(queryTypeRecordId);
|
|
57358
|
+
}
|
|
57359
|
+
else {
|
|
57360
|
+
const data = select$9(operationToExecute, variables, fragments)(snapshot.data, builder, queryTypeRecordId);
|
|
57361
|
+
builder.assignNonScalar(gqlData, 'data', data);
|
|
57362
|
+
}
|
|
57354
57363
|
builder.exitPath();
|
|
57355
57364
|
return gqlData;
|
|
57356
57365
|
}
|
|
@@ -57370,10 +57379,10 @@ function ingestOperationNode(luvio, input, node, state) {
|
|
|
57370
57379
|
});
|
|
57371
57380
|
}
|
|
57372
57381
|
}
|
|
57373
|
-
const ingest$7 = function GraphQLRepresentationIngest(
|
|
57382
|
+
const ingest$7 = function GraphQLRepresentationIngest(document, variables, operationName) {
|
|
57374
57383
|
return (input, path, luvio, store, timestamp) => {
|
|
57375
57384
|
if (input.data) {
|
|
57376
|
-
const fragments = createFragmentMap(
|
|
57385
|
+
const fragments = createFragmentMap(document);
|
|
57377
57386
|
const state = {
|
|
57378
57387
|
data: input.data,
|
|
57379
57388
|
luvio,
|
|
@@ -57383,58 +57392,63 @@ const ingest$7 = function GraphQLRepresentationIngest(query, variables) {
|
|
|
57383
57392
|
variables,
|
|
57384
57393
|
fragments,
|
|
57385
57394
|
};
|
|
57386
|
-
|
|
57387
|
-
|
|
57388
|
-
|
|
57389
|
-
|
|
57390
|
-
});
|
|
57395
|
+
const operationToExecute = getOperationFromDocument(document, operationName);
|
|
57396
|
+
if (operationToExecute !== undefined) {
|
|
57397
|
+
ingestOperationNode(luvio, input, operationToExecute, state);
|
|
57398
|
+
}
|
|
57391
57399
|
}
|
|
57392
57400
|
return {
|
|
57393
57401
|
__ref: undefined
|
|
57394
57402
|
};
|
|
57395
57403
|
};
|
|
57396
57404
|
};
|
|
57397
|
-
function getTypeCacheKeys$8(luvio,
|
|
57405
|
+
function getTypeCacheKeys$8(luvio, document, variables, data, operationName) {
|
|
57398
57406
|
const sink = new StoreKeyMap();
|
|
57399
57407
|
if (data.data) {
|
|
57400
|
-
const fragments = createFragmentMap(
|
|
57401
|
-
|
|
57402
|
-
|
|
57403
|
-
|
|
57404
|
-
|
|
57405
|
-
|
|
57406
|
-
|
|
57407
|
-
|
|
57408
|
-
|
|
57409
|
-
|
|
57410
|
-
|
|
57411
|
-
|
|
57412
|
-
|
|
57413
|
-
|
|
57414
|
-
|
|
57415
|
-
|
|
57416
|
-
});
|
|
57408
|
+
const fragments = createFragmentMap(document);
|
|
57409
|
+
const operationToExecute = getOperationFromDocument(document, operationName);
|
|
57410
|
+
if (operationToExecute !== undefined) {
|
|
57411
|
+
const state = {
|
|
57412
|
+
luvio,
|
|
57413
|
+
variables,
|
|
57414
|
+
fragments,
|
|
57415
|
+
data: data.data,
|
|
57416
|
+
path: {
|
|
57417
|
+
parent: null,
|
|
57418
|
+
propertyName: null,
|
|
57419
|
+
fullPath: '' // TODO: W-13079691 - Need to take another pass at what we want to do for structured keys
|
|
57420
|
+
}
|
|
57421
|
+
};
|
|
57422
|
+
sink.merge(getTypeCacheKeys$9(operationToExecute, state));
|
|
57423
|
+
}
|
|
57417
57424
|
}
|
|
57418
57425
|
return sink;
|
|
57419
57426
|
}
|
|
57420
57427
|
|
|
57421
57428
|
function select$7(luvio, config) {
|
|
57422
|
-
const { query, variables } = config;
|
|
57423
|
-
return select$8(luvio, query, variables);
|
|
57429
|
+
const { query, variables, operationName } = config;
|
|
57430
|
+
return select$8(luvio, query, variables, operationName);
|
|
57424
57431
|
}
|
|
57425
57432
|
function keyBuilder$d(luvio, params) {
|
|
57426
|
-
|
|
57433
|
+
const { query, operationName, variables } = params.body;
|
|
57434
|
+
const operationToExecute = getOperationFromDocument(query, operationName);
|
|
57435
|
+
if (operationToExecute !== undefined) {
|
|
57436
|
+
const fragments = createFragmentMap(query);
|
|
57437
|
+
return keyBuilder$e(luvio, operationToExecute, variables || {}, fragments);
|
|
57438
|
+
}
|
|
57439
|
+
return `adapters_adapter$45$utils_keyPrefix::GraphQLRepresentation::InvalidOperation`;
|
|
57427
57440
|
}
|
|
57428
57441
|
function getResponseCacheKeys$b(luvio, resourceParams, response) {
|
|
57429
57442
|
const query = resourceParams.body.query;
|
|
57430
57443
|
const variables = resourceParams.body.variables || {};
|
|
57431
|
-
|
|
57444
|
+
const operationName = resourceParams.body.operationName;
|
|
57445
|
+
return getTypeCacheKeys$8(luvio, query, variables, response, operationName);
|
|
57432
57446
|
}
|
|
57433
57447
|
function ingestSuccess$5(luvio, config, resourceParams, response, snapshotRefresh) {
|
|
57434
57448
|
const { body } = response;
|
|
57435
|
-
const key = keyBuilder$d();
|
|
57436
|
-
const { query, variables } = resourceParams.body;
|
|
57437
|
-
luvio.storeIngest(key, ingest$7(query, variables), body);
|
|
57449
|
+
const key = keyBuilder$d(luvio, resourceParams);
|
|
57450
|
+
const { query, variables, operationName } = resourceParams.body;
|
|
57451
|
+
luvio.storeIngest(key, ingest$7(query, variables, operationName), body);
|
|
57438
57452
|
// 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
|
|
57439
57453
|
// see optimizePagination for initial update to optimize the query
|
|
57440
57454
|
revertPaginationOptimization(variables);
|
|
@@ -57451,7 +57465,7 @@ function ingestSuccess$5(luvio, config, resourceParams, response, snapshotRefres
|
|
|
57451
57465
|
return snapshot;
|
|
57452
57466
|
}
|
|
57453
57467
|
function ingestError$2(luvio, config, params, error, snapshotRefresh) {
|
|
57454
|
-
const key = keyBuilder$d();
|
|
57468
|
+
const key = keyBuilder$d(luvio, params);
|
|
57455
57469
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
57456
57470
|
const storeMetadataParams = {
|
|
57457
57471
|
ttl: TTL$5,
|
|
@@ -57580,7 +57594,7 @@ function selectChildResourceParams(luvio, childResources, resourceParams) {
|
|
|
57580
57594
|
reader.enterPath(i);
|
|
57581
57595
|
reader.enterPath(envelopeBodyPath);
|
|
57582
57596
|
const childResource = childResources[i];
|
|
57583
|
-
const childKey = keyBuilder$d();
|
|
57597
|
+
const childKey = keyBuilder$d(luvio, childResource);
|
|
57584
57598
|
const childFragment = select$7(luvio, childResource.body); // MUST read from the ORIGINAL config not injected
|
|
57585
57599
|
const isMissingDataBeforeChildRead = reader.getIsDataMissing();
|
|
57586
57600
|
const childSnapshot = reader.read({
|
|
@@ -57699,7 +57713,7 @@ function getResponseCacheKeys$a(luvio, resourceParams, response) {
|
|
|
57699
57713
|
ObjectAssign(keys, childKeys);
|
|
57700
57714
|
}
|
|
57701
57715
|
else if (childStatusCode === 404) {
|
|
57702
|
-
const childKey = keyBuilder$d();
|
|
57716
|
+
const childKey = keyBuilder$d(luvio, childResourceParams);
|
|
57703
57717
|
keys.set(childKey, {
|
|
57704
57718
|
namespace: keyPrefix,
|
|
57705
57719
|
representationName: RepresentationType$c,
|
|
@@ -57717,7 +57731,7 @@ function ingestSuccessChildResourceParams(luvio, childConfigs, childResourcePara
|
|
|
57717
57731
|
// There's an assumption here that the config and resource params aren't reordered.
|
|
57718
57732
|
const childConfig = childConfigs[index];
|
|
57719
57733
|
const childResourceParams = childResourceParamsArray[index];
|
|
57720
|
-
const childKey = keyBuilder$d();
|
|
57734
|
+
const childKey = keyBuilder$d(luvio, childResourceParams);
|
|
57721
57735
|
const result = childEnvelopes[index];
|
|
57722
57736
|
const { statusCode: childStatusCode, result: childBody } = result;
|
|
57723
57737
|
if (childStatusCode === 200 &&
|
|
@@ -57976,8 +57990,8 @@ function createResourceParams$b(config) {
|
|
|
57976
57990
|
return resourceParams;
|
|
57977
57991
|
}
|
|
57978
57992
|
function keyBuilder$a(luvio, config) {
|
|
57979
|
-
createResourceParams$b(config);
|
|
57980
|
-
return keyBuilder$d();
|
|
57993
|
+
const resourceParams = createResourceParams$b(config);
|
|
57994
|
+
return keyBuilder$d(luvio, resourceParams);
|
|
57981
57995
|
}
|
|
57982
57996
|
function typeCheckConfig$e(untrustedConfig) {
|
|
57983
57997
|
const config = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lwc-adapters-uiapi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.143.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "UIAPI adapters with LWC bindings",
|
|
6
6
|
"module": "dist/main.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@salesforce/lds-adapters-uiapi": "*"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@luvio/lwc-luvio": "0.
|
|
37
|
+
"@luvio/lwc-luvio": "0.142.4",
|
|
38
38
|
"@salesforce/lds-default-luvio": "*"
|
|
39
39
|
}
|
|
40
40
|
}
|