@ngageoint/mage.service 6.2.9 → 6.2.10-beta.2
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/lib/@types/express/index.d.ts +1 -1
- package/lib/adapters/icons/adapters.icons.db.mongoose.js.map +1 -1
- package/lib/adapters/observations/adapters.observations.controllers.web.js +2 -2
- package/lib/adapters/observations/adapters.observations.controllers.web.js.map +1 -1
- package/lib/adapters/observations/adapters.observations.dto.ecma404-json.d.ts +1 -1
- package/lib/adapters/observations/adapters.observations.dto.ecma404-json.js +1 -1
- package/lib/api/attachment.d.ts +3 -0
- package/lib/api/attachment.d.ts.map +1 -1
- package/lib/api/attachment.js +3 -0
- package/lib/api/attachment.js.map +1 -1
- package/lib/api/icon.d.ts +51 -20
- package/lib/api/icon.js +1 -1
- package/lib/api/icon.js.map +1 -1
- package/lib/api/location.d.ts +1 -3
- package/lib/api/location.d.ts.map +1 -1
- package/lib/app.api/observations/app.api.observations.js +1 -1
- package/lib/app.api/observations/app.api.observations.js.map +1 -1
- package/lib/app.d.ts +2 -2
- package/lib/app.d.ts.map +1 -1
- package/lib/app.impl/observations/app.impl.observations.d.ts.map +1 -1
- package/lib/app.impl/observations/app.impl.observations.js +2 -1
- package/lib/app.impl/observations/app.impl.observations.js.map +1 -1
- package/lib/app.js +5 -3
- package/lib/app.js.map +1 -1
- package/lib/authentication/saml.d.ts.map +1 -1
- package/lib/authentication/saml.js +15 -14
- package/lib/authentication/saml.js.map +1 -1
- package/lib/dist-package.json +45 -45
- package/lib/docs/auth/local.yaml +1 -2
- package/lib/entities/authorization/entities.permissions.d.ts +7 -1
- package/lib/entities/authorization/entities.permissions.d.ts.map +1 -1
- package/lib/entities/authorization/entities.permissions.js +7 -2
- package/lib/entities/authorization/entities.permissions.js.map +1 -1
- package/lib/entities/entities.global.d.ts +6 -0
- package/lib/entities/entities.global.d.ts.map +1 -1
- package/lib/entities/entities.global.js +12 -1
- package/lib/entities/entities.global.js.map +1 -1
- package/lib/entities/events/entities.events.d.ts.map +1 -1
- package/lib/entities/events/entities.events.forms.d.ts +9 -1
- package/lib/entities/events/entities.events.forms.d.ts.map +1 -1
- package/lib/entities/events/entities.events.forms.js +24 -3
- package/lib/entities/events/entities.events.forms.js.map +1 -1
- package/lib/entities/events/entities.events.js.map +1 -1
- package/lib/entities/locations/entities.locations.d.ts +30 -0
- package/lib/entities/locations/entities.locations.d.ts.map +1 -0
- package/lib/entities/locations/entities.locations.js +3 -0
- package/lib/entities/locations/entities.locations.js.map +1 -0
- package/lib/entities/observations/entities.observations.d.ts +4 -4
- package/lib/entities/observations/entities.observations.d.ts.map +1 -1
- package/lib/entities/observations/entities.observations.js +16 -15
- package/lib/entities/observations/entities.observations.js.map +1 -1
- package/lib/environment/env.js +1 -1
- package/lib/environment/env.js.map +1 -1
- package/lib/export/csv.d.ts +19 -9
- package/lib/export/csv.d.ts.map +1 -1
- package/lib/export/csv.js +255 -231
- package/lib/export/csv.js.map +1 -1
- package/lib/export/exporter.d.ts +37 -10
- package/lib/export/exporter.d.ts.map +1 -1
- package/lib/export/exporter.js +67 -35
- package/lib/export/exporter.js.map +1 -1
- package/lib/export/geojson.d.ts +9 -8
- package/lib/export/geojson.d.ts.map +1 -1
- package/lib/export/geojson.js +162 -143
- package/lib/export/geojson.js.map +1 -1
- package/lib/export/geopackage.d.ts +29 -23
- package/lib/export/geopackage.d.ts.map +1 -1
- package/lib/export/geopackage.js +659 -589
- package/lib/export/geopackage.js.map +1 -1
- package/lib/export/index.d.ts +17 -0
- package/lib/export/index.d.ts.map +1 -0
- package/lib/export/index.js +28 -0
- package/lib/export/index.js.map +1 -0
- package/lib/export/kml.d.ts +11 -8
- package/lib/export/kml.d.ts.map +1 -1
- package/lib/export/kml.js +152 -106
- package/lib/export/kml.js.map +1 -1
- package/lib/export/kmlWriter.d.ts +23 -22
- package/lib/export/kmlWriter.d.ts.map +1 -1
- package/lib/export/kmlWriter.js +258 -181
- package/lib/export/kmlWriter.js.map +1 -1
- package/lib/express.js +2 -4
- package/lib/express.js.map +1 -1
- package/lib/migrations/030-saml-settings.d.ts +4 -0
- package/lib/migrations/030-saml-settings.d.ts.map +1 -0
- package/lib/migrations/030-saml-settings.js +96 -0
- package/lib/migrations/030-saml-settings.js.map +1 -0
- package/lib/models/authentication.js +1 -1
- package/lib/models/authenticationconfiguration.js +0 -1
- package/lib/models/authenticationconfiguration.js.map +1 -1
- package/lib/models/event.d.ts +4 -2
- package/lib/models/event.js +1 -1
- package/lib/models/event.js.map +1 -1
- package/lib/models/export.d.ts +56 -17
- package/lib/models/export.d.ts.map +1 -1
- package/lib/models/export.js.map +1 -1
- package/lib/models/icon.d.ts +24 -9
- package/lib/models/icon.d.ts.map +1 -1
- package/lib/models/icon.js +3 -6
- package/lib/models/icon.js.map +1 -1
- package/lib/models/location.d.ts +40 -8
- package/lib/models/location.d.ts.map +1 -1
- package/lib/models/location.js +2 -0
- package/lib/models/location.js.map +1 -1
- package/lib/models/observation.d.ts +27 -0
- package/lib/models/observation.js.map +1 -1
- package/lib/models/user.d.ts +3 -0
- package/lib/models/user.js +1 -1
- package/lib/provision/index.js +1 -1
- package/lib/provision/index.js.map +1 -1
- package/lib/routes/authenticationconfigurations.d.ts.map +1 -1
- package/lib/routes/authenticationconfigurations.js +4 -5
- package/lib/routes/authenticationconfigurations.js.map +1 -1
- package/lib/routes/events.d.ts.map +1 -1
- package/lib/routes/events.js +19 -10
- package/lib/routes/events.js.map +1 -1
- package/lib/routes/exports.d.ts +3 -2
- package/lib/routes/exports.d.ts.map +1 -1
- package/lib/routes/exports.js +121 -79
- package/lib/routes/exports.js.map +1 -1
- package/lib/routes/imports.d.ts.map +1 -1
- package/lib/routes/imports.js +4 -2
- package/lib/routes/imports.js.map +1 -1
- package/lib/routes/layers.d.ts.map +1 -1
- package/lib/routes/layers.js +11 -45
- package/lib/routes/layers.js.map +1 -1
- package/lib/routes/locations.d.ts.map +1 -1
- package/lib/routes/locations.js +7 -3
- package/lib/routes/locations.js.map +1 -1
- package/lib/routes/routes.types.d.ts +9 -0
- package/lib/routes/setup.js +1 -1
- package/lib/routes/setup.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/npm-shrinkwrap.json +4411 -7493
- package/package.json +45 -45
- package/lib/export/exporterFactory.d.ts +0 -11
- package/lib/export/exporterFactory.d.ts.map +0 -1
- package/lib/export/exporterFactory.js +0 -17
- package/lib/export/exporterFactory.js.map +0 -1
package/lib/export/exporter.js
CHANGED
|
@@ -1,38 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
eventId: this._event._id
|
|
25
|
-
};
|
|
26
|
-
if (options.userId)
|
|
27
|
-
filter.userId = options.userId;
|
|
28
|
-
if (options.lastLocationId)
|
|
29
|
-
filter.lastLocationId = options.lastLocationId;
|
|
30
|
-
if (options.startDate)
|
|
31
|
-
filter.startDate = options.startDate.toDate();
|
|
32
|
-
if (options.endDate)
|
|
33
|
-
filter.endDate = options.endDate.toDate();
|
|
34
|
-
const sort = { userId: 1, "properties.timestamp": 1, _id: 1 };
|
|
35
|
-
return Location.getLocations({ filter: filter, limit: options.limit, stream: true, sort: sort }, done);
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
36
24
|
};
|
|
37
|
-
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Exporter = void 0;
|
|
27
|
+
const ObservationModelModule = __importStar(require("../models/observation"));
|
|
28
|
+
const UserLocationModelModule = __importStar(require("../models/location"));
|
|
29
|
+
const entities_events_1 = require("../entities/events/entities.events");
|
|
30
|
+
class Exporter {
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.eventDoc = options.event;
|
|
33
|
+
this._event = new entities_events_1.MageEvent(options.event.toJSON());
|
|
34
|
+
this._filter = options.filter;
|
|
35
|
+
}
|
|
36
|
+
requestObservations(filter) {
|
|
37
|
+
const options = {
|
|
38
|
+
filter: {
|
|
39
|
+
states: ['active'],
|
|
40
|
+
observationStartDate: filter.startDate,
|
|
41
|
+
observationEndDate: filter.endDate,
|
|
42
|
+
favorites: filter.favorites,
|
|
43
|
+
important: filter.important,
|
|
44
|
+
attachments: filter.attachments
|
|
45
|
+
},
|
|
46
|
+
sort: { userId: 1 },
|
|
47
|
+
stream: true
|
|
48
|
+
};
|
|
49
|
+
return ObservationModelModule.getObservations(this.eventDoc, options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Return a cursor for the given location query with results ordered by user
|
|
53
|
+
* ID and ascending timestamp.
|
|
54
|
+
*/
|
|
55
|
+
requestLocations(options) {
|
|
56
|
+
const filter = {
|
|
57
|
+
eventId: this._event.id
|
|
58
|
+
};
|
|
59
|
+
if (options.startDate) {
|
|
60
|
+
filter.startDate = options.startDate;
|
|
61
|
+
}
|
|
62
|
+
if (options.endDate) {
|
|
63
|
+
filter.endDate = options.endDate;
|
|
64
|
+
}
|
|
65
|
+
const sort = { userId: 1, 'properties.timestamp': 1, _id: 1 };
|
|
66
|
+
return UserLocationModelModule.getLocations({ stream: true, filter, sort });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.Exporter = Exporter;
|
|
38
70
|
//# sourceMappingURL=exporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.js","sourceRoot":"","sources":["../../src/export/exporter.
|
|
1
|
+
{"version":3,"file":"exporter.js","sourceRoot":"","sources":["../../src/export/exporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8EAA+D;AAC/D,4EAA6D;AAE7D,wEAA8D;AAyB9D,MAAa,QAAQ;IAMnB,YAAY,OAAsB;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,2BAAS,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;QACnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,mBAAmB,CAAC,MAAoB;QACtC,MAAM,OAAO,GAAwD;YACnE,MAAM,EAAE;gBACN,MAAM,EAAE,CAAE,QAAQ,CAAkB;gBACpC,oBAAoB,EAAE,MAAM,CAAC,SAAS;gBACtC,kBAAkB,EAAE,MAAM,CAAC,OAAO;gBAClC,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC;YACD,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;YACnB,MAAM,EAAE,IAAI;SACb,CAAA;QACD,OAAO,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,OAA6B;QAC5C,MAAM,MAAM,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;SACiC,CAAA;QAC1D,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;SACrC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;SACjC;QACD,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,sBAAsB,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;QAC9D,OAAO,uBAAuB,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AA7CD,4BA6CC"}
|
package/lib/export/geojson.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import archiver from 'archiver';
|
|
3
|
+
import { Exporter } from './exporter';
|
|
4
|
+
import { ObservationDocument } from '../models/observation';
|
|
5
|
+
export declare class GeoJson extends Exporter {
|
|
6
|
+
export(streamable: NodeJS.WritableStream): void;
|
|
7
|
+
mapObservationProperties(observation: ObservationDocument, archive: archiver.Archiver): void;
|
|
8
|
+
streamObservations(stream: NodeJS.WritableStream, archive: archiver.Archiver, done: (err?: any) => void): Promise<void>;
|
|
9
|
+
streamLocations(stream: NodeJS.WritableStream, done: (err?: any) => void): void;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=geojson.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../../src/export/geojson.
|
|
1
|
+
{"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../../src/export/geojson.ts"],"names":[],"mappings":";AAIA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAM/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAIrC,OAAO,EAAsB,mBAAmB,EAAgC,MAAM,uBAAuB,CAAA;AAa7G,qBAAa,OAAQ,SAAQ,QAAQ;IAEnC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI;IAoC/C,wBAAwB,CAAC,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI;IAgDtF,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAoD7H,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;CA2BhF"}
|
package/lib/export/geojson.js
CHANGED
|
@@ -8,160 +8,179 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
GeoJson.super_.call(this, options);
|
|
14
|
-
}
|
|
15
|
-
util.inherits(GeoJson, Exporter);
|
|
16
|
-
module.exports = GeoJson;
|
|
17
|
-
GeoJson.prototype.export = function (streamable) {
|
|
18
|
-
const archive = archiver('zip');
|
|
19
|
-
archive.pipe(streamable);
|
|
20
|
-
async.parallel([
|
|
21
|
-
done => {
|
|
22
|
-
if (!this._filter.exportObservations)
|
|
23
|
-
return done();
|
|
24
|
-
const observationStream = new stream.PassThrough();
|
|
25
|
-
archive.append(observationStream, { name: 'observations.geojson' });
|
|
26
|
-
this.streamObservations(observationStream, archive, err => {
|
|
27
|
-
observationStream.end();
|
|
28
|
-
done(err);
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
done => {
|
|
32
|
-
if (!this._filter.exportLocations)
|
|
33
|
-
return done();
|
|
34
|
-
const locationStream = new stream.PassThrough();
|
|
35
|
-
archive.append(locationStream, { name: 'locations.geojson' });
|
|
36
|
-
this.streamLocations(locationStream, err => {
|
|
37
|
-
locationStream.end();
|
|
38
|
-
done(err);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
], err => {
|
|
42
|
-
if (err)
|
|
43
|
-
log.warn(err);
|
|
44
|
-
archive.finalize();
|
|
45
|
-
});
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
13
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GeoJson = void 0;
|
|
16
|
+
const api_1 = __importDefault(require("../api"));
|
|
17
|
+
const async_1 = __importDefault(require("async"));
|
|
18
|
+
const archiver_1 = __importDefault(require("archiver"));
|
|
19
|
+
const moment_1 = __importDefault(require("moment"));
|
|
20
|
+
const stream_1 = __importDefault(require("stream"));
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const centroid_1 = __importDefault(require("@turf/centroid"));
|
|
23
|
+
const exporter_1 = require("./exporter");
|
|
24
|
+
const env_1 = require("../environment/env");
|
|
25
|
+
const user_1 = __importDefault(require("../models/user"));
|
|
26
|
+
const device_1 = __importDefault(require("../models/device"));
|
|
27
|
+
const entities_events_forms_1 = require("../entities/events/entities.events.forms");
|
|
28
|
+
const mgrs = require('mgrs');
|
|
29
|
+
const logger = require('../logger');
|
|
30
|
+
const log = ['debug', 'info', 'warn', 'error', 'log'].reduce((log, methodName) => {
|
|
31
|
+
const logMethod = logger[methodName];
|
|
32
|
+
return Object.assign(Object.assign({}, log), { [methodName]: (...args) => logMethod('[export:geojson]', ...args) });
|
|
33
|
+
}, {});
|
|
34
|
+
class GeoJson extends exporter_1.Exporter {
|
|
35
|
+
export(streamable) {
|
|
36
|
+
const archive = (0, archiver_1.default)('zip');
|
|
37
|
+
archive.pipe(streamable);
|
|
38
|
+
async_1.default.parallel([
|
|
39
|
+
(done) => {
|
|
40
|
+
if (!this._filter.exportObservations) {
|
|
41
|
+
return done();
|
|
42
|
+
}
|
|
43
|
+
const observationStream = new stream_1.default.PassThrough();
|
|
44
|
+
archive.append(observationStream, { name: 'observations.geojson' });
|
|
45
|
+
this.streamObservations(observationStream, archive, err => {
|
|
46
|
+
observationStream.end();
|
|
47
|
+
done(err);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
(done) => {
|
|
51
|
+
if (!this._filter.exportLocations)
|
|
52
|
+
return done();
|
|
53
|
+
const locationStream = new stream_1.default.PassThrough();
|
|
54
|
+
archive.append(locationStream, { name: 'locations.geojson' });
|
|
55
|
+
this.streamLocations(locationStream, (err) => {
|
|
56
|
+
locationStream.end();
|
|
57
|
+
done(err);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
], err => {
|
|
61
|
+
if (err) {
|
|
62
|
+
log.warn(err);
|
|
63
|
+
}
|
|
64
|
+
archive.finalize();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
mapObservationProperties(observation, archive) {
|
|
68
|
+
var _a;
|
|
69
|
+
const centroid = (0, centroid_1.default)(observation);
|
|
70
|
+
const exportProperties = Object.assign(Object.assign({}, observation.properties), { id: observation._id, timestamp: (0, moment_1.default)(observation.properties.timestamp).toISOString(), mgrs: mgrs.forward(centroid.geometry.coordinates) });
|
|
71
|
+
delete exportProperties.forms;
|
|
72
|
+
const formEntries = ((_a = observation.properties) === null || _a === void 0 ? void 0 : _a.forms) || [];
|
|
73
|
+
const { formEntriesByName, exportAttachments } = formEntries.reduce(({ formEntriesByName, exportAttachments }, formEntry) => {
|
|
74
|
+
const form = this._event.formFor(formEntry.formId);
|
|
75
|
+
if (!form) {
|
|
76
|
+
return { formEntriesByName, exportAttachments };
|
|
77
|
+
}
|
|
78
|
+
const { fieldEntryHash, entryAttachments } = form.fields.reduce(({ fieldEntryHash, entryAttachments }, field) => {
|
|
79
|
+
if (field.archived || field.type === entities_events_forms_1.FormFieldType.Password || field.type === entities_events_forms_1.FormFieldType.Geometry ||
|
|
80
|
+
(field.type === entities_events_forms_1.FormFieldType.CheckBox && field.value === null)) {
|
|
81
|
+
return { fieldEntryHash, entryAttachments };
|
|
82
|
+
}
|
|
83
|
+
if (field.type === entities_events_forms_1.FormFieldType.Attachment) {
|
|
84
|
+
const fieldAttachments = observation.attachments.filter(attachment => {
|
|
85
|
+
return attachment.relativePath &&
|
|
86
|
+
attachment.fieldName === field.name &&
|
|
87
|
+
String(attachment.observationFormId) === String(formEntry._id);
|
|
88
|
+
});
|
|
89
|
+
const attachmentRelPaths = fieldAttachments.map(x => x.relativePath);
|
|
90
|
+
fieldEntryHash[field.name] = attachmentRelPaths;
|
|
91
|
+
entryAttachments = entryAttachments.concat(fieldAttachments);
|
|
92
|
+
}
|
|
93
|
+
else if (formEntry[field.name] !== undefined) {
|
|
94
|
+
fieldEntryHash[field.name] = formEntry[field.name];
|
|
95
|
+
}
|
|
96
|
+
return { fieldEntryHash, entryAttachments };
|
|
97
|
+
}, { fieldEntryHash: {}, entryAttachments: [] });
|
|
98
|
+
const entriesForForm = formEntriesByName[form.name] || [];
|
|
99
|
+
entriesForForm.push(fieldEntryHash);
|
|
100
|
+
formEntriesByName[form.name] = entriesForForm;
|
|
101
|
+
exportAttachments = exportAttachments.concat(entryAttachments);
|
|
102
|
+
return { formEntriesByName, exportAttachments };
|
|
103
|
+
}, { formEntriesByName: {}, exportAttachments: [] });
|
|
104
|
+
exportAttachments.forEach(x => archive.file(path_1.default.join(env_1.attachmentBaseDirectory, x.relativePath), { name: x.relativePath }));
|
|
105
|
+
observation.properties = Object.assign(Object.assign({}, exportProperties), formEntriesByName);
|
|
106
|
+
}
|
|
107
|
+
streamObservations(stream, archive, done) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
log.info('fetching observations');
|
|
110
|
+
const cursor = this.requestObservations(this._filter);
|
|
111
|
+
let user = null;
|
|
112
|
+
let device = null;
|
|
113
|
+
let numObservations = 0;
|
|
114
|
+
stream.write('{"type": "FeatureCollection", "features": [');
|
|
115
|
+
cursor.eachAsync((observation) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
if (numObservations > 0) {
|
|
117
|
+
stream.write(',');
|
|
118
|
+
}
|
|
119
|
+
this.mapObservationProperties(observation, archive);
|
|
120
|
+
if (observation.userId) {
|
|
121
|
+
if (!user || user._id.toString() !== String(observation.userId)) {
|
|
122
|
+
user = yield user_1.default.getUserById(observation.userId);
|
|
72
123
|
}
|
|
73
|
-
|
|
74
|
-
|
|
124
|
+
}
|
|
125
|
+
if (observation.deviceId) {
|
|
126
|
+
if (!device || device._id.toString() !== String(observation.deviceId)) {
|
|
127
|
+
device = yield device_1.default.getDeviceById(observation.deviceId);
|
|
75
128
|
}
|
|
76
129
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
value = observation.attachments.filter(attachment => {
|
|
84
|
-
return attachment.relativePath && attachment.fieldName === field.name &&
|
|
85
|
-
attachment.observationFormId.toString() === observationForm._id.toString();
|
|
86
|
-
})
|
|
87
|
-
.map(attachment => {
|
|
88
|
-
return attachment.relativePath;
|
|
89
|
-
});
|
|
90
|
-
value.forEach(attachmentPath => {
|
|
91
|
-
archive.file(path.join(attachmentBase, attachmentPath), { name: attachmentPath });
|
|
92
|
-
});
|
|
130
|
+
const exportProperties = observation.properties;
|
|
131
|
+
if (user) {
|
|
132
|
+
exportProperties.user = user.username;
|
|
133
|
+
}
|
|
134
|
+
if (device) {
|
|
135
|
+
exportProperties.device = device.uid;
|
|
93
136
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
137
|
+
const data = JSON.stringify({
|
|
138
|
+
geometry: observation.geometry,
|
|
139
|
+
properties: observation.properties
|
|
140
|
+
});
|
|
141
|
+
stream.write(data);
|
|
142
|
+
numObservations++;
|
|
143
|
+
}))
|
|
144
|
+
.then(() => {
|
|
145
|
+
if (cursor) {
|
|
146
|
+
cursor.close();
|
|
147
|
+
}
|
|
148
|
+
stream.write(']}');
|
|
149
|
+
// throw in icons
|
|
150
|
+
archive.directory(new api_1.default.Icon(this._event.id).getBasePath(), 'mage-export/icons', { date: new Date() });
|
|
151
|
+
log.info(`wrote ${numObservations} observations`);
|
|
152
|
+
done();
|
|
153
|
+
})
|
|
154
|
+
.catch(err => done(err));
|
|
98
155
|
});
|
|
99
156
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
log.info("Requesting observations from DB");
|
|
106
|
-
const cursor = this.requestObservations(this._filter);
|
|
107
|
-
let user = null;
|
|
108
|
-
let device = null;
|
|
109
|
-
let numObservations = 0;
|
|
157
|
+
streamLocations(stream, done) {
|
|
158
|
+
log.info('fetching locations');
|
|
159
|
+
const { startDate, endDate } = this._filter;
|
|
160
|
+
const cursor = this.requestLocations({ startDate: startDate, endDate: endDate });
|
|
161
|
+
let numLocations = 0;
|
|
110
162
|
stream.write('{"type": "FeatureCollection", "features": [');
|
|
111
|
-
cursor.eachAsync(
|
|
112
|
-
if (
|
|
163
|
+
cursor.eachAsync(location => {
|
|
164
|
+
if (numLocations > 0) {
|
|
113
165
|
stream.write(',');
|
|
114
166
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (!device || device._id.toString() !== observation.deviceId.toString()) {
|
|
120
|
-
device = yield Device.getDeviceById(observation.deviceId);
|
|
121
|
-
}
|
|
122
|
-
if (user)
|
|
123
|
-
observation.properties.user = user.username;
|
|
124
|
-
if (device)
|
|
125
|
-
observation.properties.device = device.uid;
|
|
126
|
-
const data = JSON.stringify({
|
|
127
|
-
geometry: observation.geometry,
|
|
128
|
-
properties: observation.properties
|
|
129
|
-
});
|
|
167
|
+
const centroid = (0, centroid_1.default)(location);
|
|
168
|
+
const exportProperties = location.properties;
|
|
169
|
+
exportProperties.mgrs = mgrs.forward(centroid.geometry.coordinates);
|
|
170
|
+
const data = JSON.stringify(location);
|
|
130
171
|
stream.write(data);
|
|
131
|
-
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
|
|
172
|
+
numLocations++;
|
|
173
|
+
})
|
|
174
|
+
.then(() => {
|
|
175
|
+
if (cursor) {
|
|
176
|
+
cursor.close();
|
|
177
|
+
}
|
|
135
178
|
stream.write(']}');
|
|
136
|
-
|
|
137
|
-
archive.directory(new api.Icon(this._event._id).getBasePath(), 'mage-export/icons', { date: new Date() });
|
|
138
|
-
log.info('Successfully wrote ' + numObservations + ' observations to GeoJSON');
|
|
179
|
+
log.info(`wrote ${numLocations} locations`);
|
|
139
180
|
done();
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const startDate = this._filter.startDate ? moment(this._filter.startDate) : null;
|
|
146
|
-
const endDate = this._filter.endDate ? moment(this._filter.endDate) : null;
|
|
147
|
-
const cursor = this.requestLocations({ startDate: startDate, endDate: endDate });
|
|
148
|
-
let numLocations = 0;
|
|
149
|
-
stream.write('{"type": "FeatureCollection", "features": [');
|
|
150
|
-
cursor.eachAsync(location => {
|
|
151
|
-
if (numLocations > 0) {
|
|
152
|
-
stream.write(',');
|
|
153
|
-
}
|
|
154
|
-
const centroid = turfCentroid(location);
|
|
155
|
-
location.properties.mgrs = mgrs.forward(centroid.geometry.coordinates);
|
|
156
|
-
const data = JSON.stringify(location);
|
|
157
|
-
stream.write(data);
|
|
158
|
-
numLocations++;
|
|
159
|
-
}).then(() => {
|
|
160
|
-
if (cursor)
|
|
161
|
-
cursor.close;
|
|
162
|
-
stream.write(']}');
|
|
163
|
-
log.info('Successfully wrote ' + numLocations + ' locations to GeoJSON');
|
|
164
|
-
done();
|
|
165
|
-
}).catch(err => done(err));
|
|
166
|
-
};
|
|
181
|
+
})
|
|
182
|
+
.catch(err => done(err));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.GeoJson = GeoJson;
|
|
167
186
|
//# sourceMappingURL=geojson.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson.js","sourceRoot":"","sources":["../../src/export/geojson.
|
|
1
|
+
{"version":3,"file":"geojson.js","sourceRoot":"","sources":["../../src/export/geojson.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;AAEb,iDAAwB;AACxB,kDAAyB;AACzB,wDAA+B;AAC/B,oDAA2B;AAC3B,oDAA2B;AAC3B,gDAAuB;AACvB,8DAAyC;AAEzC,yCAAqC;AACrC,4CAA8E;AAC9E,0DAAmD;AACnD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C,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YACpE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnB,YAAY,EAAE,CAAC;QACjB,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,MAAM,EAAE;gBACV,MAAM,CAAC,KAAK,EAAE,CAAC;aAChB;YACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnB,GAAG,CAAC,IAAI,CAAC,SAAS,YAAY,YAAY,CAAC,CAAC;YAC5C,IAAI,EAAE,CAAC;QACT,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,CAAC;CACF;AArKD,0BAqKC"}
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as GPKG from '@ngageoint/geopackage';
|
|
3
|
+
import { Envelope } from '@ngageoint/geopackage/dist/lib/geom/envelope';
|
|
4
|
+
import { Exporter } from './exporter';
|
|
5
|
+
import { UserDocument } from '../models/user';
|
|
6
|
+
import { UserLocationDocument } from '../models/location';
|
|
7
|
+
import { UserId } from '../entities/users/entities.users';
|
|
8
|
+
import { FormFieldType } from '../entities/events/entities.events.forms';
|
|
9
|
+
import { IconRow } from '@ngageoint/geopackage/dist/lib/extension/style/iconRow';
|
|
10
|
+
import { IconAttrs } from '../models/icon';
|
|
11
|
+
export declare class GeoPackage extends Exporter {
|
|
12
|
+
private iconCache;
|
|
13
|
+
private observationStyles;
|
|
14
|
+
export(streamable: NodeJS.WritableStream): Promise<void>;
|
|
15
|
+
createObservationTable(geopackage: GPKG.GeoPackage): Promise<void>;
|
|
16
|
+
createAttachmentTable(geopackage: GPKG.GeoPackage): void;
|
|
17
|
+
addUserToUsersTable(geopackage: GPKG.GeoPackage, user: UserDocument, usersLastLocation: UserLocationDocument, zoomToEnvelope: Envelope): Promise<void>;
|
|
18
|
+
createLocationTableForUser(geopackage: GPKG.GeoPackage, userId: UserId): Promise<void>;
|
|
19
|
+
addLocationsToGeoPackage(geopackage: GPKG.GeoPackage): Promise<void>;
|
|
20
|
+
createFormAttributeTables(geopackage: GPKG.GeoPackage): Promise<void>;
|
|
21
|
+
fieldTypeToGeoPackageType(fieldType: FormFieldType): string;
|
|
22
|
+
createUserTable(geopackage: GPKG.GeoPackage): Promise<void>;
|
|
23
|
+
addFormDataToGeoPackage(geopackage: GPKG.GeoPackage): Promise<void>;
|
|
24
|
+
addObservationsToGeoPackage(geopackage: GPKG.GeoPackage): Promise<void>;
|
|
25
|
+
createObservationFeatureTableStyles(geopackage: GPKG.GeoPackage): Promise<GPKG.FeatureTableStyles>;
|
|
26
|
+
linkObservationFeatureIcon(iconSpec: IconCachePath, featureId: number): Promise<void>;
|
|
27
|
+
ensureIconInGeopackage(iconSpec: IconCachePath): Promise<IconRow['id'] | null>;
|
|
24
28
|
}
|
|
29
|
+
declare type IconCachePath = Pick<IconAttrs, 'formId' | 'primary' | 'variant'>;
|
|
30
|
+
export {};
|
|
25
31
|
//# sourceMappingURL=geopackage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geopackage.d.ts","sourceRoot":"","sources":["../../src/export/geopackage.
|
|
1
|
+
{"version":3,"file":"geopackage.d.ts","sourceRoot":"","sources":["../../src/export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