@louise-toolkit/astro 0.2.7 → 0.3.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 CHANGED
@@ -44,8 +44,8 @@ Pass `apiGate: true` to deny the editor API by default: every request under
44
44
  writes and WebSocket upgrades origin-checked. This is the same gate as
45
45
  `composeWorker({ gate })` (ADR 0012), for routes mounted as Astro API routes.
46
46
  Middleware runs before Astro knows which route file answers, so a public route
47
- is declared by path: the toolkit's form and vitals routes are exempt at their
48
- default paths, and `apiGate: { isPublic: (path) => … }` adds your own.
47
+ is declared by path: the toolkit's form, vitals, and status routes are exempt
48
+ at their default paths, and `apiGate: { isPublic: (path) => … }` adds your own.
49
49
 
50
50
  **Actions**: the editor write path as Astro Actions, so a save is a typed call
51
51
  rather than a hand-rolled endpoint. `louiseSaveAction`, `louiseSaveDraftAction`,
package/dist/actions.js CHANGED
@@ -35,6 +35,7 @@
35
35
  // the raw routes (`applyFieldSave`, `applySettingsPatch`), so nothing is parsed or
36
36
  // written twice.
37
37
  import { z } from "astro/zod";
38
+ import { toPageId } from "louise-toolkit/content";
38
39
  import { D1_BOOKMARK_COOKIE } from "louise-toolkit/db";
39
40
  import { applyFieldSave } from "louise-toolkit/editor";
40
41
  import { applySettingsPatch } from "louise-toolkit/editor";
@@ -146,12 +147,14 @@ export function louiseSaveDraftAction(config) {
146
147
  const resolved = resolveDeps(config);
147
148
  return {
148
149
  input: z.object({
149
- id: z.number().int(),
150
+ // Positive, like every row ID, so `toPageId` below can't throw on input
151
+ // this schema accepted.
152
+ id: z.number().int().positive(),
150
153
  data: z.record(z.string(), z.unknown()),
151
154
  }),
152
155
  handler: async (input, context) => {
153
156
  const editor = requireEditor(resolved, context);
154
- const result = await applySaveDraft(resolved.getEnv(context), config, editor, input.id, input.data);
157
+ const result = await applySaveDraft(resolved.getEnv(context), config, editor, toPageId(input.id), input.data);
155
158
  if (!result.ok)
156
159
  throwActionError(resolved.ActionError, result.status, result.error);
157
160
  // Persist the D1 bookmark so this Action's draft is read-your-writes on the
@@ -18,8 +18,8 @@ export interface LouiseMiddlewareApiGate {
18
18
  prefix?: string;
19
19
  /**
20
20
  * Paths under the prefix an anonymous request may still reach, on top of the
21
- * toolkit's own public routes at their default mounts (forms and vitals—see
22
- * `isLouisePublicPath`).
21
+ * toolkit's own public routes at their default mounts (forms, vitals, and
22
+ * status—see `isLouisePublicPath`).
23
23
  *
24
24
  * A path, not a mark on the route, because middleware runs before it knows
25
25
  * which route file will answer: a route can't declare itself public here the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@louise-toolkit/astro",
3
- "version": "0.2.7",
3
+ "version": "0.3.0",
4
4
  "description": "Astro adapter for louise-toolkit: middleware, Actions, content-layer loaders, and the forms schema bridge.",
5
5
  "keywords": [
6
6
  "astro",
@@ -35,7 +35,7 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "louise-toolkit": "0.33.0"
38
+ "louise-toolkit": "0.34.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@cloudflare/workers-types": "^5.20260829.1",