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.
Files changed (166) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/cli/domain/get-mocked-plugins.js +2 -3
  3. package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +1 -2
  4. package/dist/cli/domain/local.d.ts +1 -1
  5. package/dist/cli/domain/registry.d.ts +1 -1
  6. package/dist/cli/programmatic-api.d.ts +2 -2
  7. package/dist/components/oc-client/_package/package.json +1 -1
  8. package/dist/components/oc-client/package.json +1 -1
  9. package/dist/registry/domain/components-cache/components-list.d.ts +3 -3
  10. package/dist/registry/domain/components-cache/components-list.js +28 -5
  11. package/dist/registry/domain/components-cache/index.js +27 -22
  12. package/dist/registry/domain/components-details.js +1 -2
  13. package/dist/registry/domain/events-handler.d.ts +3 -3
  14. package/dist/registry/domain/plugins-initialiser.d.ts +1 -1
  15. package/dist/registry/domain/repository.d.ts +1 -1
  16. package/dist/registry/domain/storage-adapter.d.ts +2 -2
  17. package/dist/registry/domain/url-builder.d.ts +1 -1
  18. package/dist/registry/domain/validators/node-version.d.ts +3 -3
  19. package/dist/registry/domain/validators/oc-cli-version.d.ts +3 -3
  20. package/dist/registry/domain/validators/plugins-requirements.d.ts +1 -1
  21. package/dist/registry/domain/validators/registry-configuration.d.ts +1 -1
  22. package/dist/registry/domain/validators/uploaded-package.d.ts +1 -1
  23. package/dist/registry/index.js +2 -3
  24. package/dist/registry/routes/helpers/get-available-dependencies.js +2 -3
  25. package/dist/registry/routes/helpers/get-component-fallback.d.ts +1 -1
  26. package/dist/registry/routes/helpers/is-url-discoverable.js +1 -2
  27. package/dist/registry/views/info.d.ts +1 -1
  28. package/dist/registry/views/partials/selected-checkbox.d.ts +1 -1
  29. package/dist/types.d.ts +3 -3
  30. package/dist/utils/is-template-legacy.d.ts +1 -1
  31. package/logintervals.md +1 -1
  32. package/package.json +20 -20
  33. package/tsconfig.json +1 -1
  34. package/dist/components/oc-client/_package/src/oc-client.min.js +0 -3
  35. package/dist/components/oc-client/_package/src/oc-client.min.map +0 -1
  36. package/dist/components/oc-client/src/oc-client.min.js +0 -3
  37. package/dist/components/oc-client/src/oc-client.min.map +0 -1
  38. package/src/cli/commands.ts +0 -178
  39. package/src/cli/domain/clean.ts +0 -21
  40. package/src/cli/domain/get-components-by-dir.ts +0 -47
  41. package/src/cli/domain/get-mocked-plugins.ts +0 -154
  42. package/src/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.ts +0 -17
  43. package/src/cli/domain/handle-dependencies/get-compiler.ts +0 -35
  44. package/src/cli/domain/handle-dependencies/get-missing-dependencies.ts +0 -17
  45. package/src/cli/domain/handle-dependencies/index.ts +0 -93
  46. package/src/cli/domain/handle-dependencies/install-compiler.ts +0 -43
  47. package/src/cli/domain/handle-dependencies/install-missing-dependencies.ts +0 -48
  48. package/src/cli/domain/handle-dependencies/link-missing-dependencies.ts +0 -45
  49. package/src/cli/domain/handle-dependencies/require-template.ts +0 -62
  50. package/src/cli/domain/init-template/index.ts +0 -26
  51. package/src/cli/domain/init-template/install-template.ts +0 -52
  52. package/src/cli/domain/init-template/scaffold.ts +0 -45
  53. package/src/cli/domain/local.ts +0 -77
  54. package/src/cli/domain/mock.ts +0 -40
  55. package/src/cli/domain/package-components.ts +0 -61
  56. package/src/cli/domain/registry.ts +0 -147
  57. package/src/cli/domain/url-parser.ts +0 -44
  58. package/src/cli/domain/watch.ts +0 -33
  59. package/src/cli/facade/clean.ts +0 -75
  60. package/src/cli/facade/dev.ts +0 -214
  61. package/src/cli/facade/init.ts +0 -50
  62. package/src/cli/facade/mock.ts +0 -20
  63. package/src/cli/facade/package.ts +0 -65
  64. package/src/cli/facade/preview.ts +0 -28
  65. package/src/cli/facade/publish.ts +0 -209
  66. package/src/cli/facade/registry-add.ts +0 -23
  67. package/src/cli/facade/registry-ls.ts +0 -36
  68. package/src/cli/facade/registry-remove.ts +0 -23
  69. package/src/cli/facade/registry.ts +0 -9
  70. package/src/cli/index.ts +0 -142
  71. package/src/cli/logger.ts +0 -38
  72. package/src/cli/programmatic-api.ts +0 -142
  73. package/src/cli/validate-command.ts +0 -18
  74. package/src/components/oc-client/_package/package.json +0 -1
  75. package/src/components/oc-client/_package/server.js +0 -1
  76. package/src/components/oc-client/_package/src/oc-client.min.js +0 -3
  77. package/src/components/oc-client/_package/src/oc-client.min.map +0 -1
  78. package/src/components/oc-client/_package/template.js +0 -1
  79. package/src/components/oc-client/package.json +0 -26
  80. package/src/components/oc-client/server.js +0 -6
  81. package/src/components/oc-client/src/oc-client.min.js +0 -3
  82. package/src/components/oc-client/src/oc-client.min.map +0 -1
  83. package/src/components/oc-client/template.js +0 -4
  84. package/src/globals.d.ts +0 -103
  85. package/src/index.ts +0 -3
  86. package/src/oc-cli.js +0 -3
  87. package/src/registry/app-start.ts +0 -75
  88. package/src/registry/domain/authentication.ts +0 -59
  89. package/src/registry/domain/components-cache/components-list.ts +0 -70
  90. package/src/registry/domain/components-cache/index.ts +0 -90
  91. package/src/registry/domain/components-details.ts +0 -96
  92. package/src/registry/domain/events-handler.ts +0 -86
  93. package/src/registry/domain/extract-package.ts +0 -45
  94. package/src/registry/domain/get-package-json-from-temp-dir.ts +0 -9
  95. package/src/registry/domain/nested-renderer.ts +0 -88
  96. package/src/registry/domain/options-sanitiser.ts +0 -118
  97. package/src/registry/domain/plugins-initialiser.ts +0 -127
  98. package/src/registry/domain/register-templates.ts +0 -41
  99. package/src/registry/domain/repository.ts +0 -390
  100. package/src/registry/domain/require-wrapper.ts +0 -39
  101. package/src/registry/domain/sanitiser.ts +0 -60
  102. package/src/registry/domain/storage-adapter.ts +0 -85
  103. package/src/registry/domain/url-builder.ts +0 -80
  104. package/src/registry/domain/validators/component-parameters.ts +0 -112
  105. package/src/registry/domain/validators/index.ts +0 -24
  106. package/src/registry/domain/validators/node-version.ts +0 -59
  107. package/src/registry/domain/validators/oc-cli-version.ts +0 -52
  108. package/src/registry/domain/validators/package-json-validator.ts +0 -35
  109. package/src/registry/domain/validators/plugins-requirements.ts +0 -39
  110. package/src/registry/domain/validators/registry-configuration.ts +0 -143
  111. package/src/registry/domain/validators/uploaded-package.ts +0 -49
  112. package/src/registry/domain/version-handler.ts +0 -25
  113. package/src/registry/index.ts +0 -117
  114. package/src/registry/middleware/base-url-handler.ts +0 -16
  115. package/src/registry/middleware/cors.ts +0 -18
  116. package/src/registry/middleware/discovery-handler.ts +0 -20
  117. package/src/registry/middleware/file-uploads.ts +0 -28
  118. package/src/registry/middleware/index.ts +0 -53
  119. package/src/registry/middleware/request-handler.ts +0 -30
  120. package/src/registry/router.ts +0 -85
  121. package/src/registry/routes/component-info.ts +0 -119
  122. package/src/registry/routes/component-preview.ts +0 -87
  123. package/src/registry/routes/component.ts +0 -53
  124. package/src/registry/routes/components.ts +0 -107
  125. package/src/registry/routes/dependencies.ts +0 -27
  126. package/src/registry/routes/helpers/apply-default-values.ts +0 -29
  127. package/src/registry/routes/helpers/get-available-dependencies.ts +0 -31
  128. package/src/registry/routes/helpers/get-component-fallback.ts +0 -139
  129. package/src/registry/routes/helpers/get-component-retrieving-info.ts +0 -44
  130. package/src/registry/routes/helpers/get-component.ts +0 -583
  131. package/src/registry/routes/helpers/get-components-history.ts +0 -40
  132. package/src/registry/routes/helpers/is-url-discoverable.ts +0 -18
  133. package/src/registry/routes/index.ts +0 -127
  134. package/src/registry/routes/plugins.ts +0 -19
  135. package/src/registry/routes/publish.ts +0 -89
  136. package/src/registry/routes/static-redirector.ts +0 -74
  137. package/src/registry/views/index.ts +0 -66
  138. package/src/registry/views/info.ts +0 -89
  139. package/src/registry/views/partials/component-author.ts +0 -32
  140. package/src/registry/views/partials/component-parameters.ts +0 -53
  141. package/src/registry/views/partials/component-state.ts +0 -14
  142. package/src/registry/views/partials/component-versions.ts +0 -16
  143. package/src/registry/views/partials/components-dependencies.ts +0 -26
  144. package/src/registry/views/partials/components-history.ts +0 -24
  145. package/src/registry/views/partials/components-list.ts +0 -65
  146. package/src/registry/views/partials/components-plugins.ts +0 -23
  147. package/src/registry/views/partials/components-templates.ts +0 -36
  148. package/src/registry/views/partials/layout.ts +0 -32
  149. package/src/registry/views/partials/property.ts +0 -17
  150. package/src/registry/views/partials/selected-checkbox.ts +0 -16
  151. package/src/registry/views/preview.ts +0 -37
  152. package/src/registry/views/static/index.ts +0 -92
  153. package/src/registry/views/static/info.ts +0 -43
  154. package/src/registry/views/static/style.ts +0 -277
  155. package/src/resources/index.ts +0 -279
  156. package/src/resources/settings.ts +0 -17
  157. package/src/types.ts +0 -251
  158. package/src/utils/clean-require.ts +0 -35
  159. package/src/utils/date-stringify.ts +0 -23
  160. package/src/utils/error-to-string.ts +0 -13
  161. package/src/utils/is-template-legacy.ts +0 -7
  162. package/src/utils/is-template-valid.ts +0 -19
  163. package/src/utils/module-exists.ts +0 -14
  164. package/src/utils/npm-utils.ts +0 -109
  165. package/src/utils/put.ts +0 -35
  166. 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
- }