zod-geojson 0.0.2 → 0.0.3

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 (56) hide show
  1. package/lib/base.d.ts +8 -7
  2. package/lib/base.d.ts.map +1 -1
  3. package/lib/base.js +6 -3
  4. package/lib/bbox.d.ts +14 -5
  5. package/lib/bbox.d.ts.map +1 -1
  6. package/lib/bbox.js +21 -5
  7. package/lib/feature.d.ts +25 -25
  8. package/lib/feature.d.ts.map +1 -1
  9. package/lib/feature.js +2 -1
  10. package/lib/feature_collection.d.ts +145 -145
  11. package/lib/feature_collection.d.ts.map +1 -1
  12. package/lib/feature_collection.js +3 -2
  13. package/lib/geojson.d.ts +170 -170
  14. package/lib/geometry/geometry.d.ts +1 -2
  15. package/lib/geometry/geometry.d.ts.map +1 -1
  16. package/lib/geometry/geometry_collection.d.ts +3 -3
  17. package/lib/geometry/geometry_collection.d.ts.map +1 -1
  18. package/lib/geometry/geometry_collection.js +2 -1
  19. package/lib/geometry/helper/base.d.ts +7 -6
  20. package/lib/geometry/helper/base.d.ts.map +1 -1
  21. package/lib/geometry/helper/base.js +9 -6
  22. package/lib/geometry/line_string.d.ts +2 -2
  23. package/lib/geometry/line_string.d.ts.map +1 -1
  24. package/lib/geometry/line_string.js +2 -1
  25. package/lib/geometry/multi_line_string.d.ts +2 -2
  26. package/lib/geometry/multi_line_string.d.ts.map +1 -1
  27. package/lib/geometry/multi_line_string.js +2 -1
  28. package/lib/geometry/multi_point.d.ts +2 -2
  29. package/lib/geometry/multi_point.d.ts.map +1 -1
  30. package/lib/geometry/multi_point.js +2 -1
  31. package/lib/geometry/multi_polygon.d.ts +2 -2
  32. package/lib/geometry/multi_polygon.d.ts.map +1 -1
  33. package/lib/geometry/multi_polygon.js +2 -1
  34. package/lib/geometry/point.d.ts +3 -3
  35. package/lib/geometry/point.d.ts.map +1 -1
  36. package/lib/geometry/point.js +3 -2
  37. package/lib/geometry/polygon.d.ts +2 -2
  38. package/lib/geometry/polygon.d.ts.map +1 -1
  39. package/lib/geometry/polygon.js +2 -1
  40. package/lib/geometry/position.d.ts +2 -2
  41. package/lib/geometry/position.d.ts.map +1 -1
  42. package/lib/geometry/position.js +9 -6
  43. package/lib/geometry/validation/bbox.d.ts +3 -5
  44. package/lib/geometry/validation/bbox.d.ts.map +1 -1
  45. package/lib/geometry/validation/dimension.d.ts +3 -4
  46. package/lib/geometry/validation/dimension.d.ts.map +1 -1
  47. package/lib/geometry/validation/linear_ring.d.ts +2 -3
  48. package/lib/geometry/validation/linear_ring.d.ts.map +1 -1
  49. package/lib/geometry/validation/types.d.ts +9 -11
  50. package/lib/geometry/validation/types.d.ts.map +1 -1
  51. package/lib/index.d.ts +1 -1
  52. package/lib/index.d.ts.map +1 -1
  53. package/lib/index.js +4 -3
  54. package/lib/validation/types.d.ts +2 -3
  55. package/lib/validation/types.d.ts.map +1 -1
  56. package/package.json +2 -1
