pgpm 0.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/README.md +416 -0
- package/commands/add.d.ts +7 -0
- package/commands/add.js +86 -0
- package/commands/admin-users/add.d.ts +4 -0
- package/commands/admin-users/add.js +89 -0
- package/commands/admin-users/bootstrap.d.ts +4 -0
- package/commands/admin-users/bootstrap.js +50 -0
- package/commands/admin-users/remove.d.ts +4 -0
- package/commands/admin-users/remove.js +82 -0
- package/commands/admin-users.d.ts +4 -0
- package/commands/admin-users.js +68 -0
- package/commands/analyze.d.ts +4 -0
- package/commands/analyze.js +21 -0
- package/commands/clear.d.ts +3 -0
- package/commands/clear.js +59 -0
- package/commands/deploy.d.ts +4 -0
- package/commands/deploy.js +146 -0
- package/commands/explorer.d.ts +3 -0
- package/commands/explorer.js +94 -0
- package/commands/export.d.ts +3 -0
- package/commands/export.js +129 -0
- package/commands/extension.d.ts +4 -0
- package/commands/extension.js +48 -0
- package/commands/init/index.d.ts +7 -0
- package/commands/init/index.js +47 -0
- package/commands/init/module.d.ts +4 -0
- package/commands/init/module.js +71 -0
- package/commands/init/workspace.d.ts +4 -0
- package/commands/init/workspace.js +52 -0
- package/commands/install.d.ts +4 -0
- package/commands/install.js +37 -0
- package/commands/kill.d.ts +3 -0
- package/commands/kill.js +107 -0
- package/commands/migrate/deps.d.ts +4 -0
- package/commands/migrate/deps.js +186 -0
- package/commands/migrate/init.d.ts +4 -0
- package/commands/migrate/init.js +65 -0
- package/commands/migrate/list.d.ts +4 -0
- package/commands/migrate/list.js +85 -0
- package/commands/migrate/status.d.ts +4 -0
- package/commands/migrate/status.js +94 -0
- package/commands/migrate.d.ts +4 -0
- package/commands/migrate.js +69 -0
- package/commands/package.d.ts +3 -0
- package/commands/package.js +65 -0
- package/commands/plan.d.ts +3 -0
- package/commands/plan.js +62 -0
- package/commands/remove.d.ts +3 -0
- package/commands/remove.js +42 -0
- package/commands/rename.d.ts +4 -0
- package/commands/rename.js +35 -0
- package/commands/revert.d.ts +3 -0
- package/commands/revert.js +107 -0
- package/commands/server.d.ts +3 -0
- package/commands/server.js +187 -0
- package/commands/tag.d.ts +6 -0
- package/commands/tag.js +168 -0
- package/commands/verify.d.ts +3 -0
- package/commands/verify.js +85 -0
- package/commands.d.ts +5 -0
- package/commands.js +118 -0
- package/dist/README.md +416 -0
- package/dist/package.json +77 -0
- package/esm/commands/add.js +51 -0
- package/esm/commands/admin-users/add.js +87 -0
- package/esm/commands/admin-users/bootstrap.js +48 -0
- package/esm/commands/admin-users/remove.js +80 -0
- package/esm/commands/admin-users.js +63 -0
- package/esm/commands/analyze.js +16 -0
- package/esm/commands/clear.js +54 -0
- package/esm/commands/deploy.js +144 -0
- package/esm/commands/explorer.js +92 -0
- package/esm/commands/export.js +127 -0
- package/esm/commands/extension.js +46 -0
- package/esm/commands/init/index.js +42 -0
- package/esm/commands/init/module.js +68 -0
- package/esm/commands/init/workspace.js +46 -0
- package/esm/commands/install.js +35 -0
- package/esm/commands/kill.js +105 -0
- package/esm/commands/migrate/deps.js +184 -0
- package/esm/commands/migrate/init.js +63 -0
- package/esm/commands/migrate/list.js +83 -0
- package/esm/commands/migrate/status.js +92 -0
- package/esm/commands/migrate.js +64 -0
- package/esm/commands/package.js +63 -0
- package/esm/commands/plan.js +60 -0
- package/esm/commands/remove.js +40 -0
- package/esm/commands/rename.js +30 -0
- package/esm/commands/revert.js +105 -0
- package/esm/commands/server.js +185 -0
- package/esm/commands/tag.js +133 -0
- package/esm/commands/verify.js +83 -0
- package/esm/commands.js +111 -0
- package/esm/index.js +20 -0
- package/esm/package.js +26 -0
- package/esm/utils/argv.js +92 -0
- package/esm/utils/cli-error.js +48 -0
- package/esm/utils/database.js +78 -0
- package/esm/utils/deployed-changes.js +68 -0
- package/esm/utils/display.js +58 -0
- package/esm/utils/index.js +3 -0
- package/esm/utils/module-utils.js +51 -0
- package/index.d.ts +3 -0
- package/index.js +23 -0
- package/package.d.ts +1 -0
- package/package.js +29 -0
- package/package.json +77 -0
- package/utils/argv.d.ts +46 -0
- package/utils/argv.js +100 -0
- package/utils/cli-error.d.ts +8 -0
- package/utils/cli-error.js +52 -0
- package/utils/database.d.ts +21 -0
- package/utils/database.js +83 -0
- package/utils/deployed-changes.d.ts +4 -0
- package/utils/deployed-changes.js +72 -0
- package/utils/display.d.ts +3 -0
- package/utils/display.js +66 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.js +19 -0
- package/utils/module-utils.d.ts +8 -0
- package/utils/module-utils.js +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# LaunchQL CLI
|
|
2
|
+
|
|
3
|
+
> Build secure, role-aware GraphQL backends powered by PostgreSQL with database-first development
|
|
4
|
+
|
|
5
|
+
LaunchQL CLI is a comprehensive command-line tool that transforms your PostgreSQL database into a powerful GraphQL API. With automated schema generation, sophisticated migration management, and robust deployment capabilities, you can focus on building great applications instead of boilerplate code.
|
|
6
|
+
|
|
7
|
+
## ✨ Features
|
|
8
|
+
|
|
9
|
+
- 🚀 **Database-First Development** - Design your database, get your GraphQL API automatically
|
|
10
|
+
- 🔐 **Built-in Security** - Role-based access control and security policies
|
|
11
|
+
- 📦 **Module System** - Reusable database modules with dependency management
|
|
12
|
+
- 🔄 **Smart Migrations** - Automated migration generation and deployment
|
|
13
|
+
- 🛠️ **Developer Experience** - Hot-reload development server with GraphiQL explorer
|
|
14
|
+
- 🏗️ **Production Ready** - Deployment plans, versioning, and rollback support
|
|
15
|
+
|
|
16
|
+
## 🚀 Quick Start
|
|
17
|
+
|
|
18
|
+
### Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g @launchql/cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Create Your First Project
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Initialize a new workspace
|
|
28
|
+
lql init --workspace
|
|
29
|
+
cd my-project
|
|
30
|
+
|
|
31
|
+
# Create your first module
|
|
32
|
+
lql init
|
|
33
|
+
|
|
34
|
+
# Deploy to your database
|
|
35
|
+
lql deploy --createdb
|
|
36
|
+
|
|
37
|
+
# Start the development server
|
|
38
|
+
lql server
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Visit `http://localhost:5555` to explore your GraphQL API!
|
|
42
|
+
|
|
43
|
+
## 📖 Core Concepts
|
|
44
|
+
|
|
45
|
+
### Workspaces and Modules
|
|
46
|
+
|
|
47
|
+
- **Workspace**: A collection of related database modules
|
|
48
|
+
- **Module**: A self-contained database package with migrations, functions, and types
|
|
49
|
+
- **Dependencies**: Modules can depend on other modules, creating reusable building blocks
|
|
50
|
+
|
|
51
|
+
### Database-First Workflow
|
|
52
|
+
|
|
53
|
+
1. **Design** your database schema using SQL migrations
|
|
54
|
+
2. **Deploy** changes with `lql deploy`
|
|
55
|
+
3. **Develop** against the auto-generated GraphQL API
|
|
56
|
+
4. **Version** and **package** your modules for distribution
|
|
57
|
+
|
|
58
|
+
## 🛠️ Commands
|
|
59
|
+
|
|
60
|
+
### Getting Started
|
|
61
|
+
|
|
62
|
+
#### `lql init`
|
|
63
|
+
|
|
64
|
+
Initialize a new LaunchQL workspace or module.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Create a new workspace
|
|
68
|
+
lql init --workspace
|
|
69
|
+
|
|
70
|
+
# Create a new module (run inside workspace)
|
|
71
|
+
lql init
|
|
72
|
+
|
|
73
|
+
# Use templates from GitHub repository
|
|
74
|
+
lql init --workspace --repo owner/repo
|
|
75
|
+
lql init --repo owner/repo --from-branch develop
|
|
76
|
+
|
|
77
|
+
# Use templates from local path
|
|
78
|
+
lql init --workspace --template-path ./custom-templates
|
|
79
|
+
lql init --template-path ./custom-templates/module
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Options:**
|
|
83
|
+
|
|
84
|
+
- `--workspace` - Initialize workspace instead of module
|
|
85
|
+
- `--repo <repo>` - Use templates from GitHub repository (e.g., `owner/repo`)
|
|
86
|
+
- `--template-path <path>` - Use templates from local path
|
|
87
|
+
- `--from-branch <branch>` - Specify branch when using `--repo` (default: `main`)
|
|
88
|
+
|
|
89
|
+
### Development
|
|
90
|
+
|
|
91
|
+
#### `lql server`
|
|
92
|
+
|
|
93
|
+
Start the GraphQL development server with hot-reload.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Start with defaults (port 5555)
|
|
97
|
+
lql server
|
|
98
|
+
|
|
99
|
+
# Custom port and options
|
|
100
|
+
lql server --port 8080 --no-postgis
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### `lql explorer`
|
|
104
|
+
|
|
105
|
+
Launch GraphiQL explorer for your API.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Launch explorer
|
|
109
|
+
lql explorer
|
|
110
|
+
|
|
111
|
+
# With custom CORS origin
|
|
112
|
+
lql explorer --origin http://localhost:3000
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Database Operations
|
|
116
|
+
|
|
117
|
+
#### `lql deploy`
|
|
118
|
+
|
|
119
|
+
Deploy your database changes and migrations.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Deploy to selected database
|
|
123
|
+
lql deploy
|
|
124
|
+
|
|
125
|
+
# Create database if it doesn't exist
|
|
126
|
+
lql deploy --createdb
|
|
127
|
+
|
|
128
|
+
# Deploy specific package to a tag
|
|
129
|
+
lql deploy --package mypackage --to @v1.0.0
|
|
130
|
+
|
|
131
|
+
# Fast deployment without transactions
|
|
132
|
+
lql deploy --fast --no-tx
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### `lql verify`
|
|
136
|
+
|
|
137
|
+
Verify your database state matches expected migrations.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Verify current state
|
|
141
|
+
lql verify
|
|
142
|
+
|
|
143
|
+
# Verify specific package
|
|
144
|
+
lql verify --package mypackage
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### `lql revert`
|
|
148
|
+
|
|
149
|
+
Safely revert database changes.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Revert latest changes
|
|
153
|
+
lql revert
|
|
154
|
+
|
|
155
|
+
# Revert to specific tag
|
|
156
|
+
lql revert --to @v1.0.0
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Migration Management
|
|
160
|
+
|
|
161
|
+
#### `lql migrate`
|
|
162
|
+
|
|
163
|
+
Comprehensive migration management.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Initialize migration tracking
|
|
167
|
+
lql migrate init
|
|
168
|
+
|
|
169
|
+
# Check migration status
|
|
170
|
+
lql migrate status
|
|
171
|
+
|
|
172
|
+
# List all changes
|
|
173
|
+
lql migrate list
|
|
174
|
+
|
|
175
|
+
# Show change dependencies
|
|
176
|
+
lql migrate deps
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Module Management
|
|
180
|
+
|
|
181
|
+
#### `lql install`
|
|
182
|
+
|
|
183
|
+
Install LaunchQL modules as dependencies.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Install single package
|
|
187
|
+
lql install @launchql/auth
|
|
188
|
+
|
|
189
|
+
# Install multiple packages
|
|
190
|
+
lql install @launchql/auth @launchql/utils
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### `lql extension`
|
|
194
|
+
|
|
195
|
+
Interactively manage module dependencies.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
lql extension
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### `lql tag`
|
|
202
|
+
|
|
203
|
+
Version your changes with tags.
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Tag latest change
|
|
207
|
+
lql tag v1.0.0
|
|
208
|
+
|
|
209
|
+
# Tag with comment
|
|
210
|
+
lql tag v1.0.0 --comment "Initial release"
|
|
211
|
+
|
|
212
|
+
# Tag specific change
|
|
213
|
+
lql tag v1.1.0 --package mypackage --changeName my-change
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Packaging and Distribution
|
|
217
|
+
|
|
218
|
+
#### `lql plan`
|
|
219
|
+
|
|
220
|
+
Generate deployment plans for your modules.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
lql plan
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### `lql package`
|
|
227
|
+
|
|
228
|
+
Package your module for distribution.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Package with defaults
|
|
232
|
+
lql package
|
|
233
|
+
|
|
234
|
+
# Package without deployment plan
|
|
235
|
+
lql package --no-plan
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Utilities
|
|
239
|
+
|
|
240
|
+
#### `lql export`
|
|
241
|
+
|
|
242
|
+
Export migrations from existing databases.
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
lql export
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
#### `lql kill`
|
|
249
|
+
|
|
250
|
+
Clean up database connections and optionally drop databases.
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Kill connections and drop databases
|
|
254
|
+
lql kill
|
|
255
|
+
|
|
256
|
+
# Only kill connections
|
|
257
|
+
lql kill --no-drop
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## 💡 Common Workflows
|
|
261
|
+
|
|
262
|
+
### Starting a New Project
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# 1. Create workspace
|
|
266
|
+
mkdir my-app && cd my-app
|
|
267
|
+
lql init --workspace
|
|
268
|
+
|
|
269
|
+
# 2. Create your first module
|
|
270
|
+
lql init
|
|
271
|
+
|
|
272
|
+
# 3. Add some SQL migrations to sql/ directory
|
|
273
|
+
# 4. Deploy to database
|
|
274
|
+
lql deploy --createdb
|
|
275
|
+
|
|
276
|
+
# 5. Start developing
|
|
277
|
+
lql server
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Using Custom Templates
|
|
281
|
+
|
|
282
|
+
You can use custom templates from GitHub repositories or local paths:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# Initialize workspace with templates from GitHub
|
|
286
|
+
lql init --workspace --repo owner/repo
|
|
287
|
+
|
|
288
|
+
# Initialize workspace with templates from local path
|
|
289
|
+
lql init --workspace --template-path ./my-custom-templates
|
|
290
|
+
|
|
291
|
+
# Initialize module with custom templates
|
|
292
|
+
lql init --template-path ./my-custom-templates
|
|
293
|
+
|
|
294
|
+
# Use specific branch from GitHub repository
|
|
295
|
+
lql init --workspace --repo owner/repo --from-branch develop
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Template Structure:**
|
|
299
|
+
Custom templates should follow the same structure as the default templates:
|
|
300
|
+
|
|
301
|
+
- For workspace: `boilerplates/workspace/` directory
|
|
302
|
+
- For module: `boilerplates/module/` directory
|
|
303
|
+
- Or provide direct path to `workspace/` or `module/` directory
|
|
304
|
+
|
|
305
|
+
### Working with Existing Projects
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# 1. Clone and enter project
|
|
309
|
+
git clone <repo> && cd <project>
|
|
310
|
+
|
|
311
|
+
# 2. Install dependencies
|
|
312
|
+
lql install
|
|
313
|
+
|
|
314
|
+
# 3. Deploy to local database
|
|
315
|
+
lql deploy --createdb
|
|
316
|
+
|
|
317
|
+
# 4. Start development server
|
|
318
|
+
lql server
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Production Deployment
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# 1. Create deployment plan
|
|
325
|
+
lql plan
|
|
326
|
+
|
|
327
|
+
# 2. Package module
|
|
328
|
+
lql package
|
|
329
|
+
|
|
330
|
+
# 3. Deploy to production
|
|
331
|
+
lql deploy --package myapp --to @production
|
|
332
|
+
|
|
333
|
+
# 4. Verify deployment
|
|
334
|
+
lql verify --package myapp
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## ⚙️ Configuration
|
|
338
|
+
|
|
339
|
+
### Environment Variables
|
|
340
|
+
|
|
341
|
+
LaunchQL respects standard PostgreSQL environment variables:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
export PGHOST=localhost
|
|
345
|
+
export PGPORT=5432
|
|
346
|
+
export PGDATABASE=myapp
|
|
347
|
+
export PGUSER=postgres
|
|
348
|
+
export PGPASSWORD=password
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## 🆘 Getting Help
|
|
352
|
+
|
|
353
|
+
### Command Help
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
# Global help
|
|
357
|
+
lql --help
|
|
358
|
+
|
|
359
|
+
# Command-specific help
|
|
360
|
+
lql deploy --help
|
|
361
|
+
lql server -h
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Common Options
|
|
365
|
+
|
|
366
|
+
Most commands support these global options:
|
|
367
|
+
|
|
368
|
+
- `--help, -h` - Show help information
|
|
369
|
+
- `--version, -v` - Show version information
|
|
370
|
+
- `--cwd <dir>` - Set working directory
|
|
371
|
+
|
|
372
|
+
## Related LaunchQL Tooling
|
|
373
|
+
|
|
374
|
+
### 🧪 Testing
|
|
375
|
+
|
|
376
|
+
* [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.
|
|
377
|
+
* [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.
|
|
378
|
+
* [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.
|
|
379
|
+
* [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.
|
|
380
|
+
|
|
381
|
+
### 🧠 Parsing & AST
|
|
382
|
+
|
|
383
|
+
* [launchql/pgsql-parser](https://github.com/launchql/pgsql-parser): **🔄 SQL conversion engine** that interprets and converts PostgreSQL syntax.
|
|
384
|
+
* [launchql/libpg-query-node](https://github.com/launchql/libpg-query-node): **🌉 Node.js bindings** for `libpg_query`, converting SQL into parse trees.
|
|
385
|
+
* [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.
|
|
386
|
+
* [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): **🏷️ TypeScript enums** for PostgreSQL AST for safe and ergonomic parsing logic.
|
|
387
|
+
* [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
|
|
388
|
+
* [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
|
|
389
|
+
* [launchql/pg-ast](https://github.com/launchql/launchql/tree/main/packages/pg-ast): **🔍 Low-level AST tools** and transformations for Postgres query structures.
|
|
390
|
+
|
|
391
|
+
### 🚀 API & Dev Tools
|
|
392
|
+
|
|
393
|
+
* [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.
|
|
394
|
+
* [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.
|
|
395
|
+
|
|
396
|
+
### 🔁 Streaming & Uploads
|
|
397
|
+
|
|
398
|
+
* [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.
|
|
399
|
+
* [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.
|
|
400
|
+
* [launchql/etag-stream](https://github.com/launchql/launchql/tree/main/packages/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
|
|
401
|
+
* [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.
|
|
402
|
+
* [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.
|
|
403
|
+
* [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.
|
|
404
|
+
|
|
405
|
+
### 🧰 CLI & Codegen
|
|
406
|
+
|
|
407
|
+
* [@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.
|
|
408
|
+
* [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.
|
|
409
|
+
* [@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.
|
|
410
|
+
* [@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.
|
|
411
|
+
|
|
412
|
+
## Disclaimer
|
|
413
|
+
|
|
414
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
415
|
+
|
|
416
|
+
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;
|
package/commands/add.js
ADDED
|
@@ -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 argv_1 = require("../utils/argv");
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const addUsageText = `
|
|
40
|
+
LaunchQL Add Command:
|
|
41
|
+
|
|
42
|
+
lql 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
|
+
lql add organizations Add change named 'organizations'
|
|
57
|
+
lql add brands --note "Adds the brands table" Add change with note
|
|
58
|
+
lql add contacts --requires users --note "Adds contacts table" Add with dependency
|
|
59
|
+
lql 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,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
|
+
LaunchQL Admin Users Add Command:
|
|
9
|
+
|
|
10
|
+
lql admin-users add [OPTIONS]
|
|
11
|
+
|
|
12
|
+
Add database users with LaunchQL roles.
|
|
13
|
+
Note: You must run 'lql 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
|
+
lql admin-users add --username myuser --password mypass
|
|
24
|
+
lql admin-users add --test # Add test users (requires bootstrap first)
|
|
25
|
+
lql 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 LaunchQL 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,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
|
+
LaunchQL Admin Users Bootstrap Command:
|
|
9
|
+
|
|
10
|
+
lql admin-users bootstrap [OPTIONS]
|
|
11
|
+
|
|
12
|
+
Initialize LaunchQL roles and permissions. This command must be run before adding users.
|
|
13
|
+
Creates the standard LaunchQL 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
|
+
lql admin-users bootstrap # Initialize LaunchQL 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 LaunchQL 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('LaunchQL roles and permissions initialized successfully.');
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
await init.close();
|
|
48
|
+
}
|
|
49
|
+
return argv;
|
|
50
|
+
};
|