meadow 2.0.43 → 2.0.44
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/README.md +2 -3
- package/docs/architecture.md +10 -99
- package/docs/diagrams/create-waterfall.excalidraw +2016 -0
- package/docs/diagrams/create-waterfall.mmd +19 -0
- package/docs/diagrams/create-waterfall.svg +2 -0
- package/docs/diagrams/crud-behavior-flow.excalidraw +1305 -0
- package/docs/diagrams/crud-behavior-flow.mmd +13 -0
- package/docs/diagrams/crud-behavior-flow.svg +2 -0
- package/docs/diagrams/module-hierarchy.excalidraw +1582 -0
- package/docs/diagrams/module-hierarchy.mmd +15 -0
- package/docs/diagrams/module-hierarchy.svg +2 -0
- package/docs/diagrams/query-lifecycle.excalidraw +1808 -0
- package/docs/diagrams/query-lifecycle.mmd +21 -0
- package/docs/diagrams/query-lifecycle.svg +2 -0
- package/docs/diagrams/schema-system.excalidraw +2034 -0
- package/docs/diagrams/schema-system.mmd +21 -0
- package/docs/diagrams/schema-system.svg +2 -0
- package/docs/providers/README.md +6 -14
- package/docs/providers/diagrams/overview.excalidraw +1324 -0
- package/docs/providers/diagrams/overview.mmd +8 -0
- package/docs/providers/diagrams/overview.svg +2 -0
- package/docs/providers/diagrams/use-case-unified-client-server-interface.excalidraw +919 -0
- package/docs/providers/diagrams/use-case-unified-client-server-interface.mmd +12 -0
- package/docs/providers/diagrams/use-case-unified-client-server-interface.svg +2 -0
- package/docs/providers/meadow-endpoints.md +5 -17
- package/docs/providers/mongodb.md +2 -2
- package/docs/providers/mssql.md +1 -1
- package/docs/providers/mysql.md +1 -1
- package/docs/providers/postgresql.md +2 -2
- package/docs/providers/rocksdb.md +1 -1
- package/docs/providers/sqlite.md +1 -1
- package/docs/query/README.md +1 -1
- package/docs/query/count.md +2 -8
- package/docs/query/create.md +2 -12
- package/docs/query/diagrams/how-it-works-2.excalidraw +1097 -0
- package/docs/query/diagrams/how-it-works-2.mmd +10 -0
- package/docs/query/diagrams/how-it-works-2.svg +2 -0
- package/docs/query/diagrams/how-it-works-3.excalidraw +665 -0
- package/docs/query/diagrams/how-it-works-3.mmd +6 -0
- package/docs/query/diagrams/how-it-works-3.svg +2 -0
- package/docs/query/diagrams/how-it-works-4.excalidraw +881 -0
- package/docs/query/diagrams/how-it-works-4.mmd +8 -0
- package/docs/query/diagrams/how-it-works-4.svg +2 -0
- package/docs/query/diagrams/how-it-works-5.excalidraw +881 -0
- package/docs/query/diagrams/how-it-works-5.mmd +8 -0
- package/docs/query/diagrams/how-it-works-5.svg +2 -0
- package/docs/query/diagrams/how-it-works.excalidraw +665 -0
- package/docs/query/diagrams/how-it-works.mmd +6 -0
- package/docs/query/diagrams/how-it-works.svg +2 -0
- package/docs/query/read.md +4 -18
- package/docs/query/update.md +2 -10
- package/docs/query-dsl.md +1 -1
- package/docs/quick-start.md +1 -1
- package/docs/retold-catalog.json +1 -1
- package/docs/retold-keyword-index.json +1 -1
- package/docs/schema/README.md +2 -7
- package/docs/schema/diagrams/overview.excalidraw +834 -0
- package/docs/schema/diagrams/overview.mmd +5 -0
- package/docs/schema/diagrams/overview.svg +2 -0
- package/package.json +3 -3
- package/source/providers/Meadow-Provider-MeadowEndpoints.js +36 -7
- package/test/Meadow-Provider-MeadowEndpoints-Session_tests.js +123 -0
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# Meadow
|
|
2
2
|
|
|
3
|
-
> **[
|
|
3
|
+
> **[Read the Meadow Documentation](https://fable-retold.github.io/meadow/)** - interactive docs with the full API reference.
|
|
4
4
|
|
|
5
5
|
A data access library providing magic where you want it, programmability where you don't.
|
|
6
6
|
|
|
7
|
-
[
|
|
8
|
-
[](https://travis-ci.org/stevenvelozo/meadow)
|
|
7
|
+
[meadow on npm](https://www.npmjs.com/package/meadow)
|
|
9
8
|
|
|
10
9
|
Meadow is a JavaScript data broker that handles repetitive CRUD operations through a consistent, provider-agnostic interface. It abstracts database communication behind a unified API -- whether your data lives in MySQL, MSSQL, PostgreSQL, SQLite, MongoDB, RocksDB, or an in-browser ALASQL store, Meadow provides schema management, query generation, data marshalling, and automatic audit stamping while you focus on business logic.
|
|
11
10
|
|
package/docs/architecture.md
CHANGED
|
@@ -6,69 +6,22 @@ This document describes the internal architecture of Meadow, its component relat
|
|
|
6
6
|
|
|
7
7
|
Meadow sits between your application and the database, orchestrating schema management, query generation, behavior execution, and data marshalling.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Fable["Fable<br/>(Configuration, Logging, DI)"]
|
|
12
|
-
Meadow["Meadow<br/>(Data Broker)"]
|
|
13
|
-
Schema["Schema<br/>(Column Types, JSON Schema,<br/>Default Object, Authorizer)"]
|
|
14
|
-
FoxHound["FoxHound<br/>(Query DSL)"]
|
|
15
|
-
Behaviors["Behaviors<br/>(Create, Read, Reads,<br/>Update, Delete, Undelete, Count)"]
|
|
16
|
-
Provider["Provider<br/>(Database Adapter)"]
|
|
17
|
-
Database["Database<br/>(MySQL, MSSQL, PostgreSQL,<br/>SQLite, MongoDB, RocksDB, etc.)"]
|
|
18
|
-
|
|
19
|
-
Fable --> Meadow
|
|
20
|
-
Meadow --> Schema
|
|
21
|
-
Meadow --> FoxHound
|
|
22
|
-
Meadow --> Behaviors
|
|
23
|
-
Meadow --> Provider
|
|
24
|
-
Provider --> Database
|
|
25
|
-
```
|
|
9
|
+
<!-- bespoke diagram: edit diagrams/module-hierarchy.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow/docs -->
|
|
10
|
+

|
|
26
11
|
|
|
27
12
|
## CRUD Behavior Flow
|
|
28
13
|
|
|
29
14
|
Every CRUD operation follows the same general flow: a query object enters a behavior module, which orchestrates provider calls, marshals results, and returns data through the callback.
|
|
30
15
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
A["Application calls<br/>meadow.doCreate / doRead / doReads /<br/>doUpdate / doDelete / doUndelete / doCount"]
|
|
34
|
-
B["Behavior Module<br/>(async waterfall)"]
|
|
35
|
-
C["Provider.Create / Read /<br/>Update / Delete / Undelete / Count"]
|
|
36
|
-
D["Database Result"]
|
|
37
|
-
E["Marshal Record<br/>(marshalRecordFromSourceToObject)"]
|
|
38
|
-
F["Callback<br/>(pError, pQuery, pRecord)"]
|
|
39
|
-
|
|
40
|
-
A --> B
|
|
41
|
-
B --> C
|
|
42
|
-
C --> D
|
|
43
|
-
D --> E
|
|
44
|
-
E --> F
|
|
45
|
-
```
|
|
16
|
+
<!-- bespoke diagram: edit diagrams/crud-behavior-flow.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow/docs -->
|
|
17
|
+

|
|
46
18
|
|
|
47
19
|
## Create Waterfall
|
|
48
20
|
|
|
49
21
|
The create behavior is the most involved operation, performing multiple steps in an async waterfall to ensure GUID uniqueness and return the complete created record.
|
|
50
22
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
A["Step 0: GUID Uniqueness Check<br/>If GUID is provided and >= 5 chars,<br/>query for existing record with same GUID"]
|
|
54
|
-
B{"GUID<br/>already exists?"}
|
|
55
|
-
C["Error: Record with GUID already exists"]
|
|
56
|
-
D["Step 1: Insert Record<br/>Merge default object with submitted record,<br/>set IDUser, call Provider.Create"]
|
|
57
|
-
E{"Insert<br/>succeeded?"}
|
|
58
|
-
F["Error: Creation failed"]
|
|
59
|
-
G["Step 2: Read Back<br/>Query by new auto-increment ID,<br/>call Provider.Read"]
|
|
60
|
-
H["Step 3: Marshal<br/>marshalRecordFromSourceToObject<br/>returns plain JavaScript object"]
|
|
61
|
-
I["Callback with<br/>created record"]
|
|
62
|
-
|
|
63
|
-
A --> B
|
|
64
|
-
B -->|Yes| C
|
|
65
|
-
B -->|No| D
|
|
66
|
-
D --> E
|
|
67
|
-
E -->|No| F
|
|
68
|
-
E -->|Yes| G
|
|
69
|
-
G --> H
|
|
70
|
-
H --> I
|
|
71
|
-
```
|
|
23
|
+
<!-- bespoke diagram: edit diagrams/create-waterfall.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow/docs -->
|
|
24
|
+

|
|
72
25
|
|
|
73
26
|
## Provider Architecture
|
|
74
27
|
|
|
@@ -182,57 +135,15 @@ classDiagram
|
|
|
182
135
|
|
|
183
136
|
The schema drives query generation, validation, record initialization, and access control. A single schema definition feeds multiple subsystems.
|
|
184
137
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
Schema["Meadow Schema"]
|
|
188
|
-
ColumnSchema["Column Schema<br/>(Column, Type, Size)"]
|
|
189
|
-
JsonSchema["JSON Schema<br/>(Validation Rules)"]
|
|
190
|
-
DefaultObject["Default Object<br/>(Initial Values)"]
|
|
191
|
-
Authorizer["Authorizer<br/>(Role Permissions)"]
|
|
192
|
-
|
|
193
|
-
QueryGen["Query Generation<br/>(FoxHound builds SQL<br/>from column definitions)"]
|
|
194
|
-
Validation["Validation<br/>(is-my-json-valid<br/>checks objects)"]
|
|
195
|
-
RecordInit["Record Initialization<br/>(merge defaults into<br/>new records)"]
|
|
196
|
-
AccessControl["Access Control<br/>(role-based CRUD<br/>permissions)"]
|
|
197
|
-
|
|
198
|
-
Schema --> ColumnSchema
|
|
199
|
-
Schema --> JsonSchema
|
|
200
|
-
Schema --> DefaultObject
|
|
201
|
-
Schema --> Authorizer
|
|
202
|
-
|
|
203
|
-
ColumnSchema --> QueryGen
|
|
204
|
-
JsonSchema --> Validation
|
|
205
|
-
DefaultObject --> RecordInit
|
|
206
|
-
Authorizer --> AccessControl
|
|
207
|
-
```
|
|
138
|
+
<!-- bespoke diagram: edit diagrams/schema-system.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow/docs -->
|
|
139
|
+

|
|
208
140
|
|
|
209
141
|
## Query Lifecycle
|
|
210
142
|
|
|
211
143
|
This diagram shows the full sequence of a CRUD operation from the application through to the database and back.
|
|
212
144
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
participant App as Application
|
|
216
|
-
participant Meadow as Meadow
|
|
217
|
-
participant Behavior as Behavior Module
|
|
218
|
-
participant FH as FoxHound
|
|
219
|
-
participant Provider as Provider
|
|
220
|
-
participant DB as Database
|
|
221
|
-
|
|
222
|
-
App->>Meadow: meadow.query (clone FoxHound)
|
|
223
|
-
Meadow-->>App: Independent query clone
|
|
224
|
-
App->>App: addFilter / addRecord / setCap
|
|
225
|
-
App->>Meadow: meadow.doCreate / doRead / etc.
|
|
226
|
-
Meadow->>Behavior: Invoke behavior (async waterfall)
|
|
227
|
-
Behavior->>FH: setDialect / buildQuery
|
|
228
|
-
FH-->>Behavior: Generated SQL + parameters
|
|
229
|
-
Behavior->>Provider: Provider.Create / Read / etc.
|
|
230
|
-
Provider->>DB: Execute query
|
|
231
|
-
DB-->>Provider: Result rows
|
|
232
|
-
Provider-->>Behavior: Result on query object
|
|
233
|
-
Behavior->>Behavior: Marshal records (source to POJO)
|
|
234
|
-
Behavior-->>App: Callback (pError, pQuery, pRecord)
|
|
235
|
-
```
|
|
145
|
+
<!-- bespoke diagram: edit diagrams/query-lifecycle.mmd or .hints.json, then: npx pict-renderer-graph build modules/meadow/meadow/docs -->
|
|
146
|
+

|
|
236
147
|
|
|
237
148
|
## Key Architectural Concepts
|
|
238
149
|
|