@valbuild/core 0.96.2 → 0.97.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.
Files changed (28) hide show
  1. package/dist/declarations/src/index.d.ts +1 -0
  2. package/dist/declarations/src/initSchema.d.ts +13 -0
  3. package/dist/declarations/src/schema/array.d.ts +10 -1
  4. package/dist/declarations/src/schema/boolean.d.ts +10 -1
  5. package/dist/declarations/src/schema/date.d.ts +10 -1
  6. package/dist/declarations/src/schema/datetime.d.ts +56 -0
  7. package/dist/declarations/src/schema/file.d.ts +10 -1
  8. package/dist/declarations/src/schema/image.d.ts +10 -1
  9. package/dist/declarations/src/schema/index.d.ts +16 -1
  10. package/dist/declarations/src/schema/keyOf.d.ts +10 -1
  11. package/dist/declarations/src/schema/literal.d.ts +10 -1
  12. package/dist/declarations/src/schema/number.d.ts +10 -1
  13. package/dist/declarations/src/schema/object.d.ts +10 -1
  14. package/dist/declarations/src/schema/record.d.ts +10 -1
  15. package/dist/declarations/src/schema/richtext.d.ts +10 -1
  16. package/dist/declarations/src/schema/route.d.ts +10 -1
  17. package/dist/declarations/src/schema/string.d.ts +10 -1
  18. package/dist/declarations/src/schema/union.d.ts +13 -1
  19. package/dist/{index-68cee7e3.esm.js → index-50fd9c06.esm.js} +669 -137
  20. package/dist/{index-1d88f031.cjs.dev.js → index-96716d5d.cjs.dev.js} +669 -136
  21. package/dist/{index-2e89de75.cjs.prod.js → index-f203e2fa.cjs.prod.js} +669 -136
  22. package/dist/valbuild-core.cjs.dev.js +2 -1
  23. package/dist/valbuild-core.cjs.prod.js +2 -1
  24. package/dist/valbuild-core.esm.js +1 -1
  25. package/package.json +1 -1
  26. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  27. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  28. package/patch/dist/valbuild-core-patch.esm.js +2 -2
@@ -47,6 +47,7 @@ export { type SerializedBooleanSchema, BooleanSchema } from "./schema/boolean.js
47
47
  export { type SerializedImageSchema, ImageSchema } from "./schema/image.js";
48
48
  export { type SerializedFileSchema, FileSchema } from "./schema/file.js";
49
49
  export { type SerializedDateSchema, DateSchema } from "./schema/date.js";
50
+ export { type SerializedDateTimeSchema, DateTimeSchema, } from "./schema/datetime.js";
50
51
  export { type SerializedKeyOfSchema, KeyOfSchema } from "./schema/keyOf.js";
51
52
  export { type SerializedRouteSchema, RouteSchema } from "./schema/route.js";
52
53
  export { type SerializedRichTextSchema, RichTextSchema, } from "./schema/richtext.js";
@@ -12,6 +12,7 @@ import { record } from "./schema/record.js";
12
12
  import { file } from "./schema/file.js";
13
13
  import { files } from "./schema/files.js";
14
14
  import { date } from "./schema/date.js";
15
+ import { datetime } from "./schema/datetime.js";
15
16
  import { route } from "./schema/route.js";
16
17
  import { router } from "./schema/router.js";
17
18
  import { images } from "./schema/images.js";
