not-node 5.0.22 → 5.1.2
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/.eslintrc.json +1 -1
- package/bin/not-deploy.js +52 -0
- package/index.js +21 -19
- package/package.json +1 -1
- package/src/app.js +61 -58
- package/src/auth/abstract.js +17 -19
- package/src/auth/const.js +8 -12
- package/src/auth/fields.js +143 -124
- package/src/auth/index.js +14 -14
- package/src/auth/roles.js +64 -63
- package/src/auth/routes.js +89 -54
- package/src/auth/rules.js +63 -63
- package/src/auth/session.js +60 -62
- package/src/bootstrap/form.js +13 -13
- package/src/bootstrap/logic.js +45 -41
- package/src/bootstrap/model.js +14 -17
- package/src/bootstrap/route.js +132 -53
- package/src/common.js +86 -79
- package/src/core/fields/ID.js +6 -6
- package/src/core/fields/__closed.js +3 -3
- package/src/core/fields/__latest.js +3 -3
- package/src/core/fields/__version.js +3 -3
- package/src/core/fields/__versions.js +3 -3
- package/src/core/fields/_id.js +6 -6
- package/src/core/fields/active.js +9 -9
- package/src/core/fields/codeName.js +9 -9
- package/src/core/fields/createdAt.js +17 -17
- package/src/core/fields/default.js +9 -9
- package/src/core/fields/description.js +11 -11
- package/src/core/fields/email.js +9 -9
- package/src/core/fields/enabled.js +9 -9
- package/src/core/fields/expiredAt.js +16 -16
- package/src/core/fields/height.js +11 -11
- package/src/core/fields/ip.js +10 -10
- package/src/core/fields/objectId.js +10 -10
- package/src/core/fields/owner.js +13 -13
- package/src/core/fields/ownerModel.js +11 -11
- package/src/core/fields/price.js +11 -11
- package/src/core/fields/requiredObject.js +10 -10
- package/src/core/fields/session.js +10 -10
- package/src/core/fields/size.js +11 -11
- package/src/core/fields/telephone.js +9 -9
- package/src/core/fields/title.js +15 -15
- package/src/core/fields/updatedAt.js +17 -17
- package/src/core/fields/userId.js +11 -12
- package/src/core/fields/uuid.js +11 -11
- package/src/core/fields/validators/email.js +6 -4
- package/src/core/fields/validators/owner.js +6 -4
- package/src/core/fields/width.js +11 -11
- package/src/domain.js +435 -431
- package/src/env.js +23 -23
- package/src/error.js +20 -23
- package/src/exceptions/db.js +23 -0
- package/src/exceptions/http.js +43 -0
- package/src/fields/index.js +106 -111
- package/src/form/fabric.js +19 -24
- package/src/form/form.js +195 -186
- package/src/form/index.js +2 -2
- package/src/generic/index.js +2 -0
- package/src/generic/logic.js +595 -0
- package/src/generic/route.js +76 -0
- package/src/init/additional.js +7 -7
- package/src/init/app.js +75 -68
- package/src/init/bodyparser.js +14 -14
- package/src/init/compression.js +6 -7
- package/src/init/core.js +12 -12
- package/src/init/cors.js +22 -24
- package/src/init/db/index.js +41 -43
- package/src/init/db/ioredis.js +28 -20
- package/src/init/db/mongoose.js +42 -32
- package/src/init/db/redis.js +59 -48
- package/src/init/env.js +44 -36
- package/src/init/express.js +18 -21
- package/src/init/fileupload.js +8 -10
- package/src/init/http.js +65 -47
- package/src/init/index.js +141 -148
- package/src/init/informer.js +7 -9
- package/src/init/methodoverride.js +4 -6
- package/src/init/middleware.js +23 -26
- package/src/init/modules.js +4 -4
- package/src/init/monitoring.js +8 -8
- package/src/init/rateLimiter.js +53 -45
- package/src/init/routes.js +67 -69
- package/src/init/security.js +37 -33
- package/src/init/sequence.js +111 -107
- package/src/init/sequence.standart.js +54 -56
- package/src/init/sessions/index.js +21 -21
- package/src/init/sessions/mongoose.js +49 -36
- package/src/init/sessions/redis.js +28 -27
- package/src/init/static.js +53 -40
- package/src/init/template.js +17 -17
- package/src/lib.js +230 -200
- package/src/manifest/batchRunner.js +26 -25
- package/src/manifest/initializator/forms.js +24 -24
- package/src/manifest/initializator/index.js +8 -10
- package/src/manifest/initializator/manifests.js +45 -42
- package/src/manifest/initializator/models.js +37 -34
- package/src/manifest/manifest.filter.js +130 -97
- package/src/manifest/manifest.js +103 -77
- package/src/manifest/module.js +350 -360
- package/src/manifest/registrator/fields.js +90 -85
- package/src/manifest/registrator/forms.js +47 -47
- package/src/manifest/registrator/index.js +14 -16
- package/src/manifest/registrator/locales.js +17 -16
- package/src/manifest/registrator/logics.js +66 -64
- package/src/manifest/registrator/models.js +64 -62
- package/src/manifest/registrator/routes.js +171 -132
- package/src/manifest/registrator/routes.ws.js +109 -103
- package/src/manifest/route.js +216 -161
- package/src/model/buildValidator.js +53 -42
- package/src/model/default.js +304 -286
- package/src/model/enrich.js +69 -61
- package/src/model/increment.js +124 -137
- package/src/model/proto.js +179 -148
- package/src/model/routine.js +85 -76
- package/src/model/utils.js +33 -0
- package/src/model/versioning.js +148 -130
- package/src/obsolete.js +12 -8
- package/src/parser.js +29 -22
- package/src/repos.js +29 -31
- package/src/rollup.js +75 -65
- package/src/shell.helpers.js +28 -28
- package/static.js +31 -0
- package/src/generic/router.js +0 -16
- package/src/manifest/module.models.js +0 -0
- package/src/manifest/module.status.js +0 -0
package/src/env.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
const {objHas} = require(
|
|
1
|
+
const { objHas } = require("./common");
|
|
2
2
|
|
|
3
3
|
const ENVS = {
|
|
4
|
-
|
|
4
|
+
process: process.env.NODE_ENV || "development",
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
module.exports = class notEnv {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Returns application environment variable
|
|
10
|
+
* @param {string} key name of var
|
|
11
|
+
* @return {object|undefined} value or undefined
|
|
12
|
+
*/
|
|
13
|
+
static getEnv(key) {
|
|
14
|
+
if (objHas(ENVS, key)) {
|
|
15
|
+
return ENVS[key];
|
|
16
|
+
} else {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
18
19
|
}
|
|
19
|
-
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Setting application environment variable
|
|
23
|
+
* @param {string} key name of var
|
|
24
|
+
* @param {object} val value
|
|
25
|
+
* @return {notDomain} chainable
|
|
26
|
+
*/
|
|
27
|
+
static setEnv(key, val) {
|
|
28
|
+
ENVS[key] = val;
|
|
29
|
+
return notEnv;
|
|
30
|
+
}
|
|
31
31
|
};
|
package/src/error.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
/** @module not-node/Error */
|
|
2
2
|
|
|
3
|
-
const {objHas} = require(
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
http = require('http');
|
|
3
|
+
const { objHas } = require("./common");
|
|
4
|
+
const util = require("util"),
|
|
5
|
+
http = require("http");
|
|
7
6
|
|
|
8
7
|
function HttpError(status, message) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
Error.apply(this, arguments);
|
|
9
|
+
Error.captureStackTrace(this, HttpError);
|
|
10
|
+
this.status = status;
|
|
11
|
+
this.message = message || http.STATUS_CODES[status] || "Error";
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
util.inherits(HttpError, Error);
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
HttpError.prototype.name = 'HttpError';
|
|
19
|
-
|
|
16
|
+
HttpError.prototype.name = "HttpError";
|
|
20
17
|
|
|
21
18
|
module.exports.Http = HttpError;
|
|
22
19
|
|
|
@@ -28,17 +25,17 @@ module.exports.Http = HttpError;
|
|
|
28
25
|
* @return {object} modified errors
|
|
29
26
|
*/
|
|
30
27
|
|
|
31
|
-
module.exports.addError = function(errors, field, error) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
module.exports.addError = function (errors, field, error) {
|
|
29
|
+
if (!errors) {
|
|
30
|
+
errors = {};
|
|
31
|
+
}
|
|
32
|
+
if (!objHas(errors, field)) {
|
|
33
|
+
errors[field] = [];
|
|
34
|
+
} else {
|
|
35
|
+
if (!Array.isArray(errors[field])) {
|
|
36
|
+
errors[field] = [errors[field]];
|
|
37
|
+
}
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return errors;
|
|
39
|
+
errors[field].push(error);
|
|
40
|
+
return errors;
|
|
44
41
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { notRequestError } = require("not-error");
|
|
2
|
+
|
|
3
|
+
//delete wasnt successful, or error, or count of deleted documents dont match requested
|
|
4
|
+
class DBExceptionDeleteWasNotSuccessful extends notRequestError {
|
|
5
|
+
constructor({ params = {}, cause = null }) {
|
|
6
|
+
super("DB Delete Was Not Successful", { code: 505, ...params }, cause);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
module.exports.DBExceptionDeleteWasNotSuccessful =
|
|
10
|
+
DBExceptionDeleteWasNotSuccessful;
|
|
11
|
+
|
|
12
|
+
//delete wasnt successful, bc document is owned by another user
|
|
13
|
+
class DBExceptionDocumentIsNotOwnerByActiveUser extends notRequestError {
|
|
14
|
+
constructor({ params = {}, cause = null }) {
|
|
15
|
+
super(
|
|
16
|
+
"DB Only Owners Could Delete their documents",
|
|
17
|
+
{ code: 403, ...params },
|
|
18
|
+
cause
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
module.exports.DBExceptionDocumentIsNotOwnerByActiveUser =
|
|
23
|
+
DBExceptionDocumentIsNotOwnerByActiveUser;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const { notRequestError } = require("not-error");
|
|
2
|
+
|
|
3
|
+
//https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses
|
|
4
|
+
|
|
5
|
+
//form of request is not valid
|
|
6
|
+
class HttpExceptionBadRequest extends notRequestError {
|
|
7
|
+
constructor({ params = {}, cause = null }) {
|
|
8
|
+
super("Bad Request", { code: 400, ...params }, cause);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
module.exports.HttpExceptionBadRequest = HttpExceptionBadRequest;
|
|
12
|
+
|
|
13
|
+
//user is not authenticated
|
|
14
|
+
class HttpExceptionUnauthorized extends notRequestError {
|
|
15
|
+
constructor({ params = {}, cause = null }) {
|
|
16
|
+
super("Unauthorized", { code: 401, ...params }, cause);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
module.exports.HttpExceptionUnauthorized = HttpExceptionUnauthorized;
|
|
20
|
+
|
|
21
|
+
//user is too poor to go there
|
|
22
|
+
class HttpExceptionPaymentRequired extends notRequestError {
|
|
23
|
+
constructor({ params = {}, cause = null }) {
|
|
24
|
+
super("Payment Required", { code: 402, ...params }, cause);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
module.exports.HttpExceptionPaymentRequired = HttpExceptionPaymentRequired;
|
|
28
|
+
|
|
29
|
+
//user identity is known, but he has no right to go there
|
|
30
|
+
class HttpExceptionForbidden extends notRequestError {
|
|
31
|
+
constructor({ params = {}, cause = null }) {
|
|
32
|
+
super("Forbidden", { code: 403, ...params }, cause);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
module.exports.HttpExceptionForbidden = HttpExceptionForbidden;
|
|
36
|
+
|
|
37
|
+
//requested address is not exists
|
|
38
|
+
class HttpExceptionNotFound extends notRequestError {
|
|
39
|
+
constructor({ params = {}, cause = null }) {
|
|
40
|
+
super("Not Found", { code: 404, ...params }, cause);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports.HttpExceptionNotFound = HttpExceptionNotFound;
|
package/src/fields/index.js
CHANGED
|
@@ -9,23 +9,23 @@ const DEFAULT_FROM = ":FIELDS";
|
|
|
9
9
|
const DEFAULT_TO = ":thisSchema";
|
|
10
10
|
|
|
11
11
|
module.exports.initFileSchemaFromFields = ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
app,
|
|
13
|
+
mod,
|
|
14
|
+
type = DEFAULT_TYPE,
|
|
15
|
+
from = DEFAULT_FROM,
|
|
16
|
+
to = DEFAULT_TO,
|
|
17
|
+
moduleName = "",
|
|
18
18
|
}) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
const FIELDS = notPath.get(from, mod);
|
|
20
|
+
if (FIELDS && Array.isArray(FIELDS)) {
|
|
21
|
+
const schema = module.exports.createSchemaFromFields(
|
|
22
|
+
app,
|
|
23
|
+
FIELDS,
|
|
24
|
+
type,
|
|
25
|
+
moduleName
|
|
26
|
+
);
|
|
27
|
+
notPath.set(to, mod, schema);
|
|
28
|
+
}
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -36,46 +36,41 @@ fields = [
|
|
|
36
36
|
]
|
|
37
37
|
**/
|
|
38
38
|
module.exports.createSchemaFromFields = (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
app,
|
|
40
|
+
fields,
|
|
41
|
+
type = "ui",
|
|
42
|
+
moduleName
|
|
43
43
|
) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
moduleName
|
|
52
|
-
);
|
|
53
|
-
schema[schemaFieldName] = schemaFieldValue;
|
|
54
|
-
});
|
|
55
|
-
return schema;
|
|
44
|
+
let schema = {};
|
|
45
|
+
fields.forEach((field) => {
|
|
46
|
+
let [schemaFieldName, schemaFieldValue] =
|
|
47
|
+
module.exports.initSchemaField(app, field, false, type, moduleName);
|
|
48
|
+
schema[schemaFieldName] = schemaFieldValue;
|
|
49
|
+
});
|
|
50
|
+
return schema;
|
|
56
51
|
};
|
|
57
52
|
|
|
58
53
|
module.exports.initSchemaField = (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
app,
|
|
55
|
+
field,
|
|
56
|
+
resultOnly = true,
|
|
57
|
+
type = "ui",
|
|
58
|
+
moduleName
|
|
64
59
|
) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
//log(field);
|
|
61
|
+
let { srcName, destName, mutation } = parseFieldDescription(field);
|
|
62
|
+
let proto = findFieldPrototype(app, srcName, type);
|
|
63
|
+
if (!proto) {
|
|
64
|
+
error(
|
|
65
|
+
`field ${moduleName}//${destName} prototype ${srcName} of ${type} type is not found`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
let schemaFieldValue = Object.assign({}, clone(proto), mutation);
|
|
69
|
+
if (resultOnly) {
|
|
70
|
+
return schemaFieldValue;
|
|
71
|
+
} else {
|
|
72
|
+
return [destName, schemaFieldValue];
|
|
73
|
+
}
|
|
79
74
|
};
|
|
80
75
|
|
|
81
76
|
/**
|
|
@@ -86,39 +81,39 @@ module.exports.initSchemaField = (
|
|
|
86
81
|
* ['destFieldName', {mutation: 'content'}, 'srcFieldName']// - form 4
|
|
87
82
|
**/
|
|
88
83
|
const parseFieldDescription = (field) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
let srcName,
|
|
85
|
+
destName,
|
|
86
|
+
mutation = {};
|
|
87
|
+
if (Array.isArray(field)) {
|
|
88
|
+
destName = srcName = field[0];
|
|
89
|
+
if (field.length === 2) {
|
|
90
|
+
if (typeof field[1] === "string") {
|
|
91
|
+
srcName = field[1]; //form 3
|
|
92
|
+
} else {
|
|
93
|
+
mutation = field[1]; //form 2
|
|
94
|
+
}
|
|
95
|
+
} else if (field.length === 3) {
|
|
96
|
+
//form 4
|
|
97
|
+
mutation = field[1];
|
|
98
|
+
srcName = field[2];
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
destName = srcName = field; //form 1
|
|
104
102
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
destName,
|
|
111
|
-
mutation,
|
|
112
|
-
};
|
|
103
|
+
return {
|
|
104
|
+
srcName,
|
|
105
|
+
destName,
|
|
106
|
+
mutation,
|
|
107
|
+
};
|
|
113
108
|
};
|
|
114
109
|
|
|
115
110
|
const findFieldPrototype = (app, name, type) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
const fieldPrototype = app.getField(name);
|
|
112
|
+
if (fieldPrototype && objHas(fieldPrototype, type)) {
|
|
113
|
+
return fieldPrototype[type];
|
|
114
|
+
} else {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
122
117
|
};
|
|
123
118
|
|
|
124
119
|
/**
|
|
@@ -133,33 +128,33 @@ const findFieldPrototype = (app, name, type) => {
|
|
|
133
128
|
**/
|
|
134
129
|
|
|
135
130
|
module.exports.initManifestFields = (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
app, //notApplication
|
|
132
|
+
schema, //schema of model
|
|
133
|
+
rawMutationsList = [], //fields mutations
|
|
134
|
+
privateFields = [], //fields to omit
|
|
135
|
+
moduleName //module name for reporting
|
|
141
136
|
) => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
137
|
+
let //shallow copy of array
|
|
138
|
+
mutationsList = [...rawMutationsList],
|
|
139
|
+
list = [];
|
|
140
|
+
if (schema && Object.keys(schema).length > 0) {
|
|
141
|
+
let rawKeys = Object.keys(schema);
|
|
142
|
+
rawKeys
|
|
143
|
+
.filter((key) => !privateFields.includes(key))
|
|
144
|
+
.forEach((key) => {
|
|
145
|
+
let mutation = getMutationForField(key, mutationsList);
|
|
146
|
+
if (mutation) {
|
|
147
|
+
list.push(mutation);
|
|
148
|
+
mutationsList.splice(mutationsList.indexOf(mutation), 1);
|
|
149
|
+
} else {
|
|
150
|
+
list.push(key);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
list.push(...mutationsList);
|
|
154
|
+
} else {
|
|
155
|
+
list = mutationsList;
|
|
156
|
+
}
|
|
157
|
+
return module.exports.createSchemaFromFields(app, list, "ui", moduleName);
|
|
163
158
|
};
|
|
164
159
|
|
|
165
160
|
/**
|
|
@@ -169,11 +164,11 @@ module.exports.initManifestFields = (
|
|
|
169
164
|
* @return {boolean|item}
|
|
170
165
|
*/
|
|
171
166
|
function getMutationForField(name, list) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
167
|
+
for (let item of list) {
|
|
168
|
+
if (Array.isArray(item) && item[0] === name) {
|
|
169
|
+
return item;
|
|
170
|
+
}
|
|
175
171
|
}
|
|
176
|
-
|
|
177
|
-
return false;
|
|
172
|
+
return false;
|
|
178
173
|
}
|
|
179
174
|
module.exports.getMutationForField = getMutationForField;
|
package/src/form/fabric.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
const Form = require(
|
|
1
|
+
const Form = require("./form");
|
|
2
2
|
|
|
3
3
|
module.exports = class FormFabric {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
super({
|
|
13
|
-
FIELDS,
|
|
14
|
-
FORM_NAME: `${MODULE_NAME}:${FORM_NAME}`
|
|
15
|
-
});
|
|
16
|
-
}
|
|
4
|
+
static create({ FIELDS, MODULE_NAME, FORM_NAME, extractor }) {
|
|
5
|
+
return class extends Form {
|
|
6
|
+
constructor() {
|
|
7
|
+
super({
|
|
8
|
+
FIELDS,
|
|
9
|
+
FORM_NAME: `${MODULE_NAME}:${FORM_NAME}`,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Extracts data
|
|
15
|
+
* @param {ExpressRequest} req expressjs request object
|
|
16
|
+
* @return {Object} forma data
|
|
17
|
+
**/
|
|
18
|
+
extract(req) {
|
|
19
|
+
return extractor(req);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
28
23
|
};
|