zod 4.2.0-canary.20251106T231624 → 4.2.0-canary.20251118T055019

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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/v4/classic/schemas.ts +13 -0
  3. package/src/v4/classic/tests/continuability.test.ts +22 -0
  4. package/src/v4/classic/tests/registries.test.ts +4 -0
  5. package/src/v4/classic/tests/string.test.ts +54 -0
  6. package/src/v4/classic/tests/template-literal.test.ts +8 -0
  7. package/src/v4/classic/tests/to-json-schema.test.ts +49 -0
  8. package/src/v4/core/api.ts +16 -0
  9. package/src/v4/core/regexes.ts +8 -1
  10. package/src/v4/core/registries.ts +12 -1
  11. package/src/v4/core/schemas.ts +21 -0
  12. package/src/v4/locales/en.ts +1 -0
  13. package/src/v4/mini/schemas.ts +13 -0
  14. package/src/v4/mini/tests/string.test.ts +32 -0
  15. package/v3/ZodError.d.cts +1 -1
  16. package/v3/ZodError.d.ts +1 -1
  17. package/v4/classic/schemas.cjs +11 -2
  18. package/v4/classic/schemas.d.cts +5 -0
  19. package/v4/classic/schemas.d.ts +5 -0
  20. package/v4/classic/schemas.js +8 -0
  21. package/v4/core/api.cjs +10 -0
  22. package/v4/core/api.d.cts +3 -0
  23. package/v4/core/api.d.ts +3 -0
  24. package/v4/core/api.js +9 -0
  25. package/v4/core/regexes.cjs +31 -2
  26. package/v4/core/regexes.d.cts +1 -0
  27. package/v4/core/regexes.d.ts +1 -0
  28. package/v4/core/regexes.js +5 -0
  29. package/v4/core/registries.cjs +3 -1
  30. package/v4/core/registries.js +3 -1
  31. package/v4/core/schemas.cjs +7 -2
  32. package/v4/core/schemas.d.cts +11 -1
  33. package/v4/core/schemas.d.ts +11 -1
  34. package/v4/core/schemas.js +5 -0
  35. package/v4/locales/en.cjs +1 -0
  36. package/v4/locales/en.js +1 -0
  37. package/v4/mini/schemas.cjs +10 -2
  38. package/v4/mini/schemas.d.cts +4 -0
  39. package/v4/mini/schemas.d.ts +4 -0
  40. package/v4/mini/schemas.js +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.2.0-canary.20251106T231624",
3
+ "version": "4.2.0-canary.20251118T055019",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Colin McDonnell <zod@colinhacks.com>",
@@ -614,6 +614,19 @@ export function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4 {
614
614
  return core._ipv4(ZodIPv4, params);
615
615
  }
616
616
 
617
+ // ZodMAC
618
+ export interface ZodMAC extends ZodStringFormat<"mac"> {
619
+ _zod: core.$ZodMACInternals;
620
+ }
621
+ export const ZodMAC: core.$constructor<ZodMAC> = /*@__PURE__*/ core.$constructor("ZodMAC", (inst, def) => {
622
+ // ZodStringFormat.init(inst, def);
623
+ core.$ZodMAC.init(inst, def);
624
+ ZodStringFormat.init(inst, def);
625
+ });
626
+ export function mac(params?: string | core.$ZodMACParams): ZodMAC {
627
+ return core._mac(ZodMAC, params);
628
+ }
629
+
617
630
  // ZodIPv6
