retold 1.0.6 → 4.0.2
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 +84 -0
- package/CLAUDE.md +52 -0
- package/docs/.nojekyll +0 -0
- package/docs/README.md +162 -0
- package/docs/_sidebar.md +78 -0
- package/docs/_topbar.md +6 -0
- package/docs/architecture/architecture.md +312 -0
- package/docs/architecture/module-architecture.md +234 -0
- package/docs/architecture/modules.md +99 -0
- package/docs/cover.md +15 -0
- package/docs/css/docuserve.css +73 -0
- package/docs/examples/examples.md +71 -0
- package/docs/examples/todolist/todo-list-cli-client.md +178 -0
- package/docs/examples/todolist/todo-list-console-client.md +152 -0
- package/docs/examples/todolist/todo-list-model.md +114 -0
- package/docs/examples/todolist/todo-list-server.md +128 -0
- package/docs/examples/todolist/todo-list-web-client.md +177 -0
- package/docs/examples/todolist/todo-list.md +162 -0
- package/docs/getting-started.md +273 -0
- package/docs/index.html +39 -0
- package/docs/modules/fable.md +198 -0
- package/docs/modules/meadow.md +209 -0
- package/docs/modules/orator.md +165 -0
- package/docs/modules/pict.md +235 -0
- package/docs/modules/utility.md +54 -0
- package/docs/retold-building-documentation.md +33 -0
- package/docs/retold-catalog.json +1405 -0
- package/docs/retold-keyword-index.json +203389 -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/examples/todo-list/Dockerfile +45 -0
- package/examples/todo-list/README.md +394 -0
- package/examples/todo-list/cli-client/package-lock.json +418 -0
- package/examples/todo-list/cli-client/package.json +19 -0
- package/examples/todo-list/cli-client/source/TodoCLI-CLIProgram.js +30 -0
- package/examples/todo-list/cli-client/source/TodoCLI-Run.js +3 -0
- package/examples/todo-list/cli-client/source/commands/add/TodoCLI-Command-Add.js +74 -0
- package/examples/todo-list/cli-client/source/commands/complete/TodoCLI-Command-Complete.js +84 -0
- package/examples/todo-list/cli-client/source/commands/list/TodoCLI-Command-List.js +110 -0
- package/examples/todo-list/cli-client/source/commands/remove/TodoCLI-Command-Remove.js +49 -0
- package/examples/todo-list/cli-client/source/services/TodoCLI-Service-API.js +92 -0
- package/examples/todo-list/console-client/console-client.cjs +913 -0
- package/examples/todo-list/console-client/package-lock.json +426 -0
- package/examples/todo-list/console-client/package.json +19 -0
- package/examples/todo-list/console-client/views/PictView-TUI-Header.cjs +43 -0
- package/examples/todo-list/console-client/views/PictView-TUI-Layout.cjs +58 -0
- package/examples/todo-list/console-client/views/PictView-TUI-StatusBar.cjs +41 -0
- package/examples/todo-list/console-client/views/PictView-TUI-TaskList.cjs +104 -0
- package/examples/todo-list/docker-motd.sh +36 -0
- package/examples/todo-list/docker-run.sh +2 -0
- package/examples/todo-list/docker-shell.sh +2 -0
- package/examples/todo-list/model/MeadowSchema-Task.json +152 -0
- package/examples/todo-list/model/Task-Compiled.json +25 -0
- package/examples/todo-list/model/Task.mddl +15 -0
- package/examples/todo-list/model/data/seeded_todo_events.csv +1001 -0
- package/examples/todo-list/server/database-initialization-service.cjs +273 -0
- package/examples/todo-list/server/package-lock.json +6113 -0
- package/examples/todo-list/server/package.json +19 -0
- package/examples/todo-list/server/server.cjs +138 -0
- package/examples/todo-list/web-client/css/todolist-theme.css +235 -0
- package/examples/todo-list/web-client/generate-build-config.cjs +18 -0
- package/examples/todo-list/web-client/html/index.html +18 -0
- package/examples/todo-list/web-client/package-lock.json +12030 -0
- package/examples/todo-list/web-client/package.json +43 -0
- package/examples/todo-list/web-client/source/TodoList-Application-Config.json +12 -0
- package/examples/todo-list/web-client/source/TodoList-Application.cjs +383 -0
- package/examples/todo-list/web-client/source/providers/Provider-TaskData.cjs +243 -0
- package/examples/todo-list/web-client/source/providers/Router-Config.json +32 -0
- package/examples/todo-list/web-client/source/views/View-Layout.cjs +75 -0
- package/examples/todo-list/web-client/source/views/View-TaskForm.cjs +87 -0
- package/examples/todo-list/web-client/source/views/View-TaskList.cjs +127 -0
- package/examples/todo-list/web-client/source/views/calendar/View-MonthView.cjs +293 -0
- package/examples/todo-list/web-client/source/views/calendar/View-WeekView.cjs +149 -0
- package/examples/todo-list/web-client/source/views/calendar/View-YearView.cjs +226 -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,209 @@
|
|
|
1
|
+
# Meadow — Data Access Layer
|
|
2
|
+
|
|
3
|
+
Meadow provides provider-agnostic data access for Retold applications. Define your entities once, and Meadow handles CRUD operations, query generation, schema management, and audit tracking across MySQL, MSSQL, SQLite, or in-browser ALASQL.
|
|
4
|
+
|
|
5
|
+
## How the Pieces Fit
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
graph LR
|
|
9
|
+
app["Application Code"] --> meadow["Meadow<br/>(ORM)"]
|
|
10
|
+
meadow --> foxhound["FoxHound<br/>(Query DSL)"]
|
|
11
|
+
foxhound --> conn["Connection<br/>(mysql/mssql/sqlite)"]
|
|
12
|
+
conn --> db[("Database")]
|
|
13
|
+
meadow --> stricture["Stricture<br/>(Schema)"]
|
|
14
|
+
stricture --> output["JSON Schema<br/>DDL<br/>Documentation"]
|
|
15
|
+
|
|
16
|
+
style app fill:#e8f5e9,stroke:#43a047,color:#333
|
|
17
|
+
style meadow fill:#fff3e0,stroke:#ffa726,color:#333
|
|
18
|
+
style foxhound fill:#fff3e0,stroke:#ffcc80,color:#333
|
|
19
|
+
style conn fill:#fff3e0,stroke:#ffcc80,color:#333
|
|
20
|
+
style stricture fill:#fff3e0,stroke:#ffcc80,color:#333
|
|
21
|
+
style db fill:#ffebee,stroke:#ef5350,color:#333
|
|
22
|
+
style output fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Meadow** is the data broker — it exposes CRUD methods, handles audit columns, and delegates query building and execution to FoxHound and the connection provider.
|
|
26
|
+
|
|
27
|
+
**FoxHound** generates SQL from a fluent API. Write one query definition; get correct SQL for any supported dialect.
|
|
28
|
+
|
|
29
|
+
**Stricture** defines schemas in a simple MicroDDL format and generates JSON, SQL DDL, documentation, and Meadow schema files from a single source of truth.
|
|
30
|
+
|
|
31
|
+
## Core Modules
|
|
32
|
+
|
|
33
|
+
### [Meadow](/meadow/meadow/)
|
|
34
|
+
|
|
35
|
+
The central data broker. Each Meadow instance represents one data entity (table).
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
const libFable = require('fable');
|
|
39
|
+
const libMeadow = require('meadow');
|
|
40
|
+
|
|
41
|
+
let _Fable = new libFable({
|
|
42
|
+
Product: 'BookStore',
|
|
43
|
+
MySQL: { Server: 'localhost', User: 'root', Database: 'bookstore' }
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
let _BookMeadow = _Fable.instantiateServiceProvider('Meadow',
|
|
47
|
+
{
|
|
48
|
+
Scope: 'Book',
|
|
49
|
+
DefaultSchema: require('./Book-Schema.json')
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Built-in operations:**
|
|
54
|
+
|
|
55
|
+
| Operation | Method | Description |
|
|
56
|
+
|-----------|--------|-------------|
|
|
57
|
+
| Create | `.doCreate(record, callback)` | Insert a new record |
|
|
58
|
+
| Read | `.doRead(id, callback)` | Get one record by ID |
|
|
59
|
+
| Reads | `.doReads(query, callback)` | Get multiple records with filtering |
|
|
60
|
+
| Update | `.doUpdate(record, callback)` | Update an existing record |
|
|
61
|
+
| Delete | `.doDelete(id, callback)` | Soft-delete a record |
|
|
62
|
+
| Undelete | `.doUndelete(id, callback)` | Restore a soft-deleted record |
|
|
63
|
+
| Count | `.doCount(query, callback)` | Count matching records |
|
|
64
|
+
|
|
65
|
+
**Automatic features:** audit columns (CreatingIDUser, UpdatingIDUser, CreateDate, UpdateDate), soft deletes (Deleted flag + DeleteDate), GUID uniqueness (GUIDBook column), and data marshalling.
|
|
66
|
+
|
|
67
|
+
**npm:** `meadow` · **Version:** 2.0.x
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### [FoxHound](/meadow/foxhound/)
|
|
72
|
+
|
|
73
|
+
A fluent query DSL that generates dialect-specific SQL.
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
let tmpQuery = _Fable.instantiateServiceProvider('FoxHound')
|
|
77
|
+
.setScope('Book')
|
|
78
|
+
.addFilter('Author', 'Tolkien')
|
|
79
|
+
.addFilter('YearPublished', '1954', '>=')
|
|
80
|
+
.setSort('Title')
|
|
81
|
+
.setBegin(0).setCap(10)
|
|
82
|
+
.buildReadQuery();
|
|
83
|
+
|
|
84
|
+
// MySQL: SELECT * FROM Book WHERE Author = 'Tolkien'
|
|
85
|
+
// AND YearPublished >= '1954' ORDER BY Title LIMIT 0,10
|
|
86
|
+
// MSSQL: SELECT TOP 10 * FROM Book WHERE Author = 'Tolkien' ...
|
|
87
|
+
// SQLite: SELECT * FROM Book WHERE Author = 'Tolkien' ... LIMIT 10 OFFSET 0
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Supported dialects:** MySQL, MSSQL, SQLite, ALASQL (in-browser)
|
|
91
|
+
|
|
92
|
+
**Operations:** Create, Read, Update, Delete, Count — each generates the correct SQL for the configured dialect with parameterized queries to prevent injection.
|
|
93
|
+
|
|
94
|
+
**npm:** `foxhound` · **Version:** 2.0.x
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### [Stricture](/meadow/stricture/)
|
|
99
|
+
|
|
100
|
+
A MicroDDL for rapid data model definition.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
# Book entity
|
|
104
|
+
Book
|
|
105
|
+
IDBook | int | identity | primary
|
|
106
|
+
GUIDBook | guid | unique
|
|
107
|
+
Title | string(200)
|
|
108
|
+
Author | string(200)
|
|
109
|
+
YearPublished | int
|
|
110
|
+
ISBN | string(20)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
From this definition, Stricture generates:
|
|
114
|
+
|
|
115
|
+
- **JSON schema** — For Meadow entity configuration
|
|
116
|
+
- **MySQL CREATE TABLE** — Database DDL with indexes
|
|
117
|
+
- **Meadow schema** — Column definitions for the data broker
|
|
118
|
+
- **Documentation** — Human-readable data model docs
|
|
119
|
+
|
|
120
|
+
**npm:** `stricture` · **Version:** 1.0.x
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### [Meadow-Endpoints](/meadow/meadow-endpoints/)
|
|
125
|
+
|
|
126
|
+
Auto-generates a full REST API from a Meadow entity. Given a "Book" entity, you get:
|
|
127
|
+
|
|
128
|
+
| Route | Method | Operation |
|
|
129
|
+
|-------|--------|-----------|
|
|
130
|
+
| `GET /Books` | Reads | List with filtering and pagination |
|
|
131
|
+
| `GET /Books/Count` | Count | Record count |
|
|
132
|
+
| `GET /Book/:id` | Read | Single record by ID |
|
|
133
|
+
| `GET /Book/Schema` | Schema | Entity schema definition |
|
|
134
|
+
| `POST /Book` | Create | Insert new record |
|
|
135
|
+
| `PUT /Book` | Update | Modify existing record |
|
|
136
|
+
| `DEL /Book/:id` | Delete | Soft-delete record |
|
|
137
|
+
| `DEL /Book/:id/Undelete` | Undelete | Restore record |
|
|
138
|
+
|
|
139
|
+
**Behavior injection** lets you add hooks at any lifecycle point:
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
_Endpoints.BehaviorModifications.setBehavior('Read-Authorize',
|
|
143
|
+
function(pRequest, fCallback)
|
|
144
|
+
{
|
|
145
|
+
// Check permissions before allowing the read
|
|
146
|
+
if (!pRequest.UserSession.authenticated)
|
|
147
|
+
{
|
|
148
|
+
pRequest.CommonServices.log.warn('Unauthorized access attempt');
|
|
149
|
+
return fCallback('Unauthorized');
|
|
150
|
+
}
|
|
151
|
+
return fCallback();
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**npm:** `meadow-endpoints` · **Version:** 4.0.x
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### [Retold-Data-Service](/meadow/retold-data-service/)
|
|
160
|
+
|
|
161
|
+
An all-in-one Fable service that assembles a Stricture schema into a complete REST API — Meadow entity, endpoints, and connection — in a single service instantiation.
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
let _BookService = _Fable.instantiateServiceProvider('RetoldDataService',
|
|
165
|
+
{
|
|
166
|
+
Scope: 'Book',
|
|
167
|
+
Schema: BookSchema
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// That's it — full CRUD REST API is ready to be wired to Orator
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**npm:** `retold-data-service` · **Version:** 2.0.x
|
|
174
|
+
|
|
175
|
+
## Connection Modules
|
|
176
|
+
|
|
177
|
+
| Module | Database | npm |
|
|
178
|
+
|--------|----------|-----|
|
|
179
|
+
| [meadow-connection-mysql](/meadow/meadow-connection-mysql/) | MySQL / MariaDB | `meadow-connection-mysql` |
|
|
180
|
+
| [meadow-connection-mssql](/meadow/meadow-connection-mssql/) | Microsoft SQL Server | `meadow-connection-mssql` |
|
|
181
|
+
| [meadow-connection-sqlite](/meadow/meadow-connection-sqlite/) | SQLite (via better-sqlite3) | `meadow-connection-sqlite` |
|
|
182
|
+
|
|
183
|
+
Each connection module provides a pooled database connection as a Fable service. Swap between databases by changing which connection module you install — no application code changes needed.
|
|
184
|
+
|
|
185
|
+
## Supporting Modules
|
|
186
|
+
|
|
187
|
+
| Module | Purpose | npm |
|
|
188
|
+
|--------|---------|-----|
|
|
189
|
+
| [bibliograph](/meadow/bibliograph/) | Key-value record comprehension for change tracking in ingestion pipelines | `bibliograph` |
|
|
190
|
+
| [parime](/meadow/parime/) | Generic data lake behaviors and services | `parime` |
|
|
191
|
+
| [retold-harness](/meadow/retold-harness/) | Pre-built API harness with a bookstore demo (8 entities, 10,000+ records) | `retold-harness` |
|
|
192
|
+
| [meadow-integration](/meadow/meadow-integration/) | Data integration tools for CSV import and schema mapping | `meadow-integration` |
|
|
193
|
+
|
|
194
|
+
## All Meadow Modules
|
|
195
|
+
|
|
196
|
+
| Module | Description |
|
|
197
|
+
|--------|-------------|
|
|
198
|
+
| [stricture](/meadow/stricture/) | MicroDDL schema definition and code generation |
|
|
199
|
+
| [foxhound](/meadow/foxhound/) | Fluent query DSL with multi-dialect SQL generation |
|
|
200
|
+
| [bibliograph](/meadow/bibliograph/) | Record-level change tracking |
|
|
201
|
+
| [meadow](/meadow/meadow/) | Provider-agnostic data broker and ORM |
|
|
202
|
+
| [parime](/meadow/parime/) | Data lake behaviors |
|
|
203
|
+
| [meadow-endpoints](/meadow/meadow-endpoints/) | Automatic RESTful CRUD endpoint generation |
|
|
204
|
+
| [meadow-connection-mysql](/meadow/meadow-connection-mysql/) | MySQL connection provider |
|
|
205
|
+
| [meadow-connection-mssql](/meadow/meadow-connection-mssql/) | MSSQL connection provider |
|
|
206
|
+
| [meadow-connection-sqlite](/meadow/meadow-connection-sqlite/) | SQLite connection provider |
|
|
207
|
+
| [retold-data-service](/meadow/retold-data-service/) | All-in-one schema-to-REST-API service |
|
|
208
|
+
| [retold-harness](/meadow/retold-harness/) | Demo API harness with bookstore dataset |
|
|
209
|
+
| [meadow-integration](/meadow/meadow-integration/) | Data integration and CSV import |
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Orator — API Server
|
|
2
|
+
|
|
3
|
+
Orator provides an unopinionated HTTP server abstraction for Retold applications. It wraps service server implementations (Restify for production, IPC for testing) behind a consistent interface, so your application code does not depend on any specific HTTP library.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
graph TB
|
|
9
|
+
app["Your Application<br/>(routes, middleware, etc.)"]
|
|
10
|
+
app --> core["Orator Core<br/>Lifecycle, content types,<br/>route registration"]
|
|
11
|
+
core --> restify["Restify Server<br/>(Production)"]
|
|
12
|
+
core --> ipc["IPC Server<br/>(Testing)"]
|
|
13
|
+
core --> other["(Other servers)"]
|
|
14
|
+
|
|
15
|
+
style app fill:#e8f5e9,stroke:#43a047,color:#333
|
|
16
|
+
style core fill:#e3f2fd,stroke:#42a5f5,color:#333
|
|
17
|
+
style restify fill:#fff,stroke:#90caf9,color:#333
|
|
18
|
+
style ipc fill:#fff,stroke:#90caf9,color:#333
|
|
19
|
+
style other fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Your application registers routes, middleware, and lifecycle hooks with Orator. Orator delegates to whichever service server implementation is configured — Restify for real HTTP, IPC for in-process testing.
|
|
23
|
+
|
|
24
|
+
## Core Modules
|
|
25
|
+
|
|
26
|
+
### [Orator](/orator/orator/)
|
|
27
|
+
|
|
28
|
+
The main server abstraction. Manages lifecycle, route registration, and service server delegation.
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
const libFable = require('fable');
|
|
32
|
+
const libOrator = require('orator');
|
|
33
|
+
|
|
34
|
+
let _Fable = new libFable({
|
|
35
|
+
Product: 'MyAPI',
|
|
36
|
+
APIServerPort: 8080
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
let _Orator = _Fable.instantiateServiceProvider('Orator');
|
|
40
|
+
|
|
41
|
+
// Register routes
|
|
42
|
+
_Orator.addRoute('GET', '/health', function(pRequest, pResponse, fNext)
|
|
43
|
+
{
|
|
44
|
+
pResponse.send({ status: 'ok' });
|
|
45
|
+
return fNext();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Start the server
|
|
49
|
+
_Orator.startService(function(pError)
|
|
50
|
+
{
|
|
51
|
+
_Fable.log.info('Server listening on port 8080');
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Lifecycle hooks** let you inject behavior at server startup, before/after route handling, and at shutdown:
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
_Orator.addPreStartFunction(function(fCallback) { /* ... */ return fCallback(); });
|
|
59
|
+
_Orator.addPreRouteFunction(function(pRequest, pResponse, fNext) { /* ... */ return fNext(); });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**npm:** `orator` · **Version:** 5.0.x
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### [Orator-ServiceServer-Restify](/orator/orator-serviceserver-restify/)
|
|
67
|
+
|
|
68
|
+
Production HTTP server powered by Restify. Provides full HTTP support, body parsing, CORS, middleware, and configurable listen options.
|
|
69
|
+
|
|
70
|
+
This is the server implementation used for real deployments. Install it alongside Orator and it registers itself automatically.
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
const libOrator = require('orator');
|
|
74
|
+
require('orator-serviceserver-restify');
|
|
75
|
+
|
|
76
|
+
// Restify server is now the active service server
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**npm:** `orator-serviceserver-restify` · **Version:** 2.0.x
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### [Orator-Static-Server](/orator/orator-static-server/)
|
|
84
|
+
|
|
85
|
+
Static file serving for Orator with MIME type detection, default file support, subdomain-based folder routing, and configurable route prefix stripping.
|
|
86
|
+
|
|
87
|
+
```javascript
|
|
88
|
+
_Orator.addStaticRoute('/app', '/var/www/app/dist');
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**npm:** `orator-static-server` · **Version:** 1.0.x
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### [Orator-HTTP-Proxy](/orator/orator-http-proxy/)
|
|
96
|
+
|
|
97
|
+
Reverse proxy for forwarding requests to backend services. Supports multiple HTTP verbs and handles HTTP-to-HTTPS translation.
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
_Orator.addProxyRoute('/api/external', 'https://backend.example.com/api');
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**npm:** `orator-http-proxy` · **Version:** 1.0.x
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### [Tidings](/orator/tidings/)
|
|
108
|
+
|
|
109
|
+
An extensible reporting system for generating HTML, PDF, and other format reports. Provides asset collection, templating, and rasterization in a micro-service-friendly pattern.
|
|
110
|
+
|
|
111
|
+
**npm:** `tidings` · **Version:** 1.0.x
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### [Orator-Endpoint](/orator/orator-endpoint/)
|
|
116
|
+
|
|
117
|
+
A base class for creating reusable, pluggable API endpoint handlers that can be shared across Orator applications.
|
|
118
|
+
|
|
119
|
+
**npm:** `orator-endpoint` · **Version:** 1.0.x
|
|
120
|
+
|
|
121
|
+
## Typical Setup
|
|
122
|
+
|
|
123
|
+
A standard API server combines Orator with Meadow-Endpoints:
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
const libFable = require('fable');
|
|
127
|
+
const libOrator = require('orator');
|
|
128
|
+
const libMeadowEndpoints = require('meadow-endpoints');
|
|
129
|
+
require('orator-serviceserver-restify');
|
|
130
|
+
|
|
131
|
+
let _Fable = new libFable({
|
|
132
|
+
Product: 'BookAPI',
|
|
133
|
+
APIServerPort: 8086,
|
|
134
|
+
MySQL: { Server: 'localhost', User: 'root', Database: 'bookstore' }
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
let _Orator = _Fable.instantiateServiceProvider('Orator');
|
|
138
|
+
|
|
139
|
+
// Create a data entity and wire its endpoints to Orator
|
|
140
|
+
let _BookEntity = _Fable.instantiateServiceProvider('Meadow',
|
|
141
|
+
{ Scope: 'Book', DefaultSchema: BookSchema });
|
|
142
|
+
let _BookEndpoints = _Fable.instantiateServiceProvider('MeadowEndpoints',
|
|
143
|
+
{ Entity: _BookEntity });
|
|
144
|
+
_BookEndpoints.connectRoutes(_Orator);
|
|
145
|
+
|
|
146
|
+
// Start serving
|
|
147
|
+
_Orator.startService((pError) =>
|
|
148
|
+
{
|
|
149
|
+
_Fable.log.info('BookAPI running on :8086');
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This gives you a full REST API with Create, Read, Reads, Update, Delete, Undelete, Count, and Schema endpoints for the Book entity — all auto-generated.
|
|
154
|
+
|
|
155
|
+
## All Orator Modules
|
|
156
|
+
|
|
157
|
+
| Module | Description |
|
|
158
|
+
|--------|-------------|
|
|
159
|
+
| [orator](/orator/orator/) | HTTP server abstraction with lifecycle hooks |
|
|
160
|
+
| [orator-serviceserver-restify](/orator/orator-serviceserver-restify/) | Production HTTP server via Restify |
|
|
161
|
+
| [orator-static-server](/orator/orator-static-server/) | Static file serving with MIME detection |
|
|
162
|
+
| [orator-http-proxy](/orator/orator-http-proxy/) | HTTP reverse proxy pass-through |
|
|
163
|
+
| [tidings](/orator/tidings/) | Reporting scaffolding for HTML/PDF output |
|
|
164
|
+
| [orator-endpoint](/orator/orator-endpoint/) | Reusable endpoint base class |
|
|
165
|
+
| [orator-conversion](/orator/orator-conversion/) | File format conversion endpoints |
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Pict — MVC Tools
|
|
2
|
+
|
|
3
|
+
Pict provides a non-opinionated set of Model-View-Controller tools for building user interfaces. Its core insight: UI is text. Whether you are rendering to a browser DOM, a terminal, or generating strings for another system, Pict treats the output as rendered text and gives you a consistent set of tools for managing views, templates, data, and application lifecycle.
|
|
4
|
+
|
|
5
|
+
## Design Philosophy
|
|
6
|
+
|
|
7
|
+
Pict does not impose opinions about what MVC means. It provides discrete tools — Views, Templates, Providers, and an Application class — that you can use individually or compose together.
|
|
8
|
+
|
|
9
|
+
*Pict is a subclass of Fable*, so does everything fable does.
|
|
10
|
+
|
|
11
|
+
- **Views** manage lifecycle (initialize, render, marshal data) and render templates into target containers
|
|
12
|
+
- **Templates** are text with expressions that resolve against application state
|
|
13
|
+
- **Providers** fetch and manage data for views
|
|
14
|
+
- **The Application class** coordinates view lifecycle and shared state
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
graph TB
|
|
18
|
+
subgraph PictApp["Pict Application"]
|
|
19
|
+
appdata["Application State (AppData)"]
|
|
20
|
+
appdata --> viewA["View A"]
|
|
21
|
+
appdata --> viewB["View B"]
|
|
22
|
+
appdata --> viewC["View C"]
|
|
23
|
+
viewA <--> viewB <--> viewC
|
|
24
|
+
viewA --> tplA["Templates"] --> outA["Rendered Output"]
|
|
25
|
+
viewB --> tplB["Templates"] --> outB["Rendered Output"]
|
|
26
|
+
viewC --> tplC["Templates"] --> outC["Rendered Output"]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
style PictApp fill:#f3e5f5,stroke:#ab47bc,color:#333
|
|
30
|
+
style appdata fill:#e1bee7,stroke:#ab47bc,color:#333
|
|
31
|
+
style viewA fill:#fff,stroke:#ce93d8,color:#333
|
|
32
|
+
style viewB fill:#fff,stroke:#ce93d8,color:#333
|
|
33
|
+
style viewC fill:#fff,stroke:#ce93d8,color:#333
|
|
34
|
+
style tplA fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
35
|
+
style tplB fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
36
|
+
style tplC fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
37
|
+
style outA fill:#e8f5e9,stroke:#66bb6a,color:#666
|
|
38
|
+
style outB fill:#e8f5e9,stroke:#66bb6a,color:#666
|
|
39
|
+
style outC fill:#e8f5e9,stroke:#66bb6a,color:#666
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Core Modules
|
|
43
|
+
|
|
44
|
+
### [Pict](/pict/pict/)
|
|
45
|
+
|
|
46
|
+
The main module. Creates the application context, manages template and view registries, provides the template expression engine, and coordinates rendering.
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
const libPict = require('pict');
|
|
50
|
+
|
|
51
|
+
let _Pict = new libPict({
|
|
52
|
+
Product: 'MyApp',
|
|
53
|
+
DefaultRenderable: true
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Register a template
|
|
57
|
+
_Pict.TemplateProvider.addTemplate('HelloTemplate',
|
|
58
|
+
'<h1>Hello {~Data:Record.Name~}!</h1>');
|
|
59
|
+
|
|
60
|
+
// Set some data
|
|
61
|
+
_Pict.AppData.Record = { Name: 'World' };
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Template expressions** use the `{~ ~}` syntax to resolve data, call templates, invoke providers, and perform logic:
|
|
65
|
+
|
|
66
|
+
| Expression | Purpose | Example |
|
|
67
|
+
|-----------|---------|---------|
|
|
68
|
+
| `{~Data:Path~}` | Resolve data from AppData | `{~Data:Record.Name~}` |
|
|
69
|
+
| `{~Template:Name~}` | Render another template | `{~Template:Header~}` |
|
|
70
|
+
| `{~Each:Array:Template~}` | Iterate and render | `{~Each:Records:RowTemplate~}` |
|
|
71
|
+
| `{~If:Condition~}` | Conditional rendering | `{~If:Record.Active~}` |
|
|
72
|
+
|
|
73
|
+
**npm:** `pict` · **Version:** 1.0.x
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### [Pict-View](/pict/pict-view/)
|
|
78
|
+
|
|
79
|
+
The View base class. Views manage a complete lifecycle — initialization, rendering, data marshaling (two-way binding), CSS injection, and teardown.
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
const libPictView = require('pict-view');
|
|
83
|
+
|
|
84
|
+
class MyView extends libPictView
|
|
85
|
+
{
|
|
86
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
87
|
+
{
|
|
88
|
+
super(pFable, pOptions, pServiceHash);
|
|
89
|
+
this.serviceType = 'MyView';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onBeforeRender()
|
|
93
|
+
{
|
|
94
|
+
this.log.info('About to render');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
onAfterMarshalFromView()
|
|
98
|
+
{
|
|
99
|
+
// Data has been pulled from the DOM back into AppData
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**View lifecycle:** Initialize → Render → Solve → Marshal From View → Marshal To View
|
|
105
|
+
|
|
106
|
+
**npm:** `pict-view` · **Version:** 1.0.x
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### [Pict-Template](/pict/pict-template/)
|
|
111
|
+
|
|
112
|
+
Base class for custom template handlers. Extend this to add new template expression types beyond the built-in set.
|
|
113
|
+
|
|
114
|
+
**npm:** `pict-template` · **Version:** 1.0.x
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### [Pict-Provider](/pict/pict-provider/)
|
|
119
|
+
|
|
120
|
+
Base class for data providers. Providers fetch, transform, and deliver data to views.
|
|
121
|
+
|
|
122
|
+
**npm:** `pict-provider` · **Version:** 1.0.x
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### [Pict-Application](/pict/pict-application/)
|
|
127
|
+
|
|
128
|
+
Application base class that coordinates multiple views, manages shared state, and provides structured lifecycle management for complete applications.
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
const libPictApplication = require('pict-application');
|
|
132
|
+
|
|
133
|
+
class MyApp extends libPictApplication
|
|
134
|
+
{
|
|
135
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
136
|
+
{
|
|
137
|
+
super(pFable, pOptions, pServiceHash);
|
|
138
|
+
this.serviceType = 'MyApp';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
onAfterInitialize()
|
|
142
|
+
{
|
|
143
|
+
// Register views, load data, start rendering
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**npm:** `pict-application` · **Version:** 1.0.x
|
|
149
|
+
|
|
150
|
+
## Section Modules
|
|
151
|
+
|
|
152
|
+
Sections are pre-built view patterns for common UI needs.
|
|
153
|
+
|
|
154
|
+
### [Pict-Section-Form](/pict/pict-section-form/)
|
|
155
|
+
|
|
156
|
+
Configuration-driven dynamic forms. Define form layout, fields, validation, and data binding in JSON — the section handles rendering, data marshaling, and mathematical solving.
|
|
157
|
+
|
|
158
|
+
Supports 13+ input types with custom providers for each. Used extensively for building data entry interfaces without writing HTML by hand.
|
|
159
|
+
|
|
160
|
+
**npm:** `pict-section-form` · **Version:** 1.0.x
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### [Pict-Section-Recordset](/pict/pict-section-recordset/)
|
|
165
|
+
|
|
166
|
+
CRUD views (Create, Read, Update, Delete) based on Meadow endpoint schemas. Provides list views, detail views, and record management with data provider integration.
|
|
167
|
+
|
|
168
|
+
**npm:** `pict-section-recordset` · **Version:** 1.0.x
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### [Pict-Section-TUIGrid](/pict/pict-section-tuigrid/)
|
|
173
|
+
|
|
174
|
+
Toast UI Grid integration for tabular data display. Provides spreadsheet-like data grids with sorting, filtering, and editing.
|
|
175
|
+
|
|
176
|
+
**npm:** `pict-section-tuigrid` · **Version:** 1.0.x
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### [Pict-Section-Content](/pict/pict-section-content/)
|
|
181
|
+
|
|
182
|
+
Markdown parsing and content rendering with Mermaid diagrams and KaTeX math equations. Provides a reusable provider for markdown-to-HTML conversion and a styled view with post-render hooks.
|
|
183
|
+
|
|
184
|
+
**npm:** `pict-section-content`
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### [Pict-Section-Flow](/pict/pict-section-flow/)
|
|
189
|
+
|
|
190
|
+
Flow diagram section for visual workflow and process representations.
|
|
191
|
+
|
|
192
|
+
**npm:** `pict-section-flow`
|
|
193
|
+
|
|
194
|
+
## Application Modules
|
|
195
|
+
|
|
196
|
+
| Module | Purpose | npm |
|
|
197
|
+
|--------|---------|-----|
|
|
198
|
+
| [pict-docuserve](/pict/pict-docuserve/) | Single-page documentation viewer built on Pict with catalog navigation and search | `pict-docuserve` |
|
|
199
|
+
| [pict-nonlinearconfig](/pict/pict-nonlinearconfig/) | Nonlinear configuration manager | `pict-nonlinearconfig` |
|
|
200
|
+
|
|
201
|
+
## Supporting Modules
|
|
202
|
+
|
|
203
|
+
| Module | Purpose | npm |
|
|
204
|
+
|--------|---------|-----|
|
|
205
|
+
| [pict-router](/pict/pict-router/) | Hash-based URL routing via Navigo with template string route functions | `pict-router` |
|
|
206
|
+
| [pict-panel](/pict/pict-panel/) | Control panel component, hot-loadable from CDN | `pict-panel` |
|
|
207
|
+
| [informary](/pict/informary/) | Dependency-free browser form marshaling with undo/redo and field-level deltas | `informary` |
|
|
208
|
+
| [cryptbrau](/pict/cryptbrau/) | Simple in-browser symmetric encryption | `cryptbrau` |
|
|
209
|
+
| [pict-serviceproviderbase](/pict/pict-serviceproviderbase/) | Base classes for Pict services with pre-initialization support | `pict-serviceproviderbase` |
|
|
210
|
+
| [pict-service-commandlineutility](/pict/pict-service-commandlineutility/) | CLI utility tools built on Commander | `pict-service-commandlineutility` |
|
|
211
|
+
| [pict-terminalui](/pict/pict-terminalui/) | Blessed-based terminal interface for Pict views | `pict-terminalui` |
|
|
212
|
+
|
|
213
|
+
## All Pict Modules
|
|
214
|
+
|
|
215
|
+
| Module | Description |
|
|
216
|
+
|--------|-------------|
|
|
217
|
+
| [pict](/pict/pict/) | Core MVC module with template engine |
|
|
218
|
+
| [pict-template](/pict/pict-template/) | Custom template handler base class |
|
|
219
|
+
| [pict-view](/pict/pict-view/) | View base class with full lifecycle |
|
|
220
|
+
| [pict-provider](/pict/pict-provider/) | Data provider base class |
|
|
221
|
+
| [pict-application](/pict/pict-application/) | Application lifecycle management |
|
|
222
|
+
| [pict-panel](/pict/pict-panel/) | Hot-loadable control panel |
|
|
223
|
+
| [pict-nonlinearconfig](/pict/pict-nonlinearconfig/) | Nonlinear configuration manager |
|
|
224
|
+
| [pict-section-flow](/pict/pict-section-flow/) | Flow diagram section |
|
|
225
|
+
| [pict-docuserve](/pict/pict-docuserve/) | Single-page documentation viewer |
|
|
226
|
+
| [cryptbrau](/pict/cryptbrau/) | In-browser symmetric encryption |
|
|
227
|
+
| [informary](/pict/informary/) | Browser form marshaling with undo/redo |
|
|
228
|
+
| [pict-service-commandlineutility](/pict/pict-service-commandlineutility/) | CLI utility tools |
|
|
229
|
+
| [pict-section-recordset](/pict/pict-section-recordset/) | CRUD record management views |
|
|
230
|
+
| [pict-section-content](/pict/pict-section-content/) | Markdown parsing and content rendering |
|
|
231
|
+
| [pict-section-form](/pict/pict-section-form/) | Configuration-driven dynamic forms |
|
|
232
|
+
| [pict-section-tuigrid](/pict/pict-section-tuigrid/) | Toast UI Grid tabular data |
|
|
233
|
+
| [pict-router](/pict/pict-router/) | Hash-based URL routing |
|
|
234
|
+
| [pict-serviceproviderbase](/pict/pict-serviceproviderbase/) | Pict service base classes |
|
|
235
|
+
| [pict-terminalui](/pict/pict-terminalui/) | Blessed-based terminal interface |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Utility — Build & Documentation Tools
|
|
2
|
+
|
|
3
|
+
The utility group provides supporting tools for building, documenting, testing, and supervising Retold applications.
|
|
4
|
+
|
|
5
|
+
## Modules
|
|
6
|
+
|
|
7
|
+
### [Indoctrinate](/utility/indoctrinate/)
|
|
8
|
+
|
|
9
|
+
Documentation scaffolding and generation. Scans source trees, catalogs content with automatic label-based metadata, and generates structured output in multiple formats. Powers the Retold documentation hub by generating cross-module catalogs and keyword search indexes.
|
|
10
|
+
|
|
11
|
+
**Key features:** Content cataloging with label-based filtering, multi-format output (HTML, LaTeX, text), Retold catalog generation for cross-repo documentation, lunr-based keyword index for cross-module search.
|
|
12
|
+
|
|
13
|
+
**npm:** `indoctrinate` · **Version:** 1.0.x
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### [Manyfest](/utility/manyfest/)
|
|
18
|
+
|
|
19
|
+
JSON manifest for consistent data description and parsing across all application layers — database, API, frontend, and UI. Provides address-based access patterns for reading and writing nested object properties with validation and type coercion.
|
|
20
|
+
|
|
21
|
+
**Key features:** Address-based data access (dot notation and array indexing), type validation and coercion, manifest-driven form generation, schema description for data layers.
|
|
22
|
+
|
|
23
|
+
**npm:** `manyfest` · **Version:** 1.0.x
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### [Quackage](/utility/quackage/)
|
|
28
|
+
|
|
29
|
+
Standardized build tool for Retold modules. Handles browser bundling (Browserify), transpilation, unit testing, file management, JSON view assembly, and documentation generation from a single CLI.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx quack build # Build browser bundle
|
|
33
|
+
npx quack test # Run Mocha tests
|
|
34
|
+
npx quack coverage # Generate coverage report
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**npm:** `quackage` · **Version:** 1.0.x
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### [Ultravisor](/utility/ultravisor/)
|
|
42
|
+
|
|
43
|
+
Process supervision tool for running commands on schedule with LLM integration. Supports distributed nodes, global state, and flexible task types (shell, browser, HTTP, database).
|
|
44
|
+
|
|
45
|
+
**npm:** `ultravisor` · **Version:** 1.0.x
|
|
46
|
+
|
|
47
|
+
## All Utility Modules
|
|
48
|
+
|
|
49
|
+
| Module | Description |
|
|
50
|
+
|--------|-------------|
|
|
51
|
+
| [indoctrinate](/utility/indoctrinate/) | Documentation scaffolding with content cataloging and cross-module search |
|
|
52
|
+
| [manyfest](/utility/manyfest/) | JSON manifest for data description, validation, and address-based access |
|
|
53
|
+
| [quackage](/utility/quackage/) | Build tool for browser bundles, testing, and packaging |
|
|
54
|
+
| [ultravisor](/utility/ultravisor/) | Process supervision with scheduled tasks and LLM integration |
|