@agentuity/schema 1.0.16 → 1.0.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/dist/coerce/boolean.d.ts +5 -5
- package/dist/coerce/boolean.d.ts.map +1 -1
- package/dist/coerce/boolean.js +3 -3
- package/dist/coerce/boolean.js.map +1 -1
- package/dist/coerce/date.d.ts +5 -5
- package/dist/coerce/date.d.ts.map +1 -1
- package/dist/coerce/date.js +3 -3
- package/dist/coerce/date.js.map +1 -1
- package/dist/coerce/number.d.ts +5 -5
- package/dist/coerce/number.d.ts.map +1 -1
- package/dist/coerce/number.js +3 -3
- package/dist/coerce/number.js.map +1 -1
- package/dist/coerce/string.d.ts +5 -5
- package/dist/coerce/string.d.ts.map +1 -1
- package/dist/coerce/string.js +3 -3
- package/dist/coerce/string.js.map +1 -1
- package/dist/complex/array.d.ts +5 -5
- package/dist/complex/array.d.ts.map +1 -1
- package/dist/complex/array.js +3 -3
- package/dist/complex/array.js.map +1 -1
- package/dist/complex/object.d.ts +5 -5
- package/dist/complex/object.d.ts.map +1 -1
- package/dist/complex/object.js +3 -3
- package/dist/complex/object.js.map +1 -1
- package/dist/complex/record.d.ts +5 -5
- package/dist/complex/record.d.ts.map +1 -1
- package/dist/complex/record.js +3 -3
- package/dist/complex/record.js.map +1 -1
- package/dist/index.d.ts +43 -43
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -39
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +1 -1
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/json-schema.js +11 -11
- package/dist/json-schema.js.map +1 -1
- package/dist/primitives/any.d.ts +5 -5
- package/dist/primitives/any.d.ts.map +1 -1
- package/dist/primitives/any.js +3 -3
- package/dist/primitives/any.js.map +1 -1
- package/dist/primitives/boolean.d.ts +5 -5
- package/dist/primitives/boolean.d.ts.map +1 -1
- package/dist/primitives/boolean.js +3 -3
- package/dist/primitives/boolean.js.map +1 -1
- package/dist/primitives/null.d.ts +5 -5
- package/dist/primitives/null.d.ts.map +1 -1
- package/dist/primitives/null.js +3 -3
- package/dist/primitives/null.js.map +1 -1
- package/dist/primitives/number.d.ts +5 -5
- package/dist/primitives/number.d.ts.map +1 -1
- package/dist/primitives/number.js +3 -3
- package/dist/primitives/number.js.map +1 -1
- package/dist/primitives/string.d.ts +5 -5
- package/dist/primitives/string.d.ts.map +1 -1
- package/dist/primitives/string.js +3 -3
- package/dist/primitives/string.js.map +1 -1
- package/dist/primitives/undefined.d.ts +5 -5
- package/dist/primitives/undefined.d.ts.map +1 -1
- package/dist/primitives/undefined.js +3 -3
- package/dist/primitives/undefined.js.map +1 -1
- package/dist/primitives/unknown.d.ts +5 -5
- package/dist/primitives/unknown.d.ts.map +1 -1
- package/dist/primitives/unknown.js +3 -3
- package/dist/primitives/unknown.js.map +1 -1
- package/dist/utils/literal.d.ts +5 -5
- package/dist/utils/literal.d.ts.map +1 -1
- package/dist/utils/literal.js +3 -3
- package/dist/utils/literal.js.map +1 -1
- package/dist/utils/nullable.d.ts +3 -3
- package/dist/utils/nullable.d.ts.map +1 -1
- package/dist/utils/nullable.js +1 -1
- package/dist/utils/nullable.js.map +1 -1
- package/dist/utils/optional.d.ts +3 -3
- package/dist/utils/optional.d.ts.map +1 -1
- package/dist/utils/optional.js +1 -1
- package/dist/utils/optional.js.map +1 -1
- package/dist/utils/union.d.ts +5 -5
- package/dist/utils/union.d.ts.map +1 -1
- package/dist/utils/union.js +3 -3
- package/dist/utils/union.js.map +1 -1
- package/package.json +3 -3
- package/src/coerce/boolean.ts +4 -4
- package/src/coerce/date.ts +4 -4
- package/src/coerce/number.ts +4 -4
- package/src/coerce/string.ts +4 -4
- package/src/complex/array.ts +4 -4
- package/src/complex/object.ts +4 -4
- package/src/complex/record.ts +4 -4
- package/src/index.ts +43 -43
- package/src/json-schema.ts +12 -12
- package/src/primitives/any.ts +4 -4
- package/src/primitives/boolean.ts +4 -4
- package/src/primitives/null.ts +4 -4
- package/src/primitives/number.ts +4 -4
- package/src/primitives/string.ts +4 -4
- package/src/primitives/undefined.ts +4 -4
- package/src/primitives/unknown.ts +4 -4
- package/src/utils/literal.ts +4 -4
- package/src/utils/nullable.ts +2 -2
- package/src/utils/optional.ts +2 -2
- package/src/utils/union.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../src/utils/optional.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../src/utils/optional.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAA+B,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;GAaG;AAEH,qBAAa,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CACrD,YAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAE7D,QAAQ,CAAC,CAAC,WAAW,CAAC,oBAAoB;IAC1C,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,WAAW;;;0BAGD,OAAO;eAMM;YAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;YAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;SAAE;MAC3F;IAGF,OAAO,CAAC,YAAY,CAA8C;gBAEtD,MAAM,EAAE,CAAC;IAIrB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAKnC,QAAQ;IAIR,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IAO5E,KAAK,oFAA2B;IAChC,SAAS,0HAA+B;CACxC;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAEjF"}
|
package/dist/utils/optional.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../src/utils/optional.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../src/utils/optional.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;GAaG;AACH,8DAA8D;AAC9D,MAAM,OAAO,cAAc;IAGjB,CAAC,WAAW,CAAC,GAAG,gBAAgB,CAAC;IACjC,MAAM,CAAI;IACnB,WAAW,CAAU;IAEZ,WAAW,GAAG;QACtB,OAAO,EAAE,CAAU;QACnB,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE;YAC5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACzB,OAAO,OAAO,CAAC,SAAiC,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;QACD,KAAK,EAAE,SAAqF;KAC5F,CAAC;IAEF,4CAA4C;IACpC,YAAY,GAAG,kBAAkB,EAAwB,CAAC;IAElE,YAAY,MAAS;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,QAAQ,CAAC,WAAmB;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,CAAC,mBAAmB;IACjC,CAAC;IAED,QAAQ;QACP,2CAA2C;QAC3C,iEAAiE;QACjE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IAChC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;CACxC;AAED;;;;;;;;;;;;GAYG;AACH,8DAA8D;AAC9D,MAAM,UAAU,QAAQ,CAA6B,MAAS;IAC7D,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/utils/union.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema, Infer } from '../base';
|
|
2
|
-
import { SCHEMA_KIND } from '../base';
|
|
1
|
+
import type { Schema, Infer } from '../base.ts';
|
|
2
|
+
import { SCHEMA_KIND } from '../base.ts';
|
|
3
3
|
type InferUnion<T extends Schema<any, any>[]> = Infer<T[number]>;
|
|
4
4
|
/**
|
|
5
5
|
* Schema for union types (one of multiple possible schemas).
|
|
@@ -36,10 +36,10 @@ export declare class UnionSchema<T extends Schema<any, any>[]> implements Schema
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
describe(description: string): this;
|
|
39
|
-
optional(): import("
|
|
40
|
-
nullable(): import("
|
|
39
|
+
optional(): import("../index.ts").OptionalSchema<this>;
|
|
40
|
+
nullable(): import("../index.ts").NullableSchema<this>;
|
|
41
41
|
parse: (this: Schema<any, InferUnion<T>>, value: unknown) => InferUnion<T>;
|
|
42
|
-
safeParse: (this: Schema<any, InferUnion<T>>, value: unknown) => import("
|
|
42
|
+
safeParse: (this: Schema<any, InferUnion<T>>, value: unknown) => import("../base.ts").SafeParseResult<InferUnion<T>>;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Create a union schema (one of multiple possible types).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/utils/union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/utils/union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAA4C,WAAW,EAAE,MAAM,YAAY,CAAC;AAKnF,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CACpD,YAAW,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAMnC,OAAO,CAAC,OAAO;IAJ3B,QAAQ,CAAC,CAAC,WAAW,CAAC,iBAAiB;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,YAAY,CAAuC;gBAEvC,OAAO,EAAE,CAAC;IAE9B,QAAQ,CAAC,WAAW;;;0BAGD,OAAO;eAwBM;YAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;YAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;SAAE;MAC7E;IAEF,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAKnC,QAAQ;IAIR,QAAQ;IAIR,KAAK,sEAA2B;IAChC,SAAS,4GAA+B;CACxC;AAED;;;;;;;;;;;;;;;GAeG;AAEH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAEjF"}
|
package/dist/utils/union.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createIssue, failure, createParseMethods, SCHEMA_KIND } from
|
|
2
|
-
import { optional } from
|
|
3
|
-
import { nullable } from
|
|
1
|
+
import { createIssue, failure, createParseMethods, SCHEMA_KIND } from "../base.js";
|
|
2
|
+
import { optional } from "../utils/optional.js";
|
|
3
|
+
import { nullable } from "../utils/nullable.js";
|
|
4
4
|
/**
|
|
5
5
|
* Schema for union types (one of multiple possible schemas).
|
|
6
6
|
* Validates against each schema until one succeeds.
|
package/dist/utils/union.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../src/utils/union.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../src/utils/union.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,8DAA8D;AAC9D,MAAM,OAAO,WAAW;IAOH;IAJX,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC;IACvC,WAAW,CAAU;IACb,YAAY,GAAG,kBAAkB,EAAiB,CAAC;IAE3D,YAAoB,OAAU;QAAV,YAAO,GAAP,OAAO,CAAG;IAAG,CAAC;IAEzB,WAAW,GAAG;QACtB,OAAO,EAAE,CAAU;QACnB,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE;YAC5B,MAAM,SAAS,GAAqC,EAAE,CAAC;YAEvD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACnC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAEnD,8CAA8C;gBAC9C,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;oBAC/B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBACnD,CAAC;gBAED,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;oBACpB,8DAA8D;oBAC9D,OAAO,MAAa,CAAC;gBACtB,CAAC;gBACD,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAClC,CAAC;YAED,OAAO,OAAO,CAAC;gBACd,WAAW,CACV,+CAA+C,SAAS,CAAC,MAAM,qBAAqB,CACpF;aACD,CAAC,CAAC;QACJ,CAAC;QACD,KAAK,EAAE,SAAuE;KAC9E,CAAC;IAEF,QAAQ,CAAC,WAAmB;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,QAAQ;QACP,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,QAAQ;QACP,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IAChC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;CACxC;AAED;;;;;;;;;;;;;;;GAeG;AACH,8DAA8D;AAC9D,MAAM,UAAU,KAAK,CAA+B,GAAG,OAAU;IAChE,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/schema",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"prepublishOnly": "bun run clean && bun run build"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@agentuity/core": "1.0.
|
|
29
|
+
"@agentuity/core": "1.0.18"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@agentuity/test-utils": "1.0.
|
|
32
|
+
"@agentuity/test-utils": "1.0.18",
|
|
33
33
|
"@types/bun": "latest",
|
|
34
34
|
"bun-types": "latest",
|
|
35
35
|
"typescript": "^5.9.0"
|
package/src/coerce/boolean.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<boolean>();
|
|
7
7
|
|
package/src/coerce/date.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<Date>();
|
|
7
7
|
|
package/src/coerce/number.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<number>();
|
|
7
7
|
|
package/src/coerce/string.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<string>();
|
|
7
7
|
|
package/src/complex/array.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema, Infer } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema, Infer } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Schema for validating arrays with typed elements.
|
package/src/complex/object.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema, Infer } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional, OptionalSchema } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema, Infer } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional, OptionalSchema } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
7
|
type ObjectShape = Record<string, Schema<any, any>>;
|
package/src/complex/record.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema, Infer } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema, Infer } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Schema for validating records (objects with string keys and typed values).
|
package/src/index.ts
CHANGED
|
@@ -8,61 +8,61 @@ export type {
|
|
|
8
8
|
SafeParseResult,
|
|
9
9
|
SafeParseSuccess,
|
|
10
10
|
SafeParseError,
|
|
11
|
-
} from './base';
|
|
12
|
-
export { createIssue, success, failure, ValidationError, SCHEMA_KIND } from './base';
|
|
11
|
+
} from './base.ts';
|
|
12
|
+
export { createIssue, success, failure, ValidationError, SCHEMA_KIND } from './base.ts';
|
|
13
13
|
|
|
14
|
-
export { StringSchema, string } from './primitives/string';
|
|
15
|
-
export { NumberSchema, number } from './primitives/number';
|
|
16
|
-
export { BooleanSchema, boolean } from './primitives/boolean';
|
|
17
|
-
export { NullSchema, null_ } from './primitives/null';
|
|
18
|
-
export { UndefinedSchema, undefined_ } from './primitives/undefined';
|
|
19
|
-
export { UnknownSchema, unknown } from './primitives/unknown';
|
|
20
|
-
export { AnySchema, any } from './primitives/any';
|
|
14
|
+
export { StringSchema, string } from './primitives/string.ts';
|
|
15
|
+
export { NumberSchema, number } from './primitives/number.ts';
|
|
16
|
+
export { BooleanSchema, boolean } from './primitives/boolean.ts';
|
|
17
|
+
export { NullSchema, null_ } from './primitives/null.ts';
|
|
18
|
+
export { UndefinedSchema, undefined_ } from './primitives/undefined.ts';
|
|
19
|
+
export { UnknownSchema, unknown } from './primitives/unknown.ts';
|
|
20
|
+
export { AnySchema, any } from './primitives/any.ts';
|
|
21
21
|
|
|
22
|
-
export { ObjectSchema, object } from './complex/object';
|
|
23
|
-
export { ArraySchema, array } from './complex/array';
|
|
24
|
-
export { RecordSchema, record } from './complex/record';
|
|
22
|
+
export { ObjectSchema, object } from './complex/object.ts';
|
|
23
|
+
export { ArraySchema, array } from './complex/array.ts';
|
|
24
|
+
export { RecordSchema, record } from './complex/record.ts';
|
|
25
25
|
|
|
26
|
-
export { LiteralSchema, literal } from './utils/literal';
|
|
27
|
-
export { OptionalSchema, optional } from './utils/optional';
|
|
28
|
-
export { NullableSchema, nullable } from './utils/nullable';
|
|
29
|
-
export { UnionSchema, union } from './utils/union';
|
|
26
|
+
export { LiteralSchema, literal } from './utils/literal.ts';
|
|
27
|
+
export { OptionalSchema, optional } from './utils/optional.ts';
|
|
28
|
+
export { NullableSchema, nullable } from './utils/nullable.ts';
|
|
29
|
+
export { UnionSchema, union } from './utils/union.ts';
|
|
30
30
|
|
|
31
31
|
export {
|
|
32
32
|
toJSONSchema,
|
|
33
33
|
fromJSONSchema,
|
|
34
34
|
type JSONSchema,
|
|
35
35
|
type ToJSONSchemaOptions,
|
|
36
|
-
} from './json-schema';
|
|
36
|
+
} from './json-schema.ts';
|
|
37
37
|
|
|
38
|
-
export { CoerceStringSchema, coerceString } from './coerce/string';
|
|
39
|
-
export { CoerceNumberSchema, coerceNumber } from './coerce/number';
|
|
40
|
-
export { CoerceBooleanSchema, coerceBoolean } from './coerce/boolean';
|
|
41
|
-
export { CoerceDateSchema, coerceDate } from './coerce/date';
|
|
38
|
+
export { CoerceStringSchema, coerceString } from './coerce/string.ts';
|
|
39
|
+
export { CoerceNumberSchema, coerceNumber } from './coerce/number.ts';
|
|
40
|
+
export { CoerceBooleanSchema, coerceBoolean } from './coerce/boolean.ts';
|
|
41
|
+
export { CoerceDateSchema, coerceDate } from './coerce/date.ts';
|
|
42
42
|
|
|
43
|
-
import { string } from './primitives/string';
|
|
44
|
-
import { number } from './primitives/number';
|
|
45
|
-
import { boolean } from './primitives/boolean';
|
|
46
|
-
import { null_ } from './primitives/null';
|
|
47
|
-
import { undefined_ } from './primitives/undefined';
|
|
48
|
-
import { unknown } from './primitives/unknown';
|
|
49
|
-
import { any } from './primitives/any';
|
|
50
|
-
import { object } from './complex/object';
|
|
51
|
-
import { array } from './complex/array';
|
|
52
|
-
import { record } from './complex/record';
|
|
53
|
-
import { literal } from './utils/literal';
|
|
54
|
-
import { optional } from './utils/optional';
|
|
55
|
-
import { nullable } from './utils/nullable';
|
|
56
|
-
import { union } from './utils/union';
|
|
57
|
-
import { toJSONSchema, fromJSONSchema } from './json-schema';
|
|
58
|
-
import { coerceString } from './coerce/string';
|
|
59
|
-
import { coerceNumber } from './coerce/number';
|
|
60
|
-
import { coerceBoolean } from './coerce/boolean';
|
|
61
|
-
import { coerceDate } from './coerce/date';
|
|
43
|
+
import { string } from './primitives/string.ts';
|
|
44
|
+
import { number } from './primitives/number.ts';
|
|
45
|
+
import { boolean } from './primitives/boolean.ts';
|
|
46
|
+
import { null_ } from './primitives/null.ts';
|
|
47
|
+
import { undefined_ } from './primitives/undefined.ts';
|
|
48
|
+
import { unknown } from './primitives/unknown.ts';
|
|
49
|
+
import { any } from './primitives/any.ts';
|
|
50
|
+
import { object } from './complex/object.ts';
|
|
51
|
+
import { array } from './complex/array.ts';
|
|
52
|
+
import { record } from './complex/record.ts';
|
|
53
|
+
import { literal } from './utils/literal.ts';
|
|
54
|
+
import { optional } from './utils/optional.ts';
|
|
55
|
+
import { nullable } from './utils/nullable.ts';
|
|
56
|
+
import { union } from './utils/union.ts';
|
|
57
|
+
import { toJSONSchema, fromJSONSchema } from './json-schema.ts';
|
|
58
|
+
import { coerceString } from './coerce/string.ts';
|
|
59
|
+
import { coerceNumber } from './coerce/number.ts';
|
|
60
|
+
import { coerceBoolean } from './coerce/boolean.ts';
|
|
61
|
+
import { coerceDate } from './coerce/date.ts';
|
|
62
62
|
|
|
63
|
-
import type { Infer as InferType, Schema } from './base';
|
|
64
|
-
import { LiteralSchema } from './utils/literal';
|
|
65
|
-
import { UnionSchema } from './utils/union';
|
|
63
|
+
import type { Infer as InferType, Schema } from './base.ts';
|
|
64
|
+
import { LiteralSchema } from './utils/literal.ts';
|
|
65
|
+
import { UnionSchema } from './utils/union.ts';
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Create an enum schema (union of literal values).
|
package/src/json-schema.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import type { Schema } from './base';
|
|
3
|
-
import { SCHEMA_KIND } from './base';
|
|
4
|
-
import { string } from './primitives/string';
|
|
5
|
-
import { number } from './primitives/number';
|
|
6
|
-
import { boolean } from './primitives/boolean';
|
|
7
|
-
import { null_ } from './primitives/null';
|
|
8
|
-
import { object } from './complex/object';
|
|
9
|
-
import { array } from './complex/array';
|
|
10
|
-
import { literal } from './utils/literal';
|
|
11
|
-
import { optional } from './utils/optional';
|
|
12
|
-
import { nullable } from './utils/nullable';
|
|
13
|
-
import { union } from './utils/union';
|
|
2
|
+
import type { Schema } from './base.ts';
|
|
3
|
+
import { SCHEMA_KIND } from './base.ts';
|
|
4
|
+
import { string } from './primitives/string.ts';
|
|
5
|
+
import { number } from './primitives/number.ts';
|
|
6
|
+
import { boolean } from './primitives/boolean.ts';
|
|
7
|
+
import { null_ } from './primitives/null.ts';
|
|
8
|
+
import { object } from './complex/object.ts';
|
|
9
|
+
import { array } from './complex/array.ts';
|
|
10
|
+
import { literal } from './utils/literal.ts';
|
|
11
|
+
import { optional } from './utils/optional.ts';
|
|
12
|
+
import { nullable } from './utils/nullable.ts';
|
|
13
|
+
import { union } from './utils/union.ts';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Check schema type using a minification-safe SCHEMA_KIND tag.
|
package/src/primitives/any.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
7
|
const parseMethods = createParseMethods<any>();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<boolean>();
|
|
7
7
|
|
package/src/primitives/null.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<null>();
|
|
7
7
|
|
package/src/primitives/number.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<number>();
|
|
7
7
|
|
package/src/primitives/string.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<string>();
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<undefined>();
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
const parseMethods = createParseMethods<unknown>();
|
|
7
7
|
|
package/src/utils/literal.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../base';
|
|
2
|
-
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Schema for validating exact literal values.
|
package/src/utils/nullable.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema, Infer } from '../base';
|
|
2
|
-
import { success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
1
|
+
import type { Schema, Infer } from '../base.ts';
|
|
2
|
+
import { success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Schema for nullable values (T | null).
|
package/src/utils/optional.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema, Infer } from '../base';
|
|
2
|
-
import { success, createParseMethods, SCHEMA_KIND } from '../base';
|
|
1
|
+
import type { Schema, Infer } from '../base.ts';
|
|
2
|
+
import { success, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Schema for optional values (T | undefined).
|
package/src/utils/union.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema, Infer } from '../base';
|
|
2
|
-
import { createIssue, failure, createParseMethods, SCHEMA_KIND } from '../base';
|
|
3
|
-
import { optional } from '../utils/optional';
|
|
4
|
-
import { nullable } from '../utils/nullable';
|
|
1
|
+
import type { Schema, Infer } from '../base.ts';
|
|
2
|
+
import { createIssue, failure, createParseMethods, SCHEMA_KIND } from '../base.ts';
|
|
3
|
+
import { optional } from '../utils/optional.ts';
|
|
4
|
+
import { nullable } from '../utils/nullable.ts';
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
7
|
type InferUnion<T extends Schema<any, any>[]> = Infer<T[number]>;
|