zeed 1.3.1 → 1.5.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/AGENTS.md +50 -211
- package/README.md +16 -0
- package/dist/_experiments/bitcask.cjs +2 -2
- package/dist/{args-FLoL3OKJ.d.cts → args-CEjib9V9.d.mts} +1 -1
- package/dist/{args-WC9q5kz2.d.mts → args-DEig-jw4.d.cts} +1 -1
- package/dist/{clipboard-BkUO-syY.d.mts → clipboard-BusqmLLY.d.cts} +1 -1
- package/dist/{clipboard-Cfpr331X.d.cts → clipboard-DcuuFRwa.d.mts} +1 -1
- package/dist/common/exec/index.d.cts +3 -3
- package/dist/common/exec/index.d.mts +3 -3
- package/dist/common/exec/pool.d.cts +1 -1
- package/dist/common/exec/pool.d.mts +1 -1
- package/dist/common/exec/progress.d.cts +1 -1
- package/dist/common/exec/progress.d.mts +1 -1
- package/dist/common/exec/promise.d.cts +1 -1
- package/dist/common/exec/promise.d.mts +1 -1
- package/dist/common/exec/queue.d.cts +1 -1
- package/dist/common/exec/queue.d.mts +1 -1
- package/dist/common/exec/throttle-debounce.d.cts +1 -1
- package/dist/common/exec/throttle-debounce.d.mts +1 -1
- package/dist/common/index.cjs +21 -0
- package/dist/common/index.d.cts +15 -12
- package/dist/common/index.d.mts +16 -13
- package/dist/common/index.mjs +4 -1
- package/dist/common/msg/channel-debug.d.cts +1 -1
- package/dist/common/msg/channel-debug.d.mts +1 -1
- package/dist/common/msg/channel-local.d.cts +1 -1
- package/dist/common/msg/channel-local.d.mts +1 -1
- package/dist/common/msg/channel-resilient.d.cts +1 -1
- package/dist/common/msg/channel-resilient.d.mts +1 -1
- package/dist/common/msg/channel-wkwebview.d.cts +2 -1
- package/dist/common/msg/channel-wkwebview.d.mts +2 -1
- package/dist/common/msg/channel.d.cts +1 -1
- package/dist/common/msg/channel.d.mts +1 -1
- package/dist/common/msg/emitter.d.cts +1 -1
- package/dist/common/msg/emitter.d.mts +1 -1
- package/dist/common/msg/index.d.cts +1 -1
- package/dist/common/msg/index.d.mts +1 -1
- package/dist/common/msg/messages.d.cts +1 -1
- package/dist/common/msg/messages.d.mts +1 -1
- package/dist/common/msg/pubsub.d.cts +1 -1
- package/dist/common/msg/pubsub.d.mts +1 -1
- package/dist/common/msg/rpc.cjs +8 -8
- package/dist/common/msg/rpc.cjs.map +1 -1
- package/dist/common/msg/rpc.mjs +8 -8
- package/dist/common/msg/rpc.mjs.map +1 -1
- package/dist/common/schema/export-json-schema.cjs +40 -31
- package/dist/common/schema/export-json-schema.cjs.map +1 -1
- package/dist/common/schema/export-json-schema.mjs +40 -31
- package/dist/common/schema/export-json-schema.mjs.map +1 -1
- package/dist/common/schema/index.cjs +21 -0
- package/dist/common/schema/index.d.cts +6 -3
- package/dist/common/schema/index.d.mts +7 -4
- package/dist/common/schema/index.mjs +4 -1
- package/dist/common/schema/sql/expr.cjs +128 -0
- package/dist/common/schema/sql/expr.cjs.map +1 -0
- package/dist/common/schema/sql/expr.d.cts +2 -0
- package/dist/common/schema/sql/expr.d.mts +2 -0
- package/dist/common/schema/sql/expr.mjs +115 -0
- package/dist/common/schema/sql/expr.mjs.map +1 -0
- package/dist/common/schema/sql/index.cjs +23 -0
- package/dist/common/schema/sql/index.d.cts +4 -0
- package/dist/common/schema/sql/index.d.mts +4 -0
- package/dist/common/schema/sql/index.mjs +5 -0
- package/dist/common/schema/sql/select.cjs +143 -0
- package/dist/common/schema/sql/select.cjs.map +1 -0
- package/dist/common/schema/sql/select.d.cts +2 -0
- package/dist/common/schema/sql/select.d.mts +2 -0
- package/dist/common/schema/sql/select.mjs +139 -0
- package/dist/common/schema/sql/select.mjs.map +1 -0
- package/dist/common/schema/sql/table.cjs +23 -0
- package/dist/common/schema/sql/table.cjs.map +1 -0
- package/dist/common/schema/sql/table.d.cts +2 -0
- package/dist/common/schema/sql/table.d.mts +2 -0
- package/dist/common/schema/sql/table.mjs +20 -0
- package/dist/common/schema/sql/table.mjs.map +1 -0
- package/dist/common/schema/type-test.d.cts +1 -1
- package/dist/common/schema/type-test.d.mts +1 -1
- package/dist/common/schema/utils.d.cts +1 -1
- package/dist/common/schema/utils.d.mts +1 -1
- package/dist/common/schema/z.d.mts +1 -1
- package/dist/common/storage/index.d.cts +1 -1
- package/dist/common/storage/index.d.mts +1 -1
- package/dist/common/storage/memstorage.d.cts +1 -1
- package/dist/common/storage/memstorage.d.mts +1 -1
- package/dist/common/test.d.cts +1 -1
- package/dist/common/test.d.mts +1 -1
- package/dist/common/time.d.cts +1 -1
- package/dist/common/time.d.mts +1 -1
- package/dist/common/timeout.d.cts +1 -1
- package/dist/common/timeout.d.mts +1 -1
- package/dist/common/utils.d.cts +1 -1
- package/dist/common/utils.d.mts +1 -1
- package/dist/common/uuid.d.cts +1 -1
- package/dist/common/uuid.d.mts +1 -1
- package/dist/{crypto-CyTV7Qce.d.cts → crypto-D68rVmvU.d.mts} +1 -1
- package/dist/{crypto-LT7EC5_d.d.mts → crypto-KzGHoCJE.d.cts} +1 -1
- package/dist/{env-B3vOiVY8.d.cts → env-BJXdwBKq.d.mts} +1 -1
- package/dist/{env-C3npYe8w.d.mts → env-HsOnA_yK.d.cts} +1 -1
- package/dist/expr-CCKrqOw1.d.mts +25 -0
- package/dist/expr-yYgSeBZ3.d.cts +25 -0
- package/dist/{files-CDNKX9VI.d.mts → files-4O-PxnAC.d.cts} +1 -1
- package/dist/{files-DdI9UZvg.d.cts → files-BlpxqSTT.d.mts} +1 -1
- package/dist/{files-async-1V0bu_ca.d.cts → files-async-DFLC-Nkd.d.cts} +1 -1
- package/dist/{files-async-cBMkRwsu.d.mts → files-async-DfuEEDjH.d.mts} +1 -1
- package/dist/{filestorage-CXQ9MzeW.d.cts → filestorage-BjeBZEAs.d.cts} +1 -1
- package/dist/{filestorage-YzM2z9sU.d.mts → filestorage-CmfztpWm.d.mts} +1 -1
- package/dist/{fs-DHJ9AqUk.d.cts → fs-D837bjRT.d.cts} +1 -1
- package/dist/{fs-DgjZdpuF.d.mts → fs-DlYLapik.d.mts} +1 -1
- package/dist/{glob-Bfs7ZS_i.d.mts → glob-5yW09dkR.d.mts} +1 -1
- package/dist/{glob-Bt150jOY.d.cts → glob-CZaZPqiy.d.cts} +1 -1
- package/dist/{index-DHXVOH8h.d.cts → index-CFkMqHvX.d.cts} +1 -2
- package/dist/{index-DMaPyx9O.d.mts → index-C_3Y_s6f.d.mts} +1 -2
- package/dist/index.all.cjs +21 -0
- package/dist/index.all.d.cts +29 -26
- package/dist/index.all.d.mts +30 -27
- package/dist/index.all.mjs +4 -1
- package/dist/index.browser.cjs +21 -0
- package/dist/index.browser.d.cts +15 -12
- package/dist/index.browser.d.mts +16 -13
- package/dist/index.browser.mjs +4 -1
- package/dist/index.jsr.d.cts +4 -4
- package/dist/index.jsr.d.mts +4 -4
- package/dist/index.node.cjs +21 -0
- package/dist/index.node.d.cts +29 -26
- package/dist/index.node.d.mts +30 -27
- package/dist/index.node.mjs +4 -1
- package/dist/{log-file-bsTsc9KM.d.cts → log-file-DwEDms1F.d.cts} +2 -2
- package/dist/{log-file-DTuImomJ.d.mts → log-file-QV1unm3z.d.mts} +2 -2
- package/dist/{log-file-rotation-_YruAcNc.d.cts → log-file-rotation-BpZxXYlU.d.cts} +2 -2
- package/dist/{log-file-rotation-FBmtp_Uz.d.mts → log-file-rotation-DanrO_2y.d.mts} +2 -2
- package/dist/{log-node-DlrXl3QO.d.mts → log-node-BSn7RqAc.d.mts} +1 -1
- package/dist/{log-node-Dk948mHX.d.cts → log-node-D_fiJL6x.d.cts} +1 -1
- package/dist/{log-rotation-CkyjZbK5.d.mts → log-rotation-BdGakFya.d.cts} +1 -1
- package/dist/{log-rotation-_d7iRm9s.d.cts → log-rotation-Ce4e-8LN.d.mts} +1 -1
- package/dist/{log-util-2Ls76P-0.d.cts → log-util-C0U3zCjw.d.cts} +1 -1
- package/dist/{log-util-Da_d19f8.d.mts → log-util-Da_UCcmt.d.mts} +1 -1
- package/dist/{memstorage-D5A9FwiP.d.mts → memstorage-BhWXthO8.d.mts} +1 -1
- package/dist/{memstorage-BcjQLdaQ.d.cts → memstorage-tvlWDYgS.d.cts} +1 -1
- package/dist/node/args.cjs +1 -1
- package/dist/node/args.d.cts +1 -1
- package/dist/node/args.d.mts +1 -1
- package/dist/node/clipboard.d.cts +1 -1
- package/dist/node/clipboard.d.mts +1 -1
- package/dist/node/crypto.cjs +1 -1
- package/dist/node/crypto.d.cts +1 -1
- package/dist/node/crypto.d.mts +1 -1
- package/dist/node/env.cjs +2 -2
- package/dist/node/env.d.cts +1 -1
- package/dist/node/env.d.mts +1 -1
- package/dist/node/files-async.cjs +1 -1
- package/dist/node/files-async.d.cts +1 -1
- package/dist/node/files-async.d.mts +1 -1
- package/dist/node/files.cjs +1 -1
- package/dist/node/files.d.cts +1 -1
- package/dist/node/files.d.mts +1 -1
- package/dist/node/filestorage.cjs +1 -1
- package/dist/node/filestorage.d.cts +1 -1
- package/dist/node/filestorage.d.mts +1 -1
- package/dist/node/fs.cjs +1 -1
- package/dist/node/fs.d.cts +1 -1
- package/dist/node/fs.d.mts +1 -1
- package/dist/node/glob.d.cts +1 -1
- package/dist/node/glob.d.mts +1 -1
- package/dist/node/index.d.cts +14 -14
- package/dist/node/index.d.mts +14 -14
- package/dist/node/log/index.d.cts +5 -5
- package/dist/node/log/index.d.mts +5 -5
- package/dist/node/log/log-context-node.cjs +1 -1
- package/dist/node/log/log-file-rotation.d.cts +1 -1
- package/dist/node/log/log-file-rotation.d.mts +1 -1
- package/dist/node/log/log-file.cjs +1 -1
- package/dist/node/log/log-file.d.cts +1 -1
- package/dist/node/log/log-file.d.mts +1 -1
- package/dist/node/log/log-node.cjs +6 -15
- package/dist/node/log/log-node.cjs.map +1 -1
- package/dist/node/log/log-node.d.cts +1 -1
- package/dist/node/log/log-node.d.mts +1 -1
- package/dist/node/log/log-node.mjs +4 -13
- package/dist/node/log/log-node.mjs.map +1 -1
- package/dist/node/log/log-rotation.cjs +1 -1
- package/dist/node/log/log-rotation.d.cts +1 -1
- package/dist/node/log/log-rotation.d.mts +1 -1
- package/dist/node/log/log-util.cjs +1 -1
- package/dist/node/log/log-util.d.cts +1 -1
- package/dist/node/log/log-util.d.mts +1 -1
- package/dist/{promise-DGgiRckN.d.cts → promise-CU_CENbU.d.cts} +1 -1
- package/dist/{promise-MH3xAy4S.d.mts → promise-CoWXgo4w.d.mts} +1 -1
- package/dist/select-DrciHdk_.d.cts +52 -0
- package/dist/select-F2KpP6mo.d.mts +52 -0
- package/dist/table-Cr8tjDIL.d.mts +19 -0
- package/dist/table-IkLXirT-.d.cts +19 -0
- package/dist/{test-CAhm15f4.d.mts → test-DcXa0MeX.d.cts} +1 -1
- package/dist/{test-D2plOVHF.d.cts → test-jZsc7P2c.d.mts} +1 -1
- package/dist/{throttle-debounce-BLFxAZ8W.d.mts → throttle-debounce-CCh0F100.d.mts} +1 -1
- package/dist/{throttle-debounce-Psb0ay1r.d.cts → throttle-debounce-DyFiyoAk.d.cts} +1 -1
- package/dist/{time-BfKJBbym.d.cts → time-BgFZe9ys.d.cts} +1 -1
- package/dist/{time-DxE-vjjw.d.mts → time-DSV_k3mG.d.mts} +1 -1
- package/dist/{timeout-CnUk6Ruj.d.mts → timeout-DDSSNZY8.d.mts} +1 -1
- package/dist/{timeout-CpFcK8MD.d.cts → timeout-E3ZQbJgK.d.cts} +1 -1
- package/dist/{type-test-BiKyEZkc.d.mts → type-test-BvzWDJz3.d.mts} +1 -1
- package/dist/{type-test-sM7QpfQU.d.cts → type-test-CBK-iJ9d.d.cts} +1 -1
- package/dist/{utils-B8DsVgFr.d.mts → utils-1RyCGkpQ.d.mts} +1 -1
- package/dist/{utils-BfZkD2Pt.d.mts → utils-6Culwiaf.d.cts} +1 -1
- package/dist/{utils-DHQBNh-Z.d.cts → utils-CDJihcg3.d.mts} +1 -1
- package/dist/{utils-Bctk_WhH.d.cts → utils-nCQklGHV.d.cts} +1 -1
- package/dist/{uuid-Cusm2nIK.d.cts → uuid-CKFZfSff.d.mts} +1 -1
- package/dist/{uuid-ININPGKB.d.mts → uuid-D42A8UdP.d.cts} +1 -1
- package/dist/z-C0fpNWZg.d.cts +1 -0
- package/dist/z-D_jezYmm.d.mts +1 -0
- package/dist/{z-collection-BmuBin--.d.mts → z-collection-BSfgRU0Q.d.mts} +1 -1
- package/package.json +17 -18
- package/src/common/schema/README.md +247 -66
- package/src/common/schema/export-json-schema.spec.ts +11 -7
- package/src/common/schema/export-json-schema.ts +59 -52
- package/src/common/schema/index.ts +1 -0
- package/src/common/schema/sql/README.md +254 -0
- package/src/common/schema/sql/expr.ts +99 -0
- package/src/common/schema/sql/index.ts +3 -0
- package/src/common/schema/sql/select.spec.ts +144 -0
- package/src/common/schema/sql/select.ts +207 -0
- package/src/common/schema/sql/table.ts +36 -0
- package/src/common/schema/README-SCHEMA.md +0 -0
- /package/dist/{index-BH1nuHdZ.d.cts → index-CIABef8t.d.mts} +0 -0
- /package/dist/{index-BL7o4fG9.d.cts → index-CliqZ9rj.d.mts} +0 -0
- /package/dist/{index-CP2eJYlK.d.mts → index-D6xqj1Qx.d.cts} +0 -0
- /package/dist/{index-DjOaHFU3.d.mts → index-DHFfG4yr.d.cts} +0 -0
- /package/dist/{index-sViox9YW.d.mts → index-N-OgGgfF.d.mts} +0 -0
- /package/dist/{z-ClMox7qS.d.mts → index-WOw4GVZo.d.cts} +0 -0
- /package/dist/{z-dtM4F8Lo.d.cts → index-luywJTzJ.d.mts} +0 -0
|
@@ -137,4 +137,4 @@ declare function getBuildNumber(): string;
|
|
|
137
137
|
declare function getSecondsFromBuildNumber(buildNumber: string): number;
|
|
138
138
|
//#endregion
|
|
139
139
|
export { parseDate as C, timestampSecondsToMilliseconds as E, getTimestampInSeconds as S, timestampMillisecondsToSeconds as T, formatMilliseconds as _, TIME_MINUTE_MS as a, getSecondsFromBuildNumber as b, TIME_MONTH_S as c, TIME_YEAR_MS as d, TIME_YEAR_S as f, duration as g, datetimeToUTC as h, TIME_HOUR_S as i, TIME_WEEK_MS as l, datetimeToLocal as m, TIME_DAY_S as n, TIME_MINUTE_S as o, dateFromSeconds as p, TIME_HOUR_MS as r, TIME_MONTH_MS as s, TIME_DAY_MS as t, TIME_WEEK_S as u, getBuildNumber as v, setTimestampTest as w, getTimestamp as x, getPerformanceTimestamp as y };
|
|
140
|
-
//# sourceMappingURL=time-
|
|
140
|
+
//# sourceMappingURL=time-BgFZe9ys.d.cts.map
|
|
@@ -137,4 +137,4 @@ declare function getBuildNumber(): string;
|
|
|
137
137
|
declare function getSecondsFromBuildNumber(buildNumber: string): number;
|
|
138
138
|
//#endregion
|
|
139
139
|
export { parseDate as C, timestampSecondsToMilliseconds as E, getTimestampInSeconds as S, timestampMillisecondsToSeconds as T, formatMilliseconds as _, TIME_MINUTE_MS as a, getSecondsFromBuildNumber as b, TIME_MONTH_S as c, TIME_YEAR_MS as d, TIME_YEAR_S as f, duration as g, datetimeToUTC as h, TIME_HOUR_S as i, TIME_WEEK_MS as l, datetimeToLocal as m, TIME_DAY_S as n, TIME_MINUTE_S as o, dateFromSeconds as p, TIME_HOUR_MS as r, TIME_MONTH_MS as s, TIME_DAY_MS as t, TIME_WEEK_S as u, getBuildNumber as v, setTimestampTest as w, getTimestamp as x, getPerformanceTimestamp as y };
|
|
140
|
-
//# sourceMappingURL=time-
|
|
140
|
+
//# sourceMappingURL=time-DSV_k3mG.d.mts.map
|
|
@@ -3,4 +3,4 @@ type Expect<T extends true> = T;
|
|
|
3
3
|
type IsEqual<X, Y> = (<T>() => T extends X ? true : false) extends (<T>() => T extends Y ? true : false) ? true : false;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { IsEqual as n, Expect as t };
|
|
6
|
-
//# sourceMappingURL=type-test-
|
|
6
|
+
//# sourceMappingURL=type-test-BvzWDJz3.d.mts.map
|
|
@@ -3,4 +3,4 @@ type Expect<T extends true> = T;
|
|
|
3
3
|
type IsEqual<X, Y> = (<T>() => T extends X ? true : false) extends (<T>() => T extends Y ? true : false) ? true : false;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { IsEqual as n, Expect as t };
|
|
6
|
-
//# sourceMappingURL=type-test-
|
|
6
|
+
//# sourceMappingURL=type-test-CBK-iJ9d.d.cts.map
|
|
@@ -8,4 +8,4 @@ declare function isSchemaPrimitive(schema: Type<any>): boolean;
|
|
|
8
8
|
declare function isSchemaObjectFlat(schema: Type<any>): boolean;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { isSchemaPrimitive as a, isSchemaOptional as i, isSchemaObject as n, isSchemaObjectFlat as r, isSchemaDefault as t };
|
|
11
|
-
//# sourceMappingURL=utils-
|
|
11
|
+
//# sourceMappingURL=utils-1RyCGkpQ.d.mts.map
|
|
@@ -8,4 +8,4 @@ declare function isSchemaPrimitive(schema: Type<any>): boolean;
|
|
|
8
8
|
declare function isSchemaObjectFlat(schema: Type<any>): boolean;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { isSchemaPrimitive as a, isSchemaOptional as i, isSchemaObject as n, isSchemaObjectFlat as r, isSchemaDefault as t };
|
|
11
|
-
//# sourceMappingURL=utils-
|
|
11
|
+
//# sourceMappingURL=utils-nCQklGHV.d.cts.map
|
|
@@ -193,4 +193,4 @@ declare function unameReset(name?: string): void;
|
|
|
193
193
|
declare function qid(): string;
|
|
194
194
|
//#endregion
|
|
195
195
|
export { uuidv4 as C, uuidIsValid as S, uuidDecodeV4 as _, suidBytesDate as a, uuidEncodeB62 as b, unameReset as c, uuidB32 as d, uuidB62 as f, uuidDecodeB62 as g, uuidDecodeB32 as h, suidBytes as i, uuid as l, uuidDecode as m, setUuidDefaultEncoding as n, suidDate as o, uuidBytes as p, suid as r, uname as s, qid as t, uuid32bit as u, uuidEncode as v, uuidEncodeV4 as x, uuidEncodeB32 as y };
|
|
196
|
-
//# sourceMappingURL=uuid-
|
|
196
|
+
//# sourceMappingURL=uuid-CKFZfSff.d.mts.map
|
|
@@ -193,4 +193,4 @@ declare function unameReset(name?: string): void;
|
|
|
193
193
|
declare function qid(): string;
|
|
194
194
|
//#endregion
|
|
195
195
|
export { uuidv4 as C, uuidIsValid as S, uuidDecodeV4 as _, suidBytesDate as a, uuidEncodeB62 as b, unameReset as c, uuidB32 as d, uuidB62 as f, uuidDecodeB62 as g, uuidDecodeB32 as h, suidBytes as i, uuid as l, uuidDecode as m, setUuidDefaultEncoding as n, suidDate as o, uuidBytes as p, suid as r, uname as s, qid as t, uuid32bit as u, uuidEncode as v, uuidEncodeV4 as x, uuidEncodeB32 as y };
|
|
196
|
-
//# sourceMappingURL=uuid-
|
|
196
|
+
//# sourceMappingURL=uuid-D42A8UdP.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zeed",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "1.5.0",
|
|
5
|
+
"packageManager": "pnpm@10.33.0",
|
|
6
6
|
"description": "🌱 Simple foundation library",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Dirk Holtwick",
|
|
@@ -65,8 +65,7 @@
|
|
|
65
65
|
"upload:docs": "nr build:docs && rsync -avz docs/* cy:public_html/zeed.holtwick.de",
|
|
66
66
|
"clean": "rm -rf dist",
|
|
67
67
|
"coverage": "vitest --run --coverage",
|
|
68
|
-
"lint": "eslint .",
|
|
69
|
-
"lint:fix": "eslint . --fix",
|
|
68
|
+
"lint": "eslint . --fix",
|
|
70
69
|
"prepublishOnly": "nr build && nr circles",
|
|
71
70
|
"start": "nr watch",
|
|
72
71
|
"test": "nr check && vitest --run",
|
|
@@ -74,26 +73,26 @@
|
|
|
74
73
|
"test:firefox": "BROWSER=firefox vitest",
|
|
75
74
|
"test:webkit": "BROWSER=webkit vitest",
|
|
76
75
|
"test:chromium": "BROWSER=chromium vitest",
|
|
77
|
-
"test:release": "nr lint
|
|
76
|
+
"test:release": "nr lint && nr check && vitest --run",
|
|
78
77
|
"post:release": "nr upload:docs && nr npm:release",
|
|
79
78
|
"npm:release": "npm login && npm publish --access public",
|
|
80
79
|
"watch": "nr build -- --watch src",
|
|
81
|
-
"prep": "nr lint
|
|
80
|
+
"prep": "nr lint && nr check && nr test:release && nr upload:docs"
|
|
82
81
|
},
|
|
83
82
|
"devDependencies": {
|
|
84
|
-
"@antfu/eslint-config": "^
|
|
83
|
+
"@antfu/eslint-config": "^8.2.0",
|
|
85
84
|
"@antfu/ni": "^30.0.0",
|
|
86
|
-
"@types/node": "^25.
|
|
87
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
88
|
-
"@vitest/browser": "^4.1.
|
|
89
|
-
"@vitest/coverage-v8": "^4.1.
|
|
90
|
-
"esbuild": "^0.
|
|
91
|
-
"eslint": "^10.1
|
|
92
|
-
"playwright": "^1.
|
|
85
|
+
"@types/node": "^25.6.0",
|
|
86
|
+
"@vitejs/plugin-vue": "^6.0.6",
|
|
87
|
+
"@vitest/browser": "^4.1.4",
|
|
88
|
+
"@vitest/coverage-v8": "^4.1.4",
|
|
89
|
+
"esbuild": "^0.28.0",
|
|
90
|
+
"eslint": "^10.2.1",
|
|
91
|
+
"playwright": "^1.59.1",
|
|
93
92
|
"pnpm": "^10.32.1",
|
|
94
|
-
"tsdown": "^0.21.
|
|
95
|
-
"typescript": "^
|
|
96
|
-
"vite": "^8.0.
|
|
97
|
-
"vitest": "^4.1.
|
|
93
|
+
"tsdown": "^0.21.9",
|
|
94
|
+
"typescript": "^6.0.3",
|
|
95
|
+
"vite": "^8.0.8",
|
|
96
|
+
"vitest": "^4.1.4"
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
This module provides a flexible, TypeScript-friendly schema/type system for runtime validation, parsing, and type inference. It is inspired by libraries like [valita](https://github.com/badrap/valita) and implements the [Standard Schema](https://github.com/standard-schema/standard-schema) specification.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
- Define schemas for primitives, objects, arrays, tuples, unions, literals, records, and functions
|
|
7
8
|
- Parse and validate data at runtime
|
|
8
9
|
- Type inference for static TypeScript types
|
|
9
|
-
-
|
|
10
|
+
- Schema transformation: `.pick()`, `.omit()`, `.partial()`, `.required()`, `.extend()`
|
|
11
|
+
- Serialize/deserialize schemas to/from JSON
|
|
12
|
+
- Export schemas to TypeScript interfaces, Swift structs, or JSON Schema
|
|
13
|
+
- Parse environment variables and CLI arguments against a schema
|
|
10
14
|
- **Standard Schema V1 compatible** - works with tRPC, TanStack Form/Router, Hono, and other compatible libraries
|
|
11
15
|
|
|
12
16
|
## Standard Schema Compatibility
|
|
@@ -18,7 +22,7 @@ All zeed schemas implement the [StandardSchemaV1](https://github.com/standard-sc
|
|
|
18
22
|
Every schema has a `~standard` property that provides the standard interface:
|
|
19
23
|
|
|
20
24
|
```ts
|
|
21
|
-
import { z } from '
|
|
25
|
+
import { z } from 'zeed'
|
|
22
26
|
|
|
23
27
|
const schema = z.object({
|
|
24
28
|
name: z.string(),
|
|
@@ -29,11 +33,9 @@ const schema = z.object({
|
|
|
29
33
|
const result = schema['~standard'].validate({ name: 'Alice', age: 30 })
|
|
30
34
|
|
|
31
35
|
if (result.issues) {
|
|
32
|
-
// Validation failed
|
|
33
36
|
console.error('Validation errors:', result.issues)
|
|
34
37
|
}
|
|
35
38
|
else {
|
|
36
|
-
// Validation succeeded
|
|
37
39
|
console.log('Valid data:', result.value)
|
|
38
40
|
}
|
|
39
41
|
```
|
|
@@ -49,18 +51,16 @@ The `~standard` property provides:
|
|
|
49
51
|
|
|
50
52
|
### Type Inference
|
|
51
53
|
|
|
52
|
-
Use the standard schema type helpers for cross-library type inference:
|
|
53
|
-
|
|
54
54
|
```ts
|
|
55
|
-
import type { StandardSchemaV1 } from '
|
|
56
|
-
import { z } from '
|
|
55
|
+
import type { StandardSchemaV1 } from 'zeed'
|
|
56
|
+
import { z } from 'zeed'
|
|
57
57
|
|
|
58
58
|
const schema = z.object({
|
|
59
59
|
email: z.string(),
|
|
60
60
|
age: z.number().optional(),
|
|
61
61
|
})
|
|
62
62
|
|
|
63
|
-
// Extract input/output types
|
|
63
|
+
// Extract input/output types via standard schema helpers
|
|
64
64
|
type Input = StandardSchemaV1.InferInput<typeof schema>
|
|
65
65
|
type Output = StandardSchemaV1.InferOutput<typeof schema>
|
|
66
66
|
|
|
@@ -70,61 +70,53 @@ type User = z.infer<typeof schema>
|
|
|
70
70
|
|
|
71
71
|
### Compatible Libraries
|
|
72
72
|
|
|
73
|
-
Zeed schemas work
|
|
74
|
-
|
|
75
|
-
- **tRPC** - Type-safe APIs
|
|
76
|
-
- **TanStack Form** - Form state management
|
|
77
|
-
- **TanStack Router** - Type-safe routing
|
|
78
|
-
- **Hono** - Fast web framework
|
|
79
|
-
- **And many more** - See the [full list](https://github.com/standard-schema/standard-schema#what-tools--frameworks-accept-spec-compliant-schemas)
|
|
73
|
+
Zeed schemas work with any library that supports Standard Schema, including tRPC, TanStack Form, TanStack Router, Hono and more. See the [full list](https://github.com/standard-schema/standard-schema#what-tools--frameworks-accept-spec-compliant-schemas).
|
|
80
74
|
|
|
81
75
|
### Generic Validation Function Example
|
|
82
76
|
|
|
83
|
-
Here's how a third-party library might use zeed schemas:
|
|
84
|
-
|
|
85
77
|
```ts
|
|
86
|
-
import type { StandardSchemaV1 } from '
|
|
78
|
+
import type { StandardSchemaV1 } from 'zeed'
|
|
79
|
+
import { z } from 'zeed'
|
|
87
80
|
|
|
88
81
|
function standardValidate<T extends StandardSchemaV1>(
|
|
89
82
|
schema: T,
|
|
90
|
-
data: unknown
|
|
83
|
+
data: unknown,
|
|
91
84
|
): StandardSchemaV1.InferOutput<T> {
|
|
92
85
|
const result = schema['~standard'].validate(data)
|
|
93
|
-
|
|
94
|
-
if (result.issues) {
|
|
86
|
+
if (result.issues)
|
|
95
87
|
throw new Error(`Validation failed: ${JSON.stringify(result.issues)}`)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
88
|
return result.value
|
|
99
89
|
}
|
|
100
90
|
|
|
101
|
-
// Use with zeed schemas
|
|
102
91
|
const userSchema = z.object({ name: z.string() })
|
|
103
92
|
const user = standardValidate(userSchema, { name: 'Alice' })
|
|
104
93
|
```
|
|
105
94
|
|
|
106
|
-
## Installation
|
|
107
|
-
|
|
108
|
-
This module is part of the `github-zeed` project. To use it, import from the appropriate path:
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
import { array, Infer, literal, number, object, string, union, z } from './schema'
|
|
112
|
-
// z.string and string are functionally alike, but z.string is preferred for consistency.
|
|
113
|
-
```
|
|
114
|
-
|
|
115
95
|
## Basic Usage
|
|
116
96
|
|
|
117
97
|
### Primitives
|
|
118
98
|
|
|
119
99
|
```ts
|
|
100
|
+
import { z } from 'zeed'
|
|
101
|
+
|
|
120
102
|
const name = z.string()
|
|
121
103
|
const age = z.number()
|
|
122
|
-
|
|
104
|
+
const count = z.int()
|
|
105
|
+
const flag = z.boolean()
|
|
106
|
+
const nothing = z.none() // undefined | null
|
|
107
|
+
const whatever = z.any()
|
|
108
|
+
|
|
109
|
+
// Numeric aliases for number()
|
|
110
|
+
const x = z.float()
|
|
111
|
+
const y = z.double()
|
|
112
|
+
const r = z.real()
|
|
123
113
|
```
|
|
124
114
|
|
|
125
115
|
### Objects
|
|
126
116
|
|
|
127
117
|
```ts
|
|
118
|
+
import { z } from 'zeed'
|
|
119
|
+
|
|
128
120
|
const user = z.object({
|
|
129
121
|
name: z.string(),
|
|
130
122
|
age: z.number().optional(),
|
|
@@ -132,97 +124,286 @@ const user = z.object({
|
|
|
132
124
|
// Type: { name: string; age?: number }
|
|
133
125
|
```
|
|
134
126
|
|
|
135
|
-
### Arrays
|
|
127
|
+
### Arrays and Tuples
|
|
136
128
|
|
|
137
129
|
```ts
|
|
130
|
+
import { z } from 'zeed'
|
|
131
|
+
|
|
138
132
|
const tags = z.array(z.string())
|
|
139
133
|
// Type: string[]
|
|
134
|
+
|
|
135
|
+
const pair = z.tuple([z.string(), z.number()])
|
|
136
|
+
// Type: [string, number]
|
|
140
137
|
```
|
|
141
138
|
|
|
142
|
-
###
|
|
139
|
+
### Records
|
|
143
140
|
|
|
144
141
|
```ts
|
|
142
|
+
import { z } from 'zeed'
|
|
143
|
+
|
|
144
|
+
const scores = z.record(z.number())
|
|
145
|
+
// Type: Record<string, number>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Unions and Literals
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import { z } from 'zeed'
|
|
152
|
+
|
|
145
153
|
const status = z.union([
|
|
146
154
|
z.literal('active'),
|
|
147
155
|
z.literal('inactive'),
|
|
148
156
|
])
|
|
149
157
|
// Type: 'active' | 'inactive'
|
|
158
|
+
|
|
159
|
+
const role = z.enum(['admin', 'user', 'guest'])
|
|
160
|
+
// Type: 'admin' | 'user' | 'guest'
|
|
161
|
+
// Note: z.enum is an alias for stringLiterals
|
|
150
162
|
```
|
|
151
163
|
|
|
152
164
|
### Type Inference
|
|
153
165
|
|
|
154
166
|
```ts
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
import { z } from 'zeed'
|
|
168
|
+
|
|
169
|
+
const user = z.object({ name: z.string(), age: z.number().optional() })
|
|
170
|
+
type User = z.infer<typeof user>
|
|
171
|
+
// { name: string; age?: number }
|
|
157
172
|
```
|
|
158
173
|
|
|
159
174
|
### Parsing
|
|
160
175
|
|
|
161
176
|
```ts
|
|
177
|
+
import { z } from 'zeed'
|
|
178
|
+
|
|
179
|
+
const user = z.object({ name: z.string(), age: z.number().optional() })
|
|
162
180
|
const parsed = user.parse({ name: 'Alice', age: 30 })
|
|
163
|
-
// parsed: { name: 'Alice', age: 30 }
|
|
164
181
|
```
|
|
165
182
|
|
|
166
183
|
### Optional and Default Values
|
|
167
184
|
|
|
168
185
|
```ts
|
|
186
|
+
import { z } from 'zeed'
|
|
187
|
+
|
|
169
188
|
const score = z.number().optional().default(0)
|
|
170
189
|
// Type: number | undefined (default: 0)
|
|
190
|
+
|
|
191
|
+
// Default can also be a function
|
|
192
|
+
const id = z.string().default(() => crypto.randomUUID())
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Metadata and Descriptions
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import { z } from 'zeed'
|
|
199
|
+
|
|
200
|
+
const name = z.string().meta({ desc: 'The user name' })
|
|
201
|
+
const age = z.number().describe('Age in years')
|
|
171
202
|
```
|
|
172
203
|
|
|
173
204
|
### Function and RPC Types
|
|
174
205
|
|
|
175
206
|
```ts
|
|
207
|
+
import { z } from 'zeed'
|
|
208
|
+
|
|
176
209
|
const add = z.func([z.number(), z.number()], z.number())
|
|
177
210
|
// Type: (a: number, b: number) => number
|
|
211
|
+
|
|
178
212
|
const rpcCall = z.rpc(z.object({ id: z.string() }), z.number())
|
|
179
213
|
// Type: (info: { id: string }) => number | Promise<number>
|
|
180
214
|
```
|
|
181
215
|
|
|
182
|
-
|
|
216
|
+
## Object Schema Transformations
|
|
183
217
|
|
|
184
|
-
|
|
218
|
+
Object schemas support composition methods similar to Zod:
|
|
185
219
|
|
|
186
220
|
```ts
|
|
187
|
-
import {
|
|
221
|
+
import { z } from 'zeed'
|
|
222
|
+
|
|
223
|
+
const user = z.object({
|
|
224
|
+
id: z.string(),
|
|
225
|
+
name: z.string(),
|
|
226
|
+
email: z.string(),
|
|
227
|
+
age: z.number(),
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
// Extend with additional fields
|
|
231
|
+
const userWithRole = user.extend({ role: z.string() })
|
|
232
|
+
|
|
233
|
+
// Pick a subset of fields
|
|
234
|
+
const userName = user.pick({ id: true, name: true })
|
|
235
|
+
|
|
236
|
+
// Omit fields
|
|
237
|
+
const userWithoutEmail = user.omit({ email: true })
|
|
238
|
+
|
|
239
|
+
// Make all (or selected) fields optional
|
|
240
|
+
const partialUser = user.partial()
|
|
241
|
+
const partialByKey = user.partial({ age: true })
|
|
242
|
+
|
|
243
|
+
// Make all (or selected) fields required
|
|
244
|
+
const requiredUser = partialUser.required()
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Serialization and Deserialization
|
|
248
|
+
|
|
249
|
+
Serialize schemas to plain JSON and reconstruct them later. Useful for sending schemas over the network or persisting them.
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
import { deserializeSchema, serializeSchema, z } from 'zeed'
|
|
188
253
|
|
|
189
|
-
// Define a schema
|
|
190
254
|
const userSchema = z.object({
|
|
191
255
|
name: z.string(),
|
|
192
256
|
age: z.number().optional(),
|
|
193
|
-
role: z.
|
|
257
|
+
role: z.enum(['admin', 'user']).default('user'),
|
|
194
258
|
})
|
|
195
259
|
|
|
196
|
-
// Serialize to plain JSON
|
|
197
260
|
const serialized = serializeSchema(userSchema)
|
|
198
|
-
// Result: { type: 'object', object: { name: { type: 'string' }, ... } }
|
|
199
|
-
|
|
200
|
-
// Send over network, store in DB, etc.
|
|
201
261
|
const jsonString = JSON.stringify(serialized)
|
|
202
262
|
|
|
203
|
-
// Deserialize back to a schema
|
|
204
263
|
const deserialized = deserializeSchema(JSON.parse(jsonString))
|
|
205
|
-
// deserialized is now a Type instance identical to userSchema
|
|
206
|
-
|
|
207
|
-
// Use the deserialized schema for validation
|
|
208
264
|
const user = deserialized.parse({ name: 'Alice', role: 'admin' })
|
|
209
265
|
```
|
|
210
266
|
|
|
211
|
-
**Note**: Function defaults (e.g., `.default(() => 'value')`) cannot be serialized and
|
|
267
|
+
**Note**: Function defaults (e.g., `.default(() => 'value')`) cannot be serialized and are omitted. Only static default values are preserved.
|
|
268
|
+
|
|
269
|
+
## Parsing Environment Variables
|
|
270
|
+
|
|
271
|
+
Map a flat object schema onto `process.env`. Field names are converted from camelCase to `UPPER_SNAKE_CASE`.
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
import { parseSchemaEnv, stringFromSchemaEnv, z } from 'zeed'
|
|
275
|
+
|
|
276
|
+
const envSchema = z.object({
|
|
277
|
+
port: z.int().default(3000).meta({ envDesc: 'Server port' }),
|
|
278
|
+
dbUrl: z.string().meta({ envDesc: 'Database connection URL' }),
|
|
279
|
+
debug: z.boolean().default(false),
|
|
280
|
+
secret: z.string().meta({ envPrivate: true }),
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
const env = parseSchemaEnv(envSchema)
|
|
284
|
+
// Reads PORT, DB_URL, DEBUG, SECRET from process.env
|
|
285
|
+
|
|
286
|
+
// Generate a .env template (private fields are hidden unless showPrivate=true)
|
|
287
|
+
const template = stringFromSchemaEnv(envSchema)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Supported `meta` fields: `envDesc`, `envPrivate`, `envSkip`.
|
|
291
|
+
|
|
292
|
+
## Parsing CLI Arguments
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
import { helpSchemaArgs, parseSchemaArgs, z } from 'zeed'
|
|
296
|
+
|
|
297
|
+
const argsSchema = z.object({
|
|
298
|
+
input: z.string().meta({ argShort: 'i', argDesc: 'Input file' }),
|
|
299
|
+
verbose: z.boolean().default(false).meta({ argShort: 'v' }),
|
|
300
|
+
count: z.int().default(1),
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
const [args, rest] = parseSchemaArgs(argsSchema) // reads process.argv
|
|
304
|
+
const help = helpSchemaArgs(argsSchema)
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Supported `meta` fields: `argShort`, `argDesc`.
|
|
308
|
+
|
|
309
|
+
## Exporting Schemas
|
|
310
|
+
|
|
311
|
+
### TypeScript Interface
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
import { schemaExportTypescriptInterface, z } from 'zeed'
|
|
315
|
+
|
|
316
|
+
const user = z.object({
|
|
317
|
+
name: z.string(),
|
|
318
|
+
age: z.int().optional(),
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
const ts = schemaExportTypescriptInterface(user, 'User')
|
|
322
|
+
// export interface User { name: string; age?: number }
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Swift Struct
|
|
326
|
+
|
|
327
|
+
```ts
|
|
328
|
+
import { schemaExportSwiftStruct, z } from 'zeed'
|
|
329
|
+
|
|
330
|
+
const user = z.object({
|
|
331
|
+
name: z.string(),
|
|
332
|
+
age: z.int().optional(),
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
const swift = schemaExportSwiftStruct(user, 'User')
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Supported `meta` fields: `swiftName`, `swiftProtocol`, `swiftDesc`, `swiftDefault`.
|
|
339
|
+
|
|
340
|
+
### JSON Schema
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
import { schemaExportJsonSchema, schemaExportJsonSchemaString, z } from 'zeed'
|
|
344
|
+
|
|
345
|
+
const user = z.object({
|
|
346
|
+
name: z.string(),
|
|
347
|
+
age: z.number().optional(),
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
const jsonSchema = schemaExportJsonSchema(user)
|
|
351
|
+
const jsonSchemaStr = schemaExportJsonSchemaString(user)
|
|
352
|
+
```
|
|
212
353
|
|
|
213
354
|
## API Reference
|
|
214
355
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
- `
|
|
218
|
-
- `
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
- `
|
|
223
|
-
- `
|
|
356
|
+
### Primitives
|
|
357
|
+
|
|
358
|
+
- `z.string()`, `z.number()`, `z.int()`, `z.boolean()`, `z.none()`, `z.any()`
|
|
359
|
+
- `z.float()`, `z.double()`, `z.real()` - aliases for `z.number()`
|
|
360
|
+
|
|
361
|
+
### Composites
|
|
362
|
+
|
|
363
|
+
- `z.object({...})`, `z.array(type)`, `z.tuple([...])`, `z.record(type)`
|
|
364
|
+
- `z.union([...])`
|
|
365
|
+
- `z.literal(value)`, `z.stringLiterals([...])`, `z.enum([...])`
|
|
366
|
+
- `z.func(args, ret)`, `z.rpc(info, ret)`
|
|
367
|
+
|
|
368
|
+
### Type methods
|
|
369
|
+
|
|
370
|
+
- `.optional()`, `.default(value | fn)`
|
|
371
|
+
- `.meta({ desc, ... })`, `.describe(msg)`
|
|
372
|
+
- `.parse(obj)`
|
|
373
|
+
- Object only: `.extend({...})`, `.pick({...})`, `.omit({...})`, `.partial()`, `.partial({...})`, `.required()`, `.required({...})`
|
|
374
|
+
|
|
375
|
+
### Type inference helpers
|
|
376
|
+
|
|
377
|
+
- `z.infer<typeof schema>`
|
|
378
|
+
|
|
379
|
+
### Serialization
|
|
380
|
+
|
|
381
|
+
- `serializeSchema(schema)` - Convert a schema to a plain JSON object
|
|
382
|
+
- `deserializeSchema(json)` - Reconstruct a schema from a JSON object
|
|
383
|
+
|
|
384
|
+
### Parsing helpers
|
|
385
|
+
|
|
386
|
+
- `schemaCreateObject(schema)` - Build an object from defaults
|
|
387
|
+
- `schemaParseObject(schema, obj, opt?)` - Parse and coerce an object against a schema
|
|
388
|
+
- `schemaValidateObject(schema, obj, opt?)` - Validate without coercion, returns issues
|
|
389
|
+
|
|
390
|
+
### Environment and CLI
|
|
391
|
+
|
|
392
|
+
- `parseSchemaEnv(schema, opt?)`, `stringFromSchemaEnv(schema, prefix?, commentOut?, showPrivate?)`
|
|
393
|
+
- `parseSchemaArgs(schema, argv?)`, `helpSchemaArgs(schema)`
|
|
394
|
+
|
|
395
|
+
### Exporters
|
|
396
|
+
|
|
397
|
+
- `schemaExportTypescriptInterface(schema, name?)`
|
|
398
|
+
- `schemaExportSwiftStruct(schema, name?)`
|
|
399
|
+
- `schemaExportJsonSchema(schema)`, `schemaExportJsonSchemaString(schema)`
|
|
400
|
+
|
|
401
|
+
### Utilities
|
|
402
|
+
|
|
403
|
+
- `isSchemaObject(schema)`, `isSchemaObjectFlat(schema)`
|
|
404
|
+
- `isSchemaOptional(schema)`, `isSchemaDefault(schema)`, `isSchemaPrimitive(schema)`
|
|
224
405
|
|
|
225
406
|
## Notes
|
|
226
407
|
|
|
227
|
-
- `z.string` and `string` are functionally equivalent, but `z.string` is preferred for consistency and clarity.
|
|
228
|
-
- Each schema definition results in a corresponding TypeScript type,
|
|
408
|
+
- `z.string()` and the bare `string()` export are functionally equivalent, but `z.string()` is preferred for consistency and clarity.
|
|
409
|
+
- Each schema definition results in a corresponding TypeScript type, extractable via `z.infer<typeof schema>`.
|
|
@@ -171,11 +171,15 @@ describe('json-schema.spec', () => {
|
|
|
171
171
|
"type": "string",
|
|
172
172
|
},
|
|
173
173
|
"value": Object {
|
|
174
|
-
"
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
"anyOf": Array [
|
|
175
|
+
Object {
|
|
176
|
+
"type": "string",
|
|
177
|
+
},
|
|
178
|
+
Object {
|
|
179
|
+
"type": "number",
|
|
180
|
+
},
|
|
178
181
|
],
|
|
182
|
+
"description": "The value to compare against",
|
|
179
183
|
},
|
|
180
184
|
},
|
|
181
185
|
"required": Array [
|
|
@@ -233,9 +237,9 @@ describe('json-schema.spec', () => {
|
|
|
233
237
|
description: 'A comparison operator',
|
|
234
238
|
},
|
|
235
239
|
value: {
|
|
236
|
-
|
|
237
|
-
'string',
|
|
238
|
-
'number',
|
|
240
|
+
anyOf: [
|
|
241
|
+
{ type: 'string' },
|
|
242
|
+
{ type: 'number' },
|
|
239
243
|
],
|
|
240
244
|
description: 'The value to compare against',
|
|
241
245
|
},
|