polen 0.10.0-next.10 → 0.10.0-next.12
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/builder.js +1 -1
- package/build/api/builder/builder.js.map +1 -1
- package/build/api/config/load.js +1 -1
- package/build/api/config/load.js.map +1 -1
- package/build/api/vite/plugins/build.js +1 -1
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +0 -2
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/pages.js +1 -1
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/exports/components.d.ts +4 -1
- package/build/exports/components.d.ts.map +1 -1
- package/build/exports/components.js +4 -1
- package/build/exports/components.js.map +1 -1
- package/build/lib/demos/config-schema.d.ts +6 -6
- package/build/lib/github-actions/runner.js +2 -2
- package/build/lib/github-actions/runner.js.map +1 -1
- package/build/lib/graphql-document/$$.d.ts +5 -0
- package/build/lib/graphql-document/$$.d.ts.map +1 -0
- package/build/lib/graphql-document/$$.js +5 -0
- package/build/lib/graphql-document/$$.js.map +1 -0
- package/build/lib/graphql-document/$.d.ts +2 -0
- package/build/lib/graphql-document/$.d.ts.map +1 -0
- package/build/lib/graphql-document/$.js +2 -0
- package/build/lib/graphql-document/$.js.map +1 -0
- package/build/lib/graphql-document/analysis.d.ts +44 -0
- package/build/lib/graphql-document/analysis.d.ts.map +1 -0
- package/build/lib/graphql-document/analysis.js +361 -0
- package/build/lib/graphql-document/analysis.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +42 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocument.js +173 -0
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +7 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +45 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +1 -0
- package/build/lib/graphql-document/components/HoverTooltip.d.ts +35 -0
- package/build/lib/graphql-document/components/HoverTooltip.d.ts.map +1 -0
- package/build/lib/graphql-document/components/HoverTooltip.js +132 -0
- package/build/lib/graphql-document/components/HoverTooltip.js.map +1 -0
- package/build/lib/graphql-document/components/IdentifierLink.d.ts +37 -0
- package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +1 -0
- package/build/lib/graphql-document/components/IdentifierLink.js +141 -0
- package/build/lib/graphql-document/components/IdentifierLink.js.map +1 -0
- package/build/lib/graphql-document/components/index.d.ts +5 -0
- package/build/lib/graphql-document/components/index.d.ts.map +1 -0
- package/build/lib/graphql-document/components/index.js +5 -0
- package/build/lib/graphql-document/components/index.js.map +1 -0
- package/build/lib/graphql-document/example.d.ts +25 -0
- package/build/lib/graphql-document/example.d.ts.map +1 -0
- package/build/lib/graphql-document/example.js +140 -0
- package/build/lib/graphql-document/example.js.map +1 -0
- package/build/lib/graphql-document/graphql-document.d.ts +35 -0
- package/build/lib/graphql-document/graphql-document.d.ts.map +1 -0
- package/build/lib/graphql-document/graphql-document.js +36 -0
- package/build/lib/graphql-document/graphql-document.js.map +1 -0
- package/build/lib/graphql-document/positioning-simple.d.ts +68 -0
- package/build/lib/graphql-document/positioning-simple.d.ts.map +1 -0
- package/build/lib/graphql-document/positioning-simple.js +197 -0
- package/build/lib/graphql-document/positioning-simple.js.map +1 -0
- package/build/lib/graphql-document/schema-context.d.ts +8 -0
- package/build/lib/graphql-document/schema-context.d.ts.map +1 -0
- package/build/lib/graphql-document/schema-context.js +11 -0
- package/build/lib/graphql-document/schema-context.js.map +1 -0
- package/build/lib/graphql-document/schema-integration-example.d.ts +27 -0
- package/build/lib/graphql-document/schema-integration-example.d.ts.map +1 -0
- package/build/lib/graphql-document/schema-integration-example.js +297 -0
- package/build/lib/graphql-document/schema-integration-example.js.map +1 -0
- package/build/lib/graphql-document/schema-integration.d.ts +135 -0
- package/build/lib/graphql-document/schema-integration.d.ts.map +1 -0
- package/build/lib/graphql-document/schema-integration.js +328 -0
- package/build/lib/graphql-document/schema-integration.js.map +1 -0
- package/build/lib/graphql-document/types.d.ts +117 -0
- package/build/lib/graphql-document/types.d.ts.map +1 -0
- package/build/lib/graphql-document/types.js +2 -0
- package/build/lib/graphql-document/types.js.map +1 -0
- package/build/template/components/ArgumentAnnotation.js +10 -0
- package/build/template/components/ArgumentAnnotation.js.map +1 -0
- package/build/template/components/ArgumentList.js +9 -0
- package/build/template/components/ArgumentList.js.map +1 -0
- package/build/template/components/ArgumentListAnnotation.js +15 -0
- package/build/template/components/ArgumentListAnnotation.js.map +1 -0
- package/build/template/components/Changelog.js +44 -0
- package/build/template/components/Changelog.js.map +1 -0
- package/build/template/components/{CodeBlock.jsx → CodeBlock.js} +4 -5
- package/build/template/components/{CodeBlock.jsx.map → CodeBlock.js.map} +1 -1
- package/build/template/components/CodeBlockEnhancer.d.ts +2 -0
- package/build/template/components/CodeBlockEnhancer.d.ts.map +1 -0
- package/build/template/components/CodeBlockEnhancer.js +175 -0
- package/build/template/components/CodeBlockEnhancer.js.map +1 -0
- package/build/template/components/DeprecationReason.js +9 -0
- package/build/template/components/DeprecationReason.js.map +1 -0
- package/build/template/components/Description.js +9 -0
- package/build/template/components/Description.js.map +1 -0
- package/build/template/components/Field.js +14 -0
- package/build/template/components/Field.js.map +1 -0
- package/build/template/components/{FieldList.jsx → FieldList.js} +4 -5
- package/build/template/components/FieldList.js.map +1 -0
- package/build/template/components/{FieldListSection.jsx → FieldListSection.js} +4 -6
- package/build/template/components/FieldListSection.js.map +1 -0
- package/build/template/components/HamburgerMenu.js +30 -0
- package/build/template/components/HamburgerMenu.js.map +1 -0
- package/build/template/components/Link.d.ts +1 -1
- package/build/template/components/{Link.jsx → Link.js} +4 -5
- package/build/template/components/Link.js.map +1 -0
- package/build/template/components/Logo.js +20 -0
- package/build/template/components/Logo.js.map +1 -0
- package/build/template/components/MDXComponents.d.ts +11 -0
- package/build/template/components/MDXComponents.d.ts.map +1 -0
- package/build/template/components/MDXComponents.js +70 -0
- package/build/template/components/MDXComponents.js.map +1 -0
- package/build/template/components/{Markdown.jsx → Markdown.js} +3 -2
- package/build/template/components/Markdown.js.map +1 -0
- package/build/template/components/MissingSchema.d.ts +1 -1
- package/build/template/components/MissingSchema.d.ts.map +1 -1
- package/build/template/components/MissingSchema.js +5 -0
- package/build/template/components/MissingSchema.js.map +1 -0
- package/build/template/components/NamedType.js +12 -0
- package/build/template/components/NamedType.js.map +1 -0
- package/build/template/components/NotFound.js +7 -0
- package/build/template/components/NotFound.js.map +1 -0
- package/build/template/components/{RadixLink.jsx → RadixLink.js} +1 -1
- package/build/template/components/RadixLink.js.map +1 -0
- package/build/template/components/TestComponent.d.ts +5 -0
- package/build/template/components/TestComponent.d.ts.map +1 -0
- package/build/template/components/TestComponent.js +7 -0
- package/build/template/components/TestComponent.js.map +1 -0
- package/build/template/components/Texts/{MinorHeading.jsx → MinorHeading.js} +4 -3
- package/build/template/components/Texts/MinorHeading.js.map +1 -0
- package/build/template/components/Texts/texts.js +1 -1
- package/build/template/components/Texts/texts.js.map +1 -1
- package/build/template/components/ThemeToggle.js +9 -0
- package/build/template/components/ThemeToggle.js.map +1 -0
- package/build/template/components/{TypeAnnotation.jsx → TypeAnnotation.js} +8 -18
- package/build/template/components/TypeAnnotation.js.map +1 -0
- package/build/template/components/TypeFieldsLinkList.js +9 -0
- package/build/template/components/TypeFieldsLinkList.js.map +1 -0
- package/build/template/components/TypeIndex.js +17 -0
- package/build/template/components/TypeIndex.js.map +1 -0
- package/build/template/components/content/$$.d.ts +1 -0
- package/build/template/components/content/$$.d.ts.map +1 -1
- package/build/template/components/content/$$.js +1 -0
- package/build/template/components/content/$$.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts +8 -0
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts.map +1 -0
- package/build/template/components/content/GraphQLDocumentWithSchema.js +16 -0
- package/build/template/components/content/GraphQLDocumentWithSchema.js.map +1 -0
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts +7 -0
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts.map +1 -0
- package/build/template/components/content/GraphQLDocumentWrapper.js +62 -0
- package/build/template/components/content/GraphQLDocumentWrapper.js.map +1 -0
- package/build/template/components/graphql/graphql.d.ts +2 -2
- package/build/template/components/graphql/graphql.js +3 -0
- package/build/template/components/graphql/graphql.js.map +1 -0
- package/build/template/components/graphql/index.d.ts +1 -1
- package/build/template/components/graphql/index.js +1 -1
- package/build/template/components/graphql/index.js.map +1 -1
- package/build/template/components/graphql/{type-kind-icon.jsx → type-kind-icon.js} +3 -2
- package/build/template/components/graphql/type-kind-icon.js.map +1 -0
- package/build/template/components/graphql/type-link.js +11 -0
- package/build/template/components/graphql/type-link.js.map +1 -0
- package/build/template/components/sidebar/Sidebar.d.ts +1 -1
- package/build/template/components/sidebar/Sidebar.d.ts.map +1 -1
- package/build/template/components/sidebar/Sidebar.js +11 -0
- package/build/template/components/sidebar/Sidebar.js.map +1 -0
- package/build/template/components/sidebar/{SidebarItem.jsx → SidebarItem.js} +15 -32
- package/build/template/components/sidebar/SidebarItem.js.map +1 -0
- package/build/template/components/sidebar/ToggleButton.d.ts +1 -1
- package/build/template/components/sidebar/ToggleButton.d.ts.map +1 -1
- package/build/template/components/sidebar/ToggleButton.js +5 -0
- package/build/template/components/sidebar/ToggleButton.js.map +1 -0
- package/build/template/contexts/{ThemeContext.jsx → ThemeContext.js} +3 -4
- package/build/template/contexts/{ThemeContext.jsx.map → ThemeContext.js.map} +1 -1
- package/build/template/entry.client.d.ts +1 -0
- package/build/template/entry.client.d.ts.map +1 -1
- package/build/template/{entry.client.jsx → entry.client.js} +5 -6
- package/build/template/entry.client.js.map +1 -0
- package/build/template/routes/changelog.d.ts +1 -1
- package/build/template/routes/{changelog.jsx → changelog.js} +5 -4
- package/build/template/routes/changelog.js.map +1 -0
- package/build/template/routes/{index.jsx → index.js} +3 -2
- package/build/template/routes/index.js.map +1 -0
- package/build/template/routes/reference.$type.$field.d.ts +1 -1
- package/build/template/routes/{reference.$type.$field.jsx → reference.$type.$field.js} +6 -5
- package/build/template/routes/reference.$type.$field.js.map +1 -0
- package/build/template/routes/reference.$type.d.ts +1 -1
- package/build/template/routes/{reference.$type.jsx → reference.$type.js} +6 -5
- package/build/template/routes/reference.$type.js.map +1 -0
- package/build/template/routes/reference.d.ts +2 -2
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/{reference.jsx → reference.js} +7 -12
- package/build/template/routes/reference.js.map +1 -0
- package/build/template/routes/root.d.ts +2 -2
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +286 -0
- package/build/template/routes/root.js.map +1 -0
- package/build/template/routes.js +5 -0
- package/build/template/routes.js.map +1 -0
- package/build/template/server/app.js +1 -1
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/{render-page.jsx → render-page.js} +3 -4
- package/build/template/server/render-page.js.map +1 -0
- package/build/template/server/ssg/generate.js +1 -1
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/server/ssg/get-route-paths.js +1 -1
- package/build/template/server/ssg/get-route-paths.js.map +1 -1
- package/build/template/server/view.js +1 -1
- package/build/template/server/view.js.map +1 -1
- package/package.json +56 -8
- package/src/api/vite/plugins/core.ts +0 -3
- package/src/api/vite/plugins/pages.ts +1 -1
- package/src/exports/components.ts +4 -1
- package/src/lib/graphql-document/$$.ts +4 -0
- package/src/lib/graphql-document/$.test.ts +132 -0
- package/src/lib/graphql-document/$.ts +1 -0
- package/src/lib/graphql-document/README.md +102 -0
- package/src/lib/graphql-document/analysis.ts +415 -0
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +284 -0
- package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +188 -0
- package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +70 -0
- package/src/lib/graphql-document/components/HoverTooltip.tsx +282 -0
- package/src/lib/graphql-document/components/IdentifierLink.tsx +221 -0
- package/src/lib/graphql-document/components/index.ts +4 -0
- package/src/lib/graphql-document/demo.md +155 -0
- package/src/lib/graphql-document/example.ts +163 -0
- package/src/lib/graphql-document/graphql-document.ts +37 -0
- package/src/lib/graphql-document/positioning-simple.test.ts +252 -0
- package/src/lib/graphql-document/positioning-simple.ts +271 -0
- package/src/lib/graphql-document/schema-context.tsx +20 -0
- package/src/lib/graphql-document/schema-integration-example.ts +341 -0
- package/src/lib/graphql-document/schema-integration.test.ts +365 -0
- package/src/lib/graphql-document/schema-integration.ts +497 -0
- package/src/lib/graphql-document/types.ts +129 -0
- package/src/template/components/ArgumentAnnotation.tsx +1 -1
- package/src/template/components/ArgumentList.tsx +1 -1
- package/src/template/components/ArgumentListAnnotation.tsx +2 -2
- package/src/template/components/CodeBlockEnhancer.tsx +192 -0
- package/src/template/components/DeprecationReason.tsx +1 -1
- package/src/template/components/Description.tsx +1 -1
- package/src/template/components/Field.tsx +4 -4
- package/src/template/components/FieldList.tsx +1 -1
- package/src/template/components/FieldListSection.tsx +1 -1
- package/src/template/components/Link.tsx +2 -2
- package/src/template/components/MDXComponents.tsx +101 -0
- package/src/template/components/NamedType.tsx +2 -2
- package/src/template/components/TestComponent.tsx +6 -0
- package/src/template/components/TypeAnnotation.tsx +1 -1
- package/src/template/components/TypeFieldsLinkList.tsx +1 -1
- package/src/template/components/TypeIndex.tsx +1 -1
- package/src/template/components/content/$$.ts +1 -0
- package/src/template/components/content/GraphQLDocumentWithSchema.tsx +18 -0
- package/src/template/components/content/GraphQLDocumentWrapper.tsx +82 -0
- package/src/template/components/graphql/graphql.tsx +2 -2
- package/src/template/components/graphql/index.ts +1 -1
- package/src/template/components/graphql/type-link.tsx +2 -2
- package/src/template/components/sidebar/SidebarItem.tsx +4 -4
- package/src/template/entry.client.tsx +2 -2
- package/src/template/routes/changelog.tsx +1 -1
- package/src/template/routes/reference.$type.$field.tsx +3 -3
- package/src/template/routes/reference.$type.tsx +3 -3
- package/src/template/routes/reference.tsx +6 -10
- package/src/template/routes/root.tsx +145 -5
- package/src/template/routes.tsx +1 -1
- package/src/template/server/app.ts +1 -1
- package/src/template/server/ssg/generate.ts +1 -1
- package/src/template/server/ssg/get-route-paths.ts +1 -1
- package/src/template/server/view.ts +1 -1
- package/src/template/styles/code-block.css +32 -0
- package/build/template/components/ArgumentAnnotation.jsx +0 -16
- package/build/template/components/ArgumentAnnotation.jsx.map +0 -1
- package/build/template/components/ArgumentList.jsx +0 -16
- package/build/template/components/ArgumentList.jsx.map +0 -1
- package/build/template/components/ArgumentListAnnotation.jsx +0 -23
- package/build/template/components/ArgumentListAnnotation.jsx.map +0 -1
- package/build/template/components/Changelog.jsx +0 -68
- package/build/template/components/Changelog.jsx.map +0 -1
- package/build/template/components/DeprecationReason.jsx +0 -10
- package/build/template/components/DeprecationReason.jsx.map +0 -1
- package/build/template/components/Description.jsx +0 -10
- package/build/template/components/Description.jsx.map +0 -1
- package/build/template/components/Field.jsx +0 -22
- package/build/template/components/Field.jsx.map +0 -1
- package/build/template/components/FieldList.jsx.map +0 -1
- package/build/template/components/FieldListSection.jsx.map +0 -1
- package/build/template/components/HamburgerMenu.jsx +0 -53
- package/build/template/components/HamburgerMenu.jsx.map +0 -1
- package/build/template/components/Link.jsx.map +0 -1
- package/build/template/components/Logo.jsx +0 -29
- package/build/template/components/Logo.jsx.map +0 -1
- package/build/template/components/Markdown.jsx.map +0 -1
- package/build/template/components/MissingSchema.jsx +0 -4
- package/build/template/components/MissingSchema.jsx.map +0 -1
- package/build/template/components/NamedType.jsx +0 -17
- package/build/template/components/NamedType.jsx.map +0 -1
- package/build/template/components/NotFound.jsx +0 -26
- package/build/template/components/NotFound.jsx.map +0 -1
- package/build/template/components/RadixLink.jsx.map +0 -1
- package/build/template/components/Texts/MinorHeading.jsx.map +0 -1
- package/build/template/components/ThemeToggle.jsx +0 -10
- package/build/template/components/ThemeToggle.jsx.map +0 -1
- package/build/template/components/TypeAnnotation.jsx.map +0 -1
- package/build/template/components/TypeFieldsLinkList.jsx +0 -17
- package/build/template/components/TypeFieldsLinkList.jsx.map +0 -1
- package/build/template/components/TypeIndex.jsx +0 -27
- package/build/template/components/TypeIndex.jsx.map +0 -1
- package/build/template/components/graphql/graphql.jsx +0 -3
- package/build/template/components/graphql/graphql.jsx.map +0 -1
- package/build/template/components/graphql/type-kind-icon.jsx.map +0 -1
- package/build/template/components/graphql/type-link.jsx +0 -16
- package/build/template/components/graphql/type-link.jsx.map +0 -1
- package/build/template/components/sidebar/Sidebar.jsx +0 -15
- package/build/template/components/sidebar/Sidebar.jsx.map +0 -1
- package/build/template/components/sidebar/SidebarItem.jsx.map +0 -1
- package/build/template/components/sidebar/ToggleButton.jsx +0 -6
- package/build/template/components/sidebar/ToggleButton.jsx.map +0 -1
- package/build/template/entry.client.jsx.map +0 -1
- package/build/template/routes/changelog.jsx.map +0 -1
- package/build/template/routes/index.jsx.map +0 -1
- package/build/template/routes/reference.$type.$field.jsx.map +0 -1
- package/build/template/routes/reference.$type.jsx.map +0 -1
- package/build/template/routes/reference.jsx.map +0 -1
- package/build/template/routes/root.jsx +0 -204
- package/build/template/routes/root.jsx.map +0 -1
- package/build/template/routes.jsx +0 -5
- package/build/template/routes.jsx.map +0 -1
- package/build/template/server/render-page.jsx.map +0 -1
@@ -0,0 +1,297 @@
|
|
1
|
+
/**
|
2
|
+
* Example usage of Schema Integration (Layer 2)
|
3
|
+
*
|
4
|
+
* Demonstrates how the schema integration layer resolves GraphQL identifiers
|
5
|
+
* against actual schemas, extracts documentation, and generates reference URLs.
|
6
|
+
*/
|
7
|
+
import { buildSchema } from 'graphql';
|
8
|
+
import { analyzeWithSchema, createPolenSchemaResolver } from "./schema-integration.js";
|
9
|
+
// Example schema - typical GraphQL API
|
10
|
+
const pokemonSchema = buildSchema(`
|
11
|
+
"""
|
12
|
+
A Pokémon character
|
13
|
+
"""
|
14
|
+
type Pokemon {
|
15
|
+
"""
|
16
|
+
The Pokémon's unique identifier
|
17
|
+
"""
|
18
|
+
id: ID!
|
19
|
+
|
20
|
+
"""
|
21
|
+
The Pokémon's name
|
22
|
+
"""
|
23
|
+
name: String!
|
24
|
+
|
25
|
+
"""
|
26
|
+
The Pokémon's type (e.g., Electric, Fire, Water)
|
27
|
+
"""
|
28
|
+
type: String!
|
29
|
+
|
30
|
+
"""
|
31
|
+
The Pokémon's abilities
|
32
|
+
"""
|
33
|
+
abilities(
|
34
|
+
"""
|
35
|
+
Maximum number of abilities to return
|
36
|
+
"""
|
37
|
+
first: Int = 5
|
38
|
+
): [Ability!]!
|
39
|
+
|
40
|
+
"""
|
41
|
+
@deprecated Use evolutionChain instead
|
42
|
+
"""
|
43
|
+
evolutions: [Pokemon!] @deprecated(reason: "Use evolutionChain instead")
|
44
|
+
}
|
45
|
+
|
46
|
+
"""
|
47
|
+
A special ability that Pokémon can have
|
48
|
+
"""
|
49
|
+
type Ability {
|
50
|
+
id: ID!
|
51
|
+
name: String!
|
52
|
+
description: String
|
53
|
+
isHidden: Boolean!
|
54
|
+
}
|
55
|
+
|
56
|
+
type Query {
|
57
|
+
"""
|
58
|
+
Get a Pokémon by ID
|
59
|
+
"""
|
60
|
+
pokemon(id: ID!): Pokemon
|
61
|
+
|
62
|
+
"""
|
63
|
+
Search for Pokémon by name
|
64
|
+
"""
|
65
|
+
searchPokemon(query: String!): [Pokemon!]!
|
66
|
+
}
|
67
|
+
`);
|
68
|
+
// Example GraphQL query with various constructs
|
69
|
+
const exampleQuery = `
|
70
|
+
query GetPokemonDetails($pokemonId: ID!, $abilityLimit: Int = 3) {
|
71
|
+
pokemon(id: $pokemonId) {
|
72
|
+
id
|
73
|
+
name
|
74
|
+
type
|
75
|
+
abilities(first: $abilityLimit) {
|
76
|
+
name
|
77
|
+
description
|
78
|
+
isHidden
|
79
|
+
}
|
80
|
+
evolutions # This field is deprecated
|
81
|
+
invalidField # This field doesn't exist
|
82
|
+
}
|
83
|
+
}
|
84
|
+
`;
|
85
|
+
/**
|
86
|
+
* Demonstrate basic schema resolution
|
87
|
+
*/
|
88
|
+
export const demonstrateSchemaResolution = () => {
|
89
|
+
console.log('🔗 Schema Integration Demo\n');
|
90
|
+
const resolver = createPolenSchemaResolver(pokemonSchema);
|
91
|
+
// Example identifiers (normally extracted from AST)
|
92
|
+
const testIdentifiers = [
|
93
|
+
{
|
94
|
+
name: 'Pokemon',
|
95
|
+
kind: 'Type',
|
96
|
+
position: { start: 50, end: 57, line: 3, column: 5 },
|
97
|
+
schemaPath: ['Pokemon'],
|
98
|
+
context: { selectionPath: [] },
|
99
|
+
},
|
100
|
+
{
|
101
|
+
name: 'name',
|
102
|
+
kind: 'Field',
|
103
|
+
position: { start: 75, end: 79, line: 4, column: 7 },
|
104
|
+
parentType: 'Pokemon',
|
105
|
+
schemaPath: ['Pokemon', 'name'],
|
106
|
+
context: { selectionPath: ['pokemon', 'name'] },
|
107
|
+
},
|
108
|
+
{
|
109
|
+
name: 'evolutions',
|
110
|
+
kind: 'Field',
|
111
|
+
position: { start: 150, end: 160, line: 9, column: 7 },
|
112
|
+
parentType: 'Pokemon',
|
113
|
+
schemaPath: ['Pokemon', 'evolutions'],
|
114
|
+
context: { selectionPath: ['pokemon', 'evolutions'] },
|
115
|
+
},
|
116
|
+
{
|
117
|
+
name: 'first',
|
118
|
+
kind: 'Argument',
|
119
|
+
position: { start: 120, end: 125, line: 6, column: 20 },
|
120
|
+
parentType: 'Pokemon',
|
121
|
+
schemaPath: ['Pokemon', 'abilities', 'first'],
|
122
|
+
context: { selectionPath: ['pokemon', 'abilities'] },
|
123
|
+
},
|
124
|
+
];
|
125
|
+
console.log('📋 Identifier Resolutions:\n');
|
126
|
+
for (const identifier of testIdentifiers) {
|
127
|
+
const resolution = resolver.resolveIdentifier(identifier);
|
128
|
+
if (!resolution)
|
129
|
+
continue;
|
130
|
+
console.log(`🏷️ ${identifier.kind}: ${identifier.name}`);
|
131
|
+
console.log(` ✅ Exists: ${resolution.exists}`);
|
132
|
+
console.log(` 🔗 URL: ${resolution.referenceUrl}`);
|
133
|
+
if (resolution.documentation) {
|
134
|
+
console.log(` 📝 Type: ${resolution.documentation.typeInfo}`);
|
135
|
+
if (resolution.documentation.description) {
|
136
|
+
console.log(` 💬 Description: ${resolution.documentation.description}`);
|
137
|
+
}
|
138
|
+
if (resolution.documentation.defaultValue) {
|
139
|
+
console.log(` 🎯 Default: ${resolution.documentation.defaultValue}`);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
if (resolution.deprecated) {
|
143
|
+
console.log(` ⚠️ DEPRECATED: ${resolution.deprecated.reason}`);
|
144
|
+
}
|
145
|
+
console.log();
|
146
|
+
}
|
147
|
+
};
|
148
|
+
/**
|
149
|
+
* Demonstrate full schema-aware analysis
|
150
|
+
*/
|
151
|
+
export const demonstrateSchemaAwareAnalysis = () => {
|
152
|
+
console.log('🔍 Schema-Aware Analysis\n');
|
153
|
+
const result = analyzeWithSchema(exampleQuery, pokemonSchema);
|
154
|
+
console.log(`📊 Analysis Summary:`);
|
155
|
+
console.log(` • Valid GraphQL: ${result.analysis.isValid}`);
|
156
|
+
console.log(` • Total identifiers: ${result.analysis.identifiers.all.length}`);
|
157
|
+
console.log(` • Schema resolutions: ${result.resolutions.size}`);
|
158
|
+
console.log(` • Schema errors: ${result.schemaErrors.length}\n`);
|
159
|
+
// Show validation errors
|
160
|
+
if (result.schemaErrors.length > 0) {
|
161
|
+
console.log('🚨 Schema Validation Issues:\n');
|
162
|
+
for (const error of result.schemaErrors) {
|
163
|
+
const emoji = error.severity === 'error' ? '❌' : '⚠️';
|
164
|
+
const pos = `${error.identifier.position.line}:${error.identifier.position.column}`;
|
165
|
+
console.log(` ${emoji} ${error.message} @ ${pos}`);
|
166
|
+
}
|
167
|
+
console.log();
|
168
|
+
}
|
169
|
+
// Show successful resolutions with hyperlink potential
|
170
|
+
console.log('🔗 Generated Hyperlinks:\n');
|
171
|
+
let linkCount = 0;
|
172
|
+
for (const [key, resolution] of result.resolutions) {
|
173
|
+
if (resolution.exists && linkCount < 8) { // Show first 8 successful resolutions
|
174
|
+
const identifier = result.analysis.identifiers.all.find(id => key.startsWith(`${id.position.start}-${id.name}-${id.kind}`));
|
175
|
+
if (identifier) {
|
176
|
+
const pos = `${identifier.position.line}:${identifier.position.column}`;
|
177
|
+
console.log(` 📍 ${identifier.name} (${identifier.kind}) → ${resolution.referenceUrl}`);
|
178
|
+
if (resolution.documentation?.description) {
|
179
|
+
const shortDesc = resolution.documentation.description.length > 50
|
180
|
+
? resolution.documentation.description.substring(0, 50) + '...'
|
181
|
+
: resolution.documentation.description;
|
182
|
+
console.log(` 💬 "${shortDesc}"`);
|
183
|
+
}
|
184
|
+
linkCount++;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
};
|
189
|
+
/**
|
190
|
+
* Demonstrate tooltip data extraction
|
191
|
+
*/
|
192
|
+
export const demonstrateTooltipData = () => {
|
193
|
+
console.log('\n💬 Tooltip Data Extraction\n');
|
194
|
+
const resolver = createPolenSchemaResolver(pokemonSchema);
|
195
|
+
// Simulate tooltip hover scenarios
|
196
|
+
const tooltipExamples = [
|
197
|
+
['Pokemon'],
|
198
|
+
['Pokemon', 'name'],
|
199
|
+
['Pokemon', 'abilities'],
|
200
|
+
['Pokemon', 'abilities', 'first'],
|
201
|
+
['Ability', 'isHidden'],
|
202
|
+
];
|
203
|
+
for (const schemaPath of tooltipExamples) {
|
204
|
+
const docs = resolver.getDocumentation(schemaPath);
|
205
|
+
if (docs) {
|
206
|
+
const pathStr = schemaPath.join(' → ');
|
207
|
+
console.log(`🏷️ ${pathStr}`);
|
208
|
+
console.log(` 📋 Type: ${docs.typeInfo}`);
|
209
|
+
if (docs.description) {
|
210
|
+
console.log(` 💬 Description: ${docs.description}`);
|
211
|
+
}
|
212
|
+
if (docs.defaultValue) {
|
213
|
+
console.log(` 🎯 Default: ${docs.defaultValue}`);
|
214
|
+
}
|
215
|
+
if (docs.deprecated) {
|
216
|
+
console.log(` ⚠️ DEPRECATED: ${docs.deprecated.reason}`);
|
217
|
+
}
|
218
|
+
console.log();
|
219
|
+
}
|
220
|
+
}
|
221
|
+
};
|
222
|
+
/**
|
223
|
+
* Demonstrate URL generation customization
|
224
|
+
*/
|
225
|
+
export const demonstrateCustomURLGeneration = () => {
|
226
|
+
console.log('🛠️ Custom URL Generation\n');
|
227
|
+
// Different resolver configurations
|
228
|
+
const configurations = [
|
229
|
+
{ name: 'Default', config: {} },
|
230
|
+
{ name: 'Custom Base Path', config: { basePath: '/docs/api' } },
|
231
|
+
{ name: 'No Fragments', config: { includeFragments: false } },
|
232
|
+
{ name: 'Custom + No Fragments', config: { basePath: '/schema', includeFragments: false } },
|
233
|
+
];
|
234
|
+
const testPaths = [
|
235
|
+
['Pokemon'],
|
236
|
+
['Pokemon', 'name'],
|
237
|
+
['Pokemon', 'abilities', 'first'],
|
238
|
+
];
|
239
|
+
for (const { name, config } of configurations) {
|
240
|
+
console.log(`📋 ${name}:`);
|
241
|
+
const resolver = createPolenSchemaResolver(pokemonSchema, config);
|
242
|
+
for (const path of testPaths) {
|
243
|
+
const url = resolver.generateReferenceLink(path);
|
244
|
+
console.log(` ${path.join(' → ')} → ${url}`);
|
245
|
+
}
|
246
|
+
console.log();
|
247
|
+
}
|
248
|
+
};
|
249
|
+
/**
|
250
|
+
* Show integration with Polen's reference system
|
251
|
+
*/
|
252
|
+
export const demonstratePolenIntegration = () => {
|
253
|
+
console.log('🏗️ Polen Integration Preview\n');
|
254
|
+
// This demonstrates how the schema integration connects with Polen's existing systems
|
255
|
+
const result = analyzeWithSchema(exampleQuery, pokemonSchema, {
|
256
|
+
basePath: '/reference', // Polen's reference page base
|
257
|
+
includeFragments: true, // Enable field anchors
|
258
|
+
});
|
259
|
+
console.log('🔄 How this integrates with Polen:\n');
|
260
|
+
console.log('1. 📋 Schema Loading:');
|
261
|
+
console.log(" • Uses PROJECT_DATA.schema from Polen's build system");
|
262
|
+
console.log(' • Leverages existing schema processing pipeline');
|
263
|
+
console.log();
|
264
|
+
console.log('2. 🔗 Reference Links:');
|
265
|
+
console.log(" • Generates URLs matching Polen's /reference/* structure");
|
266
|
+
console.log(' • Works with existing TypeIndex and sidebar system');
|
267
|
+
console.log();
|
268
|
+
console.log('3. 💬 Documentation:');
|
269
|
+
console.log(' • Extracts descriptions for hover tooltips');
|
270
|
+
console.log(' • Provides type signatures for context');
|
271
|
+
console.log(' • Detects deprecation warnings');
|
272
|
+
console.log();
|
273
|
+
console.log('4. ✅ Validation:');
|
274
|
+
console.log(' • Build-time validation against actual schema');
|
275
|
+
console.log(' • Catches typos and invalid references');
|
276
|
+
console.log(' • Reports deprecation usage');
|
277
|
+
console.log();
|
278
|
+
// Show some example integrations
|
279
|
+
const validFields = Array.from(result.resolutions.values())
|
280
|
+
.filter(r => r.exists)
|
281
|
+
.slice(0, 3);
|
282
|
+
if (validFields.length > 0) {
|
283
|
+
console.log('📋 Example Reference Links:');
|
284
|
+
for (const resolution of validFields) {
|
285
|
+
console.log(` • ${resolution.referenceUrl}`);
|
286
|
+
}
|
287
|
+
}
|
288
|
+
};
|
289
|
+
// Run examples if executed directly
|
290
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
291
|
+
demonstrateSchemaResolution();
|
292
|
+
demonstrateSchemaAwareAnalysis();
|
293
|
+
demonstrateTooltipData();
|
294
|
+
demonstrateCustomURLGeneration();
|
295
|
+
demonstratePolenIntegration();
|
296
|
+
}
|
297
|
+
//# sourceMappingURL=schema-integration-example.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema-integration-example.js","sourceRoot":"","sources":["../../../src/lib/graphql-document/schema-integration-example.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAEtF,u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DAAkD,CAAC,CAAA;IAC/D,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAA;IACxD,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;IAC7C,OAAO,CAAC,GAAG,EAAE,CAAA;IAEb,iCAAiC;IACjC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;SACxD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;SACrB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAEd,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;QAC1C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,UAAU,CAAC,YAAY,EAAE,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,oCAAoC;AACpC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,2BAA2B,EAAE,CAAA;IAC7B,8BAA8B,EAAE,CAAA;IAChC,sBAAsB,EAAE,CAAA;IACxB,8BAA8B,EAAE,CAAA;IAChC,2BAA2B,EAAE,CAAA;AAC/B,CAAC"}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
/**
|
2
|
+
* Layer 2: Schema Integration
|
3
|
+
*
|
4
|
+
* Bridge between GraphQL analysis and Polen's schema system.
|
5
|
+
* Resolves identifiers against the actual schema, extracts documentation,
|
6
|
+
* and generates reference URLs for navigation.
|
7
|
+
*/
|
8
|
+
import { type GraphQLSchema, type GraphQLType } from 'graphql';
|
9
|
+
import type { Identifier } from './types.ts';
|
10
|
+
/**
|
11
|
+
* Documentation extracted from GraphQL schema
|
12
|
+
*/
|
13
|
+
export interface Documentation {
|
14
|
+
/** Description from schema SDL or introspection */
|
15
|
+
description?: string;
|
16
|
+
/** Type signature (e.g., "String!", "[User!]!") */
|
17
|
+
typeInfo: string;
|
18
|
+
/** Whether this field/type is deprecated */
|
19
|
+
deprecated?: {
|
20
|
+
reason: string;
|
21
|
+
replacement?: string;
|
22
|
+
};
|
23
|
+
/** Default value for arguments */
|
24
|
+
defaultValue?: string;
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Result of resolving an identifier against the schema
|
28
|
+
*/
|
29
|
+
export interface SchemaResolution {
|
30
|
+
/** Whether the identifier exists in the schema */
|
31
|
+
exists: boolean;
|
32
|
+
/** Documentation extracted from schema */
|
33
|
+
documentation?: Documentation;
|
34
|
+
/** URL to the reference page for this identifier */
|
35
|
+
referenceUrl: string;
|
36
|
+
/** Whether this identifier is deprecated */
|
37
|
+
deprecated?: {
|
38
|
+
reason: string;
|
39
|
+
replacement?: string;
|
40
|
+
};
|
41
|
+
/** The GraphQL type if this is a type identifier */
|
42
|
+
graphqlType?: GraphQLType;
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Interface for resolving GraphQL identifiers against a schema
|
46
|
+
*/
|
47
|
+
export interface SchemaResolver {
|
48
|
+
/**
|
49
|
+
* Resolve an identifier against the schema
|
50
|
+
*/
|
51
|
+
resolveIdentifier(identifier: Identifier): SchemaResolution | null;
|
52
|
+
/**
|
53
|
+
* Get documentation for a schema path
|
54
|
+
*/
|
55
|
+
getDocumentation(schemaPath: string[]): Documentation | null;
|
56
|
+
/**
|
57
|
+
* Generate a reference URL for a schema path
|
58
|
+
*/
|
59
|
+
generateReferenceLink(schemaPath: string[]): string;
|
60
|
+
/**
|
61
|
+
* Check if a type exists in the schema
|
62
|
+
*/
|
63
|
+
typeExists(typeName: string): boolean;
|
64
|
+
/**
|
65
|
+
* Get all available types for validation
|
66
|
+
*/
|
67
|
+
getAllTypes(): string[];
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* Configuration for URL generation
|
71
|
+
*/
|
72
|
+
export interface RouteConfig {
|
73
|
+
/** Base path for reference pages (default: "/reference") */
|
74
|
+
basePath?: string;
|
75
|
+
/** Whether to include fragments in URLs (default: true) */
|
76
|
+
includeFragments?: boolean;
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Polen's implementation of SchemaResolver
|
80
|
+
*/
|
81
|
+
export declare class PolenSchemaResolver implements SchemaResolver {
|
82
|
+
private schema;
|
83
|
+
private routeConfig;
|
84
|
+
constructor(schema: GraphQLSchema, routeConfig?: RouteConfig);
|
85
|
+
/**
|
86
|
+
* Resolve an identifier against the schema
|
87
|
+
*/
|
88
|
+
resolveIdentifier(identifier: Identifier): SchemaResolution | null;
|
89
|
+
/**
|
90
|
+
* Get documentation for a schema path
|
91
|
+
*/
|
92
|
+
getDocumentation(schemaPath: string[]): Documentation | null;
|
93
|
+
/**
|
94
|
+
* Generate a reference URL for a schema path
|
95
|
+
*/
|
96
|
+
generateReferenceLink(schemaPath: string[]): string;
|
97
|
+
/**
|
98
|
+
* Check if a type exists in the schema
|
99
|
+
*/
|
100
|
+
typeExists(typeName: string): boolean;
|
101
|
+
/**
|
102
|
+
* Get all available types for validation
|
103
|
+
*/
|
104
|
+
getAllTypes(): string[];
|
105
|
+
private resolveType;
|
106
|
+
private resolveField;
|
107
|
+
private resolveArgument;
|
108
|
+
private resolveDirective;
|
109
|
+
private getFieldFromType;
|
110
|
+
private getTypeSignature;
|
111
|
+
}
|
112
|
+
/**
|
113
|
+
* Create a schema resolver for Polen
|
114
|
+
*/
|
115
|
+
export declare const createPolenSchemaResolver: (schema: GraphQLSchema, routeConfig?: RouteConfig) => SchemaResolver;
|
116
|
+
/**
|
117
|
+
* Enhanced analysis result with schema resolution
|
118
|
+
*/
|
119
|
+
export interface SchemaAwareAnalysisResult {
|
120
|
+
/** Original analysis result */
|
121
|
+
analysis: import('./types.ts').AnalysisResult;
|
122
|
+
/** Schema resolutions for all identifiers */
|
123
|
+
resolutions: Map<string, SchemaResolution>;
|
124
|
+
/** Validation errors from schema checking */
|
125
|
+
schemaErrors: Array<{
|
126
|
+
identifier: Identifier;
|
127
|
+
message: string;
|
128
|
+
severity: 'error' | 'warning';
|
129
|
+
}>;
|
130
|
+
}
|
131
|
+
/**
|
132
|
+
* Perform schema-aware analysis of a GraphQL document
|
133
|
+
*/
|
134
|
+
export declare const analyzeWithSchema: (source: string, schema: GraphQLSchema, routeConfig?: RouteConfig) => SchemaAwareAnalysisResult;
|
135
|
+
//# sourceMappingURL=schema-integration.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema-integration.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-document/schema-integration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,aAAa,EAClB,KAAK,WAAW,EAUjB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAA;IAChB,4CAA4C;IAC5C,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAA;IACf,0CAA0C;IAC1C,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,oDAAoD;IACpD,WAAW,C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