@soda-gql/core 0.11.23 → 0.11.25
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 +6 -8
- package/dist/adapter.d.cts +2 -2
- package/dist/adapter.d.ts +2 -2
- package/dist/{index-ByiZ8zW7.d.ts → index-BJ6nWenl.d.ts} +302 -129
- package/dist/index-BJ6nWenl.d.ts.map +1 -0
- package/dist/{index-Bf6oZfHz.d.cts → index-BcK5E-j7.d.ts} +257 -126
- package/dist/index-BcK5E-j7.d.ts.map +1 -0
- package/dist/{index-DaqYJyC3.d.ts → index-D8HbO9Y9.d.cts} +257 -126
- package/dist/index-D8HbO9Y9.d.cts.map +1 -0
- package/dist/{index-VL5qHoc7.d.cts → index-HucRBWMQ.d.cts} +302 -129
- package/dist/index-HucRBWMQ.d.cts.map +1 -0
- package/dist/index.cjs +276 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +274 -83
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/{schema-builder-DapSlk1_.d.ts → schema-builder-DfC-aBUY.d.ts} +2 -2
- package/dist/{schema-builder-DapSlk1_.d.ts.map → schema-builder-DfC-aBUY.d.ts.map} +1 -1
- package/dist/{schema-builder-BWRKX1z0.d.cts → schema-builder-DsXxY5Rn.d.cts} +2 -2
- package/dist/{schema-builder-BWRKX1z0.d.cts.map → schema-builder-DsXxY5Rn.d.cts.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Bf6oZfHz.d.cts.map +0 -1
- package/dist/index-ByiZ8zW7.d.ts.map +0 -1
- package/dist/index-DaqYJyC3.d.ts.map +0 -1
- package/dist/index-VL5qHoc7.d.cts.map +0 -1
package/README.md
CHANGED
|
@@ -36,13 +36,12 @@ import { gql } from "@/graphql-system";
|
|
|
36
36
|
Fragments define reusable field selections for a specific GraphQL type:
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
export const userFragment = gql.default(({ fragment
|
|
39
|
+
export const userFragment = gql.default(({ fragment }) =>
|
|
40
40
|
fragment.User({
|
|
41
|
-
|
|
42
|
-
fields: ({ f, $ }) => ({
|
|
41
|
+
fields: ({ f }) => ({
|
|
43
42
|
...f.id(),
|
|
44
43
|
...f.name(),
|
|
45
|
-
...f.email(
|
|
44
|
+
...f.email(),
|
|
46
45
|
}),
|
|
47
46
|
}),
|
|
48
47
|
);
|
|
@@ -67,9 +66,9 @@ export const getUserQuery = gql.default(({ query, $var }) =>
|
|
|
67
66
|
export const getUserWithFragment = gql.default(({ query, $var }) =>
|
|
68
67
|
query.operation({
|
|
69
68
|
name: "GetUserWithFragment",
|
|
70
|
-
variables: { ...$var("id").ID("!")
|
|
69
|
+
variables: { ...$var("id").ID("!") },
|
|
71
70
|
fields: ({ f, $ }) => ({
|
|
72
|
-
...f.user({ id: $.id })((
|
|
71
|
+
...f.user({ id: $.id })(() => ({ ...userFragment.spread() })),
|
|
73
72
|
}),
|
|
74
73
|
}),
|
|
75
74
|
);
|
|
@@ -95,8 +94,7 @@ Variables are declared using a string-based type syntax:
|
|
|
95
94
|
| `...f.posts({ limit: 10 })` | Field with arguments |
|
|
96
95
|
| `...f.posts()(({ f }) => ({ ... }))` | Nested selection (curried) |
|
|
97
96
|
| `...f.id(null, { alias: "uuid" })` | Field with alias |
|
|
98
|
-
| `...
|
|
99
|
-
| `...userFragment.spread({})` | Use fragment fields |
|
|
97
|
+
| `...userFragment.spread()` | Use fragment fields |
|
|
100
98
|
|
|
101
99
|
## Understanding the Inject Module
|
|
102
100
|
|
package/dist/adapter.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Adapter } from "./index-
|
|
2
|
-
import { r as defineScalar } from "./schema-builder-
|
|
1
|
+
import { t as Adapter } from "./index-HucRBWMQ.cjs";
|
|
2
|
+
import { r as defineScalar } from "./schema-builder-DsXxY5Rn.cjs";
|
|
3
3
|
|
|
4
4
|
//#region packages/core/src/adapter/define-adapter.d.ts
|
|
5
5
|
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Adapter } from "./index-
|
|
2
|
-
import { r as defineScalar } from "./schema-builder-
|
|
1
|
+
import { t as Adapter } from "./index-BJ6nWenl.js";
|
|
2
|
+
import { r as defineScalar } from "./schema-builder-DfC-aBUY.js";
|
|
3
3
|
|
|
4
4
|
//#region packages/core/src/adapter/define-adapter.d.ts
|
|
5
5
|
|
|
@@ -76,55 +76,6 @@ type ConstValues = {
|
|
|
76
76
|
readonly [key: string]: ConstValue;
|
|
77
77
|
};
|
|
78
78
|
//#endregion
|
|
79
|
-
//#region packages/core/src/types/type-foundation/depth-counter.d.ts
|
|
80
|
-
/**
|
|
81
|
-
* Depth counter utilities for limiting type inference recursion.
|
|
82
|
-
*
|
|
83
|
-
* Used primarily to prevent infinite recursion in recursive input types
|
|
84
|
-
* like Hasura's `bool_exp` pattern where types reference themselves.
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
|
-
* A depth counter represented as a tuple.
|
|
88
|
-
* The length of the tuple represents the remaining depth.
|
|
89
|
-
*/
|
|
90
|
-
type DepthCounter = readonly unknown[];
|
|
91
|
-
/**
|
|
92
|
-
* Default depth limit for input type inference.
|
|
93
|
-
* Depth 3 allows:
|
|
94
|
-
* - Level 0: Top-level fields
|
|
95
|
-
* - Level 1: First-level nested objects
|
|
96
|
-
* - Level 2: Second-level nested objects
|
|
97
|
-
* - Level 3: Third-level nested objects (then stops)
|
|
98
|
-
*/
|
|
99
|
-
type DefaultDepth = [unknown, unknown, unknown];
|
|
100
|
-
/**
|
|
101
|
-
* Decrement depth by removing one element from the tuple.
|
|
102
|
-
* Returns empty tuple when depth is already exhausted.
|
|
103
|
-
*/
|
|
104
|
-
type DecrementDepth<D extends DepthCounter> = D extends readonly [unknown, ...infer Rest] ? Rest : [];
|
|
105
|
-
/**
|
|
106
|
-
* Check if depth counter is exhausted (empty tuple).
|
|
107
|
-
*/
|
|
108
|
-
type IsDepthExhausted<D extends DepthCounter> = D extends readonly [] ? true : false;
|
|
109
|
-
/**
|
|
110
|
-
* Convert a number literal to a depth counter tuple.
|
|
111
|
-
* Supports depths 0-10 (sufficient for most use cases).
|
|
112
|
-
*/
|
|
113
|
-
type NumberToDepth<N extends number> = N extends 0 ? [] : N extends 1 ? [unknown] : N extends 2 ? [unknown, unknown] : N extends 3 ? [unknown, unknown, unknown] : N extends 4 ? [unknown, unknown, unknown, unknown] : N extends 5 ? [unknown, unknown, unknown, unknown, unknown] : N extends 6 ? [unknown, unknown, unknown, unknown, unknown, unknown] : N extends 7 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown] : N extends 8 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown] : N extends 9 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown] : N extends 10 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown] : DefaultDepth;
|
|
114
|
-
/**
|
|
115
|
-
* Type for per-input-type depth overrides (number-based, as stored in schema).
|
|
116
|
-
*/
|
|
117
|
-
type InputDepthOverrides = Readonly<Record<string, number>>;
|
|
118
|
-
/**
|
|
119
|
-
* Get depth for a specific input type from schema overrides.
|
|
120
|
-
* Priority: per-type override > schema default > hardcoded DefaultDepth (3).
|
|
121
|
-
*
|
|
122
|
-
* @typeParam TOverrides - The input depth overrides from schema
|
|
123
|
-
* @typeParam TTypeName - The input type name to look up
|
|
124
|
-
* @typeParam TDefaultDepth - Optional schema-level default depth
|
|
125
|
-
*/
|
|
126
|
-
type GetInputTypeDepth<TOverrides extends InputDepthOverrides | undefined, TTypeName$1 extends string, TDefaultDepth extends number | undefined = undefined> = TOverrides extends InputDepthOverrides ? TTypeName$1 extends keyof TOverrides ? NumberToDepth<TOverrides[TTypeName$1]> : TDefaultDepth extends number ? NumberToDepth<TDefaultDepth> : DefaultDepth : TDefaultDepth extends number ? NumberToDepth<TDefaultDepth> : DefaultDepth;
|
|
127
|
-
//#endregion
|
|
128
79
|
//#region packages/core/src/types/type-foundation/type-modifier-core.generated.d.ts
|
|
129
80
|
type TypeModifier = string;
|
|
130
81
|
type ValidTypeModifier = "!" | "?" | "![]!" | "![]?" | "?[]!" | "?[]?" | "![]![]!" | "![]![]?" | "![]?[]!" | "![]?[]?" | "?[]![]!" | "?[]![]?" | "?[]?[]!" | "?[]?[]?" | "![]![]![]!" | "![]![]![]?" | "![]![]?[]!" | "![]![]?[]?" | "![]?[]![]!" | "![]?[]![]?" | "![]?[]?[]!" | "![]?[]?[]?" | "?[]![]![]!" | "?[]![]![]?" | "?[]![]?[]!" | "?[]![]?[]?" | "?[]?[]![]!" | "?[]?[]![]?" | "?[]?[]?[]!" | "?[]?[]?[]?";
|
|
@@ -160,7 +111,7 @@ type Modified_1100<T> = Op_0<Modified_110<T>>;
|
|
|
160
111
|
type Modified_1101<T> = Op_1<Modified_110<T>>;
|
|
161
112
|
type Modified_1110<T> = Op_0<Modified_111<T>>;
|
|
162
113
|
type Modified_1111<T> = Op_1<Modified_111<T>>;
|
|
163
|
-
type ApplyTypeModifier<T, M extends TypeModifier> = M extends "!" ? Modified_0<T> : M extends "?" ? Modified_1<T> : M extends "![]!" ? Modified_00<T> : M extends "![]?" ? Modified_01<T> : M extends "?[]!" ? Modified_10<T> : M extends "?[]?" ? Modified_11<T> : M extends "![]![]!" ? Modified_000<T> : M extends "![]![]?" ? Modified_001<T> : M extends "![]?[]!" ? Modified_010<T> : M extends "![]?[]?" ? Modified_011<T> : M extends "?[]![]!" ? Modified_100<T> : M extends "?[]![]?" ? Modified_101<T> : M extends "?[]?[]!" ? Modified_110<T> : M extends "?[]?[]?" ? Modified_111<T> : M extends "![]![]![]!" ? Modified_0000<T> : M extends "![]![]![]?" ? Modified_0001<T> : M extends "![]![]?[]!" ? Modified_0010<T> : M extends "![]![]?[]?" ? Modified_0011<T> : M extends "![]?[]![]!" ? Modified_0100<T> : M extends "![]?[]![]?" ? Modified_0101<T> : M extends "![]?[]?[]!" ? Modified_0110<T> : M extends "![]?[]?[]?" ? Modified_0111<T> : M extends "?[]![]![]!" ? Modified_1000<T> : M extends "?[]![]![]?" ? Modified_1001<T> : M extends "?[]![]?[]!" ? Modified_1010<T> : M extends "?[]![]?[]?" ? Modified_1011<T> : M extends "?[]?[]![]!" ? Modified_1100<T> : M extends "?[]?[]![]?" ? Modified_1101<T> : M extends "?[]?[]?[]!" ? Modified_1110<T> : M extends "?[]?[]?[]?" ? Modified_1111<T> : never;
|
|
114
|
+
type ApplyTypeModifier<T, M$1 extends TypeModifier> = M$1 extends "!" ? Modified_0<T> : M$1 extends "?" ? Modified_1<T> : M$1 extends "![]!" ? Modified_00<T> : M$1 extends "![]?" ? Modified_01<T> : M$1 extends "?[]!" ? Modified_10<T> : M$1 extends "?[]?" ? Modified_11<T> : M$1 extends "![]![]!" ? Modified_000<T> : M$1 extends "![]![]?" ? Modified_001<T> : M$1 extends "![]?[]!" ? Modified_010<T> : M$1 extends "![]?[]?" ? Modified_011<T> : M$1 extends "?[]![]!" ? Modified_100<T> : M$1 extends "?[]![]?" ? Modified_101<T> : M$1 extends "?[]?[]!" ? Modified_110<T> : M$1 extends "?[]?[]?" ? Modified_111<T> : M$1 extends "![]![]![]!" ? Modified_0000<T> : M$1 extends "![]![]![]?" ? Modified_0001<T> : M$1 extends "![]![]?[]!" ? Modified_0010<T> : M$1 extends "![]![]?[]?" ? Modified_0011<T> : M$1 extends "![]?[]![]!" ? Modified_0100<T> : M$1 extends "![]?[]![]?" ? Modified_0101<T> : M$1 extends "![]?[]?[]!" ? Modified_0110<T> : M$1 extends "![]?[]?[]?" ? Modified_0111<T> : M$1 extends "?[]![]![]!" ? Modified_1000<T> : M$1 extends "?[]![]![]?" ? Modified_1001<T> : M$1 extends "?[]![]?[]!" ? Modified_1010<T> : M$1 extends "?[]![]?[]?" ? Modified_1011<T> : M$1 extends "?[]?[]![]!" ? Modified_1100<T> : M$1 extends "?[]?[]![]?" ? Modified_1101<T> : M$1 extends "?[]?[]?[]!" ? Modified_1110<T> : M$1 extends "?[]?[]?[]?" ? Modified_1111<T> : never;
|
|
164
115
|
type Signature_Required = "[TYPE_SIGNATURE]";
|
|
165
116
|
type Signature_Optional = Signature_Required | null | undefined;
|
|
166
117
|
type Signature_RequiredList_Required = Op_0<Signature_Required>;
|
|
@@ -191,7 +142,293 @@ type Signature_OptionalList_OptionalList_RequiredList_Required = Op_0<Signature_
|
|
|
191
142
|
type Signature_OptionalList_OptionalList_RequiredList_Optional = Op_1<Signature_OptionalList_OptionalList_Required>;
|
|
192
143
|
type Signature_OptionalList_OptionalList_OptionalList_Required = Op_0<Signature_OptionalList_OptionalList_Optional>;
|
|
193
144
|
type Signature_OptionalList_OptionalList_OptionalList_Optional = Op_1<Signature_OptionalList_OptionalList_Optional>;
|
|
194
|
-
type GetSignature<M extends TypeModifier> = M extends "!" ? Signature_Required : M extends "?" ? Signature_Optional : M extends "![]!" ? Signature_RequiredList_Required : M extends "![]?" ? Signature_RequiredList_Optional : M extends "?[]!" ? Signature_OptionalList_Required : M extends "?[]?" ? Signature_OptionalList_Optional : M extends "![]![]!" ? Signature_RequiredList_RequiredList_Required : M extends "![]![]?" ? Signature_RequiredList_RequiredList_Optional : M extends "![]?[]!" ? Signature_RequiredList_OptionalList_Required : M extends "![]?[]?" ? Signature_RequiredList_OptionalList_Optional : M extends "?[]![]!" ? Signature_OptionalList_RequiredList_Required : M extends "?[]![]?" ? Signature_OptionalList_RequiredList_Optional : M extends "?[]?[]!" ? Signature_OptionalList_OptionalList_Required : M extends "?[]?[]?" ? Signature_OptionalList_OptionalList_Optional : M extends "![]![]![]!" ? Signature_RequiredList_RequiredList_RequiredList_Required : M extends "![]![]![]?" ? Signature_RequiredList_RequiredList_RequiredList_Optional : M extends "![]![]?[]!" ? Signature_RequiredList_RequiredList_OptionalList_Required : M extends "![]![]?[]?" ? Signature_RequiredList_RequiredList_OptionalList_Optional : M extends "![]?[]![]!" ? Signature_RequiredList_OptionalList_RequiredList_Required : M extends "![]?[]![]?" ? Signature_RequiredList_OptionalList_RequiredList_Optional : M extends "![]?[]?[]!" ? Signature_RequiredList_OptionalList_OptionalList_Required : M extends "![]?[]?[]?" ? Signature_RequiredList_OptionalList_OptionalList_Optional : M extends "?[]![]![]!" ? Signature_OptionalList_RequiredList_RequiredList_Required : M extends "?[]![]![]?" ? Signature_OptionalList_RequiredList_RequiredList_Optional : M extends "?[]![]?[]!" ? Signature_OptionalList_RequiredList_OptionalList_Required : M extends "?[]![]?[]?" ? Signature_OptionalList_RequiredList_OptionalList_Optional : M extends "?[]?[]![]!" ? Signature_OptionalList_OptionalList_RequiredList_Required : M extends "?[]?[]![]?" ? Signature_OptionalList_OptionalList_RequiredList_Optional : M extends "?[]?[]?[]!" ? Signature_OptionalList_OptionalList_OptionalList_Required : M extends "?[]?[]?[]?" ? Signature_OptionalList_OptionalList_OptionalList_Optional : never;
|
|
145
|
+
type GetSignature<M$1 extends TypeModifier> = M$1 extends "!" ? Signature_Required : M$1 extends "?" ? Signature_Optional : M$1 extends "![]!" ? Signature_RequiredList_Required : M$1 extends "![]?" ? Signature_RequiredList_Optional : M$1 extends "?[]!" ? Signature_OptionalList_Required : M$1 extends "?[]?" ? Signature_OptionalList_Optional : M$1 extends "![]![]!" ? Signature_RequiredList_RequiredList_Required : M$1 extends "![]![]?" ? Signature_RequiredList_RequiredList_Optional : M$1 extends "![]?[]!" ? Signature_RequiredList_OptionalList_Required : M$1 extends "![]?[]?" ? Signature_RequiredList_OptionalList_Optional : M$1 extends "?[]![]!" ? Signature_OptionalList_RequiredList_Required : M$1 extends "?[]![]?" ? Signature_OptionalList_RequiredList_Optional : M$1 extends "?[]?[]!" ? Signature_OptionalList_OptionalList_Required : M$1 extends "?[]?[]?" ? Signature_OptionalList_OptionalList_Optional : M$1 extends "![]![]![]!" ? Signature_RequiredList_RequiredList_RequiredList_Required : M$1 extends "![]![]![]?" ? Signature_RequiredList_RequiredList_RequiredList_Optional : M$1 extends "![]![]?[]!" ? Signature_RequiredList_RequiredList_OptionalList_Required : M$1 extends "![]![]?[]?" ? Signature_RequiredList_RequiredList_OptionalList_Optional : M$1 extends "![]?[]![]!" ? Signature_RequiredList_OptionalList_RequiredList_Required : M$1 extends "![]?[]![]?" ? Signature_RequiredList_OptionalList_RequiredList_Optional : M$1 extends "![]?[]?[]!" ? Signature_RequiredList_OptionalList_OptionalList_Required : M$1 extends "![]?[]?[]?" ? Signature_RequiredList_OptionalList_OptionalList_Optional : M$1 extends "?[]![]![]!" ? Signature_OptionalList_RequiredList_RequiredList_Required : M$1 extends "?[]![]![]?" ? Signature_OptionalList_RequiredList_RequiredList_Optional : M$1 extends "?[]![]?[]!" ? Signature_OptionalList_RequiredList_OptionalList_Required : M$1 extends "?[]![]?[]?" ? Signature_OptionalList_RequiredList_OptionalList_Optional : M$1 extends "?[]?[]![]!" ? Signature_OptionalList_OptionalList_RequiredList_Required : M$1 extends "?[]?[]![]?" ? Signature_OptionalList_OptionalList_RequiredList_Optional : M$1 extends "?[]?[]?[]!" ? Signature_OptionalList_OptionalList_OptionalList_Required : M$1 extends "?[]?[]?[]?" ? Signature_OptionalList_OptionalList_OptionalList_Optional : never;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region packages/core/src/types/type-foundation/type-specifier.d.ts
|
|
148
|
+
type AnyDefaultValue = {
|
|
149
|
+
default: ConstValue;
|
|
150
|
+
};
|
|
151
|
+
type InputTypeKind = "scalar" | "enum" | "input" | "excluded";
|
|
152
|
+
type OutputTypeKind = "scalar" | "enum" | "object" | "union" | "typename" | "excluded";
|
|
153
|
+
type CreatableInputTypeKind = Exclude<InputTypeKind, "excluded">;
|
|
154
|
+
type CreatableOutputTypeKind = Exclude<OutputTypeKind, "excluded">;
|
|
155
|
+
type AnyTypeSpecifier = {
|
|
156
|
+
readonly kind: string;
|
|
157
|
+
readonly name: string;
|
|
158
|
+
readonly modifier: TypeModifier;
|
|
159
|
+
readonly defaultValue?: AnyDefaultValue | null;
|
|
160
|
+
readonly arguments?: InputTypeSpecifiers;
|
|
161
|
+
};
|
|
162
|
+
type AbstractInputTypeSpecifier<TKind extends InputTypeKind> = {
|
|
163
|
+
readonly kind: TKind;
|
|
164
|
+
readonly name: string;
|
|
165
|
+
readonly modifier: TypeModifier;
|
|
166
|
+
readonly defaultValue?: AnyDefaultValue | null;
|
|
167
|
+
};
|
|
168
|
+
type InputTypeSpecifiers = {
|
|
169
|
+
[key: string]: DeferredInputSpecifier;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* VarSpecifier is the structured format for operation variable definitions.
|
|
173
|
+
* Created by $var() at runtime, NOT from codegen.
|
|
174
|
+
*/
|
|
175
|
+
type VarSpecifier = {
|
|
176
|
+
readonly kind: CreatableInputTypeKind;
|
|
177
|
+
readonly name: string;
|
|
178
|
+
readonly modifier: TypeModifier;
|
|
179
|
+
readonly defaultValue: AnyDefaultValue | null;
|
|
180
|
+
readonly directives: Record<string, unknown>;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* VariableDefinitions is a record of VarSpecifier for operation variables.
|
|
184
|
+
* Used in operation/compat/extend composers.
|
|
185
|
+
*/
|
|
186
|
+
type VariableDefinitions = {
|
|
187
|
+
[key: string]: VarSpecifier;
|
|
188
|
+
};
|
|
189
|
+
type InputTypeSpecifier = InputScalarSpecifier | InputEnumSpecifier | InputInputObjectSpecifier | InputExcludedSpecifier;
|
|
190
|
+
type InputInferrableTypeSpecifier = InputScalarSpecifier | InputEnumSpecifier;
|
|
191
|
+
type InputScalarSpecifier = AbstractInputTypeSpecifier<"scalar">;
|
|
192
|
+
type InputEnumSpecifier = AbstractInputTypeSpecifier<"enum">;
|
|
193
|
+
type InputInputObjectSpecifier = AbstractInputTypeSpecifier<"input">;
|
|
194
|
+
type InputExcludedSpecifier = AbstractInputTypeSpecifier<"excluded">;
|
|
195
|
+
type AbstractOutputTypeSpecifier<TKind extends OutputTypeKind> = {
|
|
196
|
+
readonly kind: TKind;
|
|
197
|
+
readonly name: string;
|
|
198
|
+
readonly modifier: TypeModifier;
|
|
199
|
+
readonly arguments: InputTypeSpecifiers;
|
|
200
|
+
};
|
|
201
|
+
type OutputTypeSpecifiers = {
|
|
202
|
+
readonly [key: string]: DeferredOutputFieldWithArgs;
|
|
203
|
+
};
|
|
204
|
+
type OutputTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputObjectSpecifier | OutputUnionSpecifier | OutputTypenameSpecifier | OutputExcludedSpecifier;
|
|
205
|
+
type OutputInferrableTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputTypenameSpecifier;
|
|
206
|
+
type OutputScalarSpecifier = AbstractOutputTypeSpecifier<"scalar">;
|
|
207
|
+
type OutputEnumSpecifier = AbstractOutputTypeSpecifier<"enum">;
|
|
208
|
+
type OutputObjectSpecifier = AbstractOutputTypeSpecifier<"object">;
|
|
209
|
+
type OutputUnionSpecifier = AbstractOutputTypeSpecifier<"union">;
|
|
210
|
+
type OutputTypenameSpecifier = AbstractOutputTypeSpecifier<"typename">;
|
|
211
|
+
type OutputExcludedSpecifier = AbstractOutputTypeSpecifier<"excluded">;
|
|
212
|
+
/**
|
|
213
|
+
* Deferred input specifier string format: "{kind}|{name}|{modifier}[|D]"
|
|
214
|
+
* - s=scalar, e=enum, i=input
|
|
215
|
+
* - Trailing |D indicates default value present
|
|
216
|
+
*/
|
|
217
|
+
type DeferredInputSpecifier = `${"s" | "e" | "i"}|${string}|${TypeModifier}${string}`;
|
|
218
|
+
/**
|
|
219
|
+
* Deferred output specifier string format: "{kind}|{name}|{modifier}"
|
|
220
|
+
* - s=scalar, e=enum, o=object, u=union
|
|
221
|
+
* - No inline arguments - use DeferredOutputFieldWithArgs for fields with arguments
|
|
222
|
+
*/
|
|
223
|
+
type DeferredOutputSpecifier = `${"s" | "e" | "o" | "u"}|${string}|${TypeModifier}`;
|
|
224
|
+
/**
|
|
225
|
+
* Output field specifier with arguments extracted to a separate object.
|
|
226
|
+
* Used for fields that have arguments (e.g., user(id: ID!): User)
|
|
227
|
+
* Generated by codegen for improved readability.
|
|
228
|
+
*/
|
|
229
|
+
type DeferredOutputFieldWithArgs = {
|
|
230
|
+
readonly spec: DeferredOutputSpecifier;
|
|
231
|
+
readonly arguments: InputTypeSpecifiers;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Union type for output field specifiers (for backward compatibility in runtime parsers).
|
|
235
|
+
*
|
|
236
|
+
* Note: For schema definitions, use `OutputTypeSpecifiers` which enforces object format only.
|
|
237
|
+
* This union is maintained for `parseOutputField()` to handle legacy string formats.
|
|
238
|
+
*/
|
|
239
|
+
type DeferredOutputField = DeferredOutputSpecifier | DeferredOutputFieldWithArgs;
|
|
240
|
+
/**
|
|
241
|
+
* Deferred specifier for inferable output types (scalar, enum).
|
|
242
|
+
* Used for types that can be directly inferred without nested selection.
|
|
243
|
+
*/
|
|
244
|
+
type DeferredOutputInferrableSpecifier = `${"s" | "e"}|${string}|${TypeModifier}`;
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region packages/core/src/types/type-foundation/deferred-specifier.d.ts
|
|
247
|
+
/**
|
|
248
|
+
* Parse input kind character to full kind name
|
|
249
|
+
* s=scalar, e=enum, i=input
|
|
250
|
+
*/
|
|
251
|
+
type ParseInputKind<K$1 extends string> = K$1 extends "s" ? "scalar" : K$1 extends "e" ? "enum" : K$1 extends "i" ? "input" : never;
|
|
252
|
+
/**
|
|
253
|
+
* Parse output kind character to full kind name
|
|
254
|
+
* s=scalar, e=enum, o=object, u=union
|
|
255
|
+
*/
|
|
256
|
+
type ParseOutputKind<K$1 extends string> = K$1 extends "s" ? "scalar" : K$1 extends "e" ? "enum" : K$1 extends "o" ? "object" : K$1 extends "u" ? "union" : never;
|
|
257
|
+
/**
|
|
258
|
+
* Extract modifier portion, stopping at first | (for args separation)
|
|
259
|
+
*/
|
|
260
|
+
type ExtractModifier<S extends string> = S extends `${infer M}|${string}` ? M : S;
|
|
261
|
+
/**
|
|
262
|
+
* Parse basic specifier format: "k|name|modifier..."
|
|
263
|
+
* Returns { kind, name, modifier } or never if invalid
|
|
264
|
+
*/
|
|
265
|
+
type ParseBasicSpec<S extends string> = S extends `${infer K}|${infer Rest}` ? Rest extends `${infer N}|${infer M}` ? {
|
|
266
|
+
kind: K;
|
|
267
|
+
name: N;
|
|
268
|
+
modifier: ExtractModifier<M>;
|
|
269
|
+
} : never : never;
|
|
270
|
+
/**
|
|
271
|
+
* Parse deferred input specifier to structured type
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ParseDeferredInputSpec<"s|uuid|!">
|
|
275
|
+
* // { kind: "scalar"; name: "uuid"; modifier: "!"; defaultValue: null }
|
|
276
|
+
*
|
|
277
|
+
* ParseDeferredInputSpec<"e|order_by|?|D">
|
|
278
|
+
* // { kind: "enum"; name: "order_by"; modifier: "?"; defaultValue: { default: unknown } }
|
|
279
|
+
*/
|
|
280
|
+
type ParseDeferredInputSpec<S extends string> = ParseBasicSpec<S> extends {
|
|
281
|
+
kind: infer K extends string;
|
|
282
|
+
name: infer N;
|
|
283
|
+
modifier: infer M;
|
|
284
|
+
} ? M extends TypeModifier ? {
|
|
285
|
+
readonly kind: ParseInputKind<K>;
|
|
286
|
+
readonly name: N;
|
|
287
|
+
readonly modifier: M;
|
|
288
|
+
readonly defaultValue: S extends `${string}|D` ? {
|
|
289
|
+
default: unknown;
|
|
290
|
+
} : null;
|
|
291
|
+
} : never : never;
|
|
292
|
+
/**
|
|
293
|
+
* Parse deferred output specifier to structured type.
|
|
294
|
+
* Output specifiers no longer contain inline arguments - use DeferredOutputFieldWithArgs instead.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ParseDeferredOutputSpec<"o|users|![]!">
|
|
298
|
+
* // { kind: "object"; name: "users"; modifier: "![]!" }
|
|
299
|
+
*/
|
|
300
|
+
type ParseDeferredOutputSpec<S extends string> = ParseBasicSpec<S> extends {
|
|
301
|
+
kind: infer K extends string;
|
|
302
|
+
name: infer N;
|
|
303
|
+
modifier: infer M;
|
|
304
|
+
} ? M extends TypeModifier ? {
|
|
305
|
+
readonly kind: ParseOutputKind<K>;
|
|
306
|
+
readonly name: N;
|
|
307
|
+
readonly modifier: M;
|
|
308
|
+
} : never : never;
|
|
309
|
+
/**
|
|
310
|
+
* Resolve deferred input specifier to structured form
|
|
311
|
+
*/
|
|
312
|
+
type ResolveInputSpec<T extends string> = ParseDeferredInputSpec<T>;
|
|
313
|
+
/**
|
|
314
|
+
* Resolve deferred output specifier to structured form
|
|
315
|
+
*/
|
|
316
|
+
type ResolveOutputSpec<T extends string> = ParseDeferredOutputSpec<T>;
|
|
317
|
+
/**
|
|
318
|
+
* Get kind from deferred specifier string
|
|
319
|
+
*/
|
|
320
|
+
type GetSpecKind<T extends string> = ParseBasicSpec<T> extends {
|
|
321
|
+
kind: infer K extends string;
|
|
322
|
+
} ? K extends "s" ? "scalar" : K extends "e" ? "enum" : K extends "o" ? "object" : K extends "u" ? "union" : K extends "i" ? "input" : never : never;
|
|
323
|
+
/**
|
|
324
|
+
* Get name from deferred specifier string.
|
|
325
|
+
* Uses direct pattern matching with string constraint for better narrowing.
|
|
326
|
+
*/
|
|
327
|
+
type GetSpecName<T extends string> = T extends `${string}|${infer N extends string}|${string}` ? N : never;
|
|
328
|
+
/**
|
|
329
|
+
* Get modifier from deferred specifier string.
|
|
330
|
+
* Uses direct pattern matching with string constraint for better narrowing.
|
|
331
|
+
*/
|
|
332
|
+
type GetSpecModifier<T extends string> = T extends `${string}|${string}|${infer M extends string}` ? ExtractModifier<M> : never;
|
|
333
|
+
/**
|
|
334
|
+
* Get defaultValue indicator from deferred specifier string
|
|
335
|
+
* Returns AnyDefaultValue if |D suffix present, null otherwise
|
|
336
|
+
*
|
|
337
|
+
* Note: Returns AnyDefaultValue (not the actual value) because the deferred
|
|
338
|
+
* format only indicates presence, not the actual default value.
|
|
339
|
+
* This is sufficient for type-level checks like IsOptional.
|
|
340
|
+
*/
|
|
341
|
+
type GetSpecDefaultValue<T extends string> = T extends `${string}|D` ? AnyDefaultValue : null;
|
|
342
|
+
/**
|
|
343
|
+
* Extract the spec string from a field specifier.
|
|
344
|
+
* - String format: returns the string as-is
|
|
345
|
+
* - Object format: returns the spec property
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* GetFieldSpec<"o|User|!">
|
|
349
|
+
* // "o|User|!"
|
|
350
|
+
*
|
|
351
|
+
* GetFieldSpec<{ spec: "o|User|!", arguments: { id: "s|ID|!" } }>
|
|
352
|
+
* // "o|User|!"
|
|
353
|
+
*/
|
|
354
|
+
type GetFieldSpec<T extends DeferredOutputField> = T extends DeferredOutputFieldWithArgs ? T["spec"] : T;
|
|
355
|
+
/**
|
|
356
|
+
* Extract arguments from a field specifier.
|
|
357
|
+
* - String format (no arguments): returns {}
|
|
358
|
+
* - Object format: returns the arguments property
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* GetFieldArguments<{ spec: "o|User|!", arguments: { id: "s|ID|!" } }>
|
|
362
|
+
* // { id: "s|ID|!" }
|
|
363
|
+
*
|
|
364
|
+
* GetFieldArguments<"o|User|!">
|
|
365
|
+
* // {}
|
|
366
|
+
*/
|
|
367
|
+
type GetFieldArguments<T extends DeferredOutputField> = T extends DeferredOutputFieldWithArgs ? T["arguments"] : {};
|
|
368
|
+
/**
|
|
369
|
+
* Parse a field specifier to structured output type.
|
|
370
|
+
* - String format: parses the spec string
|
|
371
|
+
* - Object format: parses the spec and includes arguments
|
|
372
|
+
*/
|
|
373
|
+
type ParseFieldSpec<T extends DeferredOutputField> = T extends DeferredOutputFieldWithArgs ? ParseDeferredOutputSpec<T["spec"]> extends infer Base ? Base extends {
|
|
374
|
+
kind: infer K;
|
|
375
|
+
name: infer N;
|
|
376
|
+
modifier: infer M;
|
|
377
|
+
} ? {
|
|
378
|
+
readonly kind: K;
|
|
379
|
+
readonly name: N;
|
|
380
|
+
readonly modifier: M;
|
|
381
|
+
readonly arguments: T["arguments"];
|
|
382
|
+
} : never : never : ParseDeferredOutputSpec<T & string>;
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region packages/core/src/types/type-foundation/depth-counter.d.ts
|
|
385
|
+
/**
|
|
386
|
+
* Depth counter utilities for limiting type inference recursion.
|
|
387
|
+
*
|
|
388
|
+
* Used primarily to prevent infinite recursion in recursive input types
|
|
389
|
+
* like Hasura's `bool_exp` pattern where types reference themselves.
|
|
390
|
+
*/
|
|
391
|
+
/**
|
|
392
|
+
* A depth counter represented as a tuple.
|
|
393
|
+
* The length of the tuple represents the remaining depth.
|
|
394
|
+
*/
|
|
395
|
+
type DepthCounter = readonly unknown[];
|
|
396
|
+
/**
|
|
397
|
+
* Default depth limit for input type inference.
|
|
398
|
+
* Depth 3 allows:
|
|
399
|
+
* - Level 0: Top-level fields
|
|
400
|
+
* - Level 1: First-level nested objects
|
|
401
|
+
* - Level 2: Second-level nested objects
|
|
402
|
+
* - Level 3: Third-level nested objects (then stops)
|
|
403
|
+
*/
|
|
404
|
+
type DefaultDepth = [unknown, unknown, unknown];
|
|
405
|
+
/**
|
|
406
|
+
* Decrement depth by removing one element from the tuple.
|
|
407
|
+
* Returns empty tuple when depth is already exhausted.
|
|
408
|
+
*/
|
|
409
|
+
type DecrementDepth<D extends DepthCounter> = D extends readonly [unknown, ...infer Rest] ? Rest : [];
|
|
410
|
+
/**
|
|
411
|
+
* Check if depth counter is exhausted (empty tuple).
|
|
412
|
+
*/
|
|
413
|
+
type IsDepthExhausted<D extends DepthCounter> = D extends readonly [] ? true : false;
|
|
414
|
+
/**
|
|
415
|
+
* Convert a number literal to a depth counter tuple.
|
|
416
|
+
* Supports depths 0-10 (sufficient for most use cases).
|
|
417
|
+
*/
|
|
418
|
+
type NumberToDepth<N$1 extends number> = N$1 extends 0 ? [] : N$1 extends 1 ? [unknown] : N$1 extends 2 ? [unknown, unknown] : N$1 extends 3 ? [unknown, unknown, unknown] : N$1 extends 4 ? [unknown, unknown, unknown, unknown] : N$1 extends 5 ? [unknown, unknown, unknown, unknown, unknown] : N$1 extends 6 ? [unknown, unknown, unknown, unknown, unknown, unknown] : N$1 extends 7 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown] : N$1 extends 8 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown] : N$1 extends 9 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown] : N$1 extends 10 ? [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown] : DefaultDepth;
|
|
419
|
+
/**
|
|
420
|
+
* Type for per-input-type depth overrides (number-based, as stored in schema).
|
|
421
|
+
*/
|
|
422
|
+
type InputDepthOverrides = Readonly<Record<string, number>>;
|
|
423
|
+
/**
|
|
424
|
+
* Get depth for a specific input type from schema overrides.
|
|
425
|
+
* Priority: per-type override > schema default > hardcoded DefaultDepth (3).
|
|
426
|
+
*
|
|
427
|
+
* @typeParam TOverrides - The input depth overrides from schema
|
|
428
|
+
* @typeParam TTypeName - The input type name to look up
|
|
429
|
+
* @typeParam TDefaultDepth - Optional schema-level default depth
|
|
430
|
+
*/
|
|
431
|
+
type GetInputTypeDepth<TOverrides extends InputDepthOverrides | undefined, TTypeName$1 extends string, TDefaultDepth extends number | undefined = undefined> = TOverrides extends InputDepthOverrides ? TTypeName$1 extends keyof TOverrides ? NumberToDepth<TOverrides[TTypeName$1]> : TDefaultDepth extends number ? NumberToDepth<TDefaultDepth> : DefaultDepth : TDefaultDepth extends number ? NumberToDepth<TDefaultDepth> : DefaultDepth;
|
|
195
432
|
//#endregion
|
|
196
433
|
//#region packages/core/src/types/type-foundation/type-profile.d.ts
|
|
197
434
|
interface PrimitiveTypeProfile {
|
|
@@ -248,54 +485,6 @@ declare namespace TypeProfile {
|
|
|
248
485
|
type GetModifiedType<TProfile extends TypeProfile, TModifier extends TypeModifier> = TypeProfile.Type<[TProfile, TModifier]>;
|
|
249
486
|
type GetConstAssignableType<TProfile extends TypeProfile.WithMeta> = TypeProfile.Type<TProfile>;
|
|
250
487
|
//#endregion
|
|
251
|
-
//#region packages/core/src/types/type-foundation/type-specifier.d.ts
|
|
252
|
-
type AnyDefaultValue = {
|
|
253
|
-
default: ConstValue;
|
|
254
|
-
};
|
|
255
|
-
type InputTypeKind = "scalar" | "enum" | "input" | "excluded";
|
|
256
|
-
type OutputTypeKind = "scalar" | "enum" | "object" | "union" | "typename" | "excluded";
|
|
257
|
-
type CreatableInputTypeKind = Exclude<InputTypeKind, "excluded">;
|
|
258
|
-
type CreatableOutputTypeKind = Exclude<OutputTypeKind, "excluded">;
|
|
259
|
-
type AnyTypeSpecifier = {
|
|
260
|
-
readonly kind: string;
|
|
261
|
-
readonly name: string;
|
|
262
|
-
readonly modifier: TypeModifier;
|
|
263
|
-
readonly defaultValue?: AnyDefaultValue | null;
|
|
264
|
-
readonly arguments?: InputTypeSpecifiers;
|
|
265
|
-
};
|
|
266
|
-
type AbstractInputTypeSpecifier<TKind extends InputTypeKind> = {
|
|
267
|
-
readonly kind: TKind;
|
|
268
|
-
readonly name: string;
|
|
269
|
-
readonly modifier: TypeModifier;
|
|
270
|
-
readonly defaultValue?: AnyDefaultValue | null;
|
|
271
|
-
};
|
|
272
|
-
type InputTypeSpecifiers = {
|
|
273
|
-
[key: string]: InputTypeSpecifier;
|
|
274
|
-
};
|
|
275
|
-
type InputTypeSpecifier = InputScalarSpecifier | InputEnumSpecifier | InputInputObjectSpecifier | InputExcludedSpecifier;
|
|
276
|
-
type InputInferrableTypeSpecifier = InputScalarSpecifier | InputEnumSpecifier;
|
|
277
|
-
type InputScalarSpecifier = AbstractInputTypeSpecifier<"scalar">;
|
|
278
|
-
type InputEnumSpecifier = AbstractInputTypeSpecifier<"enum">;
|
|
279
|
-
type InputInputObjectSpecifier = AbstractInputTypeSpecifier<"input">;
|
|
280
|
-
type InputExcludedSpecifier = AbstractInputTypeSpecifier<"excluded">;
|
|
281
|
-
type AbstractOutputTypeSpecifier<TKind extends OutputTypeKind> = {
|
|
282
|
-
readonly kind: TKind;
|
|
283
|
-
readonly name: string;
|
|
284
|
-
readonly modifier: TypeModifier;
|
|
285
|
-
readonly arguments: InputTypeSpecifiers;
|
|
286
|
-
};
|
|
287
|
-
type OutputTypeSpecifiers = {
|
|
288
|
-
[key: string]: OutputTypeSpecifier;
|
|
289
|
-
};
|
|
290
|
-
type OutputTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputObjectSpecifier | OutputUnionSpecifier | OutputTypenameSpecifier | OutputExcludedSpecifier;
|
|
291
|
-
type OutputInferrableTypeSpecifier = OutputScalarSpecifier | OutputEnumSpecifier | OutputTypenameSpecifier;
|
|
292
|
-
type OutputScalarSpecifier = AbstractOutputTypeSpecifier<"scalar">;
|
|
293
|
-
type OutputEnumSpecifier = AbstractOutputTypeSpecifier<"enum">;
|
|
294
|
-
type OutputObjectSpecifier = AbstractOutputTypeSpecifier<"object">;
|
|
295
|
-
type OutputUnionSpecifier = AbstractOutputTypeSpecifier<"union">;
|
|
296
|
-
type OutputTypenameSpecifier = AbstractOutputTypeSpecifier<"typename">;
|
|
297
|
-
type OutputExcludedSpecifier = AbstractOutputTypeSpecifier<"excluded">;
|
|
298
|
-
//#endregion
|
|
299
488
|
//#region packages/core/src/types/type-foundation/var-ref.d.ts
|
|
300
489
|
/**
|
|
301
490
|
* VarRef meta interface using typeName + kind instead of full profile.
|
|
@@ -448,23 +637,25 @@ type UnionDefinition = {
|
|
|
448
637
|
* Infers a TypeProfile from an input type specifier.
|
|
449
638
|
*
|
|
450
639
|
* @typeParam TSchema - The GraphQL schema
|
|
451
|
-
* @typeParam TSpecifier - The input
|
|
640
|
+
* @typeParam TSpecifier - The deferred input specifier string
|
|
452
641
|
* @typeParam TDepth - Depth counter to limit recursion (default from schema overrides or schema default or 3 levels)
|
|
453
642
|
*
|
|
454
643
|
* When depth is exhausted, returns `never` to cause a type error.
|
|
455
644
|
* This prevents infinite recursion in self-referential types like `bool_exp`.
|
|
456
645
|
*/
|
|
457
|
-
type InferInputProfile<TSchema extends AnyGraphqlSchema, TSpecifier extends
|
|
646
|
+
type InferInputProfile<TSchema extends AnyGraphqlSchema, TSpecifier extends DeferredInputSpecifier, TDepth extends DepthCounter = GetInputTypeDepth<TSchema["__inputDepthOverrides"], GetSpecName<TSpecifier>, TSchema["__defaultInputDepth"]>> = { [_ in TSchema["label"]]: IsDepthExhausted<TDepth> extends true ? never : TSpecifier extends `s|${infer TName extends string}|${string}` ? [TSchema["scalar"][TName]["$type"]["inputProfile"], GetSpecModifier<TSpecifier>, TSpecifier extends `${string}|D` ? TypeProfile.WITH_DEFAULT_INPUT : undefined] : TSpecifier extends `e|${infer TName extends string}|${string}` ? [TSchema["enum"][TName]["$type"]["inputProfile"], GetSpecModifier<TSpecifier>, TSpecifier extends `${string}|D` ? TypeProfile.WITH_DEFAULT_INPUT : undefined] : TSpecifier extends `i|${infer TName extends string}|${string}` ? TSchema["input"][TName]["fields"] extends infer TFields ? [{
|
|
458
647
|
kind: "input";
|
|
459
|
-
name:
|
|
460
|
-
fields: { [K in keyof TFields]: TFields[K] extends
|
|
461
|
-
}
|
|
462
|
-
type InferOutputProfile<TSchema extends AnyGraphqlSchema, TSpecifier extends
|
|
648
|
+
name: TName;
|
|
649
|
+
fields: { [K in keyof TFields]: TFields[K] extends DeferredInputSpecifier ? InferInputProfile<TSchema, TFields[K], DecrementDepth<TDepth>> : never };
|
|
650
|
+
}, GetSpecModifier<TSpecifier>, TSpecifier extends `${string}|D` ? TypeProfile.WITH_DEFAULT_INPUT : undefined] : never : never }[TSchema["label"]];
|
|
651
|
+
type InferOutputProfile<TSchema extends AnyGraphqlSchema, TSpecifier extends DeferredOutputInferrableSpecifier> = { [_ in TSchema["label"]]: TSpecifier extends `s|${infer TName extends string}|${string}` ? TSchema["scalar"][TName]["$type"]["outputProfile"] : TSpecifier extends `e|${infer TName extends string}|${string}` ? TSchema["enum"][TName]["$type"]["outputProfile"] : never }[TSchema["label"]];
|
|
463
652
|
type PickTypeSpecifierByFieldName<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"], TFieldName$1 extends keyof TSchema["object"][TTypeName$1]["fields"]> = TSchema["object"][TTypeName$1]["fields"][TFieldName$1];
|
|
464
|
-
type InputFieldRecord<TSchema extends AnyGraphqlSchema, TSpecifier extends
|
|
653
|
+
type InputFieldRecord<TSchema extends AnyGraphqlSchema, TSpecifier extends DeferredInputSpecifier> = TSpecifier extends `i|${infer TName extends string}|${string}` ? TSchema["input"][TName]["fields"] : never;
|
|
465
654
|
type ObjectFieldRecord<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"]> = { readonly [TFieldName in keyof TSchema["object"][TTypeName$1]["fields"]]: TSchema["object"][TTypeName$1]["fields"][TFieldName] };
|
|
466
655
|
type UnionTypeRecord<TSchema extends AnyGraphqlSchema, TSpecifier extends OutputUnionSpecifier> = { readonly [TTypeName in UnionMemberName<TSchema, TSpecifier>]: TSchema["object"][TTypeName] };
|
|
467
|
-
type UnionMemberName<TSchema extends AnyGraphqlSchema, TSpecifier extends OutputUnionSpecifier> =
|
|
656
|
+
type UnionMemberName<TSchema extends AnyGraphqlSchema, TSpecifier extends OutputUnionSpecifier | DeferredOutputSpecifier> = TSpecifier extends {
|
|
657
|
+
name: infer TName extends string;
|
|
658
|
+
} ? Extract<keyof TSchema["object"], keyof TSchema["union"][TName]["types"]> & string : TSpecifier extends `u|${infer TName extends string}|${string}` ? Extract<keyof TSchema["object"], keyof TSchema["union"][TName]["types"]> & string : never;
|
|
468
659
|
/**
|
|
469
660
|
* Union of all input type names in a schema (scalars, enums, and input objects).
|
|
470
661
|
*/
|
|
@@ -472,7 +663,7 @@ type AllInputTypeNames<TSchema extends AnyGraphqlSchema> = (keyof TSchema["scala
|
|
|
472
663
|
/**
|
|
473
664
|
* Infers the input type kind from a type name.
|
|
474
665
|
*/
|
|
475
|
-
type InferInputKind<TSchema extends AnyGraphqlSchema, TName extends AllInputTypeNames<TSchema>> = TName extends keyof TSchema["scalar"] ? "scalar" : TName extends keyof TSchema["enum"] ? "enum" : TName extends keyof TSchema["input"] ? "input" : never;
|
|
666
|
+
type InferInputKind<TSchema extends AnyGraphqlSchema, TName$1 extends AllInputTypeNames<TSchema>> = TName$1 extends keyof TSchema["scalar"] ? "scalar" : TName$1 extends keyof TSchema["enum"] ? "enum" : TName$1 extends keyof TSchema["input"] ? "input" : never;
|
|
476
667
|
/**
|
|
477
668
|
* Resolves a TypeProfile from VarRefMetaV2 parameters (typeName + kind).
|
|
478
669
|
* This is used by schema-aware functions like getValueAt to resolve type structure
|
|
@@ -483,25 +674,7 @@ type InferInputKind<TSchema extends AnyGraphqlSchema, TName extends AllInputType
|
|
|
483
674
|
* @typeParam TKind - The type kind ("scalar" | "enum" | "input")
|
|
484
675
|
* @typeParam TModifier - The type modifier (e.g., "!", "?", "![]!")
|
|
485
676
|
*/
|
|
486
|
-
type ResolveInputProfileFromMeta<TSchema extends AnyGraphqlSchema, TTypeName$1 extends string, TKind extends "scalar" | "enum" | "input", TModifier extends TypeModifier> = TKind extends "scalar" ? InferInputProfile<TSchema, {
|
|
487
|
-
kind: "scalar";
|
|
488
|
-
name: TTypeName$1;
|
|
489
|
-
modifier: TModifier;
|
|
490
|
-
defaultValue: null;
|
|
491
|
-
directives: {};
|
|
492
|
-
}> : TKind extends "enum" ? InferInputProfile<TSchema, {
|
|
493
|
-
kind: "enum";
|
|
494
|
-
name: TTypeName$1;
|
|
495
|
-
modifier: TModifier;
|
|
496
|
-
defaultValue: null;
|
|
497
|
-
directives: {};
|
|
498
|
-
}> : InferInputProfile<TSchema, {
|
|
499
|
-
kind: "input";
|
|
500
|
-
name: TTypeName$1;
|
|
501
|
-
modifier: TModifier;
|
|
502
|
-
defaultValue: null;
|
|
503
|
-
directives: {};
|
|
504
|
-
}>;
|
|
677
|
+
type ResolveInputProfileFromMeta<TSchema extends AnyGraphqlSchema, TTypeName$1 extends string, TKind extends "scalar" | "enum" | "input", TModifier extends TypeModifier> = TKind extends "scalar" ? InferInputProfile<TSchema, `s|${TTypeName$1}|${TModifier}`> : TKind extends "enum" ? InferInputProfile<TSchema, `e|${TTypeName$1}|${TModifier}`> : InferInputProfile<TSchema, `i|${TTypeName$1}|${TModifier}`>;
|
|
505
678
|
//#endregion
|
|
506
679
|
//#region packages/core/src/types/metadata/metadata.d.ts
|
|
507
680
|
/**
|
|
@@ -746,5 +919,5 @@ declare const createDefaultAdapter: () => DefaultMetadataAdapter;
|
|
|
746
919
|
*/
|
|
747
920
|
declare const defaultMetadataAdapter: DefaultMetadataAdapter;
|
|
748
921
|
//#endregion
|
|
749
|
-
export {
|
|
750
|
-
//# sourceMappingURL=index-
|
|
922
|
+
export { PrimitiveTypeProfile as $, ConstValues as $t, InputDefinition as A, InputInferrableTypeSpecifier as At, UnionMemberName as B, OutputScalarSpecifier as Bt, AnyFieldName as C, DeferredInputSpecifier as Ct, InferInputKind as D, DeferredOutputSpecifier as Dt, EnumDefinition as E, DeferredOutputInferrableSpecifier as Et, OperationType as F, InputTypeSpecifiers as Ft, NestedValueElement as G, OutputUnionSpecifier as Gt, AnyVarRef as H, OutputTypeSpecifier as Ht, PickTypeSpecifierByFieldName as I, OutputEnumSpecifier as It, createVarRefFromNestedValue as J, ApplyTypeModifier as Jt, VarRef as K, VarSpecifier as Kt, ResolveInputProfileFromMeta as L, OutputExcludedSpecifier as Lt, ObjectDefinition as M, InputScalarSpecifier as Mt, ObjectFieldRecord as N, InputTypeKind as Nt, InferInputProfile as O, InputEnumSpecifier as Ot, OperationRoots as P, InputTypeSpecifier as Pt, ObjectTypeProfile as Q, ConstValue as Qt, ScalarDefinition as R, OutputInferrableTypeSpecifier as Rt, AllInputTypeNames as S, CreatableOutputTypeKind as St, AnyTypeName as T, DeferredOutputFieldWithArgs as Tt, AnyVarRefBrand as U, OutputTypeSpecifiers as Ut, UnionTypeRecord as V, OutputTypeKind as Vt, NestedValue as W, OutputTypenameSpecifier as Wt, GetConstAssignableType as X, TypeModifier as Xt, createVarRefFromVariable as Y, GetSignature as Yt, GetModifiedType as Z, ValidTypeModifier as Zt, FragmentMetadataBuilder as _, ResolveInputSpec as _t, DefaultMetadataAdapter as a, withFieldPath as an, InputDepthOverrides as at, MetadataBuilderTools as b, AnyTypeSpecifier as bt, ExtractAdapterTypes as c, GetFieldArguments as ct, MetadataAdapter as d, GetSpecKind as dt, FieldPath as en, TypeProfile as et, OperationDocumentTransformArgs as f, GetSpecModifier as ft, ExtractMetadata as g, ParseFieldSpec as gt, defaultMetadataAdapter as h, ParseDeferredOutputSpec as ht, DefaultAdapter as i, isListType as in, GetInputTypeDepth as it, InputFieldRecord as j, InputInputObjectSpecifier as jt, InferOutputProfile as k, InputExcludedSpecifier as kt, ExtractUnifiedAdapterTypes as l, GetFieldSpec as lt, createDefaultAdapter as m, ParseDeferredInputSpec as mt, AnyAdapter as n, appendToPath as nn, DefaultDepth as nt, DocumentTransformArgs as o, IsDepthExhausted as ot, OperationDocumentTransformer as p, GetSpecName as pt, VarRefInner as q, VariableDefinitions as qt, AnyMetadataAdapter as r, getCurrentFieldPath as rn, DepthCounter as rt, DocumentTransformer as s, NumberToDepth as st, Adapter as t, FieldPathSegment as tn, DecrementDepth as tt, FragmentMetaInfo as u, GetSpecDefaultValue as ut, FragmentMetadataBuilderTools as v, ResolveOutputSpec as vt, AnyGraphqlSchema as w, DeferredOutputField as wt, OperationMetadata as x, CreatableInputTypeKind as xt, MetadataBuilder as y, AnyDefaultValue as yt, UnionDefinition as z, OutputObjectSpecifier as zt };
|
|
923
|
+
//# sourceMappingURL=index-BJ6nWenl.d.ts.map
|