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
@@ -2,117 +2,34 @@
|
|
2
2
|
* Query path operations
|
3
3
|
*/
|
4
4
|
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Builder class for creating query paths with a fluent interface
|
10
|
-
*
|
11
|
-
* @example
|
12
|
-
* ```ts
|
13
|
-
* const path = builder()
|
14
|
-
* .type('User')
|
15
|
-
* .field('posts')
|
16
|
-
* .type('Post')
|
17
|
-
* .field('author')
|
18
|
-
* .build()
|
19
|
-
* ```
|
20
|
-
*/
|
21
|
-
export class QueryPathBuilder {
|
22
|
-
private segments: QuerySegment[] = []
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Add a type segment to the path
|
26
|
-
*
|
27
|
-
* @param typeName - The type name
|
28
|
-
* @returns The builder for chaining
|
29
|
-
*/
|
30
|
-
type(typeName: string): this {
|
31
|
-
this.segments.push(createTypeSegment(typeName))
|
32
|
-
return this
|
33
|
-
}
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Add a field segment to the path
|
37
|
-
*
|
38
|
-
* @param fieldName - The field name
|
39
|
-
* @returns The builder for chaining
|
40
|
-
*/
|
41
|
-
field(fieldName: string): this {
|
42
|
-
this.segments.push(createFieldSegment(fieldName))
|
43
|
-
return this
|
44
|
-
}
|
45
|
-
|
46
|
-
/**
|
47
|
-
* Build the final query path
|
48
|
-
*
|
49
|
-
* @returns The constructed query path
|
50
|
-
*/
|
51
|
-
build(): QueryPath {
|
52
|
-
return this.segments
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
/**
|
57
|
-
* Create a new query path builder
|
58
|
-
*
|
59
|
-
* @returns A new query path builder instance
|
60
|
-
* @example
|
61
|
-
* ```ts
|
62
|
-
* const path = builder()
|
63
|
-
* .type('User')
|
64
|
-
* .field('posts')
|
65
|
-
* .type('Post')
|
66
|
-
* .field('author')
|
67
|
-
* .build()
|
68
|
-
* ```
|
69
|
-
*/
|
70
|
-
export const builder = (): QueryPathBuilder => new QueryPathBuilder()
|
5
|
+
import { S } from '#lib/kit-temp/effect'
|
6
|
+
import { QueryPath } from './types.js'
|
71
7
|
|
72
8
|
/**
|
73
9
|
* Encode a query path to a human-readable expression string
|
10
|
+
* Uses the Effect Schema codec for QueryPath
|
74
11
|
*
|
75
|
-
* @param path - The query path to encode
|
12
|
+
* @param path - The query path segments to encode
|
76
13
|
* @returns A string expression representation
|
77
14
|
* @example
|
78
|
-
* encode(
|
15
|
+
* encode([
|
16
|
+
* { _tag: 'TypeSegment', type: 'User' },
|
17
|
+
* { _tag: 'FieldSegment', field: 'posts' },
|
18
|
+
* { _tag: 'TypeSegment', type: 'Post' },
|
19
|
+
* { _tag: 'FieldSegment', field: 'title' }
|
20
|
+
* ]) // 'User.posts.Post.title'
|
79
21
|
*/
|
80
|
-
export const encode = (
|
81
|
-
return path.map(segment => {
|
82
|
-
if (segment.kind === 'type') return segment.type
|
83
|
-
if (segment.kind === 'field') return segment.field
|
84
|
-
return ''
|
85
|
-
}).filter(Boolean).join('.')
|
86
|
-
}
|
22
|
+
export const encode = S.encodeSync(QueryPath)
|
87
23
|
|
88
24
|
/**
|
89
25
|
* Decode a string expression into a query path
|
26
|
+
* Uses the Effect Schema codec for QueryPath
|
90
27
|
* Note: This assumes alternating type.field.type.field pattern
|
91
28
|
*
|
92
29
|
* @param expression - The string expression to decode
|
93
|
-
* @returns The decoded query path
|
30
|
+
* @returns The decoded query path segments
|
31
|
+
* @throws ParseError if the expression is invalid
|
94
32
|
* @example
|
95
33
|
* decode('User.posts.Post.title') // Query path traversing User->posts->Post->title
|
96
34
|
*/
|
97
|
-
export const decode = (
|
98
|
-
if (!expression) return null
|
99
|
-
|
100
|
-
const parts = expression.split('.')
|
101
|
-
const segments: QuerySegment[] = []
|
102
|
-
|
103
|
-
// Assume alternating pattern: type.field.type.field...
|
104
|
-
for (let i = 0; i < parts.length; i++) {
|
105
|
-
const part = parts[i]
|
106
|
-
if (!part) continue
|
107
|
-
|
108
|
-
if (i % 2 === 0) {
|
109
|
-
// Even indices are types
|
110
|
-
segments.push(createTypeSegment(part))
|
111
|
-
} else {
|
112
|
-
// Odd indices are fields
|
113
|
-
segments.push(createFieldSegment(part))
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
return segments
|
118
|
-
}
|
35
|
+
export const decode = S.decodeUnknownSync(QueryPath)
|
@@ -0,0 +1,136 @@
|
|
1
|
+
/**
|
2
|
+
* GraphQL schema location utilities for definition paths
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { Grafaid } from '#lib/grafaid'
|
6
|
+
import { Data, Either, Match } from 'effect'
|
7
|
+
import * as Definition from './definition.js'
|
8
|
+
|
9
|
+
// ============================================================================
|
10
|
+
// Errors
|
11
|
+
// ============================================================================
|
12
|
+
|
13
|
+
export class TypeNotFoundError extends Data.TaggedError('TypeNotFoundError')<{
|
14
|
+
typeName: string
|
15
|
+
path: string
|
16
|
+
}> {}
|
17
|
+
|
18
|
+
export class FieldNotFoundError extends Data.TaggedError('FieldNotFoundError')<{
|
19
|
+
typeName: string
|
20
|
+
fieldName: string
|
21
|
+
path: string
|
22
|
+
}> {}
|
23
|
+
|
24
|
+
// ============================================================================
|
25
|
+
// Locate Functions
|
26
|
+
// ============================================================================
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Locate a type in the GraphQL schema from a type definition path.
|
30
|
+
*
|
31
|
+
* @param schema - The GraphQL schema
|
32
|
+
* @param path - The type definition path
|
33
|
+
* @returns Either the located type or a TypeNotFoundError
|
34
|
+
*/
|
35
|
+
export const locateType = (
|
36
|
+
schema: Grafaid.Schema.Schema,
|
37
|
+
path: Definition.TypeDefinitionPath,
|
38
|
+
): Either.Either<Grafaid.Schema.TypesLike.Named, TypeNotFoundError> => {
|
39
|
+
const typeName = Definition.getType(path)
|
40
|
+
const type = schema.getType(typeName)
|
41
|
+
if (!type) {
|
42
|
+
return Either.left(
|
43
|
+
new TypeNotFoundError({
|
44
|
+
typeName,
|
45
|
+
path: Definition.encodeSync(path),
|
46
|
+
}),
|
47
|
+
)
|
48
|
+
}
|
49
|
+
return Either.right(type)
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Locate a field in the GraphQL schema from a field definition path.
|
54
|
+
*
|
55
|
+
* @param schema - The GraphQL schema
|
56
|
+
* @param path - The field definition path
|
57
|
+
* @returns Either the located field or a FieldNotFoundError
|
58
|
+
*/
|
59
|
+
export const locateField = (
|
60
|
+
schema: Grafaid.Schema.Schema,
|
61
|
+
path: Definition.FieldDefinitionPath,
|
62
|
+
): Either.Either<Grafaid.Schema.NodesLike.Field, FieldNotFoundError> => {
|
63
|
+
const typeName = Definition.getType(path)
|
64
|
+
const fieldName = Definition.getField(path)
|
65
|
+
|
66
|
+
const type = schema.getType(typeName)
|
67
|
+
if (!type) {
|
68
|
+
return Either.left(
|
69
|
+
new FieldNotFoundError({
|
70
|
+
typeName,
|
71
|
+
fieldName,
|
72
|
+
path: Definition.encodeSync(path),
|
73
|
+
}),
|
74
|
+
)
|
75
|
+
}
|
76
|
+
|
77
|
+
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
78
|
+
return Either.left(
|
79
|
+
new FieldNotFoundError({
|
80
|
+
typeName,
|
81
|
+
fieldName,
|
82
|
+
path: Definition.encodeSync(path),
|
83
|
+
}),
|
84
|
+
)
|
85
|
+
}
|
86
|
+
|
87
|
+
const fields = type.getFields()
|
88
|
+
const field = fields[fieldName]
|
89
|
+
|
90
|
+
if (!field) {
|
91
|
+
// dprint-ignore
|
92
|
+
return Either.left(new FieldNotFoundError({
|
93
|
+
typeName,
|
94
|
+
fieldName,
|
95
|
+
path: Definition.encodeSync(path),
|
96
|
+
}))
|
97
|
+
}
|
98
|
+
|
99
|
+
return Either.right(field)
|
100
|
+
}
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Locate a type or field in the GraphQL schema from a definition path.
|
104
|
+
*
|
105
|
+
* @param schema - The GraphQL schema
|
106
|
+
* @param path - The definition path (type or field)
|
107
|
+
* @returns Either the located type/field or an error
|
108
|
+
*/
|
109
|
+
export const locate = (
|
110
|
+
schema: Grafaid.Schema.Schema,
|
111
|
+
path: Definition.DefinitionPath,
|
112
|
+
): Either.Either<
|
113
|
+
Grafaid.Schema.TypesLike.Named | Grafaid.Schema.NodesLike.Field,
|
114
|
+
TypeNotFoundError | FieldNotFoundError
|
115
|
+
> => {
|
116
|
+
return Match.value(path).pipe(
|
117
|
+
Match.when(
|
118
|
+
Definition.isTypeDefinitionPath,
|
119
|
+
(p) => locateType(schema, p),
|
120
|
+
),
|
121
|
+
Match.when(
|
122
|
+
Definition.isFieldDefinitionPath,
|
123
|
+
(p) => locateField(schema, p),
|
124
|
+
),
|
125
|
+
Match.orElse(() => {
|
126
|
+
// This should never happen with proper path types
|
127
|
+
// Return a generic error for unsupported path types
|
128
|
+
return Either.left(
|
129
|
+
new TypeNotFoundError({
|
130
|
+
typeName: 'unknown',
|
131
|
+
path: Definition.encodeSync(path),
|
132
|
+
}),
|
133
|
+
)
|
134
|
+
}),
|
135
|
+
)
|
136
|
+
}
|
@@ -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,24 +1,73 @@
|
|
1
|
-
import {
|
1
|
+
import { Grafaid } from '#lib/grafaid'
|
2
|
+
import { Box, Flex, HoverCard, Text } from '@radix-ui/themes'
|
2
3
|
import type { GraphQLArgument } from 'graphql'
|
3
4
|
import type { FC } from 'react'
|
5
|
+
import { useViewMode } from '../contexts/ViewModeContext.js'
|
6
|
+
import { Description } from './Description.js'
|
4
7
|
import { TypeAnnotation } from './TypeAnnotation.js'
|
5
8
|
|
6
9
|
export interface Props {
|
7
10
|
data: GraphQLArgument
|
11
|
+
nameWidth?: number
|
8
12
|
}
|
9
13
|
|
10
14
|
/**
|
11
|
-
* Renders a single GraphQL argument
|
15
|
+
* Renders a single GraphQL argument with aligned columns
|
12
16
|
*/
|
13
|
-
export const ArgumentAnnotation: FC<Props> = ({ data }) => {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
export const ArgumentAnnotation: FC<Props> = ({ data, nameWidth }) => {
|
18
|
+
const { viewMode } = useViewMode()
|
19
|
+
|
20
|
+
const nameElement = (
|
21
|
+
<Text size='2' weight='bold' color='gray'>
|
22
|
+
{data.name}
|
23
|
+
</Text>
|
24
|
+
)
|
19
25
|
|
20
|
-
|
26
|
+
return (
|
27
|
+
<Box>
|
28
|
+
<Flex align='baseline' gap='2'>
|
29
|
+
<Box
|
30
|
+
style={{
|
31
|
+
minWidth: nameWidth ? `${nameWidth}ch` : 'auto',
|
32
|
+
flexShrink: 0,
|
33
|
+
}}
|
34
|
+
>
|
35
|
+
{viewMode === 'compact' && data.description
|
36
|
+
? (
|
37
|
+
<HoverCard.Root>
|
38
|
+
<HoverCard.Trigger>
|
39
|
+
{nameElement}
|
40
|
+
</HoverCard.Trigger>
|
41
|
+
<HoverCard.Content
|
42
|
+
size='2'
|
43
|
+
maxWidth='400px'
|
44
|
+
side='top'
|
45
|
+
align='center'
|
46
|
+
>
|
47
|
+
<Text size='2' color='gray'>
|
48
|
+
<Description data={data} />
|
49
|
+
</Text>
|
50
|
+
</HoverCard.Content>
|
51
|
+
</HoverCard.Root>
|
52
|
+
)
|
53
|
+
: nameElement}
|
54
|
+
</Box>
|
55
|
+
<TypeAnnotation type={data.type} showDescription={true} />
|
56
|
+
{data.defaultValue !== undefined && (
|
57
|
+
<Text size='2' color='gray'>
|
58
|
+
{' = '}
|
59
|
+
{Grafaid.Schema.formatDefaultValue(data.defaultValue, data.type)}
|
60
|
+
</Text>
|
61
|
+
)}
|
21
62
|
</Flex>
|
63
|
+
{/* Argument description below name/type (only in expanded mode) */}
|
64
|
+
{data.description && viewMode === 'expanded' && (
|
65
|
+
<Box mt='2'>
|
66
|
+
<Text size='2' color='gray' style={{ lineHeight: '1.5' }}>
|
67
|
+
<Description data={data} />
|
68
|
+
</Text>
|
69
|
+
</Box>
|
70
|
+
)}
|
22
71
|
</Box>
|
23
72
|
)
|
24
73
|
}
|