meadow 2.0.26 → 2.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meadow",
3
- "version": "2.0.26",
3
+ "version": "2.0.28",
4
4
  "description": "A data access library.",
5
5
  "main": "source/Meadow.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
8
  "coverage": "npx quack coverage",
9
9
  "test": "npx quack test",
10
10
  "tests": "npx quack test -g",
11
- "build": "npx quack build --full-paths",
11
+ "build": "npx quack build",
12
12
  "docker-dev-build": "docker build ./ -f Dockerfile_LUXURYCode -t retold/meadow:local",
13
13
  "docker-dev-run": "docker run -it -d --name meadow-dev -p 12342:8080 -p 12106:3306 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/meadow\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/meadow:local",
14
14
  "docker-dev-shell": "docker exec -it meadow-dev /bin/bash",
@@ -40,6 +40,8 @@
40
40
  "docker-dgraph-status": "./scripts/dgraph-test-db.sh status",
41
41
  "test-dgraph": "./scripts/dgraph-test-db.sh start && npx quack test -g Meadow-Provider-DGraph",
42
42
  "test-alasql": "npx quack test -g Meadow-Provider-ALASQL",
43
+ "test-sqlite-browser": "npx quack test -g Meadow-Provider-SQLiteBrowser",
44
+ "test-sqlite-browser-headless": "npx mocha -u tdd --exit --timeout 60000 test/Meadow-Provider-SQLiteBrowser-Headless_tests.js",
43
45
  "test-all-providers": "./scripts/mysql-test-db.sh start && ./scripts/mssql-test-db.sh start && ./scripts/postgresql-test-db.sh start && ./scripts/mongodb-test-db.sh start && ./scripts/solr-test-db.sh start && ./scripts/dgraph-test-db.sh start && npx mocha -u tdd --exit -R spec",
44
46
  "docker-cleanup": "./scripts/meadow-test-cleanup.sh",
45
47
  "test-cleanup": "./scripts/meadow-test-cleanup.sh"
@@ -77,27 +79,29 @@
77
79
  },
78
80
  "homepage": "https://github.com/stevenvelozo/meadow",
79
81
  "devDependencies": {
80
- "alasql": "^4.1.10",
82
+ "alasql": "^4.17.0",
81
83
  "better-sqlite3": "^12.6.2",
84
+ "dgraph-js-http": "^21.3.0",
82
85
  "fable": "^3.1.63",
83
86
  "gulp-util": "^3.0.8",
84
- "meadow-connection-mssql": "^1.0.15",
85
- "meadow-connection-mysql": "^1.0.13",
86
87
  "meadow-connection-dgraph": "^1.0.2",
87
88
  "meadow-connection-mongodb": "^1.0.2",
89
+ "meadow-connection-mssql": "^1.0.15",
90
+ "meadow-connection-mysql": "^1.0.13",
88
91
  "meadow-connection-postgresql": "^1.0.1",
89
92
  "meadow-connection-rocksdb": "^0.0.2",
90
93
  "meadow-connection-solr": "^1.0.2",
91
94
  "meadow-connection-sqlite": "^1.0.17",
92
- "dgraph-js-http": "^21.3.0",
95
+ "meadow-connection-sqlite-browser": "^1.0.0",
93
96
  "mongodb": "^6.12.0",
94
- "mysql2": "^3.6.3",
95
- "quackage": "^1.0.59",
97
+ "mysql2": "^3.18.2",
98
+ "puppeteer": "^24.38.0",
99
+ "quackage": "^1.0.61",
96
100
  "solr-client": "^0.9.0"
97
101
  },
98
102
  "dependencies": {
99
- "async": "3.2.5",
100
- "foxhound": "^2.0.20",
103
+ "async": "3.2.6",
104
+ "foxhound": "^2.0.23",
101
105
  "is-my-json-valid": "2.20.6",
102
106
  "simple-get": "^4.0.1"
103
107
  }
@@ -22,7 +22,7 @@ var MeadowProvider = function()
22
22
  var _Headers = {};
23
23
  var _Cookies = [];
24
24
 
