oc 0.49.26 → 0.49.28

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 (247) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cli/commands.d.ts +163 -163
  3. package/dist/cli/commands.js +162 -162
  4. package/dist/cli/domain/clean.d.ts +2 -2
  5. package/dist/cli/domain/clean.js +24 -24
  6. package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
  7. package/dist/cli/domain/get-components-by-dir.js +41 -41
  8. package/dist/cli/domain/get-mocked-plugins.d.ts +10 -10
  9. package/dist/cli/domain/get-mocked-plugins.js +88 -88
  10. package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +6 -6
  11. package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +15 -15
  12. package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +10 -10
  13. package/dist/cli/domain/handle-dependencies/get-compiler.js +28 -28
  14. package/dist/cli/domain/handle-dependencies/get-missing-dependencies.d.ts +1 -1
  15. package/dist/cli/domain/handle-dependencies/get-missing-dependencies.js +18 -18
  16. package/dist/cli/domain/handle-dependencies/index.d.ts +10 -10
  17. package/dist/cli/domain/handle-dependencies/index.js +70 -70
  18. package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +8 -8
  19. package/dist/cli/domain/handle-dependencies/install-compiler.js +58 -58
  20. package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +5 -5
  21. package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +63 -63
  22. package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +6 -6
  23. package/dist/cli/domain/handle-dependencies/link-missing-dependencies.js +32 -32
  24. package/dist/cli/domain/handle-dependencies/require-template.d.ts +17 -17
  25. package/dist/cli/domain/handle-dependencies/require-template.js +34 -34
  26. package/dist/cli/domain/init-template/index.d.ts +10 -10
  27. package/dist/cli/domain/init-template/index.js +44 -44
  28. package/dist/cli/domain/init-template/install-template.d.ts +11 -11
  29. package/dist/cli/domain/init-template/install-template.js +58 -58
  30. package/dist/cli/domain/init-template/scaffold.d.ts +11 -11
  31. package/dist/cli/domain/init-template/scaffold.js +34 -34
  32. package/dist/cli/domain/local.d.ts +21 -21
  33. package/dist/cli/domain/local.js +86 -86
  34. package/dist/cli/domain/mock.d.ts +5 -5
  35. package/dist/cli/domain/mock.js +33 -33
  36. package/dist/cli/domain/package-components.d.ts +9 -9
  37. package/dist/cli/domain/package-components.js +71 -71
  38. package/dist/cli/domain/registry.d.ts +20 -20
  39. package/dist/cli/domain/registry.js +143 -143
  40. package/dist/cli/domain/url-parser.d.ts +14 -14
  41. package/dist/cli/domain/url-parser.js +31 -31
  42. package/dist/cli/domain/watch.d.ts +1 -1
  43. package/dist/cli/domain/watch.js +29 -29
  44. package/dist/cli/facade/clean.d.ts +16 -16
  45. package/dist/cli/facade/clean.js +58 -58
  46. package/dist/cli/facade/dev.d.ts +146 -114
  47. package/dist/cli/facade/dev.js +177 -177
  48. package/dist/cli/facade/init.d.ts +18 -18
  49. package/dist/cli/facade/init.js +39 -39
  50. package/dist/cli/facade/mock.d.ts +18 -18
  51. package/dist/cli/facade/mock.js +12 -12
  52. package/dist/cli/facade/package.d.ts +19 -19
  53. package/dist/cli/facade/package.js +49 -49
  54. package/dist/cli/facade/preview.d.ts +14 -14
  55. package/dist/cli/facade/preview.js +20 -20
  56. package/dist/cli/facade/publish.d.ts +24 -24
  57. package/dist/cli/facade/publish.js +145 -145
  58. package/dist/cli/facade/registry-add.d.ts +14 -14
  59. package/dist/cli/facade/registry-add.js +18 -18
  60. package/dist/cli/facade/registry-ls.d.ts +10 -10
  61. package/dist/cli/facade/registry-ls.js +27 -27
  62. package/dist/cli/facade/registry-remove.d.ts +14 -14
  63. package/dist/cli/facade/registry-remove.js +18 -18
  64. package/dist/cli/facade/registry.d.ts +5 -5
  65. package/dist/cli/facade/registry.js +9 -9
  66. package/dist/cli/index.d.ts +1 -1
  67. package/dist/cli/index.js +91 -91
  68. package/dist/cli/logger.d.ts +8 -8
  69. package/dist/cli/logger.js +19 -19
  70. package/dist/cli/programmatic-api.d.ts +84 -84
  71. package/dist/cli/programmatic-api.js +66 -66
  72. package/dist/cli/validate-command.d.ts +2 -2
  73. package/dist/cli/validate-command.js +18 -18
  74. package/dist/components/oc-client/_package/package.json +1 -1
  75. package/dist/components/oc-client/_package/server.js +1 -1
  76. package/dist/components/oc-client/_package/src/oc-client.min.js +2 -2
  77. package/dist/components/oc-client/_package/src/oc-client.min.map +1 -1
  78. package/dist/components/oc-client/_package/template.js +11 -1
  79. package/dist/components/oc-client/package.json +1 -1
  80. package/dist/components/oc-client/src/oc-client.min.js +2 -2
  81. package/dist/components/oc-client/src/oc-client.min.map +1 -1
  82. package/dist/index.d.ts +3 -3
  83. package/dist/index.js +12 -12
  84. package/dist/oc-cli.d.ts +2 -2
  85. package/dist/oc-cli.js +3 -3
  86. package/dist/registry/app-start.d.ts +3 -3
  87. package/dist/registry/app-start.js +44 -44
  88. package/dist/registry/domain/authentication.d.ts +7 -7
  89. package/dist/registry/domain/authentication.js +53 -53
  90. package/dist/registry/domain/components-cache/components-list.d.ts +8 -8
  91. package/dist/registry/domain/components-cache/components-list.js +73 -73
  92. package/dist/registry/domain/components-cache/index.d.ts +7 -7
  93. package/dist/registry/domain/components-cache/index.js +81 -81
  94. package/dist/registry/domain/components-details.d.ts +6 -6
  95. package/dist/registry/domain/components-details.js +63 -63
  96. package/dist/registry/domain/events-handler.d.ts +48 -40
  97. package/dist/registry/domain/events-handler.js +37 -37
  98. package/dist/registry/domain/extract-package.d.ts +8 -8
  99. package/dist/registry/domain/extract-package.js +30 -30
  100. package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +2 -2
  101. package/dist/registry/domain/get-package-json-from-temp-dir.js +11 -11
  102. package/dist/registry/domain/nested-renderer.d.ts +14 -14
  103. package/dist/registry/domain/nested-renderer.js +59 -59
  104. package/dist/registry/domain/options-sanitiser.d.ts +6 -6
  105. package/dist/registry/domain/options-sanitiser.js +113 -113
  106. package/dist/registry/domain/plugins-initialiser.d.ts +3 -3
  107. package/dist/registry/domain/plugins-initialiser.js +95 -95
  108. package/dist/registry/domain/register-templates.d.ts +5 -5
  109. package/dist/registry/domain/register-templates.js +37 -37
  110. package/dist/registry/domain/repository.d.ts +26 -26
  111. package/dist/registry/domain/repository.js +255 -255
  112. package/dist/registry/domain/require-wrapper.d.ts +2 -2
  113. package/dist/registry/domain/require-wrapper.js +33 -33
  114. package/dist/registry/domain/sanitiser.d.ts +2 -2
  115. package/dist/registry/domain/sanitiser.js +52 -52
  116. package/dist/registry/domain/storage-adapter.d.ts +10 -10
  117. package/dist/registry/domain/storage-adapter.js +55 -55
  118. package/dist/registry/domain/url-builder.d.ts +10 -10
  119. package/dist/registry/domain/url-builder.js +60 -60
  120. package/dist/registry/domain/validators/component-parameters.d.ts +11 -11
  121. package/dist/registry/domain/validators/component-parameters.js +79 -79
  122. package/dist/registry/domain/validators/index.d.ts +16 -16
  123. package/dist/registry/domain/validators/index.js +29 -29
  124. package/dist/registry/domain/validators/node-version.d.ts +15 -15
  125. package/dist/registry/domain/validators/node-version.js +40 -40
  126. package/dist/registry/domain/validators/oc-cli-version.d.ts +15 -15
  127. package/dist/registry/domain/validators/oc-cli-version.js +34 -34
  128. package/dist/registry/domain/validators/package-json-validator.d.ts +13 -13
  129. package/dist/registry/domain/validators/package-json-validator.js +23 -23
  130. package/dist/registry/domain/validators/plugins-requirements.d.ts +9 -9
  131. package/dist/registry/domain/validators/plugins-requirements.js +22 -22
  132. package/dist/registry/domain/validators/registry-configuration.d.ts +9 -9
  133. package/dist/registry/domain/validators/registry-configuration.js +117 -117
  134. package/dist/registry/domain/validators/uploaded-package.d.ts +14 -14
  135. package/dist/registry/domain/validators/uploaded-package.js +25 -25
  136. package/dist/registry/domain/version-handler.d.ts +2 -2
  137. package/dist/registry/domain/version-handler.js +22 -22
  138. package/dist/registry/index.d.ts +64 -48
  139. package/dist/registry/index.js +109 -109
  140. package/dist/registry/middleware/base-url-handler.d.ts +2 -2
  141. package/dist/registry/middleware/base-url-handler.js +12 -12
  142. package/dist/registry/middleware/cors.d.ts +2 -2
  143. package/dist/registry/middleware/cors.js +11 -11
  144. package/dist/registry/middleware/discovery-handler.d.ts +2 -2
  145. package/dist/registry/middleware/discovery-handler.js +15 -15
  146. package/dist/registry/middleware/file-uploads.d.ts +2 -2
  147. package/dist/registry/middleware/file-uploads.js +23 -23
  148. package/dist/registry/middleware/index.d.ts +3 -3
  149. package/dist/registry/middleware/index.js +48 -48
  150. package/dist/registry/middleware/request-handler.d.ts +2 -2
  151. package/dist/registry/middleware/request-handler.js +30 -30
  152. package/dist/registry/router.d.ts +4 -4
  153. package/dist/registry/router.js +56 -56
  154. package/dist/registry/routes/component-info.d.ts +4 -4
  155. package/dist/registry/routes/component-info.js +95 -94
  156. package/dist/registry/routes/component-preview.d.ts +4 -4
  157. package/dist/registry/routes/component-preview.js +72 -72
  158. package/dist/registry/routes/component.d.ts +4 -4
  159. package/dist/registry/routes/component.js +43 -43
  160. package/dist/registry/routes/components.d.ts +4 -4
  161. package/dist/registry/routes/components.js +78 -78
  162. package/dist/registry/routes/dependencies.d.ts +3 -3
  163. package/dist/registry/routes/dependencies.js +28 -28
  164. package/dist/registry/routes/helpers/apply-default-values.d.ts +2 -2
  165. package/dist/registry/routes/helpers/apply-default-values.js +13 -13
  166. package/dist/registry/routes/helpers/get-available-dependencies.d.ts +8 -8
  167. package/dist/registry/routes/helpers/get-available-dependencies.js +23 -23
  168. package/dist/registry/routes/helpers/get-component-fallback.d.ts +17 -17
  169. package/dist/registry/routes/helpers/get-component-fallback.js +95 -95
  170. package/dist/registry/routes/helpers/get-component-retrieving-info.d.ts +20 -20
  171. package/dist/registry/routes/helpers/get-component-retrieving-info.js +24 -24
  172. package/dist/registry/routes/helpers/get-component.d.ts +34 -34
  173. package/dist/registry/routes/helpers/get-component.js +445 -435
  174. package/dist/registry/routes/helpers/get-components-history.d.ts +8 -8
  175. package/dist/registry/routes/helpers/get-components-history.js +28 -28
  176. package/dist/registry/routes/helpers/is-url-discoverable.d.ts +3 -3
  177. package/dist/registry/routes/helpers/is-url-discoverable.js +21 -21
  178. package/dist/registry/routes/index.d.ts +3 -3
  179. package/dist/registry/routes/index.js +93 -93
  180. package/dist/registry/routes/plugins.d.ts +3 -3
  181. package/dist/registry/routes/plugins.js +17 -17
  182. package/dist/registry/routes/publish.d.ts +3 -3
  183. package/dist/registry/routes/publish.js +101 -101
  184. package/dist/registry/routes/static-redirector.d.ts +3 -3
  185. package/dist/registry/routes/static-redirector.js +86 -86
  186. package/dist/registry/views/index.d.ts +2 -2
  187. package/dist/registry/views/index.js +39 -39
  188. package/dist/registry/views/info.d.ts +16 -16
  189. package/dist/registry/views/info.js +39 -39
  190. package/dist/registry/views/partials/component-author.d.ts +8 -8
  191. package/dist/registry/views/partials/component-author.js +20 -20
  192. package/dist/registry/views/partials/component-parameters.d.ts +5 -5
  193. package/dist/registry/views/partials/component-parameters.js +24 -24
  194. package/dist/registry/views/partials/component-state.d.ts +5 -5
  195. package/dist/registry/views/partials/component-state.js +6 -6
  196. package/dist/registry/views/partials/component-versions.d.ts +5 -5
  197. package/dist/registry/views/partials/component-versions.js +9 -9
  198. package/dist/registry/views/partials/components-dependencies.d.ts +2 -2
  199. package/dist/registry/views/partials/components-dependencies.js +12 -12
  200. package/dist/registry/views/partials/components-history.d.ts +2 -2
  201. package/dist/registry/views/partials/components-history.js +10 -10
  202. package/dist/registry/views/partials/components-list.d.ts +2 -2
  203. package/dist/registry/views/partials/components-list.js +26 -26
  204. package/dist/registry/views/partials/components-plugins.d.ts +2 -2
  205. package/dist/registry/views/partials/components-plugins.js +8 -8
  206. package/dist/registry/views/partials/components-templates.d.ts +2 -2
  207. package/dist/registry/views/partials/components-templates.js +14 -14
  208. package/dist/registry/views/partials/layout.d.ts +8 -8
  209. package/dist/registry/views/partials/layout.js +11 -11
  210. package/dist/registry/views/partials/property.d.ts +2 -2
  211. package/dist/registry/views/partials/property.js +11 -11
  212. package/dist/registry/views/partials/selected-checkbox.d.ts +4 -4
  213. package/dist/registry/views/partials/selected-checkbox.js +7 -7
  214. package/dist/registry/views/preview.d.ts +8 -8
  215. package/dist/registry/views/preview.js +9 -9
  216. package/dist/registry/views/static/index.d.ts +2 -2
  217. package/dist/registry/views/static/index.js +3 -3
  218. package/dist/registry/views/static/info.d.ts +2 -2
  219. package/dist/registry/views/static/info.js +3 -3
  220. package/dist/registry/views/static/style.d.ts +2 -2
  221. package/dist/registry/views/static/style.js +3 -3
  222. package/dist/resources/index.d.ts +134 -134
  223. package/dist/resources/index.js +145 -145
  224. package/dist/resources/settings.d.ts +17 -17
  225. package/dist/resources/settings.js +18 -18
  226. package/dist/types.d.ts +231 -231
  227. package/dist/types.js +2 -2
  228. package/dist/utils/clean-require.d.ts +16 -16
  229. package/dist/utils/clean-require.js +18 -18
  230. package/dist/utils/date-stringify.d.ts +1 -1
  231. package/dist/utils/date-stringify.js +22 -22
  232. package/dist/utils/error-to-string.d.ts +1 -1
  233. package/dist/utils/error-to-string.js +15 -15
  234. package/dist/utils/is-template-legacy.d.ts +3 -3
  235. package/dist/utils/is-template-legacy.js +6 -6
  236. package/dist/utils/is-template-valid.d.ts +4 -4
  237. package/dist/utils/is-template-valid.js +12 -12
  238. package/dist/utils/module-exists.d.ts +1 -1
  239. package/dist/utils/module-exists.js +15 -15
  240. package/dist/utils/npm-utils.d.ts +20 -20
  241. package/dist/utils/npm-utils.js +74 -74
  242. package/dist/utils/put.d.ts +2 -2
  243. package/dist/utils/put.js +29 -29
  244. package/dist/utils/strip-version.d.ts +1 -1
  245. package/dist/utils/strip-version.js +11 -11
  246. package/logintervals.md +1 -1
  247. package/package.json +20 -20
@@ -1,18 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- configFile: {
5
- src: './oc.json'
6
- },
7
- filesToIgnoreOnDevWatch: /temp\/__oc|node_modules|package\.tar\.gz|_package|\.sw[op]|\.git\/|\.idea\/|\.DS_Store|oc\.json/,
8
- maxLoopIterations: 1e9,
9
- registry: {
10
- acceptRenderedHeader: 'application/vnd.oc.rendered+json',
11
- acceptUnrenderedHeader: 'application/vnd.oc.unrendered+json',
12
- acceptInfoHeader: 'application/vnd.oc.info+json',
13
- componentInfoPath: '/~info',
14
- componentPreviewPath: '/~preview',
15
- defaultTempPath: './temp/',
16
- localStaticRedirectorPath: 'static/'
17
- }
18
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ configFile: {
5
+ src: './oc.json'
6
+ },
7
+ filesToIgnoreOnDevWatch: /temp\/__oc|node_modules|package\.tar\.gz|_package|\.sw[op]|\.git\/|\.idea\/|\.DS_Store|oc\.json/,
8
+ maxLoopIterations: 1e9,
9
+ registry: {
10
+ acceptRenderedHeader: 'application/vnd.oc.rendered+json',
11
+ acceptUnrenderedHeader: 'application/vnd.oc.unrendered+json',
12
+ acceptInfoHeader: 'application/vnd.oc.info+json',
13
+ componentInfoPath: '/~info',
14
+ componentPreviewPath: '/~preview',
15
+ defaultTempPath: './temp/',
16
+ localStaticRedirectorPath: 'static/'
17
+ }
18
+ };
package/dist/types.d.ts CHANGED
@@ -1,231 +1,231 @@
1
- import { NextFunction, Request, Response } from 'express';
2
- import { PackageJson } from 'type-fest';
3
- import { StorageAdapter } from 'oc-storage-adapters-utils';
4
- export interface Author {
5
- email?: string;
6
- name?: string;
7
- url?: string;
8
- }
9
- interface ComponentList {
10
- author: Author;
11
- name: string;
12
- state: string;
13
- }
14
- interface ComponentHistory {
15
- name: string;
16
- publishDate: string;
17
- version: string;
18
- }
19
- export interface TemplateInfo {
20
- externals: Array<{
21
- name: string;
22
- global: string | string[];
23
- url: string;
24
- devUrl?: string;
25
- }>;
26
- type: string;
27
- version: string;
28
- }
29
- export interface ComponentsDetails {
30
- components: {
31
- [componentName: string]: {
32
- [componentVersion: string]: {
33
- publishDate: number;
34
- };
35
- };
36
- };
37
- lastEdit: number;
38
- }
39
- export interface ComponentsList {
40
- components: Record<string, string[]>;
41
- lastEdit: number;
42
- }
43
- export interface OcJsonConfig {
44
- registries?: string[];
45
- mocks?: {
46
- plugins?: {
47
- dynamic?: Record<string, string>;
48
- static?: Record<string, string>;
49
- };
50
- };
51
- }
52
- export interface OcParameter {
53
- default?: string | boolean | number;
54
- description?: string;
55
- example?: string;
56
- mandatory?: boolean;
57
- type: 'string' | 'boolean' | 'number';
58
- }
59
- interface OcConfiguration {
60
- container?: boolean;
61
- date: number;
62
- files: {
63
- dataProvider: {
64
- hashKey: string;
65
- src: string;
66
- type: string;
67
- };
68
- static: string[];
69
- template: {
70
- hashKey: string;
71
- src: string;
72
- type: string;
73
- version: string;
74
- };
75
- env?: string;
76
- };
77
- packaged: boolean;
78
- parameters: Record<string, OcParameter>;
79
- plugins?: string[];
80
- renderInfo?: boolean;
81
- state?: 'deprecated' | 'experimental';
82
- stringifiedDate: string;
83
- version: string;
84
- }
85
- export interface Component extends PackageJson {
86
- allVersions: string[];
87
- name: string;
88
- oc: OcConfiguration;
89
- version: string;
90
- }
91
- export interface ParsedComponent extends Omit<Component, 'author'> {
92
- author: Author;
93
- }
94
- export interface VM {
95
- availableDependencies: Array<{
96
- core: boolean;
97
- name: string;
98
- version: string;
99
- link: string;
100
- }>;
101
- availablePlugins: Record<string, (...args: unknown[]) => void>;
102
- components: ParsedComponent[];
103
- componentsHistory?: ComponentHistory[];
104
- componentsList: ComponentList[];
105
- componentsReleases: number;
106
- href: string;
107
- ocVersion: string;
108
- q: string;
109
- stateCounts: {
110
- deprecated?: number;
111
- experimental?: number;
112
- };
113
- templates: TemplateInfo[];
114
- title: string;
115
- type: 'oc-registry' | 'oc-registry-local';
116
- }
117
- export type Authentication<T = any> = {
118
- validate: (config: T) => {
119
- isValid: boolean;
120
- message: string;
121
- };
122
- middleware: (config: T) => any;
123
- };
124
- export type PublishAuthConfig = {
125
- type: 'basic';
126
- username: string;
127
- password: string;
128
- } | ({
129
- type: string | Authentication;
130
- } & Record<string, any>);
131
- export interface Config {
132
- baseUrl: string;
133
- baseUrlFunc?: (opts: {
134
- host?: string;
135
- secure: boolean;
136
- }) => string;
137
- beforePublish: (req: Request, res: Response, next: NextFunction) => void;
138
- customHeadersToSkipOnWeakVersion: string[];
139
- dependencies: string[];
140
- discovery: boolean;
141
- discoveryFunc?: (opts: {
142
- host?: string;
143
- secure: boolean;
144
- }) => boolean;
145
- env: Record<string, string>;
146
- executionTimeout?: number;
147
- fallbackRegistryUrl: string;
148
- hotReloading: boolean;
149
- keepAliveTimeout?: number;
150
- liveReloadPort: number;
151
- components?: string[];
152
- local: boolean;
153
- tarExtractMode: number;
154
- path: string;
155
- plugins: Record<string, (...args: unknown[]) => void>;
156
- pollingInterval: number;
157
- port: number | string;
158
- postRequestPayloadSize?: number;
159
- prefix: string;
160
- publishAuth?: PublishAuthConfig;
161
- publishValidation: (data: unknown) => {
162
- isValid: boolean;
163
- error?: string;
164
- } | boolean;
165
- refreshInterval?: number;
166
- routes?: Array<{
167
- route: string;
168
- method: string;
169
- handler: (req: Request, res: Response) => void;
170
- }>;
171
- s3?: {
172
- bucket: string;
173
- region: string;
174
- key?: string;
175
- secret?: string;
176
- componentsDir: string;
177
- };
178
- storage: {
179
- adapter: (options: any) => StorageAdapter;
180
- options: Record<string, any> & {
181
- componentsDir: string;
182
- };
183
- };
184
- tempDir: string;
185
- templates: any[];
186
- timeout: number;
187
- verbosity: number;
188
- }
189
- type CompiledTemplate = (model: unknown) => string;
190
- interface CompilerOptions {
191
- componentPackage: PackageJson & {
192
- oc: OcConfiguration;
193
- };
194
- componentPath: string;
195
- minify: boolean;
196
- ocPackage: PackageJson;
197
- production: boolean;
198
- publishPath: string;
199
- verbose: boolean;
200
- watch: boolean;
201
- }
202
- export interface Template {
203
- compile?: (options: CompilerOptions, cb: (err: Error | null) => void) => void;
204
- getCompiledTemplate: (templateString: string, key: string, context?: Record<string, unknown>) => CompiledTemplate;
205
- getInfo: () => TemplateInfo;
206
- render: (options: {
207
- model: unknown;
208
- template: CompiledTemplate;
209
- }, cb: (err: Error | null, data: string) => void) => void;
210
- }
211
- export interface Plugin {
212
- callback?: (error: unknown) => void;
213
- description?: string;
214
- name: string;
215
- options?: any;
216
- register: {
217
- register: (options: any, dependencies: any, next: (error?: Error) => void) => void;
218
- execute: (...args: any[]) => any;
219
- dependencies?: string[];
220
- };
221
- }
222
- declare global {
223
- namespace Express {
224
- interface Response {
225
- conf: Config;
226
- errorCode?: string;
227
- errorDetails?: string;
228
- }
229
- }
230
- }
231
- export {};
1
+ import { NextFunction, Request, Response } from 'express';
2
+ import { PackageJson } from 'type-fest';
3
+ import { StorageAdapter } from 'oc-storage-adapters-utils';
4
+ export interface Author {
5
+ email?: string;
6
+ name?: string;
7
+ url?: string;
8
+ }
9
+ interface ComponentList {
10
+ author: Author;
11
+ name: string;
12
+ state: string;
13
+ }
14
+ interface ComponentHistory {
15
+ name: string;
16
+ publishDate: string;
17
+ version: string;
18
+ }
19
+ export interface TemplateInfo {
20
+ externals: Array<{
21
+ name: string;
22
+ global: string | string[];
23
+ url: string;
24
+ devUrl?: string;
25
+ }>;
26
+ type: string;
27
+ version: string;
28
+ }
29
+ export interface ComponentsDetails {
30
+ components: {
31
+ [componentName: string]: {
32
+ [componentVersion: string]: {
33
+ publishDate: number;
34
+ };
35
+ };
36
+ };
37
+ lastEdit: number;
38
+ }
39
+ export interface ComponentsList {
40
+ components: Record<string, string[]>;
41
+ lastEdit: number;
42
+ }
43
+ export interface OcJsonConfig {
44
+ registries?: string[];
45
+ mocks?: {
46
+ plugins?: {
47
+ dynamic?: Record<string, string>;
48
+ static?: Record<string, string>;
49
+ };
50
+ };
51
+ }
52
+ export interface OcParameter {
53
+ default?: string | boolean | number;
54
+ description?: string;
55
+ example?: string;
56
+ mandatory?: boolean;
57
+ type: 'string' | 'boolean' | 'number';
58
+ }
59
+ interface OcConfiguration {
60
+ container?: boolean;
61
+ date: number;
62
+ files: {
63
+ dataProvider: {
64
+ hashKey: string;
65
+ src: string;
66
+ type: string;
67
+ };
68
+ static: string[];
69
+ template: {
70
+ hashKey: string;
71
+ src: string;
72
+ type: string;
73
+ version: string;
74
+ };
75
+ env?: string;
76
+ };
77
+ packaged: boolean;
78
+ parameters: Record<string, OcParameter>;
79
+ plugins?: string[];
80
+ renderInfo?: boolean;
81
+ state?: 'deprecated' | 'experimental';
82
+ stringifiedDate: string;
83
+ version: string;
84
+ }
85
+ export interface Component extends PackageJson {
86
+ allVersions: string[];
87
+ name: string;
88
+ oc: OcConfiguration;
89
+ version: string;
90
+ }
91
+ export interface ParsedComponent extends Omit<Component, 'author'> {
92
+ author: Author;
93
+ }
94
+ export interface VM {
95
+ availableDependencies: Array<{
96
+ core: boolean;
97
+ name: string;
98
+ version: string;
99
+ link: string;
100
+ }>;
101
+ availablePlugins: Record<string, (...args: unknown[]) => void>;
102
+ components: ParsedComponent[];
103
+ componentsHistory?: ComponentHistory[];
104
+ componentsList: ComponentList[];
105
+ componentsReleases: number;
106
+ href: string;
107
+ ocVersion: string;
108
+ q: string;
109
+ stateCounts: {
110
+ deprecated?: number;
111
+ experimental?: number;
112
+ };
113
+ templates: TemplateInfo[];
114
+ title: string;
115
+ type: 'oc-registry' | 'oc-registry-local';
116
+ }
117
+ export type Authentication<T = any> = {
118
+ validate: (config: T) => {
119
+ isValid: boolean;
120
+ message: string;
121
+ };
122
+ middleware: (config: T) => any;
123
+ };
124
+ export type PublishAuthConfig = {
125
+ type: 'basic';
126
+ username: string;
127
+ password: string;
128
+ } | ({
129
+ type: string | Authentication;
130
+ } & Record<string, any>);
131
+ export interface Config {
132
+ baseUrl: string;
133
+ baseUrlFunc?: (opts: {
134
+ host?: string;
135
+ secure: boolean;
136
+ }) => string;
137
+ beforePublish: (req: Request, res: Response, next: NextFunction) => void;
138
+ customHeadersToSkipOnWeakVersion: string[];
139
+ dependencies: string[];
140
+ discovery: boolean;
141
+ discoveryFunc?: (opts: {
142
+ host?: string;
143
+ secure: boolean;
144
+ }) => boolean;
145
+ env: Record<string, string>;
146
+ executionTimeout?: number;
147
+ fallbackRegistryUrl: string;
148
+ hotReloading: boolean;
149
+ keepAliveTimeout?: number;
150
+ liveReloadPort: number;
151
+ components?: string[];
152
+ local: boolean;
153
+ tarExtractMode: number;
154
+ path: string;
155
+ plugins: Record<string, (...args: unknown[]) => void>;
156
+ pollingInterval: number;
157
+ port: number | string;
158
+ postRequestPayloadSize?: number;
159
+ prefix: string;
160
+ publishAuth?: PublishAuthConfig;
161
+ publishValidation: (data: unknown) => {
162
+ isValid: boolean;
163
+ error?: string;
164
+ } | boolean;
165
+ refreshInterval?: number;
166
+ routes?: Array<{
167
+ route: string;
168
+ method: string;
169
+ handler: (req: Request, res: Response) => void;
170
+ }>;
171
+ s3?: {
172
+ bucket: string;
173
+ region: string;
174
+ key?: string;
175
+ secret?: string;
176
+ componentsDir: string;
177
+ };
178
+ storage: {
179
+ adapter: (options: any) => StorageAdapter;
180
+ options: Record<string, any> & {
181
+ componentsDir: string;
182
+ };
183
+ };
184
+ tempDir: string;
185
+ templates: any[];
186
+ timeout: number;
187
+ verbosity: number;
188
+ }
189
+ type CompiledTemplate = (model: unknown) => string;
190
+ interface CompilerOptions {
191
+ componentPackage: PackageJson & {
192
+ oc: OcConfiguration;
193
+ };
194
+ componentPath: string;
195
+ minify: boolean;
196
+ ocPackage: PackageJson;
197
+ production: boolean;
198
+ publishPath: string;
199
+ verbose: boolean;
200
+ watch: boolean;
201
+ }
202
+ export interface Template {
203
+ compile?: (options: CompilerOptions, cb: (err: Error | null) => void) => void;
204
+ getCompiledTemplate: (templateString: string, key: string, context?: Record<string, unknown>) => CompiledTemplate;
205
+ getInfo: () => TemplateInfo;
206
+ render: (options: {
207
+ model: unknown;
208
+ template: CompiledTemplate;
209
+ }, cb: (err: Error | null, data: string) => void) => void;
210
+ }
211
+ export interface Plugin {
212
+ callback?: (error: unknown) => void;
213
+ description?: string;
214
+ name: string;
215
+ options?: any;
216
+ register: {
217
+ register: (options: any, dependencies: any, next: (error?: Error) => void) => void;
218
+ execute: (...args: any[]) => any;
219
+ dependencies?: string[];
220
+ };
221
+ }
222
+ declare global {
223
+ namespace Express {
224
+ interface Response {
225
+ conf: Config;
226
+ errorCode?: string;
227
+ errorDetails?: string;
228
+ }
229
+ }
230
+ }
231
+ export {};
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +1,16 @@
1
- export default function cleanRequire(path: string, opts: {
2
- justTry: true;
3
- resolve: true;
4
- }): string | undefined;
5
- export default function cleanRequire(path: string, opts: {
6
- justTry?: false;
7
- resolve: true;
8
- }): string;
9
- export default function cleanRequire<T = unknown>(path: string, opts: {
10
- justTry: true;
11
- resolve?: false;
12
- }): T | undefined;
13
- export default function cleanRequire<T = unknown>(path: string, opts: {
14
- justTry?: false;
15
- resolve?: false;
16
- }): T;
1
+ export default function cleanRequire(path: string, opts: {
2
+ justTry: true;
3
+ resolve: true;
4
+ }): string | undefined;
5
+ export default function cleanRequire(path: string, opts: {
6
+ justTry?: false;
7
+ resolve: true;
8
+ }): string;
9
+ export default function cleanRequire<T = unknown>(path: string, opts: {
10
+ justTry: true;
11
+ resolve?: false;
12
+ }): T | undefined;
13
+ export default function cleanRequire<T = unknown>(path: string, opts: {
14
+ justTry?: false;
15
+ resolve?: false;
16
+ }): T;
@@ -1,18 +1,18 @@
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 try_require_1 = __importDefault(require("try-require"));
7
- function cleanRequire(path, { justTry = false, resolve = false }) {
8
- const shouldThrow = !justTry;
9
- if (require.cache && !!require.cache[path]) {
10
- delete require.cache[path];
11
- }
12
- let action = shouldThrow ? require : try_require_1.default;
13
- if (resolve) {
14
- action = action.resolve;
15
- }
16
- return action(path);
17
- }
18
- exports.default = cleanRequire;
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 try_require_1 = __importDefault(require("try-require"));
7
+ function cleanRequire(path, { justTry = false, resolve = false }) {
8
+ const shouldThrow = !justTry;
9
+ if (require.cache && !!require.cache[path]) {
10
+ delete require.cache[path];
11
+ }
12
+ let action = shouldThrow ? require : try_require_1.default;
13
+ if (resolve) {
14
+ action = action.resolve;
15
+ }
16
+ return action(path);
17
+ }
18
+ exports.default = cleanRequire;
@@ -1 +1 @@
1
- export default function dateStringify(date: unknown): string;
1
+ export default function dateStringify(date: unknown): string;
@@ -1,22 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function padTwoDigits(data) {
4
- return String(data).padStart(2, '0');
5
- }
6
- function dateStringify(date) {
7
- if (date instanceof Date) {
8
- return (date.getFullYear() +
9
- '/' +
10
- padTwoDigits(date.getMonth() + 1) +
11
- '/' +
12
- padTwoDigits(date.getDate()) +
13
- ' ' +
14
- padTwoDigits(date.getHours()) +
15
- ':' +
16
- padTwoDigits(date.getMinutes()) +
17
- ':' +
18
- padTwoDigits(date.getSeconds()));
19
- }
20
- return '';
21
- }
22
- exports.default = dateStringify;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function padTwoDigits(data) {
4
+ return String(data).padStart(2, '0');
5
+ }
6
+ function dateStringify(date) {
7
+ if (date instanceof Date) {
8
+ return (date.getFullYear() +
9
+ '/' +
10
+ padTwoDigits(date.getMonth() + 1) +
11
+ '/' +
12
+ padTwoDigits(date.getDate()) +
13
+ ' ' +
14
+ padTwoDigits(date.getHours()) +
15
+ ':' +
16
+ padTwoDigits(date.getMinutes()) +
17
+ ':' +
18
+ padTwoDigits(date.getSeconds()));
19
+ }
20
+ return '';
21
+ }
22
+ exports.default = dateStringify;
@@ -1 +1 @@
1
- export default function errorToString(err: unknown): string;
1
+ export default function errorToString(err: unknown): string;
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function hasMessage(obj) {
4
- return obj != null && typeof obj.msg === 'string';
5
- }
6
- function errorToString(err) {
7
- if (typeof err === 'string') {
8
- return err;
9
- }
10
- else if (hasMessage(err)) {
11
- return err.msg;
12
- }
13
- return err + '';
14
- }
15
- exports.default = errorToString;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function hasMessage(obj) {
4
+ return obj != null && typeof obj.msg === 'string';
5
+ }
6
+ function errorToString(err) {
7
+ if (typeof err === 'string') {
8
+ return err;
9
+ }
10
+ else if (hasMessage(err)) {
11
+ return err.msg;
12
+ }
13
+ return err + '';
14
+ }
15
+ exports.default = errorToString;
@@ -1,3 +1,3 @@
1
- type LegacyTemplate = 'jade' | 'handlebars';
2
- export default function isTemplateLegacy(template: string): template is LegacyTemplate;
3
- export {};
1
+ type LegacyTemplate = 'jade' | 'handlebars';
2
+ export default function isTemplateLegacy(template: string): template is LegacyTemplate;
3
+ export {};