@digitraffic/common 2025.9.24-2 → 2025.10.16-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.
- package/README.md +15 -0
- package/dist/types/geojson.d.ts +47 -0
- package/dist/types/geojson.js +51 -0
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -17,6 +17,21 @@ Format code
|
|
|
17
17
|
pnpm run:format-changed # Formats stagged files
|
|
18
18
|
pnpm run:format # Format all files
|
|
19
19
|
|
|
20
|
+
## Update deps
|
|
21
|
+
|
|
22
|
+
To update all dependencies to the latest versions allowed by your semver ranges:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm up
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If you want to ignore the version ranges in package.json and install the
|
|
29
|
+
absolute latest versions:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm up --latest
|
|
33
|
+
```
|
|
34
|
+
|
|
20
35
|
## Reinstall lefthook git hooks
|
|
21
36
|
|
|
22
37
|
pnpm prepare
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CoordinatesSchema: z.ZodArray<z.ZodNumber>;
|
|
3
|
+
export declare const PointSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"Point">;
|
|
5
|
+
coordinates: z.ZodArray<z.ZodNumber>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const MultiPointSchema: z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"MultiPoint">;
|
|
9
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodNumber>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const LineStringSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodLiteral<"LineString">;
|
|
13
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodNumber>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const MultiLineStringSchema: z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"MultiLineString">;
|
|
17
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const PolygonSchema: z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"Polygon">;
|
|
21
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const MultiPolygonSchema: z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"MultiPolygon">;
|
|
25
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodNumber>>>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type Point = z.infer<typeof PointSchema>;
|
|
28
|
+
export type Geometry = z.infer<typeof PointSchema> | z.infer<typeof MultiPointSchema> | z.infer<typeof LineStringSchema> | z.infer<typeof MultiLineStringSchema> | z.infer<typeof PolygonSchema> | z.infer<typeof MultiPolygonSchema> | {
|
|
29
|
+
type: "GeometryCollection";
|
|
30
|
+
geometries: Geometry[];
|
|
31
|
+
};
|
|
32
|
+
export declare const GeometrySchema: z.ZodType<Geometry>;
|
|
33
|
+
export declare const FeatureSchema: z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"Feature">;
|
|
35
|
+
geometry: z.ZodType<Geometry, unknown, z.core.$ZodTypeInternals<Geometry, unknown>>;
|
|
36
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
37
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const FeatureCollectionSchema: z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"FeatureCollection">;
|
|
41
|
+
features: z.ZodArray<z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"Feature">;
|
|
43
|
+
geometry: z.ZodType<Geometry, unknown, z.core.$ZodTypeInternals<Geometry, unknown>>;
|
|
44
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
45
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const CoordinatesSchema = z.array(z.number()).min(2).max(3);
|
|
3
|
+
export const PointSchema = z.object({
|
|
4
|
+
type: z.literal("Point"),
|
|
5
|
+
coordinates: CoordinatesSchema,
|
|
6
|
+
});
|
|
7
|
+
export const MultiPointSchema = z.object({
|
|
8
|
+
type: z.literal("MultiPoint"),
|
|
9
|
+
coordinates: z.array(CoordinatesSchema),
|
|
10
|
+
});
|
|
11
|
+
export const LineStringSchema = z.object({
|
|
12
|
+
type: z.literal("LineString"),
|
|
13
|
+
coordinates: z.array(CoordinatesSchema).min(2),
|
|
14
|
+
});
|
|
15
|
+
export const MultiLineStringSchema = z.object({
|
|
16
|
+
type: z.literal("MultiLineString"),
|
|
17
|
+
coordinates: z.array(z.array(CoordinatesSchema).min(2)),
|
|
18
|
+
});
|
|
19
|
+
export const PolygonSchema = z.object({
|
|
20
|
+
type: z.literal("Polygon"),
|
|
21
|
+
coordinates: z.array(z.array(CoordinatesSchema).min(4)),
|
|
22
|
+
});
|
|
23
|
+
export const MultiPolygonSchema = z.object({
|
|
24
|
+
type: z.literal("MultiPolygon"),
|
|
25
|
+
coordinates: z.array(z.array(z.array(CoordinatesSchema).min(4))),
|
|
26
|
+
});
|
|
27
|
+
// --- Recursive GeometrySchema ---
|
|
28
|
+
export const GeometrySchema = z.lazy(() => z.union([
|
|
29
|
+
PointSchema,
|
|
30
|
+
MultiPointSchema,
|
|
31
|
+
LineStringSchema,
|
|
32
|
+
MultiLineStringSchema,
|
|
33
|
+
PolygonSchema,
|
|
34
|
+
MultiPolygonSchema,
|
|
35
|
+
// GeometryCollection is recursive, so we need to use z.lazy
|
|
36
|
+
z.object({
|
|
37
|
+
type: z.literal("GeometryCollection"),
|
|
38
|
+
geometries: z.array(GeometrySchema),
|
|
39
|
+
}),
|
|
40
|
+
]));
|
|
41
|
+
export const FeatureSchema = z.object({
|
|
42
|
+
type: z.literal("Feature"),
|
|
43
|
+
geometry: GeometrySchema,
|
|
44
|
+
properties: z.record(z.string(), z.any()).optional(),
|
|
45
|
+
id: z.union([z.string(), z.number()]).optional(),
|
|
46
|
+
});
|
|
47
|
+
export const FeatureCollectionSchema = z.object({
|
|
48
|
+
type: z.literal("FeatureCollection"),
|
|
49
|
+
features: z.array(FeatureSchema),
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=geojson.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitraffic/common",
|
|
3
|
-
"version": "2025.
|
|
3
|
+
"version": "2025.10.16-1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -106,15 +106,15 @@
|
|
|
106
106
|
"./dist/aws/runtime/digitraffic-integration-response": "./dist/aws/runtime/digitraffic-integration-response.js"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@aws-sdk/client-api-gateway": "^3.
|
|
110
|
-
"@aws-sdk/client-s3": "^3.
|
|
111
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
112
|
-
"@aws-sdk/client-sns": "^3.
|
|
113
|
-
"@aws-sdk/lib-storage": "^3.
|
|
109
|
+
"@aws-sdk/client-api-gateway": "^3.896.0",
|
|
110
|
+
"@aws-sdk/client-s3": "^3.896.0",
|
|
111
|
+
"@aws-sdk/client-secrets-manager": "^3.896.0",
|
|
112
|
+
"@aws-sdk/client-sns": "^3.896.0",
|
|
113
|
+
"@aws-sdk/lib-storage": "^3.896.0",
|
|
114
114
|
"@date-fns/tz": "^1.4.1",
|
|
115
115
|
"@smithy/fetch-http-handler": "^5.2.1",
|
|
116
116
|
"@smithy/node-http-handler": "^4.2.1",
|
|
117
|
-
"aws-cdk-lib": "^2.
|
|
117
|
+
"aws-cdk-lib": "^2.217.0",
|
|
118
118
|
"change-case": "^5.4.4",
|
|
119
119
|
"constructs": "^10.4.2",
|
|
120
120
|
"date-fns": "^4.1.0",
|
|
@@ -127,11 +127,11 @@
|
|
|
127
127
|
"zod": "^3.25.76"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
|
-
"@aws-sdk/client-api-gateway": "^3.
|
|
131
|
-
"@aws-sdk/client-s3": "^3.
|
|
132
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
133
|
-
"@aws-sdk/client-sns": "^3.
|
|
134
|
-
"@aws-sdk/lib-storage": "^3.
|
|
130
|
+
"@aws-sdk/client-api-gateway": "^3.896.0",
|
|
131
|
+
"@aws-sdk/client-s3": "^3.896.0",
|
|
132
|
+
"@aws-sdk/client-secrets-manager": "^3.896.0",
|
|
133
|
+
"@aws-sdk/client-sns": "^3.896.0",
|
|
134
|
+
"@aws-sdk/lib-storage": "^3.896.0",
|
|
135
135
|
"@date-fns/tz": "^1.4.1",
|
|
136
136
|
"@digitraffic/eslint-config": "^3.2.5",
|
|
137
137
|
"@jest/globals": "^30.1.2",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"@types/node": "22.18.1",
|
|
153
153
|
"@typescript-eslint/eslint-plugin": "^8.44.1",
|
|
154
154
|
"@typescript-eslint/parser": "^8.44.1",
|
|
155
|
-
"aws-cdk-lib": "^2.
|
|
155
|
+
"aws-cdk-lib": "^2.217.0",
|
|
156
156
|
"aws-sdk": "^2.1692.0",
|
|
157
157
|
"change-case": "^5.4.4",
|
|
158
158
|
"constructs": "^10.4.2",
|