@tsed/formio 8.0.0-alpha.4 → 8.0.0-alpha.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.
Files changed (138) hide show
  1. package/lib/esm/services/FormioDatabase.js +1 -1
  2. package/lib/esm/services/FormioDatabase.js.map +1 -1
  3. package/lib/types/domain/Formio.d.ts +1 -1
  4. package/package.json +12 -13
  5. package/lib/cjs/FormioModule.js +0 -132
  6. package/lib/cjs/FormioModule.js.map +0 -1
  7. package/lib/cjs/builder/FormioMapper.js +0 -61
  8. package/lib/cjs/builder/FormioMapper.js.map +0 -1
  9. package/lib/cjs/components/AlterActions.js +0 -113
  10. package/lib/cjs/components/AlterActions.js.map +0 -1
  11. package/lib/cjs/components/AlterAudit.js +0 -16
  12. package/lib/cjs/components/AlterAudit.js.map +0 -1
  13. package/lib/cjs/components/AlterHost.js +0 -15
  14. package/lib/cjs/components/AlterHost.js.map +0 -1
  15. package/lib/cjs/components/AlterLog.js +0 -16
  16. package/lib/cjs/components/AlterLog.js.map +0 -1
  17. package/lib/cjs/components/AlterSkip.js +0 -32
  18. package/lib/cjs/components/AlterSkip.js.map +0 -1
  19. package/lib/cjs/components/AlterTemplateExportSteps.js +0 -52
  20. package/lib/cjs/components/AlterTemplateExportSteps.js.map +0 -1
  21. package/lib/cjs/components/AlterTemplateImportSteps.js +0 -45
  22. package/lib/cjs/components/AlterTemplateImportSteps.js.map +0 -1
  23. package/lib/cjs/decorators/action.js +0 -20
  24. package/lib/cjs/decorators/action.js.map +0 -1
  25. package/lib/cjs/decorators/actionCtx.js +0 -23
  26. package/lib/cjs/decorators/actionCtx.js.map +0 -1
  27. package/lib/cjs/decorators/alter.js +0 -20
  28. package/lib/cjs/decorators/alter.js.map +0 -1
  29. package/lib/cjs/decorators/on.js +0 -20
  30. package/lib/cjs/decorators/on.js.map +0 -1
  31. package/lib/cjs/decorators/useFormioAuth.js +0 -15
  32. package/lib/cjs/decorators/useFormioAuth.js.map +0 -1
  33. package/lib/cjs/domain/AlterHook.js +0 -3
  34. package/lib/cjs/domain/AlterHook.js.map +0 -1
  35. package/lib/cjs/domain/Formio.js +0 -3
  36. package/lib/cjs/domain/Formio.js.map +0 -1
  37. package/lib/cjs/domain/FormioAction.js +0 -3
  38. package/lib/cjs/domain/FormioAction.js.map +0 -1
  39. package/lib/cjs/domain/FormioActionsIndex.js +0 -3
  40. package/lib/cjs/domain/FormioActionsIndex.js.map +0 -1
  41. package/lib/cjs/domain/FormioAuth.js +0 -3
  42. package/lib/cjs/domain/FormioAuth.js.map +0 -1
  43. package/lib/cjs/domain/FormioBaseModel.js +0 -3
  44. package/lib/cjs/domain/FormioBaseModel.js.map +0 -1
  45. package/lib/cjs/domain/FormioConfig.js +0 -3
  46. package/lib/cjs/domain/FormioConfig.js.map +0 -1
  47. package/lib/cjs/domain/FormioCtxMapper.js +0 -3
  48. package/lib/cjs/domain/FormioCtxMapper.js.map +0 -1
  49. package/lib/cjs/domain/FormioDecodedToken.js +0 -3
  50. package/lib/cjs/domain/FormioDecodedToken.js.map +0 -1
  51. package/lib/cjs/domain/FormioErrors.js +0 -3
  52. package/lib/cjs/domain/FormioErrors.js.map +0 -1
  53. package/lib/cjs/domain/FormioHooks.js +0 -3
  54. package/lib/cjs/domain/FormioHooks.js.map +0 -1
  55. package/lib/cjs/domain/FormioJs.js +0 -3
  56. package/lib/cjs/domain/FormioJs.js.map +0 -1
  57. package/lib/cjs/domain/FormioModels.js +0 -5
  58. package/lib/cjs/domain/FormioModels.js.map +0 -1
  59. package/lib/cjs/domain/FormioRouter.js +0 -3
  60. package/lib/cjs/domain/FormioRouter.js.map +0 -1
  61. package/lib/cjs/domain/FormioSettings.js +0 -3
  62. package/lib/cjs/domain/FormioSettings.js.map +0 -1
  63. package/lib/cjs/domain/FormioTemplate.js +0 -3
  64. package/lib/cjs/domain/FormioTemplate.js.map +0 -1
  65. package/lib/cjs/domain/FormioTemplateUtil.js +0 -3
  66. package/lib/cjs/domain/FormioTemplateUtil.js.map +0 -1
  67. package/lib/cjs/domain/FormioUpdate.js +0 -3
  68. package/lib/cjs/domain/FormioUpdate.js.map +0 -1
  69. package/lib/cjs/domain/FormioUtils.js +0 -3
  70. package/lib/cjs/domain/FormioUtils.js.map +0 -1
  71. package/lib/cjs/domain/OnHook.js +0 -3
  72. package/lib/cjs/domain/OnHook.js.map +0 -1
  73. package/lib/cjs/domain/Resource.js +0 -3
  74. package/lib/cjs/domain/Resource.js.map +0 -1
  75. package/lib/cjs/index.js +0 -50
  76. package/lib/cjs/index.js.map +0 -1
  77. package/lib/cjs/middlewares/FormioAuthMiddleware.js +0 -41
  78. package/lib/cjs/middlewares/FormioAuthMiddleware.js.map +0 -1
  79. package/lib/cjs/package.json +0 -3
  80. package/lib/cjs/services/FormioAuthService.js +0 -182
  81. package/lib/cjs/services/FormioAuthService.js.map +0 -1
  82. package/lib/cjs/services/FormioDatabase.js +0 -140
  83. package/lib/cjs/services/FormioDatabase.js.map +0 -1
  84. package/lib/cjs/services/FormioHooksService.js +0 -81
  85. package/lib/cjs/services/FormioHooksService.js.map +0 -1
  86. package/lib/cjs/services/FormioInstaller.js +0 -44
  87. package/lib/cjs/services/FormioInstaller.js.map +0 -1
  88. package/lib/cjs/services/FormioRepository.js +0 -42
  89. package/lib/cjs/services/FormioRepository.js.map +0 -1
  90. package/lib/cjs/services/FormioService.js +0 -103
  91. package/lib/cjs/services/FormioService.js.map +0 -1
  92. package/lib/cjs/utils/isMongoId.js +0 -8
  93. package/lib/cjs/utils/isMongoId.js.map +0 -1
  94. package/lib/esm/package.json +0 -3
  95. package/lib/types-esm/FormioModule.d.ts +0 -24
  96. package/lib/types-esm/builder/FormioMapper.d.ts +0 -11
  97. package/lib/types-esm/components/AlterActions.d.ts +0 -18
  98. package/lib/types-esm/components/AlterAudit.d.ts +0 -5
  99. package/lib/types-esm/components/AlterHost.d.ts +0 -5
  100. package/lib/types-esm/components/AlterLog.d.ts +0 -5
  101. package/lib/types-esm/components/AlterSkip.d.ts +0 -7
  102. package/lib/types-esm/components/AlterTemplateExportSteps.d.ts +0 -12
  103. package/lib/types-esm/components/AlterTemplateImportSteps.d.ts +0 -11
  104. package/lib/types-esm/decorators/action.d.ts +0 -7
  105. package/lib/types-esm/decorators/actionCtx.d.ts +0 -23
  106. package/lib/types-esm/decorators/alter.d.ts +0 -6
  107. package/lib/types-esm/decorators/on.d.ts +0 -6
  108. package/lib/types-esm/decorators/useFormioAuth.d.ts +0 -6
  109. package/lib/types-esm/domain/AlterHook.d.ts +0 -3
  110. package/lib/types-esm/domain/Formio.d.ts +0 -112
  111. package/lib/types-esm/domain/FormioAction.d.ts +0 -20
  112. package/lib/types-esm/domain/FormioActionsIndex.d.ts +0 -15
  113. package/lib/types-esm/domain/FormioAuth.d.ts +0 -67
  114. package/lib/types-esm/domain/FormioBaseModel.d.ts +0 -11
  115. package/lib/types-esm/domain/FormioConfig.d.ts +0 -59
  116. package/lib/types-esm/domain/FormioCtxMapper.d.ts +0 -7
  117. package/lib/types-esm/domain/FormioDecodedToken.d.ts +0 -12
  118. package/lib/types-esm/domain/FormioErrors.d.ts +0 -53
  119. package/lib/types-esm/domain/FormioHooks.d.ts +0 -194
  120. package/lib/types-esm/domain/FormioJs.d.ts +0 -17
  121. package/lib/types-esm/domain/FormioModels.d.ts +0 -42
  122. package/lib/types-esm/domain/FormioRouter.d.ts +0 -7
  123. package/lib/types-esm/domain/FormioSettings.d.ts +0 -53
  124. package/lib/types-esm/domain/FormioTemplate.d.ts +0 -8
  125. package/lib/types-esm/domain/FormioTemplateUtil.d.ts +0 -13
  126. package/lib/types-esm/domain/FormioUpdate.d.ts +0 -19
  127. package/lib/types-esm/domain/FormioUtils.d.ts +0 -307
  128. package/lib/types-esm/domain/OnHook.d.ts +0 -3
  129. package/lib/types-esm/domain/Resource.d.ts +0 -18
  130. package/lib/types-esm/index.d.ts +0 -46
  131. package/lib/types-esm/middlewares/FormioAuthMiddleware.d.ts +0 -11
  132. package/lib/types-esm/services/FormioAuthService.d.ts +0 -84
  133. package/lib/types-esm/services/FormioDatabase.d.ts +0 -84
  134. package/lib/types-esm/services/FormioHooksService.d.ts +0 -17
  135. package/lib/types-esm/services/FormioInstaller.d.ts +0 -12
  136. package/lib/types-esm/services/FormioRepository.d.ts +0 -41
  137. package/lib/types-esm/services/FormioService.d.ts +0 -36
  138. package/lib/types-esm/utils/isMongoId.d.ts +0 -1
