polen 0.11.0-next.24 → 0.11.0-next.26
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 +259 -77
- package/build/api/config/input.d.ts.map +1 -1
- package/build/api/config/input.js +2 -0
- package/build/api/config/input.js.map +1 -1
- package/build/api/config/normalized.d.ts +433 -143
- package/build/api/config/normalized.d.ts.map +1 -1
- package/build/api/config/normalized.js +47 -0
- package/build/api/config/normalized.js.map +1 -1
- package/build/api/config-template/template.d.ts +191 -121
- package/build/api/config-template/template.d.ts.map +1 -1
- package/build/api/config-template/template.js +18 -1
- package/build/api/config-template/template.js.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 +30 -17
- package/build/api/examples/scanner.js.map +1 -1
- package/build/api/examples/schemas/catalog.d.ts +56 -12
- package/build/api/examples/schemas/catalog.d.ts.map +1 -1
- package/build/api/examples/schemas/example/example.d.ts +54 -11
- package/build/api/examples/schemas/example/example.d.ts.map +1 -1
- package/build/api/examples/schemas/example/example.js +5 -0
- package/build/api/examples/schemas/example/example.js.map +1 -1
- package/build/api/reference/$.d.ts +4 -0
- package/build/api/reference/$.d.ts.map +1 -0
- package/build/api/reference/$.js +4 -0
- package/build/api/reference/$.js.map +1 -0
- package/build/api/reference/catalog.d.ts +69 -0
- package/build/api/reference/catalog.d.ts.map +1 -0
- package/build/api/reference/catalog.js +44 -0
- package/build/api/reference/catalog.js.map +1 -0
- package/build/api/reference/config.d.ts +616 -0
- package/build/api/reference/config.d.ts.map +1 -0
- package/build/api/reference/config.js +162 -0
- package/build/api/reference/config.js.map +1 -0
- package/build/api/reference/scanner.d.ts +26 -0
- package/build/api/reference/scanner.d.ts.map +1 -0
- package/build/api/reference/scanner.js +27 -0
- package/build/api/reference/scanner.js.map +1 -0
- 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/grafaid/schema/format-default-value.d.ts +11 -0
- package/build/lib/grafaid/schema/format-default-value.d.ts.map +1 -0
- package/build/lib/grafaid/schema/format-default-value.js +20 -0
- package/build/lib/grafaid/schema/format-default-value.js.map +1 -0
- package/build/lib/grafaid/schema/schema.d.ts +1 -0
- package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
- package/build/lib/grafaid/schema/schema.js +1 -0
- package/build/lib/grafaid/schema/schema.js.map +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/components/ArgumentAnnotation.d.ts +2 -1
- package/build/template/components/ArgumentAnnotation.d.ts.map +1 -1
- package/build/template/components/ArgumentAnnotation.js +14 -4
- package/build/template/components/ArgumentAnnotation.js.map +1 -1
- package/build/template/components/ArgumentListAnnotation.d.ts +1 -0
- package/build/template/components/ArgumentListAnnotation.d.ts.map +1 -1
- package/build/template/components/ArgumentListAnnotation.js +21 -8
- package/build/template/components/ArgumentListAnnotation.js.map +1 -1
- package/build/template/components/Changelog/groups/FieldArgument.d.ts.map +1 -1
- package/build/template/components/Changelog/groups/FieldArgument.js +0 -1
- package/build/template/components/Changelog/groups/FieldArgument.js.map +1 -1
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +1 -1
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/Description.js +1 -1
- package/build/template/components/Description.js.map +1 -1
- package/build/template/components/ExampleLink.d.ts.map +1 -1
- package/build/template/components/ExampleLink.js +2 -1
- package/build/template/components/ExampleLink.js.map +1 -1
- package/build/template/components/Field.d.ts +2 -0
- package/build/template/components/Field.d.ts.map +1 -1
- package/build/template/components/Field.js +42 -4
- package/build/template/components/Field.js.map +1 -1
- package/build/template/components/FieldList.d.ts +2 -1
- package/build/template/components/FieldList.d.ts.map +1 -1
- package/build/template/components/FieldList.js +14 -3
- package/build/template/components/FieldList.js.map +1 -1
- package/build/template/components/FieldListSection.d.ts.map +1 -1
- package/build/template/components/FieldListSection.js +6 -1
- package/build/template/components/FieldListSection.js.map +1 -1
- package/build/template/components/GraphQLDocument.d.ts.map +1 -1
- package/build/template/components/GraphQLDocument.js +2 -1
- package/build/template/components/GraphQLDocument.js.map +1 -1
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts +2 -0
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts.map +1 -1
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.js +4 -3
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.js.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts +2 -2
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.js +17 -12
- package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
- package/build/template/components/IAPIndicator.d.ts +12 -0
- package/build/template/components/IAPIndicator.d.ts.map +1 -0
- package/build/template/components/IAPIndicator.js +21 -0
- package/build/template/components/IAPIndicator.js.map +1 -0
- package/build/template/components/Link.d.ts +1 -2
- package/build/template/components/Link.d.ts.map +1 -1
- package/build/template/components/Link.js +5 -2
- package/build/template/components/Link.js.map +1 -1
- package/build/template/components/NamedType.d.ts.map +1 -1
- package/build/template/components/NamedType.js +9 -5
- package/build/template/components/NamedType.js.map +1 -1
- package/build/template/components/ReferenceLink.d.ts +2 -2
- package/build/template/components/ReferenceLink.d.ts.map +1 -1
- package/build/template/components/ReferenceLink.js +5 -3
- package/build/template/components/ReferenceLink.js.map +1 -1
- package/build/template/components/TypeAnnotation.d.ts +2 -0
- package/build/template/components/TypeAnnotation.d.ts.map +1 -1
- package/build/template/components/TypeAnnotation.js +4 -4
- package/build/template/components/TypeAnnotation.js.map +1 -1
- package/build/template/components/ViewModeToggle.d.ts +3 -0
- package/build/template/components/ViewModeToggle.d.ts.map +1 -0
- package/build/template/components/ViewModeToggle.js +9 -0
- package/build/template/components/ViewModeToggle.js.map +1 -0
- package/build/template/components/graphql/type-link.d.ts +2 -0
- package/build/template/components/graphql/type-link.d.ts.map +1 -1
- package/build/template/components/graphql/type-link.js +15 -3
- package/build/template/components/graphql/type-link.js.map +1 -1
- package/build/template/components/home/PlaygroundPreview.d.ts.map +1 -1
- package/build/template/components/home/PlaygroundPreview.js +3 -2
- package/build/template/components/home/PlaygroundPreview.js.map +1 -1
- package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.js +18 -5
- package/build/template/components/sidebar/SidebarItem.js.map +1 -1
- package/build/template/contexts/ReferenceConfigContext.d.ts +16 -0
- package/build/template/contexts/ReferenceConfigContext.d.ts.map +1 -0
- package/build/template/contexts/ReferenceConfigContext.js +14 -0
- package/build/template/contexts/ReferenceConfigContext.js.map +1 -0
- package/build/template/contexts/ViewModeContext.d.ts +14 -0
- package/build/template/contexts/ViewModeContext.d.ts.map +1 -0
- package/build/template/contexts/ViewModeContext.js +40 -0
- package/build/template/contexts/ViewModeContext.js.map +1 -0
- package/build/template/hooks/use-examples.d.ts +4 -1
- package/build/template/hooks/use-examples.d.ts.map +1 -1
- package/build/template/hooks/useAlignedColumns.d.ts +10 -0
- package/build/template/hooks/useAlignedColumns.d.ts.map +1 -0
- package/build/template/hooks/useAlignedColumns.js +17 -0
- package/build/template/hooks/useAlignedColumns.js.map +1 -0
- 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 +12 -3
- package/build/template/routes/examples/_.d.ts.map +1 -1
- package/build/template/routes/examples/_index.d.ts +8 -2
- package/build/template/routes/examples/_index.d.ts.map +1 -1
- package/build/template/routes/examples/name.d.ts +12 -3
- package/build/template/routes/examples/name.d.ts.map +1 -1
- package/build/template/routes/examples/name.js +6 -2
- package/build/template/routes/examples/name.js.map +1 -1
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +37 -10
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/stores/changelog.d.ts +39 -39
- package/build/vite/plugins/core.d.ts.map +1 -1
- package/build/vite/plugins/core.js +6 -0
- package/build/vite/plugins/core.js.map +1 -1
- package/build/vite/plugins/examples.d.ts.map +1 -1
- package/build/vite/plugins/examples.js +10 -3
- package/build/vite/plugins/examples.js.map +1 -1
- package/build/vite/plugins/index.d.ts +1 -0
- package/build/vite/plugins/index.d.ts.map +1 -1
- package/build/vite/plugins/index.js +1 -0
- package/build/vite/plugins/index.js.map +1 -1
- package/build/vite/plugins/navbar.d.ts.map +1 -1
- package/build/vite/plugins/navbar.js +3 -1
- package/build/vite/plugins/navbar.js.map +1 -1
- package/build/vite/plugins/reference.d.ts +19 -0
- package/build/vite/plugins/reference.d.ts.map +1 -0
- package/build/vite/plugins/reference.js +96 -0
- package/build/vite/plugins/reference.js.map +1 -0
- 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/config/input.ts +2 -0
- package/src/api/config/normalized.ts +54 -0
- package/src/api/config-template/template.ts +18 -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 +31 -21
- package/src/api/examples/schemas/example/example.ts +6 -0
- package/src/api/reference/$.ts +3 -0
- package/src/api/reference/catalog.ts +55 -0
- package/src/api/reference/config.ts +193 -0
- package/src/api/reference/scanner.ts +53 -0
- 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/grafaid/schema/format-default-value.ts +22 -0
- package/src/lib/grafaid/schema/schema.ts +2 -0
- 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/components/ArgumentAnnotation.tsx +58 -9
- package/src/template/components/ArgumentListAnnotation.tsx +50 -17
- package/src/template/components/Changelog/groups/FieldArgument.tsx +0 -1
- package/src/template/components/CodeBlock.tsx +1 -0
- package/src/template/components/Description.tsx +1 -1
- package/src/template/components/ExampleLink.tsx +2 -1
- package/src/template/components/Field.tsx +148 -20
- package/src/template/components/FieldList.tsx +28 -13
- package/src/template/components/FieldListSection.tsx +12 -2
- package/src/template/components/GraphQLDocument.tsx +2 -0
- package/src/template/components/GraphQLInteractive/GraphQLInteractive.tsx +6 -1
- package/src/template/components/GraphQLInteractive/lib/parser.ts +16 -3
- package/src/template/components/IAPIndicator.tsx +73 -0
- package/src/template/components/Link.tsx +9 -3
- package/src/template/components/NamedType.tsx +54 -28
- package/src/template/components/ReferenceLink.tsx +16 -10
- package/src/template/components/TypeAnnotation.tsx +17 -5
- package/src/template/components/ViewModeToggle.tsx +27 -0
- package/src/template/components/graphql/type-link.tsx +34 -3
- package/src/template/components/home/PlaygroundPreview.tsx +3 -0
- package/src/template/components/sidebar/SidebarItem.tsx +21 -5
- package/src/template/contexts/ReferenceConfigContext.tsx +37 -0
- package/src/template/contexts/ViewModeContext.tsx +64 -0
- package/src/template/hooks/useAlignedColumns.ts +19 -0
- package/src/template/routes/changelog/ChangelogSidebar.tsx +4 -4
- package/src/template/routes/examples/name.tsx +13 -1
- package/src/template/routes/reference.tsx +67 -23
- package/src/types/virtual-modules.d.ts +5 -0
- package/src/vite/plugins/core.ts +6 -0
- package/src/vite/plugins/examples.ts +12 -2
- package/src/vite/plugins/index.ts +1 -0
- package/src/vite/plugins/navbar.ts +4 -1
- package/src/vite/plugins/reference.ts +130 -0
- 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/build/template/components/ArgumentList.d.ts +0 -6
- package/build/template/components/ArgumentList.d.ts.map +0 -1
- package/build/template/components/ArgumentList.js +0 -9
- package/build/template/components/ArgumentList.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
- package/src/template/components/ArgumentList.tsx +0 -22
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Api } from '#api/$';
|
2
2
|
import { Schema } from '#api/schema/$';
|
3
3
|
import { Catalog } from '#lib/catalog/$';
|
4
|
+
import { Diagnostic } from '#lib/diagnostic/$';
|
4
5
|
import { ViteReactive } from '#lib/vite-reactive/$';
|
5
6
|
import { createAssetReader } from '#lib/vite-reactive/reactive-asset-plugin';
|
6
7
|
import { ViteVirtual } from '#lib/vite-virtual/$';
|
@@ -30,7 +31,30 @@ export const Schemas = ({ config, dependentVirtualModules = [], }) => {
|
|
30
31
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
31
32
|
// Self-contained Schema Reader
|
32
33
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
33
|
-
|
34
|
+
let lastDiagnostics = [];
|
35
|
+
const reader = createAssetReader(() => Schema.loadOrNull(config).pipe(Effect.map((result) => {
|
36
|
+
// Store diagnostics for reporting
|
37
|
+
if (result?.diagnostics) {
|
38
|
+
lastDiagnostics = result.diagnostics;
|
39
|
+
}
|
40
|
+
return result;
|
41
|
+
})));
|
42
|
+
// Map diagnostic to its control configuration
|
43
|
+
const getControlForDiagnostic = (diagnostic) => {
|
44
|
+
if (diagnostic.source === 'schema-augmentations') {
|
45
|
+
// All augmentation errors are always enabled with error severity
|
46
|
+
return {
|
47
|
+
enabled: true,
|
48
|
+
dev: { severity: 'error' },
|
49
|
+
build: { severity: 'error' },
|
50
|
+
};
|
51
|
+
}
|
52
|
+
return undefined;
|
53
|
+
};
|
54
|
+
// Report diagnostics
|
55
|
+
const reportDiagnostics = (diagnostics, phase = 'dev') => {
|
56
|
+
Diagnostic.filterAndReport(diagnostics, getControlForDiagnostic, phase);
|
57
|
+
};
|
34
58
|
// Helper to check if a file is a schema file that should trigger regeneration
|
35
59
|
const isSchemaFile = (file) => {
|
36
60
|
if (!config.schema)
|
@@ -77,7 +101,7 @@ export const Schemas = ({ config, dependentVirtualModules = [], }) => {
|
|
77
101
|
emit: {
|
78
102
|
// @claude in what case can data be null?
|
79
103
|
serializer: (loadedCatalog) => Effect.gen(function* () {
|
80
|
-
if (!loadedCatalog
|
104
|
+
if (!loadedCatalog?.data)
|
81
105
|
throw new Error('No schema data to serialize');
|
82
106
|
const encoded = yield* Catalog.encode(loadedCatalog.data);
|
83
107
|
return JSON.stringify(encoded, null, 2);
|
@@ -89,6 +113,14 @@ export const Schemas = ({ config, dependentVirtualModules = [], }) => {
|
|
89
113
|
isRelevant: isSchemaFile,
|
90
114
|
},
|
91
115
|
dependentVirtualModules,
|
116
|
+
hooks: {
|
117
|
+
async onDiagnostics(data) {
|
118
|
+
// Report augmentation diagnostics
|
119
|
+
if (data?.diagnostics) {
|
120
|
+
reportDiagnostics(data.diagnostics, 'dev');
|
121
|
+
}
|
122
|
+
},
|
123
|
+
},
|
92
124
|
}),
|
93
125
|
{
|
94
126
|
name: 'polen:schemas-virtual',
|
@@ -98,6 +130,10 @@ export const Schemas = ({ config, dependentVirtualModules = [], }) => {
|
|
98
130
|
const debug = debugPolen.sub(`module-project-schema`);
|
99
131
|
debug(`load`, { id: viProjectSchema.id });
|
100
132
|
const schemaResult = await Effect.runPromise(reader.read().pipe(Effect.provide(NodeFileSystem.layer)));
|
133
|
+
// Report diagnostics if any
|
134
|
+
if (schemaResult?.diagnostics && schemaResult.diagnostics.length > 0) {
|
135
|
+
reportDiagnostics(schemaResult.diagnostics, 'dev');
|
136
|
+
}
|
101
137
|
if (!schemaResult?.data) {
|
102
138
|
return `export const schemasCatalog = null`;
|
103
139
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/vite/plugins/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,eAA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MAAM,CAAC,UAAU,CAC1C,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CACzD,CAAA;oBAED,4BAA4B;oBAC5B,IAAI,YAAY,EAAE,WAAW,IAAI,YAAY,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACrE,iBAAiB,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;oBACpD,CAAC;oBAED,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC;wBACxB,OAAO,oCAAoC,CAAA;oBAC7C,CAAC;oBACD,OAAO;;gCAEa,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;;aAExE,CAAA;gBACH,CAAC;aACF,CACF;SACF;KACF,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AAC5B,CAAC,CAAA"}
|
package/package.json
CHANGED
package/src/api/config/input.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { ExamplesConfig } from '#api/examples/config'
|
2
|
+
import { ReferenceConfig } from '#api/reference/config'
|
2
3
|
import { ConfigSchema } from '#api/schema/config-schema'
|
3
4
|
import { Vite } from '#dep/vite/index'
|
4
5
|
import { spreadShallow } from '#lib/kit-temp'
|
@@ -306,6 +307,7 @@ export const ConfigInput = S.Struct({
|
|
306
307
|
*/
|
307
308
|
description: S.optional(S.String),
|
308
309
|
schema: S.optional(ConfigSchema),
|
310
|
+
reference: S.optional(ReferenceConfig),
|
309
311
|
examples: S.optional(ExamplesConfig),
|
310
312
|
templateVariables: S.optional(TemplateVariables),
|
311
313
|
home: S.optional(HomeConfig),
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { ExamplesConfig } from '#api/examples/config'
|
2
|
+
import { DescriptionsView, ReferenceConfigObject } from '#api/reference/config'
|
2
3
|
import { ConfigSchema } from '#api/schema/config-schema'
|
3
4
|
import { Typings } from '#api/typings/$'
|
4
5
|
import { DirectedFilter } from '#lib/directed-filter/$'
|
@@ -11,6 +12,24 @@ import { Effect } from 'effect'
|
|
11
12
|
import type { WritableDeep } from 'type-fest'
|
12
13
|
import { BuildArchitecture, ConfigInput } from './input.js'
|
13
14
|
|
15
|
+
// ============================================================================
|
16
|
+
// Normalized Reference Config
|
17
|
+
// ============================================================================
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Normalized reference configuration where all optional fields have defaults applied.
|
21
|
+
*/
|
22
|
+
const NormalizedReferenceConfig = S.extend(
|
23
|
+
ReferenceConfigObject.pipe(S.omit('descriptionsView', 'nullabilityRendering')),
|
24
|
+
S.Struct({
|
25
|
+
descriptionsView: S.Struct({
|
26
|
+
defaultMode: S.Literal('compact', 'expanded'),
|
27
|
+
showControl: S.Boolean,
|
28
|
+
}),
|
29
|
+
nullabilityRendering: S.Literal('questionMark', 'bangMark'),
|
30
|
+
}),
|
31
|
+
)
|
32
|
+
|
14
33
|
// ============================================================================
|
15
34
|
// DirectedFilter for Strings
|
16
35
|
// ============================================================================
|
@@ -320,6 +339,11 @@ export const Config = S.Struct({
|
|
320
339
|
*/
|
321
340
|
schema: ConfigSchema,
|
322
341
|
|
342
|
+
/**
|
343
|
+
* Reference documentation configuration with resolved defaults.
|
344
|
+
*/
|
345
|
+
reference: NormalizedReferenceConfig,
|
346
|
+
|
323
347
|
/**
|
324
348
|
* Examples configuration with resolved defaults.
|
325
349
|
*/
|
@@ -487,6 +511,13 @@ const getConfigInputDefaults = (baseRootDirPath: string): Config => ({
|
|
487
511
|
},
|
488
512
|
},
|
489
513
|
schema: {},
|
514
|
+
reference: {
|
515
|
+
descriptionsView: {
|
516
|
+
defaultMode: 'expanded',
|
517
|
+
showControl: true,
|
518
|
+
},
|
519
|
+
nullabilityRendering: 'bangMark',
|
520
|
+
},
|
490
521
|
examples: {
|
491
522
|
display: 'all',
|
492
523
|
},
|
@@ -658,6 +689,29 @@ export const normalizeInput = (
|
|
658
689
|
configInput_as_writeable.warnings.interactiveWithoutSchema.enabled
|
659
690
|
}
|
660
691
|
|
692
|
+
// Process reference configuration
|
693
|
+
if (configInput_as_writeable?.reference) {
|
694
|
+
const referenceInput = configInput_as_writeable.reference
|
695
|
+
// The schema transform handles boolean shorthand, so we always get an object here
|
696
|
+
if (referenceInput.enabled !== undefined) {
|
697
|
+
config.reference.enabled = referenceInput.enabled
|
698
|
+
}
|
699
|
+
if (referenceInput.descriptionsView) {
|
700
|
+
if (referenceInput.descriptionsView.defaultMode !== undefined) {
|
701
|
+
config.reference.descriptionsView.defaultMode = referenceInput.descriptionsView.defaultMode
|
702
|
+
}
|
703
|
+
if (referenceInput.descriptionsView.showControl !== undefined) {
|
704
|
+
config.reference.descriptionsView.showControl = referenceInput.descriptionsView.showControl
|
705
|
+
}
|
706
|
+
}
|
707
|
+
if (referenceInput.nullabilityRendering !== undefined) {
|
708
|
+
config.reference.nullabilityRendering = referenceInput.nullabilityRendering
|
709
|
+
}
|
710
|
+
if (referenceInput.diagnostics) {
|
711
|
+
config.reference.diagnostics = referenceInput.diagnostics
|
712
|
+
}
|
713
|
+
}
|
714
|
+
|
661
715
|
// Process examples configuration
|
662
716
|
if (configInput_as_writeable?.examples) {
|
663
717
|
const examplesInput = configInput_as_writeable.examples
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { Api } from '#api/$'
|
2
2
|
import { ExamplesConfigObject } from '#api/examples/config'
|
3
|
+
import { ReferenceConfigObject } from '#api/reference/config'
|
3
4
|
import { ConfigSchema } from '#api/schema/config-schema'
|
4
5
|
import type { Catalog } from '#lib/catalog/$'
|
5
6
|
import { S } from '#lib/kit-temp/effect'
|
@@ -16,6 +17,13 @@ export const resolve = (config: Config, data: {
|
|
16
17
|
...config.schema,
|
17
18
|
enabled: Boolean(config.schema.enabled ?? data.schemas),
|
18
19
|
},
|
20
|
+
reference: {
|
21
|
+
...config.reference,
|
22
|
+
// Reference is enabled if explicitly enabled OR if schemas exist (unless explicitly disabled)
|
23
|
+
enabled: Boolean(config.reference.enabled ?? data.schemas),
|
24
|
+
descriptionsView: config.reference.descriptionsView,
|
25
|
+
nullabilityRendering: config.reference.nullabilityRendering,
|
26
|
+
},
|
19
27
|
examples: {
|
20
28
|
...config.examples,
|
21
29
|
enabled: Boolean(config.examples.enabled ?? (data.examples && data.examples.examples.length > 0)),
|
@@ -33,7 +41,7 @@ export const resolve = (config: Config, data: {
|
|
33
41
|
* that control feature enablement have been resolved to concrete values.
|
34
42
|
*/
|
35
43
|
export const TemplateConfig = S.extend(
|
36
|
-
Config.pipe(S.omit('_input', 'schema', 'examples')),
|
44
|
+
Config.pipe(S.omit('_input', 'schema', 'reference', 'examples')),
|
37
45
|
S.Struct({
|
38
46
|
schema: S.extend(
|
39
47
|
ConfigSchema.pipe(S.omit('enabled')),
|
@@ -41,6 +49,15 @@ export const TemplateConfig = S.extend(
|
|
41
49
|
enabled: S.Boolean,
|
42
50
|
}),
|
43
51
|
),
|
52
|
+
reference: S.Struct({
|
53
|
+
enabled: S.Boolean,
|
54
|
+
descriptionsView: S.Struct({
|
55
|
+
defaultMode: S.Literal('compact', 'expanded'),
|
56
|
+
showControl: S.Boolean,
|
57
|
+
}),
|
58
|
+
nullabilityRendering: S.Literal('questionMark', 'bangMark'),
|
59
|
+
diagnostics: S.optional(S.Unknown), // From ReferenceConfigObject
|
60
|
+
}),
|
44
61
|
examples: S.extend(
|
45
62
|
ExamplesConfigObject.pipe(S.omit('enabled')),
|
46
63
|
S.Struct({
|
@@ -2,7 +2,6 @@ import { DiagnosticDuplicateContent } from '#api/examples/diagnostic/duplicate-c
|
|
2
2
|
import { DiagnosticInvalidFilename } from '#api/examples/diagnostic/invalid-filename'
|
3
3
|
import { DiagnosticMissingVersions } from '#api/examples/diagnostic/missing-versions'
|
4
4
|
import { DiagnosticUnknownVersion } from '#api/examples/diagnostic/unknown-version'
|
5
|
-
import { DiagnosticUnusedDefault } from '#api/examples/diagnostic/unused-default'
|
6
5
|
import { DiagnosticValidationError } from '#api/examples/diagnostic/validation-error'
|
7
6
|
import { S } from '#lib/kit-temp/effect'
|
8
7
|
|
@@ -11,12 +10,10 @@ export * from './duplicate-content.js'
|
|
11
10
|
export * from './invalid-filename.js'
|
12
11
|
export * from './missing-versions.js'
|
13
12
|
export * from './unknown-version.js'
|
14
|
-
export * from './unused-default.js'
|
15
13
|
export * from './validation-error.js'
|
16
14
|
export { validateExamples } from './validator.js'
|
17
15
|
|
18
16
|
export const Diagnostic = S.Union(
|
19
|
-
DiagnosticUnusedDefault,
|
20
17
|
DiagnosticDuplicateContent,
|
21
18
|
DiagnosticMissingVersions,
|
22
19
|
DiagnosticInvalidFilename,
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { Version } from '#lib/version/$'
|
2
|
+
import { HashMap } from 'effect'
|
3
|
+
import { describe, expect, test } from 'vitest'
|
4
|
+
import * as scanner from './scanner.js'
|
5
|
+
|
6
|
+
describe('parseExampleFile', () => {
|
7
|
+
test.for([
|
8
|
+
{
|
9
|
+
input: 'get-user.graphql',
|
10
|
+
expected: { type: 'unversioned', name: 'get-user', file: 'get-user.graphql' },
|
11
|
+
},
|
12
|
+
{
|
13
|
+
input: 'get-user.1.graphql',
|
14
|
+
expected: {
|
15
|
+
type: 'versioned',
|
16
|
+
name: 'get-user',
|
17
|
+
version: Version.decodeSync('1'),
|
18
|
+
file: 'get-user.1.graphql',
|
19
|
+
},
|
20
|
+
},
|
21
|
+
{
|
22
|
+
input: 'get-user.default.graphql',
|
23
|
+
expected: {
|
24
|
+
type: 'versioned',
|
25
|
+
name: 'get-user',
|
26
|
+
version: expect.objectContaining({ _tag: 'VersionCustom', value: 'default' }),
|
27
|
+
file: 'get-user.default.graphql',
|
28
|
+
},
|
29
|
+
},
|
30
|
+
])('parses $input correctly', ({ input, expected }) => {
|
31
|
+
expect(scanner.parseExampleFile(input)).toEqual(expected)
|
32
|
+
})
|
33
|
+
})
|
34
|
+
|
35
|
+
describe('resolveDefaultFiles', () => {
|
36
|
+
const v1 = Version.decodeSync('1')
|
37
|
+
const v2 = Version.decodeSync('2')
|
38
|
+
const v3 = Version.decodeSync('3')
|
39
|
+
const schemaVersions = [v1, v2, v3]
|
40
|
+
|
41
|
+
test.for([
|
42
|
+
{
|
43
|
+
name: 'unversioned file alone remains unversioned',
|
44
|
+
grouped: new Map([['example', { unversioned: 'example.graphql', versioned: new Map() }]]),
|
45
|
+
assertions: (resolved: ReturnType<typeof scanner.resolveDefaultFiles>) => {
|
46
|
+
const example = resolved.get('example')!
|
47
|
+
expect(example.unversioned).toBe('example.graphql')
|
48
|
+
expect(HashMap.size(example.versionDocuments)).toBe(0)
|
49
|
+
},
|
50
|
+
},
|
51
|
+
{
|
52
|
+
name: 'unversioned file acts as default when versioned files exist',
|
53
|
+
grouped: new Map([['example', {
|
54
|
+
unversioned: 'example.graphql',
|
55
|
+
versioned: new Map([[v1, 'example.1.graphql']]),
|
56
|
+
}]]),
|
57
|
+
assertions: (resolved: ReturnType<typeof scanner.resolveDefaultFiles>) => {
|
58
|
+
const example = resolved.get('example')!
|
59
|
+
expect(example.unversioned).toBeUndefined()
|
60
|
+
expect(HashMap.size(example.versionDocuments)).toBe(2)
|
61
|
+
expect(HashMap.has(example.versionDocuments, v1)).toBe(true)
|
62
|
+
|
63
|
+
const entries = [...HashMap.entries(example.versionDocuments)]
|
64
|
+
const defaultEntry = entries.find(([_, value]) => value === 'example.graphql')
|
65
|
+
expect(defaultEntry).toBeDefined()
|
66
|
+
},
|
67
|
+
},
|
68
|
+
{
|
69
|
+
name: 'only versioned files when no unversioned exists',
|
70
|
+
grouped: new Map([['example', {
|
71
|
+
versioned: new Map([[v1, 'example.1.graphql'], [v2, 'example.2.graphql']]),
|
72
|
+
}]]),
|
73
|
+
assertions: (resolved: ReturnType<typeof scanner.resolveDefaultFiles>) => {
|
74
|
+
const example = resolved.get('example')!
|
75
|
+
expect(example.unversioned).toBeUndefined()
|
76
|
+
expect(HashMap.size(example.versionDocuments)).toBe(2)
|
77
|
+
},
|
78
|
+
},
|
79
|
+
])('$name', ({ grouped, assertions }) => {
|
80
|
+
const resolved = scanner.resolveDefaultFiles(grouped, schemaVersions)
|
81
|
+
assertions(resolved)
|
82
|
+
})
|
83
|
+
})
|
@@ -50,19 +50,17 @@ const VERSIONED_FILE_PATTERN = Str.pattern<{ groups: ['name', 'version'] }>(
|
|
50
50
|
type ParsedExampleFile =
|
51
51
|
| { type: 'unversioned'; name: string; file: string }
|
52
52
|
| { type: 'versioned'; name: string; version: Version.Version; file: string }
|
53
|
-
| { type: 'default'; name: string; file: string }
|
54
53
|
|
55
54
|
type GroupedExampleFiles = Map<string, {
|
56
55
|
unversioned?: string
|
57
56
|
versioned: Map<Version.Version, string>
|
58
|
-
default?: string
|
59
57
|
}>
|
60
58
|
|
61
59
|
// ============================================================================
|
62
60
|
// Helpers
|
63
61
|
// ============================================================================
|
64
62
|
|
65
|
-
const parseExampleFile = (filename: string): ParsedExampleFile => {
|
63
|
+
export const parseExampleFile = (filename: string): ParsedExampleFile => {
|
66
64
|
const parsed = Path.parse(filename)
|
67
65
|
const base = parsed.name
|
68
66
|
|
@@ -72,11 +70,6 @@ const parseExampleFile = (filename: string): ParsedExampleFile => {
|
|
72
70
|
if (match) {
|
73
71
|
const { name, version: versionStr } = match.groups
|
74
72
|
|
75
|
-
// Handle special 'default' keyword
|
76
|
-
if (versionStr === 'default') {
|
77
|
-
return { type: 'default', name, file: filename }
|
78
|
-
}
|
79
|
-
|
80
73
|
const version = Version.decodeSync(versionStr)
|
81
74
|
return { type: 'versioned', name, version, file: filename }
|
82
75
|
}
|
@@ -106,9 +99,6 @@ const groupExampleFiles = (files: string[]): GroupedExampleFiles => {
|
|
106
99
|
case 'versioned':
|
107
100
|
group.versioned.set(parsed.version, parsed.file)
|
108
101
|
break
|
109
|
-
case 'default':
|
110
|
-
group.default = parsed.file
|
111
|
-
break
|
112
102
|
}
|
113
103
|
}
|
114
104
|
|
@@ -119,7 +109,7 @@ const groupExampleFiles = (files: string[]): GroupedExampleFiles => {
|
|
119
109
|
* Resolve .default files into proper version coverage.
|
120
110
|
* This erases the .default convention and converts it to semantic version sets.
|
121
111
|
*/
|
122
|
-
const resolveDefaultFiles = (
|
112
|
+
export const resolveDefaultFiles = (
|
123
113
|
grouped: GroupedExampleFiles,
|
124
114
|
schemaVersions: Version.Version[],
|
125
115
|
): Map<string, {
|
@@ -139,9 +129,9 @@ const resolveDefaultFiles = (
|
|
139
129
|
versionDocuments = HashMap.set(versionDocuments, version, file)
|
140
130
|
}
|
141
131
|
|
142
|
-
// Handle
|
143
|
-
if (group.
|
144
|
-
//
|
132
|
+
// Handle unversioned file
|
133
|
+
if (group.unversioned && group.versioned.size > 0) {
|
134
|
+
// When both unversioned and versioned exist, use unversioned as default for missing versions
|
145
135
|
const explicitVersions = HashSet.fromIterable(group.versioned.keys())
|
146
136
|
const defaultVersions = schemaVersions.filter(v => !HashSet.has(explicitVersions, v))
|
147
137
|
|
@@ -151,14 +141,20 @@ const resolveDefaultFiles = (
|
|
151
141
|
? defaultVersions[0]! // Single version
|
152
142
|
: HashSet.fromIterable(defaultVersions) // Version set
|
153
143
|
|
154
|
-
versionDocuments = HashMap.set(versionDocuments, defaultCoverage, group.
|
144
|
+
versionDocuments = HashMap.set(versionDocuments, defaultCoverage, group.unversioned)
|
155
145
|
}
|
146
|
+
// Don't add to resolved.unversioned since it's acting as a default
|
147
|
+
resolved.set(name, { versionDocuments })
|
148
|
+
} else if (group.unversioned) {
|
149
|
+
// Only unversioned exists - truly unversioned
|
150
|
+
resolved.set(name, {
|
151
|
+
versionDocuments,
|
152
|
+
unversioned: group.unversioned,
|
153
|
+
})
|
154
|
+
} else {
|
155
|
+
// Only versioned files exist
|
156
|
+
resolved.set(name, { versionDocuments })
|
156
157
|
}
|
157
|
-
|
158
|
-
resolved.set(name, {
|
159
|
-
versionDocuments,
|
160
|
-
...(group.unversioned ? { unversioned: group.unversioned } : {}),
|
161
|
-
})
|
162
158
|
}
|
163
159
|
|
164
160
|
return resolved
|
@@ -334,6 +330,20 @@ export const scan = (
|
|
334
330
|
}
|
335
331
|
|
336
332
|
if (example) {
|
333
|
+
// Check for description.md or description.mdx file
|
334
|
+
const descriptionMdPath = Path.join(options.dir, `${name}.md`)
|
335
|
+
const descriptionMdxPath = Path.join(options.dir, `${name}.mdx`)
|
336
|
+
|
337
|
+
const descriptionPath = (yield* fs.exists(descriptionMdPath))
|
338
|
+
? descriptionMdPath
|
339
|
+
: (yield* fs.exists(descriptionMdxPath))
|
340
|
+
? descriptionMdxPath
|
341
|
+
: null
|
342
|
+
|
343
|
+
if (descriptionPath) {
|
344
|
+
example = { ...example, description: { path: descriptionPath } }
|
345
|
+
}
|
346
|
+
|
337
347
|
examples.push(example)
|
338
348
|
// Generate diagnostics for this example
|
339
349
|
diagnostics.push(...lintFileLayout(example, options.schemaCatalog))
|
@@ -26,6 +26,12 @@ export const Example = S.Struct({
|
|
26
26
|
* The document content, which can be unversioned, versioned, or partially versioned.
|
27
27
|
*/
|
28
28
|
document: Document.Document,
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Optional description file for this example.
|
32
|
+
* Points to a markdown/MDX file that describes the example.
|
33
|
+
*/
|
34
|
+
description: S.optional(S.Struct({ path: S.String })),
|
29
35
|
}).annotations({
|
30
36
|
identifier: 'Example',
|
31
37
|
description: 'A GraphQL example that contains a document with optional versioning support',
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { S } from '#lib/kit-temp/effect'
|
2
|
+
|
3
|
+
// ============================================================================
|
4
|
+
// Schema and Type
|
5
|
+
// ============================================================================
|
6
|
+
|
7
|
+
export const Catalog = S.Struct({
|
8
|
+
/**
|
9
|
+
* Optional index file metadata for custom reference landing page.
|
10
|
+
* If not provided, the app will redirect to the Query type.
|
11
|
+
*/
|
12
|
+
index: S.optional(S.Struct({
|
13
|
+
/**
|
14
|
+
* Path to the index.md or index.mdx file
|
15
|
+
*/
|
16
|
+
path: S.String,
|
17
|
+
})),
|
18
|
+
}).annotations({
|
19
|
+
identifier: 'ReferenceCatalog',
|
20
|
+
description: 'A catalog of reference documentation metadata',
|
21
|
+
})
|
22
|
+
|
23
|
+
export type Catalog = S.Schema.Type<typeof Catalog>
|
24
|
+
|
25
|
+
// ============================================================================
|
26
|
+
// Constructors
|
27
|
+
// ============================================================================
|
28
|
+
|
29
|
+
export const make = Catalog.make
|
30
|
+
|
31
|
+
// ============================================================================
|
32
|
+
// Type Guards
|
33
|
+
// ============================================================================
|
34
|
+
|
35
|
+
export const is = S.is(Catalog)
|
36
|
+
|
37
|
+
// ============================================================================
|
38
|
+
// State Predicates
|
39
|
+
// ============================================================================
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Check if the catalog has a custom index page
|
43
|
+
*/
|
44
|
+
export const hasIndex = (catalog: Catalog): boolean => {
|
45
|
+
return catalog.index !== undefined
|
46
|
+
}
|
47
|
+
|
48
|
+
// ============================================================================
|
49
|
+
// Codec
|
50
|
+
// ============================================================================
|
51
|
+
|
52
|
+
export const decode = S.decode(Catalog)
|
53
|
+
export const decodeSync = S.decodeSync(Catalog)
|
54
|
+
export const encode = S.encode(Catalog)
|
55
|
+
export const encodeSync = S.encodeSync(Catalog)
|