package/lib/base.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { z } from "zod";
2
- import { GeoJSONBbox, GeoJSONBboxSchemaType } from "./bbox";
3
- export type GeoJSONBase = {
4
- bbox?: GeoJSONBbox;
2
+ import { GeoJSONBboxSchemaType, GeoJSONBboxGeneric } from "./bbox";
3
+ import { GeoJSONPosition } from "./geometry/position";
4
+ export type GeoJSONBase<P extends GeoJSONPosition> = {
5
+ bbox?: GeoJSONBboxGeneric<P>;
5
6
  };
6
- export type GeoJSONBaseSchemaInnerType = {
7
- bbox: z.ZodOptional<GeoJSONBboxSchemaType>;
7
+ export type GeoJSONBaseSchemaInnerType<P extends GeoJSONPosition> = {
8
+ bbox: z.ZodOptional<GeoJSONBboxSchemaType<P>>;
8
9
  };
9
- export type GeoJSONBaseSchemaType = z.ZodObject<GeoJSONBaseSchemaInnerType, "strip", z.ZodTypeAny, GeoJSONBase, GeoJSONBase>;
10
- export declare const GeoJSONBaseSchema: GeoJSONBaseSchemaType;
10
+ export type GeoJSONBaseSchemaType<P extends GeoJSONPosition> = z.ZodObject<GeoJSONBaseSchemaInnerType<P>, "strip", z.ZodTypeAny, GeoJSONBase<P>, GeoJSONBase<P>>;
11
+ export declare const GeoJSONBaseSchema: <P extends GeoJSONPosition>(positionSchema: z.ZodSchema<P>) => GeoJSONBaseSchemaType<P>;
11
12
  //# sourceMappingURL=base.d.ts.map
package/lib/base.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAqB,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,SAAS,CAC3C,0BAA0B,EAC1B,OAAO,EACP,CAAC,CAAC,UAAU,EACZ,WAAW,EACX,WAAW,CACd,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAE9B,CAAC"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA4B,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,eAAe,IAAI;IACjD,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,eAAe,IAAI;IAChE,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,eAAe,IAAI,CAAC,CAAC,SAAS,CACtE,0BAA0B,CAAC,CAAC,CAAC,EAC7B,OAAO,EACP,CAAC,CAAC,UAAU,EACZ,WAAW,CAAC,CAAC,CAAC,EACd,WAAW,CAAC,CAAC,CAAC,CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,eAAe,kBACvC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAC/B,qBAAqB,CAAC,CAAC,CAGpB,CAAC"}
package/lib/base.js CHANGED
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GeoJSONBaseSchema = void 0;
4
4
  var zod_1 = require("zod");
5
5
  var bbox_1 = require("./bbox");
6
- exports.GeoJSONBaseSchema = zod_1.z.object({
7
- bbox: bbox_1.GeoJSONBboxSchema.optional(),
8
- });
6
+ var GeoJSONBaseSchema = function (positionSchema) {
7
+ return zod_1.z.object({
8
+ bbox: (0, bbox_1.GeoJSONBboxGenericSchema)(positionSchema).optional(),
9
+ });
10
+ };
11
+ exports.GeoJSONBaseSchema = GeoJSONBaseSchema;
package/lib/bbox.d.ts CHANGED
@@ -1,6 +1,15 @@
1
- import { z } from "zod";
2
- export type GeoJSONBbox = [number, number, number, number, ...number[]];
3
- export type GeoJSONBboxSchemaInnerType = z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], z.ZodNumber>;
4
- export type GeoJSONBboxSchemaType = z.ZodEffects<GeoJSONBboxSchemaInnerType, GeoJSONBbox, GeoJSONBbox>;
5
- export declare const GeoJSONBboxSchema: GeoJSONBboxSchemaType;
1
+ import { z, ZodSchema } from "zod";
2
+ import { GeoJSON2DPosition, GeoJSON3DPosition, GeoJSONPosition } from "./geometry/position";
3
+ export type GeoJSONBboxGeneric<P extends GeoJSONPosition> = P extends GeoJSON3DPosition ? [number, number, number, number, number, number] : P extends GeoJSON2DPosition ? [number, number, number, number] : [number, number, number, number] | [number, number, number, number, number, number];
4
+ export type GeoJSONBboxSchemaType<P extends GeoJSONPosition> = ZodSchema<GeoJSONBboxGeneric<P>>;
5
+ /**
6
+ * Because zod cannot do conditional typing we need to do some hacky type casts to make this work
7
+ */
8
+ export declare const GeoJSONBboxGenericSchema: <P extends GeoJSONPosition>(positionSchema: z.ZodSchema<P>) => GeoJSONBboxSchemaType<P>;
9
+ export declare const GeoJSON2DBboxSchema: GeoJSONBboxSchemaType<[number, number]>;
10
+ export type GeoJSON2DBbox = z.infer<typeof GeoJSON2DBboxSchema>;
11
+ export declare const GeoJSON3DBboxSchema: GeoJSONBboxSchemaType<[number, number, number]>;
12
+ export type GeoJSON3DBbox = z.infer<typeof GeoJSON3DBboxSchema>;
13
+ export declare const GeoJSONBboxSchema: GeoJSONBboxSchemaType<[number, number] | [number, number, number]>;
14
+ export type GeoJSONBbox = z.infer<typeof GeoJSONBboxSchema>;
6
15
  //# sourceMappingURL=bbox.d.ts.map
