@quickback-dev/cli 0.10.5 → 0.10.9
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/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +8 -1
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +76 -64
- package/dist/commands/create.js.map +1 -1
- package/dist/docs/content.d.ts.map +1 -1
- package/dist/docs/content.js +251 -241
- package/dist/docs/content.js.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts +6 -0
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/file-loader.d.ts +13 -0
- package/dist/lib/file-loader.d.ts.map +1 -1
- package/dist/lib/file-loader.js +54 -0
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/skill/SKILL.md +49 -6
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +6 -52
- package/dist/templates/registry.js.map +1 -1
- package/package.json +14 -14
- package/src/skill/SKILL.md +48 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quickback-dev/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.9",
|
|
4
4
|
"description": "CLI for Quickback — define your backend in TypeScript, compile to a fully wired Cloudflare Worker (or Bun / Node) with auth, database, migrations, security, CMS, and Account UI.",
|
|
5
5
|
"author": "Kardoe Incorporated <paul@kardoe.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,6 +41,18 @@
|
|
|
41
41
|
"README.md",
|
|
42
42
|
"LICENSE"
|
|
43
43
|
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"prebuild": "npx tsx scripts/inject-version.ts && npm run bundle:docs && npm run bundle:skill && npm run bundle:examples",
|
|
46
|
+
"build": "tsc",
|
|
47
|
+
"postbuild": "npx tsx scripts/bundle-cursor.ts && rm -rf dist/skill dist/examples && cp -r src/skill dist/skill && cp -r src/examples dist/examples",
|
|
48
|
+
"dev": "tsc --watch",
|
|
49
|
+
"test": "bun test",
|
|
50
|
+
"typecheck": "tsc --noEmit",
|
|
51
|
+
"bundle:docs": "npx tsx scripts/bundle-docs.ts",
|
|
52
|
+
"bundle:skill": "npx tsx scripts/bundle-skill.ts",
|
|
53
|
+
"bundle:cursor": "npx tsx scripts/bundle-cursor.ts",
|
|
54
|
+
"bundle:examples": "npx tsx scripts/bundle-examples.ts"
|
|
55
|
+
},
|
|
44
56
|
"dependencies": {
|
|
45
57
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
46
58
|
"esbuild": "^0.27.2",
|
|
@@ -65,17 +77,5 @@
|
|
|
65
77
|
},
|
|
66
78
|
"engines": {
|
|
67
79
|
"node": ">=18.0.0"
|
|
68
|
-
},
|
|
69
|
-
"scripts": {
|
|
70
|
-
"prebuild": "npx tsx scripts/inject-version.ts && npm run bundle:docs && npm run bundle:skill && npm run bundle:examples",
|
|
71
|
-
"build": "tsc",
|
|
72
|
-
"postbuild": "npx tsx scripts/bundle-cursor.ts && rm -rf dist/skill dist/examples && cp -r src/skill dist/skill && cp -r src/examples dist/examples",
|
|
73
|
-
"dev": "tsc --watch",
|
|
74
|
-
"test": "bun test",
|
|
75
|
-
"typecheck": "tsc --noEmit",
|
|
76
|
-
"bundle:docs": "npx tsx scripts/bundle-docs.ts",
|
|
77
|
-
"bundle:skill": "npx tsx scripts/bundle-skill.ts",
|
|
78
|
-
"bundle:cursor": "npx tsx scripts/bundle-cursor.ts",
|
|
79
|
-
"bundle:examples": "npx tsx scripts/bundle-examples.ts"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|
package/src/skill/SKILL.md
CHANGED
|
@@ -159,11 +159,54 @@ export default defineConfig({
|
|
|
159
159
|
|
|
160
160
|
## Automatic Audit Fields
|
|
161
161
|
|
|
162
|
-
Quickback
|
|
163
|
-
- `createdAt`, `modifiedAt`, `deletedAt` (timestamps)
|
|
164
|
-
- `createdBy`, `modifiedBy`, `deletedBy` (user IDs)
|
|
162
|
+
Quickback injects four **audit columns** into every table at compile time, and the runtime hard-stamps them on every write:
|
|
165
163
|
|
|
166
|
-
|
|
164
|
+
- `createdAt`, `createdBy` — set on insert
|
|
165
|
+
- `modifiedAt`, `modifiedBy` — set on every insert and every update
|
|
166
|
+
|
|
167
|
+
`deletedAt` / `deletedBy` are **soft-delete fields**, not audit fields. They're a separate per-table mechanism, injected only when the resource uses soft delete (the default). When `crud.delete.mode` and `crud.batchDelete.mode` are both `'hard'`, the columns aren't injected and the soft-delete firewall predicate is dropped.
|
|
168
|
+
|
|
169
|
+
**Do NOT add any of these six to your schema files.** They are injected by the compiler.
|
|
170
|
+
|
|
171
|
+
### Caller contract (write through the request-context `db`)
|
|
172
|
+
|
|
173
|
+
The wrapper around `db` overwrites all four audit fields on every `.insert().values()` and `.set()` call — caller-supplied values are silently dropped. So in custom actions:
|
|
174
|
+
|
|
175
|
+
✅ INSERT — set `id` and domain fields only:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
await db.insert(records).values({ id: createId(), name: input.name });
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
✅ UPDATE — set domain fields only:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
await db.update(records).set({ status: 'closed' }).where(...);
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
✅ SOFT DELETE — pass `deletedAt` as the *signal* of intent (any value works; the wrapper overwrites with `now`/`ctx.userId`):
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
await db.update(records).set({ deletedAt: new Date() }).where(...);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
❌ Don't pass `createdAt`, `createdBy`, `modifiedAt`, `modifiedBy`, or `deletedBy` — they're not yours to set.
|
|
194
|
+
|
|
195
|
+
### Actor convention (`ctx.userId` for non-user writes)
|
|
196
|
+
|
|
197
|
+
The wrapper throws `audit-wrapper: <op> reached without ctx.userId` if a write reaches it without a userId. For user-driven requests, auth middleware fills it in. For non-user entry points, mint a synthetic actor id at the boundary:
|
|
198
|
+
|
|
199
|
+
| Boundary | Actor id |
|
|
200
|
+
|---|---|
|
|
201
|
+
| Inbound webhook | `system:webhook-<provider>` |
|
|
202
|
+
| Cron / scheduled | `system:cron-<job>` |
|
|
203
|
+
| Queue worker | `system:queue-<queue>` |
|
|
204
|
+
| Quickback platform-internal write | `system:quickback` |
|
|
205
|
+
| Out-of-band operator script | `system:script-<name>` |
|
|
206
|
+
|
|
207
|
+
**Inherit before you mint.** A user request that triggers cascades, hooks, or enqueues background jobs should carry the user's id through every downstream write. Only mint when there is genuinely no upstream user.
|
|
208
|
+
|
|
209
|
+
For migrations / schema repair / backfill scripts that genuinely should not be audited at all, use the unwrapped `createDb` directly instead of the request-context `db`. That bypasses the wrapper entirely; `createdBy`/`modifiedBy` will be `NULL` on those rows.
|
|
167
210
|
|
|
168
211
|
---
|
|
169
212
|
|
|
@@ -442,7 +485,7 @@ columns: {
|
|
|
442
485
|
| `organizationId` / `organisationId` | `{ field: '...', equals: 'ctx.activeOrgId' }` |
|
|
443
486
|
| `userId` (or `ownerId`) | `{ field: '...', equals: 'ctx.userId' }` |
|
|
444
487
|
| `teamId` | `{ field: 'teamId', equals: 'ctx.activeTeamId' }` |
|
|
445
|
-
| `deletedAt` (
|
|
488
|
+
| `deletedAt` (present whenever the resource uses soft delete, which is the default) | `{ field: 'deletedAt', isNull: true }` |
|
|
446
489
|
|
|
447
490
|
- Exactly one isolation column → auto-derived.
|
|
448
491
|
- Two or more → compile-time error; declare `firewall: [...]` explicitly OR use `q.scope()` to lock semantics in the source.
|