@tsed/formio 6.107.5 → 6.108.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/.nycrc +1 -1
- package/lib/cjs/FormioModule.js +21 -21
- package/lib/cjs/FormioModule.js.map +1 -1
- package/lib/cjs/components/AlterActions.js +9 -9
- package/lib/cjs/components/AlterActions.js.map +1 -1
- package/lib/cjs/components/AlterAudit.js +1 -1
- package/lib/cjs/components/AlterHost.js +1 -1
- package/lib/cjs/components/AlterLog.js +1 -1
- package/lib/cjs/components/AlterSkip.js +5 -5
- package/lib/cjs/components/AlterTemplateExportSteps.js +4 -4
- package/lib/cjs/components/AlterTemplateExportSteps.js.map +1 -1
- package/lib/cjs/components/AlterTemplateImportSteps.js +4 -4
- package/lib/cjs/components/AlterTemplateImportSteps.js.map +1 -1
- package/lib/cjs/domain/FormioHooks.js.map +1 -1
- package/lib/cjs/domain/FormioModels.js +1 -1
- package/lib/cjs/domain/FormioModels.js.map +1 -1
- package/lib/cjs/domain/Resource.js.map +1 -1
- package/lib/cjs/index.js +43 -43
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/middlewares/FormioAuthMiddleware.js +8 -8
- package/lib/cjs/middlewares/FormioAuthMiddleware.js.map +1 -1
- package/lib/cjs/services/FormioAuthService.js +7 -7
- package/lib/cjs/services/FormioAuthService.js.map +1 -1
- package/lib/cjs/services/FormioDatabase.js +4 -4
- package/lib/cjs/services/FormioDatabase.js.map +1 -1
- package/lib/cjs/services/FormioHooksService.js +5 -5
- package/lib/cjs/services/FormioHooksService.js.map +1 -1
- package/lib/cjs/services/FormioInstaller.js +5 -5
- package/lib/cjs/services/FormioInstaller.js.map +1 -1
- package/lib/cjs/services/FormioRepository.js +2 -2
- package/lib/cjs/services/FormioRepository.js.map +1 -1
- package/lib/cjs/services/FormioService.js +6 -6
- package/lib/cjs/services/FormioService.js.map +1 -1
- package/lib/esm/domain/FormioHooks.js.map +1 -1
- package/lib/esm/domain/Resource.js.map +1 -1
- package/lib/esm/services/FormioAuthService.js.map +1 -1
- package/lib/types/domain/FormioHooks.d.ts +1 -1
- package/lib/types/domain/Resource.d.ts +2 -2
- package/lib/types/services/FormioAuthService.d.ts +14 -3
- package/lib/types/services/FormioDatabase.d.ts +26 -9
- package/lib/types/services/FormioRepository.d.ts +10 -1
- package/package.json +15 -13
package/.nycrc
CHANGED
package/lib/cjs/FormioModule.js
CHANGED
|
@@ -77,47 +77,47 @@ let FormioModule = class FormioModule {
|
|
|
77
77
|
return this.template && !(hasForms || this.skipInstall);
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
tslib_1.__decorate([
|
|
81
81
|
(0, common_1.Inject)(),
|
|
82
|
-
|
|
82
|
+
tslib_1.__metadata("design:type", FormioService_1.FormioService)
|
|
83
83
|
], FormioModule.prototype, "formio", void 0);
|
|
84
|
-
|
|
84
|
+
tslib_1.__decorate([
|
|
85
85
|
(0, common_1.Inject)(),
|
|
86
|
-
|
|
86
|
+
tslib_1.__metadata("design:type", FormioHooksService_1.FormioHooksService)
|
|
87
87
|
], FormioModule.prototype, "hooks", void 0);
|
|
88
|
-
|
|
88
|
+
tslib_1.__decorate([
|
|
89
89
|
(0, common_1.Inject)(),
|
|
90
|
-
|
|
90
|
+
tslib_1.__metadata("design:type", FormioInstaller_1.FormioInstaller)
|
|
91
91
|
], FormioModule.prototype, "installer", void 0);
|
|
92
|
-
|
|
92
|
+
tslib_1.__decorate([
|
|
93
93
|
(0, common_1.Inject)(),
|
|
94
|
-
|
|
94
|
+
tslib_1.__metadata("design:type", common_1.PlatformApplication)
|
|
95
95
|
], FormioModule.prototype, "app", void 0);
|
|
96
|
-
|
|
96
|
+
tslib_1.__decorate([
|
|
97
97
|
(0, common_1.Inject)(),
|
|
98
|
-
|
|
98
|
+
tslib_1.__metadata("design:type", common_1.InjectorService)
|
|
99
99
|
], FormioModule.prototype, "injector", void 0);
|
|
100
|
-
|
|
100
|
+
tslib_1.__decorate([
|
|
101
101
|
(0, common_1.Constant)("formio", {}),
|
|
102
|
-
|
|
102
|
+
tslib_1.__metadata("design:type", Object)
|
|
103
103
|
], FormioModule.prototype, "settings", void 0);
|
|
104
|
-
|
|
104
|
+
tslib_1.__decorate([
|
|
105
105
|
(0, common_1.Constant)("formio.baseUrl", "/"),
|
|
106
|
-
|
|
106
|
+
tslib_1.__metadata("design:type", String)
|
|
107
107
|
], FormioModule.prototype, "baseUrl", void 0);
|
|
108
|
-
|
|
108
|
+
tslib_1.__decorate([
|
|
109
109
|
(0, common_1.Constant)("formio.skipInstall", false),
|
|
110
|
-
|
|
110
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
111
111
|
], FormioModule.prototype, "skipInstall", void 0);
|
|
112
|
-
|
|
112
|
+
tslib_1.__decorate([
|
|
113
113
|
(0, common_1.Constant)("formio.template"),
|
|
114
|
-
|
|
114
|
+
tslib_1.__metadata("design:type", Object)
|
|
115
115
|
], FormioModule.prototype, "template", void 0);
|
|
116
|
-
|
|
116
|
+
tslib_1.__decorate([
|
|
117
117
|
(0, common_1.Constant)("formio.root"),
|
|
118
|
-
|
|
118
|
+
tslib_1.__metadata("design:type", Object)
|
|
119
119
|
], FormioModule.prototype, "root", void 0);
|
|
120
|
-
FormioModule =
|
|
120
|
+
FormioModule = tslib_1.__decorate([
|
|
121
121
|
(0, di_1.Module)({
|
|
122
122
|
imports: [
|
|
123
123
|
FormioService_1.FormioService,
|
|
@@ -1 +1 @@
|
|
|
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,GA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n normalizePath,\n OnReady,\n OnRoutesInit,\n PlatformApplication,\n PlatformRouteDetails\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() && this.injector.settings.getBestHost) {\n const {injector} = this;\n const host = injector.settings.getBestHost();\n const url = host.toString();\n\n injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || \"/\"}`);\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"]}
|
|
@@ -88,23 +88,23 @@ let AlterActions = class AlterActions {
|
|
|
88
88
|
return response;
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
tslib_1.__decorate([
|
|
92
92
|
(0, di_1.Inject)(),
|
|
93
|
-
|
|
93
|
+
tslib_1.__metadata("design:type", di_1.InjectorService)
|
|
94
94
|
], AlterActions.prototype, "injector", void 0);
|
|
95
|
-
|
|
95
|
+
tslib_1.__decorate([
|
|
96
96
|
(0, di_1.Inject)(),
|
|
97
|
-
|
|
97
|
+
tslib_1.__metadata("design:type", FormioService_1.FormioService)
|
|
98
98
|
], AlterActions.prototype, "formio", void 0);
|
|
99
|
-
|
|
99
|
+
tslib_1.__decorate([
|
|
100
100
|
(0, di_1.Inject)(),
|
|
101
|
-
|
|
101
|
+
tslib_1.__metadata("design:type", platform_params_1.PlatformParams)
|
|
102
102
|
], AlterActions.prototype, "params", void 0);
|
|
103
|
-
|
|
103
|
+
tslib_1.__decorate([
|
|
104
104
|
(0, di_1.Inject)(),
|
|
105
|
-
|
|
105
|
+
tslib_1.__metadata("design:type", platform_response_filter_1.PlatformResponseFilter)
|
|
106
106
|
], AlterActions.prototype, "responseFilter", void 0);
|
|
107
|
-
AlterActions =
|
|
107
|
+
AlterActions = tslib_1.__decorate([
|
|
108
108
|
(0, alter_1.Alter)("actions")
|
|
109
109
|
], AlterActions);
|
|
110
110
|
exports.AlterActions = AlterActions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterActions.js","sourceRoot":"","sources":["../../../src/components/AlterActions.ts"],"names":[],"mappings":";;;;AAAA,iCAA2D;AAC3D,yCAA8C;AAE9C,2DAAqD;AACrD,6EAAsE;AACtE,qCAA4D;AAC5D,yCAAiE;AACjE,+CAA0C;AAI1C,6DAAwD;AAGxD,IAAa,YAAY,GAAzB,MAAa,YAAY;IAavB,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,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YAE/D,OAAO;gBACL,GAAG,OAAO;gBACV,CAAC,OAAO,CAAC,IAAI,CAAC,QAAE,KAAM,SAAQ,MAAM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EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;QAExB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE;YACtB,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;YAEzB,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACvD,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAEvD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAhHC;IADC,IAAA,WAAM,GAAE;sCACW,oBAAe;8CAAC;AAGpC;IADC,IAAA,WAAM,GAAE;sCACS,6BAAa;4CAAC;AAGhC;IADC,IAAA,WAAM,GAAE;sCACS,gCAAc;4CAAC;AAGjC;IADC,IAAA,WAAM,GAAE;sCACiB,iDAAsB;oDAAC;AAXtC,YAAY;IADxB,IAAA,aAAK,EAAC,SAAS,CAAC;GACJ,YAAY,CAkHxB;AAlHY,oCAAY","sourcesContent":["import {Inject, InjectorService, Provider} from \"@tsed/di\";\nimport {EndpointMetadata} from \"@tsed/schema\";\nimport {FormioActionInfo} from \"@tsed/formio-types\";\nimport {PlatformParams} from \"@tsed/platform-params\";\nimport {PlatformResponseFilter} from \"@tsed/platform-response-filter\";\nimport {AnyToPromise, AnyToPromiseStatus} from \"@tsed/core\";\nimport {PlatformContext, setResponseHeaders} from \"@tsed/common\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {SetActionItemMessage} from \"../domain/FormioAction\";\nimport {FormioActions} from \"../domain/FormioActionsIndex\";\nimport {FormioService} from \"../services/FormioService\";\n\n@Alter(\"actions\")\nexport class AlterActions implements AlterHook {\n @Inject()\n protected injector: InjectorService;\n\n @Inject()\n protected formio: FormioService;\n\n @Inject()\n protected params: PlatformParams;\n\n @Inject()\n protected responseFilter: PlatformResponseFilter;\n\n transform(actions: FormioActions): FormioActions {\n const {Action} = this.formio;\n\n return this.getActions().reduce((actions, provider) => {\n const instance = this.injector.invoke<any>(provider.token);\n const options = provider.store.get<FormioActionInfo>(\"formio:action\");\n const resolveHandler = this.createHandler(provider, \"resolve\");\n\n return {\n ...actions,\n [options.name]: class extends Action {\n static access = options.access;\n\n static async info(req: any, res: any, next: Function) {\n let opts = {...options};\n\n if (instance.info) {\n opts = await instance.info(opts, req, res);\n }\n\n next(null, opts);\n }\n\n static async settingsForm(req: any, res: any, next: Function) {\n next(null, await instance.settingsForm(req, res));\n }\n\n resolve(handler: string, method: string, req: any, res: any, next: Function, setActionItemMessage: SetActionItemMessage): void {\n resolveHandler(this, handler, method, req, res, next, setActionItemMessage);\n }\n }\n };\n }, actions);\n }\n\n protected getActions() {\n return this.injector.getProviders(\"formio:action\");\n }\n\n protected createHandler(provider: Provider, propertyKey: string | symbol) {\n const promisedHandler = this.params.compileHandler({\n token: provider.token,\n propertyKey\n });\n\n return async (\n action: any,\n handler: string,\n method: string,\n req: {$ctx: PlatformContext},\n res: any,\n next: any,\n setActionItemMessage: SetActionItemMessage\n ) => {\n const $ctx = req.$ctx;\n $ctx.set(\"ACTION_CTX\", {handler, method, setActionItemMessage, action});\n $ctx.endpoint = EndpointMetadata.get(provider.useClass, \"resolve\");\n\n await this.injector.runInContext($ctx, async () => {\n try {\n const resolver = new AnyToPromise();\n const handler = await promisedHandler;\n const {state, data, status, headers} = await resolver.call(() => handler({$ctx}));\n if (state === AnyToPromiseStatus.RESOLVED) {\n if (status) {\n $ctx.response.status(status);\n }\n\n if (headers) {\n $ctx.response.setHeaders(headers);\n }\n\n if (data !== undefined) {\n $ctx.data = data;\n\n return await this.flush($ctx.data, $ctx);\n }\n\n next();\n }\n } catch (er) {\n next(er);\n }\n });\n };\n }\n\n private async flush(data: any, $ctx: PlatformContext) {\n const {response} = $ctx;\n\n if (!response.isDone()) {\n setResponseHeaders($ctx);\n\n data = await this.responseFilter.serialize(data, $ctx);\n data = await this.responseFilter.transform(data, $ctx);\n\n response.body(data);\n }\n\n return response;\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ let AlterHost = class AlterHost {
|
|
|
8
8
|
return `${ctx.request.protocol}://${ctx.request.host}${baseUrl}`;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
AlterHost =
|
|
11
|
+
AlterHost = tslib_1.__decorate([
|
|
12
12
|
(0, alter_1.Alter)("host")
|
|
13
13
|
], AlterHost);
|
|
14
14
|
exports.AlterHost = AlterHost;
|
|
@@ -17,15 +17,15 @@ let AlterSkip = class AlterSkip {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
tslib_1.__decorate([
|
|
21
21
|
(0, common_1.Constant)("formio.baseUrl", "/"),
|
|
22
|
-
|
|
22
|
+
tslib_1.__metadata("design:type", String)
|
|
23
23
|
], AlterSkip.prototype, "baseUrl", void 0);
|
|
24
|
-
|
|
24
|
+
tslib_1.__decorate([
|
|
25
25
|
(0, common_1.Constant)("formio.whiteList", ["/spec.json"]),
|
|
26
|
-
|
|
26
|
+
tslib_1.__metadata("design:type", Array)
|
|
27
27
|
], AlterSkip.prototype, "whiteList", void 0);
|
|
28
|
-
AlterSkip =
|
|
28
|
+
AlterSkip = tslib_1.__decorate([
|
|
29
29
|
(0, alter_1.Alter)("skip")
|
|
30
30
|
], AlterSkip);
|
|
31
31
|
exports.AlterSkip = AlterSkip;
|
|
@@ -6,7 +6,7 @@ const core_1 = require("@tsed/core");
|
|
|
6
6
|
const di_1 = require("@tsed/di");
|
|
7
7
|
const alter_1 = require("../decorators/alter");
|
|
8
8
|
const FormioDatabase_1 = require("../services/FormioDatabase");
|
|
9
|
-
const async_1 =
|
|
9
|
+
const async_1 = tslib_1.__importDefault(require("async"));
|
|
10
10
|
let AlterTemplateExportSteps = class AlterTemplateExportSteps {
|
|
11
11
|
transform(queue, template, map, options) {
|
|
12
12
|
queue.push(async_1.default.apply(this.exportSubmissions.bind(this), template, map, options));
|
|
@@ -41,11 +41,11 @@ let AlterTemplateExportSteps = class AlterTemplateExportSteps {
|
|
|
41
41
|
}, {});
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
tslib_1.__decorate([
|
|
45
45
|
(0, di_1.Inject)(),
|
|
46
|
-
|
|
46
|
+
tslib_1.__metadata("design:type", FormioDatabase_1.FormioDatabase)
|
|
47
47
|
], AlterTemplateExportSteps.prototype, "database", void 0);
|
|
48
|
-
AlterTemplateExportSteps =
|
|
48
|
+
AlterTemplateExportSteps = tslib_1.__decorate([
|
|
49
49
|
(0, alter_1.Alter)("templateExportSteps")
|
|
50
50
|
], AlterTemplateExportSteps);
|
|
51
51
|
exports.AlterTemplateExportSteps = AlterTemplateExportSteps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateExportSteps.ts"],"names":[],"mappings":";;;;AAAA,qCAAoC;AACpC,iCAAgC;AAGhC,+CAA0C;AAI1C,+DAA0D;AAC1D
|
|
1
|
+
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateExportSteps.ts"],"names":[],"mappings":";;;;AAAA,qCAAoC;AACpC,iCAAgC;AAGhC,+CAA0C;AAI1C,+DAA0D;AAC1D,0DAA0B;AAG1B,IAAa,wBAAwB,GAArC,MAAa,wBAAwB;IAInC,SAAS,CAAC,KAAY,EAAE,QAAwB,EAAE,GAAQ,EAAE,OAAY;QACtE,KAAK,CAAC,IAAI,CAAC,eAAK,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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zC,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,IAAA,WAAM,GAAE;sCACW,+BAAc;0DAAC;AAFxB,wBAAwB;IADpC,IAAA,aAAK,EAAC,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\";\nimport async from \"async\";\n\n@Alter(\"templateExportSteps\")\nexport class AlterTemplateExportSteps implements AlterHook {\n @Inject()\n protected database: FormioDatabase;\n\n transform(queue: any[], template: FormioTemplate, map: any, options: any): any {\n queue.push(async.apply(this.exportSubmissions.bind(this), template, map, options));\n\n return queue;\n }\n\n protected async exportSubmissions(template: FormioTemplate, map: any, options: any, next: any) {\n const [mapper, submissions] = await Promise.all([\n this.database.getFormioMapper(),\n this.database.submissionModel.find({\n deleted: {$eq: null}\n })\n ]);\n\n template.submissions = await this.mapSubmissions(submissions, mapper);\n\n next(null, template);\n }\n\n protected mapSubmissions(submissions: MongooseDocument<FormioSubmission>[], mapper: FormioMapper) {\n return submissions\n .map((submission) => submission.toObject())\n .reduce((acc: any, {_id, created, updated, modified, __v, owner, roles, form, metadata, ...submission}) => {\n const machineName = mapper.mapToExport(form.toString());\n const key = machineName.replace(\"$machineName:\", \"\");\n\n acc[key] = getValue(acc, key, []);\n\n acc[key].push({\n ...submission,\n created: created && created.toString(),\n modified: modified && modified.toString(),\n data: mapper.mapToExport(submission.data),\n roles: mapper.mapToExport(roles).filter(Boolean),\n form: mapper.mapToExport(form)\n });\n\n return acc;\n }, {});\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const di_1 = require("@tsed/di");
|
|
6
6
|
const alter_1 = require("../decorators/alter");
|
|
7
7
|
const FormioDatabase_1 = require("../services/FormioDatabase");
|
|
8
|
-
const async_1 =
|
|
8
|
+
const async_1 = tslib_1.__importDefault(require("async"));
|
|
9
9
|
let AlterTemplateImportSteps = class AlterTemplateImportSteps {
|
|
10
10
|
transform(queue, install, template) {
|
|
11
11
|
queue.push(async_1.default.apply(this.importSubmissions.bind(this), template));
|
|
@@ -34,11 +34,11 @@ let AlterTemplateImportSteps = class AlterTemplateImportSteps {
|
|
|
34
34
|
return value;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
tslib_1.__decorate([
|
|
38
38
|
(0, di_1.Inject)(),
|
|
39
|
-
|
|
39
|
+
tslib_1.__metadata("design:type", FormioDatabase_1.FormioDatabase)
|
|
40
40
|
], AlterTemplateImportSteps.prototype, "database", void 0);
|
|
41
|
-
AlterTemplateImportSteps =
|
|
41
|
+
AlterTemplateImportSteps = tslib_1.__decorate([
|
|
42
42
|
(0, alter_1.Alter)("templateImportSteps")
|
|
43
43
|
], AlterTemplateImportSteps);
|
|
44
44
|
exports.AlterTemplateImportSteps = AlterTemplateImportSteps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateImportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateImportSteps.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAEhC,+CAA0C;AAI1C,+DAA0D;AAC1D
|
|
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C,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,IAAA,WAAM,GAAE;sCACW,+BAAc;0DAAC;AAFxB,wBAAwB;IADpC,IAAA,aAAK,EAAC,qBAAqB,CAAC;GAChB,wBAAwB,CAsCpC;AAtCY,4DAAwB","sourcesContent":["import {Inject} from \"@tsed/di\";\nimport {FormioMapper} from \"../builder/FormioMapper\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {FormioSubmission} from \"../domain/FormioModels\";\nimport {FormioTemplate} from \"../domain/FormioTemplate\";\nimport {FormioDatabase} from \"../services/FormioDatabase\";\nimport async from \"async\";\n\n@Alter(\"templateImportSteps\")\nexport class AlterTemplateImportSteps implements AlterHook {\n @Inject()\n protected database: FormioDatabase;\n\n transform(queue: any[], install: Function, template: Partial<FormioTemplate>): any {\n queue.push(async.apply(this.importSubmissions.bind(this), template));\n\n return queue;\n }\n\n protected async importSubmissions(template: Partial<FormioTemplate>, done: any) {\n if (template && template.submissions) {\n // clean all submissions\n await this.database.submissionModel.deleteMany({});\n\n const ctxData = await this.database.getFormioMapper();\n const entries = Object.entries(template.submissions);\n\n for (const entry of entries) {\n for (const submission of entry[1]) {\n await this.importSubmission({...submission, form: submission.form || entry[0]}, ctxData);\n }\n }\n }\n\n done();\n }\n\n protected async importSubmission(submission: Partial<FormioSubmission>, mapper: FormioMapper) {\n const value = {\n ...mapper.mapToImport(submission),\n roles: [...new Set(mapper.mapToImport(submission.roles || []))].filter(Boolean)\n };\n\n await this.database.submissionModel.create(value);\n\n return value;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioHooks.js","sourceRoot":"","sources":["../../../src/domain/FormioHooks.ts"],"names":[],"mappings":"","sourcesContent":["import {MongooseDocument} from \"@tsed/mongoose\";\nimport {Request} from \"express\";\nimport {FilterQuery, Schema, SchemaDefinition} from \"mongoose\";\nimport {Formio} from \"./Formio\";\nimport {FormioActions} from \"./FormioActionsIndex\";\nimport {FormioConfig} from \"./FormioConfig\";\nimport {FormioDecodedToken} from \"./FormioDecodedToken\";\nimport {FormioJs} from \"./FormioJs\";\nimport {FormioActionItem, FormioForm, FormioModelsModels, FormioSubmission} from \"./FormioModels\";\nimport {FormioSettings} from \"./FormioSettings\";\nimport {ResourceRestOptions} from \"./Resource\";\n\nexport type FormioInitEvent = \"alias\" | \"params\" | \"token\" | \"getTempToken\" | \"logout\" | \"current\" | \"access\" | \"perms\";\n\nexport interface FormioHooks {\n settings?: (settings: FormioSettings, req: Request, cb: Function) => FormioSettings;\n alter?: {\n alias?: (alias: string, req: Request, res: Response) => string;\n /**\n * Alter FormioJs configuration\n * @param formIo\n */\n configFormio?: (formIo: {Formio: FormioJs}) => void;\n /**\n * Alter formio server configuration.\n * @param config\n */\n updateConfig?: (config: FormioConfig) => FormioConfig;\n /**\n * Alter audit log.\n * @param info\n * @param event\n * @param req\n */\n audit?: (info: any[], event: string, req: Request) => void;\n /**\n * Alter log.\n * @param info\n * @param event\n * @param req\n */\n log?: (event: string, req: Request, ...info: string[]) => void;\n /**\n * Alter available actions\n * @param info\n * @param event\n * @param req\n */\n actions?: (actions: FormioActions) => FormioActions;\n /**\n * Skip auth for the current request.\n * @param info\n * @param event\n * @param req\n */\n skip?: (value: boolean, req: Request) => boolean;\n /**\n * Resolve host.\n * @param baseUrl\n * @param req\n */\n host?: (baseUrl: string, req: Request) => string;\n /**\n * `/form/${req.params.formId}/action`\n * @param action\n * @param req\n */\n path?: (path: string, req: Request) => any;\n /**\n * Restrict request types\n * @param methods\n */\n methods?: (methods: string[]) => string[];\n /**\n * Return the cors configuration.\n */\n cors?: () => Record<string, any>;\n /**\n * Return the current user submission.\n */\n currentUser?: (user: any) => any;\n /**\n * Alter current form.\n * @param form\n */\n currentForm?: (form: FormioForm) => FormioForm;\n /**\n * Alter formio\n * @param formio\n */\n formio?: (formio: Formio) => Formio;\n /**\n * Alter models\n * @param models\n */\n models?: (models: FormioModelsModels) => FormioModelsModels;\n /**\n * Alter resources\n * @param resources\n */\n resources?: (resources: {form: any; submission: any; role: any}) => any;\n\n resourceAccessFilter?: (search: any, req: Request, done: (err: unknown, newSearch: any) => void) => void;\n\n // machineName\n actionMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n formMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n roleMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n\n // schemas\n actionSchema?: (schema: Schema) => Schema;\n actionItemSchema?: (schema: Schema) => Schema;\n formSchema?: (schema: Schema) => Schema;\n roleSchema?: (schema: Schema) => Schema;\n schemaSchema?: (schema: Schema) => Schema;\n submissionSchema?: (schema: Schema | SchemaDefinition) => Schema;\n tokenSchema?: (schema: Schema) => Schema;\n permissionSchema?: (schema: SchemaDefinition) => SchemaDefinition;\n fieldMatchAccessPermissionSchema?: (schemaOptions: SchemaDefinition) => SchemaDefinition;\n\n // query\n actionsQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n submissionQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n roleQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n formQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n\n // Data\n actionItem?: (actionItem: FormioActionItem, req: Request) => FormioActionItem;\n actionContext?: (actionContext: any, req: Request) => any;\n actionInfo?: (action: any, req: Request) => any;\n\n // submission\n submission?: (req: Request, res: Response, done: Function) => void;\n submissionRequest?: (submission: FormioSubmission) => FormioSubmission;\n validateSubmissionForm?: (form: FormioForm, submission: FormioSubmission, done: Function) => void;\n postSubmissionUpdate?: (req: Request, res: Response, submissionUpdate: FormioSubmission) => void;\n\n // response\n /**\n * Allow modules to hook into the form loader middleware.\n * @param item\n * @param req\n * @param done\n */\n formResponse?: (item: any, req: Request, done: Function) => void;\n\n // params\n requestParams?: (req: Request & {formId: string; subId: string; roleId: string}, params: Record<string, any>) => void;\n /**\n * Alter submitted params\n * @param params\n */\n submissionParams?: (params: string[]) => string[];\n\n // Routes\n /**\n * Alter actions routes.\n */\n actionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter roles routes.\n */\n rolesRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter forms routes.\n */\n formRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter submission routes.\n */\n submissionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n\n // Auth\n user?: (user: any, done: (err: any, user: any) => void) => void;\n login?: (user: any, req: Request, done: (err: any) => void) => void;\n token?: (token: FormioDecodedToken, form: FormioForm, req: Request) => FormioDecodedToken;\n tokenDecode?: (token: FormioDecodedToken, req: Request, done: (err: any, decoded: FormioDecodedToken) => void) => void;\n submissionRequestTokenQuery?: (query: {formId: string; submissionId: string}, token: string) => any;\n\n [key: string]: any;\n };\n on?: {\n init?: (type: FormioInitEvent) => boolean;\n [key: string]: any;\n };\n}\n\nexport interface FormioHook {\n /**\n * Run settings function.\n */\n settings(req: Request, cb: Function): void;\n\n /**\n * Emit an event.\n * @param args\n */\n invoke<T = any>(...args: any[]): T | boolean;\n\n /**\n * Alter the given value by calling all listener.\n * @param event\n * @param args\n */\n alter(event: string, ...args: any[]): any;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FormioHooks.js","sourceRoot":"","sources":["../../../src/domain/FormioHooks.ts"],"names":[],"mappings":"","sourcesContent":["import {MongooseDocument} from \"@tsed/mongoose\";\nimport {Request, Response} from \"express\";\nimport {FilterQuery, Schema, SchemaDefinition} from \"mongoose\";\nimport {Formio} from \"./Formio\";\nimport {FormioActions} from \"./FormioActionsIndex\";\nimport {FormioConfig} from \"./FormioConfig\";\nimport {FormioDecodedToken} from \"./FormioDecodedToken\";\nimport {FormioJs} from \"./FormioJs\";\nimport {FormioActionItem, FormioForm, FormioModelsModels, FormioSubmission} from \"./FormioModels\";\nimport {FormioSettings} from \"./FormioSettings\";\nimport {ResourceRestOptions} from \"./Resource\";\n\nexport type FormioInitEvent = \"alias\" | \"params\" | \"token\" | \"getTempToken\" | \"logout\" | \"current\" | \"access\" | \"perms\";\n\nexport interface FormioHooks {\n settings?: (settings: FormioSettings, req: Request, cb: Function) => FormioSettings;\n alter?: {\n alias?: (alias: string, req: Request, res: Response) => string;\n /**\n * Alter FormioJs configuration\n * @param formIo\n */\n configFormio?: (formIo: {Formio: FormioJs}) => void;\n /**\n * Alter formio server configuration.\n * @param config\n */\n updateConfig?: (config: FormioConfig) => FormioConfig;\n /**\n * Alter audit log.\n * @param info\n * @param event\n * @param req\n */\n audit?: (info: any[], event: string, req: Request) => void;\n /**\n * Alter log.\n * @param info\n * @param event\n * @param req\n */\n log?: (event: string, req: Request, ...info: string[]) => void;\n /**\n * Alter available actions\n * @param info\n * @param event\n * @param req\n */\n actions?: (actions: FormioActions) => FormioActions;\n /**\n * Skip auth for the current request.\n * @param info\n * @param event\n * @param req\n */\n skip?: (value: boolean, req: Request) => boolean;\n /**\n * Resolve host.\n * @param baseUrl\n * @param req\n */\n host?: (baseUrl: string, req: Request) => string;\n /**\n * `/form/${req.params.formId}/action`\n * @param action\n * @param req\n */\n path?: (path: string, req: Request) => any;\n /**\n * Restrict request types\n * @param methods\n */\n methods?: (methods: string[]) => string[];\n /**\n * Return the cors configuration.\n */\n cors?: () => Record<string, any>;\n /**\n * Return the current user submission.\n */\n currentUser?: (user: any) => any;\n /**\n * Alter current form.\n * @param form\n */\n currentForm?: (form: FormioForm) => FormioForm;\n /**\n * Alter formio\n * @param formio\n */\n formio?: (formio: Formio) => Formio;\n /**\n * Alter models\n * @param models\n */\n models?: (models: FormioModelsModels) => FormioModelsModels;\n /**\n * Alter resources\n * @param resources\n */\n resources?: (resources: {form: any; submission: any; role: any}) => any;\n\n resourceAccessFilter?: (search: any, req: Request, done: (err: unknown, newSearch: any) => void) => void;\n\n // machineName\n actionMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n formMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n roleMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;\n\n // schemas\n actionSchema?: (schema: Schema) => Schema;\n actionItemSchema?: (schema: Schema) => Schema;\n formSchema?: (schema: Schema) => Schema;\n roleSchema?: (schema: Schema) => Schema;\n schemaSchema?: (schema: Schema) => Schema;\n submissionSchema?: (schema: Schema | SchemaDefinition) => Schema;\n tokenSchema?: (schema: Schema) => Schema;\n permissionSchema?: (schema: SchemaDefinition) => SchemaDefinition;\n fieldMatchAccessPermissionSchema?: (schemaOptions: SchemaDefinition) => SchemaDefinition;\n\n // query\n actionsQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n submissionQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n roleQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n formQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;\n\n // Data\n actionItem?: (actionItem: FormioActionItem, req: Request) => FormioActionItem;\n actionContext?: (actionContext: any, req: Request) => any;\n actionInfo?: (action: any, req: Request) => any;\n\n // submission\n submission?: (req: Request, res: Response, done: Function) => void;\n submissionRequest?: (submission: FormioSubmission) => FormioSubmission;\n validateSubmissionForm?: (form: FormioForm, submission: FormioSubmission, done: Function) => void;\n postSubmissionUpdate?: (req: Request, res: Response, submissionUpdate: FormioSubmission) => void;\n\n // response\n /**\n * Allow modules to hook into the form loader middleware.\n * @param item\n * @param req\n * @param done\n */\n formResponse?: (item: any, req: Request, done: Function) => void;\n\n // params\n requestParams?: (req: Request & {formId: string; subId: string; roleId: string}, params: Record<string, any>) => void;\n /**\n * Alter submitted params\n * @param params\n */\n submissionParams?: (params: string[]) => string[];\n\n // Routes\n /**\n * Alter actions routes.\n */\n actionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter roles routes.\n */\n rolesRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter forms routes.\n */\n formRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n /**\n * Alter submission routes.\n */\n submissionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;\n\n // Auth\n user?: (user: any, done: (err: any, user: any) => void) => void;\n login?: (user: any, req: Request, done: (err: any) => void) => void;\n token?: (token: FormioDecodedToken, form: FormioForm, req: Request) => FormioDecodedToken;\n tokenDecode?: (token: FormioDecodedToken, req: Request, done: (err: any, decoded: FormioDecodedToken) => void) => void;\n submissionRequestTokenQuery?: (query: {formId: string; submissionId: string}, token: string) => any;\n\n [key: string]: any;\n };\n on?: {\n init?: (type: FormioInitEvent) => boolean;\n [key: string]: any;\n };\n}\n\nexport interface FormioHook {\n /**\n * Run settings function.\n */\n settings(req: Request, cb: Function): void;\n\n /**\n * Emit an event.\n * @param args\n */\n invoke<T = any>(...args: any[]): T | boolean;\n\n /**\n * Alter the given value by calling all listener.\n * @param event\n * @param args\n */\n alter(event: string, ...args: any[]): any;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
4
|
+
tslib_1.__exportStar(require("@tsed/formio-types"), exports);
|
|
5
5
|
//# sourceMappingURL=FormioModels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioModels.js","sourceRoot":"","sources":["../../../src/domain/FormioModels.ts"],"names":[],"mappings":";;;AAMA,
|
|
1
|
+
{"version":3,"file":"FormioModels.js","sourceRoot":"","sources":["../../../src/domain/FormioModels.ts"],"names":[],"mappings":";;;AAMA,6DAAmC","sourcesContent":["import {MongooseDocument} from \"@tsed/mongoose\";\nimport {Schema} from \"mongoose\";\nimport {FormioActionModelCtor, FormioActionMongooseSchema} from \"./FormioAction\";\nimport {FormioBaseModel, FormioModel, FormioMongooseSchema} from \"./FormioBaseModel\";\nimport {FormioActionItem, FormioForm, FormioRole, FormioSchema, FormioSubmission, FormioToken} from \"@tsed/formio-types\";\n\nexport * from \"@tsed/formio-types\";\n\nexport type WithID<T> = T & {_id: string};\n\nexport interface FormioSchemas {\n action: FormioActionMongooseSchema;\n actionItem: Schema<MongooseDocument<FormioActionItem>>;\n form: FormioMongooseSchema<FormioForm>;\n role: FormioMongooseSchema<FormioRole>;\n schema: Schema<MongooseDocument<FormioSchema>>;\n submission: Schema<MongooseDocument<FormioSubmission>>;\n token: Schema<MongooseDocument<FormioToken>>;\n\n [key: string]: Schema<MongooseDocument<any>>;\n}\n\nexport type FormioModelsModels = {\n action: FormioActionModelCtor;\n actionItem: FormioBaseModel<FormioActionItem>;\n form: FormioModel<FormioForm>;\n role: FormioModel<FormioRole>;\n schema: FormioBaseModel<FormioSchema>;\n submission: FormioBaseModel<FormioSubmission>;\n token: FormioBaseModel<FormioToken>;\n} & Record<string, FormioBaseModel>;\n\nexport interface FormioModels {\n schemas: FormioSchemas;\n models: FormioModelsModels;\n specs: {\n action: any;\n actionItem: any;\n form: any;\n role: any;\n schema: any;\n submission: any;\n token: any;\n\n [key: string]: any;\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../../../src/domain/Resource.ts"],"names":[],"mappings":"","sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../../../src/domain/Resource.ts"],"names":[],"mappings":"","sourcesContent":["import {Request, Response, NextFunction} from \"express\";\n\nexport type ResourceHttpHandler = (req: Request, res: Response, next: NextFunction) => void;\n\nexport interface ResourceHttpMethodOptions {\n before?: ResourceHttpHandler;\n after?: ResourceHttpHandler;\n}\n\nexport interface ResourceRestOptions extends ResourceHttpMethodOptions {\n beforePut?: ResourceHttpHandler;\n beforePatch?: ResourceHttpHandler;\n beforePost?: ResourceHttpHandler;\n beforeIndex?: ResourceHttpHandler;\n beforeGet?: ResourceHttpHandler;\n afterPut?: ResourceHttpHandler;\n afterPatch?: ResourceHttpHandler;\n afterPost?: ResourceHttpHandler;\n afterIndex?: ResourceHttpHandler;\n afterGet?: ResourceHttpHandler;\n}\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,47 +4,47 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
7
|
+
tslib_1.__exportStar(require("./FormioModule"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./builder/FormioMapper"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./components/AlterActions"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./components/AlterAudit"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./components/AlterHost"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./components/AlterLog"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./components/AlterSkip"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./components/AlterTemplateExportSteps"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./components/AlterTemplateImportSteps"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./decorators/action"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./decorators/actionCtx"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./decorators/alter"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./decorators/on"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./decorators/useFormioAuth"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./domain/AlterHook"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./domain/Formio"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./domain/FormioAction"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./domain/FormioActionsIndex"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./domain/FormioAuth"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./domain/FormioBaseModel"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./domain/FormioConfig"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./domain/FormioCtxMapper"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./domain/FormioDecodedToken"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./domain/FormioErrors"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./domain/FormioHooks"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./domain/FormioJs"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./domain/FormioModels"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./domain/FormioRouter"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./domain/FormioSettings"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./domain/FormioTemplate"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./domain/FormioTemplateUtil"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./domain/FormioUpdate"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./domain/FormioUtils"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./domain/OnHook"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./domain/Resource"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./middlewares/FormioAuthMiddleware"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./services/FormioAuthService"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./services/FormioDatabase"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./services/FormioHooksService"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./services/FormioInstaller"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./services/FormioRepository"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./services/FormioService"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./utils/isMongoId"), exports);
|
|
50
50
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,yDAA+B;AAC/B,iEAAuC;AACvC,oEAA0C;AAC1C,kEAAwC;AACxC,iEAAuC;AACvC,gEAAsC;AACtC,iEAAuC;AACvC,gFAAsD;AACtD,gFAAsD;AACtD,8DAAoC;AACpC,iEAAuC;AACvC,6DAAmC;AACnC,0DAAgC;AAChC,qEAA2C;AAC3C,6DAAmC;AACnC,0DAAgC;AAChC,gEAAsC;AACtC,sEAA4C;AAC5C,8DAAoC;AACpC,mEAAyC;AACzC,gEAAsC;AACtC,mEAAyC;AACzC,sEAA4C;AAC5C,gEAAsC;AACtC,+DAAqC;AACrC,4DAAkC;AAClC,gEAAsC;AACtC,gEAAsC;AACtC,kEAAwC;AACxC,kEAAwC;AACxC,sEAA4C;AAC5C,gEAAsC;AACtC,+DAAqC;AACrC,0DAAgC;AAChC,4DAAkC;AAClC,6EAAmD;AACnD,uEAA6C;AAC7C,oEAA0C;AAC1C,wEAA8C;AAC9C,qEAA2C;AAC3C,sEAA4C;AAC5C,mEAAyC;AACzC,4DAAkC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./FormioModule\";\nexport * from \"./builder/FormioMapper\";\nexport * from \"./components/AlterActions\";\nexport * from \"./components/AlterAudit\";\nexport * from \"./components/AlterHost\";\nexport * from \"./components/AlterLog\";\nexport * from \"./components/AlterSkip\";\nexport * from \"./components/AlterTemplateExportSteps\";\nexport * from \"./components/AlterTemplateImportSteps\";\nexport * from \"./decorators/action\";\nexport * from \"./decorators/actionCtx\";\nexport * from \"./decorators/alter\";\nexport * from \"./decorators/on\";\nexport * from \"./decorators/useFormioAuth\";\nexport * from \"./domain/AlterHook\";\nexport * from \"./domain/Formio\";\nexport * from \"./domain/FormioAction\";\nexport * from \"./domain/FormioActionsIndex\";\nexport * from \"./domain/FormioAuth\";\nexport * from \"./domain/FormioBaseModel\";\nexport * from \"./domain/FormioConfig\";\nexport * from \"./domain/FormioCtxMapper\";\nexport * from \"./domain/FormioDecodedToken\";\nexport * from \"./domain/FormioErrors\";\nexport * from \"./domain/FormioHooks\";\nexport * from \"./domain/FormioJs\";\nexport * from \"./domain/FormioModels\";\nexport * from \"./domain/FormioRouter\";\nexport * from \"./domain/FormioSettings\";\nexport * from \"./domain/FormioTemplate\";\nexport * from \"./domain/FormioTemplateUtil\";\nexport * from \"./domain/FormioUpdate\";\nexport * from \"./domain/FormioUtils\";\nexport * from \"./domain/OnHook\";\nexport * from \"./domain/Resource\";\nexport * from \"./middlewares/FormioAuthMiddleware\";\nexport * from \"./services/FormioAuthService\";\nexport * from \"./services/FormioDatabase\";\nexport * from \"./services/FormioHooksService\";\nexport * from \"./services/FormioInstaller\";\nexport * from \"./services/FormioRepository\";\nexport * from \"./services/FormioService\";\nexport * from \"./utils/isMongoId\";\n"]}
|
|
@@ -24,17 +24,17 @@ let FormioAuthMiddleware = class FormioAuthMiddleware {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
tslib_1.__decorate([
|
|
28
28
|
(0, common_1.Inject)(),
|
|
29
|
-
|
|
29
|
+
tslib_1.__metadata("design:type", FormioService_1.FormioService)
|
|
30
30
|
], FormioAuthMiddleware.prototype, "formio", void 0);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
tslib_1.__param(0, (0, common_1.Context)()),
|
|
33
|
+
tslib_1.__metadata("design:type", Function),
|
|
34
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
35
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
36
36
|
], FormioAuthMiddleware.prototype, "use", null);
|
|
37
|
-
FormioAuthMiddleware =
|
|
37
|
+
FormioAuthMiddleware = tslib_1.__decorate([
|
|
38
38
|
(0, common_1.Middleware)()
|
|
39
39
|
], FormioAuthMiddleware);
|
|
40
40
|
exports.FormioAuthMiddleware = FormioAuthMiddleware;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioAuthMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/FormioAuthMiddleware.ts"],"names":[],"mappings":";;;;AAAA,yCAAyD;AACzD,qCAAoC;AACpC,iDAA8C;AAC9C,+BAA+B;AAC/B,6DAAwD;AAExD;;;GAGG;AAEH,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAI/B,IAAI,YAAY;QACd,OAAO,IAAA,gBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,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AA;;;;+CASnB;AAjBU,oBAAoB;IADhC,IAAA,mBAAU,GAAE;GACA,oBAAoB,CAkBhC;AAlBY,oDAAoB","sourcesContent":["import {Context, Inject, Middleware} from \"@tsed/common\";\nimport {getValue} from \"@tsed/core\";\nimport {Unauthorized} from \"@tsed/exceptions\";\nimport {promisify} from \"util\";\nimport {FormioService} from \"../services/FormioService\";\n\n/**\n * @middleware\n * @formio\n */\n@Middleware()\nexport class FormioAuthMiddleware {\n @Inject()\n protected formio: FormioService;\n\n get tokenHandler(): any {\n return promisify(this.formio.middleware.tokenHandler);\n }\n\n async use(@Context() ctx: Context) {\n const req = ctx.getRequest();\n const res = ctx.getResponse();\n\n await this.tokenHandler(req, res);\n\n if (!getValue(req, \"token.user._id\")) {\n throw new Unauthorized(\"User unauthorized\");\n }\n }\n}\n"]}
|
|
@@ -163,19 +163,19 @@ let FormioAuthService = class FormioAuthService {
|
|
|
163
163
|
return user;
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
-
|
|
166
|
+
tslib_1.__decorate([
|
|
167
167
|
(0, di_1.Inject)(),
|
|
168
|
-
|
|
168
|
+
tslib_1.__metadata("design:type", FormioService_1.FormioService)
|
|
169
169
|
], FormioAuthService.prototype, "formio", void 0);
|
|
170
|
-
|
|
170
|
+
tslib_1.__decorate([
|
|
171
171
|
(0, di_1.Inject)(),
|
|
172
|
-
|
|
172
|
+
tslib_1.__metadata("design:type", FormioHooksService_1.FormioHooksService)
|
|
173
173
|
], FormioAuthService.prototype, "hooks", void 0);
|
|
174
|
-
|
|
174
|
+
tslib_1.__decorate([
|
|
175
175
|
(0, di_1.Inject)(),
|
|
176
|
-
|
|
176
|
+
tslib_1.__metadata("design:type", FormioDatabase_1.FormioDatabase)
|
|
177
177
|
], FormioAuthService.prototype, "db", void 0);
|
|
178
|
-
FormioAuthService =
|
|
178
|
+
FormioAuthService = tslib_1.__decorate([
|
|
179
179
|
(0, di_1.Injectable)()
|
|
180
180
|
], FormioAuthService);
|
|
181
181
|
exports.FormioAuthService = FormioAuthService;
|