package/lib/bbox.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bbox.d.ts","sourceRoot":"","sources":["../src/bbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;AAEvH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,UAAU,CAAC,0BAA0B,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,CAAC;AACjF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
package/lib/bbox.js CHANGED
@@ -1,8 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GeoJSONBboxSchema = void 0;
3
+ exports.GeoJSONBboxSchema = exports.GeoJSON3DBboxSchema = exports.GeoJSON2DBboxSchema = exports.GeoJSONBboxGenericSchema = void 0;
4
4
  var zod_1 = require("zod");
5
- exports.GeoJSONBboxSchema = zod_1.z
6
- .tuple([zod_1.z.number(), zod_1.z.number(), zod_1.z.number(), zod_1.z.number()])
7
- .rest(zod_1.z.number())
8
- .refine(function (bbox) { return bbox.length % 2 === 0; }, "Bounding box must have an even number of elements");
5
+ var position_1 = require("./geometry/position");
6
+ var _2DBboxSchema = zod_1.z.tuple([zod_1.z.number(), zod_1.z.number(), zod_1.z.number(), zod_1.z.number()]);
7
+ var _3DBboxSchema = zod_1.z.tuple([zod_1.z.number(), zod_1.z.number(), zod_1.z.number(), zod_1.z.number(), zod_1.z.number(), zod_1.z.number()]);
8
+ /**
9
+ * Because zod cannot do conditional typing we need to do some hacky type casts to make this work
10
+ */
11
+ var GeoJSONBboxGenericSchema = function (positionSchema) {
12
+ // If the position is not a tuple, we can't infer the dimension, and we return a union of 2D and 3D bbox
13
+ if (!(positionSchema instanceof zod_1.z.ZodTuple)) {
14
+ return zod_1.z.union([_2DBboxSchema, _3DBboxSchema]);
15
+ }
16
+ if (positionSchema.items.length === 2) {
17
+ return _2DBboxSchema;
18
+ }
19
+ return _3DBboxSchema;
20
+ };
21
+ exports.GeoJSONBboxGenericSchema = GeoJSONBboxGenericSchema;
22
+ exports.GeoJSON2DBboxSchema = (0, exports.GeoJSONBboxGenericSchema)(position_1.GeoJSON2DPositionSchema);
23
+ exports.GeoJSON3DBboxSchema = (0, exports.GeoJSONBboxGenericSchema)(position_1.GeoJSON3DPositionSchema);
24
+ exports.GeoJSONBboxSchema = (0, exports.GeoJSONBboxGenericSchema)(position_1.GeoJSONPositionSchema);
package/lib/feature.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { GeoJSONPosition } from "./geometry/position";
3
- export declare const GeoJSONFeatureGenericSchema: <P extends GeoJSONPosition>(positionSchema: z.ZodSchema<P>) => z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
3
+ export declare const GeoJSONFeatureGenericSchema: <P extends GeoJSONPosition>(positionSchema: z.ZodSchema<P>) => z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<P>, {
4
4
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
5
5
  type: z.ZodLiteral<"Feature">;
6
6
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<P>>;
@@ -8,7 +8,7 @@ export declare const GeoJSONFeatureGenericSchema: <P extends GeoJSONPosition>(po
8
8
  coordinates: z.ZodOptional<z.ZodNever>;
9
9
  features: z.ZodOptional<z.ZodNever>;
10
10
  geometries: z.ZodOptional<z.ZodNever>;
11
- }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
11
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<P>, {
12
12
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
13
13
  type: z.ZodLiteral<"Feature">;
14
14
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<P>>;
@@ -16,7 +16,7 @@ export declare const GeoJSONFeatureGenericSchema: <P extends GeoJSONPosition>(po
16
16
  coordinates: z.ZodOptional<z.ZodNever>;
17
17
  features: z.ZodOptional<z.ZodNever>;
18
18
  geometries: z.ZodOptional<z.ZodNever>;
19
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
19
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<P>, {
20
20
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
21
21
  type: z.ZodLiteral<"Feature">;
22
22
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<P>>;
@@ -24,7 +24,7 @@ export declare const GeoJSONFeatureGenericSchema: <P extends GeoJSONPosition>(po
24
24
  coordinates: z.ZodOptional<z.ZodNever>;
25
25
  features: z.ZodOptional<z.ZodNever>;
26
26
  geometries: z.ZodOptional<z.ZodNever>;
27
- }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
27
+ }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<P>, {
28
28
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
29
29
  type: z.ZodLiteral<"Feature">;
30
30
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<P>>;
@@ -32,7 +32,7 @@ export declare const GeoJSONFeatureGenericSchema: <P extends GeoJSONPosition>(po
32
32
  coordinates: z.ZodOptional<z.ZodNever>;
33
33
  features: z.ZodOptional<z.ZodNever>;
34
34
  geometries: z.ZodOptional<z.ZodNever>;
35
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
35
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<P>, {
36
36
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
37
37
  type: z.ZodLiteral<"Feature">;
38
38
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<P>>;
@@ -41,49 +41,49 @@ export declare const GeoJSONFeatureGenericSchema: <P extends GeoJSONPosition>(po
41
41
  features: z.ZodOptional<z.ZodNever>;
42
42
  geometries: z.ZodOptional<z.ZodNever>;
43
43
  }>, z.ZodTypeAny, "passthrough">>;
44
- export declare const GeoJSONFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
44
+ export declare const GeoJSONFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number] | [number, number, number]>, {
45
45
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
46
46
  type: z.ZodLiteral<"Feature">;
47
- geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, ...number[]]>>;
47
+ geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number] | [number, number, number]>>;
48
48
  properties: z.ZodNullable<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
49
49
  coordinates: z.ZodOptional<z.ZodNever>;
50
50
  features: z.ZodOptional<z.ZodNever>;
51
51
  geometries: z.ZodOptional<z.ZodNever>;
52
- }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
52
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number] | [number, number, number]>, {
53
53
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
54
54
  type: z.ZodLiteral<"Feature">;
55
- geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, ...number[]]>>;
55
+ geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number] | [number, number, number]>>;
56
56
  properties: z.ZodNullable<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
57
57
  coordinates: z.ZodOptional<z.ZodNever>;
58
58
  features: z.ZodOptional<z.ZodNever>;
59
59
  geometries: z.ZodOptional<z.ZodNever>;
60
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
60
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number] | [number, number, number]>, {
61
61
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
62
62
  type: z.ZodLiteral<"Feature">;
63
- geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, ...number[]]>>;
63
+ geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number] | [number, number, number]>>;
64
64
  properties: z.ZodNullable<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
