From 93df5bf4c0d900727894e6c276bd705af269b289 Mon Sep 17 00:00:00 2001 From: ingalls Date: Tue, 7 Nov 2023 12:35:34 -0700 Subject: [PATCH] Better date support --- CHANGELOG.md | 5 +++ dist/lib/geometry.js | 27 ++++++++---- dist/lib/geometry.js.map | 2 +- dist/lib/schema.js | 32 +++++++-------- dist/lib/schema.js.map | 2 +- lib/geometry.ts | 33 ++++++++++----- lib/schema.ts | 41 +++++++++---------- package-lock.json | 88 ++++++++++++++++++++-------------------- 8 files changed, 126 insertions(+), 104 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41d213e..660beb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ ## Version History +### v5.0.0 + +- :tada: Support the `format` tag in the Schema for Dates +- :rocket: Return Dates as ISO formatted strings to conform to schema + ### v4.6.2 - :bug: Fix the way headers were appended diff --git a/dist/lib/geometry.js b/dist/lib/geometry.js index 08d038a..705c77e 100644 --- a/dist/lib/geometry.js +++ b/dist/lib/geometry.js @@ -2,6 +2,7 @@ import EventEmitter from 'node:events'; import Err from '@openaddresses/batch-error'; import rings2geojson from './rings2geojson.js'; import Fetch from './fetch.js'; +import Schema from './schema.js'; import { EsriDumpConfigApproach } from '../index.js'; export default class Geometry extends EventEmitter { baseUrl; @@ -10,6 +11,7 @@ export default class Geometry extends EventEmitter { set; oidField; paths; + schema; constructor(url, metadata) { super(); this.baseUrl = url; @@ -18,6 +20,7 @@ export default class Geometry extends EventEmitter { this.maxRecords = metadata.maxRecordCount || null; this.set = new Set(); this.oidField = Geometry.findOidField(metadata.fields); + this.schema = Schema(metadata); } async fetch(config) { try { @@ -150,19 +153,27 @@ export default class Geometry extends EventEmitter { this.emit('done'); } toGeoJSON(esrifeature) { + const id = esrifeature.attributes[this.oidField]; + const type = 'Feature'; + const properties = {}; + for (const prop in esrifeature.attributes) { + const schema = this.schema.properties[prop]; + if (typeof schema !== 'boolean' && schema.format === 'date-time') { + properties[prop] = new Date(esrifeature.attributes[prop]).toISOString(); + } + else { + properties[prop] = esrifeature.attributes[prop]; + } + } if (this.geomType === 'esriGeometryPolygon') { return { - id: esrifeature.attributes[this.oidField], - type: 'Feature', - properties: esrifeature.attributes, + id, type, properties, geometry: rings2geojson(esrifeature.geometry.rings) }; } else if (this.geomType === 'esriGeometryPolyline') { return { - id: esrifeature.attributes[this.oidField], - type: 'Feature', - properties: esrifeature.attributes, + id, type, properties, geometry: { type: 'MultiLineString', coordinates: esrifeature.geometry.paths @@ -171,9 +182,7 @@ export default class Geometry extends EventEmitter { } else if (this.geomType === 'esriGeometryPoint') { return { - id: esrifeature.attributes[this.oidField], - type: 'Feature', - properties: esrifeature.attributes, + id, type, properties, geometry: { type: 'Point', coordinates: [esrifeature.geometry.x, esrifeature.geometry.y] diff --git a/dist/lib/geometry.js.map b/dist/lib/geometry.js.map index d6a6bba..4858d82 100644 --- a/dist/lib/geometry.js.map +++ b/dist/lib/geometry.js.map @@ -1 +1 @@ -{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../lib/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAC7C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,EAEH,sBAAsB,EACzB,MAAM,aAAa,CAAC;AAgBrB,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAC9C,OAAO,CAAM;IACb,QAAQ,CAAS;IACjB,UAAU,CAAgB;IAC1B,GAAG,CAAc;IACjB,QAAQ,CAAS;IACjB,KAAK,CAAQ;IAEb,YAAY,GAAQ,EAAE,QAAa;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,CAAC,QAAQ,CAAC,MAAc,CAAC,CAAC;QAEvC,IAAI,CAAC,QAAQ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IAAI,EAAE,qCAAqC,CAAC,CAAC;aACnE;SACJ;IACL,CAAC;CACJ"} \ No newline at end of file diff --git a/dist/lib/schema.js b/dist/lib/schema.js index 2fe3d2e..44d2abf 100644 --- a/dist/lib/schema.js +++ b/dist/lib/schema.js @@ -1,18 +1,18 @@ // Ref: https://help.arcgis.com/en/sdk/10.0/java_ao_adf/api/arcgiswebservices/com/esri/arcgisws/EsriFieldType.html const Types = new Map([ - ['esriFieldTypeDate', 'string'], - ['esriFieldTypeString', 'string'], - ['esriFieldTypeDouble', 'number'], - ['esriFieldTypeSingle', 'number'], - ['esriFieldTypeOID', 'number'], - ['esriFieldTypeInteger', 'integer'], - ['esriFieldTypeSmallInteger', 'integer'], - ['esriFieldTypeGeometry', 'object'], - ['esriFieldTypeBlob', 'object'], - ['esriFieldTypeGlobalID', 'string'], - ['esriFieldTypeRaster', 'object'], - ['esriFieldTypeGUID', 'string'], - ['esriFieldTypeXML', 'string'], + ['esriFieldTypeDate', { type: 'string', format: 'date-time' }], + ['esriFieldTypeString', { type: 'string' }], + ['esriFieldTypeDouble', { type: 'number' }], + ['esriFieldTypeSingle', { type: 'number' }], + ['esriFieldTypeOID', { type: 'number' }], + ['esriFieldTypeInteger', { type: 'integer' }], + ['esriFieldTypeSmallInteger', { type: 'integer' }], + ['esriFieldTypeGeometry', { type: 'object' }], + ['esriFieldTypeBlob', { type: 'object' }], + ['esriFieldTypeGlobalID', { type: 'string' }], + ['esriFieldTypeRaster', { type: 'object' }], + ['esriFieldTypeGUID', { type: 'string' }], + ['esriFieldTypeXML', { type: 'string' }], ]); export default function FieldToSchema(metadata) { const doc = { @@ -26,11 +26,11 @@ export default function FieldToSchema(metadata) { } for (const field of metadata.fields) { const name = String(field.name); - const type = Types.has(field.type) ? Types.get(field.type) : 'string'; + const type = Types.has(field.type) ? Types.get(field.type) : { type: 'string' }; const prop = doc.properties[name] = { - type + ...JSON.parse(JSON.stringify(type)) }; - if (!isNaN(field.length) && type === 'string') { + if (!isNaN(field.length) && type.type === 'string') { prop.maxLength = field.length; } } diff --git a/dist/lib/schema.js.map b/dist/lib/schema.js.map index cd7b0b8..5710871 100644 --- a/dist/lib/schema.js.map +++ b/dist/lib/schema.js.map @@ -1 +1 @@ -{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../lib/schema.ts"],"names":[],"mappings":"AAKA,kHAAkH;AAClH,MAAM,KAAK,GAAqC,IAAI,GAAG,CAAC;IACpD,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/B,CAAC,qBAAqB,EAAE,QAAQ,CAAC;IACjC,CAAC,qBAAqB,EAAE,QAAQ,CAAC;IACjC,CAAC,qBAAqB,EAAE,QAAQ,CAAC;IACjC,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9B,CAAC,sBAAsB,EAAE,SAAS,CAAC;IACnC,CAAC,2BAA2B,EAAE,SAAS,CAAC;IACxC,CAAC,uBAAuB,EAAE,QAAQ,CAAC;IACnC,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/B,CAAC,uBAAuB,EAAE,QAAQ,CAAC;IACnC,CAAC,qBAAqB,EAAE,QAAQ,CAAC;IACjC,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/B,CAAC,kBAAkB,EAAE,QAAQ,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,QAAa;IAC/C,MAAM,GAAG,GAAgB;QACrB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,EAAE;QACZ,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE,EAAE;KACjB,CAAA;IAED,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACrD,OAAO,GAAG,CAAC;KACd;IAED,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE;QACjC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,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AC"} \ No newline at end of file diff --git a/lib/geometry.ts b/lib/geometry.ts index 46c4ddd..9a39cac 100644 --- a/lib/geometry.ts +++ b/lib/geometry.ts @@ -2,7 +2,9 @@ import EventEmitter from 'node:events'; import Err from '@openaddresses/batch-error'; import rings2geojson from './rings2geojson.js'; import Fetch from './fetch.js'; -import { Feature } from 'geojson'; +import { Feature, GeoJsonProperties } from 'geojson'; +import Schema from './schema.js' +import { JSONSchema6, JSONSchema6Definition } from 'json-schema'; import { EsriDumpConfig, EsriDumpConfigApproach @@ -28,7 +30,8 @@ export default class Geometry extends EventEmitter { maxRecords: null | number; set: Set; oidField: string; - paths: Path[] + paths: Path[]; + schema: JSONSchema6; constructor(url: URL, metadata: any) { super(); @@ -40,6 +43,7 @@ export default class Geometry extends EventEmitter { this.maxRecords = metadata.maxRecordCount || null; this.set = new Set(); this.oidField = Geometry.findOidField(metadata.fields); + this.schema = Schema(metadata); } async fetch(config: EsriDumpConfig) { @@ -182,18 +186,27 @@ export default class Geometry extends EventEmitter { } toGeoJSON(esrifeature: any): Feature { + const id = esrifeature.attributes[this.oidField]; + const type = 'Feature'; + const properties: GeoJsonProperties = {} + for (const prop in esrifeature.attributes) { + const schema: JSONSchema6Definition = this.schema.properties[prop]; + + if (typeof schema !== 'boolean' && schema.format === 'date-time') { + properties[prop] = new Date(esrifeature.attributes[prop]).toISOString(); + } else { + properties[prop] = esrifeature.attributes[prop]; + } + } + if (this.geomType === 'esriGeometryPolygon') { return { - id: esrifeature.attributes[this.oidField], - type: 'Feature', - properties: esrifeature.attributes, + id, type, properties, geometry: rings2geojson(esrifeature.geometry.rings) }; } else if (this.geomType === 'esriGeometryPolyline') { return { - id: esrifeature.attributes[this.oidField], - type: 'Feature', - properties: esrifeature.attributes, + id, type, properties, geometry: { type: 'MultiLineString', coordinates: esrifeature.geometry.paths @@ -201,9 +214,7 @@ export default class Geometry extends EventEmitter { }; } else if (this.geomType === 'esriGeometryPoint') { return { - id: esrifeature.attributes[this.oidField], - type: 'Feature', - properties: esrifeature.attributes, + id, type, properties, geometry: { type: 'Point', coordinates: [esrifeature.geometry.x, esrifeature.geometry.y] diff --git a/lib/schema.ts b/lib/schema.ts index 30cebb6..e50eb43 100644 --- a/lib/schema.ts +++ b/lib/schema.ts @@ -1,26 +1,23 @@ -import { - JSONSchema6, - JSONSchema6TypeName -} from 'json-schema'; +import { JSONSchema6 } from 'json-schema'; // Ref: https://help.arcgis.com/en/sdk/10.0/java_ao_adf/api/arcgiswebservices/com/esri/arcgisws/EsriFieldType.html -const Types: Map = new Map([ - ['esriFieldTypeDate', 'string'], - ['esriFieldTypeString', 'string'], - ['esriFieldTypeDouble', 'number'], - ['esriFieldTypeSingle', 'number'], - ['esriFieldTypeOID', 'number'], - ['esriFieldTypeInteger', 'integer'], - ['esriFieldTypeSmallInteger', 'integer'], - ['esriFieldTypeGeometry', 'object'], - ['esriFieldTypeBlob', 'object'], - ['esriFieldTypeGlobalID', 'string'], - ['esriFieldTypeRaster', 'object'], - ['esriFieldTypeGUID', 'string'], - ['esriFieldTypeXML', 'string'], +const Types: Map = new Map([ + ['esriFieldTypeDate', { type: 'string', format: 'date-time' }], + ['esriFieldTypeString', { type: 'string' }], + ['esriFieldTypeDouble', { type: 'number' }], + ['esriFieldTypeSingle', { type: 'number' }], + ['esriFieldTypeOID', { type: 'number' }], + ['esriFieldTypeInteger', { type: 'integer' }], + ['esriFieldTypeSmallInteger', { type: 'integer' }], + ['esriFieldTypeGeometry', { type: 'object' }], + ['esriFieldTypeBlob', { type: 'object' }], + ['esriFieldTypeGlobalID', { type: 'string' }], + ['esriFieldTypeRaster', { type: 'object' }], + ['esriFieldTypeGUID', { type: 'string' }], + ['esriFieldTypeXML', { type: 'string' }], ]); -export default function FieldToSchema(metadata: any) { +export default function FieldToSchema(metadata: any): JSONSchema6 { const doc: JSONSchema6 = { type: 'object', required: [], @@ -35,13 +32,13 @@ export default function FieldToSchema(metadata: any) { for (const field of metadata.fields) { const name = String(field.name); - const type: JSONSchema6TypeName = Types.has(field.type) ? Types.get(field.type) : 'string'; + const type: JSONSchema6 = Types.has(field.type) ? Types.get(field.type) : { type: 'string' }; const prop: JSONSchema6 = doc.properties[name] = { - type + ...JSON.parse(JSON.stringify(type)) } - if (!isNaN(field.length) && type === 'string') { + if (!isNaN(field.length) && type.type === 'string') { prop.maxLength = field.length; } } diff --git a/package-lock.json b/package-lock.json index 33de58e..4fc3aec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "esri-dump", - "version": "4.6.0", + "version": "4.6.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "esri-dump", - "version": "4.6.0", + "version": "4.6.2", "license": "MIT", "dependencies": { "@openaddresses/batch-error": "^2.2.0", @@ -261,26 +261,26 @@ "dev": true }, "node_modules/@types/body-parser": { - "version": "1.19.4", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.4.tgz", - "integrity": "sha512-N7UDG0/xiPQa2D/XrVJXjkWbpqHCd2sBaB32ggRF2l83RhPfamgKGF8gwwqyksS95qUS5ZYF9aF+lLPRlwI2UA==", + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "node_modules/@types/connect": { - "version": "3.4.37", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.37.tgz", - "integrity": "sha512-zBUSRqkfZ59OcwXon4HVxhx5oWCJmc0OtBTK05M+p0dYjgN6iTwIL2T/WbsQZrEsdnwaF9cWQ+azOnpPvIqY3Q==", + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", "dependencies": { "@types/node": "*" } }, "node_modules/@types/express": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.20.tgz", - "integrity": "sha512-rOaqlkgEvOW495xErXMsmyX3WKBInbhG5eqojXYi3cGUaLoRDlXa5d52fkfWZT963AZ3v2eZ4MbKE6WpDAGVsw==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -289,9 +289,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "4.17.40", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.40.tgz", - "integrity": "sha512-dzQWNQktgK3AyMpPeIeWbnR/ve2wU0bDSfdhf+RSt1ivelrO3hwfrKjTZvJDK4IyGWlDoRj+knNSePnL7OUqOA==", + "version": "4.17.41", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz", + "integrity": "sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==", "dependencies": { "@types/node": "*", "@types/qs": "*", @@ -300,20 +300,20 @@ } }, "node_modules/@types/geojson": { - "version": "7946.0.12", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.12.tgz", - "integrity": "sha512-uK2z1ZHJyC0nQRbuovXFt4mzXDwf27vQeUWNhfKGwRcWW429GOhP8HxUHlM6TLH4bzmlv/HlEjpvJh3JfmGsAA==", + "version": "7946.0.13", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.13.tgz", + "integrity": "sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ==", "dev": true }, "node_modules/@types/http-errors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.3.tgz", - "integrity": "sha512-pP0P/9BnCj1OVvQR2lF41EkDG/lWWnDyA203b/4Fmi2eTyORnBtcDoKDwjWQthELrBvWkMOrvSOnZ8OVlW6tXA==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==" }, "node_modules/@types/json-schema": { - "version": "7.0.14", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", - "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==" + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, "node_modules/@types/mime": { "version": "1.3.4", @@ -321,9 +321,9 @@ "integrity": "sha512-1Gjee59G25MrQGk8bsNvC6fxNiRgUlGn2wlhGf95a59DrprnnHk80FIMMFG9XHMdrfsuA119ht06QPDXA1Z7tw==" }, "node_modules/@types/minimist": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.4.tgz", - "integrity": "sha512-Kfe/D3hxHTusnPNRbycJE1N77WHDsdS4AjUYIzlDzhDrS47NrwuL3YW4VITxwR7KCVpzwgy4Rbj829KSSQmwXQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", "dev": true }, "node_modules/@types/node": { @@ -335,14 +335,14 @@ } }, "node_modules/@types/qs": { - "version": "6.9.9", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.9.tgz", - "integrity": "sha512-wYLxw35euwqGvTDx6zfY1vokBFnsK0HNrzc6xNHchxfO2hpuRg74GbkEW7e3sSmPvj0TjCDT1VCa6OtHXnubsg==" + "version": "6.9.10", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.10.tgz", + "integrity": "sha512-3Gnx08Ns1sEoCrWssEgTSJs/rsT2vhGP+Ja9cnnk9k4ALxinORlQneLXFeFKOTJMOeZUFD1s7w+w2AphTpvzZw==" }, "node_modules/@types/range-parser": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.6.tgz", - "integrity": "sha512-+0autS93xyXizIYiyL02FCY8N+KkKPhILhcUSA276HxzreZ16kl+cmwvV2qAM/PuCCwPXzOXOWhiPcw20uSFcA==" + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==" }, "node_modules/@types/semver": { "version": "7.5.4", @@ -351,18 +351,18 @@ "dev": true }, "node_modules/@types/send": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.3.tgz", - "integrity": "sha512-/7fKxvKUoETxjFUsuFlPB9YndePpxxRAOfGC/yJdc9kTjTeP5kRCTzfnE8kPUKCeyiyIZu0YQ76s50hCedI1ug==", + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", "dependencies": { "@types/mime": "^1", "@types/node": "*" } }, "node_modules/@types/serve-static": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.4.tgz", - "integrity": "sha512-aqqNfs1XTF0HDrFdlY//+SGUxmdSUbjeRXb5iaZc3x0/vMbYmdw9qvOgHWOyyLFxSSRnUuP5+724zBgfw8/WAw==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.5.tgz", + "integrity": "sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==", "dependencies": { "@types/http-errors": "*", "@types/mime": "*", @@ -370,9 +370,9 @@ } }, "node_modules/@types/tape": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/@types/tape/-/tape-5.6.3.tgz", - "integrity": "sha512-xBqJhHnAw/eDJhSrL4wVbrVc9nQQKq97/jOExJHejzWnuut2qo8rx/xSx/YA4zeCO0+iC86Cti07Ahs8FhHRvQ==", + "version": "5.6.4", + "resolved": "https://registry.npmjs.org/@types/tape/-/tape-5.6.4.tgz", + "integrity": "sha512-EmL4fJpZyByNCkupLLcJhneqcnT+rQUG5fWKNCsZyBK1x7nUuDTwwEerc4biEMZgvSK2+FXr775aLeXhKXK4Yw==", "dev": true, "dependencies": { "@types/node": "*", @@ -380,9 +380,9 @@ } }, "node_modules/@types/through": { - "version": "0.0.32", - "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.32.tgz", - "integrity": "sha512-7XsfXIsjdfJM2wFDRAtEWp3zb2aVPk5QeyZxGlVK57q4u26DczMHhJmlhr0Jqv0THwxam/L8REXkj8M2I/lcvw==", + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.33.tgz", + "integrity": "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==", "dev": true, "dependencies": { "@types/node": "*"