@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,24 +0,0 @@
1
- import { InjectorService, OnReady, OnRoutesInit, PlatformApplication, PlatformRouteDetails } from "@tsed/common";
2
- import { FormioConfig } from "./domain/FormioConfig.js";
3
- import { FormioTemplate } from "./domain/FormioTemplate.js";
4
- import { FormioHooksService } from "./services/FormioHooksService.js";
5
- import { FormioInstaller } from "./services/FormioInstaller.js";
6
- import { FormioService } from "./services/FormioService.js";
7
- export declare class FormioModule implements OnRoutesInit, OnReady {
8
- protected formio: FormioService;
9
- protected hooks: FormioHooksService;
10
- protected installer: FormioInstaller;
11
- protected app: PlatformApplication;
12
- protected injector: InjectorService;
13
- protected settings: FormioConfig;
14
- protected baseUrl: string;
15
- protected skipInstall: boolean;
16
- protected template?: FormioTemplate;
17
- protected root?: any;
18
- $onInit(): Promise<import("./index.js").Formio> | undefined;
19
- init(options: FormioConfig): Promise<import("./index.js").Formio> | undefined;
20
- $onRoutesInit(): Promise<void>;
21
- $logRoutes(routes: PlatformRouteDetails[]): Promise<PlatformRouteDetails[]>;
22
- $onReady(): void;
23
- protected shouldInstall(): Promise<boolean | undefined>;
24
- }
@@ -1,11 +0,0 @@
1
- import { FormioCtxMapper } from "../domain/FormioCtxMapper.js";
2
- export declare class FormioMapper {
3
- readonly ctxData: FormioCtxMapper;
4
- constructor(ctxData: FormioCtxMapper);
5
- find(key: string): any;
6
- findId(data: string): any;
7
- findMachineName(data: any): string | undefined;
8
- mapToExport(data: any): any;
9
- mapToImport(data: any): any;
10
- mapData(data: any, resolver: any): any;
11
- }
@@ -1,18 +0,0 @@
1
- import { InjectorService, Provider } from "@tsed/di";
2
- import { PlatformParams } from "@tsed/platform-params";
3
- import { PlatformResponseFilter } from "@tsed/platform-response-filter";
4
- import { AlterHook } from "../domain/AlterHook.js";
5
- import { SetActionItemMessage } from "../domain/FormioAction.js";
6
- import { FormioActions } from "../domain/FormioActionsIndex.js";
7
- import { FormioService } from "../services/FormioService.js";
8
- export declare class AlterActions implements AlterHook {
9
- protected injector: InjectorService;
10
- protected formio: FormioService;
11
- protected params: PlatformParams;
12
- protected responseFilter: PlatformResponseFilter;
13
- transform(actions: FormioActions): FormioActions;
14
- protected getActions(): Provider<any>[];
15
- protected createHandler(provider: Provider, propertyKey: string | symbol): (action: any, handler: string, method: string, req: any, res: any, next: any, setActionItemMessage: SetActionItemMessage) => Promise<void>;
16
- private onRequest;
17
- private flush;
18
- }
@@ -1,5 +0,0 @@
1
- import { DIContext } from "@tsed/di";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterAudit implements AlterHook {
4
- transform(info: any[], event: string, ctx: DIContext): boolean;
5
- }
@@ -1,5 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterHost implements AlterHook<string> {
4
- transform(baseUrl: string, ctx: PlatformContext): string;
5
- }
@@ -1,5 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterLog implements AlterHook {
4
- transform(event: string, ctx: PlatformContext, ...info: any[]): boolean;
5
- }
@@ -1,7 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- export declare class AlterSkip implements AlterHook {
4
- baseUrl: string;
5
- whiteList: string[];
6
- transform(value: any, ctx: PlatformContext): any;
7
- }
@@ -1,12 +0,0 @@
1
- import { MongooseDocument } from "@tsed/mongoose";
2
- import { FormioMapper } from "../builder/FormioMapper.js";
3
- import { AlterHook } from "../domain/AlterHook.js";
4
- import { FormioSubmission } from "../domain/FormioModels.js";
5
- import { FormioTemplate } from "../domain/FormioTemplate.js";
6
- import { FormioDatabase } from "../services/FormioDatabase.js";
7
- export declare class AlterTemplateExportSteps implements AlterHook {
8
- protected database: FormioDatabase;
9
- transform(queue: any[], template: FormioTemplate, map: any, options: any): any;
10
- protected exportSubmissions(template: FormioTemplate, map: any, options: any, next: any): Promise<void>;
11
- protected mapSubmissions(submissions: MongooseDocument<FormioSubmission>[], mapper: FormioMapper): any;
12
- }
@@ -1,11 +0,0 @@
1
- import { FormioMapper } from "../builder/FormioMapper.js";
2
- import { AlterHook } from "../domain/AlterHook.js";
3
- import { FormioSubmission } from "../domain/FormioModels.js";
4
- import { FormioTemplate } from "../domain/FormioTemplate.js";
5
- import { FormioDatabase } from "../services/FormioDatabase.js";
6
- export declare class AlterTemplateImportSteps implements AlterHook {
7
- protected database: FormioDatabase;
8
- transform(queue: any[], install: Function, template: Partial<FormioTemplate>): any;
9
- protected importSubmissions(template: Partial<FormioTemplate>, done: any): Promise<void>;
10
- protected importSubmission(submission: Partial<FormioSubmission>, mapper: FormioMapper): Promise<any>;
11
- }
@@ -1,7 +0,0 @@
1
- import { FormioActionInfo } from "@tsed/formio-types";
2
- /**
3
- * Create a new FormIO Action.
4
- * @param options
5
- * @decorator
6
- */
7
- export declare function Action(options: FormioActionInfo): ClassDecorator;
@@ -1,23 +0,0 @@
1
- import { SetActionItemMessage } from "../domain/FormioAction.js";
2
- import { FormioAction } from "@tsed/formio-types";
3
- /**
4
- * Return the current action context with the following data:
5
- *
6
- * ```typescript
7
- * export type ActionCtx = {
8
- * handler: string;
9
- * method: string;
10
- * setActionItemMessage: SetActionItemMessage;
11
- * action: FormioAction;
12
- * };
13
- * ```
14
- * @param expression
15
- * @constructor
16
- */
17
- export declare function ActionCtx(expression?: string): ParameterDecorator;
18
- export type ActionCtx = {
19
- handler: string;
20
- method: string;
21
- setActionItemMessage: SetActionItemMessage;
22
- action: FormioAction;
23
- };
@@ -1,6 +0,0 @@
1
- /**
2
- *
3
- * @param name
4
- * @constructor
5
- */
6
- export declare function Alter(name: string): ClassDecorator;
@@ -1,6 +0,0 @@
1
- /**
2
- * Create a Form io hook event listener
3
- * @param name
4
- * @constructor
5
- */
6
- export declare function On(name: string): ClassDecorator;
@@ -1,6 +0,0 @@
1
- /**
2
- * Check if a user is connected by using the Formio Auth middleware
3
- * @decorator
4
- * @formio
5
- */
6
- export declare function UseFormioAuth(): Function;
@@ -1,3 +0,0 @@
1
- export interface AlterHook<T = any> {
2
- transform(...args: any[]): T;
3
- }
@@ -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
- }