@tsed/formio 6.88.1 → 6.89.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/lib/{FormioModule.d.ts → cjs/FormioModule.d.ts} +0 -0
- package/lib/{FormioModule.js → cjs/FormioModule.js} +34 -34
- package/lib/cjs/FormioModule.js.map +1 -0
- package/lib/{builder → cjs/builder}/FormioMapper.d.ts +0 -0
- package/lib/{builder → cjs/builder}/FormioMapper.js +0 -0
- package/lib/cjs/builder/FormioMapper.js.map +1 -0
- package/lib/{components → cjs/components}/AlterActions.d.ts +0 -0
- package/lib/{components → cjs/components}/AlterActions.js +8 -8
- package/lib/cjs/components/AlterActions.js.map +1 -0
- package/lib/{components → cjs/components}/AlterAudit.d.ts +0 -0
- package/lib/{components → cjs/components}/AlterAudit.js +2 -2
- package/lib/cjs/components/AlterAudit.js.map +1 -0
- package/lib/{components → cjs/components}/AlterHost.d.ts +0 -0
- package/lib/{components → cjs/components}/AlterHost.js +2 -2
- package/lib/cjs/components/AlterHost.js.map +1 -0
- package/lib/{components → cjs/components}/AlterLog.d.ts +0 -0
- package/lib/{components → cjs/components}/AlterLog.js +2 -2
- package/lib/cjs/components/AlterLog.js.map +1 -0
- package/lib/{components → cjs/components}/AlterSkip.d.ts +0 -0
- package/lib/{components → cjs/components}/AlterSkip.js +9 -9
- package/lib/cjs/components/AlterSkip.js.map +1 -0
- package/lib/{components → cjs/components}/AlterTemplateExportSteps.d.ts +0 -0
- package/lib/{components → cjs/components}/AlterTemplateExportSteps.js +6 -6
- package/lib/cjs/components/AlterTemplateExportSteps.js.map +1 -0
- package/lib/{components → cjs/components}/AlterTemplateImportSteps.d.ts +0 -0
- package/lib/{components → cjs/components}/AlterTemplateImportSteps.js +5 -5
- package/lib/cjs/components/AlterTemplateImportSteps.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/action.d.ts +0 -0
- package/lib/{decorators → cjs/decorators}/action.js +3 -3
- package/lib/cjs/decorators/action.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/actionCtx.d.ts +0 -0
- package/lib/{decorators → cjs/decorators}/actionCtx.js +1 -1
- package/lib/cjs/decorators/actionCtx.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/alter.d.ts +0 -0
- package/lib/{decorators → cjs/decorators}/alter.js +3 -3
- package/lib/cjs/decorators/alter.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/on.d.ts +0 -0
- package/lib/{decorators → cjs/decorators}/on.js +3 -3
- package/lib/cjs/decorators/on.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/useFormioAuth.d.ts +0 -0
- package/lib/{decorators → cjs/decorators}/useFormioAuth.js +1 -1
- package/lib/cjs/decorators/useFormioAuth.js.map +1 -0
- package/lib/{domain → cjs/domain}/AlterHook.d.ts +0 -0
- package/lib/{domain → cjs/domain}/AlterHook.js +0 -0
- package/lib/cjs/domain/AlterHook.js.map +1 -0
- package/lib/{domain → cjs/domain}/Formio.d.ts +0 -0
- package/lib/{domain → cjs/domain}/Formio.js +0 -0
- package/lib/cjs/domain/Formio.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioAction.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioAction.js +0 -0
- package/lib/cjs/domain/FormioAction.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioActionsIndex.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioActionsIndex.js +0 -0
- package/lib/cjs/domain/FormioActionsIndex.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioAuth.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioAuth.js +0 -0
- package/lib/cjs/domain/FormioAuth.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioBaseModel.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioBaseModel.js +0 -0
- package/lib/cjs/domain/FormioBaseModel.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioConfig.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioConfig.js +0 -0
- package/lib/cjs/domain/FormioConfig.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioCtxMapper.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioCtxMapper.js +0 -0
- package/lib/cjs/domain/FormioCtxMapper.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioDecodedToken.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioDecodedToken.js +0 -0
- package/lib/cjs/domain/FormioDecodedToken.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioErrors.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioErrors.js +0 -0
- package/lib/cjs/domain/FormioErrors.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioHooks.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioHooks.js +0 -0
- package/lib/cjs/domain/FormioHooks.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioJs.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioJs.js +0 -0
- package/lib/cjs/domain/FormioJs.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioModels.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioModels.js +1 -1
- package/lib/cjs/domain/FormioModels.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioRouter.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioRouter.js +0 -0
- package/lib/cjs/domain/FormioRouter.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioSettings.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioSettings.js +0 -0
- package/lib/cjs/domain/FormioSettings.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioTemplate.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioTemplate.js +0 -0
- package/lib/cjs/domain/FormioTemplate.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioTemplateUtil.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioTemplateUtil.js +0 -0
- package/lib/cjs/domain/FormioTemplateUtil.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioUpdate.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioUpdate.js +0 -0
- package/lib/cjs/domain/FormioUpdate.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioUtils.d.ts +0 -0
- package/lib/{domain → cjs/domain}/FormioUtils.js +0 -0
- package/lib/cjs/domain/FormioUtils.js.map +1 -0
- package/lib/{domain → cjs/domain}/OnHook.d.ts +0 -0
- package/lib/{domain → cjs/domain}/OnHook.js +0 -0
- package/lib/cjs/domain/OnHook.js.map +1 -0
- package/lib/{domain → cjs/domain}/Resource.d.ts +0 -0
- package/lib/{domain → cjs/domain}/Resource.js +0 -0
- package/lib/cjs/domain/Resource.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.js +46 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/FormioAuthMiddleware.d.ts +0 -0
- package/lib/{middlewares → cjs/middlewares}/FormioAuthMiddleware.js +12 -12
- package/lib/cjs/middlewares/FormioAuthMiddleware.js.map +1 -0
- package/lib/{services → cjs/services}/FormioAuthService.d.ts +1 -1
- package/lib/{services → cjs/services}/FormioAuthService.js +13 -13
- package/lib/cjs/services/FormioAuthService.js.map +1 -0
- package/lib/{services → cjs/services}/FormioDatabase.d.ts +0 -0
- package/lib/{services → cjs/services}/FormioDatabase.js +10 -10
- package/lib/cjs/services/FormioDatabase.js.map +1 -0
- package/lib/{services → cjs/services}/FormioHooksService.d.ts +0 -0
- package/lib/{services → cjs/services}/FormioHooksService.js +9 -9
- package/lib/cjs/services/FormioHooksService.js.map +1 -0
- package/lib/{services → cjs/services}/FormioInstaller.d.ts +0 -0
- package/lib/{services → cjs/services}/FormioInstaller.js +8 -8
- package/lib/cjs/services/FormioInstaller.js.map +1 -0
- package/lib/{services → cjs/services}/FormioService.d.ts +0 -0
- package/lib/{services → cjs/services}/FormioService.js +8 -8
- package/lib/cjs/services/FormioService.js.map +1 -0
- package/lib/{utils → cjs/utils}/isMongoId.d.ts +0 -0
- package/lib/{utils → cjs/utils}/isMongoId.js +0 -0
- package/lib/cjs/utils/isMongoId.js.map +1 -0
- package/lib/esm/FormioModule.js +147 -0
- package/lib/{FormioModule.js.map → esm/FormioModule.js.map} +1 -1
- package/lib/esm/builder/FormioMapper.js +49 -0
- package/lib/esm/builder/FormioMapper.js.map +1 -0
- package/lib/esm/components/AlterActions.js +63 -0
- package/lib/esm/components/AlterActions.js.map +1 -0
- package/lib/esm/components/AlterAudit.js +13 -0
- package/lib/esm/components/AlterAudit.js.map +1 -0
- package/lib/esm/components/AlterHost.js +12 -0
- package/lib/esm/components/AlterHost.js.map +1 -0
- package/lib/esm/components/AlterLog.js +13 -0
- package/lib/esm/components/AlterLog.js.map +1 -0
- package/lib/esm/components/AlterSkip.js +29 -0
- package/lib/esm/components/AlterSkip.js.map +1 -0
- package/lib/esm/components/AlterTemplateExportSteps.js +49 -0
- package/lib/esm/components/AlterTemplateExportSteps.js.map +1 -0
- package/lib/esm/components/AlterTemplateImportSteps.js +42 -0
- package/lib/esm/components/AlterTemplateImportSteps.js.map +1 -0
- package/lib/esm/decorators/action.js +16 -0
- package/lib/esm/decorators/action.js.map +1 -0
- package/lib/esm/decorators/actionCtx.js +19 -0
- package/lib/esm/decorators/actionCtx.js.map +1 -0
- package/lib/esm/decorators/alter.js +16 -0
- package/lib/esm/decorators/alter.js.map +1 -0
- package/lib/esm/decorators/on.js +16 -0
- package/lib/esm/decorators/on.js.map +1 -0
- package/lib/esm/decorators/useFormioAuth.js +11 -0
- package/lib/esm/decorators/useFormioAuth.js.map +1 -0
- package/lib/esm/domain/AlterHook.js +2 -0
- package/lib/esm/domain/AlterHook.js.map +1 -0
- package/lib/esm/domain/Formio.js +2 -0
- package/lib/esm/domain/Formio.js.map +1 -0
- package/lib/esm/domain/FormioAction.js +2 -0
- package/lib/esm/domain/FormioAction.js.map +1 -0
- package/lib/esm/domain/FormioActionsIndex.js +2 -0
- package/lib/esm/domain/FormioActionsIndex.js.map +1 -0
- package/lib/esm/domain/FormioAuth.js +2 -0
- package/lib/esm/domain/FormioAuth.js.map +1 -0
- package/lib/esm/domain/FormioBaseModel.js +2 -0
- package/lib/esm/domain/FormioBaseModel.js.map +1 -0
- package/lib/esm/domain/FormioConfig.js +2 -0
- package/lib/esm/domain/FormioConfig.js.map +1 -0
- package/lib/esm/domain/FormioCtxMapper.js +2 -0
- package/lib/esm/domain/FormioCtxMapper.js.map +1 -0
- package/lib/esm/domain/FormioDecodedToken.js +2 -0
- package/lib/esm/domain/FormioDecodedToken.js.map +1 -0
- package/lib/esm/domain/FormioErrors.js +2 -0
- package/lib/esm/domain/FormioErrors.js.map +1 -0
- package/lib/esm/domain/FormioHooks.js +2 -0
- package/lib/esm/domain/FormioHooks.js.map +1 -0
- package/lib/esm/domain/FormioJs.js +2 -0
- package/lib/esm/domain/FormioJs.js.map +1 -0
- package/lib/esm/domain/FormioModels.js +2 -0
- package/lib/esm/domain/FormioModels.js.map +1 -0
- package/lib/esm/domain/FormioRouter.js +2 -0
- package/lib/esm/domain/FormioRouter.js.map +1 -0
- package/lib/esm/domain/FormioSettings.js +2 -0
- package/lib/esm/domain/FormioSettings.js.map +1 -0
- package/lib/esm/domain/FormioTemplate.js +2 -0
- package/lib/esm/domain/FormioTemplate.js.map +1 -0
- package/lib/esm/domain/FormioTemplateUtil.js +2 -0
- package/lib/esm/domain/FormioTemplateUtil.js.map +1 -0
- package/lib/esm/domain/FormioUpdate.js +2 -0
- package/lib/esm/domain/FormioUpdate.js.map +1 -0
- package/lib/esm/domain/FormioUtils.js +2 -0
- package/lib/esm/domain/FormioUtils.js.map +1 -0
- package/lib/esm/domain/OnHook.js +2 -0
- package/lib/esm/domain/OnHook.js.map +1 -0
- package/lib/esm/domain/Resource.js +2 -0
- package/lib/esm/domain/Resource.js.map +1 -0
- package/lib/esm/index.js +43 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/middlewares/FormioAuthMiddleware.js +38 -0
- package/lib/esm/middlewares/FormioAuthMiddleware.js.map +1 -0
- package/lib/esm/services/FormioAuthService.js +179 -0
- package/lib/esm/services/FormioAuthService.js.map +1 -0
- package/lib/esm/services/FormioDatabase.js +100 -0
- package/lib/{services → esm/services}/FormioDatabase.js.map +1 -1
- package/lib/esm/services/FormioHooksService.js +78 -0
- package/lib/esm/services/FormioHooksService.js.map +1 -0
- package/lib/esm/services/FormioInstaller.js +47 -0
- package/lib/esm/services/FormioInstaller.js.map +1 -0
- package/lib/esm/services/FormioService.js +97 -0
- package/lib/esm/services/FormioService.js.map +1 -0
- package/lib/esm/utils/isMongoId.js +4 -0
- package/lib/esm/utils/isMongoId.js.map +1 -0
- package/lib/types/FormioModule.d.ts +24 -0
- package/lib/types/builder/FormioMapper.d.ts +11 -0
- package/lib/types/components/AlterActions.d.ts +15 -0
- package/lib/types/components/AlterAudit.d.ts +5 -0
- package/lib/types/components/AlterHost.d.ts +5 -0
- package/lib/types/components/AlterLog.d.ts +5 -0
- package/lib/types/components/AlterSkip.d.ts +7 -0
- package/lib/types/components/AlterTemplateExportSteps.d.ts +12 -0
- package/lib/types/components/AlterTemplateImportSteps.d.ts +11 -0
- package/lib/types/decorators/action.d.ts +7 -0
- package/lib/types/decorators/actionCtx.d.ts +23 -0
- package/lib/types/decorators/alter.d.ts +6 -0
- package/lib/types/decorators/on.d.ts +6 -0
- package/lib/types/decorators/useFormioAuth.d.ts +6 -0
- package/lib/types/domain/AlterHook.d.ts +3 -0
- package/lib/types/domain/Formio.d.ts +112 -0
- package/lib/types/domain/FormioAction.d.ts +20 -0
- package/lib/types/domain/FormioActionsIndex.d.ts +15 -0
- package/lib/types/domain/FormioAuth.d.ts +67 -0
- package/lib/types/domain/FormioBaseModel.d.ts +11 -0
- package/lib/types/domain/FormioConfig.d.ts +59 -0
- package/lib/types/domain/FormioCtxMapper.d.ts +7 -0
- package/lib/types/domain/FormioDecodedToken.d.ts +12 -0
- package/lib/types/domain/FormioErrors.d.ts +53 -0
- package/lib/types/domain/FormioHooks.d.ts +194 -0
- package/lib/types/domain/FormioJs.d.ts +17 -0
- package/lib/types/domain/FormioModels.d.ts +42 -0
- package/lib/types/domain/FormioRouter.d.ts +7 -0
- package/lib/types/domain/FormioSettings.d.ts +53 -0
- package/lib/types/domain/FormioTemplate.d.ts +8 -0
- package/lib/types/domain/FormioTemplateUtil.d.ts +13 -0
- package/lib/types/domain/FormioUpdate.d.ts +19 -0
- package/lib/types/domain/FormioUtils.d.ts +307 -0
- package/lib/types/domain/OnHook.d.ts +3 -0
- package/lib/types/domain/Resource.d.ts +18 -0
- package/lib/types/index.d.ts +38 -0
- package/lib/types/middlewares/FormioAuthMiddleware.d.ts +11 -0
- package/lib/types/services/FormioAuthService.d.ts +54 -0
- package/lib/types/services/FormioDatabase.d.ts +24 -0
- package/lib/types/services/FormioHooksService.d.ts +17 -0
- package/lib/types/services/FormioInstaller.d.ts +14 -0
- package/lib/types/services/FormioService.d.ts +36 -0
- package/lib/types/utils/isMongoId.d.ts +1 -0
- package/package.json +22 -14
- package/tsconfig.compile.esm.json +23 -0
- package/lib/builder/FormioMapper.js.map +0 -1
- package/lib/components/AlterActions.js.map +0 -1
- package/lib/components/AlterAudit.js.map +0 -1
- package/lib/components/AlterHost.js.map +0 -1
- package/lib/components/AlterLog.js.map +0 -1
- package/lib/components/AlterSkip.js.map +0 -1
- package/lib/components/AlterTemplateExportSteps.js.map +0 -1
- package/lib/components/AlterTemplateImportSteps.js.map +0 -1
- package/lib/decorators/action.js.map +0 -1
- package/lib/decorators/actionCtx.js.map +0 -1
- package/lib/decorators/alter.js.map +0 -1
- package/lib/decorators/on.js.map +0 -1
- package/lib/decorators/useFormioAuth.js.map +0 -1
- package/lib/domain/AlterHook.js.map +0 -1
- package/lib/domain/Formio.js.map +0 -1
- package/lib/domain/FormioAction.js.map +0 -1
- package/lib/domain/FormioActionsIndex.js.map +0 -1
- package/lib/domain/FormioAuth.js.map +0 -1
- package/lib/domain/FormioBaseModel.js.map +0 -1
- package/lib/domain/FormioConfig.js.map +0 -1
- package/lib/domain/FormioCtxMapper.js.map +0 -1
- package/lib/domain/FormioDecodedToken.js.map +0 -1
- package/lib/domain/FormioErrors.js.map +0 -1
- package/lib/domain/FormioHooks.js.map +0 -1
- package/lib/domain/FormioJs.js.map +0 -1
- package/lib/domain/FormioModels.js.map +0 -1
- package/lib/domain/FormioRouter.js.map +0 -1
- package/lib/domain/FormioSettings.js.map +0 -1
- package/lib/domain/FormioTemplate.js.map +0 -1
- package/lib/domain/FormioTemplateUtil.js.map +0 -1
- package/lib/domain/FormioUpdate.js.map +0 -1
- package/lib/domain/FormioUtils.js.map +0 -1
- package/lib/domain/OnHook.js.map +0 -1
- package/lib/domain/Resource.js.map +0 -1
- package/lib/index.js +0 -46
- package/lib/index.js.map +0 -1
- package/lib/middlewares/FormioAuthMiddleware.js.map +0 -1
- package/lib/services/FormioAuthService.js.map +0 -1
- package/lib/services/FormioHooksService.js.map +0 -1
- package/lib/services/FormioInstaller.js.map +0 -1
- package/lib/services/FormioService.js.map +0 -1
- package/lib/utils/isMongoId.js.map +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Constant, Inject, InjectorService, PlatformApplication, normalizePath } from "@tsed/common";
|
|
3
|
+
import { deepClone } from "@tsed/core";
|
|
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";
|
|
16
|
+
let FormioModule = class FormioModule {
|
|
17
|
+
$onInit() {
|
|
18
|
+
return this.init(deepClone(this.settings));
|
|
19
|
+
}
|
|
20
|
+
async init(options) {
|
|
21
|
+
return this.formio.init(options, this.hooks.getHooks());
|
|
22
|
+
}
|
|
23
|
+
async $onRoutesInit() {
|
|
24
|
+
if (this.formio.isInit()) {
|
|
25
|
+
const router = this.app.getRouter();
|
|
26
|
+
router.use(this.baseUrl, this.formio.middleware.restrictRequestTypes, this.formio.router);
|
|
27
|
+
if (await this.shouldInstall()) {
|
|
28
|
+
await this.installer.install(this.template, this.root);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async $logRoutes(routes) {
|
|
33
|
+
if (this.formio.isInit()) {
|
|
34
|
+
const spec = (await this.formio.swagger({
|
|
35
|
+
$ctx: {
|
|
36
|
+
request: {
|
|
37
|
+
protocol: "http",
|
|
38
|
+
host: "localhost"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, this.formio.router));
|
|
42
|
+
const { baseUrl } = this;
|
|
43
|
+
Object.entries(spec.paths).forEach(([path, methods]) => {
|
|
44
|
+
Object.entries(methods).forEach(([method, operation]) => {
|
|
45
|
+
routes.push({
|
|
46
|
+
toJSON() {
|
|
47
|
+
return {
|
|
48
|
+
method,
|
|
49
|
+
name: operation.operationId,
|
|
50
|
+
url: normalizePath(baseUrl, path.replace(/\/{(.*)}/gi, "/:$1")),
|
|
51
|
+
className: "formio",
|
|
52
|
+
methodClassName: operation.operationId,
|
|
53
|
+
parameters: [],
|
|
54
|
+
rawBody: false
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return routes;
|
|
62
|
+
}
|
|
63
|
+
// istanbul ignore next
|
|
64
|
+
async $onReady() {
|
|
65
|
+
if (this.formio.isInit()) {
|
|
66
|
+
const { injector } = this;
|
|
67
|
+
const { httpsPort, httpPort } = injector.settings;
|
|
68
|
+
const displayLog = (host) => {
|
|
69
|
+
const url = [`${host.protocol}://${host.address}`, typeof host.port === "number" && host.port].filter(Boolean).join(":");
|
|
70
|
+
injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || "/"}`);
|
|
71
|
+
};
|
|
72
|
+
/* istanbul ignore next */
|
|
73
|
+
if (httpsPort) {
|
|
74
|
+
this.formio.config.protocol = "https";
|
|
75
|
+
const host = injector.settings.getHttpsPort();
|
|
76
|
+
displayLog({ protocol: "https", ...host });
|
|
77
|
+
}
|
|
78
|
+
else if (httpPort) {
|
|
79
|
+
this.formio.config.protocol = "http";
|
|
80
|
+
const host = injector.settings.getHttpPort();
|
|
81
|
+
displayLog({ protocol: "http", ...host });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async shouldInstall() {
|
|
86
|
+
const hasForms = await this.installer.hasForms();
|
|
87
|
+
return this.template && !(hasForms || this.skipInstall);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
__decorate([
|
|
91
|
+
Inject(),
|
|
92
|
+
__metadata("design:type", FormioService)
|
|
93
|
+
], FormioModule.prototype, "formio", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
Inject(),
|
|
96
|
+
__metadata("design:type", FormioHooksService)
|
|
97
|
+
], FormioModule.prototype, "hooks", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
Inject(),
|
|
100
|
+
__metadata("design:type", FormioInstaller)
|
|
101
|
+
], FormioModule.prototype, "installer", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
Inject(),
|
|
104
|
+
__metadata("design:type", PlatformApplication)
|
|
105
|
+
], FormioModule.prototype, "app", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
Inject(),
|
|
108
|
+
__metadata("design:type", InjectorService)
|
|
109
|
+
], FormioModule.prototype, "injector", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
Constant("formio", {}),
|
|
112
|
+
__metadata("design:type", Object)
|
|
113
|
+
], FormioModule.prototype, "settings", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
Constant("formio.baseUrl", "/"),
|
|
116
|
+
__metadata("design:type", String)
|
|
117
|
+
], FormioModule.prototype, "baseUrl", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
Constant("formio.skipInstall", false),
|
|
120
|
+
__metadata("design:type", Boolean)
|
|
121
|
+
], FormioModule.prototype, "skipInstall", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
Constant("formio.template"),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], FormioModule.prototype, "template", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
Constant("formio.root"),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], FormioModule.prototype, "root", void 0);
|
|
130
|
+
FormioModule = __decorate([
|
|
131
|
+
Module({
|
|
132
|
+
imports: [
|
|
133
|
+
FormioService,
|
|
134
|
+
FormioHooksService,
|
|
135
|
+
FormioAuthService,
|
|
136
|
+
AlterActions,
|
|
137
|
+
AlterHost,
|
|
138
|
+
AlterAudit,
|
|
139
|
+
AlterLog,
|
|
140
|
+
AlterSkip,
|
|
141
|
+
AlterTemplateImportSteps,
|
|
142
|
+
AlterTemplateExportSteps
|
|
143
|
+
]
|
|
144
|
+
})
|
|
145
|
+
], FormioModule);
|
|
146
|
+
export { FormioModule };
|
|
147
|
+
//# sourceMappingURL=FormioModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioModule.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"FormioModule.js","sourceRoot":"","sources":["../../src/FormioModule.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EACN,eAAe,EAGf,mBAAmB,EAEnB,aAAa,EACd,MAAM,cAAc,CAAC;AAC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AAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QAEjD,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1D,CAAC;CACF,CAAA;AApHC;IADC,MAAM,EAAE;8BACS,aAAa;4CAAC;AAGhC;IADC,MAAM,EAAE;8BACQ,kBAAkB;2CAAC;AAGpC;IADC,MAAM,EAAE;8BACY,eAAe;+CAAC;AAGrC;IADC,MAAM,EAAE;8BACM,mBAAmB;yCAAC;AAGnC;IADC,MAAM,EAAE;8BACW,eAAe;8CAAC;AAGpC;IADC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;;8CACU;AAGjC;IADC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC;;6CACN;AAG1B;IADC,QAAQ,CAAC,oBAAoB,EAAE,KAAK,CAAC;;iDACP;AAG/B;IADC,QAAQ,CAAC,iBAAiB,CAAC;;8CACQ;AAGpC;IADC,QAAQ,CAAC,aAAa,CAAC;;0CACH;AA7BV,YAAY;IAdxB,MAAM,CAAC;QACN,OAAO,EAAE;YACP,aAAa;YACb,kBAAkB;YAClB,iBAAiB;YACjB,YAAY;YACZ,SAAS;YACT,UAAU;YACV,QAAQ;YACR,SAAS;YACT,wBAAwB;YACxB,wBAAwB;SACzB;KACF,CAAC;GACW,YAAY,CAsHxB;SAtHY,YAAY","sourcesContent":["import {\n Constant,\n Inject,\n InjectorService,\n OnReady,\n OnRoutesInit,\n PlatformApplication,\n PlatformRouteDetails,\n normalizePath\n} from \"@tsed/common\";\nimport {deepClone} from \"@tsed/core\";\nimport {Module} from \"@tsed/di\";\nimport {AlterActions} from \"./components/AlterActions\";\nimport {AlterAudit} from \"./components/AlterAudit\";\nimport {AlterHost} from \"./components/AlterHost\";\nimport {AlterLog} from \"./components/AlterLog\";\nimport {AlterSkip} from \"./components/AlterSkip\";\nimport {AlterTemplateExportSteps} from \"./components/AlterTemplateExportSteps\";\nimport {AlterTemplateImportSteps} from \"./components/AlterTemplateImportSteps\";\nimport {FormioConfig} from \"./domain/FormioConfig\";\nimport {FormioTemplate} from \"./domain/FormioTemplate\";\nimport {FormioAuthService} from \"./services/FormioAuthService\";\nimport {FormioHooksService} from \"./services/FormioHooksService\";\nimport {FormioInstaller} from \"./services/FormioInstaller\";\nimport {FormioService} from \"./services/FormioService\";\n\n@Module({\n imports: [\n FormioService,\n FormioHooksService,\n FormioAuthService,\n AlterActions,\n AlterHost,\n AlterAudit,\n AlterLog,\n AlterSkip,\n AlterTemplateImportSteps,\n AlterTemplateExportSteps\n ]\n})\nexport class FormioModule implements OnRoutesInit, OnReady {\n @Inject()\n protected formio: FormioService;\n\n @Inject()\n protected hooks: FormioHooksService;\n\n @Inject()\n protected installer: FormioInstaller;\n\n @Inject()\n protected app: PlatformApplication;\n\n @Inject()\n protected injector: InjectorService;\n\n @Constant(\"formio\", {})\n protected settings: FormioConfig;\n\n @Constant(\"formio.baseUrl\", \"/\")\n protected baseUrl: string;\n\n @Constant(\"formio.skipInstall\", false)\n protected skipInstall: boolean;\n\n @Constant(\"formio.template\")\n protected template?: FormioTemplate;\n\n @Constant(\"formio.root\")\n protected root?: any;\n\n $onInit() {\n return this.init(deepClone(this.settings));\n }\n\n async init(options: FormioConfig) {\n return this.formio.init(options, this.hooks.getHooks());\n }\n\n async $onRoutesInit() {\n if (this.formio.isInit()) {\n const router: any = this.app.getRouter();\n\n router.use(this.baseUrl, this.formio.middleware.restrictRequestTypes, this.formio.router);\n\n if (await this.shouldInstall()) {\n await this.installer.install(this.template!, this.root);\n }\n }\n }\n\n async $logRoutes(routes: PlatformRouteDetails[]): Promise<PlatformRouteDetails[]> {\n if (this.formio.isInit()) {\n const spec = (await this.formio.swagger(\n {\n $ctx: {\n request: {\n protocol: \"http\",\n host: \"localhost\"\n }\n }\n },\n this.formio.router\n )) as any;\n const {baseUrl} = this;\n\n Object.entries(spec.paths).forEach(([path, methods]: [string, any]) => {\n Object.entries(methods).forEach(([method, operation]: [string, any]) => {\n routes.push({\n toJSON() {\n return {\n method,\n name: operation.operationId,\n url: normalizePath(baseUrl, path.replace(/\\/{(.*)}/gi, \"/:$1\")),\n className: \"formio\",\n methodClassName: operation.operationId,\n parameters: [],\n rawBody: false\n };\n }\n } as any);\n });\n });\n }\n\n return routes;\n }\n\n // istanbul ignore next\n async $onReady(): Promise<void> {\n if (this.formio.isInit()) {\n const {injector} = this;\n const {httpsPort, httpPort} = injector.settings;\n\n const displayLog = (host: any) => {\n const url = [`${host.protocol}://${host.address}`, typeof host.port === \"number\" && host.port].filter(Boolean).join(\":\");\n\n injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || \"/\"}`);\n };\n\n /* istanbul ignore next */\n if (httpsPort) {\n (this.formio.config as any).protocol = \"https\";\n const host = injector.settings.getHttpsPort();\n displayLog({protocol: \"https\", ...host});\n } else if (httpPort) {\n (this.formio.config as any).protocol = \"http\";\n const host = injector.settings.getHttpPort();\n displayLog({protocol: \"http\", ...host});\n }\n }\n }\n\n protected async shouldInstall() {\n const hasForms = await this.installer.hasForms();\n\n return this.template && !(hasForms || this.skipInstall);\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export class FormioMapper {
|
|
2
|
+
constructor(ctxData) {
|
|
3
|
+
this.ctxData = ctxData;
|
|
4
|
+
}
|
|
5
|
+
find(key) {
|
|
6
|
+
const store = Object.values(this.ctxData).find((store) => store.get(key));
|
|
7
|
+
return store === null || store === void 0 ? void 0 : store.get(key);
|
|
8
|
+
}
|
|
9
|
+
findId(data) {
|
|
10
|
+
const key = String(data).startsWith("$machineName:") ? String(data) : `$machineName:${String(data)}`;
|
|
11
|
+
const item = this.find(key);
|
|
12
|
+
return item ? item._id : undefined;
|
|
13
|
+
}
|
|
14
|
+
findMachineName(data) {
|
|
15
|
+
const key = String(data);
|
|
16
|
+
const item = this.find(key);
|
|
17
|
+
return item ? `$machineName:${item.machineName}` : undefined;
|
|
18
|
+
}
|
|
19
|
+
mapToExport(data) {
|
|
20
|
+
return this.mapData(data, this.findMachineName.bind(this));
|
|
21
|
+
}
|
|
22
|
+
mapToImport(data) {
|
|
23
|
+
return this.mapData(data, this.findId.bind(this));
|
|
24
|
+
}
|
|
25
|
+
mapData(data, resolver) {
|
|
26
|
+
if (!data) {
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(data)) {
|
|
30
|
+
return data.map((item) => {
|
|
31
|
+
return this.mapData(item, resolver);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const key = resolver(data, this.ctxData);
|
|
35
|
+
if (key) {
|
|
36
|
+
return key;
|
|
37
|
+
}
|
|
38
|
+
if (typeof data === "object" && !(data instanceof Date)) {
|
|
39
|
+
return Object.entries(data).reduce((obj, [key, value]) => {
|
|
40
|
+
return {
|
|
41
|
+
...obj,
|
|
42
|
+
[key]: this.mapData(value, resolver)
|
|
43
|
+
};
|
|
44
|
+
}, {});
|
|
45
|
+
}
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=FormioMapper.js.map
|
|
@@ -0,0 +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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C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAEzC,IAAI,GAAG,EAAE;YACP,OAAO,GAAG,CAAC;SACZ;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,YAAY,IAAI,CAAC,EAAE;YACvD,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBACvD,OAAO;oBACL,GAAG,GAAG;oBACN,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;iBACrC,CAAC;YACJ,CAAC,EAAE,EAAE,CAAC,CAAC;SACR;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import {FormioCtxMapper} from \"../domain/FormioCtxMapper\";\n\nexport class FormioMapper {\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.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\" && !(data instanceof Date)) {\n return Object.entries(data).reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: this.mapData(value, resolver)\n };\n }, {});\n }\n\n return data;\n }\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { EndpointMetadata, PlatformHandler } from "@tsed/common";
|
|
3
|
+
import { Inject, InjectorService } from "@tsed/di";
|
|
4
|
+
import { Alter } from "../decorators/alter";
|
|
5
|
+
import { FormioService } from "../services/FormioService";
|
|
6
|
+
let AlterActions = class AlterActions {
|
|
7
|
+
transform(actions) {
|
|
8
|
+
const { Action } = this.formio;
|
|
9
|
+
return this.getActions().reduce((actions, provider) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const instance = this.injector.invoke(provider.token);
|
|
12
|
+
const options = provider.store.get("formio:action");
|
|
13
|
+
const resolveHandler = this.createResolveHandler(provider);
|
|
14
|
+
return {
|
|
15
|
+
...actions,
|
|
16
|
+
[options.name]: (_a = class extends Action {
|
|
17
|
+
static async info(req, res, next) {
|
|
18
|
+
let opts = { ...options };
|
|
19
|
+
if (instance.info) {
|
|
20
|
+
opts = await instance.info(opts, req, res);
|
|
21
|
+
}
|
|
22
|
+
next(null, opts);
|
|
23
|
+
}
|
|
24
|
+
static async settingsForm(req, res, next) {
|
|
25
|
+
next(null, await instance.settingsForm(req, res));
|
|
26
|
+
}
|
|
27
|
+
resolve(handler, method, req, res, next, setActionItemMessage) {
|
|
28
|
+
resolveHandler(this, handler, method, req, res, next, setActionItemMessage);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
_a.access = options.access,
|
|
32
|
+
_a)
|
|
33
|
+
};
|
|
34
|
+
}, actions);
|
|
35
|
+
}
|
|
36
|
+
getActions() {
|
|
37
|
+
return this.injector.getProviders("formio:action");
|
|
38
|
+
}
|
|
39
|
+
createResolveHandler(provider) {
|
|
40
|
+
const platformHandler = this.injector.get(PlatformHandler);
|
|
41
|
+
const middleware = platformHandler.createCustomHandler(provider, "resolve");
|
|
42
|
+
return (action, handler, method, req, res, next, setActionItemMessage) => {
|
|
43
|
+
req.$ctx.set("ACTION_CTX", { handler, method, setActionItemMessage, action });
|
|
44
|
+
req.$ctx.endpoint = EndpointMetadata.get(provider.useClass, "resolve");
|
|
45
|
+
middleware(req.$ctx)
|
|
46
|
+
.then(() => (req.$ctx.data ? platformHandler.flush(req.$ctx.data, req.$ctx) : next()))
|
|
47
|
+
.catch(next);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
__decorate([
|
|
52
|
+
Inject(),
|
|
53
|
+
__metadata("design:type", InjectorService)
|
|
54
|
+
], AlterActions.prototype, "injector", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
Inject(),
|
|
57
|
+
__metadata("design:type", FormioService)
|
|
58
|
+
], AlterActions.prototype, "formio", void 0);
|
|
59
|
+
AlterActions = __decorate([
|
|
60
|
+
Alter("actions")
|
|
61
|
+
], AlterActions);
|
|
62
|
+
export { AlterActions };
|
|
63
|
+
//# sourceMappingURL=AlterActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlterActions.js","sourceRoot":"","sources":["../../../src/components/AlterActions.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,gBAAgB,EAAmB,eAAe,EAAC,MAAM,cAAc,CAAC;AAChF,OAAO,EAAC,MAAM,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAGxD,IAAa,YAAY,GAAzB,MAAa,YAAY;IAOvB,SAAS,CAAC,OAAsB;QAC9B,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAE7B,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;;YACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC3D,MAAM,O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AAQ,CAAC,GAAG,CAAkB,eAAe,CAAE,CAAC;QAC7E,MAAM,UAAU,GAAG,eAAe,CAAC,mBAAmB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAE5E,OAAO,CACL,MAAW,EACX,OAAe,EACf,MAAc,EACd,GAA4B,EAC5B,GAAa,EACb,IAAS,EACT,oBAA0C,EAC1C,EAAE;YACF,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,EAAC,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAC,CAAC,CAAC;YAC5E,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YAEvE,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;iBACjB,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;iBACrF,KAAK,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AAhEC;IADC,MAAM,EAAE;8BACW,eAAe;8CAAC;AAGpC;IADC,MAAM,EAAE;8BACS,aAAa;4CAAC;AALrB,YAAY;IADxB,KAAK,CAAC,SAAS,CAAC;GACJ,YAAY,CAkExB;SAlEY,YAAY","sourcesContent":["import {EndpointMetadata, PlatformContext, PlatformHandler} from \"@tsed/common\";\nimport {Inject, InjectorService, Provider} from \"@tsed/di\";\nimport {FormioActionInfo} from \"@tsed/formio-types\";\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 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.createResolveHandler(provider);\n\n return {\n ...actions,\n [options.name]: class extends Action {\n static access = options.access;\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 createResolveHandler(provider: Provider<any>) {\n const platformHandler = this.injector.get<PlatformHandler>(PlatformHandler)!;\n const middleware = platformHandler.createCustomHandler(provider, \"resolve\");\n\n return (\n action: any,\n handler: string,\n method: string,\n req: {$ctx: PlatformContext},\n res: Response,\n next: any,\n setActionItemMessage: SetActionItemMessage\n ) => {\n req.$ctx.set(\"ACTION_CTX\", {handler, method, setActionItemMessage, action});\n req.$ctx.endpoint = EndpointMetadata.get(provider.useClass, \"resolve\");\n\n middleware(req.$ctx)\n .then(() => (req.$ctx.data ? platformHandler.flush(req.$ctx.data, req.$ctx) : next()))\n .catch(next);\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Alter } from "../decorators/alter";
|
|
3
|
+
let AlterAudit = class AlterAudit {
|
|
4
|
+
transform(info, event, ctx) {
|
|
5
|
+
ctx.logger.info({ event, info });
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
AlterAudit = __decorate([
|
|
10
|
+
Alter("audit")
|
|
11
|
+
], AlterAudit);
|
|
12
|
+
export { AlterAudit };
|
|
13
|
+
//# sourceMappingURL=AlterAudit.js.map
|
|
@@ -0,0 +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,GAAoB;QACxD,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 {PlatformContext} from \"@tsed/common\";\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: PlatformContext): boolean {\n ctx.logger.info({event, info});\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Alter } from "../decorators/alter";
|
|
3
|
+
let AlterHost = class AlterHost {
|
|
4
|
+
transform(baseUrl, ctx) {
|
|
5
|
+
return `${ctx.request.protocol}://${ctx.request.host}${baseUrl}`;
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
AlterHost = __decorate([
|
|
9
|
+
Alter("host")
|
|
10
|
+
], AlterHost);
|
|
11
|
+
export { AlterHost };
|
|
12
|
+
//# sourceMappingURL=AlterHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlterHost.js","sourceRoot":"","sources":["../../../src/components/AlterHost.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,IAAa,SAAS,GAAtB,MAAa,SAAS;IACpB,SAAS,CAAC,OAAe,EAAE,GAAoB;QAC7C,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,EAAE,CAAC;IACnE,CAAC;CACF,CAAA;AAJY,SAAS;IADrB,KAAK,CAAC,MAAM,CAAC;GACD,SAAS,CAIrB;SAJY,SAAS","sourcesContent":["import {PlatformContext} from \"@tsed/common\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\n\n@Alter(\"host\")\nexport class AlterHost implements AlterHook<string> {\n transform(baseUrl: string, ctx: PlatformContext) {\n return `${ctx.request.protocol}://${ctx.request.host}${baseUrl}`;\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Alter } from "../decorators/alter";
|
|
3
|
+
let AlterLog = class AlterLog {
|
|
4
|
+
transform(event, ctx, ...info) {
|
|
5
|
+
ctx.logger.debug({ event, info });
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
AlterLog = __decorate([
|
|
10
|
+
Alter("log")
|
|
11
|
+
], AlterLog);
|
|
12
|
+
export { AlterLog };
|
|
13
|
+
//# sourceMappingURL=AlterLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlterLog.js","sourceRoot":"","sources":["../../../src/components/AlterLog.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,IAAa,QAAQ,GAArB,MAAa,QAAQ;IACnB,SAAS,CAAC,KAAa,EAAE,GAAoB,EAAE,GAAG,IAAW;QAC3D,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AALY,QAAQ;IADpB,KAAK,CAAC,KAAK,CAAC;GACA,QAAQ,CAKpB;SALY,QAAQ","sourcesContent":["import {PlatformContext} from \"@tsed/common\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\n\n@Alter(\"log\")\nexport class AlterLog implements AlterHook {\n transform(event: string, ctx: PlatformContext, ...info: any[]): boolean {\n ctx.logger.debug({event, info});\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Constant } from "@tsed/common";
|
|
3
|
+
import { normalizePath } from "@tsed/common";
|
|
4
|
+
import { Alter } from "../decorators/alter";
|
|
5
|
+
let AlterSkip = class AlterSkip {
|
|
6
|
+
transform(value, ctx) {
|
|
7
|
+
if (value) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
const { request } = ctx;
|
|
11
|
+
const url = request.url.split("?")[0];
|
|
12
|
+
return !!this.whiteList.find((entry) => {
|
|
13
|
+
return normalizePath(this.baseUrl, entry) === url;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
Constant("formio.baseUrl", "/"),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], AlterSkip.prototype, "baseUrl", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
Constant("formio.whiteList", ["/spec.json"]),
|
|
23
|
+
__metadata("design:type", Array)
|
|
24
|
+
], AlterSkip.prototype, "whiteList", void 0);
|
|
25
|
+
AlterSkip = __decorate([
|
|
26
|
+
Alter("skip")
|
|
27
|
+
], AlterSkip);
|
|
28
|
+
export { AlterSkip };
|
|
29
|
+
//# sourceMappingURL=AlterSkip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlterSkip.js","sourceRoot":"","sources":["../../../src/components/AlterSkip.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAkB,MAAM,cAAc,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,IAAa,SAAS,GAAtB,MAAa,SAAS;IAOpB,SAAS,CAAC,KAAU,EAAE,GAAoB;QACxC,IAAI,KAAK,EAAE;YACT,OAAO,IAAI,CAAC;SACb;QAED,MAAM,EAAC,OAAO,EAAC,GAAG,GAAG,CAAC;QACtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YACrC,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAjBC;IADC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC;;0CAChB;AAGhB;IADC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,YAAY,CAAC,CAAC;;4CACzB;AALT,SAAS;IADrB,KAAK,CAAC,MAAM,CAAC;GACD,SAAS,CAmBrB;SAnBY,SAAS","sourcesContent":["import {Constant, PlatformContext} from \"@tsed/common\";\nimport {normalizePath} from \"@tsed/common\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\n\n@Alter(\"skip\")\nexport class AlterSkip implements AlterHook {\n @Constant(\"formio.baseUrl\", \"/\")\n baseUrl: string;\n\n @Constant(\"formio.whiteList\", [\"/spec.json\"])\n whiteList: string[];\n\n transform(value: any, ctx: PlatformContext): any {\n if (value) {\n return true;\n }\n\n const {request} = ctx;\n const url = request.url.split(\"?\")[0];\n\n return !!this.whiteList.find((entry) => {\n return normalizePath(this.baseUrl, entry) === url;\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { getValue } from "@tsed/core";
|
|
3
|
+
import { Inject } from "@tsed/di";
|
|
4
|
+
import { Alter } from "../decorators/alter";
|
|
5
|
+
import { FormioDatabase } from "../services/FormioDatabase";
|
|
6
|
+
const async = require("async");
|
|
7
|
+
let AlterTemplateExportSteps = class AlterTemplateExportSteps {
|
|
8
|
+
transform(queue, template, map, options) {
|
|
9
|
+
queue.push(async.apply(this.exportSubmissions.bind(this), template, map, options));
|
|
10
|
+
return queue;
|
|
11
|
+
}
|
|
12
|
+
async exportSubmissions(template, map, options, next) {
|
|
13
|
+
const [mapper, submissions] = await Promise.all([
|
|
14
|
+
this.database.getFormioMapper(),
|
|
15
|
+
this.database.submissionModel.find({
|
|
16
|
+
deleted: { $eq: null }
|
|
17
|
+
})
|
|
18
|
+
]);
|
|
19
|
+
template.submissions = await this.mapSubmissions(submissions, mapper);
|
|
20
|
+
next(null, template);
|
|
21
|
+
}
|
|
22
|
+
mapSubmissions(submissions, mapper) {
|
|
23
|
+
return submissions
|
|
24
|
+
.map((submission) => submission.toObject())
|
|
25
|
+
.reduce((acc, { _id, created, updated, modified, __v, owner, roles, form, metadata, ...submission }) => {
|
|
26
|
+
const machineName = mapper.mapToExport(form.toString());
|
|
27
|
+
const key = machineName.replace("$machineName:", "");
|
|
28
|
+
acc[key] = getValue(acc, key, []);
|
|
29
|
+
acc[key].push({
|
|
30
|
+
...submission,
|
|
31
|
+
created: created && created.toString(),
|
|
32
|
+
modified: modified && modified.toString(),
|
|
33
|
+
data: mapper.mapToExport(submission.data),
|
|
34
|
+
roles: mapper.mapToExport(roles).filter(Boolean),
|
|
35
|
+
form: mapper.mapToExport(form)
|
|
36
|
+
});
|
|
37
|
+
return acc;
|
|
38
|
+
}, {});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
Inject(),
|
|
43
|
+
__metadata("design:type", FormioDatabase)
|
|
44
|
+
], AlterTemplateExportSteps.prototype, "database", void 0);
|
|
45
|
+
AlterTemplateExportSteps = __decorate([
|
|
46
|
+
Alter("templateExportSteps")
|
|
47
|
+
], AlterTemplateExportSteps);
|
|
48
|
+
export { AlterTemplateExportSteps };
|
|
49
|
+
//# sourceMappingURL=AlterTemplateExportSteps.js.map
|
|
@@ -0,0 +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;AAE1D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAG/B,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;YAC/B,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI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AAO,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\";\n\nconst async = require(\"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"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Inject } from "@tsed/di";
|
|
3
|
+
import { Alter } from "../decorators/alter";
|
|
4
|
+
import { FormioDatabase } from "../services/FormioDatabase";
|
|
5
|
+
const async = require("async");
|
|
6
|
+
let AlterTemplateImportSteps = class AlterTemplateImportSteps {
|
|
7
|
+
transform(queue, install, template) {
|
|
8
|
+
queue.push(async.apply(this.importSubmissions.bind(this), template));
|
|
9
|
+
return queue;
|
|
10
|
+
}
|
|
11
|
+
async importSubmissions(template, done) {
|
|
12
|
+
if (template && template.submissions) {
|
|
13
|
+
// clean all submissions
|
|
14
|
+
await this.database.submissionModel.deleteMany({});
|
|
15
|
+
const ctxData = await this.database.getFormioMapper();
|
|
16
|
+
const entries = Object.entries(template.submissions);
|
|
17
|
+
for (const entry of entries) {
|
|
18
|
+
for (const submission of entry[1]) {
|
|
19
|
+
await this.importSubmission({ ...submission, form: submission.form || entry[0] }, ctxData);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
done();
|
|
24
|
+
}
|
|
25
|
+
async importSubmission(submission, mapper) {
|
|
26
|
+
const value = {
|
|
27
|
+
...mapper.mapToImport(submission),
|
|
28
|
+
roles: [...new Set(mapper.mapToImport(submission.roles || []))].filter(Boolean)
|
|
29
|
+
};
|
|
30
|
+
await this.database.submissionModel.create(value);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
__decorate([
|
|
35
|
+
Inject(),
|
|
36
|
+
__metadata("design:type", FormioDatabase)
|
|
37
|
+
], AlterTemplateImportSteps.prototype, "database", void 0);
|
|
38
|
+
AlterTemplateImportSteps = __decorate([
|
|
39
|
+
Alter("templateImportSteps")
|
|
40
|
+
], AlterTemplateImportSteps);
|
|
41
|
+
export { AlterTemplateImportSteps };
|
|
42
|
+
//# sourceMappingURL=AlterTemplateImportSteps.js.map
|
|
@@ -0,0 +1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,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,UAAqC,EAAE,MAAoB;QAC1F,MAAM,KAAK,GAAG;YACZ,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;YACjC,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;SAChF,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AApCC;IADC,MAAM,EAAE;8BACW,cAAc;0DAAC;AAFxB,wBAAwB;IADpC,KAAK,CAAC,qBAAqB,CAAC;GAChB,wBAAwB,CAsCpC;SAtCY,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\";\n\nconst async = require(\"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"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoreSet, useDecorators } from "@tsed/core";
|
|
2
|
+
import { registerProvider } from "@tsed/di";
|
|
3
|
+
/**
|
|
4
|
+
* Create a new FormIO Action.
|
|
5
|
+
* @param options
|
|
6
|
+
* @decorator
|
|
7
|
+
*/
|
|
8
|
+
export function Action(options) {
|
|
9
|
+
return useDecorators((target) => {
|
|
10
|
+
registerProvider({
|
|
11
|
+
provide: target,
|
|
12
|
+
type: "formio:action"
|
|
13
|
+
});
|
|
14
|
+
}, StoreSet("formio:action", options));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/decorators/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAG1C;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,OAAyB;IAC9C,OAAO,aAAa,CAAC,CAAC,MAAW,EAAE,EAAE;QACnC,gBAAgB,CAAC;YACf,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,eAAe;SACtB,CAAC,CAAC;IACL,CAAC,EAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {registerProvider} from \"@tsed/di\";\nimport {FormioActionInfo} from \"@tsed/formio-types\";\n\n/**\n * Create a new FormIO Action.\n * @param options\n * @decorator\n */\nexport function Action(options: FormioActionInfo): ClassDecorator {\n return useDecorators((target: any) => {\n registerProvider({\n provide: target,\n type: \"formio:action\"\n });\n }, StoreSet(\"formio:action\", options));\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from "@tsed/common";
|
|
2
|
+
/**
|
|
3
|
+
* Return the current action context with the following data:
|
|
4
|
+
*
|
|
5
|
+
* ```typescript
|
|
6
|
+
* export type ActionCtx = {
|
|
7
|
+
* handler: string;
|
|
8
|
+
* method: string;
|
|
9
|
+
* setActionItemMessage: SetActionItemMessage;
|
|
10
|
+
* action: FormioAction;
|
|
11
|
+
* };
|
|
12
|
+
* ```
|
|
13
|
+
* @param expression
|
|
14
|
+
* @constructor
|
|
15
|
+
*/
|
|
16
|
+
export function ActionCtx(expression) {
|
|
17
|
+
return Context(["ACTION_CTX", expression].filter(Boolean).join("."));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=actionCtx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionCtx.js","sourceRoot":"","sources":["../../../src/decorators/actionCtx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAIrC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,UAAmB;IAC3C,OAAO,OAAO,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {SetActionItemMessage} from \"../domain/FormioAction\";\nimport {FormioAction} from \"@tsed/formio-types\";\n\n/**\n * Return the current action context with the following data:\n *\n * ```typescript\n * export type ActionCtx = {\n * handler: string;\n * method: string;\n * setActionItemMessage: SetActionItemMessage;\n * action: FormioAction;\n * };\n * ```\n * @param expression\n * @constructor\n */\nexport function ActionCtx(expression?: string): ParameterDecorator {\n return Context([\"ACTION_CTX\", expression].filter(Boolean).join(\".\"));\n}\n\nexport type ActionCtx = {\n handler: string;\n method: string;\n setActionItemMessage: SetActionItemMessage;\n action: FormioAction;\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoreSet, useDecorators } from "@tsed/core";
|
|
2
|
+
import { registerProvider } from "@tsed/di";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param name
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export function Alter(name) {
|
|
9
|
+
return useDecorators((target) => {
|
|
10
|
+
registerProvider({
|
|
11
|
+
provide: target,
|
|
12
|
+
type: "formio:alter"
|
|
13
|
+
});
|
|
14
|
+
}, StoreSet("formio:alter:name", name));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=alter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alter.js","sourceRoot":"","sources":["../../../src/decorators/alter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,OAAO,aAAa,CAAC,CAAC,MAAW,EAAE,EAAE;QACnC,gBAAgB,CAAC;YACf,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC,EAAE,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {registerProvider} from \"@tsed/di\";\n\n/**\n *\n * @param name\n * @constructor\n */\nexport function Alter(name: string): ClassDecorator {\n return useDecorators((target: any) => {\n registerProvider({\n provide: target,\n type: \"formio:alter\"\n });\n }, StoreSet(\"formio:alter:name\", name));\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoreSet, useDecorators } from "@tsed/core";
|
|
2
|
+
import { registerProvider } from "@tsed/di";
|
|
3
|
+
/**
|
|
4
|
+
* Create a Form io hook event listener
|
|
5
|
+
* @param name
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export function On(name) {
|
|
9
|
+
return useDecorators((target) => {
|
|
10
|
+
registerProvider({
|
|
11
|
+
provide: target,
|
|
12
|
+
type: "formio:on"
|
|
13
|
+
});
|
|
14
|
+
}, StoreSet("formio:on:name", name));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=on.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on.js","sourceRoot":"","sources":["../../../src/decorators/on.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,EAAE,CAAC,IAAY;IAC7B,OAAO,aAAa,CAAC,CAAC,MAAW,EAAE,EAAE;QACnC,gBAAgB,CAAC;YACf,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,WAAW;SAClB,CAAC,CAAC;IACL,CAAC,EAAE,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {registerProvider} from \"@tsed/di\";\n\n/**\n * Create a Form io hook event listener\n * @param name\n * @constructor\n */\nexport function On(name: string): ClassDecorator {\n return useDecorators((target: any) => {\n registerProvider({\n provide: target,\n type: \"formio:on\"\n });\n }, StoreSet(\"formio:on:name\", name));\n}\n"]}
|