@tsed/formio 8.0.0-alpha.5 → 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,112 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from "events";
3
- import { NextFunction, Request, Response } from "express";
4
- import { Db } from "mongodb";
5
- import { Mongoose, Schema } from "mongoose";
6
- import { FormioActionModelCtor } from "./FormioAction.js";
7
- import { FormioActionsIndex } from "./FormioActionsIndex.js";
8
- import { FormioAuth } from "./FormioAuth.js";
9
- import { FormioBaseModel } from "./FormioBaseModel.js";
10
- import { FormioConfig } from "./FormioConfig.js";
11
- import { FormioHook, FormioHooks } from "./FormioHooks.js";
12
- import { FormioModels, FormioSchemas } from "./FormioModels.js";
13
- import { FormioTemplateUtil } from "./FormioTemplateUtil.js";
14
- import { FormioUpdate } from "./FormioUpdate.js";
15
- import { FormioUtil } from "./FormioUtils.js";
16
- export interface FormioBase {
17
- /**
18
- * Auth
19
- */
20
- auth: FormioAuth;
21
- /**
22
- * Event emitter
23
- */
24
- events: EventEmitter;
25
- /**
26
- * Formio configuration
27
- */
28
- config: FormioConfig & {
29
- schema: string;
30
- };
31
- /**
32
- * Emit alter `log` event. Return false to disable event logging.
33
- * @param event
34
- * @param req
35
- * @param info
36
- */
37
- log(event: string, req: Request, ...info: any[]): void;
38
- /**
39
- * Emit alter `audit` event if `config.audit` is enabled. Return false to disable event logging.
40
- * Use `console.log`.
41
- * @param event
42
- * @param req
43
- * @param info
44
- */
45
- audit(event: string, req: Request, ...info: any[]): void;
46
- }
47
- export interface FormioMiddlewares {
48
- alias(req: Request, res: Response, next: NextFunction): void;
49
- params(req: Request, res: Response, next: NextFunction): void;
50
- accessHandler(req: Request, res: Response, next: NextFunction): void;
51
- /**
52
- * Authorize all urls based on roles and permissions.
53
- * @param req
54
- * @param res
55
- * @param next
56
- */
57
- permissionHandler(req: Request, res: Response, next: NextFunction): void;
58
- restrictRequestTypes(req: Request, res: Response, next: NextFunction): void;
59
- tokenHandler(req: Request, res: Response, next: NextFunction): void;
60
- }
61
- export interface Formio extends FormioBase {
62
- Action: FormioActionModelCtor;
63
- BaseModel: FormioBaseModel;
64
- actions: FormioActionsIndex;
65
- resources: any;
66
- /**
67
- * Database connection
68
- */
69
- db: Db;
70
- schemas: FormioSchemas & {
71
- AccessSchema: Schema;
72
- PermissionSchema: Schema;
73
- FieldMatchAccessPermissionSchema: Schema;
74
- };
75
- models: FormioModels;
76
- /**
77
- * Mongoose lib.
78
- */
79
- mongoose: Mongoose;
80
- /**
81
- * Exported formio middlewares
82
- */
83
- readonly middleware: FormioMiddlewares;
84
- /**
85
- * Hooks.
86
- */
87
- hooks: FormioHooks;
88
- /**
89
- * Plugins.
90
- */
91
- plugins: any;
92
- /**
93
- * Formio hook util.
94
- */
95
- readonly hook: FormioHook;
96
- /**
97
- * The formio utils.
98
- */
99
- readonly util: FormioUtil;
100
- /**
101
- * Update system.
102
- */
103
- readonly update: FormioUpdate;
104
- /**
105
- * Template export/import
106
- */
107
- readonly template: FormioTemplateUtil;
108
- /**
109
- * Encryption system.
110
- */
111
- encrypt(text: string, next: (err: null | Error, hash: string) => void): void;
112
- }
@@ -1,20 +0,0 @@
1
- import { Request, Response } from "express";
2
- import { FormioMongooseSchema } from "./FormioBaseModel.js";
3
- import { FormioComponent } from "./FormioModels.js";
4
- import { FormioAction, FormioActionInfo } from "@tsed/formio-types";
5
- export interface FormioActionModel extends FormioAction {
6
- resolve(handler: string, method: string, req: Request, res: Response, next: Function, setActionItemMessage: SetActionItemMessage): void;
7
- }
8
- export type FormioActionMongooseSchema = FormioMongooseSchema<FormioAction>;
9
- export type SetActionItemMessage = (message: string, data?: any, state?: any) => void;
10
- export interface FormioActionModelCtor {
11
- schema?: FormioActionMongooseSchema;
12
- info(req: Request, response: Response, next: (err: any, info: FormioActionInfo) => void): void;
13
- settingsForm(req: Request, response: Response, next: (err: any, info: FormioComponent[]) => void): void;
14
- new (data: FormioAction, req: Request, res: Response): FormioActionModel;
15
- }
16
- export interface ActionMethods {
17
- info?(req: Request, response: Response): Promise<FormioAction>;
18
- settingsForm(req: Request, response: Response): Promise<FormioComponent[]>;
19
- resolve(...args: any[]): Promise<any>;
20
- }
@@ -1,15 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- import { FormioActionModelCtor } from "./FormioAction.js";
3
- export interface FormioActions {
4
- email: FormioActionModelCtor;
5
- login: FormioActionModelCtor;
6
- resetpass: FormioActionModelCtor;
7
- role: FormioActionModelCtor;
8
- save: FormioActionModelCtor;
9
- sql: FormioActionModelCtor;
10
- webhook: FormioActionModelCtor;
11
- [key: string]: FormioActionModelCtor;
12
- }
13
- export interface FormioActionsIndex {
14
- actions: FormioActions & Record<string, Type<FormioActionModelCtor>>;
15
- }
@@ -1,67 +0,0 @@
1
- import { Next, Req, Res } from "@tsed/common";
2
- import { FormioDecodedToken, FormioPayloadToken } from "./FormioDecodedToken.js";
3
- import { FormioForm } from "./FormioModels.js";
4
- export interface FormioAuth {
5
- /**
6
- * Send the current user.
7
- *
8
- * @param req
9
- * @param res
10
- * @param next
11
- */
12
- currentUser(req: Req, res: Res, next: Function): void;
13
- /**
14
- * Checks to see if a decoded token is allowed to access this path.
15
- * @param req
16
- * @param decoded
17
- * @return {boolean}
18
- */
19
- isTokenAllowed(req: Req, decoded: FormioDecodedToken): boolean;
20
- /**
21
- * Generate our JWT with the given payload, and pass it to the given callback function.
22
- *
23
- * @param payload {Object}
24
- * The decoded JWT.
25
- *
26
- * @return {String|Boolean}
27
- * The JWT from the given payload, or false if the jwt payload is still valid.
28
- */
29
- getToken(payload: FormioPayloadToken): string | boolean;
30
- /**
31
- * Generate a temporary token for a specific path and expiration.
32
- *
33
- * @param req
34
- * @param res
35
- * @param allow
36
- * @param expire
37
- * @param admin
38
- * @param cb
39
- */
40
- getTempToken(req: Req, res: Res, allow: boolean, expire: number, admin: boolean, cb: Function): void;
41
- tempToken(req: Req, res: Res): void;
42
- /**
43
- * Authenticate a user.
44
- *
45
- * @param req
46
- * @param forms {Mixed}
47
- * A single form or an array of forms to authenticate against.
48
- * @param userField {String}
49
- * The user submission field that contains the username.
50
- * @param passField {String}
51
- * The user submission field that contains the password.
52
- * @param username {String}
53
- * The user submission username to login with.
54
- * @param password {String}
55
- * The user submission password to login with.
56
- * @param next {Function}
57
- * The callback function to call after authentication.
58
- */
59
- authenticate(req: Req, forms: FormioForm | FormioForm[], userField: string, passField: string, username: string, password: string, next: Function): void;
60
- /**
61
- * Interception logout request.
62
- * @param req
63
- * @param res
64
- * @param next
65
- */
66
- logout(req: Req, res: Res, next: Next): void;
67
- }
@@ -1,11 +0,0 @@
1
- import { MongooseDocument } from "@tsed/mongoose";
2
- import { Schema, Document } from "mongoose";
3
- export type FormioMongooseSchema<T> = Schema<Document<T>> & {
4
- machineName(document: MongooseDocument<T>, done: Function): void;
5
- };
6
- export interface FormioBaseModel<T = any> {
7
- schema: Schema<Document<T>>;
8
- }
9
- export interface FormioModel<T = any> extends FormioBaseModel<T> {
10
- schema: FormioMongooseSchema<T>;
11
- }
@@ -1,59 +0,0 @@
1
- import { FormioSettings } from "./FormioSettings.js";
2
- import { FormioTemplate } from "./FormioTemplate.js";
3
- export interface FormioJwtConfig {
4
- secret: string;
5
- expireTime?: number;
6
- }
7
- export interface FormioEmailConfig {
8
- type: string;
9
- username: string;
10
- password: string;
11
- }
12
- export interface FormioConfig {
13
- /**
14
- * Base url to mount the formio endpoints with Ts.ED server. Default: '/'
15
- */
16
- baseUrl: string;
17
- /**
18
- * Skip installation process
19
- */
20
- skipInstall?: boolean;
21
- template?: FormioTemplate;
22
- /**
23
- * Cors allowed origin configuration. Default: `["*"]`.
24
- */
25
- allowedOrigins?: string[];
26
- /**
27
- *
28
- */
29
- mongoCA?: any;
30
- mongo?: string;
31
- mongoConfig?: string;
32
- /**
33
- * Reserved keywords form name list
34
- */
35
- reservedForms?: string[];
36
- /**
37
- * Jwt configuration
38
- */
39
- jwt: FormioJwtConfig;
40
- /**
41
- * Email sendgrid settings
42
- */
43
- email?: FormioEmailConfig;
44
- /**
45
- * Settings of external formio services
46
- */
47
- settings?: FormioSettings;
48
- /**
49
- * Enable audit log. Default: false
50
- */
51
- audit?: boolean;
52
- /**
53
- * User root credentials
54
- */
55
- root: {
56
- email: string;
57
- password: string;
58
- };
59
- }
@@ -1,7 +0,0 @@
1
- import { MongooseDocument } from "@tsed/mongoose";
2
- import { FormioAction, FormioForm, FormioRole } from "@tsed/formio-types";
3
- export interface FormioCtxMapper {
4
- forms: Map<string, MongooseDocument<FormioForm>>;
5
- actions: Map<string, MongooseDocument<FormioAction>>;
6
- roles: Map<string, MongooseDocument<FormioRole>>;
7
- }
@@ -1,12 +0,0 @@
1
- export interface FormioDecodedToken extends Record<string, unknown> {
2
- user: {
3
- _id: string;
4
- };
5
- form: {
6
- _id: string;
7
- };
8
- }
9
- export interface FormioPayloadToken {
10
- token: string;
11
- decoded: FormioDecodedToken;
12
- }
@@ -1,53 +0,0 @@
1
- export interface FormioErrors {
2
- app: {
3
- ESETTINGSLOAD: "Cannot load app settings.";
4
- EDBCONFIG: "Database settings is missing.";
5
- EDBHOST: "Invalid SQL Host.";
6
- };
7
- db: {
8
- EINVQUERY: "Invalid query.";
9
- EDBCONN: "Connection error.";
10
- EQUERY: "Query request error.";
11
- };
12
- emailer: {
13
- ENOTRANSP: "Cannot get emailer transports.";
14
- ESENDMAIL: "Email sending failed.";
15
- ESUBPARAMS: "Failed to get substitution parameters.";
16
- };
17
- cache: {
18
- EFORMLOAD: "Cannot load form.";
19
- };
20
- form: {
21
- ENOFORM: "Form not found.";
22
- };
23
- auth: {
24
- EAUTH: "Authentication failed.";
25
- EPASSFIELD: "Invalid password field.";
26
- EPASSRESET: "Unable to change password.";
27
- ERESETTOKEN: "Invalid reset password token.";
28
- ENOPASSP: "No password provided.";
29
- ELOGINCOUNT: "Unable to update login count.";
30
- };
31
- submission: {
32
- ENOSUB: "Submission not found.";
33
- ESUBLOAD: "Cannot load submission.";
34
- ESUBSAVE: "Cannot save submission.";
35
- };
36
- user: {
37
- ENOUSER: "User not found.";
38
- ENONAMEP: "No user name provided.";
39
- };
40
- role: {
41
- EROLESLOAD: "Cannot load the Roles.";
42
- ENOROLE: "Role not found.";
43
- EROLELOAD: "Cannot load role.";
44
- EROLEEXIST: "Provided role already exists.";
45
- };
46
- request: {
47
- EREQRECUR: "Too many recursive requests.";
48
- };
49
- resource: {
50
- ENOIDP: "Resource id is missing.";
51
- ENOHANDLER: "Resource handler not found.";
52
- };
53
- }
@@ -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
- }