618
631
  export interface ZodIPv6 extends ZodStringFormat<"ipv6"> {
619
632
  _zod: core.$ZodIPv6Internals;
@@ -195,6 +195,28 @@ test("continuability", () => {
195
195
  },
196
196
  ]
197
197
  `);
198
+ expect(
199
+ z
200
+ .mac()
201
+ .refine(() => false)
202
+ .safeParse("invalid_value").error!.issues
203
+ ).toMatchInlineSnapshot(`
204
+ [
205
+ {
206
+ "code": "invalid_format",
207
+ "format": "mac",
208
+ "message": "Invalid MAC address",
209
+ "origin": "string",
210
+ "path": [],
211
+ "pattern": "/^(([0-9A-F]{2}(:)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(:)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$/",
212
+ },
213
+ {
214
+ "code": "custom",
215
+ "message": "Invalid input",
216
+ "path": [],
217
+ },
218
+ ]
219
+ `);
198
220
  expect(
199
221
  z
200
222
  .emoji()
@@ -19,6 +19,10 @@ test("globalRegistry", () => {
19
19
  expect(z.globalRegistry.has(a)).toEqual(false);
20
20
  });
21
21
 
22
+ test("globalRegistry is singleton and attached to globalThis", () => {
23
+ expect(z.globalRegistry).toBe((globalThis as any).__zod_globalRegistry);
24
+ });
25
+
22
26
  test("z.registry", () => {
23
27
  const fieldRegistry = z.registry<{ name: string; description: string }>();
24
28
 
@@ -775,6 +775,8 @@ test("format", () => {
775
775
  expect(z.string().date().format).toEqual("date");
776
776
  expect(z.string().time().format).toEqual("time");
777
777
  expect(z.string().duration().format).toEqual("duration");
778
+
779
+ expect(z.mac().format).toEqual("mac");
778
780
  });
779
781
 
780
782
  test("min max getters", () => {
@@ -885,6 +887,58 @@ test("IPv6 validation", () => {
885
887
  expect(() => ipv6.parse("254.164.77.1")).toThrow();
886
888
  });
887
889
 
890
+ test("MAC validation", () => {
891
+ const mac = z.mac();
892
+
893
+ // Valid MAC addresses
894
+ expect(mac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(true);
895
+ expect(mac.safeParse("FF:FF:FF:FF:FF:FF").success).toBe(true);
896
+ expect(mac.safeParse("00:11:22:33:44:55").success).toBe(true);
897
+ expect(mac.safeParse("A1:B2:C3:D4:E5:F6").success).toBe(true);
898
+ expect(mac.safeParse("10:20:30:40:50:60").success).toBe(true);
899
+ expect(mac.safeParse("0a:1b:2c:3d:4e:5f").success).toBe(true);
900
+ expect(mac.safeParse("12:34:56:78:9A:BC").success).toBe(true);
901
+
902
+ // Invalid MAC addresses
903
+ expect(mac.safeParse("00:1A-2B:3C-4D:5E").success).toBe(false);
904
+ expect(mac.safeParse("00:1A:2B:3C:4D").success).toBe(false);
905
+ expect(mac.safeParse("00:1A:2B:3C:4D").success).toBe(false);
906
+ expect(mac.safeParse("00-1A-2B-3C-4D").success).toBe(false);
907
+ expect(mac.safeParse("01-23-45-67-89-AB").success).toBe(false); // Dash delimiter not accepted by default
908
+ expect(mac.safeParse("AA-BB-CC-DD-EE-FF").success).toBe(false); // Dash delimiter not accepted by default
909
+ expect(mac.safeParse("DE-AD-BE-EF-00-01").success).toBe(false); // Dash delimiter not accepted by default
910
+ expect(mac.safeParse("98-76-54-32-10-FF").success).toBe(false); // Dash delimiter not accepted by default
911
+ expect(mac.safeParse("00:1A:2B:3C:4D:GZ").success).toBe(false);
912
+ expect(mac.safeParse("00:1A:2B:3C:4D:5E:GG").success).toBe(false);
913
+ expect(mac.safeParse("123:45:67:89:AB:CD").success).toBe(false);
914
+ expect(mac.safeParse("00--1A:2B:3C:4D:5E").success).toBe(false);
915
+ expect(mac.safeParse("00:1A::2B:3C:4D:5E").success).toBe(false);
916
+ expect(mac.safeParse("00:1A:2B:3C:3C:2B:1A:00").success).toBe(false); // Disallow EUI-64
917
+ expect(mac.safeParse("00:1a:2B:3c:4D:5e").success).toBe(false); // Disallow mixed-case
918
+
919
+ // MAC formats that are nonstandard but occassionally referenced, ex. https://www.postgresql.org/docs/17/datatype-net-types.html#DATATYPE-MACADDR
920
+ expect(mac.safeParse("00:1A:2B:3C:4D:5E:FF").success).toBe(false);
921
+ expect(mac.safeParse("001A2B:3C4D5E").success).toBe(false);
922
+ expect(mac.safeParse("001A:2B3C:4D5E").success).toBe(false);
923
+ expect(mac.safeParse("001A.2B3C.4D5E").success).toBe(false);
924
+ expect(mac.safeParse("001A2B3C4D5E").success).toBe(false);
925
+ expect(mac.safeParse("00.1A.2B.3C.4D.5E").success).toBe(false);
926
+ });
927
+
928
+ test("MAC validation with custom delimiter", () => {
929
+ const colonMac = z.mac({ delimiter: ":" });
930
+ expect(colonMac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(true);
931
+ expect(colonMac.safeParse("00-1A-2B-3C-4D-5E").success).toBe(false);
932
+
933
+ const dashMac = z.mac({ delimiter: "-" });
934
+ expect(dashMac.safeParse("00-1A-2B-3C-4D-5E").success).toBe(true);
935
+ expect(dashMac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(false);
936
+
937
+ const colonOnlyMac = z.mac({ delimiter: ":" });
938
+ expect(colonOnlyMac.safeParse("00:1A:2B:3C:4D:5E").success).toBe(true);
939
+ expect(colonOnlyMac.safeParse("00-1A-2B-3C-4D-5E").success).toBe(false);
940
+ });
941
+
888
942
  test("CIDR v4 validation", () => {
889
943
  const cidrV4 = z.string().cidrv4();
890
944
 
@@ -43,6 +43,7 @@ const email = z.templateLiteral(["", z.string().email()]);
43
43
  // const ip = z.templateLiteral(["", z.string().ip()]);
44
44
  const ipv4 = z.templateLiteral(["", z.string().ipv4()]);
45
45
  const ipv6 = z.templateLiteral(["", z.string().ipv6()]);
46
+ const mac = z.templateLiteral(["", z.mac()]);
46
47
  const ulid = z.templateLiteral(["", z.string().ulid()]);
47
48
  const uuid = z.templateLiteral(["", z.string().uuid()]);
48
49
  const stringAToZ = z.templateLiteral(["", z.string().regex(/^[a-z]+$/)]);
@@ -137,6 +138,7 @@ test("template literal type inference", () => {
137
138
  // expectTypeOf<z.infer<typeof ip>>().toEqualTypeOf<string>();
138
139
  expectTypeOf<z.infer<typeof ipv4>>().toEqualTypeOf<string>();
139
140
  expectTypeOf<z.infer<typeof ipv6>>().toEqualTypeOf<string>();
141
+ expectTypeOf<z.infer<typeof mac>>().toEqualTypeOf<string>();
140
142
  expectTypeOf<z.infer<typeof ulid>>().toEqualTypeOf<string>();
141
143
  expectTypeOf<z.infer<typeof uuid>>().toEqualTypeOf<string>();
142
144
  expectTypeOf<z.infer<typeof stringAToZ>>().toEqualTypeOf<string>();
@@ -361,6 +363,7 @@ test("template literal parsing - success - basic cases", () => {
361
363
  // ip.parse("c359:f57c:21e5:39eb:1187:e501:f936:b452");
362
364
  ipv4.parse("213.174.246.205");
363
365
  ipv6.parse("c359:f57c:21e5:39eb:1187:e501:f936:b452");
366
+ mac.parse("00:1A:2B:3C:4D:5E");
364
367
  ulid.parse("01GW3D2QZJBYB6P1Z1AE997VPW");
365
368
  uuid.parse("808989fd-3a6e-4af2-b607-737323a176f6");
366
369
  stringAToZ.parse("asudgaskhdgashd");
@@ -497,6 +500,8 @@ test("template literal parsing - failure - basic cases", () => {
497
500
  expect(() => ipv4.parse("c359:f57c:21e5:39eb:1187:e501:f936:b452")).toThrow();
498
501
  expect(() => ipv6.parse("c359:f57c:21e5:39eb:1187:e501:f936:b4521")).toThrow();
499
502
  expect(() => ipv6.parse("213.174.246.205")).toThrow();
503
+ expect(() => mac.parse("00:1A:2B:3C:4D:5E:6A:7B")).toThrow();
504
+ expect(() => mac.parse("00:1A:2B:3C")).toThrow();
500
505
  expect(() => ulid.parse("01GW3D2QZJBYB6P1Z1AE997VPW!")).toThrow();
501
506
  expect(() => uuid.parse("808989fd-3a6e-4af2-b607-737323a176f6Z")).toThrow();
502
507
  expect(() => uuid.parse("Z808989fd-3a6e-4af2-b607-737323a176f6")).toThrow();
@@ -568,6 +573,9 @@ test("regexes", () => {
568
573
  expect(ipv6._zod.pattern.source).toMatchInlineSnapshot(
569
574
  `"^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$"`
570
575
  );
576
+ expect(mac._zod.pattern.source).toMatchInlineSnapshot(
577
+ `"^(([0-9A-F]{2}(:)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(:)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$"`
578
+ );
571
579
  expect(ulid._zod.pattern.source).toMatchInlineSnapshot(`"^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$"`);
572
580
  expect(uuid._zod.pattern.source).toMatchInlineSnapshot(
573
581
  `"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"`
@@ -132,6 +132,30 @@ describe("toJSONSchema", () => {
132
132
  "type": "string",
133
133
  }
134
134
  `);