65
65
  coordinates: z.ZodOptional<z.ZodNever>;
66
66
  features: z.ZodOptional<z.ZodNever>;
67
67
  geometries: z.ZodOptional<z.ZodNever>;
68
- }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
68
+ }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number] | [number, number, number]>, {
69
69
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
70
70
  type: z.ZodLiteral<"Feature">;
71
- geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, ...number[]]>>;
71
+ geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number] | [number, number, number]>>;
72
72
  properties: z.ZodNullable<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
73
73
  coordinates: z.ZodOptional<z.ZodNever>;
74
74
  features: z.ZodOptional<z.ZodNever>;
75
75
  geometries: z.ZodOptional<z.ZodNever>;
76
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
76
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number] | [number, number, number]>, {
77
77
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
78
78
  type: z.ZodLiteral<"Feature">;
79
- geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, ...number[]]>>;
79
+ geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number] | [number, number, number]>>;
80
80
  properties: z.ZodNullable<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
81
81
  coordinates: z.ZodOptional<z.ZodNever>;
82
82
  features: z.ZodOptional<z.ZodNever>;
83
83
  geometries: z.ZodOptional<z.ZodNever>;
84
84
  }>, z.ZodTypeAny, "passthrough">>;
85
85
  export type GeoJSONFeature = z.infer<typeof GeoJSONFeatureSchema>;
86
- export declare const GeoJSON2DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
86
+ export declare const GeoJSON2DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number]>, {
87
87
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
88
88
  type: z.ZodLiteral<"Feature">;
89
89
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number]>>;
@@ -91,7 +91,7 @@ export declare const GeoJSON2DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
91
91
  coordinates: z.ZodOptional<z.ZodNever>;
92
92
  features: z.ZodOptional<z.ZodNever>;
93
93
  geometries: z.ZodOptional<z.ZodNever>;
94
- }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
94
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number]>, {
95
95
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
96
96
  type: z.ZodLiteral<"Feature">;
97
97
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number]>>;
@@ -99,7 +99,7 @@ export declare const GeoJSON2DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
99
99
  coordinates: z.ZodOptional<z.ZodNever>;
100
100
  features: z.ZodOptional<z.ZodNever>;
101
101
  geometries: z.ZodOptional<z.ZodNever>;
