@salesforce/lds-runtime-webruntime 1.376.0 → 1.377.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.
@@ -13,6 +13,7 @@
13
13
  */
14
14
  /* proxy-compat-disable */
15
15
  import { getInstrumentation } from 'o11y/client';
16
+ import 'force/luvioTypeNormalization1';
16
17
  import { setServices } from 'force/luvioServiceProvisioner1';
17
18
  export { default, resolve, setServices } from 'force/luvioServiceProvisioner1';
18
19
  import { getSfapJwt } from 'force/clwrSfapExchange';
@@ -188,6 +189,20 @@ function toError(x) {
188
189
  }
189
190
  return new Error(typeof x === "string" ? x : JSON.stringify(x));
190
191
  }
192
+ class InternalError extends Error {
193
+ constructor(data) {
194
+ super();
195
+ this.data = data;
196
+ this.type = "internal";
197
+ }
198
+ }
199
+ class UserVisibleError extends Error {
200
+ constructor(data) {
201
+ super();
202
+ this.data = data;
203
+ this.type = "user-visible";
204
+ }
205
+ }
191
206
 
192
207
  /*!
193
208
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -252,7 +267,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
252
267
  async afterRequestHooks(_options) {
253
268
  }
254
269
  };
255
- function buildServiceDescriptor$e() {
270
+ function buildServiceDescriptor$i() {
256
271
  return {
257
272
  type: "networkCommandBaseClass",
258
273
  version: "1.0",
@@ -354,7 +369,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
354
369
  return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
355
370
  }
356
371
  }
357
- function buildServiceDescriptor$d() {
372
+ function buildServiceDescriptor$h() {
358
373
  return {
359
374
  type: "auraNetworkCommandBaseClass",
360
375
  version: "1.0",
@@ -861,7 +876,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
861
876
  return `{"endpoint":${this.endpoint},"params":${stableJSONStringify(this.auraParams)}}`;
862
877
  }
863
878
  }
864
- function buildServiceDescriptor$c() {
879
+ function buildServiceDescriptor$g() {
865
880
  return {
866
881
  type: "auraResourceCacheControlCommand",
867
882
  version: "1.0",
@@ -1000,7 +1015,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
1000
1015
  return resolvedPromiseLike$3(void 0);
1001
1016
  }
1002
1017
  }
1003
- function buildServiceDescriptor$b() {
1018
+ function buildServiceDescriptor$f() {
1004
1019
  return {
1005
1020
  type: "auraNormalizedCacheControlCommand",
1006
1021
  version: "1.0",
@@ -1089,7 +1104,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
1089
1104
  return resolvedPromiseLike$3(void 0);
1090
1105
  }
1091
1106
  }
1092
- function buildServiceDescriptor$a() {
1107
+ function buildServiceDescriptor$e() {
1093
1108
  return {
1094
1109
  type: "httpNormalizedCacheControlCommand",
1095
1110
  version: "1.0",
@@ -1196,7 +1211,7 @@ class FetchNetworkCommand extends NetworkCommand {
1196
1211
  );
1197
1212
  }
1198
1213
  }
1199
- function buildServiceDescriptor$9() {
1214
+ function buildServiceDescriptor$d() {
1200
1215
  return {
1201
1216
  type: "fetchNetworkCommandBaseClass",
1202
1217
  version: "1.0",
@@ -1232,7 +1247,7 @@ class StreamingCommand extends BaseCommand {
1232
1247
  );
1233
1248
  }
1234
1249
  }
1235
- function buildServiceDescriptor$8() {
1250
+ function buildServiceDescriptor$c() {
1236
1251
  return {
1237
1252
  type: "streamingCommandBaseClass",
1238
1253
  version: "1.0",
@@ -1315,7 +1330,7 @@ class SSEParsingStream extends TransformStream {
1315
1330
  });
1316
1331
  }
1317
1332
  }
1318
- function buildServiceDescriptor$7() {
1333
+ function buildServiceDescriptor$b() {
1319
1334
  return {
1320
1335
  type: "SSECommandBaseClass",
1321
1336
  version: "1.0",
@@ -1361,7 +1376,7 @@ function buildInstrumentCommand(services) {
1361
1376
  };
1362
1377
  };
1363
1378
  }
1364
- function buildServiceDescriptor$6(instrumentation) {
1379
+ function buildServiceDescriptor$a(instrumentation) {
1365
1380
  return {
1366
1381
  type: "instrumentCommand",
1367
1382
  version: "1.0",
@@ -1631,7 +1646,7 @@ class O11yInstrumentation {
1631
1646
  this.metrics = new O11yOTelMetricsAPI(this.services);
1632
1647
  }
1633
1648
  }
1634
- function buildServiceDescriptor$5(logger) {
1649
+ function buildServiceDescriptor$9(logger) {
1635
1650
  return {
1636
1651
  type: "instrumentation",
1637
1652
  version: "1.0",
@@ -1884,7 +1899,7 @@ class DefaultCache {
1884
1899
  return new FixedTimeWritableCache(this, generatedTime);
1885
1900
  }
1886
1901
  }
1887
- function buildServiceDescriptor$4() {
1902
+ function buildServiceDescriptor$8() {
1888
1903
  return {
1889
1904
  type: "cache",
1890
1905
  version: "1.0",
@@ -2052,7 +2067,7 @@ class CacheController {
2052
2067
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
2053
2068
  }
2054
2069
  }
2055
- function buildServiceDescriptor$3(cache, cacheInclusionPolicy) {
2070
+ function buildServiceDescriptor$7(cache, cacheInclusionPolicy) {
2056
2071
  return {
2057
2072
  type: "cacheController",
2058
2073
  version: "1.0",
@@ -2162,7 +2177,7 @@ class DefaultPubSubService {
2162
2177
  return matchingSubscriptions;
2163
2178
  }
2164
2179
  }
2165
- function buildServiceDescriptor$2() {
2180
+ function buildServiceDescriptor$6() {
2166
2181
  return {
2167
2182
  type: "pubSub",
2168
2183
  version: "1.0",
@@ -2357,6 +2372,1193 @@ function buildInMemoryCacheInclusionPolicyService(cache) {
2357
2372
  };
2358
2373
  }
2359
2374
 
2375
+ /*!
2376
+ * Copyright (c) 2022, Salesforce, Inc.,
2377
+ * All rights reserved.
2378
+ * For full license text, see the LICENSE.txt file
2379
+ */
2380
+ class FeatureFlagsService {
2381
+ constructor() {
2382
+ this.flags = /* @__PURE__ */ new Map();
2383
+ }
2384
+ set(flagName, value) {
2385
+ this.flags.set(flagName, value);
2386
+ }
2387
+ get(flagName, defaultValue = false) {
2388
+ return this.flags.get(flagName) || defaultValue;
2389
+ }
2390
+ }
2391
+ function buildServiceDescriptor$5() {
2392
+ return {
2393
+ version: "1.0",
2394
+ service: new FeatureFlagsService(),
2395
+ type: "featureFlags"
2396
+ };
2397
+ }
2398
+
2399
+ /*!
2400
+ * Copyright (c) 2022, Salesforce, Inc.,
2401
+ * All rights reserved.
2402
+ * For full license text, see the LICENSE.txt file
2403
+ */
2404
+ function devAssert(condition, message) {
2405
+ const booleanCondition = Boolean(condition);
2406
+ if (!booleanCondition) {
2407
+ throw new Error(message);
2408
+ }
2409
+ }
2410
+ const MAX_ARRAY_LENGTH = 10;
2411
+ const MAX_RECURSIVE_DEPTH = 2;
2412
+ function inspect(value) {
2413
+ return formatValue(value, []);
2414
+ }
2415
+ function formatValue(value, seenValues) {
2416
+ switch (typeof value) {
2417
+ case "string":
2418
+ return JSON.stringify(value);
2419
+ case "function":
2420
+ return value.name ? `[function ${value.name}]` : "[function]";
2421
+ case "object":
2422
+ return formatObjectValue(value, seenValues);
2423
+ default:
2424
+ return String(value);
2425
+ }
2426
+ }
2427
+ function formatObjectValue(value, previouslySeenValues) {
2428
+ if (value === null) {
2429
+ return "null";
2430
+ }
2431
+ if (previouslySeenValues.includes(value)) {
2432
+ return "[Circular]";
2433
+ }
2434
+ const seenValues = [...previouslySeenValues, value];
2435
+ if (isJSONable(value)) {
2436
+ const jsonValue = value.toJSON();
2437
+ if (jsonValue !== value) {
2438
+ return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
2439
+ }
2440
+ } else if (Array.isArray(value)) {
2441
+ return formatArray(value, seenValues);
2442
+ }
2443
+ return formatObject(value, seenValues);
2444
+ }
2445
+ function isJSONable(value) {
2446
+ return typeof value.toJSON === "function";
2447
+ }
2448
+ function formatObject(object, seenValues) {
2449
+ const entries = Object.entries(object);
2450
+ if (entries.length === 0) {
2451
+ return "{}";
2452
+ }
2453
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
2454
+ return "[" + getObjectTag(object) + "]";
2455
+ }
2456
+ const properties = entries.map(
2457
+ ([key, value]) => key + ": " + formatValue(value, seenValues)
2458
+ );
2459
+ return "{ " + properties.join(", ") + " }";
2460
+ }
2461
+ function formatArray(array, seenValues) {
2462
+ if (array.length === 0) {
2463
+ return "[]";
2464
+ }
2465
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
2466
+ return "[Array]";
2467
+ }
2468
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
2469
+ const remaining = array.length - len;
2470
+ const items = [];
2471
+ for (let i = 0; i < len; ++i) {
2472
+ items.push(formatValue(array[i], seenValues));
2473
+ }
2474
+ if (remaining === 1) {
2475
+ items.push("... 1 more item");
2476
+ } else if (remaining > 1) {
2477
+ items.push(`... ${remaining} more items`);
2478
+ }
2479
+ return "[" + items.join(", ") + "]";
2480
+ }
2481
+ function getObjectTag(object) {
2482
+ const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
2483
+ if (tag === "Object" && typeof object.constructor === "function") {
2484
+ const name = object.constructor.name;
2485
+ if (typeof name === "string" && name !== "") {
2486
+ return name;
2487
+ }
2488
+ }
2489
+ return tag;
2490
+ }
2491
+ globalThis.process && // eslint-disable-next-line no-undef
2492
+ process.env.NODE_ENV === "production";
2493
+ var Kind;
2494
+ (function(Kind2) {
2495
+ Kind2["NAME"] = "Name";
2496
+ Kind2["DOCUMENT"] = "Document";
2497
+ Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
2498
+ Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
2499
+ Kind2["SELECTION_SET"] = "SelectionSet";
2500
+ Kind2["FIELD"] = "Field";
2501
+ Kind2["ARGUMENT"] = "Argument";
2502
+ Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
2503
+ Kind2["INLINE_FRAGMENT"] = "InlineFragment";
2504
+ Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
2505
+ Kind2["VARIABLE"] = "Variable";
2506
+ Kind2["INT"] = "IntValue";
2507
+ Kind2["FLOAT"] = "FloatValue";
2508
+ Kind2["STRING"] = "StringValue";
2509
+ Kind2["BOOLEAN"] = "BooleanValue";
2510
+ Kind2["NULL"] = "NullValue";
2511
+ Kind2["ENUM"] = "EnumValue";
2512
+ Kind2["LIST"] = "ListValue";
2513
+ Kind2["OBJECT"] = "ObjectValue";
2514
+ Kind2["OBJECT_FIELD"] = "ObjectField";
2515
+ Kind2["DIRECTIVE"] = "Directive";
2516
+ Kind2["NAMED_TYPE"] = "NamedType";
2517
+ Kind2["LIST_TYPE"] = "ListType";
2518
+ Kind2["NON_NULL_TYPE"] = "NonNullType";
2519
+ Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
2520
+ Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
2521
+ Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
2522
+ Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
2523
+ Kind2["FIELD_DEFINITION"] = "FieldDefinition";
2524
+ Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
2525
+ Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
2526
+ Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
2527
+ Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
2528
+ Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
2529
+ Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
2530
+ Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
2531
+ Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
2532
+ Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
2533
+ Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
2534
+ Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
2535
+ Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
2536
+ Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
2537
+ Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
2538
+ })(Kind || (Kind = {}));
2539
+ var TokenKind;
2540
+ (function(TokenKind2) {
2541
+ TokenKind2["SOF"] = "<SOF>";
2542
+ TokenKind2["EOF"] = "<EOF>";
2543
+ TokenKind2["BANG"] = "!";
2544
+ TokenKind2["DOLLAR"] = "$";
2545
+ TokenKind2["AMP"] = "&";
2546
+ TokenKind2["PAREN_L"] = "(";
2547
+ TokenKind2["PAREN_R"] = ")";
2548
+ TokenKind2["SPREAD"] = "...";
2549
+ TokenKind2["COLON"] = ":";
2550
+ TokenKind2["EQUALS"] = "=";
2551
+ TokenKind2["AT"] = "@";
2552
+ TokenKind2["BRACKET_L"] = "[";
2553
+ TokenKind2["BRACKET_R"] = "]";
2554
+ TokenKind2["BRACE_L"] = "{";
2555
+ TokenKind2["PIPE"] = "|";
2556
+ TokenKind2["BRACE_R"] = "}";
2557
+ TokenKind2["NAME"] = "Name";
2558
+ TokenKind2["INT"] = "Int";
2559
+ TokenKind2["FLOAT"] = "Float";
2560
+ TokenKind2["STRING"] = "String";
2561
+ TokenKind2["BLOCK_STRING"] = "BlockString";
2562
+ TokenKind2["COMMENT"] = "Comment";
2563
+ })(TokenKind || (TokenKind = {}));
2564
+ const QueryDocumentKeys = {
2565
+ Name: [],
2566
+ Document: ["definitions"],
2567
+ OperationDefinition: [
2568
+ "name",
2569
+ "variableDefinitions",
2570
+ "directives",
2571
+ "selectionSet"
2572
+ ],
2573
+ VariableDefinition: ["variable", "type", "defaultValue", "directives"],
2574
+ Variable: ["name"],
2575
+ SelectionSet: ["selections"],
2576
+ Field: ["alias", "name", "arguments", "directives", "selectionSet"],
2577
+ Argument: ["name", "value"],
2578
+ FragmentSpread: ["name", "directives"],
2579
+ InlineFragment: ["typeCondition", "directives", "selectionSet"],
2580
+ FragmentDefinition: [
2581
+ "name",
2582
+ // Note: fragment variable definitions are deprecated and will removed in v17.0.0
2583
+ "variableDefinitions",
2584
+ "typeCondition",
2585
+ "directives",
2586
+ "selectionSet"
2587
+ ],
2588
+ IntValue: [],
2589
+ FloatValue: [],
2590
+ StringValue: [],
2591
+ BooleanValue: [],
2592
+ NullValue: [],
2593
+ EnumValue: [],
2594
+ ListValue: ["values"],
2595
+ ObjectValue: ["fields"],
2596
+ ObjectField: ["name", "value"],
2597
+ Directive: ["name", "arguments"],
2598
+ NamedType: ["name"],
2599
+ ListType: ["type"],
2600
+ NonNullType: ["type"],
2601
+ SchemaDefinition: ["description", "directives", "operationTypes"],
2602
+ OperationTypeDefinition: ["type"],
2603
+ ScalarTypeDefinition: ["description", "name", "directives"],
2604
+ ObjectTypeDefinition: [
2605
+ "description",
2606
+ "name",
2607
+ "interfaces",
2608
+ "directives",
2609
+ "fields"
2610
+ ],
2611
+ FieldDefinition: ["description", "name", "arguments", "type", "directives"],
2612
+ InputValueDefinition: [
2613
+ "description",
2614
+ "name",
2615
+ "type",
2616
+ "defaultValue",
2617
+ "directives"
2618
+ ],
2619
+ InterfaceTypeDefinition: [
2620
+ "description",
2621
+ "name",
2622
+ "interfaces",
2623
+ "directives",
2624
+ "fields"
2625
+ ],
2626
+ UnionTypeDefinition: ["description", "name", "directives", "types"],
2627
+ EnumTypeDefinition: ["description", "name", "directives", "values"],
2628
+ EnumValueDefinition: ["description", "name", "directives"],
2629
+ InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
2630
+ DirectiveDefinition: ["description", "name", "arguments", "locations"],
2631
+ SchemaExtension: ["directives", "operationTypes"],
2632
+ ScalarTypeExtension: ["name", "directives"],
2633
+ ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
2634
+ InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
2635
+ UnionTypeExtension: ["name", "directives", "types"],
2636
+ EnumTypeExtension: ["name", "directives", "values"],
2637
+ InputObjectTypeExtension: ["name", "directives", "fields"]
2638
+ };
2639
+ const kindValues = new Set(Object.keys(QueryDocumentKeys));
2640
+ function isNode(maybeNode) {
2641
+ const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
2642
+ return typeof maybeKind === "string" && kindValues.has(maybeKind);
2643
+ }
2644
+ var OperationTypeNode;
2645
+ (function(OperationTypeNode2) {
2646
+ OperationTypeNode2["QUERY"] = "query";
2647
+ OperationTypeNode2["MUTATION"] = "mutation";
2648
+ OperationTypeNode2["SUBSCRIPTION"] = "subscription";
2649
+ })(OperationTypeNode || (OperationTypeNode = {}));
2650
+ function isWhiteSpace(code) {
2651
+ return code === 9 || code === 32;
2652
+ }
2653
+ function printBlockString(value, options) {
2654
+ const escapedValue = value.replace(/"""/g, '\\"""');
2655
+ const lines = escapedValue.split(/\r\n|[\n\r]/g);
2656
+ const isSingleLine = lines.length === 1;
2657
+ const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
2658
+ const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
2659
+ const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
2660
+ const hasTrailingSlash = value.endsWith("\\");
2661
+ const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
2662
+ const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability
2663
+ (!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
2664
+ let result = "";
2665
+ const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
2666
+ if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
2667
+ result += "\n";
2668
+ }
2669
+ result += escapedValue;
2670
+ if (printAsMultipleLines || forceTrailingNewline) {
2671
+ result += "\n";
2672
+ }
2673
+ return '"""' + result + '"""';
2674
+ }
2675
+ var DirectiveLocation;
2676
+ (function(DirectiveLocation2) {
2677
+ DirectiveLocation2["QUERY"] = "QUERY";
2678
+ DirectiveLocation2["MUTATION"] = "MUTATION";
2679
+ DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION";
2680
+ DirectiveLocation2["FIELD"] = "FIELD";
2681
+ DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
2682
+ DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
2683
+ DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
2684
+ DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
2685
+ DirectiveLocation2["SCHEMA"] = "SCHEMA";
2686
+ DirectiveLocation2["SCALAR"] = "SCALAR";
2687
+ DirectiveLocation2["OBJECT"] = "OBJECT";
2688
+ DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION";
2689
+ DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
2690
+ DirectiveLocation2["INTERFACE"] = "INTERFACE";
2691
+ DirectiveLocation2["UNION"] = "UNION";
2692
+ DirectiveLocation2["ENUM"] = "ENUM";
2693
+ DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
2694
+ DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
2695
+ DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
2696
+ })(DirectiveLocation || (DirectiveLocation = {}));
2697
+ function printString(str) {
2698
+ return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
2699
+ }
2700
+ const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
2701
+ function escapedReplacer(str) {
2702
+ return escapeSequences[str.charCodeAt(0)];
2703
+ }
2704
+ const escapeSequences = [
2705
+ "\\u0000",
2706
+ "\\u0001",
2707
+ "\\u0002",
2708
+ "\\u0003",
2709
+ "\\u0004",
2710
+ "\\u0005",
2711
+ "\\u0006",
2712
+ "\\u0007",
2713
+ "\\b",
2714
+ "\\t",
2715
+ "\\n",
2716
+ "\\u000B",
2717
+ "\\f",
2718
+ "\\r",
2719
+ "\\u000E",
2720
+ "\\u000F",
2721
+ "\\u0010",
2722
+ "\\u0011",
2723
+ "\\u0012",
2724
+ "\\u0013",
2725
+ "\\u0014",
2726
+ "\\u0015",
2727
+ "\\u0016",
2728
+ "\\u0017",
2729
+ "\\u0018",
2730
+ "\\u0019",
2731
+ "\\u001A",
2732
+ "\\u001B",
2733
+ "\\u001C",
2734
+ "\\u001D",
2735
+ "\\u001E",
2736
+ "\\u001F",
2737
+ "",
2738
+ "",
2739
+ '\\"',
2740
+ "",
2741
+ "",
2742
+ "",
2743
+ "",
2744
+ "",
2745
+ "",
2746
+ "",
2747
+ "",
2748
+ "",
2749
+ "",
2750
+ "",
2751
+ "",
2752
+ "",
2753
+ // 2F
2754
+ "",
2755
+ "",
2756
+ "",
2757
+ "",
2758
+ "",
2759
+ "",
2760
+ "",
2761
+ "",
2762
+ "",
2763
+ "",
2764
+ "",
2765
+ "",
2766
+ "",
2767
+ "",
2768
+ "",
2769
+ "",
2770
+ // 3F
2771
+ "",
2772
+ "",
2773
+ "",
2774
+ "",
2775
+ "",
2776
+ "",
2777
+ "",
2778
+ "",
2779
+ "",
2780
+ "",
2781
+ "",
2782
+ "",
2783
+ "",
2784
+ "",
2785
+ "",
2786
+ "",
2787
+ // 4F
2788
+ "",
2789
+ "",
2790
+ "",
2791
+ "",
2792
+ "",
2793
+ "",
2794
+ "",
2795
+ "",
2796
+ "",
2797
+ "",
2798
+ "",
2799
+ "",
2800
+ "\\\\",
2801
+ "",
2802
+ "",
2803
+ "",
2804
+ // 5F
2805
+ "",
2806
+ "",
2807
+ "",
2808
+ "",
2809
+ "",
2810
+ "",
2811
+ "",
2812
+ "",
2813
+ "",
2814
+ "",
2815
+ "",
2816
+ "",
2817
+ "",
2818
+ "",
2819
+ "",
2820
+ "",
2821
+ // 6F
2822
+ "",
2823
+ "",
2824
+ "",
2825
+ "",
2826
+ "",
2827
+ "",
2828
+ "",
2829
+ "",
2830
+ "",
2831
+ "",
2832
+ "",
2833
+ "",
2834
+ "",
2835
+ "",
2836
+ "",
2837
+ "\\u007F",
2838
+ "\\u0080",
2839
+ "\\u0081",
2840
+ "\\u0082",
2841
+ "\\u0083",
2842
+ "\\u0084",
2843
+ "\\u0085",
2844
+ "\\u0086",
2845
+ "\\u0087",
2846
+ "\\u0088",
2847
+ "\\u0089",
2848
+ "\\u008A",
2849
+ "\\u008B",
2850
+ "\\u008C",
2851
+ "\\u008D",
2852
+ "\\u008E",
2853
+ "\\u008F",
2854
+ "\\u0090",
2855
+ "\\u0091",
2856
+ "\\u0092",
2857
+ "\\u0093",
2858
+ "\\u0094",
2859
+ "\\u0095",
2860
+ "\\u0096",
2861
+ "\\u0097",
2862
+ "\\u0098",
2863
+ "\\u0099",
2864
+ "\\u009A",
2865
+ "\\u009B",
2866
+ "\\u009C",
2867
+ "\\u009D",
2868
+ "\\u009E",
2869
+ "\\u009F"
2870
+ ];
2871
+ const BREAK = Object.freeze({});
2872
+ function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
2873
+ const enterLeaveMap = /* @__PURE__ */ new Map();
2874
+ for (const kind of Object.values(Kind)) {
2875
+ enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
2876
+ }
2877
+ let stack = void 0;
2878
+ let inArray = Array.isArray(root);
2879
+ let keys = [root];
2880
+ let index = -1;
2881
+ let edits = [];
2882
+ let node = root;
2883
+ let key = void 0;
2884
+ let parent = void 0;
2885
+ const path = [];
2886
+ const ancestors = [];
2887
+ do {
2888
+ index++;
2889
+ const isLeaving = index === keys.length;
2890
+ const isEdited = isLeaving && edits.length !== 0;
2891
+ if (isLeaving) {
2892
+ key = ancestors.length === 0 ? void 0 : path[path.length - 1];
2893
+ node = parent;
2894
+ parent = ancestors.pop();
2895
+ if (isEdited) {
2896
+ if (inArray) {
2897
+ node = node.slice();
2898
+ let editOffset = 0;
2899
+ for (const [editKey, editValue] of edits) {
2900
+ const arrayKey = editKey - editOffset;
2901
+ if (editValue === null) {
2902
+ node.splice(arrayKey, 1);
2903
+ editOffset++;
2904
+ } else {
2905
+ node[arrayKey] = editValue;
2906
+ }
2907
+ }
2908
+ } else {
2909
+ node = { ...node };
2910
+ for (const [editKey, editValue] of edits) {
2911
+ node[editKey] = editValue;
2912
+ }
2913
+ }
2914
+ }
2915
+ index = stack.index;
2916
+ keys = stack.keys;
2917
+ edits = stack.edits;
2918
+ inArray = stack.inArray;
2919
+ stack = stack.prev;
2920
+ } else if (parent) {
2921
+ key = inArray ? index : keys[index];
2922
+ node = parent[key];
2923
+ if (node === null || node === void 0) {
2924
+ continue;
2925
+ }
2926
+ path.push(key);
2927
+ }
2928
+ let result;
2929
+ if (!Array.isArray(node)) {
2930
+ var _enterLeaveMap$get, _enterLeaveMap$get2;
2931
+ isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
2932
+ 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;
2933
+ result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors);
2934
+ if (result === BREAK) {
2935
+ break;
2936
+ }
2937
+ if (result === false) {
2938
+ if (!isLeaving) {
2939
+ path.pop();
2940
+ continue;
2941
+ }
2942
+ } else if (result !== void 0) {
2943
+ edits.push([key, result]);
2944
+ if (!isLeaving) {
2945
+ if (isNode(result)) {
2946
+ node = result;
2947
+ } else {
2948
+ path.pop();
2949
+ continue;
2950
+ }
2951
+ }
2952
+ }
2953
+ }
2954
+ if (result === void 0 && isEdited) {
2955
+ edits.push([key, node]);
2956
+ }
2957
+ if (isLeaving) {
2958
+ path.pop();
2959
+ } else {
2960
+ var _node$kind;
2961
+ stack = {
2962
+ inArray,
2963
+ index,
2964
+ keys,
2965
+ edits,
2966
+ prev: stack
2967
+ };
2968
+ inArray = Array.isArray(node);
2969
+ keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : [];
2970
+ index = -1;
2971
+ edits = [];
2972
+ if (parent) {
2973
+ ancestors.push(parent);
2974
+ }
2975
+ parent = node;
2976
+ }
2977
+ } while (stack !== void 0);
2978
+ if (edits.length !== 0) {
2979
+ return edits[edits.length - 1][1];
2980
+ }
2981
+ return root;
2982
+ }
2983
+ function getEnterLeaveForKind(visitor, kind) {
2984
+ const kindVisitor = visitor[kind];
2985
+ if (typeof kindVisitor === "object") {
2986
+ return kindVisitor;
2987
+ } else if (typeof kindVisitor === "function") {
2988
+ return {
2989
+ enter: kindVisitor,
2990
+ leave: void 0
2991
+ };
2992
+ }
2993
+ return {
2994
+ enter: visitor.enter,
2995
+ leave: visitor.leave
2996
+ };
2997
+ }
2998
+ function print(ast) {
2999
+ return visit(ast, printDocASTReducer);
3000
+ }
3001
+ const MAX_LINE_LENGTH = 80;
3002
+ const printDocASTReducer = {
3003
+ Name: {
3004
+ leave: (node) => node.value
3005
+ },
3006
+ Variable: {
3007
+ leave: (node) => "$" + node.name
3008
+ },
3009
+ // Document
3010
+ Document: {
3011
+ leave: (node) => join(node.definitions, "\n\n")
3012
+ },
3013
+ OperationDefinition: {
3014
+ leave(node) {
3015
+ const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")");
3016
+ const prefix = join(
3017
+ [
3018
+ node.operation,
3019
+ join([node.name, varDefs]),
3020
+ join(node.directives, " ")
3021
+ ],
3022
+ " "
3023
+ );
3024
+ return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
3025
+ }
3026
+ },
3027
+ VariableDefinition: {
3028
+ leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
3029
+ },
3030
+ SelectionSet: {
3031
+ leave: ({ selections }) => block(selections)
3032
+ },
3033
+ Field: {
3034
+ leave({ alias, name, arguments: args, directives, selectionSet }) {
3035
+ const prefix = wrap("", alias, ": ") + name;
3036
+ let argsLine = prefix + wrap("(", join(args, ", "), ")");
3037
+ if (argsLine.length > MAX_LINE_LENGTH) {
3038
+ argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)");
3039
+ }
3040
+ return join([argsLine, join(directives, " "), selectionSet], " ");
3041
+ }
3042
+ },
3043
+ Argument: {
3044
+ leave: ({ name, value }) => name + ": " + value
3045
+ },
3046
+ // Fragments
3047
+ FragmentSpread: {
3048
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
3049
+ },
3050
+ InlineFragment: {
3051
+ leave: ({ typeCondition, directives, selectionSet }) => join(
3052
+ [
3053
+ "...",
3054
+ wrap("on ", typeCondition),
3055
+ join(directives, " "),
3056
+ selectionSet
3057
+ ],
3058
+ " "
3059
+ )
3060
+ },
3061
+ FragmentDefinition: {
3062
+ leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
3063
+ // or removed in the future.
3064
+ `fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
3065
+ )
3066
+ },
3067
+ // Value
3068
+ IntValue: {
3069
+ leave: ({ value }) => value
3070
+ },
3071
+ FloatValue: {
3072
+ leave: ({ value }) => value
3073
+ },
3074
+ StringValue: {
3075
+ leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
3076
+ },
3077
+ BooleanValue: {
3078
+ leave: ({ value }) => value ? "true" : "false"
3079
+ },
3080
+ NullValue: {
3081
+ leave: () => "null"
3082
+ },
3083
+ EnumValue: {
3084
+ leave: ({ value }) => value
3085
+ },
3086
+ ListValue: {
3087
+ leave: ({ values }) => "[" + join(values, ", ") + "]"
3088
+ },
3089
+ ObjectValue: {
3090
+ leave: ({ fields }) => "{" + join(fields, ", ") + "}"
3091
+ },
3092
+ ObjectField: {
3093
+ leave: ({ name, value }) => name + ": " + value
3094
+ },
3095
+ // Directive
3096
+ Directive: {
3097
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
3098
+ },
3099
+ // Type
3100
+ NamedType: {
3101
+ leave: ({ name }) => name
3102
+ },
3103
+ ListType: {
3104
+ leave: ({ type }) => "[" + type + "]"
3105
+ },
3106
+ NonNullType: {
3107
+ leave: ({ type }) => type + "!"
3108
+ },
3109
+ // Type System Definitions
3110
+ SchemaDefinition: {
3111
+ leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ")
3112
+ },
3113
+ OperationTypeDefinition: {
3114
+ leave: ({ operation, type }) => operation + ": " + type
3115
+ },
3116
+ ScalarTypeDefinition: {
3117
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ")
3118
+ },
3119
+ ObjectTypeDefinition: {
3120
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
3121
+ [
3122
+ "type",
3123
+ name,
3124
+ wrap("implements ", join(interfaces, " & ")),
3125
+ join(directives, " "),
3126
+ block(fields)
3127
+ ],
3128
+ " "
3129
+ )
3130
+ },
3131
+ FieldDefinition: {
3132
+ 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, " "))
3133
+ },
3134
+ InputValueDefinition: {
3135
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join(
3136
+ [name + ": " + type, wrap("= ", defaultValue), join(directives, " ")],
3137
+ " "
3138
+ )
3139
+ },
3140
+ InterfaceTypeDefinition: {
3141
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
3142
+ [
3143
+ "interface",
3144
+ name,
3145
+ wrap("implements ", join(interfaces, " & ")),
3146
+ join(directives, " "),
3147
+ block(fields)
3148
+ ],
3149
+ " "
3150
+ )
3151
+ },
3152
+ UnionTypeDefinition: {
3153
+ leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join(
3154
+ ["union", name, join(directives, " "), wrap("= ", join(types, " | "))],
3155
+ " "
3156
+ )
3157
+ },
3158
+ EnumTypeDefinition: {
3159
+ leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ")
3160
+ },
3161
+ EnumValueDefinition: {
3162
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ")
3163
+ },
3164
+ InputObjectTypeDefinition: {
3165
+ leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
3166
+ },
3167
+ DirectiveDefinition: {
3168
+ 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, " | ")
3169
+ },
3170
+ SchemaExtension: {
3171
+ leave: ({ directives, operationTypes }) => join(
3172
+ ["extend schema", join(directives, " "), block(operationTypes)],
3173
+ " "
3174
+ )
3175
+ },
3176
+ ScalarTypeExtension: {
3177
+ leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
3178
+ },
3179
+ ObjectTypeExtension: {
3180
+ leave: ({ name, interfaces, directives, fields }) => join(
3181
+ [
3182
+ "extend type",
3183
+ name,
3184
+ wrap("implements ", join(interfaces, " & ")),
3185
+ join(directives, " "),
3186
+ block(fields)
3187
+ ],
3188
+ " "
3189
+ )
3190
+ },
3191
+ InterfaceTypeExtension: {
3192
+ leave: ({ name, interfaces, directives, fields }) => join(
3193
+ [
3194
+ "extend interface",
3195
+ name,
3196
+ wrap("implements ", join(interfaces, " & ")),
3197
+ join(directives, " "),
3198
+ block(fields)
3199
+ ],
3200
+ " "
3201
+ )
3202
+ },
3203
+ UnionTypeExtension: {
3204
+ leave: ({ name, directives, types }) => join(
3205
+ [
3206
+ "extend union",
3207
+ name,
3208
+ join(directives, " "),
3209
+ wrap("= ", join(types, " | "))
3210
+ ],
3211
+ " "
3212
+ )
3213
+ },
3214
+ EnumTypeExtension: {
3215
+ leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
3216
+ },
3217
+ InputObjectTypeExtension: {
3218
+ leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
3219
+ }
3220
+ };
3221
+ function join(maybeArray, separator = "") {
3222
+ var _maybeArray$filter$jo;
3223
+ 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 : "";
3224
+ }
3225
+ function block(array) {
3226
+ return wrap("{\n", indent(join(array, "\n")), "\n}");
3227
+ }
3228
+ function wrap(start, maybeString, end = "") {
3229
+ return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
3230
+ }
3231
+ function indent(str) {
3232
+ return wrap(" ", str.replace(/\n/g, "\n "));
3233
+ }
3234
+ function hasMultilineItems(maybeArray) {
3235
+ var _maybeArray$some;
3236
+ return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false;
3237
+ }
3238
+
3239
+ /*!
3240
+ * Copyright (c) 2022, Salesforce, Inc.,
3241
+ * All rights reserved.
3242
+ * For full license text, see the LICENSE.txt file
3243
+ */
3244
+ function findExecutableOperation(input) {
3245
+ const operations = input.query.definitions.filter(
3246
+ (def) => def.kind === Kind.OPERATION_DEFINITION
3247
+ );
3248
+ if (operations.length === 0) {
3249
+ return err$1(new Error("No operations found in query"));
3250
+ }
3251
+ if (operations.length === 1 && !input.operationName) {
3252
+ return ok$2(operations[0]);
3253
+ }
3254
+ if (input.operationName) {
3255
+ const specifiedOperation = operations.find((op) => {
3256
+ var _a;
3257
+ return ((_a = op.name) == null ? void 0 : _a.value) === input.operationName;
3258
+ });
3259
+ if (specifiedOperation) {
3260
+ return ok$2(specifiedOperation);
3261
+ }
3262
+ return err$1(new Error(`Operation "${input.operationName}" not found in query`));
3263
+ }
3264
+ return err$1(new Error("Multiple operations found in query, and no operation name provided"));
3265
+ }
3266
+ function buildGraphQLInputExtension(input) {
3267
+ const operationResult = findExecutableOperation(input);
3268
+ if (operationResult.isErr()) {
3269
+ return err$1(operationResult.error);
3270
+ }
3271
+ const operation = operationResult.value;
3272
+ const selections = operation.selectionSet.selections;
3273
+ const variableDefinitions = operation.variableDefinitions;
3274
+ const variables = (variableDefinitions == null ? void 0 : variableDefinitions.reduce((prev, def) => {
3275
+ var _a;
3276
+ prev[def.variable.name.value] = {
3277
+ definition: def,
3278
+ value: (_a = input.variables) == null ? void 0 : _a[def.variable.name.value]
3279
+ };
3280
+ return prev;
3281
+ }, {})) || {};
3282
+ const fragments = input.query.definitions.filter((def) => def.kind === "FragmentDefinition").reduce((prev, fragment) => {
3283
+ prev[fragment.name.value] = fragment;
3284
+ return prev;
3285
+ }, {});
3286
+ return ok$2({
3287
+ selections,
3288
+ request: { definitions: { variables, fragments } },
3289
+ parentFieldSelection: void 0
3290
+ });
3291
+ }
3292
+
3293
+ /*!
3294
+ * Copyright (c) 2022, Salesforce, Inc.,
3295
+ * All rights reserved.
3296
+ * For full license text, see the LICENSE.txt file
3297
+ */
3298
+ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
3299
+ constructor(config, documentRootType, services) {
3300
+ super(services);
3301
+ this.config = config;
3302
+ this.documentRootType = documentRootType;
3303
+ this.services = services;
3304
+ }
3305
+ buildResultType() {
3306
+ return this.documentRootType;
3307
+ }
3308
+ buildQuery() {
3309
+ const extensionResult = buildGraphQLInputExtension(this.config);
3310
+ if (extensionResult.isErr()) {
3311
+ throw extensionResult.error;
3312
+ }
3313
+ return {
3314
+ type: "keyParams",
3315
+ keyParams: null,
3316
+ ...extensionResult.value
3317
+ };
3318
+ }
3319
+ responseHasErrors(data) {
3320
+ return data.hasOwnProperty("errors") && data.errors && data.errors.length > 0;
3321
+ }
3322
+ processAuraReturnValue(auraReturnValue) {
3323
+ if (this.responseHasErrors(auraReturnValue)) {
3324
+ return err$1(new UserVisibleError(auraReturnValue));
3325
+ }
3326
+ return ok$2(auraReturnValue);
3327
+ }
3328
+ processFetchReturnValue(json) {
3329
+ if (this.responseHasErrors(json)) {
3330
+ return err$1(new UserVisibleError(json));
3331
+ }
3332
+ return ok$2(json);
3333
+ }
3334
+ /**
3335
+ * Optional body wrapper name for aura requests.
3336
+ * If defined, the aura params will be wrapped in an object with this property name.
3337
+ * Override this method in subclasses if a body wrapper is needed.
3338
+ */
3339
+ get auraBodyWrapperName() {
3340
+ return void 0;
3341
+ }
3342
+ get auraParams() {
3343
+ const params = { ...this.config, query: print(this.buildRequestQuery()) };
3344
+ if (this.auraBodyWrapperName) {
3345
+ return { [this.auraBodyWrapperName]: params };
3346
+ }
3347
+ return params;
3348
+ }
3349
+ get fetchParams() {
3350
+ const body = { ...this.config, query: print(this.buildRequestQuery()) };
3351
+ const headers = {
3352
+ "Content-Type": "application/json"
3353
+ };
3354
+ const params = {
3355
+ method: "POST",
3356
+ cache: "no-cache",
3357
+ headers,
3358
+ body: JSON.stringify(body)
3359
+ };
3360
+ return [this.url, params];
3361
+ }
3362
+ get originalAuraParams() {
3363
+ const params = { ...this.config, query: print(this.config.query) };
3364
+ if (this.auraBodyWrapperName) {
3365
+ return { [this.auraBodyWrapperName]: params };
3366
+ }
3367
+ return params;
3368
+ }
3369
+ get originalFetchParams() {
3370
+ const body = { ...this.config, query: print(this.config.query) };
3371
+ const headers = {
3372
+ "Content-Type": "application/json"
3373
+ };
3374
+ const params = {
3375
+ method: "POST",
3376
+ cache: "no-cache",
3377
+ headers,
3378
+ body: JSON.stringify(body)
3379
+ };
3380
+ return [this.url, params];
3381
+ }
3382
+ // TODO: We should respect the cache control strategy in this method. We don't support only-if-cached strategies at the moment, but if we did add support, we would technically violate that cache control strategy if the data wasn't in the cache here.
3383
+ runOriginalRequest() {
3384
+ if (this.shouldUseAuraNetwork()) {
3385
+ return this.convertAuraResponseToData(
3386
+ this.services.auraNetwork(
3387
+ this.endpoint,
3388
+ this.originalAuraParams,
3389
+ this.actionConfig
3390
+ ),
3391
+ (errs) => this.coerceError(errs)
3392
+ ).then((result) => {
3393
+ if (result.isOk()) {
3394
+ return this.constructSubscribableResult(result.value);
3395
+ }
3396
+ return result;
3397
+ });
3398
+ } else if (this.shouldUseFetch()) {
3399
+ return this.convertFetchResponseToData(
3400
+ this.services.fetch(...this.originalFetchParams)
3401
+ ).then((result) => {
3402
+ if (result.isOk()) {
3403
+ return this.constructSubscribableResult(result.value);
3404
+ }
3405
+ return result;
3406
+ });
3407
+ }
3408
+ return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
3409
+ }
3410
+ buildRequestQuery() {
3411
+ const augmentedQueryResult = this.documentRootType.buildAugmentedQuery(this.config);
3412
+ if (augmentedQueryResult.isErr()) {
3413
+ throw augmentedQueryResult.error;
3414
+ }
3415
+ return augmentedQueryResult.value;
3416
+ }
3417
+ buildWriteInput(data) {
3418
+ const extensionResult = buildGraphQLInputExtension({
3419
+ ...this.config,
3420
+ query: this.buildRequestQuery()
3421
+ });
3422
+ if (extensionResult.isErr()) {
3423
+ throw new InternalError(extensionResult.error);
3424
+ }
3425
+ return { data: data.data, ...extensionResult.value };
3426
+ }
3427
+ // Any changes to this method should most likely be duplicated in the https command as well
3428
+ handleCacheControllerResult(result, requestRunner) {
3429
+ const { networkError, returnData } = requestRunner;
3430
+ return this.publishUpdatedKeys().then(() => {
3431
+ if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
3432
+ return this.runOriginalRequest();
3433
+ }
3434
+ if (this.subscriptions.length > 0) {
3435
+ this.subscribeToKeysUsed();
3436
+ }
3437
+ if (this.lastEmittedData === void 0) {
3438
+ this.lastEmittedData = returnData.value.data;
3439
+ }
3440
+ return returnData;
3441
+ });
3442
+ }
3443
+ }
3444
+ function buildServiceDescriptor$4() {
3445
+ return {
3446
+ type: "auraGraphQLNormalizedCacheControlCommand",
3447
+ version: "1.0",
3448
+ service: AuraGraphQLNormalizedCacheControlCommand
3449
+ };
3450
+ }
3451
+
3452
+ /*!
3453
+ * Copyright (c) 2022, Salesforce, Inc.,
3454
+ * All rights reserved.
3455
+ * For full license text, see the LICENSE.txt file
3456
+ */
3457
+ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheControlCommand {
3458
+ constructor(config, documentRootType, services) {
3459
+ super(services);
3460
+ this.config = config;
3461
+ this.documentRootType = documentRootType;
3462
+ this.services = services;
3463
+ }
3464
+ buildResultType() {
3465
+ return this.documentRootType;
3466
+ }
3467
+ buildQuery() {
3468
+ const extensionResult = buildGraphQLInputExtension(this.config);
3469
+ if (extensionResult.isErr()) {
3470
+ throw extensionResult.error;
3471
+ }
3472
+ return {
3473
+ type: "keyParams",
3474
+ keyParams: null,
3475
+ ...extensionResult.value
3476
+ };
3477
+ }
3478
+ get fetchParams() {
3479
+ const body = { ...this.config, query: print(this.buildRequestQuery()) };
3480
+ const headers = {
3481
+ "Content-Type": "application/json"
3482
+ };
3483
+ const params = {
3484
+ method: "POST",
3485
+ cache: "no-cache",
3486
+ headers,
3487
+ body: JSON.stringify(body)
3488
+ };
3489
+ return [this.url, params];
3490
+ }
3491
+ get originalFetchParams() {
3492
+ const body = { ...this.config, query: print(this.config.query) };
3493
+ const headers = {
3494
+ "Content-Type": "application/json"
3495
+ };
3496
+ const params = {
3497
+ method: "POST",
3498
+ cache: "no-cache",
3499
+ headers,
3500
+ body: JSON.stringify(body)
3501
+ };
3502
+ return [this.url, params];
3503
+ }
3504
+ buildRequestQuery() {
3505
+ const augmentedQueryResult = this.documentRootType.buildAugmentedQuery(this.config);
3506
+ if (augmentedQueryResult.isErr()) {
3507
+ throw augmentedQueryResult.error;
3508
+ }
3509
+ return augmentedQueryResult.value;
3510
+ }
3511
+ buildWriteInput(data) {
3512
+ const extensionResult = buildGraphQLInputExtension({
3513
+ ...this.config,
3514
+ query: this.buildRequestQuery()
3515
+ });
3516
+ if (extensionResult.isErr()) {
3517
+ throw new InternalError(extensionResult.error);
3518
+ }
3519
+ return { data: data.data, ...extensionResult.value };
3520
+ }
3521
+ processFetchReturnValue(json) {
3522
+ if (json.hasOwnProperty("errors") && json.errors && json.errors.length > 0) {
3523
+ return err$1(new UserVisibleError(json));
3524
+ }
3525
+ return ok$2(json);
3526
+ }
3527
+ runOriginalRequest() {
3528
+ return this.convertFetchResponseToData(
3529
+ this.services.fetch(...this.originalFetchParams)
3530
+ ).then((result) => {
3531
+ if (result.isOk()) {
3532
+ return this.constructSubscribableResult(result.value);
3533
+ }
3534
+ return result;
3535
+ });
3536
+ }
3537
+ // Any changes to this method should most likely be duplicated in the aura command as well
3538
+ handleCacheControllerResult(result, requestRunner) {
3539
+ const { networkError, returnData } = requestRunner;
3540
+ return this.publishUpdatedKeys().then(() => {
3541
+ if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
3542
+ return this.runOriginalRequest();
3543
+ }
3544
+ if (this.subscriptions.length > 0) {
3545
+ this.subscribeToKeysUsed();
3546
+ }
3547
+ if (this.lastEmittedData === void 0) {
3548
+ this.lastEmittedData = returnData.value.data;
3549
+ }
3550
+ return returnData;
3551
+ });
3552
+ }
3553
+ }
3554
+ function buildServiceDescriptor$3() {
3555
+ return {
3556
+ type: "httpGraphQLNormalizedCacheControlCommand",
3557
+ version: "1.0",
3558
+ service: HttpGraphQLNormalizedCacheControlCommand
3559
+ };
3560
+ }
3561
+
2360
3562
  /*!
2361
3563
  * Copyright (c) 2022, Salesforce, Inc.,
2362
3564
  * All rights reserved.
@@ -2412,7 +3614,7 @@ class NDJSONParsingStream extends TransformStream {
2412
3614
  });
2413
3615
  }
2414
3616
  }
2415
- function buildServiceDescriptor$1() {
3617
+ function buildServiceDescriptor$2() {
2416
3618
  return {
2417
3619
  type: "NDJSONCommandBaseClass",
2418
3620
  version: "1.0",
@@ -2420,6 +3622,50 @@ function buildServiceDescriptor$1() {
2420
3622
  };
2421
3623
  }
2422
3624
 
3625
+ /**
3626
+ * Copyright (c) 2022, Salesforce, Inc.,
3627
+ * All rights reserved.
3628
+ * For full license text, see the LICENSE.txt file
3629
+ */
3630
+
3631
+ /*
3632
+ * ATTENTION!
3633
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
3634
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
3635
+ * Any changes made to this file in p4 will be automatically overwritten.
3636
+ * *******************************************************************************************
3637
+ */
3638
+ /* proxy-compat-disable */
3639
+ /**
3640
+ * Creates a LuvioService descriptor with the provided Luvio instance.
3641
+ * This function follows the standard service builder pattern used
3642
+ * throughout the Luvio service ecosystem.
3643
+ *
3644
+ * @param luvio The Luvio engine instance to wrap in the service
3645
+ * @returns A service descriptor that can be used in dependency injection
3646
+ *
3647
+ * @example
3648
+ * ```typescript
3649
+ * const luvioService = buildLuvioService(myLuvioInstance);
3650
+ *
3651
+ * // Use in a services object
3652
+ * const services = {
3653
+ * ...otherServices,
3654
+ * luvio: luvioService.service,
3655
+ * };
3656
+ * ```
3657
+ */
3658
+ function buildServiceDescriptor$1(luvio) {
3659
+ return {
3660
+ type: 'luvio',
3661
+ version: '1.0',
3662
+ service: {
3663
+ luvio,
3664
+ },
3665
+ };
3666
+ }
3667
+ // version: 1.377.0-b0d5c49e07
3668
+
2423
3669
  /*!
2424
3670
  * Copyright (c) 2022, Salesforce, Inc.,
2425
3671
  * All rights reserved.
@@ -3001,26 +4247,36 @@ function buildJwtRequestInterceptor(logger) {
3001
4247
  }
3002
4248
 
3003
4249
  const loggerService = new ConsoleLogger$1('ERROR');
3004
- const cacheServiceDescriptor = buildServiceDescriptor$4();
3005
- const instrumentationServiceDescriptor = buildServiceDescriptor$5(loggerService);
4250
+ const cacheServiceDescriptor = buildServiceDescriptor$8();
4251
+ const instrumentationServiceDescriptor = buildServiceDescriptor$9(loggerService);
3006
4252
  const inMemoryCacheInclusionPolicyServiceDescriptor = buildInMemoryCacheInclusionPolicyService(cacheServiceDescriptor.service);
4253
+ const featureFlagsServiceDescriptor = buildServiceDescriptor$5();
4254
+ const featureFlagsService = featureFlagsServiceDescriptor.service;
4255
+ // This disables the OneStore GraphQL in this runtime,
4256
+ // we will enable this in the future, but while we do rollout, we disable it here
4257
+ featureFlagsService.set('useOneStoreGraphQL', false);
3007
4258
  const services = [
3008
4259
  instrumentationServiceDescriptor,
3009
4260
  buildDefaultFetchServiceDescriptor(),
3010
4261
  buildJwtAuthorizedSfapFetchServiceDescriptor(loggerService),
3011
4262
  buildCopilotFetchServiceDescriptor(loggerService),
3012
- buildServiceDescriptor$6(instrumentationServiceDescriptor.service),
3013
- buildServiceDescriptor$3(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service),
4263
+ buildServiceDescriptor$a(instrumentationServiceDescriptor.service),
4264
+ buildServiceDescriptor$7(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service),
4265
+ buildServiceDescriptor$h(),
4266
+ buildServiceDescriptor$2(),
3014
4267
  buildServiceDescriptor$d(),
3015
- buildServiceDescriptor$1(),
3016
- buildServiceDescriptor$9(),
3017
- buildServiceDescriptor$e(),
3018
- buildServiceDescriptor$8(),
3019
- buildServiceDescriptor$7(),
4268
+ buildServiceDescriptor$i(),
3020
4269
  buildServiceDescriptor$c(),
3021
4270
  buildServiceDescriptor$b(),
3022
- buildServiceDescriptor$a(),
3023
- buildServiceDescriptor$2(),
4271
+ buildServiceDescriptor$g(),
4272
+ buildServiceDescriptor$f(),
4273
+ buildServiceDescriptor$e(),
4274
+ buildServiceDescriptor$6(),
4275
+ buildServiceDescriptor$4(),
4276
+ buildServiceDescriptor$3(),
4277
+ featureFlagsServiceDescriptor,
4278
+ // Luvio service won't be used since we set the useOneStoreGraphQL flag to false
4279
+ buildServiceDescriptor$1({}),
3024
4280
  ];
3025
4281
  setServices(services);
3026
- // version: 1.376.0-cb776a38bb
4282
+ // version: 1.377.0-3c95caf11c