@constructive-io/seeder 0.5.0
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 +90 -0
- package/SEED_GUIDE.md +1925 -0
- package/SEED_USAGE.md +135 -0
- package/dist/bin.js +21860 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.cjs +21939 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +16196 -0
- package/dist/index.d.ts +16196 -0
- package/dist/index.js +21876 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @constructive-io/seeder
|
|
2
|
+
|
|
3
|
+
Provision Constructive databases from schema blueprints and seed reusable datasets.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @constructive-io/seeder
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CLI
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Provision a new database, apply schema, then seed rows
|
|
15
|
+
constructive-seeder full \
|
|
16
|
+
--blueprint marketplace \
|
|
17
|
+
--dataset marketplace-demo \
|
|
18
|
+
--email user@example.com \
|
|
19
|
+
--password '***'
|
|
20
|
+
|
|
21
|
+
# Provision schema only
|
|
22
|
+
constructive-seeder schema \
|
|
23
|
+
--blueprint logistics \
|
|
24
|
+
--email user@example.com \
|
|
25
|
+
--password '***'
|
|
26
|
+
|
|
27
|
+
# Seed rows into an existing app database
|
|
28
|
+
constructive-seeder rows \
|
|
29
|
+
--dataset crm-demo \
|
|
30
|
+
--data-endpoint http://app-public-mydb.localhost:3000/graphql \
|
|
31
|
+
--auth-endpoint http://auth-mydb.localhost:3000/graphql \
|
|
32
|
+
--email user@example.com \
|
|
33
|
+
--password '***'
|
|
34
|
+
|
|
35
|
+
# Discover available blueprints and datasets
|
|
36
|
+
constructive-seeder list
|
|
37
|
+
|
|
38
|
+
# Use an external schema blueprint
|
|
39
|
+
constructive-seeder schema \
|
|
40
|
+
--blueprint-file ./blueprint.json \
|
|
41
|
+
--email user@example.com \
|
|
42
|
+
--password '***'
|
|
43
|
+
|
|
44
|
+
# Use external runtime-generated specs
|
|
45
|
+
constructive-seeder full \
|
|
46
|
+
--blueprint-file ./blueprint.json \
|
|
47
|
+
--dataset-file ./dataset.mjs \
|
|
48
|
+
--email user@example.com \
|
|
49
|
+
--password '***'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Run `constructive-seeder help` for the full command reference.
|
|
53
|
+
|
|
54
|
+
## Programmatic API
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { getBlueprint, getDataset, parseCliArgs, runSeeder } from '@constructive-io/seeder';
|
|
58
|
+
|
|
59
|
+
const blueprint = getBlueprint('marketplace');
|
|
60
|
+
const dataset = getDataset('marketplace-demo');
|
|
61
|
+
|
|
62
|
+
await runSeeder(
|
|
63
|
+
parseCliArgs([
|
|
64
|
+
'node',
|
|
65
|
+
'constructive-seeder',
|
|
66
|
+
'full',
|
|
67
|
+
'--blueprint',
|
|
68
|
+
blueprint.name,
|
|
69
|
+
'--dataset',
|
|
70
|
+
dataset.name,
|
|
71
|
+
]),
|
|
72
|
+
);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Model
|
|
76
|
+
|
|
77
|
+
- `blueprint`: schema only
|
|
78
|
+
- `dataset`: row generation only
|
|
79
|
+
|
|
80
|
+
That split is intentional. Schema provisioning and row seeding are separate public concepts.
|
|
81
|
+
|
|
82
|
+
## Notes
|
|
83
|
+
|
|
84
|
+
- Schema provisioning aligns to the admin app's secure table / relation provisioning flow.
|
|
85
|
+
- `rows` mode is strict: it requires both `--data-endpoint` and `--auth-endpoint`.
|
|
86
|
+
- The package exports both a CLI (`constructive-seeder`) and a library entrypoint.
|
|
87
|
+
- External blueprints are validated before execution.
|
|
88
|
+
- External blueprint files can be JSON or JS modules.
|
|
89
|
+
- External datasets must be JS modules because seed nodes require functions.
|
|
90
|
+
- A dataset module may optionally export both `dataset` and `blueprint`, which is useful for AI-generated one-off specs.
|