@infra-blocks/zod-utils 0.5.0-alpha.0 → 0.5.0-alpha.2
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 +4 -23
- package/lib/cjs/geojson/base.d.ts +2 -6
- package/lib/cjs/geojson/bounding-box.d.ts +2 -2
- package/lib/cjs/geojson/coordinate.d.ts +2 -2
- package/lib/cjs/geojson/feature-collection.d.ts +50 -634
- package/lib/cjs/geojson/feature.d.ts +46 -378
- package/lib/cjs/geojson/feature.js +1 -1
- package/lib/cjs/geojson/feature.js.map +1 -1
- package/lib/cjs/geojson/geojson.d.ts +134 -1146
- package/lib/cjs/geojson/geometry.d.ts +39 -135
- package/lib/cjs/geojson/index.d.ts +67 -573
- package/lib/cjs/geojson/line-string.d.ts +6 -22
- package/lib/cjs/geojson/multi-line-string.d.ts +6 -22
- package/lib/cjs/geojson/multi-point.d.ts +6 -22
- package/lib/cjs/geojson/multi-polygon.d.ts +6 -22
- package/lib/cjs/geojson/point.d.ts +6 -22
- package/lib/cjs/geojson/polygon.d.ts +6 -22
- package/lib/cjs/index.d.ts +93 -596
- package/lib/cjs/index.js +9 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/json/index.d.ts +1 -1
- package/lib/cjs/json/json.d.ts +7 -7
- package/lib/cjs/json/json.js +2 -2
- package/lib/cjs/json/json.js.map +1 -1
- package/lib/esm/geojson/base.d.ts +2 -6
- package/lib/esm/geojson/bounding-box.d.ts +2 -2
- package/lib/esm/geojson/coordinate.d.ts +2 -2
- package/lib/esm/geojson/feature-collection.d.ts +50 -634
- package/lib/esm/geojson/feature.d.ts +46 -378
- package/lib/esm/geojson/feature.js +1 -1
- package/lib/esm/geojson/feature.js.map +1 -1
- package/lib/esm/geojson/geojson.d.ts +134 -1146
- package/lib/esm/geojson/geometry.d.ts +39 -135
- package/lib/esm/geojson/index.d.ts +67 -573
- package/lib/esm/geojson/line-string.d.ts +6 -22
- package/lib/esm/geojson/multi-line-string.d.ts +6 -22
- package/lib/esm/geojson/multi-point.d.ts +6 -22
- package/lib/esm/geojson/multi-polygon.d.ts +6 -22
- package/lib/esm/geojson/point.d.ts +6 -22
- package/lib/esm/geojson/polygon.d.ts +6 -22
- package/lib/esm/index.d.ts +93 -596
- package/lib/esm/index.js +9 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/json/index.d.ts +1 -1
- package/lib/esm/json/json.d.ts +7 -7
- package/lib/esm/json/json.js +2 -2
- package/lib/esm/json/json.js.map +1 -1
- package/package.json +3 -3
package/lib/esm/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { json } from "./json/index.js";
|
|
2
3
|
import { geojson } from "./geojson/index.js";
|
|
4
|
+
const csvSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.transform((str) => str.split(","))
|
|
7
|
+
.default([]);
|
|
8
|
+
function csv() {
|
|
9
|
+
return csvSchema;
|
|
10
|
+
}
|
|
3
11
|
const zu = {
|
|
4
12
|
geojson,
|
|
5
13
|
json,
|
|
14
|
+
csv,
|
|
6
15
|
};
|
|
7
16
|
export { zu };
|
|
8
17
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,EAAE,GAAG;IACT,OAAO;IACP,IAAI;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,SAAS,GAAG,CAAC;KAChB,MAAM,EAAE;KACR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAClC,OAAO,CAAC,EAAE,CAAC,CAAC;AAEf,SAAS,GAAG;IACV,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,EAAE,GAAG;IACT,OAAO;IACP,IAAI;IACJ,GAAG;CACJ,CAAC;AAEF,OAAO,EAAE,EAAE,EAAE,CAAC"}
|
package/lib/esm/json/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { array, object, primitive, stringifiedJson } from "./json.js";
|
|
2
2
|
declare const module: {
|
|
3
|
-
(): import("zod").ZodType<import("./json.js").Json, import("zod")
|
|
3
|
+
(): import("zod").ZodType<import("./json.js").Json, unknown, import("zod/v4/core").$ZodTypeInternals<import("./json.js").Json, unknown>>;
|
|
4
4
|
array: typeof array;
|
|
5
5
|
object: typeof object;
|
|
6
6
|
primitive: typeof primitive;
|
package/lib/esm/json/json.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
declare const primitiveSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
2
|
+
declare const primitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
3
3
|
export type JsonPrimitive = z.infer<typeof primitiveSchema>;
|
|
4
|
-
export declare function primitive(): z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
4
|
+
export declare function primitive(): z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
5
5
|
export type JsonObject = {
|
|
6
6
|
[key: string]: Json;
|
|
7
7
|
};
|
|
8
8
|
export type JsonArray = Array<Json>;
|
|
9
9
|
export type Json = JsonPrimitive | JsonObject | JsonArray;
|
|
10
|
-
export declare function json(): z.ZodType<Json, z.
|
|
11
|
-
export declare function object(): z.ZodRecord<z.ZodString, z.ZodType<Json, z.
|
|
12
|
-
export declare function array(): z.ZodArray<z.ZodType<Json, z.
|
|
13
|
-
export declare const stringifiedJsonSchema: z.ZodType<Json,
|
|
14
|
-
export declare function stringifiedJson(): z.ZodType<Json, z.
|
|
10
|
+
export declare function json(): z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>;
|
|
11
|
+
export declare function object(): z.ZodRecord<z.ZodString, z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>>;
|
|
12
|
+
export declare function array(): z.ZodArray<z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>>;
|
|
13
|
+
export declare const stringifiedJsonSchema: z.ZodType<Json, string>;
|
|
14
|
+
export declare function stringifiedJson(): z.ZodType<Json, string, z.core.$ZodTypeInternals<Json, string>>;
|
|
15
15
|
export {};
|
package/lib/esm/json/json.js
CHANGED
|
@@ -8,11 +8,11 @@ const primitiveSchema = z.union([
|
|
|
8
8
|
export function primitive() {
|
|
9
9
|
return primitiveSchema;
|
|
10
10
|
}
|
|
11
|
-
const jsonSchema = z.lazy(() => z.union([primitive(), z.array(jsonSchema), z.record(jsonSchema)]));
|
|
11
|
+
const jsonSchema = z.lazy(() => z.union([primitive(), z.array(jsonSchema), z.record(z.string(), jsonSchema)]));
|
|
12
12
|
export function json() {
|
|
13
13
|
return jsonSchema;
|
|
14
14
|
}
|
|
15
|
-
const objectSchema = z.record(jsonSchema);
|
|
15
|
+
const objectSchema = z.record(z.string(), jsonSchema);
|
|
16
16
|
export function object() {
|
|
17
17
|
return objectSchema;
|
|
18
18
|
}
|
package/lib/esm/json/json.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/json/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAA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U,CAAC,CAAC;AACtD,MAAM,UAAU,MAAM;IACpB,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACxC,MAAM,UAAU,KAAK;IACnB,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAA4B,CAAC;KAC5D,MAAM,EAAE;KACR,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACtB,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAS,CAAC;KAChC;IAAC,OAAO,CAAC,EAAE;QACV,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,CAAC,KAAK,CAAC;KAChB;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,UAAU,eAAe;IAC7B,OAAO,qBAAqB,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-blocks/zod-utils",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.2",
|
|
4
4
|
"description": "Extensions to the zod package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zod",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "https://github.com/infra-blocks/ts-zod-utils.git"
|
|
14
14
|
},
|
|
15
15
|
"license": "ISC",
|
|
16
16
|
"author": "",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"test:unit": "mocha --config test/unit/.mocharc.cjs 'test/unit/**/*.spec.ts'"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"zod": "^
|
|
53
|
+
"zod": "^4.2.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@infra-blocks/test": "^0.3.1",
|