@@ -161,6 +162,17 @@ export type InitSchema = {
161
162
  *
162
163
  */
163
164
  readonly date: typeof date;
165
+ /**
166
+ * Define a date and time.
167
+ *
168
+ * Stored as an ISO 8601 datetime string (UTC).
169
+ *
170
+ * @example
171
+ * const schema = s.datetime();
172
+ * export default c.define("/example.val.ts", schema, "2025-01-01T12:00:00.000Z");
173
+ *
174
+ */
175
+ readonly datetime: typeof datetime;
164
176
  /**
165
177
  * Define a string that references a route path in your application.
166
178
  *
@@ -270,6 +282,7 @@ export declare function initSchema(): {
270
282
  mimeType: string;
271
283
  }>, import("./schema/index.js").Schema<string>, Record<string, import("./schema/files.js").FilesEntryMetadata>>;
272
284
  date: (options?: Record<string, never>) => import("./schema/date.js").DateSchema<import("./schema/string.js").RawString>;
285
+ datetime: (options?: Record<string, never>) => import("./schema/datetime.js").DateTimeSchema<import("./schema/string.js").RawString>;
273
286
  route: <T extends string>(options?: Record<string, never>) => import("./schema/route.js").RouteSchema<T>;
274
287
  router: typeof router;
275
288
  images: <Accept extends `image/${string}`>(options: import("./schema/images.js").ImagesOptions<Accept>) => import("./schema/record.js").RecordSchema<import("./schema/object.js").ObjectSchema<{
@@ -9,16 +9,25 @@ export type SerializedArraySchema = {
9
9
  item: SerializedSchema;
10
10
  opt: boolean;
11
11
  customValidate?: boolean;
12
+ readonly?: boolean;
13
+ hidden?: boolean;
14
+ description?: string;
12
15
  };
13
16
  export declare class ArraySchema<T extends Schema<SelectorSource>, Src extends SelectorOfSchema<T>[] | null> extends Schema<Src> {
14
17
  private readonly item;
15
18
  private readonly opt;
16
19
  private readonly customValidateFunctions;
17
- constructor(item: T, opt?: boolean, customValidateFunctions?: ((src: Src) => false | string)[]);
20
+ private readonly isReadonly;
21
+ private readonly isHidden;
22
+ private readonly description?;
23
+ constructor(item: T, opt?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
24
+ describe(description: string | null): ArraySchema<T, Src>;
18
25
  validate(validationFunction: (src: Src) => false | string): ArraySchema<T, Src>;
19
26
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
20
27
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
21
28
  nullable(): ArraySchema<T, Src | null>;
29
+ readonly(): ArraySchema<T, Src>;
30
+ hidden(): ArraySchema<T, Src>;
22
31
  protected executeSerialize(): SerializedArraySchema;
23
32
  private renderInput;
24
33
  protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
@@ -6,15 +6,24 @@ export type SerializedBooleanSchema = {
6
6
  type: "boolean";
7
7
  opt: boolean;
8
8
  customValidate?: boolean;
9
+ readonly?: boolean;
10
+ hidden?: boolean;
11
+ description?: string;
9
12
  };
10
13
  export declare class BooleanSchema<Src extends boolean | null> extends Schema<Src> {
11
14
  private readonly opt;
12
15
  private readonly customValidateFunctions;
13
- constructor(opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
16
+ private readonly isReadonly;
17
+ private readonly isHidden;
18
+ private readonly description?;
19
+ constructor(opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
20
+ describe(description: string | null): BooleanSchema<Src>;
14
21
  validate(validationFunction: (src: Src) => false | string): BooleanSchema<Src>;
15
22
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
16
23
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
17
24
  nullable(): BooleanSchema<Src | null>;
25
+ readonly(): BooleanSchema<Src>;
26
+ hidden(): BooleanSchema<Src>;
18
27
  protected executeSerialize(): SerializedSchema;
19
28
  protected executeRender(): ReifiedRender;
20
29
  }
@@ -24,18 +24,27 @@ export type SerializedDateSchema = {
24
24
  options?: DateOptions;
25
25
  opt: boolean;
26
26
  customValidate?: boolean;
27
+ readonly?: boolean;
28
+ hidden?: boolean;
29
+ description?: string;
27
30
  };
28
31
  export declare class DateSchema<Src extends string | null> extends Schema<Src> {
29
32
  private readonly options?;
30
33
  private readonly opt;
31
34
  private readonly customValidateFunctions;
32
- constructor(options?: DateOptions | undefined, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
35
+ private readonly isReadonly;
36
+ private readonly isHidden;
37
+ private readonly description?;
38
+ constructor(options?: DateOptions | undefined, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
39
+ describe(description: string | null): DateSchema<Src>;
33
40
  validate(validationFunction: (src: Src) => false | string): DateSchema<Src>;
34
41
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
35
42
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
36
43
  from(from: string): DateSchema<Src>;
37
44
  to(to: string): DateSchema<Src>;
38
45
  nullable(): DateSchema<Src | null>;
46
+ readonly(): DateSchema<Src>;
47
+ hidden(): DateSchema<Src>;
39
48
  protected executeSerialize(): SerializedSchema;
40
49
  protected executeRender(): ReifiedRender;
41
50
  }
@@ -0,0 +1,56 @@
1
+ import { CustomValidateFunction, Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
+ import { ReifiedRender } from "../render.js";
3
+ import { SourcePath } from "../val/index.js";
4
+ import { RawString } from "./string.js";
5
+ import { ValidationErrors } from "./validation/ValidationError.js";
6
+ type DateTimeOptions = {
7
+ /**
8
+ * Validate that the datetime is this datetime or after (inclusive).
9
+ *
10
+ * Accepts any ISO 8601 datetime string parseable by `Date.parse`.
11
+ *
12
+ * @example
13
+ * 2021-01-01T00:00:00Z
14
+ */
15
+ from?: string;
16
+ /**
17
+ * Validate that the datetime is this datetime or before (inclusive).
18
+ *
19
+ * Accepts any ISO 8601 datetime string parseable by `Date.parse`.
20
+ *
21
+ * @example
22
+ * 2021-12-31T23:59:59Z
23
+ */
24
+ to?: string;
25
+ };
26
+ export type SerializedDateTimeSchema = {
27
+ type: "dateTime";
28
+ options?: DateTimeOptions;
29
+ opt: boolean;
30
+ customValidate?: boolean;
31
+ readonly?: boolean;
32
+ hidden?: boolean;
33
+ description?: string;
34
+ };
35
+ export declare class DateTimeSchema<Src extends string | null> extends Schema<Src> {
36
+ private readonly options?;
37
+ private readonly opt;
38
+ private readonly customValidateFunctions;
39
+ private readonly isReadonly;
40
+ private readonly isHidden;
41
+ private readonly description?;
42
+ constructor(options?: DateTimeOptions | undefined, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
43
+ describe(description: string | null): DateTimeSchema<Src>;
44
+ validate(validationFunction: (src: Src) => false | string): DateTimeSchema<Src>;
45
+ protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
46
+ protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
47
+ from(from: string): DateTimeSchema<Src>;
48
+ to(to: string): DateTimeSchema<Src>;
49
+ nullable(): DateTimeSchema<Src | null>;
50
+ readonly(): DateTimeSchema<Src>;
51
+ hidden(): DateTimeSchema<Src>;
52
+ protected executeSerialize(): SerializedSchema;
53
+ protected executeRender(): ReifiedRender;
54
+ }
55
+ export declare const datetime: (options?: Record<string, never>) => DateTimeSchema<RawString>;
56
+ export {};
@@ -16,6 +16,9 @@ export type SerializedFileSchema = {
16
16
  opt: boolean;
17
17
  customValidate?: boolean;
18
18
  referencedModule?: string;
19
+ readonly?: boolean;
20
+ hidden?: boolean;
21
+ description?: string;
19
22
  };
20
23
  export type FileMetadata = {
21
24
  mimeType?: string;
@@ -26,12 +29,18 @@ export declare class FileSchema<Src extends FileSource<FileMetadata | undefined>
26
29
  protected readonly isRemote: boolean;
27
30
  private readonly customValidateFunctions;
28
31
  private readonly moduleMetadata;
29
- constructor(options?: FileOptions | undefined, opt?: boolean, isRemote?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], moduleMetadata?: Record<ModulePath, Record<string, FilesEntryMetadata>>);
32
+ private readonly isReadonly;
33
+ private readonly isHidden;
34
+ private readonly description?;
35
+ constructor(options?: FileOptions | undefined, opt?: boolean, isRemote?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], moduleMetadata?: Record<ModulePath, Record<string, FilesEntryMetadata>>, isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
36
+ describe(description: string | null): FileSchema<Src>;
30
37
  remote(): FileSchema<Src | RemoteSource<FileMetadata | undefined>>;
31
38
  validate(validationFunction: CustomValidateFunction<Src>): FileSchema<Src>;
32
39
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
33
40
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
34
41
  nullable(): FileSchema<Src | null>;
42
+ readonly(): FileSchema<Src>;
43
+ hidden(): FileSchema<Src>;
35
44
  protected executeSerialize(): SerializedSchema;
36
45
  protected executeRender(): ReifiedRender;
37
46
  }
