spice-js 2.5.21 → 2.5.24

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.
@@ -34,8 +34,6 @@ try {
34
34
  new spice[resource][file_name]({});
35
35
  }
36
36
  }
37
-
38
- console.log(resource, spice[resource]);
39
37
  });
40
38
 
41
39
  return function (_x) {
@@ -2,20 +2,24 @@
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
4
 
5
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
6
+
5
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
8
 
7
9
  spice.seeds = {};
8
10
 
9
11
  var paths = _path.default.join(spice.root_path, "seeds");
10
12
 
11
- require("fs").readdirSync(paths).forEach(function (file) {
12
- if (file != "index.js") {
13
- var seed = require(_path.default.join(paths, file));
13
+ if (_fsExtra.default.existsSync(paths)) {
14
+ require("fs").readdirSync(paths).forEach(function (file) {
15
+ if (file != "index.js") {
16
+ var seed = require(_path.default.join(paths, file));
14
17
 
15
- spice.seeds[file.split(".")[0]] = seed;
18
+ spice.seeds[file.split(".")[0]] = seed;
16
19
 
17
- if (seed.run) {
18
- seed.run();
20
+ if (seed.run) {
21
+ seed.run();
22
+ }
19
23
  }
20
- }
21
- });
24
+ });
25
+ }
@@ -234,7 +234,7 @@ class SpiceModel {
234
234
  returnVal.push("shouldExist:" + props[i]);
235
235
  }
236
236
 
237
- if (i == "unique") {
237
+ if (i == "unique" && props[i] == true) {
238
238
  returnVal.push("unique:" + this.constructor.name + "," + property_name);
239
239
  }
240
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spice-js",
3
- "version": "2.5.21",
3
+ "version": "2.5.24",
4
4
  "description": "spice",
5
5
  "main": "build/index.js",
6
6
  "repository": {
@@ -16,8 +16,7 @@ try {
16
16
  if (resource == "models") {
17
17
  new spice[resource][file_name]({});
18
18
  }
19
- }
20
- console.log(resource, spice[resource]);
19
+ }
21
20
  });
22
21
  } catch (error) {
23
22
  console.log("Error Happened", error);
@@ -200,7 +200,7 @@ export default class SpiceModel {
200
200
  if (i == "requires") {
201
201
  returnVal.push(`shouldExist:${props[i]}`);
202
202
  }
203
- if (i == "unique") {
203
+ if (i == "unique" && props[i] == true) {
204
204
  returnVal.push(`unique:${this.constructor.name},${property_name}`);
205
205
  }
206
206
  if (i == "type") {