@squiz/render-runtime-lib 1.2.1-alpha.95 → 1.2.1-alpha.96
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/lib/component-runner/index.d.ts +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +87676 -72867
- package/lib/index.js.map +3 -3
- package/lib/migrations/20220704054051_initial.sql +13 -9
- package/lib/test/helpers/stack.d.ts +2 -0
- package/lib/webserver/app.d.ts +2 -1
- package/lib/webserver/index.d.ts +2 -1
- package/lib/worker/worker-root.js +14 -13
- package/lib/worker/worker-root.js.map +1 -1
- package/package.json +9 -5
- package/lib/utils/log.d.ts +0 -3
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
-- CreateTable
|
|
2
|
-
CREATE TABLE "component" (
|
|
3
|
-
"name" VARCHAR(128) NOT NULL,
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
);
|
|
3
|
+
CREATE TABLE "component" ( "name" VARCHAR(128) NOT NULL,
|
|
4
|
+
CONSTRAINT "component_pkey" PRIMARY KEY ("name"));
|
|
7
5
|
|
|
8
6
|
-- CreateTable
|
|
9
|
-
CREATE TABLE "component_version" (
|
|
10
|
-
"component_name" VARCHAR(128) NOT NULL,
|
|
11
|
-
"version" VARCHAR(128) NOT NULL,
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
CREATE TABLE "component_version" (
|
|
9
|
+
"component_name" VARCHAR(128) NOT NULL,
|
|
10
|
+
"version" VARCHAR(128) NOT NULL,
|
|
11
|
+
CONSTRAINT "component_version_pkey" PRIMARY KEY ("component_name",
|
|
12
|
+
"version")
|
|
14
13
|
);
|
|
15
14
|
|
|
16
15
|
-- AddForeignKey
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
ALTER TABLE "component_version" ADD CONSTRAINT "component_version_component_name_fkey"
|
|
18
|
+
FOREIGN KEY ("component_name") REFERENCES "component"("name") ON
|
|
19
|
+
DELETE CASCADE ON
|
|
20
|
+
UPDATE CASCADE;
|
|
21
|
+
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import supertest from 'supertest';
|
|
2
2
|
import { type RenderRuntimeConfig } from '../../';
|
|
3
|
+
import { Logger } from '@squiz/cmp-logger-lib';
|
|
4
|
+
export declare const testLogger: Logger;
|
|
3
5
|
export declare function getTestConfig(port: number): RenderRuntimeConfig;
|
|
4
6
|
export declare function getTestServer(): supertest.SuperTest<supertest.Test>;
|
package/lib/webserver/app.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type Express } from 'express';
|
|
2
|
+
import { Logger } from '@squiz/cmp-logger-lib';
|
|
2
3
|
import { ComponentConnectionManager } from '@squiz/component-db-lib';
|
|
3
|
-
export declare function setupApp(db?: ComponentConnectionManager): Express;
|
|
4
|
+
export declare function setupApp(logger: Logger, db?: ComponentConnectionManager): Express;
|
package/lib/webserver/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { type Server } from 'http';
|
|
3
|
+
import { Logger } from '@squiz/cmp-logger-lib';
|
|
3
4
|
import { ComponentConnectionManager } from '@squiz/component-db-lib';
|
|
4
5
|
export interface WebserverConfig {
|
|
5
6
|
port?: number;
|
|
@@ -15,7 +16,7 @@ export declare class Webserver {
|
|
|
15
16
|
private static config;
|
|
16
17
|
static get(): Server;
|
|
17
18
|
static getConfig(): WebserverConfig;
|
|
18
|
-
static start(config: Omit<WebserverConfig, 'compiledConfig'>, db?: ComponentConnectionManager, compiledConfig?: Record<string, string>): Promise<Server>;
|
|
19
|
+
static start(config: Omit<WebserverConfig, 'compiledConfig'>, logger: Logger, db?: ComponentConnectionManager, compiledConfig?: Record<string, string>): Promise<Server>;
|
|
19
20
|
static stop(): void;
|
|
20
21
|
private static mergeConfig;
|
|
21
22
|
}
|
|
@@ -23300,17 +23300,18 @@ var require_errorMiddleware = __commonJS({
|
|
|
23300
23300
|
const statusCode = error.statusCode || 500;
|
|
23301
23301
|
const message = (error === null || error === void 0 ? void 0 : error.message) || "An error occurred with no additional information available";
|
|
23302
23302
|
if (error instanceof error_1.ComponentError) {
|
|
23303
|
-
req.log.
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23311
|
-
|
|
23303
|
+
req.log.error({
|
|
23304
|
+
area: "component",
|
|
23305
|
+
"function-name": error.functionName,
|
|
23306
|
+
"component-name": error.componentName,
|
|
23307
|
+
"component-version": error.componentVersion,
|
|
23308
|
+
"set-name": error.setName,
|
|
23309
|
+
"log-command": "exception-handler",
|
|
23310
|
+
err: error.error,
|
|
23311
|
+
message
|
|
23312
|
+
});
|
|
23312
23313
|
} else if (error instanceof Error) {
|
|
23313
|
-
req.log.error(error, message);
|
|
23314
|
+
req.log.error({ error, message });
|
|
23314
23315
|
} else {
|
|
23315
23316
|
req.log.error(message);
|
|
23316
23317
|
}
|
|
@@ -40935,7 +40936,7 @@ var require_ComponentSetService = __commonJS({
|
|
|
40935
40936
|
envVars: componentSet.envVars,
|
|
40936
40937
|
headers: componentSet.headers
|
|
40937
40938
|
}, client);
|
|
40938
|
-
await this.
|
|
40939
|
+
await this.saveComponentSetComponents(componentSet.webPath, componentSet.components, client);
|
|
40939
40940
|
return set;
|
|
40940
40941
|
});
|
|
40941
40942
|
const savedSet = await this.getComponentSet(createdSet.webPath);
|
|
@@ -40970,7 +40971,7 @@ var require_ComponentSetService = __commonJS({
|
|
|
40970
40971
|
await this.db.repositories.componentSet.update({ webPath }, values, client);
|
|
40971
40972
|
}
|
|
40972
40973
|
if (data.components !== void 0) {
|
|
40973
|
-
await this.
|
|
40974
|
+
await this.saveComponentSetComponents(webPath, data.components, client);
|
|
40974
40975
|
}
|
|
40975
40976
|
});
|
|
40976
40977
|
return this.getComponentSet(webPath);
|
|
@@ -41003,7 +41004,7 @@ var require_ComponentSetService = __commonJS({
|
|
|
41003
41004
|
components: components !== null && components !== void 0 ? components : {}
|
|
41004
41005
|
};
|
|
41005
41006
|
}
|
|
41006
|
-
async
|
|
41007
|
+
async saveComponentSetComponents(webPath, components, client = null) {
|
|
41007
41008
|
const existingComponents = [];
|
|
41008
41009
|
Object.entries(await this.getExistingComponents(webPath)).forEach(([cn, cvs]) => {
|
|
41009
41010
|
cvs.forEach((cv) => {
|