polen 0.11.0-next.17 → 0.11.0-next.19
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/builder/ssg/generate.d.ts.map +1 -1
- package/build/api/builder/ssg/generate.js +5 -5
- package/build/api/builder/ssg/generate.js.map +1 -1
- package/build/api/builder/ssg/page-generator.worker.js +13 -3
- package/build/api/builder/ssg/page-generator.worker.js.map +1 -1
- package/build/api/config/input.d.ts +88 -3
- package/build/api/config/input.d.ts.map +1 -1
- package/build/api/config/normalized.d.ts +92 -7
- package/build/api/config/normalized.d.ts.map +1 -1
- package/build/api/config/normalized.js +11 -3
- package/build/api/config/normalized.js.map +1 -1
- package/build/api/config-template/template.js +2 -2
- package/build/api/config-template/template.js.map +1 -1
- package/build/api/content/sidebar.d.ts.map +1 -1
- package/build/api/content/sidebar.js +2 -1
- package/build/api/content/sidebar.js.map +1 -1
- package/build/api/errors.d.ts +278 -0
- package/build/api/errors.d.ts.map +1 -0
- package/build/api/errors.js +153 -0
- package/build/api/errors.js.map +1 -0
- package/build/api/examples/config.d.ts +366 -3
- package/build/api/examples/config.d.ts.map +1 -1
- package/build/api/examples/config.js +25 -3
- package/build/api/examples/config.js.map +1 -1
- package/build/api/examples/diagnostic/diagnostic.d.ts +1 -1
- package/build/api/examples/diagnostic/validation-error.d.ts +3 -2
- package/build/api/examples/diagnostic/validation-error.d.ts.map +1 -1
- package/build/api/examples/diagnostic/validation-error.js +9 -3
- package/build/api/examples/diagnostic/validation-error.js.map +1 -1
- package/build/api/examples/diagnostic/validator.d.ts.map +1 -1
- package/build/api/examples/diagnostic/validator.js +115 -68
- package/build/api/examples/diagnostic/validator.js.map +1 -1
- package/build/api/examples/filter.d.ts.map +1 -1
- package/build/api/examples/filter.js +9 -6
- package/build/api/examples/filter.js.map +1 -1
- package/build/api/examples/scanner.d.ts.map +1 -1
- package/build/api/examples/scanner.js +89 -103
- package/build/api/examples/scanner.js.map +1 -1
- package/build/api/examples/type-usage-indexer.d.ts.map +1 -1
- package/build/api/examples/type-usage-indexer.js +17 -30
- package/build/api/examples/type-usage-indexer.js.map +1 -1
- package/build/api/iso/schema/routing.d.ts.map +1 -1
- package/build/api/iso/schema/routing.js +8 -8
- package/build/api/iso/schema/routing.js.map +1 -1
- package/build/api/iso/schema/validation.d.ts.map +1 -1
- package/build/api/iso/schema/validation.js +3 -2
- package/build/api/iso/schema/validation.js.map +1 -1
- package/build/api/schema/input-source/$$.d.ts +1 -0
- package/build/api/schema/input-source/$$.d.ts.map +1 -1
- package/build/api/schema/input-source/$$.js +1 -0
- package/build/api/schema/input-source/$$.js.map +1 -1
- package/build/api/schema/input-source/errors.d.ts +36 -0
- package/build/api/schema/input-source/errors.d.ts.map +1 -0
- package/build/api/schema/input-source/errors.js +17 -0
- package/build/api/schema/input-source/errors.js.map +1 -0
- package/build/api/schema/input-source/input-source.d.ts +1 -7
- package/build/api/schema/input-source/input-source.d.ts.map +1 -1
- package/build/api/schema/input-source/input-source.js +0 -6
- package/build/api/schema/input-source/input-source.js.map +1 -1
- package/build/api/schema/input-sources/directory.d.ts.map +1 -1
- package/build/api/schema/input-sources/directory.js +19 -6
- package/build/api/schema/input-sources/directory.js.map +1 -1
- package/build/api/schema/input-sources/file.d.ts.map +1 -1
- package/build/api/schema/input-sources/file.js +15 -4
- package/build/api/schema/input-sources/file.js.map +1 -1
- package/build/api/schema/input-sources/introspection-file.d.ts.map +1 -1
- package/build/api/schema/input-sources/introspection-file.js +28 -6
- package/build/api/schema/input-sources/introspection-file.js.map +1 -1
- package/build/api/schema/input-sources/introspection.d.ts.map +1 -1
- package/build/api/schema/input-sources/introspection.js +35 -7
- package/build/api/schema/input-sources/introspection.js.map +1 -1
- package/build/api/schema/input-sources/memory.d.ts.map +1 -1
- package/build/api/schema/input-sources/memory.js +15 -3
- package/build/api/schema/input-sources/memory.js.map +1 -1
- package/build/api/schema/input-sources/versioned-directory.d.ts.map +1 -1
- package/build/api/schema/input-sources/versioned-directory.js +23 -7
- package/build/api/schema/input-sources/versioned-directory.js.map +1 -1
- package/build/api/schema/load.d.ts +1 -1
- package/build/api/schema/load.d.ts.map +1 -1
- package/build/api/schema/load.js.map +1 -1
- package/build/cli/commands/hero-image.d.ts +1 -2
- package/build/cli/commands/hero-image.d.ts.map +1 -1
- package/build/cli/index.d.ts +1 -1
- package/build/lib/catalog/catalog.d.ts +43 -3
- package/build/lib/catalog/catalog.d.ts.map +1 -1
- package/build/lib/catalog/catalog.js +67 -5
- package/build/lib/catalog/catalog.js.map +1 -1
- package/build/lib/catalog/versioned.d.ts +11 -1
- package/build/lib/catalog/versioned.d.ts.map +1 -1
- package/build/lib/catalog/versioned.js +23 -5
- package/build/lib/catalog/versioned.js.map +1 -1
- package/build/lib/document/document.d.ts +55 -5
- package/build/lib/document/document.d.ts.map +1 -1
- package/build/lib/document/document.js +96 -2
- package/build/lib/document/document.js.map +1 -1
- package/build/lib/document/versioned.d.ts +2 -2
- package/build/lib/document/versioned.d.ts.map +1 -1
- package/build/lib/document/versioned.js +7 -7
- package/build/lib/document/versioned.js.map +1 -1
- package/build/lib/lifecycles/lifecycles.d.ts +5 -4
- package/build/lib/lifecycles/lifecycles.d.ts.map +1 -1
- package/build/lib/lifecycles/lifecycles.js +14 -12
- package/build/lib/lifecycles/lifecycles.js.map +1 -1
- package/build/lib/version-coverage/$$.d.ts +2 -0
- package/build/lib/version-coverage/$$.d.ts.map +1 -0
- package/build/lib/version-coverage/$$.js +2 -0
- package/build/lib/version-coverage/$$.js.map +1 -0
- package/build/lib/version-coverage/$.d.ts.map +1 -0
- package/build/lib/version-coverage/$.js.map +1 -0
- package/build/lib/{version-selection/version-selection.d.ts → version-coverage/version-coverage.d.ts} +1 -1
- package/build/lib/version-coverage/version-coverage.d.ts.map +1 -0
- package/build/lib/{version-selection/version-selection.js → version-coverage/version-coverage.js} +2 -2
- package/build/lib/version-coverage/version-coverage.js.map +1 -0
- package/build/template/components/GraphQLDocument.d.ts +1 -1
- package/build/template/components/GraphQLDocument.d.ts.map +1 -1
- package/build/template/components/GraphQLDocument.js +10 -39
- package/build/template/components/GraphQLDocument.js.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts +28 -0
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.js +60 -27
- package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
- package/build/template/components/ReferenceVersionPicker.d.ts +9 -0
- package/build/template/components/ReferenceVersionPicker.d.ts.map +1 -0
- package/build/template/components/ReferenceVersionPicker.js +79 -0
- package/build/template/components/ReferenceVersionPicker.js.map +1 -0
- package/build/template/components/VersionCoveragePicker.d.ts +1 -1
- package/build/template/components/VersionCoveragePicker.d.ts.map +1 -1
- package/build/template/components/VersionCoveragePicker.js +4 -6
- package/build/template/components/VersionCoveragePicker.js.map +1 -1
- package/build/template/components/VersionPicker.d.ts +8 -3
- package/build/template/components/VersionPicker.d.ts.map +1 -1
- package/build/template/components/VersionPicker.js +12 -77
- package/build/template/components/VersionPicker.js.map +1 -1
- package/build/template/components/home/QuickStart.d.ts.map +1 -1
- package/build/template/components/home/QuickStart.js +8 -4
- package/build/template/components/home/QuickStart.js.map +1 -1
- package/build/template/hooks/use-highlighted.d.ts.map +1 -1
- package/build/template/hooks/use-highlighted.js +19 -13
- package/build/template/hooks/use-highlighted.js.map +1 -1
- package/build/template/lib/fetch-text.d.ts +18 -0
- package/build/template/lib/fetch-text.d.ts.map +1 -1
- package/build/template/lib/fetch-text.js +32 -4
- package/build/template/lib/fetch-text.js.map +1 -1
- package/build/template/routes/changelog/ChangelogBody.d.ts +6 -0
- package/build/template/routes/changelog/ChangelogBody.d.ts.map +1 -0
- package/build/template/{components/Changelog/Changelog.js → routes/changelog/ChangelogBody.js} +8 -58
- package/build/template/routes/changelog/ChangelogBody.js.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebar.d.ts +7 -0
- package/build/template/routes/changelog/ChangelogSidebar.d.ts.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebar.js +46 -0
- package/build/template/routes/changelog/ChangelogSidebar.js.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.d.ts +11 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.d.ts.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.js +35 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.js.map +1 -0
- package/build/template/routes/changelog/_.d.ts +3264 -0
- package/build/template/routes/changelog/_.d.ts.map +1 -0
- package/build/template/routes/changelog/_.js +111 -0
- package/build/template/routes/changelog/_.js.map +1 -0
- package/build/template/routes/changelog/utils.d.ts +3 -0
- package/build/template/routes/changelog/utils.d.ts.map +1 -0
- package/build/template/routes/changelog/utils.js +11 -0
- package/build/template/routes/changelog/utils.js.map +1 -0
- package/build/template/routes/examples/name.d.ts.map +1 -1
- package/build/template/routes/examples/name.js +4 -2
- package/build/template/routes/examples/name.js.map +1 -1
- package/build/template/routes/reference.js +2 -2
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.js +1 -1
- package/build/template/routes/root.js.map +1 -1
- package/build/template/stores/toast.d.ts.map +1 -1
- package/build/template/stores/toast.js +5 -3
- package/build/template/stores/toast.js.map +1 -1
- package/build/template/theme/swiss-sharp.css +14 -14
- package/build/vite/plugins/schemas.d.ts +1 -2
- package/build/vite/plugins/schemas.d.ts.map +1 -1
- package/build/vite/plugins/schemas.js +0 -1
- package/build/vite/plugins/schemas.js.map +1 -1
- package/package.json +7 -7
- package/src/api/builder/ssg/generate.ts +10 -5
- package/src/api/builder/ssg/page-generator.worker.ts +18 -3
- package/src/api/config/normalized.ts +12 -3
- package/src/api/config-template/template.ts +2 -2
- package/src/api/content/sidebar.ts +3 -3
- package/src/api/errors.ts +227 -0
- package/src/api/examples/config.test.ts +10 -0
- package/src/api/examples/config.ts +33 -4
- package/src/api/examples/diagnostic/validation-error.ts +9 -3
- package/src/api/examples/diagnostic/validator.test.ts +30 -0
- package/src/api/examples/diagnostic/validator.ts +148 -103
- package/src/api/examples/filter.ts +9 -6
- package/src/api/examples/scanner.ts +136 -117
- package/src/api/examples/type-usage-indexer.ts +24 -36
- package/src/api/iso/schema/routing.ts +10 -10
- package/src/api/iso/schema/validation.ts +3 -2
- package/src/api/schema/input-source/$$.ts +1 -0
- package/src/api/schema/input-source/errors.ts +26 -0
- package/src/api/schema/input-source/input-source.ts +1 -22
- package/src/api/schema/input-sources/directory.ts +20 -15
- package/src/api/schema/input-sources/file.ts +17 -4
- package/src/api/schema/input-sources/introspection-file.ts +30 -15
- package/src/api/schema/input-sources/introspection.ts +38 -7
- package/src/api/schema/input-sources/memory.ts +19 -3
- package/src/api/schema/input-sources/versioned-directory.ts +25 -27
- package/src/api/schema/load.ts +2 -1
- package/src/lib/catalog/catalog.ts +89 -6
- package/src/lib/catalog/versioned.ts +26 -5
- package/src/lib/document/document.ts +135 -2
- package/src/lib/document/versioned.ts +8 -8
- package/src/lib/lifecycles/lifecycles.ts +32 -27
- package/src/lib/version-coverage/$$.ts +1 -0
- package/src/lib/{version-selection/version-selection.ts → version-coverage/version-coverage.ts} +1 -1
- package/src/template/components/GraphQLDocument.tsx +11 -69
- package/src/template/components/GraphQLInteractive/lib/parser.ts +81 -29
- package/src/template/components/ReferenceVersionPicker.tsx +107 -0
- package/src/template/components/VersionCoveragePicker.tsx +4 -5
- package/src/template/components/VersionPicker.tsx +32 -98
- package/src/template/components/home/QuickStart.tsx +16 -7
- package/src/template/hooks/use-highlighted.ts +31 -19
- package/src/template/lib/fetch-text.ts +45 -4
- package/src/template/{components/Changelog/Changelog.tsx → routes/changelog/ChangelogBody.tsx} +7 -64
- package/src/template/routes/changelog/ChangelogSidebar.tsx +80 -0
- package/src/template/routes/changelog/ChangelogSidebarItem.tsx +68 -0
- package/src/template/routes/changelog/_.tsx +129 -0
- package/src/template/routes/changelog/utils.ts +13 -0
- package/src/template/routes/examples/name.tsx +4 -2
- package/src/template/routes/reference.tsx +2 -2
- package/src/template/routes/root.tsx +1 -1
- package/src/template/stores/toast.ts +6 -3
- package/src/template/theme/swiss-sharp.css +14 -14
- package/src/vite/plugins/schemas.ts +0 -1
- package/build/lib/graph/$$.d.ts +0 -2
- package/build/lib/graph/$$.d.ts.map +0 -1
- package/build/lib/graph/$$.js +0 -2
- package/build/lib/graph/$$.js.map +0 -1
- package/build/lib/graph/$.d.ts +0 -2
- package/build/lib/graph/$.d.ts.map +0 -1
- package/build/lib/graph/$.js +0 -2
- package/build/lib/graph/$.js.map +0 -1
- package/build/lib/graph/graph.d.ts +0 -127
- package/build/lib/graph/graph.d.ts.map +0 -1
- package/build/lib/graph/graph.js +0 -152
- package/build/lib/graph/graph.js.map +0 -1
- package/build/lib/mask/$$.d.ts +0 -3
- package/build/lib/mask/$$.d.ts.map +0 -1
- package/build/lib/mask/$$.js +0 -3
- package/build/lib/mask/$$.js.map +0 -1
- package/build/lib/mask/$.d.ts +0 -2
- package/build/lib/mask/$.d.ts.map +0 -1
- package/build/lib/mask/$.js +0 -2
- package/build/lib/mask/$.js.map +0 -1
- package/build/lib/mask/apply.d.ts +0 -86
- package/build/lib/mask/apply.d.ts.map +0 -1
- package/build/lib/mask/apply.js +0 -86
- package/build/lib/mask/apply.js.map +0 -1
- package/build/lib/mask/mask.d.ts +0 -124
- package/build/lib/mask/mask.d.ts.map +0 -1
- package/build/lib/mask/mask.js +0 -137
- package/build/lib/mask/mask.js.map +0 -1
- package/build/lib/mask/mask.test-d.d.ts +0 -2
- package/build/lib/mask/mask.test-d.d.ts.map +0 -1
- package/build/lib/mask/mask.test-d.js +0 -102
- package/build/lib/mask/mask.test-d.js.map +0 -1
- package/build/lib/version-selection/$$.d.ts +0 -2
- package/build/lib/version-selection/$$.d.ts.map +0 -1
- package/build/lib/version-selection/$$.js +0 -2
- package/build/lib/version-selection/$$.js.map +0 -1
- package/build/lib/version-selection/$.d.ts.map +0 -1
- package/build/lib/version-selection/$.js.map +0 -1
- package/build/lib/version-selection/version-selection.d.ts.map +0 -1
- package/build/lib/version-selection/version-selection.js.map +0 -1
- package/build/sandbox.d.ts +0 -2
- package/build/sandbox.d.ts.map +0 -1
- package/build/sandbox.js +0 -17
- package/build/sandbox.js.map +0 -1
- package/build/template/components/Changelog/Changelog.d.ts +0 -8
- package/build/template/components/Changelog/Changelog.d.ts.map +0 -1
- package/build/template/components/Changelog/Changelog.js.map +0 -1
- package/build/template/components/Changelog/ChangelogVersionPicker.d.ts +0 -8
- package/build/template/components/Changelog/ChangelogVersionPicker.d.ts.map +0 -1
- package/build/template/components/Changelog/ChangelogVersionPicker.js +0 -16
- package/build/template/components/Changelog/ChangelogVersionPicker.js.map +0 -1
- package/build/template/components/SimpleVersionPicker.d.ts +0 -15
- package/build/template/components/SimpleVersionPicker.d.ts.map +0 -1
- package/build/template/components/SimpleVersionPicker.js +0 -15
- package/build/template/components/SimpleVersionPicker.js.map +0 -1
- package/build/template/routes/changelog.d.ts +0 -1635
- package/build/template/routes/changelog.d.ts.map +0 -1
- package/build/template/routes/changelog.js +0 -168
- package/build/template/routes/changelog.js.map +0 -1
- package/src/lib/graph/$$.ts +0 -1
- package/src/lib/graph/$.ts +0 -1
- package/src/lib/graph/graph.ts +0 -197
- package/src/lib/mask/$$.ts +0 -2
- package/src/lib/mask/$.test.ts +0 -226
- package/src/lib/mask/$.ts +0 -1
- package/src/lib/mask/apply.ts +0 -134
- package/src/lib/mask/mask.test-d.ts +0 -156
- package/src/lib/mask/mask.ts +0 -244
- package/src/lib/version-selection/$$.ts +0 -1
- package/src/sandbox.ts +0 -15
- package/src/template/components/Changelog/ChangelogVersionPicker.tsx +0 -36
- package/src/template/components/SimpleVersionPicker.tsx +0 -48
- package/src/template/routes/changelog.tsx +0 -267
- /package/build/lib/{version-selection → version-coverage}/$.d.ts +0 -0
- /package/build/lib/{version-selection → version-coverage}/$.js +0 -0
- /package/src/lib/{version-selection → version-coverage}/$.ts +0 -0
@@ -469,7 +469,7 @@ const buildPaths = (rootDir: string, overrides?: ConfigAdvancedPathsInput | unde
|
|
469
469
|
}
|
470
470
|
}
|
471
471
|
|
472
|
-
const getConfigInputDefaults = (): Config => ({
|
472
|
+
const getConfigInputDefaults = (baseRootDirPath: string): Config => ({
|
473
473
|
_input: {},
|
474
474
|
name: `My Developer Portal`,
|
475
475
|
description: `Explore and integrate with our GraphQL API`,
|
@@ -525,7 +525,7 @@ const getConfigInputDefaults = (): Config => ({
|
|
525
525
|
enabled: true,
|
526
526
|
},
|
527
527
|
},
|
528
|
-
paths: buildPaths(
|
528
|
+
paths: buildPaths(baseRootDirPath),
|
529
529
|
advanced: {
|
530
530
|
isSelfContainedMode: false,
|
531
531
|
debug: false,
|
@@ -549,7 +549,7 @@ export const normalizeInput = (
|
|
549
549
|
assertPathAbsolute(baseRootDirPath)
|
550
550
|
|
551
551
|
const configInput_as_writeable = configInput as WritableDeep<ConfigInput> | undefined
|
552
|
-
const config = structuredClone(getConfigInputDefaults()) as WritableDeep<Config>
|
552
|
+
const config = structuredClone(getConfigInputDefaults(baseRootDirPath)) as WritableDeep<Config>
|
553
553
|
|
554
554
|
if (configInput_as_writeable) {
|
555
555
|
config._input = configInput_as_writeable
|
@@ -656,6 +656,15 @@ export const normalizeInput = (
|
|
656
656
|
if (configInput_as_writeable?.examples) {
|
657
657
|
const examplesInput = configInput_as_writeable.examples
|
658
658
|
|
659
|
+
// The schema transform handles boolean shorthand, so we always get an object here
|
660
|
+
if (examplesInput.enabled !== undefined) {
|
661
|
+
// If explicitly disabled, set display to 'none'
|
662
|
+
if (examplesInput.enabled === false) {
|
663
|
+
config.examples.display = 'none'
|
664
|
+
}
|
665
|
+
// enabled: true keeps defaults
|
666
|
+
}
|
667
|
+
|
659
668
|
if (examplesInput.display !== undefined) {
|
660
669
|
config.examples.display = examplesInput.display
|
661
670
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Api } from '#api/$'
|
2
|
-
import {
|
2
|
+
import { ExamplesConfigObject } from '#api/examples/config'
|
3
3
|
import { ConfigSchema } from '#api/schema/config-schema'
|
4
4
|
import type { Catalog } from '#lib/catalog/$'
|
5
5
|
import { S } from '#lib/kit-temp/effect'
|
@@ -42,7 +42,7 @@ export const TemplateConfig = S.extend(
|
|
42
42
|
}),
|
43
43
|
),
|
44
44
|
examples: S.extend(
|
45
|
-
|
45
|
+
ExamplesConfigObject.pipe(S.omit('enabled')),
|
46
46
|
S.Struct({
|
47
47
|
enabled: S.Boolean,
|
48
48
|
}),
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { FileRouter } from '#lib/file-router'
|
2
2
|
import { Str } from '@wollybeard/kit'
|
3
|
+
import { Array } from 'effect'
|
3
4
|
import type { Page } from './page.js'
|
4
5
|
import type { ScanResult } from './scan.js'
|
5
6
|
|
@@ -129,10 +130,9 @@ export const buildSidebarIndex = (scanResult: ScanResult): SidebarIndex => {
|
|
129
130
|
|
130
131
|
// Build sidebar for each directory that has an index page
|
131
132
|
for (const [topLevelDir, pages] of pagesByTopLevelDir) {
|
132
|
-
const hasIndexPage =
|
133
|
+
const hasIndexPage = Array.some(pages, page =>
|
133
134
|
page.route.logical.path.length === 1
|
134
|
-
&& FileRouter.routeIsFromIndexFile(page.route)
|
135
|
-
)
|
135
|
+
&& FileRouter.routeIsFromIndexFile(page.route))
|
136
136
|
|
137
137
|
// Skip directories without index pages
|
138
138
|
if (!hasIndexPage) continue
|
@@ -0,0 +1,227 @@
|
|
1
|
+
import { Data } from 'effect'
|
2
|
+
|
3
|
+
// =====================================
|
4
|
+
// Config Errors
|
5
|
+
// =====================================
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Error thrown when config file cannot be found
|
9
|
+
*/
|
10
|
+
export class ConfigFileNotFoundError extends Data.TaggedError('ConfigFileNotFoundError')<{
|
11
|
+
readonly path: string
|
12
|
+
}> {}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Error thrown when config file cannot be imported
|
16
|
+
*/
|
17
|
+
export class ConfigImportError extends Data.TaggedError('ConfigImportError')<{
|
18
|
+
readonly filePath: string
|
19
|
+
readonly cause: unknown
|
20
|
+
}> {}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Error thrown when config file has invalid format
|
24
|
+
*/
|
25
|
+
export class ConfigParseError extends Data.TaggedError('ConfigParseError')<{
|
26
|
+
readonly filePath: string
|
27
|
+
readonly parseErrors: unknown
|
28
|
+
}> {}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Error thrown when config cannot be resolved from module
|
32
|
+
*/
|
33
|
+
export class ConfigResolveError extends Data.TaggedError('ConfigResolveError')<{
|
34
|
+
readonly cause: unknown
|
35
|
+
}> {}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Error thrown when package.json cannot be read
|
39
|
+
*/
|
40
|
+
export class PackageJsonReadError extends Data.TaggedError('PackageJsonReadError')<{
|
41
|
+
readonly rootDir: string
|
42
|
+
readonly cause: unknown
|
43
|
+
}> {}
|
44
|
+
|
45
|
+
// =====================================
|
46
|
+
// Static Site Errors
|
47
|
+
// =====================================
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Error thrown when Polen build manifest is not found
|
51
|
+
*/
|
52
|
+
export class PolenManifestNotFoundError extends Data.TaggedError('PolenManifestNotFoundError')<{
|
53
|
+
readonly path: string
|
54
|
+
}> {}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Error thrown when base path is invalid
|
58
|
+
*/
|
59
|
+
export class InvalidBasePathError extends Data.TaggedError('InvalidBasePathError')<{
|
60
|
+
readonly basePath: string
|
61
|
+
}> {}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Error thrown when target path already exists and is not empty
|
65
|
+
*/
|
66
|
+
export class TargetExistsError extends Data.TaggedError('TargetExistsError')<{
|
67
|
+
readonly targetPath: string
|
68
|
+
}> {}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Error thrown when HTML processing fails
|
72
|
+
*/
|
73
|
+
export class HtmlProcessingError extends Data.TaggedError('HtmlProcessingError')<{
|
74
|
+
readonly filePath: string
|
75
|
+
readonly reason: string
|
76
|
+
readonly cause?: unknown
|
77
|
+
}> {}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Error thrown when file system operation fails
|
81
|
+
*/
|
82
|
+
export class FileSystemError extends Data.TaggedError('FileSystemError')<{
|
83
|
+
readonly operation: 'read' | 'write' | 'copy' | 'stat' | 'mkdir' | 'remove'
|
84
|
+
readonly path: string
|
85
|
+
readonly cause: unknown
|
86
|
+
}> {}
|
87
|
+
|
88
|
+
// =====================================
|
89
|
+
// Builder Errors
|
90
|
+
// =====================================
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Error thrown when Vite builder fails
|
94
|
+
*/
|
95
|
+
export class ViteBuilderError extends Data.TaggedError('ViteBuilderError')<{
|
96
|
+
readonly phase: 'create' | 'build'
|
97
|
+
readonly cause: unknown
|
98
|
+
}> {}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Error thrown when server fails to start
|
102
|
+
*/
|
103
|
+
export class ServerStartupError extends Data.TaggedError('ServerStartupError')<{
|
104
|
+
readonly port: number
|
105
|
+
readonly message: string
|
106
|
+
readonly cause?: unknown
|
107
|
+
}> {}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Error thrown when server exits unexpectedly
|
111
|
+
*/
|
112
|
+
export class ServerExitError extends Data.TaggedError('ServerExitError')<{
|
113
|
+
readonly port: number
|
114
|
+
readonly code: number | null
|
115
|
+
readonly signal: string | null
|
116
|
+
}> {}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Error thrown when server startup times out
|
120
|
+
*/
|
121
|
+
export class ServerTimeoutError extends Data.TaggedError('ServerTimeoutError')<{
|
122
|
+
readonly port: number
|
123
|
+
readonly timeoutSeconds: number
|
124
|
+
}> {}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Error thrown when port allocation fails
|
128
|
+
*/
|
129
|
+
export class PortAllocationError extends Data.TaggedError('PortAllocationError')<{
|
130
|
+
readonly cause: unknown
|
131
|
+
}> {}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Error thrown when route processing fails
|
135
|
+
*/
|
136
|
+
export class RouteProcessingError extends Data.TaggedError('RouteProcessingError')<{
|
137
|
+
readonly route: string
|
138
|
+
readonly cause: unknown
|
139
|
+
}> {}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Error thrown when route fetch fails
|
143
|
+
*/
|
144
|
+
export class RouteFetchError extends Data.TaggedError('RouteFetchError')<{
|
145
|
+
readonly route: string
|
146
|
+
readonly status: number
|
147
|
+
readonly statusText: string
|
148
|
+
}> {}
|
149
|
+
|
150
|
+
// =====================================
|
151
|
+
// Schema Loading Errors
|
152
|
+
// =====================================
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Error thrown when no applicable schema source is found
|
156
|
+
*/
|
157
|
+
export class NoApplicableSchemaSourceError extends Data.TaggedError('NoApplicableSchemaSourceError')<{}> {}
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Error thrown when schema source returns no data
|
161
|
+
*/
|
162
|
+
export class SchemaSourceNoDataError extends Data.TaggedError('SchemaSourceNoDataError')<{}> {}
|
163
|
+
|
164
|
+
// =====================================
|
165
|
+
// Schema Augmentation Errors
|
166
|
+
// =====================================
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Error thrown when a type cannot be found in the schema
|
170
|
+
*/
|
171
|
+
export class TypeNotFoundError extends Data.TaggedError('TypeNotFoundError')<{
|
172
|
+
readonly typeName: string
|
173
|
+
}> {}
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Error thrown when a field cannot be found on a type
|
177
|
+
*/
|
178
|
+
export class FieldNotFoundError extends Data.TaggedError('FieldNotFoundError')<{
|
179
|
+
readonly fieldName: string
|
180
|
+
readonly typeName: string
|
181
|
+
}> {}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Error thrown when a type doesn't have fields
|
185
|
+
*/
|
186
|
+
export class TypeHasNoFieldsError extends Data.TaggedError('TypeHasNoFieldsError')<{
|
187
|
+
readonly typeName: string
|
188
|
+
}> {}
|
189
|
+
|
190
|
+
// =====================================
|
191
|
+
// Routes Manifest Errors
|
192
|
+
// =====================================
|
193
|
+
|
194
|
+
/**
|
195
|
+
* Error thrown when routes manifest cannot be read
|
196
|
+
*/
|
197
|
+
export class RoutesManifestReadError extends Data.TaggedError('RoutesManifestReadError')<{
|
198
|
+
readonly path: string
|
199
|
+
readonly cause: unknown
|
200
|
+
}> {}
|
201
|
+
|
202
|
+
/**
|
203
|
+
* Error thrown when routes manifest cannot be written
|
204
|
+
*/
|
205
|
+
export class RoutesManifestWriteError extends Data.TaggedError('RoutesManifestWriteError')<{
|
206
|
+
readonly path: string
|
207
|
+
readonly cause: unknown
|
208
|
+
}> {}
|
209
|
+
|
210
|
+
// =====================================
|
211
|
+
// Validation Errors
|
212
|
+
// =====================================
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Error thrown when base path validation fails
|
216
|
+
*/
|
217
|
+
export class InvalidPathError extends Data.TaggedError('InvalidPathError')<{
|
218
|
+
readonly path: string
|
219
|
+
readonly requirement: string
|
220
|
+
}> {}
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Error thrown when version string is invalid
|
224
|
+
*/
|
225
|
+
export class InvalidVersionError extends Data.TaggedError('InvalidVersionError')<{
|
226
|
+
readonly version: string
|
227
|
+
}> {}
|
@@ -28,6 +28,16 @@ describe('ExamplesConfig', () => {
|
|
28
28
|
expect(result).toEqual({})
|
29
29
|
})
|
30
30
|
|
31
|
+
test('boolean shorthand: false disables examples', () => {
|
32
|
+
const result = decodeExamplesConfig(false)
|
33
|
+
expect(result).toEqual({ enabled: false })
|
34
|
+
})
|
35
|
+
|
36
|
+
test('boolean shorthand: true uses defaults', () => {
|
37
|
+
const result = decodeExamplesConfig(true)
|
38
|
+
expect(result).toEqual({})
|
39
|
+
})
|
40
|
+
|
31
41
|
test('decodes full config', () => {
|
32
42
|
const input = {
|
33
43
|
display: { include: ['example1', 'example2'] },
|
@@ -141,7 +141,7 @@ export type ExampleDiagnostics = S.Schema.Type<typeof ExampleDiagnostics>
|
|
141
141
|
// Schema - Examples Config
|
142
142
|
// ============================================================================
|
143
143
|
|
144
|
-
export const
|
144
|
+
export const ExamplesConfigObject = S.Struct({
|
145
145
|
/**
|
146
146
|
* Control whether the examples feature is enabled.
|
147
147
|
* - true: Always enabled (show in nav even if no examples exist)
|
@@ -220,13 +220,42 @@ export const ExamplesConfig = S.Struct({
|
|
220
220
|
description: 'Configuration for GraphQL examples behavior and diagnostics',
|
221
221
|
})
|
222
222
|
|
223
|
+
/**
|
224
|
+
* Examples configuration supporting both boolean shorthand and detailed object form.
|
225
|
+
* - `false`: Disable examples entirely
|
226
|
+
* - `true`: Enable examples with defaults
|
227
|
+
* - object: Fine-grained configuration
|
228
|
+
*/
|
229
|
+
export const ExamplesConfig = S.transform(
|
230
|
+
S.Union(
|
231
|
+
S.Boolean,
|
232
|
+
ExamplesConfigObject,
|
233
|
+
),
|
234
|
+
ExamplesConfigObject,
|
235
|
+
{
|
236
|
+
strict: false,
|
237
|
+
decode: (input) => {
|
238
|
+
if (typeof input === 'boolean') {
|
239
|
+
// Convert boolean shorthand to object form
|
240
|
+
return input === false
|
241
|
+
? { enabled: false } as const
|
242
|
+
: {} // true means use defaults
|
243
|
+
}
|
244
|
+
return input
|
245
|
+
},
|
246
|
+
encode: (value) => value,
|
247
|
+
},
|
248
|
+
).annotations({
|
249
|
+
identifier: 'ExamplesConfigTransform',
|
250
|
+
title: 'Examples Configuration with Boolean Shorthand',
|
251
|
+
description: 'Configuration for GraphQL examples - accepts boolean shorthand or detailed object',
|
252
|
+
})
|
253
|
+
|
223
254
|
export type ExamplesConfig = S.Schema.Type<typeof ExamplesConfig>
|
224
255
|
|
225
256
|
// ============================================================================
|
226
257
|
// Constructors
|
227
|
-
|
228
|
-
|
229
|
-
export const makeExamplesConfig = ExamplesConfig.make
|
258
|
+
export const makeExamplesConfig = ExamplesConfigObject.make
|
230
259
|
|
231
260
|
// ============================================================================
|
232
261
|
// Type Guards
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Diagnostic } from '#lib/diagnostic/$'
|
2
|
-
import { GraphQLError } from '#lib/graphql-error/$'
|
3
2
|
import { S } from '#lib/kit-temp/effect'
|
3
|
+
import { Version } from '#lib/version/$'
|
4
4
|
|
5
5
|
export const DiagnosticValidationError = Diagnostic.create({
|
6
6
|
source: 'examples-validation',
|
@@ -11,8 +11,14 @@ export const DiagnosticValidationError = Diagnostic.create({
|
|
11
11
|
name: S.String,
|
12
12
|
path: S.String,
|
13
13
|
}),
|
14
|
-
version: S.
|
15
|
-
errors: S.Array(
|
14
|
+
version: S.optional(Version.Version),
|
15
|
+
errors: S.Array(S.Struct({
|
16
|
+
message: S.String,
|
17
|
+
locations: S.optional(S.Array(S.Struct({
|
18
|
+
line: S.Number,
|
19
|
+
column: S.Number,
|
20
|
+
}))),
|
21
|
+
})),
|
16
22
|
},
|
17
23
|
}).annotations({
|
18
24
|
identifier: 'DiagnosticValidationError',
|
@@ -290,3 +290,33 @@ test('validates examples with version sets', () => {
|
|
290
290
|
const diagnostics = validateExamples(examples, versionedCatalogWithV3)
|
291
291
|
expect(diagnostics.length).toBe(1) // invalidField doesn't exist in the test schema
|
292
292
|
})
|
293
|
+
|
294
|
+
test('detects mismatch between versioned document and unversioned catalog', () => {
|
295
|
+
// Create a versioned document with multiple versions
|
296
|
+
const v1 = Version.fromString('1.0.0')
|
297
|
+
const v2 = Version.fromString('2.0.0')
|
298
|
+
|
299
|
+
const versionedDocument = Document.Versioned.make({
|
300
|
+
versionDocuments: HashMap.make(
|
301
|
+
[v1, 'query { user(id: "1") { id name } }'],
|
302
|
+
[v2, 'query { users { id name } }'],
|
303
|
+
),
|
304
|
+
})
|
305
|
+
|
306
|
+
// Create an example with versioned document
|
307
|
+
const example = Example.make({
|
308
|
+
name: 'test-version-mismatch',
|
309
|
+
path: 'test.graphql',
|
310
|
+
document: versionedDocument,
|
311
|
+
})
|
312
|
+
|
313
|
+
// Validate against unversioned catalog - should detect mismatch
|
314
|
+
const diagnostics = validateExamples([example], catalog)
|
315
|
+
|
316
|
+
// Should have exactly one diagnostic about the version mismatch
|
317
|
+
expect(diagnostics.length).toBe(1)
|
318
|
+
expect(diagnostics[0]!._tag).toBe('Diagnostic')
|
319
|
+
expect(diagnostics[0]!.name).toBe('invalid-graphql')
|
320
|
+
expect(diagnostics[0]!.message).toContain('versioned content but catalog is unversioned')
|
321
|
+
expect(diagnostics[0]!.errors![0]!.message).toContain('Cannot use a version coverage with an unversioned catalog')
|
322
|
+
})
|