not-node 5.0.5 → 5.0.8
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/bin/not-builder.js +8 -8
- package/package.json +1 -1
- package/src/form/form.js +1 -8
- package/src/model/buildValidator.js +11 -5
package/bin/not-builder.js
CHANGED
|
@@ -261,7 +261,7 @@ async function loadNPMModule(){
|
|
|
261
261
|
}
|
|
262
262
|
opts.verbose && console.log('result', result);
|
|
263
263
|
}else{
|
|
264
|
-
|
|
264
|
+
opts.verbose && console.info('...no templates');
|
|
265
265
|
}
|
|
266
266
|
if(mod.paths.styles){
|
|
267
267
|
let commons;
|
|
@@ -278,7 +278,7 @@ async function loadNPMModule(){
|
|
|
278
278
|
}
|
|
279
279
|
opts.verbose && console.log('result', result);
|
|
280
280
|
}else{
|
|
281
|
-
|
|
281
|
+
opts.verbose && console.info('...no styles');
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
}catch(e){
|
|
@@ -314,7 +314,7 @@ async function loadServerModule(){
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}else{
|
|
317
|
-
|
|
317
|
+
opts.verbose && console.info('...no controllers');
|
|
318
318
|
}
|
|
319
319
|
if(mod.paths.templates){
|
|
320
320
|
let commons;
|
|
@@ -339,7 +339,7 @@ async function loadServerModule(){
|
|
|
339
339
|
|
|
340
340
|
}
|
|
341
341
|
}else{
|
|
342
|
-
|
|
342
|
+
opts.verbose && console.info('...no templates');
|
|
343
343
|
}
|
|
344
344
|
if(mod.paths.styles){
|
|
345
345
|
let commons;
|
|
@@ -364,7 +364,7 @@ async function loadServerModule(){
|
|
|
364
364
|
|
|
365
365
|
}
|
|
366
366
|
}else{
|
|
367
|
-
|
|
367
|
+
opts.verbose && console.info('...no styles');
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
}catch(e){
|
|
@@ -503,8 +503,8 @@ async function build_Server(pathToRoot, roles, targetName, targetManifest){
|
|
|
503
503
|
let indexFile = path.join(pathToRoot, targetManifest.src, 'index.' + role + '.js');
|
|
504
504
|
let rollupFile = path.join(pathToRoot, targetManifest.root, 'rollup.' + role + '.js');
|
|
505
505
|
let bundleFile = path.join(pathToRoot, targetManifest.build, role + '.js');
|
|
506
|
-
let templateFile = path.join(pathToRoot, targetManifest.build, role + '.html');
|
|
507
|
-
await lib.renderScript(path.join(pathToRoot,targetManifest.index), {
|
|
506
|
+
//let templateFile = path.join(pathToRoot, targetManifest.build, role + '.html');
|
|
507
|
+
await lib.renderScript(path.join(pathToRoot, targetManifest.index), {
|
|
508
508
|
mods:list[role].controllers,
|
|
509
509
|
scss: list[role].styles,
|
|
510
510
|
env: opts.environment,
|
|
@@ -522,7 +522,7 @@ async function build_Server(pathToRoot, roles, targetName, targetManifest){
|
|
|
522
522
|
NODE_ENV: opts.environment
|
|
523
523
|
}
|
|
524
524
|
});
|
|
525
|
-
await lib.joinToFile(templateFile, list[role].templates);
|
|
525
|
+
//await lib.joinToFile(templateFile, list[role].templates);
|
|
526
526
|
}catch(e){
|
|
527
527
|
console.error(e);
|
|
528
528
|
}
|
package/package.json
CHANGED
package/src/form/form.js
CHANGED
|
@@ -4,10 +4,6 @@ const {
|
|
|
4
4
|
createSchemaFromFields
|
|
5
5
|
} = require('../fields');
|
|
6
6
|
|
|
7
|
-
const {
|
|
8
|
-
byFieldsValidators
|
|
9
|
-
} = require('../model/enrich');
|
|
10
|
-
|
|
11
7
|
const {objHas} = require('../common');
|
|
12
8
|
|
|
13
9
|
const ValidationBuilder = require('not-validation').Builder;
|
|
@@ -154,9 +150,7 @@ class Form {
|
|
|
154
150
|
}
|
|
155
151
|
|
|
156
152
|
#createModelSchema(app){
|
|
157
|
-
return
|
|
158
|
-
createSchemaFromFields(app, this.#PROTO_FIELDS, 'model', this.#FORM_NAME)
|
|
159
|
-
);
|
|
153
|
+
return createSchemaFromFields(app, this.#PROTO_FIELDS, 'model', this.#FORM_NAME);
|
|
160
154
|
}
|
|
161
155
|
|
|
162
156
|
|
|
@@ -173,7 +167,6 @@ class Form {
|
|
|
173
167
|
this.#SCHEMA = ValidationBuilder(this.#SCHEMA, this.getValidatorEnvGetter());
|
|
174
168
|
}
|
|
175
169
|
|
|
176
|
-
|
|
177
170
|
/**
|
|
178
171
|
* Validates form data or throws
|
|
179
172
|
* @param {Object} data form data
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/** @module Model/Validator */
|
|
2
2
|
const validate = require('mongoose-validator');
|
|
3
|
-
const {objHas, executeObjectFunction, isFunc} = require('../common');
|
|
3
|
+
const {objHas, executeObjectFunction, isFunc, isAsync} = require('../common');
|
|
4
4
|
|
|
5
5
|
function extractValidationEnvGetter(options){
|
|
6
6
|
if(options && objHas(options, 'getValidationEnv') && isFunc(options.getValidationEnv)){
|
|
7
7
|
return options.getValidationEnv;
|
|
8
8
|
}else{
|
|
9
9
|
//should return at least empty object
|
|
10
|
-
return ()=>{return {};};
|
|
10
|
+
return ()=>{return {validate};};
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -23,9 +23,15 @@ function extendModern(rule, options){
|
|
|
23
23
|
const result = {...rule};
|
|
24
24
|
delete result.validator;
|
|
25
25
|
const validationEnv = extractValidationEnvGetter(options)();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
if(isAsync(rule.validator)){
|
|
27
|
+
result.validator = async (val) => {
|
|
28
|
+
return await executeObjectFunction(rule, 'validator', [val, validationEnv]);
|
|
29
|
+
};
|
|
30
|
+
}else{
|
|
31
|
+
result.validator = (val) => {
|
|
32
|
+
return executeObjectFunction(rule, 'validator', [val, validationEnv]);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
29
35
|
return result;
|
|
30
36
|
}
|
|
31
37
|
|