@tsed/formio 8.37.0 → 8.38.0-beta.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __decorate
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { AnyToPromise, AnyToPromiseStatus } from "@tsed/core";
|
|
3
|
-
import {
|
|
3
|
+
import { inject, injector } from "@tsed/di";
|
|
4
4
|
import { setResponseHeaders } from "@tsed/platform-http";
|
|
5
5
|
import { Alter } from "../decorators/alter.js";
|
|
6
6
|
import { FormioService } from "../services/FormioService.js";
|
|
@@ -8,10 +8,15 @@ import { PlatformParams } from "@tsed/platform-params";
|
|
|
8
8
|
import { PlatformResponseFilter } from "@tsed/platform-response-filter";
|
|
9
9
|
import { s } from "@tsed/schema";
|
|
10
10
|
let AlterActions = class AlterActions {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.formio = inject(FormioService);
|
|
13
|
+
this.params = inject(PlatformParams);
|
|
14
|
+
this.responseFilter = inject(PlatformResponseFilter);
|
|
15
|
+
}
|
|
11
16
|
transform(actions) {
|
|
12
17
|
const { Action } = this.formio;
|
|
13
18
|
return this.getActions().reduce((actions, provider) => {
|
|
14
|
-
const instance =
|
|
19
|
+
const instance = inject(provider.token);
|
|
15
20
|
const options = provider.store.get("formio:action");
|
|
16
21
|
const resolveHandler = this.createHandler(provider, "resolve");
|
|
17
22
|
return {
|
|
@@ -36,7 +41,7 @@ let AlterActions = class AlterActions {
|
|
|
36
41
|
}, actions);
|
|
37
42
|
}
|
|
38
43
|
getActions() {
|
|
39
|
-
return
|
|
44
|
+
return injector().providers.getMany("formio:action");
|
|
40
45
|
}
|
|
41
46
|
createHandler(provider, propertyKey) {
|
|
42
47
|
const compiledHandler = this.params.compileHandler({
|
|
@@ -86,22 +91,6 @@ let AlterActions = class AlterActions {
|
|
|
86
91
|
return response;
|
|
87
92
|
}
|
|
88
93
|
};
|
|
89
|
-
__decorate([
|
|
90
|
-
Inject(),
|
|
91
|
-
__metadata("design:type", InjectorService)
|
|
92
|
-
], AlterActions.prototype, "injector", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
Inject(),
|
|
95
|
-
__metadata("design:type", FormioService)
|
|
96
|
-
], AlterActions.prototype, "formio", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
Inject(),
|
|
99
|
-
__metadata("design:type", PlatformParams)
|
|
100
|
-
], AlterActions.prototype, "params", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
Inject(),
|
|
103
|
-
__metadata("design:type", PlatformResponseFilter)
|
|
104
|
-
], AlterActions.prototype, "responseFilter", void 0);
|
|
105
94
|
AlterActions = __decorate([
|
|
106
95
|
Alter("actions")
|
|
107
96
|
], AlterActions);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StoreSet, useDecorators } from "@tsed/core";
|
|
2
|
-
import {
|
|
2
|
+
import { injectable } from "@tsed/di";
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param name
|
|
@@ -7,9 +7,6 @@ import { registerProvider } from "@tsed/di";
|
|
|
7
7
|
*/
|
|
8
8
|
export function Alter(name) {
|
|
9
9
|
return useDecorators((target) => {
|
|
10
|
-
|
|
11
|
-
token: target,
|
|
12
|
-
type: "formio:alter"
|
|
13
|
-
});
|
|
10
|
+
injectable(target).type("formio:alter");
|
|
14
11
|
}, StoreSet("formio:alter:name", name));
|
|
15
12
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Inject, Injectable, InjectorService } from "@tsed/di";
|
|
1
|
+
import { inject, injectable, injector } from "@tsed/di";
|
|
3
2
|
import { FormioService } from "./FormioService.js";
|
|
4
3
|
import { promisify } from "node:util";
|
|
5
|
-
|
|
4
|
+
export class FormioHooksService {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.formio = inject(FormioService);
|
|
7
|
+
}
|
|
6
8
|
get settings() {
|
|
7
9
|
return this.formio.hook.settings;
|
|
8
10
|
}
|
|
@@ -21,9 +23,6 @@ let FormioHooksService = class FormioHooksService {
|
|
|
21
23
|
on: this.getHooksProvider("on")
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
|
-
getProviders(type) {
|
|
25
|
-
return this.injector.getProviders(`formio:${type}`);
|
|
26
|
-
}
|
|
27
26
|
getHooksProvider(type) {
|
|
28
27
|
return this.bindHooks(type, this.createHooks(type));
|
|
29
28
|
}
|
|
@@ -49,8 +48,10 @@ let FormioHooksService = class FormioHooksService {
|
|
|
49
48
|
}, {});
|
|
50
49
|
}
|
|
51
50
|
createHooks(type) {
|
|
52
|
-
return
|
|
53
|
-
|
|
51
|
+
return injector()
|
|
52
|
+
.providers.getMany(`formio:${type}`)
|
|
53
|
+
.reduce((hooks, provider) => {
|
|
54
|
+
const instance = inject(provider.token);
|
|
54
55
|
const name = provider.store.get(`formio:${type}:name`);
|
|
55
56
|
const pool = hooks[name] || [];
|
|
56
57
|
const hook = (...args) => instance[type === "alter" ? "transform" : "on"](...args.map((input) => {
|
|
@@ -62,16 +63,5 @@ let FormioHooksService = class FormioHooksService {
|
|
|
62
63
|
};
|
|
63
64
|
}, {});
|
|
64
65
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
Inject(),
|
|
68
|
-
__metadata("design:type", InjectorService)
|
|
69
|
-
], FormioHooksService.prototype, "injector", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
Inject(FormioService),
|
|
72
|
-
__metadata("design:type", FormioService)
|
|
73
|
-
], FormioHooksService.prototype, "formio", void 0);
|
|
74
|
-
FormioHooksService = __decorate([
|
|
75
|
-
Injectable()
|
|
76
|
-
], FormioHooksService);
|
|
77
|
-
export { FormioHooksService };
|
|
66
|
+
}
|
|
67
|
+
injectable(FormioHooksService);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Provider } from "@tsed/di";
|
|
2
2
|
import { AlterHook } from "../domain/AlterHook.js";
|
|
3
3
|
import { FormioActions } from "../domain/FormioActionsIndex.js";
|
|
4
4
|
import { FormioService } from "../services/FormioService.js";
|
|
@@ -6,7 +6,6 @@ import { PlatformParams } from "@tsed/platform-params";
|
|
|
6
6
|
import { PlatformResponseFilter } from "@tsed/platform-response-filter";
|
|
7
7
|
import { SetActionItemMessage } from "../domain/FormioAction.js";
|
|
8
8
|
export declare class AlterActions implements AlterHook {
|
|
9
|
-
protected injector: InjectorService;
|
|
10
9
|
protected formio: FormioService;
|
|
11
10
|
protected params: PlatformParams;
|
|
12
11
|
protected responseFilter: PlatformResponseFilter;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { InjectorService } from "@tsed/di";
|
|
2
1
|
import { FormioHooks } from "../domain/FormioHooks.js";
|
|
3
2
|
import { FormioService } from "./FormioService.js";
|
|
4
3
|
import { Request } from "express";
|
|
5
4
|
export declare class FormioHooksService {
|
|
6
|
-
protected injector: InjectorService;
|
|
7
5
|
protected formio: FormioService;
|
|
8
6
|
get settings(): (req: Request, cb: Function) => void;
|
|
9
7
|
get invoke(): <T = any>(...args: any[]) => T | boolean;
|
|
10
8
|
get alter(): (event: string, ...args: any[]) => any;
|
|
11
9
|
get alterAsync(): (event: string, ...args: any[]) => Promise<any>;
|
|
12
10
|
getHooks(): FormioHooks;
|
|
13
|
-
protected getProviders(type: "alter" | "on"): import("@tsed/di").Provider<any>[];
|
|
14
11
|
protected getHooksProvider(type: "alter" | "on"): {};
|
|
15
12
|
protected bindHooks(type: "alter" | "on", hooks: Record<string, Function[]>): {};
|
|
16
13
|
private createHooks;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/formio",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.38.0-beta.1",
|
|
4
4
|
"description": "Formio package for Ts.ED framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Formio",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tsed/formio-types": "8.
|
|
36
|
-
"@tsed/normalize-path": "8.
|
|
35
|
+
"@tsed/formio-types": "8.38.0-beta.1",
|
|
36
|
+
"@tsed/normalize-path": "8.38.0-beta.1",
|
|
37
37
|
"tslib": ">=2.7.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@tsed/barrels": "8.
|
|
41
|
-
"@tsed/core": "8.
|
|
42
|
-
"@tsed/di": "8.
|
|
43
|
-
"@tsed/mongoose": "8.
|
|
44
|
-
"@tsed/platform-http": "8.
|
|
45
|
-
"@tsed/typescript": "8.
|
|
40
|
+
"@tsed/barrels": "8.38.0-beta.1",
|
|
41
|
+
"@tsed/core": "8.38.0-beta.1",
|
|
42
|
+
"@tsed/di": "8.38.0-beta.1",
|
|
43
|
+
"@tsed/mongoose": "8.38.0-beta.1",
|
|
44
|
+
"@tsed/platform-http": "8.38.0-beta.1",
|
|
45
|
+
"@tsed/typescript": "8.38.0-beta.1",
|
|
46
46
|
"@types/async": "3.2.24",
|
|
47
47
|
"express": "^5.2.1",
|
|
48
48
|
"formio": "4.7.2",
|
|
@@ -70,5 +70,8 @@
|
|
|
70
70
|
},
|
|
71
71
|
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/third-parties/formio",
|
|
72
72
|
"author": "Romain Lenzotti",
|
|
73
|
-
"license": "MIT"
|
|
73
|
+
"license": "MIT",
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"tag": "beta"
|
|
76
|
+
}
|
|
74
77
|
}
|