polen 0.11.0-next.16 → 0.11.0-next.17
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/examples/diagnostic/diagnostic.d.ts +4 -4
- package/build/api/examples/diagnostic/missing-versions.d.ts +5 -4
- package/build/api/examples/diagnostic/missing-versions.d.ts.map +1 -1
- package/build/api/examples/diagnostic/missing-versions.js +3 -2
- package/build/api/examples/diagnostic/missing-versions.js.map +1 -1
- package/build/api/examples/diagnostic/unknown-version.d.ts +5 -4
- package/build/api/examples/diagnostic/unknown-version.d.ts.map +1 -1
- package/build/api/examples/diagnostic/unknown-version.js +3 -2
- package/build/api/examples/diagnostic/unknown-version.js.map +1 -1
- package/build/api/examples/diagnostic/validator.d.ts.map +1 -1
- package/build/api/examples/diagnostic/validator.js +7 -8
- package/build/api/examples/diagnostic/validator.js.map +1 -1
- package/build/api/examples/scanner.d.ts.map +1 -1
- package/build/api/examples/scanner.js +20 -16
- package/build/api/examples/scanner.js.map +1 -1
- package/build/api/examples/type-usage-indexer.d.ts.map +1 -1
- package/build/api/examples/type-usage-indexer.js +4 -5
- package/build/api/examples/type-usage-indexer.js.map +1 -1
- package/build/api/schema/input-sources/versioned-directory.d.ts +3 -3
- package/build/api/schema/input-sources/versioned-directory.d.ts.map +1 -1
- package/build/api/schema/input-sources/versioned-directory.js +4 -2
- package/build/api/schema/input-sources/versioned-directory.js.map +1 -1
- package/build/api/schema/load.js +1 -1
- package/build/api/schema/load.js.map +1 -1
- package/build/cli/commands/hero-image.js +1 -1
- package/build/cli/commands/hero-image.js.map +1 -1
- package/build/lib/catalog/catalog.d.ts +24 -23
- package/build/lib/catalog/catalog.d.ts.map +1 -1
- package/build/lib/catalog/catalog.js +7 -13
- package/build/lib/catalog/catalog.js.map +1 -1
- package/build/lib/catalog/versioned.d.ts +36 -26
- package/build/lib/catalog/versioned.d.ts.map +1 -1
- package/build/lib/catalog/versioned.js +25 -6
- package/build/lib/catalog/versioned.js.map +1 -1
- package/build/lib/catalog-statistics/analyze-catalog.js +3 -3
- package/build/lib/catalog-statistics/analyze-catalog.js.map +1 -1
- package/build/lib/lifecycles/lifecycles.js +1 -1
- package/build/lib/lifecycles/lifecycles.js.map +1 -1
- package/build/template/components/Changelog/Changelog.d.ts.map +1 -1
- package/build/template/components/Changelog/Changelog.js +7 -7
- package/build/template/components/Changelog/Changelog.js.map +1 -1
- package/build/template/components/GraphQLDocument.js +6 -5
- package/build/template/components/GraphQLDocument.js.map +1 -1
- package/build/template/components/VersionPicker.d.ts.map +1 -1
- package/build/template/components/VersionPicker.js +5 -2
- package/build/template/components/VersionPicker.js.map +1 -1
- package/build/template/components/home/FeaturesGrid.js +1 -1
- package/build/template/components/home/FeaturesGrid.js.map +1 -1
- package/build/template/components/home/HeroSection.js +1 -1
- package/build/template/components/home/HeroSection.js.map +1 -1
- package/build/template/components/home/RecentChanges.d.ts.map +1 -1
- package/build/template/components/home/RecentChanges.js +2 -1
- package/build/template/components/home/RecentChanges.js.map +1 -1
- package/build/template/routes/changelog.d.ts +1 -1
- package/build/template/routes/changelog.d.ts.map +1 -1
- package/build/template/routes/changelog.js +7 -4
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/examples/_index.js +1 -1
- package/build/template/routes/examples/_index.js.map +1 -1
- package/build/template/routes/reference.js +6 -6
- package/build/template/routes/reference.js.map +1 -1
- package/build/vite/plugins/navbar.js +1 -1
- package/build/vite/plugins/navbar.js.map +1 -1
- package/build/vite/plugins/routes-manifest.js +1 -1
- package/build/vite/plugins/routes-manifest.js.map +1 -1
- package/package.json +1 -1
- package/src/api/examples/diagnostic/missing-versions.ts +3 -2
- package/src/api/examples/diagnostic/unknown-version.ts +3 -2
- package/src/api/examples/diagnostic/validator.test.ts +70 -55
- package/src/api/examples/diagnostic/validator.ts +7 -9
- package/src/api/examples/scanner.ts +25 -20
- package/src/api/examples/type-usage-indexer.test.ts +44 -33
- package/src/api/examples/type-usage-indexer.ts +4 -7
- package/src/api/schema/$.test.ts +2 -2
- package/src/api/schema/input-sources/versioned-directory.ts +7 -2
- package/src/api/schema/load.ts +1 -1
- package/src/cli/commands/hero-image.ts +1 -1
- package/src/lib/catalog/catalog.ts +7 -13
- package/src/lib/catalog/versioned.ts +35 -6
- package/src/lib/catalog-statistics/$.test.ts +22 -12
- package/src/lib/catalog-statistics/analyze-catalog.ts +3 -3
- package/src/lib/lifecycles/lifecycles.ts +1 -1
- package/src/template/components/Changelog/Changelog.tsx +10 -6
- package/src/template/components/GraphQLDocument.tsx +6 -5
- package/src/template/components/VersionPicker.tsx +9 -2
- package/src/template/components/home/FeaturesGrid.tsx +1 -1
- package/src/template/components/home/HeroSection.tsx +1 -1
- package/src/template/components/home/RecentChanges.tsx +3 -1
- package/src/template/routes/changelog.tsx +10 -4
- package/src/template/routes/examples/_index.tsx +1 -1
- package/src/template/routes/reference.tsx +6 -6
- package/src/vite/plugins/navbar.ts +1 -1
- package/src/vite/plugins/routes-manifest.ts +1 -1
@@ -1,6 +1,8 @@
|
|
1
1
|
import { Api } from '#api/iso'
|
2
2
|
import type { React } from '#dep/react/index'
|
3
|
+
import { Catalog } from '#lib/catalog/$'
|
3
4
|
import { Version } from '#lib/version/$'
|
5
|
+
import { HashMap, Option } from 'effect'
|
4
6
|
import { useNavigate } from 'react-router'
|
5
7
|
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
6
8
|
import { useReferencePath } from '../hooks/useReferencePath.js'
|
@@ -33,12 +35,17 @@ export const VersionPicker: React.FC<Props> = ({ data, current }) => {
|
|
33
35
|
|
34
36
|
// Find the schema for the target version
|
35
37
|
// Note: newVersion is a string that we need to parse
|
36
|
-
const
|
38
|
+
const targetSchemaOption = Option.map(
|
39
|
+
HashMap.findFirst(catalog.entries, (_, key) => Version.encodeSync(key) === newVersion),
|
40
|
+
([, value]) => value,
|
41
|
+
)
|
37
42
|
|
38
|
-
if (
|
43
|
+
if (Option.isNone(targetSchemaOption)) {
|
39
44
|
throw new Error(`Version ${newVersion} not found`)
|
40
45
|
}
|
41
46
|
|
47
|
+
const targetSchema = Option.getOrThrow(targetSchemaOption)
|
48
|
+
|
42
49
|
// Find fallback path if needed
|
43
50
|
const fallbackPath = Api.Schema.Validation.findFallbackPath(targetSchema.definition, currentPath)
|
44
51
|
// Get redirect description if path changed
|
@@ -80,7 +80,7 @@ function getDefaultFeatures(): Feature[] {
|
|
80
80
|
if (schemasCatalog) {
|
81
81
|
try {
|
82
82
|
// Get the latest schema from the catalog
|
83
|
-
const latestSchema = Catalog.
|
83
|
+
const latestSchema = Catalog.getLatest(schemasCatalog)
|
84
84
|
|
85
85
|
if (latestSchema && latestSchema.definition) {
|
86
86
|
// Build stats from the schema definition
|
@@ -84,7 +84,7 @@ export const Hero: React.FC<HeroProps> = ({
|
|
84
84
|
let schemaStats = null
|
85
85
|
if (schemasCatalog) {
|
86
86
|
try {
|
87
|
-
const latestSchema = Catalog.
|
87
|
+
const latestSchema = Catalog.getLatest(schemasCatalog)
|
88
88
|
if (latestSchema && latestSchema.definition) {
|
89
89
|
const versionStats = CatalogStatistics.analyzeSchema(latestSchema.definition, 'current')
|
90
90
|
schemaStats = {
|
@@ -3,6 +3,8 @@ import * as React from 'react'
|
|
3
3
|
import { Link } from 'react-router'
|
4
4
|
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
5
5
|
|
6
|
+
import { Catalog } from '#lib/catalog'
|
7
|
+
|
6
8
|
interface RecentChangesProps {
|
7
9
|
limit?: number
|
8
10
|
showVersions?: boolean
|
@@ -30,7 +32,7 @@ export const RecentChangesSection: React.FC<RecentChangesProps> = ({
|
|
30
32
|
|
31
33
|
// For versioned catalogs, we look at entries
|
32
34
|
if (schemasCatalog._tag === 'CatalogVersioned') {
|
33
|
-
const entries = schemasCatalog
|
35
|
+
const entries = Catalog.Versioned.getAll(schemasCatalog)
|
34
36
|
const recentEntries = entries.slice(0, limit)
|
35
37
|
|
36
38
|
return recentEntries.flatMap(entry =>
|
@@ -6,7 +6,7 @@ import { Revision } from '#lib/revision'
|
|
6
6
|
import { Swiss } from '#lib/swiss'
|
7
7
|
import { Version } from '#lib/version'
|
8
8
|
import { Box, Flex, Text } from '@radix-ui/themes'
|
9
|
-
import { Effect } from 'effect'
|
9
|
+
import { Effect, HashMap, Option } from 'effect'
|
10
10
|
import React, { useEffect, useMemo, useState } from 'react'
|
11
11
|
import { useParams } from 'react-router'
|
12
12
|
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
@@ -136,7 +136,7 @@ const Component = () => {
|
|
136
136
|
// Get available versions if catalog is versioned
|
137
137
|
const availableVersions = useMemo(() => {
|
138
138
|
if (Catalog.Versioned.is(catalog)) {
|
139
|
-
return catalog.
|
139
|
+
return Catalog.Versioned.getVersions(catalog).map(Version.encodeSync)
|
140
140
|
}
|
141
141
|
return []
|
142
142
|
}, [catalog])
|
@@ -148,8 +148,14 @@ const Component = () => {
|
|
148
148
|
} else {
|
149
149
|
// For versioned catalogs, show only current version's revisions
|
150
150
|
if (urlVersion) {
|
151
|
-
const
|
152
|
-
|
151
|
+
const entryOption = Option.map(
|
152
|
+
HashMap.findFirst(catalog.entries, (_, key) => Version.encodeSync(key) === urlVersion),
|
153
|
+
([, value]) => value,
|
154
|
+
)
|
155
|
+
return Option.match(entryOption, {
|
156
|
+
onNone: () => [],
|
157
|
+
onSome: (entry) => entry.revisions,
|
158
|
+
})
|
153
159
|
}
|
154
160
|
// No revisions if no version selected (will redirect)
|
155
161
|
return []
|
@@ -36,7 +36,7 @@ export const loader = async () => {
|
|
36
36
|
|
37
37
|
const Component = () => {
|
38
38
|
const examplesCatalog = useLoaderData(IndexSchema)
|
39
|
-
const schema = schemasCatalog && Catalog.
|
39
|
+
const schema = schemasCatalog && Catalog.getLatest(schemasCatalog).definition
|
40
40
|
const hasExamples = examplesCatalog && examplesCatalog.examples.length > 0
|
41
41
|
|
42
42
|
// TODO: This should become a proper diagnostic viewer component that displays
|
@@ -6,10 +6,10 @@ import { S } from '#lib/kit-temp/effect'
|
|
6
6
|
import { Lifecycles } from '#lib/lifecycles/$'
|
7
7
|
import { route, useLoaderData } from '#lib/react-router-effect/react-router-effect'
|
8
8
|
import { Schema } from '#lib/schema/$'
|
9
|
-
import { Swiss } from '#lib/swiss'
|
10
9
|
import { Version } from '#lib/version/$'
|
11
10
|
import { Flex } from '@radix-ui/themes'
|
12
11
|
import { neverCase } from '@wollybeard/kit/language'
|
12
|
+
import { HashMap, Option } from 'effect'
|
13
13
|
import { Effect, Match } from 'effect'
|
14
14
|
import React from 'react'
|
15
15
|
import { useParams } from 'react-router'
|
@@ -49,15 +49,15 @@ const referenceLoader = ({ params }: any) => {
|
|
49
49
|
// If version param provided, find that specific version
|
50
50
|
if (params.version) {
|
51
51
|
const requestedVersion = Version.decodeSync(params.version)
|
52
|
-
const
|
53
|
-
if (
|
52
|
+
const foundOption = HashMap.get(c.entries, requestedVersion)
|
53
|
+
if (Option.isNone(foundOption)) {
|
54
54
|
// TODO: Return 404 error
|
55
55
|
throw new Error(`Version ${params.version} not found`)
|
56
56
|
}
|
57
|
-
return
|
57
|
+
return Option.getOrThrow(foundOption)
|
58
58
|
}
|
59
59
|
// No version param means "latest" - use the last entry
|
60
|
-
const latest =
|
60
|
+
const latest = Catalog.Versioned.getLatestOrThrow(c)
|
61
61
|
if (!latest) {
|
62
62
|
throw new Error('No schemas available in versioned catalog')
|
63
63
|
}
|
@@ -161,7 +161,7 @@ const ReferenceView = () => {
|
|
161
161
|
return catalog._tag === 'CatalogVersioned' && version
|
162
162
|
? (
|
163
163
|
<VersionPicker
|
164
|
-
data={
|
164
|
+
data={Catalog.Versioned.getVersions(catalog)}
|
165
165
|
current={version}
|
166
166
|
/>
|
167
167
|
)
|
@@ -59,7 +59,7 @@ export const Navbar = ({
|
|
59
59
|
const hasMultipleRevisions = Catalog.fold(
|
60
60
|
(versioned) => {
|
61
61
|
// For versioned catalogs, count total revisions across all entries
|
62
|
-
const totalRevisions = versioned.
|
62
|
+
const totalRevisions = Catalog.Versioned.getAll(versioned).reduce(
|
63
63
|
(sum: number, entry) => sum + entry.revisions.length,
|
64
64
|
0,
|
65
65
|
)
|
@@ -100,7 +100,7 @@ function processVersionedCatalog(
|
|
100
100
|
catalog: Catalog.Versioned.Versioned,
|
101
101
|
routes: string[],
|
102
102
|
): void {
|
103
|
-
for (const schema of catalog
|
103
|
+
for (const schema of Catalog.Versioned.getAll(catalog)) {
|
104
104
|
const version = schema.version
|
105
105
|
routes.push(`/reference/version/${version}`)
|
106
106
|
|