@squiz/edge-dev-render-runtime-lib 2.1.1 → 2.2.1
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/ComponentRunnerService.d.ts +14 -0
- package/lib/component-runner/index.d.ts +1 -1
- package/lib/index.js +756 -107
- package/lib/index.js.map +4 -4
- package/lib/ioc.d.ts +2 -2
- package/lib/public/docs.json +4890 -84
- package/lib/webserver/controllers/DevelopmentController.d.ts +61 -0
- package/package.json +2 -2
- package/lib/component-runner/ComponentRunnerServiceWithWorkers.d.ts +0 -10
- package/lib/webserver/controllers/RenderController.d.ts +0 -22
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Controller } from 'tsoa';
|
|
2
|
+
import { ComponentFunctionService, ManifestService } from '@squiz/component-lib';
|
|
3
|
+
import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib';
|
|
4
|
+
import { DevelopmentComponentRunnerService, FunctionReturnTypes } from '../../component-runner';
|
|
5
|
+
import { Config } from '../../ioc';
|
|
6
|
+
import { Request as ExpressRequest, Response as ExpressResponse } from 'express';
|
|
7
|
+
import { ComponentPreviewService } from '../../PreviewComponentService';
|
|
8
|
+
import { ComponentExecutionInput, RenderInputService } from '../../RenderInputService';
|
|
9
|
+
type ComponentManifest = MANIFEST_MODELS.v1.ComponentManifest;
|
|
10
|
+
type ComponentSchema = {
|
|
11
|
+
name: string;
|
|
12
|
+
schema: object;
|
|
13
|
+
};
|
|
14
|
+
export declare class DevelopmentController extends Controller {
|
|
15
|
+
private config;
|
|
16
|
+
private manifestService;
|
|
17
|
+
private componentRunnerService;
|
|
18
|
+
protected renderInputService: RenderInputService;
|
|
19
|
+
protected componentPreviewService: ComponentPreviewService;
|
|
20
|
+
protected componentFunctionService: ComponentFunctionService;
|
|
21
|
+
constructor(config: Config, manifestService: ManifestService, componentRunnerService: DevelopmentComponentRunnerService, renderInputService: RenderInputService, componentPreviewService: ComponentPreviewService, componentFunctionService: ComponentFunctionService);
|
|
22
|
+
/**
|
|
23
|
+
* Returns an array of all component manifests in the data mount point
|
|
24
|
+
* @return {*} {Promise<ComponentManifest[]>}
|
|
25
|
+
* @memberof EdgeDevelopmentController
|
|
26
|
+
*/
|
|
27
|
+
getComponents(): Promise<ComponentManifest[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the manifest for the given componentId
|
|
30
|
+
* @param {string} componentId
|
|
31
|
+
* @return {*} {Promise<ComponentManifest>}
|
|
32
|
+
* @memberof EdgeDevelopmentController
|
|
33
|
+
*/
|
|
34
|
+
Manifest(componentId: string): Promise<ComponentManifest>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the component schema for the given componentId
|
|
37
|
+
* @param {string} componentId
|
|
38
|
+
* @return {*} {Promise<ComponentSchema[]>}
|
|
39
|
+
* @memberof EdgeDevelopmentController
|
|
40
|
+
*/
|
|
41
|
+
getContentSchema(componentId: string): Promise<ComponentSchema[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Renders a temporary preview for a component using input data and configuration from query params, and mocking other required variables
|
|
44
|
+
* @param {ExpressRequest} req
|
|
45
|
+
* @param {string} componentId
|
|
46
|
+
* @param {string} functionName
|
|
47
|
+
* @param {*} [headers]
|
|
48
|
+
* @param {*} [envVars]
|
|
49
|
+
* @param {*} [data]
|
|
50
|
+
* @memberof DevelopmentController
|
|
51
|
+
*/
|
|
52
|
+
TemporaryPreview(req: ExpressRequest, componentId: string, functionName: string, headers?: any, envVars?: any, data?: any): Promise<void>;
|
|
53
|
+
getDefaultFunctionRendering(expressRequest: ExpressRequest, componentId: string, componentSet?: string, previewKey?: string): Promise<void>;
|
|
54
|
+
getGivenFunctionRendering(expressRequest: ExpressRequest, componentId: string, functionName: string, componentSet?: string, previewKey?: string): Promise<void>;
|
|
55
|
+
protected handleResponse(input: ComponentExecutionInput, output: FunctionReturnTypes, response: ExpressResponse): void;
|
|
56
|
+
protected doFunctionRender(renderInput: ComponentExecutionInput): Promise<FunctionReturnTypes>;
|
|
57
|
+
private renderAndValidateOutput;
|
|
58
|
+
protected setHeadersOnResponse(renderInput: ComponentExecutionInput, response: ExpressResponse): void;
|
|
59
|
+
private checkDevMode;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squiz/edge-dev-render-runtime-lib",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Package of Edge rendering utilities for components in dev mode",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"cors": "2.8.5",
|
|
29
29
|
"dotenv": "16.0.3",
|
|
30
30
|
"esbuild": "^0.23.0",
|
|
31
|
-
"express": "4.
|
|
31
|
+
"express": "4.20.0",
|
|
32
32
|
"fs-extra": "11.1.0",
|
|
33
33
|
"helmet": "6.0.1",
|
|
34
34
|
"inversify": "6.0.2",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExecuteComponentTask } from './ExecuteComponentTask';
|
|
2
|
-
import { FunctionReturnTypes } from './FunctionReturnTypes';
|
|
3
|
-
export interface ComponentRunnerService {
|
|
4
|
-
executeComponentFunction(task: ExecuteComponentTask): Promise<FunctionReturnTypes>;
|
|
5
|
-
}
|
|
6
|
-
export declare class ComponentRunnerServiceWithWorkers implements ComponentRunnerService {
|
|
7
|
-
executeComponentFunction(task: ExecuteComponentTask): Promise<FunctionReturnTypes>;
|
|
8
|
-
private getComponentContext;
|
|
9
|
-
private getOutputLocation;
|
|
10
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BaseController } from './BaseController';
|
|
2
|
-
import { type Request as ExpressRequest, type Response as ExpressResponse } from 'express';
|
|
3
|
-
import { ComponentRunnerService } from '../../component-runner';
|
|
4
|
-
import { ManifestService, ComponentFunctionService, ComponentSetService } from '@squiz/component-lib';
|
|
5
|
-
import { RenderInputService, ComponentExecutionInput } from '../../RenderInputService';
|
|
6
|
-
import { FunctionReturnTypes } from '../../component-runner/FunctionReturnTypes';
|
|
7
|
-
import { ComponentPreviewService } from '../../PreviewComponentService';
|
|
8
|
-
export declare class RenderController extends BaseController {
|
|
9
|
-
protected componentSetService: ComponentSetService;
|
|
10
|
-
protected manifestService: ManifestService;
|
|
11
|
-
protected componentFunctionService: ComponentFunctionService;
|
|
12
|
-
protected componentRunnerService: ComponentRunnerService;
|
|
13
|
-
protected renderInputService: RenderInputService;
|
|
14
|
-
protected componentPreviewService: ComponentPreviewService;
|
|
15
|
-
constructor(componentSetService: ComponentSetService, manifestService: ManifestService, componentFunctionService: ComponentFunctionService, componentRunnerService: ComponentRunnerService, renderInputService: RenderInputService, componentPreviewService: ComponentPreviewService);
|
|
16
|
-
getDefaultFunctionRendering(expressRequest: ExpressRequest, componentId: string, componentSet?: string, previewKey?: string): Promise<void>;
|
|
17
|
-
getGivenFunctionRendering(expressRequest: ExpressRequest, componentId: string, functionName: string, componentSet?: string, previewKey?: string): Promise<void>;
|
|
18
|
-
protected handleResponse(input: ComponentExecutionInput, output: FunctionReturnTypes, response: ExpressResponse): void;
|
|
19
|
-
protected doFunctionRender(renderInput: ComponentExecutionInput): Promise<FunctionReturnTypes>;
|
|
20
|
-
private renderAndValidateOutput;
|
|
21
|
-
protected setHeadersOnResponse(renderInput: ComponentExecutionInput, response: ExpressResponse): void;
|
|
22
|
-
}
|