@@ -20,6 +20,9 @@ export type SerializedImageSchema = {
20
20
  remote?: boolean;
21
21
  customValidate?: boolean;
22
22
  referencedModule?: string;
23
+ readonly?: boolean;
24
+ hidden?: boolean;
25
+ description?: string;
23
26
  };
24
27
  export type ImageMetadata = {
25
28
  width?: number;
@@ -37,12 +40,18 @@ export declare class ImageSchema<Src extends FileSource<ImageMetadata | undefine
37
40
  protected readonly isRemote: boolean;
38
41
  private readonly customValidateFunctions;
39
42
  private readonly moduleMetadata;
40
- constructor(options?: ImageOptions | undefined, opt?: boolean, isRemote?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], moduleMetadata?: Record<ModulePath, Record<string, ImagesEntryMetadata>>);
43
+ private readonly isReadonly;
44
+ private readonly isHidden;
45
+ private readonly description?;
46
+ constructor(options?: ImageOptions | undefined, opt?: boolean, isRemote?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], moduleMetadata?: Record<ModulePath, Record<string, ImagesEntryMetadata>>, isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
47
+ describe(description: string | null): ImageSchema<Src>;
41
48
  remote(): ImageSchema<Src | RemoteSource<ImageMetadata | undefined>>;
42
49
  validate(validationFunction: CustomValidateFunction<Src>): ImageSchema<Src>;
