oc 0.49.8 → 0.49.9
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/dist/cli/commands.d.ts +163 -163
- package/dist/cli/commands.js +162 -162
- package/dist/cli/domain/clean.d.ts +2 -2
- package/dist/cli/domain/clean.js +24 -24
- package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
- package/dist/cli/domain/get-components-by-dir.js +41 -41
- package/dist/cli/domain/get-mocked-plugins.d.ts +10 -10
- package/dist/cli/domain/get-mocked-plugins.js +89 -89
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +6 -6
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +16 -16
- package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +10 -10
- package/dist/cli/domain/handle-dependencies/get-compiler.js +28 -28
- package/dist/cli/domain/handle-dependencies/get-missing-dependencies.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/get-missing-dependencies.js +18 -18
- package/dist/cli/domain/handle-dependencies/index.d.ts +10 -10
- package/dist/cli/domain/handle-dependencies/index.js +70 -70
- package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +8 -8
- package/dist/cli/domain/handle-dependencies/install-compiler.js +54 -54
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +5 -5
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +59 -59
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +6 -6
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.js +32 -32
- package/dist/cli/domain/handle-dependencies/require-template.d.ts +17 -17
- package/dist/cli/domain/handle-dependencies/require-template.js +34 -34
- package/dist/cli/domain/init-template/index.d.ts +10 -10
- package/dist/cli/domain/init-template/index.js +40 -40
- package/dist/cli/domain/init-template/install-template.d.ts +11 -11
- package/dist/cli/domain/init-template/install-template.js +54 -54
- package/dist/cli/domain/init-template/scaffold.d.ts +11 -11
- package/dist/cli/domain/init-template/scaffold.js +30 -30
- package/dist/cli/domain/local.d.ts +2 -2
- package/dist/cli/domain/local.js +82 -82
- package/dist/cli/domain/mock.d.ts +5 -5
- package/dist/cli/domain/mock.js +33 -33
- package/dist/cli/domain/package-components.d.ts +9 -9
- package/dist/cli/domain/package-components.js +67 -67
- package/dist/cli/domain/registry.d.ts +6 -6
- package/dist/cli/domain/registry.js +136 -136
- package/dist/cli/domain/url-parser.d.ts +14 -14
- package/dist/cli/domain/url-parser.js +31 -31
- package/dist/cli/domain/watch.d.ts +1 -1
- package/dist/cli/domain/watch.js +29 -29
- package/dist/cli/facade/clean.d.ts +16 -16
- package/dist/cli/facade/clean.js +58 -58
- package/dist/cli/facade/dev.d.ts +114 -114
- package/dist/cli/facade/dev.js +176 -176
- package/dist/cli/facade/init.d.ts +18 -18
- package/dist/cli/facade/init.js +39 -39
- package/dist/cli/facade/mock.d.ts +18 -18
- package/dist/cli/facade/mock.js +12 -12
- package/dist/cli/facade/package.d.ts +18 -18
- package/dist/cli/facade/package.js +49 -49
- package/dist/cli/facade/preview.d.ts +14 -14
- package/dist/cli/facade/preview.js +20 -20
- package/dist/cli/facade/publish.d.ts +23 -23
- package/dist/cli/facade/publish.js +145 -145
- package/dist/cli/facade/registry-add.d.ts +14 -14
- package/dist/cli/facade/registry-add.js +18 -18
- package/dist/cli/facade/registry-ls.d.ts +10 -10
- package/dist/cli/facade/registry-ls.js +27 -27
- package/dist/cli/facade/registry-remove.d.ts +14 -14
- package/dist/cli/facade/registry-remove.js +18 -18
- package/dist/cli/facade/registry.d.ts +5 -5
- package/dist/cli/facade/registry.js +9 -9
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +91 -91
- package/dist/cli/logger.d.ts +8 -8
- package/dist/cli/logger.js +19 -19
- package/dist/cli/programmatic-api.d.ts +84 -84
- package/dist/cli/programmatic-api.js +66 -66
- package/dist/cli/validate-command.d.ts +2 -2
- package/dist/cli/validate-command.js +18 -18
- package/dist/components/oc-client/_package/package.json +1 -1
- package/dist/components/oc-client/package.json +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -12
- package/dist/oc-cli.d.ts +2 -2
- package/dist/oc-cli.js +3 -3
- package/dist/registry/app-start.d.ts +2 -2
- package/dist/registry/app-start.js +44 -44
- package/dist/registry/domain/authentication.d.ts +7 -7
- package/dist/registry/domain/authentication.js +53 -53
- package/dist/registry/domain/components-cache/components-list.d.ts +8 -8
- package/dist/registry/domain/components-cache/components-list.js +50 -50
- package/dist/registry/domain/components-cache/index.d.ts +7 -7
- package/dist/registry/domain/components-cache/index.js +76 -76
- package/dist/registry/domain/components-details.d.ts +6 -6
- package/dist/registry/domain/components-details.js +64 -64
- package/dist/registry/domain/events-handler.d.ts +40 -40
- package/dist/registry/domain/events-handler.js +37 -37
- package/dist/registry/domain/extract-package.d.ts +8 -8
- package/dist/registry/domain/extract-package.js +26 -26
- package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +2 -2
- package/dist/registry/domain/get-package-json-from-temp-dir.js +11 -11
- package/dist/registry/domain/nested-renderer.d.ts +14 -14
- package/dist/registry/domain/nested-renderer.js +59 -59
- package/dist/registry/domain/options-sanitiser.d.ts +6 -6
- package/dist/registry/domain/options-sanitiser.js +106 -106
- package/dist/registry/domain/plugins-initialiser.d.ts +3 -3
- package/dist/registry/domain/plugins-initialiser.js +95 -95
- package/dist/registry/domain/register-templates.d.ts +5 -5
- package/dist/registry/domain/register-templates.js +30 -30
- package/dist/registry/domain/repository.d.ts +2 -2
- package/dist/registry/domain/repository.js +237 -237
- package/dist/registry/domain/require-wrapper.d.ts +2 -2
- package/dist/registry/domain/require-wrapper.js +33 -33
- package/dist/registry/domain/sanitiser.d.ts +2 -2
- package/dist/registry/domain/sanitiser.js +52 -52
- package/dist/registry/domain/storage-adapter.d.ts +10 -10
- package/dist/registry/domain/storage-adapter.js +55 -55
- package/dist/registry/domain/url-builder.d.ts +10 -10
- package/dist/registry/domain/url-builder.js +60 -60
- package/dist/registry/domain/validators/component-parameters.d.ts +11 -11
- package/dist/registry/domain/validators/component-parameters.js +79 -79
- package/dist/registry/domain/validators/index.d.ts +16 -16
- package/dist/registry/domain/validators/index.js +29 -29
- package/dist/registry/domain/validators/node-version.d.ts +15 -15
- package/dist/registry/domain/validators/node-version.js +40 -40
- package/dist/registry/domain/validators/oc-cli-version.d.ts +15 -15
- package/dist/registry/domain/validators/oc-cli-version.js +34 -34
- package/dist/registry/domain/validators/package-json-validator.d.ts +13 -13
- package/dist/registry/domain/validators/package-json-validator.js +23 -23
- package/dist/registry/domain/validators/plugins-requirements.d.ts +9 -9
- package/dist/registry/domain/validators/plugins-requirements.js +22 -22
- package/dist/registry/domain/validators/registry-configuration.d.ts +9 -9
- package/dist/registry/domain/validators/registry-configuration.js +113 -113
- package/dist/registry/domain/validators/uploaded-package.d.ts +14 -14
- package/dist/registry/domain/validators/uploaded-package.js +25 -25
- package/dist/registry/domain/version-handler.d.ts +2 -2
- package/dist/registry/domain/version-handler.js +22 -22
- package/dist/registry/index.d.ts +48 -48
- package/dist/registry/index.js +107 -107
- package/dist/registry/middleware/base-url-handler.d.ts +2 -2
- package/dist/registry/middleware/base-url-handler.js +12 -12
- package/dist/registry/middleware/cors.d.ts +2 -2
- package/dist/registry/middleware/cors.js +11 -11
- package/dist/registry/middleware/discovery-handler.d.ts +2 -2
- package/dist/registry/middleware/discovery-handler.js +15 -15
- package/dist/registry/middleware/file-uploads.d.ts +2 -2
- package/dist/registry/middleware/file-uploads.js +23 -23
- package/dist/registry/middleware/index.d.ts +7 -7
- package/dist/registry/middleware/index.js +51 -51
- package/dist/registry/middleware/request-handler.d.ts +2 -2
- package/dist/registry/middleware/request-handler.js +30 -30
- package/dist/registry/router.d.ts +3 -3
- package/dist/registry/router.js +56 -56
- package/dist/registry/routes/component-info.d.ts +3 -3
- package/dist/registry/routes/component-info.js +90 -90
- package/dist/registry/routes/component-preview.d.ts +3 -3
- package/dist/registry/routes/component-preview.js +68 -68
- package/dist/registry/routes/component.d.ts +3 -3
- package/dist/registry/routes/component.js +43 -43
- package/dist/registry/routes/components.d.ts +3 -3
- package/dist/registry/routes/components.js +78 -78
- package/dist/registry/routes/dependencies.d.ts +3 -3
- package/dist/registry/routes/dependencies.js +28 -28
- package/dist/registry/routes/helpers/apply-default-values.d.ts +2 -2
- package/dist/registry/routes/helpers/apply-default-values.js +13 -13
- package/dist/registry/routes/helpers/get-available-dependencies.d.ts +8 -8
- package/dist/registry/routes/helpers/get-available-dependencies.js +24 -24
- package/dist/registry/routes/helpers/get-component-fallback.d.ts +17 -17
- package/dist/registry/routes/helpers/get-component-fallback.js +91 -91
- package/dist/registry/routes/helpers/get-component-retrieving-info.d.ts +20 -20
- package/dist/registry/routes/helpers/get-component-retrieving-info.js +24 -24
- package/dist/registry/routes/helpers/get-component.d.ts +33 -33
- package/dist/registry/routes/helpers/get-component.js +406 -406
- package/dist/registry/routes/helpers/get-components-history.d.ts +8 -8
- package/dist/registry/routes/helpers/get-components-history.js +28 -28
- package/dist/registry/routes/helpers/is-url-discoverable.d.ts +3 -3
- package/dist/registry/routes/helpers/is-url-discoverable.js +22 -22
- package/dist/registry/routes/index.d.ts +3 -3
- package/dist/registry/routes/index.js +93 -93
- package/dist/registry/routes/plugins.d.ts +3 -3
- package/dist/registry/routes/plugins.js +17 -17
- package/dist/registry/routes/publish.d.ts +3 -3
- package/dist/registry/routes/publish.js +97 -97
- package/dist/registry/routes/static-redirector.d.ts +3 -3
- package/dist/registry/routes/static-redirector.js +63 -63
- package/dist/registry/views/index.d.ts +2 -2
- package/dist/registry/views/index.js +39 -39
- package/dist/registry/views/info.d.ts +16 -16
- package/dist/registry/views/info.js +39 -39
- package/dist/registry/views/partials/component-author.d.ts +8 -8
- package/dist/registry/views/partials/component-author.js +20 -20
- package/dist/registry/views/partials/component-parameters.d.ts +5 -5
- package/dist/registry/views/partials/component-parameters.js +24 -24
- package/dist/registry/views/partials/component-state.d.ts +5 -5
- package/dist/registry/views/partials/component-state.js +6 -6
- package/dist/registry/views/partials/component-versions.d.ts +5 -5
- package/dist/registry/views/partials/component-versions.js +9 -9
- package/dist/registry/views/partials/components-dependencies.d.ts +2 -2
- package/dist/registry/views/partials/components-dependencies.js +12 -12
- package/dist/registry/views/partials/components-history.d.ts +2 -2
- package/dist/registry/views/partials/components-history.js +10 -10
- package/dist/registry/views/partials/components-list.d.ts +2 -2
- package/dist/registry/views/partials/components-list.js +26 -26
- package/dist/registry/views/partials/components-plugins.d.ts +2 -2
- package/dist/registry/views/partials/components-plugins.js +8 -8
- package/dist/registry/views/partials/components-templates.d.ts +2 -2
- package/dist/registry/views/partials/components-templates.js +14 -14
- package/dist/registry/views/partials/layout.d.ts +8 -8
- package/dist/registry/views/partials/layout.js +11 -11
- package/dist/registry/views/partials/property.d.ts +2 -2
- package/dist/registry/views/partials/property.js +11 -11
- package/dist/registry/views/partials/selected-checkbox.d.ts +4 -4
- package/dist/registry/views/partials/selected-checkbox.js +7 -7
- package/dist/registry/views/preview.d.ts +8 -8
- package/dist/registry/views/preview.js +9 -9
- package/dist/registry/views/static/index.d.ts +2 -2
- package/dist/registry/views/static/index.js +3 -3
- package/dist/registry/views/static/info.d.ts +2 -2
- package/dist/registry/views/static/info.js +3 -3
- package/dist/registry/views/static/style.d.ts +2 -2
- package/dist/registry/views/static/style.js +3 -3
- package/dist/resources/index.d.ts +134 -134
- package/dist/resources/index.js +145 -145
- package/dist/resources/settings.d.ts +17 -17
- package/dist/resources/settings.js +18 -18
- package/dist/types.d.ts +287 -287
- package/dist/types.js +2 -2
- package/dist/utils/clean-require.d.ts +16 -16
- package/dist/utils/clean-require.js +18 -18
- package/dist/utils/date-stringify.d.ts +1 -1
- package/dist/utils/date-stringify.js +22 -22
- package/dist/utils/error-to-string.d.ts +1 -1
- package/dist/utils/error-to-string.js +15 -15
- package/dist/utils/is-template-legacy.d.ts +3 -3
- package/dist/utils/is-template-legacy.js +6 -6
- package/dist/utils/is-template-valid.d.ts +4 -4
- package/dist/utils/is-template-valid.js +12 -12
- package/dist/utils/module-exists.d.ts +1 -1
- package/dist/utils/module-exists.js +15 -15
- package/dist/utils/npm-utils.d.ts +20 -20
- package/dist/utils/npm-utils.js +74 -74
- package/dist/utils/put.d.ts +2 -2
- package/dist/utils/put.js +29 -29
- package/dist/utils/strip-version.d.ts +1 -1
- package/dist/utils/strip-version.js +11 -11
- package/logintervals.md +1 -1
- package/package.json +1 -1
- package/src/cli/facade/dev.ts +1 -1
- package/src/components/oc-client/_package/package.json +1 -1
- package/src/components/oc-client/package.json +1 -1
- package/src/oc-cli.js +0 -0
package/dist/registry/router.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.create = void 0;
|
|
7
|
-
const component_1 = __importDefault(require("./routes/component"));
|
|
8
|
-
const components_1 = __importDefault(require("./routes/components"));
|
|
9
|
-
const component_info_1 = __importDefault(require("./routes/component-info"));
|
|
10
|
-
const component_preview_1 = __importDefault(require("./routes/component-preview"));
|
|
11
|
-
const routes_1 = __importDefault(require("./routes"));
|
|
12
|
-
const publish_1 = __importDefault(require("./routes/publish"));
|
|
13
|
-
const static_redirector_1 = __importDefault(require("./routes/static-redirector"));
|
|
14
|
-
const plugins_1 = __importDefault(require("./routes/plugins"));
|
|
15
|
-
const dependencies_1 = __importDefault(require("./routes/dependencies"));
|
|
16
|
-
const settings_1 = __importDefault(require("../resources/settings"));
|
|
17
|
-
function create(app, conf, repository) {
|
|
18
|
-
const routes = {
|
|
19
|
-
component: (0, component_1.default)(conf, repository),
|
|
20
|
-
components: (0, components_1.default)(conf, repository),
|
|
21
|
-
componentInfo: (0, component_info_1.default)(conf, repository),
|
|
22
|
-
componentPreview: (0, component_preview_1.default)(conf, repository),
|
|
23
|
-
index: (0, routes_1.default)(repository),
|
|
24
|
-
publish: (0, publish_1.default)(repository),
|
|
25
|
-
staticRedirector: (0, static_redirector_1.default)(repository),
|
|
26
|
-
plugins: (0, plugins_1.default)(conf),
|
|
27
|
-
dependencies: (0, dependencies_1.default)(conf)
|
|
28
|
-
};
|
|
29
|
-
const prefix = conf.prefix;
|
|
30
|
-
if (prefix !== '/') {
|
|
31
|
-
app.get('/', (_req, res) => res.redirect(prefix));
|
|
32
|
-
app.get(prefix.substr(0, prefix.length - 1), routes.index);
|
|
33
|
-
}
|
|
34
|
-
app.get(`${prefix}oc-client/client.js`, routes.staticRedirector);
|
|
35
|
-
app.get(`${prefix}oc-client/oc-client.min.map`, routes.staticRedirector);
|
|
36
|
-
app.get(`${prefix}~registry/plugins`, routes.plugins);
|
|
37
|
-
app.get(`${prefix}~registry/dependencies`, routes.dependencies);
|
|
38
|
-
if (conf.local) {
|
|
39
|
-
app.get(`${prefix}:componentName/:componentVersion/${settings_1.default.registry.localStaticRedirectorPath}*`, routes.staticRedirector);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
app.put(`${prefix}:componentName/:componentVersion`, conf.beforePublish, routes.publish);
|
|
43
|
-
}
|
|
44
|
-
app.get(prefix, routes.index);
|
|
45
|
-
app.post(prefix, routes.components);
|
|
46
|
-
app.get(`${prefix}:componentName/:componentVersion${settings_1.default.registry.componentInfoPath}`, routes.componentInfo);
|
|
47
|
-
app.get(`${prefix}:componentName${settings_1.default.registry.componentInfoPath}`, routes.componentInfo);
|
|
48
|
-
app.get(`${prefix}:componentName/:componentVersion${settings_1.default.registry.componentPreviewPath}`, routes.componentPreview);
|
|
49
|
-
app.get(`${prefix}:componentName${settings_1.default.registry.componentPreviewPath}`, routes.componentPreview);
|
|
50
|
-
app.get(`${prefix}:componentName/:componentVersion`, routes.component);
|
|
51
|
-
app.get(`${prefix}:componentName`, routes.component);
|
|
52
|
-
if (conf.routes) {
|
|
53
|
-
conf.routes.forEach(route => app[route.method.toLowerCase()](route.route, route.handler));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.create = create;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.create = void 0;
|
|
7
|
+
const component_1 = __importDefault(require("./routes/component"));
|
|
8
|
+
const components_1 = __importDefault(require("./routes/components"));
|
|
9
|
+
const component_info_1 = __importDefault(require("./routes/component-info"));
|
|
10
|
+
const component_preview_1 = __importDefault(require("./routes/component-preview"));
|
|
11
|
+
const routes_1 = __importDefault(require("./routes"));
|
|
12
|
+
const publish_1 = __importDefault(require("./routes/publish"));
|
|
13
|
+
const static_redirector_1 = __importDefault(require("./routes/static-redirector"));
|
|
14
|
+
const plugins_1 = __importDefault(require("./routes/plugins"));
|
|
15
|
+
const dependencies_1 = __importDefault(require("./routes/dependencies"));
|
|
16
|
+
const settings_1 = __importDefault(require("../resources/settings"));
|
|
17
|
+
function create(app, conf, repository) {
|
|
18
|
+
const routes = {
|
|
19
|
+
component: (0, component_1.default)(conf, repository),
|
|
20
|
+
components: (0, components_1.default)(conf, repository),
|
|
21
|
+
componentInfo: (0, component_info_1.default)(conf, repository),
|
|
22
|
+
componentPreview: (0, component_preview_1.default)(conf, repository),
|
|
23
|
+
index: (0, routes_1.default)(repository),
|
|
24
|
+
publish: (0, publish_1.default)(repository),
|
|
25
|
+
staticRedirector: (0, static_redirector_1.default)(repository),
|
|
26
|
+
plugins: (0, plugins_1.default)(conf),
|
|
27
|
+
dependencies: (0, dependencies_1.default)(conf)
|
|
28
|
+
};
|
|
29
|
+
const prefix = conf.prefix;
|
|
30
|
+
if (prefix !== '/') {
|
|
31
|
+
app.get('/', (_req, res) => res.redirect(prefix));
|
|
32
|
+
app.get(prefix.substr(0, prefix.length - 1), routes.index);
|
|
33
|
+
}
|
|
34
|
+
app.get(`${prefix}oc-client/client.js`, routes.staticRedirector);
|
|
35
|
+
app.get(`${prefix}oc-client/oc-client.min.map`, routes.staticRedirector);
|
|
36
|
+
app.get(`${prefix}~registry/plugins`, routes.plugins);
|
|
37
|
+
app.get(`${prefix}~registry/dependencies`, routes.dependencies);
|
|
38
|
+
if (conf.local) {
|
|
39
|
+
app.get(`${prefix}:componentName/:componentVersion/${settings_1.default.registry.localStaticRedirectorPath}*`, routes.staticRedirector);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
app.put(`${prefix}:componentName/:componentVersion`, conf.beforePublish, routes.publish);
|
|
43
|
+
}
|
|
44
|
+
app.get(prefix, routes.index);
|
|
45
|
+
app.post(prefix, routes.components);
|
|
46
|
+
app.get(`${prefix}:componentName/:componentVersion${settings_1.default.registry.componentInfoPath}`, routes.componentInfo);
|
|
47
|
+
app.get(`${prefix}:componentName${settings_1.default.registry.componentInfoPath}`, routes.componentInfo);
|
|
48
|
+
app.get(`${prefix}:componentName/:componentVersion${settings_1.default.registry.componentPreviewPath}`, routes.componentPreview);
|
|
49
|
+
app.get(`${prefix}:componentName${settings_1.default.registry.componentPreviewPath}`, routes.componentPreview);
|
|
50
|
+
app.get(`${prefix}:componentName/:componentVersion`, routes.component);
|
|
51
|
+
app.get(`${prefix}:componentName`, routes.component);
|
|
52
|
+
if (conf.routes) {
|
|
53
|
+
conf.routes.forEach(route => app[route.method.toLowerCase()](route.route, route.handler));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.create = create;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Config, Repository } from '../../types';
|
|
2
|
-
import { Request, Response } from 'express';
|
|
3
|
-
export default function componentInfoRoute(conf: Config, repository: Repository): (req: Request, res: Response) => void;
|
|
1
|
+
import { Config, Repository } from '../../types';
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
export default function componentInfoRoute(conf: Config, repository: Repository): (req: Request, res: Response) => void;
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const parse_author_1 = __importDefault(require("parse-author"));
|
|
26
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
27
|
-
const universalify_1 = require("universalify");
|
|
28
|
-
const getComponentFallback = __importStar(require("./helpers/get-component-fallback"));
|
|
29
|
-
const info_1 = __importDefault(require("../views/info"));
|
|
30
|
-
const is_url_discoverable_1 = __importDefault(require("./helpers/is-url-discoverable"));
|
|
31
|
-
const urlBuilder = __importStar(require("../domain/url-builder"));
|
|
32
|
-
function getParams(component) {
|
|
33
|
-
let params = {};
|
|
34
|
-
if (component.oc.parameters) {
|
|
35
|
-
const mandatoryParams = lodash_1.default.filter(Object.keys(component.oc.parameters || {}), paramName => {
|
|
36
|
-
const param = component.oc.parameters[paramName];
|
|
37
|
-
return !!param.mandatory && !!param.example;
|
|
38
|
-
});
|
|
39
|
-
params = lodash_1.default.mapValues(lodash_1.default.pick(component.oc.parameters, mandatoryParams), x => x.example);
|
|
40
|
-
}
|
|
41
|
-
return params;
|
|
42
|
-
}
|
|
43
|
-
function getParsedAuthor(component) {
|
|
44
|
-
const author = component.author || {};
|
|
45
|
-
return typeof author === 'string' ? (0, parse_author_1.default)(author) : author;
|
|
46
|
-
}
|
|
47
|
-
function componentInfo(err, req, res, component) {
|
|
48
|
-
if (err) {
|
|
49
|
-
res.errorDetails = err.registryError || err;
|
|
50
|
-
res.status(404).json(err);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const isHtmlRequest = !!req.headers.accept && req.headers.accept.indexOf('text/html') >= 0;
|
|
54
|
-
if (isHtmlRequest && !!res.conf.discovery) {
|
|
55
|
-
const params = getParams(component);
|
|
56
|
-
const parsedAuthor = getParsedAuthor(component);
|
|
57
|
-
let href = res.conf.baseUrl;
|
|
58
|
-
const repositoryUrl = lodash_1.default.get(component, 'repository.url', typeof component.repository === 'string' ? component.repository : null);
|
|
59
|
-
(0, universalify_1.fromPromise)(is_url_discoverable_1.default)(href, (_err, result) => {
|
|
60
|
-
if (!result.isDiscoverable) {
|
|
61
|
-
href = `//${req.headers.host}${res.conf.prefix}`;
|
|
62
|
-
}
|
|
63
|
-
res.send((0, info_1.default)({
|
|
64
|
-
component,
|
|
65
|
-
dependencies: Object.keys(component.dependencies || {}),
|
|
66
|
-
href,
|
|
67
|
-
parsedAuthor,
|
|
68
|
-
repositoryUrl,
|
|
69
|
-
sandBoxDefaultQs: urlBuilder.queryString(params),
|
|
70
|
-
title: 'Component Info'
|
|
71
|
-
}));
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
res.status(200).json(Object.assign(component, {
|
|
76
|
-
requestVersion: req.params['componentVersion'] || ''
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function componentInfoRoute(conf, repository) {
|
|
81
|
-
return function (req, res) {
|
|
82
|
-
(0, universalify_1.fromPromise)(repository.getComponent)(req.params['componentName'], req.params['componentVersion'], (registryError, component) => {
|
|
83
|
-
if (registryError && conf.fallbackRegistryUrl) {
|
|
84
|
-
return getComponentFallback.getComponentInfo(conf, req, res, registryError, (fallbackError, fallbackComponent) => componentInfo(fallbackError, req, res, fallbackComponent));
|
|
85
|
-
}
|
|
86
|
-
componentInfo(registryError, req, res, component);
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
exports.default = componentInfoRoute;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const parse_author_1 = __importDefault(require("parse-author"));
|
|
26
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
27
|
+
const universalify_1 = require("universalify");
|
|
28
|
+
const getComponentFallback = __importStar(require("./helpers/get-component-fallback"));
|
|
29
|
+
const info_1 = __importDefault(require("../views/info"));
|
|
30
|
+
const is_url_discoverable_1 = __importDefault(require("./helpers/is-url-discoverable"));
|
|
31
|
+
const urlBuilder = __importStar(require("../domain/url-builder"));
|
|
32
|
+
function getParams(component) {
|
|
33
|
+
let params = {};
|
|
34
|
+
if (component.oc.parameters) {
|
|
35
|
+
const mandatoryParams = lodash_1.default.filter(Object.keys(component.oc.parameters || {}), paramName => {
|
|
36
|
+
const param = component.oc.parameters[paramName];
|
|
37
|
+
return !!param.mandatory && !!param.example;
|
|
38
|
+
});
|
|
39
|
+
params = lodash_1.default.mapValues(lodash_1.default.pick(component.oc.parameters, mandatoryParams), x => x.example);
|
|
40
|
+
}
|
|
41
|
+
return params;
|
|
42
|
+
}
|
|
43
|
+
function getParsedAuthor(component) {
|
|
44
|
+
const author = component.author || {};
|
|
45
|
+
return typeof author === 'string' ? (0, parse_author_1.default)(author) : author;
|
|
46
|
+
}
|
|
47
|
+
function componentInfo(err, req, res, component) {
|
|
48
|
+
if (err) {
|
|
49
|
+
res.errorDetails = err.registryError || err;
|
|
50
|
+
res.status(404).json(err);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const isHtmlRequest = !!req.headers.accept && req.headers.accept.indexOf('text/html') >= 0;
|
|
54
|
+
if (isHtmlRequest && !!res.conf.discovery) {
|
|
55
|
+
const params = getParams(component);
|
|
56
|
+
const parsedAuthor = getParsedAuthor(component);
|
|
57
|
+
let href = res.conf.baseUrl;
|
|
58
|
+
const repositoryUrl = lodash_1.default.get(component, 'repository.url', typeof component.repository === 'string' ? component.repository : null);
|
|
59
|
+
(0, universalify_1.fromPromise)(is_url_discoverable_1.default)(href, (_err, result) => {
|
|
60
|
+
if (!result.isDiscoverable) {
|
|
61
|
+
href = `//${req.headers.host}${res.conf.prefix}`;
|
|
62
|
+
}
|
|
63
|
+
res.send((0, info_1.default)({
|
|
64
|
+
component,
|
|
65
|
+
dependencies: Object.keys(component.dependencies || {}),
|
|
66
|
+
href,
|
|
67
|
+
parsedAuthor,
|
|
68
|
+
repositoryUrl,
|
|
69
|
+
sandBoxDefaultQs: urlBuilder.queryString(params),
|
|
70
|
+
title: 'Component Info'
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
res.status(200).json(Object.assign(component, {
|
|
76
|
+
requestVersion: req.params['componentVersion'] || ''
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function componentInfoRoute(conf, repository) {
|
|
81
|
+
return function (req, res) {
|
|
82
|
+
(0, universalify_1.fromPromise)(repository.getComponent)(req.params['componentName'], req.params['componentVersion'], (registryError, component) => {
|
|
83
|
+
if (registryError && conf.fallbackRegistryUrl) {
|
|
84
|
+
return getComponentFallback.getComponentInfo(conf, req, res, registryError, (fallbackError, fallbackComponent) => componentInfo(fallbackError, req, res, fallbackComponent));
|
|
85
|
+
}
|
|
86
|
+
componentInfo(registryError, req, res, component);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
exports.default = componentInfoRoute;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Request, Response } from 'express';
|
|
2
|
-
import { Config, Repository } from '../../types';
|
|
3
|
-
export default function componentPreviewRoute(conf: Config, repository: Repository): (req: Request, res: Response) => void;
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { Config, Repository } from '../../types';
|
|
3
|
+
export default function componentPreviewRoute(conf: Config, repository: Repository): (req: Request, res: Response) => void;
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const getComponentFallback = __importStar(require("./helpers/get-component-fallback"));
|
|
26
|
-
const preview_1 = __importDefault(require("../views/preview"));
|
|
27
|
-
const urlBuilder = __importStar(require("../domain/url-builder"));
|
|
28
|
-
const universalify_1 = require("universalify");
|
|
29
|
-
function componentPreview(err, req, res, component, templates) {
|
|
30
|
-
if (err) {
|
|
31
|
-
res.errorDetails = err.registryError || err;
|
|
32
|
-
res.errorCode = 'NOT_FOUND';
|
|
33
|
-
res.status(404).json(err);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
let liveReload = '';
|
|
37
|
-
if (res.conf.liveReloadPort) {
|
|
38
|
-
liveReload = `<script src="http://localhost:${res.conf.liveReloadPort}/livereload.js?snipver=1"></script>`;
|
|
39
|
-
}
|
|
40
|
-
const isHtmlRequest = !!req.headers.accept && req.headers.accept.indexOf('text/html') >= 0;
|
|
41
|
-
if (isHtmlRequest && !!res.conf.discovery) {
|
|
42
|
-
res.send((0, preview_1.default)({
|
|
43
|
-
component,
|
|
44
|
-
href: res.conf.baseUrl,
|
|
45
|
-
liveReload,
|
|
46
|
-
qs: urlBuilder.queryString(req.query),
|
|
47
|
-
templates
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
res.status(200).json(Object.assign(component, {
|
|
52
|
-
requestVersion: req.params['componentVersion'] || ''
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function componentPreviewRoute(conf, repository) {
|
|
57
|
-
return (req, res) => {
|
|
58
|
-
(0, universalify_1.fromPromise)(repository.getComponent)(req.params['componentName'], req.params['componentVersion'], (registryError, component) => {
|
|
59
|
-
if (registryError && conf.fallbackRegistryUrl) {
|
|
60
|
-
return getComponentFallback.getComponentPreview(conf, req, res, registryError, (fallbackError, fallbackComponent) => {
|
|
61
|
-
componentPreview(fallbackError, req, res, fallbackComponent, repository.getTemplatesInfo());
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
componentPreview(registryError, req, res, component, repository.getTemplatesInfo());
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
exports.default = componentPreviewRoute;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const getComponentFallback = __importStar(require("./helpers/get-component-fallback"));
|
|
26
|
+
const preview_1 = __importDefault(require("../views/preview"));
|
|
27
|
+
const urlBuilder = __importStar(require("../domain/url-builder"));
|
|
28
|
+
const universalify_1 = require("universalify");
|
|
29
|
+
function componentPreview(err, req, res, component, templates) {
|
|
30
|
+
if (err) {
|
|
31
|
+
res.errorDetails = err.registryError || err;
|
|
32
|
+
res.errorCode = 'NOT_FOUND';
|
|
33
|
+
res.status(404).json(err);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let liveReload = '';
|
|
37
|
+
if (res.conf.liveReloadPort) {
|
|
38
|
+
liveReload = `<script src="http://localhost:${res.conf.liveReloadPort}/livereload.js?snipver=1"></script>`;
|
|
39
|
+
}
|
|
40
|
+
const isHtmlRequest = !!req.headers.accept && req.headers.accept.indexOf('text/html') >= 0;
|
|
41
|
+
if (isHtmlRequest && !!res.conf.discovery) {
|
|
42
|
+
res.send((0, preview_1.default)({
|
|
43
|
+
component,
|
|
44
|
+
href: res.conf.baseUrl,
|
|
45
|
+
liveReload,
|
|
46
|
+
qs: urlBuilder.queryString(req.query),
|
|
47
|
+
templates
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
res.status(200).json(Object.assign(component, {
|
|
52
|
+
requestVersion: req.params['componentVersion'] || ''
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function componentPreviewRoute(conf, repository) {
|
|
57
|
+
return (req, res) => {
|
|
58
|
+
(0, universalify_1.fromPromise)(repository.getComponent)(req.params['componentName'], req.params['componentVersion'], (registryError, component) => {
|
|
59
|
+
if (registryError && conf.fallbackRegistryUrl) {
|
|
60
|
+
return getComponentFallback.getComponentPreview(conf, req, res, registryError, (fallbackError, fallbackComponent) => {
|
|
61
|
+
componentPreview(fallbackError, req, res, fallbackComponent, repository.getTemplatesInfo());
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
componentPreview(registryError, req, res, component, repository.getTemplatesInfo());
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
exports.default = componentPreviewRoute;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Config, Repository } from '../../types';
|
|
2
|
-
import { RequestHandler } from 'express';
|
|
3
|
-
export default function component(conf: Config, repository: Repository): RequestHandler;
|
|
1
|
+
import { Config, Repository } from '../../types';
|
|
2
|
+
import { RequestHandler } from 'express';
|
|
3
|
+
export default function component(conf: Config, repository: Repository): RequestHandler;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const serialize_error_1 = require("serialize-error");
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const get_component_1 = __importDefault(require("./helpers/get-component"));
|
|
9
|
-
const resources_1 = __importDefault(require("../../resources"));
|
|
10
|
-
function component(conf, repository) {
|
|
11
|
-
const getComponent = (0, get_component_1.default)(conf, repository);
|
|
12
|
-
return (req, res) => {
|
|
13
|
-
getComponent({
|
|
14
|
-
conf: res.conf,
|
|
15
|
-
headers: req.headers,
|
|
16
|
-
ip: req.ip,
|
|
17
|
-
name: req.params['componentName'],
|
|
18
|
-
parameters: req.query,
|
|
19
|
-
version: req.params['componentVersion']
|
|
20
|
-
}, result => {
|
|
21
|
-
if (result.response.error) {
|
|
22
|
-
if (lodash_1.default.isError(result.response.error)) {
|
|
23
|
-
result.response.error = (0, serialize_error_1.serializeError)(result.response.error);
|
|
24
|
-
}
|
|
25
|
-
res.errorCode = result.response.code;
|
|
26
|
-
res.errorDetails = result.response.error;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
if (!lodash_1.default.isEmpty(result.headers)) {
|
|
30
|
-
res.set(result.headers);
|
|
31
|
-
}
|
|
32
|
-
res.status(result.status).json(result.response);
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
res.status(500).json({
|
|
36
|
-
code: 'RENDER_ERROR',
|
|
37
|
-
error: resources_1.default.errors.registry.RENDER_ERROR(`${result.response.name}@${result.response.version}`, String(e))
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
exports.default = component;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const serialize_error_1 = require("serialize-error");
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const get_component_1 = __importDefault(require("./helpers/get-component"));
|
|
9
|
+
const resources_1 = __importDefault(require("../../resources"));
|
|
10
|
+
function component(conf, repository) {
|
|
11
|
+
const getComponent = (0, get_component_1.default)(conf, repository);
|
|
12
|
+
return (req, res) => {
|
|
13
|
+
getComponent({
|
|
14
|
+
conf: res.conf,
|
|
15
|
+
headers: req.headers,
|
|
16
|
+
ip: req.ip,
|
|
17
|
+
name: req.params['componentName'],
|
|
18
|
+
parameters: req.query,
|
|
19
|
+
version: req.params['componentVersion']
|
|
20
|
+
}, result => {
|
|
21
|
+
if (result.response.error) {
|
|
22
|
+
if (lodash_1.default.isError(result.response.error)) {
|
|
23
|
+
result.response.error = (0, serialize_error_1.serializeError)(result.response.error);
|
|
24
|
+
}
|
|
25
|
+
res.errorCode = result.response.code;
|
|
26
|
+
res.errorDetails = result.response.error;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
if (!lodash_1.default.isEmpty(result.headers)) {
|
|
30
|
+
res.set(result.headers);
|
|
31
|
+
}
|
|
32
|
+
res.status(result.status).json(result.response);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
res.status(500).json({
|
|
36
|
+
code: 'RENDER_ERROR',
|
|
37
|
+
error: resources_1.default.errors.registry.RENDER_ERROR(`${result.response.name}@${result.response.version}`, String(e))
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.default = component;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Config, Repository } from '../../types';
|
|
2
|
-
import { RequestHandler } from 'express';
|
|
3
|
-
export default function components(conf: Config, repository: Repository): RequestHandler;
|
|
1
|
+
import { Config, Repository } from '../../types';
|
|
2
|
+
import { RequestHandler } from 'express';
|
|
3
|
+
export default function components(conf: Config, repository: Repository): RequestHandler;
|