meadow 1.1.2 → 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.
Files changed (52) 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/dist/meadow.js +1669 -0
  31. package/dist/meadow.min.js +65 -0
  32. package/dist/meadow.min.js.map +1 -0
  33. package/gulpfile.js +83 -0
  34. package/package.json +24 -17
  35. package/source/Meadow-Browser-Shim.js +14 -0
  36. package/source/Meadow.js +17 -8
  37. package/source/behaviors/Meadow-Count.js +2 -2
  38. package/source/behaviors/Meadow-Create.js +3 -4
  39. package/source/behaviors/Meadow-Delete.js +2 -2
  40. package/source/behaviors/Meadow-Read.js +5 -4
  41. package/source/behaviors/Meadow-Reads.js +4 -3
  42. package/source/behaviors/Meadow-Undelete.js +42 -0
  43. package/source/behaviors/Meadow-Update.js +2 -2
  44. package/source/providers/Meadow-Provider-ALASQL.js +33 -0
  45. package/source/providers/Meadow-Provider-MeadowEndpoints.js +3 -4
  46. package/source/providers/Meadow-Provider-MySQL.js +40 -0
  47. package/source/providers/Meadow-Provider-None.js +8 -0
  48. package/test/Meadow-Provider-ALASQL.js +38 -14
  49. package/test/Meadow-Provider-MeadowEndpoints_tests.js +2 -819
  50. package/test/Meadow-Provider-MySQL_tests.js +49 -13
  51. package/test/Meadow-Provider-None_tests.js +19 -16
  52. package/test/Meadow_tests.js +2 -2
