@soda-gql/runtime 0.1.0 → 0.2.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.
- package/README.md +7 -44
- package/dist/index.cjs +8 -317
- package/dist/index.d.cts +2 -751
- package/dist/index.d.ts +2 -751
- package/dist/index.js +2 -315
- package/package.json +23 -3
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,751 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region packages/core/src/types/element/gql-element.d.ts
|
|
5
|
-
declare const GQL_ELEMENT_FACTORY: unique symbol;
|
|
6
|
-
declare const GQL_ELEMENT_CONTEXT: unique symbol;
|
|
7
|
-
type GqlElementContext = {
|
|
8
|
-
canonicalId: string;
|
|
9
|
-
};
|
|
10
|
-
type GqlElementDefinitionFactory<T$1> = (context: GqlElementContext | null) => T$1 | Promise<T$1>;
|
|
11
|
-
declare abstract class GqlElement<TDefinition extends object, TInfer extends object = object> {
|
|
12
|
-
readonly $infer: TInfer;
|
|
13
|
-
private [GQL_ELEMENT_FACTORY];
|
|
14
|
-
private [GQL_ELEMENT_CONTEXT];
|
|
15
|
-
protected constructor(define: GqlElementDefinitionFactory<TDefinition>, getDeps?: () => GqlElement<any>[]);
|
|
16
|
-
static setContext<TElement extends GqlElement<any>>(element: TElement, context: GqlElementContext): void;
|
|
17
|
-
static createEvaluationGenerator(element: GqlElement<any>): Generator<Promise<void>, void, void>;
|
|
18
|
-
private static evaluateInstantly;
|
|
19
|
-
static evaluateSync(element: GqlElement<any>): void;
|
|
20
|
-
static get<TValue extends object>(element: GqlElement<TValue>): TValue;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region packages/core/src/utils/hidden.d.ts
|
|
24
|
-
type Hidden<T$1> = () => T$1;
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region packages/core/src/utils/type-utils.d.ts
|
|
27
|
-
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
|
|
28
|
-
type Tuple<T$1> = [T$1, ...T$1[]];
|
|
29
|
-
type StripFunctions<T$1 extends object> = { [K in keyof T$1 as K extends "$infer" ? never : T$1[K] extends ((...args: any[]) => any) ? never : K]: T$1[K] };
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region packages/core/src/types/type-foundation/const-value.d.ts
|
|
32
|
-
type ConstValue = string | number | boolean | null | undefined | {
|
|
33
|
-
readonly [key: string]: ConstValue;
|
|
34
|
-
} | readonly ConstValue[];
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region packages/core/src/types/type-foundation/type-modifier-core.generated.d.ts
|
|
37
|
-
type TypeModifier = string;
|
|
38
|
-
interface Op$1<T$1> {
|
|
39
|
-
readonly 0: T$1[];
|
|
40
|
-
readonly 1: T$1[] | null | undefined;
|
|
41
|
-
}
|
|
42
|
-
type Modified_0<T$1> = T$1;
|
|
43
|
-
type Modified_1<T$1> = T$1 | null | undefined;
|
|
44
|
-
type Modified_00<T$1> = Op$1<Modified_0<T$1>>[0];
|
|
45
|
-
type Modified_01<T$1> = Op$1<Modified_0<T$1>>[1];
|
|
46
|
-
type Modified_10<T$1> = Op$1<Modified_1<T$1>>[0];
|
|
47
|
-
type Modified_11<T$1> = Op$1<Modified_1<T$1>>[1];
|
|
48
|
-
type Modified_000<T$1> = Op$1<Modified_00<T$1>>[0];
|
|
49
|
-
type Modified_001<T$1> = Op$1<Modified_00<T$1>>[1];
|
|
50
|
-
type Modified_010<T$1> = Op$1<Modified_01<T$1>>[0];
|
|
51
|
-
type Modified_011<T$1> = Op$1<Modified_01<T$1>>[1];
|
|
52
|
-
type Modified_100<T$1> = Op$1<Modified_10<T$1>>[0];
|
|
53
|
-
type Modified_101<T$1> = Op$1<Modified_10<T$1>>[1];
|
|
54
|
-
type Modified_110<T$1> = Op$1<Modified_11<T$1>>[0];
|
|
55
|
-
type Modified_111<T$1> = Op$1<Modified_11<T$1>>[1];
|
|
56
|
-
type Modified_0000<T$1> = Op$1<Modified_000<T$1>>[0];
|
|
57
|
-
type Modified_0001<T$1> = Op$1<Modified_000<T$1>>[1];
|
|
58
|
-
type Modified_0010<T$1> = Op$1<Modified_001<T$1>>[0];
|
|
59
|
-
type Modified_0011<T$1> = Op$1<Modified_001<T$1>>[1];
|
|
60
|
-
type Modified_0100<T$1> = Op$1<Modified_010<T$1>>[0];
|
|
61
|
-
type Modified_0101<T$1> = Op$1<Modified_010<T$1>>[1];
|
|
62
|
-
type Modified_0110<T$1> = Op$1<Modified_011<T$1>>[0];
|
|
63
|
-
type Modified_0111<T$1> = Op$1<Modified_011<T$1>>[1];
|
|
64
|
-
type Modified_1000<T$1> = Op$1<Modified_100<T$1>>[0];
|
|
65
|
-
type Modified_1001<T$1> = Op$1<Modified_100<T$1>>[1];
|
|
66
|
-
type Modified_1010<T$1> = Op$1<Modified_101<T$1>>[0];
|
|
67
|
-
type Modified_1011<T$1> = Op$1<Modified_101<T$1>>[1];
|
|
68
|
-
type Modified_1100<T$1> = Op$1<Modified_110<T$1>>[0];
|
|
69
|
-
type Modified_1101<T$1> = Op$1<Modified_110<T$1>>[1];
|
|
70
|
-
type Modified_1110<T$1> = Op$1<Modified_111<T$1>>[0];
|
|
71
|
-
type Modified_1111<T$1> = Op$1<Modified_111<T$1>>[1];
|
|
72
|
-
type ApplyTypeModifier<T$1, M extends TypeModifier> = M extends "!" ? Modified_0<T$1> : M extends "?" ? Modified_1<T$1> : M extends "![]!" ? Modified_00<T$1> : M extends "![]?" ? Modified_01<T$1> : M extends "?[]!" ? Modified_10<T$1> : M extends "?[]?" ? Modified_11<T$1> : M extends "![]![]!" ? Modified_000<T$1> : M extends "![]![]?" ? Modified_001<T$1> : M extends "![]?[]!" ? Modified_010<T$1> : M extends "![]?[]?" ? Modified_011<T$1> : M extends "?[]![]!" ? Modified_100<T$1> : M extends "?[]![]?" ? Modified_101<T$1> : M extends "?[]?[]!" ? Modified_110<T$1> : M extends "?[]?[]?" ? Modified_111<T$1> : M extends "![]![]![]!" ? Modified_0000<T$1> : M extends "![]![]![]?" ? Modified_0001<T$1> : M extends "![]![]?[]!" ? Modified_0010<T$1> : M extends "![]![]?[]?" ? Modified_0011<T$1> : M extends "![]?[]![]!" ? Modified_0100<T$1> : M extends "![]?[]![]?" ? Modified_0101<T$1> : M extends "![]?[]?[]!" ? Modified_0110<T$1> : M extends "![]?[]?[]?" ? Modified_0111<T$1> : M extends "?[]![]![]!" ? Modified_1000<T$1> : M extends "?[]![]![]?" ? Modified_1001<T$1> : M extends "?[]![]?[]!" ? Modified_1010<T$1> : M extends "?[]![]?[]?" ? Modified_1011<T$1> : M extends "?[]?[]![]!" ? Modified_1100<T$1> : M extends "?[]?[]![]?" ? Modified_1101<T$1> : M extends "?[]?[]?[]!" ? Modified_1110<T$1> : M extends "?[]?[]?[]?" ? Modified_1111<T$1> : never;
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region packages/core/src/types/type-foundation/type-profile.d.ts
|
|
75
|
-
interface PrimitiveTypeProfile {
|
|
76
|
-
readonly kind: "scalar" | "enum";
|
|
77
|
-
readonly name: string;
|
|
78
|
-
readonly value: any;
|
|
79
|
-
}
|
|
80
|
-
type TypeProfile = [PrimitiveTypeProfile] | {
|
|
81
|
-
readonly [key: string]: TypeProfile.WithMeta;
|
|
82
|
-
};
|
|
83
|
-
declare namespace TypeProfile {
|
|
84
|
-
type WITH_DEFAULT_INPUT = "with_default_input";
|
|
85
|
-
type WithMeta = [TypeProfile, TypeModifier, WITH_DEFAULT_INPUT?];
|
|
86
|
-
type Type<TProfile extends TypeProfile.WithMeta> = (TProfile[0] extends [PrimitiveTypeProfile] ? ApplyTypeModifier<TProfile[0][0]["value"], TProfile[1]> : { readonly [K in keyof TProfile[0]]: TProfile[0][K] extends TypeProfile.WithMeta ? Type<TProfile[0][K]> : never }) | (TProfile[2] extends WITH_DEFAULT_INPUT ? undefined : never);
|
|
87
|
-
type AssignableSignature<TProfile extends TypeProfile.WithMeta> = ApplyTypeModifier<"[TYPE_SIGNATURE]", TProfile[1]> | (TProfile[2] extends WITH_DEFAULT_INPUT ? undefined : never);
|
|
88
|
-
type Signature<TProfile extends TypeProfile.WithMeta> = ApplyTypeModifier<"[TYPE_SIGNATURE]", TProfile[1]> extends infer T ? TProfile[2] extends WITH_DEFAULT_INPUT ? Exclude<T, undefined> : T : never;
|
|
89
|
-
type AssignableVarRefMeta<TProfile extends TypeProfile.WithMeta> = {
|
|
90
|
-
profile: TProfile[0];
|
|
91
|
-
signature: AssignableSignature<TProfile>;
|
|
92
|
-
};
|
|
93
|
-
type AssigningVarRefMeta<TProfile extends TypeProfile.WithMeta> = {
|
|
94
|
-
profile: TProfile[0];
|
|
95
|
-
signature: Signature<TProfile>;
|
|
96
|
-
};
|
|
97
|
-
type AssignableType<TProfile extends TypeProfile.WithMeta> = ApplyTypeModifier<TProfile[0] extends [PrimitiveTypeProfile] ? TProfile[0][0]["value"] : { readonly [K in keyof TProfile[0]]: TProfile[0][K] extends TypeProfile.WithMeta ? AssignableType<TProfile[0][K]> : never }, TProfile[1]> | VarRef<AssignableVarRefMeta<TProfile>>;
|
|
98
|
-
type AssigningType<TProfile extends TypeProfile.WithMeta> = VarRef<AssigningVarRefMeta<TProfile>>;
|
|
99
|
-
}
|
|
100
|
-
type GetModifiedType<TProfile extends TypeProfile, TModifier extends TypeModifier> = TypeProfile.Type<[TProfile, TModifier]>;
|
|
101
|
-
type GetConstAssignableType<TProfile extends TypeProfile.WithMeta> = TypeProfile.Type<TProfile>;
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region packages/core/src/types/type-foundation/var-ref.d.ts
|
|
104
|
-
interface AnyVarRefMeta {
|
|
105
|
-
readonly profile: TypeProfile;
|
|
106
|
-
readonly signature: unknown;
|
|
107
|
-
}
|
|
108
|
-
type VarRefInner = {
|
|
109
|
-
type: "variable";
|
|
110
|
-
name: string;
|
|
111
|
-
} | {
|
|
112
|
-
type: "const-value";
|
|
113
|
-
value: ConstValue;
|
|
114
|
-
};
|
|
115
|
-
type AnyVarRef = VarRef<any>;
|
|
116
|
-
declare const __VAR_REF_BRAND__: unique symbol;
|
|
117
|
-
declare class VarRef<TMeta extends AnyVarRefMeta> {
|
|
118
|
-
private readonly inner;
|
|
119
|
-
readonly [__VAR_REF_BRAND__]: TMeta;
|
|
120
|
-
constructor(inner: VarRefInner);
|
|
121
|
-
static getInner(varRef: AnyVarRef): VarRefInner;
|
|
122
|
-
}
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region packages/core/src/utils/type-meta.d.ts
|
|
125
|
-
interface WithTypeMeta<T$1 extends object> {
|
|
126
|
-
readonly $type: T$1;
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region packages/core/src/types/type-foundation/type-modifier-extension.generated.d.ts
|
|
130
|
-
interface Op<T$1> {
|
|
131
|
-
readonly 0: T$1[];
|
|
132
|
-
readonly 1: T$1[] | null | undefined;
|
|
133
|
-
}
|
|
134
|
-
type Ref<TProfile extends TypeProfile.WithMeta> = VarRef<TypeProfile.AssignableVarRefMeta<TProfile>>;
|
|
135
|
-
type Assignable_0<T$1 extends TypeProfile.WithMeta> = TypeProfile.AssignableType<[T$1[0], "!", T$1[2]]>;
|
|
136
|
-
type Assignable_1<T$1 extends TypeProfile.WithMeta> = TypeProfile.AssignableType<[T$1[0], "?", T$1[2]]>;
|
|
137
|
-
type Assignable_00<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]!", T$1[2]]> | Op<Assignable_0<[T$1[0], "!"]>>[0];
|
|
138
|
-
type Assignable_01<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]?", T$1[2]]> | Op<Assignable_0<[T$1[0], "!"]>>[1];
|
|
139
|
-
type Assignable_10<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]!", T$1[2]]> | Op<Assignable_1<[T$1[0], "?"]>>[0];
|
|
140
|
-
type Assignable_11<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]?", T$1[2]]> | Op<Assignable_1<[T$1[0], "?"]>>[1];
|
|
141
|
-
type Assignable_000<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]![]!", T$1[2]]> | Op<Assignable_00<[T$1[0], "!"]>>[0];
|
|
142
|
-
type Assignable_001<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]![]?", T$1[2]]> | Op<Assignable_00<[T$1[0], "!"]>>[1];
|
|
143
|
-
type Assignable_010<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]?[]!", T$1[2]]> | Op<Assignable_01<[T$1[0], "!"]>>[0];
|
|
144
|
-
type Assignable_011<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]?[]?", T$1[2]]> | Op<Assignable_01<[T$1[0], "!"]>>[1];
|
|
145
|
-
type Assignable_100<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]![]!", T$1[2]]> | Op<Assignable_10<[T$1[0], "?"]>>[0];
|
|
146
|
-
type Assignable_101<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]![]?", T$1[2]]> | Op<Assignable_10<[T$1[0], "?"]>>[1];
|
|
147
|
-
type Assignable_110<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]?[]!", T$1[2]]> | Op<Assignable_11<[T$1[0], "?"]>>[0];
|
|
148
|
-
type Assignable_111<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]?[]?", T$1[2]]> | Op<Assignable_11<[T$1[0], "?"]>>[1];
|
|
149
|
-
type Assignable_0000<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]![]![]!", T$1[2]]> | Op<Assignable_000<[T$1[0], "!"]>>[0];
|
|
150
|
-
type Assignable_0001<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]![]![]?", T$1[2]]> | Op<Assignable_000<[T$1[0], "!"]>>[1];
|
|
151
|
-
type Assignable_0010<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]![]?[]!", T$1[2]]> | Op<Assignable_001<[T$1[0], "!"]>>[0];
|
|
152
|
-
type Assignable_0011<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]![]?[]?", T$1[2]]> | Op<Assignable_001<[T$1[0], "!"]>>[1];
|
|
153
|
-
type Assignable_0100<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]?[]![]!", T$1[2]]> | Op<Assignable_010<[T$1[0], "!"]>>[0];
|
|
154
|
-
type Assignable_0101<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]?[]![]?", T$1[2]]> | Op<Assignable_010<[T$1[0], "!"]>>[1];
|
|
155
|
-
type Assignable_0110<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]?[]?[]!", T$1[2]]> | Op<Assignable_011<[T$1[0], "!"]>>[0];
|
|
156
|
-
type Assignable_0111<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "![]?[]?[]?", T$1[2]]> | Op<Assignable_011<[T$1[0], "!"]>>[1];
|
|
157
|
-
type Assignable_1000<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]![]![]!", T$1[2]]> | Op<Assignable_100<[T$1[0], "?"]>>[0];
|
|
158
|
-
type Assignable_1001<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]![]![]?", T$1[2]]> | Op<Assignable_100<[T$1[0], "?"]>>[1];
|
|
159
|
-
type Assignable_1010<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]![]?[]!", T$1[2]]> | Op<Assignable_101<[T$1[0], "?"]>>[0];
|
|
160
|
-
type Assignable_1011<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]![]?[]?", T$1[2]]> | Op<Assignable_101<[T$1[0], "?"]>>[1];
|
|
161
|
-
type Assignable_1100<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]?[]![]!", T$1[2]]> | Op<Assignable_110<[T$1[0], "?"]>>[0];
|
|
162
|
-
type Assignable_1101<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]?[]![]?", T$1[2]]> | Op<Assignable_110<[T$1[0], "?"]>>[1];
|
|
163
|
-
type Assignable_1110<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]?[]?[]!", T$1[2]]> | Op<Assignable_111<[T$1[0], "?"]>>[0];
|
|
164
|
-
type Assignable_1111<T$1 extends TypeProfile.WithMeta> = Ref<[T$1[0], "?[]?[]?[]?", T$1[2]]> | Op<Assignable_111<[T$1[0], "?"]>>[1];
|
|
165
|
-
type GetAssignableType<T$1 extends TypeProfile.WithMeta> = T$1[1] extends "!" ? Assignable_0<T$1> : T$1[1] extends "?" ? Assignable_1<T$1> : T$1[1] extends "![]!" ? Assignable_00<T$1> : T$1[1] extends "![]?" ? Assignable_01<T$1> : T$1[1] extends "?[]!" ? Assignable_10<T$1> : T$1[1] extends "?[]?" ? Assignable_11<T$1> : T$1[1] extends "![]![]!" ? Assignable_000<T$1> : T$1[1] extends "![]![]?" ? Assignable_001<T$1> : T$1[1] extends "![]?[]!" ? Assignable_010<T$1> : T$1[1] extends "![]?[]?" ? Assignable_011<T$1> : T$1[1] extends "?[]![]!" ? Assignable_100<T$1> : T$1[1] extends "?[]![]?" ? Assignable_101<T$1> : T$1[1] extends "?[]?[]!" ? Assignable_110<T$1> : T$1[1] extends "?[]?[]?" ? Assignable_111<T$1> : T$1[1] extends "![]![]![]!" ? Assignable_0000<T$1> : T$1[1] extends "![]![]![]?" ? Assignable_0001<T$1> : T$1[1] extends "![]![]?[]!" ? Assignable_0010<T$1> : T$1[1] extends "![]![]?[]?" ? Assignable_0011<T$1> : T$1[1] extends "![]?[]![]!" ? Assignable_0100<T$1> : T$1[1] extends "![]?[]![]?" ? Assignable_0101<T$1> : T$1[1] extends "![]?[]?[]!" ? Assignable_0110<T$1> : T$1[1] extends "![]?[]?[]?" ? Assignable_0111<T$1> : T$1[1] extends "?[]![]![]!" ? Assignable_1000<T$1> : T$1[1] extends "?[]![]![]?" ? Assignable_1001<T$1> : T$1[1] extends "?[]![]?[]!" ? Assignable_1010<T$1> : T$1[1] extends "?[]![]?[]?" ? Assignable_1011<T$1> : T$1[1] extends "?[]?[]![]!" ? Assignable_1100<T$1> : T$1[1] extends "?[]?[]![]?" ? Assignable_1101<T$1> : T$1[1] extends "?[]?[]?[]!" ? Assignable_1110<T$1> : T$1[1] extends "?[]?[]?[]?" ? Assignable_1111<T$1> : never;
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region packages/core/src/types/type-foundation/type-specifier.d.ts
|
|
168
|
-
type AnyDefaultValue = {
|
|
169
|
-
default: ConstValue;
|
|
170
|
-
};
|
|
171
|
-
type InputTypeKind = "scalar" | "enum" | "input";
|
|
172
|
-
type OutputTypeKind = "scalar" | "enum" | "object" | "union" | "typename";
|
|
173
|
-
type AbstractInputTypeSpecifier<TKind extends InputTypeKind> = {
|
|
174
|
-
readonly kind: TKind;
|
|
175
|
-
readonly name: string;
|
|
176
|
-
readonly modifier: TypeModifier;
|
|
177
|
-
readonly defaultValue: AnyDefaultValue | null;
|
|
178
|
-
};
|
|
179
|
-
type InputTypeSpecifiers = {
|
|
180
|
-
[key: string]: InputTypeSpecifier;
|
|
181
|
-
};
|
|
182
|
-
type InputTypeSpecifier = InputScalarSpecifier | InputEnumSpecifier | InputInputObjectSpecifier;
|
|
183
|
-
type InputScalarSpecifier = AbstractInputTypeSpecifier<"scalar">;
|
|
184
|
-
type InputEnumSpecifier = AbstractInputTypeSpecifier<"enum">;
|
|
185
|
-
type InputInputObjectSpecifier = AbstractInputTypeSpecifier<"input">;
|
|
186
|
-
type AbstractOutputTypeSpecifier<TKind extends OutputTypeKind> = {
|
|
187
|
-
readonly kind: TKind;
|
|
188
|
-
readonly name: string;
|
|
189
|
-
readonly modifier: TypeModifier;
|
|
190
|
-
readonly arguments: InputTypeSpecifiers;
|
|
191
|
-
};
|
|
192
|
-
type OutputTypeSpecifiers = {
|
|
193
|
-
[key: string]: OutputTypeSpecifier;
|
|
194
|
-
};
|
|
195
|
-
type OutputTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputObjectSpecifier | OutputUnionSpecifier | OutputTypenameSpecifier;
|
|
196
|
-
type OutputInferrableTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputTypenameSpecifier;
|
|
197
|
-
type OutputScalarSpecifier = AbstractOutputTypeSpecifier<"scalar">;
|
|
198
|
-
type OutputEnumSpecifier = AbstractOutputTypeSpecifier<"enum">;
|
|
199
|
-
type OutputObjectSpecifier = AbstractOutputTypeSpecifier<"object">;
|
|
200
|
-
type OutputUnionSpecifier = AbstractOutputTypeSpecifier<"union">;
|
|
201
|
-
type OutputTypenameSpecifier = AbstractOutputTypeSpecifier<"typename">;
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region packages/core/src/types/schema/schema.d.ts
|
|
204
|
-
type OperationType = keyof OperationRoots;
|
|
205
|
-
type AnyTypeName = string;
|
|
206
|
-
type AnyFieldName = string;
|
|
207
|
-
type AnyGraphqlSchema = {
|
|
208
|
-
readonly label: string;
|
|
209
|
-
readonly operations: OperationRoots;
|
|
210
|
-
readonly scalar: {
|
|
211
|
-
readonly [name: string]: ScalarDefinition<any>;
|
|
212
|
-
};
|
|
213
|
-
readonly enum: {
|
|
214
|
-
readonly [name: string]: EnumDefinition<any>;
|
|
215
|
-
};
|
|
216
|
-
readonly input: {
|
|
217
|
-
readonly [name: string]: InputDefinition;
|
|
218
|
-
};
|
|
219
|
-
readonly object: {
|
|
220
|
-
readonly [name: string]: ObjectDefinition;
|
|
221
|
-
};
|
|
222
|
-
readonly union: {
|
|
223
|
-
readonly [name: string]: UnionDefinition;
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
type OperationRoots = {
|
|
227
|
-
readonly query: string | null;
|
|
228
|
-
readonly mutation: string | null;
|
|
229
|
-
readonly subscription: string | null;
|
|
230
|
-
};
|
|
231
|
-
interface ScalarDefinition<T$1 extends {
|
|
232
|
-
name: string;
|
|
233
|
-
input: unknown;
|
|
234
|
-
output: unknown;
|
|
235
|
-
}> extends WithTypeMeta<{
|
|
236
|
-
input: T$1["input"];
|
|
237
|
-
inputProfile: {
|
|
238
|
-
kind: "scalar";
|
|
239
|
-
name: T$1["name"];
|
|
240
|
-
value: T$1["input"];
|
|
241
|
-
};
|
|
242
|
-
output: T$1["output"];
|
|
243
|
-
outputProfile: {
|
|
244
|
-
kind: "scalar";
|
|
245
|
-
name: T$1["name"];
|
|
246
|
-
value: T$1["output"];
|
|
247
|
-
};
|
|
248
|
-
}> {
|
|
249
|
-
readonly name: T$1["name"];
|
|
250
|
-
}
|
|
251
|
-
interface EnumDefinition<T$1 extends {
|
|
252
|
-
name: string;
|
|
253
|
-
values: string;
|
|
254
|
-
}> extends WithTypeMeta<{
|
|
255
|
-
name: T$1["name"];
|
|
256
|
-
inputProfile: {
|
|
257
|
-
kind: "enum";
|
|
258
|
-
name: T$1["name"];
|
|
259
|
-
value: T$1["values"];
|
|
260
|
-
};
|
|
261
|
-
outputProfile: {
|
|
262
|
-
kind: "enum";
|
|
263
|
-
name: T$1["name"];
|
|
264
|
-
value: T$1["values"];
|
|
265
|
-
};
|
|
266
|
-
}> {
|
|
267
|
-
readonly name: T$1["name"];
|
|
268
|
-
readonly values: { readonly [_ in T$1["values"]]: true };
|
|
269
|
-
}
|
|
270
|
-
interface InputDefinition {
|
|
271
|
-
readonly name: string;
|
|
272
|
-
readonly fields: InputTypeSpecifiers;
|
|
273
|
-
}
|
|
274
|
-
type ObjectDefinition = {
|
|
275
|
-
readonly name: string;
|
|
276
|
-
readonly fields: OutputTypeSpecifiers;
|
|
277
|
-
};
|
|
278
|
-
type UnionDefinition = {
|
|
279
|
-
readonly name: string;
|
|
280
|
-
readonly types: {
|
|
281
|
-
[typename: string]: true;
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
type InferInputProfile<TSchema extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = { [_ in TSchema["label"]]: [TSpecifier$1 extends InputScalarSpecifier ? [TSchema["scalar"][TSpecifier$1["name"]]["$type"]["inputProfile"]] : TSpecifier$1 extends InputEnumSpecifier ? [TSchema["enum"][TSpecifier$1["name"]]["$type"]["inputProfile"]] : TSchema["input"][TSpecifier$1["name"]]["fields"] extends infer TFields ? { [K in keyof TFields]: TFields[K] extends InputTypeSpecifier ? InferInputProfile<TSchema, TFields[K]> : never } : never, TSpecifier$1["modifier"], TSpecifier$1["defaultValue"] extends AnyDefaultValue ? TypeProfile.WITH_DEFAULT_INPUT : undefined] }[TSchema["label"]];
|
|
285
|
-
type InferOutputProfile<TSchema extends AnyGraphqlSchema, TSpecifier$1 extends OutputInferrableTypeSpecifier> = { [_ in TSchema["label"]]: [(TSpecifier$1 extends OutputScalarSpecifier ? TSchema["scalar"][TSpecifier$1["name"]] : TSchema["enum"][TSpecifier$1["name"]])["$type"]["outputProfile"]] }[TSchema["label"]];
|
|
286
|
-
//#endregion
|
|
287
|
-
//#region packages/core/src/types/fragment/assignable-input.d.ts
|
|
288
|
-
type AnyAssignableInputValue = ConstValue | AnyVarRef | {
|
|
289
|
-
[key: string]: AnyAssignableInputValue;
|
|
290
|
-
} | AnyAssignableInputValue[] | undefined | null;
|
|
291
|
-
type AnyAssignableInput = {
|
|
292
|
-
readonly [key: string]: AnyAssignableInputValue;
|
|
293
|
-
};
|
|
294
|
-
type IsOptional$1<TSpecifier$1 extends InputTypeSpecifier> = TSpecifier$1["modifier"] extends `${string}?` ? true : TSpecifier$1["defaultValue"] extends AnyDefaultValue ? true : false;
|
|
295
|
-
type AssignableInput<TSchema extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers as IsOptional$1<TSpecifiers[K]> extends true ? K : never]+?: AssignableInputValue<TSchema, TSpecifiers[K]> } & { readonly [K in keyof TSpecifiers as IsOptional$1<TSpecifiers[K]> extends false ? K : never]-?: AssignableInputValue<TSchema, TSpecifiers[K]> };
|
|
296
|
-
type AssignableInputValue<TSchema extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = GetAssignableType<InferInputProfile<TSchema, TSpecifier$1>>;
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region packages/core/src/types/fragment/directives.d.ts
|
|
299
|
-
type AnyDirectiveAttachments = {
|
|
300
|
-
readonly [key: string]: AnyAssignableInput;
|
|
301
|
-
};
|
|
302
|
-
//#endregion
|
|
303
|
-
//#region packages/core/src/types/schema/const-assignable-input.d.ts
|
|
304
|
-
type AnyConstAssignableInputValue = ConstValue;
|
|
305
|
-
type AnyConstAssignableInput = {
|
|
306
|
-
readonly [key: string]: AnyConstAssignableInputValue;
|
|
307
|
-
};
|
|
308
|
-
type IsOptional<TSpecifier$1 extends InputTypeSpecifier> = TSpecifier$1["modifier"] extends `${string}?` ? true : TSpecifier$1["defaultValue"] extends AnyDefaultValue ? true : false;
|
|
309
|
-
type ConstAssignableInput<TSchema extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers as IsOptional<TSpecifiers[K]> extends true ? K : never]+?: ConstAssignableInputValue<TSchema, TSpecifiers[K]> } & { readonly [K in keyof TSpecifiers as IsOptional<TSpecifiers[K]> extends false ? K : never]-?: ConstAssignableInputValue<TSchema, TSpecifiers[K]> };
|
|
310
|
-
type ConstAssignableInputValue<TSchema extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = GetConstAssignableType<InferInputProfile<TSchema, TSpecifier$1>> & {};
|
|
311
|
-
//#endregion
|
|
312
|
-
//#region packages/core/src/types/fragment/field-selection.d.ts
|
|
313
|
-
/**
|
|
314
|
-
* Canonical representation of the field selections we collect during model and
|
|
315
|
-
* slice definition. Each alias maps to a typed field reference that still
|
|
316
|
-
* remembers its parent type, arguments, directives, and nested selections.
|
|
317
|
-
*/
|
|
318
|
-
type AnyFieldSelection = {
|
|
319
|
-
readonly parent: AnyTypeName;
|
|
320
|
-
readonly field: AnyFieldName;
|
|
321
|
-
readonly type: OutputTypeSpecifier;
|
|
322
|
-
readonly args: AnyAssignableInput;
|
|
323
|
-
readonly directives: AnyDirectiveAttachments;
|
|
324
|
-
readonly object: AnyNestedObject | null;
|
|
325
|
-
readonly union: AnyNestedUnion | null;
|
|
326
|
-
};
|
|
327
|
-
/** Nested selection produced when resolving an object field. */
|
|
328
|
-
type AnyNestedObject = {
|
|
329
|
-
readonly [alias: string]: AnyFieldSelection;
|
|
330
|
-
};
|
|
331
|
-
/** Nested selection produced when resolving a union field. */
|
|
332
|
-
type AnyNestedUnion = {
|
|
333
|
-
readonly [typeName: string]: AnyNestedObject | undefined;
|
|
334
|
-
};
|
|
335
|
-
/** Map of alias → field reference used by builders and inference. */
|
|
336
|
-
type AnyFields = {
|
|
337
|
-
readonly [alias: string]: AnyFieldSelection;
|
|
338
|
-
};
|
|
339
|
-
/** Resolve the data shape produced by a set of field selections. */
|
|
340
|
-
type InferFields<TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields> = { [_ in TSchema["label"]]: { [TAliasName in keyof TFields$1]: InferField<TSchema, TFields$1[TAliasName]> } & {} }[TSchema["label"]];
|
|
341
|
-
/** Resolve the data shape for a single field reference, including nested objects/unions. */
|
|
342
|
-
type InferField<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = (TSelection extends {
|
|
343
|
-
type: infer TSpecifier extends OutputObjectSpecifier;
|
|
344
|
-
object: infer TNested extends AnyNestedObject;
|
|
345
|
-
} ? ApplyTypeModifier<InferFields<TSchema, TNested>, TSpecifier["modifier"]> : never) | (TSelection extends {
|
|
346
|
-
type: infer TSpecifier extends OutputUnionSpecifier;
|
|
347
|
-
union: infer TNested extends AnyNestedUnion;
|
|
348
|
-
} ? ApplyTypeModifier<{ [TTypename in keyof TNested]: undefined extends TNested[TTypename] ? never : InferFields<TSchema, NonNullable<TNested[TTypename]>> }[keyof TNested], TSpecifier["modifier"]> : never) | (TSelection extends {
|
|
349
|
-
type: infer TSpecifier extends OutputInferrableTypeSpecifier;
|
|
350
|
-
} ? GetModifiedType<InferOutputProfile<TSchema, TSpecifier>, TSpecifier["modifier"]> : never);
|
|
351
|
-
//#endregion
|
|
352
|
-
//#region packages/core/src/types/fragment/field-path.d.ts
|
|
353
|
-
type AnyFieldPath = string;
|
|
354
|
-
/**
|
|
355
|
-
* Computes strongly typed "$.foo.bar" style selectors for a set of fields so
|
|
356
|
-
* slice result transforms can reference response paths safely.
|
|
357
|
-
*/
|
|
358
|
-
type AvailableFieldPathOf<TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields> = AvailableFieldPathsInner<TSchema, TFields$1, "$">;
|
|
359
|
-
/** Recursive helper used to build path strings for nested selections. */
|
|
360
|
-
type AvailableFieldPathsInner<TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields, TCurr extends AnyFieldPath> = { readonly [TAliasName in keyof TFields$1 & string]: `${TCurr}.${TAliasName}` | (TFields$1[TAliasName] extends {
|
|
361
|
-
object: infer TNested extends AnyNestedObject;
|
|
362
|
-
} ? AvailableFieldPathsInner<TSchema, TNested, `${TCurr}.${TAliasName}`> : never) }[keyof TFields$1 & string];
|
|
363
|
-
/** Resolve the TypeScript type located at a given field path. */
|
|
364
|
-
type InferByFieldPath<TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields, TPath extends AnyFieldPath> = string extends keyof TFields$1 ? any : TPath extends "$" ? never : InferByFieldPathInner<TSchema, TFields$1, TPath, "$">;
|
|
365
|
-
/** Internal helper that walks a field tree while matching a path literal. */
|
|
366
|
-
type InferByFieldPathInner<TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields, TPathTarget extends AnyFieldPath, TPathCurrent extends AnyFieldPath> = { readonly [TAliasName in keyof TFields$1]: TAliasName extends string ? `${TPathCurrent}.${TAliasName}` extends TPathTarget ? InferField<TSchema, TFields$1[TAliasName]> : TFields$1[TAliasName] extends {
|
|
367
|
-
object: infer TNested extends AnyNestedObject;
|
|
368
|
-
} ? InferByFieldPathInner<TSchema, TNested, TPathTarget, `${TPathCurrent}.${TAliasName}`> : never : never }[keyof TFields$1];
|
|
369
|
-
//#endregion
|
|
370
|
-
//#region packages/core/src/types/metadata/metadata.d.ts
|
|
371
|
-
/**
|
|
372
|
-
* Base metadata types that can be attached to operations.
|
|
373
|
-
* These are consumed at runtime by GraphQL clients for HTTP headers,
|
|
374
|
-
* extensions, and custom application-specific values.
|
|
375
|
-
*/
|
|
376
|
-
type OperationMetadata = {
|
|
377
|
-
/** HTTP headers to include with the GraphQL request */
|
|
378
|
-
readonly headers?: Record<string, string>;
|
|
379
|
-
/** GraphQL extensions to include in the request payload */
|
|
380
|
-
readonly extensions?: Record<string, unknown>;
|
|
381
|
-
/** Custom arbitrary metadata values for application-specific use */
|
|
382
|
-
readonly custom?: Record<string, unknown>;
|
|
383
|
-
};
|
|
384
|
-
/**
|
|
385
|
-
* Slice-specific metadata that can contribute to operation metadata.
|
|
386
|
-
* Extends OperationMetadata with no additional fields - use the `custom`
|
|
387
|
-
* property for application-specific values like authentication requirements
|
|
388
|
-
* or cache settings.
|
|
389
|
-
*/
|
|
390
|
-
type SliceMetadata = OperationMetadata;
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region packages/core/src/types/runtime/runtime-adapter.d.ts
|
|
393
|
-
/**
|
|
394
|
-
* Defines the runtime surface that the typed layer depends on. Implementations
|
|
395
|
-
* adapt framework-specific error payloads without leaking those types into the
|
|
396
|
-
* generated code.
|
|
397
|
-
*/
|
|
398
|
-
type AnyGraphqlRuntimeAdapter = {
|
|
399
|
-
nonGraphqlErrorType: Hidden<any>;
|
|
400
|
-
};
|
|
401
|
-
//#endregion
|
|
402
|
-
//#region packages/core/src/types/runtime/execution-result.d.ts
|
|
403
|
-
type NormalizedExecutionResult<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TData, TExtensions> = EmptyResult | GraphqlExecutionResult<TData, TExtensions> | NonGraphqlErrorResult<TRuntimeAdapter>;
|
|
404
|
-
type EmptyResult = {
|
|
405
|
-
type: "empty";
|
|
406
|
-
};
|
|
407
|
-
type GraphqlExecutionResult<TData, TExtensions> = {
|
|
408
|
-
type: "graphql";
|
|
409
|
-
body: FormattedExecutionResult<TData, TExtensions>;
|
|
410
|
-
};
|
|
411
|
-
type NonGraphqlErrorResult<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = {
|
|
412
|
-
type: "non-graphql-error";
|
|
413
|
-
error: ReturnType<TRuntimeAdapter["nonGraphqlErrorType"]>;
|
|
414
|
-
};
|
|
415
|
-
type NormalizedError<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = {
|
|
416
|
-
type: "graphql-error";
|
|
417
|
-
errors: GraphQLFormattedError[];
|
|
418
|
-
} | {
|
|
419
|
-
type: "non-graphql-error";
|
|
420
|
-
error: ReturnType<TRuntimeAdapter["nonGraphqlErrorType"]>;
|
|
421
|
-
} | {
|
|
422
|
-
type: "parse-error";
|
|
423
|
-
errors: Error[];
|
|
424
|
-
};
|
|
425
|
-
//#endregion
|
|
426
|
-
//#region packages/core/src/types/runtime/sliced-execution-result.d.ts
|
|
427
|
-
type AnySlicedExecutionResult = SlicedExecutionResult<any, AnyGraphqlRuntimeAdapter>;
|
|
428
|
-
type SafeUnwrapResult<TTransformed, TError> = {
|
|
429
|
-
data?: never;
|
|
430
|
-
error?: never;
|
|
431
|
-
} | {
|
|
432
|
-
data: TTransformed;
|
|
433
|
-
error?: never;
|
|
434
|
-
} | {
|
|
435
|
-
data?: never;
|
|
436
|
-
error: TError;
|
|
437
|
-
};
|
|
438
|
-
/** Utility signature returned by the safe unwrap helper. */
|
|
439
|
-
type SlicedExecutionResultCommon<TData, TError> = {
|
|
440
|
-
safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): SafeUnwrapResult<TTransformed, TError>;
|
|
441
|
-
};
|
|
442
|
-
/** Public union used by selection callbacks to inspect data, empty, or error states. */
|
|
443
|
-
type SlicedExecutionResult<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = SlicedExecutionResultEmpty<TData, TRuntimeAdapter> | SlicedExecutionResultSuccess<TData, TRuntimeAdapter> | SlicedExecutionResultError<TData, TRuntimeAdapter>;
|
|
444
|
-
/** Runtime guard interface shared by all slice result variants. */
|
|
445
|
-
declare class SlicedExecutionResultGuards<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> {
|
|
446
|
-
private readonly type;
|
|
447
|
-
isSuccess(): this is SlicedExecutionResultSuccess<TData, TRuntimeAdapter>;
|
|
448
|
-
isError(): this is SlicedExecutionResultError<TData, TRuntimeAdapter>;
|
|
449
|
-
isEmpty(): this is SlicedExecutionResultEmpty<TData, TRuntimeAdapter>;
|
|
450
|
-
constructor(type: "success" | "error" | "empty");
|
|
451
|
-
}
|
|
452
|
-
/** Variant representing an empty payload (no data, no error). */
|
|
453
|
-
declare class SlicedExecutionResultEmpty<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> extends SlicedExecutionResultGuards<TData, TRuntimeAdapter> implements SlicedExecutionResultCommon<TData, NormalizedError<TRuntimeAdapter>> {
|
|
454
|
-
constructor();
|
|
455
|
-
unwrap(): null;
|
|
456
|
-
safeUnwrap(): {
|
|
457
|
-
data: undefined;
|
|
458
|
-
error: undefined;
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
/** Variant representing a successful payload. */
|
|
462
|
-
declare class SlicedExecutionResultSuccess<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> extends SlicedExecutionResultGuards<TData, TRuntimeAdapter> implements SlicedExecutionResultCommon<TData, NormalizedError<TRuntimeAdapter>> {
|
|
463
|
-
readonly data: TData;
|
|
464
|
-
readonly extensions?: unknown | undefined;
|
|
465
|
-
constructor(data: TData, extensions?: unknown | undefined);
|
|
466
|
-
unwrap(): TData;
|
|
467
|
-
safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): {
|
|
468
|
-
data: TTransformed;
|
|
469
|
-
error: undefined;
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
/** Variant representing an error payload created by the adapter. */
|
|
473
|
-
declare class SlicedExecutionResultError<TData, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> extends SlicedExecutionResultGuards<TData, TRuntimeAdapter> implements SlicedExecutionResultCommon<TData, NormalizedError<TRuntimeAdapter>> {
|
|
474
|
-
readonly error: NormalizedError<TRuntimeAdapter>;
|
|
475
|
-
readonly extensions?: unknown | undefined;
|
|
476
|
-
constructor(error: NormalizedError<TRuntimeAdapter>, extensions?: unknown | undefined);
|
|
477
|
-
unwrap(): never;
|
|
478
|
-
safeUnwrap(): {
|
|
479
|
-
data: undefined;
|
|
480
|
-
error: NormalizedError<TRuntimeAdapter>;
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
//#endregion
|
|
484
|
-
//#region packages/core/src/types/runtime/projection.d.ts
|
|
485
|
-
/** Shape of a single selection slice projection. */
|
|
486
|
-
type AnyProjection = Projection<any>;
|
|
487
|
-
declare const __PROJECTION_BRAND__: unique symbol;
|
|
488
|
-
/**
|
|
489
|
-
* Nominal type representing any slice selection regardless of schema specifics.
|
|
490
|
-
* Encodes how individual slices map a concrete field path to a projection
|
|
491
|
-
* function. Multiple selections allow slices to expose several derived values.
|
|
492
|
-
*/
|
|
493
|
-
declare class Projection<TProjected> {
|
|
494
|
-
readonly projector: (result: AnySlicedExecutionResult) => TProjected;
|
|
495
|
-
readonly [__PROJECTION_BRAND__]: Hidden<never>;
|
|
496
|
-
constructor(paths: Tuple<string>, projector: (result: AnySlicedExecutionResult) => TProjected);
|
|
497
|
-
readonly paths: ProjectionPath[];
|
|
498
|
-
}
|
|
499
|
-
type ProjectionPath = {
|
|
500
|
-
full: string;
|
|
501
|
-
segments: Tuple<string>;
|
|
502
|
-
};
|
|
503
|
-
type InferExecutionResultProjection<TProjection extends AnyProjection> = ReturnType<TProjection["projector"]>;
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region packages/core/src/utils/empty-object.d.ts
|
|
506
|
-
declare const __EMPTY_SYMBOL__: unique symbol;
|
|
507
|
-
type EmptyObject = {
|
|
508
|
-
readonly [__EMPTY_SYMBOL__]: never;
|
|
509
|
-
};
|
|
510
|
-
type IsEmptyObject<T$1> = keyof (T$1 & EmptyObject) extends keyof EmptyObject ? true : false;
|
|
511
|
-
type SwitchIfEmpty<TTarget, TTrue, TFalse> = IsEmptyObject<TTarget> extends true ? TTrue : TFalse;
|
|
512
|
-
//#endregion
|
|
513
|
-
//#region packages/core/src/types/element/slice.d.ts
|
|
514
|
-
type AnySliceOf<TOperationType extends OperationType> = Slice<TOperationType, any, AnyFields, AnyProjection>;
|
|
515
|
-
type SliceInferMeta<TVariables, TProjected> = {
|
|
516
|
-
readonly input: TVariables;
|
|
517
|
-
readonly output: TProjected;
|
|
518
|
-
};
|
|
519
|
-
type SliceDefinition<TOperationType extends OperationType, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TProjection extends AnyProjection> = {
|
|
520
|
-
readonly operationType: TOperationType;
|
|
521
|
-
readonly embed: (variables: TVariables) => SlicePayload<TVariables, TFields$1, TProjection>;
|
|
522
|
-
};
|
|
523
|
-
declare const __OPERATION_SLICE_BRAND__: unique symbol;
|
|
524
|
-
declare class Slice<TOperationType extends OperationType, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TProjection extends AnyProjection> extends GqlElement<SliceDefinition<TOperationType, TVariables, TFields$1, TProjection>, SliceInferMeta<TVariables, InferExecutionResultProjection<TProjection>>> implements SliceDefinition<TOperationType, TVariables, TFields$1, TProjection> {
|
|
525
|
-
readonly [__OPERATION_SLICE_BRAND__]: Hidden<{
|
|
526
|
-
operationType: TOperationType;
|
|
527
|
-
output: InferExecutionResultProjection<TProjection>;
|
|
528
|
-
}>;
|
|
529
|
-
private constructor();
|
|
530
|
-
get operationType(): TOperationType;
|
|
531
|
-
get embed(): (variables: TVariables) => SlicePayload<TVariables, TFields$1, TProjection>;
|
|
532
|
-
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields, TProjection extends AnyProjection>(define: () => {
|
|
533
|
-
operationType: TOperationType;
|
|
534
|
-
embed: (variables: SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>) => SlicePayload<SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>, TFields$1, TProjection>;
|
|
535
|
-
}): Slice<TOperationType, SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>, TFields$1 & {
|
|
536
|
-
[key: symbol]: never;
|
|
537
|
-
}, TProjection>;
|
|
538
|
-
}
|
|
539
|
-
type AnySlicePayloads = {
|
|
540
|
-
[key: string]: AnySlicePayload;
|
|
541
|
-
};
|
|
542
|
-
type AnySlicePayload = SlicePayload<AnyAssignableInput | void, AnyFields, AnyProjection>;
|
|
543
|
-
type SlicePayload<TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TProjection extends AnyProjection> = {
|
|
544
|
-
variables: TVariables;
|
|
545
|
-
getFields: () => TFields$1;
|
|
546
|
-
projection: TProjection;
|
|
547
|
-
metadata?: SliceMetadata | Promise<SliceMetadata>;
|
|
548
|
-
};
|
|
549
|
-
//#endregion
|
|
550
|
-
//#region packages/core/src/types/element/composed-operation.d.ts
|
|
551
|
-
type AnyComposedOperationOf<TOperationType extends OperationType> = ComposedOperation<AnyGraphqlRuntimeAdapter, TOperationType, string, string[], any, any, any>;
|
|
552
|
-
type ComposedOperationInferMeta<TVariables, TRawData extends object, TProjectedData extends object> = {
|
|
553
|
-
readonly input: TVariables;
|
|
554
|
-
readonly output: {
|
|
555
|
-
readonly raw: TRawData;
|
|
556
|
-
readonly projected: TProjectedData;
|
|
557
|
-
};
|
|
558
|
-
};
|
|
559
|
-
declare const __COMPOSED_OPERATION_BRAND__: unique symbol;
|
|
560
|
-
type ComposedOperationDefinition<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TRawData extends object, TProjectedData extends object> = {
|
|
561
|
-
readonly operationType: TOperationType;
|
|
562
|
-
readonly operationName: TOperationName;
|
|
563
|
-
readonly variableNames: TVariableNames;
|
|
564
|
-
readonly projectionPathGraph: ProjectionPathGraphNode;
|
|
565
|
-
readonly document: TypedDocumentNode<TRawData, TVariables>;
|
|
566
|
-
readonly parse: (result: NormalizedExecutionResult<TRuntimeAdapter, TRawData, any>) => TProjectedData;
|
|
567
|
-
readonly metadata?: OperationMetadata;
|
|
568
|
-
};
|
|
569
|
-
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>, ComposedOperationInferMeta<TVariables, TRawData, TProjectedData>> implements ComposedOperationDefinition<TRuntimeAdapter, TOperationType, TOperationName, TVariableNames, TVariables, TRawData, TProjectedData> {
|
|
570
|
-
readonly [__COMPOSED_OPERATION_BRAND__]: Hidden<{
|
|
571
|
-
operationType: TOperationType;
|
|
572
|
-
}>;
|
|
573
|
-
private constructor();
|
|
574
|
-
get operationType(): TOperationType;
|
|
575
|
-
get operationName(): TOperationName;
|
|
576
|
-
get variableNames(): TVariableNames;
|
|
577
|
-
get projectionPathGraph(): ProjectionPathGraphNode;
|
|
578
|
-
get document(): TypedDocumentNode<TRawData, TVariables>;
|
|
579
|
-
get parse(): (result: NormalizedExecutionResult<TRuntimeAdapter, TRawData, any>) => TProjectedData;
|
|
580
|
-
get metadata(): OperationMetadata | undefined;
|
|
581
|
-
static create<TSchema extends AnyGraphqlSchema, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TSliceFragments extends AnySlicePayloads>(define: (context: GqlElementContext | null) => {
|
|
582
|
-
operationType: TOperationType;
|
|
583
|
-
operationName: TOperationName;
|
|
584
|
-
variableNames: (keyof TVariableDefinitions & string)[];
|
|
585
|
-
projectionPathGraph: ProjectionPathGraphNode;
|
|
586
|
-
document: TypedDocumentNode<InferComposedOperationRawData<TSchema, TSliceFragments>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
587
|
-
parse: (result: NormalizedExecutionResult<TRuntimeAdapter, InferComposedOperationRawData<TSchema, TSliceFragments>, any>) => { [K in keyof TSliceFragments]: InferExecutionResultProjection<TSliceFragments[K]["projection"]> };
|
|
588
|
-
metadata?: OperationMetadata;
|
|
589
|
-
} | Promise<{
|
|
590
|
-
operationType: TOperationType;
|
|
591
|
-
operationName: TOperationName;
|
|
592
|
-
variableNames: (keyof TVariableDefinitions & string)[];
|
|
593
|
-
projectionPathGraph: ProjectionPathGraphNode;
|
|
594
|
-
document: TypedDocumentNode<InferComposedOperationRawData<TSchema, TSliceFragments>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
595
|
-
parse: (result: NormalizedExecutionResult<TRuntimeAdapter, InferComposedOperationRawData<TSchema, TSliceFragments>, any>) => { [K in keyof TSliceFragments]: InferExecutionResultProjection<TSliceFragments[K]["projection"]> };
|
|
596
|
-
metadata?: OperationMetadata;
|
|
597
|
-
}>): ComposedOperation<TRuntimeAdapter, TOperationType, TOperationName, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, InferComposedOperationRawData<TSchema, TSliceFragments>, { [K in keyof TSliceFragments]: InferExecutionResultProjection<TSliceFragments[K]["projection"]> }>;
|
|
598
|
-
}
|
|
599
|
-
type ProjectionPathGraphNode = {
|
|
600
|
-
readonly matches: {
|
|
601
|
-
label: string;
|
|
602
|
-
path: string;
|
|
603
|
-
exact: boolean;
|
|
604
|
-
}[];
|
|
605
|
-
readonly children: {
|
|
606
|
-
readonly [segment: string]: ProjectionPathGraphNode;
|
|
607
|
-
};
|
|
608
|
-
};
|
|
609
|
-
type ConcatSlicePayloads<TSlicePayloads extends AnySlicePayloads> = UnionToIntersection<{ [TLabel in keyof TSlicePayloads & string]: TSlicePayloads[TLabel] extends {
|
|
610
|
-
getFields: () => infer TFields;
|
|
611
|
-
} ? { [K in keyof TFields & string as `${TLabel}_${K}`]: TFields[K] } : {} }[keyof TSlicePayloads & string]> & AnyFields;
|
|
612
|
-
type InferComposedOperationRawData<TSchema extends AnyGraphqlSchema, TSlicePayloads extends AnySlicePayloads> = InferFields<TSchema, ConcatSlicePayloads<TSlicePayloads>>;
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region packages/core/src/types/element/execution-result-projection-builder.d.ts
|
|
615
|
-
type AnyExecutionResultProjectionsBuilder = ExecutionResultProjectionsBuilder<AnyGraphqlSchema, AnyGraphqlRuntimeAdapter, any, any>;
|
|
616
|
-
type ExecutionResultProjectionsBuilder<TSchema extends AnyGraphqlSchema, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TFields$1 extends AnyFields, TProjection extends AnyProjection> = (tools: {
|
|
617
|
-
select: ResultSelector<TSchema, TRuntimeAdapter, TFields$1>;
|
|
618
|
-
}) => TProjection;
|
|
619
|
-
type ResultSelector<TSchema extends AnyGraphqlSchema, TRuntimeAdapter extends AnyGraphqlRuntimeAdapter, TFields$1 extends AnyFields> = <TPaths extends Tuple<AvailableFieldPathOf<TSchema, TFields$1>>, TProjected>(paths: TPaths, projector: (result: NoInfer<SlicedExecutionResult<InferByResultSelectorPaths<TSchema, TFields$1, TPaths>, TRuntimeAdapter>>) => TProjected) => NoInfer<Projection<TProjected>>;
|
|
620
|
-
type InferByResultSelectorPaths<TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields, TPaths extends Tuple<AvailableFieldPathOf<TSchema, TFields$1>>> = TPaths extends string[] ? { [K in keyof TPaths]: TPaths[K] extends string ? InferByFieldPath<TSchema, TFields$1, TPaths[K]> : never } : never;
|
|
621
|
-
//#endregion
|
|
622
|
-
//#region packages/core/src/types/element/inline-operation.d.ts
|
|
623
|
-
type AnyInlineOperationOf<TOperationType extends OperationType> = InlineOperation<TOperationType, string, string[], any, AnyFields, any>;
|
|
624
|
-
type InlineOperationInferMeta<TVariables, TData extends object> = {
|
|
625
|
-
readonly input: TVariables;
|
|
626
|
-
readonly output: TData;
|
|
627
|
-
};
|
|
628
|
-
declare const __INLINE_OPERATION_BRAND__: unique symbol;
|
|
629
|
-
type InlineOperationArtifact<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields$1 extends Partial<AnyFields>, TData extends object> = {
|
|
630
|
-
readonly operationType: TOperationType;
|
|
631
|
-
readonly operationName: TOperationName;
|
|
632
|
-
readonly variableNames: TVariableNames;
|
|
633
|
-
readonly documentSource: () => TFields$1;
|
|
634
|
-
readonly document: TypedDocumentNode<TData, TVariables>;
|
|
635
|
-
readonly metadata?: OperationMetadata;
|
|
636
|
-
};
|
|
637
|
-
declare class InlineOperation<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields$1 extends Partial<AnyFields>, TData extends object> extends GqlElement<InlineOperationArtifact<TOperationType, TOperationName, TVariableNames, TVariables, TFields$1, TData>, InlineOperationInferMeta<TVariables, TData>> implements InlineOperationArtifact<TOperationType, TOperationName, TVariableNames, TVariables, TFields$1, TData> {
|
|
638
|
-
readonly [__INLINE_OPERATION_BRAND__]: Hidden<{
|
|
639
|
-
operationType: TOperationType;
|
|
640
|
-
}>;
|
|
641
|
-
private constructor();
|
|
642
|
-
get operationType(): TOperationType;
|
|
643
|
-
get operationName(): TOperationName;
|
|
644
|
-
get variableNames(): TVariableNames;
|
|
645
|
-
get documentSource(): () => TFields$1;
|
|
646
|
-
get document(): TypedDocumentNode<TData, TVariables>;
|
|
647
|
-
get metadata(): OperationMetadata | undefined;
|
|
648
|
-
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
649
|
-
operationType: TOperationType;
|
|
650
|
-
operationName: TOperationName;
|
|
651
|
-
variableNames: (keyof TVariableDefinitions & string)[];
|
|
652
|
-
documentSource: () => TFields$1;
|
|
653
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields$1>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
654
|
-
metadata?: OperationMetadata;
|
|
655
|
-
} | Promise<{
|
|
656
|
-
operationType: TOperationType;
|
|
657
|
-
operationName: TOperationName;
|
|
658
|
-
variableNames: (keyof TVariableDefinitions & string)[];
|
|
659
|
-
documentSource: () => TFields$1;
|
|
660
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields$1>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
661
|
-
metadata?: OperationMetadata;
|
|
662
|
-
}>): InlineOperation<TOperationType, TOperationName, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
663
|
-
}
|
|
664
|
-
//#endregion
|
|
665
|
-
//#region packages/core/src/types/element/model.d.ts
|
|
666
|
-
type AnyModel = Model<string, any, AnyFields, any, any>;
|
|
667
|
-
type ModelInferMeta<TVariables, TRaw extends object, TNormalized extends object> = {
|
|
668
|
-
readonly input: TVariables;
|
|
669
|
-
readonly output: {
|
|
670
|
-
readonly raw: TRaw;
|
|
671
|
-
readonly normalized: TNormalized;
|
|
672
|
-
};
|
|
673
|
-
};
|
|
674
|
-
interface ModelArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TRaw extends object, TNormalized extends object> {
|
|
675
|
-
readonly typename: TTypeName$1;
|
|
676
|
-
readonly fragment: (variables: TVariables) => TFields$1;
|
|
677
|
-
readonly normalize: (raw: TRaw) => TNormalized;
|
|
678
|
-
}
|
|
679
|
-
declare const __MODEL_BRAND__: unique symbol;
|
|
680
|
-
declare class Model<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TRaw extends object, TNormalized extends object> extends GqlElement<ModelArtifact<TTypeName$1, TVariables, TFields$1, TRaw, TNormalized>, ModelInferMeta<TVariables, TRaw, TNormalized>> implements ModelArtifact<TTypeName$1, TVariables, TFields$1, TRaw, TNormalized> {
|
|
681
|
-
readonly [__MODEL_BRAND__]: Hidden<{
|
|
682
|
-
input: TVariables;
|
|
683
|
-
output: TNormalized;
|
|
684
|
-
}>;
|
|
685
|
-
private constructor();
|
|
686
|
-
get typename(): TTypeName$1;
|
|
687
|
-
get fragment(): (variables: TVariables) => TFields$1;
|
|
688
|
-
get normalize(): (raw: TRaw) => TNormalized;
|
|
689
|
-
static create<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields, TNormalized extends object>(define: () => {
|
|
690
|
-
typename: TTypeName$1;
|
|
691
|
-
fragment: (variables: SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>) => TFields$1;
|
|
692
|
-
normalize: (raw: NoInfer<InferFields<TSchema, TFields$1>>) => TNormalized;
|
|
693
|
-
}): Model<TTypeName$1, SwitchIfEmpty<TVariableDefinitions, void, AssignableInput<TSchema, TVariableDefinitions>>, TFields$1 & {
|
|
694
|
-
[key: symbol]: never;
|
|
695
|
-
}, InferFields<TSchema, TFields$1> & {
|
|
696
|
-
[key: symbol]: never;
|
|
697
|
-
}, TNormalized>;
|
|
698
|
-
}
|
|
699
|
-
//#endregion
|
|
700
|
-
//#region packages/core/src/runtime/model.d.ts
|
|
701
|
-
type RuntimeModelInput = {
|
|
702
|
-
prebuild: StripFunctions<AnyModel>;
|
|
703
|
-
runtime: {
|
|
704
|
-
normalize: (raw: any) => object;
|
|
705
|
-
};
|
|
706
|
-
};
|
|
707
|
-
//#endregion
|
|
708
|
-
//#region packages/core/src/runtime/composed-operation.d.ts
|
|
709
|
-
type RuntimeComposedOperationInput = {
|
|
710
|
-
prebuild: StripFunctions<AnyComposedOperationOf<OperationType>>;
|
|
711
|
-
runtime: {
|
|
712
|
-
getSlices: (tools: {
|
|
713
|
-
$: AnyAssignableInput;
|
|
714
|
-
}) => {
|
|
715
|
-
[key: string]: AnySlicePayload;
|
|
716
|
-
};
|
|
717
|
-
};
|
|
718
|
-
};
|
|
719
|
-
//#endregion
|
|
720
|
-
//#region packages/core/src/runtime/inline-operation.d.ts
|
|
721
|
-
type RuntimeInlineOperationInput = {
|
|
722
|
-
prebuild: StripFunctions<AnyInlineOperationOf<OperationType>>;
|
|
723
|
-
runtime: {};
|
|
724
|
-
};
|
|
725
|
-
//#endregion
|
|
726
|
-
//#region packages/core/src/runtime/slice.d.ts
|
|
727
|
-
type RuntimeSliceInput = {
|
|
728
|
-
prebuild: StripFunctions<AnySliceOf<OperationType>>;
|
|
729
|
-
runtime: {
|
|
730
|
-
buildProjection: AnyExecutionResultProjectionsBuilder;
|
|
731
|
-
};
|
|
732
|
-
};
|
|
733
|
-
//#endregion
|
|
734
|
-
//#region packages/core/src/runtime/runtime-adapter.d.ts
|
|
735
|
-
type RuntimeAdapterFactory<TRuntimeAdapter extends AnyGraphqlRuntimeAdapter> = (tools: {
|
|
736
|
-
type: <T$1>() => Hidden<T$1>;
|
|
737
|
-
}) => TRuntimeAdapter;
|
|
738
|
-
declare const createRuntimeAdapter: <TRuntimeAdapter extends AnyGraphqlRuntimeAdapter>(factory: RuntimeAdapterFactory<TRuntimeAdapter>) => TRuntimeAdapter;
|
|
739
|
-
//#endregion
|
|
740
|
-
//#region packages/core/src/runtime/index.d.ts
|
|
741
|
-
declare const gqlRuntime: {
|
|
742
|
-
model: (input: RuntimeModelInput) => AnyModel;
|
|
743
|
-
composedOperation: (input: RuntimeComposedOperationInput) => AnyComposedOperationOf<OperationType>;
|
|
744
|
-
inlineOperation: (input: RuntimeInlineOperationInput) => AnyInlineOperationOf<OperationType>;
|
|
745
|
-
slice: (input: RuntimeSliceInput) => AnySliceOf<OperationType>;
|
|
746
|
-
getComposedOperation: (name: string) => AnyComposedOperationOf<keyof OperationRoots>;
|
|
747
|
-
getInlineOperation: (name: string) => AnyInlineOperationOf<keyof OperationRoots>;
|
|
748
|
-
};
|
|
749
|
-
//#endregion
|
|
750
|
-
export { createRuntimeAdapter, gqlRuntime };
|
|
751
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import { gqlRuntime } from "@soda-gql/core/runtime";
|
|
2
|
+
export { gqlRuntime };
|