135
+ expect(z.toJSONSchema(z.mac())).toMatchInlineSnapshot(`
136
+ {
137
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
138
+ "format": "mac",
139
+ "pattern": "^(([0-9A-F]{2}(:)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(:)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$",
140
+ "type": "string",
141
+ }
142
+ `);
143
+ expect(z.toJSONSchema(z.mac({ delimiter: ":" }))).toMatchInlineSnapshot(`
144
+ {
145
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
146
+ "format": "mac",
147
+ "pattern": "^(([0-9A-F]{2}(:)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(:)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$",
148
+ "type": "string",
149
+ }
150
+ `);
151
+ expect(z.toJSONSchema(z.mac({ delimiter: "-" }))).toMatchInlineSnapshot(`
152
+ {
153
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
154
+ "format": "mac",
155
+ "pattern": "^(([0-9A-F]{2}(-)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(-)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$",
156
+ "type": "string",
157
+ }
158
+ `);
135
159
  expect(z.toJSONSchema(z.uuid())).toMatchInlineSnapshot(`
136
160
  {
137
161
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -357,6 +381,31 @@ describe("toJSONSchema", () => {
357
381
  }
358
382
  `);
359
383
 
384
+ expect(z.toJSONSchema(z.mac())).toMatchInlineSnapshot(`
385
+ {
386
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
387
+ "format": "mac",
388
+ "pattern": "^(([0-9A-F]{2}(:)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(:)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$",
389
+ "type": "string",
390
+ }
391
+ `);
392
+ expect(z.toJSONSchema(z.mac({ delimiter: ":" }))).toMatchInlineSnapshot(`
393
+ {
394
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
395
+ "format": "mac",
396
+ "pattern": "^(([0-9A-F]{2}(:)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(:)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$",
397
+ "type": "string",
398
+ }
399
+ `);
400
+ expect(z.toJSONSchema(z.mac({ delimiter: "-" }))).toMatchInlineSnapshot(`
401
+ {
402
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
403
+ "format": "mac",
404
+ "pattern": "^(([0-9A-F]{2}(-)[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(-)[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$",
405
+ "type": "string",
406
+ }
407
+ `);
408
+
360
409
  expect(z.toJSONSchema(z.base64())).toMatchInlineSnapshot(`
361
410
  {
362
411
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -345,6 +345,22 @@ export function _ipv6<T extends schemas.$ZodIPv6>(
345
345
  });
346
346
  }
347
347
 
348
+ // MAC
349
+ export type $ZodMACParams = StringFormatParams<schemas.$ZodMAC, "pattern" | "when">;
350
+ export type $ZodCheckMACParams = CheckStringFormatParams<schemas.$ZodMAC, "pattern" | "when">;
351
+ export function _mac<T extends schemas.$ZodMAC>(
352
+ Class: util.SchemaClass<T>,
353
+ params?: string | $ZodMACParams | $ZodCheckMACParams
354
+ ): T {
355
+ return new Class({
356
+ type: "string",
357
+ format: "mac",
358
+ check: "string_format",
359
+ abort: false,
360
+ ...util.normalizeParams(params),
361
+ });
362
+ }
363
+
348
364
  // CIDRv4
349
365
  export type $ZodCIDRv4Params = StringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
350
366
  export type $ZodCheckCIDRv4Params = CheckStringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
@@ -1,3 +1,5 @@
1
+ import * as util from "./util.js";
2
+
1
3
  export const cuid: RegExp = /^[cC][^\s-]{8,}$/;
2
4
  export const cuid2: RegExp = /^[0-9a-z]+$/;
3
5
  export const ulid: RegExp = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -59,7 +61,12 @@ export const ipv4: RegExp =
59
61
  /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
60
62
  export const ipv6: RegExp =
61
63
  /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
62
-
64
+ export const mac = (delimiter?: string): RegExp => {
65
+ const escapedDelim = util.escapeRegex(delimiter ?? ":");
66
+ return new RegExp(
67
+ `^(([0-9A-F]{2}(${escapedDelim})[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(${escapedDelim})[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$`
68
+ );
69
+ };
63
70
  export const cidrv4: RegExp =
64
71
  /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
65
72
  export const cidrv6: RegExp =
@@ -94,4 +94,15 @@ export function registry<T extends MetadataType = MetadataType, S extends $ZodTy
94
94
  return new $ZodRegistry<T, S>();
95
95
  }
96
96
 
97
- export const globalRegistry: $ZodRegistry<GlobalMeta> = /*@__PURE__*/ registry<GlobalMeta>();
97
+ interface GlobalThisWithRegistry {
98
+ /**
99
+ * The globalRegistry instance shared across both CommonJS and ESM builds.
100
+ * By attaching the registry to `globalThis`, this property ensures a single, deduplicated instance
101
+ * is used regardless of whether the package is loaded via `require` (CJS) or `import` (ESM).
102
+ * This prevents dual package hazards and keeps registry state consistent.
103
+ */
104
+ __zod_globalRegistry?: $ZodRegistry<GlobalMeta>;
105
+ }
106
+
107
+ (globalThis as GlobalThisWithRegistry).__zod_globalRegistry ??= registry<GlobalMeta>();
108
+ export const globalRegistry: $ZodRegistry<GlobalMeta> = (globalThis as GlobalThisWithRegistry).__zod_globalRegistry!;
@@ -782,6 +782,26 @@ export const $ZodIPv6: core.$constructor<$ZodIPv6> = /*@__PURE__*/ core.$constru
782
782
  };
783
783
  });
784
784
 
785
+ ////////////////////////////// ZodMAC //////////////////////////////
786
+ export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> {
787
+ delimiter?: string;
788
+ }
789
+
790
+ export interface $ZodMACInternals extends $ZodStringFormatInternals<"mac"> {
791
+ def: $ZodMACDef;
792
+ }
793
+
794
+ export interface $ZodMAC extends $ZodType {
795
+ _zod: $ZodMACInternals;
796
+ }
797
+
798
+ export const $ZodMAC: core.$constructor<$ZodMAC> = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def): void => {
799
+ def.pattern ??= regexes.mac(def.delimiter);
800
+ $ZodStringFormat.init(inst, def);
801
+
802
+ inst._zod.bag.format = `mac`;
803
+ });
804
+
785
805
  ////////////////////////////// ZodCIDRv4 //////////////////////////////
786
806
 
787
807
  export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
@@ -4300,6 +4320,7 @@ export type $ZodStringFormatTypes =
4300
4320
  | $ZodISODuration
4301
4321
  | $ZodIPv4
4302
4322
  | $ZodIPv6
4323
+ | $ZodMAC
4303
4324
  | $ZodCIDRv4
4304
4325
  | $ZodCIDRv6
4305
4326
  | $ZodBase64
@@ -60,6 +60,7 @@ const error: () => errors.$ZodErrorMap = () => {
60
60
  duration: "ISO duration",
61
61
  ipv4: "IPv4 address",
62
62
  ipv6: "IPv6 address",
63
+ mac: "MAC address",
63
64
  cidrv4: "IPv4 range",
64
65
  cidrv6: "IPv6 range",
65
66
  base64: "base64-encoded string",
@@ -366,6 +366,19 @@ export function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6 {
366
366
  return core._cidrv6(ZodMiniCIDRv6, params);
367
367
  }
368
368
 
369
+ // ZodMiniMAC
370
+ export interface ZodMiniMAC extends _ZodMiniString<core.$ZodMACInternals> {
371
+ // _zod: core.$ZodMACInternals;
372
+ }
373
+ export const ZodMiniMAC: core.$constructor<ZodMiniMAC> = /*@__PURE__*/ core.$constructor("ZodMiniMAC", (inst, def) => {
374
+ core.$ZodMAC.init(inst, def);
375
+ ZodMiniStringFormat.init(inst, def);
376
+ });
377
+
378
+ export function mac(params?: string | core.$ZodMACParams): ZodMiniMAC {
379
+ return core._mac(ZodMiniMAC, params);
380
+ }
381
+
369
382
  // ZodMiniBase64
370
383
  export interface ZodMiniBase64 extends _ZodMiniString<core.$ZodBase64Internals> {
371
384
  // _zod: core.$ZodBase64Internals;
@@ -241,6 +241,38 @@ test("z.ipv6", () => {
241
241
  expect(() => z.parse(a, 123)).toThrow();
242
242
  });
243
243
 
244
+ test("z.mac", () => {
245
+ const a = z.mac();
246
+ // valid mac
247
+ expect(z.parse(a, "00:1A:2B:3C:4D:5E")).toEqual("00:1A:2B:3C:4D:5E");
248
+ // invalid mac (dash delimiter not accepted by default)
249
+ expect(() => z.parse(a, "01-23-45-67-89-AB")).toThrow();
250
+ expect(() => z.parse(a, "00:1A:2B::4D:5E")).toThrow();
251
+ expect(() => z.parse(a, "00:1a-2B:3c-4D:5e")).toThrow();
252
+ expect(() => z.parse(a, "hello")).toThrow();
253
+ // wrong type
254
+ expect(() => z.parse(a, 123)).toThrow();
255
+ });
256
+
257
+ test("z.mac with custom delimiter", () => {
258
+ const a = z.mac({ delimiter: ":" });
259
+ // valid mac with colon
260
+ expect(z.parse(a, "00:1A:2B:3C:4D:5E")).toEqual("00:1A:2B:3C:4D:5E");
261
+ // invalid mac with dash
262
+ expect(() => z.parse(a, "00-1A-2B-3C-4D-5E")).toThrow();
263
+
264
+ const b = z.mac({ delimiter: "-" });
265
+ // valid mac with dash
266
+ expect(z.parse(b, "00-1A-2B-3C-4D-5E")).toEqual("00-1A-2B-3C-4D-5E");
267
+ // invalid mac with colon
268
+ expect(() => z.parse(b, "00:1A:2B:3C:4D:5E")).toThrow();
269
+
270
+ const c = z.mac({ delimiter: ":" });
271
+ // colon-only mac
272
+ expect(z.parse(c, "00:1A:2B:3C:4D:5E")).toEqual("00:1A:2B:3C:4D:5E");
273
+ expect(() => z.parse(c, "00-1A-2B-3C-4D-5E")).toThrow();
274
+ });
275
+
244
276
  test("z.base64", () => {
245
277
  const a = z.base64();
246
278
  // valid base64
package/v3/ZodError.d.cts CHANGED
@@ -12,10 +12,10 @@ export type typeToFlattenedError<T, U = string> = {
12
12
  export declare const ZodIssueCode: {
13
13
  custom: "custom";
14
14
  invalid_type: "invalid_type";
15
- unrecognized_keys: "unrecognized_keys";
16
15
  too_big: "too_big";
17
16
  too_small: "too_small";
18
17
  not_multiple_of: "not_multiple_of";
18
+ unrecognized_keys: "unrecognized_keys";
19
19
  invalid_union: "invalid_union";
20
20
  invalid_literal: "invalid_literal";
21
21
  invalid_union_discriminator: "invalid_union_discriminator";
package/v3/ZodError.d.ts CHANGED
@@ -12,10 +12,10 @@ export type typeToFlattenedError<T, U = string> = {
12
12
  export declare const ZodIssueCode: {
13
13
  custom: "custom";
14
14
  invalid_type: "invalid_type";
15
- unrecognized_keys: "unrecognized_keys";
16
15
  too_big: "too_big";
17
16
  too_small: "too_small";
18
17
  not_multiple_of: "not_multiple_of";
18
+ unrecognized_keys: "unrecognized_keys";
19
19
  invalid_union: "invalid_union";
20
20
  invalid_literal: "invalid_literal";
21
21
  invalid_union_discriminator: "invalid_union_discriminator";
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ZodTransform = exports.ZodFile = exports.ZodLiteral = exports.ZodEnum = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodDate = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodBigIntFormat = exports.ZodBigInt = exports.ZodBoolean = exports.ZodNumberFormat = exports.ZodNumber = exports.ZodCustomStringFormat = exports.ZodJWT = exports.ZodE164 = exports.ZodBase64URL = exports.ZodBase64 = exports.ZodCIDRv6 = exports.ZodCIDRv4 = exports.ZodIPv6 = exports.ZodIPv4 = exports.ZodKSUID = exports.ZodXID = exports.ZodULID = exports.ZodCUID2 = exports.ZodCUID = exports.ZodNanoID = exports.ZodEmoji = exports.ZodURL = exports.ZodUUID = exports.ZodGUID = exports.ZodEmail = exports.ZodStringFormat = exports.ZodString = exports._ZodString = exports.ZodType = void 0;
27
- exports.stringbool = exports.ZodCustom = exports.ZodFunction = exports.ZodPromise = exports.ZodLazy = exports.ZodTemplateLiteral = exports.ZodReadonly = exports.ZodCodec = exports.ZodPipe = exports.ZodNaN = exports.ZodCatch = exports.ZodSuccess = exports.ZodNonOptional = exports.ZodPrefault = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = void 0;
26
+ exports.ZodFile = exports.ZodLiteral = exports.ZodEnum = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodDate = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodBigIntFormat = exports.ZodBigInt = exports.ZodBoolean = exports.ZodNumberFormat = exports.ZodNumber = exports.ZodCustomStringFormat = exports.ZodJWT = exports.ZodE164 = exports.ZodBase64URL = exports.ZodBase64 = exports.ZodCIDRv6 = exports.ZodCIDRv4 = exports.ZodIPv6 = exports.ZodMAC = exports.ZodIPv4 = exports.ZodKSUID = exports.ZodXID = exports.ZodULID = exports.ZodCUID2 = exports.ZodCUID = exports.ZodNanoID = exports.ZodEmoji = exports.ZodURL = exports.ZodUUID = exports.ZodGUID = exports.ZodEmail = exports.ZodStringFormat = exports.ZodString = exports._ZodString = exports.ZodType = void 0;
27
+ exports.stringbool = exports.ZodCustom = exports.ZodFunction = exports.ZodPromise = exports.ZodLazy = exports.ZodTemplateLiteral = exports.ZodReadonly = exports.ZodCodec = exports.ZodPipe = exports.ZodNaN = exports.ZodCatch = exports.ZodSuccess = exports.ZodNonOptional = exports.ZodPrefault = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransform = void 0;
28
28
  exports.string = string;
29
29
  exports.email = email;
30
30
  exports.guid = guid;
@@ -42,6 +42,7 @@ exports.ulid = ulid;
42
42
  exports.xid = xid;
43
43
  exports.ksuid = ksuid;
44
44
  exports.ipv4 = ipv4;
45
+ exports.mac = mac;
45
46
  exports.ipv6 = ipv6;
46
47
  exports.cidrv4 = cidrv4;
47
48
  exports.cidrv6 = cidrv6;
@@ -377,6 +378,14 @@ exports.ZodIPv4 = core.$constructor("ZodIPv4", (inst, def) => {
377
378
  function ipv4(params) {
378
379
  return core._ipv4(exports.ZodIPv4, params);
379
380
  }
381
+ exports.ZodMAC = core.$constructor("ZodMAC", (inst, def) => {
382
+ // ZodStringFormat.init(inst, def);
383
+ core.$ZodMAC.init(inst, def);
384
+ exports.ZodStringFormat.init(inst, def);
385
+ });
386
+ function mac(params) {
387
+ return core._mac(exports.ZodMAC, params);
388
+ }
380
389
  exports.ZodIPv6 = core.$constructor("ZodIPv6", (inst, def) => {
381
390
  // ZodStringFormat.init(inst, def);
382
391
  core.$ZodIPv6.init(inst, def);
@@ -223,6 +223,11 @@ export interface ZodIPv4 extends ZodStringFormat<"ipv4"> {
223
223
  }
224
224
  export declare const ZodIPv4: core.$constructor<ZodIPv4>;
225
225
  export declare function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4;
226
+ export interface ZodMAC extends ZodStringFormat<"mac"> {
227
+ _zod: core.$ZodMACInternals;
228
+ }
229
+ export declare const ZodMAC: core.$constructor<ZodMAC>;
230
+ export declare function mac(params?: string | core.$ZodMACParams): ZodMAC;
226
231
  export interface ZodIPv6 extends ZodStringFormat<"ipv6"> {
227
232
  _zod: core.$ZodIPv6Internals;
228
233
  }
@@ -223,6 +223,11 @@ export interface ZodIPv4 extends ZodStringFormat<"ipv4"> {
223
223
  }
224
224
  export declare const ZodIPv4: core.$constructor<ZodIPv4>;
225
225
  export declare function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4;
226
+ export interface ZodMAC extends ZodStringFormat<"mac"> {
227
+ _zod: core.$ZodMACInternals;
228
+ }
229
+ export declare const ZodMAC: core.$constructor<ZodMAC>;
230
+ export declare function mac(params?: string | core.$ZodMACParams): ZodMAC;
226
231
  export interface ZodIPv6 extends ZodStringFormat<"ipv6"> {
227
232
  _zod: core.$ZodIPv6Internals;
228
233
  }
@@ -260,6 +260,14 @@ export const ZodIPv4 = /*@__PURE__*/ core.$constructor("ZodIPv4", (inst, def) =>
260
260
  export function ipv4(params) {
261
261
  return core._ipv4(ZodIPv4, params);
262
262
  }
263
+ export const ZodMAC = /*@__PURE__*/ core.$constructor("ZodMAC", (inst, def) => {
264
+ // ZodStringFormat.init(inst, def);
265
+ core.$ZodMAC.init(inst, def);
266
+ ZodStringFormat.init(inst, def);
267
+ });
268
+ export function mac(params) {
269
+ return core._mac(ZodMAC, params);
270
+ }
263
271
  export const ZodIPv6 = /*@__PURE__*/ core.$constructor("ZodIPv6", (inst, def) => {
264
272
  // ZodStringFormat.init(inst, def);
265
273
  core.$ZodIPv6.init(inst, def);
package/v4/core/api.cjs CHANGED
@@ -42,6 +42,7 @@ exports._xid = _xid;
42
42
  exports._ksuid = _ksuid;
43
43
  exports._ipv4 = _ipv4;
44
44
  exports._ipv6 = _ipv6;
45
+ exports._mac = _mac;
45
46
  exports._cidrv4 = _cidrv4;
46
47
  exports._cidrv6 = _cidrv6;
47
48
  exports._base64 = _base64;
@@ -302,6 +303,15 @@ function _ipv6(Class, params) {
302
303
  ...util.normalizeParams(params),
303
304
  });
304
305
  }
306
+ function _mac(Class, params) {
307
+ return new Class({
308
+ type: "string",
309
+ format: "mac",
310
+ check: "string_format",
311
+ abort: false,
312
+ ...util.normalizeParams(params),
313
+ });
314
+ }
305
315
  function _cidrv4(Class, params) {
306
316
  return new Class({
307
317
  type: "string",
package/v4/core/api.d.cts CHANGED
@@ -69,6 +69,9 @@ export declare function _ipv4<T extends schemas.$ZodIPv4>(Class: util.SchemaClas
69
69
  export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
70
70
  export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
71
71
  export declare function _ipv6<T extends schemas.$ZodIPv6>(Class: util.SchemaClass<T>, params?: string | $ZodIPv6Params | $ZodCheckIPv6Params): T;
72
+ export type $ZodMACParams = StringFormatParams<schemas.$ZodMAC, "pattern" | "when">;
73
+ export type $ZodCheckMACParams = CheckStringFormatParams<schemas.$ZodMAC, "pattern" | "when">;
74
+ export declare function _mac<T extends schemas.$ZodMAC>(Class: util.SchemaClass<T>, params?: string | $ZodMACParams | $ZodCheckMACParams): T;
72
75
  export type $ZodCIDRv4Params = StringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
73
76
  export type $ZodCheckCIDRv4Params = CheckStringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
74
77
  export declare function _cidrv4<T extends schemas.$ZodCIDRv4>(Class: util.SchemaClass<T>, params?: string | $ZodCIDRv4Params | $ZodCheckCIDRv4Params): T;
package/v4/core/api.d.ts CHANGED
@@ -69,6 +69,9 @@ export declare function _ipv4<T extends schemas.$ZodIPv4>(Class: util.SchemaClas
69
69
  export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
70
70
  export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
71
71
  export declare function _ipv6<T extends schemas.$ZodIPv6>(Class: util.SchemaClass<T>, params?: string | $ZodIPv6Params | $ZodCheckIPv6Params): T;
72
+ export type $ZodMACParams = StringFormatParams<schemas.$ZodMAC, "pattern" | "when">;
73
+ export type $ZodCheckMACParams = CheckStringFormatParams<schemas.$ZodMAC, "pattern" | "when">;
74
+ export declare function _mac<T extends schemas.$ZodMAC>(Class: util.SchemaClass<T>, params?: string | $ZodMACParams | $ZodCheckMACParams): T;
72
75
  export type $ZodCIDRv4Params = StringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
73
76
  export type $ZodCheckCIDRv4Params = CheckStringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
74
77
  export declare function _cidrv4<T extends schemas.$ZodCIDRv4>(Class: util.SchemaClass<T>, params?: string | $ZodCIDRv4Params | $ZodCheckCIDRv4Params): T;
package/v4/core/api.js CHANGED
@@ -161,6 +161,15 @@ export function _ipv6(Class, params) {
161
161
  ...util.normalizeParams(params),
162
162
  });
163
163
  }
164
+ export function _mac(Class, params) {
165
+ return new Class({
166
+ type: "string",
167
+ format: "mac",
168
+ check: "string_format",
169
+ abort: false,
170
+ ...util.normalizeParams(params),
171
+ });
172
+ }
164
173
  export function _cidrv4(Class, params) {
165
174
  return new Class({
166
175
  type: "string",
@@ -1,10 +1,34 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sha384_base64 = exports.sha384_hex = exports.sha256_base64url = exports.sha256_base64 = exports.sha256_hex = exports.sha1_base64url = exports.sha1_base64 = exports.sha1_hex = exports.md5_base64url = exports.md5_base64 = exports.md5_hex = exports.hex = exports.uppercase = exports.lowercase = exports.undefined = exports.null = exports.boolean = exports.number = exports.integer = exports.bigint = exports.string = exports.date = exports.e164 = exports.domain = exports.hostname = exports.base64url = exports.base64 = exports.cidrv6 = exports.cidrv4 = exports.ipv6 = exports.ipv4 = exports.browserEmail = exports.idnEmail = exports.unicodeEmail = exports.rfc5322Email = exports.html5Email = exports.email = exports.uuid7 = exports.uuid6 = exports.uuid4 = exports.uuid = exports.guid = exports.extendedDuration = exports.duration = exports.nanoid = exports.ksuid = exports.xid = exports.ulid = exports.cuid2 = exports.cuid = void 0;
4
- exports.sha512_base64url = exports.sha512_base64 = exports.sha512_hex = exports.sha384_base64url = void 0;
26
+ exports.sha384_hex = exports.sha256_base64url = exports.sha256_base64 = exports.sha256_hex = exports.sha1_base64url = exports.sha1_base64 = exports.sha1_hex = exports.md5_base64url = exports.md5_base64 = exports.md5_hex = exports.hex = exports.uppercase = exports.lowercase = exports.undefined = exports.null = exports.boolean = exports.number = exports.integer = exports.bigint = exports.string = exports.date = exports.e164 = exports.domain = exports.hostname = exports.base64url = exports.base64 = exports.cidrv6 = exports.cidrv4 = exports.mac = exports.ipv6 = exports.ipv4 = exports.browserEmail = exports.idnEmail = exports.unicodeEmail = exports.rfc5322Email = exports.html5Email = exports.email = exports.uuid7 = exports.uuid6 = exports.uuid4 = exports.uuid = exports.guid = exports.extendedDuration = exports.duration = exports.nanoid = exports.ksuid = exports.xid = exports.ulid = exports.cuid2 = exports.cuid = void 0;
27
+ exports.sha512_base64url = exports.sha512_base64 = exports.sha512_hex = exports.sha384_base64url = exports.sha384_base64 = void 0;
5
28
  exports.emoji = emoji;
6
29
  exports.time = time;
7
30
  exports.datetime = datetime;
31
+ const util = __importStar(require("./util.cjs"));
8
32
  exports.cuid = /^[cC][^\s-]{8,}$/;
9
33
  exports.cuid2 = /^[0-9a-z]+$/;
10
34
  exports.ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -46,6 +70,11 @@ function emoji() {
46
70
  }
47
71
  exports.ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
48
72
  exports.ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
73
+ const mac = (delimiter) => {
74
+ const escapedDelim = util.escapeRegex(delimiter ?? ":");
75
+ return new RegExp(`^(([0-9A-F]{2}(${escapedDelim})[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(${escapedDelim})[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$`);
76
+ };
77
+ exports.mac = mac;
49
78
  exports.cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
50
79
  exports.cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
51
80
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
@@ -30,6 +30,7 @@ export declare const browserEmail: RegExp;
30
30
  export declare function emoji(): RegExp;
31
31
  export declare const ipv4: RegExp;
32
32
  export declare const ipv6: RegExp;
33
+ export declare const mac: (delimiter?: string) => RegExp;
33
34
  export declare const cidrv4: RegExp;
34
35
  export declare const cidrv6: RegExp;
35
36
  export declare const base64: RegExp;
@@ -30,6 +30,7 @@ export declare const browserEmail: RegExp;
30
30
  export declare function emoji(): RegExp;
31
31
  export declare const ipv4: RegExp;
32
32
  export declare const ipv6: RegExp;
33
+ export declare const mac: (delimiter?: string) => RegExp;
33
34
  export declare const cidrv4: RegExp;
34
35
  export declare const cidrv6: RegExp;
35
36
  export declare const base64: RegExp;
@@ -1,3 +1,4 @@
1
+ import * as util from "./util.js";
1
2
  export const cuid = /^[cC][^\s-]{8,}$/;
2
3
  export const cuid2 = /^[0-9a-z]+$/;
3
4
  export const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -38,6 +39,10 @@ export function emoji() {
38
39
  }
39
40
  export const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
40
41
  export const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
42
+ export const mac = (delimiter) => {
43
+ const escapedDelim = util.escapeRegex(delimiter ?? ":");
44
+ return new RegExp(`^(([0-9A-F]{2}(${escapedDelim})[0-9A-F]{2}(\\3[0-9A-F]{2}){4})|([0-9a-f]{2}(${escapedDelim})[0-9a-f]{2}(\\6[0-9a-f]{2}){4}))$`);
45
+ };
41
46
  export const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
42
47
  export const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
43
48
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.globalRegistry = exports.$ZodRegistry = exports.$input = exports.$output = void 0;
4
5
  exports.registry = registry;
@@ -54,4 +55,5 @@ exports.$ZodRegistry = $ZodRegistry;
54
55
  function registry() {
55
56
  return new $ZodRegistry();
56
57
  }
57
- exports.globalRegistry = registry();
58
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
59
+ exports.globalRegistry = globalThis.__zod_globalRegistry;
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  export const $output = Symbol("ZodOutput");
2
3
  export const $input = Symbol("ZodInput");
3
4
  export class $ZodRegistry {
@@ -49,4 +50,5 @@ export class $ZodRegistry {
49
50
  export function registry() {
50
51
  return new $ZodRegistry();
51
52
  }
52
- export const globalRegistry = /*@__PURE__*/ registry();
53
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
54
+ export const globalRegistry = globalThis.__zod_globalRegistry;
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodUnion = exports.$ZodObjectJIT = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
- exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = void 0;
26
+ exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodUnion = exports.$ZodObjectJIT = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodMAC = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
+ exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = void 0;
28
28
  exports.isValidBase64 = isValidBase64;
29
29
  exports.isValidBase64URL = isValidBase64URL;
30
30
  exports.isValidJWT = isValidJWT;
@@ -350,6 +350,11 @@ exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
350
350
  }
351
351
  };
352
352
  });
353
+ exports.$ZodMAC = core.$constructor("$ZodMAC", (inst, def) => {
354
+ def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
355
+ exports.$ZodStringFormat.init(inst, def);
356
+ inst._zod.bag.format = `mac`;
357
+ });
353
358
  exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
354
359
  def.pattern ?? (def.pattern = regexes.cidrv4);
355
360
  exports.$ZodStringFormat.init(inst, def);
@@ -276,6 +276,16 @@ export interface $ZodIPv6 extends $ZodType {
276
276
  _zod: $ZodIPv6Internals;
277
277
  }
278
278
  export declare const $ZodIPv6: core.$constructor<$ZodIPv6>;
279
+ export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> {
280
+ delimiter?: string;
281
+ }
282
+ export interface $ZodMACInternals extends $ZodStringFormatInternals<"mac"> {
283
+ def: $ZodMACDef;
284
+ }
285
+ export interface $ZodMAC extends $ZodType {
286
+ _zod: $ZodMACInternals;
287
+ }
288
+ export declare const $ZodMAC: core.$constructor<$ZodMAC>;
279
289
  export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
280
290
  version?: "v4";
281
291
  }
@@ -1110,4 +1120,4 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1110
1120
  }
1111
1121
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1112
1122
  export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1113
- export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
1123
+ export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
@@ -276,6 +276,16 @@ export interface $ZodIPv6 extends $ZodType {
276
276
  _zod: $ZodIPv6Internals;
277
277
  }
278
278
  export declare const $ZodIPv6: core.$constructor<$ZodIPv6>;
279
+ export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> {
280
+ delimiter?: string;
281
+ }
282
+ export interface $ZodMACInternals extends $ZodStringFormatInternals<"mac"> {
283
+ def: $ZodMACDef;
284
+ }
285
+ export interface $ZodMAC extends $ZodType {
286
+ _zod: $ZodMACInternals;
287
+ }
288
+ export declare const $ZodMAC: core.$constructor<$ZodMAC>;
279
289
  export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
280
290
  version?: "v4";
281
291
  }
@@ -1110,4 +1120,4 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1110
1120
  }
1111
1121
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1112
1122
  export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1113
- export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
1123
+ export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
@@ -319,6 +319,11 @@ export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def)
319
319
  }
320
320
  };
321
321
  });
322
+ export const $ZodMAC = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def) => {
323
+ def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
324
+ $ZodStringFormat.init(inst, def);
325
+ inst._zod.bag.format = `mac`;
326
+ });
322
327
  export const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor("$ZodCIDRv4", (inst, def) => {
323
328
  def.pattern ?? (def.pattern = regexes.cidrv4);
324
329
  $ZodStringFormat.init(inst, def);
package/v4/locales/en.cjs CHANGED
@@ -78,6 +78,7 @@ const error = () => {
78
78
  duration: "ISO duration",
79
79
  ipv4: "IPv4 address",
80
80
  ipv6: "IPv6 address",
81
+ mac: "MAC address",
81
82
  cidrv4: "IPv4 range",
82
83
  cidrv6: "IPv6 range",
83
84
  base64: "base64-encoded string",
package/v4/locales/en.js CHANGED
@@ -50,6 +50,7 @@ const error = () => {
50
50
  duration: "ISO duration",
51
51
  ipv4: "IPv4 address",
52
52
  ipv6: "IPv6 address",
53
+ mac: "MAC address",
53
54
  cidrv4: "IPv4 range",
54
55
  cidrv6: "IPv6 range",
55
56
  base64: "base64-encoded string",
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ZodMiniOptional = exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = exports.ZodMiniUnion = exports.ZodMiniObject = exports.ZodMiniArray = exports.ZodMiniDate = exports.ZodMiniVoid = exports.ZodMiniNever = exports.ZodMiniUnknown = exports.ZodMiniAny = exports.ZodMiniNull = exports.ZodMiniUndefined = exports.ZodMiniSymbol = exports.ZodMiniBigIntFormat = exports.ZodMiniBigInt = exports.ZodMiniBoolean = exports.ZodMiniNumberFormat = exports.ZodMiniNumber = exports.ZodMiniCustomStringFormat = exports.ZodMiniJWT = exports.ZodMiniE164 = exports.ZodMiniBase64URL = exports.ZodMiniBase64 = exports.ZodMiniCIDRv6 = exports.ZodMiniCIDRv4 = exports.ZodMiniIPv6 = exports.ZodMiniIPv4 = exports.ZodMiniKSUID = exports.ZodMiniXID = exports.ZodMiniULID = exports.ZodMiniCUID2 = exports.ZodMiniCUID = exports.ZodMiniNanoID = exports.ZodMiniEmoji = exports.ZodMiniURL = exports.ZodMiniUUID = exports.ZodMiniGUID = exports.ZodMiniEmail = exports.ZodMiniStringFormat = exports.ZodMiniString = exports.ZodMiniType = void 0;
27
- exports.ZodMiniFunction = exports.stringbool = exports.ZodMiniCustom = exports.ZodMiniPromise = exports.ZodMiniLazy = exports.ZodMiniTemplateLiteral = exports.ZodMiniReadonly = exports.ZodMiniCodec = exports.ZodMiniPipe = exports.ZodMiniNaN = exports.ZodMiniCatch = exports.ZodMiniSuccess = exports.ZodMiniNonOptional = exports.ZodMiniPrefault = exports.ZodMiniDefault = exports.ZodMiniNullable = void 0;
26
+ exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = exports.ZodMiniUnion = exports.ZodMiniObject = exports.ZodMiniArray = exports.ZodMiniDate = exports.ZodMiniVoid = exports.ZodMiniNever = exports.ZodMiniUnknown = exports.ZodMiniAny = exports.ZodMiniNull = exports.ZodMiniUndefined = exports.ZodMiniSymbol = exports.ZodMiniBigIntFormat = exports.ZodMiniBigInt = exports.ZodMiniBoolean = exports.ZodMiniNumberFormat = exports.ZodMiniNumber = exports.ZodMiniCustomStringFormat = exports.ZodMiniJWT = exports.ZodMiniE164 = exports.ZodMiniBase64URL = exports.ZodMiniBase64 = exports.ZodMiniMAC = exports.ZodMiniCIDRv6 = exports.ZodMiniCIDRv4 = exports.ZodMiniIPv6 = exports.ZodMiniIPv4 = exports.ZodMiniKSUID = exports.ZodMiniXID = exports.ZodMiniULID = exports.ZodMiniCUID2 = exports.ZodMiniCUID = exports.ZodMiniNanoID = exports.ZodMiniEmoji = exports.ZodMiniURL = exports.ZodMiniUUID = exports.ZodMiniGUID = exports.ZodMiniEmail = exports.ZodMiniStringFormat = exports.ZodMiniString = exports.ZodMiniType = void 0;
27
+ exports.ZodMiniFunction = exports.stringbool = exports.ZodMiniCustom = exports.ZodMiniPromise = exports.ZodMiniLazy = exports.ZodMiniTemplateLiteral = exports.ZodMiniReadonly = exports.ZodMiniCodec = exports.ZodMiniPipe = exports.ZodMiniNaN = exports.ZodMiniCatch = exports.ZodMiniSuccess = exports.ZodMiniNonOptional = exports.ZodMiniPrefault = exports.ZodMiniDefault = exports.ZodMiniNullable = exports.ZodMiniOptional = void 0;
28
28
  exports.string = string;
29
29
  exports.email = email;
30
30
  exports.guid = guid;
@@ -45,6 +45,7 @@ exports.ipv4 = ipv4;
45
45
  exports.ipv6 = ipv6;
46
46
  exports.cidrv4 = cidrv4;
47
47
  exports.cidrv6 = cidrv6;
48
+ exports.mac = mac;
48
49
  exports.base64 = base64;
49
50
  exports.base64url = base64url;
50
51
  exports.e164 = e164;
@@ -287,6 +288,13 @@ exports.ZodMiniCIDRv6 = core.$constructor("ZodMiniCIDRv6", (inst, def) => {
287
288
  function cidrv6(params) {
288
289
  return core._cidrv6(exports.ZodMiniCIDRv6, params);
289
290
  }
291
+ exports.ZodMiniMAC = core.$constructor("ZodMiniMAC", (inst, def) => {
292
+ core.$ZodMAC.init(inst, def);
293
+ exports.ZodMiniStringFormat.init(inst, def);
294
+ });
295
+ function mac(params) {
296
+ return core._mac(exports.ZodMiniMAC, params);
297
+ }
290
298
  exports.ZodMiniBase64 = core.$constructor("ZodMiniBase64", (inst, def) => {
291
299
  core.$ZodBase64.init(inst, def);
292
300
  exports.ZodMiniStringFormat.init(inst, def);
@@ -92,6 +92,10 @@ export interface ZodMiniCIDRv6 extends _ZodMiniString<core.$ZodCIDRv6Internals>
92
92
  }
93
93
  export declare const ZodMiniCIDRv6: core.$constructor<ZodMiniCIDRv6>;
94
94
  export declare function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6;
95
+ export interface ZodMiniMAC extends _ZodMiniString<core.$ZodMACInternals> {
96
+ }
97
+ export declare const ZodMiniMAC: core.$constructor<ZodMiniMAC>;
98
+ export declare function mac(params?: string | core.$ZodMACParams): ZodMiniMAC;
95
99
  export interface ZodMiniBase64 extends _ZodMiniString<core.$ZodBase64Internals> {
96
100
  }
97
101
  export declare const ZodMiniBase64: core.$constructor<ZodMiniBase64>;
@@ -92,6 +92,10 @@ export interface ZodMiniCIDRv6 extends _ZodMiniString<core.$ZodCIDRv6Internals>
92
92
  }
93
93
  export declare const ZodMiniCIDRv6: core.$constructor<ZodMiniCIDRv6>;
94
94
  export declare function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6;
95
+ export interface ZodMiniMAC extends _ZodMiniString<core.$ZodMACInternals> {
96
+ }
97
+ export declare const ZodMiniMAC: core.$constructor<ZodMiniMAC>;
98
+ export declare function mac(params?: string | core.$ZodMACParams): ZodMiniMAC;
95
99
  export interface ZodMiniBase64 extends _ZodMiniString<core.$ZodBase64Internals> {
96
100
  }
97
101
  export declare const ZodMiniBase64: core.$constructor<ZodMiniBase64>;
@@ -163,6 +163,13 @@ export const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv6", (i
163
163
  export function cidrv6(params) {
164
164
  return core._cidrv6(ZodMiniCIDRv6, params);
165
165
  }
166
+ export const ZodMiniMAC = /*@__PURE__*/ core.$constructor("ZodMiniMAC", (inst, def) => {
167
+ core.$ZodMAC.init(inst, def);
168
+ ZodMiniStringFormat.init(inst, def);
169
+ });
170
+ export function mac(params) {
171
+ return core._mac(ZodMiniMAC, params);
172
+ }
166
173
  export const ZodMiniBase64 = /*@__PURE__*/ core.$constructor("ZodMiniBase64", (inst, def) => {
167
174
  core.$ZodBase64.init(inst, def);
168
175
  ZodMiniStringFormat.init(inst, def);