@deskwork/studio 0.15.0 → 0.16.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/dist/components/scrapbook-item.d.ts +20 -0
- package/dist/components/scrapbook-item.d.ts.map +1 -1
- package/dist/components/scrapbook-item.js +21 -2
- package/dist/components/scrapbook-item.js.map +1 -1
- package/dist/pages/dashboard/affordances.d.ts.map +1 -1
- package/dist/pages/dashboard/affordances.js +13 -1
- package/dist/pages/dashboard/affordances.js.map +1 -1
- package/dist/pages/dashboard/affordances.ts +13 -1
- package/dist/pages/review-scrapbook-drawer.d.ts.map +1 -1
- package/dist/pages/review-scrapbook-drawer.js +10 -1
- package/dist/pages/review-scrapbook-drawer.js.map +1 -1
- package/dist/pages/review-scrapbook-drawer.ts +11 -1
- package/dist/pages/scrapbook/dispatch.d.ts +50 -0
- package/dist/pages/scrapbook/dispatch.d.ts.map +1 -0
- package/dist/pages/scrapbook/dispatch.js +104 -0
- package/dist/pages/scrapbook/dispatch.js.map +1 -0
- package/dist/pages/scrapbook/image-readers.d.ts +24 -0
- package/dist/pages/scrapbook/image-readers.d.ts.map +1 -0
- package/dist/pages/scrapbook/image-readers.js +135 -0
- package/dist/pages/scrapbook/image-readers.js.map +1 -0
- package/dist/pages/scrapbook/index.d.ts +21 -0
- package/dist/pages/scrapbook/index.d.ts.map +1 -0
- package/dist/pages/scrapbook/index.js +96 -0
- package/dist/pages/scrapbook/index.js.map +1 -0
- package/dist/pages/scrapbook/render.d.ts +68 -0
- package/dist/pages/scrapbook/render.d.ts.map +1 -0
- package/dist/pages/scrapbook/render.js +315 -0
- package/dist/pages/scrapbook/render.js.map +1 -0
- package/dist/pages/scrapbook/text-helpers.d.ts +40 -0
- package/dist/pages/scrapbook/text-helpers.d.ts.map +1 -0
- package/dist/pages/scrapbook/text-helpers.js +92 -0
- package/dist/pages/scrapbook/text-helpers.js.map +1 -0
- package/dist/pages/scrapbook/types.d.ts +26 -0
- package/dist/pages/scrapbook/types.d.ts.map +1 -0
- package/dist/pages/scrapbook/types.js +12 -0
- package/dist/pages/scrapbook/types.js.map +1 -0
- package/dist/pages/scrapbook.d.ts +8 -8
- package/dist/pages/scrapbook.d.ts.map +1 -1
- package/dist/pages/scrapbook.js +8 -600
- package/dist/pages/scrapbook.js.map +1 -1
- package/dist/pages/scrapbook.ts +11 -660
- package/dist/routes/api.d.ts.map +1 -1
- package/dist/routes/api.js +111 -2
- package/dist/routes/api.js.map +1 -1
- package/dist/routes/entry-annotation-body.d.ts +29 -0
- package/dist/routes/entry-annotation-body.d.ts.map +1 -1
- package/dist/routes/entry-annotation-body.js +80 -0
- package/dist/routes/entry-annotation-body.js.map +1 -1
- package/dist/routes/scrapbook-file.d.ts +1 -1
- package/dist/routes/scrapbook-file.js +1 -1
- package/dist/routes/scrapbook-mutation-dispatch.d.ts +29 -0
- package/dist/routes/scrapbook-mutation-dispatch.d.ts.map +1 -0
- package/dist/routes/scrapbook-mutation-dispatch.js +63 -0
- package/dist/routes/scrapbook-mutation-dispatch.js.map +1 -0
- package/dist/routes/scrapbook-mutation-envelope.d.ts +93 -0
- package/dist/routes/scrapbook-mutation-envelope.d.ts.map +1 -0
- package/dist/routes/scrapbook-mutation-envelope.js +147 -0
- package/dist/routes/scrapbook-mutation-envelope.js.map +1 -0
- package/dist/routes/scrapbook-mutations.d.ts +25 -7
- package/dist/routes/scrapbook-mutations.d.ts.map +1 -1
- package/dist/routes/scrapbook-mutations.js +67 -92
- package/dist/routes/scrapbook-mutations.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +16 -2
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
- package/dist/pages/review.d.ts +0 -68
- package/dist/pages/review.d.ts.map +0 -1
- package/dist/pages/review.js +0 -561
- package/dist/pages/review.js.map +0 -1
- package/dist/pages/review.ts +0 -710
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation-envelope parsing for the studio scrapbook routes.
|
|
3
|
+
*
|
|
4
|
+
* Lives next to `scrapbook-mutations.ts`; extracted (#191) to keep the
|
|
5
|
+
* route file under the project's 300–500 line cap. The single
|
|
6
|
+
* responsibility is:
|
|
7
|
+
*
|
|
8
|
+
* 1. Validate the request envelope (`site`, `entryId | slug`, `secret?`).
|
|
9
|
+
* 2. Validate `entryId` against the UUID regex BEFORE filesystem access
|
|
10
|
+
* (the scrapbook-file route's same pattern, landed in v0.15.0
|
|
11
|
+
* commit `14ffbe7`).
|
|
12
|
+
* 3. Resolve the absolute scrapbook directory for whichever addressing
|
|
13
|
+
* mode the request used. Both modes route through
|
|
14
|
+
* `scrapbookDirForEntry`: entry-id mode reads the sidecar to get
|
|
15
|
+
* the bound `{ uuid, slug }`; slug mode synthesizes `{ slug }`
|
|
16
|
+
* (no id) and lets the entry-aware resolver fall back to its
|
|
17
|
+
* internal slug-template path. Post-#192 this is a single code
|
|
18
|
+
* path with no public slug-template entry point.
|
|
19
|
+
*
|
|
20
|
+
* The envelope is a discriminated union (`mode: 'entry' | 'slug'`); call
|
|
21
|
+
* sites narrow without `as` casts.
|
|
22
|
+
*/
|
|
23
|
+
import { scrapbookDirForEntry } from '@deskwork/core/scrapbook';
|
|
24
|
+
import { readSidecar } from '@deskwork/core/sidecar';
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// UUID validation
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
/**
|
|
29
|
+
* Mirrors the UUID regex enforced on entry creation and used by the
|
|
30
|
+
* scrapbook-file route. Rejects malformed `entryId` before it reaches
|
|
31
|
+
* the filesystem — `readSidecar` composes its path as
|
|
32
|
+
* `<projectRoot>/.deskwork/entries/<entryId>.json`, and `node:path`'s
|
|
33
|
+
* join collapses `..` segments, so an unvalidated `entryId` could probe
|
|
34
|
+
* arbitrary on-disk locations.
|
|
35
|
+
*/
|
|
36
|
+
export const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
37
|
+
export function isEnvelopeError(v) {
|
|
38
|
+
return 'error' in v;
|
|
39
|
+
}
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// JSON envelope check
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
/**
|
|
44
|
+
* Validate the common `{ site, entryId? | slug?, secret? }` envelope for
|
|
45
|
+
* JSON-body routes. Returns a typed object or an `EnvelopeError` that
|
|
46
|
+
* the caller propagates directly. The site existence check is here so
|
|
47
|
+
* every mutation 404s on unknown sites the same way the read endpoint
|
|
48
|
+
* does.
|
|
49
|
+
*
|
|
50
|
+
* `entryId` is preferred when both are present. UUID validation runs
|
|
51
|
+
* BEFORE filesystem access for the same reason as the scrapbook-file
|
|
52
|
+
* route — see the UUID_RE comment above.
|
|
53
|
+
*/
|
|
54
|
+
export function checkJsonEnvelope(ctx, body) {
|
|
55
|
+
const site = body.site;
|
|
56
|
+
if (typeof site !== 'string' || site.length === 0) {
|
|
57
|
+
return { error: 'site is required', status: 400 };
|
|
58
|
+
}
|
|
59
|
+
if (!(site in ctx.config.sites)) {
|
|
60
|
+
return { error: `unknown site: ${site}`, status: 404 };
|
|
61
|
+
}
|
|
62
|
+
const secretRaw = body.secret;
|
|
63
|
+
if (secretRaw !== undefined && typeof secretRaw !== 'boolean') {
|
|
64
|
+
return { error: 'secret must be a boolean when provided', status: 400 };
|
|
65
|
+
}
|
|
66
|
+
const secret = secretRaw === true;
|
|
67
|
+
const entryId = body.entryId;
|
|
68
|
+
if (entryId !== undefined) {
|
|
69
|
+
if (typeof entryId !== 'string' || entryId.length === 0) {
|
|
70
|
+
return {
|
|
71
|
+
error: 'entryId must be a non-empty string when provided',
|
|
72
|
+
status: 400,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (!UUID_RE.test(entryId)) {
|
|
76
|
+
return { error: 'invalid entryId', status: 400 };
|
|
77
|
+
}
|
|
78
|
+
return { mode: 'entry', site, entryId, secret };
|
|
79
|
+
}
|
|
80
|
+
// Back-compat slug-template fallback. To be removed in #192 once all
|
|
81
|
+
// callers send entryId.
|
|
82
|
+
const slug = body.slug;
|
|
83
|
+
if (typeof slug !== 'string' || slug.length === 0) {
|
|
84
|
+
return { error: 'entryId or slug is required', status: 400 };
|
|
85
|
+
}
|
|
86
|
+
return { mode: 'slug', site, slug, secret };
|
|
87
|
+
}
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Multipart envelope check
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
/**
|
|
92
|
+
* Same shape as `checkJsonEnvelope` but reads from a `FormData` instance.
|
|
93
|
+
* Used by the upload route, which speaks multipart for binary file
|
|
94
|
+
* payloads. The semantics match — `entryId` preferred, `slug` is the
|
|
95
|
+
* deprecation-window fallback, UUID validation up-front.
|
|
96
|
+
*
|
|
97
|
+
* Note: the multipart `secret` field arrives as the literal string
|
|
98
|
+
* `"true"` (form fields are always strings); we normalize it here so
|
|
99
|
+
* the rest of the pipeline doesn't have to special-case form-vs-json.
|
|
100
|
+
*/
|
|
101
|
+
export function checkFormEnvelope(ctx, form) {
|
|
102
|
+
const site = form.get('site');
|
|
103
|
+
if (typeof site !== 'string' || site.length === 0) {
|
|
104
|
+
return { error: 'site is required', status: 400 };
|
|
105
|
+
}
|
|
106
|
+
if (!(site in ctx.config.sites)) {
|
|
107
|
+
return { error: `unknown site: ${site}`, status: 404 };
|
|
108
|
+
}
|
|
109
|
+
const secretField = form.get('secret');
|
|
110
|
+
const secret = typeof secretField === 'string' && secretField === 'true';
|
|
111
|
+
const entryIdField = form.get('entryId');
|
|
112
|
+
if (typeof entryIdField === 'string' && entryIdField.length > 0) {
|
|
113
|
+
if (!UUID_RE.test(entryIdField)) {
|
|
114
|
+
return { error: 'invalid entryId', status: 400 };
|
|
115
|
+
}
|
|
116
|
+
return { mode: 'entry', site, entryId: entryIdField, secret };
|
|
117
|
+
}
|
|
118
|
+
const slug = form.get('slug');
|
|
119
|
+
if (typeof slug !== 'string' || slug.length === 0) {
|
|
120
|
+
return { error: 'entryId or slug is required', status: 400 };
|
|
121
|
+
}
|
|
122
|
+
return { mode: 'slug', site, slug, secret };
|
|
123
|
+
}
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// Directory resolution
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
/**
|
|
128
|
+
* Resolve the absolute scrapbook directory for a parsed envelope. Both
|
|
129
|
+
* modes go through `scrapbookDirForEntry`:
|
|
130
|
+
* - entry-id mode reads the sidecar and passes `{ id, slug }` so the
|
|
131
|
+
* resolver hits the index lookup (refactor-proof binding).
|
|
132
|
+
* - slug mode passes `{ slug }` only; the resolver still goes through
|
|
133
|
+
* `findEntryFile`, which falls back to its private slug-template
|
|
134
|
+
* path when no id binding exists. Post-#192 this is the only code
|
|
135
|
+
* path; the public `scrapbookDir(slug)` was retired.
|
|
136
|
+
*
|
|
137
|
+
* Throws on lookup / resolution failure; the caller maps the error
|
|
138
|
+
* message onto the right HTTP status via `statusForError`.
|
|
139
|
+
*/
|
|
140
|
+
export async function resolveScrapbookDir(ctx, env) {
|
|
141
|
+
if (env.mode === 'entry') {
|
|
142
|
+
const entry = await readSidecar(ctx.projectRoot, env.entryId);
|
|
143
|
+
return scrapbookDirForEntry(ctx.projectRoot, ctx.config, env.site, { id: entry.uuid, slug: entry.slug });
|
|
144
|
+
}
|
|
145
|
+
return scrapbookDirForEntry(ctx.projectRoot, ctx.config, env.site, { slug: env.slug });
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=scrapbook-mutation-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrapbook-mutation-envelope.js","sourceRoot":"","sources":["../../src/routes/scrapbook-mutation-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACh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AAI,EACR,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CACrC,CAAC;IACJ,CAAC;IACD,OAAO,oBAAoB,CACzB,GAAG,CAAC,WAAW,EACf,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,IAAI,EACR,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -10,15 +10,33 @@
|
|
|
10
10
|
* Phase 16d retrofitted only the read path. v0.4.1 closes the gap
|
|
11
11
|
* (issue #21).
|
|
12
12
|
*
|
|
13
|
+
* Two addressing modes (#191, unified post-#192):
|
|
14
|
+
* - **Entry-id mode** (preferred): `{ site, entryId, ... }` — looks up
|
|
15
|
+
* the entry's sidecar, derives the scrapbook dir from the artifact's
|
|
16
|
+
* parent directory via `scrapbookDirForEntry`, mutates there. Same
|
|
17
|
+
* code path the read endpoints use; refactor-proof for projects whose
|
|
18
|
+
* feature-doc layout doesn't match the kebab-case slug template.
|
|
19
|
+
* - **Slug mode** (back-compat fallback): `{ site, slug, ... }` —
|
|
20
|
+
* accepted for back-compat with older clients. Post-#192, slug mode
|
|
21
|
+
* also routes through `scrapbookDirForEntry`: passing `{ slug }`
|
|
22
|
+
* without an id triggers the resolver's internal slug-template
|
|
23
|
+
* fallback, so the public mutation surface is unified on the
|
|
24
|
+
* entry-aware code path. The legacy `scrapbookDir(slug)` and the
|
|
25
|
+
* slug-template CRUD primitives are no longer exported from
|
|
26
|
+
* `@deskwork/core/scrapbook`.
|
|
27
|
+
*
|
|
28
|
+
* Companion modules (#191 split, to keep this file under the project's
|
|
29
|
+
* 300–500 line cap):
|
|
30
|
+
* - `scrapbook-mutation-envelope.ts` — JSON / form envelope parsing,
|
|
31
|
+
* UUID validation, dir resolution.
|
|
32
|
+
* - `scrapbook-mutation-dispatch.ts` — per-mode dispatch helpers
|
|
33
|
+
* (entry-aware vs. slug-template), one per route verb.
|
|
34
|
+
*
|
|
13
35
|
* Design notes:
|
|
14
36
|
* - Path resolution + traversal protection runs through
|
|
15
|
-
* `@deskwork/core/scrapbook` helpers
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - The client speaks `{ site, slug, filename, body }` for save/create,
|
|
19
|
-
* `{ site, slug, oldName, newName }` for rename, `{ site, slug,
|
|
20
|
-
* filename }` for delete, multipart `{ site, slug, file }` for
|
|
21
|
-
* upload. Endpoints accept those exact field names.
|
|
37
|
+
* `@deskwork/core/scrapbook` helpers. Those throw on `..` sequences,
|
|
38
|
+
* absolute paths, and any filename that escapes the scrapbook dir;
|
|
39
|
+
* we surface those as 400.
|
|
22
40
|
* - We never log file contents on save / upload (privacy). Logging
|
|
23
41
|
* filename + slug is fine but kept silent here — the studio's
|
|
24
42
|
* console is the operator's, not a server log.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrapbook-mutations.d.ts","sourceRoot":"","sources":["../../src/routes/scrapbook-mutations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scrapbook-mutations.d.ts","sourceRoot":"","sources":["../../src/routes/scrapbook-mutations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAgE9C,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAyMvE"}
|
|
@@ -10,15 +10,33 @@
|
|
|
10
10
|
* Phase 16d retrofitted only the read path. v0.4.1 closes the gap
|
|
11
11
|
* (issue #21).
|
|
12
12
|
*
|
|
13
|
+
* Two addressing modes (#191, unified post-#192):
|
|
14
|
+
* - **Entry-id mode** (preferred): `{ site, entryId, ... }` — looks up
|
|
15
|
+
* the entry's sidecar, derives the scrapbook dir from the artifact's
|
|
16
|
+
* parent directory via `scrapbookDirForEntry`, mutates there. Same
|
|
17
|
+
* code path the read endpoints use; refactor-proof for projects whose
|
|
18
|
+
* feature-doc layout doesn't match the kebab-case slug template.
|
|
19
|
+
* - **Slug mode** (back-compat fallback): `{ site, slug, ... }` —
|
|
20
|
+
* accepted for back-compat with older clients. Post-#192, slug mode
|
|
21
|
+
* also routes through `scrapbookDirForEntry`: passing `{ slug }`
|
|
22
|
+
* without an id triggers the resolver's internal slug-template
|
|
23
|
+
* fallback, so the public mutation surface is unified on the
|
|
24
|
+
* entry-aware code path. The legacy `scrapbookDir(slug)` and the
|
|
25
|
+
* slug-template CRUD primitives are no longer exported from
|
|
26
|
+
* `@deskwork/core/scrapbook`.
|
|
27
|
+
*
|
|
28
|
+
* Companion modules (#191 split, to keep this file under the project's
|
|
29
|
+
* 300–500 line cap):
|
|
30
|
+
* - `scrapbook-mutation-envelope.ts` — JSON / form envelope parsing,
|
|
31
|
+
* UUID validation, dir resolution.
|
|
32
|
+
* - `scrapbook-mutation-dispatch.ts` — per-mode dispatch helpers
|
|
33
|
+
* (entry-aware vs. slug-template), one per route verb.
|
|
34
|
+
*
|
|
13
35
|
* Design notes:
|
|
14
36
|
* - Path resolution + traversal protection runs through
|
|
15
|
-
* `@deskwork/core/scrapbook` helpers
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - The client speaks `{ site, slug, filename, body }` for save/create,
|
|
19
|
-
* `{ site, slug, oldName, newName }` for rename, `{ site, slug,
|
|
20
|
-
* filename }` for delete, multipart `{ site, slug, file }` for
|
|
21
|
-
* upload. Endpoints accept those exact field names.
|
|
37
|
+
* `@deskwork/core/scrapbook` helpers. Those throw on `..` sequences,
|
|
38
|
+
* absolute paths, and any filename that escapes the scrapbook dir;
|
|
39
|
+
* we surface those as 400.
|
|
22
40
|
* - We never log file contents on save / upload (privacy). Logging
|
|
23
41
|
* filename + slug is fine but kept silent here — the studio's
|
|
24
42
|
* console is the operator's, not a server log.
|
|
@@ -28,34 +46,14 @@
|
|
|
28
46
|
* so the client UI can flash a useful message.
|
|
29
47
|
*/
|
|
30
48
|
import { Hono } from 'hono';
|
|
31
|
-
import { classify
|
|
49
|
+
import { classify } from '@deskwork/core/scrapbook';
|
|
32
50
|
import { existsSync, mkdirSync, renameSync, statSync } from 'node:fs';
|
|
33
51
|
import { dirname } from 'node:path';
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* on unknown sites the same way the read endpoint does.
|
|
40
|
-
*/
|
|
41
|
-
function checkEnvelope(ctx, body) {
|
|
42
|
-
const site = body.site;
|
|
43
|
-
const slug = body.slug;
|
|
44
|
-
if (typeof site !== 'string' || site.length === 0) {
|
|
45
|
-
return { error: 'site is required', status: 400 };
|
|
46
|
-
}
|
|
47
|
-
if (typeof slug !== 'string' || slug.length === 0) {
|
|
48
|
-
return { error: 'slug is required', status: 400 };
|
|
49
|
-
}
|
|
50
|
-
if (!(site in ctx.config.sites)) {
|
|
51
|
-
return { error: `unknown site: ${site}`, status: 404 };
|
|
52
|
-
}
|
|
53
|
-
const secretRaw = body.secret;
|
|
54
|
-
if (secretRaw !== undefined && typeof secretRaw !== 'boolean') {
|
|
55
|
-
return { error: 'secret must be a boolean when provided', status: 400 };
|
|
56
|
-
}
|
|
57
|
-
return { site, slug, secret: secretRaw === true };
|
|
58
|
-
}
|
|
52
|
+
import { checkFormEnvelope, checkJsonEnvelope, isEnvelopeError, } from "./scrapbook-mutation-envelope.js";
|
|
53
|
+
import { createDispatch, deleteDispatch, renameInPlace, resolveCrossSectionPaths, saveDispatch, uploadDispatch, } from "./scrapbook-mutation-dispatch.js";
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Helpers
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
59
57
|
/**
|
|
60
58
|
* Map a core-helper error message onto the right HTTP status. The core
|
|
61
59
|
* helpers throw plain `Error` with descriptive text; we keep the text
|
|
@@ -91,16 +89,17 @@ async function readJson(c) {
|
|
|
91
89
|
export function createScrapbookMutationsRouter(ctx) {
|
|
92
90
|
const app = new Hono();
|
|
93
91
|
// POST /api/dev/scrapbook/save
|
|
94
|
-
// Body: { site,
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
92
|
+
// Body (entry mode): { site, entryId, filename, body, secret? }
|
|
93
|
+
// Body (slug mode): { site, slug, filename, body, secret? }
|
|
94
|
+
// Behavior: write `body` to <scrapbook-dir>/<filename>. Creates the
|
|
95
|
+
// file if missing (delegates to create when absent so the operator's
|
|
96
|
+
// first save lands rather than 404'ing).
|
|
98
97
|
app.post('/save', async (c) => {
|
|
99
98
|
const parsed = await readJson(c);
|
|
100
99
|
if (!parsed.ok)
|
|
101
100
|
return c.json({ error: parsed.error }, parsed.status);
|
|
102
|
-
const env =
|
|
103
|
-
if (
|
|
101
|
+
const env = checkJsonEnvelope(ctx, parsed.value);
|
|
102
|
+
if (isEnvelopeError(env))
|
|
104
103
|
return c.json({ error: env.error }, env.status);
|
|
105
104
|
const filename = parsed.value.filename;
|
|
106
105
|
const bodyText = parsed.value.body;
|
|
@@ -112,22 +111,7 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
112
111
|
}
|
|
113
112
|
let item;
|
|
114
113
|
try {
|
|
115
|
-
|
|
116
|
-
const abs = scrapbookFilePath(ctx.projectRoot, ctx.config, env.site, env.slug, filename, { secret: env.secret });
|
|
117
|
-
if (!existsSync(abs)) {
|
|
118
|
-
// Only `.md` files can be created by the create helper, but
|
|
119
|
-
// save's contract is "write whatever was sent". For non-md
|
|
120
|
-
// files that don't yet exist, fall through to upload semantics.
|
|
121
|
-
if (filename.endsWith('.md')) {
|
|
122
|
-
item = createScrapbookMarkdown(ctx.projectRoot, ctx.config, env.site, env.slug, filename, bodyText, { secret: env.secret });
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
item = writeScrapbookUpload(ctx.projectRoot, ctx.config, env.site, env.slug, filename, Buffer.from(bodyText, 'utf-8'), { secret: env.secret });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
item = saveScrapbookFile(ctx.projectRoot, ctx.config, env.site, env.slug, filename, bodyText, { secret: env.secret });
|
|
130
|
-
}
|
|
114
|
+
item = await saveDispatch(ctx, env, filename, bodyText);
|
|
131
115
|
}
|
|
132
116
|
catch (err) {
|
|
133
117
|
const reason = err instanceof Error ? err.message : String(err);
|
|
@@ -136,7 +120,8 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
136
120
|
return c.json({ item }, 200);
|
|
137
121
|
});
|
|
138
122
|
// POST /api/dev/scrapbook/rename
|
|
139
|
-
// Body: { site,
|
|
123
|
+
// Body (entry mode): { site, entryId, oldName, newName, secret?, toSecret? }
|
|
124
|
+
// Body (slug mode): { site, slug, oldName, newName, secret?, toSecret? }
|
|
140
125
|
//
|
|
141
126
|
// Two modes:
|
|
142
127
|
// - In-place rename: secret = source location (defaults to false);
|
|
@@ -153,8 +138,8 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
153
138
|
const parsed = await readJson(c);
|
|
154
139
|
if (!parsed.ok)
|
|
155
140
|
return c.json({ error: parsed.error }, parsed.status);
|
|
156
|
-
const env =
|
|
157
|
-
if (
|
|
141
|
+
const env = checkJsonEnvelope(ctx, parsed.value);
|
|
142
|
+
if (isEnvelopeError(env))
|
|
158
143
|
return c.json({ error: env.error }, env.status);
|
|
159
144
|
const oldName = parsed.value.oldName;
|
|
160
145
|
const newName = parsed.value.newName;
|
|
@@ -172,15 +157,13 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
172
157
|
let item;
|
|
173
158
|
try {
|
|
174
159
|
if (toSecret === env.secret) {
|
|
175
|
-
item =
|
|
160
|
+
item = await renameInPlace(ctx, env, oldName, newName);
|
|
176
161
|
}
|
|
177
162
|
else {
|
|
178
|
-
// Cross-section move.
|
|
179
|
-
//
|
|
180
|
-
// sub-roots (and let the resolver enforce traversal guards).
|
|
163
|
+
// Cross-section move. Resolve src + dst absolute paths under the
|
|
164
|
+
// right sub-roots and let the resolver enforce traversal guards.
|
|
181
165
|
// Then physically rename across the two paths.
|
|
182
|
-
const srcAbs =
|
|
183
|
-
const dstAbs = scrapbookFilePath(ctx.projectRoot, ctx.config, env.site, env.slug, newName, { secret: toSecret });
|
|
166
|
+
const { srcAbs, dstAbs } = await resolveCrossSectionPaths(ctx, env, oldName, newName, toSecret);
|
|
184
167
|
if (!existsSync(srcAbs)) {
|
|
185
168
|
return c.json({ error: `file not found: "${oldName}"` }, 404);
|
|
186
169
|
}
|
|
@@ -208,21 +191,22 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
208
191
|
return c.json({ item }, 200);
|
|
209
192
|
});
|
|
210
193
|
// POST /api/dev/scrapbook/delete
|
|
211
|
-
// Body: { site,
|
|
194
|
+
// Body (entry mode): { site, entryId, filename, secret? }
|
|
195
|
+
// Body (slug mode): { site, slug, filename, secret? }
|
|
212
196
|
// Behavior: unlink the file. 404 if missing.
|
|
213
197
|
app.post('/delete', async (c) => {
|
|
214
198
|
const parsed = await readJson(c);
|
|
215
199
|
if (!parsed.ok)
|
|
216
200
|
return c.json({ error: parsed.error }, parsed.status);
|
|
217
|
-
const env =
|
|
218
|
-
if (
|
|
201
|
+
const env = checkJsonEnvelope(ctx, parsed.value);
|
|
202
|
+
if (isEnvelopeError(env))
|
|
219
203
|
return c.json({ error: env.error }, env.status);
|
|
220
204
|
const filename = parsed.value.filename;
|
|
221
205
|
if (typeof filename !== 'string' || filename.length === 0) {
|
|
222
206
|
return c.json({ error: 'filename is required' }, 400);
|
|
223
207
|
}
|
|
224
208
|
try {
|
|
225
|
-
|
|
209
|
+
await deleteDispatch(ctx, env, filename);
|
|
226
210
|
}
|
|
227
211
|
catch (err) {
|
|
228
212
|
const reason = err instanceof Error ? err.message : String(err);
|
|
@@ -231,14 +215,15 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
231
215
|
return c.json({ ok: true }, 200);
|
|
232
216
|
});
|
|
233
217
|
// POST /api/dev/scrapbook/create
|
|
234
|
-
// Body: { site,
|
|
218
|
+
// Body (entry mode): { site, entryId, filename, body?, secret? }
|
|
219
|
+
// Body (slug mode): { site, slug, filename, body?, secret? }
|
|
235
220
|
// Behavior: create a new markdown file. 409 if it already exists.
|
|
236
221
|
app.post('/create', async (c) => {
|
|
237
222
|
const parsed = await readJson(c);
|
|
238
223
|
if (!parsed.ok)
|
|
239
224
|
return c.json({ error: parsed.error }, parsed.status);
|
|
240
|
-
const env =
|
|
241
|
-
if (
|
|
225
|
+
const env = checkJsonEnvelope(ctx, parsed.value);
|
|
226
|
+
if (isEnvelopeError(env))
|
|
242
227
|
return c.json({ error: env.error }, env.status);
|
|
243
228
|
const filename = parsed.value.filename;
|
|
244
229
|
const bodyText = parsed.value.body ?? '';
|
|
@@ -250,7 +235,7 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
250
235
|
}
|
|
251
236
|
let item;
|
|
252
237
|
try {
|
|
253
|
-
item =
|
|
238
|
+
item = await createDispatch(ctx, env, filename, bodyText);
|
|
254
239
|
}
|
|
255
240
|
catch (err) {
|
|
256
241
|
const reason = err instanceof Error ? err.message : String(err);
|
|
@@ -259,12 +244,12 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
259
244
|
return c.json({ item }, 200);
|
|
260
245
|
});
|
|
261
246
|
// POST /api/dev/scrapbook/upload
|
|
262
|
-
// Multipart body: { site,
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
// `scrapbook/secret/` when the `secret` form field is the
|
|
266
|
-
// string "true". 409 if it already exists — operator must
|
|
267
|
-
// or delete first.
|
|
247
|
+
// Multipart body (entry mode): { site, entryId, file, secret? }
|
|
248
|
+
// Multipart body (slug mode): { site, slug, file, secret? }
|
|
249
|
+
// Behavior: save the uploaded file (binary-safe) at the scrapbook dir,
|
|
250
|
+
// or under `scrapbook/secret/` when the `secret` form field is the
|
|
251
|
+
// literal string "true". 409 if it already exists — operator must
|
|
252
|
+
// rename or delete first.
|
|
268
253
|
app.post('/upload', async (c) => {
|
|
269
254
|
let form;
|
|
270
255
|
try {
|
|
@@ -273,20 +258,10 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
273
258
|
catch {
|
|
274
259
|
return c.json({ error: 'invalid multipart body' }, 400);
|
|
275
260
|
}
|
|
276
|
-
const
|
|
277
|
-
|
|
261
|
+
const env = checkFormEnvelope(ctx, form);
|
|
262
|
+
if (isEnvelopeError(env))
|
|
263
|
+
return c.json({ error: env.error }, env.status);
|
|
278
264
|
const file = form.get('file');
|
|
279
|
-
const secretField = form.get('secret');
|
|
280
|
-
const secret = typeof secretField === 'string' && secretField === 'true';
|
|
281
|
-
if (typeof site !== 'string' || site.length === 0) {
|
|
282
|
-
return c.json({ error: 'site is required' }, 400);
|
|
283
|
-
}
|
|
284
|
-
if (typeof slug !== 'string' || slug.length === 0) {
|
|
285
|
-
return c.json({ error: 'slug is required' }, 400);
|
|
286
|
-
}
|
|
287
|
-
if (!(site in ctx.config.sites)) {
|
|
288
|
-
return c.json({ error: `unknown site: ${site}` }, 404);
|
|
289
|
-
}
|
|
290
265
|
if (!(file instanceof File)) {
|
|
291
266
|
return c.json({ error: 'file is required (multipart)' }, 400);
|
|
292
267
|
}
|
|
@@ -297,7 +272,7 @@ export function createScrapbookMutationsRouter(ctx) {
|
|
|
297
272
|
let item;
|
|
298
273
|
try {
|
|
299
274
|
const buf = Buffer.from(await file.arrayBuffer());
|
|
300
|
-
item =
|
|
275
|
+
item = await uploadDispatch(ctx, env, filename, buf);
|
|
301
276
|
}
|
|
302
277
|
catch (err) {
|
|
303
278
|
const reason = err instanceof Error ? err.message : String(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrapbook-mutations.js","sourceRoot":"","sources":["../../src/routes/scrapbook-mutations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,IAAI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ClD,IAAI,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAwBtE,UAAU,OAAO;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,qEAAqE;IACrE,WAAW,EAAE,OAAO,CAAC;CACtB;AAKD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CA8CpD;AAkFD,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAwBtE,UAAU,OAAO;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,qEAAqE;IACrE,WAAW,EAAE,OAAO,CAAC;CACtB;AAKD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CA8CpD;AAkFD,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAyOlD"}
|
package/dist/server.js
CHANGED
|
@@ -43,7 +43,7 @@ import { renderShortformReviewPage } from "./pages/shortform-review.js";
|
|
|
43
43
|
import { renderEntryReviewPage } from "./pages/entry-review.js";
|
|
44
44
|
import { renderShortformPage } from "./pages/shortform.js";
|
|
45
45
|
import { renderHelpPage } from "./pages/help.js";
|
|
46
|
-
import { renderScrapbookPage } from "./pages/scrapbook.js";
|
|
46
|
+
import { renderScrapbookPage, ScrapbookPageError } from "./pages/scrapbook.js";
|
|
47
47
|
import { renderContentTopLevel, renderContentProject, } from "./pages/content.js";
|
|
48
48
|
import { renderStudioIndex } from "./pages/index.js";
|
|
49
49
|
import { detectTailscale } from "./tailscale.js";
|
|
@@ -286,6 +286,11 @@ export function createApp(ctx) {
|
|
|
286
286
|
app.get('/dev/scrapbook/:site/:path{.+}', async (c) => {
|
|
287
287
|
const site = c.req.param('site');
|
|
288
288
|
const path = decodeURIComponent(c.req.param('path'));
|
|
289
|
+
// #205: when the request carries `?entryId=<uuid>`, resolve the
|
|
290
|
+
// listing via `scrapbookDirForEntry` (matching the entry-aware
|
|
291
|
+
// mutation API). Slug-template addressing remains the fallback for
|
|
292
|
+
// legacy callers and ad-hoc paths.
|
|
293
|
+
const entryId = c.req.query('entryId');
|
|
289
294
|
const overridden = await runTemplateOverride(ctx, 'scrapbook', [
|
|
290
295
|
ctx,
|
|
291
296
|
site,
|
|
@@ -293,7 +298,16 @@ export function createApp(ctx) {
|
|
|
293
298
|
]);
|
|
294
299
|
if (overridden !== null)
|
|
295
300
|
return c.html(overridden);
|
|
296
|
-
|
|
301
|
+
try {
|
|
302
|
+
const html = await renderScrapbookPage(ctx, site, path, entryId !== undefined && entryId.length > 0 ? { entryId } : {});
|
|
303
|
+
return c.html(html);
|
|
304
|
+
}
|
|
305
|
+
catch (e) {
|
|
306
|
+
if (e instanceof ScrapbookPageError) {
|
|
307
|
+
return c.json({ error: e.message }, e.status);
|
|
308
|
+
}
|
|
309
|
+
throw e;
|
|
310
|
+
}
|
|
297
311
|
});
|
|
298
312
|
// Read-only binary endpoint for scrapbook files. Used by the
|
|
299
313
|
// shared scrapbook-item renderer (`components/scrapbook-item.ts`)
|