@valbuild/core 0.63.6 → 0.65.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/dist/declarations/src/expr/expr.d.ts +2 -2
- package/dist/declarations/src/expr/parser.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +49 -94
- package/dist/declarations/src/initSchema.d.ts +19 -49
- package/dist/declarations/src/initVal.d.ts +8 -3
- package/dist/declarations/src/mimeType/all.d.ts +4 -0
- package/dist/declarations/src/mimeType/convertMimeType.d.ts +3 -0
- package/dist/declarations/src/mimeType/index.d.ts +2 -0
- package/dist/declarations/src/module.d.ts +6 -2
- package/dist/declarations/src/schema/array.d.ts +5 -5
- package/dist/declarations/src/schema/boolean.d.ts +2 -2
- package/dist/declarations/src/schema/date.d.ts +5 -5
- package/dist/declarations/src/schema/file.d.ts +5 -4
- package/dist/declarations/src/schema/image.d.ts +4 -4
- package/dist/declarations/src/schema/index.d.ts +44 -3
- package/dist/declarations/src/schema/keyOf.d.ts +9 -9
- package/dist/declarations/src/schema/literal.d.ts +3 -3
- package/dist/declarations/src/schema/number.d.ts +3 -3
- package/dist/declarations/src/schema/object.d.ts +5 -5
- package/dist/declarations/src/schema/record.d.ts +5 -5
- package/dist/declarations/src/schema/richtext.d.ts +6 -25
- package/dist/declarations/src/schema/string.d.ts +2 -2
- package/dist/declarations/src/schema/union.d.ts +18 -19
- package/dist/declarations/src/schema/validation/ValidationError.d.ts +2 -1
- package/dist/declarations/src/selector/SelectorProxy.d.ts +1 -0
- package/dist/declarations/src/source/file.d.ts +7 -4
- package/dist/declarations/src/source/richtext.d.ts +7 -0
- package/dist/declarations/src/val/index.d.ts +1 -1
- package/dist/{index-041f75bd.cjs.prod.js → index-48930c58.cjs.dev.js} +1842 -1050
- package/dist/{index-fccba617.esm.js → index-65ec1d74.esm.js} +1840 -1049
- package/dist/{index-c67ed8f9.cjs.dev.js → index-f1a23e6c.cjs.prod.js} +1842 -1050
- package/dist/{result-a8316efa.esm.js → result-168dfc1d.esm.js} +42 -46
- package/dist/{result-26f67b40.cjs.prod.js → result-787e35f6.cjs.prod.js} +41 -45
- package/dist/{result-48320acd.cjs.dev.js → result-bb1f436e.cjs.dev.js} +41 -45
- package/dist/valbuild-core.cjs.d.ts +2 -2
- package/dist/valbuild-core.cjs.dev.js +4 -3
- package/dist/valbuild-core.cjs.prod.js +4 -3
- package/dist/valbuild-core.esm.js +2 -2
- package/expr/dist/valbuild-core-expr.cjs.d.ts +2 -2
- package/expr/dist/valbuild-core-expr.cjs.dev.js +2 -2
- package/expr/dist/valbuild-core-expr.cjs.prod.js +2 -2
- package/expr/dist/valbuild-core-expr.esm.js +2 -2
- package/fp/dist/valbuild-core-fp.cjs.d.ts +2 -2
- package/fp/dist/valbuild-core-fp.cjs.dev.js +1 -1
- package/fp/dist/valbuild-core-fp.cjs.prod.js +1 -1
- package/fp/dist/valbuild-core-fp.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.d.ts +2 -2
- package/patch/dist/valbuild-core-patch.cjs.dev.js +8 -9
- package/patch/dist/valbuild-core-patch.cjs.prod.js +8 -9
- package/patch/dist/valbuild-core-patch.esm.js +9 -10
- package/dist/declarations/src/ValApi.d.ts +0 -54
- package/dist/valbuild-core.cjs.d.ts.map +0 -1
- package/expr/dist/valbuild-core-expr.cjs.d.ts.map +0 -1
- package/fp/dist/valbuild-core-fp.cjs.d.ts.map +0 -1
- package/patch/dist/valbuild-core-patch.cjs.d.ts.map +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Schema, SelectorOfSchema, SerializedSchema } from "./index.js";
|
1
|
+
import { Schema, SchemaAssertResult, SelectorOfSchema, SerializedSchema } from "./index.js";
|
2
2
|
import { SelectorSource } from "../selector/index.js";
|
3
3
|
import { SourcePath } from "../val/index.js";
|
4
4
|
import { ValidationErrors } from "./validation/ValidationError.js";
|
@@ -28,13 +28,13 @@ type ObjectSchemaProps = {
|
|
28
28
|
type ObjectSchemaSrcOf<Props extends ObjectSchemaProps> = {
|
29
29
|
[key in keyof Props]: SelectorOfSchema<Props[key]>;
|
30
30
|
};
|
31
|
-
export declare class ObjectSchema<Props extends ObjectSchemaProps
|
31
|
+
export declare class ObjectSchema<Props extends ObjectSchemaProps, Src extends ObjectSchemaSrcOf<Props> | null> extends Schema<Src> {
|
32
32
|
readonly items: Props;
|
33
33
|
readonly opt: boolean;
|
34
34
|
constructor(items: Props, opt?: boolean);
|
35
|
-
validate(path: SourcePath, src:
|
36
|
-
assert(src:
|
37
|
-
nullable(): Schema<
|
35
|
+
validate(path: SourcePath, src: Src): ValidationErrors;
|
36
|
+
assert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
|
37
|
+
nullable(): Schema<Src | null>;
|
38
38
|
serialize(): SerializedSchema;
|
39
39
|
}
|
40
40
|
export declare const object: <Props extends ObjectSchemaProps>(schema: Props) => Schema<{ [key in keyof Props]: SelectorOfSchema<Props[key]>; }>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Schema, SelectorOfSchema, SerializedSchema } from "./index.js";
|
1
|
+
import { Schema, SchemaAssertResult, SelectorOfSchema, SerializedSchema } from "./index.js";
|
2
2
|
import { SelectorSource } from "../selector/index.js";
|
3
3
|
import { SourcePath } from "../val/index.js";
|
4
4
|
import { ValidationErrors } from "./validation/ValidationError.js";
|
@@ -7,13 +7,13 @@ export type SerializedRecordSchema = {
|
|
7
7
|
item: SerializedSchema;
|
8
8
|
opt: boolean;
|
9
9
|
};
|
10
|
-
export declare class RecordSchema<T extends Schema<SelectorSource
|
10
|
+
export declare class RecordSchema<T extends Schema<SelectorSource>, Src extends Record<string, SelectorOfSchema<T>> | null> extends Schema<Src> {
|
11
11
|
readonly item: T;
|
12
12
|
readonly opt: boolean;
|
13
13
|
constructor(item: T, opt?: boolean);
|
14
|
-
validate(path: SourcePath, src:
|
15
|
-
assert(
|
16
|
-
nullable(): Schema<
|
14
|
+
validate(path: SourcePath, src: Src): ValidationErrors;
|
15
|
+
assert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
|
16
|
+
nullable(): Schema<Src | null>;
|
17
17
|
serialize(): SerializedRecordSchema;
|
18
18
|
}
|
19
19
|
export declare const record: <S extends Schema<SelectorSource>>(schema: S) => Schema<Record<string, SelectorOfSchema<S>>>;
|
@@ -1,39 +1,20 @@
|
|
1
|
-
import { Schema, SerializedSchema } from "./index.js";
|
1
|
+
import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
|
2
2
|
import { RichTextSource, RichTextOptions } from "../source/richtext.js";
|
3
3
|
import { SourcePath } from "../val/index.js";
|
4
4
|
import { ValidationErrors } from "./validation/ValidationError.js";
|
5
5
|
export type SerializedRichTextSchema = {
|
6
6
|
type: "richtext";
|
7
7
|
opt: boolean;
|
8
|
-
options
|
8
|
+
options?: RichTextOptions;
|
9
9
|
};
|
10
10
|
export declare class RichTextSchema<O extends RichTextOptions, Src extends RichTextSource<O> | null> extends Schema<Src> {
|
11
11
|
readonly options: O;
|
12
12
|
readonly opt: boolean;
|
13
13
|
constructor(options: O, opt?: boolean);
|
14
14
|
validate(path: SourcePath, src: Src): ValidationErrors;
|
15
|
-
assert(src:
|
16
|
-
|
15
|
+
assert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
|
16
|
+
private recursiveAssert;
|
17
|
+
nullable(): Schema<Src | null>;
|
17
18
|
serialize(): SerializedSchema;
|
18
19
|
}
|
19
|
-
export declare const richtext: <O extends
|
20
|
-
style: Partial<{
|
21
|
-
bold: boolean;
|
22
|
-
italic: boolean;
|
23
|
-
lineThrough: boolean;
|
24
|
-
}>;
|
25
|
-
block: Partial<{
|
26
|
-
h1: boolean;
|
27
|
-
h2: boolean;
|
28
|
-
h3: boolean;
|
29
|
-
h4: boolean;
|
30
|
-
h5: boolean;
|
31
|
-
h6: boolean;
|
32
|
-
ul: boolean;
|
33
|
-
ol: boolean;
|
34
|
-
}>;
|
35
|
-
inline: Partial<{
|
36
|
-
a: boolean;
|
37
|
-
img: boolean;
|
38
|
-
}>;
|
39
|
-
}>>(options?: O | undefined) => Schema<RichTextSource<O>>;
|
20
|
+
export declare const richtext: <O extends RichTextOptions>(options?: O) => Schema<RichTextSource<O>>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Schema, SerializedSchema } from "./index.js";
|
1
|
+
import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
|
2
2
|
import { SourcePath } from "../val/index.js";
|
3
3
|
import { ValidationErrors } from "./validation/ValidationError.js";
|
4
4
|
type StringOptions = {
|
@@ -32,7 +32,7 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
|
|
32
32
|
max(maxLength: number): StringSchema<Src>;
|
33
33
|
regexp(regexp: RegExp): StringSchema<Src>;
|
34
34
|
validate(path: SourcePath, src: Src): ValidationErrors;
|
35
|
-
assert(src:
|
35
|
+
assert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
|
36
36
|
nullable(): StringSchema<Src | null>;
|
37
37
|
raw(): StringSchema<Src extends null ? RawString | null : RawString>;
|
38
38
|
serialize(): SerializedSchema;
|
@@ -1,12 +1,21 @@
|
|
1
|
-
import { Schema, SerializedSchema } from "./index.js";
|
1
|
+
import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
|
2
2
|
import { SelectorSource } from "../selector/index.js";
|
3
3
|
import { SourceObject } from "../source/index.js";
|
4
4
|
import { SourcePath } from "../val/index.js";
|
5
|
+
import { SerializedLiteralSchema } from "./literal.js";
|
6
|
+
import { SerializedObjectSchema } from "./object.js";
|
5
7
|
import { ValidationErrors } from "./validation/ValidationError.js";
|
6
|
-
export type SerializedUnionSchema =
|
8
|
+
export type SerializedUnionSchema = SerializedStringUnionSchema | SerializedObjectUnionSchema;
|
9
|
+
export type SerializedStringUnionSchema = {
|
7
10
|
type: "union";
|
8
|
-
key:
|
9
|
-
items:
|
11
|
+
key: SerializedLiteralSchema;
|
12
|
+
items: SerializedLiteralSchema[];
|
13
|
+
opt: boolean;
|
14
|
+
};
|
15
|
+
export type SerializedObjectUnionSchema = {
|
16
|
+
type: "union";
|
17
|
+
key: string;
|
18
|
+
items: SerializedObjectSchema[];
|
10
19
|
opt: boolean;
|
11
20
|
};
|
12
21
|
type SourceOf<Key extends string | Schema<string>, T extends Schema<Key extends string ? SourceObject & {
|
@@ -14,25 +23,15 @@ type SourceOf<Key extends string | Schema<string>, T extends Schema<Key extends
|
|
14
23
|
} : Key extends Schema<string> ? string : unknown>[]> = T extends Schema<infer S>[] ? S extends SelectorSource ? S | (Key extends Schema<infer K> ? K : never) : never : never;
|
15
24
|
export declare class UnionSchema<Key extends string | Schema<string>, T extends Schema<Key extends string ? SourceObject & {
|
16
25
|
[k in Key]: string;
|
17
|
-
} : Key extends Schema<string> ? string : unknown>[]
|
26
|
+
} : Key extends Schema<string> ? string : unknown>[], Src extends SourceOf<Key, T> | null> extends Schema<Src> {
|
18
27
|
readonly key: Key;
|
19
28
|
readonly items: T;
|
20
29
|
readonly opt: boolean;
|
21
|
-
validate(path: SourcePath, src:
|
22
|
-
assert(
|
23
|
-
nullable(): Schema<
|
30
|
+
validate(path: SourcePath, src: Src): ValidationErrors;
|
31
|
+
assert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
|
32
|
+
nullable(): Schema<Src | null>;
|
24
33
|
serialize(): SerializedSchema;
|
25
34
|
constructor(key: Key, items: T, opt?: boolean);
|
26
35
|
}
|
27
|
-
export declare const union: <Key extends string | Schema<string>, T extends Schema<Key extends string ? {
|
28
|
-
[x: string]: import("../source/index.js").Source;
|
29
|
-
} & {
|
30
|
-
fold?: undefined;
|
31
|
-
assert?: undefined;
|
32
|
-
andThen?: undefined;
|
33
|
-
_ref?: undefined;
|
34
|
-
_type?: undefined;
|
35
|
-
val?: undefined;
|
36
|
-
valPath?: undefined;
|
37
|
-
} & { [k in Key]: string; } : Key extends Schema<string> ? string : unknown>[]>(key: Key, ...objects: T) => Schema<SourceOf<Key, T>>;
|
36
|
+
export declare const union: <Key extends string | Schema<string>, T extends Schema<Key extends string ? SourceObject & { [k in Key]: string; } : Key extends Schema<string> ? string : unknown>[]>(key: Key, ...objects: T) => Schema<SourceOf<Key, T>>;
|
38
37
|
export {};
|
@@ -4,4 +4,5 @@ import { ModulePath, SourcePath } from "../val/index.js";
|
|
4
4
|
export declare function isSelector(source: any): source is GenericSelector<Source>;
|
5
5
|
export declare function newSelectorProxy(source: any, path?: SourcePath, moduleSchema?: any): any;
|
6
6
|
export declare function createValPathOfItem(arrayPath: SourcePath | ModulePath | undefined, prop: string | number | symbol): SourcePath | undefined;
|
7
|
+
export declare function unsafeCreateSourcePath(path: string, itemKey: string | number | symbol): SourcePath;
|
7
8
|
export declare function selectorToVal(s: any): any;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { VAL_EXTENSION } from "./index.js";
|
2
|
+
import { ValConfig } from "../initVal.js";
|
2
3
|
import { Json } from "../Json.js";
|
3
4
|
export declare const FILE_REF_PROP: "_ref";
|
4
5
|
export declare const FILE_REF_SUBTYPE_TAG: "_tag";
|
@@ -18,8 +19,10 @@ export type FileSource<Metadata extends FileMetadata | undefined = FileMetadata
|
|
18
19
|
readonly metadata?: Metadata;
|
19
20
|
readonly patch_id?: string;
|
20
21
|
};
|
21
|
-
export declare
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
export declare const initFile: (config?: ValConfig) => {
|
23
|
+
<Metadata extends {
|
24
|
+
readonly [key: string]: Json;
|
25
|
+
}>(ref: `${`/public/${string}`}/${string}`, metadata: Metadata): FileSource<Metadata>;
|
26
|
+
(ref: `${`/public/${string}`}/${string}`, metadata?: undefined): FileSource<undefined>;
|
27
|
+
};
|
25
28
|
export declare function isFile(obj: unknown): obj is FileSource;
|
@@ -48,6 +48,13 @@ export type LineThrough<O extends RichTextOptions> = NonNullable<O["style"]>["li
|
|
48
48
|
export type Italic<O extends RichTextOptions> = NonNullable<O["style"]>["italic"] extends true ? "italic" : never;
|
49
49
|
export type Bold<O extends RichTextOptions> = NonNullable<O["style"]>["bold"] extends true ? "bold" : never;
|
50
50
|
export type Styles<O extends RichTextOptions> = LineThrough<O> | Italic<O> | Bold<O>;
|
51
|
+
export type GenericRichTextSourceNode = {
|
52
|
+
tag: string;
|
53
|
+
styles?: string[];
|
54
|
+
href?: string;
|
55
|
+
src?: ImageSource;
|
56
|
+
children?: (string | GenericRichTextSourceNode)[];
|
57
|
+
};
|
51
58
|
export type ParagraphNode<O extends RichTextOptions> = {
|
52
59
|
tag: "p";
|
53
60
|
children: (string | SpanNode<O> | BrNode | LinkNode<O> | ImageNode<O> | CustomInlineNode<O>)[];
|
@@ -22,7 +22,7 @@ export type Val<T extends Json> = Json extends T ? {
|
|
22
22
|
readonly val: Source;
|
23
23
|
} : T extends JsonObject ? ObjectVal<T> : T extends JsonArray ? ArrayVal<T> : T extends JsonPrimitive ? PrimitiveVal<T> : never;
|
24
24
|
export declare function isVal<T extends Json>(val: unknown): val is Val<T>;
|
25
|
-
declare const brand
|
25
|
+
declare const brand = "VAL_DATA_TYPE";
|
26
26
|
/**
|
27
27
|
* The path of the source value.
|
28
28
|
*
|