@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,194 +0,0 @@
1
- import { MongooseDocument } from "@tsed/mongoose";
2
- import { Request, Response } from "express";
3
- import { FilterQuery, Schema, SchemaDefinition } from "mongoose";
4
- import { Formio } from "./Formio.js";
5
- import { FormioActions } from "./FormioActionsIndex.js";
6
- import { FormioConfig } from "./FormioConfig.js";
7
- import { FormioDecodedToken } from "./FormioDecodedToken.js";
8
- import { FormioJs } from "./FormioJs.js";
9
- import { FormioActionItem, FormioForm, FormioModelsModels, FormioSubmission } from "./FormioModels.js";
10
- import { FormioSettings } from "./FormioSettings.js";
11
- import { ResourceRestOptions } from "./Resource.js";
12
- export type FormioInitEvent = "alias" | "params" | "token" | "getTempToken" | "logout" | "current" | "access" | "perms";
13
- export interface FormioHooks {
14
- settings?: (settings: FormioSettings, req: Request, cb: Function) => FormioSettings;
15
- alter?: {
16
- alias?: (alias: string, req: Request, res: Response) => string;
17
- /**
18
- * Alter FormioJs configuration
19
- * @param formIo
20
- */
21
- configFormio?: (formIo: {
22
- Formio: FormioJs;
23
- }) => void;
24
- /**
25
- * Alter formio server configuration.
26
- * @param config
27
- */
28
- updateConfig?: (config: FormioConfig) => FormioConfig;
29
- /**
30
- * Alter audit log.
31
- * @param info
32
- * @param event
33
- * @param req
34
- */
35
- audit?: (info: any[], event: string, req: Request) => void;
36
- /**
37
- * Alter log.
38
- * @param info
39
- * @param event
40
- * @param req
41
- */
42
- log?: (event: string, req: Request, ...info: string[]) => void;
43
- /**
44
- * Alter available actions
45
- * @param info
46
- * @param event
47
- * @param req
48
- */
49
- actions?: (actions: FormioActions) => FormioActions;
50
- /**
51
- * Skip auth for the current request.
52
- * @param info
53
- * @param event
54
- * @param req
55
- */
56
- skip?: (value: boolean, req: Request) => boolean;
57
- /**
58
- * Resolve host.
59
- * @param baseUrl
60
- * @param req
61
- */
62
- host?: (baseUrl: string, req: Request) => string;
63
- /**
64
- * `/form/${req.params.formId}/action`
65
- * @param action
66
- * @param req
67
- */
68
- path?: (path: string, req: Request) => any;
69
- /**
70
- * Restrict request types
71
- * @param methods
72
- */
73
- methods?: (methods: string[]) => string[];
74
- /**
75
- * Return the cors configuration.
76
- */
77
- cors?: () => Record<string, any>;
78
- /**
79
- * Return the current user submission.
80
- */
81
- currentUser?: (user: any) => any;
82
- /**
83
- * Alter current form.
84
- * @param form
85
- */
86
- currentForm?: (form: FormioForm) => FormioForm;
87
- /**
88
- * Alter formio
89
- * @param formio
90
- */
91
- formio?: (formio: Formio) => Formio;
92
- /**
93
- * Alter models
94
- * @param models
95
- */
96
- models?: (models: FormioModelsModels) => FormioModelsModels;
97
- /**
98
- * Alter resources
99
- * @param resources
100
- */
101
- resources?: (resources: {
102
- form: any;
103
- submission: any;
104
- role: any;
105
- }) => any;
106
- resourceAccessFilter?: (search: any, req: Request, done: (err: unknown, newSearch: any) => void) => void;
107
- actionMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;
108
- formMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;
109
- roleMachineName?: (name: string, document: MongooseDocument<any>, done: Function) => void;
110
- actionSchema?: (schema: Schema) => Schema;
111
- actionItemSchema?: (schema: Schema) => Schema;
112
- formSchema?: (schema: Schema) => Schema;
113
- roleSchema?: (schema: Schema) => Schema;
114
- schemaSchema?: (schema: Schema) => Schema;
115
- submissionSchema?: (schema: Schema | SchemaDefinition) => Schema;
116
- tokenSchema?: (schema: Schema) => Schema;
117
- permissionSchema?: (schema: SchemaDefinition) => SchemaDefinition;
118
- fieldMatchAccessPermissionSchema?: (schemaOptions: SchemaDefinition) => SchemaDefinition;
119
- actionsQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
120
- submissionQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
121
- roleQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
122
- formQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
123
- actionItem?: (actionItem: FormioActionItem, req: Request) => FormioActionItem;
124
- actionContext?: (actionContext: any, req: Request) => any;
125
- actionInfo?: (action: any, req: Request) => any;
126
- submission?: (req: Request, res: Response, done: Function) => void;
127
- submissionRequest?: (submission: FormioSubmission) => FormioSubmission;
128
- validateSubmissionForm?: (form: FormioForm, submission: FormioSubmission, done: Function) => void;
129
- postSubmissionUpdate?: (req: Request, res: Response, submissionUpdate: FormioSubmission) => void;
130
- /**
131
- * Allow modules to hook into the form loader middleware.
132
- * @param item
133
- * @param req
134
- * @param done
135
- */
136
- formResponse?: (item: any, req: Request, done: Function) => void;
137
- requestParams?: (req: Request & {
138
- formId: string;
139
- subId: string;
140
- roleId: string;
141
- }, params: Record<string, any>) => void;
142
- /**
143
- * Alter submitted params
144
- * @param params
145
- */
146
- submissionParams?: (params: string[]) => string[];
147
- /**
148
- * Alter actions routes.
149
- */
150
- actionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
151
- /**
152
- * Alter roles routes.
153
- */
154
- rolesRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
155
- /**
156
- * Alter forms routes.
157
- */
158
- formRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
159
- /**
160
- * Alter submission routes.
161
- */
162
- submissionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
163
- user?: (user: any, done: (err: any, user: any) => void) => void;
164
- login?: (user: any, req: Request, done: (err: any) => void) => void;
165
- token?: (token: FormioDecodedToken, form: FormioForm, req: Request) => FormioDecodedToken;
166
- tokenDecode?: (token: FormioDecodedToken, req: Request, done: (err: any, decoded: FormioDecodedToken) => void) => void;
167
- submissionRequestTokenQuery?: (query: {
168
- formId: string;
169
- submissionId: string;
170
- }, token: string) => any;
171
- [key: string]: any;
172
- };
173
- on?: {
174
- init?: (type: FormioInitEvent) => boolean;
175
- [key: string]: any;
176
- };
177
- }
178
- export interface FormioHook {
179
- /**
180
- * Run settings function.
181
- */
182
- settings(req: Request, cb: Function): void;
183
- /**
184
- * Emit an event.
185
- * @param args
186
- */
187
- invoke<T = any>(...args: any[]): T | boolean;
188
- /**
189
- * Alter the given value by calling all listener.
190
- * @param event
191
- * @param args
192
- */
193
- alter(event: string, ...args: any[]): any;
194
- }
@@ -1,17 +0,0 @@
1
- export interface FormioJs {
2
- forms: Record<string, any>;
3
- cache: Record<string, any>;
4
- Components: {
5
- components: {
6
- component: {
7
- Validator: {
8
- db: any | null;
9
- token: any | null;
10
- form: any | null;
11
- submission: any | null;
12
- };
13
- };
14
- };
15
- };
16
- getToken(): string;
17
- }
@@ -1,42 +0,0 @@
1
- import { MongooseDocument } from "@tsed/mongoose";
2
- import { Schema } from "mongoose";
3
- import { FormioActionModelCtor, FormioActionMongooseSchema } from "./FormioAction.js";
4
- import { FormioBaseModel, FormioModel, FormioMongooseSchema } from "./FormioBaseModel.js";
5
- import { FormioActionItem, FormioForm, FormioRole, FormioSchema, FormioSubmission, FormioToken } from "@tsed/formio-types";
6
- export * from "@tsed/formio-types";
7
- export type WithID<T> = T & {
8
- _id: string;
9
- };
10
- export interface FormioSchemas {
11
- action: FormioActionMongooseSchema;
12
- actionItem: Schema<MongooseDocument<FormioActionItem>>;
13
- form: FormioMongooseSchema<FormioForm>;
14
- role: FormioMongooseSchema<FormioRole>;
15
- schema: Schema<MongooseDocument<FormioSchema>>;
16
- submission: Schema<MongooseDocument<FormioSubmission>>;
17
- token: Schema<MongooseDocument<FormioToken>>;
18
- [key: string]: Schema<MongooseDocument<any>>;
19
- }
20
- export type FormioModelsModels = {
21
- action: FormioActionModelCtor;
22
- actionItem: FormioBaseModel<FormioActionItem>;
23
- form: FormioModel<FormioForm>;
24
- role: FormioModel<FormioRole>;
25
- schema: FormioBaseModel<FormioSchema>;
26
- submission: FormioBaseModel<FormioSubmission>;
27
- token: FormioBaseModel<FormioToken>;
28
- } & Record<string, FormioBaseModel>;
29
- export interface FormioModels {
30
- schemas: FormioSchemas;
31
- models: FormioModelsModels;
32
- specs: {
33
- action: any;
34
- actionItem: any;
35
- form: any;
36
- role: any;
37
- schema: any;
38
- submission: any;
39
- token: any;
40
- [key: string]: any;
41
- };
42
- }
@@ -1,7 +0,0 @@
1
- import { Router } from "express";
2
- import { Formio, FormioBase } from "./Formio.js";
3
- import { FormioHooks } from "./FormioHooks.js";
4
- export interface FormioRouter extends Router {
5
- formio: FormioBase;
6
- init(hooks: FormioHooks): Promise<Formio>;
7
- }
@@ -1,53 +0,0 @@
1
- export interface FormioSettings extends Record<string, any> {
2
- office365: {
3
- tenant: string;
4
- clientId: string;
5
- email: string;
6
- cert: string;
7
- thumbprint: string;
8
- [key: string]: any;
9
- };
10
- databases: {
11
- mysql: {
12
- host: string;
13
- port: string;
14
- database: string;
15
- user: string;
16
- password: string;
17
- [key: string]: any;
18
- };
19
- mssql: {
20
- host: string;
21
- port: string;
22
- database: string;
23
- user: string;
24
- password: string;
25
- [key: string]: any;
26
- };
27
- };
28
- email: {
29
- gmail: {
30
- auth: {
31
- user: string;
32
- pass: string;
33
- [key: string]: any;
34
- };
35
- [key: string]: any;
36
- };
37
- sendgrid: {
38
- auth: {
39
- api_user: string;
40
- api_key: string;
41
- [key: string]: any;
42
- };
43
- [key: string]: any;
44
- };
45
- mandrill: {
46
- auth: {
47
- apiKey: string;
48
- [key: string]: any;
49
- };
50
- [key: string]: any;
51
- };
52
- };
53
- }
@@ -1,8 +0,0 @@
1
- import { FormioActionItem, FormioForm, FormioRole, FormioSubmission } from "./FormioModels.js";
2
- export interface FormioTemplate {
3
- roles?: Record<string, FormioRole>;
4
- forms: Record<string, FormioForm>;
5
- resources: Record<string, FormioForm>;
6
- actions: Record<string, FormioActionItem>;
7
- submissions?: Record<string, FormioSubmission[]>;
8
- }
@@ -1,13 +0,0 @@
1
- import { FormioTemplate } from "./FormioTemplate.js";
2
- export interface FormioExportOptions {
3
- title: string;
4
- version: string;
5
- description: string;
6
- name: string;
7
- }
8
- export interface FormioTemplateUtil {
9
- import: {
10
- template(template: FormioTemplate, cb: (er: unknown, data: FormioTemplate) => void): void;
11
- };
12
- export(options: Partial<FormioExportOptions>, cb: (er: unknown, data: FormioTemplate) => void): void;
13
- }
@@ -1,19 +0,0 @@
1
- import { NextFunction, Request, Response } from "express";
2
- import { Db } from "mongodb";
3
- import { Formio } from "./Formio.js";
4
- export interface FormioUpdate {
5
- db: Db;
6
- version: string;
7
- /**
8
- *
9
- * @param cb
10
- */
11
- initialize(cb: (err: unknown, db: any) => void): Promise<Formio>;
12
- /**
13
- *
14
- * @param req
15
- * @param res
16
- * @param next
17
- */
18
- sanityCheck(req: Request, res: Response, next: NextFunction): void;
19
- }
@@ -1,307 +0,0 @@
1
- import { Request, Response } from "express";
2
- import { FormioErrors } from "./FormioErrors.js";
3
- import { FormioJs } from "./FormioJs.js";
4
- export interface FormioUtil {
5
- Formio: FormioJs;
6
- /**
7
- * Iterate through each component within a form.
8
- *
9
- * @param {Object} components
10
- * The components to iterate.
11
- * @param {Function} fn
12
- * The iteration function to invoke for each component.
13
- * @param {Boolean} includeAll
14
- * Whether or not to include layout components.
15
- * @param {String} path
16
- */
17
- eachComponent: Function;
18
- /**
19
- * Get a component by its key
20
- *
21
- * @param {Object} components
22
- * The components to iterate.
23
- * @param {String} key
24
- * The key of the component to get.
25
- *
26
- * @returns {Object}
27
- * The component that matches the given key, or undefined if not found.
28
- */
29
- getComponent: Function;
30
- /**
31
- * Define if component should be considered input component
32
- *
33
- * @param {Object} componentJson
34
- * JSON of component to check
35
- *
36
- * @returns {Boolean}
37
- * If component is input or not
38
- */
39
- isInputComponent: Function;
40
- /**
41
- * Flatten the form components for data manipulation.
42
- *
43
- * @param {Object} components
44
- * The components to iterate.
45
- * @param {Boolean} includeAll
46
- * Whether or not to include layout components.
47
- *
48
- * @returns {Object}
49
- * The flattened components map.
50
- */
51
- flattenComponents: Function;
52
- /**
53
- * Get the value for a component key, in the given submission.
54
- *
55
- * @param {Object} submission
56
- * A submission object to search.
57
- * @param {String} key
58
- * A for components API key to search for.
59
- */
60
- getValue: Function;
61
- /**
62
- * Determine if a component is a layout component or not.
63
- *
64
- * @param {Object} component
65
- * The component to check.
66
- *
67
- * @returns {Boolean}
68
- * Whether or not the component is a layout component.
69
- */
70
- isLayoutComponent: Function;
71
- /**
72
- * Apply JSON logic functionality.
73
- *
74
- * @param component
75
- * @param row
76
- * @param data
77
- */
78
- jsonLogic: Function;
79
- /**
80
- * Check if the condition for a component is true or not.
81
- *
82
- * @param component
83
- * @param row
84
- * @param data
85
- */
86
- checkCondition: Function;
87
- flattenComponentsForRender: Function;
88
- renderFormSubmission: Function;
89
- renderComponentValue: Function;
90
- /**
91
- * A node-fetch shim adding support for http(s) proxy and allowing
92
- * invalid tls certificates (to be used with self signed certificates).
93
- *
94
- * @param {any} url The request url string or url like object.
95
- * @param {any} options The request options object.
96
- * @returns {Promise<Response>} The promise with the node-fetch response object.
97
- */
98
- fetch: any;
99
- base64: {
100
- /**
101
- * Base64 encode the given data.
102
- *
103
- * @param {String} decoded
104
- * The decoded data to encode.
105
- *
106
- * @return {String}
107
- * The base64 representation of the given data.
108
- */
109
- encode(decoded: string): string;
110
- /**
111
- * Base64 decode the given data.
112
- *
113
- * @param {String} encoded
114
- * The encoded data to decode.
115
- *
116
- * @return {String}
117
- * The ascii representation of the given encoded data.
118
- */
119
- decode(encoded: string): string;
120
- };
121
- /**
122
- * Application error codes.
123
- */
124
- errorCodes: FormioErrors;
125
- layoutComponents: ("panel" | "table" | "well" | "columns" | "fieldset" | "tabs" | string)[];
126
- deleteProp(target: any, propertyKey: any): any;
127
- /**
128
- * A wrapper around console.log that gets ignored by eslint.
129
- *
130
- * @param {*} content
131
- * The content to pass to console.log.
132
- */
133
- log(content: string): void;
134
- /**
135
- * Determine if a value is a boolean representation.
136
- * @param value
137
- * @return {boolean}
138
- */
139
- isBoolean(value: any): boolean;
140
- /**
141
- * Quick boolean coercer.
142
- * @param value
143
- * @return {boolean}
144
- */
145
- boolean(value: any): boolean;
146
- /**
147
- * A wrapper around console.error that gets ignored by eslint.
148
- *
149
- * @param {*} content
150
- * The content to pass to console.error.
151
- */
152
- error(content: any): void;
153
- /**
154
- * Returns the URL alias for a form provided the url.
155
- */
156
- getAlias(req: Request, reservedForms: string[]): {
157
- alias: string;
158
- additional: string;
159
- };
160
- /**
161
- * Escape a string for use in regex.
162
- *
163
- * @param str
164
- * @returns {*}
165
- */
166
- escapeRegExp(str: string): string;
167
- /**
168
- * Create a sub response object that only handles errors.
169
- *
170
- * @param res
171
- * @return {{send: function(), sendStatus: function(*=), status: function(*=)}}
172
- */
173
- createSubResponse(res: Response): Response;
174
- /**
175
- * Create a sub-request object from the original request.
176
- *
177
- * @param req
178
- */
179
- createSubRequest(req: Request): Request;
180
- /**
181
- * Return the objectId.
182
- *
183
- * @param id
184
- * @returns {*}
185
- * @constructor
186
- */
187
- ObjectId(id: string): any;
188
- /**
189
- * Search the request headers for the given key.
190
- *
191
- * @param req
192
- * The Express request object.
193
- * @param key
194
- * The key to search for in the headers.
195
- *
196
- * @return
197
- * The header value if found or false.
198
- */
199
- getHeader(req: Request, key: string): string | false;
200
- /**
201
- * Search the request query for the given key.
202
- *
203
- * @param req
204
- * The Express request object.
205
- * @param key
206
- * The key to search for in the query.
207
- *
208
- * @return
209
- * The query value if found or false.
210
- */
211
- getQuery(req: Request, key: string): any | false;
212
- /**
213
- * Search the request parameters for the given key.
214
- *
215
- * @param req
216
- * The Express request object.
217
- * @param key
218
- * The key to search for in the parameters.
219
- *
220
- * @return
221
- * The parameter value if found or false.
222
- */
223
- getParameter(req: Request, key: string): any | false;
224
- /**
225
- * Determine if the request has the given key set as a header or url parameter.
226
- *
227
- * @param req
228
- * The Express request object.
229
- * @param key
230
- * The key to search for.
231
- *
232
- * @return
233
- * Return the value of the key or false if not found.
234
- */
235
- getRequestValue(req: Request, key: string): any | false;
236
- /**
237
- * Split the given URL into its key/value pairs.
238
- *
239
- * @param url
240
- * The request url to split, typically req.url.
241
- *
242
- * @returns {{}}
243
- * The key/value pairs of the request url.
244
- */
245
- getUrlParams(url: string): Record<string, any>;
246
- /**
247
- * Converts a form component key into a submission key
248
- * by putting .data. between each nested component
249
- * (ex: `user.name` becomes `user.data.name` in a submission)
250
- * @param key
251
- * The key to convert
252
- * @return
253
- * The submission key
254
- */
255
- getSubmissionKey(key: string): string;
256
- /**
257
- * Converts a submission key into a form component key
258
- * by replacing .data. with .
259
- * (ex: `user.data.name` becomes `user.name` in a submission)
260
- * @param key
261
- * The key to convert
262
- * @return
263
- * The form component key
264
- */
265
- getFormComponentKey(key: string): string;
266
- /**
267
- * Utility function to ensure the given id is always a BSON object.
268
- *
269
- * @param _id {String|Object}
270
- * A mongo id as a string or object.
271
- *
272
- * @returns {Object}
273
- * The mongo BSON id.
274
- */
275
- idToBson(_id: string | any): any;
276
- /**
277
- * Utility function to ensure the given id is always a string object.
278
- *
279
- * @param _id {String|Object}
280
- * A mongo id as a string or object.
281
- *
282
- * @returns {String}
283
- * The mongo string id.
284
- */
285
- idToString(_id: string | any): string;
286
- /**
287
- * Ensures that a submission data has MongoDB ObjectID's for all "id" fields.
288
- * @param data
289
- * @return {boolean}
290
- */
291
- ensureIds(data: any[]): any;
292
- removeProtectedFields(form: string, action: string, submissions: any): void;
293
- /**
294
- * Retrieve a unique machine name
295
- *
296
- * @param document
297
- * @param model
298
- * @param next
299
- * @return {*}
300
- */
301
- uniqueMachineName(document: {
302
- machineName: string;
303
- }, model: any, next: (err?: Error) => void): void;
304
- castValue<T = any>(valueType: "string" | "number" | "boolean" | "[number]" | "[string]", value: any): T;
305
- valuePath(prefix: string, key: string): string;
306
- eachValue(components: any, data: any, fn: Function, context: any, path?: string): void;
307
- }
@@ -1,3 +0,0 @@
1
- export interface OnHook<T = any> {
2
- on(...args: any[]): boolean | void;
3
- }
@@ -1,18 +0,0 @@
1
- import { Request, Response, NextFunction } from "express";
2
- export type ResourceHttpHandler = (req: Request, res: Response, next: NextFunction) => void;
3
- export interface ResourceHttpMethodOptions {
4
- before?: ResourceHttpHandler;
5
- after?: ResourceHttpHandler;
6
- }
7
- export interface ResourceRestOptions extends ResourceHttpMethodOptions {
8
- beforePut?: ResourceHttpHandler;
9
- beforePatch?: ResourceHttpHandler;
10
- beforePost?: ResourceHttpHandler;
11
- beforeIndex?: ResourceHttpHandler;
12
- beforeGet?: ResourceHttpHandler;
13
- afterPut?: ResourceHttpHandler;
14
- afterPatch?: ResourceHttpHandler;
15
- afterPost?: ResourceHttpHandler;
16
- afterIndex?: ResourceHttpHandler;
17
- afterGet?: ResourceHttpHandler;
18
- }