@infra-blocks/zod-utils 0.12.0 → 0.13.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.
@@ -11,9 +11,17 @@ declare function csv(): z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>
11
11
  *
12
12
  * @returns A string to int codec.
13
13
  *
14
- * @see https://zod.dev/codecs?id=stringtoint
14
+ * @see https://zod.dev/codecs#stringtoint
15
15
  */
16
16
  declare function stringtoInt(): z.ZodCodec<z.ZodString, z.ZodInt>;
17
+ /**
18
+ * A string to URL codec, as defined in Zod's documentation.
19
+ *
20
+ * @returns A string to URL codec.
21
+ *
22
+ * @see https://zod.dev/codecs#stringtourl
23
+ */
24
+ declare function stringToUrl(): z.ZodCodec<z.ZodURL, z.ZodCustom<import("url").URL, import("url").URL>>;
17
25
  /**
18
26
  * Returns a type guard function using the provided schema as the source of truth.
19
27
  *
@@ -81,6 +89,7 @@ declare const zu: {
81
89
  };
82
90
  csv: typeof csv;
83
91
  stringtoInt: typeof stringtoInt;
92
+ stringToUrl: typeof stringToUrl;
84
93
  typeGuard: typeof typeGuard;
85
94
  isValid: typeof isValid;
86
95
  };
package/lib/cjs/index.js CHANGED
@@ -25,11 +25,25 @@ const stringToIntCodec = zod_1.z.codec(zod_1.z.string().regex(zod_1.z.regexes.in
25
25
  *
26
26
  * @returns A string to int codec.
27
27
  *
28
- * @see https://zod.dev/codecs?id=stringtoint
28
+ * @see https://zod.dev/codecs#stringtoint
29
29
  */
30
30
  function stringtoInt() {
31
31
  return stringToIntCodec;
32
32
  }