43
50
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
44
51
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
45
52
  nullable(): ImageSchema<Src | null>;
53
+ readonly(): ImageSchema<Src>;
54
+ hidden(): ImageSchema<Src>;
46
55
  protected executeSerialize(): SerializedSchema;
47
56
  protected executeRender(): ReifiedRender;
48
57
  }
@@ -13,12 +13,13 @@ import { SerializedRichTextSchema } from "./richtext.js";
13
13
  import { RawString, SerializedStringSchema } from "./string.js";
14
14
  import { SerializedUnionSchema } from "./union.js";
15
15
  import { SerializedDateSchema } from "./date.js";
16
+ import { SerializedDateTimeSchema } from "./datetime.js";
16
17
  import { SerializedRouteSchema } from "./route.js";
17
18
  import { ValidationError, ValidationErrors } from "./validation/ValidationError.js";
18
19
  import { FileSource } from "../source/file.js";
19
20
  import { GenericRichTextSourceNode, RichTextSource } from "../source/richtext.js";
20
21
  import { ReifiedRender } from "../render.js";
21
- export type SerializedSchema = SerializedStringSchema | SerializedLiteralSchema | SerializedBooleanSchema | SerializedNumberSchema | SerializedObjectSchema | SerializedArraySchema | SerializedUnionSchema | SerializedRichTextSchema | SerializedRecordSchema | SerializedKeyOfSchema | SerializedFileSchema | SerializedDateSchema | SerializedRouteSchema | SerializedImageSchema;
22
+ export type SerializedSchema = SerializedStringSchema | SerializedLiteralSchema | SerializedBooleanSchema | SerializedNumberSchema | SerializedObjectSchema | SerializedArraySchema | SerializedUnionSchema | SerializedRichTextSchema | SerializedRecordSchema | SerializedKeyOfSchema | SerializedFileSchema | SerializedDateSchema | SerializedDateTimeSchema | SerializedRouteSchema | SerializedImageSchema;
22
23
  type Primitives = number | string | boolean | null | FileSource;
