meadow-connection-sqlite 1.0.17 → 1.0.19
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/docs/README.md +5 -5
- package/docs/_cover.md +1 -3
- package/docs/_version.json +7 -0
- package/docs/api/connect.md +2 -2
- package/docs/api/connectAsync.md +2 -2
- package/docs/api/createTable.md +2 -2
- package/docs/api/db.md +4 -4
- package/docs/api/generateDropTableStatement.md +2 -2
- package/docs/api/preparedStatement.md +2 -2
- package/docs/api/reference.md +2 -2
- package/docs/architecture.md +6 -6
- package/docs/css/docuserve.css +277 -23
- package/docs/examples-pipeline.md +1 -1
- package/docs/index.html +2 -2
- package/docs/quickstart.md +5 -5
- package/docs/retold-catalog.json +1 -1
- package/docs/retold-keyword-index.json +1 -1
- package/docs/schema.md +2 -2
- package/package.json +3 -2
- package/source/Meadow-Connection-SQLite-FormSchema.js +32 -0
- package/source/Meadow-Schema-SQLite.js +14 -0
package/docs/README.md
CHANGED
|
@@ -10,7 +10,7 @@ SQLite databases are single files that require no server process. This makes the
|
|
|
10
10
|
npm install meadow-connection-sqlite
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Requires Node.js. The `better-sqlite3` dependency compiles a native addon at install time
|
|
13
|
+
Requires Node.js. The `better-sqlite3` dependency compiles a native addon at install time -- a C compiler toolchain must be available on the host.
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
@@ -54,7 +54,7 @@ _Fable.MeadowSQLiteProvider.connectAsync(
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
// Connection is ready
|
|
57
|
+
// Connection is ready -- WAL journaling is enabled automatically
|
|
58
58
|
_Fable.log.info('SQLite connected!');
|
|
59
59
|
});
|
|
60
60
|
```
|
|
@@ -88,8 +88,8 @@ console.log(tmpBooks);
|
|
|
88
88
|
|
|
89
89
|
The provider reads `SQLiteFilePath` from two sources, in order of priority:
|
|
90
90
|
|
|
91
|
-
1. **Constructor options**
|
|
92
|
-
2. **Fable settings**
|
|
91
|
+
1. **Constructor options** -- passed as the second argument to `instantiateServiceProvider()`
|
|
92
|
+
2. **Fable settings** -- `fable.settings.SQLite.SQLiteFilePath`
|
|
93
93
|
|
|
94
94
|
| Setting | Type | Description |
|
|
95
95
|
|---------|------|-------------|
|
|
@@ -141,7 +141,7 @@ let _Fable = new libFable(
|
|
|
141
141
|
└─────────────────────────┘
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
The provider manages the connection lifecycle and exposes the raw `better-sqlite3` `Database` object. All queries go through better-sqlite3's synchronous API
|
|
144
|
+
The provider manages the connection lifecycle and exposes the raw `better-sqlite3` `Database` object. All queries go through better-sqlite3's synchronous API -- there are no promises or callbacks for individual statements.
|
|
145
145
|
|
|
146
146
|
## Learn More
|
|
147
147
|
|
package/docs/_cover.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# Meadow Connection SQLite
|
|
2
2
|
|
|
3
|
-
<small>v1.0.12</small>
|
|
4
|
-
|
|
5
3
|
> SQLite database provider for the Meadow data layer
|
|
6
4
|
|
|
7
5
|
Connect any Fable application to a local SQLite database through the service provider pattern. Built on better-sqlite3 for fast synchronous access with WAL journaling, automatic file creation, and in-memory database support.
|
|
8
6
|
|
|
9
|
-
- **Zero Config Server** -- No daemon, no Docker
|
|
7
|
+
- **Zero Config Server** -- No daemon, no Docker -- just a file path and you have a database
|
|
10
8
|
- **Synchronous API** -- All queries run synchronously through better-sqlite3's native bindings
|
|
11
9
|
- **WAL Journaling** -- Write-Ahead Logging enabled automatically for concurrent read/write performance
|
|
12
10
|
- **In-Memory Mode** -- Use `:memory:` as the file path for ephemeral databases in tests and prototypes
|
package/docs/api/connect.md
CHANGED
|
@@ -22,12 +22,12 @@ Calls `connectAsync()` internally without passing a callback. The provider logs
|
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
Meadow-Connection-SQLite connect() called without a callback; this could
|
|
25
|
-
result in race conditions
|
|
25
|
+
result in race conditions -- use connectAsync(callback) instead.
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Why This Exists
|
|
29
29
|
|
|
30
|
-
`connect()` is provided for legacy compatibility and quick prototyping. Because the underlying better-sqlite3 library opens databases synchronously, the connection actually completes immediately
|
|
30
|
+
`connect()` is provided for legacy compatibility and quick prototyping. Because the underlying better-sqlite3 library opens databases synchronously, the connection actually completes immediately -- but the method still logs a warning because the Fable service pattern expects asynchronous lifecycle management.
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
package/docs/api/connectAsync.md
CHANGED
|
@@ -60,7 +60,7 @@ Calling `connectAsync()` on an already-connected provider logs an error but does
|
|
|
60
60
|
_Fable.MeadowSQLiteProvider.connectAsync(
|
|
61
61
|
(pError, pDatabase) =>
|
|
62
62
|
{
|
|
63
|
-
// First connection
|
|
63
|
+
// First connection -- succeeds normally
|
|
64
64
|
|
|
65
65
|
_Fable.MeadowSQLiteProvider.connectAsync(
|
|
66
66
|
(pError, pDatabase2) =>
|
|
@@ -111,7 +111,7 @@ If `connectAsync()` is called without a callback, the provider logs an error:
|
|
|
111
111
|
|
|
112
112
|
```
|
|
113
113
|
Meadow-Connection-SQLite connect() called without a callback; this could
|
|
114
|
-
result in race conditions
|
|
114
|
+
result in race conditions -- use connectAsync(callback) instead.
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
## Related
|
package/docs/api/createTable.md
CHANGED
|
@@ -25,7 +25,7 @@ None. Results are delivered via the callback.
|
|
|
25
25
|
2. Executes the DDL using `db.exec()`
|
|
26
26
|
3. Calls back with `undefined` on success, or an error if the DDL fails
|
|
27
27
|
|
|
28
|
-
Because the generated DDL uses `CREATE TABLE IF NOT EXISTS`, calling `createTable()` for an already-existing table is a no-op
|
|
28
|
+
Because the generated DDL uses `CREATE TABLE IF NOT EXISTS`, calling `createTable()` for an already-existing table is a no-op -- it does not error.
|
|
29
29
|
|
|
30
30
|
## Basic Usage
|
|
31
31
|
|
|
@@ -68,7 +68,7 @@ _Fable.MeadowSQLiteProvider.createTable(tmpBookSchema,
|
|
|
68
68
|
_Fable.MeadowSQLiteProvider.createTable(tmpBookSchema,
|
|
69
69
|
(pError) =>
|
|
70
70
|
{
|
|
71
|
-
// No error
|
|
71
|
+
// No error -- "IF NOT EXISTS" handles it
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
```
|
package/docs/api/db.md
CHANGED
|
@@ -22,7 +22,7 @@ The `db` getter is the main entry point for all query operations. All queries go
|
|
|
22
22
|
```javascript
|
|
23
23
|
let tmpDB = _Fable.MeadowSQLiteProvider.db;
|
|
24
24
|
|
|
25
|
-
// DDL
|
|
25
|
+
// DDL -- run raw SQL (no return value)
|
|
26
26
|
tmpDB.exec(`
|
|
27
27
|
CREATE TABLE IF NOT EXISTS Book (
|
|
28
28
|
IDBook INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -31,16 +31,16 @@ tmpDB.exec(`
|
|
|
31
31
|
)
|
|
32
32
|
`);
|
|
33
33
|
|
|
34
|
-
// INSERT / UPDATE / DELETE
|
|
34
|
+
// INSERT / UPDATE / DELETE -- returns { changes, lastInsertRowid }
|
|
35
35
|
let tmpResult = tmpDB.prepare('INSERT INTO Book (Title, Author) VALUES (?, ?)').run('Dune', 'Frank Herbert');
|
|
36
36
|
console.log(tmpResult.lastInsertRowid); // => 1
|
|
37
37
|
console.log(tmpResult.changes); // => 1
|
|
38
38
|
|
|
39
|
-
// SELECT single row
|
|
39
|
+
// SELECT single row -- returns object or undefined
|
|
40
40
|
let tmpBook = tmpDB.prepare('SELECT * FROM Book WHERE IDBook = ?').get(1);
|
|
41
41
|
console.log(tmpBook.Title); // => 'Dune'
|
|
42
42
|
|
|
43
|
-
// SELECT all rows
|
|
43
|
+
// SELECT all rows -- returns array of objects
|
|
44
44
|
let tmpBooks = tmpDB.prepare('SELECT * FROM Book').all();
|
|
45
45
|
console.log(tmpBooks.length); // => 1
|
|
46
46
|
```
|
|
@@ -35,7 +35,7 @@ DROP TABLE IF EXISTS Book;
|
|
|
35
35
|
|
|
36
36
|
## Executing the Drop
|
|
37
37
|
|
|
38
|
-
The method only generates the SQL
|
|
38
|
+
The method only generates the SQL -- it does not execute it. Use `db.exec()` to run it:
|
|
39
39
|
|
|
40
40
|
```javascript
|
|
41
41
|
let tmpDropSQL = _Fable.MeadowSQLiteProvider.generateDropTableStatement('Book');
|
|
@@ -49,7 +49,7 @@ The generated statement uses `IF EXISTS`, so dropping a table that does not exis
|
|
|
49
49
|
```javascript
|
|
50
50
|
let tmpDropSQL = _Fable.MeadowSQLiteProvider.generateDropTableStatement('NonExistentTable');
|
|
51
51
|
_Fable.MeadowSQLiteProvider.db.exec(tmpDropSQL);
|
|
52
|
-
// No error
|
|
52
|
+
// No error -- IF EXISTS handles it
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
## Comparison with MSSQL
|
|
@@ -51,12 +51,12 @@ Use `db` when you want to check for connection state gracefully. Use `preparedSt
|
|
|
51
51
|
## Comparison with MSSQL Provider
|
|
52
52
|
|
|
53
53
|
```javascript
|
|
54
|
-
// MSSQL
|
|
54
|
+
// MSSQL -- each access creates a new PreparedStatement
|
|
55
55
|
let tmpPS = _Fable.MeadowMSSQLProvider.preparedStatement;
|
|
56
56
|
tmpPS.input('id', _Fable.MeadowMSSQLProvider.MSSQL.Int);
|
|
57
57
|
tmpPS.prepare('SELECT * FROM Book WHERE IDBook = @id', ...);
|
|
58
58
|
|
|
59
|
-
// SQLite
|
|
59
|
+
// SQLite -- returns the Database handle (prepare directly)
|
|
60
60
|
let tmpDB = _Fable.MeadowSQLiteProvider.preparedStatement;
|
|
61
61
|
let tmpStmt = tmpDB.prepare('SELECT * FROM Book WHERE IDBook = ?');
|
|
62
62
|
```
|
package/docs/api/reference.md
CHANGED
|
@@ -26,7 +26,7 @@ On construction:
|
|
|
26
26
|
- Sets `connected` to `false`
|
|
27
27
|
- Reads `SQLiteFilePath` from `fable.settings.SQLite` if available
|
|
28
28
|
|
|
29
|
-
The provider is not connected after construction
|
|
29
|
+
The provider is not connected after construction -- call `connectAsync()` to open the database.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
@@ -66,7 +66,7 @@ Always `'MeadowConnectionSQLite'`.
|
|
|
66
66
|
| Method | Description |
|
|
67
67
|
|--------|-------------|
|
|
68
68
|
| [`connectAsync(fCallback)`](connectAsync.md) | Open the database and enable WAL (recommended) |
|
|
69
|
-
| [`connect()`](connect.md) | Synchronous wrapper
|
|
69
|
+
| [`connect()`](connect.md) | Synchronous wrapper -- logs a race-condition warning |
|
|
70
70
|
|
|
71
71
|
---
|
|
72
72
|
|
package/docs/architecture.md
CHANGED
|
@@ -67,10 +67,10 @@ flowchart LR
|
|
|
67
67
|
subgraph "better-sqlite3 Synchronous API"
|
|
68
68
|
EXEC["db.exec(sql)<br/>DDL / multi-statement"]
|
|
69
69
|
PREP["db.prepare(sql)"]
|
|
70
|
-
RUN["stmt.run(params)<br
|
|
71
|
-
GET["stmt.get(params)<br
|
|
72
|
-
ALL["stmt.all(params)<br
|
|
73
|
-
TXN["db.transaction(fn)<br
|
|
70
|
+
RUN["stmt.run(params)<br/>-> { changes, lastInsertRowid }"]
|
|
71
|
+
GET["stmt.get(params)<br/>-> object | undefined"]
|
|
72
|
+
ALL["stmt.all(params)<br/>-> array of objects"]
|
|
73
|
+
TXN["db.transaction(fn)<br/>-> atomic wrapper"]
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
PREP --> RUN
|
|
@@ -114,8 +114,8 @@ flowchart TD
|
|
|
114
114
|
|
|
115
115
|
Settings priority:
|
|
116
116
|
|
|
117
|
-
1. **Constructor options**
|
|
118
|
-
2. **Fable settings**
|
|
117
|
+
1. **Constructor options** -- passed as the second argument to `instantiateServiceProvider()`
|
|
118
|
+
2. **Fable settings** -- `fable.settings.SQLite.SQLiteFilePath`
|
|
119
119
|
|
|
120
120
|
Constructor options take priority, allowing multiple provider instances with different database files.
|
|
121
121
|
|
package/docs/css/docuserve.css
CHANGED
|
@@ -1,73 +1,327 @@
|
|
|
1
1
|
/* ============================================================================
|
|
2
|
-
Pict Docuserve - Base Styles
|
|
2
|
+
Pict Docuserve - Base Styles & Theme Variables
|
|
3
3
|
============================================================================ */
|
|
4
4
|
|
|
5
|
-
/*
|
|
6
|
-
|
|
5
|
+
/* ----------------------------------------------------------------------------
|
|
6
|
+
Theme variables — light defaults on :root.
|
|
7
|
+
Dark mode applies when either:
|
|
8
|
+
(a) the user explicitly selected dark via <html data-theme="dark">
|
|
9
|
+
(b) the user hasn't chosen anything AND the system prefers dark
|
|
10
|
+
An explicit <html data-theme="light"> pins the light palette regardless.
|
|
11
|
+
---------------------------------------------------------------------------- */
|
|
12
|
+
|
|
13
|
+
:root
|
|
14
|
+
{
|
|
15
|
+
/* Surfaces */
|
|
16
|
+
--docuserve-bg: #FDFBF7;
|
|
17
|
+
--docuserve-bg-elevated: #FFFFFF;
|
|
18
|
+
--docuserve-border: #DDD6CA;
|
|
19
|
+
--docuserve-border-soft: #EAE3D8;
|
|
20
|
+
|
|
21
|
+
/* Text */
|
|
22
|
+
--docuserve-text: #2A241E;
|
|
23
|
+
--docuserve-text-strong: #3D3229;
|
|
24
|
+
--docuserve-text-muted: #5E5549;
|
|
25
|
+
--docuserve-text-dim: #8A7F72;
|
|
26
|
+
|
|
27
|
+
/* Accent / links */
|
|
28
|
+
--docuserve-accent: #2E7D74;
|
|
29
|
+
--docuserve-accent-hover: #236660;
|
|
30
|
+
|
|
31
|
+
/* Top bar */
|
|
32
|
+
--docuserve-topbar-bg: #3D3229;
|
|
33
|
+
--docuserve-topbar-text: #E8E0D4;
|
|
34
|
+
--docuserve-topbar-text-muted: #B5AA9A;
|
|
35
|
+
--docuserve-topbar-text-dim: #8A7F72;
|
|
36
|
+
--docuserve-topbar-hover-bg: #524438;
|
|
37
|
+
--docuserve-topbar-version-bg: rgba(255, 255, 255, 0.06);
|
|
38
|
+
--docuserve-topbar-version-border: rgba(255, 255, 255, 0.08);
|
|
39
|
+
--docuserve-topbar-version-text: #B5AA9A;
|
|
40
|
+
|
|
41
|
+
/* Sidebar */
|
|
42
|
+
--docuserve-sidebar-bg: #FAF7F1;
|
|
43
|
+
--docuserve-sidebar-border: #DDD6CA;
|
|
44
|
+
--docuserve-sidebar-border-soft: #E5DED1;
|
|
45
|
+
--docuserve-sidebar-text: #423D37;
|
|
46
|
+
--docuserve-sidebar-group-title: #3D3229;
|
|
47
|
+
--docuserve-sidebar-module-text: #5E5549;
|
|
48
|
+
--docuserve-sidebar-hover-bg: #EAE3D8;
|
|
49
|
+
--docuserve-sidebar-hover-text: #2E7D74;
|
|
50
|
+
--docuserve-sidebar-active-bg: #E5DED1;
|
|
51
|
+
--docuserve-sidebar-active-text: #2E7D74;
|
|
52
|
+
--docuserve-sidebar-search-bg: #FFFFFF;
|
|
53
|
+
--docuserve-sidebar-search-border: #DDD6CA;
|
|
54
|
+
|
|
55
|
+
/* Inline code */
|
|
56
|
+
--docuserve-inline-code-bg: #F0ECE4;
|
|
57
|
+
--docuserve-inline-code-text: #9E3A50;
|
|
58
|
+
|
|
59
|
+
/* Code block panel */
|
|
60
|
+
--docuserve-code-bg: #F6F3EE;
|
|
61
|
+
--docuserve-code-border: #E5DED1;
|
|
62
|
+
--docuserve-code-gutter-bg: #EFEAE0;
|
|
63
|
+
--docuserve-code-gutter-border: #DDD6CA;
|
|
64
|
+
--docuserve-code-gutter-text: #A59986;
|
|
65
|
+
--docuserve-code-text: #2A241E;
|
|
66
|
+
|
|
67
|
+
/* Syntax tokens — low-chroma dark-on-light palette */
|
|
68
|
+
--docuserve-tok-keyword: #A03472;
|
|
69
|
+
--docuserve-tok-string: #1A6640;
|
|
70
|
+
--docuserve-tok-number: #B25A00;
|
|
71
|
+
--docuserve-tok-comment: #8A7F72;
|
|
72
|
+
--docuserve-tok-operator: #2E7D74;
|
|
73
|
+
--docuserve-tok-punctuation: #2A241E;
|
|
74
|
+
--docuserve-tok-function: #2A5DB0;
|
|
75
|
+
--docuserve-tok-property: #9E3A50;
|
|
76
|
+
--docuserve-tok-tag: #9E3A50;
|
|
77
|
+
--docuserve-tok-attr-name: #B25A00;
|
|
78
|
+
--docuserve-tok-attr-value: #1A6640;
|
|
79
|
+
|
|
80
|
+
/* Tables, blockquotes, mermaid */
|
|
81
|
+
--docuserve-table-header-bg: #F5F0E8;
|
|
82
|
+
--docuserve-table-row-alt-bg: #F9F6F0;
|
|
83
|
+
--docuserve-blockquote-bg: #F7F5F0;
|
|
84
|
+
--docuserve-blockquote-border: #2E7D74;
|
|
85
|
+
--docuserve-blockquote-text: #5E5549;
|
|
86
|
+
--docuserve-mermaid-bg: #FFFFFF;
|
|
87
|
+
|
|
88
|
+
/* Scrollbars */
|
|
89
|
+
--docuserve-scrollbar-track: #F5F0E8;
|
|
90
|
+
--docuserve-scrollbar-thumb: #D4CCBE;
|
|
91
|
+
--docuserve-scrollbar-thumb-hover: #B5AA9A;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (prefers-color-scheme: dark)
|
|
95
|
+
{
|
|
96
|
+
:root:not([data-theme="light"])
|
|
97
|
+
{
|
|
98
|
+
--docuserve-bg: #15120F;
|
|
99
|
+
--docuserve-bg-elevated: #1B1814;
|
|
100
|
+
--docuserve-border: #2F2823;
|
|
101
|
+
--docuserve-border-soft: #26211C;
|
|
102
|
+
|
|
103
|
+
--docuserve-text: #E8E0D4;
|
|
104
|
+
--docuserve-text-strong: #F2ECE0;
|
|
105
|
+
--docuserve-text-muted: #B5AA9A;
|
|
106
|
+
--docuserve-text-dim: #7A6F62;
|
|
107
|
+
|
|
108
|
+
--docuserve-accent: #5DB8A8;
|
|
109
|
+
--docuserve-accent-hover: #7FCCB8;
|
|
110
|
+
|
|
111
|
+
--docuserve-topbar-bg: #1A1612;
|
|
112
|
+
--docuserve-topbar-text: #E8E0D4;
|
|
113
|
+
--docuserve-topbar-text-muted: #B5AA9A;
|
|
114
|
+
--docuserve-topbar-text-dim: #7A6F62;
|
|
115
|
+
--docuserve-topbar-hover-bg: #2A241E;
|
|
116
|
+
--docuserve-topbar-version-bg: rgba(255, 255, 255, 0.05);
|
|
117
|
+
--docuserve-topbar-version-border: rgba(255, 255, 255, 0.09);
|
|
118
|
+
--docuserve-topbar-version-text: #B5AA9A;
|
|
119
|
+
|
|
120
|
+
--docuserve-sidebar-bg: #1B1814;
|
|
121
|
+
--docuserve-sidebar-border: #2F2823;
|
|
122
|
+
--docuserve-sidebar-border-soft: #26211C;
|
|
123
|
+
--docuserve-sidebar-text: #C9C0B3;
|
|
124
|
+
--docuserve-sidebar-group-title: #F2ECE0;
|
|
125
|
+
--docuserve-sidebar-module-text: #B5AA9A;
|
|
126
|
+
--docuserve-sidebar-hover-bg: #2A241E;
|
|
127
|
+
--docuserve-sidebar-hover-text: #7FCCB8;
|
|
128
|
+
--docuserve-sidebar-active-bg: #2F2823;
|
|
129
|
+
--docuserve-sidebar-active-text: #7FCCB8;
|
|
130
|
+
--docuserve-sidebar-search-bg: #26211C;
|
|
131
|
+
--docuserve-sidebar-search-border: #2F2823;
|
|
132
|
+
|
|
133
|
+
--docuserve-inline-code-bg: #2A241E;
|
|
134
|
+
--docuserve-inline-code-text: #E8B07A;
|
|
135
|
+
|
|
136
|
+
--docuserve-code-bg: #1E1A17;
|
|
137
|
+
--docuserve-code-border: #2F2823;
|
|
138
|
+
--docuserve-code-gutter-bg: #17130F;
|
|
139
|
+
--docuserve-code-gutter-border: #2F2823;
|
|
140
|
+
--docuserve-code-gutter-text: #6A6052;
|
|
141
|
+
--docuserve-code-text: #E8E0D4;
|
|
142
|
+
|
|
143
|
+
--docuserve-tok-keyword: #C678DD;
|
|
144
|
+
--docuserve-tok-string: #98C379;
|
|
145
|
+
--docuserve-tok-number: #D19A66;
|
|
146
|
+
--docuserve-tok-comment: #7F848E;
|
|
147
|
+
--docuserve-tok-operator: #56B6C2;
|
|
148
|
+
--docuserve-tok-punctuation: #E8E0D4;
|
|
149
|
+
--docuserve-tok-function: #61AFEF;
|
|
150
|
+
--docuserve-tok-property: #E06C75;
|
|
151
|
+
--docuserve-tok-tag: #E06C75;
|
|
152
|
+
--docuserve-tok-attr-name: #D19A66;
|
|
153
|
+
--docuserve-tok-attr-value: #98C379;
|
|
154
|
+
|
|
155
|
+
--docuserve-table-header-bg: #26211C;
|
|
156
|
+
--docuserve-table-row-alt-bg: #1F1B17;
|
|
157
|
+
--docuserve-blockquote-bg: #1F1B17;
|
|
158
|
+
--docuserve-blockquote-border: #5DB8A8;
|
|
159
|
+
--docuserve-blockquote-text: #C9C0B3;
|
|
160
|
+
--docuserve-mermaid-bg: #E8E0D4;
|
|
161
|
+
|
|
162
|
+
--docuserve-scrollbar-track: #1B1814;
|
|
163
|
+
--docuserve-scrollbar-thumb: #3A322B;
|
|
164
|
+
--docuserve-scrollbar-thumb-hover: #524438;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:root[data-theme="dark"]
|
|
169
|
+
{
|
|
170
|
+
--docuserve-bg: #15120F;
|
|
171
|
+
--docuserve-bg-elevated: #1B1814;
|
|
172
|
+
--docuserve-border: #2F2823;
|
|
173
|
+
--docuserve-border-soft: #26211C;
|
|
174
|
+
|
|
175
|
+
--docuserve-text: #E8E0D4;
|
|
176
|
+
--docuserve-text-strong: #F2ECE0;
|
|
177
|
+
--docuserve-text-muted: #B5AA9A;
|
|
178
|
+
--docuserve-text-dim: #7A6F62;
|
|
179
|
+
|
|
180
|
+
--docuserve-accent: #5DB8A8;
|
|
181
|
+
--docuserve-accent-hover: #7FCCB8;
|
|
182
|
+
|
|
183
|
+
--docuserve-topbar-bg: #1A1612;
|
|
184
|
+
--docuserve-topbar-text: #E8E0D4;
|
|
185
|
+
--docuserve-topbar-text-muted: #B5AA9A;
|
|
186
|
+
--docuserve-topbar-text-dim: #7A6F62;
|
|
187
|
+
--docuserve-topbar-hover-bg: #2A241E;
|
|
188
|
+
--docuserve-topbar-version-bg: rgba(255, 255, 255, 0.05);
|
|
189
|
+
--docuserve-topbar-version-border: rgba(255, 255, 255, 0.09);
|
|
190
|
+
--docuserve-topbar-version-text: #B5AA9A;
|
|
191
|
+
|
|
192
|
+
--docuserve-sidebar-bg: #1B1814;
|
|
193
|
+
--docuserve-sidebar-border: #2F2823;
|
|
194
|
+
--docuserve-sidebar-border-soft: #26211C;
|
|
195
|
+
--docuserve-sidebar-text: #C9C0B3;
|
|
196
|
+
--docuserve-sidebar-group-title: #F2ECE0;
|
|
197
|
+
--docuserve-sidebar-module-text: #B5AA9A;
|
|
198
|
+
--docuserve-sidebar-hover-bg: #2A241E;
|
|
199
|
+
--docuserve-sidebar-hover-text: #7FCCB8;
|
|
200
|
+
--docuserve-sidebar-active-bg: #2F2823;
|
|
201
|
+
--docuserve-sidebar-active-text: #7FCCB8;
|
|
202
|
+
--docuserve-sidebar-search-bg: #26211C;
|
|
203
|
+
--docuserve-sidebar-search-border: #2F2823;
|
|
204
|
+
|
|
205
|
+
--docuserve-inline-code-bg: #2A241E;
|
|
206
|
+
--docuserve-inline-code-text: #E8B07A;
|
|
207
|
+
|
|
208
|
+
--docuserve-code-bg: #1E1A17;
|
|
209
|
+
--docuserve-code-border: #2F2823;
|
|
210
|
+
--docuserve-code-gutter-bg: #17130F;
|
|
211
|
+
--docuserve-code-gutter-border: #2F2823;
|
|
212
|
+
--docuserve-code-gutter-text: #6A6052;
|
|
213
|
+
--docuserve-code-text: #E8E0D4;
|
|
214
|
+
|
|
215
|
+
--docuserve-tok-keyword: #C678DD;
|
|
216
|
+
--docuserve-tok-string: #98C379;
|
|
217
|
+
--docuserve-tok-number: #D19A66;
|
|
218
|
+
--docuserve-tok-comment: #7F848E;
|
|
219
|
+
--docuserve-tok-operator: #56B6C2;
|
|
220
|
+
--docuserve-tok-punctuation: #E8E0D4;
|
|
221
|
+
--docuserve-tok-function: #61AFEF;
|
|
222
|
+
--docuserve-tok-property: #E06C75;
|
|
223
|
+
--docuserve-tok-tag: #E06C75;
|
|
224
|
+
--docuserve-tok-attr-name: #D19A66;
|
|
225
|
+
--docuserve-tok-attr-value: #98C379;
|
|
226
|
+
|
|
227
|
+
--docuserve-table-header-bg: #26211C;
|
|
228
|
+
--docuserve-table-row-alt-bg: #1F1B17;
|
|
229
|
+
--docuserve-blockquote-bg: #1F1B17;
|
|
230
|
+
--docuserve-blockquote-border: #5DB8A8;
|
|
231
|
+
--docuserve-blockquote-text: #C9C0B3;
|
|
232
|
+
--docuserve-mermaid-bg: #E8E0D4;
|
|
233
|
+
|
|
234
|
+
--docuserve-scrollbar-track: #1B1814;
|
|
235
|
+
--docuserve-scrollbar-thumb: #3A322B;
|
|
236
|
+
--docuserve-scrollbar-thumb-hover: #524438;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* ----------------------------------------------------------------------------
|
|
240
|
+
Reset and base
|
|
241
|
+
---------------------------------------------------------------------------- */
|
|
242
|
+
|
|
243
|
+
*, *::before, *::after
|
|
244
|
+
{
|
|
7
245
|
box-sizing: border-box;
|
|
8
246
|
}
|
|
9
247
|
|
|
10
|
-
html, body
|
|
248
|
+
html, body
|
|
249
|
+
{
|
|
11
250
|
margin: 0;
|
|
12
251
|
padding: 0;
|
|
13
252
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
14
253
|
font-size: 16px;
|
|
15
254
|
line-height: 1.5;
|
|
16
|
-
color:
|
|
17
|
-
background-color:
|
|
255
|
+
color: var(--docuserve-text);
|
|
256
|
+
background-color: var(--docuserve-bg);
|
|
18
257
|
-webkit-font-smoothing: antialiased;
|
|
19
258
|
-moz-osx-font-smoothing: grayscale;
|
|
259
|
+
transition: background-color 0.15s ease, color 0.15s ease;
|
|
20
260
|
}
|
|
21
261
|
|
|
22
262
|
/* Typography */
|
|
23
|
-
h1, h2, h3, h4, h5, h6
|
|
263
|
+
h1, h2, h3, h4, h5, h6
|
|
264
|
+
{
|
|
24
265
|
margin-top: 0;
|
|
25
266
|
line-height: 1.3;
|
|
267
|
+
color: var(--docuserve-text-strong);
|
|
26
268
|
}
|
|
27
269
|
|
|
28
|
-
a
|
|
29
|
-
|
|
270
|
+
a
|
|
271
|
+
{
|
|
272
|
+
color: var(--docuserve-accent);
|
|
30
273
|
text-decoration: none;
|
|
31
274
|
}
|
|
32
275
|
|
|
33
|
-
a:hover
|
|
34
|
-
|
|
276
|
+
a:hover
|
|
277
|
+
{
|
|
278
|
+
color: var(--docuserve-accent-hover);
|
|
35
279
|
}
|
|
36
280
|
|
|
37
281
|
/* Application container */
|
|
38
|
-
#Docuserve-Application-Container
|
|
282
|
+
#Docuserve-Application-Container
|
|
283
|
+
{
|
|
39
284
|
min-height: 100vh;
|
|
40
285
|
}
|
|
41
286
|
|
|
42
287
|
/* Utility: scrollbar styling */
|
|
43
|
-
::-webkit-scrollbar
|
|
288
|
+
::-webkit-scrollbar
|
|
289
|
+
{
|
|
44
290
|
width: 8px;
|
|
291
|
+
height: 8px;
|
|
45
292
|
}
|
|
46
293
|
|
|
47
|
-
::-webkit-scrollbar-track
|
|
48
|
-
|
|
294
|
+
::-webkit-scrollbar-track
|
|
295
|
+
{
|
|
296
|
+
background: var(--docuserve-scrollbar-track);
|
|
49
297
|
}
|
|
50
298
|
|
|
51
|
-
::-webkit-scrollbar-thumb
|
|
52
|
-
|
|
299
|
+
::-webkit-scrollbar-thumb
|
|
300
|
+
{
|
|
301
|
+
background: var(--docuserve-scrollbar-thumb);
|
|
53
302
|
border-radius: 4px;
|
|
54
303
|
}
|
|
55
304
|
|
|
56
|
-
::-webkit-scrollbar-thumb:hover
|
|
57
|
-
|
|
305
|
+
::-webkit-scrollbar-thumb:hover
|
|
306
|
+
{
|
|
307
|
+
background: var(--docuserve-scrollbar-thumb-hover);
|
|
58
308
|
}
|
|
59
309
|
|
|
60
310
|
/* Responsive adjustments */
|
|
61
|
-
@media (max-width: 768px)
|
|
62
|
-
|
|
311
|
+
@media (max-width: 768px)
|
|
312
|
+
{
|
|
313
|
+
html
|
|
314
|
+
{
|
|
63
315
|
font-size: 14px;
|
|
64
316
|
}
|
|
65
317
|
|
|
66
|
-
#Docuserve-Sidebar-Container
|
|
318
|
+
#Docuserve-Sidebar-Container
|
|
319
|
+
{
|
|
67
320
|
display: none;
|
|
68
321
|
}
|
|
69
322
|
|
|
70
|
-
.docuserve-body
|
|
323
|
+
.docuserve-body
|
|
324
|
+
{
|
|
71
325
|
flex-direction: column;
|
|
72
326
|
}
|
|
73
327
|
}
|
|
@@ -278,7 +278,7 @@ console.log(`Total value: $${tmpStats.TotalValue.toFixed(2)}`);
|
|
|
278
278
|
tmpDB.close();
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
After closing, further queries on this database instance will throw. The provider's `connected` property remains `true`
|
|
281
|
+
After closing, further queries on this database instance will throw. The provider's `connected` property remains `true` -- if you need to reconnect, create a new provider instance.
|
|
282
282
|
|
|
283
283
|
---
|
|
284
284
|
|
package/docs/index.html
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
7
|
-
<meta name="description" content="Documentation
|
|
7
|
+
<meta name="description" content="Meadow Connection SQLite v1.0.18 Documentation — Meadow SQLite Plugin">
|
|
8
8
|
|
|
9
|
-
<title>Documentation</title>
|
|
9
|
+
<title>Meadow Connection SQLite v1.0.18 Documentation</title>
|
|
10
10
|
|
|
11
11
|
<!-- Application Stylesheet -->
|
|
12
12
|
<link href="css/docuserve.css" rel="stylesheet">
|
package/docs/quickstart.md
CHANGED
|
@@ -4,7 +4,7 @@ Get a SQLite database connected and running in five steps.
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## Step 1
|
|
7
|
+
## Step 1 -- Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install meadow-connection-sqlite fable
|
|
@@ -14,7 +14,7 @@ npm install meadow-connection-sqlite fable
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
## Step 2
|
|
17
|
+
## Step 2 -- Configure and Connect
|
|
18
18
|
|
|
19
19
|
```javascript
|
|
20
20
|
const libFable = require('fable');
|
|
@@ -53,7 +53,7 @@ For in-memory databases (useful in tests), set `SQLiteFilePath` to `":memory:"`.
|
|
|
53
53
|
|
|
54
54
|
---
|
|
55
55
|
|
|
56
|
-
## Step 3
|
|
56
|
+
## Step 3 -- Run Queries
|
|
57
57
|
|
|
58
58
|
All queries use the synchronous `better-sqlite3` API via the `db` getter:
|
|
59
59
|
|
|
@@ -101,7 +101,7 @@ console.log(tmpBook.Title);
|
|
|
101
101
|
|
|
102
102
|
---
|
|
103
103
|
|
|
104
|
-
## Step 4
|
|
104
|
+
## Step 4 -- Create Tables from Schema
|
|
105
105
|
|
|
106
106
|
Instead of writing DDL by hand, pass a Meadow table schema to `createTable()`:
|
|
107
107
|
|
|
@@ -146,7 +146,7 @@ CREATE TABLE IF NOT EXISTS Book (IDBook INTEGER PRIMARY KEY AUTOINCREMENT, GUIDB
|
|
|
146
146
|
|
|
147
147
|
---
|
|
148
148
|
|
|
149
|
-
## Step 5
|
|
149
|
+
## Step 5 -- Meadow ORM Integration
|
|
150
150
|
|
|
151
151
|
Wire the SQLite connection into Meadow for full ORM capabilities:
|
|
152
152
|
|
package/docs/retold-catalog.json
CHANGED
package/docs/schema.md
CHANGED
|
@@ -26,7 +26,7 @@ SQLite uses a flexible type system called "type affinity." Unlike MySQL or MSSQL
|
|
|
26
26
|
- **REAL** -- Used for decimal/floating-point values
|
|
27
27
|
- **TEXT** -- Used for strings, GUIDs, and dates (ISO-8601 format)
|
|
28
28
|
|
|
29
|
-
The `Size` field on Meadow `String` columns is accepted but has no effect in SQLite
|
|
29
|
+
The `Size` field on Meadow `String` columns is accepted but has no effect in SQLite -- `TEXT` columns have unlimited length.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
@@ -82,7 +82,7 @@ CREATE TABLE IF NOT EXISTS Book (IDBook INTEGER PRIMARY KEY AUTOINCREMENT, GUIDB
|
|
|
82
82
|
|
|
83
83
|
Key behaviors:
|
|
84
84
|
|
|
85
|
-
- Always uses `CREATE TABLE IF NOT EXISTS`
|
|
85
|
+
- Always uses `CREATE TABLE IF NOT EXISTS` -- safe to run repeatedly
|
|
86
86
|
- Column names are used as-is (no quoting needed in SQLite)
|
|
87
87
|
- The `ID` column is always `INTEGER PRIMARY KEY AUTOINCREMENT`
|
|
88
88
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meadow-connection-sqlite",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "Meadow SQLite Plugin",
|
|
5
5
|
"main": "source/Meadow-Connection-SQLite.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/stevenvelozo/meadow-connection-sqlite",
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"
|
|
45
|
+
"pict-docuserve": "^0.1.5",
|
|
46
|
+
"quackage": "^1.1.0",
|
|
46
47
|
"retold-harness": "^1.1.2"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection form schema for SQLite.
|
|
3
|
+
*
|
|
4
|
+
* Consumed by meadow-connection-manager#getProviderFormSchema('SQLite').
|
|
5
|
+
* Pure data — safe to require() even when better-sqlite3 is not
|
|
6
|
+
* installed. See Meadow-Connection-MySQL-FormSchema.js for the field
|
|
7
|
+
* contract.
|
|
8
|
+
*
|
|
9
|
+
* SQLite is file-based; the only configurable input is the path to the
|
|
10
|
+
* database file. A leading `~` is expanded to the user's home directory
|
|
11
|
+
* by retold-data-service before the connection is opened.
|
|
12
|
+
*/
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
module.exports =
|
|
16
|
+
{
|
|
17
|
+
Provider: 'SQLite',
|
|
18
|
+
DisplayName: 'SQLite',
|
|
19
|
+
Description: 'Open or create a local SQLite database file.',
|
|
20
|
+
Fields:
|
|
21
|
+
[
|
|
22
|
+
{
|
|
23
|
+
Name: 'SQLiteFilePath',
|
|
24
|
+
Label: 'SQLite File Path',
|
|
25
|
+
Type: 'Path',
|
|
26
|
+
Default: '~/headlight-liveconnect-local/cloned.sqlite',
|
|
27
|
+
Required: true,
|
|
28
|
+
Placeholder: '~/headlight-liveconnect-local/cloned.sqlite',
|
|
29
|
+
Help: 'A leading ~ is expanded to your home directory. Parent directories are created automatically.'
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
@@ -85,6 +85,12 @@ class MeadowSchemaSQLite extends libFableServiceProviderBase
|
|
|
85
85
|
case 'Boolean':
|
|
86
86
|
tmpCreateTableStatement += ` ${tmpColumn.Column} INTEGER NOT NULL DEFAULT 0`;
|
|
87
87
|
break;
|
|
88
|
+
case 'JSON':
|
|
89
|
+
tmpCreateTableStatement += ` ${tmpColumn.Column} TEXT`;
|
|
90
|
+
break;
|
|
91
|
+
case 'JSONProxy':
|
|
92
|
+
tmpCreateTableStatement += ` ${tmpColumn.StorageColumn} TEXT`;
|
|
93
|
+
break;
|
|
88
94
|
default:
|
|
89
95
|
break;
|
|
90
96
|
}
|
|
@@ -935,6 +941,10 @@ class MeadowSchemaSQLite extends libFableServiceProviderBase
|
|
|
935
941
|
return 'DateTime';
|
|
936
942
|
case 'Boolean':
|
|
937
943
|
return 'Boolean';
|
|
944
|
+
case 'JSON':
|
|
945
|
+
return 'JSON';
|
|
946
|
+
case 'JSONProxy':
|
|
947
|
+
return 'JSONProxy';
|
|
938
948
|
default:
|
|
939
949
|
return 'String';
|
|
940
950
|
}
|
|
@@ -968,6 +978,10 @@ class MeadowSchemaSQLite extends libFableServiceProviderBase
|
|
|
968
978
|
return '';
|
|
969
979
|
case 'Boolean':
|
|
970
980
|
return false;
|
|
981
|
+
case 'JSON':
|
|
982
|
+
return {};
|
|
983
|
+
case 'JSONProxy':
|
|
984
|
+
return {};
|
|
971
985
|
default:
|
|
972
986
|
return '';
|
|
973
987
|
}
|