meadow 1.1.1 → 2.0.1
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/.config/code-server/config.yaml +4 -0
- package/.config/configstore/update-notifier-npm-check-updates.json +4 -0
- package/.config/configstore/update-notifier-npm.json +4 -0
- package/.config/luxury-extras/.vscode/launch.json +46 -0
- package/.config/luxury-extras/Dockerfile +32 -0
- package/.config/luxury-extras/MySQL/Dockerfile +51 -0
- package/.config/luxury-extras/MySQL/MySQL-Laden-Entry.sh +17 -0
- package/.config/luxury-extras/MySQL/MySQL-Security.sql +5 -0
- package/.config/luxury-extras/model/ddl/BookStore.ddl +66 -0
- package/.config/luxury-extras/model/documentation/Dictionary.md +18 -0
- package/.config/luxury-extras/model/documentation/Model-Author.md +20 -0
- package/.config/luxury-extras/model/documentation/Model-Book.md +26 -0
- package/.config/luxury-extras/model/documentation/Model-BookAuthorJoin.md +14 -0
- package/.config/luxury-extras/model/documentation/Model-BookPrice.md +25 -0
- package/.config/luxury-extras/model/documentation/Model-Review.md +22 -0
- package/.config/luxury-extras/model/documentation/ModelChangeTracking.md +17 -0
- package/.config/luxury-extras/model/documentation/README.md +1 -0
- package/.config/luxury-extras/model/documentation/diagram/README.md +1 -0
- package/.config/luxury-extras/model/documentation/diagram/Stricture_Output.dot +13 -0
- package/.config/luxury-extras/model/documentation/diagram/Stricture_Output.png +0 -0
- package/.config/luxury-extras/model/generated_diagram/README.md +1 -0
- package/.config/luxury-extras/model/generated_diagram/Stricture_Output.dot +13 -0
- package/.config/luxury-extras/model/generated_diagram/Stricture_Output.png +0 -0
- package/.config/luxury-extras/model/generated_documentation/Dictionary.md +18 -0
- package/.config/luxury-extras/model/generated_documentation/Model-Author.md +20 -0
- package/.config/luxury-extras/model/generated_documentation/Model-Book.md +26 -0
- package/.config/luxury-extras/model/generated_documentation/Model-BookAuthorJoin.md +14 -0
- package/.config/luxury-extras/model/generated_documentation/Model-BookPrice.md +25 -0
- package/.config/luxury-extras/model/generated_documentation/Model-Review.md +22 -0
- package/.config/luxury-extras/model/generated_documentation/ModelChangeTracking.md +17 -0
- package/.config/luxury-extras/model/generated_documentation/README.md +1 -0
- package/.config/luxury-extras/model/json_schema/BookStore-Extended.json +915 -0
- package/.config/luxury-extras/model/json_schema/BookStore-PICT.json +1 -0
- package/.config/luxury-extras/model/json_schema/BookStore.json +280 -0
- package/.config/luxury-extras/model/json_schema/README.md +1 -0
- package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Author.json +220 -0
- package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Book.json +268 -0
- package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-BookAuthorJoin.json +172 -0
- package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-BookPrice.json +260 -0
- package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Review.json +236 -0
- package/.config/luxury-extras/model/json_schema_entities/README.md +1 -0
- package/.config/luxury-extras/model/json_schema_model/BookStore-Extended.json +915 -0
- package/.config/luxury-extras/model/json_schema_model/BookStore-PICT.json +1 -0
- package/.config/luxury-extras/model/json_schema_model/BookStore.json +280 -0
- package/.config/luxury-extras/model/json_schema_model/README.md +1 -0
- package/.config/luxury-extras/model/manual_scripts/DropTables.sql +5 -0
- package/.config/luxury-extras/model/manual_scripts/README.md +2 -0
- package/.config/luxury-extras/model/meadow_schema/BookStore-MeadowSchema-Author.json +220 -0
- package/.config/luxury-extras/model/meadow_schema/BookStore-MeadowSchema-Book.json +268 -0
- package/.config/luxury-extras/model/meadow_schema/BookStore-MeadowSchema-BookAuthorJoin.json +172 -0
- package/.config/luxury-extras/model/meadow_schema/BookStore-MeadowSchema-BookPrice.json +260 -0
- package/.config/luxury-extras/model/meadow_schema/BookStore-MeadowSchema-Review.json +236 -0
- package/.config/luxury-extras/model/meadow_schema/README.md +1 -0
- package/.config/luxury-extras/model/mysql_create/BookStore-CreateDatabase.mysql.sql +116 -0
- package/.config/luxury-extras/model/mysql_create/README.md +1 -0
- package/.config/luxury-extras/model/sql_create/BookStore-CreateDatabase.mysql.sql +116 -0
- package/.config/luxury-extras/model/sql_create/README.md +1 -0
- package/.vscode/launch.json +46 -0
- package/Dockerfile_LUXURYCode +65 -0
- package/README.md +19 -5
- package/debug/Harness.js +69 -84
- package/dist/meadow.js +1669 -0
- package/dist/meadow.min.js +65 -0
- package/dist/meadow.min.js.map +1 -0
- package/gulpfile.js +83 -0
- package/package.json +42 -20
- package/source/Meadow-Browser-Shim.js +14 -0
- package/source/{Meadow-PackageLoader.js → Meadow-PackageFileLoader.js} +3 -3
- package/source/Meadow-PackageObjectLoader.js +62 -0
- package/source/Meadow.js +21 -3
- package/source/behaviors/Meadow-Count.js +2 -2
- package/source/behaviors/Meadow-Create.js +3 -4
- package/source/behaviors/Meadow-Delete.js +2 -2
- package/source/behaviors/Meadow-Read.js +5 -4
- package/source/behaviors/Meadow-Reads.js +4 -3
- package/source/behaviors/Meadow-Undelete.js +42 -0
- package/source/behaviors/Meadow-Update.js +2 -2
- package/source/providers/Meadow-Provider-ALASQL.js +33 -0
- package/source/providers/Meadow-Provider-MeadowEndpoints.js +3 -4
- package/source/providers/Meadow-Provider-MySQL.js +40 -0
- package/source/providers/Meadow-Provider-None.js +8 -0
- package/test/Meadow-Provider-ALASQL.js +38 -14
- package/test/Meadow-Provider-MeadowEndpoints_tests.js +2 -819
- package/test/Meadow-Provider-MySQL_tests.js +49 -13
- package/test/Meadow-Provider-None_tests.js +19 -16
- package/test/Meadow_tests.js +59 -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
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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')
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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')
|
|
14
|
-
|
|
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
|
|
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 =
|
|
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)
|
package/test/Meadow_tests.js
CHANGED
|
@@ -58,7 +58,7 @@ suite
|
|
|
58
58
|
(
|
|
59
59
|
function()
|
|
60
60
|
{
|
|
61
|
-
_Fable = libFable
|
|
61
|
+
_Fable = new libFable(
|
|
62
62
|
{
|
|
63
63
|
LogStreams:
|
|
64
64
|
[
|
|
@@ -216,6 +216,63 @@ suite
|
|
|
216
216
|
}
|
|
217
217
|
);
|
|
218
218
|
test
|
|
219
|
+
(
|
|
220
|
+
'Try to load from a json object',
|
|
221
|
+
function()
|
|
222
|
+
{
|
|
223
|
+
var testMeadow = require('../source/Meadow.js').new(_Fable).loadFromPackageObject(
|
|
224
|
+
{
|
|
225
|
+
"Scope": "MyPackage",
|
|
226
|
+
|
|
227
|
+
"DefaultIdentifier": "IDMyPackage",
|
|
228
|
+
|
|
229
|
+
"Schema": [
|
|
230
|
+
{ "Column": "IDMyPackage", "Type":"AutoIdentity" },
|
|
231
|
+
{ "Column": "GUIDMyPackage", "Type":"AutoGUID" },
|
|
232
|
+
{ "Column": "Name", "Type":"String" },
|
|
233
|
+
{ "Column": "Age", "Type":"Number" }
|
|
234
|
+
],
|
|
235
|
+
|
|
236
|
+
"DefaultObject": {
|
|
237
|
+
"IDMyPackage": 0,
|
|
238
|
+
"GUIDMyPackage": "0000-0000",
|
|
239
|
+
|
|
240
|
+
"Name": "Unknown",
|
|
241
|
+
"Age": 0
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
"JsonSchema": {
|
|
245
|
+
"title": "MyPackage",
|
|
246
|
+
"description": "A nondescript package.",
|
|
247
|
+
"type": "object",
|
|
248
|
+
"properties": {
|
|
249
|
+
"IDMyPackage": {
|
|
250
|
+
"description": "The unique identifier for our package",
|
|
251
|
+
"type": "integer"
|
|
252
|
+
},
|
|
253
|
+
"GUIDMyPackage": {
|
|
254
|
+
"description": "A string UUID for our package",
|
|
255
|
+
"type": "string"
|
|
256
|
+
},
|
|
257
|
+
"Name": {
|
|
258
|
+
"description": "The name",
|
|
259
|
+
"type": "string"
|
|
260
|
+
},
|
|
261
|
+
"Age": {
|
|
262
|
+
"description": "How old the package is",
|
|
263
|
+
"type": "number",
|
|
264
|
+
"minimum": 0,
|
|
265
|
+
"exclusiveMinimum": true
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
"required": ["IDMyPackage", "Name"]
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
Expect(testMeadow.scope)
|
|
272
|
+
.to.equal('MyPackage');
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
test
|
|
219
276
|
(
|
|
220
277
|
'Try to load from an empty json package',
|
|
221
278
|
function()
|
|
@@ -242,7 +299,7 @@ suite
|
|
|
242
299
|
function()
|
|
243
300
|
{
|
|
244
301
|
// given
|
|
245
|
-
_Fable = libFable
|
|
302
|
+
_Fable = new libFable(
|
|
246
303
|
{
|
|
247
304
|
MeadowRoleNames: ['Cool', 'Bold', 'Tired'],
|
|
248
305
|
LogStreams:
|