masterrecord 0.1.2 → 0.1.4

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/context.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 0.0.7
1
+ // Version 0.0.9
2
2
 
3
3
  var modelBuilder = require('./Entity/entityModelBuilder');
4
4
  var query = require('masterrecord/QueryLanguage/queryMethods');
@@ -91,6 +91,9 @@ class context {
91
91
 
92
92
  __findSettings(root, rootFolderLocation, envType){
93
93
 
94
+ if(envType === undefined){
95
+ envType = "development";
96
+ }
94
97
  var rootFolder = `${root}/${rootFolderLocation}`;
95
98
  var search = `${rootFolder}/**/*env.${envType}.json`;
96
99
  var files = globSearch.sync(search, rootFolder);
@@ -276,8 +279,11 @@ class context {
276
279
 
277
280
  catch(error){
278
281
  this.__clearErrorHandler();
279
- //this._SQLEngine.errorTransaction();
282
+
280
283
  console.log("error", error);
284
+ if(this.isSQLite){
285
+ this._SQLEngine.errorTransaction();
286
+ }
281
287
  this.__clearTracked();
282
288
  throw error;
283
289
  }
package/insertManager.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- // version 0.0.5
2
+ // version 0.0.6
3
3
  var tools = require('./Tools');
4
4
  var queryScript = require('masterrecord/QueryLanguage/queryScript');
5
5
 
@@ -32,7 +32,16 @@ class InsertManager {
32
32
  var query = `select * from ${currentModel.__entity.__name} where ${primaryKey} = ${ SQL.id }`;
33
33
  var jj = this.__queryObject.raw(query);
34
34
  var getQueryModel = this._SQLEngine.get(jj, currentModel.__entity, currentModel.__context );
35
- currentModel[primaryKey] = getQueryModel[0][primaryKey];
35
+ var idVal;
36
+
37
+ if(!getQueryModel[0]){
38
+ idVal = getQueryModel[primaryKey]
39
+ }
40
+ else{
41
+ idVal = getQueryModel[0][primaryKey];
42
+ }
43
+
44
+ currentModel[primaryKey] = idVal;
36
45
  }
37
46
 
38
47
  const modelKeys = Object.keys(currentModel);
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "masterrecord",
3
3
  "dependencies": {
4
- "commander": "^11.1.0",
5
- "glob" : "^10.3.10",
4
+ "commander": "^13.1.0",
5
+ "glob" : "^11.0.1",
6
6
  "deep-object-diff" : "^1.1.9",
7
- "pg" : "^8.13.3",
8
- "sync-mysql2" : "^1.0.4",
7
+ "pg" : "^8.14.1",
8
+ "sync-mysql2" : "^1.0.5",
9
9
  "app-root-path": "^3.1.0"
10
10
  },
11
- "version": "0.1.2",
11
+ "version": "0.1.4",
12
12
  "description": "An Object-relational mapping for the Master framework. Master Record connects classes to relational database tables to establish a database with almost zero-configuration ",
13
13
  "homepage": "https://github.com/Tailor/MasterRecord#readme",
14
14
  "repository": {