@valbuild/shared 0.126.0 → 0.128.0
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/CHANGELOG.md +133 -0
- package/client/dist/valbuild-shared-client.esm.js +1 -1
- package/dist/declarations/src/internal/ApiRoutes.d.ts +1 -1
- package/dist/declarations/src/internal/aiTools/aiImageToolPatches.d.ts +1 -1
- package/dist/declarations/src/internal/aiTools/aiSourceToolPatches.d.ts +2 -1
- package/dist/declarations/src/internal/emptyOf.d.ts +24 -1
- package/dist/declarations/src/internal/index.d.ts +1 -0
- package/dist/declarations/src/internal/localeAt.d.ts +19 -0
- package/dist/declarations/src/internal/resolveSchemaSourceFixes.d.ts +32 -8
- package/dist/declarations/src/internal/zod/SerializedSchema.d.ts +5 -4
- package/dist/{getSitemapTree-a6cb37cb.esm.js → getSitemapTree-6777bdfa.esm.js} +1 -1
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +517 -37
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +517 -37
- package/internal/dist/valbuild-shared-internal.esm.js +516 -41
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,138 @@
|
|
|
1
1
|
# @valbuild/shared
|
|
2
2
|
|
|
3
|
+
## 0.128.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`8b52b33`](https://github.com/valbuild/val/commit/8b52b33e1f629f14f66cc71dcc7cf415d210c7d4), [`362fb49`](https://github.com/valbuild/val/commit/362fb49f30d2b04c4ff78d54dca2bf5ad978a05c), [`c595799`](https://github.com/valbuild/val/commit/c59579977a436ec530c6c69f2b340ab9829d97ab)]:
|
|
8
|
+
- @valbuild/core@0.128.0
|
|
9
|
+
|
|
10
|
+
## 0.127.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#608](https://github.com/valbuild/val/pull/608) [`7fa8699`](https://github.com/valbuild/val/commit/7fa869974bc895af992a7d5c18b76253636d7d65) Thanks [@freekh](https://github.com/freekh)! - A record whose schema declares its keys now holds every one of them.
|
|
15
|
+
|
|
16
|
+
Two key schemas enumerate their keys: `s.locale()`, whose set is the project's
|
|
17
|
+
`locales.available`, and a union of literals. For those, the keys are part of the
|
|
18
|
+
schema, so a missing one is a hole in the content rather than content nobody has
|
|
19
|
+
written yet — and validation now says so, naming what is missing.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
s.record(s.locale(), s.object({ title: s.string() }));
|
|
23
|
+
// Missing key: 'nb-NO'. This record's keys are declared by its schema, so
|
|
24
|
+
// every one of them is an entry — an entry nobody has written yet is null,
|
|
25
|
+
// not absent.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**An entry nobody has written yet is `null`.** Not an absent key: a null entry is
|
|
29
|
+
data you can count, filter and see in a diff, and it means half-translated
|
|
30
|
+
content stays _valid_ rather than blocking a publish. The value type of such a
|
|
31
|
+
record widens by `null` to match, so writing one in a `.val.ts` type-checks:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
c.define(
|
|
35
|
+
"/content/jacket.val.ts",
|
|
36
|
+
s.record(s.locale(), s.object({ title: s.string() })),
|
|
37
|
+
{
|
|
38
|
+
"en-US": { title: "Winter jacket" },
|
|
39
|
+
"nb-NO": null, // nobody has translated this yet
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**This changes `s.record(s.union(...), item)`**, and closes a gap that was
|
|
45
|
+
already there: `s.record(s.union(s.literal("a"), s.literal("b")), item)` types as
|
|
46
|
+
`Record<"a" | "b", T>`, so TypeScript demanded both keys while the validator only
|
|
47
|
+
checked the ones present. It now checks them too, and — as above — accepts `null`
|
|
48
|
+
for an entry that has not been filled in. If you have such a record with keys
|
|
49
|
+
missing, validation will report them; adding the keys with `null` values is the
|
|
50
|
+
fix, and creating one from the Studio does it for you.
|
|
51
|
+
|
|
52
|
+
`emptyOf` creates these records with every key already in them rather than
|
|
53
|
+
empty, since an empty one is already missing keys. In the Studio use the
|
|
54
|
+
`useEmptyOf()` hook rather than importing `emptyOf` directly: a locale record's
|
|
55
|
+
keys are in the settings module, and the hook is what has read it.
|
|
56
|
+
|
|
57
|
+
- [#608](https://github.com/valbuild/val/pull/608) [`5b7fe05`](https://github.com/valbuild/val/commit/5b7fe05cec6365f9cd1de9ba31e65ed4a87edb63) Thanks [@freekh](https://github.com/freekh)! - `s.locale()`: one of the project's languages.
|
|
58
|
+
|
|
59
|
+
The languages themselves are declared in the settings module (`locales.available`);
|
|
60
|
+
this says that a value is one of them.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// a field: everything in this entry is in this language
|
|
64
|
+
s.record(s.string(), s.object({ locale: s.locale(), title: s.string() }));
|
|
65
|
+
|
|
66
|
+
// a key: one entry per language
|
|
67
|
+
s.record(s.locale(), s.object({ title: s.string() }));
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Every locale in content is checked against the project's list, the way `keyOf`
|
|
71
|
+
and `route` are checked against what they point at. An undeclared language names
|
|
72
|
+
the ones the project has; a project that has declared none is told to declare
|
|
73
|
+
them rather than told the value is wrong.
|
|
74
|
+
|
|
75
|
+
A locale is stored as the tag itself — the value in content is `nb-NO`, and a
|
|
76
|
+
record keyed by `s.locale()` has `nb-NO` as its key. Spelling one differently
|
|
77
|
+
where it is stored (`/no/…` as a URL segment) is a real need and is deliberately
|
|
78
|
+
not in this release: it changes what is accepted as well as what is shown, so it
|
|
79
|
+
is being designed on its own rather than folded in here.
|
|
80
|
+
|
|
81
|
+
A locale is **never stega encoded**: it ends up in `<html lang>`, in `hreflang`
|
|
82
|
+
and in `Intl` constructors, none of which survive invisible characters.
|
|
83
|
+
|
|
84
|
+
`assistant.translation` joins the settings module alongside `context` and `tone`
|
|
85
|
+
— a note per language, keyed by language, so only the target language's rules are
|
|
86
|
+
sent when translating into it.
|
|
87
|
+
|
|
88
|
+
- [#608](https://github.com/valbuild/val/pull/608) [`88262ac`](https://github.com/valbuild/val/commit/88262ac8db068650a664981ef73556457d87741a) Thanks [@freekh](https://github.com/freekh)! - Locale scopes: a subtree in one language, and one function that answers which.
|
|
89
|
+
|
|
90
|
+
A **locale scope** is content governed by a single language. Two things open one
|
|
91
|
+
today (a third, locale segments in routes, follows):
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// a locale field: this object and everything below it is in one language
|
|
95
|
+
s.object({ locale: s.locale(), title: s.string(), body: s.richtext() });
|
|
96
|
+
|
|
97
|
+
// a locale-keyed record: each entry is in the language its key names
|
|
98
|
+
s.record(s.locale(), s.object({ title: s.string() }));
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**A scope may not contain another scope**, and an object may have only one
|
|
102
|
+
locale field. Both are reported as schema errors, naming what to move:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
An object can be in one language, so it can have one locale field.
|
|
106
|
+
Found 'locale', 'language'.
|
|
107
|
+
|
|
108
|
+
Everything here is already in one language, so 'byLanguage' cannot set
|
|
109
|
+
another. Move the locale-keyed record out of this object, or take the outer
|
|
110
|
+
one away.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
A scope three levels deep is reported once, by the scope immediately enclosing
|
|
114
|
+
it, rather than by every ancestor.
|
|
115
|
+
|
|
116
|
+
The rule is **validated rather than typed**. Expressing "no scope below this
|
|
117
|
+
one" as a type constraint means threading it through every schema class's type
|
|
118
|
+
parameter, and the errors a recursive constraint like that produces name the
|
|
119
|
+
whole tree — an unrelated typo in a `.val.ts` would print pages.
|
|
120
|
+
|
|
121
|
+
`localeAt(path, snapshot)` (from `@valbuild/shared/internal`) answers which
|
|
122
|
+
language governs a path, and is the one implementation of that question, so the
|
|
123
|
+
Studio, the server and the validation worker cannot disagree. It returns the
|
|
124
|
+
tag, which is what `<html lang>`, `Intl` and `locales.available` all want.
|
|
125
|
+
|
|
126
|
+
It answers `null` where no scope governs the path, where the project has
|
|
127
|
+
declared no languages, and where a locale field holds something that is not one
|
|
128
|
+
of them — validation is already reporting the last, and guessing would put a
|
|
129
|
+
language in `<html lang>` that nobody chose.
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- Updated dependencies [[`7fa8699`](https://github.com/valbuild/val/commit/7fa869974bc895af992a7d5c18b76253636d7d65), [`5b7fe05`](https://github.com/valbuild/val/commit/5b7fe05cec6365f9cd1de9ba31e65ed4a87edb63), [`88262ac`](https://github.com/valbuild/val/commit/88262ac8db068650a664981ef73556457d87741a), [`7072e07`](https://github.com/valbuild/val/commit/7072e07623c953a09ac14388ae22dada0b431ce3), [`29811c3`](https://github.com/valbuild/val/commit/29811c3f8c7e001a950e6f4833af6888e6a4efea)]:
|
|
134
|
+
- @valbuild/core@0.127.0
|
|
135
|
+
|
|
3
136
|
## 0.126.0
|
|
4
137
|
|
|
5
138
|
### Minor Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { b as VAL_AI_SESSION_STORAGE_KEY, d as VAL_CANVAS_MESSAGE, c as VAL_CANVAS_PARAM, V as VAL_CONFIG_SESSION_STORAGE_KEY, a as VAL_THEME_SESSION_STORAGE_KEY, g as getNextAppRouterSourceFolder, l as getPageRouterSitemapTree, j as getPageRouterSourceFolder, m as getPatternFromModuleFilePath, h as getTanStackRouterSourceFolder, k as isTanStackRoutesFolder, f as isValCanvasFrame, i as isValCanvasPageMessage, e as isValCanvasStudioMessage, p as parseRoutePattern, w as withValCanvasParam } from '../../dist/getSitemapTree-
|
|
1
|
+
export { b as VAL_AI_SESSION_STORAGE_KEY, d as VAL_CANVAS_MESSAGE, c as VAL_CANVAS_PARAM, V as VAL_CONFIG_SESSION_STORAGE_KEY, a as VAL_THEME_SESSION_STORAGE_KEY, g as getNextAppRouterSourceFolder, l as getPageRouterSitemapTree, j as getPageRouterSourceFolder, m as getPatternFromModuleFilePath, h as getTanStackRouterSourceFolder, k as isTanStackRoutesFolder, f as isValCanvasFrame, i as isValCanvasPageMessage, e as isValCanvasStudioMessage, p as parseRoutePattern, w as withValCanvasParam } from '../../dist/getSitemapTree-6777bdfa.esm.js';
|
|
2
2
|
import '@valbuild/core';
|
|
@@ -948,7 +948,7 @@ export declare const Api: {
|
|
|
948
948
|
message: z.ZodString;
|
|
949
949
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
950
950
|
fatal: z.ZodOptional<z.ZodBoolean>;
|
|
951
|
-
fixes: z.ZodOptional<z.ZodArray<z.ZodType<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "external:upload", unknown, z.core.$ZodTypeInternals<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "external:upload", unknown>>>>;
|
|
951
|
+
fixes: z.ZodOptional<z.ZodArray<z.ZodType<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "locale:check-locale" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload", unknown, z.core.$ZodTypeInternals<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "keyof:check-keys" | "router:check-route" | "locale:check-locale" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload", unknown>>>>;
|
|
952
952
|
}, z.core.$strip>>>>;
|
|
953
953
|
}, z.core.$strip>>;
|
|
954
954
|
}, z.core.$strip>;
|
|
@@ -40,7 +40,7 @@ export type ResolveResult = {
|
|
|
40
40
|
* Walks `schema` along `path`, returning a structured result:
|
|
41
41
|
* - `leaf`: walked the full path; resolved schema at the end.
|
|
42
42
|
* - `richtext`: hit a richtext mid-walk; richtext is the resolved schema.
|
|
43
|
-
* - `gallery-traversed`: hit an `s.
|
|
43
|
+
* - `gallery-traversed`: hit an `s.imageset()` record and walked past it (i.e. the
|
|
44
44
|
* path tries to address an entry inside the gallery — a clue the AI should
|
|
45
45
|
* have used the gallery tool instead).
|
|
46
46
|
* - `unresolved`: the path could not be walked.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SerializedSchema, Source } from "@valbuild/core";
|
|
2
|
+
import { type EmptyOfContext } from "../emptyOf.js";
|
|
2
3
|
import { type BuildResult } from "./aiImageToolPatches.js";
|
|
3
4
|
export declare function buildDuplicatePatch(args: {
|
|
4
5
|
sourcePath: string[];
|
|
@@ -6,7 +7,7 @@ export declare function buildDuplicatePatch(args: {
|
|
|
6
7
|
}, moduleSchema: SerializedSchema, moduleSource: Source | undefined): BuildResult;
|
|
7
8
|
export declare function buildEmptyAtPathPatch(args: {
|
|
8
9
|
destinationPath: string[];
|
|
9
|
-
}, moduleSchema: SerializedSchema, moduleSource: Source | undefined): BuildResult;
|
|
10
|
+
}, moduleSchema: SerializedSchema, moduleSource: Source | undefined, context?: EmptyOfContext): BuildResult;
|
|
10
11
|
/**
|
|
11
12
|
* What kind of container a path points at.
|
|
12
13
|
*
|
|
@@ -1,2 +1,25 @@
|
|
|
1
1
|
import { SerializedSchema, Json } from "@valbuild/core";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* What `emptyOf` cannot read off a serialized schema.
|
|
4
|
+
*
|
|
5
|
+
* The project's languages, and which one is being worked in. Neither is in the
|
|
6
|
+
* schema: a locale-keyed record has one entry per language and the languages
|
|
7
|
+
* are declared in the settings module, and "which language am I writing" is a
|
|
8
|
+
* fact about the editor, not about the content. Optional throughout: a caller
|
|
9
|
+
* that has no context gets an empty record and an unset locale, which
|
|
10
|
+
* validation then reports, rather than wrong ones.
|
|
11
|
+
*/
|
|
12
|
+
export type EmptyOfContext = {
|
|
13
|
+
/** `locales.available` from the settings module. */
|
|
14
|
+
locales?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* The one language being worked in, where the editor has narrowed to one.
|
|
17
|
+
*
|
|
18
|
+
* A new `s.locale()` field is created already set to it. Someone filtered to
|
|
19
|
+
* Norwegian is writing Norwegian, and a new item that defaulted to unset
|
|
20
|
+
* would fail validation and vanish from the list they are looking at, in
|
|
21
|
+
* that order.
|
|
22
|
+
*/
|
|
23
|
+
selectedLocale?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function emptyOf(schema: SerializedSchema, context?: EmptyOfContext): Json;
|
|
@@ -16,6 +16,7 @@ export * from "./parseRoutePattern.js";
|
|
|
16
16
|
export * from "./getNextAppRouterSourceFolder.js";
|
|
17
17
|
export * from "./routeValidation.js";
|
|
18
18
|
export * from "./resolveSchemaSourceFixes.js";
|
|
19
|
+
export * from "./localeAt.js";
|
|
19
20
|
export * from "./getErrorMessageFromUnknownJson.js";
|
|
20
21
|
export * from "./zod/SerializedSchema.js";
|
|
21
22
|
export * from "./valCanvasProtocol.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SourcePath } from "@valbuild/core";
|
|
2
|
+
import { type SchemaSourceSnapshot } from "./resolveSchemaSourceFixes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Which of the project's languages governs a path, or `null` for none.
|
|
5
|
+
*
|
|
6
|
+
* THE question the whole feature turns on. A locale scope is a subtree in one
|
|
7
|
+
* language, and three things open one: a `locale` field on an object, a record
|
|
8
|
+
* keyed by `s.locale()`, and a locale segment in a segmented key. Once this can
|
|
9
|
+
* be answered from the schema and the source alone, everything downstream falls
|
|
10
|
+
* out of it — the Studio's locale filter, deep links, `<html lang>`, and knowing
|
|
11
|
+
* what to translate from and into.
|
|
12
|
+
*
|
|
13
|
+
* One implementation, so the Studio, the server and the validation worker cannot
|
|
14
|
+
* disagree about what language a piece of content is in.
|
|
15
|
+
*
|
|
16
|
+
* `null` means no scope governs the path — which is the answer for most content
|
|
17
|
+
* in most projects, and for every project that has not declared any languages.
|
|
18
|
+
*/
|
|
19
|
+
export declare function localeAt(path: SourcePath, snapshot: SchemaSourceSnapshot): string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Json, type ModuleFilePath, type SerializedSchema, type SourcePath, type ValidationError } from "@valbuild/core";
|
|
1
|
+
import { type Json, type ModuleFilePath, type SerializedSchema, type SourcePath, type ValidationError, type ValidationFix } from "@valbuild/core";
|
|
2
2
|
export type SchemaSourceSnapshot = {
|
|
3
3
|
schemas: Record<ModuleFilePath, SerializedSchema>;
|
|
4
4
|
sources: Record<ModuleFilePath, Json>;
|
|
@@ -28,12 +28,36 @@ export declare function getKeyOfRecordAt(sourcePath: SourcePath, snapshot: Schem
|
|
|
28
28
|
source: unknown;
|
|
29
29
|
schema: SerializedSchema | undefined;
|
|
30
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* The languages the project declares, from its settings module.
|
|
33
|
+
*
|
|
34
|
+
* Empty where there is no settings module, no `locales` section, or nothing in
|
|
35
|
+
* it — all of which mean the same thing: this project has not said it is
|
|
36
|
+
* translated.
|
|
37
|
+
*/
|
|
38
|
+
export declare function declaredLocales(snapshot: SchemaSourceSnapshot): string[];
|
|
31
39
|
export type ResolvedFix = {
|
|
32
40
|
status: "resolved";
|
|
33
41
|
} | {
|
|
34
42
|
status: "remaining";
|
|
35
43
|
error: ValidationError;
|
|
36
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* The fixes {@link resolveSchemaSourceFixForError} answers for.
|
|
47
|
+
*
|
|
48
|
+
* A marker error carrying one of these is NOT a message: it says "ask the whole
|
|
49
|
+
* project about this" and carries the value to ask with, because the schema
|
|
50
|
+
* that raised it can only see its own module. Left unresolved, what a user sees
|
|
51
|
+
* is the marker's own placeholder text — "should typically be processed by Val
|
|
52
|
+
* internally … version mismatch" — which is alarming and says nothing.
|
|
53
|
+
*
|
|
54
|
+
* A list rather than a check per call site: every caller that resolves some of
|
|
55
|
+
* these has to resolve all of them, and the two that leaked did so by adding a
|
|
56
|
+
* fix here and not to a condition somewhere else.
|
|
57
|
+
*/
|
|
58
|
+
export declare const SCHEMA_SOURCE_FIXES: ValidationFix[];
|
|
59
|
+
/** Whether an error is a marker only the whole project can answer. */
|
|
60
|
+
export declare function isSchemaSourceFixError(error: ValidationError): boolean;
|
|
37
61
|
/**
|
|
38
62
|
* The record a `keyof:check-keys` error resolves against, or null for any other
|
|
39
63
|
* error — including a malformed marker, which
|
|
@@ -46,20 +70,20 @@ export type ResolvedFix = {
|
|
|
46
70
|
*/
|
|
47
71
|
export declare function keyOfRecordPath(error: ValidationError): SourcePath | null;
|
|
48
72
|
/**
|
|
49
|
-
* Resolves a single
|
|
50
|
-
*
|
|
73
|
+
* Resolves a single marker error (see {@link SCHEMA_SOURCE_FIXES}) against the
|
|
74
|
+
* given schema/source snapshot. Returns:
|
|
51
75
|
* - null if the error is not one of these fixes (caller should pass through)
|
|
52
|
-
* - { status: "resolved" } if the
|
|
76
|
+
* - { status: "resolved" } if the reference is valid (drop error)
|
|
53
77
|
* - { status: "remaining"; error } if invalid (rewritten error to surface)
|
|
54
78
|
*/
|
|
55
79
|
export declare function resolveSchemaSourceFixForError(error: ValidationError, snapshot: SchemaSourceSnapshot): ResolvedFix | null;
|
|
56
80
|
/**
|
|
57
81
|
* Apply schema/source fix resolution across a map of validation errors.
|
|
58
82
|
*
|
|
59
|
-
* Errors
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
83
|
+
* Errors carrying one of {@link SCHEMA_SOURCE_FIXES} are resolved against the
|
|
84
|
+
* in-memory schema/source snapshot — valid references drop the error, invalid
|
|
85
|
+
* ones are rewritten with a "did you mean…" message and have their `fixes`
|
|
86
|
+
* cleared (so downstream code reports them as plain validation errors).
|
|
63
87
|
* All other errors pass through untouched.
|
|
64
88
|
*
|
|
65
89
|
* Source paths with no remaining errors are removed from the result.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type SerializedSchema as SerializedSchemaT, type SerializedStringSchema as SerializedStringSchemaT, type SerializedLiteralSchema as SerializedLiteralSchemaT, type SerializedBooleanSchema as SerializedBooleanSchemaT, type SerializedNumberSchema as SerializedNumberSchemaT, type SerializedObjectSchema as SerializedObjectSchemaT, type SerializedArraySchema as SerializedArraySchemaT, type SerializedDiscriminatedUnionSchema as SerializedDiscriminatedUnionSchemaT, type SerializedEnumSchema as SerializedEnumSchemaT, type SerializedRichTextSchema as SerializedRichTextSchemaT, type SerializedRichTextOptions as SerializedRichTextOptionsT, type SerializedRecordSchema as SerializedRecordSchemaT, type SerializedKeyOfSchema as SerializedKeyOfSchemaT, type SerializedRouteSchema as SerializedRouteSchemaT, type SerializedFileSchema as SerializedFileSchemaT, type SerializedDateSchema as SerializedDateSchemaT, type SerializedDateTimeSchema as SerializedDateTimeSchemaT, type SerializedColorSchema as SerializedColorSchemaT, type SerializedCodeSchema as SerializedCodeSchemaT, type SerializedImageSchema as SerializedImageSchemaT, type SerializedSettingsSchema as SerializedSettingsSchemaT } from "@valbuild/core";
|
|
2
|
+
import { type SerializedSchema as SerializedSchemaT, type SerializedStringSchema as SerializedStringSchemaT, type SerializedLiteralSchema as SerializedLiteralSchemaT, type SerializedBooleanSchema as SerializedBooleanSchemaT, type SerializedNumberSchema as SerializedNumberSchemaT, type SerializedObjectSchema as SerializedObjectSchemaT, type SerializedArraySchema as SerializedArraySchemaT, type SerializedDiscriminatedUnionSchema as SerializedDiscriminatedUnionSchemaT, type SerializedEnumSchema as SerializedEnumSchemaT, type SerializedRichTextSchema as SerializedRichTextSchemaT, type SerializedRichTextOptions as SerializedRichTextOptionsT, type SerializedRecordSchema as SerializedRecordSchemaT, type SerializedKeyOfSchema as SerializedKeyOfSchemaT, type SerializedLocaleSchema as SerializedLocaleSchemaT, type SerializedRouteSchema as SerializedRouteSchemaT, type SerializedFileSchema as SerializedFileSchemaT, type SerializedDateSchema as SerializedDateSchemaT, type SerializedDateTimeSchema as SerializedDateTimeSchemaT, type SerializedColorSchema as SerializedColorSchemaT, type SerializedCodeSchema as SerializedCodeSchemaT, type SerializedImageSchema as SerializedImageSchemaT, type SerializedSettingsSchema as SerializedSettingsSchemaT } from "@valbuild/core";
|
|
3
3
|
export declare const SerializedStringSchema: z.ZodType<SerializedStringSchemaT>;
|
|
4
4
|
export declare const SerializedLiteralSchema: z.ZodType<SerializedLiteralSchemaT>;
|
|
5
5
|
export declare const SerializedBooleanSchema: z.ZodType<SerializedBooleanSchemaT>;
|
|
@@ -14,8 +14,8 @@ export declare const ImageEncodeOption: z.ZodUnion<readonly [z.ZodLiteral<false>
|
|
|
14
14
|
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
15
15
|
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
}, z.core.$strip>]>;
|
|
17
|
-
export declare const ImageOptions: z.ZodObject<{
|
|
18
|
-
|
|
17
|
+
export declare const ImageOptions: z.ZodPreprocess<z.ZodObject<{
|
|
18
|
+
dir: z.ZodOptional<z.ZodString>;
|
|
19
19
|
accept: z.ZodOptional<z.ZodString>;
|
|
20
20
|
encode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
21
21
|
type: z.ZodLiteral<"webp">;
|
|
@@ -23,7 +23,7 @@ export declare const ImageOptions: z.ZodObject<{
|
|
|
23
23
|
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
24
24
|
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
25
25
|
}, z.core.$strip>]>>;
|
|
26
|
-
}, z.core.$strip
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
27
|
export declare const SerializedImageSchema: z.ZodType<SerializedImageSchemaT>;
|
|
28
28
|
export declare const RichTextOptions: z.ZodType<SerializedRichTextOptionsT>;
|
|
29
29
|
export declare const SerializedRichTextSchema: z.ZodType<SerializedRichTextSchemaT>;
|
|
@@ -73,6 +73,7 @@ export declare const CodeOptions: z.ZodObject<{
|
|
|
73
73
|
}>>;
|
|
74
74
|
}, z.core.$strip>;
|
|
75
75
|
export declare const SerializedCodeSchema: z.ZodType<SerializedCodeSchemaT>;
|
|
76
|
+
export declare const SerializedLocaleSchema: z.ZodType<SerializedLocaleSchemaT>;
|
|
76
77
|
export declare const SerializedRouteSchema: z.ZodType<SerializedRouteSchemaT>;
|
|
77
78
|
export declare const SerializedSettingsSchema: z.ZodType<SerializedSettingsSchemaT>;
|
|
78
79
|
export declare const SerializedSchema: z.ZodType<SerializedSchemaT>;
|
|
@@ -428,4 +428,4 @@ function getPatternFromModuleFilePath(moduleFilePath, srcFolder) {
|
|
|
428
428
|
.replace("/page.val.ts", "").replace("/page.val.js", "");
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
export { VAL_CONFIG_SESSION_STORAGE_KEY as V, _createForOfIteratorHelper as _, VAL_THEME_SESSION_STORAGE_KEY as a, VAL_AI_SESSION_STORAGE_KEY as b, VAL_CANVAS_PARAM as c, VAL_CANVAS_MESSAGE as d, isValCanvasStudioMessage as e, isValCanvasFrame as f, getNextAppRouterSourceFolder as g, getTanStackRouterSourceFolder as h, isValCanvasPageMessage as i, getPageRouterSourceFolder as j, isTanStackRoutesFolder as k, getPageRouterSitemapTree as l, getPatternFromModuleFilePath as m, _objectSpread2 as n, _arrayLikeToArray as o, parseRoutePattern as p, _unsupportedIterableToArray as q,
|
|
431
|
+
export { VAL_CONFIG_SESSION_STORAGE_KEY as V, _createForOfIteratorHelper as _, VAL_THEME_SESSION_STORAGE_KEY as a, VAL_AI_SESSION_STORAGE_KEY as b, VAL_CANVAS_PARAM as c, VAL_CANVAS_MESSAGE as d, isValCanvasStudioMessage as e, isValCanvasFrame as f, getNextAppRouterSourceFolder as g, getTanStackRouterSourceFolder as h, isValCanvasPageMessage as i, getPageRouterSourceFolder as j, isTanStackRoutesFolder as k, getPageRouterSitemapTree as l, getPatternFromModuleFilePath as m, _objectSpread2 as n, _arrayLikeToArray as o, parseRoutePattern as p, _unsupportedIterableToArray as q, _typeof as r, _defineProperty as s, withValCanvasParam as w };
|