@@ -0,0 +1,280 @@
1
+ {
2
+ "Tables": {
3
+ "Book": {
4
+ "TableName": "Book",
5
+ "Domain": "Default",
6
+ "Columns": [
7
+ {
8
+ "Column": "IDBook",
9
+ "DataType": "ID"
10
+ },
11
+ {
12
+ "Column": "GUIDBook",
13
+ "DataType": "GUID"
14
+ },
15
+ {
16
+ "Column": "CreateDate",
17
+ "DataType": "DateTime"
18
+ },
19
+ {
20
+ "Column": "CreatingIDUser",
21
+ "DataType": "Numeric"
22
+ },
23
+ {
24
+ "Column": "UpdateDate",
25
+ "DataType": "DateTime"
26
+ },
27
+ {
28
+ "Column": "UpdatingIDUser",
29
+ "DataType": "Numeric"
30
+ },
31
+ {
32
+ "Column": "Deleted",
33
+ "DataType": "Boolean"
34
+ },
35
+ {
36
+ "Column": "DeleteDate",
37
+ "DataType": "DateTime"
38
+ },
39
+ {
40
+ "Column": "DeletingIDUser",
41
+ "DataType": "Numeric"
42
+ },
43
+ {
44
+ "Column": "Title",
45
+ "DataType": "String",
46
+ "Size": "200"
47
+ },
48
+ {
49
+ "Column": "Type",
50
+ "DataType": "String",
51
+ "Size": "32"
52
+ },
53
+ {
54
+ "Column": "Genre",
55
+ "DataType": "String",
56
+ "Size": "128"
57
+ },
58
+ {
59
+ "Column": "ISBN",
60
+ "DataType": "String",
61
+ "Size": "64"
62
+ },
63
+ {
64
+ "Column": "Language",
65
+ "DataType": "String",
66
+ "Size": "12"
67
+ },
68
+ {
69
+ "Column": "ImageURL",
70
+ "DataType": "String",
71
+ "Size": "254"
72
+ },
73
+ {
74
+ "Column": "PublicationYear",
75
+ "DataType": "Numeric"
76
+ }
77
+ ],
78
+ "Description": ""
79
+ },
80
+ "BookAuthorJoin": {
81
+ "TableName": "BookAuthorJoin",
82
+ "Domain": "Default",
83
+ "Columns": [
84
+ {
85
+ "Column": "IDBookAuthorJoin",
86
+ "DataType": "ID"
87
+ },
88
+ {
89
+ "Column": "GUIDBookAuthorJoin",
90
+ "DataType": "GUID"
91
+ },
92
+ {
93
+ "Column": "IDBook",
94
+ "DataType": "Numeric",
95
+ "Join": "IDBook"
96
+ },
97
+ {
98
+ "Column": "IDAuthor",
99
+ "DataType": "Numeric",
100
+ "Join": "IDAuthor"
101
+ }
102
+ ],
103
+ "Description": ""
104
+ },
105
+ "Author": {
106
+ "TableName": "Author",
107
+ "Domain": "Default",
108
+ "Columns": [
109
+ {
110
+ "Column": "IDAuthor",
111
+ "DataType": "ID"
112
+ },
113
+ {
114
+ "Column": "GUIDAuthor",
115
+ "DataType": "GUID"
116
+ },
117
+ {
118
+ "Column": "CreateDate",
119
+ "DataType": "DateTime"
120
+ },
121
+ {
122
+ "Column": "CreatingIDUser",
123
+ "DataType": "Numeric"
124
+ },
125
+ {
126
+ "Column": "UpdateDate",
127
+ "DataType": "DateTime"
128
+ },
129
+ {
130
+ "Column": "UpdatingIDUser",
131
+ "DataType": "Numeric"
132
+ },
133
+ {
134
+ "Column": "Deleted",
135
+ "DataType": "Boolean"
136
+ },
137
+ {
138
+ "Column": "DeleteDate",
139
+ "DataType": "DateTime"
140
+ },
141
+ {
142
+ "Column": "DeletingIDUser",
143
+ "DataType": "Numeric"
144
+ },
145
+ {
146
+ "Column": "Name",
147
+ "DataType": "String",
148
+ "Size": "200"
149
+ }
150
+ ],
151
+ "Description": ""
152
+ },
153
+ "BookPrice": {
154
+ "TableName": "BookPrice",
155
+ "Domain": "Default",
156
+ "Columns": [
157
+ {
158
+ "Column": "IDBookPrice",
159
+ "DataType": "ID"
160
+ },
161
+ {
162
+ "Column": "GUIDBookPrice",
163
+ "DataType": "GUID"
164
+ },
165
+ {
166
+ "Column": "CreateDate",
167
+ "DataType": "DateTime"
168
+ },
169
+ {
170
+ "Column": "CreatingIDUser",
171
+ "DataType": "Numeric"
172
+ },
173
+ {
174
+ "Column": "UpdateDate",
175
+ "DataType": "DateTime"
176
+ },
177
+ {
178
+ "Column": "UpdatingIDUser",
179
+ "DataType": "Numeric"
180
+ },
181
+ {
182
+ "Column": "Deleted",
183
+ "DataType": "Boolean"
184
+ },
185
+ {
186
+ "Column": "DeleteDate",
187
+ "DataType": "DateTime"
188
+ },
189
+ {
190
+ "Column": "DeletingIDUser",
191
+ "DataType": "Numeric"
192
+ },
193
+ {
194
+ "Column": "Price",
195
+ "DataType": "Decimal",
196
+ "Size": "8,2"
197
+ },
198
+ {
199
+ "Column": "StartDate",
200
+ "DataType": "DateTime"
201
+ },
202
+ {
203
+ "Column": "EndDate",
204
+ "DataType": "DateTime"
205
+ },
206
+ {
207
+ "Column": "Discountable",
208
+ "DataType": "Boolean"
209
+ },
210
+ {
211
+ "Column": "CouponCode",
212
+ "DataType": "String",
213
+ "Size": "16"
214
+ },
215
+ {
216
+ "Column": "IDBook",
217
+ "DataType": "Numeric",
218
+ "Join": "IDBook"
219
+ }
220
+ ],
221
+ "Description": ""
222
+ },
223
+ "Review": {
224
+ "TableName": "Review",
225
+ "Domain": "Default",
226
+ "Columns": [
227
+ {
228
+ "Column": "IDReviews",
229
+ "DataType": "ID"
230
+ },
231
+ {
232
+ "Column": "GUIDReviews",
233
+ "DataType": "GUID"
234
+ },
235
+ {
236
+ "Column": "CreateDate",
237
+ "DataType": "DateTime"
238
+ },
239
+ {
240
+ "Column": "CreatingIDUser",
241
+ "DataType": "Numeric"
242
+ },
243
+ {
244
+ "Column": "UpdateDate",
245
+ "DataType": "DateTime"
246
+ },
247
+ {
248
+ "Column": "UpdatingIDUser",
249
+ "DataType": "Numeric"
250
+ },
251
+ {
252
+ "Column": "Deleted",
253
+ "DataType": "Boolean"
254
+ },
255
+ {
256
+ "Column": "DeleteDate",
257
+ "DataType": "DateTime"
258
+ },
259
+ {
260
+ "Column": "DeletingIDUser",
261
+ "DataType": "Numeric"
262
+ },
263
+ {
264
+ "Column": "Text",
265
+ "DataType": "Text"
266
+ },
267
+ {
268
+ "Column": "Rating",
269
+ "DataType": "Numeric"
270
+ },
271
+ {
272
+ "Column": "IDBook",
273
+ "DataType": "Numeric",
274
+ "Join": "IDBook"
275
+ }
276
+ ],
277
+ "Description": ""
278
+ }
279
+ }
280
+ }
@@ -0,0 +1 @@
1
+ This is where the meadow high-level JSON schema of the data model will generate.
@@ -0,0 +1,116 @@
1
+ -- Data Model -- Generated 2022-03-29T11:36:36.684Z
2
+
3
+ -- This script creates the following tables:
4
+ -- Table ----------------------------------------- Column Count ----------------
5
+ -- Book 16
6
+ -- BookAuthorJoin 4
7
+ -- Author 10
8
+ -- BookPrice 15
9
+ -- Review 12
10
+
11
+
12
+
13
+ -- [ Book ]
14
+ CREATE TABLE IF NOT EXISTS
15
+ Book
16
+ (
17
+ IDBook INT UNSIGNED NOT NULL AUTO_INCREMENT,
18
+ GUIDBook CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
19
+ CreateDate DATETIME,
20
+ CreatingIDUser INT NOT NULL DEFAULT '0',
21
+ UpdateDate DATETIME,
22
+ UpdatingIDUser INT NOT NULL DEFAULT '0',
23
+ Deleted TINYINT NOT NULL DEFAULT '0',
24
+ DeleteDate DATETIME,
25
+ DeletingIDUser INT NOT NULL DEFAULT '0',
26
+ Title CHAR(200) NOT NULL DEFAULT '',
27
+ Type CHAR(32) NOT NULL DEFAULT '',
28
+ Genre CHAR(128) NOT NULL DEFAULT '',
29
+ ISBN CHAR(64) NOT NULL DEFAULT '',
30
+ Language CHAR(12) NOT NULL DEFAULT '',
31
+ ImageURL CHAR(254) NOT NULL DEFAULT '',
32
+ PublicationYear INT NOT NULL DEFAULT '0',
33
+
34
+ PRIMARY KEY (IDBook)
35
+ ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
36
+
37
+
38
+
39
+ -- [ BookAuthorJoin ]
40
+ CREATE TABLE IF NOT EXISTS
41
+ BookAuthorJoin
42
+ (
43
+ IDBookAuthorJoin INT UNSIGNED NOT NULL AUTO_INCREMENT,
44
+ GUIDBookAuthorJoin CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
45
+ IDBook INT NOT NULL DEFAULT '0',
46
+ IDAuthor INT NOT NULL DEFAULT '0',
47
+
48
+ PRIMARY KEY (IDBookAuthorJoin)
49
+ ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
50
+
51
+
52
+
53
+ -- [ Author ]
54
+ CREATE TABLE IF NOT EXISTS
55
+ Author
56
+ (
57
+ IDAuthor INT UNSIGNED NOT NULL AUTO_INCREMENT,
58
+ GUIDAuthor CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
59
+ CreateDate DATETIME,
60
+ CreatingIDUser INT NOT NULL DEFAULT '0',
61
+ UpdateDate DATETIME,
62
+ UpdatingIDUser INT NOT NULL DEFAULT '0',
63
+ Deleted TINYINT NOT NULL DEFAULT '0',
64
+ DeleteDate DATETIME,
65
+ DeletingIDUser INT NOT NULL DEFAULT '0',
66
+ Name CHAR(200) NOT NULL DEFAULT '',
67
+
68
+ PRIMARY KEY (IDAuthor)
69
+ ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
70
+
71
+
72
+
73
+ -- [ BookPrice ]
74
+ CREATE TABLE IF NOT EXISTS
75
+ BookPrice
76
+ (
77
+ IDBookPrice INT UNSIGNED NOT NULL AUTO_INCREMENT,
78
+ GUIDBookPrice CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
79
+ CreateDate DATETIME,
80
+ CreatingIDUser INT NOT NULL DEFAULT '0',
81
+ UpdateDate DATETIME,
82
+ UpdatingIDUser INT NOT NULL DEFAULT '0',
83
+ Deleted TINYINT NOT NULL DEFAULT '0',
84
+ DeleteDate DATETIME,
85
+ DeletingIDUser INT NOT NULL DEFAULT '0',
86
+ Price DECIMAL(8,2),
87
+ StartDate DATETIME,
88
+ EndDate DATETIME,
89
+ Discountable TINYINT NOT NULL DEFAULT '0',
90
+ CouponCode CHAR(16) NOT NULL DEFAULT '',
91
+ IDBook INT NOT NULL DEFAULT '0',
92
+
93
+ PRIMARY KEY (IDBookPrice)
94
+ ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
95
+
96
+
97
+
98
+ -- [ Review ]
99
+ CREATE TABLE IF NOT EXISTS
100
+ Review
101
+ (
102
+ IDReviews INT UNSIGNED NOT NULL AUTO_INCREMENT,
103
+ GUIDReviews CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
104
+ CreateDate DATETIME,
105
+ CreatingIDUser INT NOT NULL DEFAULT '0',
106
+ UpdateDate DATETIME,
107
+ UpdatingIDUser INT NOT NULL DEFAULT '0',
108
+ Deleted TINYINT NOT NULL DEFAULT '0',
109
+ DeleteDate DATETIME,
110
+ DeletingIDUser INT NOT NULL DEFAULT '0',
111
+ Text TEXT,
112
+ Rating INT NOT NULL DEFAULT '0',
113
+ IDBook INT NOT NULL DEFAULT '0',
114
+
115
+ PRIMARY KEY (IDReviews)
116
+ ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -0,0 +1 @@
1
+ This is where the MYSQL Create statement for the data model will generate.
@@ -17,6 +17,7 @@ RUN echo "...configuring mariadb (mysql) server..."
17
17
  RUN sudo sed -i "s|bind-address|#bind-address|g" /etc/mysql/mariadb.conf.d/50-server.cnf
18
18
  ADD ./.config/luxury-extras/MySQL/MySQL-Security.sql /home/coder/MySQL-Configure-Security.sql
19
19
  ADD ./.config/luxury-extras/MySQL/MySQL-Laden-Entry.sh /usr/bin/MySQL-Laden-Entry.sh
20
+ RUN sudo chmod +x /usr/bin/MySQL-Laden-Entry.sh
20
21
  RUN ( sudo mysqld_safe --skip-grant-tables --skip-networking & ) && sleep 5 && mysql -u root < /home/coder/MySQL-Configure-Security.sql
21
22
 
22
23
  # Enable MariaDB even without systemd
@@ -25,6 +26,21 @@ RUN ( sudo mysqld_safe --skip-grant-tables --skip-networking & ) && sleep 5 &&
25
26
  # Import the initial database
26
27
  RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" -e "CREATE DATABASE FableTest;"
27
28
 
29
+ RUN echo "...installing vscode extensions..."
30
+ RUN code-server --install-extension rangav.vscode-thunder-client \
31
+ code-server --install-extension hbenl.vscode-mocha-test-adapter \
32
+ code-server --install-extension hbenl.vscode-test-explorer \
33
+ code-server --install-extension hbenl.test-adapter-converter \
34
+ code-server --install-extension cweijan.vscode-mysql-client2 \
35
+ code-server --install-extension daylerees.rainglow \
36
+ code-server --install-extension oderwat.indent-rainbow \
37
+ code-server --install-extension evan-buss.font-switcher \
38
+ code-server --install-extension vscode-icons-team.vscode-icons \
39
+ code-server --install-extension bengreenier.vscode-node-readme \
40
+ code-server --install-extension bierner.color-info \
41
+ code-server --install-extension dbaeumer.vscode-eslint \
42
+ code-server --install-extension PKief.material-icon-theme
43
+
28
44
  SHELL ["/bin/bash", "-c"]
29
45
  USER coder
30
46
 
@@ -34,7 +50,6 @@ USER coder
34
50
  RUN echo "...mapping library specific volumes..."
35
51
  # Volume mappings for code
36
52
  VOLUME /home/coder/meadow
37
- # VOLUME /home/coder/meadow/node_modules
38
53
 
39
54
  RUN echo "...installing node version manager..."
40
55
  # Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.
package/README.md CHANGED
@@ -3,11 +3,6 @@ Meadow
3
3
 
4
4
  A Javascript Data Broker.
5
5
 
6
- [![Coverage Status](https://coveralls.io/repos/stevenvelozo/meadow/badge.svg?branch=master)](https://coveralls.io/r/stevenvelozo/meadow?branch=master)
7
- [![Build Status](https://travis-ci.org/stevenvelozo/meadow.svg?branch=master)](https://travis-ci.org/stevenvelozo/meadow)
8
- [![Dependency Status](https://david-dm.org/stevenvelozo/meadow.svg)](https://david-dm.org/stevenvelozo/meadow)
9
- [![devDependency Status](https://david-dm.org/stevenvelozo/meadow/dev-status.svg)](https://david-dm.org/stevenvelozo/meadow#info=devDependencies)
10
-
11
6
  Who doesn't love writing the same code over and over again? Good question. Anybody who doesn't probably wants something to do simple data access stuff. And some of the complicated interactions as well. Meadow aims to provide a simple “magic where you want it, programmability where you don't” pattern.
12
7
 
13
8
  ## Install
@@ -123,3 +118,22 @@ meadow.doRead(queryDescription,
123
118
  );
124
119
  ```
125
120
 
121
+
122
+ ### Docker Development Environment
123
+
124
+
125
+ 1. Run this command to build this image:
126
+ ```
127
+ docker build ./ -t retold/meadow:local
128
+ ```
129
+
130
+ 2. Run this command to build the local container:
131
+ ```
132
+ docker run -it --name meadow-dev -p 127.0.0.1:12342:8080 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/meadow" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" retold/meadow:local
133
+ ```
134
+
135
+ 3. Go to http://localhost:12342/ in a web browser
136
+
137
+ 4. The password is "retold"
138
+
139
+ 5. Right now you (may) need to delete the `node_modules` folders and regenerate it for Linux.
package/debug/Harness.js CHANGED
@@ -1,94 +1,79 @@
1
1
 
2
- var libMeadow = require('../source/Meadow.js');
2
+ const _AnimalJsonSchema = (
3
+ {
4
+ title: "Animal",
5
+ description: "A creature that lives in a meadow.",
6
+ type: "object",
7
+ properties: {
8
+ IDAnimal: {
9
+ description: "The unique identifier for an animal",
10
+ type: "integer"
11
+ },
12
+ Name: {
13
+ description: "The animal's name",
14
+ type: "string"
15
+ },
16
+ Type: {
17
+ description: "The type of the animal",
18
+ type: "string"
19
+ }
20
+ },
21
+ required: ["IDAnimal", "Name", "CreatingIDUser"]
22
+ });
23
+ const _AnimalSchema = (
24
+ [
25
+ { Column: "IDAnimal", Type:"AutoIdentity" },
26
+ { Column: "GUIDAnimal", Type:"AutoGUID" },
27
+ { Column: "CreateDate", Type:"CreateDate" },
28
+ { Column: "CreatingIDUser", Type:"CreateIDUser" },
29
+ { Column: "UpdateDate", Type:"UpdateDate" },
30
+ { Column: "UpdatingIDUser", Type:"UpdateIDUser" },
31
+ { Column: "Deleted", Type:"Deleted" },
32
+ { Column: "DeletingIDUser", Type:"DeleteIDUser" },
33
+ { Column: "DeleteDate", Type:"DeleteDate" },
34
+ { "Column": "Name", "Type":"String" },
35
+ { "Column": "Type", "Type":"String" }
36
+ ]);
37
+ const _AnimalDefault = (
38
+ {
39
+ IDAnimal: null,
40
+ GUIDAnimal: '',
41
+
42
+ CreateDate: false,
43
+ CreatingIDUser: 0,
44
+ UpdateDate: false,
45
+ UpdatingIDUser: 0,
46
+ Deleted: 0,
47
+ DeleteDate: false,
48
+ DeletingIDUser: 0,
49
+
50
+ Name: 'Unknown',
51
+ Type: 'Unclassified'
52
+ });
53
+ var libALASQL = require('alasql');
3
54
 
4
- var tmpFableSettings = (
5
- {
55
+ const libFable = new (require('fable'))({
6
56
  LogStreams:
7
57
  [
8
- {
9
- level: 'trace',
10
- streamtype:'process.stdout',
11
- },
12
- {
13
- level: 'trace',
14
- path: __dirname+'/../tests.log'
15
- }
58
+ {
59
+ streamtype:'default',
60
+ },
61
+ {
62
+ streamtype: 'simpleflatfile',
63
+ path: __dirname+'/Harness.log'
64
+ }
16
65
  ]
17
66
  });
18
67
 
19
- var libFable = require('fable').new(tmpFableSettings);
20
- var libMeadow = require('../source/Meadow.js').new(libFable);
21
-
22
- var _BookSchemaLocation = '../test/schemas/BookStore-MeadowSchema-Book.json';
23
-
24
- var newMeadow = function()
25
- {
26
- return libMeadow.loadFromPackage(_BookSchemaLocation)
27
- .setProvider('MeadowEndpoints');
28
- };
29
-
30
- var testMeadow = newMeadow();
31
-
32
- testMeadow.fable.settings.QueryThresholdWarnTime = 1;
33
-
34
- /* READ
35
- var tmpQuery = testMeadow.setProvider('MeadowEndpoints').query.addFilter('IDBook', 1);
36
- tmpQuery.addFilter('PublicationYear',2008);
37
- testMeadow.doRead(tmpQuery,
38
- function(pError, pQuery, pRecord)
39
- {
40
- console.log(JSON.stringify(pRecord));
41
- }
42
- )
43
- */
44
-
45
- /* CREATE
46
- var testMeadow = newMeadow();
47
- var tmpQuery = testMeadow.query.clone().setLogLevel(5)
48
- .addRecord({Title:'Blastoise', Type:'Pokemon'});
49
-
50
- testMeadow.doCreate(tmpQuery,
51
- function(pError, pQuery, pQueryRead, pRecord)
52
- {
53
- libFable.log.info('Record returned from Create:',pRecord);
54
- }
55
- )
56
- */
57
-
58
- /* UPDATE
59
- var testMeadow = newMeadow();
60
- var tmpQuery = testMeadow.query.setLogLevel(5)
61
- .addRecord({IDBook:10001, Type:'Novella'});
62
-
63
- testMeadow.doUpdate(tmpQuery,
64
- function(pError, pQuery, pQueryRead, pRecord)
65
- {
66
- libFable.log.info('Record returned:',pRecord);
67
- }
68
- )
69
- */
70
-
71
- /* DELETE
72
- var testMeadow = newMeadow();
73
- var tmpQuery = testMeadow.query.clone().setLogLevel(5)
74
- .addFilter('IDBook',10005);
68
+ libFable.ALASQL = libALASQL;
75
69
 
76
- testMeadow.doDelete(tmpQuery,
77
- function(pError, pQuery, pResponse)
78
- {
79
- libFable.log.info('Affected record count returned:',pResponse);
80
- }
81
- )
82
- */
70
+ const tmpDAL = require('../source/Meadow.js')
71
+ .new(libFable, 'Animal')
72
+ .setProvider('ALASQL')
73
+ .setSchema(_AnimalSchema)
74
+ .setJsonSchema(_AnimalJsonSchema)
75
+ .setDefaultIdentifier('IDAnimal')
76
+ .setDefault(_AnimalDefault);
83
77
 
84
- /* COUNT
85
- */
78
+ tmpDAL.fable.settings.QueryThresholdWarnTime = 1;
86
79
 
87
- var testMeadow = newMeadow();
88
- var tmpQuery = testMeadow.query.clone().addFilter('Type','Pokemon');
89
- testMeadow.doCount(tmpQuery,
90
- function(pError, pQuery, pResponse)
91
- {
92
- libFable.log.info('Record count returned:', pResponse);
93
- }
94
- )