polen 0.11.0-next.16 → 0.11.0-next.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/builder/ssg/generate.d.ts.map +1 -1
- package/build/api/builder/ssg/generate.js +5 -5
- package/build/api/builder/ssg/generate.js.map +1 -1
- package/build/api/builder/ssg/page-generator.worker.js +13 -3
- package/build/api/builder/ssg/page-generator.worker.js.map +1 -1
- package/build/api/config/input.d.ts +88 -3
- package/build/api/config/input.d.ts.map +1 -1
- package/build/api/config/normalized.d.ts +92 -7
- package/build/api/config/normalized.d.ts.map +1 -1
- package/build/api/config/normalized.js +11 -3
- package/build/api/config/normalized.js.map +1 -1
- package/build/api/config-template/template.js +2 -2
- package/build/api/config-template/template.js.map +1 -1
- package/build/api/content/sidebar.d.ts.map +1 -1
- package/build/api/content/sidebar.js +2 -1
- package/build/api/content/sidebar.js.map +1 -1
- package/build/api/examples/config.d.ts +366 -3
- package/build/api/examples/config.d.ts.map +1 -1
- package/build/api/examples/config.js +25 -3
- package/build/api/examples/config.js.map +1 -1
- package/build/api/examples/diagnostic/diagnostic.d.ts +5 -5
- 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/validation-error.d.ts +3 -2
- package/build/api/examples/diagnostic/validation-error.d.ts.map +1 -1
- package/build/api/examples/diagnostic/validation-error.js +9 -3
- package/build/api/examples/diagnostic/validation-error.js.map +1 -1
- package/build/api/examples/diagnostic/validator.d.ts.map +1 -1
- package/build/api/examples/diagnostic/validator.js +115 -69
- package/build/api/examples/diagnostic/validator.js.map +1 -1
- package/build/api/examples/filter.d.ts.map +1 -1
- package/build/api/examples/filter.js +9 -6
- package/build/api/examples/filter.js.map +1 -1
- package/build/api/examples/scanner.d.ts.map +1 -1
- package/build/api/examples/scanner.js +93 -103
- package/build/api/examples/scanner.js.map +1 -1
- package/build/api/examples/type-usage-indexer.d.ts.map +1 -1
- package/build/api/examples/type-usage-indexer.js +18 -32
- package/build/api/examples/type-usage-indexer.js.map +1 -1
- package/build/api/iso/schema/routing.d.ts.map +1 -1
- package/build/api/iso/schema/routing.js +8 -8
- package/build/api/iso/schema/routing.js.map +1 -1
- package/build/api/iso/schema/validation.d.ts.map +1 -1
- package/build/api/iso/schema/validation.js +3 -2
- package/build/api/iso/schema/validation.js.map +1 -1
- package/build/api/schema/input-sources/directory.js +2 -2
- package/build/api/schema/input-sources/directory.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 +6 -4
- package/build/api/schema/input-sources/versioned-directory.js.map +1 -1
- package/build/api/schema/load.d.ts.map +1 -1
- package/build/api/schema/load.js +2 -2
- 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 +65 -24
- package/build/lib/catalog/catalog.d.ts.map +1 -1
- package/build/lib/catalog/catalog.js +72 -16
- package/build/lib/catalog/catalog.js.map +1 -1
- package/build/lib/catalog/versioned.d.ts +46 -26
- package/build/lib/catalog/versioned.d.ts.map +1 -1
- package/build/lib/catalog/versioned.js +44 -7
- 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/document/document.d.ts +55 -5
- package/build/lib/document/document.d.ts.map +1 -1
- package/build/lib/document/document.js +96 -2
- package/build/lib/document/document.js.map +1 -1
- package/build/lib/document/versioned.d.ts +2 -2
- package/build/lib/document/versioned.d.ts.map +1 -1
- package/build/lib/document/versioned.js +7 -7
- package/build/lib/document/versioned.js.map +1 -1
- package/build/lib/lifecycles/lifecycles.d.ts +5 -4
- package/build/lib/lifecycles/lifecycles.d.ts.map +1 -1
- package/build/lib/lifecycles/lifecycles.js +15 -13
- package/build/lib/lifecycles/lifecycles.js.map +1 -1
- package/build/lib/version-coverage/$$.d.ts +2 -0
- package/build/lib/version-coverage/$$.d.ts.map +1 -0
- package/build/lib/version-coverage/$$.js +2 -0
- package/build/lib/version-coverage/$$.js.map +1 -0
- package/build/lib/version-coverage/$.d.ts.map +1 -0
- package/build/lib/version-coverage/$.js.map +1 -0
- package/build/lib/{version-selection/version-selection.d.ts → version-coverage/version-coverage.d.ts} +1 -1
- package/build/lib/version-coverage/version-coverage.d.ts.map +1 -0
- package/build/lib/{version-selection/version-selection.js → version-coverage/version-coverage.js} +2 -2
- package/build/lib/version-coverage/version-coverage.js.map +1 -0
- package/build/template/components/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.d.ts +1 -1
- package/build/template/components/GraphQLDocument.d.ts.map +1 -1
- package/build/template/components/GraphQLDocument.js +10 -38
- package/build/template/components/GraphQLDocument.js.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts +28 -0
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.js +60 -27
- package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
- package/build/template/components/VersionCoveragePicker.d.ts +1 -1
- package/build/template/components/VersionCoveragePicker.d.ts.map +1 -1
- package/build/template/components/VersionCoveragePicker.js +4 -6
- package/build/template/components/VersionCoveragePicker.js.map +1 -1
- package/build/template/components/VersionPicker.d.ts.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/QuickStart.d.ts.map +1 -1
- package/build/template/components/home/QuickStart.js +8 -4
- package/build/template/components/home/QuickStart.js.map +1 -1
- package/build/template/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/hooks/use-highlighted.d.ts.map +1 -1
- package/build/template/hooks/use-highlighted.js +19 -13
- package/build/template/hooks/use-highlighted.js.map +1 -1
- package/build/template/lib/fetch-text.d.ts +18 -0
- package/build/template/lib/fetch-text.d.ts.map +1 -1
- package/build/template/lib/fetch-text.js +32 -4
- package/build/template/lib/fetch-text.js.map +1 -1
- package/build/template/routes/changelog.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/examples/name.d.ts.map +1 -1
- package/build/template/routes/examples/name.js +4 -2
- package/build/template/routes/examples/name.js.map +1 -1
- package/build/template/routes/reference.js +6 -6
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/stores/toast.d.ts.map +1 -1
- package/build/template/stores/toast.js +5 -3
- package/build/template/stores/toast.js.map +1 -1
- package/build/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 +7 -7
- package/src/api/builder/ssg/generate.ts +10 -5
- package/src/api/builder/ssg/page-generator.worker.ts +18 -3
- package/src/api/config/normalized.ts +12 -3
- package/src/api/config-template/template.ts +2 -2
- package/src/api/content/sidebar.ts +3 -3
- package/src/api/examples/config.test.ts +10 -0
- package/src/api/examples/config.ts +33 -4
- 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/validation-error.ts +9 -3
- package/src/api/examples/diagnostic/validator.test.ts +100 -55
- package/src/api/examples/diagnostic/validator.ts +148 -105
- package/src/api/examples/filter.ts +9 -6
- package/src/api/examples/scanner.ts +144 -120
- package/src/api/examples/type-usage-indexer.test.ts +44 -33
- package/src/api/examples/type-usage-indexer.ts +25 -40
- package/src/api/iso/schema/routing.ts +10 -10
- package/src/api/iso/schema/validation.ts +3 -2
- package/src/api/schema/$.test.ts +2 -2
- package/src/api/schema/input-sources/directory.ts +2 -2
- package/src/api/schema/input-sources/versioned-directory.ts +11 -8
- package/src/api/schema/load.ts +2 -2
- package/src/cli/commands/hero-image.ts +1 -1
- package/src/lib/catalog/catalog.ts +93 -16
- package/src/lib/catalog/versioned.ts +57 -7
- package/src/lib/catalog-statistics/$.test.ts +22 -12
- package/src/lib/catalog-statistics/analyze-catalog.ts +3 -3
- package/src/lib/document/document.ts +135 -2
- package/src/lib/document/versioned.ts +8 -8
- package/src/lib/lifecycles/lifecycles.ts +33 -28
- package/src/lib/version-coverage/$$.ts +1 -0
- package/src/lib/{version-selection/version-selection.ts → version-coverage/version-coverage.ts} +1 -1
- package/src/template/components/Changelog/Changelog.tsx +10 -6
- package/src/template/components/GraphQLDocument.tsx +11 -68
- package/src/template/components/GraphQLInteractive/lib/parser.ts +81 -29
- package/src/template/components/VersionCoveragePicker.tsx +4 -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/QuickStart.tsx +16 -7
- package/src/template/components/home/RecentChanges.tsx +3 -1
- package/src/template/hooks/use-highlighted.ts +31 -19
- package/src/template/lib/fetch-text.ts +45 -4
- package/src/template/routes/changelog.tsx +10 -4
- package/src/template/routes/examples/_index.tsx +1 -1
- package/src/template/routes/examples/name.tsx +4 -2
- package/src/template/routes/reference.tsx +6 -6
- package/src/template/stores/toast.ts +6 -3
- package/src/vite/plugins/navbar.ts +1 -1
- package/src/vite/plugins/routes-manifest.ts +1 -1
- package/build/lib/graph/$$.d.ts +0 -2
- package/build/lib/graph/$$.d.ts.map +0 -1
- package/build/lib/graph/$$.js +0 -2
- package/build/lib/graph/$$.js.map +0 -1
- package/build/lib/graph/$.d.ts +0 -2
- package/build/lib/graph/$.d.ts.map +0 -1
- package/build/lib/graph/$.js +0 -2
- package/build/lib/graph/$.js.map +0 -1
- package/build/lib/graph/graph.d.ts +0 -127
- package/build/lib/graph/graph.d.ts.map +0 -1
- package/build/lib/graph/graph.js +0 -152
- package/build/lib/graph/graph.js.map +0 -1
- package/build/lib/mask/$$.d.ts +0 -3
- package/build/lib/mask/$$.d.ts.map +0 -1
- package/build/lib/mask/$$.js +0 -3
- package/build/lib/mask/$$.js.map +0 -1
- package/build/lib/mask/$.d.ts +0 -2
- package/build/lib/mask/$.d.ts.map +0 -1
- package/build/lib/mask/$.js +0 -2
- package/build/lib/mask/$.js.map +0 -1
- package/build/lib/mask/apply.d.ts +0 -86
- package/build/lib/mask/apply.d.ts.map +0 -1
- package/build/lib/mask/apply.js +0 -86
- package/build/lib/mask/apply.js.map +0 -1
- package/build/lib/mask/mask.d.ts +0 -124
- package/build/lib/mask/mask.d.ts.map +0 -1
- package/build/lib/mask/mask.js +0 -137
- package/build/lib/mask/mask.js.map +0 -1
- package/build/lib/mask/mask.test-d.d.ts +0 -2
- package/build/lib/mask/mask.test-d.d.ts.map +0 -1
- package/build/lib/mask/mask.test-d.js +0 -102
- package/build/lib/mask/mask.test-d.js.map +0 -1
- package/build/lib/version-selection/$$.d.ts +0 -2
- package/build/lib/version-selection/$$.d.ts.map +0 -1
- package/build/lib/version-selection/$$.js +0 -2
- package/build/lib/version-selection/$$.js.map +0 -1
- package/build/lib/version-selection/$.d.ts.map +0 -1
- package/build/lib/version-selection/$.js.map +0 -1
- package/build/lib/version-selection/version-selection.d.ts.map +0 -1
- package/build/lib/version-selection/version-selection.js.map +0 -1
- package/src/lib/graph/$$.ts +0 -1
- package/src/lib/graph/$.ts +0 -1
- package/src/lib/graph/graph.ts +0 -197
- package/src/lib/mask/$$.ts +0 -2
- package/src/lib/mask/$.test.ts +0 -226
- package/src/lib/mask/$.ts +0 -1
- package/src/lib/mask/apply.ts +0 -134
- package/src/lib/mask/mask.test-d.ts +0 -156
- package/src/lib/mask/mask.ts +0 -244
- package/src/lib/version-selection/$$.ts +0 -1
- /package/build/lib/{version-selection → version-coverage}/$.d.ts +0 -0
- /package/build/lib/{version-selection → version-coverage}/$.js +0 -0
- /package/src/lib/{version-selection → version-coverage}/$.ts +0 -0
@@ -1,13 +1,54 @@
|
|
1
|
+
import { Either } from 'effect'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Error type for fetch failures
|
5
|
+
*/
|
6
|
+
export interface FetchError {
|
7
|
+
readonly _tag: 'FetchError'
|
8
|
+
readonly url: string
|
9
|
+
readonly status: number
|
10
|
+
readonly statusText: string
|
11
|
+
readonly message: string
|
12
|
+
}
|
13
|
+
|
14
|
+
const makeFetchError = (url: string, status: number, statusText: string): FetchError => ({
|
15
|
+
_tag: 'FetchError',
|
16
|
+
url,
|
17
|
+
status,
|
18
|
+
statusText,
|
19
|
+
message: `Failed to fetch: ${url} (${status} ${statusText})`,
|
20
|
+
})
|
21
|
+
|
1
22
|
/**
|
2
23
|
* Fetch text content from a URL
|
3
24
|
* @param url - The URL to fetch from
|
25
|
+
* @returns Either with text content on right or FetchError on left
|
26
|
+
*/
|
27
|
+
export const fetchTextEither = async (url: string): Promise<Either.Either<string, FetchError>> => {
|
28
|
+
try {
|
29
|
+
const response = await fetch(url)
|
30
|
+
if (!response.ok) {
|
31
|
+
return Either.left(makeFetchError(url, response.status, response.statusText))
|
32
|
+
}
|
33
|
+
const text = await response.text()
|
34
|
+
return Either.right(text)
|
35
|
+
} catch (error) {
|
36
|
+
// Network errors or other exceptions
|
37
|
+
return Either.left(makeFetchError(url, 0, 'Network Error'))
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Fetch text content from a URL (legacy throwing version)
|
43
|
+
* @param url - The URL to fetch from
|
4
44
|
* @returns Promise that resolves to the text content
|
5
45
|
* @throws Error if the request fails
|
46
|
+
* @deprecated Use fetchTextEither for better error handling
|
6
47
|
*/
|
7
48
|
export const fetchText = async (url: string): Promise<string> => {
|
8
|
-
const
|
9
|
-
if (
|
10
|
-
throw new Error(
|
49
|
+
const result = await fetchTextEither(url)
|
50
|
+
if (Either.isLeft(result)) {
|
51
|
+
throw new Error(result.left.message)
|
11
52
|
}
|
12
|
-
return
|
53
|
+
return result.right
|
13
54
|
}
|
@@ -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
|
@@ -4,6 +4,7 @@ import { useLoaderData } from '#lib/react-router-effect/use-loader-data'
|
|
4
4
|
import { Version } from '#lib/version/$'
|
5
5
|
import { Heading } from '@radix-ui/themes'
|
6
6
|
import { Str } from '@wollybeard/kit'
|
7
|
+
import { Array, Option } from 'effect'
|
7
8
|
import { useSearchParams } from 'react-router'
|
8
9
|
import { examplesCatalog } from 'virtual:polen/project/examples'
|
9
10
|
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
@@ -23,10 +24,11 @@ export const nameLoader = async ({ params }: any) => {
|
|
23
24
|
}
|
24
25
|
|
25
26
|
// Check if the example exists
|
26
|
-
const
|
27
|
-
if (
|
27
|
+
const exampleOption = Array.findFirst(examplesCatalog.examples, (e) => e.name === name)
|
28
|
+
if (Option.isNone(exampleOption)) {
|
28
29
|
throw new Response('Not Found', { status: 404 })
|
29
30
|
}
|
31
|
+
const example = exampleOption.value
|
30
32
|
|
31
33
|
return example
|
32
34
|
}
|
@@ -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
|
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Schema as S } from 'effect'
|
1
|
+
import { Duration, Schema as S } from 'effect'
|
2
2
|
import { proxy } from 'valtio'
|
3
3
|
|
4
4
|
// ============================================================================
|
@@ -68,8 +68,10 @@ export const initialState: State = {
|
|
68
68
|
toasts: [],
|
69
69
|
}
|
70
70
|
|
71
|
+
const DEFAULT_TOAST_DURATION = Duration.seconds(5)
|
72
|
+
|
71
73
|
const toastDefaults = {
|
72
|
-
duration:
|
74
|
+
duration: Duration.toMillis(DEFAULT_TOAST_DURATION),
|
73
75
|
actions: [],
|
74
76
|
} satisfies Partial<Toast>
|
75
77
|
|
@@ -96,7 +98,8 @@ export const store = proxy({
|
|
96
98
|
|
97
99
|
// Auto-remove after duration (default 5 seconds). Set duration to 0 to disable auto-dismiss
|
98
100
|
if (toast.duration !== 0) {
|
99
|
-
|
101
|
+
const durationMs = toast.duration || toastDefaults.duration
|
102
|
+
setTimeout(() => store.remove(id), durationMs)
|
100
103
|
}
|
101
104
|
|
102
105
|
return id
|
@@ -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
|
|
package/build/lib/graph/$$.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$$.d.ts","sourceRoot":"","sources":["../../../src/lib/graph/$$.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
package/build/lib/graph/$$.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$$.js","sourceRoot":"","sources":["../../../src/lib/graph/$$.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
package/build/lib/graph/$.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/graph/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA"}
|
package/build/lib/graph/$.js
DELETED
package/build/lib/graph/$.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/graph/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA"}
|
@@ -1,127 +0,0 @@
|
|
1
|
-
import { S } from '#lib/kit-temp/effect';
|
2
|
-
/**
|
3
|
-
* Dependency graph for tracking relationships between nodes
|
4
|
-
* Used to efficiently handle dependencies in various contexts
|
5
|
-
*/
|
6
|
-
export declare const DependencyGraph: S.Struct<{
|
7
|
-
/**
|
8
|
-
* Map from parent ID to array of child IDs (parent depends on children)
|
9
|
-
*/
|
10
|
-
dependencies: S.Record$<typeof S.String, S.Array$<typeof S.String>>;
|
11
|
-
/**
|
12
|
-
* Map from child ID to array of parent IDs (child is depended on by parents)
|
13
|
-
*/
|
14
|
-
dependents: S.Record$<typeof S.String, S.Array$<typeof S.String>>;
|
15
|
-
}>;
|
16
|
-
export type DependencyGraph = typeof DependencyGraph.Type;
|
17
|
-
export declare const make: (props: {
|
18
|
-
readonly dependencies: {
|
19
|
-
readonly [x: string]: readonly string[];
|
20
|
-
};
|
21
|
-
readonly dependents: {
|
22
|
-
readonly [x: string]: readonly string[];
|
23
|
-
};
|
24
|
-
}, options?: S.MakeOptions) => {
|
25
|
-
readonly dependencies: {
|
26
|
-
readonly [x: string]: readonly string[];
|
27
|
-
};
|
28
|
-
readonly dependents: {
|
29
|
-
readonly [x: string]: readonly string[];
|
30
|
-
};
|
31
|
-
};
|
32
|
-
/**
|
33
|
-
* Create an empty dependency graph
|
34
|
-
*/
|
35
|
-
export declare const create: () => DependencyGraph;
|
36
|
-
/**
|
37
|
-
* Add a dependency relationship (immutable)
|
38
|
-
* @param graph - The dependency graph
|
39
|
-
* @param parent - The parent node ID
|
40
|
-
* @param child - The child node ID that the parent depends on
|
41
|
-
* @returns A new graph with the dependency added
|
42
|
-
*/
|
43
|
-
export declare const addDependency: (graph: DependencyGraph, parent: string, child: string) => DependencyGraph;
|
44
|
-
/**
|
45
|
-
* Add a dependency relationship (mutable)
|
46
|
-
* @param graph - The dependency graph to mutate
|
47
|
-
* @param parent - The parent node ID
|
48
|
-
* @param child - The child node ID that the parent depends on
|
49
|
-
*/
|
50
|
-
export declare const addDependencyMutable: (graph: DependencyGraph, parent: string, child: string) => void;
|
51
|
-
/**
|
52
|
-
* Find all nodes that have no dependencies (leaf nodes)
|
53
|
-
*/
|
54
|
-
export declare const findLeafNodes: (graph: DependencyGraph) => Set<string>;
|
55
|
-
/**
|
56
|
-
* Check if all dependencies of a node have been processed
|
57
|
-
*/
|
58
|
-
export declare const areDependenciesReady: (node: string, graph: DependencyGraph, processed: Set<string>) => boolean;
|
59
|
-
/**
|
60
|
-
* Get topological ordering of nodes (children before parents)
|
61
|
-
* This ensures we process dependencies before the nodes that depend on them
|
62
|
-
*
|
63
|
-
* @param graph - The dependency graph
|
64
|
-
* @returns Array of node IDs in topological order
|
65
|
-
*/
|
66
|
-
export declare const topologicalSort: (graph: DependencyGraph) => string[];
|
67
|
-
export declare const decode: (i: {
|
68
|
-
readonly dependencies: {
|
69
|
-
readonly [x: string]: readonly string[];
|
70
|
-
};
|
71
|
-
readonly dependents: {
|
72
|
-
readonly [x: string]: readonly string[];
|
73
|
-
};
|
74
|
-
}, overrideOptions?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
75
|
-
readonly dependencies: {
|
76
|
-
readonly [x: string]: readonly string[];
|
77
|
-
};
|
78
|
-
readonly dependents: {
|
79
|
-
readonly [x: string]: readonly string[];
|
80
|
-
};
|
81
|
-
}, import("effect/ParseResult").ParseError, never>;
|
82
|
-
export declare const decodeSync: (i: {
|
83
|
-
readonly dependencies: {
|
84
|
-
readonly [x: string]: readonly string[];
|
85
|
-
};
|
86
|
-
readonly dependents: {
|
87
|
-
readonly [x: string]: readonly string[];
|
88
|
-
};
|
89
|
-
}, overrideOptions?: import("effect/SchemaAST").ParseOptions) => {
|
90
|
-
readonly dependencies: {
|
91
|
-
readonly [x: string]: readonly string[];
|
92
|
-
};
|
93
|
-
readonly dependents: {
|
94
|
-
readonly [x: string]: readonly string[];
|
95
|
-
};
|
96
|
-
};
|
97
|
-
export declare const encode: (a: {
|
98
|
-
readonly dependencies: {
|
99
|
-
readonly [x: string]: readonly string[];
|
100
|
-
};
|
101
|
-
readonly dependents: {
|
102
|
-
readonly [x: string]: readonly string[];
|
103
|
-
};
|
104
|
-
}, overrideOptions?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
105
|
-
readonly dependencies: {
|
106
|
-
readonly [x: string]: readonly string[];
|
107
|
-
};
|
108
|
-
readonly dependents: {
|
109
|
-
readonly [x: string]: readonly string[];
|
110
|
-
};
|
111
|
-
}, import("effect/ParseResult").ParseError, never>;
|
112
|
-
export declare const encodeSync: (a: {
|
113
|
-
readonly dependencies: {
|
114
|
-
readonly [x: string]: readonly string[];
|
115
|
-
};
|
116
|
-
readonly dependents: {
|
117
|
-
readonly [x: string]: readonly string[];
|
118
|
-
};
|
119
|
-
}, overrideOptions?: import("effect/SchemaAST").ParseOptions) => {
|
120
|
-
readonly dependencies: {
|
121
|
-
readonly [x: string]: readonly string[];
|
122
|
-
};
|
123
|
-
readonly dependents: {
|
124
|
-
readonly [x: string]: readonly string[];
|
125
|
-
};
|
126
|
-
};
|
127
|
-
//# sourceMappingURL=graph.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/lib/graph/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AAIxC;;;GAGG;AACH,eAAO,MAAM,eAAe;IAC1B;;OAEG;;IAGH;;OAEG;;EAKH,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAIzD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;CAAuB,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,MAAM,QAAO,eAItB,CAAA;AAIJ;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,eAAe,EACtB,QAAQ,MAAM,EACd,OAAO,MAAM,KACZ,eAqBF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,eAAe,EACtB,QAAQ,MAAM,EACd,OAAO,MAAM,KACZ,IAsBF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,eAAe,KAAG,GAAG,CAAC,MAAM,CAYhE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EACZ,OAAO,eAAe,EACtB,WAAW,GAAG,CAAC,MAAM,CAAC,KACrB,OAKF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,eAAe,KAAG,MAAM,EA2C9D,CAAA;AAID,eAAO,MAAM,MAAM;;;;;;;;;;;;;;kDAA4B,CAAA;AAC/C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;CAAgC,CAAA;AACvD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;kDAA4B,CAAA;AAC/C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;CAAgC,CAAA"}
|
package/build/lib/graph/graph.js
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
import { S } from '#lib/kit-temp/effect';
|
2
|
-
// ─── Schema ──────────────────────────────────────────────────────────────────
|
3
|
-
/**
|
4
|
-
* Dependency graph for tracking relationships between nodes
|
5
|
-
* Used to efficiently handle dependencies in various contexts
|
6
|
-
*/
|
7
|
-
export const DependencyGraph = S.Struct({
|
8
|
-
/**
|
9
|
-
* Map from parent ID to array of child IDs (parent depends on children)
|
10
|
-
*/
|
11
|
-
dependencies: S.Record({ key: S.String, value: S.Array(S.String) }),
|
12
|
-
/**
|
13
|
-
* Map from child ID to array of parent IDs (child is depended on by parents)
|
14
|
-
*/
|
15
|
-
dependents: S.Record({ key: S.String, value: S.Array(S.String) }),
|
16
|
-
}).annotations({
|
17
|
-
identifier: 'DependencyGraph',
|
18
|
-
description: 'A directed graph tracking dependencies between nodes',
|
19
|
-
});
|
20
|
-
// ─── Constructors ────────────────────────────────────────────────────────────
|
21
|
-
export const make = DependencyGraph.make;
|
22
|
-
/**
|
23
|
-
* Create an empty dependency graph
|
24
|
-
*/
|
25
|
-
export const create = () => make({
|
26
|
-
dependencies: {},
|
27
|
-
dependents: {},
|
28
|
-
});
|
29
|
-
// ─── Domain Logic ────────────────────────────────────────────────────────────
|
30
|
-
/**
|
31
|
-
* Add a dependency relationship (immutable)
|
32
|
-
* @param graph - The dependency graph
|
33
|
-
* @param parent - The parent node ID
|
34
|
-
* @param child - The child node ID that the parent depends on
|
35
|
-
* @returns A new graph with the dependency added
|
36
|
-
*/
|
37
|
-
export const addDependency = (graph, parent, child) => {
|
38
|
-
// Get existing arrays or create empty ones
|
39
|
-
const children = graph.dependencies[parent] || [];
|
40
|
-
const parents = graph.dependents[child] || [];
|
41
|
-
// Add child if not already present
|
42
|
-
const newChildren = children.includes(child) ? children : [...children, child];
|
43
|
-
// Add parent if not already present
|
44
|
-
const newParents = parents.includes(parent) ? parents : [...parents, parent];
|
45
|
-
return make({
|
46
|
-
dependencies: {
|
47
|
-
...graph.dependencies,
|
48
|
-
[parent]: newChildren,
|
49
|
-
},
|
50
|
-
dependents: {
|
51
|
-
...graph.dependents,
|
52
|
-
[child]: newParents,
|
53
|
-
},
|
54
|
-
});
|
55
|
-
};
|
56
|
-
/**
|
57
|
-
* Add a dependency relationship (mutable)
|
58
|
-
* @param graph - The dependency graph to mutate
|
59
|
-
* @param parent - The parent node ID
|
60
|
-
* @param child - The child node ID that the parent depends on
|
61
|
-
*/
|
62
|
-
export const addDependencyMutable = (graph, parent, child) => {
|
63
|
-
// Cast to mutable for mutation
|
64
|
-
const mutableGraph = graph;
|
65
|
-
// Add to dependencies
|
66
|
-
if (!mutableGraph.dependencies[parent]) {
|
67
|
-
mutableGraph.dependencies[parent] = [];
|
68
|
-
}
|
69
|
-
if (!mutableGraph.dependencies[parent].includes(child)) {
|
70
|
-
mutableGraph.dependencies[parent].push(child);
|
71
|
-
}
|
72
|
-
// Add to dependents
|
73
|
-
if (!mutableGraph.dependents[child]) {
|
74
|
-
mutableGraph.dependents[child] = [];
|
75
|
-
}
|
76
|
-
if (!mutableGraph.dependents[child].includes(parent)) {
|
77
|
-
mutableGraph.dependents[child].push(parent);
|
78
|
-
}
|
79
|
-
};
|
80
|
-
/**
|
81
|
-
* Find all nodes that have no dependencies (leaf nodes)
|
82
|
-
*/
|
83
|
-
export const findLeafNodes = (graph) => {
|
84
|
-
const leaves = new Set();
|
85
|
-
// Check all nodes that appear as children
|
86
|
-
for (const child of Object.keys(graph.dependents)) {
|
87
|
-
const deps = graph.dependencies[child];
|
88
|
-
if (!deps || deps.length === 0) {
|
89
|
-
leaves.add(child);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return leaves;
|
93
|
-
};
|
94
|
-
/**
|
95
|
-
* Check if all dependencies of a node have been processed
|
96
|
-
*/
|
97
|
-
export const areDependenciesReady = (node, graph, processed) => {
|
98
|
-
const deps = graph.dependencies[node];
|
99
|
-
if (!deps)
|
100
|
-
return true;
|
101
|
-
return deps.every(dep => processed.has(dep));
|
102
|
-
};
|
103
|
-
/**
|
104
|
-
* Get topological ordering of nodes (children before parents)
|
105
|
-
* This ensures we process dependencies before the nodes that depend on them
|
106
|
-
*
|
107
|
-
* @param graph - The dependency graph
|
108
|
-
* @returns Array of node IDs in topological order
|
109
|
-
*/
|
110
|
-
export const topologicalSort = (graph) => {
|
111
|
-
const result = [];
|
112
|
-
const visited = new Set();
|
113
|
-
const visiting = new Set(); // For cycle detection
|
114
|
-
// Get all nodes
|
115
|
-
const allNodes = new Set();
|
116
|
-
for (const parent of Object.keys(graph.dependencies)) {
|
117
|
-
allNodes.add(parent);
|
118
|
-
}
|
119
|
-
for (const child of Object.keys(graph.dependents)) {
|
120
|
-
allNodes.add(child);
|
121
|
-
}
|
122
|
-
const visit = (node) => {
|
123
|
-
if (visited.has(node))
|
124
|
-
return;
|
125
|
-
if (visiting.has(node)) {
|
126
|
-
// Cycle detected - just skip this node
|
127
|
-
return;
|
128
|
-
}
|
129
|
-
visiting.add(node);
|
130
|
-
// Visit all children first
|
131
|
-
const children = graph.dependencies[node];
|
132
|
-
if (children) {
|
133
|
-
for (const child of children) {
|
134
|
-
visit(child);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
visiting.delete(node);
|
138
|
-
visited.add(node);
|
139
|
-
result.push(node);
|
140
|
-
};
|
141
|
-
// Visit all nodes
|
142
|
-
for (const node of allNodes) {
|
143
|
-
visit(node);
|
144
|
-
}
|
145
|
-
return result;
|
146
|
-
};
|
147
|
-
// ─── Codec ───────────────────────────────────────────────────────────────────
|
148
|
-
export const decode = S.decode(DependencyGraph);
|
149
|
-
export const decodeSync = S.decodeSync(DependencyGraph);
|
150
|
-
export const encode = S.encode(DependencyGraph);
|
151
|
-
export const encodeSync = S.encodeSync(DependencyGraph);
|
152
|
-
//# sourceMappingURL=graph.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../src/lib/graph/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AAExC,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,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Ac,WAAW,CAAA"}
|
package/build/lib/mask/$$.js
DELETED
package/build/lib/mask/$$.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$$.js","sourceRoot":"","sources":["../../../src/lib/mask/$$.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA"}
|
package/build/lib/mask/$.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/mask/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA"}
|
package/build/lib/mask/$.js
DELETED
package/build/lib/mask/$.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/mask/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA"}
|
@@ -1,86 +0,0 @@
|
|
1
|
-
import { type ExtendsExact } from '#lib/kit-temp';
|
2
|
-
import type { GetDataType, Mask } from './mask.js';
|
3
|
-
/**
|
4
|
-
* Type-level function that applies a mask to data.
|
5
|
-
*
|
6
|
-
* @template Data - The data type
|
7
|
-
* @template M - The mask type
|
8
|
-
*
|
9
|
-
* Binary masks:
|
10
|
-
* - show=true returns the data unchanged
|
11
|
-
* - show=false returns undefined
|
12
|
-
*
|
13
|
-
* Properties masks:
|
14
|
-
* - 'allow' mode returns Pick<Data, keys>
|
15
|
-
* - 'deny' mode returns Omit<Data, keys>
|
16
|
-
* - Non-objects throw an error at runtime
|
17
|
-
*/
|
18
|
-
export type Apply<$Data, $M extends Mask> = $M extends {
|
19
|
-
type: `binary`;
|
20
|
-
show: boolean;
|
21
|
-
} ? $M[`show`] extends true ? $Data : undefined : $M extends {
|
22
|
-
type: `properties`;
|
23
|
-
mode: string;
|
24
|
-
properties: any[];
|
25
|
-
} ? $Data extends object ? $M[`mode`] extends `allow` ? Pick<$Data, Extract<$M[`properties`][number], keyof $Data>> : Omit<$Data, Extract<$M[`properties`][number], keyof $Data>> : never : never;
|
26
|
-
/**
|
27
|
-
* Apply mask to data with standard covariance.
|
28
|
-
*
|
29
|
-
* Data must be assignable to the mask's expected type (may have excess properties).
|
30
|
-
*
|
31
|
-
* @param data - The data to mask
|
32
|
-
* @param mask - The mask to apply
|
33
|
-
* @returns The masked data
|
34
|
-
*
|
35
|
-
* @example
|
36
|
-
* ```ts
|
37
|
-
* const user = { name: 'John', email: 'john@example.com', password: 'secret' }
|
38
|
-
* const mask = Mask.pick<User>(['name', 'email'])
|
39
|
-
* const safeUser = apply(user, mask) // { name: 'John', email: 'john@example.com' }
|
40
|
-
* ```
|
41
|
-
*/
|
42
|
-
export declare const apply: <data extends GetDataType<mask>, mask extends Mask>(data: data, mask: mask) => Apply<data, mask>;
|
43
|
-
/**
|
44
|
-
* Apply mask to partial data.
|
45
|
-
*
|
46
|
-
* Data may have only a subset of the mask's expected properties.
|
47
|
-
* Useful when working with incomplete data or optional fields.
|
48
|
-
*
|
49
|
-
* @param data - The partial data to mask
|
50
|
-
* @param mask - The mask to apply
|
51
|
-
* @returns The masked data
|
52
|
-
*
|
53
|
-
* @example
|
54
|
-
* ```ts
|
55
|
-
* const partialUser = { name: 'John' } // missing email
|
56
|
-
* const mask = Mask.pick<User>(['name', 'email'])
|
57
|
-
* const result = applyPartial(partialUser, mask) // { name: 'John' }
|
58
|
-
* ```
|
59
|
-
*/
|
60
|
-
export declare const applyPartial: <data extends Partial<GetDataType<mask>>, mask extends Mask>(data: data, mask: mask) => Apply<data, mask>;
|
61
|
-
/**
|
62
|
-
* Apply mask to data with exact type matching.
|
63
|
-
*
|
64
|
-
* Data must exactly match the mask's expected type - no missing or excess properties.
|
65
|
-
* Provides the strictest type checking.
|
66
|
-
*
|
67
|
-
* @param data - The data to mask (must exactly match expected type)
|
68
|
-
* @param mask - The mask to apply
|
69
|
-
* @returns The masked data
|
70
|
-
*
|
71
|
-
* @example
|
72
|
-
* ```ts
|
73
|
-
* type User = { name: string; email: string }
|
74
|
-
* const mask = Mask.pick<User>(['name'])
|
75
|
-
*
|
76
|
-
* // This works - exact match
|
77
|
-
* const user: User = { name: 'John', email: 'john@example.com' }
|
78
|
-
* const result = applyExact(user, mask)
|
79
|
-
*
|
80
|
-
* // This fails - has extra property
|
81
|
-
* const userWithExtra = { name: 'John', email: 'john@example.com', age: 30 }
|
82
|
-
* const result2 = applyExact(userWithExtra, mask) // Type error!
|
83
|
-
* ```
|
84
|
-
*/
|
85
|
-
export declare const applyExact: <data, mask extends Mask>(data: ExtendsExact<data, GetDataType<mask>>, mask: mask) => Apply<data, mask>;
|
86
|
-
//# sourceMappingURL=apply.d.ts.map
|