@constructive-io/cli 0.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.
Files changed (122) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +412 -0
  3. package/commands/add.d.ts +7 -0
  4. package/commands/add.js +86 -0
  5. package/commands/admin-users/add.d.ts +4 -0
  6. package/commands/admin-users/add.js +89 -0
  7. package/commands/admin-users/bootstrap.d.ts +4 -0
  8. package/commands/admin-users/bootstrap.js +50 -0
  9. package/commands/admin-users/remove.d.ts +4 -0
  10. package/commands/admin-users/remove.js +82 -0
  11. package/commands/admin-users.d.ts +4 -0
  12. package/commands/admin-users.js +68 -0
  13. package/commands/analyze.d.ts +4 -0
  14. package/commands/analyze.js +21 -0
  15. package/commands/clear.d.ts +3 -0
  16. package/commands/clear.js +59 -0
  17. package/commands/deploy.d.ts +4 -0
  18. package/commands/deploy.js +146 -0
  19. package/commands/docker.d.ts +3 -0
  20. package/commands/docker.js +194 -0
  21. package/commands/env.d.ts +4 -0
  22. package/commands/env.js +124 -0
  23. package/commands/export.d.ts +3 -0
  24. package/commands/export.js +129 -0
  25. package/commands/extension.d.ts +4 -0
  26. package/commands/extension.js +48 -0
  27. package/commands/init/index.d.ts +7 -0
  28. package/commands/init/index.js +47 -0
  29. package/commands/init/module.d.ts +4 -0
  30. package/commands/init/module.js +71 -0
  31. package/commands/init/workspace.d.ts +4 -0
  32. package/commands/init/workspace.js +52 -0
  33. package/commands/install.d.ts +4 -0
  34. package/commands/install.js +37 -0
  35. package/commands/kill.d.ts +3 -0
  36. package/commands/kill.js +107 -0
  37. package/commands/migrate/deps.d.ts +4 -0
  38. package/commands/migrate/deps.js +186 -0
  39. package/commands/migrate/init.d.ts +4 -0
  40. package/commands/migrate/init.js +65 -0
  41. package/commands/migrate/list.d.ts +4 -0
  42. package/commands/migrate/list.js +85 -0
  43. package/commands/migrate/status.d.ts +4 -0
  44. package/commands/migrate/status.js +94 -0
  45. package/commands/migrate.d.ts +4 -0
  46. package/commands/migrate.js +69 -0
  47. package/commands/package.d.ts +3 -0
  48. package/commands/package.js +65 -0
  49. package/commands/plan.d.ts +3 -0
  50. package/commands/plan.js +62 -0
  51. package/commands/remove.d.ts +3 -0
  52. package/commands/remove.js +42 -0
  53. package/commands/rename.d.ts +4 -0
  54. package/commands/rename.js +35 -0
  55. package/commands/revert.d.ts +3 -0
  56. package/commands/revert.js +107 -0
  57. package/commands/tag.d.ts +6 -0
  58. package/commands/tag.js +168 -0
  59. package/commands/verify.d.ts +3 -0
  60. package/commands/verify.js +85 -0
  61. package/commands.d.ts +6 -0
  62. package/commands.js +113 -0
  63. package/dist/README.md +412 -0
  64. package/dist/package.json +64 -0
  65. package/esm/commands/add.js +51 -0
  66. package/esm/commands/admin-users/add.js +87 -0
  67. package/esm/commands/admin-users/bootstrap.js +48 -0
  68. package/esm/commands/admin-users/remove.js +80 -0
  69. package/esm/commands/admin-users.js +63 -0
  70. package/esm/commands/analyze.js +16 -0
  71. package/esm/commands/clear.js +54 -0
  72. package/esm/commands/deploy.js +144 -0
  73. package/esm/commands/docker.js +192 -0
  74. package/esm/commands/env.js +122 -0
  75. package/esm/commands/export.js +127 -0
  76. package/esm/commands/extension.js +46 -0
  77. package/esm/commands/init/index.js +42 -0
  78. package/esm/commands/init/module.js +68 -0
  79. package/esm/commands/init/workspace.js +46 -0
  80. package/esm/commands/install.js +35 -0
  81. package/esm/commands/kill.js +105 -0
  82. package/esm/commands/migrate/deps.js +184 -0
  83. package/esm/commands/migrate/init.js +63 -0
  84. package/esm/commands/migrate/list.js +83 -0
  85. package/esm/commands/migrate/status.js +92 -0
  86. package/esm/commands/migrate.js +64 -0
  87. package/esm/commands/package.js +63 -0
  88. package/esm/commands/plan.js +60 -0
  89. package/esm/commands/remove.js +40 -0
  90. package/esm/commands/rename.js +30 -0
  91. package/esm/commands/revert.js +105 -0
  92. package/esm/commands/tag.js +133 -0
  93. package/esm/commands/verify.js +83 -0
  94. package/esm/commands.js +105 -0
  95. package/esm/index.js +48 -0
  96. package/esm/package.js +26 -0
  97. package/esm/utils/argv.js +92 -0
  98. package/esm/utils/cli-error.js +48 -0
  99. package/esm/utils/database.js +78 -0
  100. package/esm/utils/deployed-changes.js +68 -0
  101. package/esm/utils/display.js +58 -0
  102. package/esm/utils/index.js +6 -0
  103. package/esm/utils/module-utils.js +51 -0
  104. package/index.d.ts +25 -0
  105. package/index.js +87 -0
  106. package/package.d.ts +1 -0
  107. package/package.js +29 -0
  108. package/package.json +64 -0
  109. package/utils/argv.d.ts +46 -0
  110. package/utils/argv.js +100 -0
  111. package/utils/cli-error.d.ts +8 -0
  112. package/utils/cli-error.js +52 -0
  113. package/utils/database.d.ts +21 -0
  114. package/utils/database.js +83 -0
  115. package/utils/deployed-changes.d.ts +4 -0
  116. package/utils/deployed-changes.js +72 -0
  117. package/utils/display.d.ts +3 -0
  118. package/utils/display.js +66 -0
  119. package/utils/index.d.ts +6 -0
  120. package/utils/index.js +22 -0
  121. package/utils/module-utils.d.ts +8 -0
  122. package/utils/module-utils.js +54 -0
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Dan Lynch <pyramation@gmail.com>
4
+ Copyright (c) 2025 Hyperweb <developers@hyperweb.io>
5
+ Copyright (c) 2020-present, Interweb, Inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,412 @@
1
+ # **constructive — Platform for building Schemas, APIs, and Apps**
2
+
3
+ **A unified cloud platform for data, APIs, and application development.**
4
+
5
+ `constructive` brings together everything teams need to model data, ship APIs, and deploy modern applications. It provides a modular foundation for defining schemas, automating infrastructure, and delivering fast, secure experiences—without the complexity of traditional backend stacks.
6
+
7
+ ## ✨ Features
8
+
9
+ * 🧱 **Modular Building Blocks** — Compose your app from reusable modules for data, logic, storage, and services. Swap, version, and extend components without rewriting your backend.
10
+ * 🔄 **Automated Schema & API Generation** — Define your data and relationships once; get auto-generated APIs, migrations, types, and client code across languages.
11
+ * ☁️ **Zero-Config Cloud Deployments** — Push code, get production. Deploy databases, APIs, functions, and frontends with instant environments and built-in rollout safety.
12
+ * 🏗️ **Full-Stack Workspaces** — `constructive init` creates a complete workspace with data models, API routes, auth, edge functions, and CI/CD already wired together.
13
+ * 📊 **Versioned Infrastructure** — Every schema, API, and service change is tracked and versioned, enabling reproducible deployments and safe rollbacks.
14
+ * 🌐 **Portable by Design** — Built on open standards and SQL-first workflows, your app runs anywhere—from the constructive cloud to your own infra.
15
+ * 🚀 **Optimized Developer Experience** — Type-safe SDKs, hot reloading for data and APIs, local-first dev, and zero boilerplate to get from idea → production fast.
16
+
17
+ ## 🚀 Quick Start
18
+
19
+ ### Install & Setup
20
+
21
+ ```bash
22
+ # Install constructive globally
23
+ npm install -g @constructive-io/cli
24
+
25
+ # Start local Postgres (via Docker) and export env vars
26
+ constructive docker start
27
+ eval "$(constructive env)"
28
+ ```
29
+
30
+ > **Tip:** Already running Postgres? Skip the Docker step and just export your PG* vars.
31
+
32
+ ---
33
+
34
+ ### Create a Workspace and Install a Package
35
+
36
+ ```bash
37
+ # 1. Create a workspace
38
+ constructive init --workspace
39
+ cd my-app
40
+
41
+ # 2. Create your first module
42
+ constructive init
43
+ cd packages/your-module
44
+
45
+ # 3. Install a package
46
+ constructive install @pgpm/faker
47
+
48
+ # 4. Deploy everything
49
+ constructive deploy --createdb --database mydb1
50
+ psql -d mydb1 -c "SELECT faker.city('MI');"
51
+ > Ann Arbor
52
+ ```
53
+
54
+ ## 🛠️ Commands
55
+
56
+ ### Getting Started
57
+
58
+ - `constructive init` - Initialize a new module
59
+ - `constructive init --workspace` - Initialize a new workspace
60
+
61
+ ### Development Setup
62
+
63
+ - `constructive docker start` - Start PostgreSQL container (via Docker)
64
+ - `constructive docker stop` - Stop PostgreSQL container
65
+ - `constructive env` - Print PostgreSQL environment variables for shell export
66
+
67
+ ### Database Operations
68
+
69
+ - `constructive deploy` - Deploy database changes and migrations
70
+ - `constructive verify` - Verify database state matches expected migrations
71
+ - `constructive revert` - Safely revert database changes
72
+
73
+ ### Migration Management
74
+
75
+ - `constructive migrate` - Comprehensive migration management
76
+ - `constructive migrate init` - Initialize migration tracking
77
+ - `constructive migrate status` - Check migration status
78
+ - `constructive migrate list` - List all changes
79
+ - `constructive migrate deps` - Show change dependencies
80
+
81
+ ### Module Management
82
+
83
+ - `constructive install` - Install database modules as dependencies
84
+ - `constructive extension` - Interactively manage module dependencies
85
+ - `constructive tag` - Version your changes with tags
86
+
87
+ ### Packaging and Distribution
88
+
89
+ - `constructive plan` - Generate deployment plans for your modules
90
+ - `constructive package` - Package your module for distribution
91
+
92
+ ### Utilities
93
+
94
+ - `constructive add` - Add a new database change
95
+ - `constructive remove` - Remove a database change
96
+ - `constructive export` - Export migrations from existing databases
97
+ - `constructive clear` - Clear database state
98
+ - `constructive kill` - Clean up database connections
99
+ - `constructive analyze` - Analyze database structure
100
+ - `constructive rename` - Rename database changes
101
+ - `constructive admin-users` - Manage admin users
102
+
103
+ ## 💡 Common Workflows
104
+
105
+ ### Starting a New Project and Adding a Change
106
+
107
+ ```bash
108
+ # 1. Create workspace
109
+ constructive init --workspace
110
+ cd my-app
111
+
112
+ # 2. Create your first module
113
+ constructive init
114
+ cd packages/new-module
115
+
116
+ # 3. Add some SQL migrations to sql/ directory
117
+ constructive add some_change
118
+
119
+ # 4. Deploy to database
120
+ constructive deploy --createdb
121
+ ```
122
+
123
+ ### Working with Existing Projects
124
+
125
+ ```bash
126
+ # 1. Navigate to your module
127
+ cd packages/your-module
128
+
129
+ # 2. Install a package
130
+ constructive install @pgpm/faker
131
+
132
+ # 3. Deploy all installed modules
133
+ constructive deploy --createdb --database mydb1
134
+ psql -d mydb1 -c "SELECT faker.city('MI');"
135
+ > Ann Arbor
136
+ ```
137
+
138
+ ### Testing a module in a workspace
139
+
140
+ ```bash
141
+ # 1. Install workspace dependencies
142
+ pnpm install
143
+
144
+ # 2. Enter the packages/<yourmodule>
145
+ cd packages/yourmodule
146
+
147
+ # 3. Test the module in watch mode
148
+ pnpm test:watch
149
+ ```
150
+
151
+ ### Database Operations
152
+
153
+ #### `constructive deploy`
154
+
155
+ Deploy your database changes and migrations.
156
+
157
+ ```bash
158
+ # Deploy to selected database
159
+ constructive deploy
160
+
161
+ # Create database if it doesn't exist
162
+ constructive deploy --createdb
163
+
164
+ # Deploy specific package to a tag
165
+ constructive deploy --package mypackage --to @v1.0.0
166
+
167
+ # Fast deployment without transactions
168
+ constructive deploy --fast --no-tx
169
+ ```
170
+
171
+ #### `constructive verify`
172
+
173
+ Verify your database state matches expected migrations.
174
+
175
+ ```bash
176
+ # Verify current state
177
+ constructive verify
178
+
179
+ # Verify specific package
180
+ constructive verify --package mypackage
181
+ ```
182
+
183
+ #### `constructive revert`
184
+
185
+ Safely revert database changes.
186
+
187
+ ```bash
188
+ # Revert latest changes
189
+ constructive revert
190
+
191
+ # Revert to specific tag
192
+ constructive revert --to @v1.0.0
193
+ ```
194
+
195
+ ### Migration Management
196
+
197
+ #### `constructive migrate`
198
+
199
+ Comprehensive migration management.
200
+
201
+ ```bash
202
+ # Initialize migration tracking
203
+ constructive migrate init
204
+
205
+ # Check migration status
206
+ constructive migrate status
207
+
208
+ # List all changes
209
+ constructive migrate list
210
+
211
+ # Show change dependencies
212
+ constructive migrate deps
213
+ ```
214
+
215
+ ### Module Management
216
+
217
+ #### `constructive install`
218
+
219
+ Install database modules as dependencies.
220
+
221
+ ```bash
222
+ # Install single package
223
+ constructive install @pgpm/base32
224
+
225
+ # Install multiple packages
226
+ constructive install @pgpm/base32 @pgpm/faker
227
+ ```
228
+
229
+ #### `constructive extension`
230
+
231
+ Interactively manage module dependencies.
232
+
233
+ ```bash
234
+ constructive extension
235
+ ```
236
+
237
+ #### `constructive tag`
238
+
239
+ Version your changes with tags.
240
+
241
+ ```bash
242
+ # Tag latest change
243
+ constructive tag v1.0.0
244
+
245
+ # Tag with comment
246
+ constructive tag v1.0.0 --comment "Initial release"
247
+
248
+ # Tag specific change
249
+ constructive tag v1.1.0 --package mypackage --changeName my-change
250
+ ```
251
+
252
+ ### Packaging and Distribution
253
+
254
+ #### `constructive plan`
255
+
256
+ Generate deployment plans for your modules.
257
+
258
+ ```bash
259
+ constructive plan
260
+ ```
261
+
262
+ #### `constructive package`
263
+
264
+ Package your module for distribution.
265
+
266
+ ```bash
267
+ # Package with defaults
268
+ constructive package
269
+
270
+ # Package without deployment plan
271
+ constructive package --no-plan
272
+ ```
273
+
274
+ ### Utilities
275
+
276
+ #### `constructive export`
277
+
278
+ Export migrations from existing databases.
279
+
280
+ ```bash
281
+ constructive export
282
+ ```
283
+
284
+ #### `constructive kill`
285
+
286
+ Clean up database connections and optionally drop databases.
287
+
288
+ ```bash
289
+ # Kill connections and drop databases
290
+ constructive kill
291
+
292
+ # Only kill connections
293
+ constructive kill --no-drop
294
+ ```
295
+
296
+ ## ⚙️ Configuration
297
+
298
+ ### Environment Variables
299
+
300
+ `constructive` uses standard PostgreSQL environment variables (`PGHOST`, `PGPORT`, `PGDATABASE`, `PGUSER`, `PGPASSWORD`).
301
+
302
+ **Quick setup** (recommended):
303
+ ```bash
304
+ eval "$(constructive env)"
305
+ ```
306
+
307
+ **Manual setup** (if you prefer):
308
+ ```bash
309
+ export PGHOST=localhost
310
+ export PGPORT=5432
311
+ export PGDATABASE=myapp
312
+ export PGUSER=postgres
313
+ export PGPASSWORD=password
314
+ ```
315
+
316
+ **Supabase local development:**
317
+ ```bash
318
+ eval "$(constructive env --supabase)"
319
+ ```
320
+
321
+ ## Getting Help
322
+
323
+ ### Command Help
324
+
325
+ ```bash
326
+ # Global help
327
+ constructive --help
328
+
329
+ # Command-specific help
330
+ constructive deploy --help
331
+ constructive tag -h
332
+ ```
333
+
334
+ ### Common Options
335
+
336
+ Most commands support these global options:
337
+
338
+ - `--help, -h` - Show help information
339
+ - `--version, -v` - Show version information
340
+ - `--cwd <dir>` - Set working directory
341
+
342
+ ## Education and Tutorials
343
+
344
+ 1. 🚀 [Quickstart: Getting Up and Running](https://launchql.com/learn/quickstart)
345
+ Get started with modular databases in minutes. Install prerequisites and deploy your first module.
346
+
347
+ 2. 📦 [Modular PostgreSQL Development with Database Packages](https://launchql.com/learn/modular-postgres)
348
+ Learn to organize PostgreSQL projects with constructive workspaces and reusable database modules.
349
+
350
+ 3. ✏️ [Authoring Database Changes](https://launchql.com/learn/authoring-database-changes)
351
+ Master the workflow for adding, organizing, and managing database changes with constructive.
352
+
353
+ 4. 🧪 [End-to-End PostgreSQL Testing with TypeScript](https://launchql.com/learn/e2e-postgres-testing)
354
+ Master end-to-end PostgreSQL testing with ephemeral databases, RLS testing, and CI/CD automation.
355
+
356
+ 5. ⚡ [Supabase Testing](https://launchql.com/learn/supabase)
357
+ TypeScript-native testing for Supabase with modern workflows.
358
+
359
+ 6. 🔧 [Troubleshooting](https://launchql.com/learn/troubleshooting)
360
+ Common issues and solutions for constructive, PostgreSQL, and testing.
361
+
362
+ ## Related LaunchQL Tooling
363
+
364
+ ### 🧪 Testing
365
+
366
+ * [launchql/pgsql-test](https://github.com/launchql/launchql/tree/main/packages/pgsql-test): **📊 Isolated testing environments** with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
367
+ * [launchql/supabase-test](https://github.com/launchql/launchql/tree/main/packages/supabase-test): **🧪 Supabase-native test harness** preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
368
+ * [launchql/graphile-test](https://github.com/launchql/launchql/tree/main/packages/graphile-test): **🔐 Authentication mocking** for Graphile-focused test helpers and emulating row-level security contexts.
369
+ * [launchql/pg-query-context](https://github.com/launchql/launchql/tree/main/packages/pg-query-context): **🔒 Session context injection** to add session-local context (e.g., `SET LOCAL`) into queries—ideal for setting `role`, `jwt.claims`, and other session settings.
370
+
371
+ ### 🧠 Parsing & AST
372
+
373
+ * [launchql/pgsql-parser](https://github.com/launchql/pgsql-parser): **🔄 SQL conversion engine** that interprets and converts PostgreSQL syntax.
374
+ * [launchql/libpg-query-node](https://github.com/launchql/libpg-query-node): **🌉 Node.js bindings** for `libpg_query`, converting SQL into parse trees.
375
+ * [launchql/pg-proto-parser](https://github.com/launchql/pg-proto-parser): **📦 Protobuf parser** for parsing PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
376
+ * [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): **🏷️ TypeScript enums** for PostgreSQL AST for safe and ergonomic parsing logic.
377
+ * [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
378
+ * [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
379
+ * [launchql/pg-ast](https://github.com/launchql/launchql/tree/main/packages/pg-ast): **🔍 Low-level AST tools** and transformations for Postgres query structures.
380
+
381
+ ### 🚀 API & Dev Tools
382
+
383
+ * [launchql/server](https://github.com/launchql/launchql/tree/main/packages/server): **⚡ Express-based API server** powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
384
+ * [launchql/explorer](https://github.com/launchql/launchql/tree/main/packages/explorer): **🔎 Visual API explorer** with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.
385
+
386
+ ### 🔁 Streaming & Uploads
387
+
388
+ * [launchql/s3-streamer](https://github.com/launchql/launchql/tree/main/packages/s3-streamer): **📤 Direct S3 streaming** for large files with support for metadata injection and content validation.
389
+ * [launchql/etag-hash](https://github.com/launchql/launchql/tree/main/packages/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
390
+ * [launchql/etag-stream](https://github.com/launchql/launchql/tree/main/packages/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
391
+ * [launchql/uuid-hash](https://github.com/launchql/launchql/tree/main/packages/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
392
+ * [launchql/uuid-stream](https://github.com/launchql/launchql/tree/main/packages/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
393
+ * [launchql/upload-names](https://github.com/launchql/launchql/tree/main/packages/upload-names): **📂 Collision-resistant filenames** utility for structured and unique file names for uploads.
394
+
395
+ ### 🧰 CLI & Codegen
396
+
397
+ * [constructive](https://github.com/launchql/launchql/tree/main/packages/pgpm): **🖥️ Backend platform** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
398
+ * [@launchql/cli](https://github.com/launchql/launchql/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing LaunchQL projects—supports database scaffolding, migrations, seeding, code generation, and automation.
399
+ * [launchql/launchql-gen](https://github.com/launchql/launchql/tree/main/packages/launchql-gen): **✨ Auto-generated GraphQL** mutations and queries dynamically built from introspected schema data.
400
+ * [@launchql/query-builder](https://github.com/launchql/launchql/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
401
+ * [@launchql/query](https://github.com/launchql/launchql/tree/main/packages/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
402
+
403
+ ## Credits
404
+
405
+ 🛠 Built by LaunchQL — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/launchql)
406
+
407
+
408
+ ## Disclaimer
409
+
410
+ AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
411
+
412
+ No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
@@ -0,0 +1,7 @@
1
+ import { CLIOptions, Inquirerer } from 'inquirerer';
2
+ import { ParsedArgs } from 'minimist';
3
+ declare const _default: (argv: Partial<ParsedArgs>, prompter: Inquirerer, _options: CLIOptions) => Promise<{
4
+ _: string[];
5
+ "--"?: string[] | undefined;
6
+ }>;
7
+ export default _default;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const core_1 = require("@launchql/core");
37
+ const path = __importStar(require("path"));
38
+ const argv_1 = require("../utils/argv");
39
+ const addUsageText = `
40
+ Add Command:
41
+
42
+ constructive add [change] [OPTIONS]
43
+
44
+ Add a database change to plans and create deploy/revert/verify SQL files.
45
+
46
+ Arguments:
47
+ change Name of the change to create
48
+
49
+ Options:
50
+ --help, -h Show this help message
51
+ --requires <dependency> Required change (can be used multiple times)
52
+ --note <text> Brief note describing the purpose of the change
53
+ --cwd <directory> Working directory (default: current directory)
54
+
55
+ Examples:
56
+ constructive add organizations Add change named 'organizations'
57
+ constructive add brands --note "Adds the brands table" Add change with note
58
+ constructive add contacts --requires users --note "Adds contacts table" Add with dependency
59
+ constructive add be/a/path/like/this Add change with nested path
60
+ `;
61
+ exports.default = async (argv, prompter, _options) => {
62
+ // Show usage if explicitly requested
63
+ if (argv.help || argv.h) {
64
+ console.log(addUsageText);
65
+ process.exit(0);
66
+ }
67
+ const cwd = argv.cwd || process.cwd();
68
+ const { first: change, newArgv } = (0, argv_1.extractFirst)(argv);
69
+ let finalChange = change;
70
+ if (!change) {
71
+ const answers = await prompter.prompt(newArgv, [{
72
+ type: 'text',
73
+ name: 'change',
74
+ message: 'Change name',
75
+ required: true
76
+ }]);
77
+ finalChange = answers.change;
78
+ }
79
+ let dependencies = [];
80
+ if (argv.requires) {
81
+ dependencies = Array.isArray(argv.requires) ? argv.requires : [argv.requires];
82
+ }
83
+ const pkg = new core_1.LaunchQLPackage(path.resolve(cwd));
84
+ pkg.addChange(finalChange, dependencies.length > 0 ? dependencies : undefined, argv.note);
85
+ return newArgv;
86
+ };
@@ -0,0 +1,4 @@
1
+ import { CLIOptions, Inquirerer } from 'inquirerer';
2
+ import { ParsedArgs } from 'minimist';
3
+ declare const _default: (argv: Partial<ParsedArgs>, prompter: Inquirerer, _options: CLIOptions) => Promise<Partial<ParsedArgs>>;
4
+ export default _default;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@launchql/core");
4
+ const logger_1 = require("@launchql/logger");
5
+ const pg_env_1 = require("pg-env");
6
+ const log = new logger_1.Logger('admin-users-add');
7
+ const addUsageText = `
8
+ Admin Users Add Command:
9
+
10
+ constructive admin-users add [OPTIONS]
11
+
12
+ Add database users with postgres roles.
13
+ Note: You must run 'constructive admin-users bootstrap' first to initialize roles.
14
+
15
+ Options:
16
+ --help, -h Show this help message
17
+ --username <username> Username for the database user
18
+ --password <password> Password for the database user
19
+ --test Add test users (app_user, app_admin) with default passwords
20
+ --cwd <directory> Working directory (default: current directory)
21
+
22
+ Examples:
23
+ constructive admin-users add --username myuser --password mypass
24
+ constructive admin-users add --test # Add test users (requires bootstrap first)
25
+ constructive admin-users add # Will prompt for username and password
26
+ `;
27
+ exports.default = async (argv, prompter, _options) => {
28
+ // Show usage if explicitly requested
29
+ if (argv.help || argv.h) {
30
+ console.log(addUsageText);
31
+ process.exit(0);
32
+ }
33
+ const pgEnv = (0, pg_env_1.getPgEnvOptions)();
34
+ const isTest = argv.test;
35
+ const init = new core_1.LaunchQLInit(pgEnv);
36
+ try {
37
+ if (isTest) {
38
+ const { yes: confirmTest } = await prompter.prompt(argv, [
39
+ {
40
+ type: 'confirm',
41
+ name: 'yes',
42
+ message: 'Are you sure you want to add test users? (WARNING: Should NEVER be run on production!)',
43
+ default: false
44
+ }
45
+ ]);
46
+ if (!confirmTest) {
47
+ log.info('Operation cancelled.');
48
+ return;
49
+ }
50
+ await init.bootstrapTestRoles();
51
+ log.success('Test users added successfully.');
52
+ }
53
+ else {
54
+ const prompts = [
55
+ {
56
+ type: 'text',
57
+ name: 'username',
58
+ message: 'Enter username for database user:',
59
+ validate: (input) => input && input.trim().length > 0
60
+ },
61
+ {
62
+ type: 'text',
63
+ name: 'password',
64
+ message: 'Enter password for database user:',
65
+ validate: (input) => input && input.trim().length > 0
66
+ }
67
+ ];
68
+ const { username, password } = await prompter.prompt(argv, prompts);
69
+ const { yes } = await prompter.prompt(argv, [
70
+ {
71
+ type: 'confirm',
72
+ name: 'yes',
73
+ message: `Are you sure you want to add database user "${username}"?`,
74
+ default: false
75
+ }
76
+ ]);
77
+ if (!yes) {
78
+ log.info('Operation cancelled.');
79
+ return;
80
+ }
81
+ await init.bootstrapDbRoles(username, password);
82
+ log.success(`Database user "${username}" added successfully.`);
83
+ }
84
+ }
85
+ finally {
86
+ await init.close();
87
+ }
88
+ return argv;
89
+ };
@@ -0,0 +1,4 @@
1
+ import { CLIOptions, Inquirerer } from 'inquirerer';
2
+ import { ParsedArgs } from 'minimist';
3
+ declare const _default: (argv: Partial<ParsedArgs>, prompter: Inquirerer, _options: CLIOptions) => Promise<Partial<ParsedArgs>>;
4
+ export default _default;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@launchql/core");
4
+ const logger_1 = require("@launchql/logger");
5
+ const pg_env_1 = require("pg-env");
6
+ const log = new logger_1.Logger('admin-users-bootstrap');
7
+ const bootstrapUsageText = `
8
+ Admin Users Bootstrap Command:
9
+
10
+ constructive admin-users bootstrap [OPTIONS]
11
+
12
+ Initialize postgres roles and permissions. This command must be run before adding users.
13
+ Creates the standard postgres roles: anonymous, authenticated, administrator.
14
+
15
+ Options:
16
+ --help, -h Show this help message
17
+ --cwd <directory> Working directory (default: current directory)
18
+
19
+ Examples:
20
+ constructive admin-users bootstrap # Initialize postgres roles
21
+ `;
22
+ exports.default = async (argv, prompter, _options) => {
23
+ // Show usage if explicitly requested
24
+ if (argv.help || argv.h) {
25
+ console.log(bootstrapUsageText);
26
+ process.exit(0);
27
+ }
28
+ const pgEnv = (0, pg_env_1.getPgEnvOptions)();
29
+ const { yes } = await prompter.prompt(argv, [
30
+ {
31
+ type: 'confirm',
32
+ name: 'yes',
33
+ message: 'Are you sure you want to initialize postgres roles and permissions?',
34
+ default: false
35
+ }
36
+ ]);
37
+ if (!yes) {
38
+ log.info('Operation cancelled.');
39
+ return;
40
+ }
41
+ const init = new core_1.LaunchQLInit(pgEnv);
42
+ try {
43
+ await init.bootstrapRoles();
44
+ log.success('postgres roles and permissions initialized successfully.');
45
+ }
46
+ finally {
47
+ await init.close();
48
+ }
49
+ return argv;
50
+ };
@@ -0,0 +1,4 @@
1
+ import { CLIOptions, Inquirerer } from 'inquirerer';
2
+ import { ParsedArgs } from 'minimist';
3
+ declare const _default: (argv: Partial<ParsedArgs>, prompter: Inquirerer, _options: CLIOptions) => Promise<Partial<ParsedArgs>>;
4
+ export default _default;