@formio/appserver 2.0.0-dev.4 → 2.0.0-dev.40
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/actions/index.d.ts +11 -11
- package/lib/modules/auth/auth.js +2 -2
- package/lib/prepare/access.js +3 -3
- package/lib/prepare/index.js +1 -1
- package/lib/prepare/reference.js +2 -1
- package/lib/server.js +2 -2
- package/lib/types/server.d.ts +4 -2
- package/lib/types/submission.d.ts +1 -0
- package/package.json +22 -21
package/lib/actions/index.d.ts
CHANGED
|
@@ -15,12 +15,12 @@ declare const _default: {
|
|
|
15
15
|
method: boolean;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
mappingComponents(scope: import("
|
|
19
|
-
settingsForm(scope: import("
|
|
20
|
-
saveToForm(scope: import("
|
|
21
|
-
childSubmission(scope: import("
|
|
22
|
-
childResponse(scope: import("
|
|
23
|
-
executor(scope: import("
|
|
18
|
+
mappingComponents(scope: import("src/types/lib").ActionScope): Promise<any>;
|
|
19
|
+
settingsForm(scope: import("src/types/lib").ActionScope): Promise<any>;
|
|
20
|
+
saveToForm(scope: import("src/types/lib").ActionScope, resource: string): undefined;
|
|
21
|
+
childSubmission(scope: import("src/types/lib").ActionScope, req: import("src/types/lib").SubmissionRequest, res: import("src/types/lib").SubmissionResponse, submission: any): any;
|
|
22
|
+
childResponse(scope: import("src/types/lib").ActionScope, req: import("src/types/lib").SubmissionRequest, res: import("src/types/lib").SubmissionResponse): void;
|
|
23
|
+
executor(scope: import("src/types/lib").ActionScope): Promise<(req: import("src/types/lib").SubmissionRequest, res: import("src/types/lib").SubmissionResponse, next: import("express").NextFunction) => Promise<void>>;
|
|
24
24
|
};
|
|
25
25
|
login: {
|
|
26
26
|
readonly info: {
|
|
@@ -37,7 +37,7 @@ declare const _default: {
|
|
|
37
37
|
method: boolean;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
settingsForm(scope: import("
|
|
40
|
+
settingsForm(scope: import("src/types/lib").ActionScope): Promise<({
|
|
41
41
|
type: string;
|
|
42
42
|
label: string;
|
|
43
43
|
key: string;
|
|
@@ -103,8 +103,8 @@ declare const _default: {
|
|
|
103
103
|
validate?: undefined;
|
|
104
104
|
})[]>;
|
|
105
105
|
waitText(time: number): string;
|
|
106
|
-
checkAttempts(scope: import("
|
|
107
|
-
executor(scope: import("
|
|
106
|
+
checkAttempts(scope: import("src/types/lib").ActionScope, error: any, user: import("src/types/lib").User): Promise<any>;
|
|
107
|
+
executor(scope: import("src/types/lib").ActionScope): Promise<(req: import("src/types/lib").SubmissionRequest, res: import("src/types/lib").SubmissionResponse, next: import("express").NextFunction) => Promise<void>>;
|
|
108
108
|
};
|
|
109
109
|
role: {
|
|
110
110
|
readonly info: {
|
|
@@ -121,7 +121,7 @@ declare const _default: {
|
|
|
121
121
|
method: boolean;
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
|
-
settingsForm(scope: import("
|
|
124
|
+
settingsForm(scope: import("src/types/lib").ActionScope): Promise<({
|
|
125
125
|
type: string;
|
|
126
126
|
input: boolean;
|
|
127
127
|
label: string;
|
|
@@ -154,7 +154,7 @@ declare const _default: {
|
|
|
154
154
|
required: boolean;
|
|
155
155
|
};
|
|
156
156
|
})[]>;
|
|
157
|
-
executor(scope: import("
|
|
157
|
+
executor(scope: import("src/types/lib").ActionScope): Promise<(req: import("src/types/lib").SubmissionRequest, res: import("src/types/lib").SubmissionResponse, next: import("express").NextFunction) => Promise<void | import("src/types/lib").SubmissionResponse>>;
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
160
|
export default _default;
|
package/lib/modules/auth/auth.js
CHANGED
|
@@ -17,8 +17,8 @@ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
|
17
17
|
const debug = require('debug')('formio:auth');
|
|
18
18
|
const error = require('debug')('formio:error');
|
|
19
19
|
class Auth {
|
|
20
|
-
token(
|
|
21
|
-
return __awaiter(this,
|
|
20
|
+
token(user_1, secret_1) {
|
|
21
|
+
return __awaiter(this, arguments, void 0, function* (user, secret, expire = 240) {
|
|
22
22
|
user = Object.assign({}, user);
|
|
23
23
|
delete user.iat;
|
|
24
24
|
delete user.exp;
|
package/lib/prepare/access.js
CHANGED
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const find_1 = __importDefault(require("lodash/find"));
|
|
16
16
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
17
17
|
exports.default = (scope) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const {
|
|
18
|
+
const { component, submission } = scope;
|
|
19
19
|
let { value } = scope;
|
|
20
20
|
if (!value ||
|
|
21
21
|
!component ||
|
|
@@ -43,7 +43,7 @@ exports.default = (scope) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
43
43
|
value = (0, uniq_1.default)(value.map((val) => val._id ? val._id.toString() : val.toString()));
|
|
44
44
|
// Iterate through each submissionAccess object and assign the appropriate access roles.
|
|
45
45
|
component.submissionAccess.map((access) => {
|
|
46
|
-
const perm = (0, find_1.default)(
|
|
46
|
+
const perm = (0, find_1.default)(submission.access, {
|
|
47
47
|
type: access.type,
|
|
48
48
|
});
|
|
49
49
|
if (perm) {
|
|
@@ -53,7 +53,7 @@ exports.default = (scope) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
53
53
|
perm.resources = (0, uniq_1.default)(perm.resources.concat(value));
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
|
|
56
|
+
submission.access.push({
|
|
57
57
|
type: access.type,
|
|
58
58
|
resources: value,
|
|
59
59
|
});
|
package/lib/prepare/index.js
CHANGED
|
@@ -43,7 +43,7 @@ exports.Prepper = {
|
|
|
43
43
|
const { type, form, submission } = scope;
|
|
44
44
|
try {
|
|
45
45
|
debug(`Preparing data for ${form.name}...`);
|
|
46
|
-
yield scope.utils.
|
|
46
|
+
yield scope.utils.eachComponentDataAsync(form.components, submission.data, (component, compData, compRow, compPath) => __awaiter(this, void 0, void 0, function* () {
|
|
47
47
|
if (exports.Prepper.preppers.hasOwnProperty(type)) {
|
|
48
48
|
for (let i = 0; i < exports.Prepper.preppers[type].length; i++) {
|
|
49
49
|
yield exports.Prepper.preppers[type][i](Object.assign(Object.assign({}, scope), { component, row: compRow, data, value: (0, get_1.default)(compData, compPath), path: core_1.Utils.getComponentAbsolutePath(component) }));
|
package/lib/prepare/reference.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.referenceSave = exports.referenceLoad = void 0;
|
|
16
16
|
const lodash_1 = require("lodash");
|
|
17
17
|
const protect_1 = __importDefault(require("./protect"));
|
|
18
|
+
const core_1 = require("@formio/core");
|
|
18
19
|
const getResource = (scope) => {
|
|
19
20
|
var _a, _b, _c, _d, _e;
|
|
20
21
|
const { component } = scope;
|
|
@@ -44,7 +45,7 @@ const referenceLoad = (scope) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
44
45
|
// Make sure to protect this submission like any other submission output.
|
|
45
46
|
const context = Object.assign(Object.assign({}, scope), { data: {} });
|
|
46
47
|
yield scope.utils.eachComponentDataAsync(resource.clientForm.components, submission.data, (comp, compData, compRow, compPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
-
yield (0, protect_1.default)(Object.assign(Object.assign({}, context), { component: comp, row: compRow, data:
|
|
48
|
+
yield (0, protect_1.default)(Object.assign(Object.assign({}, context), { component: comp, row: compRow, data: context.data, value: (0, lodash_1.get)(compData, compPath), path: core_1.Utils.getComponentAbsolutePath(comp) }));
|
|
48
49
|
}));
|
|
49
50
|
submission.data = context.data;
|
|
50
51
|
(0, lodash_1.set)(data, path, submission);
|
package/lib/server.js
CHANGED
|
@@ -7,13 +7,13 @@ exports.Actions = exports.Auth = exports.Database = exports.Prepper = exports.Se
|
|
|
7
7
|
// Load the license key.
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
|
-
let licenseKey = (0, get_1.default)(process.env, 'LICENSE_KEY', '');
|
|
10
|
+
let licenseKey = (0, get_1.default)(process.env, 'APPSERVER_LICENSE', (0, get_1.default)(process.env, 'LICENSE_KEY', ''));
|
|
11
11
|
if (!licenseKey) {
|
|
12
12
|
try {
|
|
13
13
|
licenseKey = fs_1.default.readFileSync(path_1.default.join((0, process_1.cwd)(), 'license.txt'), 'utf8');
|
|
14
14
|
}
|
|
15
15
|
catch (err) {
|
|
16
|
-
console.log('No license key found. Please set the
|
|
16
|
+
console.log('No license key found. Please set the APPSERVER_LICENSE environment variable or create a license.txt file in the root of the project.');
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
const appserver_core_1 = require("@formio/appserver-core");
|
package/lib/types/server.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export interface ServerConfig {
|
|
|
36
36
|
license: string;
|
|
37
37
|
status: any;
|
|
38
38
|
cache: boolean;
|
|
39
|
+
maxBodySize: string;
|
|
39
40
|
}
|
|
40
41
|
export interface DBConfig {
|
|
41
42
|
url: string;
|
|
@@ -46,9 +47,10 @@ export interface DBConfig {
|
|
|
46
47
|
export interface ServerDB {
|
|
47
48
|
config: DBConfig;
|
|
48
49
|
connect: (prefix?: string) => Promise<void>;
|
|
50
|
+
saveOne: (collection: string, doc: any) => Promise<any>;
|
|
49
51
|
save: (collection: string, doc: any) => Promise<any>;
|
|
50
|
-
load: (collection: string) => Promise<any>;
|
|
51
|
-
remove: (collection: string) => Promise<any>;
|
|
52
|
+
load: (collection: string, query?: any) => Promise<any>;
|
|
53
|
+
remove: (collection: string, query?: any) => Promise<any>;
|
|
52
54
|
index: (scope: FormScope, query: any) => Promise<any>;
|
|
53
55
|
create: (scope: FormScope, doc: any, allowFields?: string[]) => Promise<any>;
|
|
54
56
|
read: (scope: FormScope, id: string) => Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/appserver",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.40",
|
|
4
4
|
"description": "A highly performant and extensible Application Server for Form.io Multi-Tenant Deployments.",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,31 +29,32 @@
|
|
|
29
29
|
],
|
|
30
30
|
"homepage": "https://github.com/formio/appserver#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@formio/appserver-auth-jwt": "^2.0.0-dev.
|
|
33
|
-
"@formio/appserver-core": "^2.0.0-dev.
|
|
34
|
-
"@formio/appserver-db-mongodb": "^2.0.0-dev.
|
|
35
|
-
"@formio/appserver-types": "^2.0.0-dev.
|
|
36
|
-
"@formio/core": "^2.
|
|
37
|
-
"@formio/
|
|
38
|
-
"async": "^3.2.
|
|
32
|
+
"@formio/appserver-auth-jwt": "^2.0.0-dev.9",
|
|
33
|
+
"@formio/appserver-core": "^2.0.0-dev.38",
|
|
34
|
+
"@formio/appserver-db-mongodb": "^2.0.0-dev.9",
|
|
35
|
+
"@formio/appserver-types": "^2.0.0-dev.11",
|
|
36
|
+
"@formio/core": "^2.1.0-dev.tt.8",
|
|
37
|
+
"@formio/license": "^2.0.0-dev.4",
|
|
38
|
+
"async": "^3.2.5",
|
|
39
39
|
"bcryptjs": "^2.4.3",
|
|
40
40
|
"debug": "^4.3.4",
|
|
41
|
-
"dotenv": "^16.
|
|
42
|
-
"express": "^4.
|
|
43
|
-
"jsonwebtoken": "^9.0.
|
|
41
|
+
"dotenv": "^16.4.5",
|
|
42
|
+
"express": "^4.19.2",
|
|
43
|
+
"jsonwebtoken": "^9.0.2",
|
|
44
44
|
"lodash": "^4.17.21"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"@types/
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/
|
|
51
|
-
"@types/
|
|
52
|
-
"@types/
|
|
53
|
-
"@types/
|
|
54
|
-
"
|
|
55
|
-
"
|
|
47
|
+
"@formio/js": "^5.0.0-rc.52",
|
|
48
|
+
"@types/async": "^3.2.24",
|
|
49
|
+
"@types/bcryptjs": "^2.4.6",
|
|
50
|
+
"@types/express": "^4.17.21",
|
|
51
|
+
"@types/jsonwebtoken": "^9.0.6",
|
|
52
|
+
"@types/lodash": "^4.17.0",
|
|
53
|
+
"@types/mocha": "^10.0.6",
|
|
54
|
+
"@types/node": "^20.12.7",
|
|
55
|
+
"mocha": "^10.4.0",
|
|
56
|
+
"ts-node": "^10.9.2",
|
|
56
57
|
"tsconfig-paths": "^4.2.0",
|
|
57
|
-
"typescript": "^5.
|
|
58
|
+
"typescript": "^5.4.5"
|
|
58
59
|
}
|
|
59
60
|
}
|