@tsed/formio 7.83.3 → 8.0.0-alpha.10

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 (175) hide show
  1. package/lib/esm/FormioModule.js.map +1 -1
  2. package/lib/esm/builder/FormioMapper.js.map +1 -1
  3. package/lib/esm/components/AlterActions.js.map +1 -1
  4. package/lib/esm/components/AlterAudit.js.map +1 -1
  5. package/lib/esm/components/AlterHost.js.map +1 -1
  6. package/lib/esm/components/AlterLog.js.map +1 -1
  7. package/lib/esm/components/AlterSkip.js.map +1 -1
  8. package/lib/esm/components/AlterTemplateExportSteps.js +1 -1
  9. package/lib/esm/components/AlterTemplateExportSteps.js.map +1 -1
  10. package/lib/esm/components/AlterTemplateImportSteps.js +1 -1
  11. package/lib/esm/components/AlterTemplateImportSteps.js.map +1 -1
  12. package/lib/esm/decorators/action.js.map +1 -1
  13. package/lib/esm/decorators/actionCtx.js.map +1 -1
  14. package/lib/esm/decorators/alter.js.map +1 -1
  15. package/lib/esm/decorators/on.js.map +1 -1
  16. package/lib/esm/decorators/useFormioAuth.js.map +1 -1
  17. package/lib/esm/domain/FormioModels.js.map +1 -1
  18. package/lib/esm/middlewares/FormioAuthMiddleware.js.map +1 -1
  19. package/lib/esm/services/FormioAuthService.js.map +1 -1
  20. package/lib/esm/services/FormioDatabase.js +1 -1
  21. package/lib/esm/services/FormioDatabase.js.map +1 -1
  22. package/lib/esm/services/FormioHooksService.js.map +1 -1
  23. package/lib/esm/services/FormioInstaller.js.map +1 -1
  24. package/lib/esm/services/FormioRepository.js.map +1 -1
  25. package/lib/esm/services/FormioService.js +1 -1
  26. package/lib/esm/services/FormioService.js.map +1 -1
  27. package/lib/types/decorators/actionCtx.d.ts +1 -1
  28. package/lib/types/domain/Formio.d.ts +26 -1
  29. package/lib/types/domain/FormioAction.d.ts +1 -1
  30. package/lib/types/domain/FormioBaseModel.d.ts +27 -1
  31. package/lib/types/domain/FormioCtxMapper.d.ts +1 -1
  32. package/lib/types/domain/FormioHooks.d.ts +26 -0
  33. package/lib/types/domain/FormioModels.d.ts +26 -1
  34. package/lib/types/domain/Resource.d.ts +1 -1
  35. package/lib/types/services/FormioAuthService.d.ts +11 -7
  36. package/lib/types/services/FormioDatabase.d.ts +36 -21
  37. package/lib/types/services/FormioHooksService.d.ts +1 -1
  38. package/lib/types/services/FormioRepository.d.ts +8 -3
  39. package/lib/types/services/FormioService.d.ts +25 -0
  40. package/package.json +26 -24
  41. package/vitest.config.mts +5 -5
  42. package/lib/cjs/FormioModule.js +0 -132
  43. package/lib/cjs/FormioModule.js.map +0 -1
  44. package/lib/cjs/builder/FormioMapper.js +0 -61
  45. package/lib/cjs/builder/FormioMapper.js.map +0 -1
  46. package/lib/cjs/components/AlterActions.js +0 -113
  47. package/lib/cjs/components/AlterActions.js.map +0 -1
  48. package/lib/cjs/components/AlterAudit.js +0 -16
  49. package/lib/cjs/components/AlterAudit.js.map +0 -1
  50. package/lib/cjs/components/AlterHost.js +0 -15
  51. package/lib/cjs/components/AlterHost.js.map +0 -1
  52. package/lib/cjs/components/AlterLog.js +0 -16
  53. package/lib/cjs/components/AlterLog.js.map +0 -1
  54. package/lib/cjs/components/AlterSkip.js +0 -32
  55. package/lib/cjs/components/AlterSkip.js.map +0 -1
  56. package/lib/cjs/components/AlterTemplateExportSteps.js +0 -52
  57. package/lib/cjs/components/AlterTemplateExportSteps.js.map +0 -1
  58. package/lib/cjs/components/AlterTemplateImportSteps.js +0 -45
  59. package/lib/cjs/components/AlterTemplateImportSteps.js.map +0 -1
  60. package/lib/cjs/decorators/action.js +0 -20
  61. package/lib/cjs/decorators/action.js.map +0 -1
  62. package/lib/cjs/decorators/actionCtx.js +0 -23
  63. package/lib/cjs/decorators/actionCtx.js.map +0 -1
  64. package/lib/cjs/decorators/alter.js +0 -20
  65. package/lib/cjs/decorators/alter.js.map +0 -1
  66. package/lib/cjs/decorators/on.js +0 -20
  67. package/lib/cjs/decorators/on.js.map +0 -1
  68. package/lib/cjs/decorators/useFormioAuth.js +0 -15
  69. package/lib/cjs/decorators/useFormioAuth.js.map +0 -1
  70. package/lib/cjs/domain/AlterHook.js +0 -3
  71. package/lib/cjs/domain/AlterHook.js.map +0 -1
  72. package/lib/cjs/domain/Formio.js +0 -3
  73. package/lib/cjs/domain/Formio.js.map +0 -1
  74. package/lib/cjs/domain/FormioAction.js +0 -3
  75. package/lib/cjs/domain/FormioAction.js.map +0 -1
  76. package/lib/cjs/domain/FormioActionsIndex.js +0 -3
  77. package/lib/cjs/domain/FormioActionsIndex.js.map +0 -1
  78. package/lib/cjs/domain/FormioAuth.js +0 -3
  79. package/lib/cjs/domain/FormioAuth.js.map +0 -1
  80. package/lib/cjs/domain/FormioBaseModel.js +0 -3
  81. package/lib/cjs/domain/FormioBaseModel.js.map +0 -1
  82. package/lib/cjs/domain/FormioConfig.js +0 -3
  83. package/lib/cjs/domain/FormioConfig.js.map +0 -1
  84. package/lib/cjs/domain/FormioCtxMapper.js +0 -3
  85. package/lib/cjs/domain/FormioCtxMapper.js.map +0 -1
  86. package/lib/cjs/domain/FormioDecodedToken.js +0 -3
  87. package/lib/cjs/domain/FormioDecodedToken.js.map +0 -1
  88. package/lib/cjs/domain/FormioErrors.js +0 -3
  89. package/lib/cjs/domain/FormioErrors.js.map +0 -1
  90. package/lib/cjs/domain/FormioHooks.js +0 -3
  91. package/lib/cjs/domain/FormioHooks.js.map +0 -1
  92. package/lib/cjs/domain/FormioJs.js +0 -3
  93. package/lib/cjs/domain/FormioJs.js.map +0 -1
  94. package/lib/cjs/domain/FormioModels.js +0 -5
  95. package/lib/cjs/domain/FormioModels.js.map +0 -1
  96. package/lib/cjs/domain/FormioRouter.js +0 -3
  97. package/lib/cjs/domain/FormioRouter.js.map +0 -1
  98. package/lib/cjs/domain/FormioSettings.js +0 -3
  99. package/lib/cjs/domain/FormioSettings.js.map +0 -1
  100. package/lib/cjs/domain/FormioTemplate.js +0 -3
  101. package/lib/cjs/domain/FormioTemplate.js.map +0 -1
  102. package/lib/cjs/domain/FormioTemplateUtil.js +0 -3
  103. package/lib/cjs/domain/FormioTemplateUtil.js.map +0 -1
  104. package/lib/cjs/domain/FormioUpdate.js +0 -3
  105. package/lib/cjs/domain/FormioUpdate.js.map +0 -1
  106. package/lib/cjs/domain/FormioUtils.js +0 -3
  107. package/lib/cjs/domain/FormioUtils.js.map +0 -1
  108. package/lib/cjs/domain/OnHook.js +0 -3
  109. package/lib/cjs/domain/OnHook.js.map +0 -1
  110. package/lib/cjs/domain/Resource.js +0 -3
  111. package/lib/cjs/domain/Resource.js.map +0 -1
  112. package/lib/cjs/index.js +0 -50
  113. package/lib/cjs/index.js.map +0 -1
  114. package/lib/cjs/middlewares/FormioAuthMiddleware.js +0 -41
  115. package/lib/cjs/middlewares/FormioAuthMiddleware.js.map +0 -1
  116. package/lib/cjs/package.json +0 -3
  117. package/lib/cjs/services/FormioAuthService.js +0 -182
  118. package/lib/cjs/services/FormioAuthService.js.map +0 -1
  119. package/lib/cjs/services/FormioDatabase.js +0 -140
  120. package/lib/cjs/services/FormioDatabase.js.map +0 -1
  121. package/lib/cjs/services/FormioHooksService.js +0 -81
  122. package/lib/cjs/services/FormioHooksService.js.map +0 -1
  123. package/lib/cjs/services/FormioInstaller.js +0 -44
  124. package/lib/cjs/services/FormioInstaller.js.map +0 -1
  125. package/lib/cjs/services/FormioRepository.js +0 -42
  126. package/lib/cjs/services/FormioRepository.js.map +0 -1
  127. package/lib/cjs/services/FormioService.js +0 -103
  128. package/lib/cjs/services/FormioService.js.map +0 -1
  129. package/lib/cjs/utils/isMongoId.js +0 -8
  130. package/lib/cjs/utils/isMongoId.js.map +0 -1
  131. package/lib/esm/package.json +0 -3
  132. package/lib/types-esm/FormioModule.d.ts +0 -24
  133. package/lib/types-esm/builder/FormioMapper.d.ts +0 -11
  134. package/lib/types-esm/components/AlterActions.d.ts +0 -18
  135. package/lib/types-esm/components/AlterAudit.d.ts +0 -5
  136. package/lib/types-esm/components/AlterHost.d.ts +0 -5
  137. package/lib/types-esm/components/AlterLog.d.ts +0 -5
  138. package/lib/types-esm/components/AlterSkip.d.ts +0 -7
  139. package/lib/types-esm/components/AlterTemplateExportSteps.d.ts +0 -12
  140. package/lib/types-esm/components/AlterTemplateImportSteps.d.ts +0 -11
  141. package/lib/types-esm/decorators/action.d.ts +0 -7
  142. package/lib/types-esm/decorators/actionCtx.d.ts +0 -23
  143. package/lib/types-esm/decorators/alter.d.ts +0 -6
  144. package/lib/types-esm/decorators/on.d.ts +0 -6
  145. package/lib/types-esm/decorators/useFormioAuth.d.ts +0 -6
  146. package/lib/types-esm/domain/AlterHook.d.ts +0 -3
  147. package/lib/types-esm/domain/Formio.d.ts +0 -112
  148. package/lib/types-esm/domain/FormioAction.d.ts +0 -20
  149. package/lib/types-esm/domain/FormioActionsIndex.d.ts +0 -15
  150. package/lib/types-esm/domain/FormioAuth.d.ts +0 -67
  151. package/lib/types-esm/domain/FormioBaseModel.d.ts +0 -11
  152. package/lib/types-esm/domain/FormioConfig.d.ts +0 -59
  153. package/lib/types-esm/domain/FormioCtxMapper.d.ts +0 -7
  154. package/lib/types-esm/domain/FormioDecodedToken.d.ts +0 -12
  155. package/lib/types-esm/domain/FormioErrors.d.ts +0 -53
  156. package/lib/types-esm/domain/FormioHooks.d.ts +0 -194
  157. package/lib/types-esm/domain/FormioJs.d.ts +0 -17
  158. package/lib/types-esm/domain/FormioModels.d.ts +0 -42
  159. package/lib/types-esm/domain/FormioRouter.d.ts +0 -7
  160. package/lib/types-esm/domain/FormioSettings.d.ts +0 -53
  161. package/lib/types-esm/domain/FormioTemplate.d.ts +0 -8
  162. package/lib/types-esm/domain/FormioTemplateUtil.d.ts +0 -13
  163. package/lib/types-esm/domain/FormioUpdate.d.ts +0 -19
  164. package/lib/types-esm/domain/FormioUtils.d.ts +0 -307
  165. package/lib/types-esm/domain/OnHook.d.ts +0 -3
  166. package/lib/types-esm/domain/Resource.d.ts +0 -18
  167. package/lib/types-esm/index.d.ts +0 -46
  168. package/lib/types-esm/middlewares/FormioAuthMiddleware.d.ts +0 -11
  169. package/lib/types-esm/services/FormioAuthService.d.ts +0 -84
  170. package/lib/types-esm/services/FormioDatabase.d.ts +0 -84
  171. package/lib/types-esm/services/FormioHooksService.d.ts +0 -17
  172. package/lib/types-esm/services/FormioInstaller.d.ts +0 -12
  173. package/lib/types-esm/services/FormioRepository.d.ts +0 -41
  174. package/lib/types-esm/services/FormioService.d.ts +0 -36
  175. package/lib/types-esm/utils/isMongoId.d.ts +0 -1
