meadow 2.0.18 → 2.0.20
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/CONTRIBUTING.md +50 -0
- package/README.md +10 -6
- package/docs/index.html +39 -0
- package/package.json +5 -5
- package/source/providers/Meadow-Provider-SQLite.js +35 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Contributing to Retold
|
|
2
|
+
|
|
3
|
+
We welcome contributions to Retold and its modules. This guide covers the expectations and process for contributing.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
The Retold community values **empathy**, **equity**, **kindness**, and **thoughtfulness**. We expect all participants to treat each other with respect, assume good intent, and engage constructively. These values apply to all interactions: pull requests, issues, discussions, and code review.
|
|
8
|
+
|
|
9
|
+
## How to Contribute
|
|
10
|
+
|
|
11
|
+
### Pull Requests
|
|
12
|
+
|
|
13
|
+
Pull requests are the preferred method for contributing changes. To submit one:
|
|
14
|
+
|
|
15
|
+
1. Fork the module repository you want to change
|
|
16
|
+
2. Create a branch for your work
|
|
17
|
+
3. Make your changes, following the code style of the module you are editing
|
|
18
|
+
4. Ensure your changes have test coverage (see below)
|
|
19
|
+
5. Open a pull request against the module's main branch
|
|
20
|
+
|
|
21
|
+
**Submitting a pull request does not guarantee it will be accepted.** Maintainers review contributions for fit, quality, and alignment with the project's direction. A PR may be declined, or you may be asked to revise it. This is normal and not a reflection on the quality of your effort.
|
|
22
|
+
|
|
23
|
+
### Reporting Issues
|
|
24
|
+
|
|
25
|
+
If you find a bug or have a feature suggestion, open an issue on the relevant module's repository. Include enough detail to reproduce the problem or understand the proposal.
|
|
26
|
+
|
|
27
|
+
## Test Coverage
|
|
28
|
+
|
|
29
|
+
Every commit must include test coverage for the changes it introduces. Retold modules use Mocha in TDD style. Before submitting:
|
|
30
|
+
|
|
31
|
+
- **Write tests** for any new functionality or bug fixes
|
|
32
|
+
- **Run the existing test suite** with `npm test` and confirm all tests pass
|
|
33
|
+
- **Check coverage** with `npm run coverage` if the module supports it
|
|
34
|
+
|
|
35
|
+
Pull requests that break existing tests or lack coverage for new code will not be merged.
|
|
36
|
+
|
|
37
|
+
## Code Style
|
|
38
|
+
|
|
39
|
+
Follow the conventions of the module you are working in. The general Retold style is:
|
|
40
|
+
|
|
41
|
+
- **Tabs** for indentation, never spaces
|
|
42
|
+
- **Plain JavaScript** only (no TypeScript)
|
|
43
|
+
- **Allman-style braces** (opening brace on its own line)
|
|
44
|
+
- **Variable naming:** `pVariable` for parameters, `tmpVariable` for temporaries, `libSomething` for imports
|
|
45
|
+
|
|
46
|
+
When in doubt, match what the surrounding code does.
|
|
47
|
+
|
|
48
|
+
## Repository Structure
|
|
49
|
+
|
|
50
|
+
Each module is its own git repository. The [retold](https://github.com/stevenvelozo/retold) repository tracks module organization but does not contain module source code. Direct your pull request to the specific module repository where your change belongs.
|
package/README.md
CHANGED
|
@@ -207,9 +207,13 @@ npx docsify-cli serve docs
|
|
|
207
207
|
|
|
208
208
|
- [foxhound](https://github.com/stevenvelozo/foxhound) - Query DSL for SQL generation
|
|
209
209
|
- [stricture](https://github.com/stevenvelozo/stricture) - Schema definition language
|
|
210
|
-
- [meadow-endpoints](https://github.com/stevenvelozo/meadow-endpoints) -
|
|
211
|
-
- [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
210
|
+
- [meadow-endpoints](https://github.com/stevenvelozo/meadow-endpoints) - Auto-generated REST endpoints
|
|
211
|
+
- [fable](https://github.com/stevenvelozo/fable) - Application services framework
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT
|
|
216
|
+
|
|
217
|
+
## Contributing
|
|
218
|
+
|
|
219
|
+
Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the [Retold Contributing Guide](https://github.com/stevenvelozo/retold/blob/main/docs/contributing.md).
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
7
|
+
<meta name="description" content="Documentation powered by pict-docuserve">
|
|
8
|
+
|
|
9
|
+
<title>Documentation</title>
|
|
10
|
+
|
|
11
|
+
<!-- Application Stylesheet -->
|
|
12
|
+
<link href="https://cdn.jsdelivr.net/npm/pict-docuserve@0/dist/css/docuserve.css" rel="stylesheet">
|
|
13
|
+
<!-- KaTeX stylesheet for LaTeX equation rendering -->
|
|
14
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.css">
|
|
15
|
+
<!-- PICT Dynamic View CSS Container -->
|
|
16
|
+
<style id="PICT-CSS"></style>
|
|
17
|
+
|
|
18
|
+
<!-- Load the PICT library from jsDelivr CDN -->
|
|
19
|
+
<script src="https://cdn.jsdelivr.net/npm/pict@1/dist/pict.min.js" type="text/javascript"></script>
|
|
20
|
+
<!-- Bootstrap the Application -->
|
|
21
|
+
<script type="text/javascript">
|
|
22
|
+
//<![CDATA[
|
|
23
|
+
Pict.safeOnDocumentReady(() => { Pict.safeLoadPictApplication(PictDocuserve, 2)});
|
|
24
|
+
//]]>
|
|
25
|
+
</script>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<!-- The root container for the Pict application -->
|
|
29
|
+
<div id="Docuserve-Application-Container"></div>
|
|
30
|
+
|
|
31
|
+
<!-- Mermaid diagram rendering -->
|
|
32
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"></script>
|
|
33
|
+
<script>mermaid.initialize({ startOnLoad: false, theme: 'default' });</script>
|
|
34
|
+
<!-- KaTeX for LaTeX equation rendering -->
|
|
35
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.js"></script>
|
|
36
|
+
<!-- Load the Docuserve PICT Application Bundle from jsDelivr CDN -->
|
|
37
|
+
<script src="https://cdn.jsdelivr.net/npm/pict-docuserve@0/dist/pict-docuserve.min.js" type="text/javascript"></script>
|
|
38
|
+
</body>
|
|
39
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meadow",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20",
|
|
4
4
|
"description": "A data access library.",
|
|
5
5
|
"main": "source/Meadow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
"better-sqlite3": "^12.6.2",
|
|
62
62
|
"browserify": "^17.0.0",
|
|
63
63
|
"chai": "4.3.10",
|
|
64
|
-
"fable": "^3.1.
|
|
64
|
+
"fable": "^3.1.53",
|
|
65
65
|
"gulp": "^4.0.2",
|
|
66
66
|
"gulp-babel": "^8.0.0",
|
|
67
67
|
"gulp-sourcemaps": "^3.0.0",
|
|
68
68
|
"gulp-terser": "^2.1.0",
|
|
69
69
|
"gulp-util": "^3.0.8",
|
|
70
|
-
"meadow-connection-mssql": "^1.0.
|
|
71
|
-
"meadow-connection-mysql": "^1.0.
|
|
70
|
+
"meadow-connection-mssql": "^1.0.10",
|
|
71
|
+
"meadow-connection-mysql": "^1.0.7",
|
|
72
72
|
"meadow-connection-sqlite": "file:../meadow-connection-sqlite",
|
|
73
73
|
"mocha": "10.2.0",
|
|
74
74
|
"mysql2": "^3.6.3",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"async": "3.2.5",
|
|
81
|
-
"foxhound": "^2.0.
|
|
81
|
+
"foxhound": "^2.0.16",
|
|
82
82
|
"is-my-json-valid": "2.20.6",
|
|
83
83
|
"npm-check-updates": "^16.14.6",
|
|
84
84
|
"simple-get": "^4.0.1"
|
|
@@ -66,6 +66,35 @@ var MeadowProvider = function ()
|
|
|
66
66
|
* which better-sqlite3 supports natively.
|
|
67
67
|
*/
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Coerce query parameter values so they are safe for better-sqlite3.
|
|
71
|
+
*
|
|
72
|
+
* better-sqlite3 only accepts numbers, strings, bigints, buffers and null.
|
|
73
|
+
* Booleans (e.g. Deleted: false) must be converted to integers.
|
|
74
|
+
* Undefined values must be converted to null.
|
|
75
|
+
*/
|
|
76
|
+
var coerceParameters = function (pParams)
|
|
77
|
+
{
|
|
78
|
+
if (typeof (pParams) !== 'object' || pParams === null)
|
|
79
|
+
{
|
|
80
|
+
return pParams;
|
|
81
|
+
}
|
|
82
|
+
var tmpKeys = Object.keys(pParams);
|
|
83
|
+
for (var i = 0; i < tmpKeys.length; i++)
|
|
84
|
+
{
|
|
85
|
+
var tmpValue = pParams[tmpKeys[i]];
|
|
86
|
+
if (typeof (tmpValue) === 'boolean')
|
|
87
|
+
{
|
|
88
|
+
pParams[tmpKeys[i]] = tmpValue ? 1 : 0;
|
|
89
|
+
}
|
|
90
|
+
else if (typeof (tmpValue) === 'undefined')
|
|
91
|
+
{
|
|
92
|
+
pParams[tmpKeys[i]] = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return pParams;
|
|
96
|
+
};
|
|
97
|
+
|
|
69
98
|
// The Meadow marshaller also passes in the Schema as the third parameter, but this is a blunt function ATM.
|
|
70
99
|
var marshalRecordFromSourceToObject = function (pObject, pRecord)
|
|
71
100
|
{
|
|
@@ -83,6 +112,7 @@ var MeadowProvider = function ()
|
|
|
83
112
|
pQuery.setDialect('SQLite').buildCreateQuery();
|
|
84
113
|
|
|
85
114
|
var tmpQueryBody = fixDateFunctions(pQuery.query.body);
|
|
115
|
+
coerceParameters(pQuery.query.parameters);
|
|
86
116
|
|
|
87
117
|
if (pQuery.logLevel > 0)
|
|
88
118
|
{
|
|
@@ -132,6 +162,7 @@ var MeadowProvider = function ()
|
|
|
132
162
|
pQuery.setDialect('SQLite').buildReadQuery();
|
|
133
163
|
|
|
134
164
|
var tmpQueryBody = fixDateFunctions(pQuery.query.body);
|
|
165
|
+
coerceParameters(pQuery.query.parameters);
|
|
135
166
|
|
|
136
167
|
if (pQuery.logLevel > 0)
|
|
137
168
|
{
|
|
@@ -172,6 +203,7 @@ var MeadowProvider = function ()
|
|
|
172
203
|
pQuery.setDialect('SQLite').buildUpdateQuery();
|
|
173
204
|
|
|
174
205
|
var tmpQueryBody = fixDateFunctions(pQuery.query.body);
|
|
206
|
+
coerceParameters(pQuery.query.parameters);
|
|
175
207
|
|
|
176
208
|
if (pQuery.logLevel > 0)
|
|
177
209
|
{
|
|
@@ -212,6 +244,7 @@ var MeadowProvider = function ()
|
|
|
212
244
|
pQuery.setDialect('SQLite').buildDeleteQuery();
|
|
213
245
|
|
|
214
246
|
var tmpQueryBody = fixDateFunctions(pQuery.query.body);
|
|
247
|
+
coerceParameters(pQuery.query.parameters);
|
|
215
248
|
|
|
216
249
|
if (pQuery.logLevel > 0)
|
|
217
250
|
{
|
|
@@ -260,6 +293,7 @@ var MeadowProvider = function ()
|
|
|
260
293
|
pQuery.setDialect('SQLite').buildUndeleteQuery();
|
|
261
294
|
|
|
262
295
|
var tmpQueryBody = fixDateFunctions(pQuery.query.body);
|
|
296
|
+
coerceParameters(pQuery.query.parameters);
|
|
263
297
|
|
|
264
298
|
if (pQuery.logLevel > 0)
|
|
265
299
|
{
|
|
@@ -308,6 +342,7 @@ var MeadowProvider = function ()
|
|
|
308
342
|
pQuery.setDialect('SQLite').buildCountQuery();
|
|
309
343
|
|
|
310
344
|
var tmpQueryBody = fixDateFunctions(pQuery.query.body);
|
|
345
|
+
coerceParameters(pQuery.query.parameters);
|
|
311
346
|
|
|
312
347
|
if (pQuery.logLevel > 0)
|
|
313
348
|
{
|