@salesforce/lds-runtime-aura 1.370.0 → 1.372.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.
@@ -25,8 +25,8 @@ import useOneStoreGraphql from '@salesforce/gate/lds.oneStoreGraphqlEnabled';
25
25
  import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
26
26
  import { getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, getRelatedListActionsAdapterFactory, getRecordId18Array, instrument, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher } from 'force/ldsAdaptersUiapi';
27
27
  import { getInstrumentation } from 'o11y/client';
28
+ import { buildGraphQLInputExtension } from 'force/luvioGraphqlNormalization';
28
29
  import { setServices } from 'force/luvioServiceProvisioner1';
29
- import oneStoreEnabled from '@salesforce/gate/lds.oneStoreEnabled.ltng';
30
30
  import oneStoreUiapiEnabled from '@salesforce/gate/lds.oneStoreUiapiEnabled.ltng';
31
31
  import { unstable_loadComponentDefs, executeGlobalControllerRawResponse } from 'aura';
32
32
  import auraNetworkAdapter, { dispatchAuraAction, defaultActionConfig, instrument as instrument$1, forceRecordTransactionsDisabled as forceRecordTransactionsDisabled$1, ldsNetworkAdapterInstrument, CrudEventState, CrudEventType, UIAPI_RECORDS_PATH, UIAPI_RELATED_LIST_RECORDS_BATCH_PATH, UIAPI_RELATED_LIST_RECORDS_PATH } from 'force/ldsNetwork';
@@ -40,6 +40,7 @@ import useHotspotLimit from '@salesforce/gate/lds.pdl.useHotspotLimit';
40
40
  import { createStorage, clearStorages } from 'force/ldsStorage';
41
41
  import useHttpInsteadAuraTransport from '@salesforce/gate/lds.useHttpInsteadAuraTransport';
42
42
  import { ThirdPartyTracker } from 'instrumentation:beaconLib';
43
+ import { graphql, graphql_imperative } from 'force/ldsAdaptersOnestoreGraphql';
43
44
 
