meadow 1.1.2 → 2.0.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.
Files changed (50) hide show
  1. package/.config/configstore/update-notifier-npm.json +1 -1
  2. package/.config/luxury-extras/MySQL/Dockerfile +1 -0
  3. package/.config/luxury-extras/MySQL/MySQL-Laden-Entry.sh +0 -0
  4. package/.config/luxury-extras/model/documentation/Dictionary.md +18 -0
  5. package/.config/luxury-extras/model/documentation/Model-Author.md +20 -0
  6. package/.config/luxury-extras/model/documentation/Model-Book.md +26 -0
  7. package/.config/luxury-extras/model/documentation/Model-BookAuthorJoin.md +14 -0
  8. package/.config/luxury-extras/model/documentation/Model-BookPrice.md +25 -0
  9. package/.config/luxury-extras/model/documentation/Model-Review.md +22 -0
  10. package/.config/luxury-extras/model/documentation/ModelChangeTracking.md +17 -0
  11. package/.config/luxury-extras/model/documentation/README.md +1 -0
  12. package/.config/luxury-extras/model/documentation/diagram/README.md +1 -0
  13. package/.config/luxury-extras/model/documentation/diagram/Stricture_Output.dot +13 -0
  14. package/.config/luxury-extras/model/documentation/diagram/Stricture_Output.png +0 -0
  15. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Author.json +220 -0
  16. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Book.json +268 -0
  17. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-BookAuthorJoin.json +172 -0
  18. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-BookPrice.json +260 -0
  19. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Review.json +236 -0
  20. package/.config/luxury-extras/model/json_schema_entities/README.md +1 -0
  21. package/.config/luxury-extras/model/json_schema_model/BookStore-Extended.json +915 -0
  22. package/.config/luxury-extras/model/json_schema_model/BookStore-PICT.json +1 -0
  23. package/.config/luxury-extras/model/json_schema_model/BookStore.json +280 -0
  24. package/.config/luxury-extras/model/json_schema_model/README.md +1 -0
  25. package/.config/luxury-extras/model/mysql_create/BookStore-CreateDatabase.mysql.sql +116 -0
  26. package/.config/luxury-extras/model/mysql_create/README.md +1 -0
  27. package/{Dockerfile → Dockerfile_LUXURYCode} +16 -1
  28. package/README.md +19 -5
  29. package/debug/Harness.js +69 -84
  30. package/gulpfile.js +83 -0
  31. package/package.json +24 -17
  32. package/source/Meadow-Browser-Shim.js +14 -0
  33. package/source/Meadow-Package.json +1 -1
  34. package/source/Meadow.js +17 -8
  35. package/source/behaviors/Meadow-Count.js +2 -2
  36. package/source/behaviors/Meadow-Create.js +3 -4
  37. package/source/behaviors/Meadow-Delete.js +2 -2
  38. package/source/behaviors/Meadow-Read.js +4 -4
  39. package/source/behaviors/Meadow-Reads.js +4 -3
  40. package/source/behaviors/Meadow-Undelete.js +42 -0
  41. package/source/behaviors/Meadow-Update.js +2 -2
  42. package/source/providers/Meadow-Provider-ALASQL.js +33 -0
  43. package/source/providers/Meadow-Provider-MeadowEndpoints.js +3 -4
  44. package/source/providers/Meadow-Provider-MySQL.js +40 -0
  45. package/source/providers/Meadow-Provider-None.js +8 -0
  46. package/test/Meadow-Provider-ALASQL.js +38 -14
  47. package/test/Meadow-Provider-MeadowEndpoints_tests.js +2 -819
  48. package/test/Meadow-Provider-MySQL_tests.js +49 -13
  49. package/test/Meadow-Provider-None_tests.js +19 -16
  50. package/test/Meadow_tests.js +2 -2
@@ -13,7 +13,7 @@ var Expect = Chai.expect;
13
13
  var Assert = Chai.assert;
14
14
 
15
15
  var libMySQL = require('mysql2');
16
- var libAsync = require('async');
16
+ var libAsyncWaterfall = require('async/waterfall');
17
17
 
18
18
  var tmpFableSettings = (
19
19
  {
@@ -29,18 +29,20 @@ var tmpFableSettings = (
29
29
  },
30
30
  LogStreams:
31
31
  [
32
- {
33
- level: 'fatal',
34
- streamtype:'process.stdout',
35
- },
36
- {
37
- level: 'trace',
38
- path: __dirname+'/../tests.log'
39
- }
32
+ {
33
+ level: 'fatal',
34
+ streamtype:'process.stdout',
35
+ },
36
+ {
37
+ level: 'trace',
38
+ path: __dirname+'/../tests.log'
39
+ }
40
40
  ]
41
41
  });
42
42
 
43
- var libFable = require('fable').new(tmpFableSettings);
43
+ var libFable = new (require('fable'))(tmpFableSettings);
44
+
45
+ var _SQLConnectionPool = false;
44
46
 
45
47
  libFable.MeadowMySQLConnectionPool = libMySQL.createPool
