@valbuild/core 0.62.5 → 0.62.6

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.
@@ -30,6 +30,14 @@ export declare function initSchema(): {
30
30
  array: <S extends import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>>(schema: S) => import("./schema/index.js").Schema<import("./schema/index.js").SelectorOfSchema<S>[]>;
31
31
  object: <Props extends {
32
32
  [key: string]: import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>;
33
+ } & {
34
+ valPath?: undefined;
35
+ val?: undefined;
36
+ _type?: undefined;
37
+ _ref?: undefined;
38
+ andThen?: undefined;
39
+ assert?: undefined;
40
+ fold?: undefined;
33
41
  }>(schema: Props) => import("./schema/index.js").Schema<{ [key in keyof Props]: import("./schema/index.js").SelectorOfSchema<Props[key]>; }>;
34
42
  number: (options?: {
35
43
  max?: number | undefined;
@@ -49,7 +57,7 @@ export declare function initSchema(): {
49
57
  richtext: <O extends import("./index.js").RichTextOptions>(options?: O | undefined) => import("./schema/index.js").Schema<import("./index.js").RichTextSource<O>>;
50
58
  image: (options?: import("./schema/image.js").ImageOptions | undefined) => import("./schema/index.js").Schema<import("./index.js").ImageSource>;
51
59
  literal: <T_2 extends string>(value: T_2) => import("./schema/index.js").Schema<T_2>;
52
- keyOf: <Src extends import("./selector/index.js").GenericSelector<import("./source/index.js").SourceObject | import("./source/index.js").SourceArray, undefined> & import("./module.js").ValModuleBrand>(valModule: Src) => import("./schema/index.js").Schema<Src extends import("./selector/index.js").GenericSelector<infer S_2 extends import("./source/index.js").Source, undefined> ? S_2 extends readonly any[] ? number : S_2 extends import("./source/index.js").SourceObject ? keyof S_2 : S_2 extends Record<string, any> ? string : never : never>;
60
+ keyOf: <Src extends import("./selector/index.js").GenericSelector<import("./source/index.js").SourceObject | import("./source/index.js").SourceArray, undefined> & import("./module.js").ValModuleBrand>(valModule: Src) => import("./schema/index.js").Schema<Src extends import("./selector/index.js").GenericSelector<infer S_2 extends import("./source/index.js").Source, undefined> ? S_2 extends readonly import("./source/index.js").Source[] ? number : S_2 extends import("./source/index.js").SourceObject ? string extends keyof S_2 ? import("./schema/string.js").RawString : keyof S_2 : S_2 extends Record<string, import("./source/index.js").Source> ? import("./schema/string.js").RawString : never : never>;
53
61
  record: <S_3 extends import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>>(schema: S_3) => import("./schema/index.js").Schema<Record<string, import("./schema/index.js").SelectorOfSchema<S_3>>>;
54
62
  file: (options?: import("./schema/file.js").FileOptions | undefined) => import("./schema/index.js").Schema<import("./index.js").FileSource<import("./schema/file.js").FileMetadata>>;
55
63
  };
@@ -1,9 +1,10 @@
1
1
  import { Schema, SerializedSchema } from "./index.js";
2
2
  import { ValModuleBrand } from "../module.js";
3
3
  import { GenericSelector } from "../selector/index.js";
4
- import { SourceArray, SourceObject } from "../source/index.js";
4
+ import { Source, SourceArray, SourceObject } from "../source/index.js";
5
5
  import { SourcePath } from "../val/index.js";
6
6
  import { ValidationErrors } from "./validation/ValidationError.js";
7
+ import { RawString } from "./string.js";
7
8
  export type SerializedKeyOfSchema = {
8
9
  type: "keyOf";
9
10
  path: SourcePath;
@@ -11,7 +12,7 @@ export type SerializedKeyOfSchema = {
11
12
  opt: boolean;
12
13
  values: "string" | "number" | string[];
13
14
  };
14
- type KeyOfSelector<Sel extends GenericSelector<SourceArray | SourceObject>> = Sel extends GenericSelector<infer S> ? S extends readonly any[] ? number : S extends SourceObject ? keyof S : S extends Record<string, any> ? string : never : never;
15
+ type KeyOfSelector<Sel extends GenericSelector<SourceArray | SourceObject>> = Sel extends GenericSelector<infer S> ? S extends readonly Source[] ? number : S extends SourceObject ? string extends keyof S ? RawString : keyof S : S extends Record<string, Source> ? RawString : never : never;
15
16
  export declare class KeyOfSchema<Sel extends GenericSelector<SourceArray | SourceObject>> extends Schema<KeyOfSelector<Sel>> {
16
17
  readonly schema?: SerializedSchema | undefined;
17
18
  readonly sourcePath?: SourcePath | undefined;
@@ -9,6 +9,21 @@ export type SerializedObjectSchema = {
9
9
  };
10
10
  type ObjectSchemaProps = {
11
11
  [key: string]: Schema<SelectorSource>;
12
+ } & {
13
+ /** Cannot create object with key: valPath. It is a reserved name */
14
+ valPath?: never;
15
+ /** Cannot create object with key: val. It is a reserved name */
16
+ val?: never;
17
+ /** Cannot create object with key: _type. It is a reserved name */
18
+ _type?: never;
19
+ /** Cannot create object with key: _ref. It is a reserved name */
20
+ _ref?: never;
21
+ /** Cannot create object with key: andThen. It is a reserved name */
22
+ andThen?: never;
23
+ /** Cannot create object with key: assert. It is a reserved name */
24
+ assert?: never;
25
+ /** Cannot create object with key: fold. It is a reserved name */
26
+ fold?: never;
12
27
  };
13
28
  type ObjectSchemaSrcOf<Props extends ObjectSchemaProps> = {
14
29
  [key in keyof Props]: SelectorOfSchema<Props[key]>;
@@ -6,12 +6,19 @@ export type Source = SourcePrimitive | SourceObject | SourceArray | I18nSource<s
6
6
  export type SourceObject = {
7
7
  [key in string]: Source;
8
8
  } & {
9
+ /** Reserved name */
9
10
  fold?: never;
11
+ /** Reserved name */
10
12
  assert?: never;
13
+ /** Reserved name */
11
14
  andThen?: never;
15
+ /** Reserved name */
12
16
  _ref?: never;
17
+ /** Reserved name */
13
18
  _type?: never;
19
+ /** Reserved name */
14
20
  val?: never;
21
+ /** Reserved name */
15
22
  valPath?: never;
16
23
  };
17
24
  export type SourceArray = readonly Source[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.62.5",
3
+ "version": "0.62.6",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {