oc 0.50.55 → 0.50.57-beta.0
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/.turbo/turbo-build.log +16 -18
- package/.turbo/turbo-lint.log +2 -2
- package/.turbo/turbo-test-silent.log +28 -46
- package/.turbo/turbo-test.log +17 -1627
- package/CHANGELOG.md +14 -0
- package/README.md +180 -0
- package/dist/cli/commands.d.ts +8 -0
- package/dist/cli/commands.js +8 -0
- package/dist/cli/facade/dev.d.ts +2 -2
- package/dist/cli/facade/registry-migrate-metadata.d.ts +20 -0
- package/dist/cli/facade/registry-migrate-metadata.js +105 -0
- package/dist/cli/index.js +2 -0
- package/dist/components/oc-client/_package/package.json +1 -38
- package/dist/components/oc-client/_package/server.js +1 -1
- package/dist/components/oc-client/package.json +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/registry/domain/components-cache/index.d.ts +3 -1
- package/dist/registry/domain/components-cache/index.js +28 -5
- package/dist/registry/domain/components-details.d.ts +3 -1
- package/dist/registry/domain/components-details.js +26 -5
- package/dist/registry/domain/extract-package.d.ts +3 -2
- package/dist/registry/domain/http-server/express-adapter.d.ts +2 -0
- package/dist/registry/domain/http-server/express-adapter.js +196 -0
- package/dist/registry/domain/http-server/types.d.ts +99 -0
- package/dist/registry/domain/http-server/types.js +2 -0
- package/dist/registry/domain/metadata-adapter-options.d.ts +6 -0
- package/dist/registry/domain/metadata-adapter-options.js +12 -0
- package/dist/registry/domain/metadata-index.d.ts +15 -0
- package/dist/registry/domain/metadata-index.js +132 -0
- package/dist/registry/domain/metadata-migration.d.ts +38 -0
- package/dist/registry/domain/metadata-migration.js +128 -0
- package/dist/registry/domain/options-sanitiser.js +13 -0
- package/dist/registry/domain/repository.d.ts +1 -0
- package/dist/registry/domain/repository.js +106 -7
- package/dist/registry/domain/server-adapter.d.ts +4 -0
- package/dist/registry/domain/server-adapter.js +20 -0
- package/dist/registry/domain/validators/registry-configuration.js +21 -0
- package/dist/registry/domain/validators/uploaded-package.d.ts +5 -4
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.js +19 -17
- package/dist/registry/middleware/base-url-handler.d.ts +3 -2
- package/dist/registry/middleware/base-url-handler.js +3 -4
- package/dist/registry/middleware/compression.d.ts +2 -2
- package/dist/registry/middleware/compression.js +1 -1
- package/dist/registry/middleware/cors.d.ts +3 -2
- package/dist/registry/middleware/cors.js +7 -8
- package/dist/registry/middleware/discovery-handler.d.ts +3 -2
- package/dist/registry/middleware/discovery-handler.js +3 -4
- package/dist/registry/middleware/index.d.ts +2 -2
- package/dist/registry/middleware/index.js +39 -36
- package/dist/registry/router.d.ts +2 -2
- package/dist/registry/router.js +33 -27
- package/dist/registry/routes/component-info.d.ts +2 -2
- package/dist/registry/routes/component-info.js +1 -1
- package/dist/registry/routes/component-preview.d.ts +2 -2
- package/dist/registry/routes/component.d.ts +2 -2
- package/dist/registry/routes/component.js +3 -5
- package/dist/registry/routes/components.d.ts +2 -2
- package/dist/registry/routes/components.js +3 -1
- package/dist/registry/routes/dependencies.d.ts +2 -2
- package/dist/registry/routes/helpers/get-component-fallback.d.ts +3 -3
- package/dist/registry/routes/helpers/get-component.d.ts +1 -1
- package/dist/registry/routes/history.d.ts +2 -2
- package/dist/registry/routes/history.js +1 -1
- package/dist/registry/routes/index.d.ts +2 -2
- package/dist/registry/routes/plugins.d.ts +2 -2
- package/dist/registry/routes/publish.d.ts +2 -2
- package/dist/registry/routes/static-redirector.d.ts +3 -2
- package/dist/registry/routes/static-redirector.js +8 -12
- package/dist/registry/routes/validate.d.ts +2 -2
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.js +3 -0
- package/dist/types.d.ts +49 -1
- package/package.json +7 -6
- package/dist/registry/middleware/file-uploads.d.ts +0 -2
- package/dist/registry/middleware/file-uploads.js +0 -23
- package/dist/registry/middleware/request-handler.d.ts +0 -2
- package/dist/registry/middleware/request-handler.js +0 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
1
|
import type { Config } from '../../types';
|
|
2
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
3
3
|
import type { Repository } from '../domain/repository';
|
|
4
|
-
export default function componentInfoRoute(conf: Config, repository: Repository):
|
|
4
|
+
export default function componentInfoRoute(conf: Config, repository: Repository): OcHandler;
|
|
@@ -84,7 +84,7 @@ function componentInfo(err, req, res, component, componentDetail) {
|
|
|
84
84
|
href = `//${req.headers.host}${res.conf.prefix}`;
|
|
85
85
|
}
|
|
86
86
|
// Get theme from cookie or default to dark
|
|
87
|
-
const theme = req.cookies?.['oc-theme']
|
|
87
|
+
const theme = req.cookies?.['oc-theme'] === 'light' ? 'light' : 'dark';
|
|
88
88
|
res.send((0, info_1.default)({
|
|
89
89
|
component,
|
|
90
90
|
componentDetail,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
1
|
import type { Config } from '../../types';
|
|
2
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
3
3
|
import type { Repository } from '../domain/repository';
|
|
4
|
-
export default function componentPreviewRoute(conf: Config, repository: Repository):
|
|
4
|
+
export default function componentPreviewRoute(conf: Config, repository: Repository): OcHandler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestHandler } from 'express';
|
|
2
1
|
import type { Config } from '../../types';
|
|
2
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
3
3
|
import type { Repository } from '../domain/repository';
|
|
4
|
-
export default function component(conf: Config, repository: Repository):
|
|
4
|
+
export default function component(conf: Config, repository: Repository): OcHandler;
|
|
@@ -70,7 +70,7 @@ function component(conf, repository) {
|
|
|
70
70
|
res.errorDetails = result.response.error;
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
73
|
-
if (Object.keys(result.headers
|
|
73
|
+
if (result.headers && Object.keys(result.headers).length) {
|
|
74
74
|
res.set(result.headers);
|
|
75
75
|
}
|
|
76
76
|
if (Array.isArray(result.cookies) && result.cookies.length > 0) {
|
|
@@ -89,10 +89,8 @@ function component(conf, repository) {
|
|
|
89
89
|
nodeStream.on('error', (err) => {
|
|
90
90
|
res.status(500).end(String(err));
|
|
91
91
|
});
|
|
92
|
-
res.
|
|
93
|
-
|
|
94
|
-
res.end();
|
|
95
|
-
});
|
|
92
|
+
res.set('Content-Type', 'x-text/stream');
|
|
93
|
+
res.stream(nodeStream);
|
|
96
94
|
}
|
|
97
95
|
else {
|
|
98
96
|
res.status(result.status).json(result.response);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestHandler } from 'express';
|
|
2
1
|
import type { Config } from '../../types';
|
|
2
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
3
3
|
import type { Repository } from '../domain/repository';
|
|
4
|
-
export default function components(conf: Config, repository: Repository):
|
|
4
|
+
export default function components(conf: Config, repository: Repository): OcHandler;
|
|
@@ -13,7 +13,9 @@ function components(conf, repository) {
|
|
|
13
13
|
if (results?.length !== 1 || !results[0] || !res.set) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
if (results[0].headers) {
|
|
17
|
+
res.set(results[0].headers);
|
|
18
|
+
}
|
|
17
19
|
};
|
|
18
20
|
const setCookies = (results, res) => {
|
|
19
21
|
if (results?.length !== 1 || !results[0] || !res.cookie) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
1
|
import type { Config } from '../../types';
|
|
3
|
-
|
|
2
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
3
|
+
export default function dependencies(conf: Config): OcHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingHttpHeaders } from 'node:http';
|
|
2
|
-
import type { Request, Response } from 'express';
|
|
3
2
|
import type { Component, Config } from '../../../types';
|
|
3
|
+
import type { OcRequest, OcResponse } from '../../domain/http-server/types';
|
|
4
4
|
import type { GetComponentResult } from './get-component';
|
|
5
5
|
type ComponentCallback = (err: {
|
|
6
6
|
registryError: any;
|
|
@@ -11,6 +11,6 @@ export declare function getComponent(fallbackRegistryUrl: string, headers: Incom
|
|
|
11
11
|
version: string;
|
|
12
12
|
parameters: IncomingHttpHeaders;
|
|
13
13
|
}, callback: (result: GetComponentResult) => void): void;
|
|
14
|
-
export declare function getComponentPreview(conf: Config, req:
|
|
15
|
-
export declare function getComponentInfo(conf: Config, req:
|
|
14
|
+
export declare function getComponentPreview(conf: Config, req: OcRequest, res: OcResponse, registryError: string | null, callback: ComponentCallback): void;
|
|
15
|
+
export declare function getComponentInfo(conf: Config, req: OcRequest, res: OcResponse, registryError: string | null, callback: ComponentCallback): void;
|
|
16
16
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingHttpHeaders } from 'node:http';
|
|
2
|
-
import type { CookieOptions } from 'express';
|
|
3
2
|
import type { Config } from '../../../types';
|
|
3
|
+
import type { CookieOptions } from '../../domain/http-server/types';
|
|
4
4
|
import type { Repository } from '../../domain/repository';
|
|
5
5
|
export interface RendererOptions {
|
|
6
6
|
action?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
2
2
|
import type { Repository } from '../domain/repository';
|
|
3
|
-
export default function history(repository: Repository):
|
|
3
|
+
export default function history(repository: Repository): OcHandler;
|
|
@@ -11,7 +11,7 @@ function history(repository) {
|
|
|
11
11
|
if (res.conf.discovery.ui && !res.conf.local) {
|
|
12
12
|
const details = await repository.getComponentsDetails();
|
|
13
13
|
const componentsHistory = (0, get_components_history_1.default)(details);
|
|
14
|
-
res.
|
|
14
|
+
res.set('Cache-Control', 'public, max-age=600');
|
|
15
15
|
res.status(200).json({ componentsHistory });
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
2
2
|
import type { Repository } from '../domain/repository';
|
|
3
|
-
export default function (repository: Repository):
|
|
3
|
+
export default function (repository: Repository): OcHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
1
|
import type { Config } from '../../types';
|
|
3
|
-
|
|
2
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
3
|
+
export default function plugins(conf: Config): OcHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
2
2
|
import type { Repository } from '../domain/repository';
|
|
3
|
-
export default function publish(repository: Repository):
|
|
3
|
+
export default function publish(repository: Repository): OcHandler;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
2
2
|
import type { Repository } from '../domain/repository';
|
|
3
|
-
export
|
|
3
|
+
export type StaticRedirectorRouteId = 'client' | 'dev-client' | 'client-map' | 'local-static';
|
|
4
|
+
export default function staticRedirector(repository: Repository, routeId: StaticRedirectorRouteId): OcHandler;
|
|
@@ -41,13 +41,10 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
41
41
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
42
42
|
const storageUtils = __importStar(require("oc-storage-adapters-utils"));
|
|
43
43
|
const compression_1 = __importDefault(require("../middleware/compression"));
|
|
44
|
-
function staticRedirector(repository) {
|
|
44
|
+
function staticRedirector(repository, routeId) {
|
|
45
45
|
return (req, res) => {
|
|
46
46
|
let filePath;
|
|
47
|
-
|
|
48
|
-
const devClientPath = `${res.conf.prefix || '/'}oc-client/client.dev.js`;
|
|
49
|
-
const clientMapPath = `${res.conf.prefix || '/'}oc-client/oc-client.min.map`;
|
|
50
|
-
if (req.route.path === clientPath || req.route.path === devClientPath) {
|
|
47
|
+
if (routeId === 'client' || routeId === 'dev-client') {
|
|
51
48
|
if (res.conf.local) {
|
|
52
49
|
if (res.conf.compiledClient) {
|
|
53
50
|
res.type('application/javascript');
|
|
@@ -59,7 +56,7 @@ function staticRedirector(repository) {
|
|
|
59
56
|
else {
|
|
60
57
|
if (res.conf.compiledClient) {
|
|
61
58
|
res.type('application/javascript');
|
|
62
|
-
if (
|
|
59
|
+
if (routeId === 'client') {
|
|
63
60
|
(0, compression_1.default)({
|
|
64
61
|
uncompressed: res.conf.compiledClient.code.minified,
|
|
65
62
|
brotli: res.conf.compiledClient.code.brotli,
|
|
@@ -71,11 +68,11 @@ function staticRedirector(repository) {
|
|
|
71
68
|
}
|
|
72
69
|
return;
|
|
73
70
|
}
|
|
74
|
-
res.redirect(repository.getStaticClientPath(
|
|
71
|
+
res.redirect(repository.getStaticClientPath(routeId === 'dev-client'));
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
else if (
|
|
75
|
+
else if (routeId === 'client-map') {
|
|
79
76
|
if (res.conf.local) {
|
|
80
77
|
filePath = node_path_1.default.join(__dirname, '../../components/oc-client/_package/src/oc-client.min.map');
|
|
81
78
|
}
|
|
@@ -90,14 +87,13 @@ function staticRedirector(repository) {
|
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
89
|
else if (req.params['componentName'] === 'oc-client') {
|
|
93
|
-
filePath = node_path_1.default.join(__dirname, '../../components/oc-client/_package/' +
|
|
94
|
-
req.params['splat'].join('/'));
|
|
90
|
+
filePath = node_path_1.default.join(__dirname, '../../components/oc-client/_package/' + req.params['splat']);
|
|
95
91
|
}
|
|
96
92
|
else {
|
|
97
93
|
filePath =
|
|
98
94
|
node_path_1.default.join(res.conf.path, req.params['componentName']) +
|
|
99
95
|
'/_package/' +
|
|
100
|
-
req.params['splat']
|
|
96
|
+
req.params['splat'];
|
|
101
97
|
}
|
|
102
98
|
if (!fs_extra_1.default.existsSync(filePath)) {
|
|
103
99
|
res.errorDetails = `File ${filePath} not found`;
|
|
@@ -119,7 +115,7 @@ function staticRedirector(repository) {
|
|
|
119
115
|
res.set('Content-Encoding', 'gzip');
|
|
120
116
|
}
|
|
121
117
|
fileStream.on('open', () => {
|
|
122
|
-
|
|
118
|
+
res.stream(fileStream);
|
|
123
119
|
});
|
|
124
120
|
};
|
|
125
121
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export default function validate():
|
|
1
|
+
import type { OcHandler } from '../domain/http-server/types';
|
|
2
|
+
export default function validate(): OcHandler;
|
|
@@ -28,6 +28,9 @@ declare const _default: {
|
|
|
28
28
|
COMPONENT_SET_COOKIE_PARAMETERS_NOT_VALID: string;
|
|
29
29
|
CONFIGURATION_DEPENDENCIES_MUST_BE_ARRAY: string;
|
|
30
30
|
CONFIGURATION_EMPTY: string;
|
|
31
|
+
CONFIGURATION_METADATA_NOT_VALID: (adapterType: string) => string;
|
|
32
|
+
CONFIGURATION_METADATA_EXPORT_INTERVAL_NOT_VALID: string;
|
|
33
|
+
CONFIGURATION_METADATA_EXPORT_INTERVAL_WITHOUT_EXPORT_NOT_VALID: string;
|
|
31
34
|
CONFIGURATION_ONREQUEST_MUST_BE_FUNCTION: string;
|
|
32
35
|
CONFIGURATION_OFFREQUEST_MUST_BE_FUNCTION: string;
|
|
33
36
|
CONFIGURATION_PUBLISH_BASIC_AUTH_CREDENTIALS_MISSING: string;
|
package/dist/resources/index.js
CHANGED
|
@@ -77,6 +77,9 @@ exports.default = {
|
|
|
77
77
|
COMPONENT_SET_COOKIE_PARAMETERS_NOT_VALID: 'context.setCookie parameters are not valid',
|
|
78
78
|
CONFIGURATION_DEPENDENCIES_MUST_BE_ARRAY: 'Registry configuration is not valid: dependencies must be an array',
|
|
79
79
|
CONFIGURATION_EMPTY: 'Registry configuration is empty',
|
|
80
|
+
CONFIGURATION_METADATA_NOT_VALID: (adapterType) => `Registry configuration is not valid: ${adapterType} is not a valid metadata adapter`,
|
|
81
|
+
CONFIGURATION_METADATA_EXPORT_INTERVAL_NOT_VALID: 'Registry configuration is not valid: metadata.exportLegacyFilesInterval must be a positive number',
|
|
82
|
+
CONFIGURATION_METADATA_EXPORT_INTERVAL_WITHOUT_EXPORT_NOT_VALID: 'Registry configuration is not valid: metadata.exportLegacyFilesInterval requires metadata.exportLegacyFiles to be true',
|
|
80
83
|
CONFIGURATION_ONREQUEST_MUST_BE_FUNCTION: "Registry configuration is not valid: registry.on's callback must be a function",
|
|
81
84
|
CONFIGURATION_OFFREQUEST_MUST_BE_FUNCTION: "Registry configuration is not valid: registry.off's callback must be a function",
|
|
82
85
|
CONFIGURATION_PUBLISH_BASIC_AUTH_CREDENTIALS_MISSING: 'Registry configuration is not valid: basic auth requires username and password',
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { NextFunction, Request, Response } from 'express';
|
|
2
|
+
import type { MetadataStore as MetadataStoreType } from 'oc-metadata-adapters-utils';
|
|
2
3
|
import type { StorageAdapter } from 'oc-storage-adapters-utils';
|
|
3
4
|
import type { PackageJson } from 'type-fest';
|
|
5
|
+
import type { HttpServerAdapter } from './registry/domain/http-server/types';
|
|
6
|
+
export type { ComponentRow, MetadataStore } from 'oc-metadata-adapters-utils';
|
|
4
7
|
type Middleware = (req: Request, res: Response, next: NextFunction) => void;
|
|
5
8
|
export interface Author {
|
|
6
9
|
email?: string;
|
|
@@ -38,6 +41,44 @@ export interface ComponentsList {
|
|
|
38
41
|
components: Record<string, string[]>;
|
|
39
42
|
lastEdit: number;
|
|
40
43
|
}
|
|
44
|
+
export interface MetadataConfig<T = any> {
|
|
45
|
+
/**
|
|
46
|
+
* Factory for the metadata store. It must be side-effect free because config
|
|
47
|
+
* validation may instantiate a throwaway store before registry startup.
|
|
48
|
+
*/
|
|
49
|
+
adapter: (options: T) => MetadataStoreType;
|
|
50
|
+
options: T;
|
|
51
|
+
/**
|
|
52
|
+
* Controls whether OC asks the metadata adapter to manage its schema/table.
|
|
53
|
+
* When omitted, OC behaves as `true` and passes that default to adapter
|
|
54
|
+
* validation/startup/migration paths.
|
|
55
|
+
*
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
manageSchema?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* When true, startup scans storage and inserts any missing metadata rows
|
|
61
|
+
* before cache hydration. Existing rows are skipped.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
reconcileFromStorage?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* When true, startup exports DB-derived `components.json` and
|
|
68
|
+
* `components-details.json` projections to storage. This is a one-way export
|
|
69
|
+
* from metadata to storage and is not triggered on each publish.
|
|
70
|
+
*
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
exportLegacyFiles?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Interval, in seconds, at which the DB→`components.json` legacy export runs
|
|
76
|
+
* in the background. Only used when `exportLegacyFiles` is true. When omitted,
|
|
77
|
+
* the export runs once at startup only (no background refresh). The export is
|
|
78
|
+
* never coupled to the publish path.
|
|
79
|
+
*/
|
|
80
|
+
exportLegacyFilesInterval?: number;
|
|
81
|
+
}
|
|
41
82
|
export interface OcParameter {
|
|
42
83
|
default?: string | boolean | number;
|
|
43
84
|
description?: string;
|
|
@@ -334,6 +375,7 @@ export interface Config<T = any> {
|
|
|
334
375
|
* @default "/"
|
|
335
376
|
*/
|
|
336
377
|
prefix: string;
|
|
378
|
+
metadata?: MetadataConfig;
|
|
337
379
|
/**
|
|
338
380
|
* Authentication strategy for component publishing.
|
|
339
381
|
*/
|
|
@@ -379,6 +421,13 @@ export interface Config<T = any> {
|
|
|
379
421
|
componentsDir: string;
|
|
380
422
|
};
|
|
381
423
|
};
|
|
424
|
+
/**
|
|
425
|
+
* Low-level HTTP server adapter used by the registry.
|
|
426
|
+
*/
|
|
427
|
+
server: {
|
|
428
|
+
adapter: (options?: unknown) => HttpServerAdapter;
|
|
429
|
+
options?: unknown;
|
|
430
|
+
};
|
|
382
431
|
/**
|
|
383
432
|
* Directory used by the registry for temporary files.
|
|
384
433
|
*/
|
|
@@ -491,4 +540,3 @@ declare global {
|
|
|
491
540
|
}
|
|
492
541
|
}
|
|
493
542
|
}
|
|
494
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.57-beta.0",
|
|
4
4
|
"description": "A framework for developing and distributing html components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"preview": "bun run preview/uiPreview.ts",
|
|
12
12
|
"prebuild": "rimraf dist",
|
|
13
13
|
"build": "npm run lint && tsc && node tasks/build.js",
|
|
14
|
-
"test": "
|
|
15
|
-
"test-silent": "
|
|
14
|
+
"test": "node tasks/mochaTest.js",
|
|
15
|
+
"test-silent": "node tasks/mochaTest.js --silent",
|
|
16
16
|
"bench": "node tasks/benchmarks/server-benchmark.js --repetitions=5",
|
|
17
17
|
"bench:quick": "node tasks/benchmarks/server-benchmark.js --repetitions=3",
|
|
18
18
|
"bench:update-baseline": "node tasks/benchmarks/server-benchmark.js --repetitions=5 --update-baseline=true",
|
|
@@ -98,8 +98,9 @@
|
|
|
98
98
|
"oc-client-browser": "*",
|
|
99
99
|
"oc-empty-response-handler": "^1.0.2",
|
|
100
100
|
"oc-get-unix-utc-timestamp": "^1.0.6",
|
|
101
|
-
"oc-
|
|
102
|
-
"oc-storage-
|
|
101
|
+
"oc-metadata-adapters-utils": "^0.1.1",
|
|
102
|
+
"oc-s3-storage-adapter": "*",
|
|
103
|
+
"oc-storage-adapters-utils": "*",
|
|
103
104
|
"oc-template-es6": "^2.0.0",
|
|
104
105
|
"oc-template-es6-compiler": "^7.1.4",
|
|
105
106
|
"oc-template-handlebars": "^6.0.26",
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
"source-map": "^0.7.6",
|
|
118
119
|
"targz": "^1.0.1",
|
|
119
120
|
"try-require": "^1.2.1",
|
|
120
|
-
"undici": "^8.
|
|
121
|
+
"undici": "^8.5.0",
|
|
121
122
|
"universalify": "^2.0.1",
|
|
122
123
|
"yargs": "^17.7.2"
|
|
123
124
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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.default = fileUpload;
|
|
7
|
-
const multer_1 = __importDefault(require("multer"));
|
|
8
|
-
function fileUpload(req, res, next) {
|
|
9
|
-
if (res.conf.local) {
|
|
10
|
-
return next();
|
|
11
|
-
}
|
|
12
|
-
const normaliseFileName = (x) => x.replace('.tar.gz', '').replace(/\W+/g, '-').toLowerCase();
|
|
13
|
-
const upload = (0, multer_1.default)({
|
|
14
|
-
limits: {
|
|
15
|
-
fieldSize: 10
|
|
16
|
-
},
|
|
17
|
-
storage: multer_1.default.diskStorage({
|
|
18
|
-
destination: res.conf.tempDir,
|
|
19
|
-
filename: (_req, file, cb) => cb(null, `${normaliseFileName(file.originalname)}-${Date.now()}.tar.gz`)
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
return upload.any()(req, res, next);
|
|
23
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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.default = requestHandler;
|
|
7
|
-
const response_time_1 = __importDefault(require("response-time"));
|
|
8
|
-
const events_handler_1 = __importDefault(require("../domain/events-handler"));
|
|
9
|
-
function requestHandler() {
|
|
10
|
-
return (0, response_time_1.default)((req, res, time) => {
|
|
11
|
-
const data = {
|
|
12
|
-
body: req.body,
|
|
13
|
-
duration: time,
|
|
14
|
-
headers: req.headers,
|
|
15
|
-
method: req.method,
|
|
16
|
-
path: req.path,
|
|
17
|
-
relativeUrl: req.originalUrl,
|
|
18
|
-
query: req.query,
|
|
19
|
-
url: req.protocol + '://' + req.get('host') + req.originalUrl,
|
|
20
|
-
statusCode: res.statusCode
|
|
21
|
-
};
|
|
22
|
-
if (res.errorDetails) {
|
|
23
|
-
data.errorDetails = res.errorDetails;
|
|
24
|
-
}
|
|
25
|
-
if (res.errorCode) {
|
|
26
|
-
data.errorCode = res.errorCode;
|
|
27
|
-
}
|
|
28
|
-
events_handler_1.default.fire('request', data);
|
|
29
|
-
});
|
|
30
|
-
}
|