@@ -1,3 +1,5 @@
1
+ /// <reference types="mongoose/types/document.js" />
2
+ /// <reference types="mongoose/types/query.js" />
1
3
  /// <reference types="mongoose/types/aggregate.js" />
2
4
  /// <reference types="mongoose/types/callback.js" />
3
5
  /// <reference types="mongoose/types/collection.js" />
@@ -21,10 +23,11 @@
21
23
  /// <reference types="mongoose/types/utility.js" />
22
24
  /// <reference types="mongoose/types/validation.js" />
23
25
  /// <reference types="mongoose/types/virtuals.js" />
26
+ /// <reference types="mongoose/types/inferrawdoctype.js" />
24
27
  /// <reference types="mongoose/types/inferschematype.js" />
28
+ import { FormioAction, FormioActionItem, FormioForm, FormioRole, FormioSubmission, FormioToken } from "@tsed/formio-types";
25
29
  import { MongooseDocument, MongooseModel } from "@tsed/mongoose";
26
30
  import type { FilterQuery } from "mongoose";
27
- import { FormioAction, FormioActionItem, FormioForm, FormioRole, FormioSubmission, FormioToken } from "@tsed/formio-types";
28
31
  import { FormioMapper } from "../builder/FormioMapper.js";
29
32
  import { FormioService } from "./FormioService.js";
