@tsed/formio 6.102.2 → 6.102.6
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/cjs/components/AlterTemplateExportSteps.js +2 -2
- package/lib/cjs/components/AlterTemplateExportSteps.js.map +1 -1
- package/lib/cjs/components/AlterTemplateImportSteps.js +2 -2
- package/lib/cjs/components/AlterTemplateImportSteps.js.map +1 -1
- package/lib/cjs/services/FormioService.js +10 -7
- package/lib/cjs/services/FormioService.js.map +1 -1
- package/lib/esm/components/AlterTemplateExportSteps.js +1 -1
- package/lib/esm/components/AlterTemplateExportSteps.js.map +1 -1
- package/lib/esm/components/AlterTemplateImportSteps.js +1 -1
- package/lib/esm/components/AlterTemplateImportSteps.js.map +1 -1
- package/lib/esm/services/FormioService.js +6 -3
- package/lib/esm/services/FormioService.js.map +1 -1
- package/package.json +11 -10
|
@@ -6,10 +6,10 @@ 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
|
|
9
|
+
const async_1 = (0, tslib_1.__importDefault)(require("async"));
|
|
10
10
|
let AlterTemplateExportSteps = class AlterTemplateExportSteps {
|
|
11
11
|
transform(queue, template, map, options) {
|
|
12
|
-
queue.push(
|
|
12
|
+
queue.push(async_1.default.apply(this.exportSubmissions.bind(this), template, map, options));
|
|
13
13
|
return queue;
|
|
14
14
|
}
|
|
15
15
|
async exportSubmissions(template, map, options, next) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateExportSteps.ts"],"names":[],"mappings":";;;;AAAA,qCAAoC;AACpC,iCAAgC;AAGhC,+CAA0C;AAI1C,+DAA0D;
|
|
1
|
+
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../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,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,IAAA,eAAQ,EAAC,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,IAAA,WAAM,GAAE;2CACW,+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,10 +5,10 @@ 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
|
|
8
|
+
const async_1 = (0, tslib_1.__importDefault)(require("async"));
|
|
9
9
|
let AlterTemplateImportSteps = class AlterTemplateImportSteps {
|
|
10
10
|
transform(queue, install, template) {
|
|
11
|
-
queue.push(
|
|
11
|
+
queue.push(async_1.default.apply(this.importSubmissions.bind(this), template));
|
|
12
12
|
return queue;
|
|
13
13
|
}
|
|
14
14
|
async importSubmissions(template, done) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateImportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateImportSteps.ts"],"names":[],"mappings":";;;;AAAA,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WAAW,CAAC,UAAU,CAAC;YACjC,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;SAChF,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AApCC;IADC,IAAA,WAAM,GAAE;2CACW,+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"]}
|
|
@@ -4,9 +4,12 @@ exports.FormioService = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@tsed/common");
|
|
6
6
|
const util_1 = require("util");
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const formio_1 = (0, tslib_1.__importDefault)(require("formio"));
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const swagger_js_1 = (0, tslib_1.__importDefault)(require("formio/src/util/swagger.js"));
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
const util_js_1 = (0, tslib_1.__importDefault)(require("formio/src/util/util.js"));
|
|
10
13
|
let FormioService = class FormioService {
|
|
11
14
|
get audit() {
|
|
12
15
|
return this.formio.audit || (() => { });
|
|
@@ -16,7 +19,7 @@ let FormioService = class FormioService {
|
|
|
16
19
|
}
|
|
17
20
|
// istanbul ignore next
|
|
18
21
|
get swagger() {
|
|
19
|
-
return (...args) => new Promise((resolve) =>
|
|
22
|
+
return (...args) => new Promise((resolve) => (0, swagger_js_1.default)(...args, resolve));
|
|
20
23
|
}
|
|
21
24
|
get config() {
|
|
22
25
|
return this.formio.config;
|
|
@@ -65,7 +68,7 @@ let FormioService = class FormioService {
|
|
|
65
68
|
}
|
|
66
69
|
// istanbul ignore next
|
|
67
70
|
createRouter(options) {
|
|
68
|
-
return
|
|
71
|
+
return (0, formio_1.default)(options);
|
|
69
72
|
}
|
|
70
73
|
init(options, hooks = {}) {
|
|
71
74
|
if (options && Object.keys(options).length) {
|
|
@@ -85,8 +88,8 @@ let FormioService = class FormioService {
|
|
|
85
88
|
}
|
|
86
89
|
bindLogger() {
|
|
87
90
|
const { injector } = this;
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
util_js_1.default.log = injector.logger.info.bind(injector.logger);
|
|
92
|
+
util_js_1.default.error = injector.logger.error.bind(injector.logger);
|
|
90
93
|
}
|
|
91
94
|
};
|
|
92
95
|
(0, tslib_1.__decorate)([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormioService.js","sourceRoot":"","sources":["../../../src/services/FormioService.ts"],"names":[],"mappings":";;;;AAAA,yCAAiE;AAIjE,+BAA+B;
|
|
1
|
+
{"version":3,"file":"FormioService.js","sourceRoot":"","sources":["../../../src/services/FormioService.ts"],"names":[],"mappings":";;;;AAAA,yCAAiE;AAIjE,+BAA+B;AAQ/B,aAAa;AACb,iEAAkC;AAClC,aAAa;AACb,yFAAiD;AACjD,aAAa;AACb,mFAA2C;AAG3C,IAAa,aAAa,GAA1B,MAAa,aAAa;IAMxB,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,uBAAuB;IACvB,IAAI,OAAO;QACT,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,oBAAO,EAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAChC,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAA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,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,UAAU,EAAE,CAAC;YAElB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAChC;IACH,CAAC;IAES,gBAAgB,CAAC,OAAqB;QAC9C,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;QACxB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAA4B,YAAY,CAAC,CAAC;QAExF,IAAI,gBAAgB,EAAE;YACpB,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,gBAAgB,CAAC,GAAG,CAAC;YACtD,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;SACjG;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAES,UAAU;QAClB,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;QAExB,iBAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtD,iBAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF,CAAA;AA3GC;IADC,IAAA,eAAM,GAAE;2CACW,wBAAe;+CAAC;AAJzB,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CA+GzB;AA/GY,sCAAa","sourcesContent":["import {Inject, Injectable, InjectorService} from \"@tsed/common\";\nimport {MongooseConnectionOptions} from \"@tsed/mongoose\";\nimport {Db} from \"mongodb\";\nimport {Mongoose} from \"mongoose\";\nimport {promisify} from \"util\";\nimport {Formio} from \"../domain/Formio\";\nimport {FormioConfig} from \"../domain/FormioConfig\";\nimport {FormioHook, FormioHooks} from \"../domain/FormioHooks\";\nimport {FormioSchemas} from \"../domain/FormioModels\";\nimport {FormioRouter} from \"../domain/FormioRouter\";\nimport {FormioTemplate} from \"../domain/FormioTemplate\";\nimport {FormioExportOptions} from \"../domain/FormioTemplateUtil\";\n// @ts-ignore\nimport createRouter from \"formio\";\n// @ts-ignore\nimport swagger from \"formio/src/util/swagger.js\";\n// @ts-ignore\nimport util from \"formio/src/util/util.js\";\n\n@Injectable()\nexport class FormioService {\n router: FormioRouter;\n\n @Inject()\n protected injector: InjectorService;\n\n get audit(): Function {\n return this.formio.audit || (() => {});\n }\n\n get auth() {\n return this.formio.auth;\n }\n\n // istanbul ignore next\n get swagger() {\n return (...args: any[]) => new Promise((resolve) => swagger(...args, resolve));\n }\n\n get config(): FormioConfig {\n return this.formio.config;\n }\n\n get db(): Db {\n return this.formio.db;\n }\n\n get resources() {\n return this.formio.resources;\n }\n\n get mongoose(): Mongoose {\n return this.formio.mongoose;\n }\n\n get middleware() {\n return this.formio.middleware;\n }\n\n get schemas(): FormioSchemas {\n return this.formio.schemas;\n }\n\n get formio(): Formio {\n return this.router.formio as Formio;\n }\n\n get hook(): FormioHook {\n return this.formio.hook;\n }\n\n get util() {\n return this.formio.util;\n }\n\n get template() {\n return this.formio.template;\n }\n\n get Action() {\n return this.formio.Action;\n }\n\n async exportTemplate(options: Partial<FormioExportOptions> = {}): Promise<FormioTemplate> {\n return promisify(this.formio.template.export)(options);\n }\n\n async importTemplate(template: FormioTemplate): Promise<FormioTemplate> {\n return promisify(this.formio.template.import.template)(template);\n }\n\n encrypt(text: string) {\n return promisify(this.formio.encrypt)(text);\n }\n\n isInit() {\n return !!this.router;\n }\n\n // istanbul ignore next\n public createRouter(options: FormioConfig) {\n return createRouter(options);\n }\n\n public init(options: FormioConfig, hooks: FormioHooks = {}) {\n if (options && Object.keys(options).length) {\n this.router = this.createRouter(this.mapConfiguration(options));\n this.bindLogger();\n\n return this.router.init(hooks);\n }\n }\n\n protected mapConfiguration(options: FormioConfig) {\n const {injector} = this;\n const mongooseSettings = injector.settings.get<MongooseConnectionOptions>(\"mongoose.0\");\n\n if (mongooseSettings) {\n options.mongo = options.mongo || mongooseSettings.url;\n options.mongoConfig = options.mongoConfig || JSON.stringify(mongooseSettings.connectionOptions);\n }\n\n return options;\n }\n\n protected bindLogger() {\n const {injector} = this;\n\n util.log = injector.logger.info.bind(injector.logger);\n util.error = injector.logger.error.bind(injector.logger);\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { getValue } from "@tsed/core";
|
|
|
3
3
|
import { Inject } from "@tsed/di";
|
|
4
4
|
import { Alter } from "../decorators/alter";
|
|
5
5
|
import { FormioDatabase } from "../services/FormioDatabase";
|
|
6
|
-
|
|
6
|
+
import async from "async";
|
|
7
7
|
let AlterTemplateExportSteps = class AlterTemplateExportSteps {
|
|
8
8
|
transform(queue, template, map, options) {
|
|
9
9
|
queue.push(async.apply(this.exportSubmissions.bind(this), template, map, options));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateExportSteps.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AlterTemplateExportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateExportSteps.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,K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AG,GAAG,WAAW,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;YAErD,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,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,MAAM,EAAE;8BACW,cAAc;0DAAC;AAFxB,wBAAwB;IADpC,KAAK,CAAC,qBAAqB,CAAC;GAChB,wBAAwB,CA4CpC;SA5CY,wBAAwB","sourcesContent":["import {getValue} from \"@tsed/core\";\nimport {Inject} from \"@tsed/di\";\nimport {MongooseDocument} from \"@tsed/mongoose\";\nimport {FormioMapper} from \"../builder/FormioMapper\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {FormioSubmission} from \"../domain/FormioModels\";\nimport {FormioTemplate} from \"../domain/FormioTemplate\";\nimport {FormioDatabase} from \"../services/FormioDatabase\";\nimport async from \"async\";\n\n@Alter(\"templateExportSteps\")\nexport class AlterTemplateExportSteps implements AlterHook {\n @Inject()\n protected database: FormioDatabase;\n\n transform(queue: any[], template: FormioTemplate, map: any, options: any): any {\n queue.push(async.apply(this.exportSubmissions.bind(this), template, map, options));\n\n return queue;\n }\n\n protected async exportSubmissions(template: FormioTemplate, map: any, options: any, next: any) {\n const [mapper, submissions] = await Promise.all([\n this.database.getFormioMapper(),\n this.database.submissionModel.find({\n deleted: {$eq: null}\n })\n ]);\n\n template.submissions = await this.mapSubmissions(submissions, mapper);\n\n next(null, template);\n }\n\n protected mapSubmissions(submissions: MongooseDocument<FormioSubmission>[], mapper: FormioMapper) {\n return submissions\n .map((submission) => submission.toObject())\n .reduce((acc: any, {_id, created, updated, modified, __v, owner, roles, form, metadata, ...submission}) => {\n const machineName = mapper.mapToExport(form.toString());\n const key = machineName.replace(\"$machineName:\", \"\");\n\n acc[key] = getValue(acc, key, []);\n\n acc[key].push({\n ...submission,\n created: created && created.toString(),\n modified: modified && modified.toString(),\n data: mapper.mapToExport(submission.data),\n roles: mapper.mapToExport(roles).filter(Boolean),\n form: mapper.mapToExport(form)\n });\n\n return acc;\n }, {});\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { Inject } from "@tsed/di";
|
|
3
3
|
import { Alter } from "../decorators/alter";
|
|
4
4
|
import { FormioDatabase } from "../services/FormioDatabase";
|
|
5
|
-
|
|
5
|
+
import async from "async";
|
|
6
6
|
let AlterTemplateImportSteps = class AlterTemplateImportSteps {
|
|
7
7
|
transform(queue, install, template) {
|
|
8
8
|
queue.push(async.apply(this.importSubmissions.bind(this), template));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlterTemplateImportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateImportSteps.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AlterTemplateImportSteps.js","sourceRoot":"","sources":["../../../src/components/AlterTemplateImportSteps.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WAAW,CAAC,UAAU,CAAC;YACjC,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;SAChF,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AApCC;IADC,MAAM,EAAE;8BACW,cAAc;0DAAC;AAFxB,wBAAwB;IADpC,KAAK,CAAC,qBAAqB,CAAC;GAChB,wBAAwB,CAsCpC;SAtCY,wBAAwB","sourcesContent":["import {Inject} from \"@tsed/di\";\nimport {FormioMapper} from \"../builder/FormioMapper\";\nimport {Alter} from \"../decorators/alter\";\nimport {AlterHook} from \"../domain/AlterHook\";\nimport {FormioSubmission} from \"../domain/FormioModels\";\nimport {FormioTemplate} from \"../domain/FormioTemplate\";\nimport {FormioDatabase} from \"../services/FormioDatabase\";\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,9 +1,12 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Inject, Injectable, InjectorService } from "@tsed/common";
|
|
3
3
|
import { promisify } from "util";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import createRouter from "formio";
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import swagger from "formio/src/util/swagger.js";
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import util from "formio/src/util/util.js";
|
|
7
10
|
let FormioService = class FormioService {
|
|
8
11
|
get audit() {
|
|
9
12
|
return this.formio.audit || (() => { });
|
|
@@ -1 +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;
|
|
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;AAQ/B,aAAa;AACb,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,aAAa;AACb,OAAO,OAAO,MAAM,4BAA4B,CAAC;AACjD,aAAa;AACb,OAAO,IAAI,MAAM,yBAAyB,CAAC;AAG3C,IAAa,aAAa,GAA1B,MAAa,aAAa;IAMxB,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,C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G,IAAI,CAAC;QAExB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF,CAAA;AA3GC;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// @ts-ignore\nimport createRouter from \"formio\";\n// @ts-ignore\nimport swagger from \"formio/src/util/swagger.js\";\n// @ts-ignore\nimport util from \"formio/src/util/util.js\";\n\n@Injectable()\nexport class FormioService {\n router: FormioRouter;\n\n @Inject()\n protected injector: InjectorService;\n\n get audit(): Function {\n return this.formio.audit || (() => {});\n }\n\n get auth() {\n return this.formio.auth;\n }\n\n // istanbul ignore next\n get swagger() {\n return (...args: any[]) => new Promise((resolve) => swagger(...args, resolve));\n }\n\n get config(): FormioConfig {\n return this.formio.config;\n }\n\n get db(): Db {\n return this.formio.db;\n }\n\n get resources() {\n return this.formio.resources;\n }\n\n get mongoose(): Mongoose {\n return this.formio.mongoose;\n }\n\n get middleware() {\n return this.formio.middleware;\n }\n\n get schemas(): FormioSchemas {\n return this.formio.schemas;\n }\n\n get formio(): Formio {\n return this.router.formio as Formio;\n }\n\n get hook(): FormioHook {\n return this.formio.hook;\n }\n\n get util() {\n return this.formio.util;\n }\n\n get template() {\n return this.formio.template;\n }\n\n get Action() {\n return this.formio.Action;\n }\n\n async exportTemplate(options: Partial<FormioExportOptions> = {}): Promise<FormioTemplate> {\n return promisify(this.formio.template.export)(options);\n }\n\n async importTemplate(template: FormioTemplate): Promise<FormioTemplate> {\n return promisify(this.formio.template.import.template)(template);\n }\n\n encrypt(text: string) {\n return promisify(this.formio.encrypt)(text);\n }\n\n isInit() {\n return !!this.router;\n }\n\n // istanbul ignore next\n public createRouter(options: FormioConfig) {\n return createRouter(options);\n }\n\n public init(options: FormioConfig, hooks: FormioHooks = {}) {\n if (options && Object.keys(options).length) {\n this.router = this.createRouter(this.mapConfiguration(options));\n this.bindLogger();\n\n return this.router.init(hooks);\n }\n }\n\n protected mapConfiguration(options: FormioConfig) {\n const {injector} = this;\n const mongooseSettings = injector.settings.get<MongooseConnectionOptions>(\"mongoose.0\");\n\n if (mongooseSettings) {\n options.mongo = options.mongo || mongooseSettings.url;\n options.mongoConfig = options.mongoConfig || JSON.stringify(mongooseSettings.connectionOptions);\n }\n\n return options;\n }\n\n protected bindLogger() {\n const {injector} = this;\n\n util.log = injector.logger.info.bind(injector.logger);\n util.error = injector.logger.error.bind(injector.logger);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/formio",
|
|
3
|
-
"version": "6.102.
|
|
3
|
+
"version": "6.102.6",
|
|
4
4
|
"description": "Formio package for Ts.ED framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -28,24 +28,25 @@
|
|
|
28
28
|
"test": "cross-env NODE_ENV=test nyc mocha"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tsed/formio-types": "6.102.
|
|
31
|
+
"@tsed/formio-types": "6.102.6",
|
|
32
32
|
"tslib": "2.2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tsed/common": "6.102.
|
|
36
|
-
"@tsed/core": "6.102.
|
|
37
|
-
"@tsed/di": "6.102.
|
|
38
|
-
"@tsed/mongoose": "6.102.
|
|
35
|
+
"@tsed/common": "6.102.6",
|
|
36
|
+
"@tsed/core": "6.102.6",
|
|
37
|
+
"@tsed/di": "6.102.6",
|
|
38
|
+
"@tsed/mongoose": "6.102.6",
|
|
39
|
+
"@types/async": "3.2.12",
|
|
39
40
|
"express": "^4.17.1",
|
|
40
41
|
"formio": "^2.0.0",
|
|
41
42
|
"mongodb": "*",
|
|
42
43
|
"mongoose": "^5.12.2"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
|
-
"@tsed/common": "^6.102.
|
|
46
|
-
"@tsed/core": "^6.102.
|
|
47
|
-
"@tsed/di": "^6.102.
|
|
48
|
-
"@tsed/mongoose": "^6.102.
|
|
46
|
+
"@tsed/common": "^6.102.6",
|
|
47
|
+
"@tsed/core": "^6.102.6",
|
|
48
|
+
"@tsed/di": "^6.102.6",
|
|
49
|
+
"@tsed/mongoose": "^6.102.6",
|
|
49
50
|
"express": "^4.17.1",
|
|
50
51
|
"formio": "^2.0.0",
|
|
51
52
|
"mongodb": "*",
|