realitydb 0.4.0 → 0.4.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/README.md +46 -51
- package/dist/index.js +14 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,64 +2,70 @@
|
|
|
2
2
|
|
|
3
3
|
> Production-like data before production exists.
|
|
4
4
|
|
|
5
|
-
RealityDB
|
|
6
|
-
realistic, schema-aware data. One command, realistic environments.
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm install -g realitydb
|
|
12
|
-
```
|
|
5
|
+
RealityDB populates your PostgreSQL database with realistic, schema-aware data. Point it at your schema, pick a domain template, and get thousands of rows that look like they came from a real application. Deterministic seeds mean the same command always produces the same data.
|
|
13
6
|
|
|
14
7
|
## Quick Start
|
|
15
8
|
|
|
16
9
|
```bash
|
|
17
|
-
|
|
18
|
-
realitydb seed --seed 42 # Populate with realistic data
|
|
19
|
-
realitydb reset --confirm # Clear and start fresh
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Or use npx without installing:
|
|
10
|
+
npm install -g realitydb
|
|
23
11
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
realitydb scan # Inspect your schema
|
|
13
|
+
realitydb seed --template saas --seed 42 # Populate with realistic data
|
|
14
|
+
realitydb reset --confirm # Clear and start fresh
|
|
27
15
|
```
|
|
28
16
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
- **Schema Intelligence** — Automatically understands your database structure
|
|
32
|
-
- **Domain Templates** — SaaS, e-commerce, education with realistic distributions
|
|
33
|
-
- **Timeline Generation** — Datasets spanning months with growth curves
|
|
34
|
-
- **Scenario Injection** — Payment failures, churn spikes, fraud patterns
|
|
35
|
-
- **Reality Packs** — Portable, shareable environment packages
|
|
36
|
-
- **Deterministic** — Same seed = same data, every time
|
|
17
|
+
## Domain Templates
|
|
37
18
|
|
|
38
|
-
|
|
19
|
+
| Template | Description | Tables |
|
|
20
|
+
|----------|-------------|--------|
|
|
21
|
+
| `saas` | Subscription business | users, plans, subscriptions, payments |
|
|
22
|
+
| `ecommerce` | Online store | customers, products, orders, order_items |
|
|
23
|
+
| `education` | School system | teachers, classes, students, enrollments, grades, attendance |
|
|
24
|
+
| `fintech` | Financial services | accounts, transactions, fraud_alerts, settlements, chargebacks |
|
|
25
|
+
| `healthcare` | Medical system | patients, providers, encounters, diagnoses, billing |
|
|
39
26
|
|
|
40
27
|
```bash
|
|
41
|
-
realitydb seed --template
|
|
42
|
-
realitydb seed --template ecommerce --records 1000 --seed 42
|
|
43
|
-
realitydb seed --template education --records 1000 --seed 42
|
|
28
|
+
realitydb seed --template fintech --records 200 --seed 42
|
|
44
29
|
```
|
|
45
30
|
|
|
46
|
-
|
|
31
|
+
Each template includes weighted distributions matching real-world data.
|
|
32
|
+
|
|
33
|
+
## Key Features
|
|
47
34
|
|
|
48
35
|
```bash
|
|
36
|
+
# Timeline generation -- data spanning months
|
|
49
37
|
realitydb seed --template saas --timeline 12-months --seed 42
|
|
38
|
+
|
|
39
|
+
# Scenario injection -- controlled anomalies
|
|
50
40
|
realitydb seed --template saas --scenario payment-failures --scenario-intensity high
|
|
51
|
-
```
|
|
52
41
|
|
|
53
|
-
|
|
42
|
+
# Environment reproduction -- capture and share
|
|
43
|
+
realitydb capture --name bug-4821
|
|
44
|
+
realitydb load bug-4821.realitydb-pack.json --confirm
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
realitydb
|
|
57
|
-
realitydb pack import ./my-saas-env.databox-pack.json --confirm
|
|
46
|
+
# CI mode -- JSON output, proper exit codes
|
|
47
|
+
npx realitydb seed --ci --template saas --records 500 --seed 42
|
|
58
48
|
```
|
|
59
49
|
|
|
50
|
+
## Commands
|
|
51
|
+
|
|
52
|
+
| Command | Description |
|
|
53
|
+
|---------|-------------|
|
|
54
|
+
| `realitydb scan` | Inspect database schema |
|
|
55
|
+
| `realitydb seed` | Generate and insert realistic data |
|
|
56
|
+
| `realitydb reset` | Clear seeded data |
|
|
57
|
+
| `realitydb export` | Export data to JSON/CSV/SQL files |
|
|
58
|
+
| `realitydb capture` | Snapshot live database into a Reality Pack |
|
|
59
|
+
| `realitydb load` | Load a Reality Pack into the database |
|
|
60
|
+
| `realitydb share` | Display Reality Pack info for sharing |
|
|
61
|
+
| `realitydb pack export` | Generate and export as Reality Pack |
|
|
62
|
+
| `realitydb pack import` | Import a Reality Pack |
|
|
63
|
+
| `realitydb templates` | List available domain templates |
|
|
64
|
+
| `realitydb scenarios` | List available scenarios |
|
|
65
|
+
|
|
60
66
|
## Configuration
|
|
61
67
|
|
|
62
|
-
Create `realitydb.config.json
|
|
68
|
+
Create `realitydb.config.json`:
|
|
63
69
|
|
|
64
70
|
```json
|
|
65
71
|
{
|
|
@@ -68,7 +74,7 @@ Create `realitydb.config.json` (also reads `seedforge.config.json` and `databox.
|
|
|
68
74
|
"connectionString": "postgres://user:pass@localhost:5432/mydb"
|
|
69
75
|
},
|
|
70
76
|
"seed": {
|
|
71
|
-
"defaultRecords":
|
|
77
|
+
"defaultRecords": 1000,
|
|
72
78
|
"batchSize": 1000,
|
|
73
79
|
"randomSeed": 42
|
|
74
80
|
},
|
|
@@ -76,23 +82,12 @@ Create `realitydb.config.json` (also reads `seedforge.config.json` and `databox.
|
|
|
76
82
|
}
|
|
77
83
|
```
|
|
78
84
|
|
|
79
|
-
##
|
|
85
|
+
## Requirements
|
|
80
86
|
|
|
81
87
|
- Node.js 20+
|
|
82
|
-
- PostgreSQL
|
|
88
|
+
- PostgreSQL
|
|
83
89
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
| Command | Description |
|
|
87
|
-
|---------|-------------|
|
|
88
|
-
| `realitydb scan` | Scan and display database schema |
|
|
89
|
-
| `realitydb seed` | Generate and insert realistic data |
|
|
90
|
-
| `realitydb reset` | Clear seeded data |
|
|
91
|
-
| `realitydb export` | Export dataset to JSON/CSV/SQL files |
|
|
92
|
-
| `realitydb templates` | List available domain templates |
|
|
93
|
-
| `realitydb scenarios` | List available scenarios |
|
|
94
|
-
| `realitydb pack export` | Export environment as Reality Pack |
|
|
95
|
-
| `realitydb pack import` | Import Reality Pack into database |
|
|
90
|
+
Full documentation: [github.com/emkwambe/databox](https://github.com/emkwambe/databox)
|
|
96
91
|
|
|
97
92
|
## License
|
|
98
93
|
|
package/dist/index.js
CHANGED
|
@@ -5154,7 +5154,7 @@ function matchesAnyPattern(tableName, patterns) {
|
|
|
5154
5154
|
var import_promises5 = require("fs/promises");
|
|
5155
5155
|
var import_node_path5 = require("path");
|
|
5156
5156
|
function exportRealityPack(dataset, plan, schema, options) {
|
|
5157
|
-
const name = options?.name ?? plan.config.templateName ?? "
|
|
5157
|
+
const name = options?.name ?? plan.config.templateName ?? "realitydb-pack";
|
|
5158
5158
|
const packSchema = {
|
|
5159
5159
|
tables: schema.tables.map((t) => ({
|
|
5160
5160
|
name: t.name,
|
|
@@ -5182,7 +5182,7 @@ function exportRealityPack(dataset, plan, schema, options) {
|
|
|
5182
5182
|
};
|
|
5183
5183
|
}
|
|
5184
5184
|
return {
|
|
5185
|
-
format: "
|
|
5185
|
+
format: "realitydb-pack",
|
|
5186
5186
|
version: "1.0",
|
|
5187
5187
|
metadata: {
|
|
5188
5188
|
name,
|
|
@@ -5199,7 +5199,7 @@ function exportRealityPack(dataset, plan, schema, options) {
|
|
|
5199
5199
|
};
|
|
5200
5200
|
}
|
|
5201
5201
|
async function saveRealityPack(pack, outputPath) {
|
|
5202
|
-
const filePath = outputPath.endsWith(".databox-pack.json") ? outputPath : `${outputPath}/${pack.metadata.name}.
|
|
5202
|
+
const filePath = outputPath.endsWith(".realitydb-pack.json") || outputPath.endsWith(".databox-pack.json") ? outputPath : `${outputPath}/${pack.metadata.name}.realitydb-pack.json`;
|
|
5203
5203
|
await (0, import_promises5.mkdir)((0, import_node_path5.dirname)(filePath), { recursive: true });
|
|
5204
5204
|
await (0, import_promises5.writeFile)(filePath, JSON.stringify(pack, null, 2), "utf-8");
|
|
5205
5205
|
return filePath;
|
|
@@ -5219,8 +5219,8 @@ async function loadRealityPack(filePath) {
|
|
|
5219
5219
|
throw new Error(`Invalid Reality Pack file: not valid JSON`);
|
|
5220
5220
|
}
|
|
5221
5221
|
const pack = parsed;
|
|
5222
|
-
if (pack.format !== "databox-reality-pack") {
|
|
5223
|
-
throw new Error(`Invalid Reality Pack: expected format "
|
|
5222
|
+
if (pack.format !== "realitydb-pack" && pack.format !== "databox-reality-pack") {
|
|
5223
|
+
throw new Error(`Invalid Reality Pack: expected format "realitydb-pack", got "${String(pack.format)}"`);
|
|
5224
5224
|
}
|
|
5225
5225
|
if (!pack.version) {
|
|
5226
5226
|
throw new Error("Invalid Reality Pack: missing version field");
|
|
@@ -7297,7 +7297,7 @@ async function captureDatabase(config, options) {
|
|
|
7297
7297
|
};
|
|
7298
7298
|
const masked = maskConnection(config.database.connectionString);
|
|
7299
7299
|
const pack = {
|
|
7300
|
-
format: "
|
|
7300
|
+
format: "realitydb-pack",
|
|
7301
7301
|
version: "1.0",
|
|
7302
7302
|
metadata: {
|
|
7303
7303
|
name: options.name,
|
|
@@ -7390,7 +7390,7 @@ function maskConnectionString(connectionString) {
|
|
|
7390
7390
|
}
|
|
7391
7391
|
|
|
7392
7392
|
// src/commands/scan.ts
|
|
7393
|
-
var VERSION2 = "0.4.
|
|
7393
|
+
var VERSION2 = "0.4.1";
|
|
7394
7394
|
async function scanCommand(options) {
|
|
7395
7395
|
const start = performance.now();
|
|
7396
7396
|
try {
|
|
@@ -7481,7 +7481,7 @@ async function scanCommand(options) {
|
|
|
7481
7481
|
}
|
|
7482
7482
|
|
|
7483
7483
|
// src/commands/seed.ts
|
|
7484
|
-
var VERSION3 = "0.4.
|
|
7484
|
+
var VERSION3 = "0.4.1";
|
|
7485
7485
|
async function seedCommand(options) {
|
|
7486
7486
|
const start = performance.now();
|
|
7487
7487
|
try {
|
|
@@ -7659,7 +7659,7 @@ async function seedCommand(options) {
|
|
|
7659
7659
|
}
|
|
7660
7660
|
|
|
7661
7661
|
// src/commands/reset.ts
|
|
7662
|
-
var VERSION4 = "0.4.
|
|
7662
|
+
var VERSION4 = "0.4.1";
|
|
7663
7663
|
async function resetCommand(options) {
|
|
7664
7664
|
const start = performance.now();
|
|
7665
7665
|
if (!options.ci && !options.confirm) {
|
|
@@ -7729,7 +7729,7 @@ async function resetCommand(options) {
|
|
|
7729
7729
|
}
|
|
7730
7730
|
|
|
7731
7731
|
// src/commands/export.ts
|
|
7732
|
-
var VERSION5 = "0.4.
|
|
7732
|
+
var VERSION5 = "0.4.1";
|
|
7733
7733
|
async function exportCommand(options) {
|
|
7734
7734
|
const start = performance.now();
|
|
7735
7735
|
try {
|
|
@@ -8081,7 +8081,7 @@ async function packImportCommand(filePath, options) {
|
|
|
8081
8081
|
|
|
8082
8082
|
// src/commands/capture.ts
|
|
8083
8083
|
var import_promises8 = require("fs/promises");
|
|
8084
|
-
var VERSION6 = "0.4.
|
|
8084
|
+
var VERSION6 = "0.4.1";
|
|
8085
8085
|
async function captureCommand(options) {
|
|
8086
8086
|
const start = performance.now();
|
|
8087
8087
|
try {
|
|
@@ -8181,7 +8181,7 @@ async function captureCommand(options) {
|
|
|
8181
8181
|
}
|
|
8182
8182
|
|
|
8183
8183
|
// src/commands/share.ts
|
|
8184
|
-
var VERSION7 = "0.4.
|
|
8184
|
+
var VERSION7 = "0.4.1";
|
|
8185
8185
|
async function shareCommand(filePath, options) {
|
|
8186
8186
|
const start = performance.now();
|
|
8187
8187
|
try {
|
|
@@ -8256,7 +8256,7 @@ async function shareCommand(filePath, options) {
|
|
|
8256
8256
|
}
|
|
8257
8257
|
|
|
8258
8258
|
// src/commands/load.ts
|
|
8259
|
-
var VERSION8 = "0.4.
|
|
8259
|
+
var VERSION8 = "0.4.1";
|
|
8260
8260
|
async function loadCommand(filePath, options) {
|
|
8261
8261
|
const start = performance.now();
|
|
8262
8262
|
try {
|
|
@@ -8399,7 +8399,7 @@ async function loadCommand(filePath, options) {
|
|
|
8399
8399
|
}
|
|
8400
8400
|
|
|
8401
8401
|
// src/cli.ts
|
|
8402
|
-
var VERSION9 = "0.4.
|
|
8402
|
+
var VERSION9 = "0.4.1";
|
|
8403
8403
|
function run(argv) {
|
|
8404
8404
|
const program2 = new Command();
|
|
8405
8405
|
program2.name("realitydb").description("RealityDB \u2014 Developer Reality Platform").version(VERSION9).option("--config <path>", "Path to config file").option("--ci", "CI mode: JSON output, no prompts, proper exit codes", false).option("--verbose", "Enable verbose output", false);
|