@bluealba/pae-core 0.0.3
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 +9 -0
- package/dist/src/authentication/auth-user.interface.d.ts +13 -0
- package/dist/src/authentication/auth-user.interface.d.ts.map +1 -0
- package/dist/src/authentication/auth-user.interface.js +3 -0
- package/dist/src/authentication/auth-user.interface.js.map +1 -0
- package/dist/src/authentication/index.d.ts +2 -0
- package/dist/src/authentication/index.d.ts.map +1 -0
- package/dist/src/authentication/index.js +18 -0
- package/dist/src/authentication/index.js.map +1 -0
- package/dist/src/authorization/allowed-resources.interface.d.ts +7 -0
- package/dist/src/authorization/allowed-resources.interface.d.ts.map +1 -0
- package/dist/src/authorization/allowed-resources.interface.js +3 -0
- package/dist/src/authorization/allowed-resources.interface.js.map +1 -0
- package/dist/src/authorization/application.model.d.ts +7 -0
- package/dist/src/authorization/application.model.d.ts.map +1 -0
- package/dist/src/authorization/application.model.js +14 -0
- package/dist/src/authorization/application.model.js.map +1 -0
- package/dist/src/authorization/authorization-repository.interface.d.ts +9 -0
- package/dist/src/authorization/authorization-repository.interface.d.ts.map +1 -0
- package/dist/src/authorization/authorization-repository.interface.js +3 -0
- package/dist/src/authorization/authorization-repository.interface.js.map +1 -0
- package/dist/src/authorization/authorization.service.d.ts +13 -0
- package/dist/src/authorization/authorization.service.d.ts.map +1 -0
- package/dist/src/authorization/authorization.service.js +32 -0
- package/dist/src/authorization/authorization.service.js.map +1 -0
- package/dist/src/authorization/constants.d.ts +3 -0
- package/dist/src/authorization/constants.d.ts.map +1 -0
- package/dist/src/authorization/constants.js +6 -0
- package/dist/src/authorization/constants.js.map +1 -0
- package/dist/src/authorization/index.d.ts +6 -0
- package/dist/src/authorization/index.d.ts.map +1 -0
- package/dist/src/authorization/index.js +26 -0
- package/dist/src/authorization/index.js.map +1 -0
- package/dist/src/authorization/operation.model.d.ts +10 -0
- package/dist/src/authorization/operation.model.d.ts.map +1 -0
- package/dist/src/authorization/operation.model.js +19 -0
- package/dist/src/authorization/operation.model.js.map +1 -0
- package/dist/src/authorization/repositories/http.repository.d.ts +15 -0
- package/dist/src/authorization/repositories/http.repository.d.ts.map +1 -0
- package/dist/src/authorization/repositories/http.repository.js +157 -0
- package/dist/src/authorization/repositories/http.repository.js.map +1 -0
- package/dist/src/authorization/repositories/index.d.ts +2 -0
- package/dist/src/authorization/repositories/index.d.ts.map +1 -0
- package/dist/src/authorization/repositories/index.js +18 -0
- package/dist/src/authorization/repositories/index.js.map +1 -0
- package/dist/src/authorization/rule.model.d.ts +11 -0
- package/dist/src/authorization/rule.model.d.ts.map +1 -0
- package/dist/src/authorization/rule.model.js +18 -0
- package/dist/src/authorization/rule.model.js.map +1 -0
- package/dist/src/authorization/utilities/filter-app-operations.d.ts +3 -0
- package/dist/src/authorization/utilities/filter-app-operations.d.ts.map +1 -0
- package/dist/src/authorization/utilities/filter-app-operations.js +8 -0
- package/dist/src/authorization/utilities/filter-app-operations.js.map +1 -0
- package/dist/src/authorization/utilities/get-operations.utility.d.ts +8 -0
- package/dist/src/authorization/utilities/get-operations.utility.d.ts.map +1 -0
- package/dist/src/authorization/utilities/get-operations.utility.js +33 -0
- package/dist/src/authorization/utilities/get-operations.utility.js.map +1 -0
- package/dist/src/authorization/utilities/get-route-operations.d.ts +4 -0
- package/dist/src/authorization/utilities/get-route-operations.d.ts.map +1 -0
- package/dist/src/authorization/utilities/get-route-operations.js +45 -0
- package/dist/src/authorization/utilities/get-route-operations.js.map +1 -0
- package/dist/src/authorization/utilities/index.d.ts +2 -0
- package/dist/src/authorization/utilities/index.d.ts.map +1 -0
- package/dist/src/authorization/utilities/index.js +6 -0
- package/dist/src/authorization/utilities/index.js.map +1 -0
- package/dist/src/authorization/utilities/is-authorized.utility.d.ts +6 -0
- package/dist/src/authorization/utilities/is-authorized.utility.d.ts.map +1 -0
- package/dist/src/authorization/utilities/is-authorized.utility.js +21 -0
- package/dist/src/authorization/utilities/is-authorized.utility.js.map +1 -0
- package/dist/src/catalog/authorization.interface.d.ts +11 -0
- package/dist/src/catalog/authorization.interface.d.ts.map +1 -0
- package/dist/src/catalog/authorization.interface.js +3 -0
- package/dist/src/catalog/authorization.interface.js.map +1 -0
- package/dist/src/catalog/catalog-repository.interface.d.ts +5 -0
- package/dist/src/catalog/catalog-repository.interface.d.ts.map +1 -0
- package/dist/src/catalog/catalog-repository.interface.js +3 -0
- package/dist/src/catalog/catalog-repository.interface.js.map +1 -0
- package/dist/src/catalog/catalog.service.d.ts +10 -0
- package/dist/src/catalog/catalog.service.d.ts.map +1 -0
- package/dist/src/catalog/catalog.service.js +32 -0
- package/dist/src/catalog/catalog.service.js.map +1 -0
- package/dist/src/catalog/index.d.ts +6 -0
- package/dist/src/catalog/index.d.ts.map +1 -0
- package/dist/src/catalog/index.js +23 -0
- package/dist/src/catalog/index.js.map +1 -0
- package/dist/src/catalog/module-metadata.interface.d.ts +47 -0
- package/dist/src/catalog/module-metadata.interface.d.ts.map +1 -0
- package/dist/src/catalog/module-metadata.interface.js +3 -0
- package/dist/src/catalog/module-metadata.interface.js.map +1 -0
- package/dist/src/catalog/repositories/http.repository.d.ts +9 -0
- package/dist/src/catalog/repositories/http.repository.d.ts.map +1 -0
- package/dist/src/catalog/repositories/http.repository.js +40 -0
- package/dist/src/catalog/repositories/http.repository.js.map +1 -0
- package/dist/src/catalog/repositories/index.d.ts +2 -0
- package/dist/src/catalog/repositories/index.d.ts.map +1 -0
- package/dist/src/catalog/repositories/index.js +18 -0
- package/dist/src/catalog/repositories/index.js.map +1 -0
- package/dist/src/catalog/service-config.interface.d.ts +17 -0
- package/dist/src/catalog/service-config.interface.d.ts.map +1 -0
- package/dist/src/catalog/service-config.interface.js +3 -0
- package/dist/src/catalog/service-config.interface.js.map +1 -0
- package/dist/src/catalog/ui-config.interface.d.ts +27 -0
- package/dist/src/catalog/ui-config.interface.d.ts.map +1 -0
- package/dist/src/catalog/ui-config.interface.js +3 -0
- package/dist/src/catalog/ui-config.interface.js.map +1 -0
- package/dist/src/catalog/ui-types.constants.d.ts +2 -0
- package/dist/src/catalog/ui-types.constants.d.ts.map +1 -0
- package/dist/src/catalog/ui-types.constants.js +5 -0
- package/dist/src/catalog/ui-types.constants.js.map +1 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.d.ts +8 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.d.ts.map +1 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.js +50 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.js.map +1 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.d.ts +13 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.d.ts.map +1 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.js +45 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.js.map +1 -0
- package/dist/src/gateway/gateway.service.d.ts +7 -0
- package/dist/src/gateway/gateway.service.d.ts.map +1 -0
- package/dist/src/gateway/gateway.service.js +13 -0
- package/dist/src/gateway/gateway.service.js.map +1 -0
- package/dist/src/gateway/get-from-header.d.ts +3 -0
- package/dist/src/gateway/get-from-header.d.ts.map +1 -0
- package/dist/src/gateway/get-from-header.js +11 -0
- package/dist/src/gateway/get-from-header.js.map +1 -0
- package/dist/src/gateway/headers.d.ts +5 -0
- package/dist/src/gateway/headers.d.ts.map +1 -0
- package/dist/src/gateway/headers.js +8 -0
- package/dist/src/gateway/headers.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +24 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/pae/config.interface.d.ts +15 -0
- package/dist/src/pae/config.interface.d.ts.map +1 -0
- package/dist/src/pae/config.interface.js +3 -0
- package/dist/src/pae/config.interface.js.map +1 -0
- package/dist/src/pae/index.d.ts +2 -0
- package/dist/src/pae/index.d.ts.map +1 -0
- package/dist/src/pae/index.js +18 -0
- package/dist/src/pae/index.js.map +1 -0
- package/dist/src/pae/pae.d.ts +17 -0
- package/dist/src/pae/pae.d.ts.map +1 -0
- package/dist/src/pae/pae.js +110 -0
- package/dist/src/pae/pae.js.map +1 -0
- package/dist/src/user/group.interface.d.ts +2 -0
- package/dist/src/user/group.interface.d.ts.map +1 -0
- package/dist/src/user/group.interface.js +3 -0
- package/dist/src/user/group.interface.js.map +1 -0
- package/dist/src/user/repositories/http.repository.d.ts +8 -0
- package/dist/src/user/repositories/http.repository.d.ts.map +1 -0
- package/dist/src/user/repositories/http.repository.js +39 -0
- package/dist/src/user/repositories/http.repository.js.map +1 -0
- package/dist/src/user/repositories/index.d.ts +2 -0
- package/dist/src/user/repositories/index.d.ts.map +1 -0
- package/dist/src/user/repositories/index.js +18 -0
- package/dist/src/user/repositories/index.js.map +1 -0
- package/dist/src/user/user-repository.interface.d.ts +5 -0
- package/dist/src/user/user-repository.interface.d.ts.map +1 -0
- package/dist/src/user/user-repository.interface.js +3 -0
- package/dist/src/user/user-repository.interface.js.map +1 -0
- package/dist/src/user/user.service.d.ts +7 -0
- package/dist/src/user/user.service.d.ts.map +1 -0
- package/dist/src/user/user.service.js +25 -0
- package/dist/src/user/user.service.js.map +1 -0
- package/dist/src/utilities.d.ts +3 -0
- package/dist/src/utilities.d.ts.map +1 -0
- package/dist/src/utilities.js +19 -0
- package/dist/src/utilities.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getModuleRequirements = void 0;
|
|
4
|
+
const get_route_operations_1 = require("./get-route-operations");
|
|
5
|
+
const getModuleRequirements = (module, catalog, requestPath, requestMethod = "GET") => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const dependsOn = module.dependsOn || [];
|
|
8
|
+
const requirements = {
|
|
9
|
+
operations: [],
|
|
10
|
+
applications: [],
|
|
11
|
+
};
|
|
12
|
+
if (((_a = module.authorization) === null || _a === void 0 ? void 0 : _a.routes) && requestPath) {
|
|
13
|
+
const routeOperations = (0, get_route_operations_1.getRoutesOperations)(module, requestMethod, requestPath);
|
|
14
|
+
requirements.operations.push(...routeOperations);
|
|
15
|
+
}
|
|
16
|
+
if ((_b = module.authorization) === null || _b === void 0 ? void 0 : _b.operations) {
|
|
17
|
+
requirements.operations.push(...module.authorization.operations);
|
|
18
|
+
}
|
|
19
|
+
if (module.application) {
|
|
20
|
+
requirements.applications.push(module.application);
|
|
21
|
+
}
|
|
22
|
+
dependsOn.forEach(moduleName => {
|
|
23
|
+
const dependencyApp = catalog.find(app => app.name === moduleName);
|
|
24
|
+
if (dependencyApp) {
|
|
25
|
+
const dependencyRequirements = (0, exports.getModuleRequirements)(dependencyApp, catalog);
|
|
26
|
+
requirements.operations.push(...dependencyRequirements.operations);
|
|
27
|
+
requirements.applications.push(...dependencyRequirements.applications);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return requirements;
|
|
31
|
+
};
|
|
32
|
+
exports.getModuleRequirements = getModuleRequirements;
|
|
33
|
+
//# sourceMappingURL=get-operations.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-operations.utility.js","sourceRoot":"","sources":["../../../../src/authorization/utilities/get-operations.utility.ts"],"names":[],"mappings":";;;AAEA,iEAA6D;AAOtD,MAAM,qBAAqB,GAAG,CACnC,MAAsB,EACtB,OAAyB,EACzB,WAAmB,EACnB,gBAA2B,KAAK,EACZ,EAAE;;IACtB,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;IACzC,MAAM,YAAY,GAAuB;QACvC,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,EAAE;KACjB,CAAC;IAEF,IAAG,CAAA,MAAA,MAAM,CAAC,aAAa,0CAAE,MAAM,KAAI,WAAW,EAAE,CAAC;QAC/C,MAAM,eAAe,GAAG,IAAA,0CAAmB,EAAC,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;QAChF,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;IACnD,CAAC;IAED,IAAG,MAAA,MAAM,CAAC,aAAa,0CAAE,UAAU,EAAE,CAAC;QACpC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACnE,CAAC;IAED,IAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACtB,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAEnE,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,sBAAsB,GAAG,IAAA,6BAAqB,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC7E,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;YACnE,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;QACzE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAA;AApCY,QAAA,qBAAqB,yBAoCjC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HttpMethod } from "../../catalog/authorization.interface";
|
|
2
|
+
import { ModuleMetadata } from "../../catalog";
|
|
3
|
+
export declare const getRoutesOperations: (module: ModuleMetadata, requestMethod: HttpMethod, requestURL: string) => string[];
|
|
4
|
+
//# sourceMappingURL=get-route-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-route-operations.d.ts","sourceRoot":"","sources":["../../../../src/authorization/utilities/get-route-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAsB,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,eAAO,MAAM,mBAAmB,WAAY,cAAc,iBAAiB,UAAU,cAAc,MAAM,aAQxG,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRoutesOperations = void 0;
|
|
4
|
+
const path_to_regexp_1 = require("path-to-regexp");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const getRoutesOperations = (module, requestMethod, requestURL) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
if ((module === null || module === void 0 ? void 0 : module.authorization) && ((_a = module === null || module === void 0 ? void 0 : module.authorization) === null || _a === void 0 ? void 0 : _a.routes)) {
|
|
9
|
+
const routes = ((_b = module === null || module === void 0 ? void 0 : module.authorization) === null || _b === void 0 ? void 0 : _b.routes) || [];
|
|
10
|
+
const route = resolveRouteSpecificity(routes, requestURL, requestMethod);
|
|
11
|
+
return (route === null || route === void 0 ? void 0 : route.operations) || [];
|
|
12
|
+
}
|
|
13
|
+
return [];
|
|
14
|
+
};
|
|
15
|
+
exports.getRoutesOperations = getRoutesOperations;
|
|
16
|
+
const resolveRouteSpecificity = (routes, reqURL, reqMethod) => {
|
|
17
|
+
const matchingRoutes = routes.filter(route => {
|
|
18
|
+
return validateRoutePattern(route.pattern, reqURL)
|
|
19
|
+
&& ((route.methods && route.methods.includes(reqMethod)) || !route.methods);
|
|
20
|
+
});
|
|
21
|
+
if (matchingRoutes.length === 0) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (matchingRoutes.length === 1) {
|
|
25
|
+
return matchingRoutes[0];
|
|
26
|
+
}
|
|
27
|
+
return matchingRoutes.sort((a, b) => {
|
|
28
|
+
return getRoutePatternSpecificity(b.pattern) - getRoutePatternSpecificity(a.pattern);
|
|
29
|
+
})[0];
|
|
30
|
+
};
|
|
31
|
+
function validateRoutePattern(pattern, url) {
|
|
32
|
+
return (0, path_to_regexp_1.pathToRegexp)(pattern).test(url);
|
|
33
|
+
}
|
|
34
|
+
function getRoutePatternSpecificity(pattern) {
|
|
35
|
+
return pattern.split("/").reduce((acc, part) => {
|
|
36
|
+
if (part === constants_1.ROUTE_PATTERN_WILD_CARD) {
|
|
37
|
+
return acc + 1;
|
|
38
|
+
}
|
|
39
|
+
if (part.startsWith(constants_1.ROUTE_PATTERN_PARAMETER)) {
|
|
40
|
+
return acc + 2;
|
|
41
|
+
}
|
|
42
|
+
return acc + 3;
|
|
43
|
+
}, 0);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=get-route-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-route-operations.js","sourceRoot":"","sources":["../../../../src/authorization/utilities/get-route-operations.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,4CAAgF;AAMzE,MAAM,mBAAmB,GAAG,CAAC,MAAsB,EAAE,aAAyB,EAAE,UAAkB,EAAE,EAAE;;IAC3G,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,MAAI,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,0CAAE,MAAM,CAAA,EAAE,CAAC;QAC3D,MAAM,MAAM,GAAG,CAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,0CAAE,MAAM,KAAI,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,uBAAuB,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QACzE,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,KAAI,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAA;AARY,QAAA,mBAAmB,uBAQ/B;AAED,MAAM,uBAAuB,GAAG,CAAC,MAA4B,EAAE,MAAc,EAAE,SAAqB,EAAE,EAAE;IACtG,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC3C,OAAO,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;eAC7C,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAClC,OAAO,0BAA0B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,CAAA;AAED,SAAS,oBAAoB,CAAC,OAAgB,EAAE,GAAW;IACzD,OAAO,IAAA,6BAAY,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,0BAA0B,CAAC,OAAgB;IAClD,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QAC7C,IAAI,IAAI,KAAK,mCAAuB,EAAE,CAAC;YACrC,OAAO,GAAG,GAAG,CAAC,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,mCAAuB,CAAC,EAAE,CAAC;YAC7C,OAAO,GAAG,GAAG,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,GAAG,GAAG,CAAC,CAAC;IACjB,CAAC,EAAE,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/authorization/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAuthorized = void 0;
|
|
4
|
+
var is_authorized_utility_1 = require("./is-authorized.utility");
|
|
5
|
+
Object.defineProperty(exports, "isAuthorized", { enumerable: true, get: function () { return is_authorized_utility_1.isAuthorized; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/authorization/utilities/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuD;AAA9C,qHAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModuleMetadata } from "../../catalog";
|
|
2
|
+
import { HttpMethod } from "../../catalog/authorization.interface";
|
|
3
|
+
import { Application } from "../application.model";
|
|
4
|
+
import { Operation } from "../operation.model";
|
|
5
|
+
export declare const isAuthorized: (module: ModuleMetadata, catalog: ModuleMetadata[], allowedApplications: Application[], allowedOperations: Operation[], requestPath?: string, requestMethod?: HttpMethod) => boolean;
|
|
6
|
+
//# sourceMappingURL=is-authorized.utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-authorized.utility.d.ts","sourceRoot":"","sources":["../../../../src/authorization/utilities/is-authorized.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,eAAO,MAAM,YAAY,WACf,cAAc,WACb,cAAc,EAAE,uBACJ,WAAW,EAAE,qBACf,SAAS,EAAE,gBAChB,MAAM,kBACL,UAAU,KACxB,OAQF,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAuthorized = void 0;
|
|
4
|
+
const filter_app_operations_1 = require("./filter-app-operations");
|
|
5
|
+
const get_operations_utility_1 = require("./get-operations.utility");
|
|
6
|
+
const isAuthorized = (module, catalog, allowedApplications, allowedOperations, requestPath, requestMethod = "GET") => {
|
|
7
|
+
const { operations, applications } = (0, get_operations_utility_1.getModuleRequirements)(module, catalog, requestPath, requestMethod);
|
|
8
|
+
if (!validateApplications(applications, allowedApplications)) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return validateOperations(operations, applications, allowedOperations);
|
|
12
|
+
};
|
|
13
|
+
exports.isAuthorized = isAuthorized;
|
|
14
|
+
function validateApplications(applications, allowedApplications) {
|
|
15
|
+
return applications.every(app => allowedApplications.some(allowedApp => allowedApp.name === app));
|
|
16
|
+
}
|
|
17
|
+
function validateOperations(operations, applications, allowedOperations) {
|
|
18
|
+
const filteredOperations = (0, filter_app_operations_1.filterAppOperations)(allowedOperations, applications);
|
|
19
|
+
return operations.every(op => filteredOperations.some(allowedOp => allowedOp.name === op));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=is-authorized.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-authorized.utility.js","sourceRoot":"","sources":["../../../../src/authorization/utilities/is-authorized.utility.ts"],"names":[],"mappings":";;;AAIA,mEAA8D;AAC9D,qEAAiE;AAE1D,MAAM,YAAY,GAAG,CAC1B,MAAsB,EACtB,OAAyB,EACzB,mBAAkC,EAClC,iBAA8B,EAC9B,WAAoB,EACpB,gBAA4B,KAAK,EACxB,EAAE;IACX,MAAM,EAAE,UAAU,EAAE,YAAY,EAAC,GAAG,IAAA,8CAAqB,EAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;IAEvG,IAAG,CAAC,oBAAoB,CAAC,YAAY,EAAC,mBAAmB,CAAC,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,kBAAkB,CAAC,UAAU,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;AACzE,CAAC,CAAA;AAfY,QAAA,YAAY,gBAexB;AAGD,SAAS,oBAAoB,CAAC,YAAsB,EAAE,mBAAkC;IACtF,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;AACpG,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAoB,EAAE,YAAsB,EAAE,iBAA8B;IACtG,MAAM,kBAAkB,GAAG,IAAA,2CAAmB,EAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAChF,OAAO,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type HttpMethod = 'GET' | 'HEAD' | 'OPTIONS' | 'PUT' | 'POST' | 'DELETE' | 'PATCH' | 'CONNECT' | 'TRACE';
|
|
2
|
+
export interface RouteAuthorization {
|
|
3
|
+
methods?: HttpMethod[];
|
|
4
|
+
pattern: string;
|
|
5
|
+
operations: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface AuthorizationMetadata {
|
|
8
|
+
operations?: string[];
|
|
9
|
+
routes?: RouteAuthorization[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=authorization.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.interface.d.ts","sourceRoot":"","sources":["../../../src/catalog/authorization.interface.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhH,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.interface.js","sourceRoot":"","sources":["../../../src/catalog/authorization.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-repository.interface.d.ts","sourceRoot":"","sources":["../../../src/catalog/catalog-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,cAAc,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-repository.interface.js","sourceRoot":"","sources":["../../../src/catalog/catalog-repository.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AllowedResources } from "../authorization/allowed-resources.interface";
|
|
2
|
+
import { CatalogRepository } from "./catalog-repository.interface";
|
|
3
|
+
import { ModuleMetadata } from "./module-metadata.interface";
|
|
4
|
+
export declare class CatalogService {
|
|
5
|
+
private readonly catalogRepository;
|
|
6
|
+
constructor(catalogRepository: CatalogRepository);
|
|
7
|
+
findAllModules(): Promise<ModuleMetadata[]>;
|
|
8
|
+
findAllowedModules(allowedResources: AllowedResources, catalog?: ModuleMetadata[]): Promise<ModuleMetadata[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=catalog.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.service.d.ts","sourceRoot":"","sources":["../../../src/catalog/catalog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,iBAAiB;IAGjD,cAAc,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAI3C,kBAAkB,CACtB,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,cAAc,EAAE,GACzB,OAAO,CAAC,cAAc,EAAE,CAAC;CAM7B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.CatalogService = void 0;
|
|
13
|
+
const authorization_1 = require("../authorization");
|
|
14
|
+
class CatalogService {
|
|
15
|
+
constructor(catalogRepository) {
|
|
16
|
+
this.catalogRepository = catalogRepository;
|
|
17
|
+
}
|
|
18
|
+
findAllModules() {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return yield this.catalogRepository.findAllModules();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
findAllowedModules(allowedResources, catalog) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const { applications, operations } = allowedResources;
|
|
26
|
+
const allCatalog = catalog !== null && catalog !== void 0 ? catalog : yield this.findAllModules();
|
|
27
|
+
return allCatalog.filter(module => (0, authorization_1.isAuthorized)(module, allCatalog, applications, operations));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.CatalogService = CatalogService;
|
|
32
|
+
//# sourceMappingURL=catalog.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.service.js","sourceRoot":"","sources":["../../../src/catalog/catalog.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgD;AAKhD,MAAa,cAAc;IACzB,YACmB,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IACnD,CAAC;IAEC,cAAc;;YAClB,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;QACvD,CAAC;KAAA;IAEK,kBAAkB,CACtB,gBAAkC,EAClC,OAA0B;;YAG1B,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC;YACtD,MAAM,UAAU,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1D,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAA,4BAAY,EAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;QACjG,CAAC;KAAA;CACF;AAlBD,wCAkBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CatalogService } from './catalog.service';
|
|
2
|
+
export { CatalogRepository } from './catalog-repository.interface';
|
|
3
|
+
export * from './module-metadata.interface';
|
|
4
|
+
export * from './ui-types.constants';
|
|
5
|
+
export * from './repositories';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/catalog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CatalogService = void 0;
|
|
18
|
+
var catalog_service_1 = require("./catalog.service");
|
|
19
|
+
Object.defineProperty(exports, "CatalogService", { enumerable: true, get: function () { return catalog_service_1.CatalogService; } });
|
|
20
|
+
__exportStar(require("./module-metadata.interface"), exports);
|
|
21
|
+
__exportStar(require("./ui-types.constants"), exports);
|
|
22
|
+
__exportStar(require("./repositories"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/catalog/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAEvB,8DAA4C;AAC5C,uDAAqC;AACrC,iDAA+B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AuthorizationMetadata } from "./authorization.interface";
|
|
2
|
+
import { ServiceConfig } from "./service-config.interface";
|
|
3
|
+
import { UIConfig } from "./ui-config.interface";
|
|
4
|
+
import { UI_TYPES } from "./ui-types.constants";
|
|
5
|
+
export interface ModuleMetadata {
|
|
6
|
+
/**
|
|
7
|
+
* Unique name of module
|
|
8
|
+
* */
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Display name of module
|
|
12
|
+
* */
|
|
13
|
+
displayName: string;
|
|
14
|
+
/**
|
|
15
|
+
* Version of the module
|
|
16
|
+
* */
|
|
17
|
+
version?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Type of the module
|
|
20
|
+
*/
|
|
21
|
+
type: typeof UI_TYPES[number];
|
|
22
|
+
/**
|
|
23
|
+
* The base url of the module
|
|
24
|
+
* */
|
|
25
|
+
baseUrl: string;
|
|
26
|
+
/**
|
|
27
|
+
* The service configuration
|
|
28
|
+
* */
|
|
29
|
+
service: ServiceConfig;
|
|
30
|
+
/**
|
|
31
|
+
* The UI configuration
|
|
32
|
+
* */
|
|
33
|
+
ui?: UIConfig;
|
|
34
|
+
/**
|
|
35
|
+
* The modules that this module depends on
|
|
36
|
+
* */
|
|
37
|
+
dependsOn: string[];
|
|
38
|
+
/**
|
|
39
|
+
* The authorization configuration
|
|
40
|
+
* */
|
|
41
|
+
authorization?: AuthorizationMetadata;
|
|
42
|
+
/**
|
|
43
|
+
* The application that this module belongs to
|
|
44
|
+
*/
|
|
45
|
+
application?: string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=module-metadata.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-metadata.interface.d.ts","sourceRoot":"","sources":["../../../src/catalog/module-metadata.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B;;SAEK;IACL,IAAI,EAAE,MAAM,CAAC;IAEb;;SAEK;IACL,WAAW,EAAE,MAAM,CAAC;IAEpB;;SAEK;IACL,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE9B;;SAEK;IACL,OAAO,EAAE,MAAM,CAAC;IAEhB;;SAEK;IACL,OAAO,EAAE,aAAa,CAAC;IAEvB;;SAEK;IACL,EAAE,CAAC,EAAE,QAAQ,CAAC;IAEd;;SAEK;IACL,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;SAEK;IACL,aAAa,CAAC,EAAE,qBAAqB,CAAC;IAEtC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-metadata.interface.js","sourceRoot":"","sources":["../../../src/catalog/module-metadata.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CatalogRepository } from "../catalog-repository.interface";
|
|
2
|
+
import { ModuleMetadata } from "../module-metadata.interface";
|
|
3
|
+
export declare class CatalogHttpRepository implements CatalogRepository {
|
|
4
|
+
private readonly catalogServiceUrl;
|
|
5
|
+
private readonly sessionCookie;
|
|
6
|
+
constructor(catalogServiceUrl: string, sessionCookie: string);
|
|
7
|
+
findAllModules(): Promise<ModuleMetadata[]>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=http.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.repository.d.ts","sourceRoot":"","sources":["../../../../src/catalog/repositories/http.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,qBAAa,qBAAsB,YAAW,iBAAiB;IAEjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAAU,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAzD,iBAAiB,EAAE,MAAM,EAAmB,aAAa,EAAE,MAAM;IAExF,cAAc,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;CAmBlD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.CatalogHttpRepository = void 0;
|
|
13
|
+
const enrichAppWithVersionMetadata_1 = require("../versions/enrichAppWithVersionMetadata");
|
|
14
|
+
class CatalogHttpRepository {
|
|
15
|
+
constructor(catalogServiceUrl, sessionCookie) {
|
|
16
|
+
this.catalogServiceUrl = catalogServiceUrl;
|
|
17
|
+
this.sessionCookie = sessionCookie;
|
|
18
|
+
}
|
|
19
|
+
findAllModules() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const response = yield fetch(`${this.catalogServiceUrl}/catalog`, {
|
|
22
|
+
headers: {
|
|
23
|
+
Cookie: this.sessionCookie,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok)
|
|
27
|
+
throw new Error(`Error fetching modules catalog: ${response.statusText}`);
|
|
28
|
+
const modules = yield response.json();
|
|
29
|
+
try {
|
|
30
|
+
yield Promise.all(modules.map((module) => (0, enrichAppWithVersionMetadata_1.enrichAppWithVersionMetadata)(module, this.sessionCookie)));
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
throw new Error('Error enriching applications with version metadata');
|
|
34
|
+
}
|
|
35
|
+
return modules;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.CatalogHttpRepository = CatalogHttpRepository;
|
|
40
|
+
//# sourceMappingURL=http.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.repository.js","sourceRoot":"","sources":["../../../../src/catalog/repositories/http.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,2FAAwF;AAExF,MAAa,qBAAqB;IAEhC,YAA6B,iBAAyB,EAAmB,aAAqB;QAAjE,sBAAiB,GAAjB,iBAAiB,CAAQ;QAAmB,kBAAa,GAAb,aAAa,CAAQ;IAAI,CAAC;IAE7F,cAAc;;YAClB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,iBAAiB,UAAU,EAAE;gBAChE,OAAO,EAAE;oBACP,MAAM,EAAE,IAAI,CAAC,aAAa;iBAC3B;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAE5F,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAsB,CAAC;YAE1D,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,2DAA4B,EAAC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YACvG,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;YACxE,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF;AAvBD,sDAuBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/catalog/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./http.repository"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/catalog/repositories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ServiceConfig {
|
|
2
|
+
/**
|
|
3
|
+
* The host of the service
|
|
4
|
+
* */
|
|
5
|
+
host: string;
|
|
6
|
+
/**
|
|
7
|
+
* The port of the service
|
|
8
|
+
* */
|
|
9
|
+
port: number;
|
|
10
|
+
/**
|
|
11
|
+
* The protocol of the service.
|
|
12
|
+
* Default is "http".
|
|
13
|
+
* In case that your service uses SSL then it must be "https".
|
|
14
|
+
*/
|
|
15
|
+
protocol?: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=service-config.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-config.interface.d.ts","sourceRoot":"","sources":["../../../src/catalog/service-config.interface.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC5B;;SAEK;IACL,IAAI,EAAE,MAAM,CAAC;IACb;;SAEK;IACL,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-config.interface.js","sourceRoot":"","sources":["../../../src/catalog/service-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface UIConfig {
|
|
2
|
+
/**
|
|
3
|
+
* The route that the app will be mounted on
|
|
4
|
+
* */
|
|
5
|
+
route: string;
|
|
6
|
+
/**
|
|
7
|
+
* A DOM selector that specifies the point in the DOM where the application must be mounted into.
|
|
8
|
+
* If not specified then PAE will look for one with the id `pae-app:${NAME}` that must be present.
|
|
9
|
+
*/
|
|
10
|
+
mountAtSelector?: string | null;
|
|
11
|
+
/**
|
|
12
|
+
* The name of the bundle file
|
|
13
|
+
* */
|
|
14
|
+
bundleFile: string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom props to pass to the app
|
|
17
|
+
* */
|
|
18
|
+
customProps: Record<string, any>;
|
|
19
|
+
/**
|
|
20
|
+
* Tells whether this app is the product's shell.
|
|
21
|
+
* There should only be one shell defined at a time.
|
|
22
|
+
* If you declare more than one then PAE will take the first one (order depends on the catalog storage such
|
|
23
|
+
* a DB query result)
|
|
24
|
+
*/
|
|
25
|
+
shell?: boolean;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ui-config.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-config.interface.d.ts","sourceRoot":"","sources":["../../../src/catalog/ui-config.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB;;SAEK;IACL,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;SAEK;IACL,UAAU,EAAE,MAAM,CAAC;IAEnB;;SAEK;IACL,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-config.interface.js","sourceRoot":"","sources":["../../../src/catalog/ui-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-types.constants.d.ts","sourceRoot":"","sources":["../../../src/catalog/ui-types.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,UAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-types.constants.js","sourceRoot":"","sources":["../../../src/catalog/ui-types.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModuleMetadata } from "../module-metadata.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Modifies the given AppMetadata to inject the runtime version of the service.
|
|
4
|
+
* For that it makes a request to the service /version endpoint (convention)
|
|
5
|
+
* If the service fails to respond then it won't fail but generate an empty version ("-")
|
|
6
|
+
*/
|
|
7
|
+
export declare function enrichAppWithVersionMetadata(module: ModuleMetadata, sessionCookie: string): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=enrichAppWithVersionMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrichAppWithVersionMetadata.d.ts","sourceRoot":"","sources":["../../../../src/catalog/versions/enrichAppWithVersionMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D;;;;GAIG;AACH,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/G"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.enrichAppWithVersionMetadata = void 0;
|
|
36
|
+
const fetchRuntimeMetadata_1 = __importStar(require("./fetchRuntimeMetadata"));
|
|
37
|
+
/**
|
|
38
|
+
* Modifies the given AppMetadata to inject the runtime version of the service.
|
|
39
|
+
* For that it makes a request to the service /version endpoint (convention)
|
|
40
|
+
* If the service fails to respond then it won't fail but generate an empty version ("-")
|
|
41
|
+
*/
|
|
42
|
+
function enrichAppWithVersionMetadata(module, sessionCookie) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const metadata = yield (0, fetchRuntimeMetadata_1.default)(module, sessionCookie);
|
|
45
|
+
module.displayName = (metadata === null || metadata === void 0 ? void 0 : metadata.displayName) || (0, fetchRuntimeMetadata_1.getDisplayName)(module);
|
|
46
|
+
module.version = (metadata === null || metadata === void 0 ? void 0 : metadata.version) || '-';
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.enrichAppWithVersionMetadata = enrichAppWithVersionMetadata;
|
|
50
|
+
//# sourceMappingURL=enrichAppWithVersionMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrichAppWithVersionMetadata.js","sourceRoot":"","sources":["../../../../src/catalog/versions/enrichAppWithVersionMetadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+EAA8E;AAE9E;;;;GAIG;AACH,SAAsB,4BAA4B,CAAC,MAAsB,EAAE,aAAqB;;QAC9F,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAoB,EAAC,MAAM,EAAE,aAAa,CAAC,CAAA;QAClE,MAAM,CAAC,WAAW,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,KAAI,IAAA,qCAAc,EAAC,MAAM,CAAC,CAAC;QACrE,MAAM,CAAC,OAAO,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,KAAI,GAAG,CAAC;IAC5C,CAAC;CAAA;AAJD,oEAIC"}
|