@salesforce/lds-runtime-webruntime 1.404.0-dev1 → 1.404.0-dev11
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/ldsWebruntimeOneStoreInit.js +76 -915
- package/package.json +31 -29
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
15
|
import { getInstrumentation } from 'o11y/client';
|
|
16
16
|
import 'force/luvioTypeNormalization1';
|
|
17
|
+
import { Kind, visit, print, wrapConfigAndVerify, resolveAst, validateGraphQLOperations } from 'force/luvioOnestoreGraphqlParser';
|
|
17
18
|
import { setServices } from 'force/luvioServiceProvisioner1';
|
|
18
19
|
export { default, resolve, setServices } from 'force/luvioServiceProvisioner1';
|
|
19
20
|
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
@@ -472,7 +473,12 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
472
473
|
this.coerceAuraErrors
|
|
473
474
|
);
|
|
474
475
|
} else if (this.shouldUseFetch()) {
|
|
475
|
-
|
|
476
|
+
const params = this.fetchParams;
|
|
477
|
+
try {
|
|
478
|
+
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
479
|
+
} catch (reason) {
|
|
480
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
481
|
+
}
|
|
476
482
|
}
|
|
477
483
|
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
478
484
|
}
|
|
@@ -1070,7 +1076,12 @@ let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheContr
|
|
|
1070
1076
|
(errs) => this.coerceAuraErrors(errs)
|
|
1071
1077
|
);
|
|
1072
1078
|
} else if (this.shouldUseFetch()) {
|
|
1073
|
-
|
|
1079
|
+
const params = this.fetchParams;
|
|
1080
|
+
try {
|
|
1081
|
+
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
1082
|
+
} catch (reason) {
|
|
1083
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1084
|
+
}
|
|
1074
1085
|
}
|
|
1075
1086
|
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
1076
1087
|
}
|
|
@@ -1213,7 +1224,12 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1213
1224
|
(errs) => this.coerceAuraErrors(errs)
|
|
1214
1225
|
);
|
|
1215
1226
|
} else if (this.shouldUseFetch()) {
|
|
1216
|
-
|
|
1227
|
+
const params = this.fetchParams;
|
|
1228
|
+
try {
|
|
1229
|
+
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
1230
|
+
} catch (reason) {
|
|
1231
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1232
|
+
}
|
|
1217
1233
|
}
|
|
1218
1234
|
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
1219
1235
|
}
|
|
@@ -1331,7 +1347,11 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1331
1347
|
return this.fetch();
|
|
1332
1348
|
}
|
|
1333
1349
|
fetch() {
|
|
1334
|
-
|
|
1350
|
+
try {
|
|
1351
|
+
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
1352
|
+
} catch (reason) {
|
|
1353
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1354
|
+
}
|
|
1335
1355
|
}
|
|
1336
1356
|
async coerceError(errorResponse) {
|
|
1337
1357
|
return toError(errorResponse.statusText);
|
|
@@ -1534,7 +1554,11 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
|
|
|
1534
1554
|
this.services = services;
|
|
1535
1555
|
}
|
|
1536
1556
|
fetch() {
|
|
1537
|
-
|
|
1557
|
+
try {
|
|
1558
|
+
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
1559
|
+
} catch (reason) {
|
|
1560
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1561
|
+
}
|
|
1538
1562
|
}
|
|
1539
1563
|
async coerceError(errorResponse) {
|
|
1540
1564
|
return toError(errorResponse.statusText);
|
|
@@ -1590,7 +1614,11 @@ class StreamingCommand extends BaseCommand {
|
|
|
1590
1614
|
this.services = services;
|
|
1591
1615
|
}
|
|
1592
1616
|
execute() {
|
|
1593
|
-
|
|
1617
|
+
try {
|
|
1618
|
+
return this.convertFetchStreamResponseToData(this.services.fetch(...this.fetchParams));
|
|
1619
|
+
} catch (reason) {
|
|
1620
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1621
|
+
}
|
|
1594
1622
|
}
|
|
1595
1623
|
convertFetchStreamResponseToData(response) {
|
|
1596
1624
|
return response.then(
|
|
@@ -2426,9 +2454,13 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2426
2454
|
}
|
|
2427
2455
|
get expiredChecks() {
|
|
2428
2456
|
return [
|
|
2429
|
-
|
|
2457
|
+
...super.expiredChecks,
|
|
2458
|
+
(cacheControlMetadata) => cacheControlMetadata.type === "no-cache"
|
|
2430
2459
|
];
|
|
2431
2460
|
}
|
|
2461
|
+
// Note: If we add support for `stale-while-revalidate` in the future, we may
|
|
2462
|
+
// need to further override expiredChecks to allow stale entries that are within the
|
|
2463
|
+
// stale-while-revalidate window to be returned for only-if-cached requests.
|
|
2432
2464
|
collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
|
|
2433
2465
|
if (this.services.instrumentation) {
|
|
2434
2466
|
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
@@ -2774,902 +2806,6 @@ function buildServiceDescriptor$d() {
|
|
|
2774
2806
|
};
|
|
2775
2807
|
}
|
|
2776
2808
|
|
|
2777
|
-
/*!
|
|
2778
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2779
|
-
* All rights reserved.
|
|
2780
|
-
* For full license text, see the LICENSE.txt file
|
|
2781
|
-
*/
|
|
2782
|
-
function devAssert(condition, message) {
|
|
2783
|
-
const booleanCondition = Boolean(condition);
|
|
2784
|
-
if (!booleanCondition) {
|
|
2785
|
-
throw new Error(message);
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
const MAX_ARRAY_LENGTH = 10;
|
|
2789
|
-
const MAX_RECURSIVE_DEPTH = 2;
|
|
2790
|
-
function inspect(value) {
|
|
2791
|
-
return formatValue(value, []);
|
|
2792
|
-
}
|
|
2793
|
-
function formatValue(value, seenValues) {
|
|
2794
|
-
switch (typeof value) {
|
|
2795
|
-
case "string":
|
|
2796
|
-
return JSON.stringify(value);
|
|
2797
|
-
case "function":
|
|
2798
|
-
return value.name ? `[function ${value.name}]` : "[function]";
|
|
2799
|
-
case "object":
|
|
2800
|
-
return formatObjectValue(value, seenValues);
|
|
2801
|
-
default:
|
|
2802
|
-
return String(value);
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
function formatObjectValue(value, previouslySeenValues) {
|
|
2806
|
-
if (value === null) {
|
|
2807
|
-
return "null";
|
|
2808
|
-
}
|
|
2809
|
-
if (previouslySeenValues.includes(value)) {
|
|
2810
|
-
return "[Circular]";
|
|
2811
|
-
}
|
|
2812
|
-
const seenValues = [...previouslySeenValues, value];
|
|
2813
|
-
if (isJSONable(value)) {
|
|
2814
|
-
const jsonValue = value.toJSON();
|
|
2815
|
-
if (jsonValue !== value) {
|
|
2816
|
-
return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
|
|
2817
|
-
}
|
|
2818
|
-
} else if (Array.isArray(value)) {
|
|
2819
|
-
return formatArray(value, seenValues);
|
|
2820
|
-
}
|
|
2821
|
-
return formatObject(value, seenValues);
|
|
2822
|
-
}
|
|
2823
|
-
function isJSONable(value) {
|
|
2824
|
-
return typeof value.toJSON === "function";
|
|
2825
|
-
}
|
|
2826
|
-
function formatObject(object, seenValues) {
|
|
2827
|
-
const entries = Object.entries(object);
|
|
2828
|
-
if (entries.length === 0) {
|
|
2829
|
-
return "{}";
|
|
2830
|
-
}
|
|
2831
|
-
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
2832
|
-
return "[" + getObjectTag(object) + "]";
|
|
2833
|
-
}
|
|
2834
|
-
const properties = entries.map(
|
|
2835
|
-
([key, value]) => key + ": " + formatValue(value, seenValues)
|
|
2836
|
-
);
|
|
2837
|
-
return "{ " + properties.join(", ") + " }";
|
|
2838
|
-
}
|
|
2839
|
-
function formatArray(array, seenValues) {
|
|
2840
|
-
if (array.length === 0) {
|
|
2841
|
-
return "[]";
|
|
2842
|
-
}
|
|
2843
|
-
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
2844
|
-
return "[Array]";
|
|
2845
|
-
}
|
|
2846
|
-
const len = Math.min(MAX_ARRAY_LENGTH, array.length);
|
|
2847
|
-
const remaining = array.length - len;
|
|
2848
|
-
const items = [];
|
|
2849
|
-
for (let i = 0; i < len; ++i) {
|
|
2850
|
-
items.push(formatValue(array[i], seenValues));
|
|
2851
|
-
}
|
|
2852
|
-
if (remaining === 1) {
|
|
2853
|
-
items.push("... 1 more item");
|
|
2854
|
-
} else if (remaining > 1) {
|
|
2855
|
-
items.push(`... ${remaining} more items`);
|
|
2856
|
-
}
|
|
2857
|
-
return "[" + items.join(", ") + "]";
|
|
2858
|
-
}
|
|
2859
|
-
function getObjectTag(object) {
|
|
2860
|
-
const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
|
|
2861
|
-
if (tag === "Object" && typeof object.constructor === "function") {
|
|
2862
|
-
const name = object.constructor.name;
|
|
2863
|
-
if (typeof name === "string" && name !== "") {
|
|
2864
|
-
return name;
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
return tag;
|
|
2868
|
-
}
|
|
2869
|
-
globalThis.process && // eslint-disable-next-line no-undef
|
|
2870
|
-
process.env.NODE_ENV === "production";
|
|
2871
|
-
var Kind;
|
|
2872
|
-
(function(Kind2) {
|
|
2873
|
-
Kind2["NAME"] = "Name";
|
|
2874
|
-
Kind2["DOCUMENT"] = "Document";
|
|
2875
|
-
Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
|
|
2876
|
-
Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
|
|
2877
|
-
Kind2["SELECTION_SET"] = "SelectionSet";
|
|
2878
|
-
Kind2["FIELD"] = "Field";
|
|
2879
|
-
Kind2["ARGUMENT"] = "Argument";
|
|
2880
|
-
Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
|
|
2881
|
-
Kind2["INLINE_FRAGMENT"] = "InlineFragment";
|
|
2882
|
-
Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
|
|
2883
|
-
Kind2["VARIABLE"] = "Variable";
|
|
2884
|
-
Kind2["INT"] = "IntValue";
|
|
2885
|
-
Kind2["FLOAT"] = "FloatValue";
|
|
2886
|
-
Kind2["STRING"] = "StringValue";
|
|
2887
|
-
Kind2["BOOLEAN"] = "BooleanValue";
|
|
2888
|
-
Kind2["NULL"] = "NullValue";
|
|
2889
|
-
Kind2["ENUM"] = "EnumValue";
|
|
2890
|
-
Kind2["LIST"] = "ListValue";
|
|
2891
|
-
Kind2["OBJECT"] = "ObjectValue";
|
|
2892
|
-
Kind2["OBJECT_FIELD"] = "ObjectField";
|
|
2893
|
-
Kind2["DIRECTIVE"] = "Directive";
|
|
2894
|
-
Kind2["NAMED_TYPE"] = "NamedType";
|
|
2895
|
-
Kind2["LIST_TYPE"] = "ListType";
|
|
2896
|
-
Kind2["NON_NULL_TYPE"] = "NonNullType";
|
|
2897
|
-
Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
|
|
2898
|
-
Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
|
|
2899
|
-
Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
|
|
2900
|
-
Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
|
|
2901
|
-
Kind2["FIELD_DEFINITION"] = "FieldDefinition";
|
|
2902
|
-
Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
|
|
2903
|
-
Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
|
|
2904
|
-
Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
|
|
2905
|
-
Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
|
|
2906
|
-
Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
|
|
2907
|
-
Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
|
|
2908
|
-
Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
|
|
2909
|
-
Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
|
|
2910
|
-
Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
|
|
2911
|
-
Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
|
|
2912
|
-
Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
|
|
2913
|
-
Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
|
|
2914
|
-
Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
|
|
2915
|
-
Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
|
|
2916
|
-
})(Kind || (Kind = {}));
|
|
2917
|
-
var TokenKind;
|
|
2918
|
-
(function(TokenKind2) {
|
|
2919
|
-
TokenKind2["SOF"] = "<SOF>";
|
|
2920
|
-
TokenKind2["EOF"] = "<EOF>";
|
|
2921
|
-
TokenKind2["BANG"] = "!";
|
|
2922
|
-
TokenKind2["DOLLAR"] = "$";
|
|
2923
|
-
TokenKind2["AMP"] = "&";
|
|
2924
|
-
TokenKind2["PAREN_L"] = "(";
|
|
2925
|
-
TokenKind2["PAREN_R"] = ")";
|
|
2926
|
-
TokenKind2["SPREAD"] = "...";
|
|
2927
|
-
TokenKind2["COLON"] = ":";
|
|
2928
|
-
TokenKind2["EQUALS"] = "=";
|
|
2929
|
-
TokenKind2["AT"] = "@";
|
|
2930
|
-
TokenKind2["BRACKET_L"] = "[";
|
|
2931
|
-
TokenKind2["BRACKET_R"] = "]";
|
|
2932
|
-
TokenKind2["BRACE_L"] = "{";
|
|
2933
|
-
TokenKind2["PIPE"] = "|";
|
|
2934
|
-
TokenKind2["BRACE_R"] = "}";
|
|
2935
|
-
TokenKind2["NAME"] = "Name";
|
|
2936
|
-
TokenKind2["INT"] = "Int";
|
|
2937
|
-
TokenKind2["FLOAT"] = "Float";
|
|
2938
|
-
TokenKind2["STRING"] = "String";
|
|
2939
|
-
TokenKind2["BLOCK_STRING"] = "BlockString";
|
|
2940
|
-
TokenKind2["COMMENT"] = "Comment";
|
|
2941
|
-
})(TokenKind || (TokenKind = {}));
|
|
2942
|
-
const QueryDocumentKeys = {
|
|
2943
|
-
Name: [],
|
|
2944
|
-
Document: ["definitions"],
|
|
2945
|
-
OperationDefinition: [
|
|
2946
|
-
"name",
|
|
2947
|
-
"variableDefinitions",
|
|
2948
|
-
"directives",
|
|
2949
|
-
"selectionSet"
|
|
2950
|
-
],
|
|
2951
|
-
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
|
|
2952
|
-
Variable: ["name"],
|
|
2953
|
-
SelectionSet: ["selections"],
|
|
2954
|
-
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
|
|
2955
|
-
Argument: ["name", "value"],
|
|
2956
|
-
FragmentSpread: ["name", "directives"],
|
|
2957
|
-
InlineFragment: ["typeCondition", "directives", "selectionSet"],
|
|
2958
|
-
FragmentDefinition: [
|
|
2959
|
-
"name",
|
|
2960
|
-
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
|
|
2961
|
-
"variableDefinitions",
|
|
2962
|
-
"typeCondition",
|
|
2963
|
-
"directives",
|
|
2964
|
-
"selectionSet"
|
|
2965
|
-
],
|
|
2966
|
-
IntValue: [],
|
|
2967
|
-
FloatValue: [],
|
|
2968
|
-
StringValue: [],
|
|
2969
|
-
BooleanValue: [],
|
|
2970
|
-
NullValue: [],
|
|
2971
|
-
EnumValue: [],
|
|
2972
|
-
ListValue: ["values"],
|
|
2973
|
-
ObjectValue: ["fields"],
|
|
2974
|
-
ObjectField: ["name", "value"],
|
|
2975
|
-
Directive: ["name", "arguments"],
|
|
2976
|
-
NamedType: ["name"],
|
|
2977
|
-
ListType: ["type"],
|
|
2978
|
-
NonNullType: ["type"],
|
|
2979
|
-
SchemaDefinition: ["description", "directives", "operationTypes"],
|
|
2980
|
-
OperationTypeDefinition: ["type"],
|
|
2981
|
-
ScalarTypeDefinition: ["description", "name", "directives"],
|
|
2982
|
-
ObjectTypeDefinition: [
|
|
2983
|
-
"description",
|
|
2984
|
-
"name",
|
|
2985
|
-
"interfaces",
|
|
2986
|
-
"directives",
|
|
2987
|
-
"fields"
|
|
2988
|
-
],
|
|
2989
|
-
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
|
|
2990
|
-
InputValueDefinition: [
|
|
2991
|
-
"description",
|
|
2992
|
-
"name",
|
|
2993
|
-
"type",
|
|
2994
|
-
"defaultValue",
|
|
2995
|
-
"directives"
|
|
2996
|
-
],
|
|
2997
|
-
InterfaceTypeDefinition: [
|
|
2998
|
-
"description",
|
|
2999
|
-
"name",
|
|
3000
|
-
"interfaces",
|
|
3001
|
-
"directives",
|
|
3002
|
-
"fields"
|
|
3003
|
-
],
|
|
3004
|
-
UnionTypeDefinition: ["description", "name", "directives", "types"],
|
|
3005
|
-
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
3006
|
-
EnumValueDefinition: ["description", "name", "directives"],
|
|
3007
|
-
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
|
|
3008
|
-
DirectiveDefinition: ["description", "name", "arguments", "locations"],
|
|
3009
|
-
SchemaExtension: ["directives", "operationTypes"],
|
|
3010
|
-
ScalarTypeExtension: ["name", "directives"],
|
|
3011
|
-
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
3012
|
-
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
3013
|
-
UnionTypeExtension: ["name", "directives", "types"],
|
|
3014
|
-
EnumTypeExtension: ["name", "directives", "values"],
|
|
3015
|
-
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
3016
|
-
};
|
|
3017
|
-
const kindValues = new Set(Object.keys(QueryDocumentKeys));
|
|
3018
|
-
function isNode(maybeNode) {
|
|
3019
|
-
const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
|
|
3020
|
-
return typeof maybeKind === "string" && kindValues.has(maybeKind);
|
|
3021
|
-
}
|
|
3022
|
-
var OperationTypeNode;
|
|
3023
|
-
(function(OperationTypeNode2) {
|
|
3024
|
-
OperationTypeNode2["QUERY"] = "query";
|
|
3025
|
-
OperationTypeNode2["MUTATION"] = "mutation";
|
|
3026
|
-
OperationTypeNode2["SUBSCRIPTION"] = "subscription";
|
|
3027
|
-
})(OperationTypeNode || (OperationTypeNode = {}));
|
|
3028
|
-
function isWhiteSpace(code) {
|
|
3029
|
-
return code === 9 || code === 32;
|
|
3030
|
-
}
|
|
3031
|
-
function printBlockString(value, options) {
|
|
3032
|
-
const escapedValue = value.replace(/"""/g, '\\"""');
|
|
3033
|
-
const lines = escapedValue.split(/\r\n|[\n\r]/g);
|
|
3034
|
-
const isSingleLine = lines.length === 1;
|
|
3035
|
-
const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
|
|
3036
|
-
const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
|
|
3037
|
-
const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
|
|
3038
|
-
const hasTrailingSlash = value.endsWith("\\");
|
|
3039
|
-
const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
|
|
3040
|
-
const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability
|
|
3041
|
-
(!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
|
|
3042
|
-
let result = "";
|
|
3043
|
-
const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
|
|
3044
|
-
if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
|
|
3045
|
-
result += "\n";
|
|
3046
|
-
}
|
|
3047
|
-
result += escapedValue;
|
|
3048
|
-
if (printAsMultipleLines || forceTrailingNewline) {
|
|
3049
|
-
result += "\n";
|
|
3050
|
-
}
|
|
3051
|
-
return '"""' + result + '"""';
|
|
3052
|
-
}
|
|
3053
|
-
var DirectiveLocation;
|
|
3054
|
-
(function(DirectiveLocation2) {
|
|
3055
|
-
DirectiveLocation2["QUERY"] = "QUERY";
|
|
3056
|
-
DirectiveLocation2["MUTATION"] = "MUTATION";
|
|
3057
|
-
DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION";
|
|
3058
|
-
DirectiveLocation2["FIELD"] = "FIELD";
|
|
3059
|
-
DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
|
|
3060
|
-
DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
|
|
3061
|
-
DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
|
|
3062
|
-
DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
|
|
3063
|
-
DirectiveLocation2["SCHEMA"] = "SCHEMA";
|
|
3064
|
-
DirectiveLocation2["SCALAR"] = "SCALAR";
|
|
3065
|
-
DirectiveLocation2["OBJECT"] = "OBJECT";
|
|
3066
|
-
DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION";
|
|
3067
|
-
DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
|
|
3068
|
-
DirectiveLocation2["INTERFACE"] = "INTERFACE";
|
|
3069
|
-
DirectiveLocation2["UNION"] = "UNION";
|
|
3070
|
-
DirectiveLocation2["ENUM"] = "ENUM";
|
|
3071
|
-
DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
|
|
3072
|
-
DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
|
|
3073
|
-
DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
|
|
3074
|
-
})(DirectiveLocation || (DirectiveLocation = {}));
|
|
3075
|
-
function printString(str) {
|
|
3076
|
-
return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
|
|
3077
|
-
}
|
|
3078
|
-
const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
3079
|
-
function escapedReplacer(str) {
|
|
3080
|
-
return escapeSequences[str.charCodeAt(0)];
|
|
3081
|
-
}
|
|
3082
|
-
const escapeSequences = [
|
|
3083
|
-
"\\u0000",
|
|
3084
|
-
"\\u0001",
|
|
3085
|
-
"\\u0002",
|
|
3086
|
-
"\\u0003",
|
|
3087
|
-
"\\u0004",
|
|
3088
|
-
"\\u0005",
|
|
3089
|
-
"\\u0006",
|
|
3090
|
-
"\\u0007",
|
|
3091
|
-
"\\b",
|
|
3092
|
-
"\\t",
|
|
3093
|
-
"\\n",
|
|
3094
|
-
"\\u000B",
|
|
3095
|
-
"\\f",
|
|
3096
|
-
"\\r",
|
|
3097
|
-
"\\u000E",
|
|
3098
|
-
"\\u000F",
|
|
3099
|
-
"\\u0010",
|
|
3100
|
-
"\\u0011",
|
|
3101
|
-
"\\u0012",
|
|
3102
|
-
"\\u0013",
|
|
3103
|
-
"\\u0014",
|
|
3104
|
-
"\\u0015",
|
|
3105
|
-
"\\u0016",
|
|
3106
|
-
"\\u0017",
|
|
3107
|
-
"\\u0018",
|
|
3108
|
-
"\\u0019",
|
|
3109
|
-
"\\u001A",
|
|
3110
|
-
"\\u001B",
|
|
3111
|
-
"\\u001C",
|
|
3112
|
-
"\\u001D",
|
|
3113
|
-
"\\u001E",
|
|
3114
|
-
"\\u001F",
|
|
3115
|
-
"",
|
|
3116
|
-
"",
|
|
3117
|
-
'\\"',
|
|
3118
|
-
"",
|
|
3119
|
-
"",
|
|
3120
|
-
"",
|
|
3121
|
-
"",
|
|
3122
|
-
"",
|
|
3123
|
-
"",
|
|
3124
|
-
"",
|
|
3125
|
-
"",
|
|
3126
|
-
"",
|
|
3127
|
-
"",
|
|
3128
|
-
"",
|
|
3129
|
-
"",
|
|
3130
|
-
"",
|
|
3131
|
-
// 2F
|
|
3132
|
-
"",
|
|
3133
|
-
"",
|
|
3134
|
-
"",
|
|
3135
|
-
"",
|
|
3136
|
-
"",
|
|
3137
|
-
"",
|
|
3138
|
-
"",
|
|
3139
|
-
"",
|
|
3140
|
-
"",
|
|
3141
|
-
"",
|
|
3142
|
-
"",
|
|
3143
|
-
"",
|
|
3144
|
-
"",
|
|
3145
|
-
"",
|
|
3146
|
-
"",
|
|
3147
|
-
"",
|
|
3148
|
-
// 3F
|
|
3149
|
-
"",
|
|
3150
|
-
"",
|
|
3151
|
-
"",
|
|
3152
|
-
"",
|
|
3153
|
-
"",
|
|
3154
|
-
"",
|
|
3155
|
-
"",
|
|
3156
|
-
"",
|
|
3157
|
-
"",
|
|
3158
|
-
"",
|
|
3159
|
-
"",
|
|
3160
|
-
"",
|
|
3161
|
-
"",
|
|
3162
|
-
"",
|
|
3163
|
-
"",
|
|
3164
|
-
"",
|
|
3165
|
-
// 4F
|
|
3166
|
-
"",
|
|
3167
|
-
"",
|
|
3168
|
-
"",
|
|
3169
|
-
"",
|
|
3170
|
-
"",
|
|
3171
|
-
"",
|
|
3172
|
-
"",
|
|
3173
|
-
"",
|
|
3174
|
-
"",
|
|
3175
|
-
"",
|
|
3176
|
-
"",
|
|
3177
|
-
"",
|
|
3178
|
-
"\\\\",
|
|
3179
|
-
"",
|
|
3180
|
-
"",
|
|
3181
|
-
"",
|
|
3182
|
-
// 5F
|
|
3183
|
-
"",
|
|
3184
|
-
"",
|
|
3185
|
-
"",
|
|
3186
|
-
"",
|
|
3187
|
-
"",
|
|
3188
|
-
"",
|
|
3189
|
-
"",
|
|
3190
|
-
"",
|
|
3191
|
-
"",
|
|
3192
|
-
"",
|
|
3193
|
-
"",
|
|
3194
|
-
"",
|
|
3195
|
-
"",
|
|
3196
|
-
"",
|
|
3197
|
-
"",
|
|
3198
|
-
"",
|
|
3199
|
-
// 6F
|
|
3200
|
-
"",
|
|
3201
|
-
"",
|
|
3202
|
-
"",
|
|
3203
|
-
"",
|
|
3204
|
-
"",
|
|
3205
|
-
"",
|
|
3206
|
-
"",
|
|
3207
|
-
"",
|
|
3208
|
-
"",
|
|
3209
|
-
"",
|
|
3210
|
-
"",
|
|
3211
|
-
"",
|
|
3212
|
-
"",
|
|
3213
|
-
"",
|
|
3214
|
-
"",
|
|
3215
|
-
"\\u007F",
|
|
3216
|
-
"\\u0080",
|
|
3217
|
-
"\\u0081",
|
|
3218
|
-
"\\u0082",
|
|
3219
|
-
"\\u0083",
|
|
3220
|
-
"\\u0084",
|
|
3221
|
-
"\\u0085",
|
|
3222
|
-
"\\u0086",
|
|
3223
|
-
"\\u0087",
|
|
3224
|
-
"\\u0088",
|
|
3225
|
-
"\\u0089",
|
|
3226
|
-
"\\u008A",
|
|
3227
|
-
"\\u008B",
|
|
3228
|
-
"\\u008C",
|
|
3229
|
-
"\\u008D",
|
|
3230
|
-
"\\u008E",
|
|
3231
|
-
"\\u008F",
|
|
3232
|
-
"\\u0090",
|
|
3233
|
-
"\\u0091",
|
|
3234
|
-
"\\u0092",
|
|
3235
|
-
"\\u0093",
|
|
3236
|
-
"\\u0094",
|
|
3237
|
-
"\\u0095",
|
|
3238
|
-
"\\u0096",
|
|
3239
|
-
"\\u0097",
|
|
3240
|
-
"\\u0098",
|
|
3241
|
-
"\\u0099",
|
|
3242
|
-
"\\u009A",
|
|
3243
|
-
"\\u009B",
|
|
3244
|
-
"\\u009C",
|
|
3245
|
-
"\\u009D",
|
|
3246
|
-
"\\u009E",
|
|
3247
|
-
"\\u009F"
|
|
3248
|
-
];
|
|
3249
|
-
const BREAK = Object.freeze({});
|
|
3250
|
-
function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
|
|
3251
|
-
const enterLeaveMap = /* @__PURE__ */ new Map();
|
|
3252
|
-
for (const kind of Object.values(Kind)) {
|
|
3253
|
-
enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
|
|
3254
|
-
}
|
|
3255
|
-
let stack = void 0;
|
|
3256
|
-
let inArray = Array.isArray(root);
|
|
3257
|
-
let keys = [root];
|
|
3258
|
-
let index = -1;
|
|
3259
|
-
let edits = [];
|
|
3260
|
-
let node = root;
|
|
3261
|
-
let key = void 0;
|
|
3262
|
-
let parent = void 0;
|
|
3263
|
-
const path = [];
|
|
3264
|
-
const ancestors = [];
|
|
3265
|
-
do {
|
|
3266
|
-
index++;
|
|
3267
|
-
const isLeaving = index === keys.length;
|
|
3268
|
-
const isEdited = isLeaving && edits.length !== 0;
|
|
3269
|
-
if (isLeaving) {
|
|
3270
|
-
key = ancestors.length === 0 ? void 0 : path[path.length - 1];
|
|
3271
|
-
node = parent;
|
|
3272
|
-
parent = ancestors.pop();
|
|
3273
|
-
if (isEdited) {
|
|
3274
|
-
if (inArray) {
|
|
3275
|
-
node = node.slice();
|
|
3276
|
-
let editOffset = 0;
|
|
3277
|
-
for (const [editKey, editValue] of edits) {
|
|
3278
|
-
const arrayKey = editKey - editOffset;
|
|
3279
|
-
if (editValue === null) {
|
|
3280
|
-
node.splice(arrayKey, 1);
|
|
3281
|
-
editOffset++;
|
|
3282
|
-
} else {
|
|
3283
|
-
node[arrayKey] = editValue;
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
} else {
|
|
3287
|
-
node = { ...node };
|
|
3288
|
-
for (const [editKey, editValue] of edits) {
|
|
3289
|
-
node[editKey] = editValue;
|
|
3290
|
-
}
|
|
3291
|
-
}
|
|
3292
|
-
}
|
|
3293
|
-
index = stack.index;
|
|
3294
|
-
keys = stack.keys;
|
|
3295
|
-
edits = stack.edits;
|
|
3296
|
-
inArray = stack.inArray;
|
|
3297
|
-
stack = stack.prev;
|
|
3298
|
-
} else if (parent) {
|
|
3299
|
-
key = inArray ? index : keys[index];
|
|
3300
|
-
node = parent[key];
|
|
3301
|
-
if (node === null || node === void 0) {
|
|
3302
|
-
continue;
|
|
3303
|
-
}
|
|
3304
|
-
path.push(key);
|
|
3305
|
-
}
|
|
3306
|
-
let result;
|
|
3307
|
-
if (!Array.isArray(node)) {
|
|
3308
|
-
var _enterLeaveMap$get, _enterLeaveMap$get2;
|
|
3309
|
-
isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
|
|
3310
|
-
const visitFn = isLeaving ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get === void 0 ? void 0 : _enterLeaveMap$get.leave : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get2 === void 0 ? void 0 : _enterLeaveMap$get2.enter;
|
|
3311
|
-
result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors);
|
|
3312
|
-
if (result === BREAK) {
|
|
3313
|
-
break;
|
|
3314
|
-
}
|
|
3315
|
-
if (result === false) {
|
|
3316
|
-
if (!isLeaving) {
|
|
3317
|
-
path.pop();
|
|
3318
|
-
continue;
|
|
3319
|
-
}
|
|
3320
|
-
} else if (result !== void 0) {
|
|
3321
|
-
edits.push([key, result]);
|
|
3322
|
-
if (!isLeaving) {
|
|
3323
|
-
if (isNode(result)) {
|
|
3324
|
-
node = result;
|
|
3325
|
-
} else {
|
|
3326
|
-
path.pop();
|
|
3327
|
-
continue;
|
|
3328
|
-
}
|
|
3329
|
-
}
|
|
3330
|
-
}
|
|
3331
|
-
}
|
|
3332
|
-
if (result === void 0 && isEdited) {
|
|
3333
|
-
edits.push([key, node]);
|
|
3334
|
-
}
|
|
3335
|
-
if (isLeaving) {
|
|
3336
|
-
path.pop();
|
|
3337
|
-
} else {
|
|
3338
|
-
var _node$kind;
|
|
3339
|
-
stack = {
|
|
3340
|
-
inArray,
|
|
3341
|
-
index,
|
|
3342
|
-
keys,
|
|
3343
|
-
edits,
|
|
3344
|
-
prev: stack
|
|
3345
|
-
};
|
|
3346
|
-
inArray = Array.isArray(node);
|
|
3347
|
-
keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : [];
|
|
3348
|
-
index = -1;
|
|
3349
|
-
edits = [];
|
|
3350
|
-
if (parent) {
|
|
3351
|
-
ancestors.push(parent);
|
|
3352
|
-
}
|
|
3353
|
-
parent = node;
|
|
3354
|
-
}
|
|
3355
|
-
} while (stack !== void 0);
|
|
3356
|
-
if (edits.length !== 0) {
|
|
3357
|
-
return edits[edits.length - 1][1];
|
|
3358
|
-
}
|
|
3359
|
-
return root;
|
|
3360
|
-
}
|
|
3361
|
-
function getEnterLeaveForKind(visitor, kind) {
|
|
3362
|
-
const kindVisitor = visitor[kind];
|
|
3363
|
-
if (typeof kindVisitor === "object") {
|
|
3364
|
-
return kindVisitor;
|
|
3365
|
-
} else if (typeof kindVisitor === "function") {
|
|
3366
|
-
return {
|
|
3367
|
-
enter: kindVisitor,
|
|
3368
|
-
leave: void 0
|
|
3369
|
-
};
|
|
3370
|
-
}
|
|
3371
|
-
return {
|
|
3372
|
-
enter: visitor.enter,
|
|
3373
|
-
leave: visitor.leave
|
|
3374
|
-
};
|
|
3375
|
-
}
|
|
3376
|
-
function print(ast) {
|
|
3377
|
-
return visit(ast, printDocASTReducer);
|
|
3378
|
-
}
|
|
3379
|
-
const MAX_LINE_LENGTH = 80;
|
|
3380
|
-
const printDocASTReducer = {
|
|
3381
|
-
Name: {
|
|
3382
|
-
leave: (node) => node.value
|
|
3383
|
-
},
|
|
3384
|
-
Variable: {
|
|
3385
|
-
leave: (node) => "$" + node.name
|
|
3386
|
-
},
|
|
3387
|
-
// Document
|
|
3388
|
-
Document: {
|
|
3389
|
-
leave: (node) => join(node.definitions, "\n\n")
|
|
3390
|
-
},
|
|
3391
|
-
OperationDefinition: {
|
|
3392
|
-
leave(node) {
|
|
3393
|
-
const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")");
|
|
3394
|
-
const prefix = join(
|
|
3395
|
-
[
|
|
3396
|
-
node.operation,
|
|
3397
|
-
join([node.name, varDefs]),
|
|
3398
|
-
join(node.directives, " ")
|
|
3399
|
-
],
|
|
3400
|
-
" "
|
|
3401
|
-
);
|
|
3402
|
-
return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
|
|
3403
|
-
}
|
|
3404
|
-
},
|
|
3405
|
-
VariableDefinition: {
|
|
3406
|
-
leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
|
|
3407
|
-
},
|
|
3408
|
-
SelectionSet: {
|
|
3409
|
-
leave: ({ selections }) => block(selections)
|
|
3410
|
-
},
|
|
3411
|
-
Field: {
|
|
3412
|
-
leave({ alias, name, arguments: args, directives, selectionSet }) {
|
|
3413
|
-
const prefix = wrap("", alias, ": ") + name;
|
|
3414
|
-
let argsLine = prefix + wrap("(", join(args, ", "), ")");
|
|
3415
|
-
if (argsLine.length > MAX_LINE_LENGTH) {
|
|
3416
|
-
argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)");
|
|
3417
|
-
}
|
|
3418
|
-
return join([argsLine, join(directives, " "), selectionSet], " ");
|
|
3419
|
-
}
|
|
3420
|
-
},
|
|
3421
|
-
Argument: {
|
|
3422
|
-
leave: ({ name, value }) => name + ": " + value
|
|
3423
|
-
},
|
|
3424
|
-
// Fragments
|
|
3425
|
-
FragmentSpread: {
|
|
3426
|
-
leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
|
|
3427
|
-
},
|
|
3428
|
-
InlineFragment: {
|
|
3429
|
-
leave: ({ typeCondition, directives, selectionSet }) => join(
|
|
3430
|
-
[
|
|
3431
|
-
"...",
|
|
3432
|
-
wrap("on ", typeCondition),
|
|
3433
|
-
join(directives, " "),
|
|
3434
|
-
selectionSet
|
|
3435
|
-
],
|
|
3436
|
-
" "
|
|
3437
|
-
)
|
|
3438
|
-
},
|
|
3439
|
-
FragmentDefinition: {
|
|
3440
|
-
leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
|
|
3441
|
-
// or removed in the future.
|
|
3442
|
-
`fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
|
|
3443
|
-
)
|
|
3444
|
-
},
|
|
3445
|
-
// Value
|
|
3446
|
-
IntValue: {
|
|
3447
|
-
leave: ({ value }) => value
|
|
3448
|
-
},
|
|
3449
|
-
FloatValue: {
|
|
3450
|
-
leave: ({ value }) => value
|
|
3451
|
-
},
|
|
3452
|
-
StringValue: {
|
|
3453
|
-
leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
|
|
3454
|
-
},
|
|
3455
|
-
BooleanValue: {
|
|
3456
|
-
leave: ({ value }) => value ? "true" : "false"
|
|
3457
|
-
},
|
|
3458
|
-
NullValue: {
|
|
3459
|
-
leave: () => "null"
|
|
3460
|
-
},
|
|
3461
|
-
EnumValue: {
|
|
3462
|
-
leave: ({ value }) => value
|
|
3463
|
-
},
|
|
3464
|
-
ListValue: {
|
|
3465
|
-
leave: ({ values }) => "[" + join(values, ", ") + "]"
|
|
3466
|
-
},
|
|
3467
|
-
ObjectValue: {
|
|
3468
|
-
leave: ({ fields }) => "{" + join(fields, ", ") + "}"
|
|
3469
|
-
},
|
|
3470
|
-
ObjectField: {
|
|
3471
|
-
leave: ({ name, value }) => name + ": " + value
|
|
3472
|
-
},
|
|
3473
|
-
// Directive
|
|
3474
|
-
Directive: {
|
|
3475
|
-
leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
|
|
3476
|
-
},
|
|
3477
|
-
// Type
|
|
3478
|
-
NamedType: {
|
|
3479
|
-
leave: ({ name }) => name
|
|
3480
|
-
},
|
|
3481
|
-
ListType: {
|
|
3482
|
-
leave: ({ type }) => "[" + type + "]"
|
|
3483
|
-
},
|
|
3484
|
-
NonNullType: {
|
|
3485
|
-
leave: ({ type }) => type + "!"
|
|
3486
|
-
},
|
|
3487
|
-
// Type System Definitions
|
|
3488
|
-
SchemaDefinition: {
|
|
3489
|
-
leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ")
|
|
3490
|
-
},
|
|
3491
|
-
OperationTypeDefinition: {
|
|
3492
|
-
leave: ({ operation, type }) => operation + ": " + type
|
|
3493
|
-
},
|
|
3494
|
-
ScalarTypeDefinition: {
|
|
3495
|
-
leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ")
|
|
3496
|
-
},
|
|
3497
|
-
ObjectTypeDefinition: {
|
|
3498
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
|
|
3499
|
-
[
|
|
3500
|
-
"type",
|
|
3501
|
-
name,
|
|
3502
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
3503
|
-
join(directives, " "),
|
|
3504
|
-
block(fields)
|
|
3505
|
-
],
|
|
3506
|
-
" "
|
|
3507
|
-
)
|
|
3508
|
-
},
|
|
3509
|
-
FieldDefinition: {
|
|
3510
|
-
leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + ": " + type + wrap(" ", join(directives, " "))
|
|
3511
|
-
},
|
|
3512
|
-
InputValueDefinition: {
|
|
3513
|
-
leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join(
|
|
3514
|
-
[name + ": " + type, wrap("= ", defaultValue), join(directives, " ")],
|
|
3515
|
-
" "
|
|
3516
|
-
)
|
|
3517
|
-
},
|
|
3518
|
-
InterfaceTypeDefinition: {
|
|
3519
|
-
leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
|
|
3520
|
-
[
|
|
3521
|
-
"interface",
|
|
3522
|
-
name,
|
|
3523
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
3524
|
-
join(directives, " "),
|
|
3525
|
-
block(fields)
|
|
3526
|
-
],
|
|
3527
|
-
" "
|
|
3528
|
-
)
|
|
3529
|
-
},
|
|
3530
|
-
UnionTypeDefinition: {
|
|
3531
|
-
leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join(
|
|
3532
|
-
["union", name, join(directives, " "), wrap("= ", join(types, " | "))],
|
|
3533
|
-
" "
|
|
3534
|
-
)
|
|
3535
|
-
},
|
|
3536
|
-
EnumTypeDefinition: {
|
|
3537
|
-
leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ")
|
|
3538
|
-
},
|
|
3539
|
-
EnumValueDefinition: {
|
|
3540
|
-
leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ")
|
|
3541
|
-
},
|
|
3542
|
-
InputObjectTypeDefinition: {
|
|
3543
|
-
leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
|
|
3544
|
-
},
|
|
3545
|
-
DirectiveDefinition: {
|
|
3546
|
-
leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
|
|
3547
|
-
},
|
|
3548
|
-
SchemaExtension: {
|
|
3549
|
-
leave: ({ directives, operationTypes }) => join(
|
|
3550
|
-
["extend schema", join(directives, " "), block(operationTypes)],
|
|
3551
|
-
" "
|
|
3552
|
-
)
|
|
3553
|
-
},
|
|
3554
|
-
ScalarTypeExtension: {
|
|
3555
|
-
leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
|
|
3556
|
-
},
|
|
3557
|
-
ObjectTypeExtension: {
|
|
3558
|
-
leave: ({ name, interfaces, directives, fields }) => join(
|
|
3559
|
-
[
|
|
3560
|
-
"extend type",
|
|
3561
|
-
name,
|
|
3562
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
3563
|
-
join(directives, " "),
|
|
3564
|
-
block(fields)
|
|
3565
|
-
],
|
|
3566
|
-
" "
|
|
3567
|
-
)
|
|
3568
|
-
},
|
|
3569
|
-
InterfaceTypeExtension: {
|
|
3570
|
-
leave: ({ name, interfaces, directives, fields }) => join(
|
|
3571
|
-
[
|
|
3572
|
-
"extend interface",
|
|
3573
|
-
name,
|
|
3574
|
-
wrap("implements ", join(interfaces, " & ")),
|
|
3575
|
-
join(directives, " "),
|
|
3576
|
-
block(fields)
|
|
3577
|
-
],
|
|
3578
|
-
" "
|
|
3579
|
-
)
|
|
3580
|
-
},
|
|
3581
|
-
UnionTypeExtension: {
|
|
3582
|
-
leave: ({ name, directives, types }) => join(
|
|
3583
|
-
[
|
|
3584
|
-
"extend union",
|
|
3585
|
-
name,
|
|
3586
|
-
join(directives, " "),
|
|
3587
|
-
wrap("= ", join(types, " | "))
|
|
3588
|
-
],
|
|
3589
|
-
" "
|
|
3590
|
-
)
|
|
3591
|
-
},
|
|
3592
|
-
EnumTypeExtension: {
|
|
3593
|
-
leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
|
|
3594
|
-
},
|
|
3595
|
-
InputObjectTypeExtension: {
|
|
3596
|
-
leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
|
|
3597
|
-
}
|
|
3598
|
-
};
|
|
3599
|
-
function join(maybeArray, separator = "") {
|
|
3600
|
-
var _maybeArray$filter$jo;
|
|
3601
|
-
return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
|
|
3602
|
-
}
|
|
3603
|
-
function block(array) {
|
|
3604
|
-
return wrap("{\n", indent(join(array, "\n")), "\n}");
|
|
3605
|
-
}
|
|
3606
|
-
function wrap(start, maybeString, end = "") {
|
|
3607
|
-
return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
|
|
3608
|
-
}
|
|
3609
|
-
function indent(str) {
|
|
3610
|
-
return wrap(" ", str.replace(/\n/g, "\n "));
|
|
3611
|
-
}
|
|
3612
|
-
function hasMultilineItems(maybeArray) {
|
|
3613
|
-
var _maybeArray$some;
|
|
3614
|
-
return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false;
|
|
3615
|
-
}
|
|
3616
|
-
const referenceMap = /* @__PURE__ */ new WeakMap();
|
|
3617
|
-
const astResolver = function(astReference) {
|
|
3618
|
-
return referenceMap.get(astReference);
|
|
3619
|
-
};
|
|
3620
|
-
function findExecutableOperation$1(document, operationName) {
|
|
3621
|
-
const operations = document.definitions.filter(
|
|
3622
|
-
(def) => def.kind === Kind.OPERATION_DEFINITION
|
|
3623
|
-
);
|
|
3624
|
-
if (operations.length === 0) {
|
|
3625
|
-
return void 0;
|
|
3626
|
-
}
|
|
3627
|
-
if (operations.length === 1 && !operationName) {
|
|
3628
|
-
return operations[0];
|
|
3629
|
-
}
|
|
3630
|
-
if (operationName) {
|
|
3631
|
-
return operations.find((op) => {
|
|
3632
|
-
var _a;
|
|
3633
|
-
return ((_a = op.name) == null ? void 0 : _a.value) === operationName;
|
|
3634
|
-
});
|
|
3635
|
-
}
|
|
3636
|
-
return void 0;
|
|
3637
|
-
}
|
|
3638
|
-
function validateGraphQLOperations(config, options) {
|
|
3639
|
-
const executableOperation = findExecutableOperation$1(config.query, config.operationName);
|
|
3640
|
-
if (executableOperation) {
|
|
3641
|
-
const operationType = executableOperation.operation;
|
|
3642
|
-
if (!options.acceptedOperations.includes(operationType)) {
|
|
3643
|
-
const operationTypeCapitalized = operationType.charAt(0).toUpperCase() + operationType.slice(1);
|
|
3644
|
-
throw new Error(
|
|
3645
|
-
`${operationTypeCapitalized} operations are not supported in this context`
|
|
3646
|
-
);
|
|
3647
|
-
}
|
|
3648
|
-
}
|
|
3649
|
-
}
|
|
3650
|
-
function resolveAst(ast) {
|
|
3651
|
-
if (ast === null || ast === void 0) {
|
|
3652
|
-
return;
|
|
3653
|
-
}
|
|
3654
|
-
const result = astResolver(ast);
|
|
3655
|
-
if (result === void 0) {
|
|
3656
|
-
throw new Error("Could not resolve AST. Did you parse the query with gql?");
|
|
3657
|
-
}
|
|
3658
|
-
return result;
|
|
3659
|
-
}
|
|
3660
|
-
function wrapConfigAndVerify(config, options) {
|
|
3661
|
-
if (config == null ? void 0 : config.query) {
|
|
3662
|
-
config = { ...config, query: resolveAst(config.query) };
|
|
3663
|
-
if (config.query === void 0) {
|
|
3664
|
-
throw new Error("Internal error in GraphQL adapter occurred: Unable to resolve query");
|
|
3665
|
-
}
|
|
3666
|
-
validateGraphQLOperations(config, {
|
|
3667
|
-
acceptedOperations: (options == null ? void 0 : options.acceptedOperations) ?? ["query"]
|
|
3668
|
-
});
|
|
3669
|
-
}
|
|
3670
|
-
return config;
|
|
3671
|
-
}
|
|
3672
|
-
|
|
3673
2809
|
/*!
|
|
3674
2810
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3675
2811
|
* All rights reserved.
|
|
@@ -3879,11 +3015,26 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
3879
3015
|
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
3880
3016
|
});
|
|
3881
3017
|
} else if (this.shouldUseFetch()) {
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3018
|
+
const params = this.originalFetchParams;
|
|
3019
|
+
try {
|
|
3020
|
+
return this.convertFetchResponseToData(this.services.fetch(...params)).then(
|
|
3021
|
+
(result) => {
|
|
3022
|
+
return buildSubscribableResult$1(
|
|
3023
|
+
result,
|
|
3024
|
+
this.buildSubscribe(),
|
|
3025
|
+
() => this.refresh()
|
|
3026
|
+
);
|
|
3027
|
+
}
|
|
3028
|
+
);
|
|
3029
|
+
} catch (reason) {
|
|
3030
|
+
return resolvedPromiseLike$2(
|
|
3031
|
+
buildSubscribableResult$1(
|
|
3032
|
+
err$1(toError(reason)),
|
|
3033
|
+
this.buildSubscribe(),
|
|
3034
|
+
() => this.refresh()
|
|
3035
|
+
)
|
|
3036
|
+
);
|
|
3037
|
+
}
|
|
3887
3038
|
}
|
|
3888
3039
|
return resolvedPromiseLike$2(
|
|
3889
3040
|
buildSubscribableResult$1(
|
|
@@ -4158,7 +3309,7 @@ function buildServiceDescriptor$9(luvio) {
|
|
|
4158
3309
|
},
|
|
4159
3310
|
};
|
|
4160
3311
|
}
|
|
4161
|
-
// version: 1.404.0-
|
|
3312
|
+
// version: 1.404.0-dev11-efd5bd34f5
|
|
4162
3313
|
|
|
4163
3314
|
/**
|
|
4164
3315
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4184,7 +3335,7 @@ function buildServiceDescriptor$8(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
4184
3335
|
},
|
|
4185
3336
|
};
|
|
4186
3337
|
}
|
|
4187
|
-
// version: 1.404.0-
|
|
3338
|
+
// version: 1.404.0-dev11-efd5bd34f5
|
|
4188
3339
|
|
|
4189
3340
|
/*!
|
|
4190
3341
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -5621,7 +4772,12 @@ class JwtManager {
|
|
|
5621
4772
|
* All rights reserved.
|
|
5622
4773
|
* For full license text, see the LICENSE.txt file
|
|
5623
4774
|
*/
|
|
5624
|
-
function buildServiceDescriptor(interceptors = {
|
|
4775
|
+
function buildServiceDescriptor(interceptors = {
|
|
4776
|
+
request: [],
|
|
4777
|
+
retry: void 0,
|
|
4778
|
+
response: [],
|
|
4779
|
+
finally: []
|
|
4780
|
+
}, retryService) {
|
|
5625
4781
|
return {
|
|
5626
4782
|
type: "fetch",
|
|
5627
4783
|
version: "1.0",
|
|
@@ -5630,6 +4786,7 @@ function buildServiceDescriptor(interceptors = { request: [], response: [], fina
|
|
|
5630
4786
|
const context = (_a = interceptors.createContext) == null ? void 0 : _a.call(interceptors);
|
|
5631
4787
|
const {
|
|
5632
4788
|
request: requestInterceptors = [],
|
|
4789
|
+
retry: retryInterceptor = void 0,
|
|
5633
4790
|
response: responseInterceptors = [],
|
|
5634
4791
|
finally: finallyInterceptors = []
|
|
5635
4792
|
} = interceptors;
|
|
@@ -5638,10 +4795,14 @@ function buildServiceDescriptor(interceptors = { request: [], response: [], fina
|
|
|
5638
4795
|
resolvedPromiseLike$2(args)
|
|
5639
4796
|
);
|
|
5640
4797
|
return Promise.resolve(pending).then((args2) => {
|
|
5641
|
-
if (
|
|
5642
|
-
return
|
|
4798
|
+
if (retryInterceptor) {
|
|
4799
|
+
return retryInterceptor(args2, retryService, context);
|
|
4800
|
+
} else {
|
|
4801
|
+
if (retryService) {
|
|
4802
|
+
return retryService.applyRetry(() => fetch(...args2));
|
|
4803
|
+
}
|
|
4804
|
+
return fetch(...args2);
|
|
5643
4805
|
}
|
|
5644
|
-
return fetch(...args2);
|
|
5645
4806
|
}).then((response) => {
|
|
5646
4807
|
return responseInterceptors.reduce(
|
|
5647
4808
|
(previousPromise, interceptor) => previousPromise.then((response2) => interceptor(response2, context)),
|
|
@@ -5973,4 +5134,4 @@ withDefaultLuvio((luvio) => {
|
|
|
5973
5134
|
];
|
|
5974
5135
|
setServices(services);
|
|
5975
5136
|
});
|
|
5976
|
-
// version: 1.404.0-
|
|
5137
|
+
// version: 1.404.0-dev11-6f0e46e63f
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-webruntime",
|
|
3
|
-
"version": "1.404.0-
|
|
3
|
+
"version": "1.404.0-dev11",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Webruntime runtime",
|
|
6
6
|
"main": "dist/ldsWebruntimeOneStoreInit.js",
|
|
@@ -35,44 +35,46 @@
|
|
|
35
35
|
"ready": "yarn build && jest --collectCoverage && yarn test:size && yarn release:corejar"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@conduit-client/service-provisioner": "3.
|
|
39
|
-
"@conduit-client/tools-core": "3.
|
|
38
|
+
"@conduit-client/service-provisioner": "3.7.0-dev2",
|
|
39
|
+
"@conduit-client/tools-core": "3.7.0-dev2",
|
|
40
40
|
"jwt-encode": "1.0.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@conduit-client/command-aura-network": "3.
|
|
44
|
-
"@conduit-client/command-aura-normalized-cache-control": "3.
|
|
45
|
-
"@conduit-client/command-aura-resource-cache-control": "3.
|
|
46
|
-
"@conduit-client/command-fetch-network": "3.
|
|
47
|
-
"@conduit-client/command-http-normalized-cache-control": "3.
|
|
48
|
-
"@conduit-client/command-ndjson": "3.
|
|
49
|
-
"@conduit-client/command-network": "3.
|
|
50
|
-
"@conduit-client/command-sse": "3.
|
|
51
|
-
"@conduit-client/command-streaming": "3.
|
|
52
|
-
"@conduit-client/jwt-manager": "3.
|
|
53
|
-
"@conduit-client/service-aura-network": "3.
|
|
54
|
-
"@conduit-client/service-
|
|
55
|
-
"@conduit-client/service-
|
|
56
|
-
"@conduit-client/service-cache
|
|
57
|
-
"@conduit-client/service-
|
|
58
|
-
"@conduit-client/service-
|
|
59
|
-
"@conduit-client/service-
|
|
60
|
-
"@conduit-client/service-
|
|
61
|
-
"@conduit-client/
|
|
43
|
+
"@conduit-client/command-aura-network": "3.7.0-dev2",
|
|
44
|
+
"@conduit-client/command-aura-normalized-cache-control": "3.7.0-dev2",
|
|
45
|
+
"@conduit-client/command-aura-resource-cache-control": "3.7.0-dev2",
|
|
46
|
+
"@conduit-client/command-fetch-network": "3.7.0-dev2",
|
|
47
|
+
"@conduit-client/command-http-normalized-cache-control": "3.7.0-dev2",
|
|
48
|
+
"@conduit-client/command-ndjson": "3.7.0-dev2",
|
|
49
|
+
"@conduit-client/command-network": "3.7.0-dev2",
|
|
50
|
+
"@conduit-client/command-sse": "3.7.0-dev2",
|
|
51
|
+
"@conduit-client/command-streaming": "3.7.0-dev2",
|
|
52
|
+
"@conduit-client/jwt-manager": "3.7.0-dev2",
|
|
53
|
+
"@conduit-client/service-aura-network": "3.7.0-dev2",
|
|
54
|
+
"@conduit-client/service-bindings-imperative": "3.7.0-dev2",
|
|
55
|
+
"@conduit-client/service-bindings-lwc": "3.7.0-dev2",
|
|
56
|
+
"@conduit-client/service-cache": "3.7.0-dev2",
|
|
57
|
+
"@conduit-client/service-cache-control": "3.7.0-dev2",
|
|
58
|
+
"@conduit-client/service-cache-inclusion-policy": "3.7.0-dev2",
|
|
59
|
+
"@conduit-client/service-fetch-network": "3.7.0-dev2",
|
|
60
|
+
"@conduit-client/service-instrument-command": "3.7.0-dev2",
|
|
61
|
+
"@conduit-client/service-pubsub": "3.7.0-dev2",
|
|
62
|
+
"@conduit-client/service-store": "3.7.0-dev2",
|
|
63
|
+
"@conduit-client/utils": "3.7.0-dev2",
|
|
62
64
|
"@luvio/network-adapter-composable": "0.158.7",
|
|
63
65
|
"@luvio/network-adapter-fetch": "0.158.7",
|
|
64
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.404.0-
|
|
65
|
-
"@salesforce/lds-default-luvio": "^1.404.0-
|
|
66
|
-
"@salesforce/lds-luvio-service": "^1.404.0-
|
|
67
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.404.0-
|
|
66
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.404.0-dev11",
|
|
67
|
+
"@salesforce/lds-default-luvio": "^1.404.0-dev11",
|
|
68
|
+
"@salesforce/lds-luvio-service": "^1.404.0-dev11",
|
|
69
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.404.0-dev11"
|
|
68
70
|
},
|
|
69
71
|
"luvioBundlesize": [
|
|
70
72
|
{
|
|
71
73
|
"path": "./dist/ldsWebruntimeOneStoreInit.js",
|
|
72
74
|
"maxSize": {
|
|
73
|
-
"none": "
|
|
74
|
-
"min": "
|
|
75
|
-
"compressed": "
|
|
75
|
+
"none": "160 kB",
|
|
76
|
+
"min": "85 kB",
|
|
77
|
+
"compressed": "25 kB"
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
],
|