oc 0.49.21 → 0.49.22
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/CHANGELOG.md +4 -0
- package/dist/cli/domain/get-mocked-plugins.js +2 -3
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +1 -2
- package/dist/cli/domain/local.d.ts +1 -1
- package/dist/cli/domain/registry.d.ts +1 -1
- package/dist/cli/programmatic-api.d.ts +2 -2
- package/dist/components/oc-client/_package/package.json +1 -1
- package/dist/components/oc-client/package.json +1 -1
- package/dist/registry/domain/components-cache/components-list.d.ts +3 -3
- package/dist/registry/domain/components-cache/components-list.js +28 -5
- package/dist/registry/domain/components-cache/index.js +27 -22
- package/dist/registry/domain/components-details.js +1 -2
- package/dist/registry/domain/events-handler.d.ts +3 -3
- package/dist/registry/domain/plugins-initialiser.d.ts +1 -1
- package/dist/registry/domain/repository.d.ts +1 -1
- package/dist/registry/domain/storage-adapter.d.ts +2 -2
- package/dist/registry/domain/url-builder.d.ts +1 -1
- package/dist/registry/domain/validators/node-version.d.ts +3 -3
- package/dist/registry/domain/validators/oc-cli-version.d.ts +3 -3
- package/dist/registry/domain/validators/plugins-requirements.d.ts +1 -1
- package/dist/registry/domain/validators/registry-configuration.d.ts +1 -1
- package/dist/registry/domain/validators/uploaded-package.d.ts +1 -1
- package/dist/registry/index.js +2 -3
- package/dist/registry/routes/helpers/get-available-dependencies.js +2 -3
- package/dist/registry/routes/helpers/get-component-fallback.d.ts +1 -1
- package/dist/registry/routes/helpers/is-url-discoverable.js +1 -2
- package/dist/registry/views/info.d.ts +1 -1
- package/dist/registry/views/partials/selected-checkbox.d.ts +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/utils/is-template-legacy.d.ts +1 -1
- package/logintervals.md +1 -1
- package/package.json +20 -20
- package/tsconfig.json +1 -1
- package/dist/components/oc-client/_package/src/oc-client.min.js +0 -3
- package/dist/components/oc-client/_package/src/oc-client.min.map +0 -1
- package/dist/components/oc-client/src/oc-client.min.js +0 -3
- package/dist/components/oc-client/src/oc-client.min.map +0 -1
- package/src/cli/commands.ts +0 -178
- package/src/cli/domain/clean.ts +0 -21
- package/src/cli/domain/get-components-by-dir.ts +0 -47
- package/src/cli/domain/get-mocked-plugins.ts +0 -154
- package/src/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.ts +0 -17
- package/src/cli/domain/handle-dependencies/get-compiler.ts +0 -35
- package/src/cli/domain/handle-dependencies/get-missing-dependencies.ts +0 -17
- package/src/cli/domain/handle-dependencies/index.ts +0 -93
- package/src/cli/domain/handle-dependencies/install-compiler.ts +0 -43
- package/src/cli/domain/handle-dependencies/install-missing-dependencies.ts +0 -48
- package/src/cli/domain/handle-dependencies/link-missing-dependencies.ts +0 -45
- package/src/cli/domain/handle-dependencies/require-template.ts +0 -62
- package/src/cli/domain/init-template/index.ts +0 -26
- package/src/cli/domain/init-template/install-template.ts +0 -52
- package/src/cli/domain/init-template/scaffold.ts +0 -45
- package/src/cli/domain/local.ts +0 -77
- package/src/cli/domain/mock.ts +0 -40
- package/src/cli/domain/package-components.ts +0 -61
- package/src/cli/domain/registry.ts +0 -147
- package/src/cli/domain/url-parser.ts +0 -44
- package/src/cli/domain/watch.ts +0 -33
- package/src/cli/facade/clean.ts +0 -75
- package/src/cli/facade/dev.ts +0 -214
- package/src/cli/facade/init.ts +0 -50
- package/src/cli/facade/mock.ts +0 -20
- package/src/cli/facade/package.ts +0 -65
- package/src/cli/facade/preview.ts +0 -28
- package/src/cli/facade/publish.ts +0 -209
- package/src/cli/facade/registry-add.ts +0 -23
- package/src/cli/facade/registry-ls.ts +0 -36
- package/src/cli/facade/registry-remove.ts +0 -23
- package/src/cli/facade/registry.ts +0 -9
- package/src/cli/index.ts +0 -142
- package/src/cli/logger.ts +0 -38
- package/src/cli/programmatic-api.ts +0 -142
- package/src/cli/validate-command.ts +0 -18
- package/src/components/oc-client/_package/package.json +0 -1
- package/src/components/oc-client/_package/server.js +0 -1
- package/src/components/oc-client/_package/src/oc-client.min.js +0 -3
- package/src/components/oc-client/_package/src/oc-client.min.map +0 -1
- package/src/components/oc-client/_package/template.js +0 -1
- package/src/components/oc-client/package.json +0 -26
- package/src/components/oc-client/server.js +0 -6
- package/src/components/oc-client/src/oc-client.min.js +0 -3
- package/src/components/oc-client/src/oc-client.min.map +0 -1
- package/src/components/oc-client/template.js +0 -4
- package/src/globals.d.ts +0 -103
- package/src/index.ts +0 -3
- package/src/oc-cli.js +0 -3
- package/src/registry/app-start.ts +0 -75
- package/src/registry/domain/authentication.ts +0 -59
- package/src/registry/domain/components-cache/components-list.ts +0 -70
- package/src/registry/domain/components-cache/index.ts +0 -90
- package/src/registry/domain/components-details.ts +0 -96
- package/src/registry/domain/events-handler.ts +0 -86
- package/src/registry/domain/extract-package.ts +0 -45
- package/src/registry/domain/get-package-json-from-temp-dir.ts +0 -9
- package/src/registry/domain/nested-renderer.ts +0 -88
- package/src/registry/domain/options-sanitiser.ts +0 -118
- package/src/registry/domain/plugins-initialiser.ts +0 -127
- package/src/registry/domain/register-templates.ts +0 -41
- package/src/registry/domain/repository.ts +0 -390
- package/src/registry/domain/require-wrapper.ts +0 -39
- package/src/registry/domain/sanitiser.ts +0 -60
- package/src/registry/domain/storage-adapter.ts +0 -85
- package/src/registry/domain/url-builder.ts +0 -80
- package/src/registry/domain/validators/component-parameters.ts +0 -112
- package/src/registry/domain/validators/index.ts +0 -24
- package/src/registry/domain/validators/node-version.ts +0 -59
- package/src/registry/domain/validators/oc-cli-version.ts +0 -52
- package/src/registry/domain/validators/package-json-validator.ts +0 -35
- package/src/registry/domain/validators/plugins-requirements.ts +0 -39
- package/src/registry/domain/validators/registry-configuration.ts +0 -143
- package/src/registry/domain/validators/uploaded-package.ts +0 -49
- package/src/registry/domain/version-handler.ts +0 -25
- package/src/registry/index.ts +0 -117
- package/src/registry/middleware/base-url-handler.ts +0 -16
- package/src/registry/middleware/cors.ts +0 -18
- package/src/registry/middleware/discovery-handler.ts +0 -20
- package/src/registry/middleware/file-uploads.ts +0 -28
- package/src/registry/middleware/index.ts +0 -53
- package/src/registry/middleware/request-handler.ts +0 -30
- package/src/registry/router.ts +0 -85
- package/src/registry/routes/component-info.ts +0 -119
- package/src/registry/routes/component-preview.ts +0 -87
- package/src/registry/routes/component.ts +0 -53
- package/src/registry/routes/components.ts +0 -107
- package/src/registry/routes/dependencies.ts +0 -27
- package/src/registry/routes/helpers/apply-default-values.ts +0 -29
- package/src/registry/routes/helpers/get-available-dependencies.ts +0 -31
- package/src/registry/routes/helpers/get-component-fallback.ts +0 -139
- package/src/registry/routes/helpers/get-component-retrieving-info.ts +0 -44
- package/src/registry/routes/helpers/get-component.ts +0 -583
- package/src/registry/routes/helpers/get-components-history.ts +0 -40
- package/src/registry/routes/helpers/is-url-discoverable.ts +0 -18
- package/src/registry/routes/index.ts +0 -127
- package/src/registry/routes/plugins.ts +0 -19
- package/src/registry/routes/publish.ts +0 -89
- package/src/registry/routes/static-redirector.ts +0 -74
- package/src/registry/views/index.ts +0 -66
- package/src/registry/views/info.ts +0 -89
- package/src/registry/views/partials/component-author.ts +0 -32
- package/src/registry/views/partials/component-parameters.ts +0 -53
- package/src/registry/views/partials/component-state.ts +0 -14
- package/src/registry/views/partials/component-versions.ts +0 -16
- package/src/registry/views/partials/components-dependencies.ts +0 -26
- package/src/registry/views/partials/components-history.ts +0 -24
- package/src/registry/views/partials/components-list.ts +0 -65
- package/src/registry/views/partials/components-plugins.ts +0 -23
- package/src/registry/views/partials/components-templates.ts +0 -36
- package/src/registry/views/partials/layout.ts +0 -32
- package/src/registry/views/partials/property.ts +0 -17
- package/src/registry/views/partials/selected-checkbox.ts +0 -16
- package/src/registry/views/preview.ts +0 -37
- package/src/registry/views/static/index.ts +0 -92
- package/src/registry/views/static/info.ts +0 -43
- package/src/registry/views/static/style.ts +0 -277
- package/src/resources/index.ts +0 -279
- package/src/resources/settings.ts +0 -17
- package/src/types.ts +0 -251
- package/src/utils/clean-require.ts +0 -35
- package/src/utils/date-stringify.ts +0 -23
- package/src/utils/error-to-string.ts +0 -13
- package/src/utils/is-template-legacy.ts +0 -7
- package/src/utils/is-template-valid.ts +0 -19
- package/src/utils/module-exists.ts +0 -14
- package/src/utils/npm-utils.ts +0 -109
- package/src/utils/put.ts +0 -35
- package/src/utils/strip-version.ts +0 -6
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { Request, Response } from 'express';
|
|
2
|
-
import { IncomingHttpHeaders } from 'http';
|
|
3
|
-
import request from 'minimal-request';
|
|
4
|
-
import url from 'url';
|
|
5
|
-
import { Component, Config } from '../../../types';
|
|
6
|
-
import * as urlBuilder from '../../domain/url-builder';
|
|
7
|
-
import { GetComponentResult } from './get-component';
|
|
8
|
-
|
|
9
|
-
type ComponentCallback = (
|
|
10
|
-
err: { registryError: any; fallbackError: any } | null,
|
|
11
|
-
data: Component
|
|
12
|
-
) => void;
|
|
13
|
-
|
|
14
|
-
function getComponentFallbackForViewType(
|
|
15
|
-
buildUrl: (
|
|
16
|
-
component: {
|
|
17
|
-
name: string;
|
|
18
|
-
version?: string;
|
|
19
|
-
parameters?: Record<string, string>;
|
|
20
|
-
},
|
|
21
|
-
baseUrl: string
|
|
22
|
-
) => string,
|
|
23
|
-
conf: Config,
|
|
24
|
-
req: Request,
|
|
25
|
-
res: Response,
|
|
26
|
-
registryError: string | null,
|
|
27
|
-
callback: ComponentCallback
|
|
28
|
-
) {
|
|
29
|
-
const path = buildUrl(
|
|
30
|
-
{
|
|
31
|
-
name: req.params['componentName'],
|
|
32
|
-
version: req.params['componentVersion']
|
|
33
|
-
},
|
|
34
|
-
conf.fallbackRegistryUrl
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return request(
|
|
38
|
-
{
|
|
39
|
-
method: 'get',
|
|
40
|
-
url: path,
|
|
41
|
-
headers: {
|
|
42
|
-
...req.headers,
|
|
43
|
-
host: url.parse(conf.fallbackRegistryUrl).host,
|
|
44
|
-
accept: 'application/json'
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
(fallbackErr, fallbackResponse: string) => {
|
|
48
|
-
if (fallbackErr === 304) {
|
|
49
|
-
return res.status(304).send('');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (fallbackErr) {
|
|
53
|
-
return callback(
|
|
54
|
-
{
|
|
55
|
-
registryError: registryError,
|
|
56
|
-
fallbackError: fallbackErr
|
|
57
|
-
},
|
|
58
|
-
undefined as any
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
return callback(null, JSON.parse(fallbackResponse));
|
|
64
|
-
} catch (parseError) {
|
|
65
|
-
return callback(
|
|
66
|
-
{
|
|
67
|
-
registryError: registryError,
|
|
68
|
-
fallbackError: `Could not parse fallback response: ${fallbackResponse}`
|
|
69
|
-
},
|
|
70
|
-
undefined as any
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function getComponent(
|
|
78
|
-
fallbackRegistryUrl: string,
|
|
79
|
-
headers: IncomingHttpHeaders,
|
|
80
|
-
component: { name: string; version: string; parameters: IncomingHttpHeaders },
|
|
81
|
-
callback: (result: GetComponentResult) => void
|
|
82
|
-
): void {
|
|
83
|
-
return request(
|
|
84
|
-
{
|
|
85
|
-
method: 'post',
|
|
86
|
-
url: fallbackRegistryUrl,
|
|
87
|
-
headers: { ...headers, host: url.parse(fallbackRegistryUrl).host },
|
|
88
|
-
json: true,
|
|
89
|
-
body: { components: [component] }
|
|
90
|
-
},
|
|
91
|
-
(err, res: GetComponentResult[]) => {
|
|
92
|
-
if (err || !res || res.length === 0) {
|
|
93
|
-
return callback({
|
|
94
|
-
status: 404,
|
|
95
|
-
response: {
|
|
96
|
-
code: 'NOT_FOUND',
|
|
97
|
-
error: err as any
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return callback(res[0]);
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function getComponentPreview(
|
|
108
|
-
conf: Config,
|
|
109
|
-
req: Request,
|
|
110
|
-
res: Response,
|
|
111
|
-
registryError: string | null,
|
|
112
|
-
callback: ComponentCallback
|
|
113
|
-
): void {
|
|
114
|
-
getComponentFallbackForViewType(
|
|
115
|
-
urlBuilder.componentPreview,
|
|
116
|
-
conf,
|
|
117
|
-
req,
|
|
118
|
-
res,
|
|
119
|
-
registryError,
|
|
120
|
-
callback
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function getComponentInfo(
|
|
125
|
-
conf: Config,
|
|
126
|
-
req: Request,
|
|
127
|
-
res: Response,
|
|
128
|
-
registryError: string | null,
|
|
129
|
-
callback: ComponentCallback
|
|
130
|
-
): void {
|
|
131
|
-
getComponentFallbackForViewType(
|
|
132
|
-
urlBuilder.componentInfo,
|
|
133
|
-
conf,
|
|
134
|
-
req,
|
|
135
|
-
res,
|
|
136
|
-
registryError,
|
|
137
|
-
callback
|
|
138
|
-
);
|
|
139
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { IncomingHttpHeaders } from 'http';
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
headers: IncomingHttpHeaders;
|
|
5
|
-
name: string;
|
|
6
|
-
parameters: IncomingHttpHeaders;
|
|
7
|
-
version: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface EventData {
|
|
11
|
-
headers: IncomingHttpHeaders;
|
|
12
|
-
name: string;
|
|
13
|
-
parameters: IncomingHttpHeaders;
|
|
14
|
-
requestVersion: string;
|
|
15
|
-
duration: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default function getComponentRetrievingInfo(options: Options): {
|
|
19
|
-
extend(obj: unknown): void;
|
|
20
|
-
getData(): EventData;
|
|
21
|
-
} {
|
|
22
|
-
const eventData: EventData = {
|
|
23
|
-
headers: options.headers,
|
|
24
|
-
name: options.name,
|
|
25
|
-
parameters: options.parameters,
|
|
26
|
-
requestVersion: options.version || '',
|
|
27
|
-
duration: 0
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const start = process.hrtime();
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
extend(obj: unknown) {
|
|
34
|
-
Object.assign(eventData, obj);
|
|
35
|
-
},
|
|
36
|
-
getData() {
|
|
37
|
-
const delta = process.hrtime(start);
|
|
38
|
-
const nanosec = delta[0] * 1e9 + delta[1];
|
|
39
|
-
eventData.duration = nanosec / 1e3;
|
|
40
|
-
|
|
41
|
-
return eventData;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|