@quickback-dev/cli 0.13.0 → 0.14.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 (26) hide show
  1. package/dist/docs/content.js +11 -11
  2. package/dist/docs/content.js.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/skill/docs/changelog.md +192 -1
  5. package/dist/skill/docs/compiler/definitions/access.md +164 -2
  6. package/dist/skill/docs/compiler/definitions/actions.md +145 -0
  7. package/dist/skill/docs/compiler/definitions/firewall.md +46 -0
  8. package/dist/skill/docs/compiler/definitions/index.md +2 -0
  9. package/dist/skill/docs/compiler/definitions/masking.md +11 -0
  10. package/dist/skill/docs/compiler/definitions/read.md +8 -7
  11. package/dist/skill/docs/compiler/definitions/views.md +100 -12
  12. package/dist/skill/docs/compiler/getting-started/full-example.md +12 -11
  13. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +1 -2
  14. package/dist/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +8 -13
  15. package/package.json +1 -1
  16. package/src/skill/docs/changelog.md +192 -1
  17. package/src/skill/docs/compiler/definitions/access.md +164 -2
  18. package/src/skill/docs/compiler/definitions/actions.md +145 -0
  19. package/src/skill/docs/compiler/definitions/firewall.md +46 -0
  20. package/src/skill/docs/compiler/definitions/index.md +2 -0
  21. package/src/skill/docs/compiler/definitions/masking.md +11 -0
  22. package/src/skill/docs/compiler/definitions/read.md +8 -7
  23. package/src/skill/docs/compiler/definitions/views.md +100 -12
  24. package/src/skill/docs/compiler/getting-started/full-example.md +12 -11
  25. package/src/skill/docs/compiler/targets/hono-api/using-the-api/crud.md +1 -2
  26. package/src/skill/docs/compiler/targets/hono-api/using-the-api/views-api.md +8 -13
@@ -253,16 +253,17 @@ import { AuthErrors, AccessErrors, GuardErrors } from '../../lib/errors';
253
253
 
254
254
  const app = new Hono();
255
255
 
256
- // GET /candidates?view=<name> — unified read handler dispatched by ?view
256
+ // GET /candidates/views/:viewName — named view projection
257
257
  const READ_ACCESS = { roles: ['owner', 'hiring-manager', 'recruiter', 'interviewer'] };
258
258
 
