@golemio/core 1.6.6-dev.826432115 → 1.6.6-dev.837591395
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/README.md +0 -1
- package/bin/import-test-data.js +0 -72
- package/dist/helpers/HealthCheck.d.ts +0 -1
- package/dist/helpers/HealthCheck.js +0 -1
- package/dist/helpers/HealthCheck.js.map +1 -1
- package/dist/integration-engine/config/IntegrationEngineConfiguration.d.ts +0 -1
- package/dist/integration-engine/config/IntegrationEngineConfiguration.js +0 -1
- package/dist/integration-engine/config/IntegrationEngineConfiguration.js.map +1 -1
- package/dist/integration-engine/config/abstract.d.ts +0 -1
- package/dist/integration-engine/connectors/index.d.ts +0 -6
- package/dist/integration-engine/connectors/index.js +1 -6
- package/dist/integration-engine/connectors/index.js.map +1 -1
- package/dist/integration-engine/datasources/IDataSource.d.ts +2 -2
- package/dist/integration-engine/datasources/datatype-strategy/IDataTypeStrategy.d.ts +2 -1
- package/dist/integration-engine/datasources/datatype-strategy/XMLDataTypeStrategy.js +2 -2
- package/dist/integration-engine/datasources/datatype-strategy/XMLDataTypeStrategy.js.map +1 -1
- package/dist/integration-engine/ioc/ContainerToken.d.ts +0 -1
- package/dist/integration-engine/ioc/ContainerToken.js +0 -1
- package/dist/integration-engine/ioc/ContainerToken.js.map +1 -1
- package/dist/integration-engine/ioc/Di.js +0 -2
- package/dist/integration-engine/ioc/Di.js.map +1 -1
- package/dist/integration-engine/models/IModel.d.ts +0 -12
- package/dist/integration-engine/models/PostgresModel.js +1 -1
- package/dist/integration-engine/models/PostgresModel.js.map +1 -1
- package/dist/integration-engine/models/index.d.ts +0 -1
- package/dist/integration-engine/models/index.js +0 -1
- package/dist/integration-engine/models/index.js.map +1 -1
- package/dist/monitoring/opentelemetry/instrumentation/configs/index.d.ts +0 -1
- package/dist/monitoring/opentelemetry/instrumentation/configs/index.js +1 -3
- package/dist/monitoring/opentelemetry/instrumentation/configs/index.js.map +1 -1
- package/dist/monitoring/opentelemetry/instrumentation/index.d.ts +1 -2
- package/dist/monitoring/opentelemetry/instrumentation/index.js +0 -2
- package/dist/monitoring/opentelemetry/instrumentation/index.js.map +1 -1
- package/dist/monitoring/sentry/sentry-provider.js +0 -1
- package/dist/monitoring/sentry/sentry-provider.js.map +1 -1
- package/dist/output-gateway/Geo.d.ts +1 -1
- package/dist/output-gateway/config/OutputGatewayConfiguration.d.ts +0 -3
- package/dist/output-gateway/config/OutputGatewayConfiguration.js +0 -11
- package/dist/output-gateway/config/OutputGatewayConfiguration.js.map +1 -1
- package/dist/output-gateway/database/index.d.ts +1 -30
- package/dist/output-gateway/database/index.js +1 -6
- package/dist/output-gateway/database/index.js.map +1 -1
- package/dist/output-gateway/ioc/ContainerToken.d.ts +0 -1
- package/dist/output-gateway/ioc/ContainerToken.js +0 -1
- package/dist/output-gateway/ioc/ContainerToken.js.map +1 -1
- package/dist/output-gateway/ioc/Di.js +0 -2
- package/dist/output-gateway/ioc/Di.js.map +1 -1
- package/dist/output-gateway/models/index.d.ts +0 -3
- package/dist/output-gateway/models/index.js +0 -3
- package/dist/output-gateway/models/index.js.map +1 -1
- package/dist/output-gateway/routes/index.d.ts +0 -2
- package/dist/output-gateway/routes/index.js +0 -2
- package/dist/output-gateway/routes/index.js.map +1 -1
- package/package.json +4 -6
- package/dist/integration-engine/connectors/MongoConnector.d.ts +0 -15
- package/dist/integration-engine/connectors/MongoConnector.js +0 -89
- package/dist/integration-engine/connectors/MongoConnector.js.map +0 -1
- package/dist/integration-engine/connectors/interfaces/IMongoConnector.d.ts +0 -7
- package/dist/integration-engine/connectors/interfaces/IMongoConnector.js +0 -3
- package/dist/integration-engine/connectors/interfaces/IMongoConnector.js.map +0 -1
- package/dist/integration-engine/models/MongoModel.d.ts +0 -42
- package/dist/integration-engine/models/MongoModel.js +0 -245
- package/dist/integration-engine/models/MongoModel.js.map +0 -1
- package/dist/monitoring/opentelemetry/instrumentation/configs/mongoose.d.ts +0 -2
- package/dist/monitoring/opentelemetry/instrumentation/configs/mongoose.js +0 -20
- package/dist/monitoring/opentelemetry/instrumentation/configs/mongoose.js.map +0 -1
- package/dist/output-gateway/database/MongoDatabase.d.ts +0 -19
- package/dist/output-gateway/database/MongoDatabase.js +0 -89
- package/dist/output-gateway/database/MongoDatabase.js.map +0 -1
- package/dist/output-gateway/models/GeoJsonModel.d.ts +0 -56
- package/dist/output-gateway/models/GeoJsonModel.js +0 -188
- package/dist/output-gateway/models/GeoJsonModel.js.map +0 -1
- package/dist/output-gateway/models/HistoryModel.d.ts +0 -30
- package/dist/output-gateway/models/HistoryModel.js +0 -96
- package/dist/output-gateway/models/HistoryModel.js.map +0 -1
- package/dist/output-gateway/models/MongoModel.d.ts +0 -74
- package/dist/output-gateway/models/MongoModel.js +0 -87
- package/dist/output-gateway/models/MongoModel.js.map +0 -1
- package/dist/output-gateway/routes/HistoryRouter.d.ts +0 -7
- package/dist/output-gateway/routes/HistoryRouter.js +0 -46
- package/dist/output-gateway/routes/HistoryRouter.js.map +0 -1
- package/dist/output-gateway/routes/RouterBuilder.d.ts +0 -70
- package/dist/output-gateway/routes/RouterBuilder.js +0 -92
- package/dist/output-gateway/routes/RouterBuilder.js.map +0 -1
- package/dist/shared/mongoose.d.ts +0 -2
- package/dist/shared/mongoose.js +0 -7
- package/dist/shared/mongoose.js.map +0 -1
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MongoModel = void 0;
|
|
13
|
-
const models_1 = require("./");
|
|
14
|
-
const mongoose_1 = require("mongoose");
|
|
15
|
-
/**
|
|
16
|
-
* General model for data stored in MongoDB.
|
|
17
|
-
*
|
|
18
|
-
* Model /DATA ACCESS LAYER/: Defines data structure, connects to DB storage and retrieves data directly from database.
|
|
19
|
-
* Performs database queries.
|
|
20
|
-
*/
|
|
21
|
-
class MongoModel extends models_1.BaseModel {
|
|
22
|
-
/**
|
|
23
|
-
* Creates a model with specified schema definition
|
|
24
|
-
* @param inName Name of the model - corresponding with mongo collection name (eg. "parkings" for "Parking" model)
|
|
25
|
-
* @param inSchema Schema of the data
|
|
26
|
-
* @param inCollectionName (optional) Name of the mongo collection
|
|
27
|
-
* if empty, collection named as plural of model's name is used
|
|
28
|
-
*/
|
|
29
|
-
constructor(inName, inSchema, inCollectionName) {
|
|
30
|
-
super(inName);
|
|
31
|
-
/** Selection object to filter the retrieved records */
|
|
32
|
-
this.selection = {};
|
|
33
|
-
/** Projection object to filter the retrieved record's attributes */
|
|
34
|
-
this.projection = {};
|
|
35
|
-
/**
|
|
36
|
-
* Returns current schema of the data
|
|
37
|
-
*/
|
|
38
|
-
this.GetSchema = () => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
return this.schema;
|
|
40
|
-
});
|
|
41
|
-
// TODO: Careful, Router takes this keys()[0] as a decision, if ID parameter can be string or number,
|
|
42
|
-
// that's weird dependency - selection with $or on two attributes for example will fail!
|
|
43
|
-
/**
|
|
44
|
-
* Specifies where is the primary ID of the entity.
|
|
45
|
-
* Searches by this selection in FindOne()
|
|
46
|
-
*/
|
|
47
|
-
this.PrimaryIdentifierSelection = (inId) => {
|
|
48
|
-
return { "properties.id": inId };
|
|
49
|
-
};
|
|
50
|
-
this.IsPrimaryIdNumber = (idKey) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const schema = yield this.GetSchema();
|
|
52
|
-
return schema.path(idKey) instanceof mongoose_1.Schema.Types.Number;
|
|
53
|
-
});
|
|
54
|
-
/**
|
|
55
|
-
* Adds a new selection condition to filter the retrieved results by
|
|
56
|
-
* @param newCondition New condition/filter object to be added to the "where" clause
|
|
57
|
-
*/
|
|
58
|
-
this.AddSelection = (newCondition) => {
|
|
59
|
-
this.selection = Object.assign(Object.assign({}, this.selection), newCondition);
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Adds a new projection to filter what attributes to retrieve from the selected objects
|
|
63
|
-
* @param newFilter New filter to be added to the "select" clause
|
|
64
|
-
*/
|
|
65
|
-
this.AddProjection = (newFilter) => {
|
|
66
|
-
this.projection = Object.assign(Object.assign({}, this.projection), newFilter);
|
|
67
|
-
};
|
|
68
|
-
this.name = inName;
|
|
69
|
-
this.schema = new mongoose_1.Schema(inSchema);
|
|
70
|
-
if (inCollectionName) {
|
|
71
|
-
this.collectionName = inCollectionName;
|
|
72
|
-
}
|
|
73
|
-
// assign existing mongo model or create new one
|
|
74
|
-
try {
|
|
75
|
-
this.model = (0, mongoose_1.model)(this.name); // existing model
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
// uses database collection named as plural of model's name (eg. "parkings" for "Parking" model)
|
|
79
|
-
// or collection name specified in the third parameter
|
|
80
|
-
this.model = (0, mongoose_1.model)(this.name, this.schema, this.collectionName);
|
|
81
|
-
}
|
|
82
|
-
// Don't return default mongoose values and mongo internal ID
|
|
83
|
-
this.AddProjection({ _id: 0, __v: 0 });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.MongoModel = MongoModel;
|
|
87
|
-
//# sourceMappingURL=MongoModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MongoModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/MongoModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+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C;SAC1C;QACD,gDAAgD;QAChD,IAAI;YACA,IAAI,CAAC,KAAK,GAAG,IAAA,gBAAK,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB;SACnD;QAAC,OAAO,KAAK,EAAE;YACZ,gGAAgG;YAChG,sDAAsD;YACtD,IAAI,CAAC,KAAK,GAAG,IAAA,gBAAK,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;SACnE;QACD,6DAA6D;QAC7D,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;CAwCJ;AA5ED,gCA4EC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HistoryModel } from "../models";
|
|
2
|
-
import { ValidationChain } from "express-validator/check";
|
|
3
|
-
import { AbstractHistoryRouter } from "./AbstractHistoryRouter";
|
|
4
|
-
export declare class HistoryRouter extends AbstractHistoryRouter {
|
|
5
|
-
constructor(inModel: HistoryModel);
|
|
6
|
-
protected GetIdQueryParamWithCorrectType: () => Promise<ValidationChain>;
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.HistoryRouter = void 0;
|
|
13
|
-
const Logger_1 = require("../Logger");
|
|
14
|
-
const check_1 = require("express-validator/check");
|
|
15
|
-
const mongoose_1 = require("mongoose");
|
|
16
|
-
const AbstractHistoryRouter_1 = require("./AbstractHistoryRouter");
|
|
17
|
-
class HistoryRouter extends AbstractHistoryRouter_1.AbstractHistoryRouter {
|
|
18
|
-
constructor(inModel) {
|
|
19
|
-
super(inModel);
|
|
20
|
-
this.GetIdQueryParamWithCorrectType = () => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
let sensorIdParam;
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
return yield this.model.GetSchema().then((schema) => {
|
|
24
|
-
// Get the location of the ID of the sensor (the attribute name)
|
|
25
|
-
const idKey = this.model.primarySensorIdPropertyLocation;
|
|
26
|
-
let message = "Created history model " + this.model.GetName() + " has ID of sensor `" + idKey + "` of type ";
|
|
27
|
-
// ID of the sensor has type "Number" in the schema
|
|
28
|
-
if (schema.path(idKey) instanceof mongoose_1.Schema.Types.Number) {
|
|
29
|
-
message += "number.";
|
|
30
|
-
// Create a query parameter (which validates by express-validator) for detail route with type number
|
|
31
|
-
sensorIdParam = (0, check_1.query)("sensorId.*").optional().isNumeric();
|
|
32
|
-
// ID of the sensor has type "String" in the schema
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
message += "string.";
|
|
36
|
-
// Create a query parameter (which validates by express-validator) for detail route with type string
|
|
37
|
-
sensorIdParam = (0, check_1.query)("sensorId.*").optional().isString();
|
|
38
|
-
}
|
|
39
|
-
Logger_1.log.silly(message);
|
|
40
|
-
return sensorIdParam;
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.HistoryRouter = HistoryRouter;
|
|
46
|
-
//# sourceMappingURL=HistoryRouter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HistoryRouter.js","sourceRoot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
-
import { SchemaDefinition } from "mongoose";
|
|
3
|
-
import { GeoJsonModel, HistoryModel } from "../models";
|
|
4
|
-
export interface IDatasetDefinition {
|
|
5
|
-
name: string;
|
|
6
|
-
schema: SchemaDefinition;
|
|
7
|
-
collectionName: string;
|
|
8
|
-
history?: IDatasetDefinition;
|
|
9
|
-
historyTimePropertyLocation?: string;
|
|
10
|
-
expire?: number | string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* General router builder. Creates routes on top of passed Express router
|
|
14
|
-
* based on data about desired routes - their type, name (base url) and schema of the data to be returned
|
|
15
|
-
*
|
|
16
|
-
* For GeoJSON data, automatically creates / and /:id routes,
|
|
17
|
-
* adds filtering parameters (geo, city district, limit, offset, last updated)
|
|
18
|
-
*/
|
|
19
|
-
export declare class RouterBuilder {
|
|
20
|
-
/**
|
|
21
|
-
* Router instance to build all the routes on
|
|
22
|
-
*/
|
|
23
|
-
private router;
|
|
24
|
-
/**
|
|
25
|
-
* Routes data - name (base url) of the routes, data schemas and (optional) collection name
|
|
26
|
-
*/
|
|
27
|
-
private routesData;
|
|
28
|
-
constructor(inRouter: Router);
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @param inName Name of the route, serves as base url for the route's requests {base router}/{inName}/
|
|
32
|
-
* @param inModel Model whose methods are to be mounted on the routes
|
|
33
|
-
*
|
|
34
|
-
* Creates a router with the model's methods mounted on {inName}/...
|
|
35
|
-
*/
|
|
36
|
-
CreateGeojsonRoute(inName: string, inModel: GeoJsonModel, expire?: number | string): void;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param inName Name of the route, serves as base url for the route's requests {base router}/{inName}/
|
|
40
|
-
* @param inModel Model whose methods are to be mounted on the routes
|
|
41
|
-
*
|
|
42
|
-
* Creates a router with the model's methods mounted on {inName}/...
|
|
43
|
-
*/
|
|
44
|
-
CreateHistoryRoute(inName: string, inModel: HistoryModel, expire?: number | string): void;
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @param inData Array with data about the new created routes, contains object with name
|
|
48
|
-
* (specifies where the routes will be available)
|
|
49
|
-
* and schema (format of the data to be returned at the routes).
|
|
50
|
-
*
|
|
51
|
-
* Binds all routes passed as parameter to /{their name}
|
|
52
|
-
*/
|
|
53
|
-
CreateGeojsonRoutes(inData: IDatasetDefinition[]): void;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @param inData Array with data about the new created routes
|
|
57
|
-
* if it contains a "history" sub-object, this creates a route for that
|
|
58
|
-
*
|
|
59
|
-
* Binds history route passed as parameter to /{their name}/history
|
|
60
|
-
*/
|
|
61
|
-
CreateHistoryRoutes(inData: IDatasetDefinition[]): void;
|
|
62
|
-
/**
|
|
63
|
-
* Loads the data for building the routes
|
|
64
|
-
*/
|
|
65
|
-
LoadData(inData: IDatasetDefinition[]): void;
|
|
66
|
-
/**
|
|
67
|
-
* Builds all routes based on data in this.data and mounts them to this.router
|
|
68
|
-
*/
|
|
69
|
-
BuildAllRoutes(): void;
|
|
70
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RouterBuilder = void 0;
|
|
4
|
-
const routes_1 = require("./");
|
|
5
|
-
const Logger_1 = require("../Logger");
|
|
6
|
-
const models_1 = require("../models");
|
|
7
|
-
/**
|
|
8
|
-
* General router builder. Creates routes on top of passed Express router
|
|
9
|
-
* based on data about desired routes - their type, name (base url) and schema of the data to be returned
|
|
10
|
-
*
|
|
11
|
-
* For GeoJSON data, automatically creates / and /:id routes,
|
|
12
|
-
* adds filtering parameters (geo, city district, limit, offset, last updated)
|
|
13
|
-
*/
|
|
14
|
-
class RouterBuilder {
|
|
15
|
-
constructor(inRouter) {
|
|
16
|
-
this.router = inRouter;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param inName Name of the route, serves as base url for the route's requests {base router}/{inName}/
|
|
21
|
-
* @param inModel Model whose methods are to be mounted on the routes
|
|
22
|
-
*
|
|
23
|
-
* Creates a router with the model's methods mounted on {inName}/...
|
|
24
|
-
*/
|
|
25
|
-
CreateGeojsonRoute(inName, inModel, expire) {
|
|
26
|
-
const generalRouter = new routes_1.GeoJsonRouter(inModel);
|
|
27
|
-
generalRouter.initRoutes(expire);
|
|
28
|
-
this.router.use(inName, generalRouter.router);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param inName Name of the route, serves as base url for the route's requests {base router}/{inName}/
|
|
33
|
-
* @param inModel Model whose methods are to be mounted on the routes
|
|
34
|
-
*
|
|
35
|
-
* Creates a router with the model's methods mounted on {inName}/...
|
|
36
|
-
*/
|
|
37
|
-
CreateHistoryRoute(inName, inModel, expire) {
|
|
38
|
-
const historyRouter = new routes_1.HistoryRouter(inModel);
|
|
39
|
-
historyRouter.initRoutes(expire);
|
|
40
|
-
this.router.use(inName, historyRouter.router);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param inData Array with data about the new created routes, contains object with name
|
|
45
|
-
* (specifies where the routes will be available)
|
|
46
|
-
* and schema (format of the data to be returned at the routes).
|
|
47
|
-
*
|
|
48
|
-
* Binds all routes passed as parameter to /{their name}
|
|
49
|
-
*/
|
|
50
|
-
CreateGeojsonRoutes(inData) {
|
|
51
|
-
inData.forEach((data) => {
|
|
52
|
-
this.CreateGeojsonRoute("/" + data.name.toLowerCase(), new models_1.GeoJsonModel(data.name, data.schema, data.collectionName));
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* @param inData Array with data about the new created routes
|
|
58
|
-
* if it contains a "history" sub-object, this creates a route for that
|
|
59
|
-
*
|
|
60
|
-
* Binds history route passed as parameter to /{their name}/history
|
|
61
|
-
*/
|
|
62
|
-
CreateHistoryRoutes(inData) {
|
|
63
|
-
inData.forEach((data) => {
|
|
64
|
-
if (data.history) {
|
|
65
|
-
this.CreateHistoryRoute("/" + data.name.toLowerCase() + "/history", new models_1.HistoryModel(data.history.name, data.history.schema, data.history.collectionName, data.history.historyTimePropertyLocation));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Loads the data for building the routes
|
|
71
|
-
*/
|
|
72
|
-
LoadData(inData) {
|
|
73
|
-
Logger_1.log.silly(`RouterBuilder: Loaded data to build ${inData.length} sets of routes`);
|
|
74
|
-
if (this.routesData && this.routesData.length >= 0) {
|
|
75
|
-
Logger_1.log.warn("Routes data were not empty. Rewriting with new set of data. All previous will be lost.");
|
|
76
|
-
}
|
|
77
|
-
this.routesData = inData;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Builds all routes based on data in this.data and mounts them to this.router
|
|
81
|
-
*/
|
|
82
|
-
BuildAllRoutes() {
|
|
83
|
-
if (!this.routesData || this.routesData.length === 0) {
|
|
84
|
-
Logger_1.log.warn("Routes data for building routes seem to be empty." + "Make sure to call .LoadData before you .BuildAllRoutes");
|
|
85
|
-
Logger_1.log.debug(this.routesData);
|
|
86
|
-
}
|
|
87
|
-
this.CreateHistoryRoutes(this.routesData);
|
|
88
|
-
this.CreateGeojsonRoutes(this.routesData);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.RouterBuilder = RouterBuilder;
|
|
92
|
-
//# sourceMappingURL=RouterBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouterBuilder.js","sourceRoot":"","sources":["../../../src/output-gateway/routes/RouterBuilder.ts"],"names":[],"mappings":";;;AAEA,+BAA0D;AAC1D,sCAAiC;AACjC,sCAAwD;AAWxD;;;;;;GAMG;AACH,MAAa,aAAa;IAUtB,YAAY,QAAgB;QACxB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACI,kBAAkB,CAAC,M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AC3C,CACJ,CAAC;aACL;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,MAA4B;QACxC,YAAG,CAAC,KAAK,CAAC,uCAAuC,MAAM,CAAC,MAAM,iBAAiB,CAAC,CAAC;QACjF,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;YAChD,YAAG,CAAC,IAAI,CAAC,wFAAwF,CAAC,CAAC;SACtG;QACD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,cAAc;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAClD,YAAG,CAAC,IAAI,CACJ,mDAAmD,GAAG,wDAAwD,CACjH,CAAC;YACF,YAAG,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC9B;QACD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;CACJ;AArGD,sCAqGC"}
|
package/dist/shared/mongoose.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const mongoose_1 = __importDefault(require("mongoose"));
|
|
6
|
-
module.exports = mongoose_1.default;
|
|
7
|
-
//# sourceMappingURL=mongoose.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mongoose.js","sourceRoot":"","sources":["../../src/shared/mongoose.ts"],"names":[],"mappings":";;;;AAAA,wDAAgC;AAChC,iBAAS,kBAAQ,CAAC"}
|