diff --git a/api/lib/sprites.ts b/api/lib/sprites.ts index 9e0f0a567..998bc71fa 100644 --- a/api/lib/sprites.ts +++ b/api/lib/sprites.ts @@ -8,6 +8,7 @@ const SpriteSmith = promisify(spritesmith.run); type SpriteConfig = { name?: string; + useDataAlt?: boolean; }; export default async function(icons: Array>, config: SpriteConfig = {}) { @@ -16,7 +17,7 @@ export default async function(icons: Array>, config: return new Vinyl({ // @ts-expect-error Deal with indexing issue on icon path: config.name ? icon[config.name] + '.png' : icon.path.replace(/.*?\//, ''), - contents: Buffer.from(icon.data, 'base64'), + contents: Buffer.from(config.useDataAlt && icon.data_alt ? icon.data_alt : icon.data, 'base64'), }) }) }); diff --git a/api/package-lock.json b/api/package-lock.json index 6b64425e8..037af0bb0 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -361,9 +361,9 @@ } }, "node_modules/@aws-sdk/client-cloudformation": { - "version": "3.672.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-cloudformation/-/client-cloudformation-3.672.0.tgz", - "integrity": "sha512-PsQ+Qg/3fGz7oI+zrN+kBGkpGrZ20tWCA/sUqyfDIroBFpmQ1YqxeQT4mFD7u57QB42Pbhm2k15+lH4j8hdTPQ==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cloudformation/-/client-cloudformation-3.674.0.tgz", + "integrity": "sha512-K2/U5p2qF57qL+KZ2R1sQ7qdCWVnKbZMNA+2NqqS46XUIq4Ve6Y+192SskXAHXjgHPWf8U6CXxrvKd59R1RQ6g==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", @@ -407,6 +407,7 @@ "@smithy/util-retry": "^3.0.7", "@smithy/util-utf8": "^3.0.0", "@smithy/util-waiter": "^3.1.6", + "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" }, @@ -469,9 +470,9 @@ } }, "node_modules/@aws-sdk/client-cloudwatch-logs": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-cloudwatch-logs/-/client-cloudwatch-logs-3.670.0.tgz", - "integrity": "sha512-5EARAsAH01rxrSr3/L0nHiupQWrkJs2K0NvSFlajEOjEwa08gQZHMrTnASaRc8VazIU73y63ddjxHR+Fk4Xhng==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cloudwatch-logs/-/client-cloudwatch-logs-3.674.0.tgz", + "integrity": "sha512-wnrp9IB2J0pf4IeVCfG9XnLzr02ZZyzrUMX/9O716PP/+EdKYocrqnySMniaVHAjpvw5fdLRjPXTmkhPEb9Ymw==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", @@ -517,6 +518,7 @@ "@smithy/util-middleware": "^3.0.7", "@smithy/util-retry": "^3.0.7", "@smithy/util-utf8": "^3.0.0", + "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" }, @@ -525,9 +527,9 @@ } }, "node_modules/@aws-sdk/client-dynamodb": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.670.0.tgz", - "integrity": "sha512-K0VAFpHzVnAgAxUb8z7/93WsyNx1v296VhVmYsIYZW1judLpAyWYW0EWaKkVb52X2r7khm8q1PtGtykRNiFAzQ==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.674.0.tgz", + "integrity": "sha512-LLLIOPpal6ZxS/4pSTDLtvHmteRQZBt8NyHNV7FsYsCsQhwIzDpl0zVEQ7V1pLmXdrs72dfUuFjpvJHXB6faXw==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", @@ -572,6 +574,7 @@ "@smithy/util-retry": "^3.0.7", "@smithy/util-utf8": "^3.0.0", "@smithy/util-waiter": "^3.1.6", + "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" }, @@ -580,9 +583,9 @@ } }, "node_modules/@aws-sdk/client-ec2": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-ec2/-/client-ec2-3.670.0.tgz", - "integrity": "sha512-e19jbRUEJ/1HPxmS0V0mByyfzjdXak/pzuenkmiusYtKPTTfIPo+APfjNW6cwhj9LrVFgcIYxuIX2E2CYKFRtw==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-ec2/-/client-ec2-3.674.0.tgz", + "integrity": "sha512-EnbAechu9WGtqHU834pi/sMPI5W29barWDAIPxkPEWax8Y8r9gNRjf9HAjhf97Ri3Fd/fK6hzHROPWbZY31bHw==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", @@ -627,6 +630,7 @@ "@smithy/util-retry": "^3.0.7", "@smithy/util-utf8": "^3.0.0", "@smithy/util-waiter": "^3.1.6", + "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" }, @@ -688,9 +692,9 @@ } }, "node_modules/@aws-sdk/client-ecs": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-ecs/-/client-ecs-3.670.0.tgz", - "integrity": "sha512-foTdNseNPdGBXL7pLolGbqVA9VP2ocDJFUKInB2HXO10cv9hCl/x6X2LftDJVEJcQI4ynJxmiDEmQzl3jwsRZQ==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-ecs/-/client-ecs-3.674.0.tgz", + "integrity": "sha512-HViyj8vNniolpsrWo8QuQ0IRNWUbDZXMxFRfKDzUCmVyJ51cLQKkxia5UwyOvGii6OYINNyvFY1bhU61HrgM+w==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -735,6 +739,7 @@ "@smithy/util-retry": "^3.0.7", "@smithy/util-utf8": "^3.0.0", "@smithy/util-waiter": "^3.1.6", + "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" }, @@ -743,9 +748,9 @@ } }, "node_modules/@aws-sdk/client-eventbridge": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-eventbridge/-/client-eventbridge-3.670.0.tgz", - "integrity": "sha512-L/QOkYbW1ld652dwxC6lPh4F6Ni1+RPkzY+PH0r7yIo+hdQs0bPkqdh2FQi+SaSQtEir6hJkOotPVzvUGXSOkA==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-eventbridge/-/client-eventbridge-3.674.0.tgz", + "integrity": "sha512-mdvHRhXDCxNwHtvXurP7m6AfC9bBw/ywydWXDNY5Z2LD7GWoRKaRuuvu33xQT7D5E9gJDaz8qMksmuR7UqCPkQ==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", @@ -759,7 +764,7 @@ "@aws-sdk/middleware-recursion-detection": "3.667.0", "@aws-sdk/middleware-user-agent": "3.669.0", "@aws-sdk/region-config-resolver": "3.667.0", - "@aws-sdk/signature-v4-multi-region": "3.669.0", + "@aws-sdk/signature-v4-multi-region": "3.674.0", "@aws-sdk/types": "3.667.0", "@aws-sdk/util-endpoints": "3.667.0", "@aws-sdk/util-user-agent-browser": "3.670.0", @@ -853,9 +858,9 @@ } }, "node_modules/@aws-sdk/client-s3": { - "version": "3.673.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.673.0.tgz", - "integrity": "sha512-GREQlgG13Jveu9I+4pH2wfxHnl8TN0geVdUO8vOh6VbudmtfdC8hXUuMiTMX7VZ6c4zyOFStzBwysUv0Ze7kFg==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.674.0.tgz", + "integrity": "sha512-/pbAGFXUFqhZPrb4vACYdJzAc/lX/MPW1sxRoiX46BVjvpT7QkYwRjlzuifskLyDf2TjkGNsXu+F6AgPGCXFUg==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha1-browser": "5.2.0", @@ -872,11 +877,11 @@ "@aws-sdk/middleware-location-constraint": "3.667.0", "@aws-sdk/middleware-logger": "3.667.0", "@aws-sdk/middleware-recursion-detection": "3.667.0", - "@aws-sdk/middleware-sdk-s3": "3.669.0", + "@aws-sdk/middleware-sdk-s3": "3.674.0", "@aws-sdk/middleware-ssec": "3.667.0", "@aws-sdk/middleware-user-agent": "3.669.0", "@aws-sdk/region-config-resolver": "3.667.0", - "@aws-sdk/signature-v4-multi-region": "3.669.0", + "@aws-sdk/signature-v4-multi-region": "3.674.0", "@aws-sdk/types": "3.667.0", "@aws-sdk/util-endpoints": "3.667.0", "@aws-sdk/util-user-agent-browser": "3.670.0", @@ -922,9 +927,9 @@ } }, "node_modules/@aws-sdk/client-secrets-manager": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-secrets-manager/-/client-secrets-manager-3.670.0.tgz", - "integrity": "sha512-O5M94wRBqvGuD2+atCTWPFZfCvsRAMOV96ftw6Mje/Ug375dC4aLc/FvsG9YQGiuGbzhzu02hOIOiGvnJqxj4A==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-secrets-manager/-/client-secrets-manager-3.674.0.tgz", + "integrity": "sha512-emzNqq5CZ1h52oGWBzMIFORgJ3sF2ddnRqXwRGfbFvZchNjMTRm0PbXx9P4gAIA6ZbB5SWMI9wsBRbnVE7J++Q==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", @@ -967,6 +972,7 @@ "@smithy/util-middleware": "^3.0.7", "@smithy/util-retry": "^3.0.7", "@smithy/util-utf8": "^3.0.0", + "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" }, @@ -1380,13 +1386,13 @@ } }, "node_modules/@aws-sdk/lib-dynamodb": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/lib-dynamodb/-/lib-dynamodb-3.670.0.tgz", - "integrity": "sha512-YoySUx1SIy/pfWODeRuv3k5RaOG57ewdINHzuOB6rCQcx1sU6eXu/omHGMkhNCah8xOfwYGeXJ6b3kTI6lHTxg==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/lib-dynamodb/-/lib-dynamodb-3.674.0.tgz", + "integrity": "sha512-Ahy6y2EHeDTqNrLh1YwlgldmJGvsPFO0U839538bdT+Uu1oHlXFBdVUsX/5O/3XESYlDp4STHM/vWmCb4BeosA==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/core": "3.667.0", - "@aws-sdk/util-dynamodb": "3.670.0", + "@aws-sdk/util-dynamodb": "3.674.0", "@smithy/core": "^2.4.8", "@smithy/smithy-client": "^3.4.0", "@smithy/types": "^3.5.0", @@ -1396,13 +1402,13 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-dynamodb": "^3.670.0" + "@aws-sdk/client-dynamodb": "^3.674.0" } }, "node_modules/@aws-sdk/lib-storage": { - "version": "3.673.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/lib-storage/-/lib-storage-3.673.0.tgz", - "integrity": "sha512-KDhCYCEQ7vOQre907TFTzA7cSoMOetSavAwSc2Xk550oBgw6LmPeWf2OsWyeScGaASdqZ/ZhpQSiasQo8KcILg==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/lib-storage/-/lib-storage-3.674.0.tgz", + "integrity": "sha512-66mSM4pp0Z6O2pLP/b5veFSIMpvR/7/c0f75RSDweE0VV2kr3WOr8uZYxY6jYkjj6CDYaN0PGhLJXt2vdfxRng==", "license": "Apache-2.0", "dependencies": { "@smithy/abort-controller": "^3.1.5", @@ -1417,7 +1423,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-s3": "^3.673.0" + "@aws-sdk/client-s3": "^3.674.0" } }, "node_modules/@aws-sdk/middleware-bucket-endpoint": { @@ -1570,9 +1576,9 @@ } }, "node_modules/@aws-sdk/middleware-sdk-s3": { - "version": "3.669.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.669.0.tgz", - "integrity": "sha512-b2QUQ7DcIcVCUFhvmFEDI90BemvQhO0ntIajllLqQSy88PSNdLDCVx5mIzfxaaK/1tdY/UsEDRRm1kMQHJDQpg==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.674.0.tgz", + "integrity": "sha512-IvXnWrKy4mO+I44kLYHd6Wlw+FdB4sg1jvHCmnZo1KNaAFIA3x1iXgOaZynKoBdEmol3xfr2uDbeXUQvIwoIgg==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/core": "3.667.0", @@ -1661,12 +1667,12 @@ } }, "node_modules/@aws-sdk/signature-v4-multi-region": { - "version": "3.669.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.669.0.tgz", - "integrity": "sha512-TVwlWAxfBHnFjnfTBQWUhzVJzjwVhkq1+KR0JZV7JrfqeyBOdZjAaV9ie3VNY9HUouecq1fDuKaSwe4JiWQsHg==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.674.0.tgz", + "integrity": "sha512-VMQWbtcbg4FV/fILrODADV21pPg9AghuEzQlW2kH0hCtacvBwFl7eBxIiCBLLtkNple+CVPJvyBcqOZdBkEv/w==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/middleware-sdk-s3": "3.669.0", + "@aws-sdk/middleware-sdk-s3": "3.674.0", "@aws-sdk/types": "3.667.0", "@smithy/protocol-http": "^4.1.4", "@smithy/signature-v4": "^4.2.0", @@ -1722,9 +1728,9 @@ } }, "node_modules/@aws-sdk/util-dynamodb": { - "version": "3.670.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.670.0.tgz", - "integrity": "sha512-d+kb5njjqi5uU4X8O9FTfdOSFisxH9Zi7iyoeSDzo2B+cxYG26uhk5jmLbZ7Usq/h6OQoCsMecWoTQyZU6+VXA==", + "version": "3.674.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.674.0.tgz", + "integrity": "sha512-edxrLzjnc/1VbR0XL955BrJ/W43gk2i4txod2ZXFu1vBfXRz6RFq50J/H4UbkQWsFLxT5S3BALnoAUsJjy7znQ==", "license": "Apache-2.0", "dependencies": { "tslib": "^2.6.2" @@ -1733,7 +1739,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-dynamodb": "^3.670.0" + "@aws-sdk/client-dynamodb": "^3.674.0" } }, "node_modules/@aws-sdk/util-endpoints": { @@ -4968,6 +4974,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/uuid": { + "version": "9.0.8", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", + "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==", + "license": "MIT" + }, "node_modules/@types/vinyl": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.12.tgz", diff --git a/api/routes/connection-layer-cot.ts b/api/routes/connection-layer-cot.ts index 8fe7a79a9..2cca4b0c6 100644 --- a/api/routes/connection-layer-cot.ts +++ b/api/routes/connection-layer-cot.ts @@ -75,7 +75,7 @@ export default async function router(schema: Schema, config: Config) { } const errors: Array> = []; - const cots = []; + let cots = []; for (const feat of req.body.features) { try { cots.push(CoT.from_geojson(feat)) @@ -129,16 +129,17 @@ export default async function router(schema: Schema, config: Config) { existMap.set(String(feat.id), feat); } - - for (const cot of cots) { + cots = cots.filter((cot) => { const exist = existMap.get(cot.uid()); if (exist && data.mission_diff) { const b = CoT.from_geojson(exist); - if (!cot.isDiff(b)) continue; + if (!cot.isDiff(b)) return false; } cot.addDest({ mission: data.name, path: `layer-${layer.id}`, after: '' }); - } + + return true; + }) } else { for (const cot of cots) { cot.addDest({ mission: data.name });