@sortlist/cli 0.62.0 → 0.64.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.
@@ -0,0 +1,1105 @@
1
+ // src/core/router-client.ts
2
+ function codeOf(errors) {
3
+ for (const { extensions } of errors) {
4
+ const code = extensions?.code;
5
+ if (typeof code === "string") return code;
6
+ }
7
+ return null;
8
+ }
9
+ function serviceOf(errors) {
10
+ for (const { extensions } of errors) {
11
+ const service = extensions?.service;
12
+ if (typeof service === "string") return service;
13
+ }
14
+ return null;
15
+ }
16
+ function hasResolvedField(data) {
17
+ if (data === null || data === void 0) return false;
18
+ return Object.values(data).some((value) => value !== null);
19
+ }
20
+ var RouterError = class extends Error {
21
+ kind;
22
+ code;
23
+ httpStatus;
24
+ graphqlErrors;
25
+ service;
26
+ statusText;
27
+ body;
28
+ constructor(message, details) {
29
+ super(message, details.cause === void 0 ? void 0 : { cause: details.cause });
30
+ this.name = "RouterError";
31
+ this.kind = details.kind;
32
+ this.code = details.code;
33
+ this.httpStatus = details.httpStatus;
34
+ this.graphqlErrors = details.graphqlErrors ?? [];
35
+ this.service = serviceOf(this.graphqlErrors);
36
+ this.statusText = details.statusText;
37
+ this.body = details.body;
38
+ }
39
+ };
40
+ async function* parseEventStream(chunks) {
41
+ const decoder = new TextDecoder();
42
+ let buffer = "";
43
+ for await (const chunk of chunks) {
44
+ buffer += typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true });
45
+ buffer = buffer.replaceAll("\r\n", "\n");
46
+ let boundary = buffer.indexOf("\n\n");
47
+ while (boundary !== -1) {
48
+ const block = buffer.slice(0, boundary);
49
+ buffer = buffer.slice(boundary + 2);
50
+ const parsed = parseEventBlock(block);
51
+ if (parsed) yield parsed;
52
+ boundary = buffer.indexOf("\n\n");
53
+ }
54
+ }
55
+ const rest = parseEventBlock(buffer);
56
+ if (rest) yield rest;
57
+ }
58
+ function parseEventBlock(block) {
59
+ let event = "message";
60
+ const data = [];
61
+ for (const line of block.split("\n")) {
62
+ if (line === "" || line.startsWith(":")) continue;
63
+ const colon = line.indexOf(":");
64
+ const field = colon === -1 ? line : line.slice(0, colon);
65
+ const value = colon === -1 ? "" : line.slice(colon + 1).replace(/^ /, "");
66
+ if (field === "event") event = value;
67
+ if (field === "data") data.push(value);
68
+ }
69
+ return data.length > 0 || event !== "message" ? { event, data: data.join("\n") } : null;
70
+ }
71
+ function parseErrors(body) {
72
+ try {
73
+ const errors = JSON.parse(body).errors;
74
+ return errors?.length ? errors : null;
75
+ } catch {
76
+ return null;
77
+ }
78
+ }
79
+ function setHeader(headers, name, value) {
80
+ for (const existing of Object.keys(headers)) {
81
+ if (existing.toLowerCase() === name.toLowerCase()) delete headers[existing];
82
+ }
83
+ headers[name] = value;
84
+ }
85
+ function withJsonBody(headers = {}) {
86
+ const labelled = Object.keys(headers).some((name) => name.toLowerCase() === "content-type");
87
+ return labelled ? { ...headers } : { "Content-Type": "application/json", ...headers };
88
+ }
89
+ function createRouterClient(options) {
90
+ function headersFor(accept) {
91
+ const headers = withJsonBody(options.headers);
92
+ if (options.token) setHeader(headers, "Authorization", `Bearer ${options.token}`);
93
+ if (options.companyId) setHeader(headers, "X-Company-Id", options.companyId);
94
+ if (accept) setHeader(headers, "Accept", accept);
95
+ return headers;
96
+ }
97
+ async function post(query, variables, headers, signal) {
98
+ const send = options.fetch ?? fetch;
99
+ let res;
100
+ try {
101
+ res = await send(options.endpoint, {
102
+ method: "POST",
103
+ headers,
104
+ body: JSON.stringify({ query, variables }),
105
+ ...signal ? { signal } : {}
106
+ });
107
+ } catch (err) {
108
+ throw new RouterError(err.message, { kind: "unreachable", code: "UNREACHABLE", cause: err });
109
+ }
110
+ if (res.ok) return res;
111
+ const body = await res.text();
112
+ const errors = parseErrors(body) ?? [];
113
+ throw new RouterError(`HTTP ${res.status} ${res.statusText}`, {
114
+ kind: "http",
115
+ code: codeOf(errors) ?? `HTTP_${res.status}`,
116
+ httpStatus: res.status,
117
+ graphqlErrors: errors,
118
+ statusText: res.statusText,
119
+ body
120
+ });
121
+ }
122
+ function failWith(errors) {
123
+ throw new RouterError(errors[0]?.message ?? "GraphQL errors", {
124
+ kind: "graphql",
125
+ code: codeOf(errors),
126
+ graphqlErrors: errors
127
+ });
128
+ }
129
+ async function respond(query, variables, signal) {
130
+ try {
131
+ const res = await post(query, variables, headersFor(), signal);
132
+ return await res.json();
133
+ } catch (err) {
134
+ throw signal?.aborted ? signal.reason : err;
135
+ }
136
+ }
137
+ async function execute(query, variables, signal) {
138
+ const json = await respond(query, variables, signal);
139
+ if (json.errors?.length) {
140
+ if (!hasResolvedField(json.data)) failWith(json.errors);
141
+ options.onPartialErrors?.(json.errors);
142
+ return json.data;
143
+ }
144
+ if (!json.data) throw new RouterError("No data returned from API.", { kind: "no_data", code: "NO_DATA" });
145
+ return json.data;
146
+ }
147
+ async function* events(res) {
148
+ if (!res.body) return;
149
+ for await (const { event, data } of parseEventStream(res.body)) {
150
+ if (event === "complete") return;
151
+ if (event !== "next" && event !== "message") continue;
152
+ const payload = JSON.parse(data);
153
+ if (payload.errors?.length && !hasResolvedField(payload.data)) failWith(payload.errors);
154
+ if (payload.errors?.length) options.onPartialErrors?.(payload.errors);
155
+ if (payload.data) yield payload.data;
156
+ }
157
+ }
158
+ async function openSubscription(query, variables, signal) {
159
+ return events(await post(query, variables, headersFor("text/event-stream"), signal));
160
+ }
161
+ async function* subscribe(query, variables, signal) {
162
+ yield* await openSubscription(query, variables, signal);
163
+ }
164
+ return { execute, subscribe, openSubscription };
165
+ }
166
+
167
+ // src/core/catalog.ts
168
+ import {
169
+ isEnumType,
170
+ isInputObjectType,
171
+ isInterfaceType,
172
+ isListType,
173
+ isNonNullType,
174
+ isObjectType,
175
+ isUnionType
176
+ } from "graphql";
177
+ var SKIP_FIELDS = /* @__PURE__ */ new Set(["node", "nodes", "id", "_entities", "_service"]);
178
+ var KIND_ORDER = ["query", "mutation", "subscription"];
179
+ function unwrap(type) {
180
+ if (isNonNullType(type)) return unwrap(type.ofType);
181
+ if (isListType(type)) return unwrap(type.ofType);
182
+ return type;
183
+ }
184
+ function operationArg(field) {
185
+ return {
186
+ name: field.name,
187
+ type: field.type,
188
+ required: isNonNullType(field.type),
189
+ description: field.description,
190
+ ...field.defaultValue === void 0 ? {} : { defaultValue: field.defaultValue }
191
+ };
192
+ }
193
+ function isRecord(value) {
194
+ return typeof value === "object" && value !== null;
195
+ }
196
+ function getInputFields(field) {
197
+ if (field.args.length !== 1) return null;
198
+ const arg = field.args[0];
199
+ if (arg.name !== "input") return null;
200
+ const argType = isNonNullType(arg.type) ? arg.type.ofType : arg.type;
201
+ if (!isInputObjectType(argType)) return null;
202
+ return Object.values(argType.getFields()).map(operationArg);
203
+ }
204
+ function supersededBy(field, siblings) {
205
+ const replacement = field.deprecationReason?.match(/`(\w+)`/)?.[1];
206
+ if (!replacement || SKIP_FIELDS.has(replacement)) return null;
207
+ const sibling = siblings[replacement];
208
+ return sibling && !sibling.deprecationReason ? replacement : null;
209
+ }
210
+ function argumentNames(field) {
211
+ return new Set((getInputFields(field) ?? field.args).map((a) => a.name));
212
+ }
213
+ var RESULT_OF_MUTATION = /(?:result|outcome) of an? `(\w+)` call|then call `(\w+)`/;
214
+ function resultSubscriptions(schema) {
215
+ const pairs = /* @__PURE__ */ new Map();
216
+ const mutations = schema.getMutationType()?.getFields() ?? {};
217
+ for (const [name, field] of Object.entries(schema.getSubscriptionType()?.getFields() ?? {})) {
218
+ const match = field.description?.match(RESULT_OF_MUTATION);
219
+ const mutation = match?.[1] ?? match?.[2];
220
+ if (!mutation || !mutations[mutation]) continue;
221
+ const mutationArguments = argumentNames(mutations[mutation]);
222
+ if (!field.args.some((a) => a.name === "externalId") || !mutationArguments.has("externalId")) continue;
223
+ if (field.args.some((a) => isNonNullType(a.type) && !mutationArguments.has(a.name))) continue;
224
+ pairs.set(mutation, name);
225
+ }
226
+ return pairs;
227
+ }
228
+ function subscriptionVariablesFor(schema, subscription, mutationArguments, externalId) {
229
+ const variables = {};
230
+ for (const arg of schema.getSubscriptionType()?.getFields()[subscription]?.args ?? []) {
231
+ if (mutationArguments[arg.name] !== void 0) variables[arg.name] = mutationArguments[arg.name];
232
+ }
233
+ return { ...variables, externalId };
234
+ }
235
+ function isStillFilling(result) {
236
+ return isRecord(result) && result.status === "FILLING";
237
+ }
238
+ var PAGE_STATUS_FIELD = "status";
239
+ function deliversFillingPages(schema, subscriptionName) {
240
+ const field = schema.getSubscriptionType()?.getFields()[subscriptionName];
241
+ const returnType = field ? unwrap(field.type) : null;
242
+ const status = returnType && isObjectType(returnType) ? returnType.getFields()[PAGE_STATUS_FIELD] : void 0;
243
+ const statusType = status ? unwrap(status.type) : null;
244
+ return Boolean(statusType && isEnumType(statusType) && statusType.getValue("FILLING"));
245
+ }
246
+ function exposedFields(type, services) {
247
+ const fields = type.getFields();
248
+ const exposed = [];
249
+ for (const [fieldName, field] of Object.entries(fields)) {
250
+ if (SKIP_FIELDS.has(fieldName) || fieldName.startsWith("__")) continue;
251
+ if (supersededBy(field, fields)) continue;
252
+ const returnType = unwrap(field.type);
253
+ if (isInterfaceType(returnType) || isUnionType(returnType)) continue;
254
+ const service = services.get(fieldName);
255
+ if (service) exposed.push({ fieldName, field, service });
256
+ }
257
+ return exposed;
258
+ }
259
+ function listOperations(introspected) {
260
+ const { schema, fieldServices, fieldScopes } = introspected;
261
+ const pairs = resultSubscriptions(schema);
262
+ const operations = [];
263
+ const rootTypes = [
264
+ { kind: "query", type: schema.getQueryType() },
265
+ { kind: "mutation", type: schema.getMutationType() },
266
+ { kind: "subscription", type: schema.getSubscriptionType() }
267
+ ];
268
+ for (const { kind, type } of rootTypes) {
269
+ const services = type && fieldServices.get(type.name);
270
+ if (!type || !services) continue;
271
+ for (const { fieldName, field, service } of exposedFields(type, services)) {
272
+ const inputFields = getInputFields(field);
273
+ const args = inputFields ?? field.args.map(operationArg);
274
+ const resultSubscription = kind === "mutation" ? pairs.get(fieldName) : void 0;
275
+ const scopes = fieldScopes.get(type.name)?.get(fieldName);
276
+ operations.push({
277
+ fieldName,
278
+ kind,
279
+ service,
280
+ description: field.description ?? "",
281
+ args,
282
+ inputWrapper: inputFields != null,
283
+ ...resultSubscription ? { resultSubscription } : {},
284
+ ...scopes ? { scopes } : {}
285
+ });
286
+ }
287
+ }
288
+ return operations.sort(
289
+ (a, b) => a.service.localeCompare(b.service) || a.fieldName.localeCompare(b.fieldName) || KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind)
290
+ );
291
+ }
292
+
293
+ // src/graphql/query-builder.ts
294
+ import {
295
+ astFromValue,
296
+ isAbstractType,
297
+ isEnumType as isEnumType2,
298
+ isListType as isListType2,
299
+ isNonNullType as isNonNullType2,
300
+ isObjectType as isObjectType2,
301
+ isScalarType,
302
+ Kind,
303
+ parse,
304
+ print,
305
+ TypeInfo,
306
+ visit,
307
+ visitWithTypeInfo
308
+ } from "graphql";
309
+ var CLI_OPERATION_PREFIX = "SlCli_";
310
+ function unwrap2(type) {
311
+ if (isNonNullType2(type)) return unwrap2(type.ofType);
312
+ if (isListType2(type)) return unwrap2(type.ofType);
313
+ return type;
314
+ }
315
+ function isLeaf(type) {
316
+ return isScalarType(type) || isEnumType2(type);
317
+ }
318
+ function ucfirst(s) {
319
+ return s.charAt(0).toUpperCase() + s.slice(1);
320
+ }
321
+ var PAYLOAD_TYPE_PATTERN = /(?:Response|Payload|MutationPayload)$/;
322
+ var PAYLOAD_PLUMBING = /* @__PURE__ */ new Set(["id", "clientMutationId"]);
323
+ function effectiveDepth(returnType, depth) {
324
+ return isObjectType2(returnType) && PAYLOAD_TYPE_PATTERN.test(returnType.name) ? depth + 1 : depth;
325
+ }
326
+ function buildSelections(type, schema, depth, exclude, prefix, totalCount, visited) {
327
+ if (!isObjectType2(type)) return [];
328
+ if (visited.has(type.name)) return [];
329
+ visited.add(type.name);
330
+ const fields = type.getFields();
331
+ const lines = [];
332
+ const isPayload = PAYLOAD_TYPE_PATTERN.test(type.name);
333
+ if (isConnection(type)) {
334
+ const nodesType = unwrap2(fields.nodes.type);
335
+ const nodeSelections = buildSelections(
336
+ nodesType,
337
+ schema,
338
+ depth,
339
+ exclude,
340
+ `${prefix}nodes.`,
341
+ totalCount,
342
+ new Set(visited)
343
+ );
344
+ return connectionSelections(type, nodeSelections, totalCount);
345
+ }
346
+ for (const [name, field] of Object.entries(fields)) {
347
+ if (name.startsWith("__")) continue;
348
+ if (isPayload && PAYLOAD_PLUMBING.has(name)) continue;
349
+ const fullPath = `${prefix}${name}`;
350
+ if (exclude.has(fullPath) || exclude.has(name)) continue;
351
+ if (!isAutoSelectable(field)) continue;
352
+ const namedType = unwrap2(field.type);
353
+ if (isLeaf(namedType)) {
354
+ lines.push(name);
355
+ } else if (isObjectType2(namedType) && isConnection(namedType) && field.args.length === 0) {
356
+ const pageSelections = buildSelections(
357
+ namedType,
358
+ schema,
359
+ depth,
360
+ exclude,
361
+ `${fullPath}.`,
362
+ totalCount,
363
+ new Set(visited)
364
+ );
365
+ if (pageSelections.length > 0) {
366
+ lines.push(`${name} {`);
367
+ for (const sel of pageSelections) lines.push(` ${sel}`);
368
+ lines.push(`}`);
369
+ }
370
+ } else if (isObjectType2(namedType) && depth > 0) {
371
+ const subSelections = buildSelections(
372
+ namedType,
373
+ schema,
374
+ depth - 1,
375
+ exclude,
376
+ `${fullPath}.`,
377
+ totalCount,
378
+ new Set(visited)
379
+ );
380
+ if (subSelections.length > 0) {
381
+ lines.push(`${fieldCall(name, field)} {`);
382
+ for (const sel of subSelections) lines.push(` ${sel}`);
383
+ lines.push(`}`);
384
+ }
385
+ } else if (isAbstractType(namedType) && depth > 0) {
386
+ lines.push(`${name} {`);
387
+ for (const sel of abstractSelections(
388
+ namedType,
389
+ schema,
390
+ depth - 1,
391
+ exclude,
392
+ `${fullPath}.`,
393
+ totalCount,
394
+ visited
395
+ )) {
396
+ lines.push(` ${sel}`);
397
+ }
398
+ lines.push(`}`);
399
+ }
400
+ }
401
+ return lines;
402
+ }
403
+ function abstractSelections(type, schema, depth, exclude, prefix, totalCount, visited) {
404
+ const lines = ["__typename"];
405
+ for (const member of schema.getPossibleTypes(type)) {
406
+ const memberSelections = buildSelections(member, schema, depth, exclude, prefix, totalCount, new Set(visited));
407
+ if (memberSelections.length === 0) continue;
408
+ lines.push(`... on ${member.name} {`);
409
+ for (const sel of memberSelections) lines.push(` ${sel}`);
410
+ lines.push(`}`);
411
+ }
412
+ return lines;
413
+ }
414
+ var NESTED_PAGE_SIZE = 10;
415
+ function fieldCall(name, field) {
416
+ const named = unwrap2(field.type);
417
+ const pageable = isObjectType2(named) && isConnection(named) && field.args.some((a) => a.name === "first");
418
+ return pageable ? `${name}(first: ${NESTED_PAGE_SIZE})` : name;
419
+ }
420
+ function deliveredPageField(type) {
421
+ const pages = Object.values(type.getFields()).filter((field) => {
422
+ const named = unwrap2(field.type);
423
+ return isObjectType2(named) && isConnection(named) && field.args.length === 0;
424
+ });
425
+ return pages.length === 1 ? pages[0] : null;
426
+ }
427
+ function isConnection(type) {
428
+ const fields = type.getFields();
429
+ return Boolean(fields.nodes) && Boolean(fields.pageInfo);
430
+ }
431
+ function isAutoSelectable(field) {
432
+ if (field.name.startsWith("__") || field.deprecationReason != null) return false;
433
+ return !field.args.some((a) => isNonNullType2(a.type) && a.defaultValue === void 0);
434
+ }
435
+ function selectableFields(type) {
436
+ return Object.values(type.getFields()).filter(isAutoSelectable);
437
+ }
438
+ function edgeExtras(connection) {
439
+ const edgesField = connection.getFields().edges;
440
+ if (!edgesField) return null;
441
+ const edge = unwrap2(edgesField.type);
442
+ if (!isObjectType2(edge)) return null;
443
+ const lines = [];
444
+ for (const field of selectableFields(edge)) {
445
+ if (field.name === "node" || field.name === "cursor" || field.name === "id") continue;
446
+ const named = unwrap2(field.type);
447
+ if (isLeaf(named)) {
448
+ lines.push(field.name);
449
+ } else if (isObjectType2(named)) {
450
+ const leaves = selectableFields(named).filter((sub) => isLeaf(unwrap2(sub.type))).map((sub) => sub.name);
451
+ if (leaves.length > 0) lines.push(`${field.name} { ${leaves.join(" ")} }`);
452
+ }
453
+ }
454
+ return lines.length === 0 ? null : { edge, lines };
455
+ }
456
+ function connectionSelections(connection, nodeSelections, totalCount) {
457
+ if (nodeSelections.length === 0) return [];
458
+ const lines = [];
459
+ const extras = edgeExtras(connection);
460
+ if (extras) {
461
+ lines.push("edges {");
462
+ lines.push(" node {");
463
+ for (const sel of nodeSelections) lines.push(` ${sel}`);
464
+ lines.push(" }");
465
+ for (const extra of extras.lines) lines.push(` ${extra}`);
466
+ lines.push("}");
467
+ } else {
468
+ lines.push("nodes {");
469
+ for (const sel of nodeSelections) lines.push(` ${sel}`);
470
+ lines.push("}");
471
+ }
472
+ lines.push("pageInfo {");
473
+ lines.push(" hasNextPage");
474
+ lines.push(" endCursor");
475
+ lines.push("}");
476
+ if (totalCount && connection.getFields().totalCount) lines.push("totalCount");
477
+ for (const extra of connectionExtras(connection)) lines.push(extra);
478
+ return lines;
479
+ }
480
+ var CONNECTION_PLUMBING = /* @__PURE__ */ new Set(["edges", "nodes", "pageInfo", "totalCount", "approximateTotalCount"]);
481
+ function isConnectionExtraPath(connection, nodesType, path) {
482
+ const [top] = path.split(".");
483
+ if (CONNECTION_PLUMBING.has(top)) return false;
484
+ if (isObjectType2(nodesType) && nodesType.getFields()[top]) return false;
485
+ return Boolean(connection.getFields()[top]);
486
+ }
487
+ function connectionExtras(connection) {
488
+ return selectableFields(connection).filter((field) => !CONNECTION_PLUMBING.has(field.name)).flatMap((field) => {
489
+ const named = unwrap2(field.type);
490
+ if (isLeaf(named)) return [field.name];
491
+ if (!isObjectType2(named)) return [];
492
+ const inner = selectableFields(named).flatMap((sub) => {
493
+ const subType = unwrap2(sub.type);
494
+ if (isLeaf(subType)) return [sub.name];
495
+ if (!isObjectType2(subType)) return [];
496
+ const leaves = selectableFields(subType).filter((leaf) => isLeaf(unwrap2(leaf.type)));
497
+ return leaves.length === 0 ? [] : [`${sub.name} { ${leaves.map((leaf) => leaf.name).join(" ")} }`];
498
+ });
499
+ return inner.length === 0 ? [] : [`${field.name} { ${inner.join(" ")} }`];
500
+ });
501
+ }
502
+ function fieldNamesOf(type) {
503
+ return isObjectType2(type) ? Object.keys(type.getFields()) : [];
504
+ }
505
+ var UnknownFieldError = class extends Error {
506
+ field;
507
+ suggestions;
508
+ constructor(field, type, candidates = fieldNamesOf(type)) {
509
+ const names = candidates.filter((name) => !name.startsWith("__"));
510
+ const needle = field.toLowerCase();
511
+ const suggestions = names.filter((name) => {
512
+ const candidate = name.toLowerCase();
513
+ return candidate.includes(needle) || needle.includes(candidate);
514
+ });
515
+ super(`${type.name} has no field "${field}".`);
516
+ this.name = "UnknownFieldError";
517
+ this.field = field;
518
+ this.suggestions = suggestions.length > 0 ? suggestions : names;
519
+ }
520
+ };
521
+ function rootTypeOf(schema, kind) {
522
+ if (kind === "query") return schema.getQueryType();
523
+ if (kind === "mutation") return schema.getMutationType();
524
+ return schema.getSubscriptionType();
525
+ }
526
+ function buildQuery(schema, kind, fieldName, variables, options = {}) {
527
+ const rootType = rootTypeOf(schema, kind);
528
+ if (!rootType) throw new Error(`No ${kind} type in schema`);
529
+ const field = rootType.getFields()[fieldName];
530
+ if (!field) throw new Error(`Unknown ${kind} field: ${fieldName}`);
531
+ const returnType = unwrap2(field.type);
532
+ const depth = effectiveDepth(returnType, options.depth ?? 0);
533
+ const exclude = new Set(options.exclude ?? []);
534
+ const wantsTotalCount = options.totalCount === true;
535
+ const allArgs = field.args;
536
+ const varDefsInner = allArgs.map((a) => `$${a.name}: ${a.type.toString()}`).join(", ");
537
+ const fieldArgsInner = allArgs.map((a) => `${a.name}: $${a.name}`).join(", ");
538
+ const varDefs = allArgs.length > 0 ? `(${varDefsInner})` : "";
539
+ const fieldArgs = allArgs.length > 0 ? `(${fieldArgsInner})` : "";
540
+ let selectionBody;
541
+ if (isLeaf(returnType)) {
542
+ selectionBody = ` ${fieldName}${fieldArgs}`;
543
+ } else if (isAbstractType(returnType)) {
544
+ const indent = " ";
545
+ const body = abstractSelections(returnType, schema, depth, exclude, "", wantsTotalCount, /* @__PURE__ */ new Set()).map((s) => `${indent}${s}`).join("\n");
546
+ selectionBody = ` ${fieldName}${fieldArgs} {
547
+ ${body}
548
+ }`;
549
+ } else {
550
+ let selections;
551
+ if (options.fields && options.fields.length > 0) {
552
+ selections = buildFieldsFromList(returnType, schema, options.fields, wantsTotalCount);
553
+ } else {
554
+ selections = buildSelections(returnType, schema, depth, exclude, "", wantsTotalCount, /* @__PURE__ */ new Set());
555
+ }
556
+ if (selections.length === 0) {
557
+ selectionBody = ` ${fieldName}${fieldArgs} {
558
+ __typename
559
+ }`;
560
+ } else {
561
+ const indent = " ";
562
+ const body = selections.map((s) => `${indent}${s}`).join("\n");
563
+ selectionBody = ` ${fieldName}${fieldArgs} {
564
+ ${body}
565
+ }`;
566
+ }
567
+ }
568
+ const opName = `${CLI_OPERATION_PREFIX}${ucfirst(fieldName)}`;
569
+ const query = `${kind} ${opName}${varDefs} {
570
+ ${selectionBody}
571
+ }`;
572
+ if (options.reveal !== void 0)
573
+ return { query: withNestedReveal(schema, query, options.reveal), variables, fieldName };
574
+ return { query, variables, fieldName };
575
+ }
576
+ function revealValue(argument, reveal) {
577
+ let value;
578
+ try {
579
+ value = astFromValue(reveal, argument.type);
580
+ } catch (err) {
581
+ throw new Error(`Cannot write reveal ${JSON.stringify(reveal)}: ${err.message}`, { cause: err });
582
+ }
583
+ if (!value) throw new Error(`Cannot write reveal ${JSON.stringify(reveal)} as ${argument.type.toString()}.`);
584
+ return value;
585
+ }
586
+ function withNestedReveal(schema, query, reveal) {
587
+ const typeInfo = new TypeInfo(schema);
588
+ const revealed = visit(
589
+ parse(query),
590
+ visitWithTypeInfo(typeInfo, {
591
+ Field(node, _key, _parent, _path, ancestors) {
592
+ const nested = ancestors.some((ancestor) => "kind" in ancestor && ancestor.kind === Kind.FIELD);
593
+ const argument = typeInfo.getFieldDef()?.args.find((arg) => arg.name === "reveal");
594
+ if (!nested || !argument) return void 0;
595
+ const written = {
596
+ kind: Kind.ARGUMENT,
597
+ name: { kind: Kind.NAME, value: argument.name },
598
+ value: revealValue(argument, reveal)
599
+ };
600
+ const others = (node.arguments ?? []).filter((arg) => arg.name.value !== argument.name);
601
+ return { ...node, arguments: [...others, written] };
602
+ }
603
+ })
604
+ );
605
+ return print(revealed);
606
+ }
607
+ function buildFieldsFromList(type, schema, requestedPaths, totalCount) {
608
+ if (!isObjectType2(type)) return [];
609
+ const fields = type.getFields();
610
+ const page = deliveredPageField(type);
611
+ const fieldPaths = page ? requestedPaths.map((path) => fields[path.split(".")[0]] ? path : `${page.name}.${path}`) : requestedPaths;
612
+ if (isConnection(type)) {
613
+ const nodesType = unwrap2(fields.nodes.type);
614
+ const nodePaths = fieldPaths.filter((path) => !isConnectionExtraPath(type, nodesType, path));
615
+ const withId = isObjectType2(nodesType) && nodesType.getFields().id && !nodePaths.includes("id");
616
+ const nodeSelections = buildFieldsFromList(
617
+ nodesType,
618
+ schema,
619
+ withId ? ["id", ...nodePaths] : nodePaths,
620
+ totalCount
621
+ );
622
+ return connectionSelections(type, nodeSelections, totalCount);
623
+ }
624
+ const lines = [];
625
+ const grouped = /* @__PURE__ */ new Map();
626
+ for (const fp of fieldPaths) {
627
+ const [top, ...rest] = fp.split(".");
628
+ if (!grouped.has(top)) grouped.set(top, []);
629
+ if (rest.length > 0) grouped.get(top).push(rest.join("."));
630
+ }
631
+ for (const [name, subPaths] of grouped) {
632
+ const field = fields[name];
633
+ if (!field) throw new UnknownFieldError(name, type);
634
+ const namedType = unwrap2(field.type);
635
+ if (isLeaf(namedType)) {
636
+ lines.push(name);
637
+ } else if (isObjectType2(namedType) && subPaths.length > 0) {
638
+ const subSelections = buildFieldsFromList(namedType, schema, subPaths, totalCount);
639
+ if (subSelections.length > 0) {
640
+ lines.push(`${fieldCall(name, field)} {`);
641
+ for (const sel of subSelections) lines.push(` ${sel}`);
642
+ lines.push(`}`);
643
+ }
644
+ } else if (isAbstractType(namedType)) {
645
+ lines.push(`${name} {`);
646
+ for (const sel of abstractFieldsFromList(namedType, schema, subPaths, totalCount)) lines.push(` ${sel}`);
647
+ lines.push(`}`);
648
+ }
649
+ }
650
+ return lines;
651
+ }
652
+ function abstractFieldsFromList(type, schema, subPaths, totalCount) {
653
+ const members = schema.getPossibleTypes(type);
654
+ if (subPaths.length === 0) {
655
+ return abstractSelections(type, schema, 0, /* @__PURE__ */ new Set(), "", totalCount, /* @__PURE__ */ new Set());
656
+ }
657
+ const lines = ["__typename"];
658
+ const claimed = /* @__PURE__ */ new Set();
659
+ for (const member of members) {
660
+ const known = subPaths.filter((fp) => Boolean(member.getFields()[fp.split(".")[0]]));
661
+ if (known.length === 0) continue;
662
+ for (const fp of known) claimed.add(fp);
663
+ lines.push(`... on ${member.name} {`);
664
+ for (const sel of buildFieldsFromList(member, schema, known, totalCount)) lines.push(` ${sel}`);
665
+ lines.push(`}`);
666
+ }
667
+ const unknown = subPaths.find((fp) => !claimed.has(fp));
668
+ if (unknown !== void 0) {
669
+ throw new UnknownFieldError(unknown.split(".")[0], type, members.flatMap(fieldNamesOf));
670
+ }
671
+ return lines;
672
+ }
673
+
674
+ // src/core/run-operation.ts
675
+ import { randomUUID } from "crypto";
676
+ import { setTimeout as delay } from "timers/promises";
677
+ import { isDeepStrictEqual } from "util";
678
+ var ResultNotDeliveredError = class extends Error {
679
+ subscription;
680
+ constructor(subscription) {
681
+ super(`${subscription} closed without delivering a result.`);
682
+ this.name = "ResultNotDeliveredError";
683
+ this.subscription = subscription;
684
+ }
685
+ };
686
+ function isAbort(err) {
687
+ return err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError");
688
+ }
689
+ function isDroppedStream(err) {
690
+ if (!(err instanceof Error) || isAbort(err)) return false;
691
+ const code = err.cause?.code;
692
+ return err.message === "terminated" || code === "UND_ERR_SOCKET" || code === "ECONNRESET";
693
+ }
694
+ function nextPageCursor(result) {
695
+ if (!isRecord(result)) return null;
696
+ for (const value of Object.values(result)) {
697
+ const pageInfo = isRecord(value) && isRecord(value.pageInfo) ? value.pageInfo : null;
698
+ if (pageInfo?.hasNextPage === true && typeof pageInfo.endCursor === "string") return pageInfo.endCursor;
699
+ }
700
+ return null;
701
+ }
702
+ function deadlineAfter(seconds, signal) {
703
+ const controller = new AbortController();
704
+ let expired = false;
705
+ const timer = setTimeout(() => {
706
+ expired = true;
707
+ controller.abort();
708
+ }, seconds * 1e3);
709
+ const forward = () => controller.abort(signal?.reason);
710
+ if (signal?.aborted) forward();
711
+ signal?.addEventListener("abort", forward, { once: true });
712
+ return {
713
+ signal: controller.signal,
714
+ timedOut: () => expired,
715
+ stop: () => {
716
+ clearTimeout(timer);
717
+ signal?.removeEventListener("abort", forward);
718
+ controller.abort();
719
+ }
720
+ };
721
+ }
722
+ function abortReasonOr(err, signal) {
723
+ return signal?.aborted ? signal.reason : err;
724
+ }
725
+ var RECONNECT_DELAYS_MS = [500, 1e3, 2e3];
726
+ function reconnectDelay(attempts) {
727
+ return RECONNECT_DELAYS_MS[Math.min(attempts, RECONNECT_DELAYS_MS.length - 1)];
728
+ }
729
+ var GATEWAY_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
730
+ function reconnectable(err) {
731
+ if (isDroppedStream(err)) return true;
732
+ if (!(err instanceof RouterError)) return false;
733
+ return err.kind === "unreachable" || err.kind === "http" && GATEWAY_STATUSES.has(err.httpStatus ?? 0);
734
+ }
735
+ async function subscribeWithin(deadline, client, query, variables, signal, options) {
736
+ const open = () => client.openSubscription(query, variables, deadline.signal);
737
+ const giveUpUnlessReconnectable = (err) => {
738
+ if (signal?.aborted) throw signal.reason;
739
+ if (deadline.timedOut() || !reconnectable(err)) throw err;
740
+ };
741
+ let first;
742
+ try {
743
+ first = await open();
744
+ } catch (err) {
745
+ throw abortReasonOr(err, signal);
746
+ }
747
+ let attempts = 0;
748
+ async function reopen() {
749
+ for (; ; ) {
750
+ try {
751
+ await delay(reconnectDelay(attempts), void 0, { signal: deadline.signal });
752
+ attempts += 1;
753
+ return await open();
754
+ } catch (err) {
755
+ giveUpUnlessReconnectable(err);
756
+ }
757
+ }
758
+ }
759
+ async function* events() {
760
+ let current = first;
761
+ for (; ; ) {
762
+ try {
763
+ for await (const event of current) {
764
+ attempts = 0;
765
+ yield event;
766
+ }
767
+ return;
768
+ } catch (err) {
769
+ giveUpUnlessReconnectable(err);
770
+ }
771
+ current = await reopen();
772
+ options.onReopen?.();
773
+ }
774
+ }
775
+ return events();
776
+ }
777
+ async function listen(client, query, variables, seconds, signal, options = {}) {
778
+ const deadline = deadlineAfter(seconds, signal);
779
+ try {
780
+ const events = await subscribeWithin(deadline, client, query, variables, signal, options);
781
+ return { events, stop: deadline.stop, timedOut: deadline.timedOut, signal: deadline.signal };
782
+ } catch (err) {
783
+ deadline.stop();
784
+ throw err;
785
+ }
786
+ }
787
+ function wrap(spec, args) {
788
+ return spec.inputWrapper ? { input: args } : args;
789
+ }
790
+ function withPageStatus(schema, subscription, selection) {
791
+ if (!selection.fields || selection.fields.includes(PAGE_STATUS_FIELD)) return selection;
792
+ if (!deliversFillingPages(schema, subscription)) return selection;
793
+ return { ...selection, fields: [...selection.fields, PAGE_STATUS_FIELD] };
794
+ }
795
+ function timedOutBy(err, deadline) {
796
+ const cause = err instanceof Error ? err.cause : void 0;
797
+ return deadline.timedOut() && (isAbort(err) || isAbort(cause));
798
+ }
799
+ function edgeCount(data) {
800
+ if (!isRecord(data)) return 0;
801
+ let count = 0;
802
+ for (const value of Object.values(data)) {
803
+ const edges = isRecord(value) ? value.edges ?? value.nodes : void 0;
804
+ if (Array.isArray(edges)) count += edges.length;
805
+ }
806
+ return count;
807
+ }
808
+ function supersedes(page, current, byArrival) {
809
+ if (!current) return true;
810
+ if (page.filling !== current.filling) return !page.filling;
811
+ if (byArrival) return true;
812
+ const more = page.filling ? edgeCount(page.data) - edgeCount(current.data) : 0;
813
+ return more > 0 || more === 0 && page.streamed;
814
+ }
815
+ function offer(wait, page) {
816
+ if (wait.ended || !supersedes(page, wait.latest, wait.byArrival)) return;
817
+ wait.latest = page;
818
+ if (!wait.onPage || wait.delivered.some((seen) => isDeepStrictEqual(seen, page.data))) return;
819
+ wait.delivered.push(page.data);
820
+ wait.onPage(page.data);
821
+ }
822
+ function completed(wait) {
823
+ return wait.latest?.filling === false;
824
+ }
825
+ function whenAborted(signal) {
826
+ return new Promise((_, reject) => {
827
+ if (signal.aborted) reject(signal.reason);
828
+ else signal.addEventListener("abort", () => reject(signal.reason), { once: true });
829
+ });
830
+ }
831
+ var StoredReads = class {
832
+ constructor(wait, read, signal) {
833
+ this.wait = wait;
834
+ this.read = read;
835
+ this.signal = signal;
836
+ this.completed = new Promise((resolve) => {
837
+ this.finish = resolve;
838
+ });
839
+ this.failed = new Promise((_, reject) => {
840
+ this.fail = reject;
841
+ });
842
+ this.failed.catch(() => void 0);
843
+ }
844
+ wait;
845
+ read;
846
+ signal;
847
+ completed;
848
+ failed;
849
+ finish = () => void 0;
850
+ fail = () => void 0;
851
+ inflight = /* @__PURE__ */ new Set();
852
+ started = 0;
853
+ newestSettled = 0;
854
+ start() {
855
+ this.started += 1;
856
+ const reading = this.take(this.started).catch((err) => this.fail(err)).finally(() => this.inflight.delete(reading));
857
+ this.inflight.add(reading);
858
+ }
859
+ settled() {
860
+ return Promise.race([Promise.allSettled([...this.inflight]), this.failed, whenAborted(this.signal)]);
861
+ }
862
+ async take(order) {
863
+ let result;
864
+ try {
865
+ result = await this.read(this.signal);
866
+ } catch (err) {
867
+ if (!this.signal.aborted) this.settle(order, err);
868
+ return;
869
+ }
870
+ if (this.signal.aborted) return;
871
+ this.settle(order, void 0);
872
+ if (result?.state !== "complete" && result?.state !== "filling") return;
873
+ try {
874
+ offer(this.wait, {
875
+ data: result.data,
876
+ nextCursor: result.nextCursor,
877
+ filling: result.state === "filling",
878
+ streamed: false
879
+ });
880
+ } catch (err) {
881
+ this.fail(err);
882
+ }
883
+ if (completed(this.wait)) this.finish();
884
+ }
885
+ settle(order, failure) {
886
+ if (order < this.newestSettled) return;
887
+ this.newestSettled = order;
888
+ this.wait.readFailure = failure;
889
+ }
890
+ };
891
+ async function follow(events, wait, fieldName) {
892
+ for await (const data of events) {
893
+ if (!(fieldName in data)) continue;
894
+ const delivered = data[fieldName];
895
+ offer(wait, {
896
+ data: delivered,
897
+ nextCursor: nextPageCursor(delivered),
898
+ filling: isStillFilling(delivered),
899
+ streamed: true
900
+ });
901
+ if (completed(wait)) return;
902
+ }
903
+ }
904
+ function withExternalId(input, subscription) {
905
+ const args = { ...input.args };
906
+ if (subscription !== void 0 && typeof args.externalId !== "string") {
907
+ args.externalId = (input.newExternalId ?? (() => `sl-${randomUUID()}`))();
908
+ }
909
+ return args;
910
+ }
911
+ async function runWithoutWaiting(input, variables, externalId) {
912
+ const { schema, spec, client } = input;
913
+ const built = buildQuery(schema, spec.kind, spec.fieldName, variables, input.selection);
914
+ const data = await client.execute(built.query, built.variables, input.signal);
915
+ const done = { state: "done", data: data[built.fieldName] };
916
+ return externalId === void 0 ? done : { ...done, externalId };
917
+ }
918
+ async function runOperation(input) {
919
+ try {
920
+ return await runUntilSettled(input);
921
+ } catch (err) {
922
+ throw abortReasonOr(err, input.signal);
923
+ }
924
+ }
925
+ async function runUntilSettled(input) {
926
+ const { spec, waitSeconds } = input;
927
+ if (spec.kind === "subscription") {
928
+ throw new Error(`${spec.fieldName} is a subscription: listen to it rather than run it.`);
929
+ }
930
+ const subscription = spec.resultSubscription;
931
+ const args = withExternalId(input, subscription);
932
+ const variables = wrap(spec, args);
933
+ if (subscription === void 0 || waitSeconds === void 0) {
934
+ const externalId = subscription === void 0 ? void 0 : args.externalId;
935
+ return runWithoutWaiting(input, variables, externalId);
936
+ }
937
+ return runWaiting(input, subscription, args, variables, waitSeconds);
938
+ }
939
+ async function runWaiting(input, subscription, args, variables, waitSeconds) {
940
+ const { schema, spec, client } = input;
941
+ const externalId = args.externalId;
942
+ const subscriptionVariables = subscriptionVariablesFor(schema, subscription, args, externalId);
943
+ const listened = buildQuery(
944
+ schema,
945
+ "subscription",
946
+ subscription,
947
+ subscriptionVariables,
948
+ withPageStatus(schema, subscription, input.selection)
949
+ );
950
+ const reveal = input.selection.reveal;
951
+ const mutation = buildQuery(schema, spec.kind, spec.fieldName, variables, reveal === void 0 ? {} : { reveal });
952
+ const wait = { ended: false, byArrival: !input.readStored, delivered: [], onPage: input.onPage };
953
+ const deadline = deadlineAfter(waitSeconds, input.signal);
954
+ const reads = input.readStored ? new StoredReads(wait, input.readStored, deadline.signal) : void 0;
955
+ let opened = false;
956
+ try {
957
+ const events = await subscribeWithin(
958
+ deadline,
959
+ client,
960
+ listened.query,
961
+ listened.variables,
962
+ input.signal,
963
+ reads ? { onReopen: () => reads.start() } : {}
964
+ );
965
+ opened = true;
966
+ await client.execute(mutation.query, mutation.variables, input.signal);
967
+ const following = follow(events, wait, listened.fieldName);
968
+ if (reads) await followWithReads(following, reads, wait);
969
+ else await following;
970
+ } catch (err) {
971
+ if (input.signal?.aborted || !timedOutBy(err, deadline)) throw err;
972
+ if (!opened) throw notSent(err, spec.fieldName, subscription, waitSeconds);
973
+ if (!wait.latest) return { state: "pending", ended: "timeout", externalId };
974
+ return resultOf(wait.latest, externalId, "timeout");
975
+ } finally {
976
+ wait.ended = true;
977
+ deadline.stop();
978
+ }
979
+ return closedOn(wait, externalId, subscription);
980
+ }
981
+ async function followWithReads(following, reads, wait) {
982
+ following.catch(() => void 0);
983
+ reads.start();
984
+ await Promise.race([following, reads.completed, reads.failed]);
985
+ if (!completed(wait)) await reads.settled();
986
+ }
987
+ function notSent(cause, mutation, subscription, waitSeconds) {
988
+ return new RouterError(`${subscription} did not open within ${waitSeconds}s, so ${mutation} was not sent.`, {
989
+ kind: "unreachable",
990
+ code: "UNREACHABLE",
991
+ cause
992
+ });
993
+ }
994
+ function resultOf(latest, externalId, ended) {
995
+ const { data, nextCursor } = latest;
996
+ if (latest.filling) return { state: "filling", ended, externalId, data, nextCursor };
997
+ return { state: "complete", externalId, data, nextCursor };
998
+ }
999
+ function closedOn(wait, externalId, subscription) {
1000
+ if (!wait.latest) throw wait.readFailure ?? new ResultNotDeliveredError(subscription);
1001
+ return resultOf(wait.latest, externalId, "closed");
1002
+ }
1003
+
1004
+ // src/core/introspect.ts
1005
+ import { buildClientSchema, getIntrospectionQuery } from "graphql";
1006
+ async function fetchIntrospection(endpoint, token, fetchImpl = fetch, baseHeaders = {}) {
1007
+ const headers = withJsonBody(baseHeaders);
1008
+ if (token) setHeader(headers, "Authorization", `Bearer ${token}`);
1009
+ const res = await fetchImpl(endpoint, {
1010
+ method: "POST",
1011
+ headers,
1012
+ body: JSON.stringify({ query: getIntrospectionQuery({ oneOf: true }) })
1013
+ });
1014
+ if (!res.ok) {
1015
+ throw new Error(`Introspection failed: HTTP ${res.status} ${res.statusText}`);
1016
+ }
1017
+ const json = await res.json();
1018
+ if (json.errors?.length) {
1019
+ throw new Error(`Introspection errors: ${json.errors.map((e) => e.message).join(", ")}`);
1020
+ }
1021
+ if (!json.data) {
1022
+ throw new Error("Introspection returned no data");
1023
+ }
1024
+ return { introspection: json.data, raw: json.data };
1025
+ }
1026
+ var CLI_TAG = "cli";
1027
+ function isTaggedForCli(field) {
1028
+ return field.appliedDirectives?.some(
1029
+ (d) => d.name === "tag" && d.args.some((a) => a.name === "name" && a.value === CLI_TAG)
1030
+ ) ?? false;
1031
+ }
1032
+ function requiredScopes(field) {
1033
+ const value = field.appliedDirectives?.find((directive) => directive.name === "requiresScopes")?.args.find((arg) => arg.name === "scopes")?.value;
1034
+ const parsed = typeof value === "string" ? JSON.parse(value) : value;
1035
+ if (!Array.isArray(parsed)) return void 0;
1036
+ return parsed.filter(Array.isArray).map((alternative) => alternative.map(String));
1037
+ }
1038
+ function parseIntrospection(raw) {
1039
+ const fieldServices = /* @__PURE__ */ new Map();
1040
+ const fieldScopes = /* @__PURE__ */ new Map();
1041
+ const services = /* @__PURE__ */ new Set();
1042
+ for (const type of raw.__schema.types ?? []) {
1043
+ if (!type.fields?.length) continue;
1044
+ let fieldMap = null;
1045
+ let scopeMap = null;
1046
+ for (const field of type.fields) {
1047
+ const directive = field.appliedDirectives?.find((d) => d.name === "join__field");
1048
+ if (!directive) continue;
1049
+ const graphArg = directive.args.find((a) => a.name === "graph");
1050
+ if (!graphArg || typeof graphArg.value !== "string") continue;
1051
+ services.add(graphArg.value);
1052
+ if (!isTaggedForCli(field)) continue;
1053
+ fieldMap ??= /* @__PURE__ */ new Map();
1054
+ fieldMap.set(field.name, graphArg.value);
1055
+ const scopes = requiredScopes(field);
1056
+ if (scopes?.length) {
1057
+ scopeMap ??= /* @__PURE__ */ new Map();
1058
+ scopeMap.set(field.name, scopes);
1059
+ }
1060
+ }
1061
+ if (fieldMap) fieldServices.set(type.name, fieldMap);
1062
+ if (scopeMap) fieldScopes.set(type.name, scopeMap);
1063
+ }
1064
+ return { fieldServices, fieldScopes, services };
1065
+ }
1066
+ function buildIntrospected(introspection, raw) {
1067
+ try {
1068
+ const { fieldServices, fieldScopes, services } = parseIntrospection(raw);
1069
+ return { schema: buildClientSchema(introspection), fieldServices, fieldScopes, services };
1070
+ } catch {
1071
+ return null;
1072
+ }
1073
+ }
1074
+ async function introspect(endpoint, token, fetchImpl, headers) {
1075
+ const { introspection, raw } = await fetchIntrospection(endpoint, token, fetchImpl, headers);
1076
+ const built = buildIntrospected(introspection, raw);
1077
+ if (!built) throw new Error("introspection did not build");
1078
+ return built;
1079
+ }
1080
+
1081
+ export {
1082
+ codeOf,
1083
+ serviceOf,
1084
+ RouterError,
1085
+ parseEventStream,
1086
+ createRouterClient,
1087
+ unwrap,
1088
+ resultSubscriptions,
1089
+ subscriptionVariablesFor,
1090
+ isStillFilling,
1091
+ deliversFillingPages,
1092
+ listOperations,
1093
+ UnknownFieldError,
1094
+ buildQuery,
1095
+ ResultNotDeliveredError,
1096
+ isAbort,
1097
+ nextPageCursor,
1098
+ listen,
1099
+ runOperation,
1100
+ fetchIntrospection,
1101
+ requiredScopes,
1102
+ buildIntrospected,
1103
+ introspect
1104
+ };
1105
+ //# sourceMappingURL=chunk-RCCV6ET2.js.map