102
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
102
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number]>, {
103
103
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
104
104
  type: z.ZodLiteral<"Feature">;
105
105
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number]>>;
@@ -107,7 +107,7 @@ export declare const GeoJSON2DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
107
107
  coordinates: z.ZodOptional<z.ZodNever>;
108
108
  features: z.ZodOptional<z.ZodNever>;
109
109
  geometries: z.ZodOptional<z.ZodNever>;
110
- }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
110
+ }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number]>, {
111
111
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
112
112
  type: z.ZodLiteral<"Feature">;
113
113
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number]>>;
@@ -115,7 +115,7 @@ export declare const GeoJSON2DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
115
115
  coordinates: z.ZodOptional<z.ZodNever>;
116
116
  features: z.ZodOptional<z.ZodNever>;
117
117
  geometries: z.ZodOptional<z.ZodNever>;
118
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
118
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number]>, {
119
119
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
120
120
  type: z.ZodLiteral<"Feature">;
121
121
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number]>>;
@@ -125,7 +125,7 @@ export declare const GeoJSON2DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
125
125
  geometries: z.ZodOptional<z.ZodNever>;
126
126
  }>, z.ZodTypeAny, "passthrough">>;
127
127
  export type GeoJSON2DFeature = z.infer<typeof GeoJSON2DFeatureSchema>;
128
- export declare const GeoJSON3DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
128
+ export declare const GeoJSON3DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number, number]>, {
129
129
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
130
130
  type: z.ZodLiteral<"Feature">;
131
131
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, number]>>;
@@ -133,7 +133,7 @@ export declare const GeoJSON3DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
133
133
  coordinates: z.ZodOptional<z.ZodNever>;
134
134
  features: z.ZodOptional<z.ZodNever>;
135
135
  geometries: z.ZodOptional<z.ZodNever>;
136
- }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
136
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number, number]>, {
137
137
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
138
138
  type: z.ZodLiteral<"Feature">;
139
139
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, number]>>;
@@ -141,7 +141,7 @@ export declare const GeoJSON3DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
141
141
  coordinates: z.ZodOptional<z.ZodNever>;
142
142
  features: z.ZodOptional<z.ZodNever>;
143
143
  geometries: z.ZodOptional<z.ZodNever>;
144
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
144
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number, number]>, {
145
145
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
146
146
  type: z.ZodLiteral<"Feature">;
147
147
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, number]>>;
@@ -149,7 +149,7 @@ export declare const GeoJSON3DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
149
149
  coordinates: z.ZodOptional<z.ZodNever>;
150
150
  features: z.ZodOptional<z.ZodNever>;
151
151
  geometries: z.ZodOptional<z.ZodNever>;
152
- }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
152
+ }>, z.ZodTypeAny, "passthrough">>, z.objectOutputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number, number]>, {
153
153
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
154
154
  type: z.ZodLiteral<"Feature">;
155
155
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, number]>>;
@@ -157,7 +157,7 @@ export declare const GeoJSON3DFeatureSchema: z.ZodEffects<z.ZodObject<z.objectUt
157
157
  coordinates: z.ZodOptional<z.ZodNever>;
158
158
  features: z.ZodOptional<z.ZodNever>;
159
159
  geometries: z.ZodOptional<z.ZodNever>;
160
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType, {
160
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<import("./base").GeoJSONBaseSchemaInnerType<[number, number, number]>, {
161
161
  id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
162
162
  type: z.ZodLiteral<"Feature">;
163
163
  geometry: z.ZodNullable<import("./geometry/geometry").GeoJSONGeometryGenericSchemaType<[number, number, number]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAAA,OAA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OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAAuD,CAAC;AAC3F,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAAuD,CAAC;AAC3F,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
package/lib/feature.js CHANGED
@@ -9,7 +9,8 @@ var position_1 = require("./geometry/position");
9
9
  var type_1 = require("./type");
10
10
  var bbox_2 = require("./validation/bbox");
11
11
  var GeoJSONFeatureGenericSchema = function (positionSchema) {
12
- return base_1.GeoJSONBaseSchema.extend({
12
+ return (0, base_1.GeoJSONBaseSchema)(positionSchema)
13
+ .extend({
13
14
  id: zod_1.z.string().or(zod_1.z.number()).optional(),
14
15
  type: zod_1.z.literal(type_1.GeoJSONTypeSchema.enum.Feature),
15
16
  geometry: (0, geometry_1.GeoJSONGeometryGenericSchema)(positionSchema).nullable(),