diff --git a/CHANGELOG.md b/CHANGELOG.md index 660beb8..9fdf57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ ## Version History +### v5.1.0 + +- :tada: Add optional config parameter with `map` feature for modifying features with full `Geometry` context + ### v5.0.0 - :tada: Support the `format` tag in the Schema for Dates diff --git a/dist/cli.js b/dist/cli.js old mode 100755 new mode 100644 diff --git a/dist/index.js b/dist/index.js index 38fdef1..0dfcbd5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -65,13 +65,18 @@ export default class EsriDump extends EventEmitter { this.emit('error', err); } } - async fetch() { + async fetch(config) { + if (!config) + config = {}; const metadata = await this.#fetchMeta(); try { const geom = new Geometry(this.url, metadata); geom.fetch(this.config); geom.on('feature', (feature) => { - this.emit('feature', rewind(feature)); + feature = rewind(feature); + if (config.map) + feature = config.map(geom, feature); + this.emit('feature', feature); }).on('error', (error) => { this.emit('error', error); }).on('done', () => { @@ -133,4 +138,5 @@ export default class EsriDump extends EventEmitter { return metadata; } } +export { Geometry }; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map index 9b34d62..02a5014 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,YAAY,MAAM,aAAa,CAAC;AAEvC,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAKrC,MAAM,SAAS,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;AAEjD,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,uCAAa,CAAA;IAC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,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,qCAAqC,GAAG,GAAG,CAAC,CAAC,CAAC;SAC9F;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC;QAEtC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;SAChE;aAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,gCAAgC,CAAC,CAAC,CAAC;SACnF;aAAM,IAAI,WAAW,IAAI,QAAQ,IAAI,QAAQ,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACjE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,gCAAgC,CAAC,CAAC,CAAC;SACnF;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED,OAAO,EACH,QAAQ,EACX,CAAA"} \ No newline at end of file diff --git a/index.ts b/index.ts index ed4b9f8..b1f77a7 100644 --- a/index.ts +++ b/index.ts @@ -89,7 +89,10 @@ export default class EsriDump extends EventEmitter { } } - async fetch() { + async fetch(config?: { + map?: (g: Geometry, f: Feature) => Feature + }) { + if (!config) config = {}; const metadata = await this.#fetchMeta(); try { @@ -97,7 +100,9 @@ export default class EsriDump extends EventEmitter { geom.fetch(this.config); geom.on('feature', (feature: Feature) => { - this.emit('feature', rewind(feature)); + feature = rewind(feature) as Feature; + if (config.map) feature = config.map(geom, feature); + this.emit('feature', feature); }).on('error', (error: Err) => { this.emit('error', error); }).on('done', () => { @@ -160,3 +165,8 @@ export default class EsriDump extends EventEmitter { return metadata; } } + +export { + Geometry +} + diff --git a/test/schema.test.ts b/test/schema.test.ts index d6195b2..4730062 100644 --- a/test/schema.test.ts +++ b/test/schema.test.ts @@ -17,12 +17,12 @@ test('FeatureServer Schema', async (t) => { objectid: { type: 'number' }, rotation: { type: 'integer' }, description: { type: 'string', maxLength: 75 }, - eventdate: { type: 'string', maxLength: 8 }, + eventdate: { type: 'string', format: 'date-time', maxLength: 8 }, eventtype: { type: 'integer' }, created_user: { type: 'string', maxLength: 255 }, - created_date: { type: 'string', maxLength: 8 }, + created_date: { type: 'string', format: 'date-time', maxLength: 8 }, last_edited_user: { type: 'string', maxLength: 255 }, - last_edited_date: { type: 'string', maxLength: 8 } + last_edited_date: { type: 'string', format: 'date-time', maxLength: 8 } } });