23
24
  export type AssertError = {
24
25
  message: string;
@@ -67,6 +68,20 @@ export declare abstract class Schema<Src extends SelectorSource> {
67
68
  */
68
69
  protected abstract executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
69
70
  abstract nullable(): Schema<Src | null>;
71
+ /**
72
+ * Mark this field as read-only in the Val editor.
73
+ *
74
+ * This is a UI-only flag: the field is rendered disabled in the editor, but
75
+ * the value is not otherwise validated or enforced differently.
76
+ */
77
+ abstract readonly(): Schema<Src>;
78
+ /**
79
+ * Hide this field from the Val editor.
80
+ *
81
+ * This is a UI-only flag: the field is not rendered in the editor, but the
82
+ * value is still stored, validated and serialized as normal.
83
+ */
84
+ abstract hidden(): Schema<Src>;
70
85
  protected abstract executeSerialize(): SerializedSchema;
71
86
  protected abstract executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
72
87
  /** MUTATES! since internal and perf sensitive */
@@ -13,6 +13,9 @@ export type SerializedKeyOfSchema = {
13
13
  opt: boolean;
14
14
  values: "string" | string[];
15
15
  customValidate?: boolean;
16
+ readonly?: boolean;
17
+ hidden?: boolean;
18
+ description?: string;
16
19
  };
17
20
  type SerializedRefSchema = {
18
21
  type: "object";
@@ -28,11 +31,17 @@ export declare class KeyOfSchema<Sel extends GenericSelector<SourceObject>, Src
28
31
  private readonly sourcePath?;
29
32
  private readonly opt;
30
33
  private readonly customValidateFunctions;
31
- constructor(schema?: SerializedRefSchema | undefined, sourcePath?: SourcePath | undefined, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
34
+ private readonly isReadonly;
35
+ private readonly isHidden;
36
+ private readonly description?;
37
+ constructor(schema?: SerializedRefSchema | undefined, sourcePath?: SourcePath | undefined, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
38
+ describe(description: string | null): KeyOfSchema<Sel, Src>;
32
39
  validate(validationFunction: (src: Src) => false | string): KeyOfSchema<Sel, Src>;
33
40
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
34
41
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
35
42
  nullable(): KeyOfSchema<Sel, Src | null>;
43
+ readonly(): KeyOfSchema<Sel, Src>;
44
+ hidden(): KeyOfSchema<Sel, Src>;
36
45
  protected executeSerialize(): SerializedSchema;
37
46
  protected executeRender(): ReifiedRender;
38
47
  }
@@ -7,16 +7,25 @@ export type SerializedLiteralSchema = {
7
7
  value: string;
8
8
  opt: boolean;
9
9
  customValidate?: boolean;
10
+ readonly?: boolean;
11
+ hidden?: boolean;
12
+ description?: string;
10
13
  };
11
14
  export declare class LiteralSchema<Src extends string | null> extends Schema<Src> {
12
15
  private readonly value;
13
16
  private readonly opt;
14
17
  private readonly customValidateFunctions;
15
- constructor(value: string, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
18
+ private readonly isReadonly;
19
+ private readonly isHidden;
20
+ private readonly description?;
21
+ constructor(value: string, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
22
+ describe(description: string | null): LiteralSchema<Src>;
16
23
  validate(validationFunction: (src: Src) => false | string): LiteralSchema<Src>;
17
24
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
18
25
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
19
26
  nullable(): LiteralSchema<Src | null>;
27
+ readonly(): LiteralSchema<Src>;
28
+ hidden(): LiteralSchema<Src>;
20
29
  protected executeSerialize(): SerializedSchema;
21
30
  protected executeRender(): ReifiedRender;
22
31
  }
@@ -11,16 +11,25 @@ export type SerializedNumberSchema = {
11
11
  options?: NumberOptions;
12
12
  opt: boolean;
13
13
  customValidate?: boolean;
14
+ readonly?: boolean;
15
+ hidden?: boolean;
16
+ description?: string;
14
17
  };
15
18
  export declare class NumberSchema<Src extends number | null> extends Schema<Src> {
16
19
  private readonly options?;
17
20
  private readonly opt;
18
21
  private readonly customValidateFunctions;
19
- constructor(options?: NumberOptions | undefined, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
22
+ private readonly isReadonly;
23
+ private readonly isHidden;
24
+ private readonly description?;
25
+ constructor(options?: NumberOptions | undefined, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
26
+ describe(description: string | null): NumberSchema<Src>;
20
27
  validate(validationFunction: (src: Src) => false | string): NumberSchema<Src>;
21
28
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
22
29
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
23
30
  nullable(): NumberSchema<Src | null>;
31
+ readonly(): NumberSchema<Src>;
32
+ hidden(): NumberSchema<Src>;
24
33
  max(max: number): NumberSchema<Src>;
25
34
  min(min: number): NumberSchema<Src>;
26
35
  protected executeSerialize(): SerializedSchema;
@@ -8,6 +8,9 @@ export type SerializedObjectSchema = {
8
8
  items: Record<string, SerializedSchema>;
9
9
  opt: boolean;
10
10
  customValidate?: boolean;
11
+ readonly?: boolean;
12
+ hidden?: boolean;
13
+ description?: string;
11
14
  };
12
15
  type ObjectSchemaProps = {
13
16
  [key: string]: Schema<SelectorSource>;
@@ -36,11 +39,17 @@ export declare class ObjectSchema<Props extends ObjectSchemaProps, Src extends O
36
39
  private readonly items;
37
40
  private readonly opt;
38
41
  private readonly customValidateFunctions;
39
- constructor(items: Props, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
42
+ private readonly isReadonly;
43
+ private readonly isHidden;
44
+ private readonly description?;
45
+ constructor(items: Props, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
46
+ describe(description: string | null): ObjectSchema<Props, Src>;
40
47
  validate(validationFunction: (src: Src) => false | string): ObjectSchema<Props, Src>;
41
48
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
42
49
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
43
50
  nullable(): ObjectSchema<Props, Src | null>;
51
+ readonly(): ObjectSchema<Props, Src>;
52
+ hidden(): ObjectSchema<Props, Src>;
44
53
  protected executeSerialize(): SerializedSchema;
45
54
  protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
46
55
  }
@@ -26,6 +26,9 @@ export type SerializedRecordSchema = {
26
26
  directory?: string;
27
27
  remote?: boolean;
28
28
  alt?: SerializedSchema;
29
+ readonly?: boolean;
30
+ hidden?: boolean;
31
+ description?: string;
29
32
  };
30
33
  export declare class RecordSchema<T extends Schema<SelectorSource>, K extends Schema<string>, Src extends Record<SelectorOfSchema<K>, SelectorOfSchema<T>> | null> extends Schema<Src> {
31
34
  private readonly item;
@@ -34,7 +37,11 @@ export declare class RecordSchema<T extends Schema<SelectorSource>, K extends Sc
34
37
  private readonly currentRouter;
35
38
  private readonly keySchema;
36
39
  private readonly mediaOptions?;
37
- constructor(item: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], currentRouter?: ValRouter | null, keySchema?: Schema<string> | null, mediaOptions?: MediaOptions | undefined);
40
+ private readonly isReadonly;
41
+ private readonly isHidden;
42
+ private readonly description?;
43
+ constructor(item: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], currentRouter?: ValRouter | null, keySchema?: Schema<string> | null, mediaOptions?: MediaOptions | undefined, isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
44
+ describe(description: string | null): RecordSchema<T, K, Src>;
38
45
  validate(validationFunction: (src: Src) => false | string): RecordSchema<T, K, Src>;
39
46
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
40
47
  private isRemoteUrl;
@@ -43,6 +50,8 @@ export declare class RecordSchema<T extends Schema<SelectorSource>, K extends Sc
43
50
  private validateMediaMimeType;
44
51
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
45
52
  nullable(): RecordSchema<T, K, Src | null>;
53
+ readonly(): RecordSchema<T, K, Src>;
54
+ hidden(): RecordSchema<T, K, Src>;
46
55
  router(router: ValRouter): RecordSchema<T, K, Src>;
47
56
  remote(): RecordSchema<T, K, Src>;
48
57
  private getRouterValidations;
@@ -12,12 +12,19 @@ export type SerializedRichTextSchema = {
12
12
  opt: boolean;
13
13
  options?: SerializedRichTextOptions & ValidationOptions;
14
14
  customValidate?: boolean;
15
+ readonly?: boolean;
16
+ hidden?: boolean;
17
+ description?: string;
15
18
  };
16
19
  export declare class RichTextSchema<O extends RichTextOptions, Src extends RichTextSource<O> | null> extends Schema<Src> {
17
20
  private readonly options;
18
21
  private readonly opt;
19
22
  private readonly customValidateFunctions;
20
- constructor(options: O & ValidationOptions, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
23
+ private readonly isReadonly;
24
+ private readonly isHidden;
25
+ private readonly description?;
26
+ constructor(options: O & ValidationOptions, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
27
+ describe(description: string | null): RichTextSchema<O, Src>;
21
28
  maxLength(max: number): RichTextSchema<O, Src>;
22
29
  minLength(min: number): RichTextSchema<O, Src>;
23
30
  validate(validationFunction: (src: Src) => false | string): RichTextSchema<O, Src>;
@@ -26,6 +33,8 @@ export declare class RichTextSchema<O extends RichTextOptions, Src extends RichT
26
33
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
27
34
  private recursiveAssert;
28
35
  nullable(): RichTextSchema<O, Src | null>;
36
+ readonly(): RichTextSchema<O, Src>;
37
+ hidden(): RichTextSchema<O, Src>;
29
38
  protected executeSerialize(): SerializedSchema;
30
39
  protected executeRender(): ReifiedRender;
31
40
  }
@@ -21,12 +21,19 @@ export type SerializedRouteSchema = {
21
21
  };
22
22
  opt: boolean;
23
23
  customValidate?: boolean;
24
+ readonly?: boolean;
25
+ hidden?: boolean;
26
+ description?: string;
24
27
  };
25
28
  export declare class RouteSchema<Src extends string | null> extends Schema<Src> {
26
29
  private readonly options?;
27
30
  private readonly opt;
28
31
  private readonly customValidateFunctions;
29
- constructor(options?: RouteOptions | undefined, opt?: boolean, customValidateFunctions?: ((src: Src) => false | string)[]);
32
+ private readonly isReadonly;
33
+ private readonly isHidden;
34
+ private readonly description?;
35
+ constructor(options?: RouteOptions | undefined, opt?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
36
+ describe(description: string | null): RouteSchema<Src>;
30
37
  /**
31
38
  * Specify a pattern for which routes are allowed.
32
39
  *
@@ -57,6 +64,8 @@ export declare class RouteSchema<Src extends string | null> extends Schema<Src>
57
64
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
58
65
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
59
66
  nullable(): RouteSchema<Src | null>;
67
+ readonly(): RouteSchema<Src>;
68
+ hidden(): RouteSchema<Src>;
60
69
  protected executeSerialize(): SerializedSchema;
61
70
  protected executeRender(): ReifiedRender;
62
71
  }
@@ -23,6 +23,9 @@ export type SerializedStringSchema = {
23
23
  opt: boolean;
24
24
  raw: boolean;
25
25
  customValidate?: boolean;
26
+ readonly?: boolean;
27
+ hidden?: boolean;
28
+ description?: string;
26
29
  };
27
30
  declare const brand: unique symbol;
28
31
  export type RawString = string & {
@@ -34,12 +37,16 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
34
37
  private readonly isRaw;
35
38
  private readonly customValidateFunctions;
36
39
  private readonly renderInput;
40
+ private readonly isReadonly;
41
+ private readonly isHidden;
42
+ private readonly description?;
37
43
  constructor(options?: StringOptions | undefined, opt?: boolean, isRaw?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], renderInput?: {
38
44
  as: "textarea";
39
45
  } | {
40
46
  as: "code";
41
47
  language: CodeLanguage;
42
- } | null);
48
+ } | null, isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
49
+ describe(description: string | null): StringSchema<Src>;
43
50
  /**
44
51
  * @deprecated Use `minLength` instead
45
52
  */
@@ -55,6 +62,8 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
55
62
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
56
63
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
57
64
  nullable(): StringSchema<Src | null>;
65
+ readonly(): StringSchema<Src>;
66
+ hidden(): StringSchema<Src>;
58
67
  raw(): StringSchema<Src extends null ? RawString | null : RawString>;
59
68
  protected executeSerialize(): SerializedSchema;
60
69
  render(input: {
@@ -13,6 +13,9 @@ export type SerializedStringUnionSchema = {
13
13
  items: SerializedLiteralSchema[];
14
14
  opt: boolean;
15
15
  customValidate?: boolean;
16
+ readonly?: boolean;
17
+ hidden?: boolean;
18
+ description?: string;
16
19
  };
17
20
  export type SerializedObjectUnionSchema = {
18
21
  type: "union";
@@ -20,6 +23,9 @@ export type SerializedObjectUnionSchema = {
20
23
  items: SerializedObjectSchema[];
21
24
  opt: boolean;
22
25
  customValidate?: boolean;
26
+ readonly?: boolean;
27
+ hidden?: boolean;
28
+ description?: string;
23
29
  };
24
30
  type SourceOf<Key extends string | Schema<string>, T extends Schema<Key extends string ? SourceObject & {
25
31
  [k in Key]: string;
@@ -31,12 +37,18 @@ export declare class UnionSchema<Key extends string | Schema<string>, T extends
31
37
  private readonly items;
32
38
  private readonly opt;
33
39
  private readonly customValidateFunctions;
40
+ private readonly isReadonly;
41
+ private readonly isHidden;
42
+ private readonly description?;
43
+ describe(description: string | null): UnionSchema<Key, T, Src>;
34
44
  validate(validationFunction: (src: Src) => false | string): UnionSchema<Key, T, Src>;
35
45
  protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
36
46
  protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
37
47
  nullable(): UnionSchema<Key, T, Src | null>;
48
+ readonly(): UnionSchema<Key, T, Src>;
49
+ hidden(): UnionSchema<Key, T, Src>;
38
50
  protected executeSerialize(): SerializedSchema;
39
- constructor(key: Key, items: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[]);
51
+ constructor(key: Key, items: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], isReadonly?: boolean, isHidden?: boolean, description?: string | undefined);
40
52
  protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
41
53
  }
42
54
  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) => UnionSchema<Key, T, SourceOf<Key, T>>;