polen 0.11.0-next.1 → 0.11.0-next.10
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/configurator.d.ts +35 -23
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +0 -6
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/config/merge.d.ts.map +1 -1
- package/build/api/config/merge.js +0 -11
- package/build/api/config/merge.js.map +1 -1
- package/build/api/content/metadata.d.ts +8 -2
- package/build/api/content/metadata.d.ts.map +1 -1
- package/build/api/content/metadata.js +1 -1
- package/build/api/content/metadata.js.map +1 -1
- package/build/api/schema/data-sources/data-sources.d.ts +1 -0
- package/build/api/schema/data-sources/data-sources.d.ts.map +1 -1
- package/build/api/schema/data-sources/data-sources.js +1 -0
- package/build/api/schema/data-sources/data-sources.js.map +1 -1
- package/build/api/schema/data-sources/introspection/introspection.d.ts +83 -0
- package/build/api/schema/data-sources/introspection/introspection.d.ts.map +1 -0
- package/build/api/schema/data-sources/introspection/introspection.js +110 -0
- package/build/api/schema/data-sources/introspection/introspection.js.map +1 -0
- package/build/api/schema/metadata.d.ts +11 -3
- package/build/api/schema/metadata.d.ts.map +1 -1
- package/build/api/schema/metadata.js +1 -1
- package/build/api/schema/metadata.js.map +1 -1
- package/build/api/schema/read.d.ts +83 -9
- package/build/api/schema/read.d.ts.map +1 -1
- package/build/api/schema/read.js +15 -6
- package/build/api/schema/read.js.map +1 -1
- package/build/api/schema-source/schema-source.d.ts +1 -1
- package/build/api/schema-source/schema-source.d.ts.map +1 -1
- package/build/api/schema-source/schema-source.js.map +1 -1
- package/build/api/static/manifest.d.ts +1 -2
- package/build/api/static/manifest.d.ts.map +1 -1
- package/build/api/static/manifest.js +1 -1
- package/build/api/static/manifest.js.map +1 -1
- package/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +3 -0
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.js +8 -8
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/main.d.ts.map +1 -1
- package/build/api/vite/plugins/main.js +1 -8
- package/build/api/vite/plugins/main.js.map +1 -1
- package/build/api/vite/plugins/schema-assets.d.ts.map +1 -1
- package/build/api/vite/plugins/schema-assets.js +52 -11
- package/build/api/vite/plugins/schema-assets.js.map +1 -1
- package/build/cli/commands/open.js +1 -1
- package/build/cli/commands/open.js.map +1 -1
- package/build/lib/grafaid/schema/schema.d.ts +1 -1
- package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
- package/build/lib/grafaid/schema/schema.js +1 -1
- package/build/lib/grafaid/schema/schema.js.map +1 -1
- package/build/lib/kit-temp.js +2 -2
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/react-router-aid/react-router-aid.d.ts +5 -3
- package/build/lib/react-router-aid/react-router-aid.d.ts.map +1 -1
- package/build/lib/react-router-aid/react-router-aid.js +7 -4
- package/build/lib/react-router-aid/react-router-aid.js.map +1 -1
- package/build/template/routes/changelog.js +2 -2
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/index.js +2 -2
- package/build/template/routes/index.js.map +1 -1
- package/build/template/routes/pages.js +2 -2
- package/build/template/routes/pages.js.map +1 -1
- package/build/template/routes/reference.d.ts +27 -4
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +81 -20
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.js +3 -3
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/ssg/get-route-paths.d.ts.map +1 -1
- package/build/template/server/ssg/get-route-paths.js +42 -3
- package/build/template/server/ssg/get-route-paths.js.map +1 -1
- package/build/template/sources/schema-source.d.ts +1 -1
- package/build/template/sources/schema-source.d.ts.map +1 -1
- package/build/template/sources/schema-source.js +2 -1
- package/build/template/sources/schema-source.js.map +1 -1
- package/package.json +16 -17
- package/src/api/config/configurator.ts +35 -30
- package/src/api/config/merge.ts +0 -16
- package/src/api/content/metadata.ts +1 -1
- package/src/api/schema/data-sources/data-sources.ts +1 -0
- package/src/api/schema/data-sources/introspection/introspection.ts +213 -0
- package/src/api/schema/metadata.ts +1 -1
- package/src/api/schema/read.ts +107 -16
- package/src/api/schema-source/schema-source.ts +3 -3
- package/src/api/static/manifest.ts +1 -1
- package/src/api/vite/plugins/build.ts +3 -0
- package/src/api/vite/plugins/core.ts +8 -8
- package/src/api/vite/plugins/main.ts +1 -9
- package/src/api/vite/plugins/schema-assets.ts +59 -12
- package/src/cli/commands/open.ts +1 -1
- package/src/lib/grafaid/schema/schema.ts +1 -0
- package/src/lib/kit-temp.ts +2 -2
- package/src/lib/mask/$.test.ts +3 -3
- package/src/lib/react-router-aid/react-router-aid.ts +12 -6
- package/src/template/routes/changelog.tsx +2 -2
- package/src/template/routes/index.tsx +2 -2
- package/src/template/routes/pages.tsx +2 -2
- package/src/template/routes/reference.tsx +88 -20
- package/src/template/routes/root.tsx +3 -3
- package/src/template/server/ssg/get-route-paths.test.ts +132 -0
- package/src/template/server/ssg/get-route-paths.ts +41 -3
- package/src/template/sources/schema-source.ts +2 -1
- package/build/template/routes/reference.$type.$field.d.ts +0 -5
- package/build/template/routes/reference.$type.$field.d.ts.map +0 -1
- package/build/template/routes/reference.$type.$field.js +0 -31
- package/build/template/routes/reference.$type.$field.js.map +0 -1
- package/build/template/routes/reference.$type.d.ts +0 -9
- package/build/template/routes/reference.$type.d.ts.map +0 -1
- package/build/template/routes/reference.$type.js +0 -25
- package/build/template/routes/reference.$type.js.map +0 -1
- package/build/template/routes/reference.version.$version.$type.$field.d.ts +0 -6
- package/build/template/routes/reference.version.$version.$type.$field.d.ts.map +0 -1
- package/build/template/routes/reference.version.$version.$type.$field.js +0 -32
- package/build/template/routes/reference.version.$version.$type.$field.js.map +0 -1
- package/build/template/routes/reference.version.$version.$type.d.ts +0 -11
- package/build/template/routes/reference.version.$version.$type.d.ts.map +0 -1
- package/build/template/routes/reference.version.$version.$type.js +0 -26
- package/build/template/routes/reference.version.$version.$type.js.map +0 -1
- package/src/template/routes/reference.$type.$field.tsx +0 -34
- package/src/template/routes/reference.$type.tsx +0 -29
- package/src/template/routes/reference.version.$version.$type.$field.tsx +0 -35
- package/src/template/routes/reference.version.$version.$type.tsx +0 -30
@@ -0,0 +1,132 @@
|
|
1
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest'
|
2
|
+
|
3
|
+
// Mock node:fs/promises
|
4
|
+
vi.mock('node:fs/promises', () => ({
|
5
|
+
readFile: vi.fn(),
|
6
|
+
}))
|
7
|
+
|
8
|
+
// Mock the virtual import
|
9
|
+
vi.mock('virtual:polen/project/data.jsonsuper', () => ({
|
10
|
+
default: {
|
11
|
+
paths: {
|
12
|
+
project: {
|
13
|
+
absolute: {
|
14
|
+
build: {
|
15
|
+
assets: {
|
16
|
+
schemas: '/mock/schemas',
|
17
|
+
},
|
18
|
+
},
|
19
|
+
},
|
20
|
+
},
|
21
|
+
},
|
22
|
+
},
|
23
|
+
}))
|
24
|
+
|
25
|
+
// Mock the routes
|
26
|
+
vi.mock('../../routes.js', () => ({
|
27
|
+
routes: [
|
28
|
+
{
|
29
|
+
path: 'reference',
|
30
|
+
children: [
|
31
|
+
{
|
32
|
+
path: 'version/:version',
|
33
|
+
children: [
|
34
|
+
{
|
35
|
+
path: ':type',
|
36
|
+
},
|
37
|
+
],
|
38
|
+
},
|
39
|
+
{
|
40
|
+
path: ':type',
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
],
|
45
|
+
}))
|
46
|
+
|
47
|
+
// Mock the API
|
48
|
+
vi.mock('#api/index', () => ({
|
49
|
+
Api: {
|
50
|
+
Schema: {
|
51
|
+
getMetadata: vi.fn(),
|
52
|
+
VERSION_LATEST: 'latest',
|
53
|
+
},
|
54
|
+
},
|
55
|
+
}))
|
56
|
+
|
57
|
+
describe('getRoutesPaths', () => {
|
58
|
+
beforeEach(() => {
|
59
|
+
vi.resetAllMocks()
|
60
|
+
})
|
61
|
+
|
62
|
+
test('should handle versioned routes without type parameter', async () => {
|
63
|
+
// Mock schema metadata
|
64
|
+
const { Api } = await import('#api/index')
|
65
|
+
vi.mocked(Api.Schema.getMetadata).mockResolvedValue({
|
66
|
+
hasSchema: true,
|
67
|
+
versions: ['2024-01-01', '2024-02-01'],
|
68
|
+
})
|
69
|
+
|
70
|
+
// Mock file system reads with proper GraphQL AST
|
71
|
+
const NodeFs = await import('node:fs/promises')
|
72
|
+
vi.mocked(NodeFs.readFile).mockImplementation(async (path) => {
|
73
|
+
if (typeof path === 'string' && path.includes('.json')) {
|
74
|
+
// Return a minimal GraphQL document AST
|
75
|
+
return JSON.stringify({
|
76
|
+
kind: 'Document',
|
77
|
+
definitions: [],
|
78
|
+
})
|
79
|
+
}
|
80
|
+
throw new Error(`Unexpected file read: ${path}`)
|
81
|
+
})
|
82
|
+
|
83
|
+
const { getRoutesPaths } = await import('./get-route-paths.js')
|
84
|
+
|
85
|
+
// This should not throw "Unhandled parameterized path: /reference/version/:version"
|
86
|
+
await expect(getRoutesPaths()).resolves.toBeDefined()
|
87
|
+
})
|
88
|
+
|
89
|
+
test('should generate paths for all schema versions', async () => {
|
90
|
+
const { Api } = await import('#api/index')
|
91
|
+
vi.mocked(Api.Schema.getMetadata).mockResolvedValue({
|
92
|
+
hasSchema: true,
|
93
|
+
versions: ['2024-01-01', '2024-02-01'],
|
94
|
+
})
|
95
|
+
|
96
|
+
// Mock schema with types - proper GraphQL AST
|
97
|
+
const mockSchema = {
|
98
|
+
kind: 'Document',
|
99
|
+
definitions: [
|
100
|
+
{
|
101
|
+
kind: 'ObjectTypeDefinition',
|
102
|
+
name: { kind: 'Name', value: 'User' },
|
103
|
+
},
|
104
|
+
{
|
105
|
+
kind: 'ObjectTypeDefinition',
|
106
|
+
name: { kind: 'Name', value: 'Post' },
|
107
|
+
},
|
108
|
+
],
|
109
|
+
}
|
110
|
+
|
111
|
+
const NodeFs = await import('node:fs/promises')
|
112
|
+
vi.mocked(NodeFs.readFile).mockImplementation(async (path) => {
|
113
|
+
if (typeof path === 'string' && path.includes('.json')) {
|
114
|
+
return JSON.stringify(mockSchema)
|
115
|
+
}
|
116
|
+
throw new Error(`Unexpected file read: ${path}`)
|
117
|
+
})
|
118
|
+
|
119
|
+
const { getRoutesPaths } = await import('./get-route-paths.js')
|
120
|
+
const paths = await getRoutesPaths()
|
121
|
+
|
122
|
+
// Should include versioned paths
|
123
|
+
expect(paths).toContain('/reference/version/2024-01-01/User')
|
124
|
+
expect(paths).toContain('/reference/version/2024-01-01/Post')
|
125
|
+
expect(paths).toContain('/reference/version/2024-02-01/User')
|
126
|
+
expect(paths).toContain('/reference/version/2024-02-01/Post')
|
127
|
+
|
128
|
+
// Should include unversioned paths
|
129
|
+
expect(paths).toContain('/reference/User')
|
130
|
+
expect(paths).toContain('/reference/Post')
|
131
|
+
})
|
132
|
+
})
|
@@ -11,7 +11,10 @@ import { routes } from '../../routes.js'
|
|
11
11
|
// Maybe we can figure something out too.
|
12
12
|
const knownParameterizedRouteExpressions = {
|
13
13
|
reference_type: `/reference/:type`,
|
14
|
+
reference_type_field: `/reference/:type/:field`,
|
15
|
+
reference_version: `/reference/version/:version`,
|
14
16
|
reference_versioned_type: `/reference/version/:version/:type`,
|
17
|
+
reference_versioned_type_field: `/reference/version/:version/:type/:field`,
|
15
18
|
}
|
16
19
|
|
17
20
|
export const getRoutesPaths = async (): Promise<string[]> => {
|
@@ -19,7 +22,7 @@ export const getRoutesPaths = async (): Promise<string[]> => {
|
|
19
22
|
const routeExpressions = ReactRouterAid.getRouteExpressions(routes)
|
20
23
|
|
21
24
|
// Helper function to load schema from filesystem and add type paths
|
22
|
-
const addTypePathsForVersion = async (version: string, pathPrefix: string) => {
|
25
|
+
const addTypePathsForVersion = async (version: string, pathPrefix: string, includeFields = false) => {
|
23
26
|
try {
|
24
27
|
const schemaFilePath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, `${version}.json`)
|
25
28
|
const schemaContent = await NodeFs.readFile(schemaFilePath, 'utf-8')
|
@@ -27,10 +30,26 @@ export const getRoutesPaths = async (): Promise<string[]> => {
|
|
27
30
|
|
28
31
|
visit(schemaAst, {
|
29
32
|
ObjectTypeDefinition(node) {
|
30
|
-
|
33
|
+
const typePath = `${pathPrefix}/${node.name.value}`
|
34
|
+
paths.add(typePath)
|
35
|
+
|
36
|
+
// Add field paths if requested
|
37
|
+
if (includeFields && node.fields) {
|
38
|
+
for (const field of node.fields) {
|
39
|
+
paths.add(`${typePath}/${field.name.value}`)
|
40
|
+
}
|
41
|
+
}
|
31
42
|
},
|
32
43
|
InterfaceTypeDefinition(node) {
|
33
|
-
|
44
|
+
const typePath = `${pathPrefix}/${node.name.value}`
|
45
|
+
paths.add(typePath)
|
46
|
+
|
47
|
+
// Add field paths if requested
|
48
|
+
if (includeFields && node.fields) {
|
49
|
+
for (const field of node.fields) {
|
50
|
+
paths.add(`${typePath}/${field.name.value}`)
|
51
|
+
}
|
52
|
+
}
|
34
53
|
},
|
35
54
|
EnumTypeDefinition(node) {
|
36
55
|
paths.add(`${pathPrefix}/${node.name.value}`)
|
@@ -61,6 +80,18 @@ export const getRoutesPaths = async (): Promise<string[]> => {
|
|
61
80
|
// Add paths for latest version (no version in URL)
|
62
81
|
await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`)
|
63
82
|
}
|
83
|
+
} else if (exp === knownParameterizedRouteExpressions.reference_version) {
|
84
|
+
if (hasSchema) {
|
85
|
+
// Add paths for version pages themselves (without type)
|
86
|
+
for (const version of availableVersions) {
|
87
|
+
paths.add(`/reference/version/${version}`)
|
88
|
+
}
|
89
|
+
}
|
90
|
+
} else if (exp === knownParameterizedRouteExpressions.reference_type_field) {
|
91
|
+
if (hasSchema) {
|
92
|
+
// Add paths for latest version fields
|
93
|
+
await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`, true)
|
94
|
+
}
|
64
95
|
} else if (exp === knownParameterizedRouteExpressions.reference_versioned_type) {
|
65
96
|
if (hasSchema) {
|
66
97
|
// Add paths for all versions using new route structure
|
@@ -68,6 +99,13 @@ export const getRoutesPaths = async (): Promise<string[]> => {
|
|
68
99
|
await addTypePathsForVersion(version, `/reference/version/${version}`)
|
69
100
|
}
|
70
101
|
}
|
102
|
+
} else if (exp === knownParameterizedRouteExpressions.reference_versioned_type_field) {
|
103
|
+
if (hasSchema) {
|
104
|
+
// Add paths for all versions with fields
|
105
|
+
for (const version of availableVersions) {
|
106
|
+
await addTypePathsForVersion(version, `/reference/version/${version}`, true)
|
107
|
+
}
|
108
|
+
}
|
71
109
|
} else if (ReactRouterAid.isParameterizedPath(exp)) {
|
72
110
|
throw new Error(`Unhandled parameterized path: ${exp}`)
|
73
111
|
} else {
|
@@ -13,8 +13,9 @@ const io = import.meta.env.SSR
|
|
13
13
|
|
14
14
|
// Extract the path after the assets route
|
15
15
|
// e.g., "/assets/schemas/latest.json" -> "schemas/latest.json"
|
16
|
+
// e.g., "/demos/pokemon/assets/schemas/latest.json" -> "schemas/latest.json"
|
16
17
|
const assetsRoute = PROJECT_DATA.server.routes.assets
|
17
|
-
const routePattern = new RegExp(
|
18
|
+
const routePattern = new RegExp(`${assetsRoute}/(.+)$`)
|
18
19
|
const match = path.match(routePattern)
|
19
20
|
const assetPath = match ? match[1] : path
|
20
21
|
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.$field.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.$field.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,oBAAoB;;;CAG/B,CAAA"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Grafaid } from '#lib/grafaid/index';
|
3
|
-
import { ReactRouterAid } from '#lib/react-router-aid/index';
|
4
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
5
|
-
import { useParams } from 'react-router';
|
6
|
-
import { Field } from '../components/Field.js';
|
7
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type)
|
16
|
-
return `Could not find type ${params.type}`;
|
17
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
18
|
-
return `Type ${params.type} does not have fields`;
|
19
|
-
}
|
20
|
-
const fields = type.getFields();
|
21
|
-
const field = fields[params.field];
|
22
|
-
if (!field) {
|
23
|
-
return `Could not find field ${params.field} on type ${params.type}`;
|
24
|
-
}
|
25
|
-
return _jsx(Field, { data: field });
|
26
|
-
};
|
27
|
-
export const reference$type$field = ReactRouterAid.createRoute({
|
28
|
-
path: `:field`,
|
29
|
-
Component,
|
30
|
-
});
|
31
|
-
//# sourceMappingURL=reference.$type.$field.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.$field.js","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.$field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAG9D,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAqC,CAAA;IAC7D,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAO,uBAAuB,MAAM,CAAC,IAAI,EAAE,CAAA;IACtD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,OAAO,QAAQ,MAAM,CAAC,IAAI,uBAAuB,CAAA;IACnD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,wBAAwB,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,IAAI,EAAE,CAAA;IACtE,CAAC;IAED,OAAO,KAAC,KAAK,IAAC,IAAI,EAAE,KAAK,GAAI,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,WAAW,CAAC;IAC7D,IAAI,EAAE,QAAQ;IACd,SAAS;CACV,CAAC,CAAA"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
export declare const reference$type: {
|
2
|
-
path: string;
|
3
|
-
Component: () => string | import("react/jsx-runtime").JSX.Element;
|
4
|
-
children: {
|
5
|
-
path: string;
|
6
|
-
Component: () => string | import("react/jsx-runtime").JSX.Element;
|
7
|
-
}[];
|
8
|
-
};
|
9
|
-
//# sourceMappingURL=reference.$type.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,cAAc;;;;;;;CAIzB,CAAA"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
4
|
-
import { useParams } from 'react-router';
|
5
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
6
|
-
import { NamedType } from '../components/NamedType.js';
|
7
|
-
import { reference$type$field } from './reference.$type.$field.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type) {
|
16
|
-
return `Could not find type ${params.type}`;
|
17
|
-
}
|
18
|
-
return _jsx(NamedType, { data: type });
|
19
|
-
};
|
20
|
-
export const reference$type = createRoute({
|
21
|
-
path: `:type`,
|
22
|
-
Component,
|
23
|
-
children: [reference$type$field],
|
24
|
-
});
|
25
|
-
//# sourceMappingURL=reference.$type.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.js","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAGlE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAsB,CAAA;IAE9C,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,uBAAuB,MAAM,CAAC,IAAI,EAAE,CAAA;IAC7C,CAAC;IAED,OAAO,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;IACxC,IAAI,EAAE,OAAO;IACb,SAAS;IACT,QAAQ,EAAE,CAAC,oBAAoB,CAAC;CACjC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.$field.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.$field.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,mCAAmC;;;;CAI9C,CAAA"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Grafaid } from '#lib/grafaid/index';
|
3
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
4
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
5
|
-
import { useParams } from 'react-router';
|
6
|
-
import { Field } from '../components/Field.js';
|
7
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type)
|
16
|
-
return `Could not find type ${params.type}`;
|
17
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
18
|
-
return `Type ${params.type} does not have fields`;
|
19
|
-
}
|
20
|
-
const fields = type.getFields();
|
21
|
-
const field = fields[params.field];
|
22
|
-
if (!field) {
|
23
|
-
return `Could not find field ${params.field} on type ${params.type}`;
|
24
|
-
}
|
25
|
-
return _jsx(Field, { data: field });
|
26
|
-
};
|
27
|
-
export const referenceVersion$version$type$field = createRoute({
|
28
|
-
id: `reference-version-type-field`,
|
29
|
-
path: `:field`,
|
30
|
-
Component,
|
31
|
-
});
|
32
|
-
//# sourceMappingURL=reference.version.$version.$type.$field.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.$field.js","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.$field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAG9D,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAsD,CAAA;IAC9E,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAO,uBAAuB,MAAM,CAAC,IAAI,EAAE,CAAA;IACtD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,OAAO,QAAQ,MAAM,CAAC,IAAI,uBAAuB,CAAA;IACnD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,wBAAwB,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,IAAI,EAAE,CAAA;IACtE,CAAC;IAED,OAAO,KAAC,KAAK,IAAC,IAAI,EAAE,KAAK,GAAI,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAG,WAAW,CAAC;IAC7D,EAAE,EAAE,8BAA8B;IAClC,IAAI,EAAE,QAAQ;IACd,SAAS;CACV,CAAC,CAAA"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
export declare const referenceVersion$version$type: {
|
2
|
-
id: string;
|
3
|
-
path: string;
|
4
|
-
Component: () => import("react/jsx-runtime").JSX.Element;
|
5
|
-
children: {
|
6
|
-
id: string;
|
7
|
-
path: string;
|
8
|
-
Component: () => string | import("react/jsx-runtime").JSX.Element;
|
9
|
-
}[];
|
10
|
-
};
|
11
|
-
//# sourceMappingURL=reference.version.$version.$type.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,6BAA6B;;;;;;;;;CAKxC,CAAA"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
4
|
-
import { useParams } from 'react-router';
|
5
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
6
|
-
import { NamedType } from '../components/NamedType.js';
|
7
|
-
import { referenceVersion$version$type$field } from './reference.version.$version.$type.$field.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type) {
|
16
|
-
return _jsxs("div", { children: ["Type not found: ", params.type] });
|
17
|
-
}
|
18
|
-
return _jsx(NamedType, { data: type });
|
19
|
-
};
|
20
|
-
export const referenceVersion$version$type = createRoute({
|
21
|
-
id: `reference-version-type`,
|
22
|
-
path: `:type`,
|
23
|
-
Component,
|
24
|
-
children: [referenceVersion$version$type$field],
|
25
|
-
});
|
26
|
-
//# sourceMappingURL=reference.version.$version.$type.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.js","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAA;AAElG,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAuC,CAAA;IAE/D,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,8CAAsB,MAAM,CAAC,IAAI,IAAO,CAAA;IACjD,CAAC;IAED,OAAO,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;IACvD,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,OAAO;IACb,SAAS;IACT,QAAQ,EAAE,CAAC,mCAAmC,CAAC;CAChD,CAAC,CAAA"}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import { Grafaid } from '#lib/grafaid/index'
|
2
|
-
import { ReactRouterAid } from '#lib/react-router-aid/index'
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
4
|
-
import { useParams } from 'react-router'
|
5
|
-
import { Field } from '../components/Field.js'
|
6
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
7
|
-
import type { reference } from './reference.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string; field: string }
|
11
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
12
|
-
if (!data.schema) {
|
13
|
-
return <MissingSchema />
|
14
|
-
}
|
15
|
-
|
16
|
-
const type = data.schema.getType(params.type)
|
17
|
-
if (!type) return `Could not find type ${params.type}`
|
18
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
19
|
-
return `Type ${params.type} does not have fields`
|
20
|
-
}
|
21
|
-
|
22
|
-
const fields = type.getFields()
|
23
|
-
const field = fields[params.field]
|
24
|
-
if (!field) {
|
25
|
-
return `Could not find field ${params.field} on type ${params.type}`
|
26
|
-
}
|
27
|
-
|
28
|
-
return <Field data={field} />
|
29
|
-
}
|
30
|
-
|
31
|
-
export const reference$type$field = ReactRouterAid.createRoute({
|
32
|
-
path: `:field`,
|
33
|
-
Component,
|
34
|
-
})
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
2
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
|
-
import { useParams } from 'react-router'
|
4
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
5
|
-
import { NamedType } from '../components/NamedType.js'
|
6
|
-
import { reference$type$field } from './reference.$type.$field.js'
|
7
|
-
import type { reference } from './reference.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string }
|
11
|
-
|
12
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
13
|
-
if (!data.schema) {
|
14
|
-
return <MissingSchema />
|
15
|
-
}
|
16
|
-
|
17
|
-
const type = data.schema.getType(params.type)
|
18
|
-
if (!type) {
|
19
|
-
return `Could not find type ${params.type}`
|
20
|
-
}
|
21
|
-
|
22
|
-
return <NamedType data={type} />
|
23
|
-
}
|
24
|
-
|
25
|
-
export const reference$type = createRoute({
|
26
|
-
path: `:type`,
|
27
|
-
Component,
|
28
|
-
children: [reference$type$field],
|
29
|
-
})
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import { Grafaid } from '#lib/grafaid/index'
|
2
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
4
|
-
import { useParams } from 'react-router'
|
5
|
-
import { Field } from '../components/Field.js'
|
6
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
7
|
-
import type { reference } from './reference.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string; field: string; version: string }
|
11
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
12
|
-
if (!data.schema) {
|
13
|
-
return <MissingSchema />
|
14
|
-
}
|
15
|
-
|
16
|
-
const type = data.schema.getType(params.type)
|
17
|
-
if (!type) return `Could not find type ${params.type}`
|
18
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
19
|
-
return `Type ${params.type} does not have fields`
|
20
|
-
}
|
21
|
-
|
22
|
-
const fields = type.getFields()
|
23
|
-
const field = fields[params.field]
|
24
|
-
if (!field) {
|
25
|
-
return `Could not find field ${params.field} on type ${params.type}`
|
26
|
-
}
|
27
|
-
|
28
|
-
return <Field data={field} />
|
29
|
-
}
|
30
|
-
|
31
|
-
export const referenceVersion$version$type$field = createRoute({
|
32
|
-
id: `reference-version-type-field`,
|
33
|
-
path: `:field`,
|
34
|
-
Component,
|
35
|
-
})
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
2
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
|
-
import { useParams } from 'react-router'
|
4
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
5
|
-
import { NamedType } from '../components/NamedType.js'
|
6
|
-
import type { reference } from './reference.js'
|
7
|
-
import { referenceVersion$version$type$field } from './reference.version.$version.$type.$field.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string; version: string }
|
11
|
-
|
12
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
13
|
-
if (!data.schema) {
|
14
|
-
return <MissingSchema />
|
15
|
-
}
|
16
|
-
|
17
|
-
const type = data.schema.getType(params.type)
|
18
|
-
if (!type) {
|
19
|
-
return <div>Type not found: {params.type}</div>
|
20
|
-
}
|
21
|
-
|
22
|
-
return <NamedType data={type} />
|
23
|
-
}
|
24
|
-
|
25
|
-
export const referenceVersion$version$type = createRoute({
|
26
|
-
id: `reference-version-type`,
|
27
|
-
path: `:type`,
|
28
|
-
Component,
|
29
|
-
children: [referenceVersion$version$type$field],
|
30
|
-
})
|