25
- var _EndpointSettings = (_Fable.settings.hasOwnProperty('MeadowEndpoints')) ? JSON.parse(JSON.stringify(_Fable.settings.MedaowEndpoints)) : (
25
+ var _EndpointSettings = (_Fable.settings.hasOwnProperty('MeadowEndpoints')) ? JSON.parse(JSON.stringify(_Fable.settings.MeadowEndpoints)) : (
26
26
  {
27
27
  ServerProtocol: 'http',
28
28
  ServerAddress: '127.0.0.1',
@@ -116,13 +116,25 @@ var MeadowProvider = function()
116
116
  pResponse.on('end', ()=>
117
117
  {
118
118
  if (tmpData)
119
- tmpResult.value = JSON.parse(tmpData);
119
+ {
120
+ try
121
+ {
122
+ tmpResult.value = JSON.parse(tmpData);
123
+ }
124
+ catch (pParseError)
125
+ {
126
+ tmpResult.error = new Error(`Failed to parse Create response as JSON: ${pParseError.message}`);
127
+ return fCallback();
128
+ }
129
+ }
120
130
 
121
131
  // TODO Because this was proxied, read happens at this layer too. Inefficient -- fixable
122
- let tmpIdentityColumn = `ID${pQuery.parameters.scope}`;
123
- if (tmpResult.value.hasOwnProperty(tmpIdentityColumn))
124
- tmpResult.value = tmpResult.value[tmpIdentityColumn];
125
-
132
+ const tmpIdentityColumn = `ID${pQuery.parameters.scope}`;
133
+ if (tmpResult.value && tmpResult.value.hasOwnProperty(tmpIdentityColumn))
134
+ {
135
+ tmpResult.value = tmpResult.value[tmpIdentityColumn];
136
+ }
137
+
126
138
  if (pQuery.logLevel > 0 ||
127
139
  _GlobalLogLevel > 0)
128
140
  {
@@ -169,7 +181,17 @@ var MeadowProvider = function()
169
181
  pResponse.on('end', ()=>
170
182
  {
171
183
  if (tmpData)
172
- tmpResult.value = JSON.parse(tmpData);
184
+ {
185
+ try
186
+ {
187
+ tmpResult.value = JSON.parse(tmpData);
188
+ }
189
+ catch (pParseError)
190
+ {
191
+ tmpResult.error = new Error(`Failed to parse Read response as JSON: ${pParseError.message}`);
192
+ return fCallback();
193
+ }
194
+ }
173
195
 
174
196
  if (pQuery.query.body.startsWith(`${pQuery.parameters.scope}/`))
175
197
  {
@@ -232,13 +254,23 @@ var MeadowProvider = function()
232
254
  pResponse.on('end', ()=>
233
255
  {
234
256
  if (tmpData)
235
- tmpResult.value = JSON.parse(tmpData);
257
+ {
258
+ try
259
+ {
260
+ tmpResult.value = JSON.parse(tmpData);
261
+ }
262
+ catch (pParseError)
263
+ {
264
+ tmpResult.error = new Error(`Failed to parse Update response as JSON: ${pParseError.message}`);
265
+ return fCallback();
266
+ }
267
+ }
268
+
269
+ // Keep result.value as the full response object so the
270
+ // Meadow Update waterfall's typeof check passes (it expects
271
+ // an object). The subsequent Read step uses the existing
272
+ // filters to re-read the updated record.
236
273
 
237
- // TODO Because this was proxied, read happens at this layer too. Inefficient -- fixable
238
- let tmpIdentityColumn = `ID${pQuery.parameters.scope}`;
239
- if (tmpResult.value.hasOwnProperty(tmpIdentityColumn))
240
- tmpResult.value = tmpResult.value[tmpIdentityColumn];
241
-
242
274
  if (pQuery.logLevel > 0 ||
243
275
  _GlobalLogLevel > 0)
244
276
  {
@@ -284,11 +316,22 @@ var MeadowProvider = function()
284
316
  pResponse.on('end', ()=>
285
317
  {
286
318
  if (tmpData)
287
- tmpResult.value = JSON.parse(tmpData);
288
-
289
- if (tmpResult.value.hasOwnProperty('Count'))
319
+ {
320
+ try
321
+ {
322
+ tmpResult.value = JSON.parse(tmpData);
323
+ }
324
+ catch (pParseError)
325
+ {
326
+ tmpResult.error = new Error(`Failed to parse Delete response as JSON: ${pParseError.message}`);
327
+ return fCallback();
328
+ }
329
+ }
330
+
331
+ if (tmpResult.value && tmpResult.value.hasOwnProperty('Count'))
332
+ {
290
333
  tmpResult.value = tmpResult.value.Count;
291
-
334
+ }
292
335
 
293
336
  if (pQuery.logLevel > 0 ||
294
337
  _GlobalLogLevel > 0)
@@ -334,19 +377,29 @@ var MeadowProvider = function()
334
377
  pResponse.on('end', ()=>
335
378
  {
336
379
  if (tmpData)
337
- tmpResult.value = JSON.parse(tmpData);
338
-
380
+ {
339
381
  try
340
382
  {
341
- tmpResult.value = tmpResult.value.Count;
383
+ tmpResult.value = JSON.parse(tmpData);
342
384
  }
343
- catch(pErrorGettingRowcount)
385
+ catch (pParseError)
344
386
  {
345
- // This is an error state...
346
- tmpResult.value = -1;
347
- _Fable.log.warn('Error getting rowcount during count query',{Body:pQuery.query.body, Parameters:pQuery.query.parameters});
387
+ tmpResult.error = new Error(`Failed to parse Count response as JSON: ${pParseError.message}`);
388
+ return fCallback();
348
389
  }
349
-
390
+ }
391
+
392
+ try
393
+ {
394
+ tmpResult.value = tmpResult.value.Count;
395
+ }
396
+ catch(pErrorGettingRowcount)
397
+ {
398
+ // This is an error state...
399
+ tmpResult.value = -1;
400
+ _Fable.log.warn('Error getting rowcount during count query',{Body:pQuery.query.body, Parameters:pQuery.query.parameters});
401
+ }
402
+
350
403
  if (pQuery.logLevel > 0 ||
351
404
  _GlobalLogLevel > 0)
352
405
  {