owservable 0.7.0 → 0.7.1
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/owservable.d.ts +1 -5
- package/lib/owservable.js +1 -9
- package/lib/owservable.js.map +1 -1
- package/package.json +2 -3
- package/lib/_types/fastify.route.type.d.ts +0 -7
- package/lib/_types/fastify.route.type.js +0 -3
- package/lib/_types/fastify.route.type.js.map +0 -1
- package/lib/routing/functions/add.fastify.routes.d.ts +0 -2
- package/lib/routing/functions/add.fastify.routes.js +0 -50
- package/lib/routing/functions/add.fastify.routes.js.map +0 -1
- package/lib/routing/functions/clean.relative.path.d.ts +0 -2
- package/lib/routing/functions/clean.relative.path.js +0 -14
- package/lib/routing/functions/clean.relative.path.js.map +0 -1
- package/lib/routing/functions/process.fastify.blipp.d.ts +0 -2
- package/lib/routing/functions/process.fastify.blipp.js +0 -17
- package/lib/routing/functions/process.fastify.blipp.js.map +0 -1
- package/lib/routing/routes.map.d.ts +0 -10
- package/lib/routing/routes.map.js +0 -60
- package/lib/routing/routes.map.js.map +0 -1
package/lib/owservable.d.ts
CHANGED
|
@@ -18,15 +18,11 @@ import CollectionsModelsMap from './mongodb/collections.models.map';
|
|
|
18
18
|
import processModels from './mongodb/functions/process.models';
|
|
19
19
|
import observableModel from './mongodb/functions/observable.model';
|
|
20
20
|
import observableDatabase from './mongodb/functions/observable.database';
|
|
21
|
-
import RoutesMap from './routing/routes.map';
|
|
22
|
-
import addFastifyRoutes from './routing/functions/add.fastify.routes';
|
|
23
|
-
import cleanRelativePath from './routing/functions/clean.relative.path';
|
|
24
|
-
import processFastifyBlipp from './routing/functions/process.fastify.blipp';
|
|
25
21
|
import AStore from './store/a.store';
|
|
26
22
|
import CountStore from './store/count.store';
|
|
27
23
|
import DocumentStore from './store/document.store';
|
|
28
24
|
import CollectionStore from './store/collection.store';
|
|
29
25
|
import storeFactory from './store/factories/store.factory';
|
|
30
|
-
export { OwservableClient, EStoreType, ConnectionManagerRefreshType, CronJobType, StoreScopeType, StoreSubscriptionConfigType, StoreSubscriptionUpdateType, WatcherType, WorkerType, IConnectionManager, getSubfolderPathsByFolderName, initiateCronjobs, initiateWatchers, initiateWorkers, DataMiddlewareMap, MongoDBConnector, CollectionsModelsMap, processModels, observableModel, observableDatabase,
|
|
26
|
+
export { OwservableClient, EStoreType, ConnectionManagerRefreshType, CronJobType, StoreScopeType, StoreSubscriptionConfigType, StoreSubscriptionUpdateType, WatcherType, WorkerType, IConnectionManager, getSubfolderPathsByFolderName, initiateCronjobs, initiateWatchers, initiateWorkers, DataMiddlewareMap, MongoDBConnector, CollectionsModelsMap, processModels, observableModel, observableDatabase, AStore, CountStore, DocumentStore, CollectionStore, storeFactory };
|
|
31
27
|
declare const Owservable: {};
|
|
32
28
|
export default Owservable;
|
package/lib/owservable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storeFactory = exports.CollectionStore = exports.DocumentStore = exports.CountStore = exports.AStore = exports.
|
|
3
|
+
exports.storeFactory = exports.CollectionStore = exports.DocumentStore = exports.CountStore = exports.AStore = exports.observableDatabase = exports.observableModel = exports.processModels = exports.CollectionsModelsMap = exports.MongoDBConnector = exports.DataMiddlewareMap = exports.initiateWorkers = exports.initiateWatchers = exports.initiateCronjobs = exports.getSubfolderPathsByFolderName = exports.EStoreType = exports.OwservableClient = void 0;
|
|
4
4
|
const owservable_client_1 = require("./owservable.client");
|
|
5
5
|
exports.OwservableClient = owservable_client_1.default;
|
|
6
6
|
const store_type_enum_1 = require("./_enums/store.type.enum");
|
|
@@ -25,14 +25,6 @@ const observable_model_1 = require("./mongodb/functions/observable.model");
|
|
|
25
25
|
exports.observableModel = observable_model_1.default;
|
|
26
26
|
const observable_database_1 = require("./mongodb/functions/observable.database");
|
|
27
27
|
exports.observableDatabase = observable_database_1.default;
|
|
28
|
-
const routes_map_1 = require("./routing/routes.map");
|
|
29
|
-
exports.RoutesMap = routes_map_1.default;
|
|
30
|
-
const add_fastify_routes_1 = require("./routing/functions/add.fastify.routes");
|
|
31
|
-
exports.addFastifyRoutes = add_fastify_routes_1.default;
|
|
32
|
-
const clean_relative_path_1 = require("./routing/functions/clean.relative.path");
|
|
33
|
-
exports.cleanRelativePath = clean_relative_path_1.default;
|
|
34
|
-
const process_fastify_blipp_1 = require("./routing/functions/process.fastify.blipp");
|
|
35
|
-
exports.processFastifyBlipp = process_fastify_blipp_1.default;
|
|
36
28
|
const a_store_1 = require("./store/a.store");
|
|
37
29
|
exports.AStore = a_store_1.default;
|
|
38
30
|
const count_store_1 = require("./store/count.store");
|
package/lib/owservable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owservable.js","sourceRoot":"","sources":["../src/owservable.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,2DAAmD;
|
|
1
|
+
{"version":3,"file":"owservable.js","sourceRoot":"","sources":["../src/owservable.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,2DAAmD;AA6ClD,2BA7CM,2BAAgB,CA6CN;AA1CjB,8DAAkD;AA4CjD,qBA5CM,yBAAU,CA4CN;AA7BX,mEAA2D;AA4C1D,0BA5CM,0BAAe,CA4CN;AA3ChB,qEAA6D;AAyC5D,2BAzCM,2BAAgB,CAyCN;AAxCjB,qEAA6D;AAyC5D,2BAzCM,2BAAgB,CAyCN;AAxCjB,uGAA2F;AAsC1F,wCAtCM,4CAA6B,CAsCN;AAnC9B,0EAAiE;AAwChE,4BAxCM,6BAAiB,CAwCN;AArClB,mEAA2D;AAuC1D,2BAvCM,2BAAgB,CAuCN;AAtCjB,6EAAoE;AAuCnE,+BAvCM,gCAAoB,CAuCN;AApCrB,uEAA+D;AAsC9D,wBAtCM,wBAAa,CAsCN;AArCd,2EAAmE;AAsClE,0BAtCM,0BAAe,CAsCN;AArChB,iFAAyE;AAsCxE,6BAtCM,6BAAkB,CAsCN;AAnCnB,6CAAqC;AAqCpC,iBArCM,iBAAM,CAqCN;AApCP,qDAA6C;AAqC5C,qBArCM,qBAAU,CAqCN;AApCX,2DAAmD;AAqClD,wBArCM,wBAAa,CAqCN;AApCd,+DAAuD;AAqCtD,0BArCM,0BAAe,CAqCN;AAlChB,mEAA2D;AAoC1D,uBApCM,uBAAY,CAoCN;AAGb,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,kBAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owservable",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "owservable
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"description": "owservable backend",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=14"
|
|
7
7
|
},
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"@types/mongoose": "^5.7.36",
|
|
39
39
|
"@types/node": "^14.11.2",
|
|
40
40
|
"@types/node-cron": "^2.0.4",
|
|
41
|
-
"fastify": "^3.19.1",
|
|
42
41
|
"jsondiffpatch": "^0.4.1",
|
|
43
42
|
"lodash": "^4.17.20",
|
|
44
43
|
"mongoose": "^5.13.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.route.type.js","sourceRoot":"","sources":["../../src/_types/fastify.route.type.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const _ = require("lodash");
|
|
6
|
-
const clean_relative_path_1 = require("./clean.relative.path");
|
|
7
|
-
let routesRootFolder;
|
|
8
|
-
const METHODS = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'];
|
|
9
|
-
const _fixUrl = (url, relativeFilePath) => {
|
|
10
|
-
url = relativeFilePath + url;
|
|
11
|
-
url = _.join(_.split(url, '//'), '/');
|
|
12
|
-
if (_.endsWith(url, '/'))
|
|
13
|
-
url = url.slice(0, -1);
|
|
14
|
-
return url;
|
|
15
|
-
};
|
|
16
|
-
const _addRoute = (fastify, route, relativeFilePath) => {
|
|
17
|
-
if (!_.has(route, 'url'))
|
|
18
|
-
route.url = '/';
|
|
19
|
-
const { url } = route;
|
|
20
|
-
if (!_.startsWith(_.toLower(url), relativeFilePath))
|
|
21
|
-
route.url = _fixUrl(url, relativeFilePath);
|
|
22
|
-
if (_.has(route, 'method'))
|
|
23
|
-
route.method = _.toUpper(route.method);
|
|
24
|
-
else
|
|
25
|
-
route.method = 'GET';
|
|
26
|
-
if (_.isPlainObject(route) && METHODS.includes(route.method))
|
|
27
|
-
fastify.route(route);
|
|
28
|
-
};
|
|
29
|
-
const addFastifyRoutes = (fastify, folder) => {
|
|
30
|
-
if (!routesRootFolder)
|
|
31
|
-
routesRootFolder = folder;
|
|
32
|
-
const fileNames = fs.readdirSync(folder);
|
|
33
|
-
const files = _.filter(fileNames, (name) => !fs.lstatSync(path.join(folder, name)).isDirectory());
|
|
34
|
-
_.each(files, (file) => {
|
|
35
|
-
const ext = path.extname(file);
|
|
36
|
-
if (ext !== '.ts' && ext !== '.js')
|
|
37
|
-
return;
|
|
38
|
-
const absoluteFilePath = path.join(folder, file);
|
|
39
|
-
const relativeFilePath = (0, clean_relative_path_1.default)(routesRootFolder, absoluteFilePath, ext);
|
|
40
|
-
const route = require(absoluteFilePath);
|
|
41
|
-
if (_.isArray(route))
|
|
42
|
-
_.each(route, (r) => _addRoute(fastify, r, relativeFilePath));
|
|
43
|
-
else
|
|
44
|
-
_addRoute(fastify, route, relativeFilePath);
|
|
45
|
-
});
|
|
46
|
-
const folders = _.filter(fileNames, (name) => fs.lstatSync(path.join(folder, name)).isDirectory());
|
|
47
|
-
_.each(folders, (sub) => addFastifyRoutes(fastify, path.join(folder, sub)));
|
|
48
|
-
};
|
|
49
|
-
exports.default = addFastifyRoutes;
|
|
50
|
-
//# sourceMappingURL=add.fastify.routes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add.fastify.routes.js","sourceRoot":"","sources":["../../../src/routing/functions/add.fastify.routes.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;AAE7B,4BAA4B;AAE5B,+DAAsD;AAEtD,IAAI,gBAAwB,CAAC;AAC7B,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAE7E,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,gBAAwB,EAAU,EAAE;IACjE,GAAG,GAAG,gBAAgB,GAAG,GAAG,CAAC;IAC7B,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACtC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;QAAE,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,OAAY,EAAE,KAAU,EAAE,gBAAwB,EAAQ,EAAE;IAC9E,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;IAE1C,MAAM,EAAC,GAAG,EAAC,GAAG,KAAK,CAAC;IACpB,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC;QAAE,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,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AAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC;;YACpF,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3G,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC;AACF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lodash_1 = require("lodash");
|
|
4
|
-
const cleanRelativePath = (rootFolder, absoluteFilePath, ext) => {
|
|
5
|
-
let relativeFilePath = (0, lodash_1.toLower)(absoluteFilePath) + '/';
|
|
6
|
-
relativeFilePath = (0, lodash_1.replace)(relativeFilePath, (0, lodash_1.toLower)(rootFolder), '');
|
|
7
|
-
relativeFilePath = (0, lodash_1.replace)(relativeFilePath, (0, lodash_1.toLower)(ext), '');
|
|
8
|
-
relativeFilePath = (0, lodash_1.replace)(relativeFilePath, 'root', '');
|
|
9
|
-
relativeFilePath = (0, lodash_1.join)((0, lodash_1.split)(relativeFilePath, '\\'), '/');
|
|
10
|
-
relativeFilePath = (0, lodash_1.join)((0, lodash_1.split)(relativeFilePath, '//'), '/');
|
|
11
|
-
return relativeFilePath;
|
|
12
|
-
};
|
|
13
|
-
exports.default = cleanRelativePath;
|
|
14
|
-
//# sourceMappingURL=clean.relative.path.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clean.relative.path.js","sourceRoot":"","sources":["../../../src/routing/functions/clean.relative.path.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,mCAAqD;AAErD,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,gBAAwB,EAAE,GAAkB,EAAU,EAAE;IACtG,IAAI,gBAAgB,GAAG,IAAA,gBAAO,EAAC,gBAAgB,CAAC,GAAG,GAAG,CAAC;IACvD,gBAAgB,GAAG,IAAA,gBAAO,EAAC,gBAAgB,EAAE,IAAA,gBAAO,EAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IACtE,gBAAgB,GAAG,IAAA,gBAAO,EAAC,gBAAgB,EAAE,IAAA,gBAAO,EAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/D,gBAAgB,GAAG,IAAA,gBAAO,EAAC,gBAAgB,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,gBAAgB,GAAG,IAAA,aAAI,EAAC,IAAA,cAAK,EAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5D,gBAAgB,GAAG,IAAA,aAAI,EAAC,IAAA,cAAK,EAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5D,OAAO,gBAAgB,CAAC;AACzB,CAAC,CAAC;AACF,kBAAe,iBAAiB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lodash_1 = require("lodash");
|
|
4
|
-
const routes_map_1 = require("../routes.map");
|
|
5
|
-
const processFastifyBlipp = (blipp) => {
|
|
6
|
-
console.log(blipp);
|
|
7
|
-
if (!(0, lodash_1.includes)(blipp, 'Routes:')) {
|
|
8
|
-
let routes = (0, lodash_1.split)(blipp, '\n');
|
|
9
|
-
routes = (0, lodash_1.map)(routes, (r) => r.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, ''));
|
|
10
|
-
(0, lodash_1.each)(routes, (r) => {
|
|
11
|
-
const parts = (0, lodash_1.split)(r, '\t');
|
|
12
|
-
routes_map_1.default.add(parts[0], parts[1]);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.default = processFastifyBlipp;
|
|
17
|
-
//# sourceMappingURL=process.fastify.blipp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process.fastify.blipp.js","sourceRoot":"","sources":["../../../src/routing/functions/process.fastify.blipp.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,mCAAkD;AAClD,8CAAsC;AAEtC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAQ,EAAE;IACnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,IAAI,CAAC,IAAA,iBAAQ,EAAC,KAAK,EAAE,SAAS,CAAC,EAAE;QAChC,IAAI,MAAM,GAAG,IAAA,cAAK,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAChC,MAAM,GAAG,IAAA,YAAG,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,6EAA6E,EAAE,EAAE,CAAC,CAAC,CAAC;QAC1H,IAAA,aAAI,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;YAClB,MAAM,KAAK,GAAG,IAAA,cAAK,EAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YAC7B,oBAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;KACH;AACF,CAAC,CAAC;AACF,kBAAe,mBAAmB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default class RoutesMap {
|
|
2
|
-
static add(method: string, route: string): void;
|
|
3
|
-
static getMethods(): string[];
|
|
4
|
-
static getRoutes(method: string): string[] | null;
|
|
5
|
-
static keys(): string[];
|
|
6
|
-
static values(): string[][];
|
|
7
|
-
static list(): any;
|
|
8
|
-
static json(): any;
|
|
9
|
-
private static readonly _routes;
|
|
10
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const _ = require("lodash");
|
|
4
|
-
class RoutesMap {
|
|
5
|
-
static add(method, route) {
|
|
6
|
-
method = _.toUpper(method);
|
|
7
|
-
let routes = RoutesMap._routes.get(method) || [];
|
|
8
|
-
routes.push(route);
|
|
9
|
-
routes = _.sortBy(_.compact(_.uniq(routes)));
|
|
10
|
-
RoutesMap._routes.set(method, routes);
|
|
11
|
-
}
|
|
12
|
-
static getMethods() {
|
|
13
|
-
return _.sortBy(_.compact(Array.from(RoutesMap._routes.keys())));
|
|
14
|
-
}
|
|
15
|
-
static getRoutes(method) {
|
|
16
|
-
return RoutesMap._routes.get(_.toUpper(method));
|
|
17
|
-
}
|
|
18
|
-
static keys() {
|
|
19
|
-
return Array.from(RoutesMap._routes.keys());
|
|
20
|
-
}
|
|
21
|
-
static values() {
|
|
22
|
-
return Array.from(RoutesMap._routes.values());
|
|
23
|
-
}
|
|
24
|
-
static list() {
|
|
25
|
-
const obj = {};
|
|
26
|
-
const methods = RoutesMap.getMethods();
|
|
27
|
-
_.each(methods, (method) => (obj[method] = RoutesMap.getRoutes(method)));
|
|
28
|
-
return obj;
|
|
29
|
-
}
|
|
30
|
-
static json() {
|
|
31
|
-
const obj = {};
|
|
32
|
-
const methods = RoutesMap.getMethods();
|
|
33
|
-
_.each(methods, (method) => {
|
|
34
|
-
const apis = {};
|
|
35
|
-
const routes = RoutesMap.getRoutes(method);
|
|
36
|
-
_.each(routes, (route) => {
|
|
37
|
-
let parts = _.split(route, '/');
|
|
38
|
-
parts = _.compact(parts);
|
|
39
|
-
const last = _.join(parts, '.');
|
|
40
|
-
parts.pop();
|
|
41
|
-
let paths = [_.join(parts, '.')];
|
|
42
|
-
while (!_.isEmpty(parts)) {
|
|
43
|
-
parts.pop();
|
|
44
|
-
paths.push(_.join(parts, '.'));
|
|
45
|
-
}
|
|
46
|
-
paths = _.reverse(_.compact(paths));
|
|
47
|
-
_.each(paths, (path) => {
|
|
48
|
-
if (!_.get(apis, path))
|
|
49
|
-
_.set(apis, path, {});
|
|
50
|
-
});
|
|
51
|
-
_.set(apis, last, true);
|
|
52
|
-
});
|
|
53
|
-
obj[method] = apis;
|
|
54
|
-
});
|
|
55
|
-
return obj;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.default = RoutesMap;
|
|
59
|
-
RoutesMap._routes = new Map();
|
|
60
|
-
//# sourceMappingURL=routes.map.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.map.js","sourceRoot":"","sources":["../../src/routing/routes.map.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,4BAA4B;AAE5B,MAAqB,SAAS;IACtB,MAAM,CAAC,GAAG,CAAC,MAAc,EAAE,KAAa;QAC9C,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7C,SAAS,CAAC,OAAO,CA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