not-node 4.0.6 → 4.0.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.
@@ -16,7 +16,7 @@ var argv = require('yargs').argv,
16
16
  path = require('path'),
17
17
  child_process = require('child_process'),
18
18
  deepMerge = require('deepmerge'),
19
-
19
+
20
20
  lib = require('../src/lib.js');
21
21
 
22
22
  const TEMPLATES_EXT = '.html';
@@ -31,6 +31,7 @@ let opts = {
31
31
  'to': argv.to || false,
32
32
  'config': argv.config || './project.manifest.json',
33
33
  'rollup': argv.rollup || path.join(process.cwd(),'./node_modules/.bin/rollup'),
34
+ 'role': argv.role || null
34
35
  },
35
36
  configName = path.join(process.cwd(), opts.config),
36
37
  config = {};
@@ -493,7 +494,10 @@ async function build_Server(pathToRoot, roles, targetName, targetManifest){
493
494
  console.log('List:', list);
494
495
  ////forming index.js and rollup.js
495
496
  for(let i = 0; i < roles.length; i++){
496
- let role = roles[i];
497
+ const role = roles[i];
498
+ if((opts.role !== null) && opts.role !== role){
499
+ continue;
500
+ }
497
501
  try{
498
502
  let indexFile = path.join(pathToRoot, targetManifest.src, 'index.' + role + '.js');
499
503
  let rollupFile = path.join(pathToRoot, targetManifest.root, 'rollup.' + role + '.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "4.0.6",
3
+ "version": "4.0.10",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/form/index.js CHANGED
@@ -22,7 +22,11 @@ module.exports = class Form {
22
22
  this.FORM_NAME = FORM_NAME;
23
23
  this.FIELDS = FIELDS;
24
24
  this.SCHEMA = byFieldsValidators(initFields(FIELDS, 'model'));
25
- this.MODEL = mongoose.model(FORM_NAME + '_' + Math.random().toString(), Schema(this.SCHEMA));
25
+ if (mongoose.modelNames().indexOf(FORM_NAME)===-1){
26
+ this.MODEL = mongoose.model(FORM_NAME, Schema(this.SCHEMA));
27
+ }else{
28
+ this.MODEL = mongoose.connection.model(FORM_NAME);
29
+ }
26
30
  }
27
31
 
28
32
  /**
@@ -162,14 +162,18 @@ class notRoute{
162
162
  }
163
163
 
164
164
  async executeRoute(modRoute, actionName, {req, res, next}){
165
- //waiting preparation
166
- let prepared = await this.executeFunction(modRoute, CONST_BEFORE_ACTION, [req, res, next]);
167
- //waiting results
168
- let result = await this.executeFunction(modRoute, actionName, [req, res, next, prepared]);
169
- //filter result IF actionData.return specified
170
- this.filterResultByReturnRule(req, result);
171
- //run after with results, continue without waiting when it finished
172
- return this.executeFunction(modRoute, CONST_AFTER_ACTION, [req, res, next, result]);
165
+ try{
166
+ //waiting preparation
167
+ let prepared = await this.executeFunction(modRoute, CONST_BEFORE_ACTION, [req, res, next]);
168
+ //waiting results
169
+ let result = await this.executeFunction(modRoute, actionName, [req, res, next, prepared]);
170
+ //filter result IF actionData.return specified
171
+ this.filterResultByReturnRule(req, result);
172
+ //run after with results, continue without waiting when it finished
173
+ return this.executeFunction(modRoute, CONST_AFTER_ACTION, [req, res, next, result]);
174
+ }catch(e){
175
+ next(e);
176
+ }
173
177
  }
174
178
 
175
179
  async executeFunction(obj, name, params) {