46
48
  (
@@ -129,14 +131,14 @@ suite
129
131
  .setDefault(_AnimalDefault)
130
132
  };
131
133
 
132
- setup
134
+ suiteSetup
133
135
  (
134
136
  function(fDone)
135
137
  {
136
138
  // Only do this for the first test.
137
139
  if (!_SpooledUp)
138
140
  {
139
- var _SQLConnectionPool = libMySQL.createPool
141
+ _SQLConnectionPool = libMySQL.createPool
140
142
  (
141
143
  {
142
144
  connectionLimit: tmpFableSettings.MySQL.ConnectionPoolLimit,
@@ -149,7 +151,7 @@ suite
149
151
  );
150
152
 
151
153
  // Tear down previous test data
152
- libAsync.waterfall(
154
+ libAsyncWaterfall(
153
155
  [
154
156
  function(fCallBack)
155
157
  {
@@ -202,6 +204,11 @@ suite
202
204
  }
203
205
  );
204
206
 
207
+ suiteTeardown((fDone) => {
208
+ _SQLConnectionPool.end(fDone);
209
+ }
210
+ );
211
+
205
212
  suite
206
213
  (
207
214
  'Object Sanity',
@@ -379,6 +386,35 @@ suite
379
386
  }
380
387
  );
381
388
  test
389
+ (
390
+ 'Undelete a record in the database',
391
+ function(fDone)
392
+ {
393
+ var testMeadow = newMeadow();
394
+
395
+ testMeadow.fable.settings.QueryThresholdWarnTime = 1;
396
+ var tmpDeleteQuery = testMeadow.query.addFilter('IDAnimal',5);
397
+
398
+ // Make sure the record is deleted!
399
+ testMeadow.doDelete(tmpDeleteQuery,
400
+ function(pDeleteError, pDeleteQuery, pDeleteRecord)
401
+ {
402
+ var tmpQuery = testMeadow.query.addFilter('IDAnimal',5);
403
+ testMeadow.doUndelete(tmpQuery,
404
+ function(pError, pQuery, pRecord)
405
+ {
406
+ // It returns the number of rows deleted
407
+ Expect(pRecord)
408
+ .to.equal(1);
409
+
410
+ testMeadow.fable.settings.QueryThresholdWarnTime = 1000;
411
+
412
+ fDone();
413
+ });
414
+ });
415
+ }
416
+ );
417
+ test
382
418
  (
383
419
  'Count all records from the database',
384
420
  function(fDone)
@@ -10,20 +10,8 @@ var Chai = require("chai");
10
10
  var Expect = Chai.expect;
11
11
  var Assert = Chai.assert;
12
12
 
13
- var libFable = require('fable').new({
14
- LogStreams:
15
- [
16
- {
17
- level: 'fatal',
18
- streamtype:'process.stdout',
19
- },
20
- {
21
- level: 'trace',
22
- path: __dirname+'/../tests.log'
23
- }
24
- ]
25
- });
26
- var libFoxHound = require('foxhound');
13
+ var libFable = new (require('fable'))({ Product:'MeadowProviderNone'});
14
+ var libMeadow = require('../source/Meadow.js');
27
15
 
28
16
  var _AnimalJsonSchema = (
29
17
  {
@@ -74,7 +62,7 @@ suite
74
62
  {
75
63
  var newMeadow = function()
76
64
  {
77
- return require('../source/Meadow.js').new(libFable, 'FableTest');
65
+ return libMeadow.new(libFable, 'FableTest');
78
66
  };
79
67
 
80
68
  setup
@@ -94,7 +82,7 @@ suite
94
82
  'The class should initialize itself into a happy little object.',
95
83
  function()
96
84
  {
97
- var testMeadow = require('../source/Meadow.js').new(libFable);
85
+ var testMeadow = libMeadow.new(libFable);
98
86
  Expect(testMeadow).to.be.an('object', 'Meadow should initialize as an object directly from the require statement.');
99
87
  }
100
88
  );
@@ -186,6 +174,21 @@ suite
186
174
  }
187
175
  );
188
176
  test
177
+ (
178
+ 'Undelete a record in the database',
179
+ function(fDone)
180
+ {
181
+ var testMeadow = newMeadow();
182
+ testMeadow.doUndelete(testMeadow.query,
183
+ function(pError, pQuery, pRecord)
184
+ {
185
+ Expect(pQuery.parameters.result.executed).to.equal(true);
186
+ fDone();
187
+ }
188
+ )
189
+ }
190
+ );
191
+ test
189
192
  (
190
193
  'Count all records from the database',
191
194
  function(fDone)
@@ -58,7 +58,7 @@ suite
58
58
  (
59
59
  function()
60
60
  {
61
- _Fable = libFable.new(
61
+ _Fable = new libFable(
62
62
  {
63
63
  LogStreams:
64
64
  [
@@ -299,7 +299,7 @@ suite
299
299
  function()
300
300
  {
301
301
  // given
302
- _Fable = libFable.new(
302
+ _Fable = new libFable(
303
303
  {
304
304
  MeadowRoleNames: ['Cool', 'Bold', 'Tired'],
305
305
  LogStreams: