@infra-blocks/zod-utils 0.23.0 → 0.23.1-alpha.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/lib/cjs/codec/json-parse.js +2 -2
- package/lib/cjs/codec/json-parse.js.map +1 -1
- package/lib/cjs/codec/string-to-integer.js +2 -2
- package/lib/cjs/codec/string-to-integer.js.map +1 -1
- package/lib/cjs/codec/string-to-url.js +2 -2
- package/lib/cjs/codec/string-to-url.js.map +1 -1
- package/lib/cjs/lib.d.ts +0 -1
- package/lib/cjs/lib.js +0 -5
- package/lib/cjs/lib.js.map +1 -1
- package/lib/esm/codec/json-parse.js +1 -1
- package/lib/esm/codec/json-parse.js.map +1 -1
- package/lib/esm/codec/string-to-integer.js +1 -1
- package/lib/esm/codec/string-to-integer.js.map +1 -1
- package/lib/esm/codec/string-to-url.js +1 -1
- package/lib/esm/codec/string-to-url.js.map +1 -1
- package/lib/esm/lib.d.ts +0 -1
- package/lib/esm/lib.js +1 -4
- package/lib/esm/lib.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jsonParse = void 0;
|
|
4
|
+
const types_1 = require("@infra-blocks/types");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
|
-
const lib_js_1 = require("../lib.js");
|
|
6
6
|
const index_js_1 = require("../string/index.js");
|
|
7
7
|
/**
|
|
8
8
|
* A codec factory that returns a codec that expects a valid JSON string
|
|
@@ -14,7 +14,7 @@ const index_js_1 = require("../string/index.js");
|
|
|
14
14
|
*/
|
|
15
15
|
const jsonParse = (schema) => zod_1.z.codec(index_js_1.string.json(), schema, {
|
|
16
16
|
decode: (str) => JSON.parse(str),
|
|
17
|
-
encode: (json) => (0,
|
|
17
|
+
encode: (json) => (0, types_1.trusted)(JSON.stringify(json)),
|
|
18
18
|
});
|
|
19
19
|
exports.jsonParse = jsonParse;
|
|
20
20
|
//# sourceMappingURL=json-parse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-parse.js","sourceRoot":"","sources":["../../../src/codec/json-parse.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"json-parse.js","sourceRoot":"","sources":["../../../src/codec/json-parse.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAC9C,6BAAwB;AACxB,iDAA4C;AAE5C;;;;;;;GAOG;AACI,MAAM,SAAS,GAAG,CAAsB,MAAS,EAAE,EAAE,CAC1D,OAAC,CAAC,KAAK,CAAC,iBAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE;IAC7B,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;IAChC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,eAAO,EAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC,CAAC;AAJQ,QAAA,SAAS,aAIjB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringToInteger = void 0;
|
|
4
|
+
const types_1 = require("@infra-blocks/types");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
|
-
const lib_js_1 = require("../lib.js");
|
|
6
6
|
const index_js_1 = require("../number/index.js");
|
|
7
7
|
const index_js_2 = require("../string/index.js");
|
|
8
8
|
const codec = zod_1.z.codec(index_js_2.string.integer(), index_js_1.number.integer(), {
|
|
9
9
|
decode: (str) => Number.parseInt(str, 10),
|
|
10
|
-
encode: (num) => (0,
|
|
10
|
+
encode: (num) => (0, types_1.trusted)(num.toString()),
|
|
11
11
|
});
|
|
12
12
|
/**
|
|
13
13
|
* A string to integer codec.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-integer.js","sourceRoot":"","sources":["../../../src/codec/string-to-integer.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"string-to-integer.js","sourceRoot":"","sources":["../../../src/codec/string-to-integer.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAC9C,6BAAwB;AAExB,iDAA4C;AAC5C,iDAA4C;AAE5C,MAAM,KAAK,GAAG,OAAC,CAAC,KAAK,CAAC,iBAAM,CAAC,OAAO,EAAE,EAAE,iBAAM,CAAC,OAAO,EAAE,EAAE;IACxD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,eAAO,EAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;AAA9B,QAAA,eAAe,mBAAe"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringToUrl = void 0;
|
|
4
|
+
const types_1 = require("@infra-blocks/types");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
|
-
const lib_js_1 = require("../lib.js");
|
|
6
6
|
const index_js_1 = require("../string/index.js");
|
|
7
7
|
const codec = zod_1.z.codec(index_js_1.string.url(), zod_1.z.instanceof(URL), {
|
|
8
8
|
decode: (urlString) => new URL(urlString),
|
|
9
|
-
encode: (url) => (0,
|
|
9
|
+
encode: (url) => (0, types_1.trusted)(url.href),
|
|
10
10
|
});
|
|
11
11
|
/**
|
|
12
12
|
* A string to URL codec, as defined in Zod's documentation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-url.js","sourceRoot":"","sources":["../../../src/codec/string-to-url.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"string-to-url.js","sourceRoot":"","sources":["../../../src/codec/string-to-url.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAC9C,6BAAwB;AACxB,iDAA4C;AAE5C,MAAM,KAAK,GAAG,OAAC,CAAC,KAAK,CAAC,iBAAM,CAAC,GAAG,EAAE,EAAE,OAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;IACrD,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,eAAO,EAAC,GAAG,CAAC,IAAI,CAAC;CACnC,CAAC,CAAC;AAEH;;;;;;GAMG;AACI,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;AAA1B,QAAA,WAAW,eAAe"}
|
package/lib/cjs/lib.d.ts
CHANGED
package/lib/cjs/lib.js
CHANGED
package/lib/cjs/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-parse.js","sourceRoot":"","sources":["../../../src/codec/json-parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"json-parse.js","sourceRoot":"","sources":["../../../src/codec/json-parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAsB,MAAS,EAAE,EAAE,CAC1D,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE;IAC7B,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;IAChC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-integer.js","sourceRoot":"","sources":["../../../src/codec/string-to-integer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"string-to-integer.js","sourceRoot":"","sources":["../../../src/codec/string-to-integer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE;IACxD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-url.js","sourceRoot":"","sources":["../../../src/codec/string-to-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"string-to-url.js","sourceRoot":"","sources":["../../../src/codec/string-to-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;IACrD,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;CACnC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC"}
|
package/lib/esm/lib.d.ts
CHANGED
package/lib/esm/lib.js
CHANGED
package/lib/esm/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-blocks/zod-utils",
|
|
3
|
-
"version": "0.23.0",
|
|
3
|
+
"version": "0.23.1-alpha.0",
|
|
4
4
|
"description": "Extensions to the zod package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zod",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"test:unit": "mocha --config test/unit/.mocharc.cjs 'test/unit/**/*.spec.ts'"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@infra-blocks/types": "^0.
|
|
69
|
+
"@infra-blocks/types": "^0.26.0",
|
|
70
70
|
"currency-codes": "^2.2.0",
|
|
71
71
|
"iso-3166": "^4.4.0",
|
|
72
72
|
"ms": "^2.1.3",
|