30
33
  export declare class FormioDatabase {
@@ -39,31 +42,37 @@ export declare class FormioDatabase {
39
42
  getFormioMapper(): Promise<FormioMapper>;
40
43
  hasForms(): Promise<boolean>;
41
44
  hasForm(name: string): Promise<boolean>;
42
- getForm(nameOrId: string): Promise<import("mongoose").LeanDocument<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & {
43
- _id: import("mongoose").Types.ObjectId;
44
- }> | null>;
45
+ getForm(nameOrId: string): Promise<(import("mongoose").FlattenMaps<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>>> & Required<{
46
+ _id: string;
47
+ }>) | null>;
45
48
  /**
46
49
  * Import form previously exported by export tool.
47
50
  * This method transform alias to a real mongoose _id
48
51
  * @param form
49
52
  * @param onCreate
50
53
  */
51
- importFormIfNotExists(form: FormioForm, onCreate?: (form: FormioForm) => any): Promise<import("mongoose").LeanDocument<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & {
52
- _id: import("mongoose").Types.ObjectId;
53
- }> | null>;
54
+ importFormIfNotExists(form: FormioForm, onCreate?: (form: FormioForm) => any): Promise<(import("mongoose").FlattenMaps<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>>> & Required<{
55
+ _id: string;
56
+ }>) | null>;
54
57
  /**
55
58
  * Import form previously exported by export tool.
56
59
  * This method transform alias to a real mongoose _id
57
60
  * @param form
58
61
  */
59
- importForm(form: FormioForm): Promise<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & {
60
- _id: import("mongoose").Types.ObjectId;
62
+ importForm(form: FormioForm): Promise<import("mongoose").Document<unknown, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>>> & import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & Required<{
63
+ _id: string;
64
+ }> & {
65
+ __v?: number | undefined;
61
66
  }>;
62
- saveForm(form: FormioForm): import("mongoose").Query<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & {
63
- _id: import("mongoose").Types.ObjectId;
64
- }, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & {
65
- _id: import("mongoose").Types.ObjectId;
66
- }, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>>>;
67
+ saveForm(form: FormioForm): import("mongoose").Query<import("mongoose").Document<unknown, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>>> & import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & Required<{
68
+ _id: string;
69
+ }> & {
70
+ __v?: number | undefined;
71
+ }, import("mongoose").Document<unknown, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>>> & import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>> & Required<{
72
+ _id: string;
73
+ }> & {
74
+ __v?: number | undefined;
75
+ }, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioForm & import("@tsed/mongoose").MongooseDocumentMethods<FormioForm>>, "findOneAndUpdate", {}>;
67
76
  getSubmissions<Data>(query?: FilterQuery<MongooseModel<FormioSubmission<Data>>>): Promise<MongooseDocument<FormioSubmission<Data>>[]>;
68
77
  /**
69
78
  * Import submission previously exported by export tool.
@@ -72,13 +81,19 @@ export declare class FormioDatabase {
72
81
  */
73
82
  importSubmission<Data = any>(submission: Omit<Partial<FormioSubmission<Data>>, "form"> & {
74
83
  form?: any;
75
- }): Promise<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & {
76
- _id: import("mongoose").Types.ObjectId;
84
+ }): Promise<import("mongoose").Document<unknown, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>>> & import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & Required<{
85
+ _id: string;
86
+ }> & {
87
+ __v?: number | undefined;
77
88
  }>;
78
- saveSubmission<Data = any>(submission: Partial<FormioSubmission<Data>>): import("mongoose").Query<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & {
79
- _id: import("mongoose").Types.ObjectId;
80
- }, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & {
81
- _id: import("mongoose").Types.ObjectId;
82
- }, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>>>;
89
+ saveSubmission<Data = any>(submission: Partial<FormioSubmission<Data>>): import("mongoose").Query<import("mongoose").Document<unknown, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>>> & import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & Required<{
90
+ _id: string;
91
+ }> & {
92
+ __v?: number | undefined;
93
+ }, import("mongoose").Document<unknown, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>>> & import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & Required<{
94
+ _id: string;
95
+ }> & {
96
+ __v?: number | undefined;
97
+ }, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>>, "findOneAndUpdate", {}>;
83
98
  idToBson(form?: any): any;
84
99
  }
@@ -1,7 +1,7 @@
1
1
  import { InjectorService } from "@tsed/common";
2
+ import { Request } from "express";
2
3
  import { FormioHooks } from "../domain/FormioHooks.js";
3
4
  import { FormioService } from "./FormioService.js";
4
- import { Request } from "express";
5
5
  export declare class FormioHooksService {
6
6
  protected injector: InjectorService;
7
7
  protected formio: FormioService;
@@ -1,3 +1,5 @@
1
+ /// <reference types="mongoose/types/document.js" />
2
+ /// <reference types="mongoose/types/query.js" />
1
3
  /// <reference types="mongoose/types/aggregate.js" />
2
4
  /// <reference types="mongoose/types/callback.js" />
3
5
  /// <reference types="mongoose/types/collection.js" />
@@ -21,9 +23,10 @@
21
23
  /// <reference types="mongoose/types/utility.js" />
22
24
  /// <reference types="mongoose/types/validation.js" />
23
25
  /// <reference types="mongoose/types/virtuals.js" />
26
+ /// <reference types="mongoose/types/inferrawdoctype.js" />
24
27
  /// <reference types="mongoose/types/inferschematype.js" />
25
- import type { FilterQuery } from "mongoose";
26
28
  import { MongooseDocument, MongooseModel } from "@tsed/mongoose";
29
+ import type { FilterQuery } from "mongoose";
27
30
  import { FormioSubmission } from "../domain/FormioModels.js";
28
31
  import { FormioDatabase } from "./FormioDatabase.js";
29
32
  export declare abstract class FormioRepository<SubmissionData = any> {
@@ -33,8 +36,10 @@ export declare abstract class FormioRepository<SubmissionData = any> {
33
36
  getFormId(): Promise<string>;
34
37
  saveSubmission(submission: Omit<Partial<FormioSubmission<SubmissionData>>, "form"> & {
35
38
  form?: any;
36
- }): Promise<import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<any, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & {
37
- _id: import("mongoose").Types.ObjectId;
39
+ }): Promise<import("mongoose").Document<unknown, {}, import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>>> & import("@tsed/mongoose").MongooseMergedDocument<import("mongoose").Document<unknown, any, any> & FormioSubmission<any> & import("@tsed/mongoose").MongooseDocumentMethods<FormioSubmission<any>>> & Required<{
40
+ _id: string;
41
+ }> & {
42
+ __v?: number | undefined;
38
43
  }>;
39
44
  getSubmissions(query?: FilterQuery<MongooseModel<FormioSubmission<SubmissionData>>>): Promise<MongooseDocument<FormioSubmission<SubmissionData>>[]>;
40
45
  findOneSubmission(query: any): Promise<MongooseDocument<FormioSubmission<SubmissionData>> | undefined>;
@@ -1,3 +1,28 @@
1
+ /// <reference types="mongoose/types/aggregate.js" />
2
+ /// <reference types="mongoose/types/callback.js" />
3
+ /// <reference types="mongoose/types/collection.js" />
4
+ /// <reference types="mongoose/types/connection.js" />
5
+ /// <reference types="mongoose/types/cursor.js" />
6
+ /// <reference types="mongoose/types/document.js" />
7
+ /// <reference types="mongoose/types/error.js" />
8
+ /// <reference types="mongoose/types/expressions.js" />
9
+ /// <reference types="mongoose/types/helpers.js" />
10
+ /// <reference types="mongoose/types/middlewares.js" />
11
+ /// <reference types="mongoose/types/indexes.js" />
12
+ /// <reference types="mongoose/types/models.js" />
13
+ /// <reference types="mongoose/types/mongooseoptions.js" />
14
+ /// <reference types="mongoose/types/pipelinestage.js" />
15
+ /// <reference types="mongoose/types/populate.js" />
16
+ /// <reference types="mongoose/types/query.js" />
17
+ /// <reference types="mongoose/types/schemaoptions.js" />
18
+ /// <reference types="mongoose/types/schematypes.js" />
19
+ /// <reference types="mongoose/types/session.js" />
20
+ /// <reference types="mongoose/types/types.js" />
21
+ /// <reference types="mongoose/types/utility.js" />
22
+ /// <reference types="mongoose/types/validation.js" />
23
+ /// <reference types="mongoose/types/virtuals.js" />
24
+ /// <reference types="mongoose/types/inferrawdoctype.js" />
25
+ /// <reference types="mongoose/types/inferschematype.js" />
1
26
  import { InjectorService } from "@tsed/common";
2
27
  import { Db } from "mongodb";
3
28
  import { Mongoose } from "mongoose";
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tsed/formio",
3
3
  "description": "Formio package for Ts.ED framework",
4
- "type": "commonjs",
5
- "version": "7.83.3",
4
+ "type": "module",
5
+ "version": "8.0.0-alpha.10",
6
6
  "keywords": [
7
7
  "Formio",
8
8
  "Ts.ED",
@@ -12,15 +12,14 @@
12
12
  "express"
13
13
  ],
14
14
  "source": "./src/index.ts",
15
- "main": "./lib/cjs/index.js",
15
+ "main": "./lib/esm/index.js",
16
16
  "module": "./lib/esm/index.js",
17
17
  "typings": "./lib/types/index.d.ts",
18
18
  "exports": {
19
19
  ".": {
20
20
  "types": "./lib/types/index.d.ts",
21
21
  "import": "./lib/esm/index.js",
22
- "require": "./lib/cjs/index.js",
23
- "default": "./lib/cjs/index.js"
22
+ "default": "./lib/esm/index.js"
24
23
  }
25
24
  },
26
25
  "scripts": {
@@ -32,33 +31,33 @@
32
31
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
33
32
  },
34
33
  "dependencies": {
35
- "@tsed/formio-types": "7.83.3",
36
- "@tsed/normalize-path": "7.83.3",
37
- "tslib": "2.6.1"
34
+ "@tsed/formio-types": "8.0.0-alpha.10",
35
+ "@tsed/normalize-path": "8.0.0-alpha.10",
36
+ "tslib": "2.7.0"
38
37
  },
39
38
  "devDependencies": {
40
- "@tsed/barrels": "7.83.3",
41
- "@tsed/common": "7.83.3",
42
- "@tsed/core": "7.83.3",
43
- "@tsed/di": "7.83.3",
44
- "@tsed/mongoose": "7.83.3",
45
- "@tsed/typescript": "7.83.3",
39
+ "@tsed/barrels": "8.0.0-alpha.10",
40
+ "@tsed/common": "8.0.0-alpha.10",
41
+ "@tsed/core": "8.0.0-alpha.10",
42
+ "@tsed/di": "8.0.0-alpha.10",
43
+ "@tsed/mongoose": "8.0.0-alpha.10",
44
+ "@tsed/typescript": "8.0.0-alpha.10",
46
45
  "@types/async": "3.2.24",
47
- "eslint": "^8.57.0",
48
- "express": "^4.19.1",
49
- "formio": "3.5.0",
50
- "mongodb": "*",
51
- "mongoose": "^6.12.7",
52
- "typescript": "4.9.5",
53
- "vitest": "2.0.4"
46
+ "eslint": "9.12.0",
47
+ "express": "^4.21.0",
48
+ "formio": "4.2.5",
49
+ "mongodb": "^6.9.0",
50
+ "mongoose": "8.7.0",
51
+ "typescript": "5.4.5",
52
+ "vitest": "2.1.2"
54
53
  },
55
54
  "peerDependencies": {
56
- "@tsed/common": "7.83.3",
55
+ "@tsed/common": "8.0.0-alpha.10",
57
56
  "express": "^4.17.1",
58
57
  "formio": ">=2.0.0",
59
58
  "lodash": "^4.17.21",
60
59
  "mongodb": "*",
61
- "mongoose": "^6.1.7"
60
+ "mongoose": "^8.7.0"
62
61
  },
63
62
  "peerDependenciesMeta": {
64
63
  "@tsed/common": {
@@ -71,5 +70,8 @@
71
70
  },
72
71
  "homepage": "https://github.com/tsedio/tsed/tree/production/packages/third-parties/formio",
73
72
  "author": "Romain Lenzotti",
74
- "license": "MIT"
73
+ "license": "MIT",
74
+ "publishConfig": {
75
+ "tag": "alpha"
76
+ }
75
77
  }
package/vitest.config.mts CHANGED
@@ -10,12 +10,12 @@ export default defineConfig(
10
10
  coverage: {
11
11
  ...presets.test.coverage,
12
12
  thresholds: {
13
- statements: 0,
14
- branches: 0,
15
- functions: 0,
16
- lines: 0
13
+ statements: 95.76,
14
+ branches: 96.66,
15
+ functions: 96.85,
16
+ lines: 95.76
17
17
  }
18
18
  }
19
19
  }
20
20
  }
21
- );
21
+ );
@@ -1,132 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormioModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@tsed/common");
6
- const core_1 = require("@tsed/core");
7
- const di_1 = require("@tsed/di");
8
- const normalize_path_1 = require("@tsed/normalize-path");
9
- const AlterActions_js_1 = require("./components/AlterActions.js");
10
- const AlterAudit_js_1 = require("./components/AlterAudit.js");
11
- const AlterHost_js_1 = require("./components/AlterHost.js");
12
- const AlterLog_js_1 = require("./components/AlterLog.js");
13
- const AlterSkip_js_1 = require("./components/AlterSkip.js");
14
- const AlterTemplateExportSteps_js_1 = require("./components/AlterTemplateExportSteps.js");
15
- const AlterTemplateImportSteps_js_1 = require("./components/AlterTemplateImportSteps.js");
16
- const FormioAuthService_js_1 = require("./services/FormioAuthService.js");
17
- const FormioHooksService_js_1 = require("./services/FormioHooksService.js");
18
- const FormioInstaller_js_1 = require("./services/FormioInstaller.js");
19
- const FormioService_js_1 = require("./services/FormioService.js");
20
- let FormioModule = class FormioModule {
21
- $onInit() {
22
- return this.init((0, core_1.deepClone)(this.settings));
23
- }
24
- init(options) {
25
- return this.formio.init(options, this.hooks.getHooks());
26
- }
27
- async $onRoutesInit() {
28
- if (this.formio.isInit()) {
29
- this.app.use(this.baseUrl, this.formio.middleware.restrictRequestTypes, this.formio.router);
30
- if (await this.shouldInstall()) {
31
- await this.installer.install(this.template, this.root);
32
- }
33
- }
34
- }
35
- async $logRoutes(routes) {
36
- if (this.formio.isInit()) {
37
- const spec = (await this.formio.swagger({
38
- $ctx: {
39
- request: {
40
- protocol: "http",
41
- host: "localhost"
42
- }
43
- }
44
- }, this.formio.router));
45
- const { baseUrl } = this;
46
- Object.entries(spec.paths).forEach(([path, methods]) => {
47
- Object.entries(methods).forEach(([method, operation]) => {
48
- routes.push({
49
- method,
50
- name: operation.operationId,
51
- url: (0, normalize_path_1.normalizePath)(baseUrl, path.replace(/\/{(.*)}/gi, "/:$1")),
52
- className: "formio",
53
- methodClassName: operation.operationId
54
- });
55
- });
56
- });
57
- }
58
- return routes;
59
- }
60
- // istanbul ignore next
61
- $onReady() {
62
- if (this.formio.isInit() && "getBestHost" in this.injector.settings) {
63
- const { injector } = this;
64
- // @ts-ignore
65
- const host = injector.settings.getBestHost();
66
- const url = host.toString();
67
- injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || "/"}`);
68
- }
69
- }
70
- async shouldInstall() {
71
- const hasForms = await this.installer.hasForms();
72
- return this.template && !(hasForms || this.skipInstall);
73
- }
74
- };
75
- tslib_1.__decorate([
76
- (0, common_1.Inject)(),
77
- tslib_1.__metadata("design:type", FormioService_js_1.FormioService)
78
- ], FormioModule.prototype, "formio", void 0);
79
- tslib_1.__decorate([
80
- (0, common_1.Inject)(),
81
- tslib_1.__metadata("design:type", FormioHooksService_js_1.FormioHooksService)
82
- ], FormioModule.prototype, "hooks", void 0);
83
- tslib_1.__decorate([
84
- (0, common_1.Inject)(),
85
- tslib_1.__metadata("design:type", FormioInstaller_js_1.FormioInstaller)
86
- ], FormioModule.prototype, "installer", void 0);
87
- tslib_1.__decorate([
88
- (0, common_1.Inject)(),
89
- tslib_1.__metadata("design:type", common_1.PlatformApplication)
90
- ], FormioModule.prototype, "app", void 0);
91
- tslib_1.__decorate([
92
- (0, common_1.Inject)(),
93
- tslib_1.__metadata("design:type", common_1.InjectorService)
94
- ], FormioModule.prototype, "injector", void 0);
95
- tslib_1.__decorate([
96
- (0, common_1.Constant)("formio", {}),
97
- tslib_1.__metadata("design:type", Object)
98
- ], FormioModule.prototype, "settings", void 0);
99
- tslib_1.__decorate([
100
- (0, common_1.Constant)("formio.baseUrl", "/"),
101
- tslib_1.__metadata("design:type", String)
102
- ], FormioModule.prototype, "baseUrl", void 0);
103
- tslib_1.__decorate([
104
- (0, common_1.Constant)("formio.skipInstall", false),
105
- tslib_1.__metadata("design:type", Boolean)
106
- ], FormioModule.prototype, "skipInstall", void 0);
107
- tslib_1.__decorate([
108
- (0, common_1.Constant)("formio.template"),
109
- tslib_1.__metadata("design:type", Object)
110
- ], FormioModule.prototype, "template", void 0);
111
- tslib_1.__decorate([
112
- (0, common_1.Constant)("formio.root"),
113
- tslib_1.__metadata("design:type", Object)
114
- ], FormioModule.prototype, "root", void 0);
115
- FormioModule = tslib_1.__decorate([
116
- (0, di_1.Module)({
117
- imports: [
118
- FormioService_js_1.FormioService,
119
- FormioHooksService_js_1.FormioHooksService,
120
- FormioAuthService_js_1.FormioAuthService,
121
- AlterActions_js_1.AlterActions,
122
- AlterHost_js_1.AlterHost,
123
- AlterAudit_js_1.AlterAudit,
124
- AlterLog_js_1.AlterLog,
125
- AlterSkip_js_1.AlterSkip,
126
- AlterTemplateImportSteps_js_1.AlterTemplateImportSteps,
127
- AlterTemplateExportSteps_js_1.AlterTemplateExportSteps
128
- ]
129
- })
130
- ], FormioModule);
131
- exports.FormioModule = FormioModule;
132
- //# sourceMappingURL=FormioModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormioModule.js","sourceRoot":"","sources":["../../src/FormioModule.ts"],"names":[],"mappings":";;;;AAAA,yCAAiI;AACjI,qCAAqC;AACrC,iCAAgC;AAChC,yDAAmD;AACnD,kEAA0D;AAC1D,8DAAsD;AACtD,4DAAoD;AACpD,0DAAkD;AAClD,4DAAoD;AACpD,0FAAkF;AAClF,0FAAkF;AAGlF,0EAAkE;AAClE,4EAAoE;AACpE,sEAA8D;AAC9D,kEAA0D;AAgBnD,IAAM,YAAY,GAAlB,MAAM,YAAY;IA+BvB,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,IAAA,gBAAS,EAAC,IA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AAE;sCACW,wBAAe;8CAAC;AAEpC;IAAC,IAAA,iBAAQ,EAAC,QAAQ,EAAE,EAAE,CAAC;;8CACU;AAEjC;IAAC,IAAA,iBAAQ,EAAC,gBAAgB,EAAE,GAAG,CAAC;;6CACN;AAE1B;IAAC,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,KAAK,CAAC;;iDACP;AAE/B;IAAC,IAAA,iBAAQ,EAAC,iBAAiB,CAAC;;8CACQ;AAEpC;IAAC,IAAA,iBAAQ,EAAC,aAAa,CAAC;;0CACH;AA7BV,YAAY;IAdxB,IAAA,WAAM,EAAC;QACN,OAAO,EAAE;YACP,gCAAa;YACb,0CAAkB;YAClB,wCAAiB;YACjB,8BAAY;YACZ,wBAAS;YACT,0BAAU;YACV,sBAAQ;YACR,wBAAS;YACT,sDAAwB;YACxB,sDAAwB;SACzB;KACF,CAAC;GACW,YAAY,CAgGxB;AAhGY,oCAAY"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormioMapper = void 0;
4
- class FormioMapper {
5
- constructor(ctxData) {
6
- this.ctxData = ctxData;
7
- }
8
- find(key) {
9
- const store = Object.values(this.ctxData).find((store) => store.get(key));
10
- return store?.get(key);
11
- }
12
- findId(data) {
13
- const key = String(data).startsWith("$machineName:") ? String(data) : `$machineName:${String(data)}`;
14
- const item = this.find(key);
15
- return item ? item._id : undefined;
16
- }
17
- findMachineName(data) {
18
- const key = String(data);
19
- const item = this.find(key);
20
- return item ? `$machineName:${item.name || item.machineName}` : undefined;
21
- }
22
- mapToExport(data) {
23
- return this.mapData(data, this.findMachineName.bind(this));
24
- }
25
- mapToImport(data) {
26
- return this.mapData(data, this.findId.bind(this));
27
- }
28
- mapData(data, resolver) {
29
- if (!data) {
30
- return data;
31
- }
32
- if (Array.isArray(data)) {
33
- return data.map((item) => {
34
- return this.mapData(item, resolver);
35
- });
36
- }
37
- const key = resolver(data, this.ctxData);
38
- if (key) {
39
- return key;
40
- }
41
- if (typeof data === "object" && !("_bsontype" in data) && !(data instanceof Date)) {
42
- const isForm = data.path && data.type;
43
- const mapped = Object.entries(data).reduce((obj, [key, value]) => {
44
- return {
45
- ...obj,
46
- [key]: this.mapData(value, resolver)
47
- };
48
- }, {});
49
- return isForm
50
- ? {
51
- ...mapped,
52
- name: data.name,
53
- machineName: data.machineName || data.name
54
- }
55
- : mapped;
56
- }
57
- return data;
58
- }
59
- }
60
- exports.FormioMapper = FormioMapper;
61
- //# sourceMappingURL=FormioMapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormioMapper.js","sourceRoot":"","sources":["../../../src/builder/FormioMapper.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IACvB,YAAqB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEjD,IAAI,CAAC,GAAW;QACd,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAE1E,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACrG,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5B,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IACrC,CAAC;IAED,eAAe,CAAC,IAAS;QACvB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,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AAK,CAAC,EAAE,EAAE;gBAC/D,OAAO;oBACL,GAAG,GAAG;oBACN,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;iBACrC,CAAC;YACJ,CAAC,EAAE,EAAE,CAAC,CAAC;YAEP,OAAO,MAAM;gBACX,CAAC,CAAC;oBACE,GAAG,MAAM;oBACT,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI;iBAC3C;gBACH,CAAC,CAAC,MAAM,CAAC;SACZ;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AApED,oCAoEC"}
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlterActions = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@tsed/common");
6
- const core_1 = require("@tsed/core");
7
- const di_1 = require("@tsed/di");
8
- const platform_params_1 = require("@tsed/platform-params");
9
- const platform_response_filter_1 = require("@tsed/platform-response-filter");
10
- const schema_1 = require("@tsed/schema");
11
- const alter_js_1 = require("../decorators/alter.js");
12
- const FormioService_js_1 = require("../services/FormioService.js");
13
- let AlterActions = class AlterActions {
14
- transform(actions) {
15
- const { Action } = this.formio;
16
- return this.getActions().reduce((actions, provider) => {
17
- const instance = this.injector.invoke(provider.token);
18
- const options = provider.store.get("formio:action");
19
- const resolveHandler = this.createHandler(provider, "resolve");
20
- return {
21
- ...actions,
22
- [options.name]: class extends Action {
23
- static { this.access = options.access; }
24
- static async info(req, res, next) {
25
- let opts = { ...options };
26
- if (instance.info) {
27
- opts = await instance.info(opts, req, res);
28
- }
29
- next(null, opts);
30
- }
31
- static async settingsForm(req, res, next) {
32
- next(null, await instance.settingsForm(req, res));
33
- }
34
- resolve(handler, method, req, res, next, setActionItemMessage) {
35
- resolveHandler(this, handler, method, req, res, next, setActionItemMessage);
36
- }
37
- }
38
- };
39
- }, actions);
40
- }
41
- getActions() {
42
- return this.injector.getProviders("formio:action");
43
- }
44
- createHandler(provider, propertyKey) {
45
- const compiledHandler = this.params.compileHandler({
46
- token: provider.token,
47
- propertyKey
48
- });
49
- return async (action, handler, method, req, res, next, setActionItemMessage) => {
50
- const { $ctx } = req;
51
- if ($ctx) {
52
- $ctx.set("ACTION_CTX", { handler, method, setActionItemMessage, action });
53
- $ctx.endpoint = schema_1.EndpointMetadata.get(provider.useClass, "resolve");
54
- try {
55
- if (await this.onRequest(compiledHandler, $ctx)) {
56
- next();
57
- }
58
- }
59
- catch (er) {
60
- next(er);
61
- }
62
- }
63
- };
64
- }
65
- async onRequest(handler, $ctx) {
66
- const resolver = new core_1.AnyToPromise();
67
- const { state, data, status, headers } = await resolver.call(() => handler({ $ctx }));
68
- if (state === core_1.AnyToPromiseStatus.RESOLVED) {
69
- if (status) {
70
- $ctx.response.status(status);
71
- }
72
- if (headers) {
73
- $ctx.response.setHeaders(headers);
74
- }
75
- if (data !== undefined) {
76
- $ctx.data = data;
77
- return this.flush($ctx.data, $ctx);
78
- }
79
- return true;
80
- }
81
- }
82
- async flush(data, $ctx) {
83
- const { response } = $ctx;
84
- if (!$ctx.isDone()) {
85
- (0, common_1.setResponseHeaders)($ctx);
86
- data = await this.responseFilter.serialize(data, $ctx);
87
- data = await this.responseFilter.transform(data, $ctx);
88
- response.body(data);
89
- }
90
- return response;
91
- }
92
- };
93
- tslib_1.__decorate([
94
- (0, di_1.Inject)(),
95
- tslib_1.__metadata("design:type", di_1.InjectorService)
96
- ], AlterActions.prototype, "injector", void 0);
97
- tslib_1.__decorate([
98
- (0, di_1.Inject)(),
99
- tslib_1.__metadata("design:type", FormioService_js_1.FormioService)
100
- ], AlterActions.prototype, "formio", void 0);
101
- tslib_1.__decorate([
102
- (0, di_1.Inject)(),
103
- tslib_1.__metadata("design:type", platform_params_1.PlatformParams)
104
- ], AlterActions.prototype, "params", void 0);
105
- tslib_1.__decorate([
106
- (0, di_1.Inject)(),
107
- tslib_1.__metadata("design:type", platform_response_filter_1.PlatformResponseFilter)
108
- ], AlterActions.prototype, "responseFilter", void 0);
109
- AlterActions = tslib_1.__decorate([
110
- (0, alter_js_1.Alter)("actions")
111
- ], AlterActions);
112
- exports.AlterActions = AlterActions;
113
- //# sourceMappingURL=AlterActions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AlterActions.js","sourceRoot":"","sources":["../../../src/components/AlterActions.ts"],"names":[],"mappings":";;;;AAAA,yCAAiE;AACjE,qCAA4D;AAC5D,iCAA2D;AAE3D,2DAAqD;AACrD,6EAAsE;AACtE,yCAA8C;AAC9C,qDAA6C;AAI7C,mEAA2D;AAGpD,IAAM,YAAY,GAAlB,MAAM,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,EAAE,KAAM,SAAQ,MAAM;6BAC3B,WAAM,GAAG,OAAO,CAAC,MAAM,CAAC;oBAE/B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAQ,EAAE,GAAQ,EAAE,IAAc;wBAClD,IAAI,IAAI,GAAG,EAAC,GAAG,OAAO,EAAC,CAAC;wBAExB,IAAI,QAAQ,CAAC,IAAI,EAAE;4BACjB,IAAI,GAAG,MAAM,QAAQ,CAAC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C9D,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC;YAE9D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAxHC;IAAC,IAAA,WAAM,GAAE;sCACW,oBAAe;8CAAC;AAEpC;IAAC,IAAA,WAAM,GAAE;sCACS,gCAAa;4CAAC;AAEhC;IAAC,IAAA,WAAM,GAAE;sCACS,gCAAc;4CAAC;AAEjC;IAAC,IAAA,WAAM,GAAE;sCACiB,iDAAsB;oDAAC;AAXtC,YAAY;IADxB,IAAA,gBAAK,EAAC,SAAS,CAAC;GACJ,YAAY,CAyHxB;AAzHY,oCAAY"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlterAudit = void 0;
4
- const tslib_1 = require("tslib");
5
- const alter_js_1 = require("../decorators/alter.js");
6
- let AlterAudit = class AlterAudit {
7
- transform(info, event, ctx) {
8
- ctx.logger.info({ event, info });
9
- return false;
10
- }
11
- };
12
- AlterAudit = tslib_1.__decorate([
13
- (0, alter_js_1.Alter)("audit")
14
- ], AlterAudit);
15
- exports.AlterAudit = AlterAudit;
16
- //# sourceMappingURL=AlterAudit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AlterAudit.js","sourceRoot":"","sources":["../../../src/components/AlterAudit.ts"],"names":[],"mappings":";;;;AACA,qDAA6C;AAItC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,SAAS,CAAC,IAAW,EAAE,KAAa,EAAE,GAAc;QAClD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AALY,UAAU;IADtB,IAAA,gBAAK,EAAC,OAAO,CAAC;GACF,UAAU,CAKtB;AALY,gCAAU"}