44
45
  /*!
45
46
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -208,6 +209,20 @@ function toError(x) {
208
209
  }
209
210
  return new Error(typeof x === "string" ? x : JSON.stringify(x));
210
211
  }
212
+ class InternalError extends Error {
213
+ constructor(data) {
214
+ super();
215
+ this.data = data;
216
+ this.type = "internal";
217
+ }
218
+ }
219
+ class UserVisibleError extends Error {
220
+ constructor(data) {
221
+ super();
222
+ this.data = data;
223
+ this.type = "user-visible";
224
+ }
225
+ }
211
226
 
212
227
  /*!
213
228
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -272,7 +287,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
272
287
  async afterRequestHooks(_options) {
273
288
  }
274
289
  };
275
- function buildServiceDescriptor$e() {
290
+ function buildServiceDescriptor$h() {
276
291
  return {
277
292
  type: "networkCommandBaseClass",
278
293
  version: "1.0",
@@ -374,7 +389,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
374
389
  return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
375
390
  }
376
391
  }
377
- function buildServiceDescriptor$d() {
392
+ function buildServiceDescriptor$g() {
378
393
  return {
379
394
  type: "auraNetworkCommandBaseClass",
380
395
  version: "1.0",
@@ -793,14 +808,20 @@ let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheContr
793
808
  async coerceFetchError(errorResponse) {
794
809
  return toError(errorResponse.statusText);
795
810
  }
811
+ processAuraReturnValue(auraReturnValue) {
812
+ return ok$2(auraReturnValue);
813
+ }
814
+ processFetchReturnValue(json) {
815
+ return ok$2(json);
816
+ }
796
817
  convertAuraResponseToData(responsePromise, coerceError) {
797
818
  return responsePromise.then((response) => {
798
- const auraReturnValue = response.getReturnValue();
819
+ return this.processAuraReturnValue(response.getReturnValue());
820
+ }).finally(() => {
799
821
  try {
800
822
  this.afterRequestHooks({ statusCode: 200 });
801
823
  } catch (e) {
802
824
  }
803
- return ok$2(auraReturnValue);
804
825
  }).catch((error) => {
805
826
  if (!error || !error.getError) {
806
827
  return err$1(toError("Failed to get error from response"));
@@ -819,7 +840,9 @@ let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheContr
819
840
  (response2) => {
820
841
  if (response2.ok) {
821
842
  return response2.json().then(
822
- (json) => ok$2(json),
843
+ (json) => {
844
+ return this.processFetchReturnValue(json);
845
+ },
823
846
  (reason) => err$1(toError(reason))
824
847
  ).finally(() => {
825
848
  try {
@@ -873,7 +896,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
873
896
  return `{"endpoint":${this.endpoint},"params":${stableJSONStringify$2(this.auraParams)}}`;
874
897
  }
875
898
  }
876
- function buildServiceDescriptor$c() {
899
+ function buildServiceDescriptor$f() {
877
900
  return {
878
901
  type: "auraResourceCacheControlCommand",
879
902
  version: "1.0",
@@ -931,14 +954,20 @@ class AuraCacheControlCommand extends CacheControlCommand {
931
954
  async coerceFetchError(errorResponse) {
932
955
  return toError(errorResponse.statusText);
933
956
  }
957
+ processAuraReturnValue(auraReturnValue) {
958
+ return ok$2(auraReturnValue);
959
+ }
960
+ processFetchReturnValue(json) {
961
+ return ok$2(json);
962
+ }
934
963
  convertAuraResponseToData(responsePromise, coerceError) {
935
964
  return responsePromise.then((response) => {
936
- const auraReturnValue = response.getReturnValue();
965
+ return this.processAuraReturnValue(response.getReturnValue());
966
+ }).finally(() => {
937
967
  try {
938
968
  this.afterRequestHooks({ statusCode: 200 });
939
969
  } catch (e) {
940
970
  }
941
- return ok$2(auraReturnValue);
942
971
  }).catch((error) => {
943
972
  if (!error || !error.getError) {
944
973
  return err$1(toError("Failed to get error from response"));
@@ -957,7 +986,9 @@ class AuraCacheControlCommand extends CacheControlCommand {
957
986
  (response2) => {
958
987
  if (response2.ok) {
959
988
  return response2.json().then(
960
- (json) => ok$2(json),
989
+ (json) => {
990
+ return this.processFetchReturnValue(json);
991
+ },
961
992
  (reason) => err$1(toError(reason))
962
993
  ).finally(() => {
963
994
  try {
@@ -1004,7 +1035,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
1004
1035
  return resolvedPromiseLike$3(void 0);
1005
1036
  }
1006
1037
  }
1007
- function buildServiceDescriptor$b() {
1038
+ function buildServiceDescriptor$e() {
1008
1039
  return {
1009
1040
  type: "auraNormalizedCacheControlCommand",
1010
1041
  version: "1.0",
@@ -1036,12 +1067,17 @@ class HttpCacheControlCommand extends CacheControlCommand {
1036
1067
  async coerceError(errorResponse) {
1037
1068
  return toError(errorResponse.statusText);
1038
1069
  }
1070
+ processFetchReturnValue(json) {
1071
+ return ok$2(json);
1072
+ }
1039
1073
  convertFetchResponseToData(response) {
1040
1074
  return response.then(
1041
1075
  (response2) => {
1042
1076
  if (response2.ok) {
1043
1077
  return response2.json().then(
1044
- (json) => ok$2(json),
1078
+ (json) => {
1079
+ return this.processFetchReturnValue(json);
1080
+ },
1045
1081
  (reason) => err$1(toError(reason))
1046
1082
  ).finally(() => {
1047
1083
  try {
@@ -1088,7 +1124,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
1088
1124
  return resolvedPromiseLike$3(void 0);
1089
1125
  }
1090
1126
  }
1091
- function buildServiceDescriptor$a() {
1127
+ function buildServiceDescriptor$d() {
1092
1128
  return {
1093
1129
  type: "httpNormalizedCacheControlCommand",
1094
1130
  version: "1.0",
@@ -1195,7 +1231,7 @@ class FetchNetworkCommand extends NetworkCommand {
1195
1231
  );
1196
1232
  }
1197
1233
  }
1198
- function buildServiceDescriptor$9() {
1234
+ function buildServiceDescriptor$c() {
1199
1235
  return {
1200
1236
  type: "fetchNetworkCommandBaseClass",
1201
1237
  version: "1.0",
@@ -1231,7 +1267,7 @@ class StreamingCommand extends BaseCommand {
1231
1267
  );
1232
1268
  }
1233
1269
  }
1234
- function buildServiceDescriptor$8() {
1270
+ function buildServiceDescriptor$b() {
1235
1271
  return {
1236
1272
  type: "streamingCommandBaseClass",
1237
1273
  version: "1.0",
@@ -1314,7 +1350,7 @@ class SSEParsingStream extends TransformStream {
1314
1350
  });
1315
1351
  }
1316
1352
  }
1317
- function buildServiceDescriptor$7() {
1353
+ function buildServiceDescriptor$a() {
1318
1354
  return {
1319
1355
  type: "SSECommandBaseClass",
1320
1356
  version: "1.0",
@@ -1360,7 +1396,7 @@ function buildInstrumentCommand(services) {
1360
1396
  };
1361
1397
  };
1362
1398
  }
1363
- function buildServiceDescriptor$6(instrumentation) {
1399
+ function buildServiceDescriptor$9(instrumentation) {
1364
1400
  return {
1365
1401
  type: "instrumentCommand",
1366
1402
  version: "1.0",
@@ -1630,7 +1666,7 @@ class O11yInstrumentation {
1630
1666
  this.metrics = new O11yOTelMetricsAPI(this.services);
1631
1667
  }
1632
1668
  }
1633
- function buildServiceDescriptor$5(logger) {
1669
+ function buildServiceDescriptor$8(logger) {
1634
1670
  return {
1635
1671
  type: "instrumentation",
1636
1672
  version: "1.0",
@@ -1883,7 +1919,7 @@ class DefaultCache {
1883
1919
  return new FixedTimeWritableCache(this, generatedTime);
1884
1920
  }
1885
1921
  }
1886
- function buildServiceDescriptor$4() {
1922
+ function buildServiceDescriptor$7() {
1887
1923
  return {
1888
1924
  type: "cache",
1889
1925
  version: "1.0",
@@ -2051,7 +2087,7 @@ class CacheController {
2051
2087
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
2052
2088
  }
2053
2089
  }
2054
- function buildServiceDescriptor$3(cache, cacheInclusionPolicy) {
2090
+ function buildServiceDescriptor$6(cache, cacheInclusionPolicy) {
2055
2091
  return {
2056
2092
  type: "cacheController",
2057
2093
  version: "1.0",
@@ -2161,7 +2197,7 @@ class DefaultPubSubService {
2161
2197
  return matchingSubscriptions;
2162
2198
  }
2163
2199
  }
2164
- function buildServiceDescriptor$2() {
2200
+ function buildServiceDescriptor$5() {
2165
2201
  return {
2166
2202
  type: "pubSub",
2167
2203
  version: "1.0",
@@ -2224,7 +2260,7 @@ class NDJSONParsingStream extends TransformStream {
2224
2260
  });
2225
2261
  }
2226
2262
  }
2227
- function buildServiceDescriptor$1() {
2263
+ function buildServiceDescriptor$4() {
2228
2264
  return {
2229
2265
  type: "NDJSONCommandBaseClass",
2230
2266
  version: "1.0",
@@ -2232,6 +2268,1159 @@ function buildServiceDescriptor$1() {
2232
2268
  };
2233
2269
  }
2234
2270
 
2271
+ /**
2272
+ * Copyright (c) 2022, Salesforce, Inc.,
2273
+ * All rights reserved.
2274
+ * For full license text, see the LICENSE.txt file
2275
+ */
2276
+
2277
+ /*
2278
+ * ATTENTION!
2279
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
2280
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
2281
+ * Any changes made to this file in p4 will be automatically overwritten.
2282
+ * *******************************************************************************************
2283
+ */
2284
+ /* proxy-compat-disable */
2285
+ /**
2286
+ * Creates a LuvioService descriptor with the provided Luvio instance.
2287
+ * This function follows the standard service builder pattern used
2288
+ * throughout the Luvio service ecosystem.
2289
+ *
2290
+ * @param luvio The Luvio engine instance to wrap in the service
2291
+ * @returns A service descriptor that can be used in dependency injection
2292
+ *
2293
+ * @example
2294
+ * ```typescript
2295
+ * const luvioService = buildLuvioService(myLuvioInstance);
2296
+ *
2297
+ * // Use in a services object
2298
+ * const services = {
2299
+ * ...otherServices,
2300
+ * luvio: luvioService.service,
2301
+ * };
2302
+ * ```
2303
+ */
2304
+ function buildServiceDescriptor$3(luvio) {
2305
+ return {
2306
+ type: 'luvio',
2307
+ version: '1.0',
2308
+ service: {
2309
+ luvio,
2310
+ },
2311
+ };
2312
+ }
2313
+ // version: 1.372.0-59e8aa192f
2314
+
2315
+ /*!
2316
+ * Copyright (c) 2022, Salesforce, Inc.,
2317
+ * All rights reserved.
2318
+ * For full license text, see the LICENSE.txt file
2319
+ */
2320
+ function devAssert(condition, message) {
2321
+ const booleanCondition = Boolean(condition);
2322
+ if (!booleanCondition) {
2323
+ throw new Error(message);
2324
+ }
2325
+ }
2326
+ const MAX_ARRAY_LENGTH = 10;
2327
+ const MAX_RECURSIVE_DEPTH = 2;
2328
+ function inspect(value) {
2329
+ return formatValue(value, []);
2330
+ }
2331
+ function formatValue(value, seenValues) {
2332
+ switch (typeof value) {
2333
+ case "string":
2334
+ return JSON.stringify(value);
2335
+ case "function":
2336
+ return value.name ? `[function ${value.name}]` : "[function]";
2337
+ case "object":
2338
+ return formatObjectValue(value, seenValues);
2339
+ default:
2340
+ return String(value);
2341
+ }
2342
+ }
2343
+ function formatObjectValue(value, previouslySeenValues) {
2344
+ if (value === null) {
2345
+ return "null";
2346
+ }
2347
+ if (previouslySeenValues.includes(value)) {
2348
+ return "[Circular]";
2349
+ }
2350
+ const seenValues = [...previouslySeenValues, value];
2351
+ if (isJSONable(value)) {
2352
+ const jsonValue = value.toJSON();
2353
+ if (jsonValue !== value) {
2354
+ return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
2355
+ }
2356
+ } else if (Array.isArray(value)) {
2357
+ return formatArray(value, seenValues);
2358
+ }
2359
+ return formatObject(value, seenValues);
2360
+ }
2361
+ function isJSONable(value) {
2362
+ return typeof value.toJSON === "function";
2363
+ }
2364
+ function formatObject(object, seenValues) {
2365
+ const entries = Object.entries(object);
2366
+ if (entries.length === 0) {
2367
+ return "{}";
2368
+ }
2369
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
2370
+ return "[" + getObjectTag(object) + "]";
2371
+ }
2372
+ const properties = entries.map(
2373
+ ([key, value]) => key + ": " + formatValue(value, seenValues)
2374
+ );
2375
+ return "{ " + properties.join(", ") + " }";
2376
+ }
2377
+ function formatArray(array, seenValues) {
2378
+ if (array.length === 0) {
2379
+ return "[]";
2380
+ }
2381
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
2382
+ return "[Array]";
2383
+ }
2384
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
2385
+ const remaining = array.length - len;
2386
+ const items = [];
2387
+ for (let i = 0; i < len; ++i) {
2388
+ items.push(formatValue(array[i], seenValues));
2389
+ }
2390
+ if (remaining === 1) {
2391
+ items.push("... 1 more item");
2392
+ } else if (remaining > 1) {
2393
+ items.push(`... ${remaining} more items`);
2394
+ }
2395
+ return "[" + items.join(", ") + "]";
2396
+ }
2397
+ function getObjectTag(object) {
2398
+ const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
2399
+ if (tag === "Object" && typeof object.constructor === "function") {
2400
+ const name = object.constructor.name;
2401
+ if (typeof name === "string" && name !== "") {
2402
+ return name;
2403
+ }
2404
+ }
2405
+ return tag;
2406
+ }
2407
+ globalThis.process && // eslint-disable-next-line no-undef
2408
+ process.env.NODE_ENV === "production";
2409
+ var Kind;
2410
+ (function(Kind2) {
2411
+ Kind2["NAME"] = "Name";
2412
+ Kind2["DOCUMENT"] = "Document";
2413
+ Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
2414
+ Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
2415
+ Kind2["SELECTION_SET"] = "SelectionSet";
2416
+ Kind2["FIELD"] = "Field";
2417
+ Kind2["ARGUMENT"] = "Argument";
2418
+ Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
2419
+ Kind2["INLINE_FRAGMENT"] = "InlineFragment";
2420
+ Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
2421
+ Kind2["VARIABLE"] = "Variable";
2422
+ Kind2["INT"] = "IntValue";
2423
+ Kind2["FLOAT"] = "FloatValue";
2424
+ Kind2["STRING"] = "StringValue";
2425
+ Kind2["BOOLEAN"] = "BooleanValue";
2426
+ Kind2["NULL"] = "NullValue";
2427
+ Kind2["ENUM"] = "EnumValue";
2428
+ Kind2["LIST"] = "ListValue";
2429
+ Kind2["OBJECT"] = "ObjectValue";
2430
+ Kind2["OBJECT_FIELD"] = "ObjectField";
2431
+ Kind2["DIRECTIVE"] = "Directive";
2432
+ Kind2["NAMED_TYPE"] = "NamedType";
2433
+ Kind2["LIST_TYPE"] = "ListType";
2434
+ Kind2["NON_NULL_TYPE"] = "NonNullType";
2435
+ Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
2436
+ Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
2437
+ Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
2438
+ Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
2439
+ Kind2["FIELD_DEFINITION"] = "FieldDefinition";
2440
+ Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
2441
+ Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
2442
+ Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
2443
+ Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
2444
+ Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
2445
+ Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
2446
+ Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
2447
+ Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
2448
+ Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
2449
+ Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
2450
+ Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
2451
+ Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
2452
+ Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
2453
+ Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
2454
+ })(Kind || (Kind = {}));
2455
+ var TokenKind;
2456
+ (function(TokenKind2) {
2457
+ TokenKind2["SOF"] = "<SOF>";
2458
+ TokenKind2["EOF"] = "<EOF>";
2459
+ TokenKind2["BANG"] = "!";
2460
+ TokenKind2["DOLLAR"] = "$";
2461
+ TokenKind2["AMP"] = "&";
2462
+ TokenKind2["PAREN_L"] = "(";
2463
+ TokenKind2["PAREN_R"] = ")";
2464
+ TokenKind2["SPREAD"] = "...";
2465
+ TokenKind2["COLON"] = ":";
2466
+ TokenKind2["EQUALS"] = "=";
2467
+ TokenKind2["AT"] = "@";
2468
+ TokenKind2["BRACKET_L"] = "[";
2469
+ TokenKind2["BRACKET_R"] = "]";
2470
+ TokenKind2["BRACE_L"] = "{";
2471
+ TokenKind2["PIPE"] = "|";
2472
+ TokenKind2["BRACE_R"] = "}";
2473
+ TokenKind2["NAME"] = "Name";
2474
+ TokenKind2["INT"] = "Int";
2475
+ TokenKind2["FLOAT"] = "Float";
2476
+ TokenKind2["STRING"] = "String";
2477
+ TokenKind2["BLOCK_STRING"] = "BlockString";
2478
+ TokenKind2["COMMENT"] = "Comment";
2479
+ })(TokenKind || (TokenKind = {}));
2480
+ const QueryDocumentKeys = {
2481
+ Name: [],
2482
+ Document: ["definitions"],
2483
+ OperationDefinition: [
2484
+ "name",
2485
+ "variableDefinitions",
2486
+ "directives",
2487
+ "selectionSet"
2488
+ ],
2489
+ VariableDefinition: ["variable", "type", "defaultValue", "directives"],
2490
+ Variable: ["name"],
2491
+ SelectionSet: ["selections"],
2492
+ Field: ["alias", "name", "arguments", "directives", "selectionSet"],
2493
+ Argument: ["name", "value"],
2494
+ FragmentSpread: ["name", "directives"],
2495
+ InlineFragment: ["typeCondition", "directives", "selectionSet"],
2496
+ FragmentDefinition: [
2497
+ "name",
2498
+ // Note: fragment variable definitions are deprecated and will removed in v17.0.0
2499
+ "variableDefinitions",
2500
+ "typeCondition",
2501
+ "directives",
2502
+ "selectionSet"
2503
+ ],
2504
+ IntValue: [],
2505
+ FloatValue: [],
2506
+ StringValue: [],
2507
+ BooleanValue: [],
2508
+ NullValue: [],
2509
+ EnumValue: [],
2510
+ ListValue: ["values"],
2511
+ ObjectValue: ["fields"],
2512
+ ObjectField: ["name", "value"],
2513
+ Directive: ["name", "arguments"],
2514
+ NamedType: ["name"],
2515
+ ListType: ["type"],
2516
+ NonNullType: ["type"],
2517
+ SchemaDefinition: ["description", "directives", "operationTypes"],
2518
+ OperationTypeDefinition: ["type"],
2519
+ ScalarTypeDefinition: ["description", "name", "directives"],
2520
+ ObjectTypeDefinition: [
2521
+ "description",
2522
+ "name",
2523
+ "interfaces",
2524
+ "directives",
2525
+ "fields"
2526
+ ],
2527
+ FieldDefinition: ["description", "name", "arguments", "type", "directives"],
2528
+ InputValueDefinition: [
2529
+ "description",
2530
+ "name",
2531
+ "type",
2532
+ "defaultValue",
2533
+ "directives"
2534
+ ],
2535
+ InterfaceTypeDefinition: [
2536
+ "description",
2537
+ "name",
2538
+ "interfaces",
2539
+ "directives",
2540
+ "fields"
2541
+ ],
2542
+ UnionTypeDefinition: ["description", "name", "directives", "types"],
2543
+ EnumTypeDefinition: ["description", "name", "directives", "values"],
2544
+ EnumValueDefinition: ["description", "name", "directives"],
2545
+ InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
2546
+ DirectiveDefinition: ["description", "name", "arguments", "locations"],
2547
+ SchemaExtension: ["directives", "operationTypes"],
2548
+ ScalarTypeExtension: ["name", "directives"],
2549
+ ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
2550
+ InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
2551
+ UnionTypeExtension: ["name", "directives", "types"],
2552
+ EnumTypeExtension: ["name", "directives", "values"],
2553
+ InputObjectTypeExtension: ["name", "directives", "fields"]
2554
+ };
2555
+ const kindValues = new Set(Object.keys(QueryDocumentKeys));
2556
+ function isNode(maybeNode) {
2557
+ const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
2558
+ return typeof maybeKind === "string" && kindValues.has(maybeKind);
2559
+ }
2560
+ var OperationTypeNode;
2561
+ (function(OperationTypeNode2) {
2562
+ OperationTypeNode2["QUERY"] = "query";
2563
+ OperationTypeNode2["MUTATION"] = "mutation";
2564
+ OperationTypeNode2["SUBSCRIPTION"] = "subscription";
2565
+ })(OperationTypeNode || (OperationTypeNode = {}));
2566
+ function isWhiteSpace(code) {
2567
+ return code === 9 || code === 32;
2568
+ }
2569
+ function printBlockString(value, options) {
2570
+ const escapedValue = value.replace(/"""/g, '\\"""');
2571
+ const lines = escapedValue.split(/\r\n|[\n\r]/g);
2572
+ const isSingleLine = lines.length === 1;
2573
+ const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
2574
+ const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
2575
+ const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
2576
+ const hasTrailingSlash = value.endsWith("\\");
2577
+ const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
2578
+ const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability
2579
+ (!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
2580
+ let result = "";
2581
+ const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
2582
+ if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
2583
+ result += "\n";
2584
+ }
2585
+ result += escapedValue;
2586
+ if (printAsMultipleLines || forceTrailingNewline) {
2587
+ result += "\n";
2588
+ }
2589
+ return '"""' + result + '"""';
2590
+ }
2591
+ var DirectiveLocation;
2592
+ (function(DirectiveLocation2) {
2593
+ DirectiveLocation2["QUERY"] = "QUERY";
2594
+ DirectiveLocation2["MUTATION"] = "MUTATION";
2595
+ DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION";
2596
+ DirectiveLocation2["FIELD"] = "FIELD";
2597
+ DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
2598
+ DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
2599
+ DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
2600
+ DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
2601
+ DirectiveLocation2["SCHEMA"] = "SCHEMA";
2602
+ DirectiveLocation2["SCALAR"] = "SCALAR";
2603
+ DirectiveLocation2["OBJECT"] = "OBJECT";
2604
+ DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION";
2605
+ DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
2606
+ DirectiveLocation2["INTERFACE"] = "INTERFACE";
2607
+ DirectiveLocation2["UNION"] = "UNION";
2608
+ DirectiveLocation2["ENUM"] = "ENUM";
2609
+ DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
2610
+ DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
2611
+ DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
2612
+ })(DirectiveLocation || (DirectiveLocation = {}));
2613
+ function printString(str) {
2614
+ return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
2615
+ }
2616
+ const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
2617
+ function escapedReplacer(str) {
2618
+ return escapeSequences[str.charCodeAt(0)];
2619
+ }
2620
+ const escapeSequences = [
2621
+ "\\u0000",
2622
+ "\\u0001",
2623
+ "\\u0002",
2624
+ "\\u0003",
2625
+ "\\u0004",
2626
+ "\\u0005",
2627
+ "\\u0006",
2628
+ "\\u0007",
2629
+ "\\b",
2630
+ "\\t",
2631
+ "\\n",
2632
+ "\\u000B",
2633
+ "\\f",
2634
+ "\\r",
2635
+ "\\u000E",
2636
+ "\\u000F",
2637
+ "\\u0010",
2638
+ "\\u0011",
2639
+ "\\u0012",
2640
+ "\\u0013",
2641
+ "\\u0014",
2642
+ "\\u0015",
2643
+ "\\u0016",
2644
+ "\\u0017",
2645
+ "\\u0018",
2646
+ "\\u0019",
2647
+ "\\u001A",
2648
+ "\\u001B",
2649
+ "\\u001C",
2650
+ "\\u001D",
2651
+ "\\u001E",
2652
+ "\\u001F",
2653
+ "",
2654
+ "",
2655
+ '\\"',
2656
+ "",
2657
+ "",
2658
+ "",
2659
+ "",
2660
+ "",
2661
+ "",
2662
+ "",
2663
+ "",
2664
+ "",
2665
+ "",
2666
+ "",
2667
+ "",
2668
+ "",
2669
+ // 2F
2670
+ "",
2671
+ "",
2672
+ "",
2673
+ "",
2674
+ "",
2675
+ "",
2676
+ "",
2677
+ "",
2678
+ "",
2679
+ "",
2680
+ "",
2681
+ "",
2682
+ "",
2683
+ "",
2684
+ "",
2685
+ "",
2686
+ // 3F
2687
+ "",
2688
+ "",
2689
+ "",
2690
+ "",
2691
+ "",
2692
+ "",
2693
+ "",
2694
+ "",
2695
+ "",
2696
+ "",
2697
+ "",
2698
+ "",
2699
+ "",
2700
+ "",
2701
+ "",
2702
+ "",
2703
+ // 4F
2704
+ "",
2705
+ "",
2706
+ "",
2707
+ "",
2708
+ "",
2709
+ "",
2710
+ "",
2711
+ "",
2712
+ "",
2713
+ "",
2714
+ "",
2715
+ "",
2716
+ "\\\\",
2717
+ "",
2718
+ "",
2719
+ "",
2720
+ // 5F
2721
+ "",
2722
+ "",
2723
+ "",
2724
+ "",
2725
+ "",
2726
+ "",
2727
+ "",
2728
+ "",
2729
+ "",
2730
+ "",
2731
+ "",
2732
+ "",
2733
+ "",
2734
+ "",
2735
+ "",
2736
+ "",
2737
+ // 6F
2738
+ "",
2739
+ "",
2740
+ "",
2741
+ "",
2742
+ "",
2743
+ "",
2744
+ "",
2745
+ "",
2746
+ "",
2747
+ "",
2748
+ "",
2749
+ "",
2750
+ "",
2751
+ "",
2752
+ "",
2753
+ "\\u007F",
2754
+ "\\u0080",
2755
+ "\\u0081",
2756
+ "\\u0082",
2757
+ "\\u0083",
2758
+ "\\u0084",
2759
+ "\\u0085",
2760
+ "\\u0086",
2761
+ "\\u0087",
2762
+ "\\u0088",
2763
+ "\\u0089",
2764
+ "\\u008A",
2765
+ "\\u008B",
2766
+ "\\u008C",
2767
+ "\\u008D",
2768
+ "\\u008E",
2769
+ "\\u008F",
2770
+ "\\u0090",
2771
+ "\\u0091",
2772
+ "\\u0092",
2773
+ "\\u0093",
2774
+ "\\u0094",
2775
+ "\\u0095",
2776
+ "\\u0096",
2777
+ "\\u0097",
2778
+ "\\u0098",
2779
+ "\\u0099",
2780
+ "\\u009A",
2781
+ "\\u009B",
2782
+ "\\u009C",
2783
+ "\\u009D",
2784
+ "\\u009E",
2785
+ "\\u009F"
2786
+ ];
2787
+ const BREAK = Object.freeze({});
2788
+ function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
2789
+ const enterLeaveMap = /* @__PURE__ */ new Map();
2790
+ for (const kind of Object.values(Kind)) {
2791
+ enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
2792
+ }
2793
+ let stack = void 0;
2794
+ let inArray = Array.isArray(root);
2795
+ let keys = [root];
2796
+ let index = -1;
2797
+ let edits = [];
2798
+ let node = root;
2799
+ let key = void 0;
2800
+ let parent = void 0;
2801
+ const path = [];
2802
+ const ancestors = [];
2803
+ do {
2804
+ index++;
2805
+ const isLeaving = index === keys.length;
2806
+ const isEdited = isLeaving && edits.length !== 0;
2807
+ if (isLeaving) {
2808
+ key = ancestors.length === 0 ? void 0 : path[path.length - 1];
2809
+ node = parent;
2810
+ parent = ancestors.pop();
2811
+ if (isEdited) {
2812
+ if (inArray) {
2813
+ node = node.slice();
2814
+ let editOffset = 0;
2815
+ for (const [editKey, editValue] of edits) {
2816
+ const arrayKey = editKey - editOffset;
2817
+ if (editValue === null) {
2818
+ node.splice(arrayKey, 1);
2819
+ editOffset++;
2820
+ } else {
2821
+ node[arrayKey] = editValue;
2822
+ }
2823
+ }
2824
+ } else {
2825
+ node = { ...node };
2826
+ for (const [editKey, editValue] of edits) {
2827
+ node[editKey] = editValue;
2828
+ }
2829
+ }
2830
+ }
2831
+ index = stack.index;
2832
+ keys = stack.keys;
2833
+ edits = stack.edits;
2834
+ inArray = stack.inArray;
2835
+ stack = stack.prev;
2836
+ } else if (parent) {
2837
+ key = inArray ? index : keys[index];
2838
+ node = parent[key];
2839
+ if (node === null || node === void 0) {
2840
+ continue;
2841
+ }
2842
+ path.push(key);
2843
+ }
2844
+ let result;
2845
+ if (!Array.isArray(node)) {
2846
+ var _enterLeaveMap$get, _enterLeaveMap$get2;
2847
+ isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
2848
+ 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;
2849
+ result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors);
2850
+ if (result === BREAK) {
2851
+ break;
2852
+ }
2853
+ if (result === false) {
2854
+ if (!isLeaving) {
2855
+ path.pop();
2856
+ continue;
2857
+ }
2858
+ } else if (result !== void 0) {
2859
+ edits.push([key, result]);
2860
+ if (!isLeaving) {
2861
+ if (isNode(result)) {
2862
+ node = result;
2863
+ } else {
2864
+ path.pop();
2865
+ continue;
2866
+ }
2867
+ }
2868
+ }
2869
+ }
2870
+ if (result === void 0 && isEdited) {
2871
+ edits.push([key, node]);
2872
+ }
2873
+ if (isLeaving) {
2874
+ path.pop();
2875
+ } else {
2876
+ var _node$kind;
2877
+ stack = {
2878
+ inArray,
2879
+ index,
2880
+ keys,
2881
+ edits,
2882
+ prev: stack
2883
+ };
2884
+ inArray = Array.isArray(node);
2885
+ keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : [];
2886
+ index = -1;
2887
+ edits = [];
2888
+ if (parent) {
2889
+ ancestors.push(parent);
2890
+ }
2891
+ parent = node;
2892
+ }
2893
+ } while (stack !== void 0);
2894
+ if (edits.length !== 0) {
2895
+ return edits[edits.length - 1][1];
2896
+ }
2897
+ return root;
2898
+ }
2899
+ function getEnterLeaveForKind(visitor, kind) {
2900
+ const kindVisitor = visitor[kind];
2901
+ if (typeof kindVisitor === "object") {
2902
+ return kindVisitor;
2903
+ } else if (typeof kindVisitor === "function") {
2904
+ return {
2905
+ enter: kindVisitor,
2906
+ leave: void 0
2907
+ };
2908
+ }
2909
+ return {
2910
+ enter: visitor.enter,
2911
+ leave: visitor.leave
2912
+ };
2913
+ }
2914
+ function print(ast) {
2915
+ return visit(ast, printDocASTReducer);
2916
+ }
2917
+ const MAX_LINE_LENGTH = 80;
2918
+ const printDocASTReducer = {
2919
+ Name: {
2920
+ leave: (node) => node.value
2921
+ },
2922
+ Variable: {
2923
+ leave: (node) => "$" + node.name
2924
+ },
2925
+ // Document
2926
+ Document: {
2927
+ leave: (node) => join(node.definitions, "\n\n")
2928
+ },
2929
+ OperationDefinition: {
2930
+ leave(node) {
2931
+ const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")");
2932
+ const prefix = join(
2933
+ [
2934
+ node.operation,
2935
+ join([node.name, varDefs]),
2936
+ join(node.directives, " ")
2937
+ ],
2938
+ " "
2939
+ );
2940
+ return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
2941
+ }
2942
+ },
2943
+ VariableDefinition: {
2944
+ leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
2945
+ },
2946
+ SelectionSet: {
2947
+ leave: ({ selections }) => block(selections)
2948
+ },
2949
+ Field: {
2950
+ leave({ alias, name, arguments: args, directives, selectionSet }) {
2951
+ const prefix = wrap("", alias, ": ") + name;
2952
+ let argsLine = prefix + wrap("(", join(args, ", "), ")");
2953
+ if (argsLine.length > MAX_LINE_LENGTH) {
2954
+ argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)");
2955
+ }
2956
+ return join([argsLine, join(directives, " "), selectionSet], " ");
2957
+ }
2958
+ },
2959
+ Argument: {
2960
+ leave: ({ name, value }) => name + ": " + value
2961
+ },
2962
+ // Fragments
2963
+ FragmentSpread: {
2964
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
2965
+ },
2966
+ InlineFragment: {
2967
+ leave: ({ typeCondition, directives, selectionSet }) => join(
2968
+ [
2969
+ "...",
2970
+ wrap("on ", typeCondition),
2971
+ join(directives, " "),
2972
+ selectionSet
2973
+ ],
2974
+ " "
2975
+ )
2976
+ },
2977
+ FragmentDefinition: {
2978
+ leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
2979
+ // or removed in the future.
2980
+ `fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
2981
+ )
2982
+ },
2983
+ // Value
2984
+ IntValue: {
2985
+ leave: ({ value }) => value
2986
+ },
2987
+ FloatValue: {
2988
+ leave: ({ value }) => value
2989
+ },
2990
+ StringValue: {
2991
+ leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
2992
+ },
2993
+ BooleanValue: {
2994
+ leave: ({ value }) => value ? "true" : "false"
2995
+ },
2996
+ NullValue: {
2997
+ leave: () => "null"
2998
+ },
2999
+ EnumValue: {
3000
+ leave: ({ value }) => value
3001
+ },
3002
+ ListValue: {
3003
+ leave: ({ values }) => "[" + join(values, ", ") + "]"
3004
+ },
3005
+ ObjectValue: {
3006
+ leave: ({ fields }) => "{" + join(fields, ", ") + "}"
3007
+ },
3008
+ ObjectField: {
3009
+ leave: ({ name, value }) => name + ": " + value
3010
+ },
3011
+ // Directive
3012
+ Directive: {
3013
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
3014
+ },
3015
+ // Type
3016
+ NamedType: {
3017
+ leave: ({ name }) => name
3018
+ },
3019
+ ListType: {
3020
+ leave: ({ type }) => "[" + type + "]"
3021
+ },
3022
+ NonNullType: {
3023
+ leave: ({ type }) => type + "!"
3024
+ },
3025
+ // Type System Definitions
3026
+ SchemaDefinition: {
3027
+ leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ")
3028
+ },
3029
+ OperationTypeDefinition: {
3030
+ leave: ({ operation, type }) => operation + ": " + type
3031
+ },
3032
+ ScalarTypeDefinition: {
3033
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ")
3034
+ },
3035
+ ObjectTypeDefinition: {
3036
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
3037
+ [
3038
+ "type",
3039
+ name,
3040
+ wrap("implements ", join(interfaces, " & ")),
3041
+ join(directives, " "),
3042
+ block(fields)
3043
+ ],
3044
+ " "
3045
+ )
3046
+ },
3047
+ FieldDefinition: {
3048
+ 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, " "))
3049
+ },
3050
+ InputValueDefinition: {
3051
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join(
3052
+ [name + ": " + type, wrap("= ", defaultValue), join(directives, " ")],
3053
+ " "
3054
+ )
3055
+ },
3056
+ InterfaceTypeDefinition: {
3057
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
3058
+ [
3059
+ "interface",
3060
+ name,
3061
+ wrap("implements ", join(interfaces, " & ")),
3062
+ join(directives, " "),
3063
+ block(fields)
3064
+ ],
3065
+ " "
3066
+ )
3067
+ },
3068
+ UnionTypeDefinition: {
3069
+ leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join(
3070
+ ["union", name, join(directives, " "), wrap("= ", join(types, " | "))],
3071
+ " "
3072
+ )
3073
+ },
3074
+ EnumTypeDefinition: {
3075
+ leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ")
3076
+ },
3077
+ EnumValueDefinition: {
3078
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ")
3079
+ },
3080
+ InputObjectTypeDefinition: {
3081
+ leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
3082
+ },
3083
+ DirectiveDefinition: {
3084
+ 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, " | ")
3085
+ },
3086
+ SchemaExtension: {
3087
+ leave: ({ directives, operationTypes }) => join(
3088
+ ["extend schema", join(directives, " "), block(operationTypes)],
3089
+ " "
3090
+ )
3091
+ },
3092
+ ScalarTypeExtension: {
3093
+ leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
3094
+ },
3095
+ ObjectTypeExtension: {
3096
+ leave: ({ name, interfaces, directives, fields }) => join(
3097
+ [
3098
+ "extend type",
3099
+ name,
3100
+ wrap("implements ", join(interfaces, " & ")),
3101
+ join(directives, " "),
3102
+ block(fields)
3103
+ ],
3104
+ " "
3105
+ )
3106
+ },
3107
+ InterfaceTypeExtension: {
3108
+ leave: ({ name, interfaces, directives, fields }) => join(
3109
+ [
3110
+ "extend interface",
3111
+ name,
3112
+ wrap("implements ", join(interfaces, " & ")),
3113
+ join(directives, " "),
3114
+ block(fields)
3115
+ ],
3116
+ " "
3117
+ )
3118
+ },
3119
+ UnionTypeExtension: {
3120
+ leave: ({ name, directives, types }) => join(
3121
+ [
3122
+ "extend union",
3123
+ name,
3124
+ join(directives, " "),
3125
+ wrap("= ", join(types, " | "))
3126
+ ],
3127
+ " "
3128
+ )
3129
+ },
3130
+ EnumTypeExtension: {
3131
+ leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
3132
+ },
3133
+ InputObjectTypeExtension: {
3134
+ leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
3135
+ }
3136
+ };
3137
+ function join(maybeArray, separator = "") {
3138
+ var _maybeArray$filter$jo;
3139
+ 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 : "";
3140
+ }
3141
+ function block(array) {
3142
+ return wrap("{\n", indent(join(array, "\n")), "\n}");
3143
+ }
3144
+ function wrap(start, maybeString, end = "") {
3145
+ return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
3146
+ }
3147
+ function indent(str) {
3148
+ return wrap(" ", str.replace(/\n/g, "\n "));
3149
+ }
3150
+ function hasMultilineItems(maybeArray) {
3151
+ var _maybeArray$some;
3152
+ return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false;
3153
+ }
3154
+
3155
+ /*!
3156
+ * Copyright (c) 2022, Salesforce, Inc.,
3157
+ * All rights reserved.
3158
+ * For full license text, see the LICENSE.txt file
3159
+ */
3160
+ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
3161
+ constructor(config, documentRootType, services) {
3162
+ super(services);
3163
+ this.config = config;
3164
+ this.documentRootType = documentRootType;
3165
+ this.services = services;
3166
+ }
3167
+ buildResultType() {
3168
+ return this.documentRootType;
3169
+ }
3170
+ buildQuery() {
3171
+ const extensionResult = buildGraphQLInputExtension(this.config);
3172
+ if (extensionResult.isErr()) {
3173
+ throw extensionResult.error;
3174
+ }
3175
+ return {
3176
+ type: "keyParams",
3177
+ keyParams: null,
3178
+ ...extensionResult.value
3179
+ };
3180
+ }
3181
+ responseHasErrors(data) {
3182
+ return data.hasOwnProperty("errors") && data.errors && data.errors.length > 0;
3183
+ }
3184
+ processAuraReturnValue(auraReturnValue) {
3185
+ if (this.responseHasErrors(auraReturnValue)) {
3186
+ return err$1(new UserVisibleError(auraReturnValue));
3187
+ }
3188
+ return ok$2(auraReturnValue);
3189
+ }
3190
+ processFetchReturnValue(json) {
3191
+ if (this.responseHasErrors(json)) {
3192
+ return err$1(new UserVisibleError(json));
3193
+ }
3194
+ return ok$2(json);
3195
+ }
3196
+ /**
3197
+ * Optional body wrapper name for aura requests.
3198
+ * If defined, the aura params will be wrapped in an object with this property name.
3199
+ * Override this method in subclasses if a body wrapper is needed.
3200
+ */
3201
+ get auraBodyWrapperName() {
3202
+ return void 0;
3203
+ }
3204
+ get auraParams() {
3205
+ const params = { ...this.config, query: print(this.buildRequestQuery()) };
3206
+ if (this.auraBodyWrapperName) {
3207
+ return { [this.auraBodyWrapperName]: params };
3208
+ }
3209
+ return params;
3210
+ }
3211
+ get fetchParams() {
3212
+ const body = { ...this.config, query: print(this.buildRequestQuery()) };
3213
+ const headers = {
3214
+ "Content-Type": "application/json"
3215
+ };
3216
+ const params = {
3217
+ method: "POST",
3218
+ cache: "no-cache",
3219
+ headers,
3220
+ body: JSON.stringify(body)
3221
+ };
3222
+ return [this.url, params];
3223
+ }
3224
+ get originalAuraParams() {
3225
+ const params = { ...this.config, query: print(this.config.query) };
3226
+ if (this.auraBodyWrapperName) {
3227
+ return { [this.auraBodyWrapperName]: params };
3228
+ }
3229
+ return params;
3230
+ }
3231
+ get originalFetchParams() {
3232
+ const body = { ...this.config, query: print(this.config.query) };
3233
+ const headers = {
3234
+ "Content-Type": "application/json"
3235
+ };
3236
+ const params = {
3237
+ method: "POST",
3238
+ cache: "no-cache",
3239
+ headers,
3240
+ body: JSON.stringify(body)
3241
+ };
3242
+ return [this.url, params];
3243
+ }
3244
+ // 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.
3245
+ runOriginalRequest() {
3246
+ if (this.shouldUseAuraNetwork()) {
3247
+ return this.convertAuraResponseToData(
3248
+ this.services.auraNetwork(
3249
+ this.endpoint,
3250
+ this.originalAuraParams,
3251
+ this.actionConfig
3252
+ ),
3253
+ (errs) => this.coerceError(errs)
3254
+ ).then((result) => {
3255
+ if (result.isOk()) {
3256
+ return this.constructSubscribableResult(result.value);
3257
+ }
3258
+ return result;
3259
+ });
3260
+ } else if (this.shouldUseFetch()) {
3261
+ return this.convertFetchResponseToData(
3262
+ this.services.fetch(...this.originalFetchParams)
3263
+ ).then((result) => {
3264
+ if (result.isOk()) {
3265
+ return this.constructSubscribableResult(result.value);
3266
+ }
3267
+ return result;
3268
+ });
3269
+ }
3270
+ return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
3271
+ }
3272
+ buildRequestQuery() {
3273
+ const augmentedQueryResult = this.documentRootType.buildAugmentedQuery(this.config);
3274
+ if (augmentedQueryResult.isErr()) {
3275
+ throw augmentedQueryResult.error;
3276
+ }
3277
+ return augmentedQueryResult.value;
3278
+ }
3279
+ buildWriteInput(data) {
3280
+ const extensionResult = buildGraphQLInputExtension({
3281
+ ...this.config,
3282
+ query: this.buildRequestQuery()
3283
+ });
3284
+ if (extensionResult.isErr()) {
3285
+ throw new InternalError(extensionResult.error);
3286
+ }
3287
+ return { data: data.data, ...extensionResult.value };
3288
+ }
3289
+ // Any changes to this method should most likely be duplicated in the https command as well
3290
+ handleCacheControllerResult(result, requestRunner) {
3291
+ const { networkError, returnData } = requestRunner;
3292
+ return this.publishUpdatedKeys().then(() => {
3293
+ if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
3294
+ return this.runOriginalRequest();
3295
+ }
3296
+ if (this.subscriptions.length > 0) {
3297
+ this.subscribeToKeysUsed();
3298
+ }
3299
+ if (this.lastEmittedData === void 0) {
3300
+ this.lastEmittedData = returnData.value.data;
3301
+ }
3302
+ return returnData;
3303
+ });
3304
+ }
3305
+ }
3306
+ function buildServiceDescriptor$2() {
3307
+ return {
3308
+ type: "auraGraphQLNormalizedCacheControlCommand",
3309
+ version: "1.0",
3310
+ service: AuraGraphQLNormalizedCacheControlCommand
3311
+ };
3312
+ }
3313
+
3314
+ /*!
3315
+ * Copyright (c) 2022, Salesforce, Inc.,
3316
+ * All rights reserved.
3317
+ * For full license text, see the LICENSE.txt file
3318
+ */
3319
+ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheControlCommand {
3320
+ constructor(config, documentRootType, services) {
3321
+ super(services);
3322
+ this.config = config;
3323
+ this.documentRootType = documentRootType;
3324
+ this.services = services;
3325
+ }
3326
+ buildResultType() {
3327
+ return this.documentRootType;
3328
+ }
3329
+ buildQuery() {
3330
+ const extensionResult = buildGraphQLInputExtension(this.config);
3331
+ if (extensionResult.isErr()) {
3332
+ throw extensionResult.error;
3333
+ }
3334
+ return {
3335
+ type: "keyParams",
3336
+ keyParams: null,
3337
+ ...extensionResult.value
3338
+ };
3339
+ }
3340
+ get fetchParams() {
3341
+ const body = { ...this.config, query: print(this.buildRequestQuery()) };
3342
+ const headers = {
3343
+ "Content-Type": "application/json"
3344
+ };
3345
+ const params = {
3346
+ method: "POST",
3347
+ cache: "no-cache",
3348
+ headers,
3349
+ body: JSON.stringify(body)
3350
+ };
3351
+ return [this.url, params];
3352
+ }
3353
+ get originalFetchParams() {
3354
+ const body = { ...this.config, query: print(this.config.query) };
3355
+ const headers = {
3356
+ "Content-Type": "application/json"
3357
+ };
3358
+ const params = {
3359
+ method: "POST",
3360
+ cache: "no-cache",
3361
+ headers,
3362
+ body: JSON.stringify(body)
3363
+ };
3364
+ return [this.url, params];
3365
+ }
3366
+ buildRequestQuery() {
3367
+ const augmentedQueryResult = this.documentRootType.buildAugmentedQuery(this.config);
3368
+ if (augmentedQueryResult.isErr()) {
3369
+ throw augmentedQueryResult.error;
3370
+ }
3371
+ return augmentedQueryResult.value;
3372
+ }
3373
+ buildWriteInput(data) {
3374
+ const extensionResult = buildGraphQLInputExtension({
3375
+ ...this.config,
3376
+ query: this.buildRequestQuery()
3377
+ });
3378
+ if (extensionResult.isErr()) {
3379
+ throw new InternalError(extensionResult.error);
3380
+ }
3381
+ return { data: data.data, ...extensionResult.value };
3382
+ }
3383
+ processFetchReturnValue(json) {
3384
+ if (json.hasOwnProperty("errors") && json.errors && json.errors.length > 0) {
3385
+ return err$1(new UserVisibleError(json));
3386
+ }
3387
+ return ok$2(json);
3388
+ }
3389
+ runOriginalRequest() {
3390
+ return this.convertFetchResponseToData(
3391
+ this.services.fetch(...this.originalFetchParams)
3392
+ ).then((result) => {
3393
+ if (result.isOk()) {
3394
+ return this.constructSubscribableResult(result.value);
3395
+ }
3396
+ return result;
3397
+ });
3398
+ }
3399
+ // Any changes to this method should most likely be duplicated in the aura command as well
3400
+ handleCacheControllerResult(result, requestRunner) {
3401
+ const { networkError, returnData } = requestRunner;
3402
+ return this.publishUpdatedKeys().then(() => {
3403
+ if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
3404
+ return this.runOriginalRequest();
3405
+ }
3406
+ if (this.subscriptions.length > 0) {
3407
+ this.subscribeToKeysUsed();
3408
+ }
3409
+ if (this.lastEmittedData === void 0) {
3410
+ this.lastEmittedData = returnData.value.data;
3411
+ }
3412
+ return returnData;
3413
+ });
3414
+ }
3415
+ }
3416
+ function buildServiceDescriptor$1() {
3417
+ return {
3418
+ type: "httpGraphQLNormalizedCacheControlCommand",
3419
+ version: "1.0",
3420
+ service: HttpGraphQLNormalizedCacheControlCommand
3421
+ };
3422
+ }
3423
+
2235
3424
  /*!
2236
3425
  * Copyright (c) 2022, Salesforce, Inc.,
2237
3426
  * All rights reserved.
@@ -5725,7 +6914,7 @@ function getEnvironmentSetting(name) {
5725
6914
  }
5726
6915
  return undefined;
5727
6916
  }
5728
- // version: 1.370.0-7c1df2520b
6917
+ // version: 1.372.0-59e8aa192f
5729
6918
 
5730
6919
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
5731
6920
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6603,12 +7792,13 @@ function initializeLDS() {
6603
7792
  if (usePredictiveLoading.isOpen({ fallback: false })) {
6604
7793
  setupPredictivePrefetcher(luvio);
6605
7794
  }
7795
+ return luvio; // Return the luvio instance so that we can inject it for OneStore
6606
7796
  }
6607
7797
  // Initializes OneStore in LEX
6608
- function initializeOneStore() {
7798
+ function initializeOneStore(luvio) {
6609
7799
  const loggerService = new ConsoleLogger$1('ERROR');
6610
- const cacheServiceDescriptor = buildServiceDescriptor$4();
6611
- const instrumentationServiceDescriptor = buildServiceDescriptor$5(loggerService);
7800
+ const cacheServiceDescriptor = buildServiceDescriptor$7();
7801
+ const instrumentationServiceDescriptor = buildServiceDescriptor$8(loggerService);
6612
7802
  const inMemoryCacheInclusionPolicyServiceDescriptor = buildInMemoryCacheInclusionPolicyService(cacheServiceDescriptor.service);
6613
7803
  const services = [
6614
7804
  instrumentationServiceDescriptor,
@@ -6616,19 +7806,22 @@ function initializeOneStore() {
6616
7806
  buildJwtAuthorizedSfapFetchServiceDescriptor(loggerService),
6617
7807
  buildCopilotFetchServiceDescriptor(loggerService),
6618
7808
  buildAuraNetworkService(),
6619
- buildServiceDescriptor$6(instrumentationServiceDescriptor.service),
6620
- buildServiceDescriptor$3(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service),
6621
- buildServiceDescriptor$d(),
6622
- buildServiceDescriptor$1(),
6623
- buildServiceDescriptor$9(),
6624
- buildServiceDescriptor$e(),
6625
- buildServiceDescriptor$8(),
6626
- buildServiceDescriptor$7(),
7809
+ buildServiceDescriptor$9(instrumentationServiceDescriptor.service),
7810
+ buildServiceDescriptor$6(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service),
7811
+ buildServiceDescriptor$g(),
7812
+ buildServiceDescriptor$4(),
6627
7813
  buildServiceDescriptor$c(),
7814
+ buildServiceDescriptor$h(),
6628
7815
  buildServiceDescriptor$b(),
6629
7816
  buildServiceDescriptor$a(),
6630
- buildServiceDescriptor$2(),
7817
+ buildServiceDescriptor$f(),
7818
+ buildServiceDescriptor$e(),
7819
+ buildServiceDescriptor$d(),
7820
+ buildServiceDescriptor$5(),
6631
7821
  buildLexRuntimeFetchServiceDescriptor(loggerService),
7822
+ buildServiceDescriptor$3(luvio),
7823
+ buildServiceDescriptor$2(),
7824
+ buildServiceDescriptor$1(),
6632
7825
  ];
6633
7826
  setServices(services);
6634
7827
  }
@@ -6637,8 +7830,8 @@ function initializeOnestoreUiApiAdapters() {
6637
7830
  // ldsAdaptersUiapiConfig.setGetObjectInfoAdapter(getObjectInfo);
6638
7831
  // ldsAdaptersUiapiConfig.setGetObjectInfosAdapter(getObjectInfos);
6639
7832
  if (useOneStoreGraphql.isOpen({ fallback: false })) {
6640
- configuration.setGraphQLWireAdapter({});
6641
- configuration.setGraphQLImperativeQueryAdapter({});
7833
+ configuration.setGraphQLWireAdapter(graphql);
7834
+ configuration.setGraphQLImperativeQueryAdapter(graphql_imperative);
6642
7835
  }
6643
7836
  }
6644
7837
  function buildAuraNetworkService() {
@@ -6650,16 +7843,14 @@ function buildAuraNetworkService() {
6650
7843
  }
6651
7844
  // service function to be invoked by Aura
6652
7845
  function ldsEngineCreator() {
7846
+ const luvio = initializeLDS();
6653
7847
  // One store initialization needs to happen first in order to set the one store adapter correctly in configuration object.
6654
- if (oneStoreEnabled.isOpen({ fallback: true })) {
6655
- initializeOneStore();
6656
- if (oneStoreUiapiEnabled.isOpen({ fallback: false })) {
6657
- initializeOnestoreUiApiAdapters();
6658
- }
7848
+ initializeOneStore(luvio);
7849
+ if (oneStoreUiapiEnabled.isOpen({ fallback: false })) {
7850
+ initializeOnestoreUiApiAdapters();
6659
7851
  }
6660
- initializeLDS();
6661
7852
  return { name: 'ldsEngineCreator' };
6662
7853
  }
6663
7854
 
6664
7855
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
6665
- // version: 1.370.0-3ec6ffba72
7856
+ // version: 1.372.0-5866fad2db