@tsed/formio 7.0.0-beta.2 → 7.0.0-beta.5
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/.mocharc.js +2 -2
- package/.nycrc +6 -5
- package/lib/cjs/FormioModule.js +21 -21
- package/lib/cjs/FormioModule.js.map +1 -1
- package/lib/cjs/builder/FormioMapper.js +11 -3
- package/lib/cjs/builder/FormioMapper.js.map +1 -1
- package/lib/cjs/components/AlterActions.js +61 -16
- package/lib/cjs/components/AlterActions.js.map +1 -1
- package/lib/cjs/components/AlterAudit.js +1 -1
- package/lib/cjs/components/AlterAudit.js.map +1 -1
- package/lib/cjs/components/AlterHost.js +1 -1
- package/lib/cjs/components/AlterLog.js +1 -1
- package/lib/cjs/components/AlterSkip.js +5 -5
- package/lib/cjs/components/AlterTemplateExportSteps.js +5 -5
- package/lib/cjs/components/AlterTemplateExportSteps.js.map +1 -1
- package/lib/cjs/components/AlterTemplateImportSteps.js +5 -5
- package/lib/cjs/components/AlterTemplateImportSteps.js.map +1 -1
- package/lib/cjs/domain/FormioHooks.js.map +1 -1
- package/lib/cjs/domain/FormioModels.js +1 -1
- package/lib/cjs/domain/FormioModels.js.map +1 -1
- package/lib/cjs/domain/Resource.js.map +1 -1
- package/lib/cjs/index.js +46 -42
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/middlewares/FormioAuthMiddleware.js +8 -8
- package/lib/cjs/middlewares/FormioAuthMiddleware.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/services/FormioAuthService.js +7 -7
- package/lib/cjs/services/FormioAuthService.js.map +1 -1
- package/lib/cjs/services/FormioDatabase.js +47 -10
- package/lib/cjs/services/FormioDatabase.js.map +1 -1
- package/lib/cjs/services/FormioHooksService.js +5 -5
- package/lib/cjs/services/FormioHooksService.js.map +1 -1
- package/lib/cjs/services/FormioInstaller.js +5 -5
- package/lib/cjs/services/FormioInstaller.js.map +1 -1
- package/lib/cjs/services/FormioRepository.js +42 -0
- package/lib/cjs/services/FormioRepository.js.map +1 -0
- package/lib/cjs/services/FormioService.js +13 -10
- package/lib/cjs/services/FormioService.js.map +1 -1
- package/lib/esm/FormioModule.js +11 -11
- package/lib/esm/builder/FormioMapper.js +11 -3
- package/lib/esm/builder/FormioMapper.js.map +1 -1
- package/lib/esm/components/AlterActions.js +58 -13
- package/lib/esm/components/AlterActions.js.map +1 -1
- package/lib/esm/components/AlterAudit.js +1 -1
- package/lib/esm/components/AlterAudit.js.map +1 -1
- package/lib/esm/components/AlterHost.js +1 -1
- package/lib/esm/components/AlterLog.js +1 -1
- package/lib/esm/components/AlterSkip.js +1 -1
- package/lib/esm/components/AlterTemplateExportSteps.js +3 -3
- package/lib/esm/components/AlterTemplateExportSteps.js.map +1 -1
- package/lib/esm/components/AlterTemplateImportSteps.js +3 -3
- package/lib/esm/components/AlterTemplateImportSteps.js.map +1 -1
- package/lib/esm/decorators/useFormioAuth.js +1 -1
- package/lib/esm/domain/FormioHooks.js.map +1 -1
- package/lib/esm/domain/Resource.js.map +1 -1
- package/lib/esm/index.js +46 -42
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/middlewares/FormioAuthMiddleware.js +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/FormioAuthService.js +3 -3
- package/lib/esm/services/FormioAuthService.js.map +1 -1
- package/lib/esm/services/FormioDatabase.js +47 -10
- package/lib/esm/services/FormioDatabase.js.map +1 -1
- package/lib/esm/services/FormioHooksService.js +1 -1
- package/lib/esm/services/FormioInstaller.js +2 -2
- package/lib/esm/services/FormioRepository.js +38 -0
- package/lib/esm/services/FormioRepository.js.map +1 -0
- package/lib/esm/services/FormioService.js +6 -3
- package/lib/esm/services/FormioService.js.map +1 -1
- package/lib/types/components/AlterActions.d.ts +8 -3
- package/lib/types/components/AlterAudit.d.ts +2 -2
- package/lib/types/domain/FormioHooks.d.ts +1 -1
- package/lib/types/domain/Resource.d.ts +2 -2
- package/lib/types/index.d.ts +22 -14
- package/lib/types/services/FormioAuthService.d.ts +14 -3
- package/lib/types/services/FormioDatabase.d.ts +47 -8
- package/lib/types/services/FormioRepository.d.ts +24 -0
- package/package.json +21 -15
- package/readme.md +5 -9
- package/tsconfig.compile.esm.json +1 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioService.js","sourceRoot":"","sources":["../../../src/services/FormioService.ts"],"names":[],"mappings":";;;;AAAA,yCAAiE;AAIjE,+BAA+B;
|
|
1
|
+
{"version":3,"file":"FormioService.js","sourceRoot":"","sources":["../../../src/services/FormioService.ts"],"names":[],"mappings":";;;;AAAA,yCAAiE;AAIjE,+BAA+B;AAQ/B,aAAa;AACb,4DAAkC;AAClC,aAAa;AACb,oFAAiD;AACjD,aAAa;AACb,8EAA2C;AAG3C,IAAa,aAAa,GAA1B,MAAa,aAAa;IAMxB,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,uBAAuB;IACvB,IAAI,OAAO;QACT,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,oBAAO,EAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC9B,CAAC;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IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,UAAU,EAAE,CAAC;YAElB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAChC;IACH,CAAC;IAES,gBAAgB,CAAC,OAAqB;QAC9C,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;QACxB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAA4B,YAAY,CAAC,CAAC;QAExF,IAAI,gBAAgB,EAAE;YACpB,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,gBAAgB,CAAC,GAAG,CAAC;YACtD,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;SACjG;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAES,UAAU;QAClB,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;QAExB,iBAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtD,iBAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF,CAAA;AA3GC;IADC,IAAA,eAAM,GAAE;sCACW,wBAAe;+CAAC;AAJzB,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CA+GzB;AA/GY,sCAAa","sourcesContent":["import {Inject, Injectable, InjectorService} from \"@tsed/common\";\nimport {MongooseConnectionOptions} from \"@tsed/mongoose\";\nimport {Db} from \"mongodb\";\nimport {Mongoose} from \"mongoose\";\nimport {promisify} from \"util\";\nimport {Formio} from \"../domain/Formio\";\nimport {FormioConfig} from \"../domain/FormioConfig\";\nimport {FormioHook, FormioHooks} from \"../domain/FormioHooks\";\nimport {FormioSchemas} from \"../domain/FormioModels\";\nimport {FormioRouter} from \"../domain/FormioRouter\";\nimport {FormioTemplate} from \"../domain/FormioTemplate\";\nimport {FormioExportOptions} from \"../domain/FormioTemplateUtil\";\n// @ts-ignore\nimport createRouter from \"formio\";\n// @ts-ignore\nimport swagger from \"formio/src/util/swagger.js\";\n// @ts-ignore\nimport util from \"formio/src/util/util.js\";\n\n@Injectable()\nexport class FormioService {\n router: FormioRouter;\n\n @Inject()\n protected injector: InjectorService;\n\n get audit(): Function {\n return this.formio.audit || (() => {});\n }\n\n get auth() {\n return this.formio.auth;\n }\n\n // istanbul ignore next\n get swagger() {\n return (...args: any[]) => new Promise((resolve) => swagger(...args, resolve));\n }\n\n get config(): FormioConfig {\n return this.formio.config;\n }\n\n get db(): Db {\n return this.formio.db;\n }\n\n get resources() {\n return this.formio.resources;\n }\n\n get mongoose(): Mongoose {\n return this.formio.mongoose;\n }\n\n get middleware() {\n return this.formio.middleware;\n }\n\n get schemas(): FormioSchemas {\n return this.formio.schemas;\n }\n\n get formio(): Formio {\n return this.router.formio as Formio;\n }\n\n get hook(): FormioHook {\n return this.formio.hook;\n }\n\n get util() {\n return this.formio.util;\n }\n\n get template() {\n return this.formio.template;\n }\n\n get Action() {\n return this.formio.Action;\n }\n\n async exportTemplate(options: Partial<FormioExportOptions> = {}): Promise<FormioTemplate> {\n return promisify(this.formio.template.export)(options);\n }\n\n async importTemplate(template: FormioTemplate): Promise<FormioTemplate> {\n return promisify(this.formio.template.import.template)(template);\n }\n\n encrypt(text: string) {\n return promisify(this.formio.encrypt)(text);\n }\n\n isInit() {\n return !!this.router;\n }\n\n // istanbul ignore next\n public createRouter(options: FormioConfig) {\n return createRouter(options);\n }\n\n public init(options: FormioConfig, hooks: FormioHooks = {}) {\n if (options && Object.keys(options).length) {\n this.router = this.createRouter(this.mapConfiguration(options));\n this.bindLogger();\n\n return this.router.init(hooks);\n }\n }\n\n protected mapConfiguration(options: FormioConfig) {\n const {injector} = this;\n const mongooseSettings = injector.settings.get<MongooseConnectionOptions>(\"mongoose.0\");\n\n if (mongooseSettings) {\n options.mongo = options.mongo || mongooseSettings.url;\n options.mongoConfig = options.mongoConfig || JSON.stringify(mongooseSettings.connectionOptions);\n }\n\n return options;\n }\n\n protected bindLogger() {\n const {injector} = this;\n\n util.log = injector.logger.info.bind(injector.logger);\n util.error = injector.logger.error.bind(injector.logger);\n }\n}\n"]}
|
package/lib/esm/FormioModule.js
CHANGED
|
@@ -2,17 +2,17 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { Constant, Inject, InjectorService, normalizePath, PlatformApplication } from "@tsed/common";
|
|
3
3
|
import { deepClone } from "@tsed/core";
|
|
4
4
|
import { Module } from "@tsed/di";
|
|
5
|
-
import { AlterActions } from "./components/AlterActions";
|
|
6
|
-
import { AlterAudit } from "./components/AlterAudit";
|
|
7
|
-
import { AlterHost } from "./components/AlterHost";
|
|
8
|
-
import { AlterLog } from "./components/AlterLog";
|
|
9
|
-
import { AlterSkip } from "./components/AlterSkip";
|
|
10
|
-
import { AlterTemplateExportSteps } from "./components/AlterTemplateExportSteps";
|
|
11
|
-
import { AlterTemplateImportSteps } from "./components/AlterTemplateImportSteps";
|
|
12
|
-
import { FormioAuthService } from "./services/FormioAuthService";
|
|
13
|
-
import { FormioHooksService } from "./services/FormioHooksService";
|
|
14
|
-
import { FormioInstaller } from "./services/FormioInstaller";
|
|
15
|
-
import { FormioService } from "./services/FormioService";
|
|
5
|
+
import { AlterActions } from "./components/AlterActions.js";
|
|
6
|
+
import { AlterAudit } from "./components/AlterAudit.js";
|
|
7
|
+
import { AlterHost } from "./components/AlterHost.js";
|
|
8
|
+
import { AlterLog } from "./components/AlterLog.js";
|
|
9
|
+
import { AlterSkip } from "./components/AlterSkip.js";
|
|
10
|
+
import { AlterTemplateExportSteps } from "./components/AlterTemplateExportSteps.js";
|
|
11
|
+
import { AlterTemplateImportSteps } from "./components/AlterTemplateImportSteps.js";
|
|
12
|
+
import { FormioAuthService } from "./services/FormioAuthService.js";
|
|
13
|
+
import { FormioHooksService } from "./services/FormioHooksService.js";
|
|
14
|
+
import { FormioInstaller } from "./services/FormioInstaller.js";
|
|
15
|
+
import { FormioService } from "./services/FormioService.js";
|
|
16
16
|
let FormioModule = class FormioModule {
|
|
17
17
|
$onInit() {
|
|
18
18
|
return this.init(deepClone(this.settings));
|
|
@@ -14,7 +14,7 @@ export class FormioMapper {
|
|
|
14
14
|
findMachineName(data) {
|
|
15
15
|
const key = String(data);
|
|
16
16
|
const item = this.find(key);
|
|
17
|
-
return item ? `$machineName:${item.machineName}` : undefined;
|
|
17
|
+
return item ? `$machineName:${item.name || item.machineName}` : undefined;
|
|
18
18
|
}
|
|
19
19
|
mapToExport(data) {
|
|
20
20
|
return this.mapData(data, this.findMachineName.bind(this));
|
|
@@ -35,13 +35,21 @@ export class FormioMapper {
|
|
|
35
35
|
if (key) {
|
|
36
36
|
return key;
|
|
37
37
|
}
|
|
38
|
-
if (typeof data === "object" && !(data instanceof Date)) {
|
|
39
|
-
|
|
38
|
+
if (typeof data === "object" && !("_bsontype" in data) && !(data instanceof Date)) {
|
|
39
|
+
const isForm = data.path && data.type;
|
|
40
|
+
const mapped = Object.entries(data).reduce((obj, [key, value]) => {
|
|
40
41
|
return {
|
|
41
42
|
...obj,
|
|
42
43
|
[key]: this.mapData(value, resolver)
|
|
43
44
|
};
|
|
44
45
|
}, {});
|
|
46
|
+
return isForm
|
|
47
|
+
? {
|
|
48
|
+
...mapped,
|
|
49
|
+
name: data.name,
|
|
50
|
+
machineName: data.machineName || data.name
|
|
51
|
+
}
|
|
52
|
+
: mapped;
|
|
45
53
|
}
|
|
46
54
|
return data;
|
|
47
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioMapper.js","sourceRoot":"","sources":["../../../src/builder/FormioMapper.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACvB,YAAqB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEjD,IAAI,CAAC,GAAW;QACd,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAE1E,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACrG,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5B,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IACrC,CAAC;IAED,eAAe,CAAC,IAAS;QACvB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,IAAI,GAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC,CAAC,CAAC,gBAAgB,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"FormioMapper.js","sourceRoot":"","sources":["../../../src/builder/FormioMapper.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACvB,YAAqB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAA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ormioMapper {\n constructor(readonly ctxData: FormioCtxMapper) {}\n\n find(key: string) {\n const store = Object.values(this.ctxData).find((store) => store.get(key));\n\n return store?.get(key);\n }\n\n findId(data: string) {\n const key = String(data).startsWith(\"$machineName:\") ? String(data) : `$machineName:${String(data)}`;\n const item = this.find(key);\n\n return item ? item._id : undefined;\n }\n\n findMachineName(data: any) {\n const key = String(data);\n const item: any = this.find(key);\n\n return item ? `$machineName:${item.name || item.machineName}` : undefined;\n }\n\n mapToExport(data: any) {\n return this.mapData(data, this.findMachineName.bind(this));\n }\n\n mapToImport(data: any) {\n return this.mapData(data, this.findId.bind(this));\n }\n\n mapData(data: any, resolver: any): any {\n if (!data) {\n return data;\n }\n\n if (Array.isArray(data)) {\n return data.map((item) => {\n return this.mapData(item, resolver);\n });\n }\n\n const key = resolver(data, this.ctxData);\n\n if (key) {\n return key;\n }\n\n if (typeof data === \"object\" && !(\"_bsontype\" in data) && !(data instanceof Date)) {\n const isForm = data.path && data.type;\n const mapped = Object.entries(data).reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: this.mapData(value, resolver)\n };\n }, {});\n\n return isForm\n ? {\n ...mapped,\n name: data.name,\n machineName: data.machineName || data.name\n }\n : mapped;\n }\n\n return data;\n }\n}\n"]}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { EndpointMetadata, PlatformHandler } from "@tsed/common";
|
|
3
2
|
import { Inject, InjectorService } from "@tsed/di";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { EndpointMetadata } from "@tsed/schema";
|
|
4
|
+
import { PlatformParams } from "@tsed/platform-params";
|
|
5
|
+
import { PlatformResponseFilter } from "@tsed/platform-response-filter";
|
|
6
|
+
import { AnyToPromise, AnyToPromiseStatus } from "@tsed/core";
|
|
7
|
+
import { setResponseHeaders } from "@tsed/common";
|
|
8
|
+
import { Alter } from "../decorators/alter.js";
|
|
9
|
+
import { FormioService } from "../services/FormioService.js";
|
|
6
10
|
let AlterActions = class AlterActions {
|
|
7
11
|
transform(actions) {
|
|
8
12
|
const { Action } = this.formio;
|
|
@@ -10,7 +14,7 @@ let AlterActions = class AlterActions {
|
|
|
10
14
|
var _a;
|
|
11
15
|
const instance = this.injector.invoke(provider.token);
|
|
12
16
|
const options = provider.store.get("formio:action");
|
|
13
|
-
const resolveHandler = this.
|
|
17
|
+
const resolveHandler = this.createHandler(provider, "resolve");
|
|
14
18
|
return {
|
|
15
19
|
...actions,
|
|
16
20
|
[options.name]: (_a = class extends Action {
|
|
@@ -36,17 +40,50 @@ let AlterActions = class AlterActions {
|
|
|
36
40
|
getActions() {
|
|
37
41
|
return this.injector.getProviders("formio:action");
|
|
38
42
|
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
createHandler(provider, propertyKey) {
|
|
44
|
+
const promisedHandler = this.params.compileHandler({
|
|
45
|
+
token: provider.token,
|
|
46
|
+
propertyKey
|
|
47
|
+
});
|
|
48
|
+
return async (action, handler, method, req, res, next, setActionItemMessage) => {
|
|
49
|
+
const $ctx = req.$ctx;
|
|
50
|
+
$ctx.set("ACTION_CTX", { handler, method, setActionItemMessage, action });
|
|
51
|
+
$ctx.endpoint = EndpointMetadata.get(provider.useClass, "resolve");
|
|
52
|
+
await this.injector.runInContext($ctx, async () => {
|
|
53
|
+
try {
|
|
54
|
+
const resolver = new AnyToPromise();
|
|
55
|
+
const handler = await promisedHandler;
|
|
56
|
+
const { state, data, status, headers } = await resolver.call(() => handler({ $ctx }));
|
|
57
|
+
if (state === AnyToPromiseStatus.RESOLVED) {
|
|
58
|
+
if (status) {
|
|
59
|
+
$ctx.response.status(status);
|
|
60
|
+
}
|
|
61
|
+
if (headers) {
|
|
62
|
+
$ctx.response.setHeaders(headers);
|
|
63
|
+
}
|
|
64
|
+
if (data !== undefined) {
|
|
65
|
+
$ctx.data = data;
|
|
66
|
+
return await this.flush($ctx.data, $ctx);
|
|
67
|
+
}
|
|
68
|
+
next();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (er) {
|
|
72
|
+
next(er);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
48
75
|
};
|
|
49
76
|
}
|
|
77
|
+
async flush(data, $ctx) {
|
|
78
|
+
const { response } = $ctx;
|
|
79
|
+
if (!response.isDone()) {
|
|
80
|
+
setResponseHeaders($ctx);
|
|
81
|
+
data = await this.responseFilter.serialize(data, $ctx);
|
|
82
|
+
data = await this.responseFilter.transform(data, $ctx);
|
|
83
|
+
response.body(data);
|
|
84
|
+
}
|
|
85
|
+
return response;
|
|
86
|
+
}
|
|
50
87
|
};
|
|
51
88
|
__decorate([
|
|
52
89
|
Inject(),
|
|
@@ -56,6 +93,14 @@ __decorate([
|
|
|
56
93
|
Inject(),
|
|
57
94
|
__metadata("design:type", FormioService)
|
|
58
95
|
], AlterActions.prototype, "formio", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
Inject(),
|
|
98
|
+
__metadata("design:type", PlatformParams)
|
|
99
|
+
], AlterActions.prototype, "params", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
Inject(),
|
|
102
|
+
__metadata("design:type", PlatformResponseFilter)
|
|
103
|
+
], AlterActions.prototype, "responseFilter", void 0);
|
|
59
104
|
AlterActions = __decorate([
|
|
60
105
|
Alter("actions")
|
|
61
106
|
], AlterActions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterActions.js","sourceRoot":"","sources":["../../../src/components/AlterActions.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"AlterActions.js","sourceRoot":"","sources":["../../../src/components/AlterActions.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,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IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAhHC;IADC,MAAM,EAAE;8BACW,eAAe;8CAAC;AAGpC;IADC,MAAM,EAAE;8BACS,aAAa;4CAAC;AAGhC;IADC,MAAM,EAAE;8BACS,cAAc;4CAAC;AAGjC;IADC,MAAM,EAAE;8BACiB,sBAAsB;oDAAC;AAXtC,YAAY;IADxB,KAAK,CAAC,SAAS,CAAC;GACJ,YAAY,CAkHxB;SAlHY,YAAY","sourcesContent":["import {Inject, InjectorService, Provider} from \"@tsed/di\";\nimport {EndpointMetadata} from \"@tsed/schema\";\nimport {FormioActionInfo} from \"@tsed/formio-types\";\nimport {PlatformParams} from \"@tsed/platform-params\";\nimport {PlatformResponseFilter} from \"@tsed/platform-response-filter\";\nimport {AnyToPromise, AnyToPromiseStatus} from \"@tsed/core\";\nimport {PlatformContext, setResponseHeaders} from \"@tsed/common\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {SetActionItemMessage} from \"../domain/FormioAction\";\nimport {FormioActions} from \"../domain/FormioActionsIndex\";\nimport {FormioService} from \"../services/FormioService\";\n\n@Alter(\"actions\")\nexport class AlterActions implements AlterHook {\n @Inject()\n protected injector: InjectorService;\n\n @Inject()\n protected formio: FormioService;\n\n @Inject()\n protected params: PlatformParams;\n\n @Inject()\n protected responseFilter: PlatformResponseFilter;\n\n transform(actions: FormioActions): FormioActions {\n const {Action} = this.formio;\n\n return this.getActions().reduce((actions, provider) => {\n const instance = this.injector.invoke<any>(provider.token);\n const options = provider.store.get<FormioActionInfo>(\"formio:action\");\n const resolveHandler = this.createHandler(provider, \"resolve\");\n\n return {\n ...actions,\n [options.name]: class extends Action {\n static access = options.access;\n\n static async info(req: any, res: any, next: Function) {\n let opts = {...options};\n\n if (instance.info) {\n opts = await instance.info(opts, req, res);\n }\n\n next(null, opts);\n }\n\n static async settingsForm(req: any, res: any, next: Function) {\n next(null, await instance.settingsForm(req, res));\n }\n\n resolve(handler: string, method: string, req: any, res: any, next: Function, setActionItemMessage: SetActionItemMessage): void {\n resolveHandler(this, handler, method, req, res, next, setActionItemMessage);\n }\n }\n };\n }, actions);\n }\n\n protected getActions() {\n return this.injector.getProviders(\"formio:action\");\n }\n\n protected createHandler(provider: Provider, propertyKey: string | symbol) {\n const promisedHandler = this.params.compileHandler({\n token: provider.token,\n propertyKey\n });\n\n return async (\n action: any,\n handler: string,\n method: string,\n req: {$ctx: PlatformContext},\n res: any,\n next: any,\n setActionItemMessage: SetActionItemMessage\n ) => {\n const $ctx = req.$ctx;\n $ctx.set(\"ACTION_CTX\", {handler, method, setActionItemMessage, action});\n $ctx.endpoint = EndpointMetadata.get(provider.useClass, \"resolve\");\n\n await this.injector.runInContext($ctx, async () => {\n try {\n const resolver = new AnyToPromise();\n const handler = await promisedHandler;\n const {state, data, status, headers} = await resolver.call(() => handler({$ctx}));\n if (state === AnyToPromiseStatus.RESOLVED) {\n if (status) {\n $ctx.response.status(status);\n }\n\n if (headers) {\n $ctx.response.setHeaders(headers);\n }\n\n if (data !== undefined) {\n $ctx.data = data;\n\n return await this.flush($ctx.data, $ctx);\n }\n\n next();\n }\n } catch (er) {\n next(er);\n }\n });\n };\n }\n\n private async flush(data: any, $ctx: PlatformContext) {\n const {response} = $ctx;\n\n if (!response.isDone()) {\n setResponseHeaders($ctx);\n\n data = await this.responseFilter.serialize(data, $ctx);\n data = await this.responseFilter.transform(data, $ctx);\n\n response.body(data);\n }\n\n return response;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterAudit.js","sourceRoot":"","sources":["../../../src/components/AlterAudit.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,IAAa,UAAU,GAAvB,MAAa,UAAU;IACrB,SAAS,CAAC,IAAW,EAAE,KAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"AlterAudit.js","sourceRoot":"","sources":["../../../src/components/AlterAudit.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,IAAa,UAAU,GAAvB,MAAa,UAAU;IACrB,SAAS,CAAC,IAAW,EAAE,KAAa,EAAE,GAAc;QAClD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AALY,UAAU;IADtB,KAAK,CAAC,OAAO,CAAC;GACF,UAAU,CAKtB;SALY,UAAU","sourcesContent":["import {DIContext} from \"@tsed/di\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\n\n@Alter(\"audit\")\nexport class AlterAudit implements AlterHook {\n transform(info: any[], event: string, ctx: DIContext): boolean {\n ctx.logger.info({event, info});\n return false;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Constant } from "@tsed/common";
|
|
3
3
|
import { normalizePath } from "@tsed/common";
|
|
4
|
-
import { Alter } from "../decorators/alter";
|
|
4
|
+
import { Alter } from "../decorators/alter.js";
|
|
5
5
|
let AlterSkip = class AlterSkip {
|
|
6
6
|
transform(value, ctx) {
|
|
7
7
|
if (value) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { getValue } from "@tsed/core";
|
|
3
3
|
import { Inject } from "@tsed/di";
|
|
4
|
-
import { Alter } from "../decorators/alter";
|
|
5
|
-
import { FormioDatabase } from "../services/FormioDatabase";
|
|
6
|
-
|
|
4
|
+
import { Alter } from "../decorators/alter.js";
|
|
5
|
+
import { FormioDatabase } from "../services/FormioDatabase.js";
|
|
6
|
+
import async from "async";
|
|
7
7
|
let AlterTemplateExportSteps = class AlterTemplateExportSteps {
|
|
8
8
|
transform(queue, template, map, options) {
|
|
9
9
|
queue.push(async.apply(this.exportSubmissions.bind(this), template, map, options));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateExportSteps.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateExportSteps.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,IAAa,wBAAwB,GAArC,MAAa,wBAAwB;IAInC,SAAS,CAAC,KAAY,EAAE,QAAwB,EAAE,GAAQ,EAAE,OAAY;QACtE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;QAEnF,OAAO,KAAK,CAAC;IACf,CAAC;IAES,KAAK,CAAC,iBAAiB,CAAC,QAAwB,EAAE,GAAQ,EAAE,OAAY,EAAE,IAAS;QAC3F,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE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WAAW,CAAC,IAAI,CAAC;aAC/B,CAAC,CAAC;YAEH,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACX,CAAC;CACF,CAAA;AA1CC;IADC,MAAM,EAAE;8BACW,cAAc;0DAAC;AAFxB,wBAAwB;IADpC,KAAK,CAAC,qBAAqB,CAAC;GAChB,wBAAwB,CA4CpC;SA5CY,wBAAwB","sourcesContent":["import {getValue} from \"@tsed/core\";\nimport {Inject} from \"@tsed/di\";\nimport {MongooseDocument} from \"@tsed/mongoose\";\nimport {FormioMapper} from \"../builder/FormioMapper\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {FormioSubmission} from \"../domain/FormioModels\";\nimport {FormioTemplate} from \"../domain/FormioTemplate\";\nimport {FormioDatabase} from \"../services/FormioDatabase\";\nimport async from \"async\";\n\n@Alter(\"templateExportSteps\")\nexport class AlterTemplateExportSteps implements AlterHook {\n @Inject()\n protected database: FormioDatabase;\n\n transform(queue: any[], template: FormioTemplate, map: any, options: any): any {\n queue.push(async.apply(this.exportSubmissions.bind(this), template, map, options));\n\n return queue;\n }\n\n protected async exportSubmissions(template: FormioTemplate, map: any, options: any, next: any) {\n const [mapper, submissions] = await Promise.all([\n this.database.getFormioMapper(),\n this.database.submissionModel.find({\n deleted: {$eq: null}\n })\n ]);\n\n template.submissions = await this.mapSubmissions(submissions, mapper);\n\n next(null, template);\n }\n\n protected mapSubmissions(submissions: MongooseDocument<FormioSubmission>[], mapper: FormioMapper) {\n return submissions\n .map((submission) => submission.toObject())\n .reduce((acc: any, {_id, created, updated, modified, __v, owner, roles, form, metadata, ...submission}) => {\n const machineName = mapper.mapToExport(form.toString());\n const key = machineName.replace(\"$machineName:\", \"\");\n\n acc[key] = getValue(acc, key, []);\n\n acc[key].push({\n ...submission,\n created: created && created.toString(),\n modified: modified && modified.toString(),\n data: mapper.mapToExport(submission.data),\n roles: mapper.mapToExport(roles).filter(Boolean),\n form: mapper.mapToExport(form)\n });\n\n return acc;\n }, {});\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Inject } from "@tsed/di";
|
|
3
|
-
import { Alter } from "../decorators/alter";
|
|
4
|
-
import { FormioDatabase } from "../services/FormioDatabase";
|
|
5
|
-
|
|
3
|
+
import { Alter } from "../decorators/alter.js";
|
|
4
|
+
import { FormioDatabase } from "../services/FormioDatabase.js";
|
|
5
|
+
import async from "async";
|
|
6
6
|
let AlterTemplateImportSteps = class AlterTemplateImportSteps {
|
|
7
7
|
transform(queue, install, template) {
|
|
8
8
|
queue.push(async.apply(this.importSubmissions.bind(this), template));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateImportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateImportSteps.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AlterTemplateImportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateImportSteps.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,IAAa,wBAAwB,GAArC,MAAa,wBAAwB;IAInC,SAAS,CAAC,KAAY,EAAE,OAAiB,EAAE,QAAiC;QAC1E,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CA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wBAAwB","sourcesContent":["import {Inject} from \"@tsed/di\";\nimport {FormioMapper} from \"../builder/FormioMapper\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {FormioSubmission} from \"../domain/FormioModels\";\nimport {FormioTemplate} from \"../domain/FormioTemplate\";\nimport {FormioDatabase} from \"../services/FormioDatabase\";\nimport async from \"async\";\n\n@Alter(\"templateImportSteps\")\nexport class AlterTemplateImportSteps implements AlterHook {\n @Inject()\n protected database: FormioDatabase;\n\n transform(queue: any[], install: Function, template: Partial<FormioTemplate>): any {\n queue.push(async.apply(this.importSubmissions.bind(this), template));\n\n return queue;\n }\n\n protected async importSubmissions(template: Partial<FormioTemplate>, done: any) {\n if (template && template.submissions) {\n // clean all submissions\n await this.database.submissionModel.deleteMany({});\n\n const ctxData = await this.database.getFormioMapper();\n const entries = Object.entries(template.submissions);\n\n for (const entry of entries) {\n for (const submission of entry[1]) {\n await this.importSubmission({...submission, form: submission.form || entry[0]}, ctxData);\n }\n }\n }\n\n done();\n }\n\n protected async importSubmission(submission: Partial<FormioSubmission>, mapper: FormioMapper) {\n const value = {\n ...mapper.mapToImport(submission),\n roles: [...new Set(mapper.mapToImport(submission.roles || []))].filter(Boolean)\n };\n\n await this.database.submissionModel.create(value);\n\n return value;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseAuth } from "@tsed/common";
|
|
2
|
-
import { FormioAuthMiddleware } from "../middlewares/FormioAuthMiddleware";
|
|
2
|
+
import { FormioAuthMiddleware } from "../middlewares/FormioAuthMiddleware.js";
|
|
3
3
|
/**
|
|
4
4
|
* Check if a user is connected by using the Formio Auth middleware
|
|
5
5
|
* @decorator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioHooks.js","sourceRoot":"","sources":["../../../src/domain/FormioHooks.ts"],"names":[],"mappings":"","sourcesContent":["import {MongooseDocument} from \"@tsed/mongoose\";\nimport {Request} from \"express\";\nimport {FilterQuery, Schema, SchemaDefinition} from \"mongoose\";\nimport {Formio} from \"./Formio\";\nimport {FormioActions} from \"./FormioActionsIndex\";\nimport {FormioConfig} from \"./FormioConfig\";\nimport {FormioDecodedToken} from \"./FormioDecodedToken\";\nimport {FormioJs} from \"./FormioJs\";\nimport {FormioActionItem, FormioForm, FormioModelsModels, FormioSubmission} from \"./FormioModels\";\nimport {FormioSettings} from \"./FormioSettings\";\nimport {ResourceRestOptions} from \"./Resource\";\n\nexport type FormioInitEvent = \"alias\" | \"params\" | \"token\" | \"getTempToken\" | \"logout\" | \"current\" | \"access\" | \"perms\";\n\nexport interface FormioHooks {\n settings?: (settings: FormioSettings, req: Request, cb: Function) => FormioSettings;\n alter?: {\n alias?: (alias: string, req: Request, res: Response) => string;\n /**\n * Alter FormioJs configuration\n * @param formIo\n */\n configFormio?: (formIo: {Formio: FormioJs}) => void;\n /**\n * Alter formio server configuration.\n * @param config\n */\n updateConfig?: (config: FormioConfig) => FormioConfig;\n /**\n * Alter audit log.\n * @param info\n * @param event\n * @param req\n */\n audit?: (info: any[], event: string, req: Request) => void;\n /**\n * Alter log.\n * @param info\n * @param event\n * @param req\n */\n log?: (event: string, req: Request, ...info: string[]) => void;\n /**\n * Alter available actions\n * @param info\n * @param event\n * @param req\n */\n actions?: (actions: FormioActions) => FormioActions;\n /**\n * Skip auth for the current request.\n * @param info\n * @param event\n * @param req\n */\n skip?: (value: boolean, req: Request) => boolean;\n /**\n * Resolve host.\n * @param baseUrl\n * @param req\n */\n host?: (baseUrl: string, req: Request) => string;\n /**\n * `/form/${req.params.formId}/action`\n * @param action\n * @param req\n */\n path?: (path: string, req: Request) => any;\n /**\n * Restrict request types\n * @param methods\n */\n methods?: (methods: string[]) => string[];\n /**\n * Return the cors configuration.\n */\n cors?: () => Record<string, any>;\n /**\n * Return the current user submission.\n */\n currentUser?: (user: any) => any;\n /**\n * Alter current form.\n * @param form\n */\n currentForm?: (form: FormioForm) => FormioForm;\n /**\n * Alter formio\n * @param formio\n */\n formio?: (formio: Formio) => Formio;\n /**\n * Alter models\n * @param models\n */\n models?: (models: FormioModelsModels) => FormioModelsModels;\n /**\n * Alter resources\n * @param resources\n */\n resources?: (resources: {form: any; submission: any; role: any}) => any;\n\n resourceAccessFilter?: (search: any, req: Request, done: (err: unknown, newSearch: any) => void) => void;\n\n // machineName\n actionMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n formMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n roleMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n\n // schemas\n actionSchema?: (schema: Schema) => Schema;\n actionItemSchema?: (schema: Schema) => Schema;\n formSchema?: (schema: Schema) => Schema;\n roleSchema?: (schema: Schema) => Schema;\n schemaSchema?: (schema: Schema) => Schema;\n submissionSchema?: (schema: Schema | SchemaDefinition) => Schema;\n tokenSchema?: (schema: Schema) => Schema;\n permissionSchema?: (schema: SchemaDefinition) => SchemaDefinition;\n fieldMatchAccessPermissionSchema?: (schemaOptions: SchemaDefinition) => SchemaDefinition;\n\n // query\n actionsQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n submissionQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n roleQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n formQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n\n // Data\n actionItem?: (actionItem: FormioActionItem, req: Request) => FormioActionItem;\n actionContext?: (actionContext: any, req: Request) => any;\n actionInfo?: (action: any, req: Request) => any;\n\n // submission\n submission?: (req: Request, res: Response, done: Function) => void;\n submissionRequest?: (submission: FormioSubmission) => FormioSubmission;\n validateSubmissionForm?: (form: FormioForm, submission: FormioSubmission, done: Function) => void;\n postSubmissionUpdate?: (req: Request, res: Response, submissionUpdate: FormioSubmission) => void;\n\n // response\n /**\n * Allow modules to hook into the form loader middleware.\n * @param item\n * @param req\n * @param done\n */\n formResponse?: (item: any, req: Request, done: Function) => void;\n\n // params\n requestParams?: (req: Request & {formId: string; subId: string; roleId: string}, params: Record<string, any>) => void;\n /**\n * Alter submitted params\n * @param params\n */\n submissionParams?: (params: string[]) => string[];\n\n // Routes\n /**\n * Alter actions routes.\n */\n actionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter roles routes.\n */\n rolesRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter forms routes.\n */\n formRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter submission routes.\n */\n submissionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n\n // Auth\n user?: (user: any, done: (err: any, user: any) => void) => void;\n login?: (user: any, req: Request, done: (err: any) => void) => void;\n token?: (token: FormioDecodedToken, form: FormioForm, req: Request) => FormioDecodedToken;\n tokenDecode?: (token: FormioDecodedToken, req: Request, done: (err: any, decoded: FormioDecodedToken) => void) => void;\n submissionRequestTokenQuery?: (query: {formId: string; submissionId: string}, token: string) => any;\n\n [key: string]: any;\n };\n on?: {\n init?: (type: FormioInitEvent) => boolean;\n [key: string]: any;\n };\n}\n\nexport interface FormioHook {\n /**\n * Run settings function.\n */\n settings(req: Request, cb: Function): void;\n\n /**\n * Emit an event.\n * @param args\n */\n invoke<T = any>(...args: any[]): T | boolean;\n\n /**\n * Alter the given value by calling all listener.\n * @param event\n * @param args\n */\n alter(event: string, ...args: any[]): any;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FormioHooks.js","sourceRoot":"","sources":["../../../src/domain/FormioHooks.ts"],"names":[],"mappings":"","sourcesContent":["import {MongooseDocument} from \"@tsed/mongoose\";\nimport {Request, Response} from \"express\";\nimport {FilterQuery, Schema, SchemaDefinition} from \"mongoose\";\nimport {Formio} from \"./Formio\";\nimport {FormioActions} from \"./FormioActionsIndex\";\nimport {FormioConfig} from \"./FormioConfig\";\nimport {FormioDecodedToken} from \"./FormioDecodedToken\";\nimport {FormioJs} from \"./FormioJs\";\nimport {FormioActionItem, FormioForm, FormioModelsModels, FormioSubmission} from \"./FormioModels\";\nimport {FormioSettings} from \"./FormioSettings\";\nimport {ResourceRestOptions} from \"./Resource\";\n\nexport type FormioInitEvent = \"alias\" | \"params\" | \"token\" | \"getTempToken\" | \"logout\" | \"current\" | \"access\" | \"perms\";\n\nexport interface FormioHooks {\n settings?: (settings: FormioSettings, req: Request, cb: Function) => FormioSettings;\n alter?: {\n alias?: (alias: string, req: Request, res: Response) => string;\n /**\n * Alter FormioJs configuration\n * @param formIo\n */\n configFormio?: (formIo: {Formio: FormioJs}) => void;\n /**\n * Alter formio server configuration.\n * @param config\n */\n updateConfig?: (config: FormioConfig) => FormioConfig;\n /**\n * Alter audit log.\n * @param info\n * @param event\n * @param req\n */\n audit?: (info: any[], event: string, req: Request) => void;\n /**\n * Alter log.\n * @param info\n * @param event\n * @param req\n */\n log?: (event: string, req: Request, ...info: string[]) => void;\n /**\n * Alter available actions\n * @param info\n * @param event\n * @param req\n */\n actions?: (actions: FormioActions) => FormioActions;\n /**\n * Skip auth for the current request.\n * @param info\n * @param event\n * @param req\n */\n skip?: (value: boolean, req: Request) => boolean;\n /**\n * Resolve host.\n * @param baseUrl\n * @param req\n */\n host?: (baseUrl: string, req: Request) => string;\n /**\n * `/form/${req.params.formId}/action`\n * @param action\n * @param req\n */\n path?: (path: string, req: Request) => any;\n /**\n * Restrict request types\n * @param methods\n */\n methods?: (methods: string[]) => string[];\n /**\n * Return the cors configuration.\n */\n cors?: () => Record<string, any>;\n /**\n * Return the current user submission.\n */\n currentUser?: (user: any) => any;\n /**\n * Alter current form.\n * @param form\n */\n currentForm?: (form: FormioForm) => FormioForm;\n /**\n * Alter formio\n * @param formio\n */\n formio?: (formio: Formio) => Formio;\n /**\n * Alter models\n * @param models\n */\n models?: (models: FormioModelsModels) => FormioModelsModels;\n /**\n * Alter resources\n * @param resources\n */\n resources?: (resources: {form: any; submission: any; role: any}) => any;\n\n resourceAccessFilter?: (search: any, req: Request, done: (err: unknown, newSearch: any) => void) => void;\n\n // machineName\n actionMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n formMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n roleMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n\n // schemas\n actionSchema?: (schema: Schema) => Schema;\n actionItemSchema?: (schema: Schema) => Schema;\n formSchema?: (schema: Schema) => Schema;\n roleSchema?: (schema: Schema) => Schema;\n schemaSchema?: (schema: Schema) => Schema;\n submissionSchema?: (schema: Schema | SchemaDefinition) => Schema;\n tokenSchema?: (schema: Schema) => Schema;\n permissionSchema?: (schema: SchemaDefinition) => SchemaDefinition;\n fieldMatchAccessPermissionSchema?: (schemaOptions: SchemaDefinition) => SchemaDefinition;\n\n // query\n actionsQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n submissionQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n roleQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n formQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n\n // Data\n actionItem?: (actionItem: FormioActionItem, req: Request) => FormioActionItem;\n actionContext?: (actionContext: any, req: Request) => any;\n actionInfo?: (action: any, req: Request) => any;\n\n // submission\n submission?: (req: Request, res: Response, done: Function) => void;\n submissionRequest?: (submission: FormioSubmission) => FormioSubmission;\n validateSubmissionForm?: (form: FormioForm, submission: FormioSubmission, done: Function) => void;\n postSubmissionUpdate?: (req: Request, res: Response, submissionUpdate: FormioSubmission) => void;\n\n // response\n /**\n * Allow modules to hook into the form loader middleware.\n * @param item\n * @param req\n * @param done\n */\n formResponse?: (item: any, req: Request, done: Function) => void;\n\n // params\n requestParams?: (req: Request & {formId: string; subId: string; roleId: string}, params: Record<string, any>) => void;\n /**\n * Alter submitted params\n * @param params\n */\n submissionParams?: (params: string[]) => string[];\n\n // Routes\n /**\n * Alter actions routes.\n */\n actionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter roles routes.\n */\n rolesRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter forms routes.\n */\n formRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter submission routes.\n */\n submissionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n\n // Auth\n user?: (user: any, done: (err: any, user: any) => void) => void;\n login?: (user: any, req: Request, done: (err: any) => void) => void;\n token?: (token: FormioDecodedToken, form: FormioForm, req: Request) => FormioDecodedToken;\n tokenDecode?: (token: FormioDecodedToken, req: Request, done: (err: any, decoded: FormioDecodedToken) => void) => void;\n submissionRequestTokenQuery?: (query: {formId: string; submissionId: string}, token: string) => any;\n\n [key: string]: any;\n };\n on?: {\n init?: (type: FormioInitEvent) => boolean;\n [key: string]: any;\n };\n}\n\nexport interface FormioHook {\n /**\n * Run settings function.\n */\n settings(req: Request, cb: Function): void;\n\n /**\n * Emit an event.\n * @param args\n */\n invoke<T = any>(...args: any[]): T | boolean;\n\n /**\n * Alter the given value by calling all listener.\n * @param event\n * @param args\n */\n alter(event: string, ...args: any[]): any;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../../../src/domain/Resource.ts"],"names":[],"mappings":"","sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../../../src/domain/Resource.ts"],"names":[],"mappings":"","sourcesContent":["import {Request, Response, NextFunction} from \"express\";\n\nexport type ResourceHttpHandler = (req: Request, res: Response, next: NextFunction) => void;\n\nexport interface ResourceHttpMethodOptions {\n before?: ResourceHttpHandler;\n after?: ResourceHttpHandler;\n}\n\nexport interface ResourceRestOptions extends ResourceHttpMethodOptions {\n beforePut?: ResourceHttpHandler;\n beforePatch?: ResourceHttpHandler;\n beforePost?: ResourceHttpHandler;\n beforeIndex?: ResourceHttpHandler;\n beforeGet?: ResourceHttpHandler;\n afterPut?: ResourceHttpHandler;\n afterPatch?: ResourceHttpHandler;\n afterPost?: ResourceHttpHandler;\n afterIndex?: ResourceHttpHandler;\n afterGet?: ResourceHttpHandler;\n}\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
|
|
8
|
-
export * from "./
|
|
9
|
-
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./domain/
|
|
19
|
-
export * from "./domain/
|
|
20
|
-
export * from "./domain/
|
|
21
|
-
export * from "./domain/
|
|
22
|
-
export * from "./domain/
|
|
23
|
-
export * from "./domain/
|
|
24
|
-
export * from "./domain/
|
|
25
|
-
export * from "./domain/
|
|
26
|
-
export * from "./domain/
|
|
27
|
-
export * from "./domain/
|
|
28
|
-
export * from "./domain/
|
|
29
|
-
export * from "./domain/
|
|
30
|
-
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
35
|
-
export * from "./
|
|
36
|
-
export * from "./
|
|
37
|
-
export * from "./
|
|
38
|
-
export * from "./
|
|
39
|
-
export * from "./
|
|
40
|
-
export * from "./
|
|
41
|
-
export * from "./
|
|
42
|
-
export * from "./
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./FormioModule.js";
|
|
5
|
+
export * from "./builder/FormioMapper.js";
|
|
6
|
+
export * from "./components/AlterActions.js";
|
|
7
|
+
export * from "./components/AlterAudit.js";
|
|
8
|
+
export * from "./components/AlterHost.js";
|
|
9
|
+
export * from "./components/AlterLog.js";
|
|
10
|
+
export * from "./components/AlterSkip.js";
|
|
11
|
+
export * from "./components/AlterTemplateExportSteps.js";
|
|
12
|
+
export * from "./components/AlterTemplateImportSteps.js";
|
|
13
|
+
export * from "./decorators/action.js";
|
|
14
|
+
export * from "./decorators/actionCtx.js";
|
|
15
|
+
export * from "./decorators/alter.js";
|
|
16
|
+
export * from "./decorators/on.js";
|
|
17
|
+
export * from "./decorators/useFormioAuth.js";
|
|
18
|
+
export * from "./domain/AlterHook.js";
|
|
19
|
+
export * from "./domain/Formio.js";
|
|
20
|
+
export * from "./domain/FormioAction.js";
|
|
21
|
+
export * from "./domain/FormioActionsIndex.js";
|
|
22
|
+
export * from "./domain/FormioAuth.js";
|
|
23
|
+
export * from "./domain/FormioBaseModel.js";
|
|
24
|
+
export * from "./domain/FormioConfig.js";
|
|
25
|
+
export * from "./domain/FormioCtxMapper.js";
|
|
26
|
+
export * from "./domain/FormioDecodedToken.js";
|
|
27
|
+
export * from "./domain/FormioErrors.js";
|
|
28
|
+
export * from "./domain/FormioHooks.js";
|
|
29
|
+
export * from "./domain/FormioJs.js";
|
|
30
|
+
export * from "./domain/FormioModels.js";
|
|
31
|
+
export * from "./domain/FormioRouter.js";
|
|
32
|
+
export * from "./domain/FormioSettings.js";
|
|
33
|
+
export * from "./domain/FormioTemplate.js";
|
|
34
|
+
export * from "./domain/FormioTemplateUtil.js";
|
|
35
|
+
export * from "./domain/FormioUpdate.js";
|
|
36
|
+
export * from "./domain/FormioUtils.js";
|
|
37
|
+
export * from "./domain/OnHook.js";
|
|
38
|
+
export * from "./domain/Resource.js";
|
|
39
|
+
export * from "./middlewares/FormioAuthMiddleware.js";
|
|
40
|
+
export * from "./services/FormioAuthService.js";
|
|
41
|
+
export * from "./services/FormioDatabase.js";
|
|
42
|
+
export * from "./services/FormioHooksService.js";
|
|
43
|
+
export * from "./services/FormioInstaller.js";
|
|
44
|
+
export * from "./services/FormioRepository.js";
|
|
45
|
+
export * from "./services/FormioService.js";
|
|
46
|
+
export * from "./utils/isMongoId.js";
|
|
43
47
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./FormioModule\";\nexport * from \"./builder/FormioMapper\";\nexport * from \"./components/AlterActions\";\nexport * from \"./components/AlterAudit\";\nexport * from \"./components/AlterHost\";\nexport * from \"./components/AlterLog\";\nexport * from \"./components/AlterSkip\";\nexport * from \"./components/AlterTemplateExportSteps\";\nexport * from \"./components/AlterTemplateImportSteps\";\nexport * from \"./decorators/action\";\nexport * from \"./decorators/actionCtx\";\nexport * from \"./decorators/alter\";\nexport * from \"./decorators/on\";\nexport * from \"./decorators/useFormioAuth\";\nexport * from \"./domain/AlterHook\";\nexport * from \"./domain/Formio\";\nexport * from \"./domain/FormioAction\";\nexport * from \"./domain/FormioActionsIndex\";\nexport * from \"./domain/FormioAuth\";\nexport * from \"./domain/FormioBaseModel\";\nexport * from \"./domain/FormioConfig\";\nexport * from \"./domain/FormioCtxMapper\";\nexport * from \"./domain/FormioDecodedToken\";\nexport * from \"./domain/FormioErrors\";\nexport * from \"./domain/FormioHooks\";\nexport * from \"./domain/FormioJs\";\nexport * from \"./domain/FormioModels\";\nexport * from \"./domain/FormioRouter\";\nexport * from \"./domain/FormioSettings\";\nexport * from \"./domain/FormioTemplate\";\nexport * from \"./domain/FormioTemplateUtil\";\nexport * from \"./domain/FormioUpdate\";\nexport * from \"./domain/FormioUtils\";\nexport * from \"./domain/OnHook\";\nexport * from \"./domain/Resource\";\nexport * from \"./middlewares/FormioAuthMiddleware\";\nexport * from \"./services/FormioAuthService\";\nexport * from \"./services/FormioDatabase\";\nexport * from \"./services/FormioHooksService\";\nexport * from \"./services/FormioInstaller\";\nexport * from \"./services/FormioRepository\";\nexport * from \"./services/FormioService\";\nexport * from \"./utils/isMongoId\";\n"]}
|
|
@@ -3,7 +3,7 @@ import { Context, Inject, Middleware } from "@tsed/common";
|
|
|
3
3
|
import { getValue } from "@tsed/core";
|
|
4
4
|
import { Unauthorized } from "@tsed/exceptions";
|
|
5
5
|
import { promisify } from "util";
|
|
6
|
-
import { FormioService } from "../services/FormioService";
|
|
6
|
+
import { FormioService } from "../services/FormioService.js";
|
|
7
7
|
/**
|
|
8
8
|
* @middleware
|
|
9
9
|
* @formio
|
|
@@ -3,9 +3,9 @@ import { isFunction } from "@tsed/core";
|
|
|
3
3
|
import { Inject, Injectable } from "@tsed/di";
|
|
4
4
|
import { BadRequest, NotFound, Unauthorized } from "@tsed/exceptions";
|
|
5
5
|
import { promisify } from "util";
|
|
6
|
-
import { FormioDatabase } from "./FormioDatabase";
|
|
7
|
-
import { FormioHooksService } from "./FormioHooksService";
|
|
8
|
-
import { FormioService } from "./FormioService";
|
|
6
|
+
import { FormioDatabase } from "./FormioDatabase.js";
|
|
7
|
+
import { FormioHooksService } from "./FormioHooksService.js";
|
|
8
|
+
import { FormioService } from "./FormioService.js";
|
|
9
9
|
let FormioAuthService = class FormioAuthService {
|
|
10
10
|
get currentUser() {
|
|
11
11
|
return promisify(this.formio.auth.currentUser);
|