@xylabs/zod 5.1.5 → 6.0.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/neutral/index.mjs +6 -3
- package/dist/neutral/index.mjs.map +3 -3
- package/dist/neutral/zodAllFactory.d.ts +2 -2
- package/dist/neutral/zodAllFactory.d.ts.map +1 -1
- package/dist/neutral/zodAsAsyncFactory.d.ts +2 -2
- package/dist/neutral/zodAsAsyncFactory.d.ts.map +1 -1
- package/dist/neutral/zodAsFactory.d.ts +2 -2
- package/dist/neutral/zodAsFactory.d.ts.map +1 -1
- package/dist/neutral/zodIsFactory.d.ts +2 -2
- package/dist/neutral/zodIsFactory.d.ts.map +1 -1
- package/dist/neutral/zodToAsyncFactory.d.ts +2 -2
- package/dist/neutral/zodToAsyncFactory.d.ts.map +1 -1
- package/dist/neutral/zodToFactory.d.ts +2 -2
- package/dist/neutral/zodToFactory.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// src/zodAsFactory.ts
|
|
2
2
|
import { assertError } from "@xylabs/error";
|
|
3
|
+
import * as z from "zod/v4/core";
|
|
3
4
|
function zodAsFactory(zod, name) {
|
|
4
5
|
function asFunc(value, assert) {
|
|
5
|
-
const result =
|
|
6
|
+
const result = z.safeParse(zod, value);
|
|
6
7
|
if (result.success) {
|
|
7
8
|
return value;
|
|
8
9
|
}
|
|
@@ -33,8 +34,9 @@ function zodAsFactory(zod, name) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
// src/zodIsFactory.ts
|
|
37
|
+
import * as z2 from "zod/v4/core";
|
|
36
38
|
function zodIsFactory(zod) {
|
|
37
|
-
return (value) =>
|
|
39
|
+
return (value) => z2.safeParse(zod, value).success;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
// src/zodToFactory.ts
|
|
@@ -61,9 +63,10 @@ function zodAllFactory(zod, name) {
|
|
|
61
63
|
|
|
62
64
|
// src/zodAsAsyncFactory.ts
|
|
63
65
|
import { assertError as assertError2 } from "@xylabs/error";
|
|
66
|
+
import * as z3 from "zod/v4/core";
|
|
64
67
|
function zodAsAsyncFactory(zod, name) {
|
|
65
68
|
async function asFunc(value, assert) {
|
|
66
|
-
const result = await
|
|
69
|
+
const result = await z3.safeParseAsync(zod, value);
|
|
67
70
|
if (result.success) {
|
|
68
71
|
return value;
|
|
69
72
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/zodAsFactory.ts", "../../src/zodIsFactory.ts", "../../src/zodToFactory.ts", "../../src/zodAllFactory.ts", "../../src/zodAsAsyncFactory.ts", "../../src/zodToAsyncFactory.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AssertConfig } from '@xylabs/error'\nimport { assertError } from '@xylabs/error'\nimport
|
|
5
|
-
"mappings": ";AACA,SAAS,mBAAmB;
|
|
6
|
-
"names": ["assertError", "isDefined", "isDefined"]
|
|
4
|
+
"sourcesContent": ["import type { AssertConfig } from '@xylabs/error'\nimport { assertError } from '@xylabs/error'\nimport * as z from 'zod/v4/core'\n\nimport type { ZodFactoryConfig } from './Config.ts'\n\n/**\n * Creates a function that validates a value against a zod schema and returns it with a narrowed type.\n * When called without an assert config, returns undefined on failure. When called with an assert config, throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns A function that validates and narrows the type of a value\n */\nexport function zodAsFactory<TZod>(zod: z.$ZodType<TZod>, name: string) {\n function asFunc<T>(value: T): (T & TZod) | undefined\n function asFunc<T>(value: T, assert: ZodFactoryConfig): (T & TZod)\n function asFunc<T>(value: T, assert?: ZodFactoryConfig): (T & TZod) | undefined {\n const result = z.safeParse(zod, value)\n if (result.success) {\n return value as (T & TZod)\n }\n if (assert !== undefined) {\n let assertConfig: AssertConfig\n switch (typeof assert) {\n case 'string': {\n assertConfig = `[${name}][${value}] ${assert}`\n break\n }\n case 'object': {\n assertConfig = `[${name}][${assert.name}][${value}] ${result.error.message}`\n break\n }\n case 'boolean': {\n assertConfig = `[${name}][${value}] ${result.error.message}`\n break\n }\n case 'function': {\n assertConfig = assert(value, result.error.message)\n break\n }\n }\n return assertError(value, assertConfig, result.error.message)\n }\n }\n\n return asFunc\n}\n", "import * as z from 'zod/v4/core'\n\n/**\n * Creates a type guard function that checks if a value matches a zod schema.\n * @param zod - The zod schema to validate against\n * @returns A type guard function that returns true if the value passes validation\n */\nexport function zodIsFactory<TZod>(zod: z.$ZodType<TZod>) {\n return <T>(value: T): value is T & TZod => z.safeParse(zod, value).success\n}\n", "import { isDefined } from '@xylabs/typeof'\nimport type * as z from 'zod/v4/core'\n\nimport type { ZodFactoryConfig } from './Config.ts'\nimport { zodAsFactory } from './zodAsFactory.ts'\n\n/**\n * Creates a function that converts a value to the zod schema type, delegating to `zodAsFactory` internally.\n * Provides overloads for optional assertion: without assert config returns undefined on failure, with assert config throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns A function that validates and converts a value to the schema type\n */\nexport function zodToFactory<TZod>(zod: z.$ZodType<TZod>, name: string) {\n const as = zodAsFactory<TZod>(zod, name)\n function toFunc<T>(value: T): (T & TZod) | undefined\n function toFunc<T>(value: T, assert: ZodFactoryConfig): (T & TZod)\n function toFunc<T>(value: T, assert?: ZodFactoryConfig): (T & TZod) | undefined {\n if (isDefined(assert)) {\n return as(value, assert)\n }\n return as(value)\n }\n return toFunc\n}\n", "import type * as z from 'zod/v4/core'\n\nimport { zodAsFactory } from './zodAsFactory.ts'\nimport { zodIsFactory } from './zodIsFactory.ts'\nimport { zodToFactory } from './zodToFactory.ts'\n\n/** @alpha */\nexport type AllZodFactories<TType, TName extends string>\n = Record<`is${TName}`, ReturnType<typeof zodIsFactory<TType>>>\n & Record<`as${TName}`, ReturnType<typeof zodAsFactory<TType>>>\n & Record<`to${TName}`, ReturnType<typeof zodToFactory<TType>>>\n\n/**\n * Creates a bundle of `is`, `as`, and `to` factory functions for a given zod schema.\n * @alpha\n * @param zod - The zod schema to validate against\n * @param name - The name used to suffix the generated function names (e.g. 'Address' produces `isAddress`, `asAddress`, `toAddress`)\n * @returns An object containing `is<Name>`, `as<Name>`, and `to<Name>` functions\n */\nexport function zodAllFactory<T, TName extends string>(zod: z.$ZodType<T>, name: TName) {\n return {\n [`is${name}`]: zodIsFactory<T>(zod),\n [`as${name}`]: zodAsFactory<T>(zod, `as${name}`),\n [`to${name}`]: zodToFactory<T>(zod, `to${name}`),\n }\n}\n", "import type { AssertConfig } from '@xylabs/error'\nimport { assertError } from '@xylabs/error'\nimport * as z from 'zod/v4/core'\n\nimport type { ZodFactoryConfig } from './Config.ts'\n\n/**\n * Creates an async function that validates a value against a zod schema and returns it with a narrowed type.\n * Uses `safeParseAsync` for schemas with async refinements. When called without an assert config, returns undefined on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns An async function that validates and narrows the type of a value\n */\nexport function zodAsAsyncFactory<TZod>(zod: z.$ZodType<TZod>, name: string) {\n function asFunc<T>(value: T): Promise<(T & TZod) | undefined>\n function asFunc<T>(value: T, assert: ZodFactoryConfig): Promise<(T & TZod)>\n async function asFunc<T>(value: T, assert?: ZodFactoryConfig): Promise<(T & TZod) | undefined> {\n const result = await z.safeParseAsync(zod, value)\n if (result.success) {\n return value as (T & TZod)\n }\n if (assert !== undefined) {\n let assertConfig: AssertConfig\n switch (typeof assert) {\n case 'string': {\n assertConfig = `[${name}][${value}] ${assert}`\n break\n }\n case 'object': {\n assertConfig = `[${name}][${assert.name}][${value}] ${result.error.message}`\n break\n }\n case 'boolean': {\n assertConfig = `[${name}][${value}] ${result.error.message}`\n break\n }\n case 'function': {\n assertConfig = assert(value, result.error.message)\n break\n }\n }\n return assertError(value, assertConfig, result.error.message)\n }\n }\n\n return asFunc\n}\n", "import { isDefined } from '@xylabs/typeof'\nimport type * as z from 'zod/v4/core'\n\nimport type { ZodFactoryConfig } from './Config.ts'\nimport { zodAsAsyncFactory } from './zodAsAsyncFactory.ts'\n\n/**\n * Creates an async function that converts a value to the zod schema type, delegating to `zodAsAsyncFactory` internally.\n * Provides overloads for optional assertion: without assert config resolves to undefined on failure, with assert config throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns An async function that validates and converts a value to the schema type\n */\nexport function zodToAsyncFactory<TZod>(zod: z.$ZodType<TZod>, name: string) {\n const as = zodAsAsyncFactory<TZod>(zod, name)\n function toFunc<T>(value: T): Promise<(T & TZod) | undefined>\n function toFunc<T>(value: T, assert: ZodFactoryConfig): Promise<(T & TZod)>\n async function toFunc<T>(value: T, assert?: ZodFactoryConfig): Promise<(T & TZod) | undefined> {\n if (isDefined(assert)) {\n return await as(value, assert)\n }\n return await as(value)\n }\n return toFunc\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["z", "assertError", "z", "isDefined", "isDefined"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as z from 'zod';
|
|
1
|
+
import type * as z from 'zod/v4/core';
|
|
2
2
|
import { zodAsFactory } from './zodAsFactory.ts';
|
|
3
3
|
import { zodIsFactory } from './zodIsFactory.ts';
|
|
4
4
|
import { zodToFactory } from './zodToFactory.ts';
|
|
@@ -11,7 +11,7 @@ export type AllZodFactories<TType, TName extends string> = Record<`is${TName}`,
|
|
|
11
11
|
* @param name - The name used to suffix the generated function names (e.g. 'Address' produces `isAddress`, `asAddress`, `toAddress`)
|
|
12
12
|
* @returns An object containing `is<Name>`, `as<Name>`, and `to<Name>` functions
|
|
13
13
|
*/
|
|
14
|
-
export declare function zodAllFactory<T, TName extends string>(zod: z
|
|
14
|
+
export declare function zodAllFactory<T, TName extends string>(zod: z.$ZodType<T>, name: TName): {
|
|
15
15
|
[x: string]: {
|
|
16
16
|
<T_1>(value: T_1): (T_1 & T) | undefined;
|
|
17
17
|
<T_1>(value: T_1, assert: import("./Config.ts").ZodFactoryConfig): T_1 & T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodAllFactory.d.ts","sourceRoot":"","sources":["../../src/zodAllFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"zodAllFactory.d.ts","sourceRoot":"","sources":["../../src/zodAllFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,aAAa,CAAA;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,aAAa;AACb,MAAM,MAAM,eAAe,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,IACnD,MAAM,CAAC,KAAK,KAAK,EAAE,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAC1D,MAAM,CAAC,KAAK,KAAK,EAAE,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAC5D,MAAM,CAAC,KAAK,KAAK,EAAE,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAElE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK;;;;;EAMrF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod/v4/core';
|
|
2
2
|
import type { ZodFactoryConfig } from './Config.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Creates an async function that validates a value against a zod schema and returns it with a narrowed type.
|
|
@@ -7,7 +7,7 @@ import type { ZodFactoryConfig } from './Config.ts';
|
|
|
7
7
|
* @param name - A name used in error messages for identification
|
|
8
8
|
* @returns An async function that validates and narrows the type of a value
|
|
9
9
|
*/
|
|
10
|
-
export declare function zodAsAsyncFactory<TZod>(zod: z
|
|
10
|
+
export declare function zodAsAsyncFactory<TZod>(zod: z.$ZodType<TZod>, name: string): {
|
|
11
11
|
<T>(value: T): Promise<(T & TZod) | undefined>;
|
|
12
12
|
<T>(value: T, assert: ZodFactoryConfig): Promise<(T & TZod)>;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodAsAsyncFactory.d.ts","sourceRoot":"","sources":["../../src/zodAsAsyncFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"zodAsAsyncFactory.d.ts","sourceRoot":"","sources":["../../src/zodAsAsyncFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM;KACzD,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;KAC7C,CAAC,SAAS,CAAC,UAAU,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;EA+B5E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod/v4/core';
|
|
2
2
|
import type { ZodFactoryConfig } from './Config.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a function that validates a value against a zod schema and returns it with a narrowed type.
|
|
@@ -7,7 +7,7 @@ import type { ZodFactoryConfig } from './Config.ts';
|
|
|
7
7
|
* @param name - A name used in error messages for identification
|
|
8
8
|
* @returns A function that validates and narrows the type of a value
|
|
9
9
|
*/
|
|
10
|
-
export declare function zodAsFactory<TZod>(zod: z
|
|
10
|
+
export declare function zodAsFactory<TZod>(zod: z.$ZodType<TZod>, name: string): {
|
|
11
11
|
<T>(value: T): (T & TZod) | undefined;
|
|
12
12
|
<T>(value: T, assert: ZodFactoryConfig): (T & TZod);
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodAsFactory.d.ts","sourceRoot":"","sources":["../../src/zodAsFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"zodAsFactory.d.ts","sourceRoot":"","sources":["../../src/zodAsFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM;KACpD,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS;KACpC,CAAC,SAAS,CAAC,UAAU,gBAAgB,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;EA+BnE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod/v4/core';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a type guard function that checks if a value matches a zod schema.
|
|
4
4
|
* @param zod - The zod schema to validate against
|
|
5
5
|
* @returns A type guard function that returns true if the value passes validation
|
|
6
6
|
*/
|
|
7
|
-
export declare function zodIsFactory<TZod>(zod: z
|
|
7
|
+
export declare function zodIsFactory<TZod>(zod: z.$ZodType<TZod>): <T>(value: T) => value is T & TZod;
|
|
8
8
|
//# sourceMappingURL=zodIsFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodIsFactory.d.ts","sourceRoot":"","sources":["../../src/zodIsFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"zodIsFactory.d.ts","sourceRoot":"","sources":["../../src/zodIsFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,aAAa,CAAA;AAEhC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAC9C,CAAC,EAAE,OAAO,CAAC,KAAG,KAAK,IAAI,CAAC,GAAG,IAAI,CACxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as z from 'zod';
|
|
1
|
+
import type * as z from 'zod/v4/core';
|
|
2
2
|
import type { ZodFactoryConfig } from './Config.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Creates an async function that converts a value to the zod schema type, delegating to `zodAsAsyncFactory` internally.
|
|
@@ -7,7 +7,7 @@ import type { ZodFactoryConfig } from './Config.ts';
|
|
|
7
7
|
* @param name - A name used in error messages for identification
|
|
8
8
|
* @returns An async function that validates and converts a value to the schema type
|
|
9
9
|
*/
|
|
10
|
-
export declare function zodToAsyncFactory<TZod>(zod: z
|
|
10
|
+
export declare function zodToAsyncFactory<TZod>(zod: z.$ZodType<TZod>, name: string): {
|
|
11
11
|
<T>(value: T): Promise<(T & TZod) | undefined>;
|
|
12
12
|
<T>(value: T, assert: ZodFactoryConfig): Promise<(T & TZod)>;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodToAsyncFactory.d.ts","sourceRoot":"","sources":["../../src/zodToAsyncFactory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"zodToAsyncFactory.d.ts","sourceRoot":"","sources":["../../src/zodToAsyncFactory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,CAAC,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGnD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM;KAEzD,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;KAC7C,CAAC,SAAS,CAAC,UAAU,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;EAQ5E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as z from 'zod';
|
|
1
|
+
import type * as z from 'zod/v4/core';
|
|
2
2
|
import type { ZodFactoryConfig } from './Config.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a function that converts a value to the zod schema type, delegating to `zodAsFactory` internally.
|
|
@@ -7,7 +7,7 @@ import type { ZodFactoryConfig } from './Config.ts';
|
|
|
7
7
|
* @param name - A name used in error messages for identification
|
|
8
8
|
* @returns A function that validates and converts a value to the schema type
|
|
9
9
|
*/
|
|
10
|
-
export declare function zodToFactory<TZod>(zod: z
|
|
10
|
+
export declare function zodToFactory<TZod>(zod: z.$ZodType<TZod>, name: string): {
|
|
11
11
|
<T>(value: T): (T & TZod) | undefined;
|
|
12
12
|
<T>(value: T, assert: ZodFactoryConfig): (T & TZod);
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodToFactory.d.ts","sourceRoot":"","sources":["../../src/zodToFactory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"zodToFactory.d.ts","sourceRoot":"","sources":["../../src/zodToFactory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,CAAC,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGnD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM;KAEpD,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS;KACpC,CAAC,SAAS,CAAC,UAAU,gBAAgB,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;EAQnE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/zod",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xylabs/error": "~
|
|
38
|
-
"@xylabs/typeof": "~
|
|
37
|
+
"@xylabs/error": "~6.0.0",
|
|
38
|
+
"@xylabs/typeof": "~6.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@xylabs/toolchain": "^8.0.8",
|