@soda-gql/runtime 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/LICENSE +21 -0
- package/dist/index.cjs +308 -0
- package/dist/index.d.cts +601 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +601 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +307 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { FormattedExecutionResult, GraphQLFormattedError, TypedQueryDocumentNode } from "graphql";
|
|
2
|
+
|
|
3
|
+
//#region packages/core/src/types/element/gql-element.d.ts
|
|
4
|
+
declare const GQL_ELEMENT_FACTORY: unique symbol;
|
|
5
|
+
declare const GQL_ELEMENT_CONTEXT: unique symbol;
|
|
6
|
+
type GqlElementContext = {
|
|
7
|
+
canonicalId: string;
|
|
8
|
+
};
|
|
9
|
+
type GqlElementDefinitionFactory<T> = (context: GqlElementContext | null) => T;
|
|
10
|
+
declare abstract class GqlElement<TDefinition> {
|
|
11
|
+
private [GQL_ELEMENT_FACTORY];
|
|
12
|
+
private [GQL_ELEMENT_CONTEXT];
|
|
13
|
+
protected constructor(define: GqlElementDefinitionFactory<TDefinition>);
|
|
14
|
+
static setContext<TElement extends GqlElement<any>>(element: TElement, context: GqlElementContext): void;
|
|
15
|
+
static evaluate(element: GqlElement<any>): void;
|
|
16
|
+
static get<TValue>(element: GqlElement<TValue>): TValue;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region packages/core/src/types/schema/const-value.d.ts
|
|
20
|
+
type ConstValue = string | number | boolean | null | undefined | {
|
|
21
|
+
readonly [key: string]: ConstValue;
|
|
22
|
+
} | readonly ConstValue[];
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region packages/core/src/utils/hidden.d.ts
|
|
25
|
+
type Hidden<T> = () => T;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region packages/core/src/types/schema/type-modifier.d.ts
|
|
28
|
+
type TypeModifier = "?" | `!${string}` | `[]${string}`;
|
|
29
|
+
type ListTypeModifierSuffix = "[]" | "[]!";
|
|
30
|
+
type StripTailingListFromTypeModifier<TModifier extends TypeModifier> = TModifier extends `${infer TInner extends TypeModifier}${ListTypeModifierSuffix}` ? TInner : TModifier;
|
|
31
|
+
type ApplyTypeModifier<TModifier extends TypeModifier, TInner> = TModifier extends "!" ? TInner : TModifier extends "?" | "" ? TInner | null | undefined : TModifier extends `![]${infer TNext extends TypeModifier}` ? ApplyTypeModifier<TNext, TInner[]> : TModifier extends `[]${infer TNext extends TypeModifier}` ? ApplyTypeModifier<TNext, (TInner | null | undefined)[]> : never;
|
|
32
|
+
type ApplyTypeModifierToKeys<T extends {
|
|
33
|
+
[key: string]: {
|
|
34
|
+
modifier: TypeModifier;
|
|
35
|
+
};
|
|
36
|
+
}> = { readonly [K in keyof T as T[K]["modifier"] extends `${string}!` ? K : never]-?: T[K] } & { readonly [K in keyof T as T[K]["modifier"] extends `${string}!` ? never : K]+?: T[K] };
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region packages/core/src/types/schema/type-specifier.d.ts
|
|
39
|
+
type AnyDefaultValue = {
|
|
40
|
+
default: ConstValue;
|
|
41
|
+
};
|
|
42
|
+
type InputTypeKind = "scalar" | "enum" | "input";
|
|
43
|
+
type OutputTypeKind = "scalar" | "enum" | "object" | "union" | "typename";
|
|
44
|
+
type AnyTypeSpecifier = {
|
|
45
|
+
readonly kind: string;
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly modifier: TypeModifier;
|
|
48
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
49
|
+
readonly defaultValue?: AnyDefaultValue | null;
|
|
50
|
+
readonly arguments?: InputTypeSpecifiers;
|
|
51
|
+
};
|
|
52
|
+
type AbstractInputTypeSpecifier<TKind extends InputTypeKind> = {
|
|
53
|
+
readonly kind: TKind;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly modifier: TypeModifier;
|
|
56
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
57
|
+
readonly defaultValue: AnyDefaultValue | null;
|
|
58
|
+
};
|
|
59
|
+
type InputTypeSpecifiers = {
|
|
60
|
+
[key: string]: InputTypeSpecifier;
|
|
61
|
+
};
|
|
62
|
+
type InputTypeSpecifier = InputScalarSpecifier | InputEnumSpecifier | InputInputObjectSpecifier;
|
|
63
|
+
type InputInferrableTypeSpecifier = InputScalarSpecifier | InputEnumSpecifier;
|
|
64
|
+
type InputScalarSpecifier = AbstractInputTypeSpecifier<"scalar">;
|
|
65
|
+
type InputEnumSpecifier = AbstractInputTypeSpecifier<"enum">;
|
|
66
|
+
type InputInputObjectSpecifier = AbstractInputTypeSpecifier<"input">;
|
|
67
|
+
type AbstractOutputTypeSpecifier<TKind extends OutputTypeKind> = {
|
|
68
|
+
readonly kind: TKind;
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly modifier: TypeModifier;
|
|
71
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
72
|
+
readonly arguments: InputTypeSpecifiers;
|
|
73
|
+
};
|
|
74
|
+
type OutputTypeSpecifiers = {
|
|
75
|
+
[key: string]: OutputTypeSpecifier;
|
|
76
|
+
};
|
|
77
|
+
type OutputTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputObjectSpecifier | OutputUnionSpecifier | OutputTypenameSpecifier;
|
|
78
|
+
type OutputInferrableTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputTypenameSpecifier;
|
|
79
|
+
type OutputScalarSpecifier = AbstractOutputTypeSpecifier<"scalar">;
|
|
80
|
+
type OutputEnumSpecifier = AbstractOutputTypeSpecifier<"enum">;
|
|
81
|
+
type OutputObjectSpecifier = AbstractOutputTypeSpecifier<"object">;
|
|
82
|
+
type OutputUnionSpecifier = AbstractOutputTypeSpecifier<"union">;
|
|
83
|
+
type OutputTypenameSpecifier = AbstractOutputTypeSpecifier<"typename">;
|
|
84
|
+
type StripTailingListFromTypeSpecifier<TTypeSpecifier extends AnyTypeSpecifier> = TTypeSpecifier extends {
|
|
85
|
+
defaultValue: AnyDefaultValue | null;
|
|
86
|
+
} ? {
|
|
87
|
+
readonly kind: TTypeSpecifier["kind"];
|
|
88
|
+
readonly name: TTypeSpecifier["name"];
|
|
89
|
+
readonly modifier: StripTailingListFromTypeModifier<TTypeSpecifier["modifier"]>;
|
|
90
|
+
readonly directives: TTypeSpecifier["directives"];
|
|
91
|
+
readonly defaultValue: TTypeSpecifier["modifier"] extends `${string}${ListTypeModifierSuffix}` ? null : TTypeSpecifier["defaultValue"];
|
|
92
|
+
} : TTypeSpecifier extends {
|
|
93
|
+
arguments: InputTypeSpecifiers;
|
|
94
|
+
} ? {
|
|
95
|
+
readonly kind: TTypeSpecifier["kind"];
|
|
96
|
+
readonly name: TTypeSpecifier["name"];
|
|
97
|
+
readonly modifier: StripTailingListFromTypeModifier<TTypeSpecifier["modifier"]>;
|
|
98
|
+
readonly directives: TTypeSpecifier["directives"];
|
|
99
|
+
readonly arguments: TTypeSpecifier["arguments"];
|
|
100
|
+
} : never;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region packages/core/src/types/schema/const-assignable-input.d.ts
|
|
103
|
+
type AnyConstAssignableInputValue = ConstValue;
|
|
104
|
+
type AnyConstAssignableInput = {
|
|
105
|
+
readonly [key: string]: AnyConstAssignableInputValue;
|
|
106
|
+
};
|
|
107
|
+
type ConstAssignableInput<TSchema extends AnyGraphqlSchema, TRefs extends InputTypeSpecifiers> = { readonly [K in keyof ApplyTypeModifierToKeys<TRefs>]: ConstAssignableInputValue<TSchema, TRefs[K]> };
|
|
108
|
+
type ConstAssignableInputValue<TSchema extends AnyGraphqlSchema, TRef extends InputTypeSpecifier> = TRef["modifier"] extends `${string}${ListTypeModifierSuffix}` ? ConstAssignableInputValue<TSchema, StripTailingListFromTypeSpecifier<TRef>>[] : (TRef extends InputInputObjectSpecifier ? ConstAssignableInput<TSchema, InputFieldRecord<TSchema, TRef>> : never) | (TRef extends InputInferrableTypeSpecifier ? InferInputTypeRef<TSchema, TRef> : never);
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region packages/core/src/types/schema/const-directives.d.ts
|
|
111
|
+
type AnyConstDirectiveAttachments = {
|
|
112
|
+
readonly [key: string]: AnyConstAssignableInputValue;
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region packages/core/src/types/schema/schema.d.ts
|
|
116
|
+
type OperationType = keyof OperationRoots;
|
|
117
|
+
type AnyTypeName = string;
|
|
118
|
+
type AnyFieldName = string;
|
|
119
|
+
type AnyGraphqlSchema = {
|
|
120
|
+
readonly operations: OperationRoots;
|
|
121
|
+
readonly scalar: {
|
|
122
|
+
readonly [name: string]: ScalarDefinition<any>;
|
|
123
|
+
};
|
|
124
|
+
readonly enum: {
|
|
125
|
+
readonly [name: string]: EnumDefinition<any>;
|
|
126
|
+
};
|
|
127
|
+
readonly input: {
|
|
128
|
+
readonly [name: string]: InputDefinition;
|
|
129
|
+
};
|
|
130
|
+
readonly object: {
|
|
131
|
+
readonly [name: string]: ObjectDefinition;
|
|
132
|
+
};
|
|
133
|
+
readonly union: {
|
|
134
|
+
readonly [name: string]: UnionDefinition;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
type OperationRoots = {
|
|
138
|
+
readonly query: string | null;
|
|
139
|
+
readonly mutation: string | null;
|
|
140
|
+
readonly subscription: string | null;
|
|
141
|
+
};
|
|
142
|
+
type ScalarDefinition<T extends {
|
|
143
|
+
input: unknown;
|
|
144
|
+
output: unknown;
|
|
145
|
+
}> = {
|
|
146
|
+
readonly _type: Hidden<{
|
|
147
|
+
input: T["input"];
|
|
148
|
+
output: T["output"];
|
|
149
|
+
}>;
|
|
150
|
+
readonly name: string;
|
|
151
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
152
|
+
};
|
|
153
|
+
type EnumDefinition<T extends string> = {
|
|
154
|
+
readonly _type: Hidden<T>;
|
|
155
|
+
readonly name: string;
|
|
156
|
+
readonly values: { readonly [_ in T]: true };
|
|
157
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
158
|
+
};
|
|
159
|
+
type InputDefinition = {
|
|
160
|
+
readonly name: string;
|
|
161
|
+
readonly fields: InputTypeSpecifiers;
|
|
162
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
163
|
+
};
|
|
164
|
+
type ObjectDefinition = {
|
|
165
|
+
readonly name: string;
|
|
166
|
+
readonly fields: OutputTypeSpecifiers;
|
|
167
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
168
|
+
};
|
|
169
|
+
type UnionDefinition = {
|
|
170
|
+
readonly name: string;
|
|
171
|
+
readonly types: {
|
|
172
|
+
[typename: string]: true;
|
|
173
|
+
};
|
|
174
|
+
readonly directives: AnyConstDirectiveAttachments;
|
|
175
|
+
};
|
|
176
|
+
type InferInputTypeRef<TSchema extends AnyGraphqlSchema, TSpecifier extends InputInferrableTypeSpecifier> = (TSpecifier extends {
|
|
177
|
+
defaultValue: null;
|
|
178
|
+
} ? never : undefined) | (TSpecifier extends InputScalarSpecifier ? ApplyTypeModifier<TSpecifier["modifier"], ReturnType<TSchema["scalar"][TSpecifier["name"]]["_type"]>["input"]> : TSpecifier extends InputEnumSpecifier ? ApplyTypeModifier<TSpecifier["modifier"], ReturnType<TSchema["enum"][TSpecifier["name"]]["_type"]>> : never);
|
|
179
|
+
type InferOutputTypeRef<TSchema extends AnyGraphqlSchema, TSpecifier extends OutputInferrableTypeSpecifier> = TSpecifier extends OutputScalarSpecifier ? ApplyTypeModifier<TSpecifier["modifier"], ReturnType<TSchema["scalar"][TSpecifier["name"]]["_type"]>["output"]> : TSpecifier extends OutputEnumSpecifier ? ApplyTypeModifier<TSpecifier["modifier"], ReturnType<TSchema["enum"][TSpecifier["name"]]["_type"]>> : TSpecifier extends OutputTypenameSpecifier ? ApplyTypeModifier<TSpecifier["modifier"], TSpecifier["name"]> : never;
|
|
180
|
+
type InputFieldRecord<TSchema extends AnyGraphqlSchema, TSpecifier extends InputTypeSpecifier> = TSchema["input"][TSpecifier["name"]]["fields"];
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region packages/core/src/utils/prettify.d.ts
|
|
183
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region packages/core/src/types/fragment/var-ref.d.ts
|
|
186
|
+
/** Nominal reference placeholder used inside `AnyVariableAssignments`. */
|
|
187
|
+
type AnyVarRef = VarRef<any>;
|
|
188
|
+
type AnyVarRefMeta = {
|
|
189
|
+
readonly kind: string;
|
|
190
|
+
readonly name: string;
|
|
191
|
+
readonly modifier: unknown;
|
|
192
|
+
};
|
|
193
|
+
type VarRefBy<TRef extends InputTypeSpecifier> = VarRef<VarRefMetaBy<TRef>>;
|
|
194
|
+
type VarRefMetaBy<TRef extends InputTypeSpecifier> = Prettify<{
|
|
195
|
+
readonly kind: TRef["kind"];
|
|
196
|
+
readonly name: TRef["name"];
|
|
197
|
+
readonly modifier: ApplyTypeModifier<TRef["modifier"], "_"> | (TRef["defaultValue"] extends AnyDefaultValue ? null | undefined : never);
|
|
198
|
+
}>;
|
|
199
|
+
declare const __VAR_REF_BRAND__: unique symbol;
|
|
200
|
+
/** Nominal reference used to defer variable binding while carrying type info. */
|
|
201
|
+
declare class VarRef<TMeta extends AnyVarRefMeta> {
|
|
202
|
+
readonly name: string;
|
|
203
|
+
readonly [__VAR_REF_BRAND__]: Hidden<TMeta>;
|
|
204
|
+
private constructor();
|
|
205
|
+
static create<TRef extends InputTypeSpecifier>(name: string): VarRefBy<TRef>;
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region packages/core/src/types/fragment/assignable-input.d.ts
|
|
209
|
+
type AnyAssignableInputValue = ConstValue | AnyVarRef | {
|
|
210
|
+
[key: string]: AnyAssignableInputValue;
|
|
211
|
+
} | AnyAssignableInputValue[] | undefined | null;
|
|
212
|
+
type AnyAssignableInput = {
|
|
213
|
+
readonly [key: string]: AnyAssignableInputValue;
|
|
214
|
+
};
|
|
215
|
+
type AssignableInput<TSchema extends AnyGraphqlSchema, TRefs extends InputTypeSpecifiers> = { readonly [K in keyof ApplyTypeModifierToKeys<TRefs>]: AssignableInputValue<TSchema, TRefs[K]> };
|
|
216
|
+
type AssignableInputValue<TSchema extends AnyGraphqlSchema, TRef extends InputTypeSpecifier> = VarRefBy<TRef> | (TRef["modifier"] extends `${string}${ListTypeModifierSuffix}` ? AssignableInputValue<TSchema, StripTailingListFromTypeSpecifier<TRef>>[] : (TRef extends InputInputObjectSpecifier ? AssignableInput<TSchema, InputFieldRecord<TSchema, TRef>> : never) | (TRef extends InputInferrableTypeSpecifier ? InferInputTypeRef<TSchema, TRef> : never));
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region packages/core/src/types/fragment/directives.d.ts
|
|
219
|
+
type AnyDirectiveAttachments = {
|
|
220
|
+
readonly [key: string]: AnyAssignableInput;
|
|
221
|
+
};
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region packages/core/src/types/fragment/field-selection.d.ts
|
|
224
|
+
/**
|
|
225
|
+
* Canonical representation of the field selections we collect during model and
|
|
226
|
+
* slice definition. Each alias maps to a typed field reference that still
|
|
227
|
+
* remembers its parent type, arguments, directives, and nested selections.
|
|
228
|
+
*/
|
|
229
|
+
type AnyFieldSelection = {
|
|
230
|
+
readonly parent: AnyTypeName;
|
|
231
|
+
readonly field: AnyFieldName;
|
|
232
|
+
readonly type: OutputTypeSpecifier;
|
|
233
|
+
readonly args: AnyAssignableInput;
|
|
234
|
+
readonly directives: AnyDirectiveAttachments;
|
|
235
|
+
readonly object: AnyNestedObject | null;
|
|
236
|
+
readonly union: AnyNestedUnion | null;
|
|
237
|
+
};
|
|
238
|
+
/** Nested selection produced when resolving an object field. */
|
|
239
|
+
type AnyNestedObject = {
|
|
240
|
+
readonly [alias: string]: AnyFieldSelection;
|
|
241
|
+
};
|
|
242
|
+
/** Nested selection produced when resolving a union field. */
|
|
243
|
+
type AnyNestedUnion = {
|
|
244
|
+
readonly [typeName: string]: AnyNestedObject | undefined;
|
|
245
|
+
};
|
|
246
|
+
/** Map of alias → field reference used by builders and inference. */
|
|
247
|
+
type AnyFields = {
|
|
248
|
+
readonly [alias: string]: AnyFieldSelection;
|
|
249
|
+
};
|
|
250
|
+
/** Resolve the data shape produced by a set of field selections. */
|
|
251
|
+
type InferFields<TSchema extends AnyGraphqlSchema, TFields extends AnyFields> = Prettify<{ readonly [TAliasName in keyof TFields]: InferField<TSchema, TFields[TAliasName]> }>;
|
|
252
|
+
/** Resolve the data shape for a single field reference, including nested objects/unions. */
|
|
253
|
+
type InferField<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = (TSelection extends {
|
|
254
|
+
type: infer TRef extends OutputObjectSpecifier;
|
|
255
|
+
object: infer TNested extends AnyNestedObject;
|
|
256
|
+
} ? ApplyTypeModifier<TRef["modifier"], InferFields<TSchema, TNested>> : never) | (TSelection extends {
|
|
257
|
+
type: infer TRef extends OutputUnionSpecifier;
|
|
258
|
+
union: infer TNested extends AnyNestedUnion;
|
|
259
|
+
} ? ApplyTypeModifier<TRef["modifier"], { [TTypename in keyof TNested]: undefined extends TNested[TTypename] ? never : InferFields<TSchema, NonNullable<TNested[TTypename]>> }[keyof TNested]> : never) | (TSelection extends {
|
|
260
|
+
type: infer TRef extends OutputInferrableTypeSpecifier;
|
|
261
|
+
} ? InferOutputTypeRef<TSchema, TRef> : never);
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region packages/core/src/types/fragment/field-path.d.ts
|
|
264
|
+
type AnyFieldPath = string;
|
|
265
|
+
/**
|
|
266
|
+
* Computes strongly typed "$.foo.bar" style selectors for a set of fields so
|
|
267
|
+
* slice result transforms can reference response paths safely.
|
|
268
|
+
*/
|
|
269
|
+
type AvailableFieldPathOf<TSchema extends AnyGraphqlSchema, TFields extends AnyFields> = AvailableFieldPathsInner<TSchema, TFields, "$">;
|
|
270
|
+
/** Recursive helper used to build path strings for nested selections. */
|
|
271
|
+
type AvailableFieldPathsInner<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TCurr extends AnyFieldPath> = { readonly [TAliasName in keyof TFields & string]: `${TCurr}.${TAliasName}` | (TFields[TAliasName] extends {
|
|
272
|
+
object: infer TNested extends AnyNestedObject;
|
|
273
|
+
} ? AvailableFieldPathsInner<TSchema, TNested, `${TCurr}.${TAliasName}`> : never) }[keyof TFields & string];
|
|
274
|
+
/** Resolve the TypeScript type located at a given field path. */
|
|
275
|
+
type InferByFieldPath<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TPath extends AnyFieldPath> = string extends keyof TFields ? any : TPath extends "$" ? never : InferByFieldPathInner<TSchema, TFields, TPath, "$">;
|
|
276
|
+
/** Internal helper that walks a field tree while matching a path literal. */
|
|
277
|
+
type InferByFieldPathInner<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TPathTarget extends AnyFieldPath, TPathCurrent extends AnyFieldPath> = { readonly [TAliasName in keyof TFields]: TAliasName extends string ? `${TPathCurrent}.${TAliasName}` extends TPathTarget ? InferField<TSchema, TFields[TAliasName]> : TFields[TAliasName] extends {
|
|
278
|
+
object: infer TNested extends AnyNestedObject;
|
|
279
|
+
} ? InferByFieldPathInner<TSchema, TNested, TPathTarget, `${TPathCurrent}.${TAliasName}`> : never : never }[keyof TFields];
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region packages/core/src/utils/type-utils.d.ts
|
|
282
|
+
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
|
|
283
|
+
type Tuple<T> = [T, ...T[]];
|
|
284
|
+
type StripFunctions<T extends object> = { [K in keyof T as T[K] extends ((...args: any[]) => any) ? never : K]: T[K] };
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region packages/core/src/types/runtime/runtime-adapter.d.ts
|
|
287
|
+
/**
|
|
288
|
+
* Defines the runtime surface that the typed layer depends on. Implementations
|
|
289
|
+
* adapt framework-specific error payloads without leaking those types into the
|
|
290
|
+
* generated code.
|
|
291
|
+
*/
|
|
292
|
+
type AnyGraphqlRuntimeAdapter = {
|
|
293
|
+
nonGraphqlErrorType: Hidden<any>;
|
|
294
|
+
};
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region packages/core/src/types/runtime/execution-result.d.ts
|
|
297
|
+
type NormalizedExecutionResult<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TData, TExtensions> = EmptyResult | GraphqlExecutionResult<TData, TExtensions> | NonGraphqlErrorResult<TRuntimeAdapter>;
|
|
298
|
+
type EmptyResult = {
|
|
299
|
+
type: "empty";
|
|
300
|
+
};
|
|
301
|
+
type GraphqlExecutionResult<TData, TExtensions> = {
|
|
302
|
+
type: "graphql";
|
|
303
|
+
body: FormattedExecutionResult<TData, TExtensions>;
|
|
304
|
+
};
|
|
305
|
+
type NonGraphqlErrorResult<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = {
|
|
306
|
+
type: "non-graphql-error";
|
|
307
|
+
error: ReturnType<TRuntimeAdapter["nonGraphqlErrorType"]>;
|
|
308
|
+
};
|
|
309
|
+
type NormalizedError<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = {
|
|
310
|
+
type: "graphql-error";
|
|
311
|
+
errors: GraphQLFormattedError[];
|
|
312
|
+
} | {
|
|
313
|
+
type: "non-graphql-error";
|
|
314
|
+
error: ReturnType<TRuntimeAdapter["nonGraphqlErrorType"]>;
|
|
315
|
+
} | {
|
|
316
|
+
type: "parse-error";
|
|
317
|
+
errors: Error[];
|
|
318
|
+
};
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region packages/core/src/types/runtime/sliced-execution-result.d.ts
|
|
321
|
+
type AnySlicedExecutionResult = SlicedExecutionResult<any, AnyGraphqlRuntimeAdapter>;
|
|
322
|
+
type SafeUnwrapResult<TTransformed, TError> = {
|
|
323
|
+
data?: never;
|
|
324
|
+
error?: never;
|
|
325
|
+
} | {
|
|
326
|
+
data: TTransformed;
|
|
327
|
+
error?: never;
|
|
328
|
+
} | {
|
|
329
|
+
data?: never;
|
|
330
|
+
error: TError;
|
|
331
|
+
};
|
|
332
|
+
/** Utility signature returned by the safe unwrap helper. */
|
|
333
|
+
type SlicedExecutionResultCommon<TData, TError> = {
|
|
334
|
+
safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): SafeUnwrapResult<TTransformed, TError>;
|
|
335
|
+
};
|
|
336
|
+
/** Public union used by selection callbacks to inspect data, empty, or error states. */
|
|
337
|
+
type SlicedExecutionResult<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = SlicedExecutionResultEmpty<TData, TRuntimeAdapter> | SlicedExecutionResultSuccess<TData, TRuntimeAdapter> | SlicedExecutionResultError<TData, TRuntimeAdapter>;
|
|
338
|
+
/** Runtime guard interface shared by all slice result variants. */
|
|
339
|
+
declare class SlicedExecutionResultGuards<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> {
|
|
340
|
+
private readonly type;
|
|
341
|
+
isSuccess(): this is SlicedExecutionResultSuccess<TData, TRuntimeAdapter>;
|
|
342
|
+
isError(): this is SlicedExecutionResultError<TData, TRuntimeAdapter>;
|
|
343
|
+
isEmpty(): this is SlicedExecutionResultEmpty<TData, TRuntimeAdapter>;
|
|
344
|
+
constructor(type: "success" | "error" | "empty");
|
|
345
|
+
}
|
|
346
|
+
/** Variant representing an empty payload (no data, no error). */
|
|
347
|
+
declare class SlicedExecutionResultEmpty<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> extends SlicedExecutionResultGuards<TData, TRuntimeAdapter> implements SlicedExecutionResultCommon<TData, NormalizedError<TRuntimeAdapter>> {
|
|
348
|
+
constructor();
|
|
349
|
+
unwrap(): null;
|
|
350
|
+
safeUnwrap(): {
|
|
351
|
+
data: undefined;
|
|
352
|
+
error: undefined;
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/** Variant representing a successful payload. */
|
|
356
|
+
declare class SlicedExecutionResultSuccess<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> extends SlicedExecutionResultGuards<TData, TRuntimeAdapter> implements SlicedExecutionResultCommon<TData, NormalizedError<TRuntimeAdapter>> {
|
|
357
|
+
readonly data: TData;
|
|
358
|
+
readonly extensions?: unknown | undefined;
|
|
359
|
+
constructor(data: TData, extensions?: unknown | undefined);
|
|
360
|
+
unwrap(): TData;
|
|
361
|
+
safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): {
|
|
362
|
+
data: TTransformed;
|
|
363
|
+
error: undefined;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/** Variant representing an error payload created by the adapter. */
|
|
367
|
+
declare class SlicedExecutionResultError<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> extends SlicedExecutionResultGuards<TData, TRuntimeAdapter> implements SlicedExecutionResultCommon<TData, NormalizedError<TRuntimeAdapter>> {
|
|
368
|
+
readonly error: NormalizedError<TRuntimeAdapter>;
|
|
369
|
+
readonly extensions?: unknown | undefined;
|
|
370
|
+
constructor(error: NormalizedError<TRuntimeAdapter>, extensions?: unknown | undefined);
|
|
371
|
+
unwrap(): never;
|
|
372
|
+
safeUnwrap(): {
|
|
373
|
+
data: undefined;
|
|
374
|
+
error: NormalizedError<TRuntimeAdapter>;
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region packages/core/src/types/runtime/projection.d.ts
|
|
379
|
+
/** Shape of a single selection slice projection. */
|
|
380
|
+
type AnyProjection = Projection<any>;
|
|
381
|
+
declare const __PROJECTION_BRAND__: unique symbol;
|
|
382
|
+
/**
|
|
383
|
+
* Nominal type representing any slice selection regardless of schema specifics.
|
|
384
|
+
* Encodes how individual slices map a concrete field path to a projection
|
|
385
|
+
* function. Multiple selections allow slices to expose several derived values.
|
|
386
|
+
*/
|
|
387
|
+
declare class Projection<TProjected> {
|
|
388
|
+
readonly projector: (result: AnySlicedExecutionResult) => TProjected;
|
|
389
|
+
readonly [__PROJECTION_BRAND__]: Hidden<never>;
|
|
390
|
+
constructor(paths: Tuple<string>, projector: (result: AnySlicedExecutionResult) => TProjected);
|
|
391
|
+
readonly paths: ProjectionPath[];
|
|
392
|
+
}
|
|
393
|
+
type ProjectionPath = {
|
|
394
|
+
full: string;
|
|
395
|
+
segments: Tuple<string>;
|
|
396
|
+
};
|
|
397
|
+
type InferExecutionResultProjection<TProjection extends AnyProjection> = ReturnType<TProjection["projector"]>;
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region packages/core/src/utils/empty-object.d.ts
|
|
400
|
+
declare const __EMPTY_SYMBOL__: unique symbol;
|
|
401
|
+
type EmptyObject = {
|
|
402
|
+
readonly [__EMPTY_SYMBOL__]: never;
|
|
403
|
+
};
|
|
404
|
+
type IsEmptyObject<T> = keyof (T & EmptyObject) extends keyof EmptyObject ? true : false;
|
|
405
|
+
type SwitchIfEmpty<TTarget, TTrue, TFalse> = IsEmptyObject<TTarget> extends true ? TTrue : TFalse;
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region packages/core/src/types/element/slice.d.ts
|
|
408
|
+
type AnySliceOf<TOperationType extends OperationType> = Slice<TOperationType, any, AnyFields, AnyProjection>;
|
|
409
|
+
type SliceDefinition<TOperationType extends OperationType, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>, TProjection extends AnyProjection> = {
|
|
410
|
+
readonly operationType: TOperationType;
|
|
411
|
+
readonly embed: (variables: TVariables) => SlicePayload<TVariables, TFields, TProjection>;
|
|
412
|
+
};
|
|
413
|
+
declare const __OPERATION_SLICE_BRAND__: unique symbol;
|
|
414
|
+
declare class Slice<TOperationType extends OperationType, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>, TProjection extends AnyProjection> extends GqlElement<SliceDefinition<TOperationType, TVariables, TFields, TProjection>> implements SliceDefinition<TOperationType, TVariables, TFields, TProjection> {
|
|
415
|
+
readonly [__OPERATION_SLICE_BRAND__]: Hidden<{
|
|
416
|
+
operationType: TOperationType;
|
|
417
|
+
output: InferExecutionResultProjection<TProjection>;
|
|
418
|
+
}>;
|
|
419
|
+
private constructor();
|
|
420
|
+
get operationType(): TOperationType;
|
|
421
|
+
get embed(): (variables: TVariables) => SlicePayload<TVariables, TFields, TProjection>;
|
|
422
|
+
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields, TProjection extends AnyProjection>(define: () => {
|
|
423
|
+
operationType: TOperationType;
|
|
424
|
+
embed: (variables: SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>) => SlicePayload<SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>, TFields, TProjection>;
|
|
425
|
+
}): Slice<TOperationType, SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>, TFields & {
|
|
426
|
+
[key: symbol]: never;
|
|
427
|
+
}, TProjection>;
|
|
428
|
+
}
|
|
429
|
+
type AnySlicePayloads = {
|
|
430
|
+
[key: string]: AnySlicePayload;
|
|
431
|
+
};
|
|
432
|
+
type AnySlicePayload = SlicePayload<AnyAssignableInput | void, AnyFields, AnyProjection>;
|
|
433
|
+
type SlicePayload<TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>, TProjection extends AnyProjection> = {
|
|
434
|
+
variables: TVariables;
|
|
435
|
+
getFields: () => TFields;
|
|
436
|
+
projection: TProjection;
|
|
437
|
+
};
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region packages/core/src/types/element/composed-operation.d.ts
|
|
440
|
+
type AnyComposedOperationOf<TOperationType extends OperationType> = ComposedOperation<AnyGraphqlRuntimeAdapter, TOperationType, string, string[], any, any, any>;
|
|
441
|
+
declare const __COMPOSED_OPERATION_BRAND__: unique symbol;
|
|
442
|
+
type ComposedOperationDefinition<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TRawData extends object, TProjectedData extends object> = {
|
|
443
|
+
readonly operationType: TOperationType;
|
|
444
|
+
readonly operationName: TOperationName;
|
|
445
|
+
readonly variableNames: TVariableNames;
|
|
446
|
+
readonly projectionPathGraph: ProjectionPathGraphNode;
|
|
447
|
+
readonly document: TypedQueryDocumentNode<TRawData, TVariables>;
|
|
448
|
+
readonly parse: (result: NormalizedExecutionResult<TRuntimeAdapter, TRawData, any>) => TProjectedData;
|
|
449
|
+
};
|
|
450
|
+
declare class ComposedOperation<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TRawData extends object, TProjectedData extends object> extends GqlElement<ComposedOperationDefinition<TRuntimeAdapter, TOperationType, TOperationName, TVariableNames, TVariables, TRawData, TProjectedData>> implements ComposedOperationDefinition<TRuntimeAdapter, TOperationType, TOperationName, TVariableNames, TVariables, TRawData, TProjectedData> {
|
|
451
|
+
readonly [__COMPOSED_OPERATION_BRAND__]: Hidden<{
|
|
452
|
+
operationType: TOperationType;
|
|
453
|
+
}>;
|
|
454
|
+
private constructor();
|
|
455
|
+
get operationType(): TOperationType;
|
|
456
|
+
get operationName(): TOperationName;
|
|
457
|
+
get variableNames(): TVariableNames;
|
|
458
|
+
get projectionPathGraph(): ProjectionPathGraphNode;
|
|
459
|
+
get document(): TypedQueryDocumentNode<TRawData, TVariables>;
|
|
460
|
+
get parse(): (result: NormalizedExecutionResult<TRuntimeAdapter, TRawData, any>) => TProjectedData;
|
|
461
|
+
static create<TSchema extends AnyGraphqlSchema, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TSliceFragments extends AnySlicePayloads>(define: (context: GqlElementContext | null) => {
|
|
462
|
+
operationType: TOperationType;
|
|
463
|
+
operationName: TOperationName;
|
|
464
|
+
variableNames: (keyof TVariableDefinitions & string)[];
|
|
465
|
+
projectionPathGraph: ProjectionPathGraphNode;
|
|
466
|
+
document: TypedQueryDocumentNode<InferComposedOperationRawData<TSchema, TSliceFragments>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
467
|
+
parse: (result: NormalizedExecutionResult<TRuntimeAdapter, InferComposedOperationRawData<TSchema, TSliceFragments>, any>) => { [K in keyof TSliceFragments]: InferExecutionResultProjection<TSliceFragments[K]["projection"]> };
|
|
468
|
+
}): ComposedOperation<TRuntimeAdapter, TOperationType, TOperationName, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, ((ConcatSlicePayloads<TSliceFragments> extends infer T_2 extends AnyFields ? { readonly [TAliasName in keyof T_2]: InferField<TSchema_1, T_2[TAliasName]> } : never) extends infer T_1 ? { [K_1 in keyof T_1]: T_1[K_1] } : never) extends infer T ? { [K in keyof T]: T[K] } : never, { [K_2 in keyof TSliceFragments]: InferExecutionResultProjection<TSliceFragments[K_2]["projection"]> }>;
|
|
469
|
+
}
|
|
470
|
+
type ProjectionPathGraphNode = {
|
|
471
|
+
readonly matches: {
|
|
472
|
+
label: string;
|
|
473
|
+
path: string;
|
|
474
|
+
exact: boolean;
|
|
475
|
+
}[];
|
|
476
|
+
readonly children: {
|
|
477
|
+
readonly [segment: string]: ProjectionPathGraphNode;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
type ConcatSlicePayloads<TSlicePayloads extends AnySlicePayloads> = Prettify<UnionToIntersection<{ [TLabel in keyof TSlicePayloads & string]: TSlicePayloads[TLabel] extends {
|
|
481
|
+
getFields: () => infer TFields;
|
|
482
|
+
} ? { [K in keyof TFields & string as `${TLabel}_${K}`]: TFields[K] } : {} }[keyof TSlicePayloads & string]>> & AnyFields;
|
|
483
|
+
type InferComposedOperationRawData<TSchema extends AnyGraphqlSchema, TSlicePayloads extends AnySlicePayloads> = Prettify<InferFields<TSchema, ConcatSlicePayloads<TSlicePayloads>>>;
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region packages/core/src/types/element/execution-result-projection-builder.d.ts
|
|
486
|
+
type AnyExecutionResultProjectionsBuilder = ExecutionResultProjectionsBuilder<AnyGraphqlSchema, AnyGraphqlRuntimeAdapter, any, any>;
|
|
487
|
+
type ExecutionResultProjectionsBuilder<TSchema extends AnyGraphqlSchema, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TFields extends AnyFields, TProjection extends AnyProjection> = (tools: {
|
|
488
|
+
select: ResultSelector<TSchema, TRuntimeAdapter, TFields>;
|
|
489
|
+
}) => TProjection;
|
|
490
|
+
type ResultSelector<TSchema extends AnyGraphqlSchema, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TFields extends AnyFields> = <TPaths extends Tuple<AvailableFieldPathOf<TSchema, TFields>>, TProjected>(paths: TPaths, projector: (result: NoInfer<SlicedExecutionResult<InferByResultSelectorPaths<TSchema, TFields, TPaths>, TRuntimeAdapter>>) => TProjected) => NoInfer<Projection<TProjected>>;
|
|
491
|
+
type InferByResultSelectorPaths<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TPaths extends Tuple<AvailableFieldPathOf<TSchema, TFields>>> = TPaths extends string[] ? { [K in keyof TPaths]: TPaths[K] extends string ? InferByFieldPath<TSchema, TFields, TPaths[K]> : never } : never;
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region packages/core/src/types/element/inline-operation.d.ts
|
|
494
|
+
type AnyInlineOperationOf<TOperationType extends OperationType> = InlineOperation<TOperationType, string, string[], any, AnyFields, any>;
|
|
495
|
+
declare const __INLINE_OPERATION_BRAND__: unique symbol;
|
|
496
|
+
type InlineOperationArtifact<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields extends Partial<AnyFields>, TData extends object> = {
|
|
497
|
+
readonly operationType: TOperationType;
|
|
498
|
+
readonly operationName: TOperationName;
|
|
499
|
+
readonly variableNames: TVariableNames;
|
|
500
|
+
readonly documentSource: () => TFields;
|
|
501
|
+
readonly document: TypedQueryDocumentNode<TData, TVariables>;
|
|
502
|
+
};
|
|
503
|
+
declare class InlineOperation<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields extends Partial<AnyFields>, TData extends object> extends GqlElement<InlineOperationArtifact<TOperationType, TOperationName, TVariableNames, TVariables, TFields, TData>> implements InlineOperationArtifact<TOperationType, TOperationName, TVariableNames, TVariables, TFields, TData> {
|
|
504
|
+
readonly [__INLINE_OPERATION_BRAND__]: Hidden<{
|
|
505
|
+
operationType: TOperationType;
|
|
506
|
+
}>;
|
|
507
|
+
private constructor();
|
|
508
|
+
get operationType(): TOperationType;
|
|
509
|
+
get operationName(): TOperationName;
|
|
510
|
+
get variableNames(): TVariableNames;
|
|
511
|
+
get documentSource(): () => TFields;
|
|
512
|
+
get document(): TypedQueryDocumentNode<TData, TVariables>;
|
|
513
|
+
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
514
|
+
operationType: TOperationType;
|
|
515
|
+
operationName: TOperationName;
|
|
516
|
+
variableNames: (keyof TVariableDefinitions & string)[];
|
|
517
|
+
documentSource: () => TFields;
|
|
518
|
+
document: TypedQueryDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
519
|
+
}): InlineOperation<TOperationType, TOperationName, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, TFields, { [K in keyof { readonly [TAliasName in keyof TFields]: InferField<TSchema, TFields[TAliasName]> }]: { readonly [TAliasName in keyof TFields]: InferField<TSchema, TFields[TAliasName]> }[K] }>;
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region packages/core/src/types/element/model.d.ts
|
|
523
|
+
type AnyModel = Model<string, any, AnyFields, any, any>;
|
|
524
|
+
type ModelArtifact<TTypeName extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>, TRaw extends object, TNormalized extends object> = {
|
|
525
|
+
readonly typename: TTypeName;
|
|
526
|
+
readonly fragment: (variables: TVariables) => TFields;
|
|
527
|
+
readonly normalize: (raw: TRaw) => TNormalized;
|
|
528
|
+
};
|
|
529
|
+
declare const __MODEL_BRAND__: unique symbol;
|
|
530
|
+
declare class Model<TTypeName extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>, TRaw extends object, TNormalized extends object> extends GqlElement<ModelArtifact<TTypeName, TVariables, TFields, TRaw, TNormalized>> implements ModelArtifact<TTypeName, TVariables, TFields, TRaw, TNormalized> {
|
|
531
|
+
readonly [__MODEL_BRAND__]: Hidden<{
|
|
532
|
+
input: TVariables;
|
|
533
|
+
output: TNormalized;
|
|
534
|
+
}>;
|
|
535
|
+
private constructor();
|
|
536
|
+
get typename(): TTypeName;
|
|
537
|
+
get fragment(): (variables: TVariables) => TFields;
|
|
538
|
+
get normalize(): (raw: TRaw) => TNormalized;
|
|
539
|
+
static create<TSchema extends AnyGraphqlSchema, TTypeName extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields, TNormalized extends object>(define: () => {
|
|
540
|
+
typename: TTypeName;
|
|
541
|
+
fragment: (variables: SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>) => TFields;
|
|
542
|
+
normalize: (raw: NoInfer<InferFields<TSchema, TFields>>) => TNormalized;
|
|
543
|
+
}): Model<TTypeName, SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>, TFields & {
|
|
544
|
+
[key: symbol]: never;
|
|
545
|
+
}, { [K in keyof { readonly [TAliasName in keyof TFields]: InferField<TSchema, TFields[TAliasName]> }]: { readonly [TAliasName in keyof TFields]: InferField<TSchema, TFields[TAliasName]> }[K] } & {
|
|
546
|
+
[key: symbol]: never;
|
|
547
|
+
}, TNormalized>;
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region packages/core/src/runtime/model.d.ts
|
|
551
|
+
type RuntimeModelInput = {
|
|
552
|
+
prebuild: StripFunctions<AnyModel>;
|
|
553
|
+
runtime: {
|
|
554
|
+
normalize: (raw: any) => object;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region packages/core/src/runtime/composed-operation.d.ts
|
|
559
|
+
type RuntimeComposedOperationInput = {
|
|
560
|
+
prebuild: StripFunctions<AnyComposedOperationOf<OperationType>>;
|
|
561
|
+
runtime: {
|
|
562
|
+
getSlices: (tools: {
|
|
563
|
+
$: AnyAssignableInput;
|
|
564
|
+
}) => {
|
|
565
|
+
[key: string]: AnySlicePayload;
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region packages/core/src/runtime/inline-operation.d.ts
|
|
571
|
+
type RuntimeInlineOperationInput = {
|
|
572
|
+
prebuild: StripFunctions<AnyInlineOperationOf<OperationType>>;
|
|
573
|
+
runtime: {};
|
|
574
|
+
};
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region packages/core/src/runtime/slice.d.ts
|
|
577
|
+
type RuntimeSliceInput = {
|
|
578
|
+
prebuild: StripFunctions<AnySliceOf<OperationType>>;
|
|
579
|
+
runtime: {
|
|
580
|
+
buildProjection: AnyExecutionResultProjectionsBuilder;
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region packages/core/src/runtime/runtime-adapter.d.ts
|
|
585
|
+
type RuntimeAdapterFactory<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = (tools: {
|
|
586
|
+
type: <T>() => Hidden<T>;
|
|
587
|
+
}) => TRuntimeAdapter;
|
|
588
|
+
declare const createRuntimeAdapter: <TRuntimeAdapter extends AnyGraphqlRuntimeAdapter>(factory: RuntimeAdapterFactory<TRuntimeAdapter>) => TRuntimeAdapter;
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region packages/core/src/runtime/index.d.ts
|
|
591
|
+
declare const gqlRuntime: {
|
|
592
|
+
model: (input: RuntimeModelInput) => AnyModel;
|
|
593
|
+
composedOperation: (input: RuntimeComposedOperationInput) => AnyComposedOperationOf<OperationType>;
|
|
594
|
+
inlineOperation: (input: RuntimeInlineOperationInput) => AnyInlineOperationOf<OperationType>;
|
|
595
|
+
slice: (input: RuntimeSliceInput) => AnySliceOf<OperationType>;
|
|
596
|
+
getComposedOperation: (name: string) => AnyComposedOperationOf<keyof OperationRoots>;
|
|
597
|
+
getInlineOperation: (name: string) => AnyInlineOperationOf<keyof OperationRoots>;
|
|
598
|
+
};
|
|
599
|
+
//#endregion
|
|
600
|
+
export { createRuntimeAdapter, gqlRuntime };
|
|
601
|
+
//# sourceMappingURL=index.d.ts.map
|