@infra-blocks/zod-utils 0.24.0 → 0.25.0-alpha.1

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/README.md CHANGED
@@ -384,6 +384,20 @@ expectsInteger(zu.number.integer().parse(42));
384
384
  ### string
385
385
 
386
386
  The `zu.string` module exposes schemas for manipulating strings. All schemas return [branded types](#branded-types).
387
+ Which means, their result can be used as strings anywhere, but strings cannot be used in place of the corresonding
388
+ type.
389
+
390
+ #### base64url
391
+
392
+ ```typescript
393
+ import { zu } from "@infra-blocks/zod-utils";
394
+ import { Base64UrlString } from "@infra-blocks/zod-utils/string";
395
+ import { expectTypeOf } from "expect-type";
396
+
397
+ const result = zu.string.base64url().parse("w6p0cmUgb3UgbmUgcGFzIMOqdHJlIGVzdGk_");
398
+ expectTypeOf(result).toEqualTypeOf<IntegerString>();
399
+ expect(result).to.equal("w6p0cmUgb3UgbmUgcGFzIMOqdHJlIGVzdGk_");
400
+ ```
387
401
 
388
402
  #### integer
389
403
 
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ declare const schema: z.core.$ZodBranded<z.ZodBase64URL, "Base64UrlString">;
3
+ export type Base64UrlString = z.infer<typeof schema>;
4
+ export declare const base64url: () => z.core.$ZodBranded<z.ZodBase64URL, "Base64UrlString">;
5
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.base64url = void 0;
4
+ const zod_1 = require("zod");
5
+ const schema = zod_1.z.base64url().brand("Base64UrlString");
6
+ const base64url = () => schema;
7
+ exports.base64url = base64url;
8
+ //# sourceMappingURL=base64url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64url.js","sourceRoot":"","sources":["../../../src/string/base64url.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,MAAM,MAAM,GAAG,OAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAI/C,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC;AAAzB,QAAA,SAAS,aAAgB"}
@@ -1,4 +1,5 @@
1
1
  declare const string: {
2
+ base64url: () => import("zod/v4/core").$ZodBranded<import("zod").ZodBase64URL, "Base64UrlString">;
2
3
  integer: () => import("zod/v4/core").$ZodBranded<import("zod").ZodString, "IntegerString">;
3
4
  json: () => import("zod/v4/core").$ZodBranded<import("zod").ZodString, "JsonString">;
4
5
  number: () => import("zod/v4/core").$ZodBranded<import("zod").ZodString, "NumberString">;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.string = void 0;
4
+ const base64url_js_1 = require("./base64url.js");
4
5
  const integer_js_1 = require("./integer.js");
5
6
  const json_js_1 = require("./json.js");
6
7
  const number_js_1 = require("./number.js");
7
8
  const url_js_1 = require("./url.js");
8
9
  const string = {
10
+ base64url: base64url_js_1.base64url,
9
11
  integer: integer_js_1.integer,
10
12
  json: json_js_1.json,
11
13
  number: number_js_1.number,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/string/index.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,uCAAiC;AACjC,2CAAqC;AACrC,qCAA+B;AAE/B,MAAM,MAAM,GAAG;IACb,OAAO,EAAP,oBAAO;IACP,IAAI,EAAJ,cAAI;IACJ,MAAM,EAAN,kBAAM;IACN,GAAG,EAAH,YAAG;CACJ,CAAC;AAEO,wBAAM"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/string/index.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAC3C,6CAAuC;AACvC,uCAAiC;AACjC,2CAAqC;AACrC,qCAA+B;AAE/B,MAAM,MAAM,GAAG;IACb,SAAS,EAAT,wBAAS;IACT,OAAO,EAAP,oBAAO;IACP,IAAI,EAAJ,cAAI;IACJ,MAAM,EAAN,kBAAM;IACN,GAAG,EAAH,YAAG;CACJ,CAAC;AAEO,wBAAM"}
@@ -1,3 +1,4 @@
1
+ export { Base64UrlString } from "./base64url.js";
1
2
  export { IntegerString } from "./integer.js";
2
3
  export { JsonString } from "./json.js";
3
4
  export { NumberString } from "./number.js";
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ declare const schema: z.core.$ZodBranded<z.ZodBase64URL, "Base64UrlString">;
3
+ export type Base64UrlString = z.infer<typeof schema>;
4
+ export declare const base64url: () => z.core.$ZodBranded<z.ZodBase64URL, "Base64UrlString">;
5
+ export {};
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ const schema = z.base64url().brand("Base64UrlString");
3
+ export const base64url = () => schema;
4
+ //# sourceMappingURL=base64url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64url.js","sourceRoot":"","sources":["../../../src/string/base64url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAItD,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC"}
@@ -1,4 +1,5 @@
1
1
  declare const string: {
2
+ base64url: () => import("zod/v4/core").$ZodBranded<import("zod").ZodBase64URL, "Base64UrlString">;
2
3
  integer: () => import("zod/v4/core").$ZodBranded<import("zod").ZodString, "IntegerString">;
3
4
  json: () => import("zod/v4/core").$ZodBranded<import("zod").ZodString, "JsonString">;
4
5
  number: () => import("zod/v4/core").$ZodBranded<import("zod").ZodString, "NumberString">;
@@ -1,8 +1,10 @@
1
+ import { base64url } from "./base64url.js";
1
2
  import { integer } from "./integer.js";
2
3
  import { json } from "./json.js";
3
4
  import { number } from "./number.js";
4
5
  import { url } from "./url.js";
5
6
  const string = {
7
+ base64url,
6
8
  integer,
7
9
  json,
8
10
  number,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/string/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,MAAM,GAAG;IACb,OAAO;IACP,IAAI;IACJ,MAAM;IACN,GAAG;CACJ,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/string/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,MAAM,GAAG;IACb,SAAS;IACT,OAAO;IACP,IAAI;IACJ,MAAM;IACN,GAAG;CACJ,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { Base64UrlString } from "./base64url.js";
1
2
  export { IntegerString } from "./integer.js";
2
3
  export { JsonString } from "./json.js";
3
4
  export { NumberString } from "./number.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infra-blocks/zod-utils",
3
- "version": "0.24.0",
3
+ "version": "0.25.0-alpha.1",
4
4
  "description": "Extensions to the zod package.",
5
5
  "keywords": [
6
6
  "zod",