@map-colonies/mc-utils 3.4.0 → 3.4.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/dist/files/shapefile/core/chunkBuilder.d.ts.map +1 -1
- package/dist/files/shapefile/core/chunkBuilder.js +8 -2
- package/dist/files/shapefile/core/chunkBuilder.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/validation.d.ts +9 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +13 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunkBuilder.d.ts","sourceRoot":"","sources":["../../../../src/files/shapefile/core/chunkBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chunkBuilder.d.ts","sourceRoot":"","sources":["../../../../src/files/shapefile/core/chunkBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIhD,qBAAa,YAAY;IAKJ,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAU,OAAO,CAAC,UAAU;IAJ3E,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,oBAAoB,CAAS;gBAED,WAAW,EAAE,MAAM,EAAU,UAAU,GAAE,MAAU;IAMvF,IAAW,OAAO,IAAI,MAAM,CAE3B;IAEM,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAaxC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IASlC,KAAK,IAAI,cAAc;IASvB,SAAS,IAAI,IAAI;IAOxB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,iBAAiB;CAM1B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChunkBuilder = void 0;
|
|
4
4
|
const vertices_1 = require("../../../geo/vertices");
|
|
5
|
+
const validation_1 = require("../../../utils/validation");
|
|
5
6
|
class ChunkBuilder {
|
|
6
7
|
maxVertices;
|
|
7
8
|
chunkIndex;
|
|
@@ -50,10 +51,15 @@ class ChunkBuilder {
|
|
|
50
51
|
this.chunkIndex++;
|
|
51
52
|
}
|
|
52
53
|
withinSkipped(feature) {
|
|
53
|
-
|
|
54
|
+
const featureId = validation_1.featurePropertiesSchema.safeParse(feature.properties).data?.id;
|
|
55
|
+
return this.skippedFeatures.some((skipped) => {
|
|
56
|
+
const skippedId = validation_1.featurePropertiesSchema.safeParse(skipped.properties).data?.id;
|
|
57
|
+
return skippedId === featureId;
|
|
58
|
+
});
|
|
54
59
|
}
|
|
55
60
|
validateFeatureId(feature) {
|
|
56
|
-
|
|
61
|
+
const parsed = validation_1.featurePropertiesSchema.safeParse(feature.properties);
|
|
62
|
+
if (!parsed.success) {
|
|
57
63
|
throw new Error('Feature must have an id');
|
|
58
64
|
}
|
|
59
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunkBuilder.js","sourceRoot":"","sources":["../../../../src/files/shapefile/core/chunkBuilder.ts"],"names":[],"mappings":";;;AAEA,oDAAsD;
|
|
1
|
+
{"version":3,"file":"chunkBuilder.js","sourceRoot":"","sources":["../../../../src/files/shapefile/core/chunkBuilder.ts"],"names":[],"mappings":";;;AAEA,oDAAsD;AACtD,0DAAoE;AAEpE,MAAa,YAAY;IAKa;IAA6B;IAJzD,QAAQ,CAAY;IACpB,eAAe,CAAY;IAC3B,oBAAoB,CAAS;IAErC,YAAoC,WAAmB,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CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAEO,aAAa,CAAC,OAAgB;QACpC,MAAM,SAAS,GAAG,oCAAuB,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACjF,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3C,MAAM,SAAS,GAAG,oCAAuB,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACjF,OAAO,SAAS,KAAK,SAAS,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,OAAgB;QACxC,MAAM,MAAM,GAAG,oCAAuB,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC5C;IACH,CAAC;CACF;AAnED,oCAmEC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./timeout"), exports);
|
|
18
|
+
__exportStar(require("./validation"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,+CAA6B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const featurePropertiesSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
4
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
5
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
6
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
7
|
+
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
8
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
9
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,uBAAuB;;;;;;gCAOpB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.featurePropertiesSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.featurePropertiesSchema = zod_1.default
|
|
9
|
+
.object({
|
|
10
|
+
id: zod_1.default.string().or(zod_1.default.number()).describe('Feature ID'),
|
|
11
|
+
}, { message: 'error(ShapeFileReader): Feature must have an id' })
|
|
12
|
+
.passthrough();
|
|
13
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEP,QAAA,uBAAuB,GAAG,aAAC;KACrC,MAAM,CACL;IACE,EAAE,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,aAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC;CACrD,EACD,EAAE,OAAO,EAAE,iDAAiD,EAAE,CAC/D;KACA,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@map-colonies/mc-utils",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "This is template for map colonies typescript packages",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
"http-status-codes": "^2.2.0",
|
|
74
74
|
"lodash": "^4.17.21",
|
|
75
75
|
"ngeohash": "^0.6.3",
|
|
76
|
-
"shapefile": "^0.6.6"
|
|
76
|
+
"shapefile": "^0.6.6",
|
|
77
|
+
"zod": "^3.24.1"
|
|
77
78
|
},
|
|
78
79
|
"peerDependencies": {
|
|
79
80
|
"@map-colonies/error-types": "^1.3.1",
|