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
@@ -1,55 +1,135 @@
|
|
1
1
|
/**
|
2
|
-
* GraphQL Path type definitions
|
2
|
+
* GraphQL Path type definitions using Effect Schema
|
3
3
|
*/
|
4
4
|
|
5
|
+
import { S } from '#lib/kit-temp/effect'
|
6
|
+
import { ParseResult } from 'effect'
|
7
|
+
|
8
|
+
// ============================================================================
|
9
|
+
// Schema
|
10
|
+
// ============================================================================
|
11
|
+
|
5
12
|
/**
|
6
|
-
*
|
13
|
+
* Segment representing a GraphQL type in a path
|
7
14
|
*/
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
15
|
+
export const TypeSegment = S.TaggedStruct('TypeSegment', {
|
16
|
+
type: S.String,
|
17
|
+
})
|
18
|
+
|
19
|
+
export type TypeSegment = S.Schema.Type<typeof TypeSegment>
|
20
|
+
|
21
|
+
// Type guard derived from Effect Schema
|
22
|
+
export const isTypeSegment = S.is(TypeSegment)
|
12
23
|
|
13
24
|
/**
|
14
|
-
*
|
25
|
+
* Segment representing a field in a path
|
15
26
|
*/
|
16
|
-
export
|
17
|
-
|
18
|
-
|
19
|
-
|
27
|
+
export const FieldSegment = S.TaggedStruct('FieldSegment', {
|
28
|
+
field: S.String,
|
29
|
+
})
|
30
|
+
|
31
|
+
export type FieldSegment = S.Schema.Type<typeof FieldSegment>
|
32
|
+
|
33
|
+
// Type guard derived from Effect Schema
|
34
|
+
export const isFieldSegment = S.is(FieldSegment)
|
20
35
|
|
21
36
|
/**
|
22
|
-
*
|
37
|
+
* Segment representing an argument in a path
|
23
38
|
*/
|
24
|
-
export
|
25
|
-
|
26
|
-
|
27
|
-
|
39
|
+
export const ArgumentSegment = S.TaggedStruct('ArgumentSegment', {
|
40
|
+
argument: S.String,
|
41
|
+
})
|
42
|
+
|
43
|
+
export type ArgumentSegment = S.Schema.Type<typeof ArgumentSegment>
|
44
|
+
|
45
|
+
// Type guard derived from Effect Schema
|
46
|
+
export const isArgumentSegment = S.is(ArgumentSegment)
|
28
47
|
|
29
48
|
/**
|
30
49
|
* Union of all possible segments
|
31
50
|
*/
|
32
|
-
export
|
51
|
+
export const Segment = S.Union(TypeSegment, FieldSegment, ArgumentSegment)
|
52
|
+
|
53
|
+
export type Segment = S.Schema.Type<typeof Segment>
|
54
|
+
|
55
|
+
// Type guard derived from Effect Schema
|
56
|
+
export const isSegment = S.is(Segment)
|
33
57
|
|
34
58
|
/**
|
35
59
|
* Query segments - only types and fields can be traversed in queries
|
36
60
|
* Arguments cannot be part of query paths as they are not traversable
|
37
61
|
*/
|
38
|
-
export
|
62
|
+
export const QuerySegment = S.Union(TypeSegment, FieldSegment)
|
63
|
+
|
64
|
+
export type QuerySegment = S.Schema.Type<typeof QuerySegment>
|
65
|
+
|
66
|
+
// Type guard derived from Effect Schema
|
67
|
+
export const isQuerySegment = S.is(QuerySegment)
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Internal decoded form of QueryPath
|
71
|
+
*/
|
72
|
+
const QueryPathDecoded = S.Array(QuerySegment)
|
39
73
|
|
40
74
|
/**
|
41
75
|
* Query/Data paths - potentially deep paths that span multiple types through fields
|
42
76
|
* These represent traversal paths through the schema graph
|
43
77
|
*
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
47
|
-
* {
|
48
|
-
* {
|
49
|
-
* {
|
50
|
-
* {
|
51
|
-
* {
|
52
|
-
* { kind: 'field', field: 'name' }
|
78
|
+
* Encoded: "User.posts.Post.author.User.name"
|
79
|
+
* Decoded: [
|
80
|
+
* { _tag: 'TypeSegment', type: 'User' },
|
81
|
+
* { _tag: 'FieldSegment', field: 'posts' },
|
82
|
+
* { _tag: 'TypeSegment', type: 'Post' },
|
83
|
+
* { _tag: 'FieldSegment', field: 'author' },
|
84
|
+
* { _tag: 'TypeSegment', type: 'User' },
|
85
|
+
* { _tag: 'FieldSegment', field: 'name' }
|
53
86
|
* ]
|
87
|
+
*
|
88
|
+
* Note: Assumes alternating type.field.type.field pattern
|
54
89
|
*/
|
55
|
-
export
|
90
|
+
export const QueryPath = S.transformOrFail(
|
91
|
+
S.String,
|
92
|
+
QueryPathDecoded,
|
93
|
+
{
|
94
|
+
decode: (str, _options, ast) => {
|
95
|
+
if (!str) {
|
96
|
+
return ParseResult.fail(new ParseResult.Type(ast, str))
|
97
|
+
}
|
98
|
+
|
99
|
+
const parts = str.split('.')
|
100
|
+
const segments: QuerySegment[] = []
|
101
|
+
|
102
|
+
// Assume alternating pattern: type.field.type.field...
|
103
|
+
for (let i = 0; i < parts.length; i++) {
|
104
|
+
const part = parts[i]
|
105
|
+
if (!part) {
|
106
|
+
return ParseResult.fail(new ParseResult.Type(ast, str))
|
107
|
+
}
|
108
|
+
|
109
|
+
if (i % 2 === 0) {
|
110
|
+
// Even indices are types
|
111
|
+
segments.push(TypeSegment.make({ type: part }))
|
112
|
+
} else {
|
113
|
+
// Odd indices are fields
|
114
|
+
segments.push(FieldSegment.make({ field: part }))
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
return ParseResult.succeed(segments)
|
119
|
+
},
|
120
|
+
encode: (path) => {
|
121
|
+
const str = path.map(segment => {
|
122
|
+
if (segment._tag === 'TypeSegment') return segment.type
|
123
|
+
if (segment._tag === 'FieldSegment') return segment.field
|
124
|
+
return ''
|
125
|
+
}).filter(Boolean).join('.')
|
126
|
+
|
127
|
+
return ParseResult.succeed(str)
|
128
|
+
},
|
129
|
+
},
|
130
|
+
).annotations({
|
131
|
+
identifier: 'QueryPath',
|
132
|
+
description: 'Query path through a GraphQL schema',
|
133
|
+
})
|
134
|
+
|
135
|
+
export type QueryPath = S.Schema.Type<typeof QueryPath>
|
@@ -6,19 +6,23 @@ import { Array, HashSet, pipe } from 'effect'
|
|
6
6
|
// Schema
|
7
7
|
// ============================================================================
|
8
8
|
|
9
|
+
export class VersionCoverageUnversioned
|
10
|
+
extends S.TaggedClass<VersionCoverageUnversioned>()('VersionCoverageUnversioned', {})
|
11
|
+
{}
|
9
12
|
export const VersionCoverageOne = Version.Version
|
10
13
|
export const VersionCoverageSet = S.HashSet(Version.Version)
|
11
14
|
|
12
15
|
/**
|
13
|
-
* A selection of versions - either a single version or a set of versions.
|
16
|
+
* A selection of versions - either unversioned (applies to all), a single version, or a set of versions.
|
14
17
|
* Used as keys in versioned documents to map version(s) to document content.
|
15
18
|
*/
|
16
19
|
export const VersionCoverage = S.Union(
|
20
|
+
VersionCoverageUnversioned,
|
17
21
|
VersionCoverageOne,
|
18
22
|
VersionCoverageSet,
|
19
23
|
).annotations({
|
20
24
|
identifier: 'VersionCoverage',
|
21
|
-
description: '
|
25
|
+
description: 'Unversioned (all versions), a single version, or a set of versions',
|
22
26
|
})
|
23
27
|
|
24
28
|
// ============================================================================
|
@@ -31,16 +35,34 @@ export type VersionCoverage = S.Schema.Type<typeof VersionCoverage>
|
|
31
35
|
// Constructors
|
32
36
|
// ============================================================================
|
33
37
|
|
38
|
+
/**
|
39
|
+
* Create an unversioned coverage that applies to all versions
|
40
|
+
*/
|
41
|
+
export const unversioned = (): VersionCoverage => new VersionCoverageUnversioned({})
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Create a single version coverage
|
45
|
+
*/
|
46
|
+
export const single = (version: Version.Version): VersionCoverage => version
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Create a version set coverage
|
50
|
+
*/
|
51
|
+
export const set = (versions: Version.Version[]): VersionCoverage => HashSet.fromIterable(versions)
|
52
|
+
|
34
53
|
// ============================================================================
|
35
54
|
// Type Guards
|
36
55
|
// ============================================================================
|
37
56
|
|
38
57
|
export const is = S.is(VersionCoverage)
|
39
58
|
|
40
|
-
export const
|
59
|
+
export const isUnversioned = (coverage: VersionCoverage): coverage is VersionCoverageUnversioned =>
|
60
|
+
coverage instanceof VersionCoverageUnversioned
|
41
61
|
|
42
|
-
export const
|
43
|
-
|
62
|
+
export const isSingle = (coverage: VersionCoverage): coverage is Version.Version => Version.is(coverage)
|
63
|
+
|
64
|
+
export const isSet = (coverage: VersionCoverage): coverage is HashSet.HashSet<Version.Version> =>
|
65
|
+
!isUnversioned(coverage) && !Version.is(coverage)
|
44
66
|
|
45
67
|
// ============================================================================
|
46
68
|
// Codec
|
@@ -68,6 +90,9 @@ export const contains = (
|
|
68
90
|
versionCoverage: VersionCoverage,
|
69
91
|
version: Version.Version,
|
70
92
|
): boolean => {
|
93
|
+
if (isUnversioned(versionCoverage)) {
|
94
|
+
return true // Unversioned applies to all versions
|
95
|
+
}
|
71
96
|
if (Version.is(versionCoverage)) {
|
72
97
|
return Version.equivalence(versionCoverage, version)
|
73
98
|
}
|
@@ -78,6 +103,9 @@ export const contains = (
|
|
78
103
|
* Get display label for UI
|
79
104
|
*/
|
80
105
|
export const toLabel = (versionCoverage: VersionCoverage): string => {
|
106
|
+
if (isUnversioned(versionCoverage)) {
|
107
|
+
return 'All Versions'
|
108
|
+
}
|
81
109
|
return pipe(versionCoverage, encodeSync, Array.ensure, Array.map(_ => _.toString()), Array.join(', '))
|
82
110
|
}
|
83
111
|
|
@@ -85,6 +113,9 @@ export const toLabel = (versionCoverage: VersionCoverage): string => {
|
|
85
113
|
* Get all versions from a selection
|
86
114
|
*/
|
87
115
|
export const toVersions = (versionCoverage: VersionCoverage): Version.Version[] => {
|
116
|
+
if (isUnversioned(versionCoverage)) {
|
117
|
+
return [] // Unversioned doesn't map to specific versions
|
118
|
+
}
|
88
119
|
if (Version.is(versionCoverage)) {
|
89
120
|
return [versionCoverage]
|
90
121
|
}
|
@@ -98,9 +129,12 @@ export const toVersions = (versionCoverage: VersionCoverage): Version.Version[]
|
|
98
129
|
*
|
99
130
|
* @param versionCoverage - The version coverage to get the latest version from
|
100
131
|
* @returns The latest version
|
101
|
-
* @throws {Error} If the version set is empty
|
132
|
+
* @throws {Error} If the version set is empty or if called on unversioned coverage
|
102
133
|
*/
|
103
134
|
export const getLatest = (versionCoverage: VersionCoverage): Version.Version => {
|
135
|
+
if (isUnversioned(versionCoverage)) {
|
136
|
+
throw new Error('Cannot get latest version from unversioned coverage')
|
137
|
+
}
|
104
138
|
if (Version.is(versionCoverage)) {
|
105
139
|
return versionCoverage
|
106
140
|
}
|
@@ -115,3 +149,11 @@ export const getLatest = (versionCoverage: VersionCoverage): Version.Version =>
|
|
115
149
|
// Reduce the array to find the maximum
|
116
150
|
return versions.reduce((latest, current) => Version.max(latest, current))
|
117
151
|
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Check if a version coverage matches a specific version.
|
155
|
+
* Unversioned always matches, single version must be equal, set must contain the version.
|
156
|
+
*/
|
157
|
+
export const matches = (coverage: VersionCoverage, version: Version.Version): boolean => {
|
158
|
+
return contains(coverage, version)
|
159
|
+
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { Catalog } from '#lib/catalog
|
2
|
-
import { Schema } from '#lib/schema
|
3
|
-
import { Swiss } from '#lib/swiss
|
1
|
+
import { Catalog } from '#lib/catalog'
|
2
|
+
import { Schema } from '#lib/schema'
|
3
|
+
import { Swiss } from '#lib/swiss'
|
4
4
|
import { Version } from '#lib/version'
|
5
5
|
import { Box, Text } from '@radix-ui/themes'
|
6
6
|
import { useEffect, useState } from 'react'
|
7
|
-
import { useNavigate
|
7
|
+
import { useNavigate } from 'react-router'
|
8
8
|
import { VersionPicker } from '../../components/VersionPicker.js'
|
9
9
|
import { ChangelogSidebarItem } from './ChangelogSidebarItem.js'
|
10
10
|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
import { Catalog } from '#lib/catalog/$'
|
1
2
|
import { route } from '#lib/react-router-effect/route'
|
2
3
|
import { SidebarLayout } from '#template/layouts/index'
|
3
4
|
import { Outlet, useLocation } from 'react-router'
|
4
5
|
import { pagesCatalog } from 'virtual:polen/project/pages'
|
5
6
|
import { routes } from 'virtual:polen/project/routes.jsx'
|
7
|
+
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
6
8
|
import { MdxProvider } from '../providers/mdx.js'
|
7
9
|
|
8
10
|
const Component = () => {
|
@@ -16,8 +18,11 @@ const Component = () => {
|
|
16
18
|
// Get the sidebar for this section
|
17
19
|
const sidebar = pagesCatalog.sidebarIndex[topLevelPath]?.items || []
|
18
20
|
|
21
|
+
// Get the latest schema for interactive GraphQL blocks
|
22
|
+
const schema = schemasCatalog && Catalog.getLatest(schemasCatalog).definition
|
23
|
+
|
19
24
|
return (
|
20
|
-
<MdxProvider>
|
25
|
+
<MdxProvider schema={schema}>
|
21
26
|
<SidebarLayout sidebar={sidebar}>
|
22
27
|
<Outlet />
|
23
28
|
</SidebarLayout>
|
@@ -83,8 +83,6 @@ export const Examples = ({
|
|
83
83
|
const getControlForDiagnostic = (diagnostic: ExamplesModule.Diagnostic) => {
|
84
84
|
if (diagnostic.source === 'examples-scanner') {
|
85
85
|
switch (diagnostic.name) {
|
86
|
-
case 'unused-default':
|
87
|
-
return config.examples.diagnostics?.unusedVersions
|
88
86
|
case 'duplicate-content':
|
89
87
|
return config.examples.diagnostics?.duplicateContent
|
90
88
|
case 'missing-versions':
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { Api } from '#api/$'
|
2
2
|
import { Schema } from '#api/schema/$'
|
3
|
+
import type { Diagnostic as AugmentationDiagnostic } from '#api/schema/augmentations/diagnostics/diagnostic'
|
3
4
|
import { Catalog } from '#lib/catalog/$'
|
5
|
+
import { Diagnostic } from '#lib/diagnostic/$'
|
4
6
|
import { ViteReactive } from '#lib/vite-reactive/$'
|
5
7
|
import { createAssetReader } from '#lib/vite-reactive/reactive-asset-plugin'
|
6
8
|
import { ViteVirtual } from '#lib/vite-virtual/$'
|
@@ -39,7 +41,40 @@ export const Schemas = ({
|
|
39
41
|
// Self-contained Schema Reader
|
40
42
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
41
43
|
|
42
|
-
|
44
|
+
let lastDiagnostics: AugmentationDiagnostic[] = []
|
45
|
+
|
46
|
+
const reader = createAssetReader(() =>
|
47
|
+
Schema.loadOrNull(config).pipe(
|
48
|
+
Effect.map((result) => {
|
49
|
+
// Store diagnostics for reporting
|
50
|
+
if (result?.diagnostics) {
|
51
|
+
lastDiagnostics = result.diagnostics
|
52
|
+
}
|
53
|
+
return result
|
54
|
+
}),
|
55
|
+
)
|
56
|
+
)
|
57
|
+
|
58
|
+
// Map diagnostic to its control configuration
|
59
|
+
const getControlForDiagnostic = (diagnostic: AugmentationDiagnostic) => {
|
60
|
+
if (diagnostic.source === 'schema-augmentations') {
|
61
|
+
// All augmentation errors are always enabled with error severity
|
62
|
+
return {
|
63
|
+
enabled: true,
|
64
|
+
dev: { severity: 'error' as const },
|
65
|
+
build: { severity: 'error' as const },
|
66
|
+
}
|
67
|
+
}
|
68
|
+
return undefined
|
69
|
+
}
|
70
|
+
|
71
|
+
// Report diagnostics
|
72
|
+
const reportDiagnostics = (
|
73
|
+
diagnostics: AugmentationDiagnostic[],
|
74
|
+
phase: 'dev' | 'build' = 'dev',
|
75
|
+
) => {
|
76
|
+
Diagnostic.filterAndReport(diagnostics, getControlForDiagnostic, phase)
|
77
|
+
}
|
43
78
|
|
44
79
|
// Helper to check if a file is a schema file that should trigger regeneration
|
45
80
|
const isSchemaFile = (file: string): boolean => {
|
@@ -102,7 +137,7 @@ export const Schemas = ({
|
|
102
137
|
// @claude in what case can data be null?
|
103
138
|
serializer: (loadedCatalog) =>
|
104
139
|
Effect.gen(function*() {
|
105
|
-
if (!loadedCatalog
|
140
|
+
if (!loadedCatalog?.data) throw new Error('No schema data to serialize')
|
106
141
|
const encoded = yield* Catalog.encode(loadedCatalog.data)
|
107
142
|
return JSON.stringify(encoded, null, 2)
|
108
143
|
}),
|
@@ -113,6 +148,14 @@ export const Schemas = ({
|
|
113
148
|
isRelevant: isSchemaFile,
|
114
149
|
},
|
115
150
|
dependentVirtualModules,
|
151
|
+
hooks: {
|
152
|
+
async onDiagnostics(data) {
|
153
|
+
// Report augmentation diagnostics
|
154
|
+
if (data?.diagnostics) {
|
155
|
+
reportDiagnostics(data.diagnostics as AugmentationDiagnostic[], 'dev')
|
156
|
+
}
|
157
|
+
},
|
158
|
+
},
|
116
159
|
}),
|
117
160
|
{
|
118
161
|
name: 'polen:schemas-virtual',
|
@@ -126,6 +169,12 @@ export const Schemas = ({
|
|
126
169
|
const schemaResult = await Effect.runPromise(
|
127
170
|
reader.read().pipe(Effect.provide(NodeFileSystem.layer)),
|
128
171
|
)
|
172
|
+
|
173
|
+
// Report diagnostics if any
|
174
|
+
if (schemaResult?.diagnostics && schemaResult.diagnostics.length > 0) {
|
175
|
+
reportDiagnostics(schemaResult.diagnostics, 'dev')
|
176
|
+
}
|
177
|
+
|
129
178
|
if (!schemaResult?.data) {
|
130
179
|
return `export const schemasCatalog = null`
|
131
180
|
}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { S } from '#lib/kit-temp/effect';
|
2
|
-
export declare const DiagnosticUnusedDefault: S.Struct<{
|
3
|
-
_tag: S.tag<"Diagnostic">;
|
4
|
-
} & Omit<{
|
5
|
-
_tag: S.Literal<["Diagnostic"]>;
|
6
|
-
source: typeof S.String;
|
7
|
-
name: typeof S.String;
|
8
|
-
severity: S.Enums<{
|
9
|
-
readonly error: "error";
|
10
|
-
readonly warning: "warning";
|
11
|
-
readonly info: "info";
|
12
|
-
}>;
|
13
|
-
message: typeof S.String;
|
14
|
-
}, "_tag" | "name" | "source" | "severity"> & {
|
15
|
-
name: S.Literal<["unused-default"]>;
|
16
|
-
source: S.Literal<["examples-scanner"]>;
|
17
|
-
severity: S.Literal<["warning"]>;
|
18
|
-
} & {
|
19
|
-
example: S.Struct<{
|
20
|
-
name: typeof S.String;
|
21
|
-
path: typeof S.String;
|
22
|
-
}>;
|
23
|
-
versions: S.Array$<typeof S.String>;
|
24
|
-
}>;
|
25
|
-
export declare const makeDiagnosticUnusedDefault: import("#lib/kit-temp/effect").EffectKit.Schema.ConstructorUsingOmitLiteral1Algo<S.Struct<{
|
26
|
-
_tag: S.tag<"Diagnostic">;
|
27
|
-
} & Omit<{
|
28
|
-
_tag: S.Literal<["Diagnostic"]>;
|
29
|
-
source: typeof S.String;
|
30
|
-
name: typeof S.String;
|
31
|
-
severity: S.Enums<{
|
32
|
-
readonly error: "error";
|
33
|
-
readonly warning: "warning";
|
34
|
-
readonly info: "info";
|
35
|
-
}>;
|
36
|
-
message: typeof S.String;
|
37
|
-
}, "_tag" | "name" | "source" | "severity"> & {
|
38
|
-
name: S.Literal<["unused-default"]>;
|
39
|
-
source: S.Literal<["examples-scanner"]>;
|
40
|
-
severity: S.Literal<["warning"]>;
|
41
|
-
} & {
|
42
|
-
example: S.Struct<{
|
43
|
-
name: typeof S.String;
|
44
|
-
path: typeof S.String;
|
45
|
-
}>;
|
46
|
-
versions: S.Array$<typeof S.String>;
|
47
|
-
}>>;
|
48
|
-
export type DiagnosticUnusedDefault = S.Schema.Type<typeof DiagnosticUnusedDefault>;
|
49
|
-
//# sourceMappingURL=unused-default.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"unused-default.d.ts","sourceRoot":"","sources":["../../../../src/api/examples/diagnostic/unused-default.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AAExC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;EAclC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;GAAiD,CAAA;AAEzF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { Diagnostic } from '#lib/diagnostic/$';
|
2
|
-
import { S } from '#lib/kit-temp/effect';
|
3
|
-
export const DiagnosticUnusedDefault = Diagnostic.create({
|
4
|
-
source: 'examples-scanner',
|
5
|
-
name: 'unused-default',
|
6
|
-
severity: 'warning',
|
7
|
-
context: {
|
8
|
-
example: S.Struct({
|
9
|
-
name: S.String,
|
10
|
-
path: S.String,
|
11
|
-
}),
|
12
|
-
versions: S.Array(S.String),
|
13
|
-
},
|
14
|
-
}).annotations({
|
15
|
-
identifier: 'DiagnosticUnusedDefault',
|
16
|
-
description: 'Default example file that is never used because explicit versions exist for all schema versions',
|
17
|
-
});
|
18
|
-
export const makeDiagnosticUnusedDefault = Diagnostic.createMake(DiagnosticUnusedDefault);
|
19
|
-
//# sourceMappingURL=unused-default.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"unused-default.js","sourceRoot":"","sources":["../../../../src/api/examples/diagnostic/unused-default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AAExC,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC,MAAM,CAAC;IACvD,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE;QACP,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YAChB,IAAI,EAAE,CAAC,CAAC,MAAM;YACd,IAAI,EAAE,CAAC,CAAC,MAAM;SACf,CAAC;QACF,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;KAC5B;CACF,CAAC,CAAC,WAAW,CAAC;IACb,UAAU,EAAE,yBAAyB;IACrC,WAAW,EAAE,iGAAiG;CAC/G,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAA"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import type { GrafaidOld } from '#lib/grafaid-old';
|
2
|
-
import { S } from '#lib/kit-temp/effect';
|
3
|
-
export declare const PlacementSchema: S.Literal<["before", "after", "over"]>;
|
4
|
-
export type Placement = S.Schema.Type<typeof PlacementSchema>;
|
5
|
-
export declare const DescriptionAugmentationSchema: S.Struct<{
|
6
|
-
type: S.Literal<["description"]>;
|
7
|
-
on: S.Union<[S.Struct<{
|
8
|
-
type: S.Literal<["TargetType"]>;
|
9
|
-
name: typeof S.String;
|
10
|
-
}>, S.Struct<{
|
11
|
-
type: S.Literal<["TargetField"]>;
|
12
|
-
name: typeof S.String;
|
13
|
-
targetType: typeof S.String;
|
14
|
-
}>]>;
|
15
|
-
placement: S.Literal<["before", "after", "over"]>;
|
16
|
-
content: typeof S.String;
|
17
|
-
}>;
|
18
|
-
export type DescriptionAugmentation = S.Schema.Type<typeof DescriptionAugmentationSchema>;
|
19
|
-
export declare const Placement: {
|
20
|
-
Before: "before";
|
21
|
-
After: "after";
|
22
|
-
Over: "over";
|
23
|
-
};
|
24
|
-
export declare const applyDescriptionContent: (type: GrafaidOld.Groups.Describable, augmentation: DescriptionAugmentation) => void;
|
25
|
-
export declare const apply: (schema: GrafaidOld.Schema.Schema, augmentation: DescriptionAugmentation) => void;
|
26
|
-
//# sourceMappingURL=description.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../../../../../src/api/schema/augmentations/augmentations/description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AASxC,eAAO,MAAM,eAAe,wCAAuC,CAAA;AACnE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAKxC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAMzF,eAAO,MAAM,SAAS;;;;CAIrB,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,MAAM,UAAU,CAAC,MAAM,CAAC,WAAW,EACnC,cAAc,uBAAuB,SAiBtC,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,QAAQ,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,uBAAuB,SAe5F,CAAA"}
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import { S } from '#lib/kit-temp/effect';
|
2
|
-
import { neverCase } from '@wollybeard/kit/language';
|
3
|
-
import { TargetSchema } from '../target.js';
|
4
|
-
import { locateTargetField, locateTargetType } from '../target.js';
|
5
|
-
// ============================================================================
|
6
|
-
// Schema
|
7
|
-
// ============================================================================
|
8
|
-
export const PlacementSchema = S.Literal('before', 'after', 'over');
|
9
|
-
export const DescriptionAugmentationSchema = S.Struct({
|
10
|
-
type: S.Literal('description'),
|
11
|
-
on: TargetSchema,
|
12
|
-
placement: PlacementSchema,
|
13
|
-
content: S.String,
|
14
|
-
});
|
15
|
-
// ============================================================================
|
16
|
-
// Constants
|
17
|
-
// ============================================================================
|
18
|
-
export const Placement = {
|
19
|
-
Before: `before`,
|
20
|
-
After: `after`,
|
21
|
-
Over: `over`,
|
22
|
-
};
|
23
|
-
export const applyDescriptionContent = (type, augmentation) => {
|
24
|
-
const existingDescription = type.description ?? ``;
|
25
|
-
switch (augmentation.placement) {
|
26
|
-
case `before`:
|
27
|
-
type.description = `${augmentation.content}\n\n${existingDescription}`;
|
28
|
-
break;
|
29
|
-
case `after`:
|
30
|
-
type.description = `${existingDescription}\n\n${augmentation.content}`;
|
31
|
-
break;
|
32
|
-
case `over`:
|
33
|
-
type.description = augmentation.content;
|
34
|
-
break;
|
35
|
-
default:
|
36
|
-
neverCase(augmentation.placement);
|
37
|
-
}
|
38
|
-
};
|
39
|
-
export const apply = (schema, augmentation) => {
|
40
|
-
switch (augmentation.on.type) {
|
41
|
-
case `TargetType`: {
|
42
|
-
const type = locateTargetType(schema, augmentation.on);
|
43
|
-
applyDescriptionContent(type, augmentation);
|
44
|
-
break;
|
45
|
-
}
|
46
|
-
case `TargetField`: {
|
47
|
-
const field = locateTargetField(schema, augmentation.on);
|
48
|
-
applyDescriptionContent(field, augmentation);
|
49
|
-
break;
|
50
|
-
}
|
51
|
-
default:
|
52
|
-
neverCase(augmentation.on);
|
53
|
-
}
|
54
|
-
};
|
55
|
-
//# sourceMappingURL=description.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../../src/api/schema/augmentations/augmentations/description.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAElE,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAGnE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAC9B,EAAE,EAAE,YAAY;IAChB,SAAS,EAAE,eAAe;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM;CAClB,CAAC,CAAA;AAIF,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,QAAiB;IACzB,KAAK,EAAE,OAAgB;IACvB,IAAI,EAAE,MAAe;CACtB,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,IAAmC,EACnC,YAAqC,EACrC,EAAE;IACF,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,CAAA;IAElD,QAAQ,YAAY,CAAC,SAAS,EAAE,CAAC;QAC/B,KAAK,QAAQ;YACX,IAAI,CAAC,WAAW,GAAG,GAAG,YAAY,CAAC,OAAO,OAAO,mBAAmB,EAAE,CAAA;YACtE,MAAK;QACP,KAAK,OAAO;YACV,IAAI,CAAC,WAAW,GAAG,GAAG,mBAAmB,OAAO,YAAY,CAAC,OAAO,EAAE,CAAA;YACtE,MAAK;QACP,KAAK,MAAM;YACT,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,OAAO,CAAA;YACvC,MAAK;QACP;YACE,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAAgC,EAAE,YAAqC,EAAE,EAAE;IAC/F,QAAQ,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAC7B,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,CAAA;YACtD,uBAAuB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;YAC3C,MAAK;QACP,CAAC;QACD,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,CAAA;YACxD,uBAAuB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;YAC5C,MAAK;QACP,CAAC;QACD;YACE,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;AACH,CAAC,CAAA"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import type { GrafaidOld } from '#lib/grafaid-old';
|
2
|
-
import { S } from '#lib/kit-temp/effect';
|
3
|
-
import * as AugmentationDescription from './augmentations/description.js';
|
4
|
-
export { AugmentationDescription };
|
5
|
-
export declare const AugmentationSchema: S.Struct<{
|
6
|
-
type: S.Literal<["description"]>;
|
7
|
-
on: S.Union<[S.Struct<{
|
8
|
-
type: S.Literal<["TargetType"]>;
|
9
|
-
name: typeof S.String;
|
10
|
-
}>, S.Struct<{
|
11
|
-
type: S.Literal<["TargetField"]>;
|
12
|
-
name: typeof S.String;
|
13
|
-
targetType: typeof S.String;
|
14
|
-
}>]>;
|
15
|
-
placement: S.Literal<["before", "after", "over"]>;
|
16
|
-
content: typeof S.String;
|
17
|
-
}>;
|
18
|
-
export type Augmentation = S.Schema.Type<typeof AugmentationSchema>;
|
19
|
-
export declare const apply: (schema: GrafaidOld.Schema.Schema, augmentations: readonly Augmentation[]) => GrafaidOld.Schema.Schema;
|
20
|
-
//# sourceMappingURL=schema-augmentation.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"schema-augmentation.d.ts","sourceRoot":"","sources":["../../../../src/api/schema/augmentations/schema-augmentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AAExC,OAAO,KAAK,uBAAuB,MAAM,gCAAgC,CAAA;AAEzE,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAMlC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAAwD,CAAA;AAEvF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,KAAK,GAChB,QAAQ,UAAU,CAAC,MAAM,CAAC,MAAM,EAChC,eAAe,SAAS,YAAY,EAAE,KACrC,UAAU,CAAC,MAAM,CAAC,MAapB,CAAA"}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { S } from '#lib/kit-temp/effect';
|
2
|
-
import { neverCase } from '@wollybeard/kit/language';
|
3
|
-
import * as AugmentationDescription from './augmentations/description.js';
|
4
|
-
export { AugmentationDescription };
|
5
|
-
// ============================================================================
|
6
|
-
// Schema
|
7
|
-
// ============================================================================
|
8
|
-
export const AugmentationSchema = AugmentationDescription.DescriptionAugmentationSchema; // Union will expand as more augmentation types are added
|
9
|
-
export const apply = (schema, augmentations) => {
|
10
|
-
for (const augmentation of augmentations) {
|
11
|
-
switch (augmentation.type) {
|
12
|
-
case `description`: {
|
13
|
-
AugmentationDescription.apply(schema, augmentation);
|
14
|
-
break;
|
15
|
-
}
|
16
|
-
default:
|
17
|
-
neverCase(augmentation.type);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
return schema;
|
21
|
-
};
|
22
|
-
//# sourceMappingURL=schema-augmentation.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"schema-augmentation.js","sourceRoot":"","sources":["../../../../src/api/schema/augmentations/schema-augmentation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,uBAAuB,MAAM,gCAAgC,CAAA;AAEzE,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAElC,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,6BAA6B,CAAA,CAAC,yDAAyD;AAIjJ,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,MAAgC,EAChC,aAAsC,EACZ,EAAE;IAC5B,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACzC,QAAQ,YAAY,CAAC,IAAI,EAAE,CAAC;YAC1B,KAAK,aAAa,CAAC,CAAC,CAAC;gBACnB,uBAAuB,CAAC,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;gBACnD,MAAK;YACP,CAAC;YACD;gBACE,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|