@soda-gql/core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,681 @@
1
+ import { Projection, SlicedExecutionResultEmpty, SlicedExecutionResultError, SlicedExecutionResultSuccess, VarRef, createExecutionResultParser, createVarAssignments, createVarRefs, handleProjectionBuilder, hidden, mapValues, mergeVarDefinitions } from "./slice-B0ZSKvG2.js";
2
+ import { Kind, OperationTypeNode } from "graphql";
3
+
4
+ //#region packages/core/src/composer/build-document.ts
5
+ const buildArgumentValue = (value) => {
6
+ if (value === void 0) return null;
7
+ if (value === null) return { kind: Kind.NULL };
8
+ if (value instanceof VarRef) return {
9
+ kind: Kind.VARIABLE,
10
+ name: {
11
+ kind: Kind.NAME,
12
+ value: value.name
13
+ }
14
+ };
15
+ if (Array.isArray(value)) return {
16
+ kind: Kind.LIST,
17
+ values: value.map((item) => buildArgumentValue(item)).filter((item) => item !== null)
18
+ };
19
+ if (typeof value === "object") return {
20
+ kind: Kind.OBJECT,
21
+ fields: Object.entries(value).map(([key, value$1]) => {
22
+ const valueNode = buildArgumentValue(value$1);
23
+ return valueNode ? {
24
+ kind: Kind.OBJECT_FIELD,
25
+ name: {
26
+ kind: Kind.NAME,
27
+ value: key
28
+ },
29
+ value: valueNode
30
+ } : null;
31
+ }).filter((item) => item !== null)
32
+ };
33
+ if (typeof value === "string") return {
34
+ kind: Kind.STRING,
35
+ value
36
+ };
37
+ if (typeof value === "number") return {
38
+ kind: !Number.isInteger(value) || value.toString().includes(".") ? Kind.FLOAT : Kind.INT,
39
+ value: value.toString()
40
+ };
41
+ if (typeof value === "boolean") return {
42
+ kind: Kind.BOOLEAN,
43
+ value
44
+ };
45
+ throw new Error(`Unknown value type: ${typeof value}`);
46
+ };
47
+ const buildArguments = (args) => Object.entries(args ?? {}).map(([name, value]) => {
48
+ const valueNode = buildArgumentValue(value);
49
+ return valueNode ? {
50
+ kind: Kind.ARGUMENT,
51
+ name: {
52
+ kind: Kind.NAME,
53
+ value: name
54
+ },
55
+ value: valueNode
56
+ } : null;
57
+ }).filter((item) => item !== null);
58
+ const buildUnionSelection = (union) => Object.entries(union).map(([typeName, object]) => {
59
+ return object ? {
60
+ kind: Kind.INLINE_FRAGMENT,
61
+ typeCondition: {
62
+ kind: Kind.NAMED_TYPE,
63
+ name: {
64
+ kind: Kind.NAME,
65
+ value: typeName
66
+ }
67
+ },
68
+ selectionSet: {
69
+ kind: Kind.SELECTION_SET,
70
+ selections: buildField(object)
71
+ }
72
+ } : null;
73
+ }).filter((item) => item !== null);
74
+ const buildField = (field) => Object.entries(field).map(([alias, { args, field: field$1, object, union }]) => ({
75
+ kind: Kind.FIELD,
76
+ name: {
77
+ kind: Kind.NAME,
78
+ value: field$1
79
+ },
80
+ alias: alias !== field$1 ? {
81
+ kind: Kind.NAME,
82
+ value: alias
83
+ } : void 0,
84
+ arguments: buildArguments(args),
85
+ selectionSet: object ? {
86
+ kind: Kind.SELECTION_SET,
87
+ selections: buildField(object)
88
+ } : union ? {
89
+ kind: Kind.SELECTION_SET,
90
+ selections: buildUnionSelection(union)
91
+ } : void 0
92
+ }));
93
+ const buildConstValueNode = (value) => {
94
+ if (value === void 0) return null;
95
+ if (value === null) return { kind: Kind.NULL };
96
+ if (typeof value === "string") return {
97
+ kind: Kind.STRING,
98
+ value
99
+ };
100
+ if (typeof value === "boolean") return {
101
+ kind: Kind.BOOLEAN,
102
+ value
103
+ };
104
+ if (typeof value === "number") return {
105
+ kind: !Number.isInteger(value) || value.toString().includes(".") ? Kind.FLOAT : Kind.INT,
106
+ value: value.toString()
107
+ };
108
+ if (Array.isArray(value)) return {
109
+ kind: Kind.LIST,
110
+ values: value.map((item) => buildConstValueNode(item)).filter((item) => item !== null)
111
+ };
112
+ if (typeof value === "object") return {
113
+ kind: Kind.OBJECT,
114
+ fields: Object.entries(value).map(([key, value$1]) => {
115
+ const valueNode = buildConstValueNode(value$1);
116
+ return valueNode ? {
117
+ kind: Kind.OBJECT_FIELD,
118
+ name: {
119
+ kind: Kind.NAME,
120
+ value: key
121
+ },
122
+ value: valueNode
123
+ } : null;
124
+ }).filter((item) => item !== null)
125
+ };
126
+ throw new Error(`Unknown value type: ${typeof value}`);
127
+ };
128
+ const buildWithTypeModifier = (modifier, buildType) => {
129
+ const baseType = buildType();
130
+ if (modifier === "?") return baseType;
131
+ let curr = {
132
+ modifier,
133
+ type: baseType
134
+ };
135
+ while (curr.modifier.length > 0) {
136
+ if (curr.modifier.startsWith("!")) {
137
+ curr = {
138
+ modifier: curr.modifier.slice(1),
139
+ type: curr.type.kind === Kind.NON_NULL_TYPE ? curr.type : {
140
+ kind: Kind.NON_NULL_TYPE,
141
+ type: curr.type
142
+ }
143
+ };
144
+ continue;
145
+ }
146
+ if (curr.modifier.startsWith("[]")) {
147
+ curr = {
148
+ modifier: curr.modifier.slice(2),
149
+ type: {
150
+ kind: Kind.LIST_TYPE,
151
+ type: curr.type
152
+ }
153
+ };
154
+ continue;
155
+ }
156
+ throw new Error(`Unknown modifier: ${curr.modifier}`);
157
+ }
158
+ return curr.type;
159
+ };
160
+ const buildVariables = (variables) => {
161
+ return Object.entries(variables).map(([name, ref]) => ({
162
+ kind: Kind.VARIABLE_DEFINITION,
163
+ variable: {
164
+ kind: Kind.VARIABLE,
165
+ name: {
166
+ kind: Kind.NAME,
167
+ value: name
168
+ }
169
+ },
170
+ defaultValue: ref.defaultValue && buildConstValueNode(ref.defaultValue.default) || void 0,
171
+ type: buildWithTypeModifier(ref.modifier, () => ({
172
+ kind: Kind.NAMED_TYPE,
173
+ name: {
174
+ kind: Kind.NAME,
175
+ value: ref.name
176
+ }
177
+ }))
178
+ }));
179
+ };
180
+ const buildOperationTypeNode = (operation) => {
181
+ switch (operation) {
182
+ case "query": return OperationTypeNode.QUERY;
183
+ case "mutation": return OperationTypeNode.MUTATION;
184
+ case "subscription": return OperationTypeNode.SUBSCRIPTION;
185
+ default: throw new Error(`Unknown operation type: ${operation}`);
186
+ }
187
+ };
188
+ const buildDocument = (options) => {
189
+ const { operationName, operationType, variables, fields } = options;
190
+ return {
191
+ kind: Kind.DOCUMENT,
192
+ definitions: [{
193
+ kind: Kind.OPERATION_DEFINITION,
194
+ operation: buildOperationTypeNode(operationType),
195
+ name: {
196
+ kind: Kind.NAME,
197
+ value: operationName
198
+ },
199
+ variableDefinitions: buildVariables(variables),
200
+ selectionSet: {
201
+ kind: Kind.SELECTION_SET,
202
+ selections: buildField(fields)
203
+ }
204
+ }]
205
+ };
206
+ };
207
+
208
+ //#endregion
209
+ //#region packages/core/src/types/element/gql-element.ts
210
+ const GQL_ELEMENT_FACTORY = Symbol("GQL_ELEMENT_FACTORY");
211
+ const GQL_ELEMENT_CONTEXT = Symbol("GQL_ELEMENT_CONTEXT");
212
+ var GqlElement = class GqlElement {
213
+ [GQL_ELEMENT_FACTORY];
214
+ [GQL_ELEMENT_CONTEXT] = null;
215
+ constructor(define$1) {
216
+ let cache = null;
217
+ this[GQL_ELEMENT_FACTORY] = (context) => {
218
+ if (cache) return cache.value;
219
+ const value = define$1(context);
220
+ cache = { value };
221
+ return value;
222
+ };
223
+ }
224
+ static setContext(element, context) {
225
+ element[GQL_ELEMENT_CONTEXT] = context;
226
+ }
227
+ static evaluate(element) {
228
+ GqlElement.get(element);
229
+ }
230
+ static get(element) {
231
+ const context = element[GQL_ELEMENT_CONTEXT];
232
+ return element[GQL_ELEMENT_FACTORY](context);
233
+ }
234
+ };
235
+
236
+ //#endregion
237
+ //#region packages/core/src/types/element/composed-operation.ts
238
+ var ComposedOperation = class ComposedOperation extends GqlElement {
239
+ constructor(define$1) {
240
+ super(define$1);
241
+ }
242
+ get operationType() {
243
+ return GqlElement.get(this).operationType;
244
+ }
245
+ get operationName() {
246
+ return GqlElement.get(this).operationName;
247
+ }
248
+ get variableNames() {
249
+ return GqlElement.get(this).variableNames;
250
+ }
251
+ get projectionPathGraph() {
252
+ return GqlElement.get(this).projectionPathGraph;
253
+ }
254
+ get document() {
255
+ return GqlElement.get(this).document;
256
+ }
257
+ get parse() {
258
+ return GqlElement.get(this).parse;
259
+ }
260
+ static create(define$1) {
261
+ return new ComposedOperation(define$1);
262
+ }
263
+ };
264
+
265
+ //#endregion
266
+ //#region packages/core/src/types/element/fields-builder.ts
267
+ const mergeFields = (fields) => Object.assign({}, ...fields);
268
+
269
+ //#endregion
270
+ //#region packages/core/src/types/element/inline-operation.ts
271
+ var InlineOperation = class InlineOperation extends GqlElement {
272
+ constructor(define$1) {
273
+ super(define$1);
274
+ }
275
+ get operationType() {
276
+ return GqlElement.get(this).operationType;
277
+ }
278
+ get operationName() {
279
+ return GqlElement.get(this).operationName;
280
+ }
281
+ get variableNames() {
282
+ return GqlElement.get(this).variableNames;
283
+ }
284
+ get documentSource() {
285
+ return GqlElement.get(this).documentSource;
286
+ }
287
+ get document() {
288
+ return GqlElement.get(this).document;
289
+ }
290
+ static create(define$1) {
291
+ return new InlineOperation(define$1);
292
+ }
293
+ };
294
+
295
+ //#endregion
296
+ //#region packages/core/src/types/element/model.ts
297
+ var Model = class Model extends GqlElement {
298
+ constructor(define$1) {
299
+ super(define$1);
300
+ }
301
+ get typename() {
302
+ return GqlElement.get(this).typename;
303
+ }
304
+ get fragment() {
305
+ return GqlElement.get(this).fragment;
306
+ }
307
+ get normalize() {
308
+ return GqlElement.get(this).normalize;
309
+ }
310
+ static create(define$1) {
311
+ return new Model(define$1);
312
+ }
313
+ };
314
+
315
+ //#endregion
316
+ //#region packages/core/src/types/element/slice.ts
317
+ var Slice = class Slice extends GqlElement {
318
+ constructor(define$1) {
319
+ super(define$1);
320
+ }
321
+ get operationType() {
322
+ return GqlElement.get(this).operationType;
323
+ }
324
+ get embed() {
325
+ return GqlElement.get(this).embed;
326
+ }
327
+ static create(define$1) {
328
+ return new Slice(define$1);
329
+ }
330
+ };
331
+
332
+ //#endregion
333
+ //#region packages/core/src/composer/projection-path-graph.ts
334
+ function createPathGraph(paths) {
335
+ const intermediate = paths.reduce((acc, { label, raw, segments: [segment, ...segments] }) => {
336
+ if (segment) (acc[segment] || (acc[segment] = [])).push({
337
+ label,
338
+ raw,
339
+ segments
340
+ });
341
+ return acc;
342
+ }, {});
343
+ return {
344
+ matches: paths.map(({ label, raw, segments }) => ({
345
+ label,
346
+ path: raw,
347
+ exact: segments.length === 0
348
+ })),
349
+ children: mapValues(intermediate, (paths$1) => createPathGraph(paths$1))
350
+ };
351
+ }
352
+ function createPathGraphFromSliceEntries(fragments) {
353
+ return createPathGraph(Object.entries(fragments).flatMap(([label, slice]) => Array.from(new Map(slice.projection.paths.map(({ full: raw, segments }) => {
354
+ const [first, ...rest] = segments;
355
+ return [raw, {
356
+ label,
357
+ raw,
358
+ segments: [`${label}_${first}`, ...rest]
359
+ }];
360
+ })).values())));
361
+ }
362
+
363
+ //#endregion
364
+ //#region packages/core/src/composer/composed-operation.ts
365
+ const createComposedOperationComposerFactory = () => {
366
+ return (operationType) => {
367
+ return (options, builder) => {
368
+ return ComposedOperation.create(() => {
369
+ const { operationName } = options;
370
+ const variables = mergeVarDefinitions(options.variables ?? []);
371
+ const fragments = builder({ $: createVarRefs(variables) });
372
+ const fields = Object.fromEntries(Object.entries(fragments).flatMap(([label, { getFields: fields$1 }]) => Object.entries(fields$1).map(([key, reference]) => [`${label}_${key}`, reference])));
373
+ const projectionPathGraph = createPathGraphFromSliceEntries(fragments);
374
+ return {
375
+ operationType,
376
+ operationName,
377
+ variableNames: Object.keys(variables),
378
+ projectionPathGraph,
379
+ document: buildDocument({
380
+ operationName,
381
+ operationType,
382
+ variables,
383
+ fields
384
+ }),
385
+ parse: createExecutionResultParser({
386
+ fragments,
387
+ projectionPathGraph
388
+ })
389
+ };
390
+ });
391
+ };
392
+ };
393
+ };
394
+
395
+ //#endregion
396
+ //#region packages/core/src/utils/wrap-by-key.ts
397
+ const wrapByKey = (name, value) => ({ [name]: value });
398
+
399
+ //#endregion
400
+ //#region packages/core/src/composer/fields-builder.ts
401
+ const cacheMapBySchema = /* @__PURE__ */ new WeakMap();
402
+ const ensureCacheMapBySchema = (schema) => {
403
+ const cachedCacheMap = cacheMapBySchema.get(schema);
404
+ if (cachedCacheMap) return cachedCacheMap;
405
+ const cacheMap = /* @__PURE__ */ new Map();
406
+ cacheMapBySchema.set(schema, cacheMap);
407
+ return cacheMap;
408
+ };
409
+ const createFieldFactories = (schema, typeName) => {
410
+ const cacheMap = ensureCacheMapBySchema(schema);
411
+ const cached = cacheMap.get(typeName);
412
+ if (cached) return cached;
413
+ const factories = createFieldFactoriesInner(schema, typeName);
414
+ cacheMap.set(typeName, factories);
415
+ return factories;
416
+ };
417
+ const createFieldFactoriesInner = (schema, typeName) => {
418
+ const typeDef = schema.object[typeName];
419
+ if (!typeDef) throw new Error(`Type ${typeName} is not defined in schema objects`);
420
+ const entries = Object.entries(typeDef.fields).map(([fieldName, type]) => {
421
+ const factory = (fieldArgs, extras) => {
422
+ const wrap = (value) => wrapByKey(extras?.alias ?? fieldName, value);
423
+ if (type.kind === "object") {
424
+ const factoryReturn = ((nest) => wrap({
425
+ parent: typeName,
426
+ field: fieldName,
427
+ type,
428
+ args: fieldArgs ?? {},
429
+ directives: extras?.directives ?? {},
430
+ object: mergeFields(nest({ f: createFieldFactories(schema, type.name) })),
431
+ union: null
432
+ }));
433
+ return factoryReturn;
434
+ }
435
+ if (type.kind === "union") {
436
+ const factoryReturn = ((nest) => wrap({
437
+ parent: typeName,
438
+ field: fieldName,
439
+ type,
440
+ args: fieldArgs ?? {},
441
+ directives: extras?.directives ?? {},
442
+ object: null,
443
+ union: mapValues(nest, (builder, memberName) => {
444
+ if (!builder) throw new Error(`Builder is undefined for member name: ${memberName}`);
445
+ return mergeFields(builder({ f: createFieldFactories(schema, memberName) }));
446
+ })
447
+ }));
448
+ return factoryReturn;
449
+ }
450
+ if (type.kind === "scalar" || type.kind === "enum" || type.kind === "typename") return wrap({
451
+ parent: typeName,
452
+ field: fieldName,
453
+ type,
454
+ args: fieldArgs ?? {},
455
+ directives: extras?.directives ?? {},
456
+ object: null,
457
+ union: null
458
+ });
459
+ throw new Error(`Unsupported field type: ${type}`);
460
+ };
461
+ return [fieldName, factory];
462
+ });
463
+ return Object.fromEntries(entries);
464
+ };
465
+
466
+ //#endregion
467
+ //#region packages/core/src/composer/inline-operation.ts
468
+ const createInlineOperationComposerFactory = (schema) => {
469
+ return (operationType) => {
470
+ const operationTypeName = schema.operations[operationType];
471
+ if (operationTypeName === null) throw new Error(`Operation type ${operationType} is not defined in schema roots`);
472
+ return (options, fieldBuilder) => {
473
+ return InlineOperation.create(() => {
474
+ const { operationName } = options;
475
+ const variables = mergeVarDefinitions(options.variables ?? []);
476
+ const $ = createVarRefs(variables);
477
+ const fields = mergeFields(fieldBuilder({
478
+ f: createFieldFactories(schema, operationTypeName),
479
+ $
480
+ }));
481
+ return {
482
+ operationType,
483
+ operationName,
484
+ variableNames: Object.keys(variables),
485
+ documentSource: () => fields,
486
+ document: buildDocument({
487
+ operationName,
488
+ operationType,
489
+ variables,
490
+ fields
491
+ })
492
+ };
493
+ });
494
+ };
495
+ };
496
+ };
497
+
498
+ //#endregion
499
+ //#region packages/core/src/composer/model.ts
500
+ const createGqlModelComposers = (schema) => {
501
+ const createModelComposer = (typename) => {
502
+ return (options, builder, normalize) => Model.create(() => {
503
+ const varDefinitions = mergeVarDefinitions(options.variables ?? []);
504
+ return {
505
+ typename,
506
+ fragment: (variables) => {
507
+ return mergeFields(builder({
508
+ f: createFieldFactories(schema, typename),
509
+ $: createVarAssignments(varDefinitions, variables)
510
+ }));
511
+ },
512
+ normalize
513
+ };
514
+ });
515
+ };
516
+ return mapValues(schema.object, (_, typename) => createModelComposer(typename));
517
+ };
518
+
519
+ //#endregion
520
+ //#region packages/core/src/composer/slice.ts
521
+ const createSliceComposerFactory = (schema) => {
522
+ return (operationType) => {
523
+ const operationTypeName = schema.operations[operationType];
524
+ if (operationTypeName === null) throw new Error(`Operation type ${operationType} is not defined in schema roots`);
525
+ return (options, fieldBuilder, projectionBuilder) => Slice.create(() => {
526
+ const varDefinitions = mergeVarDefinitions(options.variables ?? []);
527
+ const projection = handleProjectionBuilder(projectionBuilder);
528
+ return {
529
+ operationType,
530
+ embed: (variables) => {
531
+ const fields = mergeFields(fieldBuilder({
532
+ f: createFieldFactories(schema, operationTypeName),
533
+ $: createVarAssignments(varDefinitions, variables)
534
+ }));
535
+ return {
536
+ variables,
537
+ getFields: () => fields,
538
+ projection
539
+ };
540
+ }
541
+ };
542
+ });
543
+ };
544
+ };
545
+
546
+ //#endregion
547
+ //#region packages/core/src/types/schema/type-modifier.ts
548
+ const parseModifiedTypeName = (nameAndModifier) => {
549
+ if (typeof nameAndModifier !== "string") throw new Error(`Invalid modified type name: ${nameAndModifier}`);
550
+ const [name, modifier] = nameAndModifier.split(":");
551
+ return {
552
+ name,
553
+ modifier
554
+ };
555
+ };
556
+
557
+ //#endregion
558
+ //#region packages/core/src/composer/var-builder.ts
559
+ const createVarBuilder = (schema) => {
560
+ const $ = (varName) => {
561
+ const createRefBuilder = (kind) => {
562
+ return (type, extras) => wrapByKey(varName, {
563
+ kind,
564
+ ...parseModifiedTypeName(type),
565
+ defaultValue: extras?.default ? { default: extras.default() } : null,
566
+ directives: extras?.directives ?? {}
567
+ });
568
+ };
569
+ return {
570
+ scalar: createRefBuilder("scalar"),
571
+ enum: createRefBuilder("enum"),
572
+ input: createRefBuilder("input"),
573
+ byField: (typeName, fieldName, argName) => {
574
+ const argTypeRef = schema.object[typeName]?.fields[fieldName]?.arguments[argName];
575
+ if (!argTypeRef) throw new Error(`Argument ${argName} not found in field ${fieldName} of type ${typeName}`);
576
+ return { ...argTypeRef };
577
+ }
578
+ };
579
+ };
580
+ return { $ };
581
+ };
582
+
583
+ //#endregion
584
+ //#region packages/core/src/composer/gql-composer.ts
585
+ const createGqlElementComposer = (schema) => {
586
+ const model = createGqlModelComposers(schema);
587
+ const createSliceComposer = createSliceComposerFactory(schema);
588
+ const createComposedOperationFactory = createComposedOperationComposerFactory();
589
+ const createInlineOperationComposer = createInlineOperationComposerFactory(schema);
590
+ const composers = {
591
+ model,
592
+ query: {
593
+ slice: createSliceComposer("query"),
594
+ composed: createComposedOperationFactory("query"),
595
+ inline: createInlineOperationComposer("query")
596
+ },
597
+ mutation: {
598
+ slice: createSliceComposer("mutation"),
599
+ composed: createComposedOperationFactory("mutation"),
600
+ inline: createInlineOperationComposer("mutation")
601
+ },
602
+ subscription: {
603
+ slice: createSliceComposer("subscription"),
604
+ composed: createComposedOperationFactory("subscription"),
605
+ inline: createInlineOperationComposer("subscription")
606
+ }
607
+ };
608
+ const helper = { ...createVarBuilder(schema) };
609
+ const elementComposer = (composeElement) => composeElement(composers, helper);
610
+ return elementComposer;
611
+ };
612
+
613
+ //#endregion
614
+ //#region packages/core/src/schema/type-specifier-builder.ts
615
+ const createUnsafeInputTypeSpecifierFactory = (kind) => {
616
+ return (type, extras) => ({
617
+ kind,
618
+ ...parseModifiedTypeName(type),
619
+ defaultValue: extras.default ? { default: extras.default() } : null,
620
+ directives: extras.directives ?? {}
621
+ });
622
+ };
623
+ const unsafeInputType = {
624
+ scalar: createUnsafeInputTypeSpecifierFactory("scalar"),
625
+ enum: createUnsafeInputTypeSpecifierFactory("enum"),
626
+ input: createUnsafeInputTypeSpecifierFactory("input")
627
+ };
628
+ const createUnsafeOutputTypeSpecifierFactory = (kind) => {
629
+ return (type, extras) => ({
630
+ kind,
631
+ ...parseModifiedTypeName(type),
632
+ arguments: extras.arguments ?? {},
633
+ directives: extras.directives ?? {}
634
+ });
635
+ };
636
+ const unsafeOutputType = {
637
+ scalar: createUnsafeOutputTypeSpecifierFactory("scalar"),
638
+ enum: createUnsafeOutputTypeSpecifierFactory("enum"),
639
+ object: createUnsafeOutputTypeSpecifierFactory("object"),
640
+ union: createUnsafeOutputTypeSpecifierFactory("union"),
641
+ typename: createUnsafeOutputTypeSpecifierFactory("typename")
642
+ };
643
+
644
+ //#endregion
645
+ //#region packages/core/src/schema/schema-builder.ts
646
+ const defineScalar = (name, definition) => wrapByKey(name, {
647
+ _type: hidden(),
648
+ name,
649
+ directives: definition({ type: hidden }).directives
650
+ });
651
+ const define = (name) => ({
652
+ enum: (values, directives) => ({
653
+ _type: hidden(),
654
+ name,
655
+ values,
656
+ directives
657
+ }),
658
+ input: (fields, directives) => ({
659
+ name,
660
+ fields,
661
+ directives
662
+ }),
663
+ object: (fields, directives) => ({
664
+ name,
665
+ fields: {
666
+ __typename: unsafeOutputType.typename(`${name}:!`, {}),
667
+ ...fields
668
+ },
669
+ directives
670
+ }),
671
+ union: (types, directives) => ({
672
+ name,
673
+ types,
674
+ directives
675
+ })
676
+ });
677
+ const defineOperationRoots = (operationRoots) => operationRoots;
678
+
679
+ //#endregion
680
+ export { ComposedOperation, GqlElement, InlineOperation, Model, Projection, Slice, SlicedExecutionResultEmpty, SlicedExecutionResultError, SlicedExecutionResultSuccess, buildArgumentValue, buildConstValueNode, buildDocument, buildOperationTypeNode, buildWithTypeModifier, createComposedOperationComposerFactory, createFieldFactories, createGqlElementComposer, createGqlModelComposers, createPathGraphFromSliceEntries, createSliceComposerFactory, createVarAssignments, createVarBuilder, createVarRefs, define, defineOperationRoots, defineScalar, mergeFields, mergeVarDefinitions, unsafeInputType, unsafeOutputType };
681
+ //# sourceMappingURL=index.js.map