33
+ const stringToURLCodec = zod_1.z.codec(zod_1.z.url(), zod_1.z.instanceof(URL), {
34
+ decode: (urlString) => new URL(urlString),
35
+ encode: (url) => url.href,
36
+ });
37
+ /**
38
+ * A string to URL codec, as defined in Zod's documentation.
39
+ *
40
+ * @returns A string to URL codec.
41
+ *
42
+ * @see https://zod.dev/codecs#stringtourl
43
+ */
44
+ function stringToUrl() {
45
+ return stringToURLCodec;
46
+ }
33
47
  /**
34
48
  * Returns a type guard function using the provided schema as the source of truth.
35
49
  *
@@ -72,6 +86,7 @@ const zu = {
72
86
  json: index_js_4.json,
73
87
  csv,
74
88
  stringtoInt,
89
+ stringToUrl,
75
90
  typeGuard,
76
91
  isValid,
77
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,6BAAwB;AACxB,6CAAqC;AACrC,iDAA6C;AAC7C,6CAAqC;AACrC,8CAAuC;AAEvC,MAAM,SAAS,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAS,GAAG;IACV,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,gBAAgB,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAC,CAAC,GAAG,EAAE,EAAE;IAC7E,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,WAAW;IAClB,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,SAAS,CAAsB,MAAS;IAC/C,OAAO,CAAC,KAAc,EAAuB,EAAE;QAC7C,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAED;;;;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CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;IAC3D,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI;CAC1B,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,WAAW;IAClB,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,SAAS,CAAsB,MAAS;IAC/C,OAAO,CAAC,KAAc,EAAuB,EAAE;QAC7C,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,OAAO,CACd,MAAS,EACT,KAAc;IAEd,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACzC,CAAC;AAED,MAAM,EAAE,GAAG;IACT,GAAG,EAAH,cAAG;IACH,OAAO,EAAP,kBAAO;IACP,GAAG,EAAH,cAAG;IACH,IAAI,EAAJ,eAAI;IACJ,GAAG;IACH,WAAW;IACX,WAAW;IACX,SAAS;IACT,OAAO;CACR,CAAC;AAEO,gBAAE"}
@@ -3,19 +3,19 @@ declare const alpha3CodeSchema: z.core.$ZodBranded<z.ZodEnum<{
3
3
  [x: string]: string;
4
4
  }>, "IsoAlpha3CountryCode">;
5
5
  export type IsoAlpha3CountryCode = z.infer<typeof alpha3CodeSchema>;
6
- /**
7
- * Returns a zod schema that validates that the input is a string that matches
8
- * an ISO 3166 alpha 3 country code.
9
- *
10
- * The currency code is case-sensitive and all current currency codes are
11
- * all uppercase.
12
- *
13
- * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
14
- * branded type as output.
15
- *
16
- * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
17
- */
18
6
  export declare const countryCode: {
7
+ /**
8
+ * Returns a zod schema that validates that the input is a string that matches
9
+ * an ISO 3166 alpha 3 country code.
10
+ *
11
+ * The currency code is case-sensitive and all current currency codes are
12
+ * all uppercase.
13
+ *
14
+ * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
15
+ * branded type as output.
16
+ *
17
+ * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
18
+ */
19
19
  alpha3: () => z.core.$ZodBranded<z.ZodEnum<{
20
20
  [x: string]: string;
21
21
  }>, "IsoAlpha3CountryCode">;
@@ -5,19 +5,19 @@ const iso_3166_1 = require("iso-3166");
5
5
  const zod_1 = require("zod");
6
6
  const ALPHA_3_CODES = iso_3166_1.iso31661.map((entry) => entry.alpha3);
7
7
  const alpha3CodeSchema = zod_1.z.enum(ALPHA_3_CODES).brand("IsoAlpha3CountryCode");
8
- /**
9
- * Returns a zod schema that validates that the input is a string that matches
10
- * an ISO 3166 alpha 3 country code.
11
- *
12
- * The currency code is case-sensitive and all current currency codes are
13
- * all uppercase.
14
- *
15
- * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
16
- * branded type as output.
17
- *
18
- * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
19
- */
20
8
  exports.countryCode = {
9
+ /**
10
+ * Returns a zod schema that validates that the input is a string that matches
11
+ * an ISO 3166 alpha 3 country code.
12
+ *
13
+ * The currency code is case-sensitive and all current currency codes are
14
+ * all uppercase.
15
+ *
16
+ * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
17
+ * branded type as output.
18
+ *
19
+ * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
20
+ */
21
21
  alpha3: () => alpha3CodeSchema,
22
22
  };
23
23
  //# sourceMappingURL=country-code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AACpC,6BAAwB;AAExB,MAAM,aAAa,GAAG,mBAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,OAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAI7E;;;;;;;;;;;GAWG;AACU,QAAA,WAAW,GAAG;IACzB,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAgB;CAC/B,CAAC"}
1
+ {"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AACpC,6BAAwB;AAExB,MAAM,aAAa,GAAG,mBAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,OAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAIhE,QAAA,WAAW,GAAG;IACzB;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAgB;CAC/B,CAAC"}
@@ -11,9 +11,17 @@ declare function csv(): z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>
11
11
  *
12
12
  * @returns A string to int codec.
13
13
  *
14
- * @see https://zod.dev/codecs?id=stringtoint
14
+ * @see https://zod.dev/codecs#stringtoint
15
15
  */
16
16
  declare function stringtoInt(): z.ZodCodec<z.ZodString, z.ZodInt>;
17
+ /**
18
+ * A string to URL codec, as defined in Zod's documentation.
19
+ *
20
+ * @returns A string to URL codec.
21
+ *
22
+ * @see https://zod.dev/codecs#stringtourl
23
+ */
24
+ declare function stringToUrl(): z.ZodCodec<z.ZodURL, z.ZodCustom<import("url").URL, import("url").URL>>;
17
25
  /**
18
26
  * Returns a type guard function using the provided schema as the source of truth.
19
27
  *
@@ -81,6 +89,7 @@ declare const zu: {
81
89
  };
82
90
  csv: typeof csv;
83
91
  stringtoInt: typeof stringtoInt;
92
+ stringToUrl: typeof stringToUrl;
84
93
  typeGuard: typeof typeGuard;
85
94
  isValid: typeof isValid;
86
95
  };
package/lib/esm/index.js CHANGED
@@ -22,11 +22,25 @@ const stringToIntCodec = z.codec(z.string().regex(z.regexes.integer), z.int(), {
22
22
  *
23
23
  * @returns A string to int codec.
24
24
  *
25
- * @see https://zod.dev/codecs?id=stringtoint
25
+ * @see https://zod.dev/codecs#stringtoint
26
26
  */
27
27
  function stringtoInt() {
28
28
  return stringToIntCodec;
29
29
  }
30
+ const stringToURLCodec = z.codec(z.url(), z.instanceof(URL), {
31
+ decode: (urlString) => new URL(urlString),
32
+ encode: (url) => url.href,
33
+ });
34
+ /**
35
+ * A string to URL codec, as defined in Zod's documentation.
36
+ *
37
+ * @returns A string to URL codec.
38
+ *
39
+ * @see https://zod.dev/codecs#stringtourl
40
+ */
41
+ function stringToUrl() {
42
+ return stringToURLCodec;
43
+ }
30
44
  /**
31
45
  * Returns a type guard function using the provided schema as the source of truth.
32
46
  *
@@ -69,6 +83,7 @@ const zu = {
69
83
  json,
70
84
  csv,
71
85
  stringtoInt,
86
+ stringToUrl,
72
87
  typeGuard,
73
88
  isValid,
74
89
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,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AAsB,MAAS;IAC/C,OAAO,CAAC,KAAc,EAAuB,EAAE;QAC7C,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,OAAO,CACd,MAAS,EACT,KAAc;IAEd,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACzC,CAAC;AAED,MAAM,EAAE,GAAG;IACT,GAAG;IACH,OAAO;IACP,GAAG;IACH,IAAI;IACJ,GAAG;IACH,WAAW;IACX,WAAW;IACX,SAAS;IACT,OAAO;CACR,CAAC;AAEF,OAAO,EAAE,EAAE,EAAE,CAAC"}
@@ -3,19 +3,19 @@ declare const alpha3CodeSchema: z.core.$ZodBranded<z.ZodEnum<{
3
3
  [x: string]: string;
4
4
  }>, "IsoAlpha3CountryCode">;
5
5
  export type IsoAlpha3CountryCode = z.infer<typeof alpha3CodeSchema>;
6
- /**
7
- * Returns a zod schema that validates that the input is a string that matches
8
- * an ISO 3166 alpha 3 country code.
9
- *
10
- * The currency code is case-sensitive and all current currency codes are
11
- * all uppercase.
12
- *
13
- * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
14
- * branded type as output.
15
- *
16
- * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
17
- */
18
6
  export declare const countryCode: {
7
+ /**
8
+ * Returns a zod schema that validates that the input is a string that matches
9
+ * an ISO 3166 alpha 3 country code.
10
+ *
11
+ * The currency code is case-sensitive and all current currency codes are
12
+ * all uppercase.
13
+ *
14
+ * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
15
+ * branded type as output.
16
+ *
17
+ * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
18
+ */
19
19
  alpha3: () => z.core.$ZodBranded<z.ZodEnum<{
20
20
  [x: string]: string;
21
21
  }>, "IsoAlpha3CountryCode">;
@@ -2,19 +2,19 @@ import { iso31661 } from "iso-3166";
2
2
  import { z } from "zod";
3
3
  const ALPHA_3_CODES = iso31661.map((entry) => entry.alpha3);
4
4
  const alpha3CodeSchema = z.enum(ALPHA_3_CODES).brand("IsoAlpha3CountryCode");
5
- /**
6
- * Returns a zod schema that validates that the input is a string that matches
7
- * an ISO 3166 alpha 3 country code.
8
- *
9
- * The currency code is case-sensitive and all current currency codes are
10
- * all uppercase.
11
- *
12
- * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
13
- * branded type as output.
14
- *
15
- * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
16
- */
17
5
  export const countryCode = {
6
+ /**
7
+ * Returns a zod schema that validates that the input is a string that matches
8
+ * an ISO 3166 alpha 3 country code.
9
+ *
10
+ * The currency code is case-sensitive and all current currency codes are
11
+ * all uppercase.
12
+ *
13
+ * @returns A zod schema that validates ISO alpha 3 code strings and return the {@link IsoAlpha3CountryCode}
14
+ * branded type as output.
15
+ *
16
+ * @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
17
+ */
18
18
  alpha3: () => alpha3CodeSchema,
19
19
  };
20
20
  //# sourceMappingURL=country-code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAI7E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAgB;CAC/B,CAAC"}
1
+ {"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../../src/iso/country-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAI7E,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAgB;CAC/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infra-blocks/zod-utils",
3
- "version": "0.12.0",
3
+ "version": "0.13.0-alpha.1",
4
4
  "description": "Extensions to the zod package.",
5
5
  "keywords": [
6
6
  "zod",