@soda-gql/colocation-tools 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.
@@ -0,0 +1,272 @@
1
+ import { AnyFields, AnyGraphqlSchema, AnyNestedObject, Fragment, GqlElementAttachment, InferField } from "@soda-gql/core";
2
+ import { FormattedExecutionResult, GraphQLFormattedError } from "graphql";
3
+
4
+ //#region packages/colocation-tools/src/types.d.ts
5
+
6
+ /**
7
+ * Generic non-GraphQL error type for framework-specific errors.
8
+ * Users can define their own error shape.
9
+ */
10
+ type NonGraphqlError = unknown;
11
+ /**
12
+ * Normalized execution result representing all possible outcomes
13
+ * from a GraphQL operation.
14
+ */
15
+ type NormalizedExecutionResult<TData, TExtensions> = EmptyResult | GraphqlExecutionResult<TData, TExtensions> | NonGraphqlErrorResult;
16
+ type EmptyResult = {
17
+ type: "empty";
18
+ };
19
+ type GraphqlExecutionResult<TData, TExtensions> = {
20
+ type: "graphql";
21
+ body: FormattedExecutionResult<TData, TExtensions>;
22
+ };
23
+ type NonGraphqlErrorResult = {
24
+ type: "non-graphql-error";
25
+ error: NonGraphqlError;
26
+ };
27
+ /**
28
+ * Error types that can occur during slice result processing.
29
+ */
30
+ type NormalizedError = {
31
+ type: "graphql-error";
32
+ errors: GraphQLFormattedError[];
33
+ } | {
34
+ type: "non-graphql-error";
35
+ error: NonGraphqlError;
36
+ } | {
37
+ type: "parse-error";
38
+ errors: Error[];
39
+ };
40
+ //#endregion
41
+ //#region packages/colocation-tools/src/sliced-execution-result.d.ts
42
+ type AnySlicedExecutionResult = SlicedExecutionResult<any>;
43
+ /**
44
+ * Internal discriminated union describing the Result-like wrapper exposed to
45
+ * slice selection callbacks.
46
+ */
47
+ type AnySlicedExecutionResultRecord = {
48
+ [path: string]: AnySlicedExecutionResult;
49
+ };
50
+ type SafeUnwrapResult<TTransformed, TError> = {
51
+ data?: never;
52
+ error?: never;
53
+ } | {
54
+ data: TTransformed;
55
+ error?: never;
56
+ } | {
57
+ data?: never;
58
+ error: TError;
59
+ };
60
+ /** Utility signature returned by the safe unwrap helper. */
61
+ type SlicedExecutionResultCommon<TData, TError> = {
62
+ safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): SafeUnwrapResult<TTransformed, TError>;
63
+ };
64
+ /** Public union used by selection callbacks to inspect data, empty, or error states. */
65
+ type SlicedExecutionResult<TData> = SlicedExecutionResultEmpty<TData> | SlicedExecutionResultSuccess<TData> | SlicedExecutionResultError<TData>;
66
+ /** Runtime guard interface shared by all slice result variants. */
67
+ declare class SlicedExecutionResultGuards<TData> {
68
+ private readonly type;
69
+ isSuccess(): this is SlicedExecutionResultSuccess<TData>;
70
+ isError(): this is SlicedExecutionResultError<TData>;
71
+ isEmpty(): this is SlicedExecutionResultEmpty<TData>;
72
+ constructor(type: "success" | "error" | "empty");
73
+ }
74
+ /** Variant representing an empty payload (no data, no error). */
75
+ declare class SlicedExecutionResultEmpty<TData> extends SlicedExecutionResultGuards<TData> implements SlicedExecutionResultCommon<TData, NormalizedError> {
76
+ constructor();
77
+ unwrap(): null;
78
+ safeUnwrap(): {
79
+ data: undefined;
80
+ error: undefined;
81
+ };
82
+ }
83
+ /** Variant representing a successful payload. */
84
+ declare class SlicedExecutionResultSuccess<TData> extends SlicedExecutionResultGuards<TData> implements SlicedExecutionResultCommon<TData, NormalizedError> {
85
+ readonly data: TData;
86
+ readonly extensions?: unknown | undefined;
87
+ constructor(data: TData, extensions?: unknown | undefined);
88
+ unwrap(): TData;
89
+ safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): {
90
+ data: TTransformed;
91
+ error: undefined;
92
+ };
93
+ }
94
+ /** Variant representing an error payload. */
95
+ declare class SlicedExecutionResultError<TData> extends SlicedExecutionResultGuards<TData> implements SlicedExecutionResultCommon<TData, NormalizedError> {
96
+ readonly error: NormalizedError;
97
+ readonly extensions?: unknown | undefined;
98
+ constructor(error: NormalizedError, extensions?: unknown | undefined);
99
+ unwrap(): never;
100
+ safeUnwrap(): {
101
+ data: undefined;
102
+ error: NormalizedError;
103
+ };
104
+ }
105
+ //#endregion
106
+ //#region packages/colocation-tools/src/utils/type-utils.d.ts
107
+ type Tuple<T> = [T, ...T[]];
108
+ //#endregion
109
+ //#region packages/colocation-tools/src/projection.d.ts
110
+ /** Shape of a single selection slice projection. */
111
+ type AnyProjection = Projection<any>;
112
+ declare const __PROJECTION_BRAND__: unique symbol;
113
+ /**
114
+ * Nominal type representing any slice selection regardless of schema specifics.
115
+ * Encodes how individual slices map a concrete field path to a projection
116
+ * function. Multiple selections allow slices to expose several derived values.
117
+ */
118
+ declare class Projection<TProjected> {
119
+ readonly projector: (result: AnySlicedExecutionResult) => TProjected;
120
+ readonly [__PROJECTION_BRAND__]: void;
121
+ readonly $infer: {
122
+ readonly output: TProjected;
123
+ };
124
+ constructor(paths: Tuple<string>, projector: (result: AnySlicedExecutionResult) => TProjected);
125
+ readonly paths: ProjectionPath[];
126
+ }
127
+ type ProjectionPath = {
128
+ full: string;
129
+ segments: Tuple<string>;
130
+ };
131
+ type InferExecutionResultProjection<TProjection extends AnyProjection> = ReturnType<TProjection["projector"]>;
132
+ //#endregion
133
+ //#region packages/colocation-tools/src/create-projection.d.ts
134
+ type AnyFragment = Fragment<string, any, any, any>;
135
+ /**
136
+ * Options for creating a projection from a Fragment.
137
+ */
138
+ type CreateProjectionOptions<TOutput extends object, TProjected> = {
139
+ /**
140
+ * Field paths to extract from the execution result.
141
+ * Each path starts with "$." and follows the field selection structure.
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * paths: ["$.user.id", "$.user.name"]
146
+ * ```
147
+ */
148
+ paths: Tuple<string>;
149
+ /**
150
+ * Handler function to transform the sliced execution result.
151
+ * Receives a SlicedExecutionResult with the Fragment's output type.
152
+ * Handles all cases: success, error, and empty.
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * handle: (result) => {
157
+ * if (result.isError()) return { error: result.error, data: null };
158
+ * if (result.isEmpty()) return { error: null, data: null };
159
+ * const data = result.unwrap();
160
+ * return { error: null, data: { userId: data.user.id } };
161
+ * }
162
+ * ```
163
+ */
164
+ handle: (result: SlicedExecutionResult<TOutput>) => TProjected;
165
+ };
166
+ /**
167
+ * Creates a type-safe projection from a Fragment.
168
+ *
169
+ * The projection extracts and transforms data from GraphQL execution results,
170
+ * with full type inference from the Fragment's output type.
171
+ *
172
+ * Note: The Fragment parameter is used only for type inference.
173
+ * The actual paths must be specified explicitly.
174
+ *
175
+ * @param _fragment - The Fragment to infer types from (used for type inference only)
176
+ * @param options - Projection options including paths and handle function
177
+ * @returns A Projection that can be used with createExecutionResultParser
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * const userFragment = gql(({ fragment }) =>
182
+ * fragment.Query({ variables: [...] }, ({ f, $ }) => [
183
+ * f.user({ id: $.userId })(({ f }) => [f.id(), f.name()]),
184
+ * ])
185
+ * );
186
+ *
187
+ * const userProjection = createProjection(userFragment, {
188
+ * paths: ["$.user"],
189
+ * handle: (result) => {
190
+ * if (result.isError()) return { error: result.error, user: null };
191
+ * if (result.isEmpty()) return { error: null, user: null };
192
+ * const data = result.unwrap();
193
+ * return { error: null, user: data.user };
194
+ * },
195
+ * });
196
+ * ```
197
+ */
198
+ declare const createProjection: <TFragment extends AnyFragment, TProjected>(_fragment: TFragment, options: CreateProjectionOptions<TFragment["$infer"]["output"], TProjected>) => Projection<TProjected>;
199
+ declare const createProjectionAttachment: <TFragment extends AnyFragment, TProjected>(options: CreateProjectionOptions<NoInfer<TFragment>["$infer"]["output"], TProjected>) => GqlElementAttachment<TFragment, "projection", Projection<TProjected>>;
200
+ //#endregion
201
+ //#region packages/colocation-tools/src/projection-path-graph.d.ts
202
+ /**
203
+ * Node in the projection path graph tree.
204
+ * Used for mapping GraphQL errors and data to their corresponding slices.
205
+ */
206
+ type ProjectionPathGraphNode = {
207
+ readonly matches: {
208
+ label: string;
209
+ path: string;
210
+ exact: boolean;
211
+ }[];
212
+ readonly children: {
213
+ readonly [segment: string]: ProjectionPathGraphNode;
214
+ };
215
+ };
216
+ /**
217
+ * Payload from a slice that contains projection.
218
+ */
219
+ type AnySlicePayload = {
220
+ readonly projection: AnyProjection;
221
+ };
222
+ type AnySlicePayloads = Record<string, AnySlicePayload>;
223
+ /**
224
+ * Creates a projection path graph from slice entries with field prefixing.
225
+ * Each slice's paths are prefixed with the slice label for disambiguation.
226
+ */
227
+ declare function createPathGraphFromSliceEntries(fragments: AnySlicePayloads): ProjectionPathGraphNode;
228
+ //#endregion
229
+ //#region packages/colocation-tools/src/parse-execution-result.d.ts
230
+ /**
231
+ * Creates an execution result parser for composed operations.
232
+ * The parser maps GraphQL errors and data to their corresponding slices
233
+ * based on the projection path graph.
234
+ *
235
+ * @param slices - Object mapping labels to projections
236
+ * @returns A parser function that takes a NormalizedExecutionResult and returns parsed slices
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * const parser = createExecutionResultParser({
241
+ * userCard: userCardProjection,
242
+ * posts: postsProjection,
243
+ * });
244
+ *
245
+ * const results = parser({
246
+ * type: "graphql",
247
+ * body: { data, errors },
248
+ * });
249
+ * ```
250
+ */
251
+ declare const createExecutionResultParser: <TSlices extends AnySlicePayloads>(slices: TSlices) => (result: NormalizedExecutionResult<object, object>) => any;
252
+ //#endregion
253
+ //#region packages/colocation-tools/src/types/field-path.d.ts
254
+ type AnyFieldPath = string;
255
+ /**
256
+ * Computes strongly typed "$.foo.bar" style selectors for a set of fields so
257
+ * slice result transforms can reference response paths safely.
258
+ */
259
+ type AvailableFieldPathOf<TSchema extends AnyGraphqlSchema, TFields extends AnyFields> = AvailableFieldPathsInner<TSchema, TFields, "$">;
260
+ /** Recursive helper used to build path strings for nested selections. */
261
+ type AvailableFieldPathsInner<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TCurr extends AnyFieldPath> = { readonly [TAliasName in keyof TFields & string]: `${TCurr}.${TAliasName}` | (TFields[TAliasName] extends {
262
+ object: infer TNested extends AnyNestedObject;
263
+ } ? AvailableFieldPathsInner<TSchema, TNested, `${TCurr}.${TAliasName}`> : never) }[keyof TFields & string];
264
+ /** Resolve the TypeScript type located at a given field path. */
265
+ type InferByFieldPath<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TPath extends AnyFieldPath> = string extends keyof TFields ? any : TPath extends "$" ? never : InferByFieldPathInner<TSchema, TFields, TPath, "$">;
266
+ /** Internal helper that walks a field tree while matching a path literal. */
267
+ type InferByFieldPathInner<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TPathTarget extends AnyFieldPath, TPathCurrent extends AnyFieldPath> = { readonly [TAliasName in keyof TFields]: TAliasName extends string ? `${TPathCurrent}.${TAliasName}` extends TPathTarget ? InferField<TSchema, TFields[TAliasName]> : TFields[TAliasName] extends {
268
+ object: infer TNested extends AnyNestedObject;
269
+ } ? InferByFieldPathInner<TSchema, TNested, TPathTarget, `${TPathCurrent}.${TAliasName}`> : never : never }[keyof TFields];
270
+ //#endregion
271
+ export { type AnyFieldPath, type AnyProjection, type AnySlicePayload, type AnySlicePayloads, type AnySlicedExecutionResult, type AnySlicedExecutionResultRecord, type AvailableFieldPathOf, type CreateProjectionOptions, type EmptyResult, type GraphqlExecutionResult, type InferByFieldPath, type InferExecutionResultProjection, type NonGraphqlError, type NonGraphqlErrorResult, type NormalizedError, type NormalizedExecutionResult, Projection, type ProjectionPath, type ProjectionPathGraphNode, type SafeUnwrapResult, type SlicedExecutionResult, SlicedExecutionResultEmpty, SlicedExecutionResultError, SlicedExecutionResultSuccess, createExecutionResultParser, createPathGraphFromSliceEntries, createProjection, createProjectionAttachment };
272
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/sliced-execution-result.ts","../src/utils/type-utils.ts","../src/projection.ts","../src/create-projection.ts","../src/projection-path-graph.ts","../src/parse-execution-result.ts","../src/types/field-path.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAMA;AAMY,KANA,eAAA,GAMA,OAAyB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GOOJ,qBPPI,COOkB,OPPlB,EOO2B,OPP3B,EOOoC,WPPpC,EAAA,GOOoD,YPPpD,IOOoE,UPPpE,EAAA,CAAA,GAAA,KAAA,GAAA,KAAA,EAID,CAAA,MOML,OPNK,CAAA"}
@@ -0,0 +1,272 @@
1
+ import { AnyFields, AnyGraphqlSchema, AnyNestedObject, Fragment, GqlElementAttachment, InferField } from "@soda-gql/core";
2
+ import { FormattedExecutionResult, GraphQLFormattedError } from "graphql";
3
+
4
+ //#region packages/colocation-tools/src/types.d.ts
5
+
6
+ /**
7
+ * Generic non-GraphQL error type for framework-specific errors.
8
+ * Users can define their own error shape.
9
+ */
10
+ type NonGraphqlError = unknown;
11
+ /**
12
+ * Normalized execution result representing all possible outcomes
13
+ * from a GraphQL operation.
14
+ */
15
+ type NormalizedExecutionResult<TData, TExtensions> = EmptyResult | GraphqlExecutionResult<TData, TExtensions> | NonGraphqlErrorResult;
16
+ type EmptyResult = {
17
+ type: "empty";
18
+ };
19
+ type GraphqlExecutionResult<TData, TExtensions> = {
20
+ type: "graphql";
21
+ body: FormattedExecutionResult<TData, TExtensions>;
22
+ };
23
+ type NonGraphqlErrorResult = {
24
+ type: "non-graphql-error";
25
+ error: NonGraphqlError;
26
+ };
27
+ /**
28
+ * Error types that can occur during slice result processing.
29
+ */
30
+ type NormalizedError = {
31
+ type: "graphql-error";
32
+ errors: GraphQLFormattedError[];
33
+ } | {
34
+ type: "non-graphql-error";
35
+ error: NonGraphqlError;
36
+ } | {
37
+ type: "parse-error";
38
+ errors: Error[];
39
+ };
40
+ //#endregion
41
+ //#region packages/colocation-tools/src/sliced-execution-result.d.ts
42
+ type AnySlicedExecutionResult = SlicedExecutionResult<any>;
43
+ /**
44
+ * Internal discriminated union describing the Result-like wrapper exposed to
45
+ * slice selection callbacks.
46
+ */
47
+ type AnySlicedExecutionResultRecord = {
48
+ [path: string]: AnySlicedExecutionResult;
49
+ };
50
+ type SafeUnwrapResult<TTransformed, TError> = {
51
+ data?: never;
52
+ error?: never;
53
+ } | {
54
+ data: TTransformed;
55
+ error?: never;
56
+ } | {
57
+ data?: never;
58
+ error: TError;
59
+ };
60
+ /** Utility signature returned by the safe unwrap helper. */
61
+ type SlicedExecutionResultCommon<TData, TError> = {
62
+ safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): SafeUnwrapResult<TTransformed, TError>;
63
+ };
64
+ /** Public union used by selection callbacks to inspect data, empty, or error states. */
65
+ type SlicedExecutionResult<TData> = SlicedExecutionResultEmpty<TData> | SlicedExecutionResultSuccess<TData> | SlicedExecutionResultError<TData>;
66
+ /** Runtime guard interface shared by all slice result variants. */
67
+ declare class SlicedExecutionResultGuards<TData> {
68
+ private readonly type;
69
+ isSuccess(): this is SlicedExecutionResultSuccess<TData>;
70
+ isError(): this is SlicedExecutionResultError<TData>;
71
+ isEmpty(): this is SlicedExecutionResultEmpty<TData>;
72
+ constructor(type: "success" | "error" | "empty");
73
+ }
74
+ /** Variant representing an empty payload (no data, no error). */
75
+ declare class SlicedExecutionResultEmpty<TData> extends SlicedExecutionResultGuards<TData> implements SlicedExecutionResultCommon<TData, NormalizedError> {
76
+ constructor();
77
+ unwrap(): null;
78
+ safeUnwrap(): {
79
+ data: undefined;
80
+ error: undefined;
81
+ };
82
+ }
83
+ /** Variant representing a successful payload. */
84
+ declare class SlicedExecutionResultSuccess<TData> extends SlicedExecutionResultGuards<TData> implements SlicedExecutionResultCommon<TData, NormalizedError> {
85
+ readonly data: TData;
86
+ readonly extensions?: unknown | undefined;
87
+ constructor(data: TData, extensions?: unknown | undefined);
88
+ unwrap(): TData;
89
+ safeUnwrap<TTransformed>(transform: (data: TData) => TTransformed): {
90
+ data: TTransformed;
91
+ error: undefined;
92
+ };
93
+ }
94
+ /** Variant representing an error payload. */
95
+ declare class SlicedExecutionResultError<TData> extends SlicedExecutionResultGuards<TData> implements SlicedExecutionResultCommon<TData, NormalizedError> {
96
+ readonly error: NormalizedError;
97
+ readonly extensions?: unknown | undefined;
98
+ constructor(error: NormalizedError, extensions?: unknown | undefined);
99
+ unwrap(): never;
100
+ safeUnwrap(): {
101
+ data: undefined;
102
+ error: NormalizedError;
103
+ };
104
+ }
105
+ //#endregion
106
+ //#region packages/colocation-tools/src/utils/type-utils.d.ts
107
+ type Tuple<T> = [T, ...T[]];
108
+ //#endregion
109
+ //#region packages/colocation-tools/src/projection.d.ts
110
+ /** Shape of a single selection slice projection. */
111
+ type AnyProjection = Projection<any>;
112
+ declare const __PROJECTION_BRAND__: unique symbol;
113
+ /**
114
+ * Nominal type representing any slice selection regardless of schema specifics.
115
+ * Encodes how individual slices map a concrete field path to a projection
116
+ * function. Multiple selections allow slices to expose several derived values.
117
+ */
118
+ declare class Projection<TProjected> {
119
+ readonly projector: (result: AnySlicedExecutionResult) => TProjected;
120
+ readonly [__PROJECTION_BRAND__]: void;
121
+ readonly $infer: {
122
+ readonly output: TProjected;
123
+ };
124
+ constructor(paths: Tuple<string>, projector: (result: AnySlicedExecutionResult) => TProjected);
125
+ readonly paths: ProjectionPath[];
126
+ }
127
+ type ProjectionPath = {
128
+ full: string;
129
+ segments: Tuple<string>;
130
+ };
131
+ type InferExecutionResultProjection<TProjection extends AnyProjection> = ReturnType<TProjection["projector"]>;
132
+ //#endregion
133
+ //#region packages/colocation-tools/src/create-projection.d.ts
134
+ type AnyFragment = Fragment<string, any, any, any>;
135
+ /**
136
+ * Options for creating a projection from a Fragment.
137
+ */
138
+ type CreateProjectionOptions<TOutput extends object, TProjected> = {
139
+ /**
140
+ * Field paths to extract from the execution result.
141
+ * Each path starts with "$." and follows the field selection structure.
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * paths: ["$.user.id", "$.user.name"]
146
+ * ```
147
+ */
148
+ paths: Tuple<string>;
149
+ /**
150
+ * Handler function to transform the sliced execution result.
151
+ * Receives a SlicedExecutionResult with the Fragment's output type.
152
+ * Handles all cases: success, error, and empty.
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * handle: (result) => {
157
+ * if (result.isError()) return { error: result.error, data: null };
158
+ * if (result.isEmpty()) return { error: null, data: null };
159
+ * const data = result.unwrap();
160
+ * return { error: null, data: { userId: data.user.id } };
161
+ * }
162
+ * ```
163
+ */
164
+ handle: (result: SlicedExecutionResult<TOutput>) => TProjected;
165
+ };
166
+ /**
167
+ * Creates a type-safe projection from a Fragment.
168
+ *
169
+ * The projection extracts and transforms data from GraphQL execution results,
170
+ * with full type inference from the Fragment's output type.
171
+ *
172
+ * Note: The Fragment parameter is used only for type inference.
173
+ * The actual paths must be specified explicitly.
174
+ *
175
+ * @param _fragment - The Fragment to infer types from (used for type inference only)
176
+ * @param options - Projection options including paths and handle function
177
+ * @returns A Projection that can be used with createExecutionResultParser
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * const userFragment = gql(({ fragment }) =>
182
+ * fragment.Query({ variables: [...] }, ({ f, $ }) => [
183
+ * f.user({ id: $.userId })(({ f }) => [f.id(), f.name()]),
184
+ * ])
185
+ * );
186
+ *
187
+ * const userProjection = createProjection(userFragment, {
188
+ * paths: ["$.user"],
189
+ * handle: (result) => {
190
+ * if (result.isError()) return { error: result.error, user: null };
191
+ * if (result.isEmpty()) return { error: null, user: null };
192
+ * const data = result.unwrap();
193
+ * return { error: null, user: data.user };
194
+ * },
195
+ * });
196
+ * ```
197
+ */
198
+ declare const createProjection: <TFragment extends AnyFragment, TProjected>(_fragment: TFragment, options: CreateProjectionOptions<TFragment["$infer"]["output"], TProjected>) => Projection<TProjected>;
199
+ declare const createProjectionAttachment: <TFragment extends AnyFragment, TProjected>(options: CreateProjectionOptions<NoInfer<TFragment>["$infer"]["output"], TProjected>) => GqlElementAttachment<TFragment, "projection", Projection<TProjected>>;
200
+ //#endregion
201
+ //#region packages/colocation-tools/src/projection-path-graph.d.ts
202
+ /**
203
+ * Node in the projection path graph tree.
204
+ * Used for mapping GraphQL errors and data to their corresponding slices.
205
+ */
206
+ type ProjectionPathGraphNode = {
207
+ readonly matches: {
208
+ label: string;
209
+ path: string;
210
+ exact: boolean;
211
+ }[];
212
+ readonly children: {
213
+ readonly [segment: string]: ProjectionPathGraphNode;
214
+ };
215
+ };
216
+ /**
217
+ * Payload from a slice that contains projection.
218
+ */
219
+ type AnySlicePayload = {
220
+ readonly projection: AnyProjection;
221
+ };
222
+ type AnySlicePayloads = Record<string, AnySlicePayload>;
223
+ /**
224
+ * Creates a projection path graph from slice entries with field prefixing.
225
+ * Each slice's paths are prefixed with the slice label for disambiguation.
226
+ */
227
+ declare function createPathGraphFromSliceEntries(fragments: AnySlicePayloads): ProjectionPathGraphNode;
228
+ //#endregion
229
+ //#region packages/colocation-tools/src/parse-execution-result.d.ts
230
+ /**
231
+ * Creates an execution result parser for composed operations.
232
+ * The parser maps GraphQL errors and data to their corresponding slices
233
+ * based on the projection path graph.
234
+ *
235
+ * @param slices - Object mapping labels to projections
236
+ * @returns A parser function that takes a NormalizedExecutionResult and returns parsed slices
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * const parser = createExecutionResultParser({
241
+ * userCard: userCardProjection,
242
+ * posts: postsProjection,
243
+ * });
244
+ *
245
+ * const results = parser({
246
+ * type: "graphql",
247
+ * body: { data, errors },
248
+ * });
249
+ * ```
250
+ */
251
+ declare const createExecutionResultParser: <TSlices extends AnySlicePayloads>(slices: TSlices) => (result: NormalizedExecutionResult<object, object>) => any;
252
+ //#endregion
253
+ //#region packages/colocation-tools/src/types/field-path.d.ts
254
+ type AnyFieldPath = string;
255
+ /**
256
+ * Computes strongly typed "$.foo.bar" style selectors for a set of fields so
257
+ * slice result transforms can reference response paths safely.
258
+ */
259
+ type AvailableFieldPathOf<TSchema extends AnyGraphqlSchema, TFields extends AnyFields> = AvailableFieldPathsInner<TSchema, TFields, "$">;
260
+ /** Recursive helper used to build path strings for nested selections. */
261
+ type AvailableFieldPathsInner<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TCurr extends AnyFieldPath> = { readonly [TAliasName in keyof TFields & string]: `${TCurr}.${TAliasName}` | (TFields[TAliasName] extends {
262
+ object: infer TNested extends AnyNestedObject;
263
+ } ? AvailableFieldPathsInner<TSchema, TNested, `${TCurr}.${TAliasName}`> : never) }[keyof TFields & string];
264
+ /** Resolve the TypeScript type located at a given field path. */
265
+ type InferByFieldPath<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TPath extends AnyFieldPath> = string extends keyof TFields ? any : TPath extends "$" ? never : InferByFieldPathInner<TSchema, TFields, TPath, "$">;
266
+ /** Internal helper that walks a field tree while matching a path literal. */
267
+ type InferByFieldPathInner<TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TPathTarget extends AnyFieldPath, TPathCurrent extends AnyFieldPath> = { readonly [TAliasName in keyof TFields]: TAliasName extends string ? `${TPathCurrent}.${TAliasName}` extends TPathTarget ? InferField<TSchema, TFields[TAliasName]> : TFields[TAliasName] extends {
268
+ object: infer TNested extends AnyNestedObject;
269
+ } ? InferByFieldPathInner<TSchema, TNested, TPathTarget, `${TPathCurrent}.${TAliasName}`> : never : never }[keyof TFields];
270
+ //#endregion
271
+ export { type AnyFieldPath, type AnyProjection, type AnySlicePayload, type AnySlicePayloads, type AnySlicedExecutionResult, type AnySlicedExecutionResultRecord, type AvailableFieldPathOf, type CreateProjectionOptions, type EmptyResult, type GraphqlExecutionResult, type InferByFieldPath, type InferExecutionResultProjection, type NonGraphqlError, type NonGraphqlErrorResult, type NormalizedError, type NormalizedExecutionResult, Projection, type ProjectionPath, type ProjectionPathGraphNode, type SafeUnwrapResult, type SlicedExecutionResult, SlicedExecutionResultEmpty, SlicedExecutionResultError, SlicedExecutionResultSuccess, createExecutionResultParser, createPathGraphFromSliceEntries, createProjection, createProjectionAttachment };
272
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/sliced-execution-result.ts","../src/utils/type-utils.ts","../src/projection.ts","../src/create-projection.ts","../src/projection-path-graph.ts","../src/parse-execution-result.ts","../src/types/field-path.ts"],"sourcesContent":[],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