retold 1.0.6 → 4.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.
- package/.claude/settings.local.json +58 -0
- package/CLAUDE.md +52 -0
- package/docs/.nojekyll +0 -0
- package/docs/README.md +161 -0
- package/docs/_sidebar.md +65 -0
- package/docs/_topbar.md +6 -0
- package/docs/architecture.md +312 -0
- package/docs/cover.md +15 -0
- package/docs/css/docuserve.css +73 -0
- package/docs/fable.md +198 -0
- package/docs/getting-started.md +272 -0
- package/docs/index.html +39 -0
- package/docs/js/pict.min.js +12 -0
- package/docs/js/pict.min.js.map +1 -0
- package/docs/meadow.md +211 -0
- package/docs/modules.md +96 -0
- package/docs/orator.md +164 -0
- package/docs/pict-docuserve.min.js +58 -0
- package/docs/pict-docuserve.min.js.map +1 -0
- package/docs/pict.md +213 -0
- package/docs/retold-building-documentation.md +33 -0
- package/docs/retold-catalog.json +2826 -0
- package/docs/retold-keyword-index.json +161289 -0
- package/docs/utility.md +63 -0
- package/examples/quickstart/README.md +47 -0
- package/examples/quickstart/layer1/README.md +21 -0
- package/examples/quickstart/layer1/index.js +49 -0
- package/examples/quickstart/layer1/package-lock.json +344 -0
- package/examples/quickstart/layer1/package.json +12 -0
- package/examples/quickstart/layer2/README.md +34 -0
- package/examples/quickstart/layer2/index.js +251 -0
- package/examples/quickstart/layer2/package-lock.json +4468 -0
- package/examples/quickstart/layer2/package.json +17 -0
- package/examples/quickstart/layer2/setup-database.js +61 -0
- package/examples/quickstart/layer3/README.md +39 -0
- package/examples/quickstart/layer3/index.js +91 -0
- package/examples/quickstart/layer3/package-lock.json +1936 -0
- package/examples/quickstart/layer3/package.json +14 -0
- package/examples/quickstart/layer4/README.md +47 -0
- package/examples/quickstart/layer4/generate-build-config.js +18 -0
- package/examples/quickstart/layer4/html/index.html +17 -0
- package/examples/quickstart/layer4/package-lock.json +13206 -0
- package/examples/quickstart/layer4/package.json +38 -0
- package/examples/quickstart/layer4/server.js +28 -0
- package/examples/quickstart/layer4/source/BookStore-Application-Config.json +15 -0
- package/examples/quickstart/layer4/source/BookStore-Application.js +54 -0
- package/examples/quickstart/layer4/source/providers/Router-Config.json +18 -0
- package/examples/quickstart/layer4/source/views/View-About.js +38 -0
- package/examples/quickstart/layer4/source/views/View-Home.js +50 -0
- package/examples/quickstart/layer4/source/views/View-Layout.js +60 -0
- package/examples/quickstart/layer5/README.md +26 -0
- package/examples/quickstart/layer5/index.js +121 -0
- package/examples/quickstart/layer5/package-lock.json +345 -0
- package/examples/quickstart/layer5/package.json +13 -0
- package/modules/.claude/settings.local.json +52 -0
- package/modules/CLAUDE.md +60 -0
- package/modules/Checkout.sh +42 -0
- package/modules/Include-Retold-Module-List.sh +15 -0
- package/modules/Retold-Modules.md +24 -0
- package/modules/Status.sh +59 -0
- package/modules/Update.sh +45 -0
- package/modules/fable/Fable.md +2 -0
- package/modules/meadow/Meadow.md +1 -0
- package/modules/orator/Orator.md +1 -0
- package/modules/pict/Pict.md +1 -0
- package/package.json +30 -35
- package/source/Retold.cjs +2 -0
- package/test/Retold_tests.js +23 -41
- package/.travis.yml +0 -13
- package/source/Retold-Meadow-Macros.js +0 -269
- package/source/Retold.js +0 -48
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(done)",
|
|
5
|
+
"Bash(xargs:*)",
|
|
6
|
+
"Bash(npm install:*)",
|
|
7
|
+
"Bash(npm view:*)",
|
|
8
|
+
"Bash(npm test:*)",
|
|
9
|
+
"Bash(chmod:*)",
|
|
10
|
+
"Bash(pdftk:*)",
|
|
11
|
+
"Bash(pdftoppm:*)",
|
|
12
|
+
"Bash(gs:*)",
|
|
13
|
+
"Bash(convert:*)",
|
|
14
|
+
"Bash(npx mocha test/Orator-File-Translation_basic_tests.js --exit --timeout 10000)",
|
|
15
|
+
"Bash(docker build:*)",
|
|
16
|
+
"Bash(docker run:*)",
|
|
17
|
+
"Bash(docker logs:*)",
|
|
18
|
+
"Bash(node -e:*)",
|
|
19
|
+
"Bash(curl:*)",
|
|
20
|
+
"Bash(docker images:*)",
|
|
21
|
+
"Bash(docker stop:*)",
|
|
22
|
+
"Bash(wc:*)",
|
|
23
|
+
"Bash(npm run build:*)",
|
|
24
|
+
"Bash(node build-site.js:*)",
|
|
25
|
+
"Bash(npm run build-site:*)",
|
|
26
|
+
"Bash(npx http-server example_applications/todo-app/site -p 8787 -c-1)",
|
|
27
|
+
"Bash(npm run build-examples:*)",
|
|
28
|
+
"Bash(ls:*)",
|
|
29
|
+
"Bash(tr:*)",
|
|
30
|
+
"Bash(npm pack:*)",
|
|
31
|
+
"Bash(tar:*)",
|
|
32
|
+
"Bash(git check-ignore:*)",
|
|
33
|
+
"Bash(node /Users/stevenvelozo/Code/retold/modules/pict/pict-docuserve/source/cli/Docuserve-CLI-Run.js inject:*)",
|
|
34
|
+
"Bash(node example_applications/build-examples.js:*)",
|
|
35
|
+
"Bash(npm run build-docs:*)",
|
|
36
|
+
"Bash(lsof:*)",
|
|
37
|
+
"Bash(find:*)",
|
|
38
|
+
"Bash(DISCLAIMER='> **Note:** This is sample documentation for a fictional product, created to demonstrate [pict-docuserve]\\(https://github.com/stevenvelozo/pict-docuserve\\). It is not a real application.')",
|
|
39
|
+
"Bash(SKIP_FILES=\"_sidebar.md _topbar.md cover.md errorpage.md\")",
|
|
40
|
+
"Bash(npm install)",
|
|
41
|
+
"Bash(xargs kill:*)",
|
|
42
|
+
"Bash(timeout 5 node:*)",
|
|
43
|
+
"Bash(grep:*)",
|
|
44
|
+
"Bash(npx quack:*)",
|
|
45
|
+
"Bash(npx copy-files-from-to:*)",
|
|
46
|
+
"Bash(python3:*)",
|
|
47
|
+
"Bash(echo:*)",
|
|
48
|
+
"Bash(npx quack build:*)",
|
|
49
|
+
"Bash(npx quack copy:*)",
|
|
50
|
+
"Bash(mysql:*)",
|
|
51
|
+
"Bash(node:*)",
|
|
52
|
+
"Bash(kill:*)",
|
|
53
|
+
"Bash(wait)",
|
|
54
|
+
"Bash(while read d)",
|
|
55
|
+
"Bash(do echo \"Cleaning: $d\")"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Retold
|
|
2
|
+
|
|
3
|
+
A suite of ~50 JavaScript/Node.js modules for building web applications and APIs. MIT licensed.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
Five module groups, each in `modules/<group>/`:
|
|
8
|
+
|
|
9
|
+
- **Fable** — Core ecosystem: dependency injection (service provider pattern), configuration, logging, UUID generation, expression parser, REST client, template engine
|
|
10
|
+
- **Meadow** — Data access layer: ORM, query DSL (FoxHound), schema definitions (Stricture), DB connectors (MySQL, MSSQL, SQLite), RESTful endpoint generation
|
|
11
|
+
- **Orator** — API server: Restify wrapper, static file serving, HTTP proxy, WebSocket support (Tidings)
|
|
12
|
+
- **Pict** — MVC tools: views, templates, providers, application lifecycle, form builders, TUI grid, CLI utilities
|
|
13
|
+
- **Utility** — Build tools (Quackage), manifest management (Manyfest), documentation (Indoctrinate), process supervision (Ultravisor)
|
|
14
|
+
|
|
15
|
+
## Repository Structure
|
|
16
|
+
|
|
17
|
+
Each module is its own git repo cloned into a category folder under `modules/`. The root repo tracks module organization only — individual module code lives in their own repos.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
retold/
|
|
21
|
+
├── source/Retold.js # Minimal common service class
|
|
22
|
+
├── test/ # Root-level tests
|
|
23
|
+
├── modules/
|
|
24
|
+
│ ├── fable/ # 6 modules
|
|
25
|
+
│ ├── meadow/ # 13 modules
|
|
26
|
+
│ ├── orator/ # 6 modules
|
|
27
|
+
│ ├── pict/ # 15 modules
|
|
28
|
+
│ └── utility/ # 10+ modules
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Code Style
|
|
32
|
+
|
|
33
|
+
- Tabs for indentation, never spaces
|
|
34
|
+
- Plain JavaScript only — no TypeScript
|
|
35
|
+
- Opening braces on new lines (Allman style)
|
|
36
|
+
- Variable naming:
|
|
37
|
+
- `pVariable` — function parameters
|
|
38
|
+
- `tmpVariable` — scoped/temporary variables
|
|
39
|
+
- `VARIABLE` — globals and constants
|
|
40
|
+
- `libSomeLibrary` — imported/required libraries
|
|
41
|
+
- Always follow existing patterns in the module you are editing
|
|
42
|
+
|
|
43
|
+
## Common Commands
|
|
44
|
+
|
|
45
|
+
- `npm test` — Run tests (Mocha, TDD style)
|
|
46
|
+
- `npx quack build` — Build with Quackage
|
|
47
|
+
- `npm run coverage` — Code coverage via nyc/Istanbul
|
|
48
|
+
- `npm run docker-dev-build` / `docker-dev-run` — Docker dev environment (some modules)
|
|
49
|
+
|
|
50
|
+
## Key Services Pattern
|
|
51
|
+
|
|
52
|
+
Modules extend `fable-serviceproviderbase`. Services register with a Fable instance and get access to logging, configuration, and other services through dependency injection. When writing new services, follow this pattern.
|
package/docs/.nojekyll
ADDED
|
File without changes
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Retold
|
|
2
|
+
|
|
3
|
+
> A story-obsessed application suite.
|
|
4
|
+
|
|
5
|
+
Retold is a collection of ~50 JavaScript/Node.js modules for building web applications and APIs. The modules span five groups — from core dependency injection up through data access, API serving, and full MVC — all designed to compose together through a shared service provider pattern.
|
|
6
|
+
|
|
7
|
+
## Architecture at a Glance
|
|
8
|
+
|
|
9
|
+
The modules build on each other in layers. A typical Retold application stacks up like this:
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
block-beta
|
|
13
|
+
columns 4
|
|
14
|
+
|
|
15
|
+
block:app:4
|
|
16
|
+
columns 4
|
|
17
|
+
appLabel["Your Application / Mid-Tier Service"]:4
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
block:server:2
|
|
21
|
+
oratorLabel["Orator\n(API Server)"]
|
|
22
|
+
end
|
|
23
|
+
block:endpoints:2
|
|
24
|
+
endpointLabel["Meadow-Endpoints\n(Auto-generated REST)"]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
block:data:4
|
|
28
|
+
columns 3
|
|
29
|
+
meadowLabel["Meadow (Data Access)"]:3
|
|
30
|
+
foxhound["FoxHound\n(Query DSL)"]
|
|
31
|
+
stricture["Stricture\n(Schema DDL)"]
|
|
32
|
+
connections["Connections\n(MySQL / MSSQL / SQLite)"]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
block:core:4
|
|
36
|
+
columns 4
|
|
37
|
+
fableLabel["Fable (Core Ecosystem)"]:4
|
|
38
|
+
settings["Settings\n(Config)"]
|
|
39
|
+
flog["Log\n(Logging)"]
|
|
40
|
+
uuid["UUID\n(Identity)"]
|
|
41
|
+
spb["Service\nProvider Base"]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
block:infra:4
|
|
45
|
+
columns 3
|
|
46
|
+
config["Config Files"]
|
|
47
|
+
logs["Log Streams"]
|
|
48
|
+
db[("Database")]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
space:4
|
|
52
|
+
|
|
53
|
+
block:pict:4
|
|
54
|
+
columns 4
|
|
55
|
+
pictLabel["Pict (MVC Tools)"]:4
|
|
56
|
+
views["Views"]
|
|
57
|
+
templates["Templates"]
|
|
58
|
+
providers["Providers"]
|
|
59
|
+
appfw["App\nLifecycle"]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
app --> server
|
|
63
|
+
app --> endpoints
|
|
64
|
+
server --> data
|
|
65
|
+
endpoints --> data
|
|
66
|
+
data --> core
|
|
67
|
+
core --> infra
|
|
68
|
+
pict --> core
|
|
69
|
+
|
|
70
|
+
style app fill:#e8f5e9,stroke:#42b983,color:#333
|
|
71
|
+
style server fill:#e3f2fd,stroke:#42a5f5,color:#333
|
|
72
|
+
style endpoints fill:#e3f2fd,stroke:#42a5f5,color:#333
|
|
73
|
+
style data fill:#fff3e0,stroke:#ffa726,color:#333
|
|
74
|
+
style core fill:#fce4ec,stroke:#ef5350,color:#333
|
|
75
|
+
style infra fill:#f5f5f5,stroke:#bdbdbd,color:#333
|
|
76
|
+
style pict fill:#f3e5f5,stroke:#ab47bc,color:#333
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Fable** is the foundation — every other module depends on it for dependency injection, configuration, logging, and UUID generation.
|
|
80
|
+
|
|
81
|
+
**Meadow** provides the data access layer. It uses **FoxHound** to generate SQL queries, **Stricture** to define schemas, and database-specific connection modules to talk to MySQL, MSSQL, or SQLite.
|
|
82
|
+
|
|
83
|
+
**Orator** wraps an HTTP server (Restify) to serve APIs. **Meadow-Endpoints** auto-generates RESTful CRUD routes from Meadow entities.
|
|
84
|
+
|
|
85
|
+
**Pict** provides Model-View-Controller patterns for browser, console, and text-based UIs. It connects to Fable for services and can use Meadow for data.
|
|
86
|
+
|
|
87
|
+
All modules follow the **Fable Service Provider Pattern**: they register with a Fable instance and gain access to logging, configuration, and each other through dependency injection.
|
|
88
|
+
|
|
89
|
+
## Module Groups
|
|
90
|
+
|
|
91
|
+
### [Fable](/fable/fable/) — Core Ecosystem
|
|
92
|
+
|
|
93
|
+
The foundation layer. Dependency injection, configuration, logging, UUID generation, expression parsing, REST client, and template engine.
|
|
94
|
+
|
|
95
|
+
**Key modules:** [fable](/fable/fable/) · [fable-log](/fable/fable-log/) · [fable-settings](/fable/fable-settings/) · [fable-uuid](/fable/fable-uuid/) · [fable-serviceproviderbase](/fable/fable-serviceproviderbase/)
|
|
96
|
+
|
|
97
|
+
### [Meadow](/meadow/meadow/) — Data Access Layer
|
|
98
|
+
|
|
99
|
+
Provider-agnostic data broker with schema management, query generation, and automatic audit tracking.
|
|
100
|
+
|
|
101
|
+
**Key modules:** [meadow](/meadow/meadow/) · [foxhound](/meadow/foxhound/) · [stricture](/meadow/stricture/) · [meadow-endpoints](/meadow/meadow-endpoints/) · [retold-data-service](/meadow/retold-data-service/)
|
|
102
|
+
|
|
103
|
+
### [Orator](/orator/orator/) — API Server
|
|
104
|
+
|
|
105
|
+
Thin HTTP server abstraction with REST and IPC support, static file serving, proxy pass-through, and WebSocket reporting.
|
|
106
|
+
|
|
107
|
+
**Key modules:** [orator](/orator/orator/) · [orator-serviceserver-restify](/orator/orator-serviceserver-restify/) · [orator-static-server](/orator/orator-static-server/)
|
|
108
|
+
|
|
109
|
+
### [Pict](/pict/pict/) — MVC Tools
|
|
110
|
+
|
|
111
|
+
Non-opinionated Model-View-Controller tools for building UIs as text strings — browser, console, or any text-based interface.
|
|
112
|
+
|
|
113
|
+
**Key modules:** [pict](/pict/pict/) · [pict-view](/pict/pict-view/) · [pict-application](/pict/pict-application/) · [pict-section-form](/pict/pict-section-form/)
|
|
114
|
+
|
|
115
|
+
### [Utility](/utility/indoctrinate/) — Build & Documentation Tools
|
|
116
|
+
|
|
117
|
+
Build tooling, manifest management, documentation generation, and process supervision.
|
|
118
|
+
|
|
119
|
+
**Key modules:** [indoctrinate](/utility/indoctrinate/) · [manyfest](/utility/manyfest/) · [quackage](/utility/quackage/) · [ultravisor](/utility/ultravisor/)
|
|
120
|
+
|
|
121
|
+
## Quick Start
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Install the core
|
|
125
|
+
npm install fable
|
|
126
|
+
|
|
127
|
+
# Add data access
|
|
128
|
+
npm install meadow foxhound stricture
|
|
129
|
+
|
|
130
|
+
# Add an API server
|
|
131
|
+
npm install orator orator-serviceserver-restify meadow-endpoints
|
|
132
|
+
|
|
133
|
+
# Add browser MVC
|
|
134
|
+
npm install pict
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
const libFable = require('fable');
|
|
139
|
+
|
|
140
|
+
let _Fable = new libFable({
|
|
141
|
+
Product: 'MyApp',
|
|
142
|
+
ProductVersion: '1.0.0',
|
|
143
|
+
LogLevel: 3
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
_Fable.log.info('Retold application started.');
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Learn More
|
|
150
|
+
|
|
151
|
+
- **[Architecture](architecture.md)** — Detailed layer-by-layer breakdown of the module stack
|
|
152
|
+
- **[Getting Started](getting-started.md)** — Building your first Retold application
|
|
153
|
+
- **[Fable In Depth](fable.md)** — The core ecosystem and service provider pattern
|
|
154
|
+
- **[Meadow In Depth](meadow.md)** — Data access, schemas, and query generation
|
|
155
|
+
- **[Orator In Depth](orator.md)** — API servers and endpoint generation
|
|
156
|
+
- **[Pict In Depth](pict.md)** — MVC tools for browser and console UIs
|
|
157
|
+
- **[All Modules](modules.md)** — Exhaustive list of every Retold repository
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|
package/docs/_sidebar.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
- Getting Started
|
|
2
|
+
|
|
3
|
+
- [Architecture](architecture.md)
|
|
4
|
+
- [Getting Started](getting-started.md)
|
|
5
|
+
- [All Modules](modules.md)
|
|
6
|
+
|
|
7
|
+
- [Fable — Core Ecosystem](fable.md)
|
|
8
|
+
|
|
9
|
+
- [fable](/fable/fable/)
|
|
10
|
+
- [fable-serviceproviderbase](/fable/fable-serviceproviderbase/)
|
|
11
|
+
- [fable-settings](/fable/fable-settings/)
|
|
12
|
+
- [fable-log](/fable/fable-log/)
|
|
13
|
+
- [fable-uuid](/fable/fable-uuid/)
|
|
14
|
+
- [fable-log-logger-bunyan](/fable/fable-log-logger-bunyan/)
|
|
15
|
+
|
|
16
|
+
- [Meadow — Data Access](meadow.md)
|
|
17
|
+
|
|
18
|
+
- [meadow](/meadow/meadow/)
|
|
19
|
+
- [foxhound](/meadow/foxhound/)
|
|
20
|
+
- [stricture](/meadow/stricture/)
|
|
21
|
+
- [meadow-endpoints](/meadow/meadow-endpoints/)
|
|
22
|
+
- [retold-data-service](/meadow/retold-data-service/)
|
|
23
|
+
- [meadow-connection-mysql](/meadow/meadow-connection-mysql/)
|
|
24
|
+
- [meadow-connection-mssql](/meadow/meadow-connection-mssql/)
|
|
25
|
+
- [meadow-connection-sqlite](/meadow/meadow-connection-sqlite/)
|
|
26
|
+
- [retold-harness](/meadow/retold-harness/)
|
|
27
|
+
- [bibliograph](/meadow/bibliograph/)
|
|
28
|
+
- [parime](/meadow/parime/)
|
|
29
|
+
- [meadow-integration](/meadow/meadow-integration/)
|
|
30
|
+
- [meadow-graph-client](/meadow/meadow-graph-client/)
|
|
31
|
+
|
|
32
|
+
- [Orator — API Server](orator.md)
|
|
33
|
+
|
|
34
|
+
- [orator](/orator/orator/)
|
|
35
|
+
- [orator-serviceserver-restify](/orator/orator-serviceserver-restify/)
|
|
36
|
+
- [orator-static-server](/orator/orator-static-server/)
|
|
37
|
+
- [orator-http-proxy](/orator/orator-http-proxy/)
|
|
38
|
+
- [tidings](/orator/tidings/)
|
|
39
|
+
- [orator-endpoint](/orator/orator-endpoint/)
|
|
40
|
+
|
|
41
|
+
- [Pict — MVC Tools](pict.md)
|
|
42
|
+
|
|
43
|
+
- [pict](/pict/pict/)
|
|
44
|
+
- [pict-view](/pict/pict-view/)
|
|
45
|
+
- [pict-template](/pict/pict-template/)
|
|
46
|
+
- [pict-provider](/pict/pict-provider/)
|
|
47
|
+
- [pict-application](/pict/pict-application/)
|
|
48
|
+
- [pict-section-form](/pict/pict-section-form/)
|
|
49
|
+
- [pict-section-recordset](/pict/pict-section-recordset/)
|
|
50
|
+
- [pict-section-tuigrid](/pict/pict-section-tuigrid/)
|
|
51
|
+
- [pict-section-content](/pict/pict-section-content/)
|
|
52
|
+
- [pict-panel](/pict/pict-panel/)
|
|
53
|
+
- [pict-router](/pict/pict-router/)
|
|
54
|
+
- [informary](/pict/informary/)
|
|
55
|
+
- [cryptbrau](/pict/cryptbrau/)
|
|
56
|
+
- [pict-serviceproviderbase](/pict/pict-serviceproviderbase/)
|
|
57
|
+
- [pict-service-commandlineutility](/pict/pict-service-commandlineutility/)
|
|
58
|
+
|
|
59
|
+
- [Utility — Build Tools](utility.md)
|
|
60
|
+
|
|
61
|
+
- [indoctrinate](/utility/indoctrinate/)
|
|
62
|
+
- [manyfest](/utility/manyfest/)
|
|
63
|
+
- [quackage](/utility/quackage/)
|
|
64
|
+
- [choreographic](/utility/choreographic/)
|
|
65
|
+
- [ultravisor](/utility/ultravisor/)
|
package/docs/_topbar.md
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
Retold modules are designed to compose into layered application stacks. Each layer builds on the one below it through the Fable service provider pattern.
|
|
4
|
+
|
|
5
|
+
## The Layer Model
|
|
6
|
+
|
|
7
|
+
A fully-realized Retold application assembles five layers, from infrastructure at the bottom to your application logic at the top.
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
graph TB
|
|
11
|
+
L5["<b>Layer 5</b> — Your Application / Mid-Tier Service<br/><i>Authentication, business logic, custom endpoints</i>"]
|
|
12
|
+
L4["<b>Layer 4</b> — Orator (API Server)<br/><i>HTTP lifecycle, middleware, static files, proxy</i>"]
|
|
13
|
+
L3["<b>Layer 3</b> — Meadow-Endpoints<br/><i>Auto-generated CRUD routes, behavior hooks</i>"]
|
|
14
|
+
L2["<b>Layer 2</b> — Meadow + FoxHound + Stricture<br/><i>Data broker, SQL generation, schema definitions</i>"]
|
|
15
|
+
L1["<b>Layer 1</b> — Fable (Core Ecosystem)<br/><i>DI, configuration, logging, UUID, expressions</i>"]
|
|
16
|
+
Infra["<b>Infrastructure</b><br/><i>Config files, log streams, databases, filesystem</i>"]
|
|
17
|
+
|
|
18
|
+
L5 --> L4
|
|
19
|
+
L4 --> L3
|
|
20
|
+
L3 --> L2
|
|
21
|
+
L2 --> L1
|
|
22
|
+
L1 --> Infra
|
|
23
|
+
|
|
24
|
+
style L5 fill:#e8f5e9,stroke:#43a047,color:#333
|
|
25
|
+
style L4 fill:#e3f2fd,stroke:#42a5f5,color:#333
|
|
26
|
+
style L3 fill:#e3f2fd,stroke:#64b5f6,color:#333
|
|
27
|
+
style L2 fill:#fff3e0,stroke:#ffa726,color:#333
|
|
28
|
+
style L1 fill:#fce4ec,stroke:#ef5350,color:#333
|
|
29
|
+
style Infra fill:#f5f5f5,stroke:#bdbdbd,color:#333
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Not every application uses every layer. A browser app might use Fable + Pict. A CLI tool might use Fable + Meadow. A full API service uses the complete stack.
|
|
33
|
+
|
|
34
|
+
## The Service Provider Pattern
|
|
35
|
+
|
|
36
|
+
Every Retold module extends `fable-serviceproviderbase`. This base class provides:
|
|
37
|
+
|
|
38
|
+
- **Registration** — Services register with a Fable instance by type and hash
|
|
39
|
+
- **Dependency access** — Any service can reach any other through `this.fable`
|
|
40
|
+
- **Logging** — Built-in `this.log` from Fable-Log
|
|
41
|
+
- **Configuration** — Shared settings through `this.fable.settings`
|
|
42
|
+
- **Identity** — UUID generation through `this.fable.getUUID()`
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
const libFable = require('fable');
|
|
46
|
+
const libMeadow = require('meadow');
|
|
47
|
+
const libOrator = require('orator');
|
|
48
|
+
|
|
49
|
+
let _Fable = new libFable({ Product: 'MyApp', LogLevel: 3 });
|
|
50
|
+
|
|
51
|
+
// Services register themselves with the Fable instance
|
|
52
|
+
let _Meadow = _Fable.instantiateServiceProvider('Meadow');
|
|
53
|
+
let _Orator = _Fable.instantiateServiceProvider('Orator');
|
|
54
|
+
|
|
55
|
+
// Now every service can reach every other service
|
|
56
|
+
// _Meadow.fable.Orator, _Orator.fable.Meadow, etc.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This pattern means modules are loosely coupled. You can swap database providers, change API server implementations, or add custom services without modifying existing code.
|
|
60
|
+
|
|
61
|
+
## Layer 1: Fable — The Foundation
|
|
62
|
+
|
|
63
|
+
Fable is the only module that every other module depends on. It provides the core services that all other modules consume.
|
|
64
|
+
|
|
65
|
+
```mermaid
|
|
66
|
+
graph TB
|
|
67
|
+
subgraph Fable["Fable (Core Ecosystem)"]
|
|
68
|
+
direction TB
|
|
69
|
+
settings["Fable-Settings<br/><code>.settings</code>"]
|
|
70
|
+
flog["Fable-Log<br/><code>.log</code>"]
|
|
71
|
+
uuid["Fable-UUID<br/><code>.getUUID()</code>"]
|
|
72
|
+
spb["Service<br/>Provider Base"]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
settings --> configfiles["Config Files<br/>(.json, env)"]
|
|
76
|
+
flog --> logstreams["Log Streams<br/>(console, file, bunyan)"]
|
|
77
|
+
|
|
78
|
+
style Fable fill:#fce4ec,stroke:#ef5350,color:#333
|
|
79
|
+
style settings fill:#fff,stroke:#ef9a9a,color:#333
|
|
80
|
+
style flog fill:#fff,stroke:#ef9a9a,color:#333
|
|
81
|
+
style uuid fill:#fff,stroke:#ef9a9a,color:#333
|
|
82
|
+
style spb fill:#fff,stroke:#ef9a9a,color:#333
|
|
83
|
+
style configfiles fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
84
|
+
style logstreams fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Fable-Settings** loads and merges configuration from files, defaults, and runtime overrides into a single settings object.
|
|
88
|
+
|
|
89
|
+
**Fable-Log** provides six log levels (trace, debug, info, warn, error, fatal) with extensible output streams. Logs go to console by default; add bunyan or custom loggers as needed.
|
|
90
|
+
|
|
91
|
+
**Fable-UUID** generates RFC 4122 v4 UUIDs or configurable random strings for identity and uniqueness.
|
|
92
|
+
|
|
93
|
+
**Fable-ServiceProviderBase** is the base class all Retold services extend. It provides the registration and dependency injection mechanics.
|
|
94
|
+
|
|
95
|
+
Fable also bundles an expression parser, a REST client (Fable-RestClient), a template engine, date utilities, and data format helpers — all accessible as services.
|
|
96
|
+
|
|
97
|
+
## Layer 2: Meadow — Data Access
|
|
98
|
+
|
|
99
|
+
Meadow sits on top of Fable and provides a provider-agnostic data broker. You define entities once and access them through any supported database.
|
|
100
|
+
|
|
101
|
+
```mermaid
|
|
102
|
+
graph TB
|
|
103
|
+
subgraph Meadow["Meadow (Data Broker / ORM)"]
|
|
104
|
+
direction TB
|
|
105
|
+
foxhound["FoxHound<br/>(Query DSL)<br/><code>.addFilter() .setSort() .buildRead()</code>"]
|
|
106
|
+
stricture["Stricture<br/>(Schema DDL)<br/>JSON schema, CREATE TABLE, docs"]
|
|
107
|
+
conn["Connections<br/>meadow-connection-mysql<br/>meadow-connection-mssql<br/>meadow-connection-sqlite"]
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
foxhound --> sql["SQL Queries<br/>(MySQL, MSSQL, SQLite, ALASQL)"]
|
|
111
|
+
stricture --> ddl["DDL Scripts<br/>(CREATE TABLE, indexes)"]
|
|
112
|
+
conn --> db[("Database<br/>(pooled connections)")]
|
|
113
|
+
|
|
114
|
+
style Meadow fill:#fff3e0,stroke:#ffa726,color:#333
|
|
115
|
+
style foxhound fill:#fff,stroke:#ffcc80,color:#333
|
|
116
|
+
style stricture fill:#fff,stroke:#ffcc80,color:#333
|
|
117
|
+
style conn fill:#fff,stroke:#ffcc80,color:#333
|
|
118
|
+
style sql fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
119
|
+
style ddl fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
120
|
+
style db fill:#ffebee,stroke:#ef5350,color:#333
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Meadow** handles CRUD operations (Create, Read, Reads, Update, Delete, Count, Undelete), automatic audit columns (CreatingIDUser, UpdatingIDUser, timestamps), soft deletes, GUID uniqueness, and data marshalling.
|
|
124
|
+
|
|
125
|
+
**FoxHound** generates dialect-specific SQL from a single chainable API. One query definition produces correct SQL for MySQL, MSSQL, SQLite, or ALASQL (for in-browser use).
|
|
126
|
+
|
|
127
|
+
**Stricture** is an opinionated MicroDDL — define your data model in a simple text format and generate JSON schemas, MySQL CREATE statements, Meadow schema files, and documentation from a single source.
|
|
128
|
+
|
|
129
|
+
**Connection modules** (meadow-connection-mysql, meadow-connection-mssql, meadow-connection-sqlite) provide pooled database connections as Fable services.
|
|
130
|
+
|
|
131
|
+
## Layer 3: Meadow-Endpoints — Auto-Generated API
|
|
132
|
+
|
|
133
|
+
Meadow-Endpoints takes a Meadow entity definition and automatically generates a full suite of RESTful routes.
|
|
134
|
+
|
|
135
|
+
```mermaid
|
|
136
|
+
graph LR
|
|
137
|
+
entity["Meadow Entity<br/><b>Book</b>"] --> endpoints["<b>Meadow-Endpoints</b>"]
|
|
138
|
+
|
|
139
|
+
endpoints --> r1["GET /Books → Reads"]
|
|
140
|
+
endpoints --> r2["GET /Books/Count → Count"]
|
|
141
|
+
endpoints --> r3["GET /Book/:id → Read"]
|
|
142
|
+
endpoints --> r4["GET /Book/Schema → Schema"]
|
|
143
|
+
endpoints --> r5["POST /Book → Create"]
|
|
144
|
+
endpoints --> r6["PUT /Book → Update"]
|
|
145
|
+
endpoints --> r7["DEL /Book/:id → Delete"]
|
|
146
|
+
endpoints --> r8["DEL /Book/:id/Undelete"]
|
|
147
|
+
|
|
148
|
+
entity --> hooks["+ Behavior injection hooks<br/>+ Dynamic filtering & pagination<br/>+ Bulk operations"]
|
|
149
|
+
|
|
150
|
+
style entity fill:#fff3e0,stroke:#ffa726,color:#333
|
|
151
|
+
style endpoints fill:#e3f2fd,stroke:#42a5f5,color:#333
|
|
152
|
+
style hooks fill:#f3e5f5,stroke:#ab47bc,color:#333
|
|
153
|
+
style r1 fill:#fff,stroke:#90caf9,color:#333
|
|
154
|
+
style r2 fill:#fff,stroke:#90caf9,color:#333
|
|
155
|
+
style r3 fill:#fff,stroke:#90caf9,color:#333
|
|
156
|
+
style r4 fill:#fff,stroke:#90caf9,color:#333
|
|
157
|
+
style r5 fill:#fff,stroke:#90caf9,color:#333
|
|
158
|
+
style r6 fill:#fff,stroke:#90caf9,color:#333
|
|
159
|
+
style r7 fill:#fff,stroke:#90caf9,color:#333
|
|
160
|
+
style r8 fill:#fff,stroke:#90caf9,color:#333
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Behavior hooks let you inject authentication, authorization, validation, and transformation logic at any point in the request lifecycle — before or after each CRUD operation.
|
|
164
|
+
|
|
165
|
+
## Layer 4: Orator — API Server
|
|
166
|
+
|
|
167
|
+
Orator provides the HTTP server that hosts the endpoints from Layer 3 (and any custom routes).
|
|
168
|
+
|
|
169
|
+
```mermaid
|
|
170
|
+
graph TB
|
|
171
|
+
subgraph Orator["Orator (HTTP Server Abstraction)"]
|
|
172
|
+
direction TB
|
|
173
|
+
restify["orator-serviceserver-restify<br/>(Production HTTP)"]
|
|
174
|
+
static["orator-static-server<br/>(File Serving)"]
|
|
175
|
+
restify --> core["Orator Core<br/>Lifecycle hooks, middleware,<br/>content negotiation, IPC mode"]
|
|
176
|
+
static --> core
|
|
177
|
+
proxy["orator-http-proxy<br/>(Reverse Proxy)"]
|
|
178
|
+
tidings["Tidings<br/>(Reporting)"]
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
style Orator fill:#e3f2fd,stroke:#42a5f5,color:#333
|
|
182
|
+
style restify fill:#fff,stroke:#90caf9,color:#333
|
|
183
|
+
style static fill:#fff,stroke:#90caf9,color:#333
|
|
184
|
+
style core fill:#bbdefb,stroke:#42a5f5,color:#333
|
|
185
|
+
style proxy fill:#fff,stroke:#90caf9,color:#333
|
|
186
|
+
style tidings fill:#fff,stroke:#90caf9,color:#333
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Orator is deliberately thin. It provides a consistent interface regardless of the underlying server, so you can swap Restify for another implementation or use IPC mode for testing — without changing your application code.
|
|
190
|
+
|
|
191
|
+
## Pict — MVC Tools
|
|
192
|
+
|
|
193
|
+
Pict sits alongside the server stack, providing Model-View-Controller tools for any text-based UI: browser DOM, terminal, or rendered strings.
|
|
194
|
+
|
|
195
|
+
```mermaid
|
|
196
|
+
graph TB
|
|
197
|
+
subgraph Pict["Pict (Non-Opinionated MVC)"]
|
|
198
|
+
direction TB
|
|
199
|
+
subgraph Core["Core"]
|
|
200
|
+
views["Views<br/><i>pict-view</i>"]
|
|
201
|
+
templates["Templates<br/><i>pict-template</i>"]
|
|
202
|
+
providers["Providers<br/><i>pict-provider</i>"]
|
|
203
|
+
appfw["Application<br/><i>pict-application</i>"]
|
|
204
|
+
end
|
|
205
|
+
subgraph Sections["Sections & Components"]
|
|
206
|
+
forms["Forms<br/><i>pict-section-form</i>"]
|
|
207
|
+
recordset["Recordset<br/><i>pict-section-recordset</i>"]
|
|
208
|
+
tuigrid["TUI Grid<br/><i>pict-section-tuigrid</i>"]
|
|
209
|
+
content["Content<br/><i>pict-section-content</i>"]
|
|
210
|
+
end
|
|
211
|
+
Core --> Sections
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
style Pict fill:#f3e5f5,stroke:#ab47bc,color:#333
|
|
215
|
+
style Core fill:#f3e5f5,stroke:#ce93d8,color:#333
|
|
216
|
+
style Sections fill:#f3e5f5,stroke:#ce93d8,color:#333
|
|
217
|
+
style views fill:#fff,stroke:#ce93d8,color:#333
|
|
218
|
+
style templates fill:#fff,stroke:#ce93d8,color:#333
|
|
219
|
+
style providers fill:#fff,stroke:#ce93d8,color:#333
|
|
220
|
+
style appfw fill:#fff,stroke:#ce93d8,color:#333
|
|
221
|
+
style forms fill:#fff,stroke:#ce93d8,color:#333
|
|
222
|
+
style recordset fill:#fff,stroke:#ce93d8,color:#333
|
|
223
|
+
style tuigrid fill:#fff,stroke:#ce93d8,color:#333
|
|
224
|
+
style content fill:#fff,stroke:#ce93d8,color:#333
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Pict's core philosophy: UI is text. Views render templates into strings. Providers fetch data. The Application class coordinates lifecycle. Sections provide pre-built patterns for common UI needs (forms, record lists, grids).
|
|
228
|
+
|
|
229
|
+
Pict connects to Fable for services and can use Meadow-Endpoints as its data source, but it has no hard dependency on the server stack.
|
|
230
|
+
|
|
231
|
+
## Putting It All Together
|
|
232
|
+
|
|
233
|
+
A full Retold application combines these layers. Here is the typical assembly order from the whiteboard architecture diagram:
|
|
234
|
+
|
|
235
|
+
```mermaid
|
|
236
|
+
graph LR
|
|
237
|
+
S1["<b>Step 1</b><br/>Fable<br/><i>Config, logging, DI</i>"]
|
|
238
|
+
S2["<b>Step 2</b><br/>Meadow<br/><i>Entities, DB connection</i>"]
|
|
239
|
+
S3["<b>Step 3</b><br/>Meadow-Endpoints<br/><i>Auto-generate REST</i>"]
|
|
240
|
+
S4["<b>Step 4</b><br/>Orator<br/><i>HTTP server</i>"]
|
|
241
|
+
S5["<b>Step 5</b><br/>Your Application<br/><i>Mid-tier service</i>"]
|
|
242
|
+
|
|
243
|
+
S1 --> S2 --> S3 --> S4 --> S5
|
|
244
|
+
|
|
245
|
+
style S1 fill:#fce4ec,stroke:#ef5350,color:#333
|
|
246
|
+
style S2 fill:#fff3e0,stroke:#ffa726,color:#333
|
|
247
|
+
style S3 fill:#fff3e0,stroke:#ffcc80,color:#333
|
|
248
|
+
style S4 fill:#e3f2fd,stroke:#42a5f5,color:#333
|
|
249
|
+
style S5 fill:#e8f5e9,stroke:#43a047,color:#333
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
const libFable = require('fable');
|
|
254
|
+
const libOrator = require('orator');
|
|
255
|
+
const libMeadowEndpoints = require('meadow-endpoints');
|
|
256
|
+
|
|
257
|
+
let _Fable = new libFable({
|
|
258
|
+
Product: 'BookService',
|
|
259
|
+
LogLevel: 3,
|
|
260
|
+
"MySQL": { "Server": "localhost", "User": "root", "Database": "bookstore" }
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// Layer 2: Data access
|
|
264
|
+
let _MeadowEntity = _Fable.instantiateServiceProvider('Meadow',
|
|
265
|
+
{ Scope: 'Book', DefaultSchema: BookSchema });
|
|
266
|
+
|
|
267
|
+
// Layer 3: Auto-generate REST endpoints
|
|
268
|
+
let _Endpoints = _Fable.instantiateServiceProvider('MeadowEndpoints',
|
|
269
|
+
{ Entity: _MeadowEntity });
|
|
270
|
+
|
|
271
|
+
// Layer 4: HTTP server
|
|
272
|
+
let _Orator = _Fable.instantiateServiceProvider('Orator');
|
|
273
|
+
|
|
274
|
+
// Wire endpoints to the server
|
|
275
|
+
_Endpoints.connectRoutes(_Orator);
|
|
276
|
+
|
|
277
|
+
// Start listening
|
|
278
|
+
_Orator.startService((pError) =>
|
|
279
|
+
{
|
|
280
|
+
_Fable.log.info('BookService is running on port 8086');
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Utility Modules
|
|
285
|
+
|
|
286
|
+
Supporting the application stack are utility modules:
|
|
287
|
+
|
|
288
|
+
| Module | Purpose |
|
|
289
|
+
|--------|---------|
|
|
290
|
+
| **[Manyfest](/utility/manyfest/)** | JSON manifest for consistent data description across layers |
|
|
291
|
+
| **[Quackage](/utility/quackage/)** | Standardized build tool for browser bundles, testing, and packaging |
|
|
292
|
+
| **[Indoctrinate](/utility/indoctrinate/)** | Documentation scaffolding, catalog generation, and cross-module search |
|
|
293
|
+
| **[Ultravisor](/utility/ultravisor/)** | Process supervision with scheduled tasks and LLM integration |
|
|
294
|
+
| **[Choreographic](/utility/choreographic/)** | Scaffolding for single-run data processing scripts |
|
|
295
|
+
|
|
296
|
+
## Design Principles
|
|
297
|
+
|
|
298
|
+
### Convention Over Configuration
|
|
299
|
+
|
|
300
|
+
Modules generate rich metadata automatically. A Meadow entity with a well-named schema and standard columns needs zero additional configuration to get a full REST API.
|
|
301
|
+
|
|
302
|
+
### Provider Agnostic
|
|
303
|
+
|
|
304
|
+
Data access, server implementations, and log destinations are all pluggable. Swap MySQL for SQLite, Restify for IPC, or console logging for Bunyan — without changing application code.
|
|
305
|
+
|
|
306
|
+
### Composable, Not Monolithic
|
|
307
|
+
|
|
308
|
+
Each module does one thing. Combine the modules you need; skip the rest. A CLI tool does not need Orator. A browser widget does not need Meadow.
|
|
309
|
+
|
|
310
|
+
### Everything is a Service
|
|
311
|
+
|
|
312
|
+
The service provider pattern means modules discover and use each other through dependency injection. No global state, no singletons, no import ordering problems.
|
package/docs/cover.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Retold
|
|
2
|
+
|
|
3
|
+
> A story-obsessed application suite
|
|
4
|
+
|
|
5
|
+
~50 JavaScript/Node.js modules for building web applications and APIs. Service provider pattern from foundation to full-stack.
|
|
6
|
+
|
|
7
|
+
- **Fable** — Core ecosystem, DI, config, logging
|
|
8
|
+
- **Meadow** — Data access, ORM, query DSL, schema
|
|
9
|
+
- **Orator** — API server, HTTP, proxy, static files
|
|
10
|
+
- **Pict** — MVC tools, views, templates, forms
|
|
11
|
+
|
|
12
|
+
[Get Started](getting-started.md)
|
|
13
|
+
[Architecture](architecture.md)
|
|
14
|
+
[All Modules](modules.md)
|
|
15
|
+
[GitHub](https://github.com/stevenvelozo/retold)
|