@@ -1,140 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormioDatabase = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@tsed/core");
6
- const di_1 = require("@tsed/di");
7
- const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
8
- const FormioMapper_js_1 = require("../builder/FormioMapper.js");
9
- const isMongoId_js_1 = require("../utils/isMongoId.js");
10
- const FormioService_js_1 = require("./FormioService.js");
11
- function toMap(list) {
12
- return (0, core_1.toMap)(list, (o) => [o._id.toString(), `$machineName:${o.name || o.machineName}`]);
13
- }
14
- let FormioDatabase = class FormioDatabase {
15
- get models() {
16
- return this.formio.mongoose.models;
17
- }
18
- get roleModel() {
19
- return this.models.role;
20
- }
21
- get formModel() {
22
- return this.models.form;
23
- }
24
- get actionModel() {
25
- return this.models.action;
26
- }
27
- get submissionModel() {
28
- return this.models.submission;
29
- }
30
- get tokenModel() {
31
- return this.models.token;
32
- }
33
- get actionItemModel() {
34
- return this.models.actionItem;
35
- }
36
- async getFormioMapper() {
37
- const [roles, forms, actions] = await Promise.all([
38
- this.roleModel.find({
39
- deleted: { $eq: null }
40
- }),
41
- this.formModel.find({
42
- deleted: { $eq: null }
43
- }),
44
- this.actionModel.find({
45
- deleted: { $eq: null }
46
- })
47
- ]);
48
- return new FormioMapper_js_1.FormioMapper({
49
- forms: toMap(forms),
50
- actions: toMap(actions),
51
- roles: toMap(roles)
52
- });
53
- }
54
- async hasForms() {
55
- return (await this.formModel.countDocuments()) > 0;
56
- }
57
- async hasForm(name) {
58
- return !!(await this.formModel.countDocuments({ name: { $eq: name } }));
59
- }
60
- getForm(nameOrId) {
61
- return this.formModel
62
- .findOne({
63
- deleted: { $eq: null },
64
- ...((0, isMongoId_js_1.isMongoId)(nameOrId)
65
- ? {
66
- _id: nameOrId
67
- }
68
- : { name: { $eq: nameOrId } })
69
- })
70
- .lean()
71
- .exec();
72
- }
73
- /**
74
- * Import form previously exported by export tool.
75
- * This method transform alias to a real mongoose _id
76
- * @param form
77
- * @param onCreate
78
- */
79
- async importFormIfNotExists(form, onCreate) {
80
- if (!(await this.hasForm(form.name))) {
81
- const createForm = await this.importForm(form);
82
- onCreate && (await onCreate(createForm));
83
- }
84
- return this.getForm(form.name);
85
- }
86
- /**
87
- * Import form previously exported by export tool.
88
- * This method transform alias to a real mongoose _id
89
- * @param form
90
- */
91
- async importForm(form) {
92
- const mapper = await this.getFormioMapper();
93
- return this.saveForm(mapper.mapToImport(form));
94
- }
95
- saveForm(form) {
96
- form = new this.formModel((0, omit_1.default)(form, ["__v"]));
97
- return this.formModel.findOneAndUpdate({ _id: form._id }, form, { upsert: true, new: true });
98
- }
99
- getSubmissions(query = {}) {
100
- return this.submissionModel.find({
101
- ...query,
102
- deleted: { $eq: null }
103
- });
104
- }
105
- /**
106
- * Import submission previously exported by export tool.
107
- * This method transform alias to a real mongoose _id
108
- * @param submission
109
- */
110
- async importSubmission(submission) {
111
- const mapper = await this.getFormioMapper();
112
- return this.saveSubmission(mapper.mapToImport(submission));
113
- }
114
- saveSubmission(submission) {
115
- submission = new this.submissionModel((0, omit_1.default)(submission, ["__v"]));
116
- return this.submissionModel.findOneAndUpdate({
117
- _id: submission._id
118
- }, submission, { new: true, upsert: true });
119
- }
120
- idToBson(form) {
121
- if ((0, core_1.isArray)(form)) {
122
- return { $in: form.map(this.formio.util.idToBson) };
123
- }
124
- else if ((0, core_1.isObject)(form)) {
125
- return this.formio.util.idToBson(form._id);
126
- }
127
- else if ((0, core_1.isString)(form)) {
128
- return this.formio.util.idToBson(form);
129
- }
130
- }
131
- };
132
- tslib_1.__decorate([
133
- (0, di_1.Inject)(),
134
- tslib_1.__metadata("design:type", FormioService_js_1.FormioService)
135
- ], FormioDatabase.prototype, "formio", void 0);
136
- FormioDatabase = tslib_1.__decorate([
137
- (0, di_1.Injectable)()
138
- ], FormioDatabase);
139
- exports.FormioDatabase = FormioDatabase;
140
- //# sourceMappingURL=FormioDatabase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormioDatabase.js","sourceRoot":"","sources":["../../../src/services/FormioDatabase.ts"],"names":[],"mappings":";;;;AAAA,qCAAsE;AACtE,iCAA4C;AAG5C,+DAA+B;AAE/B,gEAAwD;AACxD,wDAAgD;AAChD,yDAAiD;AAEjD,SAAS,KAAK,CAAI,IAAW;IAC3B,OAAO,IAAA,YAAI,EAA8B,IAAI,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,gBAAgB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AAC5H,CAAC;AAGM,IAAM,cAAc,GAApB,MAAM,cAAc;IAIzB,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACrC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAChC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,I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0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@tsed/common");
6
- const util_1 = require("util");
7
- const FormioService_js_1 = require("./FormioService.js");
8
- let FormioHooksService = class FormioHooksService {
9
- get settings() {
10
- return this.formio.hook.settings;
11
- }
12
- get invoke() {
13
- return this.formio.hook.invoke;
14
- }
15
- get alter() {
16
- return this.formio.hook.alter;
17
- }
18
- get alterAsync() {
19
- return (0, util_1.promisify)(this.alter);
20
- }
21
- getHooks() {
22
- return {
23
- alter: this.getHooksProvider("alter"),
24
- on: this.getHooksProvider("on")
25
- };
26
- }
27
- getProviders(type) {
28
- return this.injector.getProviders(`formio:${type}`);
29
- }
30
- getHooksProvider(type) {
31
- return this.bindHooks(type, this.createHooks(type));
32
- }
33
- bindHooks(type, hooks) {
34
- return Object.entries(hooks).reduce((newHooks, [key, pool]) => {
35
- const wrap = (input, ...args) => {
36
- let last;
37
- for (const fn of pool) {
38
- const result = fn(input, ...args);
39
- if (type === "alter") {
40
- input = result;
41
- }
42
- else {
43
- last = result;
44
- }
45
- }
46
- return type === "alter" ? input : last;
47
- };
48
- return {
49
- ...newHooks,
50
- [key]: wrap
51
- };
52
- }, {});
53
- }
54
- createHooks(type) {
55
- return this.getProviders(type).reduce((hooks, provider) => {
56
- const instance = this.injector.invoke(provider.token);
57
- const name = provider.store.get(`formio:${type}:name`);
58
- const pool = hooks[name] || [];
59
- const hook = (...args) => instance[type === "alter" ? "transform" : "on"](...args.map((input) => {
60
- return input && input.$ctx ? input.$ctx : input;
61
- }));
62
- return {
63
- ...hooks,
64
- [name]: [].concat(pool, hook)
65
- };
66
- }, {});
67
- }
68
- };
69
- tslib_1.__decorate([
70
- (0, common_1.Inject)(),
71
- tslib_1.__metadata("design:type", common_1.InjectorService)
72
- ], FormioHooksService.prototype, "injector", void 0);
73
- tslib_1.__decorate([
74
- (0, common_1.Inject)(FormioService_js_1.FormioService),
75
- tslib_1.__metadata("design:type", FormioService_js_1.FormioService)
76
- ], FormioHooksService.prototype, "formio", void 0);
77
- FormioHooksService = tslib_1.__decorate([
78
- (0, common_1.Injectable)()
79
- ], FormioHooksService);
80
- exports.FormioHooksService = FormioHooksService;
81
- //# sourceMappingURL=FormioHooksService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormioHooksService.js","sourceRoot":"","sources":["../../../src/services/FormioHooksService.ts"],"names":[],"mappings":";;;;AAAA,yCAAiE;AACjE,+BAA+B;AAE/B,yDAAiD;AAI1C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAO7B,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;IACjC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IAChC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAA,gBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,QAAQ;QACN,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YACrC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;SAChC,CAAC;IACJ,CAAC;IAES,YAAY,CAAC,IAAoB;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAES,gBAAgB,CAAC,IAAoB;QAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,CAAC;IAES,SAAS,CAAC,IAAoB,EAAE,KAAiC;QACzE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,IAA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CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;YAClD,CAAC,CAAC,CACH,CAAC;YAEJ,OAAO;gBACL,GAAG,KAAK;gBACR,CAAC,IAAI,CAAC,EAAG,EAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;aAC9C,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CACF,CAAA;AAjFC;IAAC,IAAA,eAAM,GAAE;sCACW,wBAAe;oDAAC;AAEpC;IAAC,IAAA,eAAM,EAAC,gCAAa,CAAC;sCACJ,gCAAa;kDAAC;AALrB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;GACA,kBAAkB,CAkF9B;AAlFY,gDAAkB"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormioInstaller = void 0;
4
- const tslib_1 = require("tslib");
5
- const di_1 = require("@tsed/di");
6
- const logger_1 = require("@tsed/logger");
7
- const FormioDatabase_js_1 = require("./FormioDatabase.js");
8
- let FormioInstaller = class FormioInstaller extends FormioDatabase_js_1.FormioDatabase {
9
- async install(template, root) {
10
- this.logger.info("Install formio template...");
11
- template = await this.formio.importTemplate(template);
12
- if (root) {
13
- this.logger.info("Create root user...");
14
- await this.createRootUser(root, template);
15
- }
16
- }
17
- async createRootUser(user, template) {
18
- const hash = await this.formio.encrypt(user.password);
19
- return new Promise((resolve, reject) => {
20
- this.formio.resources.submission.model.create({
21
- form: template.resources.admin._id,
22
- data: {
23
- email: user.email,
24
- password: hash
25
- },
26
- roles: [template.roles?.administrator._id].filter(Boolean)
27
- }, (err, item) => {
28
- if (err) {
29
- return reject(err);
30
- }
31
- resolve(item);
32
- });
33
- });
34
- }
35
- };
36
- tslib_1.__decorate([
37
- (0, di_1.Inject)(),
38
- tslib_1.__metadata("design:type", logger_1.Logger)
39
- ], FormioInstaller.prototype, "logger", void 0);
40
- FormioInstaller = tslib_1.__decorate([
41
- (0, di_1.Injectable)()
42
- ], FormioInstaller);
43
- exports.FormioInstaller = FormioInstaller;
44
- //# sourceMappingURL=FormioInstaller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormioInstaller.js","sourceRoot":"","sources":["../../../src/services/FormioInstaller.ts"],"names":[],"mappings":";;;;AAAA,iCAA4C;AAC5C,yCAAoC;AAGpC,2DAAmD;AAG5C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,kCAAc;IAIjD,KAAK,CAAC,OAAO,CAAC,QAAwB,EAAE,IAAS;QAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC/C,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAEtD,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YACxC,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SAC3C;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAiB,IAAuC,EAAE,QAAwB;QACpG,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAC3C;gBACE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG;gBAClC,IAAI,EAAE;oBACJ,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,QAAQ,EAAE,IAAI;iBACf;gBACD,KAAK,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;aAC3D,EACD,CAAC,GAAY,EAAE,IAAS,EAAE,EAAE;gBAC1B,IAAI,GAAG,EAAE;oBACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;iBACpB;gBAED,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApCC;IAAC,IAAA,WAAM,GAAE;sCACS,eAAM;+CAAC;AAFd,eAAe;IAD3B,IAAA,eAAU,GAAE;GACA,eAAe,CAqC3B;AArCY,0CAAe"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormioRepository = void 0;
4
- const tslib_1 = require("tslib");
5
- const di_1 = require("@tsed/di");
6
- const FormioDatabase_js_1 = require("./FormioDatabase.js");
7
- class FormioRepository {
8
- async getFormId() {
9
- if (!this.formId) {
10
- const form = await this.formioDatabase.formModel.findOne({ name: { $eq: this.formName } });
11
- if (form) {
12
- this.formId = form._id;
13
- }
14
- }
15
- return this.formId;
16
- }
17
- async saveSubmission(submission) {
18
- return this.formioDatabase.saveSubmission({
19
- ...submission,
20
- form: submission.form || (await this.getFormId())
21
- });
22
- }
23
- async getSubmissions(query = {}) {
24
- return this.formioDatabase.getSubmissions({
25
- ...query,
26
- form: await this.getFormId()
27
- });
28
- }
29
- async findOneSubmission(query) {
30
- return this.formioDatabase.submissionModel.findOne({
31
- form: await this.getFormId(),
32
- deleted: null,
33
- ...query
34
- });
35
- }
36
- }
37
- tslib_1.__decorate([
38
- (0, di_1.Inject)(),
39
- tslib_1.__metadata("design:type", FormioDatabase_js_1.FormioDatabase)
40
- ], FormioRepository.prototype, "formioDatabase", void 0);
41
- exports.FormioRepository = FormioRepository;
42
- //# sourceMappingURL=FormioRepository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormioRepository.js","sourceRoot":"","sources":["../../../src/services/FormioRepository.ts"],"names":[],"mappings":";;;;AACA,iCAAgC;AAGhC,2DAAmD;AAEnD,MAAsB,gBAAgB;IAQpC,KAAK,CAAC,SAAS;QACb,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC,IAAI,EAAE,EAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAC,EAAC,CAAC,CAAC;YAEvF,IAAI,IAAI,EAAE;gBACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;aACxB;SACF;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,UAAkF;QACrG,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAiB;YACxD,GAAG,UAAU;YACb,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;SAClD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,QAAsE,EAAE;QAC3F,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAiB;YACxD,GAAG,KAAK;YACR,IAAI,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAU;QAChC,OAAO,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC;YACjD,IAAI,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE;YAC5B,OAAO,EAAE,IAAI;YACb,GAAG,KAAK;SACT,CAAQ,CAAC;IACZ,CAAC;CACF;AAxCC;IAAC,IAAA,WAAM,GAAE;sCACiB,kCAAc;wDAAC;AAF3C,4CAyCC"}
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormioService = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@tsed/common");
6
- const util_1 = require("util");
7
- // @ts-ignore
8
- const formio_1 = tslib_1.__importDefault(require("formio"));
9
- // @ts-ignore
10
- const swagger_js_1 = tslib_1.__importDefault(require("formio/src/util/swagger.js"));
11
- // @ts-ignore
12
- const util_js_1 = tslib_1.__importDefault(require("formio/src/util/util.js"));
13
- let FormioService = class FormioService {
14
- get audit() {
15
- return this.formio.audit || (() => { });
16
- }
17
- get auth() {
18
- return this.formio.auth;
19
- }
20
- // istanbul ignore next
21
- get swagger() {
22
- return (...args) => new Promise((resolve) => (0, swagger_js_1.default)(...args, resolve));
23
- }
24
- get config() {
25
- return this.formio.config;
26
- }
27
- get db() {
28
- return this.formio.db;
29
- }
30
- get resources() {
31
- return this.formio.resources;
32
- }
33
- get mongoose() {
34
- return this.formio.mongoose;
35
- }
36
- get middleware() {
37
- return this.formio.middleware;
38
- }
39
- get schemas() {
40
- return this.formio.schemas;
41
- }
42
- get formio() {
43
- return this.router.formio;
44
- }
45
- get hook() {
46
- return this.formio.hook;
47
- }
48
- get util() {
49
- return this.formio.util;
50
- }
51
- get template() {
52
- return this.formio.template;
53
- }
54
- get Action() {
55
- return this.formio.Action;
56
- }
57
- exportTemplate(options = {}) {
58
- return (0, util_1.promisify)(this.formio.template.export)(options);
59
- }
60
- importTemplate(template) {
61
- return (0, util_1.promisify)(this.formio.template.import.template)(template);
62
- }
63
- encrypt(text) {
64
- return (0, util_1.promisify)(this.formio.encrypt)(text);
65
- }
66
- isInit() {
67
- return !!this.router;
68
- }
69
- // istanbul ignore next
70
- createRouter(options) {
71
- return (0, formio_1.default)(options);
72
- }
73
- init(options, hooks = {}) {
74
- if (options && Object.keys(options).length) {
75
- this.router = this.createRouter(this.mapConfiguration(options));
76
- this.bindLogger();
77
- return this.router.init(hooks);
78
- }
79
- }
80
- mapConfiguration(options) {
81
- const { injector } = this;
82
- const mongooseSettings = injector.settings.get("mongoose.0");
83
- if (mongooseSettings) {
84
- options.mongo = options.mongo || mongooseSettings.url;
85
- options.mongoConfig = options.mongoConfig || JSON.stringify(mongooseSettings.connectionOptions);
86
- }
87
- return options;
88
- }
89
- bindLogger() {
90
- const { injector } = this;
91
- util_js_1.default.log = injector.logger.info.bind(injector.logger);
92
- util_js_1.default.error = injector.logger.error.bind(injector.logger);
93
- }
94
- };
95
- tslib_1.__decorate([
96
- (0, common_1.Inject)(),
97
- tslib_1.__metadata("design:type", common_1.InjectorService)
98
- ], FormioService.prototype, "injector", void 0);
99
- FormioService = tslib_1.__decorate([
100
- (0, common_1.Injectable)()
101
- ], FormioService);
102
- exports.FormioService = FormioService;
103
- //# sourceMappingURL=FormioService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormioService.js","sourceRoot":"","sources":["../../../src/services/FormioService.ts"],"names":[],"mappings":";;;;AAAA,yCAAiE;AAIjE,+BAA+B;AAQ/B,aAAa;AACb,4DAAkC;AAClC,aAAa;AACb,oFAAiD;AACjD,aAAa;AACb,8EAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,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;Q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value: true });
3
- exports.isMongoId = void 0;
4
- function isMongoId(text) {
5
- return text.toString().match(/^[0-9a-fA-F]{24}$/);
6
- }
7
- exports.isMongoId = isMongoId;
8
- //# sourceMappingURL=isMongoId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isMongoId.js","sourceRoot":"","sources":["../../../src/utils/isMongoId.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACpD,CAAC;AAFD,8BAEC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,24 +0,0 @@
1
- import { InjectorService, OnReady, OnRoutesInit, PlatformApplication, PlatformRouteDetails } from "@tsed/common";
2
- import { FormioConfig } from "./domain/FormioConfig.js";
3
- import { FormioTemplate } from "./domain/FormioTemplate.js";
4
- import { FormioHooksService } from "./services/FormioHooksService.js";
5
- import { FormioInstaller } from "./services/FormioInstaller.js";
6
- import { FormioService } from "./services/FormioService.js";
7
- export declare class FormioModule implements OnRoutesInit, OnReady {
8
- protected formio: FormioService;
9
- protected hooks: FormioHooksService;
10
- protected installer: FormioInstaller;
11
- protected app: PlatformApplication;
12
- protected injector: InjectorService;
13
- protected settings: FormioConfig;
14
- protected baseUrl: string;
15
- protected skipInstall: boolean;
16
- protected template?: FormioTemplate;
17
- protected root?: any;
18
- $onInit(): Promise<import("./index.js").Formio> | undefined;
19
- init(options: FormioConfig): Promise<import("./index.js").Formio> | undefined;
20
- $onRoutesInit(): Promise<void>;
21
- $logRoutes(routes: PlatformRouteDetails[]): Promise<PlatformRouteDetails[]>;
22
- $onReady(): void;
23
- protected shouldInstall(): Promise<boolean | undefined>;
24
- }
@@ -1,11 +0,0 @@
1
- import { FormioCtxMapper } from "../domain/FormioCtxMapper.js";
2
- export declare class FormioMapper {
3
- readonly ctxData: FormioCtxMapper;
4
- constructor(ctxData: FormioCtxMapper);
5
- find(key: string): any;
6
- findId(data: string): any;
7
- findMachineName(data: any): string | undefined;
8
- mapToExport(data: any): any;
9
- mapToImport(data: any): any;
10
- mapData(data: any, resolver: any): any;
11
- }
@@ -1,18 +0,0 @@
1
- import { InjectorService, Provider } from "@tsed/di";
2
- import { PlatformParams } from "@tsed/platform-params";
3
- import { PlatformResponseFilter } from "@tsed/platform-response-filter";
4
- import { AlterHook } from "../domain/AlterHook.js";
5
- import { SetActionItemMessage } from "../domain/FormioAction.js";
6
- import { FormioActions } from "../domain/FormioActionsIndex.js";
7
- import { FormioService } from "../services/FormioService.js";
8
- export declare class AlterActions implements AlterHook {
9
- protected injector: InjectorService;
10
- protected formio: FormioService;
11
- protected params: PlatformParams;
12
- protected responseFilter: PlatformResponseFilter;
13
- transform(actions: FormioActions): FormioActions;
14
- protected getActions(): Provider<any>[];
15
- protected createHandler(provider: Provider, propertyKey: string | symbol): (action: any, handler: string, method: string, req: any, res: any, next: any, setActionItemMessage: SetActionItemMessage) => Promise<void>;
16
- private onRequest;
17
- private flush;
18
- }
@@ -1,5 +0,0 @@
1
- import { DIContext } from "@tsed/di";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterAudit implements AlterHook {
4
- transform(info: any[], event: string, ctx: DIContext): boolean;
5
- }
@@ -1,5 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterHost implements AlterHook<string> {
4
- transform(baseUrl: string, ctx: PlatformContext): string;
5
- }
@@ -1,5 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterLog implements AlterHook {
4
- transform(event: string, ctx: PlatformContext, ...info: any[]): boolean;
5
- }
@@ -1,7 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterSkip implements AlterHook {
4
- baseUrl: string;
5
- whiteList: string[];
6
- transform(value: any, ctx: PlatformContext): any;
7
- }
@@ -1,12 +0,0 @@
1
- import { MongooseDocument } from "@tsed/mongoose";
2
- import { FormioMapper } from "../builder/FormioMapper.js";
3
- import { AlterHook } from "../domain/AlterHook.js";
4
- import { FormioSubmission } from "../domain/FormioModels.js";
5
- import { FormioTemplate } from "../domain/FormioTemplate.js";
6
- import { FormioDatabase } from "../services/FormioDatabase.js";
7
- export declare class AlterTemplateExportSteps implements AlterHook {
8
- protected database: FormioDatabase;
9
- transform(queue: any[], template: FormioTemplate, map: any, options: any): any;
10
- protected exportSubmissions(template: FormioTemplate, map: any, options: any, next: any): Promise<void>;
11
- protected mapSubmissions(submissions: MongooseDocument<FormioSubmission>[], mapper: FormioMapper): any;
12
- }
@@ -1,11 +0,0 @@
1
- import { FormioMapper } from "../builder/FormioMapper.js";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- import { FormioSubmission } from "../domain/FormioModels.js";
4
- import { FormioTemplate } from "../domain/FormioTemplate.js";
5
- import { FormioDatabase } from "../services/FormioDatabase.js";
6
- export declare class AlterTemplateImportSteps implements AlterHook {
7
- protected database: FormioDatabase;
8
- transform(queue: any[], install: Function, template: Partial<FormioTemplate>): any;
9
- protected importSubmissions(template: Partial<FormioTemplate>, done: any): Promise<void>;
10
- protected importSubmission(submission: Partial<FormioSubmission>, mapper: FormioMapper): Promise<any>;
11
- }
@@ -1,7 +0,0 @@
1
- import { FormioActionInfo } from "@tsed/formio-types";
2
- /**
3
- * Create a new FormIO Action.
4
- * @param options
5
- * @decorator
6
- */
7
- export declare function Action(options: FormioActionInfo): ClassDecorator;
@@ -1,23 +0,0 @@
1
- import { SetActionItemMessage } from "../domain/FormioAction.js";
2
- import { FormioAction } from "@tsed/formio-types";
3
- /**
4
- * Return the current action context with the following data:
5
- *
6
- * ```typescript
7
- * export type ActionCtx = {
8
- * handler: string;
9
- * method: string;
10
- * setActionItemMessage: SetActionItemMessage;
11
- * action: FormioAction;
12
- * };
13
- * ```
14
- * @param expression
15
- * @constructor
16
- */
17
- export declare function ActionCtx(expression?: string): ParameterDecorator;
18
- export type ActionCtx = {
19
- handler: string;
20
- method: string;
21
- setActionItemMessage: SetActionItemMessage;
22
- action: FormioAction;
23
- };
@@ -1,6 +0,0 @@
1
- /**
2
- *
3
- * @param name
4
- * @constructor
5
- */
6
- export declare function Alter(name: string): ClassDecorator;
@@ -1,6 +0,0 @@
1
- /**
2
- * Create a Form io hook event listener
3
- * @param name
4
- * @constructor
5
- */
6
- export declare function On(name: string): ClassDecorator;
@@ -1,6 +0,0 @@
1
- /**
2
- * Check if a user is connected by using the Formio Auth middleware
3
- * @decorator
4
- * @formio
5
- */
6
- export declare function UseFormioAuth(): Function;
@@ -1,3 +0,0 @@
1
- export interface AlterHook<T = any> {
2
- transform(...args: any[]): T;
3
- }