@tsed/formio 7.0.0-alpha.2 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{FormioModule.js → cjs/FormioModule.js} +38 -51
- package/lib/cjs/FormioModule.js.map +1 -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.js +8 -8
- package/lib/cjs/components/AlterActions.js.map +1 -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.js +2 -2
- package/lib/cjs/components/AlterHost.js.map +1 -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.js +9 -9
- package/lib/cjs/components/AlterSkip.js.map +1 -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.js +5 -5
- package/lib/cjs/components/AlterTemplateImportSteps.js.map +1 -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.js +1 -1
- package/lib/cjs/decorators/actionCtx.js.map +1 -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.js +3 -3
- package/lib/cjs/decorators/on.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/AlterHook.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioAction.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioAuth.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioConfig.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioDecodedToken.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioHooks.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioJs.js +0 -0
- package/lib/cjs/domain/FormioJs.js.map +1 -0
- package/lib/cjs/domain/FormioModels.js +5 -0
- package/lib/cjs/domain/FormioModels.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioSettings.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioTemplateUtil.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/FormioUtils.js.map +1 -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.js +0 -0
- package/lib/cjs/domain/Resource.js.map +1 -0
- package/lib/cjs/index.js +46 -0
- package/lib/cjs/index.js.map +1 -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.js +13 -13
- package/lib/cjs/services/FormioAuthService.js.map +1 -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.js +9 -9
- package/lib/cjs/services/FormioHooksService.js.map +1 -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.js +8 -8
- package/lib/cjs/services/FormioService.js.map +1 -0
- package/lib/{utils → cjs/utils}/isMongoId.js +0 -0
- package/lib/cjs/utils/isMongoId.js.map +1 -0
- package/lib/esm/FormioModule.js +134 -0
- package/lib/esm/FormioModule.js.map +1 -0
- 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/esm/services/FormioDatabase.js.map +1 -0
- 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/{FormioModule.d.ts → types/FormioModule.d.ts} +0 -0
- package/lib/{builder → types/builder}/FormioMapper.d.ts +0 -0
- package/lib/{components → types/components}/AlterActions.d.ts +0 -0
- package/lib/{components → types/components}/AlterAudit.d.ts +0 -0
- package/lib/{components → types/components}/AlterHost.d.ts +0 -0
- package/lib/{components → types/components}/AlterLog.d.ts +0 -0
- package/lib/{components → types/components}/AlterSkip.d.ts +0 -0
- package/lib/{components → types/components}/AlterTemplateExportSteps.d.ts +0 -0
- package/lib/{components → types/components}/AlterTemplateImportSteps.d.ts +0 -0
- package/lib/{decorators → types/decorators}/action.d.ts +1 -1
- package/lib/{decorators → types/decorators}/actionCtx.d.ts +2 -1
- package/lib/{decorators → types/decorators}/alter.d.ts +0 -0
- package/lib/{decorators → types/decorators}/on.d.ts +0 -0
- package/lib/{decorators → types/decorators}/useFormioAuth.d.ts +0 -0
- package/lib/{domain → types/domain}/AlterHook.d.ts +0 -0
- package/lib/{domain → types/domain}/Formio.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioAction.d.ts +1 -26
- package/lib/{domain → types/domain}/FormioActionsIndex.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioAuth.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioBaseModel.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioConfig.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioCtxMapper.d.ts +1 -2
- package/lib/{domain → types/domain}/FormioDecodedToken.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioErrors.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioHooks.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioJs.d.ts +0 -0
- package/lib/types/domain/FormioModels.d.ts +42 -0
- package/lib/{domain → types/domain}/FormioRouter.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioSettings.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioTemplate.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioTemplateUtil.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioUpdate.d.ts +0 -0
- package/lib/{domain → types/domain}/FormioUtils.d.ts +0 -0
- package/lib/{domain → types/domain}/OnHook.d.ts +0 -0
- package/lib/{domain → types/domain}/Resource.d.ts +0 -0
- package/lib/{index.d.ts → types/index.d.ts} +0 -0
- package/lib/types/middlewares/FormioAuthMiddleware.d.ts +11 -0
- package/lib/{services → types/services}/FormioAuthService.d.ts +1 -1
- package/lib/{services → types/services}/FormioDatabase.d.ts +1 -2
- package/lib/{services → types/services}/FormioHooksService.d.ts +2 -3
- package/lib/{services → types/services}/FormioInstaller.d.ts +0 -0
- package/lib/{services → types/services}/FormioService.d.ts +0 -0
- package/lib/{utils → types/utils}/isMongoId.d.ts +0 -0
- package/package.json +23 -17
- package/tsconfig.compile.esm.json +23 -0
- package/lib/FormioModule.js.map +0 -1
- 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.d.ts +0 -183
- package/lib/domain/FormioModels.js +0 -3
- 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.d.ts +0 -13
- package/lib/middlewares/FormioAuthMiddleware.js.map +0 -1
- package/lib/services/FormioAuthService.js.map +0 -1
- package/lib/services/FormioDatabase.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,97 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Inject, Injectable, InjectorService } from "@tsed/common";
|
|
3
|
+
import { promisify } from "util";
|
|
4
|
+
const createRouter = require("formio");
|
|
5
|
+
const swagger = require("formio/src/util/swagger.js");
|
|
6
|
+
const util = require("formio/src/util/util.js");
|
|
7
|
+
let FormioService = class FormioService {
|
|
8
|
+
get audit() {
|
|
9
|
+
return this.formio.audit || (() => { });
|
|
10
|
+
}
|
|
11
|
+
get auth() {
|
|
12
|
+
return this.formio.auth;
|
|
13
|
+
}
|
|
14
|
+
// istanbul ignore next
|
|
15
|
+
get swagger() {
|
|
16
|
+
return (...args) => new Promise((resolve) => swagger(...args, resolve));
|
|
17
|
+
}
|
|
18
|
+
get config() {
|
|
19
|
+
return this.formio.config;
|
|
20
|
+
}
|
|
21
|
+
get db() {
|
|
22
|
+
return this.formio.db;
|
|
23
|
+
}
|
|
24
|
+
get resources() {
|
|
25
|
+
return this.formio.resources;
|
|
26
|
+
}
|
|
27
|
+
get mongoose() {
|
|
28
|
+
return this.formio.mongoose;
|
|
29
|
+
}
|
|
30
|
+
get middleware() {
|
|
31
|
+
return this.formio.middleware;
|
|
32
|
+
}
|
|
33
|
+
get schemas() {
|
|
34
|
+
return this.formio.schemas;
|
|
35
|
+
}
|
|
36
|
+
get formio() {
|
|
37
|
+
return this.router.formio;
|
|
38
|
+
}
|
|
39
|
+
get hook() {
|
|
40
|
+
return this.formio.hook;
|
|
41
|
+
}
|
|
42
|
+
get util() {
|
|
43
|
+
return this.formio.util;
|
|
44
|
+
}
|
|
45
|
+
get template() {
|
|
46
|
+
return this.formio.template;
|
|
47
|
+
}
|
|
48
|
+
get Action() {
|
|
49
|
+
return this.formio.Action;
|
|
50
|
+
}
|
|
51
|
+
async exportTemplate(options = {}) {
|
|
52
|
+
return promisify(this.formio.template.export)(options);
|
|
53
|
+
}
|
|
54
|
+
async importTemplate(template) {
|
|
55
|
+
return promisify(this.formio.template.import.template)(template);
|
|
56
|
+
}
|
|
57
|
+
encrypt(text) {
|
|
58
|
+
return promisify(this.formio.encrypt)(text);
|
|
59
|
+
}
|
|
60
|
+
isInit() {
|
|
61
|
+
return !!this.router;
|
|
62
|
+
}
|
|
63
|
+
// istanbul ignore next
|
|
64
|
+
createRouter(options) {
|
|
65
|
+
return createRouter(options);
|
|
66
|
+
}
|
|
67
|
+
init(options, hooks = {}) {
|
|
68
|
+
if (options && Object.keys(options).length) {
|
|
69
|
+
this.router = this.createRouter(this.mapConfiguration(options));
|
|
70
|
+
this.bindLogger();
|
|
71
|
+
return this.router.init(hooks);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
mapConfiguration(options) {
|
|
75
|
+
const { injector } = this;
|
|
76
|
+
const mongooseSettings = injector.settings.get("mongoose.0");
|
|
77
|
+
if (mongooseSettings) {
|
|
78
|
+
options.mongo = options.mongo || mongooseSettings.url;
|
|
79
|
+
options.mongoConfig = options.mongoConfig || JSON.stringify(mongooseSettings.connectionOptions);
|
|
80
|
+
}
|
|
81
|
+
return options;
|
|
82
|
+
}
|
|
83
|
+
bindLogger() {
|
|
84
|
+
const { injector } = this;
|
|
85
|
+
util.log = injector.logger.info.bind(injector.logger);
|
|
86
|
+
util.error = injector.logger.error.bind(injector.logger);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
__decorate([
|
|
90
|
+
Inject(),
|
|
91
|
+
__metadata("design:type", InjectorService)
|
|
92
|
+
], FormioService.prototype, "injector", void 0);
|
|
93
|
+
FormioService = __decorate([
|
|
94
|
+
Injectable()
|
|
95
|
+
], FormioService);
|
|
96
|
+
export { FormioService };
|
|
97
|
+
//# sourceMappingURL=FormioService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormioService.js","sourceRoot":"","sources":["../../../src/services/FormioService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAIjE,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAS/B,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACvC,MAAM,OAAO,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAGhD,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,OAAO,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;I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3GC;IADC,MAAM,EAAE;8BACW,eAAe;+CAAC;AAJzB,aAAa;IADzB,UAAU,EAAE;GACA,aAAa,CA+GzB;SA/GY,aAAa","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\nconst createRouter = require(\"formio\");\nconst swagger = require(\"formio/src/util/swagger.js\");\nconst util = require(\"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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMongoId.js","sourceRoot":"","sources":["../../../src/utils/isMongoId.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACpD,CAAC","sourcesContent":["export function isMongoId(text: string) {\n return text.toString().match(/^[0-9a-fA-F]{24}$/);\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,32 +1,7 @@
|
|
|
1
1
|
import { Request, Response } from "express";
|
|
2
2
|
import { FormioMongooseSchema } from "./FormioBaseModel";
|
|
3
3
|
import { FormioComponent } from "./FormioModels";
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
6
|
-
title: string;
|
|
7
|
-
description: string;
|
|
8
|
-
priority: number;
|
|
9
|
-
defaults: {
|
|
10
|
-
handler: string[];
|
|
11
|
-
method: string[];
|
|
12
|
-
};
|
|
13
|
-
access?: {
|
|
14
|
-
handler: boolean;
|
|
15
|
-
method: boolean;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export interface FormioAction<Settings = any> {
|
|
19
|
-
name: string;
|
|
20
|
-
title: string;
|
|
21
|
-
action: string;
|
|
22
|
-
handler: string[];
|
|
23
|
-
method: string[];
|
|
24
|
-
priority: number;
|
|
25
|
-
form: any;
|
|
26
|
-
settings: Settings;
|
|
27
|
-
condition?: any;
|
|
28
|
-
deleted?: number | null;
|
|
29
|
-
}
|
|
4
|
+
import { FormioAction, FormioActionInfo } from "@tsed/formio-types";
|
|
30
5
|
export interface FormioActionModel extends FormioAction {
|
|
31
6
|
resolve(handler: string, method: string, req: Request, res: Response, next: Function, setActionItemMessage: SetActionItemMessage): void;
|
|
32
7
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MongooseDocument } from "@tsed/mongoose";
|
|
2
|
-
import { FormioAction } from "
|
|
3
|
-
import { FormioForm, FormioRole } from "./FormioModels";
|
|
2
|
+
import { FormioAction, FormioForm, FormioRole } from "@tsed/formio-types";
|
|
4
3
|
export interface FormioCtxMapper {
|
|
5
4
|
forms: Map<string, MongooseDocument<FormioForm>>;
|
|
6
5
|
actions: Map<string, MongooseDocument<FormioAction>>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MongooseDocument } from "@tsed/mongoose";
|
|
2
|
+
import { Schema } from "mongoose";
|
|
3
|
+
import { FormioActionModelCtor, FormioActionMongooseSchema } from "./FormioAction";
|
|
4
|
+
import { FormioBaseModel, FormioModel, FormioMongooseSchema } from "./FormioBaseModel";
|
|
5
|
+
import { FormioActionItem, FormioForm, FormioRole, FormioSchema, FormioSubmission, FormioToken } from "@tsed/formio-types";
|
|
6
|
+
export * from "@tsed/formio-types";
|
|
7
|
+
export declare type WithID<T> = T & {
|
|
8
|
+
_id: string;
|
|
9
|
+
};
|
|
10
|
+
export interface FormioSchemas {
|
|
11
|
+
action: FormioActionMongooseSchema;
|
|
12
|
+
actionItem: Schema<MongooseDocument<FormioActionItem>>;
|
|
13
|
+
form: FormioMongooseSchema<FormioForm>;
|
|
14
|
+
role: FormioMongooseSchema<FormioRole>;
|
|
15
|
+
schema: Schema<MongooseDocument<FormioSchema>>;
|
|
16
|
+
submission: Schema<MongooseDocument<FormioSubmission>>;
|
|
17
|
+
token: Schema<MongooseDocument<FormioToken>>;
|
|
18
|
+
[key: string]: Schema<MongooseDocument<any>>;
|
|
19
|
+
}
|
|
20
|
+
export declare type FormioModelsModels = {
|
|
21
|
+
action: FormioActionModelCtor;
|
|
22
|
+
actionItem: FormioBaseModel<FormioActionItem>;
|
|
23
|
+
form: FormioModel<FormioForm>;
|
|
24
|
+
role: FormioModel<FormioRole>;
|
|
25
|
+
schema: FormioBaseModel<FormioSchema>;
|
|
26
|
+
submission: FormioBaseModel<FormioSubmission>;
|
|
27
|
+
token: FormioBaseModel<FormioToken>;
|
|
28
|
+
} & Record<string, FormioBaseModel>;
|
|
29
|
+
export interface FormioModels {
|
|
30
|
+
schemas: FormioSchemas;
|
|
31
|
+
models: FormioModelsModels;
|
|
32
|
+
specs: {
|
|
33
|
+
action: any;
|
|
34
|
+
actionItem: any;
|
|
35
|
+
form: any;
|
|
36
|
+
role: any;
|
|
37
|
+
schema: any;
|
|
38
|
+
submission: any;
|
|
39
|
+
token: any;
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Context } from "@tsed/common";
|
|
2
|
+
import { FormioService } from "../services/FormioService";
|
|
3
|
+
/**
|
|
4
|
+
* @middleware
|
|
5
|
+
* @formio
|
|
6
|
+
*/
|
|
7
|
+
export declare class FormioAuthMiddleware {
|
|
8
|
+
protected formio: FormioService;
|
|
9
|
+
get tokenHandler(): any;
|
|
10
|
+
use(ctx: Context): Promise<void>;
|
|
11
|
+
}
|
|
@@ -33,7 +33,7 @@ export declare class FormioAuthService {
|
|
|
33
33
|
* Retrieve roles
|
|
34
34
|
* @param req
|
|
35
35
|
*/
|
|
36
|
-
getRoles(req?: Req): Promise<import("mongoose").LeanDocument<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, {}> & import("
|
|
36
|
+
getRoles(req?: Req): Promise<import("mongoose").LeanDocument<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, {}> & import("@tsed/formio-types/lib/types/domain/FormioRole").FormioRole & import("@tsed/mongoose").MongooseDocumentMethods<import("@tsed/formio-types/lib/types/domain/FormioRole").FormioRole>>>[]>;
|
|
37
37
|
/**
|
|
38
38
|
* Update the role of the current user submission
|
|
39
39
|
* @param _id
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="mongoose" />
|
|
2
2
|
import { MongooseModel } from "@tsed/mongoose";
|
|
3
|
+
import { FormioAction, FormioActionItem, FormioForm, FormioRole, FormioSubmission, FormioToken } from "@tsed/formio-types";
|
|
3
4
|
import { FormioMapper } from "../builder/FormioMapper";
|
|
4
|
-
import { FormioAction } from "../domain/FormioAction";
|
|
5
|
-
import { FormioActionItem, FormioForm, FormioRole, FormioSubmission, FormioToken } from "../domain/FormioModels";
|
|
6
5
|
import { FormioService } from "./FormioService";
|
|
7
6
|
export declare class FormioDatabase {
|
|
8
7
|
protected formio: FormioService;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
/// <reference types="express" />
|
|
3
1
|
import { InjectorService } from "@tsed/common";
|
|
4
2
|
import { FormioHooks } from "../domain/FormioHooks";
|
|
5
3
|
import { FormioService } from "./FormioService";
|
|
4
|
+
import { Request } from "express";
|
|
6
5
|
export declare class FormioHooksService {
|
|
7
6
|
protected injector: InjectorService;
|
|
8
7
|
protected formio: FormioService;
|
|
9
|
-
get settings(): (req:
|
|
8
|
+
get settings(): (req: Request, cb: Function) => void;
|
|
10
9
|
get invoke(): <T = any>(...args: any[]) => boolean | T;
|
|
11
10
|
get alter(): (event: string, ...args: any[]) => any;
|
|
12
11
|
get alterAsync(): (event: string, ...args: any[]) => Promise<any>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/formio",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.1",
|
|
4
4
|
"description": "Formio package for Ts.ED framework",
|
|
5
|
-
"source": "./src/index.ts",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"typings": "./lib/index.d.ts",
|
|
8
5
|
"private": false,
|
|
9
6
|
"keywords": [
|
|
10
7
|
"Formio",
|
|
@@ -14,29 +11,41 @@
|
|
|
14
11
|
"decorators",
|
|
15
12
|
"express"
|
|
16
13
|
],
|
|
14
|
+
"source": "./src/index.ts",
|
|
15
|
+
"main": "./lib/cjs/index.js",
|
|
16
|
+
"typings": "./lib/types/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"import": "./lib/esm/index.js",
|
|
20
|
+
"require": "./lib/cjs/index.js",
|
|
21
|
+
"default": "./lib/esm/index.js"
|
|
22
|
+
},
|
|
17
23
|
"scripts": {
|
|
18
|
-
"build": "
|
|
24
|
+
"build": "yarn run build:esm && yarn run build:cjs",
|
|
25
|
+
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
26
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
19
27
|
"start": "ts-node -r tsconfig-paths/register test/app/index.ts",
|
|
20
28
|
"test": "cross-env NODE_ENV=test nyc mocha"
|
|
21
29
|
},
|
|
22
30
|
"dependencies": {
|
|
31
|
+
"@tsed/formio-types": "7.0.0-beta.1",
|
|
23
32
|
"tslib": "2.2.0"
|
|
24
33
|
},
|
|
25
34
|
"devDependencies": {
|
|
26
|
-
"@tsed/common": "7.0.0-
|
|
27
|
-
"@tsed/core": "7.0.0-
|
|
28
|
-
"@tsed/di": "7.0.0-
|
|
29
|
-
"@tsed/mongoose": "7.0.0-
|
|
35
|
+
"@tsed/common": "7.0.0-beta.1",
|
|
36
|
+
"@tsed/core": "7.0.0-beta.1",
|
|
37
|
+
"@tsed/di": "7.0.0-beta.1",
|
|
38
|
+
"@tsed/mongoose": "7.0.0-beta.1",
|
|
30
39
|
"express": "^4.17.1",
|
|
31
40
|
"formio": "^2.0.0",
|
|
32
41
|
"mongodb": "*",
|
|
33
42
|
"mongoose": "^5.12.2"
|
|
34
43
|
},
|
|
35
44
|
"peerDependencies": {
|
|
36
|
-
"@tsed/common": "^7.0.0-
|
|
37
|
-
"@tsed/core": "^7.0.0-
|
|
38
|
-
"@tsed/di": "^7.0.0-
|
|
39
|
-
"@tsed/mongoose": "^7.0.0-
|
|
45
|
+
"@tsed/common": "^7.0.0-beta.1",
|
|
46
|
+
"@tsed/core": "^7.0.0-beta.1",
|
|
47
|
+
"@tsed/di": "^7.0.0-beta.1",
|
|
48
|
+
"@tsed/mongoose": "^7.0.0-beta.1",
|
|
40
49
|
"express": "^4.17.1",
|
|
41
50
|
"formio": "^2.0.0",
|
|
42
51
|
"mongodb": "*",
|
|
@@ -48,8 +57,5 @@
|
|
|
48
57
|
},
|
|
49
58
|
"homepage": "https://github.com/tsedio/tsed/tree/alpha/packages/third-parties/formio",
|
|
50
59
|
"author": "Romain Lenzotti",
|
|
51
|
-
"license": "MIT"
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"tag": "alpha"
|
|
54
|
-
}
|
|
60
|
+
"license": "MIT"
|
|
55
61
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"node_modules",
|
|
13
|
+
"test",
|
|
14
|
+
"lib",
|
|
15
|
+
"benchmark",
|
|
16
|
+
"coverage",
|
|
17
|
+
"spec",
|
|
18
|
+
"**/*.benchmark.ts",
|
|
19
|
+
"**/*.spec.ts",
|
|
20
|
+
"keys",
|
|
21
|
+
"jest.config.js"
|
|
22
|
+
]
|
|
23
|
+
}
|
package/lib/FormioModule.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormioModule.js","sourceRoot":"","sources":["../src/FormioModule.ts"],"names":[],"mappings":";;;;AAAA,yCASsB;AACtB,qCAAqC;AACrC,iCAAgC;AAChC,4DAAuD;AACvD,wDAAmD;AACnD,sDAAiD;AACjD,oDAA+C;AAC/C,sDAAiD;AACjD,oFAA+E;AAC/E,oFAA+E;AAG/E,oEAA+D;AAC/D,sEAAiE;AACjE,gEAA2D;AAC3D,4DAAuD;AAgBvD,IAAa,YAAY,GAAzB,MAAa,YAAY;IA+BvB,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAqB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAA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AAG,MAAM,CAAC;gBAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;gBAC7C,UAAU,CAAC,EAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAC,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAES,KAAK,CAAC,aAAa;QAC3B,MAAM,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,eAAM,EAAE;sCACS,6BAAa;4CAAC;AAGhC;IADC,eAAM,EAAE;sCACQ,uCAAkB;2CAAC;AAGpC;IADC,eAAM,EAAE;sCACY,iCAAe;+CAAC;AAGrC;IADC,eAAM,EAAE;sCACM,4BAAmB;yCAAC;AAGnC;IADC,eAAM,EAAE;sCACW,wBAAe;8CAAC;AAGpC;IADC,iBAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;;8CACU;AAGjC;IADC,iBAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC;;6CACN;AAG1B;IADC,iBAAQ,CAAC,oBAAoB,EAAE,KAAK,CAAC;;iDACP;AAG/B;IADC,iBAAQ,CAAC,iBAAiB,CAAC;;8CACQ;AAGpC;IADC,iBAAQ,CAAC,aAAa,CAAC;;0CACH;AA7BV,YAAY;IAdxB,WAAM,CAAC;QACN,OAAO,EAAE;YACP,6BAAa;YACb,uCAAkB;YAClB,qCAAiB;YACjB,2BAAY;YACZ,qBAAS;YACT,uBAAU;YACV,mBAAQ;YACR,qBAAS;YACT,mDAAwB;YACxB,mDAAwB;SACzB;KACF,CAAC;GACW,YAAY,CAsHxB;AAtHY,oCAAY","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormioMapper.js","sourceRoot":"","sources":["../../src/builder/FormioMapper.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IACvB,YAAqB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEjD,IAAI,CAAC,GAAW;QACd,MAAM,KAAK,GAAG,MAAM,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C;SACb;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACvB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;SACJ;QAED,MAAM,GAAG,GAAG,QAAQ,CAAC,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;AA3DD,oCA2DC","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterActions.js","sourceRoot":"","sources":["../../src/components/AlterActions.ts"],"names":[],"mappings":";;;;AAAA,yCAAgF;AAChF,iCAA2D;AAC3D,+CAA0C;AAI1C,6DAAwD;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,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAmB,eAAe,CAAC,CAAC;YACtE,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YAE3D,OAAO;gBACL,GAAG,OAAO;gBACV,CAAC,OAAO,CAAC,IAAI,CAAC,QAAE,KAAM,SAAQ,MAAM;wBAElC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAQ,EAAE,GAAQ,EAAE,IAAc;4BAClD,IAAI,IAAI,GAAG,EAAC,GAAG,OAAO,EAAC,CAAC;4BAExB,IAAI,QAAQ,CAAC,IAAI,EAAE;gCACjB,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAA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,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,WAAM,EAAE;sCACW,oBAAe;8CAAC;AAGpC;IADC,WAAM,EAAE;sCACS,6BAAa;4CAAC;AALrB,YAAY;IADxB,aAAK,CAAC,SAAS,CAAC;GACJ,YAAY,CAkExB;AAlEY,oCAAY","sourcesContent":["import {EndpointMetadata, PlatformContext, PlatformHandler} from \"@tsed/common\";\nimport {Inject, InjectorService, Provider} from \"@tsed/di\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {FormioActionInfo, 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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterAudit.js","sourceRoot":"","sources":["../../src/components/AlterAudit.ts"],"names":[],"mappings":";;;;AACA,+CAA0C;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,aAAK,CAAC,OAAO,CAAC;GACF,UAAU,CAKtB;AALY,gCAAU","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterHost.js","sourceRoot":"","sources":["../../src/components/AlterHost.ts"],"names":[],"mappings":";;;;AACA,+CAA0C;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,aAAK,CAAC,MAAM,CAAC;GACD,SAAS,CAIrB;AAJY,8BAAS","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterLog.js","sourceRoot":"","sources":["../../src/components/AlterLog.ts"],"names":[],"mappings":";;;;AACA,+CAA0C;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,aAAK,CAAC,KAAK,CAAC;GACA,QAAQ,CAKpB;AALY,4BAAQ","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterSkip.js","sourceRoot":"","sources":["../../src/components/AlterSkip.ts"],"names":[],"mappings":";;;;AAAA,yCAAuD;AACvD,yCAA2C;AAC3C,+CAA0C;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,sBAAa,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAjBC;IADC,iBAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC;;0CAChB;AAGhB;IADC,iBAAQ,CAAC,kBAAkB,EAAE,CAAC,YAAY,CAAC,CAAC;;4CACzB;AALT,SAAS;IADrB,aAAK,CAAC,MAAM,CAAC;GACD,SAAS,CAmBrB;AAnBY,8BAAS","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"]}
|
|
@@ -1 +0,0 @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,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAC,EAAE,EAAE;YACxG,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxD,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;YAErD,GAAG,CAAC,GAAG,CAAC,GAAG,eAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;YAElC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACZ,GAAG,UAAU;gBACb,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE;gBACtC,QAAQ,EAAE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,EAAE;gBACzC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC;gBACzC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;gBAChD,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;aAC/B,CAAC,CAAC;YAEH,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACX,CAAC;CACF,CAAA;AA1CC;IADC,WAAM,EAAE;sCACW,+BAAc;0DAAC;AAFxB,wBAAwB;IADpC,aAAK,CAAC,qBAAqB,CAAC;GAChB,wBAAwB,CA4CpC;AA5CY,4DAAwB","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateImportSteps.js","sourceRoot":"","sources":["../../src/components/AlterTemplateImportSteps.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAEhC,+CAA0C;AAI1C,+DAA0D;AAE1D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAG/B,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,CAAC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DAAwB","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/decorators/action.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,iCAA0C;AAG1C;;;;GAIG;AACH,SAAgB,MAAM,CAAC,OAAyB;IAC9C,OAAO,oBAAa,CAAC,CAAC,MAAW,EAAE,EAAE;QACnC,qBAAgB,CAAC;YACf,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,eAAe;SACtB,CAAC,CAAC;IACL,CAAC,EAAE,eAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;AACzC,CAAC;AAPD,wBAOC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {registerProvider} from \"@tsed/di\";\nimport {FormioActionInfo} from \"../domain/FormioAction\";\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actionCtx.js","sourceRoot":"","sources":["../../src/decorators/actionCtx.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AAGrC;;;;;;;;;;;;;GAaG;AACH,SAAgB,SAAS,CAAC,UAAmB;IAC3C,OAAO,gBAAO,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACvE,CAAC;AAFD,8BAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {FormioAction, SetActionItemMessage} from \"../domain/FormioAction\";\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alter.js","sourceRoot":"","sources":["../../src/decorators/alter.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,iCAA0C;AAE1C;;;;GAIG;AACH,SAAgB,KAAK,CAAC,IAAY;IAChC,OAAO,oBAAa,CAAC,CAAC,MAAW,EAAE,EAAE;QACnC,qBAAgB,CAAC;YACf,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC,EAAE,eAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAPD,sBAOC","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"]}
|
package/lib/decorators/on.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"on.js","sourceRoot":"","sources":["../../src/decorators/on.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,iCAA0C;AAE1C;;;;GAIG;AACH,SAAgB,EAAE,CAAC,IAAY;IAC7B,OAAO,oBAAa,CAAC,CAAC,MAAW,EAAE,EAAE;QACnC,qBAAgB,CAAC;YACf,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,WAAW;SAClB,CAAC,CAAC;IACL,CAAC,EAAE,eAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC;AAPD,gBAOC","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFormioAuth.js","sourceRoot":"","sources":["../../src/decorators/useFormioAuth.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,8EAAyE;AAEzE;;;;GAIG;AACH,SAAgB,aAAa;IAC3B,OAAO,gBAAO,CAAC,2CAAoB,CAAC,CAAC;AACvC,CAAC;AAFD,sCAEC","sourcesContent":["import {UseAuth} from \"@tsed/common\";\nimport {FormioAuthMiddleware} from \"../middlewares/FormioAuthMiddleware\";\n\n/**\n * Check if a user is connected by using the Formio Auth middleware\n * @decorator\n * @formio\n */\nexport function UseFormioAuth(): Function {\n return UseAuth(FormioAuthMiddleware);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterHook.js","sourceRoot":"","sources":["../../src/domain/AlterHook.ts"],"names":[],"mappings":"","sourcesContent":["export interface AlterHook<T = any> {\n transform(...args: any[]): T;\n}\n"]}
|
package/lib/domain/Formio.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Formio.js","sourceRoot":"","sources":["../../src/domain/Formio.ts"],"names":[],"mappings":"","sourcesContent":["import {EventEmitter} from \"events\";\nimport {NextFunction, Request, Response} from \"express\";\nimport {Db} from \"mongodb\";\nimport {Mongoose, Schema} from \"mongoose\";\nimport {FormioActionModelCtor} from \"./FormioAction\";\nimport {FormioActionsIndex} from \"./FormioActionsIndex\";\nimport {FormioAuth} from \"./FormioAuth\";\nimport {FormioBaseModel} from \"./FormioBaseModel\";\nimport {FormioConfig} from \"./FormioConfig\";\nimport {FormioHook, FormioHooks} from \"./FormioHooks\";\nimport {FormioModels, FormioSchemas} from \"./FormioModels\";\nimport {FormioTemplateUtil} from \"./FormioTemplateUtil\";\nimport {FormioUpdate} from \"./FormioUpdate\";\nimport {FormioUtil} from \"./FormioUtils\";\n\nexport interface FormioBase {\n /**\n * Auth\n */\n auth: FormioAuth;\n /**\n * Event emitter\n */\n events: EventEmitter;\n /**\n * Formio configuration\n */\n config: FormioConfig & {schema: string};\n\n /**\n * Emit alter `log` event. Return false to disable event logging.\n * @param event\n * @param req\n * @param info\n */\n log(event: string, req: Request, ...info: any[]): void;\n\n /**\n * Emit alter `audit` event if `config.audit` is enabled. Return false to disable event logging.\n * Use `console.log`.\n * @param event\n * @param req\n * @param info\n */\n audit(event: string, req: Request, ...info: any[]): void;\n}\n\nexport interface FormioMiddlewares {\n alias(req: Request, res: Response, next: NextFunction): void;\n\n params(req: Request, res: Response, next: NextFunction): void;\n\n accessHandler(req: Request, res: Response, next: NextFunction): void;\n\n /**\n * Authorize all urls based on roles and permissions.\n * @param req\n * @param res\n * @param next\n */\n permissionHandler(req: Request, res: Response, next: NextFunction): void;\n\n restrictRequestTypes(req: Request, res: Response, next: NextFunction): void;\n tokenHandler(req: Request, res: Response, next: NextFunction): void;\n}\n\nexport interface Formio extends FormioBase {\n Action: FormioActionModelCtor;\n BaseModel: FormioBaseModel;\n actions: FormioActionsIndex;\n resources: any;\n /**\n * Database connection\n */\n db: Db;\n\n schemas: FormioSchemas & {\n AccessSchema: Schema;\n PermissionSchema: Schema;\n FieldMatchAccessPermissionSchema: Schema;\n };\n\n models: FormioModels;\n /**\n * Mongoose lib.\n */\n mongoose: Mongoose;\n /**\n * Exported formio middlewares\n */\n readonly middleware: FormioMiddlewares;\n /**\n * Hooks.\n */\n hooks: FormioHooks;\n /**\n * Plugins.\n */\n plugins: any;\n /**\n * Formio hook util.\n */\n readonly hook: FormioHook;\n /**\n * The formio utils.\n */\n readonly util: FormioUtil;\n /**\n * Update system.\n */\n readonly update: FormioUpdate;\n /**\n * Template export/import\n */\n readonly template: FormioTemplateUtil;\n\n /**\n * Encryption system.\n */\n encrypt(text: string, next: (err: null | Error, hash: string) => void): void;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormioAction.js","sourceRoot":"","sources":["../../src/domain/FormioAction.ts"],"names":[],"mappings":"","sourcesContent":["import {Request, Response} from \"express\";\nimport {FormioMongooseSchema} from \"./FormioBaseModel\";\nimport {FormioComponent} from \"./FormioModels\";\n\nexport interface FormioActionInfo {\n name: string;\n title: string;\n description: string;\n priority: number;\n defaults: {\n handler: string[];\n method: string[];\n };\n access?: {\n handler: boolean;\n method: boolean;\n };\n}\n\nexport interface FormioAction<Settings = any> {\n name: string;\n title: string;\n action: string;\n handler: string[];\n method: string[];\n priority: number;\n form: any;\n settings: Settings;\n condition?: any;\n deleted?: number | null;\n}\n\nexport interface FormioActionModel extends FormioAction {\n resolve(handler: string, method: string, req: Request, res: Response, next: Function, setActionItemMessage: SetActionItemMessage): void;\n}\n\nexport type FormioActionMongooseSchema = FormioMongooseSchema<FormioAction>;\nexport type SetActionItemMessage = (message: string, data?: any, state?: any) => void;\n\nexport interface FormioActionModelCtor {\n schema?: FormioActionMongooseSchema;\n\n info(req: Request, response: Response, next: (err: any, info: FormioActionInfo) => void): void;\n\n settingsForm(req: Request, response: Response, next: (err: any, info: FormioComponent[]) => void): void;\n\n new (data: FormioAction, req: Request, res: Response): FormioActionModel;\n}\n\nexport interface ActionMethods {\n info?(req: Request, response: Response): Promise<FormioAction>;\n\n settingsForm(req: Request, response: Response): Promise<FormioComponent[]>;\n\n resolve(...args: any[]): Promise<any>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormioActionsIndex.js","sourceRoot":"","sources":["../../src/domain/FormioActionsIndex.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {FormioActionModelCtor} from \"./FormioAction\";\n\nexport interface FormioActions {\n email: FormioActionModelCtor;\n login: FormioActionModelCtor;\n resetpass: FormioActionModelCtor;\n role: FormioActionModelCtor;\n save: FormioActionModelCtor;\n sql: FormioActionModelCtor;\n webhook: FormioActionModelCtor;\n\n [key: string]: FormioActionModelCtor;\n}\n\nexport interface FormioActionsIndex {\n actions: FormioActions & Record<string, Type<FormioActionModelCtor>>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormioAuth.js","sourceRoot":"","sources":["../../src/domain/FormioAuth.ts"],"names":[],"mappings":"","sourcesContent":["import {Next, Req, Res} from \"@tsed/common\";\nimport {FormioDecodedToken, FormioPayloadToken} from \"./FormioDecodedToken\";\nimport {FormioForm} from \"./FormioModels\";\n\nexport interface FormioAuth {\n /**\n * Send the current user.\n *\n * @param req\n * @param res\n * @param next\n */\n currentUser(req: Req, res: Res, next: Function): void;\n\n /**\n * Checks to see if a decoded token is allowed to access this path.\n * @param req\n * @param decoded\n * @return {boolean}\n */\n isTokenAllowed(req: Req, decoded: FormioDecodedToken): boolean;\n\n /**\n * Generate our JWT with the given payload, and pass it to the given callback function.\n *\n * @param payload {Object}\n * The decoded JWT.\n *\n * @return {String|Boolean}\n * The JWT from the given payload, or false if the jwt payload is still valid.\n */\n getToken(payload: FormioPayloadToken): string | boolean;\n\n /**\n * Generate a temporary token for a specific path and expiration.\n *\n * @param req\n * @param res\n * @param allow\n * @param expire\n * @param admin\n * @param cb\n */\n getTempToken(req: Req, res: Res, allow: boolean, expire: number, admin: boolean, cb: Function): void;\n\n tempToken(req: Req, res: Res): void;\n\n /**\n * Authenticate a user.\n *\n * @param req\n * @param forms {Mixed}\n * A single form or an array of forms to authenticate against.\n * @param userField {String}\n * The user submission field that contains the username.\n * @param passField {String}\n * The user submission field that contains the password.\n * @param username {String}\n * The user submission username to login with.\n * @param password {String}\n * The user submission password to login with.\n * @param next {Function}\n * The callback function to call after authentication.\n */\n authenticate(\n req: Req,\n forms: FormioForm | FormioForm[],\n userField: string,\n passField: string,\n username: string,\n password: string,\n next: Function\n ): void;\n\n /**\n * Interception logout request.\n * @param req\n * @param res\n * @param next\n */\n logout(req: Req, res: Res, next: Next): void;\n}\n"]}
|