259
- app.get('/', async (c) => {
259
+ app.get('/views/:viewName', async (c) => {
260
260
  const ctx = c.get('ctx');
261
261
  const db = c.get('db');
262
262
 
263
+ const viewName = c.req.param('viewName');
263
264
  const params = Object.fromEntries(new URL(c.req.url).searchParams);
264
- const view = VIEWS_CONFIG[params.view as keyof typeof VIEWS_CONFIG];
265
- if (!view) return c.json({ error: 'View required', code: 'VIEW_REQUIRED' }, 400);
265
+ const view = VIEWS_CONFIG[viewName as keyof typeof VIEWS_CONFIG];
266
+ if (!view) return c.json({ error: 'Unknown view', code: 'VIEW_NOT_FOUND' }, 400);
266
267
 
267
268
  // Per-view access gate (falls back to read-level access)
268
269
  if (!await evaluateAccess(view.access ?? READ_ACCESS, ctx)) {
@@ -273,7 +274,7 @@ app.get('/', async (c) => {
273
274
  const results = await db.select(/* projected fields */).from(candidates)
274
275
  .where(buildFirewallConditions(ctx));
275
276
 
276
- return c.json({ data: maskCandidates(results, ctx), view: params.view });
277
+ return c.json({ data: maskCandidates(results, ctx), view: viewName });
277
278
  });
278
279
 
279
280
  // POST /candidates - Create with guards
@@ -383,10 +384,10 @@ Views control **which fields are returned**. Masking controls **what values are
383
384
 
384
385
  | Endpoint | Role | `phone` in response? | `phone` value |
385
386
  |----------|------|--------------------|-------------|
386
- | `/candidates?view=pipeline` | interviewer | No | N/A |
387
- | `/candidates?view=pipeline` | recruiter | No | N/A |
388
- | `/candidates?view=full` | interviewer | No | N/A (no access) |
389
- | `/candidates?view=full` | recruiter | Yes | `555-123-4567` |
387
+ | `/candidates/views/pipeline` | interviewer | No | N/A |
388
+ | `/candidates/views/pipeline` | recruiter | No | N/A |
389
+ | `/candidates/views/full` | interviewer | No | N/A (no access) |
390
+ | `/candidates/views/full` | recruiter | Yes | `555-123-4567` |
390
391
 
391
392
  ### Guards Enforcement
392
393
 
@@ -417,8 +418,8 @@ POST /candidates
417
418
  | `POST` | `/candidates` | hiring-manager, recruiter |
418
419
  | `PATCH` | `/candidates/:id` | hiring-manager, recruiter |
419
420
  | `DELETE` | `/candidates/:id` | hiring-manager |
420
- | `GET` | `/candidates?view=pipeline` | owner, hiring-manager, recruiter, interviewer |
421
- | `GET` | `/candidates?view=full` | hiring-manager, recruiter |
421
+ | `GET` | `/candidates/views/pipeline` | owner, hiring-manager, recruiter, interviewer |
422
+ | `GET` | `/candidates/views/full` | hiring-manager, recruiter |
422
423
 
423
424
  ---
424
425
 
@@ -75,8 +75,7 @@ Calls a client makes:
75
75
  ```bash
76
76
  GET /jobs # Collection — gated by read.access
77
77
  GET /jobs/:id # Single — gated by read.access (with ID-probe defense)
78
- GET /jobs?view=summary # View dispatch
79
- GET /jobs/views/summary # Explicit view path
78
+ GET /jobs/views/summary # Named view projection
80
79
  ```
81
80
 
82
81
  ### ID-probe defense on `/:id`
@@ -4,14 +4,14 @@ Views provide named column projections that limit which fields are returned in A
4
4
 
5
5
  ## Endpoints
6
6
 
7
- Views are dispatched two equivalent ways:
7
+ Named views are queried through a dedicated path endpoint:
8
8
 
9
9
  ```
10
- GET /api/v1/{resource}?view={view-name} # Query-string dispatch
11
- GET /api/v1/{resource}/views/{view-name} # Explicit path
10
+ GET /api/v1/{resource}/views/{view-name}
12
11
  ```
13
12
 
14
- Both forms are emitted automatically and behave identically.
13
+ If you set `read.defaultView`, bare `GET /api/v1/{resource}` can still resolve
14
+ to that view. Named views themselves are addressed via `/views/{view-name}`.
15
15
 
16
16
  ## Example
17
17
 
@@ -39,11 +39,6 @@ export default defineTable(candidates, {
39
39
  ### Request
40
40
 
41
41
  ```bash
42
- # Query-string form
43
- curl '/api/v1/candidates?view=pipeline' \
44
- -H "Authorization: Bearer <token>"
45
-
46
- # Path form (equivalent)
47
42
  curl /api/v1/candidates/views/pipeline \
48
43
  -H "Authorization: Bearer <token>"
49
44
  ```
@@ -57,11 +52,11 @@ curl /api/v1/candidates/views/pipeline \
57
52
  { "id": "cand_002", "name": "Bob Martinez", "source": "referral" }
58
53
  ],
59
54
  "view": "pipeline",
60
- "fields": ["id", "name", "source"],
61
55
  "pagination": {
62
- "limit": 50,
63
- "offset": 0,
64
- "count": 2
56
+ "count": 2,
57
+ "page": 1,
58
+ "pageSize": 50,
59
+ "hasMore": false
65
60
  }
66
61
  }
67
62
  ```