@tsed/formio 8.11.0 → 8.11.2-rc.1
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.
- package/lib/esm/FormioModule.js +0 -1
- package/lib/esm/builder/FormioMapper.js +0 -1
- package/lib/esm/components/AlterActions.js +0 -1
- package/lib/esm/components/AlterAudit.js +0 -1
- package/lib/esm/components/AlterHost.js +0 -1
- package/lib/esm/components/AlterLog.js +0 -1
- package/lib/esm/components/AlterSkip.js +0 -1
- package/lib/esm/components/AlterTemplateExportSteps.js +0 -1
- package/lib/esm/components/AlterTemplateImportSteps.js +0 -1
- package/lib/esm/decorators/action.js +0 -1
- package/lib/esm/decorators/actionCtx.js +0 -1
- package/lib/esm/decorators/alter.js +0 -1
- package/lib/esm/decorators/on.js +0 -1
- package/lib/esm/decorators/useFormioAuth.js +0 -1
- package/lib/esm/domain/AlterHook.js +0 -1
- package/lib/esm/domain/Formio.js +0 -1
- package/lib/esm/domain/FormioAction.js +0 -1
- package/lib/esm/domain/FormioActionsIndex.js +0 -1
- package/lib/esm/domain/FormioAuth.js +0 -1
- package/lib/esm/domain/FormioBaseModel.js +0 -1
- package/lib/esm/domain/FormioConfig.js +0 -1
- package/lib/esm/domain/FormioCtxMapper.js +0 -1
- package/lib/esm/domain/FormioDecodedToken.js +0 -1
- package/lib/esm/domain/FormioErrors.js +0 -1
- package/lib/esm/domain/FormioHooks.js +0 -1
- package/lib/esm/domain/FormioJs.js +0 -1
- package/lib/esm/domain/FormioModels.js +0 -1
- package/lib/esm/domain/FormioRouter.js +0 -1
- package/lib/esm/domain/FormioSettings.js +0 -1
- package/lib/esm/domain/FormioTemplate.js +0 -1
- package/lib/esm/domain/FormioTemplateUtil.js +0 -1
- package/lib/esm/domain/FormioUpdate.js +0 -1
- package/lib/esm/domain/FormioUtils.js +0 -1
- package/lib/esm/domain/OnHook.js +0 -1
- package/lib/esm/domain/Resource.js +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/middlewares/FormioAuthMiddleware.js +0 -1
- package/lib/esm/services/FormioAuthService.js +0 -1
- package/lib/esm/services/FormioDatabase.js +0 -1
- package/lib/esm/services/FormioHooksService.js +0 -1
- package/lib/esm/services/FormioInstaller.js +0 -1
- package/lib/esm/services/FormioRepository.js +0 -1
- package/lib/esm/services/FormioService.js +0 -1
- package/lib/esm/utils/isMongoId.js +0 -1
- package/package.json +13 -10
- package/lib/esm/FormioModule.js.map +0 -1
- package/lib/esm/builder/FormioMapper.js.map +0 -1
- package/lib/esm/components/AlterActions.js.map +0 -1
- package/lib/esm/components/AlterAudit.js.map +0 -1
- package/lib/esm/components/AlterHost.js.map +0 -1
- package/lib/esm/components/AlterLog.js.map +0 -1
- package/lib/esm/components/AlterSkip.js.map +0 -1
- package/lib/esm/components/AlterTemplateExportSteps.js.map +0 -1
- package/lib/esm/components/AlterTemplateImportSteps.js.map +0 -1
- package/lib/esm/decorators/action.js.map +0 -1
- package/lib/esm/decorators/actionCtx.js.map +0 -1
- package/lib/esm/decorators/alter.js.map +0 -1
- package/lib/esm/decorators/on.js.map +0 -1
- package/lib/esm/decorators/useFormioAuth.js.map +0 -1
- package/lib/esm/domain/AlterHook.js.map +0 -1
- package/lib/esm/domain/Formio.js.map +0 -1
- package/lib/esm/domain/FormioAction.js.map +0 -1
- package/lib/esm/domain/FormioActionsIndex.js.map +0 -1
- package/lib/esm/domain/FormioAuth.js.map +0 -1
- package/lib/esm/domain/FormioBaseModel.js.map +0 -1
- package/lib/esm/domain/FormioConfig.js.map +0 -1
- package/lib/esm/domain/FormioCtxMapper.js.map +0 -1
- package/lib/esm/domain/FormioDecodedToken.js.map +0 -1
- package/lib/esm/domain/FormioErrors.js.map +0 -1
- package/lib/esm/domain/FormioHooks.js.map +0 -1
- package/lib/esm/domain/FormioJs.js.map +0 -1
- package/lib/esm/domain/FormioModels.js.map +0 -1
- package/lib/esm/domain/FormioRouter.js.map +0 -1
- package/lib/esm/domain/FormioSettings.js.map +0 -1
- package/lib/esm/domain/FormioTemplate.js.map +0 -1
- package/lib/esm/domain/FormioTemplateUtil.js.map +0 -1
- package/lib/esm/domain/FormioUpdate.js.map +0 -1
- package/lib/esm/domain/FormioUtils.js.map +0 -1
- package/lib/esm/domain/OnHook.js.map +0 -1
- package/lib/esm/domain/Resource.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/middlewares/FormioAuthMiddleware.js.map +0 -1
- package/lib/esm/services/FormioAuthService.js.map +0 -1
- package/lib/esm/services/FormioDatabase.js.map +0 -1
- package/lib/esm/services/FormioHooksService.js.map +0 -1
- package/lib/esm/services/FormioInstaller.js.map +0 -1
- package/lib/esm/services/FormioRepository.js.map +0 -1
- package/lib/esm/services/FormioService.js.map +0 -1
- package/lib/esm/utils/isMongoId.js.map +0 -1
- package/src/FormioModule.spec.ts +0 -113
- package/src/FormioModule.ts +0 -130
- package/src/builder/FormioMapper.spec.ts +0 -93
- package/src/builder/FormioMapper.ts +0 -71
- package/src/components/AlterActions.spec.ts +0 -376
- package/src/components/AlterActions.ts +0 -136
- package/src/components/AlterAudit.spec.ts +0 -19
- package/src/components/AlterAudit.ts +0 -12
- package/src/components/AlterHost.spec.ts +0 -20
- package/src/components/AlterHost.ts +0 -11
- package/src/components/AlterLog.spec.ts +0 -19
- package/src/components/AlterLog.ts +0 -12
- package/src/components/AlterSkip.spec.ts +0 -44
- package/src/components/AlterSkip.ts +0 -28
- package/src/components/AlterTemplateExportSteps.spec.ts +0 -99
- package/src/components/AlterTemplateExportSteps.ts +0 -58
- package/src/components/AlterTemplateImportSteps.spec.ts +0 -70
- package/src/components/AlterTemplateImportSteps.ts +0 -50
- package/src/decorators/action.ts +0 -20
- package/src/decorators/actionCtx.spec.ts +0 -25
- package/src/decorators/actionCtx.ts +0 -29
- package/src/decorators/alter.spec.ts +0 -16
- package/src/decorators/alter.ts +0 -19
- package/src/decorators/on.spec.ts +0 -16
- package/src/decorators/on.ts +0 -19
- package/src/decorators/useFormioAuth.spec.ts +0 -15
- package/src/decorators/useFormioAuth.ts +0 -12
- package/src/domain/AlterHook.ts +0 -3
- package/src/domain/Formio.ts +0 -122
- package/src/domain/FormioAction.ts +0 -30
- package/src/domain/FormioActionsIndex.ts +0 -19
- package/src/domain/FormioAuth.ts +0 -83
- package/src/domain/FormioBaseModel.ts +0 -14
- package/src/domain/FormioConfig.ts +0 -63
- package/src/domain/FormioCtxMapper.ts +0 -8
- package/src/domain/FormioDecodedToken.ts +0 -13
- package/src/domain/FormioErrors.ts +0 -53
- package/src/domain/FormioHooks.ts +0 -207
- package/src/domain/FormioJs.ts +0 -18
- package/src/domain/FormioModels.ts +0 -48
- package/src/domain/FormioRouter.ts +0 -10
- package/src/domain/FormioSettings.ts +0 -61
- package/src/domain/FormioTemplate.ts +0 -9
- package/src/domain/FormioTemplateUtil.ts +0 -15
- package/src/domain/FormioUpdate.ts +0 -23
- package/src/domain/FormioUtils.ts +0 -331
- package/src/domain/OnHook.ts +0 -3
- package/src/domain/Resource.ts +0 -21
- package/src/index.ts +0 -46
- package/src/middlewares/FormioAuthMiddleware.spec.ts +0 -61
- package/src/middlewares/FormioAuthMiddleware.ts +0 -34
- package/src/services/FormioAuthService.spec.ts +0 -396
- package/src/services/FormioAuthService.ts +0 -228
- package/src/services/FormioDatabase.spec.ts +0 -326
- package/src/services/FormioDatabase.ts +0 -165
- package/src/services/FormioHooksService.spec.ts +0 -156
- package/src/services/FormioHooksService.ts +0 -92
- package/src/services/FormioInstaller.spec.ts +0 -146
- package/src/services/FormioInstaller.ts +0 -46
- package/src/services/FormioRepository.spec.ts +0 -114
- package/src/services/FormioRepository.ts +0 -49
- package/src/services/FormioService.spec.ts +0 -368
- package/src/services/FormioService.ts +0 -134
- package/src/utils/isMongoId.ts +0 -3
- package/vitest.config.mts +0 -21
package/src/domain/FormioAuth.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {Next, Req, Res} from "@tsed/platform-http";
|
|
2
|
-
|
|
3
|
-
import {FormioDecodedToken, FormioPayloadToken} from "./FormioDecodedToken.js";
|
|
4
|
-
import {FormioForm} from "./FormioModels.js";
|
|
5
|
-
|
|
6
|
-
export interface FormioAuth {
|
|
7
|
-
/**
|
|
8
|
-
* Send the current user.
|
|
9
|
-
*
|
|
10
|
-
* @param req
|
|
11
|
-
* @param res
|
|
12
|
-
* @param next
|
|
13
|
-
*/
|
|
14
|
-
currentUser(req: Req, res: Res, next: Function): void;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Checks to see if a decoded token is allowed to access this path.
|
|
18
|
-
* @param req
|
|
19
|
-
* @param decoded
|
|
20
|
-
* @return {boolean}
|
|
21
|
-
*/
|
|
22
|
-
isTokenAllowed(req: Req, decoded: FormioDecodedToken): boolean;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Generate our JWT with the given payload, and pass it to the given callback function.
|
|
26
|
-
*
|
|
27
|
-
* @param payload {Object}
|
|
28
|
-
* The decoded JWT.
|
|
29
|
-
*
|
|
30
|
-
* @return {String|Boolean}
|
|
31
|
-
* The JWT from the given payload, or false if the jwt payload is still valid.
|
|
32
|
-
*/
|
|
33
|
-
getToken(payload: FormioPayloadToken): string | boolean;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Generate a temporary token for a specific path and expiration.
|
|
37
|
-
*
|
|
38
|
-
* @param req
|
|
39
|
-
* @param res
|
|
40
|
-
* @param allow
|
|
41
|
-
* @param expire
|
|
42
|
-
* @param admin
|
|
43
|
-
* @param cb
|
|
44
|
-
*/
|
|
45
|
-
getTempToken(req: Req, res: Res, allow: boolean, expire: number, admin: boolean, cb: Function): void;
|
|
46
|
-
|
|
47
|
-
tempToken(req: Req, res: Res): void;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Authenticate a user.
|
|
51
|
-
*
|
|
52
|
-
* @param req
|
|
53
|
-
* @param forms {Mixed}
|
|
54
|
-
* A single form or an array of forms to authenticate against.
|
|
55
|
-
* @param userField {String}
|
|
56
|
-
* The user submission field that contains the username.
|
|
57
|
-
* @param passField {String}
|
|
58
|
-
* The user submission field that contains the password.
|
|
59
|
-
* @param username {String}
|
|
60
|
-
* The user submission username to login with.
|
|
61
|
-
* @param password {String}
|
|
62
|
-
* The user submission password to login with.
|
|
63
|
-
* @param next {Function}
|
|
64
|
-
* The callback function to call after authentication.
|
|
65
|
-
*/
|
|
66
|
-
authenticate(
|
|
67
|
-
req: Req,
|
|
68
|
-
forms: FormioForm | FormioForm[],
|
|
69
|
-
userField: string,
|
|
70
|
-
passField: string,
|
|
71
|
-
username: string,
|
|
72
|
-
password: string,
|
|
73
|
-
next: Function
|
|
74
|
-
): void;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Interception logout request.
|
|
78
|
-
* @param req
|
|
79
|
-
* @param res
|
|
80
|
-
* @param next
|
|
81
|
-
*/
|
|
82
|
-
logout(req: Req, res: Res, next: Next): void;
|
|
83
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {MongooseDocument} from "@tsed/mongoose";
|
|
2
|
-
import {Document, Schema} from "mongoose";
|
|
3
|
-
|
|
4
|
-
export type FormioMongooseSchema<T> = Schema<Document<T>> & {
|
|
5
|
-
machineName(document: MongooseDocument<T>, done: Function): void;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export interface FormioBaseModel<T = any> {
|
|
9
|
-
schema: Schema<Document<T>>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface FormioModel<T = any> extends FormioBaseModel<T> {
|
|
13
|
-
schema: FormioMongooseSchema<T>;
|
|
14
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {FormioSettings} from "./FormioSettings.js";
|
|
2
|
-
import {FormioTemplate} from "./FormioTemplate.js";
|
|
3
|
-
|
|
4
|
-
export interface FormioJwtConfig {
|
|
5
|
-
secret: string;
|
|
6
|
-
expireTime?: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface FormioEmailConfig {
|
|
10
|
-
type: string;
|
|
11
|
-
username: string;
|
|
12
|
-
password: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface FormioConfig {
|
|
16
|
-
/**
|
|
17
|
-
* Base url to mount the formio endpoints with Ts.ED server. Default: '/'
|
|
18
|
-
*/
|
|
19
|
-
baseUrl: string;
|
|
20
|
-
/**
|
|
21
|
-
* Skip installation process
|
|
22
|
-
*/
|
|
23
|
-
skipInstall?: boolean;
|
|
24
|
-
|
|
25
|
-
template?: FormioTemplate;
|
|
26
|
-
/**
|
|
27
|
-
* Cors allowed origin configuration. Default: `["*"]`.
|
|
28
|
-
*/
|
|
29
|
-
allowedOrigins?: string[];
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
mongoCA?: any;
|
|
34
|
-
mongo?: string;
|
|
35
|
-
mongoConfig?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Reserved keywords form name list
|
|
38
|
-
*/
|
|
39
|
-
reservedForms?: string[];
|
|
40
|
-
/**
|
|
41
|
-
* Jwt configuration
|
|
42
|
-
*/
|
|
43
|
-
jwt: FormioJwtConfig;
|
|
44
|
-
/**
|
|
45
|
-
* Email sendgrid settings
|
|
46
|
-
*/
|
|
47
|
-
email?: FormioEmailConfig;
|
|
48
|
-
/**
|
|
49
|
-
* Settings of external formio services
|
|
50
|
-
*/
|
|
51
|
-
settings?: FormioSettings;
|
|
52
|
-
/**
|
|
53
|
-
* Enable audit log. Default: false
|
|
54
|
-
*/
|
|
55
|
-
audit?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* User root credentials
|
|
58
|
-
*/
|
|
59
|
-
root: {
|
|
60
|
-
email: string;
|
|
61
|
-
password: string;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import {FormioAction, FormioForm, FormioRole} from "@tsed/formio-types";
|
|
2
|
-
import {MongooseDocument} from "@tsed/mongoose";
|
|
3
|
-
|
|
4
|
-
export interface FormioCtxMapper {
|
|
5
|
-
forms: Map<string, MongooseDocument<FormioForm>>;
|
|
6
|
-
actions: Map<string, MongooseDocument<FormioAction>>;
|
|
7
|
-
roles: Map<string, MongooseDocument<FormioRole>>;
|
|
8
|
-
}
|
|
@@ -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,207 +0,0 @@
|
|
|
1
|
-
import {MongooseDocument} from "@tsed/mongoose";
|
|
2
|
-
import {Request, Response} from "express";
|
|
3
|
-
import {FilterQuery, Schema, SchemaDefinition} from "mongoose";
|
|
4
|
-
|
|
5
|
-
import {Formio} from "./Formio.js";
|
|
6
|
-
import {FormioActions} from "./FormioActionsIndex.js";
|
|
7
|
-
import {FormioConfig} from "./FormioConfig.js";
|
|
8
|
-
import {FormioDecodedToken} from "./FormioDecodedToken.js";
|
|
9
|
-
import {FormioJs} from "./FormioJs.js";
|
|
10
|
-
import {FormioActionItem, FormioForm, FormioModelsModels, FormioSubmission} from "./FormioModels.js";
|
|
11
|
-
import {FormioSettings} from "./FormioSettings.js";
|
|
12
|
-
import {ResourceRestOptions} from "./Resource.js";
|
|
13
|
-
|
|
14
|
-
export type FormioInitEvent = "alias" | "params" | "token" | "getTempToken" | "logout" | "current" | "access" | "perms";
|
|
15
|
-
|
|
16
|
-
export interface FormioHooks {
|
|
17
|
-
settings?: (settings: FormioSettings, req: Request, cb: Function) => FormioSettings;
|
|
18
|
-
alter?: {
|
|
19
|
-
alias?: (alias: string, req: Request, res: Response) => string;
|
|
20
|
-
/**
|
|
21
|
-
* Alter FormioJs configuration
|
|
22
|
-
* @param formIo
|
|
23
|
-
*/
|
|
24
|
-
configFormio?: (formIo: {Formio: FormioJs}) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Alter formio server configuration.
|
|
27
|
-
* @param config
|
|
28
|
-
*/
|
|
29
|
-
updateConfig?: (config: FormioConfig) => FormioConfig;
|
|
30
|
-
/**
|
|
31
|
-
* Alter audit log.
|
|
32
|
-
* @param info
|
|
33
|
-
* @param event
|
|
34
|
-
* @param req
|
|
35
|
-
*/
|
|
36
|
-
audit?: (info: any[], event: string, req: Request) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Alter log.
|
|
39
|
-
* @param info
|
|
40
|
-
* @param event
|
|
41
|
-
* @param req
|
|
42
|
-
*/
|
|
43
|
-
log?: (event: string, req: Request, ...info: string[]) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Alter available actions
|
|
46
|
-
* @param info
|
|
47
|
-
* @param event
|
|
48
|
-
* @param req
|
|
49
|
-
*/
|
|
50
|
-
actions?: (actions: FormioActions) => FormioActions;
|
|
51
|
-
/**
|
|
52
|
-
* Skip auth for the current request.
|
|
53
|
-
* @param info
|
|
54
|
-
* @param event
|
|
55
|
-
* @param req
|
|
56
|
-
*/
|
|
57
|
-
skip?: (value: boolean, req: Request) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Resolve host.
|
|
60
|
-
* @param baseUrl
|
|
61
|
-
* @param req
|
|
62
|
-
*/
|
|
63
|
-
host?: (baseUrl: string, req: Request) => string;
|
|
64
|
-
/**
|
|
65
|
-
* `/form/${req.params.formId}/action`
|
|
66
|
-
* @param action
|
|
67
|
-
* @param req
|
|
68
|
-
*/
|
|
69
|
-
path?: (path: string, req: Request) => any;
|
|
70
|
-
/**
|
|
71
|
-
* Restrict request types
|
|
72
|
-
* @param methods
|
|
73
|
-
*/
|
|
74
|
-
methods?: (methods: string[]) => string[];
|
|
75
|
-
/**
|
|
76
|
-
* Return the cors configuration.
|
|
77
|
-
*/
|
|
78
|
-
cors?: () => Record<string, any>;
|
|
79
|
-
/**
|
|
80
|
-
* Return the current user submission.
|
|
81
|
-
*/
|
|
82
|
-
currentUser?: (user: any) => any;
|
|
83
|
-
/**
|
|
84
|
-
* Alter current form.
|
|
85
|
-
* @param form
|
|
86
|
-
*/
|
|
87
|
-
currentForm?: (form: FormioForm) => FormioForm;
|
|
88
|
-
/**
|
|
89
|
-
* Alter formio
|
|
90
|
-
* @param formio
|
|
91
|
-
*/
|
|
92
|
-
formio?: (formio: Formio) => Formio;
|
|
93
|
-
/**
|
|
94
|
-
* Alter models
|
|
95
|
-
* @param models
|
|
96
|
-
*/
|
|
97
|
-
models?: (models: FormioModelsModels) => FormioModelsModels;
|
|
98
|
-
/**
|
|
99
|
-
* Alter resources
|
|
100
|
-
* @param resources
|
|
101
|
-
*/
|
|
102
|
-
resources?: (resources: {form: any; submission: any; role: any}) => any;
|
|
103
|
-
|
|
104
|
-
resourceAccessFilter?: (search: any, req: Request, done: (err: unknown, newSearch: any) => void) => void;
|
|
105
|
-
|
|
106
|
-
// machineName
|
|
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
|
-
|
|
111
|
-
// schemas
|
|
112
|
-
actionSchema?: (schema: Schema) => Schema;
|
|
113
|
-
actionItemSchema?: (schema: Schema) => Schema;
|
|
114
|
-
formSchema?: (schema: Schema) => Schema;
|
|
115
|
-
roleSchema?: (schema: Schema) => Schema;
|
|
116
|
-
schemaSchema?: (schema: Schema) => Schema;
|
|
117
|
-
submissionSchema?: (schema: Schema | SchemaDefinition) => Schema;
|
|
118
|
-
tokenSchema?: (schema: Schema) => Schema;
|
|
119
|
-
permissionSchema?: (schema: SchemaDefinition) => SchemaDefinition;
|
|
120
|
-
fieldMatchAccessPermissionSchema?: (schemaOptions: SchemaDefinition) => SchemaDefinition;
|
|
121
|
-
|
|
122
|
-
// query
|
|
123
|
-
actionsQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
|
|
124
|
-
submissionQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
|
|
125
|
-
roleQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
|
|
126
|
-
formQuery?: <DocType = any>(query: FilterQuery<DocType>, req: Request) => FilterQuery<DocType>;
|
|
127
|
-
|
|
128
|
-
// Data
|
|
129
|
-
actionItem?: (actionItem: FormioActionItem, req: Request) => FormioActionItem;
|
|
130
|
-
actionContext?: (actionContext: any, req: Request) => any;
|
|
131
|
-
actionInfo?: (action: any, req: Request) => any;
|
|
132
|
-
|
|
133
|
-
// submission
|
|
134
|
-
submission?: (req: Request, res: Response, done: Function) => void;
|
|
135
|
-
submissionRequest?: (submission: FormioSubmission) => FormioSubmission;
|
|
136
|
-
validateSubmissionForm?: (form: FormioForm, submission: FormioSubmission, done: Function) => void;
|
|
137
|
-
postSubmissionUpdate?: (req: Request, res: Response, submissionUpdate: FormioSubmission) => void;
|
|
138
|
-
|
|
139
|
-
// response
|
|
140
|
-
/**
|
|
141
|
-
* Allow modules to hook into the form loader middleware.
|
|
142
|
-
* @param item
|
|
143
|
-
* @param req
|
|
144
|
-
* @param done
|
|
145
|
-
*/
|
|
146
|
-
formResponse?: (item: any, req: Request, done: Function) => void;
|
|
147
|
-
|
|
148
|
-
// params
|
|
149
|
-
requestParams?: (req: Request & {formId: string; subId: string; roleId: string}, params: Record<string, any>) => void;
|
|
150
|
-
/**
|
|
151
|
-
* Alter submitted params
|
|
152
|
-
* @param params
|
|
153
|
-
*/
|
|
154
|
-
submissionParams?: (params: string[]) => string[];
|
|
155
|
-
|
|
156
|
-
// Routes
|
|
157
|
-
/**
|
|
158
|
-
* Alter actions routes.
|
|
159
|
-
*/
|
|
160
|
-
actionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
|
|
161
|
-
/**
|
|
162
|
-
* Alter roles routes.
|
|
163
|
-
*/
|
|
164
|
-
rolesRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
|
|
165
|
-
/**
|
|
166
|
-
* Alter forms routes.
|
|
167
|
-
*/
|
|
168
|
-
formRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
|
|
169
|
-
/**
|
|
170
|
-
* Alter submission routes.
|
|
171
|
-
*/
|
|
172
|
-
submissionRoutes?: (options: ResourceRestOptions) => ResourceRestOptions;
|
|
173
|
-
|
|
174
|
-
// Auth
|
|
175
|
-
user?: (user: any, done: (err: any, user: any) => void) => void;
|
|
176
|
-
login?: (user: any, req: Request, done: (err: any) => void) => void;
|
|
177
|
-
token?: (token: FormioDecodedToken, form: FormioForm, req: Request) => FormioDecodedToken;
|
|
178
|
-
tokenDecode?: (token: FormioDecodedToken, req: Request, done: (err: any, decoded: FormioDecodedToken) => void) => void;
|
|
179
|
-
submissionRequestTokenQuery?: (query: {formId: string; submissionId: string}, token: string) => any;
|
|
180
|
-
|
|
181
|
-
[key: string]: any;
|
|
182
|
-
};
|
|
183
|
-
on?: {
|
|
184
|
-
init?: (type: FormioInitEvent) => boolean;
|
|
185
|
-
[key: string]: any;
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export interface FormioHook {
|
|
190
|
-
/**
|
|
191
|
-
* Run settings function.
|
|
192
|
-
*/
|
|
193
|
-
settings(req: Request, cb: Function): void;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Emit an event.
|
|
197
|
-
* @param args
|
|
198
|
-
*/
|
|
199
|
-
invoke<T = any>(...args: any[]): T | boolean;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Alter the given value by calling all listener.
|
|
203
|
-
* @param event
|
|
204
|
-
* @param args
|
|
205
|
-
*/
|
|
206
|
-
alter(event: string, ...args: any[]): any;
|
|
207
|
-
}
|
package/src/domain/FormioJs.ts
DELETED
|
@@ -1,18 +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
|
-
|
|
17
|
-
getToken(): string;
|
|
18
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {FormioActionItem, FormioForm, FormioRole, FormioSchema, FormioSubmission, FormioToken} from "@tsed/formio-types";
|
|
2
|
-
import {MongooseDocument} from "@tsed/mongoose";
|
|
3
|
-
import {Schema} from "mongoose";
|
|
4
|
-
|
|
5
|
-
import {FormioActionModelCtor, FormioActionMongooseSchema} from "./FormioAction.js";
|
|
6
|
-
import {FormioBaseModel, FormioModel, FormioMongooseSchema} from "./FormioBaseModel.js";
|
|
7
|
-
|
|
8
|
-
export * from "@tsed/formio-types";
|
|
9
|
-
|
|
10
|
-
export type WithID<T> = T & {_id: string};
|
|
11
|
-
|
|
12
|
-
export interface FormioSchemas {
|
|
13
|
-
action: FormioActionMongooseSchema;
|
|
14
|
-
actionItem: Schema<MongooseDocument<FormioActionItem>>;
|
|
15
|
-
form: FormioMongooseSchema<FormioForm>;
|
|
16
|
-
role: FormioMongooseSchema<FormioRole>;
|
|
17
|
-
schema: Schema<MongooseDocument<FormioSchema>>;
|
|
18
|
-
submission: Schema<MongooseDocument<FormioSubmission>>;
|
|
19
|
-
token: Schema<MongooseDocument<FormioToken>>;
|
|
20
|
-
|
|
21
|
-
[key: string]: Schema<MongooseDocument<any>>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type FormioModelsModels = {
|
|
25
|
-
action: FormioActionModelCtor;
|
|
26
|
-
actionItem: FormioBaseModel<FormioActionItem>;
|
|
27
|
-
form: FormioModel<FormioForm>;
|
|
28
|
-
role: FormioModel<FormioRole>;
|
|
29
|
-
schema: FormioBaseModel<FormioSchema>;
|
|
30
|
-
submission: FormioBaseModel<FormioSubmission>;
|
|
31
|
-
token: FormioBaseModel<FormioToken>;
|
|
32
|
-
} & Record<string, FormioBaseModel>;
|
|
33
|
-
|
|
34
|
-
export interface FormioModels {
|
|
35
|
-
schemas: FormioSchemas;
|
|
36
|
-
models: FormioModelsModels;
|
|
37
|
-
specs: {
|
|
38
|
-
action: any;
|
|
39
|
-
actionItem: any;
|
|
40
|
-
form: any;
|
|
41
|
-
role: any;
|
|
42
|
-
schema: any;
|
|
43
|
-
submission: any;
|
|
44
|
-
token: any;
|
|
45
|
-
|
|
46
|
-
[key: string]: any;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,61 +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
|
-
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
databases: {
|
|
13
|
-
mysql: {
|
|
14
|
-
host: string;
|
|
15
|
-
port: string;
|
|
16
|
-
database: string;
|
|
17
|
-
user: string;
|
|
18
|
-
password: string;
|
|
19
|
-
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
};
|
|
22
|
-
mssql: {
|
|
23
|
-
host: string;
|
|
24
|
-
port: string;
|
|
25
|
-
database: string;
|
|
26
|
-
user: string;
|
|
27
|
-
password: string;
|
|
28
|
-
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
email: {
|
|
33
|
-
gmail: {
|
|
34
|
-
auth: {
|
|
35
|
-
user: string;
|
|
36
|
-
pass: string;
|
|
37
|
-
[key: string]: any;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
};
|
|
42
|
-
sendgrid: {
|
|
43
|
-
auth: {
|
|
44
|
-
api_user: string;
|
|
45
|
-
api_key: string;
|
|
46
|
-
|
|
47
|
-
[key: string]: any;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
[key: string]: any;
|
|
51
|
-
};
|
|
52
|
-
mandrill: {
|
|
53
|
-
auth: {
|
|
54
|
-
apiKey: string;
|
|
55
|
-
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
};
|
|
58
|
-
[key: string]: any;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {FormioActionItem, FormioForm, FormioRole, FormioSubmission} from "./FormioModels.js";
|
|
2
|
-
|
|
3
|
-
export interface FormioTemplate {
|
|
4
|
-
roles?: Record<string, FormioRole>;
|
|
5
|
-
forms: Record<string, FormioForm>;
|
|
6
|
-
resources: Record<string, FormioForm>;
|
|
7
|
-
actions: Record<string, FormioActionItem>;
|
|
8
|
-
submissions?: Record<string, FormioSubmission[]>;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {FormioTemplate} from "./FormioTemplate.js";
|
|
2
|
-
|
|
3
|
-
export interface FormioExportOptions {
|
|
4
|
-
title: string;
|
|
5
|
-
version: string;
|
|
6
|
-
description: string;
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface FormioTemplateUtil {
|
|
11
|
-
import: {
|
|
12
|
-
template(template: FormioTemplate, cb: (er: unknown, data: FormioTemplate) => void): void;
|
|
13
|
-
};
|
|
14
|
-
export(options: Partial<FormioExportOptions>, cb: (er: unknown, data: FormioTemplate) => void): void;
|
|
15
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {NextFunction, Request, Response} from "express";
|
|
2
|
-
import {Db} from "mongodb";
|
|
3
|
-
|
|
4
|
-
import {Formio} from "./Formio.js";
|
|
5
|
-
|
|
6
|
-
export interface FormioUpdate {
|
|
7
|
-
db: Db;
|
|
8
|
-
version: string;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param cb
|
|
13
|
-
*/
|
|
14
|
-
initialize(cb: (err: unknown, db: any) => void): Promise<Formio>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param req
|
|
19
|
-
* @param res
|
|
20
|
-
* @param next
|
|
21
|
-
*/
|
|
22
|
-
sanityCheck(req: Request, res: Response, next: NextFunction): void;
|
|
23
|
-
}
|