polen 0.11.0-next.23 → 0.11.0-next.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/build/api/config/input.d.ts +76 -77
- package/build/api/config/input.d.ts.map +1 -1
- package/build/api/config/normalized.d.ts +136 -143
- package/build/api/config/normalized.d.ts.map +1 -1
- package/build/api/config-template/template.d.ts +110 -121
- package/build/api/config-template/template.d.ts.map +1 -1
- package/build/api/examples/diagnostic/diagnostic.d.ts +0 -23
- package/build/api/examples/diagnostic/diagnostic.d.ts.map +1 -1
- package/build/api/examples/diagnostic/diagnostic.js +1 -3
- package/build/api/examples/diagnostic/diagnostic.js.map +1 -1
- package/build/api/examples/scanner.d.ts +27 -1
- package/build/api/examples/scanner.d.ts.map +1 -1
- package/build/api/examples/scanner.js +19 -17
- package/build/api/examples/scanner.js.map +1 -1
- package/build/api/examples/schemas/catalog.d.ts +20 -12
- package/build/api/examples/schemas/catalog.d.ts.map +1 -1
- package/build/api/examples/schemas/example/example.d.ts +17 -11
- package/build/api/examples/schemas/example/example.d.ts.map +1 -1
- package/build/api/schema/augmentations/$$.d.ts +7 -0
- package/build/api/schema/augmentations/$$.d.ts.map +1 -0
- package/build/api/schema/augmentations/$$.js +7 -0
- package/build/api/schema/augmentations/$$.js.map +1 -0
- package/build/api/schema/augmentations/$.d.ts +1 -1
- package/build/api/schema/augmentations/$.d.ts.map +1 -1
- package/build/api/schema/augmentations/$.js +1 -1
- package/build/api/schema/augmentations/$.js.map +1 -1
- package/build/api/schema/augmentations/apply.d.ts +29 -0
- package/build/api/schema/augmentations/apply.d.ts.map +1 -0
- package/build/api/schema/augmentations/apply.js +181 -0
- package/build/api/schema/augmentations/apply.js.map +1 -0
- package/build/api/schema/augmentations/augmentation.d.ts +31 -0
- package/build/api/schema/augmentations/augmentation.d.ts.map +1 -0
- package/build/api/schema/augmentations/augmentation.js +22 -0
- package/build/api/schema/augmentations/augmentation.js.map +1 -0
- package/build/api/schema/augmentations/config.d.ts +24 -0
- package/build/api/schema/augmentations/config.d.ts.map +1 -0
- package/build/api/schema/augmentations/config.js +9 -0
- package/build/api/schema/augmentations/config.js.map +1 -0
- package/build/api/schema/augmentations/diagnostics/diagnostic.d.ts +67 -0
- package/build/api/schema/augmentations/diagnostics/diagnostic.d.ts.map +1 -0
- package/build/api/schema/augmentations/diagnostics/diagnostic.js +13 -0
- package/build/api/schema/augmentations/diagnostics/diagnostic.js.map +1 -0
- package/build/api/schema/augmentations/diagnostics/duplicate-version.d.ts +45 -0
- package/build/api/schema/augmentations/diagnostics/duplicate-version.d.ts.map +1 -0
- package/build/api/schema/augmentations/diagnostics/duplicate-version.js +17 -0
- package/build/api/schema/augmentations/diagnostics/duplicate-version.js.map +1 -0
- package/build/api/schema/augmentations/diagnostics/invalid-path.d.ts +46 -0
- package/build/api/schema/augmentations/diagnostics/invalid-path.d.ts.map +1 -0
- package/build/api/schema/augmentations/diagnostics/invalid-path.js +18 -0
- package/build/api/schema/augmentations/diagnostics/invalid-path.js.map +1 -0
- package/build/api/schema/augmentations/diagnostics/version-mismatch.d.ts +46 -0
- package/build/api/schema/augmentations/diagnostics/version-mismatch.d.ts.map +1 -0
- package/build/api/schema/augmentations/diagnostics/version-mismatch.js +18 -0
- package/build/api/schema/augmentations/diagnostics/version-mismatch.js.map +1 -0
- package/build/api/schema/augmentations/input.d.ts +145 -0
- package/build/api/schema/augmentations/input.d.ts.map +1 -0
- package/build/api/schema/augmentations/input.js +191 -0
- package/build/api/schema/augmentations/input.js.map +1 -0
- package/build/api/schema/augmentations/placement.d.ts +8 -0
- package/build/api/schema/augmentations/placement.d.ts.map +1 -0
- package/build/api/schema/augmentations/placement.js +7 -0
- package/build/api/schema/augmentations/placement.js.map +1 -0
- package/build/api/schema/config-schema.d.ts +66 -66
- package/build/api/schema/config-schema.d.ts.map +1 -1
- package/build/api/schema/config-schema.js +2 -2
- package/build/api/schema/config-schema.js.map +1 -1
- package/build/api/schema/input-source/load.d.ts +2 -0
- package/build/api/schema/input-source/load.d.ts.map +1 -1
- package/build/api/schema/input-source/load.js.map +1 -1
- package/build/api/schema/input-sources/directory.d.ts +39 -39
- package/build/api/schema/input-sources/file.d.ts +39 -39
- package/build/api/schema/input-sources/introspection-file.d.ts +39 -39
- package/build/api/schema/input-sources/introspection.d.ts +39 -39
- package/build/api/schema/input-sources/memory.d.ts +39 -39
- package/build/api/schema/input-sources/versioned-directory.d.ts +79 -79
- package/build/api/schema/load.d.ts.map +1 -1
- package/build/api/schema/load.js +9 -2
- package/build/api/schema/load.js.map +1 -1
- package/build/lib/catalog/catalog.d.ts +1181 -1181
- package/build/lib/catalog/unversioned.d.ts +312 -312
- package/build/lib/catalog/versioned.d.ts +634 -634
- package/build/lib/change/change.d.ts +238 -238
- package/build/lib/document/document.d.ts +14 -8
- package/build/lib/document/document.d.ts.map +1 -1
- package/build/lib/document/versioned.d.ts +17 -10
- package/build/lib/document/versioned.d.ts.map +1 -1
- package/build/lib/grafaid/schema/KindMap/_.d.ts +1 -1
- package/build/lib/graphql-path/$$.d.ts +7 -13
- package/build/lib/graphql-path/$$.d.ts.map +1 -1
- package/build/lib/graphql-path/$$.js +7 -13
- package/build/lib/graphql-path/$$.js.map +1 -1
- package/build/lib/graphql-path/definition.d.ts +104 -94
- package/build/lib/graphql-path/definition.d.ts.map +1 -1
- package/build/lib/graphql-path/definition.js +126 -125
- package/build/lib/graphql-path/definition.js.map +1 -1
- package/build/lib/graphql-path/query.d.ts +25 -57
- package/build/lib/graphql-path/query.d.ts.map +1 -1
- package/build/lib/graphql-path/query.js +15 -93
- package/build/lib/graphql-path/query.js.map +1 -1
- package/build/lib/graphql-path/schema.d.ts +49 -0
- package/build/lib/graphql-path/schema.d.ts.map +1 -0
- package/build/lib/graphql-path/schema.js +89 -0
- package/build/lib/graphql-path/schema.js.map +1 -0
- package/build/lib/graphql-path/types.d.ts +76 -28
- package/build/lib/graphql-path/types.d.ts.map +1 -1
- package/build/lib/graphql-path/types.js +101 -2
- package/build/lib/graphql-path/types.js.map +1 -1
- package/build/lib/revision/revision.d.ts +1170 -1170
- package/build/lib/schema/schema.d.ts +708 -708
- package/build/lib/schema/unversioned.d.ts +1092 -1092
- package/build/lib/schema/versioned.d.ts +634 -634
- package/build/lib/semver/official-release.d.ts +10 -10
- package/build/lib/semver/pre-release.d.ts +10 -10
- package/build/lib/semver/semver.d.ts +50 -50
- package/build/lib/version-coverage/version-coverage.d.ts +43 -11
- package/build/lib/version-coverage/version-coverage.d.ts.map +1 -1
- package/build/lib/version-coverage/version-coverage.js +40 -6
- package/build/lib/version-coverage/version-coverage.js.map +1 -1
- package/build/template/hooks/use-examples.d.ts +1 -1
- package/build/template/routes/changelog/ChangelogSidebar.d.ts +2 -2
- package/build/template/routes/changelog/ChangelogSidebar.d.ts.map +1 -1
- package/build/template/routes/changelog/ChangelogSidebar.js +4 -4
- package/build/template/routes/changelog/ChangelogSidebar.js.map +1 -1
- package/build/template/routes/examples/_.d.ts +3 -3
- package/build/template/routes/examples/_index.d.ts +2 -2
- package/build/template/routes/examples/name.d.ts +3 -3
- package/build/template/routes/pages.d.ts.map +1 -1
- package/build/template/routes/pages.js +5 -1
- package/build/template/routes/pages.js.map +1 -1
- package/build/template/stores/changelog.d.ts +39 -39
- package/build/vite/plugins/examples.d.ts.map +1 -1
- package/build/vite/plugins/examples.js +0 -2
- package/build/vite/plugins/examples.js.map +1 -1
- package/build/vite/plugins/schemas.d.ts.map +1 -1
- package/build/vite/plugins/schemas.js +38 -2
- package/build/vite/plugins/schemas.js.map +1 -1
- package/package.json +1 -1
- package/src/api/examples/diagnostic/diagnostic.ts +0 -3
- package/src/api/examples/scanner.test.ts +83 -0
- package/src/api/examples/scanner.ts +17 -21
- package/src/api/schema/augmentations/$$.ts +6 -0
- package/src/api/schema/augmentations/$.ts +1 -1
- package/src/api/schema/augmentations/apply.test.ts +89 -0
- package/src/api/schema/augmentations/apply.ts +277 -0
- package/src/api/schema/augmentations/augmentation.ts +24 -0
- package/src/api/schema/augmentations/config.ts +11 -0
- package/src/api/schema/augmentations/diagnostics/diagnostic.ts +20 -0
- package/src/api/schema/augmentations/diagnostics/duplicate-version.ts +20 -0
- package/src/api/schema/augmentations/diagnostics/invalid-path.ts +21 -0
- package/src/api/schema/augmentations/diagnostics/version-mismatch.ts +21 -0
- package/src/api/schema/augmentations/input.test.ts +144 -0
- package/src/api/schema/augmentations/input.ts +215 -0
- package/src/api/schema/augmentations/placement.ts +11 -0
- package/src/api/schema/config-schema.ts +2 -2
- package/src/api/schema/input-source/load.ts +2 -0
- package/src/api/schema/load.ts +19 -2
- package/src/lib/graphql-path/$$.ts +7 -13
- package/src/lib/graphql-path/$.test.ts +175 -0
- package/src/lib/graphql-path/definition.ts +162 -162
- package/src/lib/graphql-path/query.ts +15 -98
- package/src/lib/graphql-path/schema.ts +136 -0
- package/src/lib/graphql-path/types.ts +108 -28
- package/src/lib/version-coverage/version-coverage.ts +48 -6
- package/src/template/routes/changelog/ChangelogSidebar.tsx +4 -4
- package/src/template/routes/pages.tsx +6 -1
- package/src/vite/plugins/examples.ts +0 -2
- package/src/vite/plugins/schemas.ts +51 -2
- package/build/api/examples/diagnostic/unused-default.d.ts +0 -49
- package/build/api/examples/diagnostic/unused-default.d.ts.map +0 -1
- package/build/api/examples/diagnostic/unused-default.js +0 -19
- package/build/api/examples/diagnostic/unused-default.js.map +0 -1
- package/build/api/schema/augmentations/augmentations/description.d.ts +0 -26
- package/build/api/schema/augmentations/augmentations/description.d.ts.map +0 -1
- package/build/api/schema/augmentations/augmentations/description.js +0 -55
- package/build/api/schema/augmentations/augmentations/description.js.map +0 -1
- package/build/api/schema/augmentations/schema-augmentation.d.ts +0 -20
- package/build/api/schema/augmentations/schema-augmentation.d.ts.map +0 -1
- package/build/api/schema/augmentations/schema-augmentation.js +0 -22
- package/build/api/schema/augmentations/schema-augmentation.js.map +0 -1
- package/build/api/schema/augmentations/target.d.ts +0 -25
- package/build/api/schema/augmentations/target.d.ts.map +0 -1
- package/build/api/schema/augmentations/target.js +0 -39
- package/build/api/schema/augmentations/target.js.map +0 -1
- package/build/lib/graphql-path/constructors.d.ts +0 -57
- package/build/lib/graphql-path/constructors.d.ts.map +0 -1
- package/build/lib/graphql-path/constructors.js +0 -73
- package/build/lib/graphql-path/constructors.js.map +0 -1
- package/src/api/examples/diagnostic/unused-default.ts +0 -22
- package/src/api/schema/augmentations/augmentations/description.ts +0 -69
- package/src/api/schema/augmentations/schema-augmentation.ts +0 -32
- package/src/api/schema/augmentations/target.ts +0 -61
- package/src/lib/graphql-path/constructors.ts +0 -81
@@ -0,0 +1,89 @@
|
|
1
|
+
/**
|
2
|
+
* GraphQL schema location utilities for definition paths
|
3
|
+
*/
|
4
|
+
import { Grafaid } from '#lib/grafaid';
|
5
|
+
import { Data, Either, Match } from 'effect';
|
6
|
+
import * as Definition from './definition.js';
|
7
|
+
// ============================================================================
|
8
|
+
// Errors
|
9
|
+
// ============================================================================
|
10
|
+
export class TypeNotFoundError extends Data.TaggedError('TypeNotFoundError') {
|
11
|
+
}
|
12
|
+
export class FieldNotFoundError extends Data.TaggedError('FieldNotFoundError') {
|
13
|
+
}
|
14
|
+
// ============================================================================
|
15
|
+
// Locate Functions
|
16
|
+
// ============================================================================
|
17
|
+
/**
|
18
|
+
* Locate a type in the GraphQL schema from a type definition path.
|
19
|
+
*
|
20
|
+
* @param schema - The GraphQL schema
|
21
|
+
* @param path - The type definition path
|
22
|
+
* @returns Either the located type or a TypeNotFoundError
|
23
|
+
*/
|
24
|
+
export const locateType = (schema, path) => {
|
25
|
+
const typeName = Definition.getType(path);
|
26
|
+
const type = schema.getType(typeName);
|
27
|
+
if (!type) {
|
28
|
+
return Either.left(new TypeNotFoundError({
|
29
|
+
typeName,
|
30
|
+
path: Definition.encodeSync(path),
|
31
|
+
}));
|
32
|
+
}
|
33
|
+
return Either.right(type);
|
34
|
+
};
|
35
|
+
/**
|
36
|
+
* Locate a field in the GraphQL schema from a field definition path.
|
37
|
+
*
|
38
|
+
* @param schema - The GraphQL schema
|
39
|
+
* @param path - The field definition path
|
40
|
+
* @returns Either the located field or a FieldNotFoundError
|
41
|
+
*/
|
42
|
+
export const locateField = (schema, path) => {
|
43
|
+
const typeName = Definition.getType(path);
|
44
|
+
const fieldName = Definition.getField(path);
|
45
|
+
const type = schema.getType(typeName);
|
46
|
+
if (!type) {
|
47
|
+
return Either.left(new FieldNotFoundError({
|
48
|
+
typeName,
|
49
|
+
fieldName,
|
50
|
+
path: Definition.encodeSync(path),
|
51
|
+
}));
|
52
|
+
}
|
53
|
+
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
54
|
+
return Either.left(new FieldNotFoundError({
|
55
|
+
typeName,
|
56
|
+
fieldName,
|
57
|
+
path: Definition.encodeSync(path),
|
58
|
+
}));
|
59
|
+
}
|
60
|
+
const fields = type.getFields();
|
61
|
+
const field = fields[fieldName];
|
62
|
+
if (!field) {
|
63
|
+
// dprint-ignore
|
64
|
+
return Either.left(new FieldNotFoundError({
|
65
|
+
typeName,
|
66
|
+
fieldName,
|
67
|
+
path: Definition.encodeSync(path),
|
68
|
+
}));
|
69
|
+
}
|
70
|
+
return Either.right(field);
|
71
|
+
};
|
72
|
+
/**
|
73
|
+
* Locate a type or field in the GraphQL schema from a definition path.
|
74
|
+
*
|
75
|
+
* @param schema - The GraphQL schema
|
76
|
+
* @param path - The definition path (type or field)
|
77
|
+
* @returns Either the located type/field or an error
|
78
|
+
*/
|
79
|
+
export const locate = (schema, path) => {
|
80
|
+
return Match.value(path).pipe(Match.when(Definition.isTypeDefinitionPath, (p) => locateType(schema, p)), Match.when(Definition.isFieldDefinitionPath, (p) => locateField(schema, p)), Match.orElse(() => {
|
81
|
+
// This should never happen with proper path types
|
82
|
+
// Return a generic error for unsupported path types
|
83
|
+
return Either.left(new TypeNotFoundError({
|
84
|
+
typeName: 'unknown',
|
85
|
+
path: Definition.encodeSync(path),
|
86
|
+
}));
|
87
|
+
}));
|
88
|
+
};
|
89
|
+
//# sourceMappingURL=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AC7B,EACD,KAAK,CAAC,IAAI,CACR,UAAU,CAAC,qBAAqB,EAChC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAC9B,EACD,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE;QAChB,kDAAkD;QAClD,oDAAoD;QACpD,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,iBAAiB,CAAC;YACpB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC;SAClC,CAAC,CACH,CAAA;IACH,CAAC,CAAC,CACH,CAAA;AACH,CAAC,CAAA"}
|
@@ -1,50 +1,98 @@
|
|
1
1
|
/**
|
2
|
-
* GraphQL Path type definitions
|
2
|
+
* GraphQL Path type definitions using Effect Schema
|
3
3
|
*/
|
4
|
+
import { S } from '#lib/kit-temp/effect';
|
4
5
|
/**
|
5
|
-
*
|
6
|
+
* Segment representing a GraphQL type in a path
|
6
7
|
*/
|
7
|
-
export
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
export declare const TypeSegment: S.TaggedStruct<"TypeSegment", {
|
9
|
+
type: typeof S.String;
|
10
|
+
}>;
|
11
|
+
export type TypeSegment = S.Schema.Type<typeof TypeSegment>;
|
12
|
+
export declare const isTypeSegment: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is {
|
13
|
+
readonly _tag: "TypeSegment";
|
14
|
+
readonly type: string;
|
15
|
+
};
|
11
16
|
/**
|
12
|
-
*
|
17
|
+
* Segment representing a field in a path
|
13
18
|
*/
|
14
|
-
export
|
15
|
-
|
16
|
-
|
17
|
-
|
19
|
+
export declare const FieldSegment: S.TaggedStruct<"FieldSegment", {
|
20
|
+
field: typeof S.String;
|
21
|
+
}>;
|
22
|
+
export type FieldSegment = S.Schema.Type<typeof FieldSegment>;
|
23
|
+
export declare const isFieldSegment: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is {
|
24
|
+
readonly _tag: "FieldSegment";
|
25
|
+
readonly field: string;
|
26
|
+
};
|
18
27
|
/**
|
19
|
-
*
|
28
|
+
* Segment representing an argument in a path
|
20
29
|
*/
|
21
|
-
export
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
export declare const ArgumentSegment: S.TaggedStruct<"ArgumentSegment", {
|
31
|
+
argument: typeof S.String;
|
32
|
+
}>;
|
33
|
+
export type ArgumentSegment = S.Schema.Type<typeof ArgumentSegment>;
|
34
|
+
export declare const isArgumentSegment: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is {
|
35
|
+
readonly _tag: "ArgumentSegment";
|
36
|
+
readonly argument: string;
|
37
|
+
};
|
25
38
|
/**
|
26
39
|
* Union of all possible segments
|
27
40
|
*/
|
28
|
-
export
|
41
|
+
export declare const Segment: S.Union<[S.TaggedStruct<"TypeSegment", {
|
42
|
+
type: typeof S.String;
|
43
|
+
}>, S.TaggedStruct<"FieldSegment", {
|
44
|
+
field: typeof S.String;
|
45
|
+
}>, S.TaggedStruct<"ArgumentSegment", {
|
46
|
+
argument: typeof S.String;
|
47
|
+
}>]>;
|
48
|
+
export type Segment = S.Schema.Type<typeof Segment>;
|
49
|
+
export declare const isSegment: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is {
|
50
|
+
readonly _tag: "TypeSegment";
|
51
|
+
readonly type: string;
|
52
|
+
} | {
|
53
|
+
readonly _tag: "FieldSegment";
|
54
|
+
readonly field: string;
|
55
|
+
} | {
|
56
|
+
readonly _tag: "ArgumentSegment";
|
57
|
+
readonly argument: string;
|
58
|
+
};
|
29
59
|
/**
|
30
60
|
* Query segments - only types and fields can be traversed in queries
|
31
61
|
* Arguments cannot be part of query paths as they are not traversable
|
32
62
|
*/
|
33
|
-
export
|
63
|
+
export declare const QuerySegment: S.Union<[S.TaggedStruct<"TypeSegment", {
|
64
|
+
type: typeof S.String;
|
65
|
+
}>, S.TaggedStruct<"FieldSegment", {
|
66
|
+
field: typeof S.String;
|
67
|
+
}>]>;
|
68
|
+
export type QuerySegment = S.Schema.Type<typeof QuerySegment>;
|
69
|
+
export declare const isQuerySegment: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is {
|
70
|
+
readonly _tag: "TypeSegment";
|
71
|
+
readonly type: string;
|
72
|
+
} | {
|
73
|
+
readonly _tag: "FieldSegment";
|
74
|
+
readonly field: string;
|
75
|
+
};
|
34
76
|
/**
|
35
77
|
* Query/Data paths - potentially deep paths that span multiple types through fields
|
36
78
|
* These represent traversal paths through the schema graph
|
37
79
|
*
|
38
|
-
*
|
39
|
-
*
|
40
|
-
*
|
41
|
-
* {
|
42
|
-
* {
|
43
|
-
* {
|
44
|
-
* {
|
45
|
-
* {
|
46
|
-
* { kind: 'field', field: 'name' }
|
80
|
+
* Encoded: "User.posts.Post.author.User.name"
|
81
|
+
* Decoded: [
|
82
|
+
* { _tag: 'TypeSegment', type: 'User' },
|
83
|
+
* { _tag: 'FieldSegment', field: 'posts' },
|
84
|
+
* { _tag: 'TypeSegment', type: 'Post' },
|
85
|
+
* { _tag: 'FieldSegment', field: 'author' },
|
86
|
+
* { _tag: 'TypeSegment', type: 'User' },
|
87
|
+
* { _tag: 'FieldSegment', field: 'name' }
|
47
88
|
* ]
|
89
|
+
*
|
90
|
+
* Note: Assumes alternating type.field.type.field pattern
|
48
91
|
*/
|
49
|
-
export
|
92
|
+
export declare const QueryPath: S.transformOrFail<typeof S.String, S.Array$<S.Union<[S.TaggedStruct<"TypeSegment", {
|
93
|
+
type: typeof S.String;
|
94
|
+
}>, S.TaggedStruct<"FieldSegment", {
|
95
|
+
field: typeof S.String;
|
96
|
+
}>]>>, never>;
|
97
|
+
export type QueryPath = S.Schema.Type<typeof QueryPath>;
|
50
98
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-path/types.ts"],"names":[],"mapp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G,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
@@ -1,5 +1,104 @@
|
|
1
1
|
/**
|
2
|
-
* GraphQL Path type definitions
|
2
|
+
* GraphQL Path type definitions using Effect Schema
|
3
3
|
*/
|
4
|
-
|
4
|
+
import { S } from '#lib/kit-temp/effect';
|
5
|
+
import { ParseResult } from 'effect';
|
6
|
+
// ============================================================================
|
7
|
+
// Schema
|
8
|
+
// ============================================================================
|
9
|
+
/**
|
10
|
+
* Segment representing a GraphQL type in a path
|
11
|
+
*/
|
12
|
+
export const TypeSegment = S.TaggedStruct('TypeSegment', {
|
13
|
+
type: S.String,
|
14
|
+
});
|
15
|
+
// Type guard derived from Effect Schema
|
16
|
+
export const isTypeSegment = S.is(TypeSegment);
|
17
|
+
/**
|
18
|
+
* Segment representing a field in a path
|
19
|
+
*/
|
20
|
+
export const FieldSegment = S.TaggedStruct('FieldSegment', {
|
21
|
+
field: S.String,
|
22
|
+
});
|
23
|
+
// Type guard derived from Effect Schema
|
24
|
+
export const isFieldSegment = S.is(FieldSegment);
|
25
|
+
/**
|
26
|
+
* Segment representing an argument in a path
|
27
|
+
*/
|
28
|
+
export const ArgumentSegment = S.TaggedStruct('ArgumentSegment', {
|
29
|
+
argument: S.String,
|
30
|
+
});
|
31
|
+
// Type guard derived from Effect Schema
|
32
|
+
export const isArgumentSegment = S.is(ArgumentSegment);
|
33
|
+
/**
|
34
|
+
* Union of all possible segments
|
35
|
+
*/
|
36
|
+
export const Segment = S.Union(TypeSegment, FieldSegment, ArgumentSegment);
|
37
|
+
// Type guard derived from Effect Schema
|
38
|
+
export const isSegment = S.is(Segment);
|
39
|
+
/**
|
40
|
+
* Query segments - only types and fields can be traversed in queries
|
41
|
+
* Arguments cannot be part of query paths as they are not traversable
|
42
|
+
*/
|
43
|
+
export const QuerySegment = S.Union(TypeSegment, FieldSegment);
|
44
|
+
// Type guard derived from Effect Schema
|
45
|
+
export const isQuerySegment = S.is(QuerySegment);
|
46
|
+
/**
|
47
|
+
* Internal decoded form of QueryPath
|
48
|
+
*/
|
49
|
+
const QueryPathDecoded = S.Array(QuerySegment);
|
50
|
+
/**
|
51
|
+
* Query/Data paths - potentially deep paths that span multiple types through fields
|
52
|
+
* These represent traversal paths through the schema graph
|
53
|
+
*
|
54
|
+
* Encoded: "User.posts.Post.author.User.name"
|
55
|
+
* Decoded: [
|
56
|
+
* { _tag: 'TypeSegment', type: 'User' },
|
57
|
+
* { _tag: 'FieldSegment', field: 'posts' },
|
58
|
+
* { _tag: 'TypeSegment', type: 'Post' },
|
59
|
+
* { _tag: 'FieldSegment', field: 'author' },
|
60
|
+
* { _tag: 'TypeSegment', type: 'User' },
|
61
|
+
* { _tag: 'FieldSegment', field: 'name' }
|
62
|
+
* ]
|
63
|
+
*
|
64
|
+
* Note: Assumes alternating type.field.type.field pattern
|
65
|
+
*/
|
66
|
+
export const QueryPath = S.transformOrFail(S.String, QueryPathDecoded, {
|
67
|
+
decode: (str, _options, ast) => {
|
68
|
+
if (!str) {
|
69
|
+
return ParseResult.fail(new ParseResult.Type(ast, str));
|
70
|
+
}
|
71
|
+
const parts = str.split('.');
|
72
|
+
const segments = [];
|
73
|
+
// Assume alternating pattern: type.field.type.field...
|
74
|
+
for (let i = 0; i < parts.length; i++) {
|
75
|
+
const part = parts[i];
|
76
|
+
if (!part) {
|
77
|
+
return ParseResult.fail(new ParseResult.Type(ast, str));
|
78
|
+
}
|
79
|
+
if (i % 2 === 0) {
|
80
|
+
// Even indices are types
|
81
|
+
segments.push(TypeSegment.make({ type: part }));
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
// Odd indices are fields
|
85
|
+
segments.push(FieldSegment.make({ field: part }));
|
86
|
+
}
|
87
|
+
}
|
88
|
+
return ParseResult.succeed(segments);
|
89
|
+
},
|
90
|
+
encode: (path) => {
|
91
|
+
const str = path.map(segment => {
|
92
|
+
if (segment._tag === 'TypeSegment')
|
93
|
+
return segment.type;
|
94
|
+
if (segment._tag === 'FieldSegment')
|
95
|
+
return segment.field;
|
96
|
+
return '';
|
97
|
+
}).filter(Boolean).join('.');
|
98
|
+
return ParseResult.succeed(str);
|
99
|
+
},
|
100
|
+
}).annotations({
|
101
|
+
identifier: 'QueryPath',
|
102
|
+
description: 'Query path through a GraphQL schema',
|
103
|
+
});
|
5
104
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/graphql-path/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/graphql-path/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEpC,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC,aAAa,EAAE;IACvD,IAAI,EAAE,CAAC,CAAC,MAAM;CACf,CAAC,CAAA;AAIF,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC,cAAc,EAAE;IACzD,KAAK,EAAE,CAAC,CAAC,MAAM;CAChB,CAAC,CAAA;AAIF,wCAAwC;AACxC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAA;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC,iBAAiB,EAAE;IAC/D,QAAQ,EAAE,CAAC,CAAC,MAAM;CACnB,CAAC,CAAA;AAIF,wCAAwC;AACxC,MAAM,CAAC,MAAM,iB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