@crombolo/server 0.42.1 → 0.43.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/NOTICE CHANGED
@@ -27,6 +27,15 @@ The Umbraco backoffice
27
27
  @umbraco-cms/backoffice 18.2.0 — MIT — https://github.com/umbraco/Umbraco-CMS
28
28
  @umbraco-ui/uui 2.0.2 — MIT — https://github.com/umbraco/Umbraco.UI
29
29
 
30
+ The Lato fonts
31
+ -------------
32
+ LatoLatin-*.woff2 — Copyright (c) 2011-2015 by tyPoland Lukasz Dziedzic, with
33
+ Reserved Font Name "Lato" — SIL Open Font License 1.1 — https://www.latofonts.com
34
+ Shipped unmodified, as @umbraco-ui/uui ships them, in @crombolo/backoffice-dist
35
+ under `dist/assets/fonts/`, with the licence beside them as `OFL.txt`
36
+ (`packages/backoffice-dist/licenses/Lato-OFL.txt` in this repository). The
37
+ fonts carry the same notice in their own metadata.
38
+
30
39
  Static files from the Umbraco client source tree
31
40
  ------------------------------------------------
32
41
  css/umb-css.css, css/rte-content.css, css/umbraco-blockgridlayout.css
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crombolo/server",
3
- "version": "0.42.1",
3
+ "version": "0.43.1",
4
4
  "description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. The crombolo HTTP server: routing, configuration, media stores and background jobs.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -31,18 +31,18 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@crombolo/api-delivery": "0.42.1",
35
- "@crombolo/api-management": "0.42.1",
36
- "@crombolo/auth": "0.42.1",
37
- "@crombolo/backoffice-host": "0.42.1",
38
- "@crombolo/common": "0.42.1",
39
- "@crombolo/content": "0.42.1",
40
- "@crombolo/contracts": "0.42.1",
41
- "@crombolo/core": "0.42.1",
42
- "@crombolo/data": "0.42.1",
43
- "@crombolo/render": "0.42.1",
44
- "@crombolo/schema": "0.42.1",
45
- "@crombolo/transfer": "0.42.1",
34
+ "@crombolo/api-delivery": "0.43.1",
35
+ "@crombolo/api-management": "0.43.1",
36
+ "@crombolo/auth": "0.43.1",
37
+ "@crombolo/backoffice-host": "0.43.1",
38
+ "@crombolo/common": "0.43.1",
39
+ "@crombolo/content": "0.43.1",
40
+ "@crombolo/contracts": "0.43.1",
41
+ "@crombolo/core": "0.43.1",
42
+ "@crombolo/data": "0.43.1",
43
+ "@crombolo/render": "0.43.1",
44
+ "@crombolo/schema": "0.43.1",
45
+ "@crombolo/transfer": "0.43.1",
46
46
  "@logtape/logtape": "^2.3.8",
47
47
  "jose": "^6.2.12"
48
48
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Workflows section's and the page tab's reads and actions (story 028),
2
+ * The Approvals section's and the page tab's reads and actions (story 028),
3
3
  * under `<backoffice>/crombolo/api/approvals/`, and saving a workflow drawn in
4
4
  * the designer back to `schema/workflows/`. docs/workflows.md.
5
5
  *
@@ -64,6 +64,17 @@ async function changePreview(approvals: Approvals, principal: Principal, workflo
64
64
  return waiting.map((r) => ({ key: r.key, page: r.nodeName, outcome: workflow.onChange }))
65
65
  }
66
66
 
67
+ /** What deleting a workflow would do: its waiting requests are withdrawn. */
68
+ async function removalPreview(approvals: Approvals, principal: Principal, alias: string) {
69
+ const stored = (await approvals.workflows()).find((s) => s.workflow.alias === alias)
70
+ if (!stored) return []
71
+ const id = stored.workflow.key ?? stored.workflow.alias
72
+ const waiting = (await approvals.inFlight(principal)).filter(
73
+ (r) => r.state === 'waiting' && (r.workflow.key ?? r.workflow.alias) === id,
74
+ )
75
+ return waiting.map((r) => ({ key: r.key, page: r.nodeName, outcome: 'withdraw' as const }))
76
+ }
77
+
67
78
  /**
68
79
  * `schedule`: `[{ culture, publishTime, unpublishTime }]`, times in ISO form.
69
80
  * A time that does not parse stays an invalid date, which the engine refuses.
@@ -129,6 +140,13 @@ export async function handleApprovalsApi(
129
140
  return json(await approvals.finished(principal, skip, take))
130
141
  }
131
142
 
143
+ // Whether Approvals and a page's Workflow tab show: a workflow, or a request still open.
144
+ if (path === 'active' && request.method === 'GET') {
145
+ const active =
146
+ (await approvals.workflows()).length > 0 || (await approvals.inFlight(principal)).length > 0
147
+ return json({ active })
148
+ }
149
+
132
150
  if (path === 'workflows' && request.method === 'GET') {
133
151
  const loaded = loadSchemaDirectory(ctx.schemaDir)
134
152
  return json({
@@ -149,6 +167,8 @@ export async function handleApprovalsApi(
149
167
  const alias = decodeURIComponent(match[1] as string)
150
168
  const file = join(ctx.schemaDir, 'workflows', fileNameFor(alias))
151
169
  if (request.method === 'DELETE') {
170
+ if (match[2])
171
+ return json({ ok: true, affected: await removalPreview(approvals, principal, alias) })
152
172
  if (!ctx.writable) return readOnly()
153
173
  if (!existsSync(file))
154
174
  return json({ ok: false, message: 'There is no such workflow.' }, 404)
package/src/config.ts CHANGED
@@ -982,7 +982,7 @@ export function describeDatabase(
982
982
  }
983
983
  }
984
984
 
985
- export const VERSION = '0.42.1'
985
+ export const VERSION = '0.43.1'
986
986
 
987
987
  /** A whole number of seconds from the environment; undefined when unset or not one. */
988
988
  /** A positive number from a setting, else the default. */
package/src/no-nodes.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * The holding page for a site with nothing published — Umbraco's "no nodes"
3
- * screen, which `docs/features.md` asks for.
3
+ * screen, which `docs/features.md` asks for — written as a one-page guide to
4
+ * getting a first page out (story 236).
4
5
  *
5
6
  * It answers 404, not 200: a brand-new site is not a working one, and anything
6
7
  * watching the URL should keep saying so until a page is published. It is only
7
8
  * reached when the published tree is empty, so a missing path on a live site is
8
9
  * the bare 404 it always was.
9
10
  */
11
+ import { faviconSvg, logoDarkSvg, logoSvg } from '@crombolo/backoffice-host/branding'
12
+
13
+ const DOCS = 'https://github.com/kineco-au/crombolo-cms#getting-started'
14
+
10
15
  export function noNodesPage(options: { siteName: string; backOfficePath: string }): string {
11
16
  const site = escapeHtml(options.siteName)
12
17
  const backoffice = escapeHtml(options.backOfficePath)
@@ -16,41 +21,161 @@ export function noNodesPage(options: { siteName: string; backOfficePath: string
16
21
  <meta charset="utf-8">
17
22
  <meta name="viewport" content="width=device-width, initial-scale=1">
18
23
  <meta name="robots" content="noindex">
19
- <title>${site} — nothing published yet</title>
24
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,${encodeURIComponent(faviconSvg)}">
25
+ <title>${site} — getting started</title>
20
26
  <style>
21
- :root { color-scheme: light dark; }
27
+ :root {
28
+ color-scheme: light dark;
29
+ --ink: #54321f; --muted: #7a5a47; --ground: #fff7ea; --panel: #fff; --line: #f0e2cf;
30
+ --code: #fbefe0; --accent: #ad4f2c; --on-accent: #fff; --accent-hover: #9b4526; --deep: #cb6f48; --link: #ad4f2c;
31
+ }
32
+ * { box-sizing: border-box; }
22
33
  body {
23
- margin: 0; min-height: 100vh; display: grid; place-items: center;
24
- font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
25
- background: #f6f5f3; color: #1b1b1b;
34
+ margin: 0;
35
+ font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
36
+ background: var(--ground); color: var(--ink);
37
+ }
38
+ a { color: var(--link); }
39
+ header.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 52rem; margin: 0 auto; padding: 1.5rem 1.25rem 0; }
40
+ header.bar svg { height: 2.1rem; width: auto; display: block; }
41
+ .logo-dark { display: none; }
42
+ header.bar .site { color: var(--muted); font-size: .9rem; }
43
+ main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
44
+ .hero {
45
+ position: relative; overflow: hidden;
46
+ background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
47
+ padding: 2.5rem 2.25rem; margin-bottom: 2rem;
48
+ box-shadow: 0 1px 2px rgba(84, 50, 31, .06), 0 12px 32px -18px rgba(84, 50, 31, .25);
49
+ }
50
+ .hero > * { position: relative; z-index: 1; }
51
+ .hero::after {
52
+ content: ''; position: absolute; right: -4rem; top: -4rem; width: 14rem; height: 14rem;
53
+ border-radius: 50%; background: var(--deep); opacity: .12;
54
+ }
55
+ .eyebrow { margin: 0 0 .4rem; color: var(--link); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; }
56
+ h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 .75rem; letter-spacing: -.01em; }
57
+ .lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.5rem; max-width: 34rem; }
58
+ a.cta {
59
+ display: inline-block; padding: .7rem 1.25rem; border-radius: 999px;
60
+ background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 700;
61
+ }
62
+ a.cta:hover { background: var(--accent-hover); }
63
+ a.cta:focus-visible { outline: 3px solid var(--deep); outline-offset: 2px; }
64
+ details.setup > summary {
65
+ display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none;
66
+ padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--line);
67
+ background: var(--panel); color: var(--link); font-weight: 600; margin-bottom: 1.25rem;
68
+ }
69
+ details.setup > summary::-webkit-details-marker { display: none; }
70
+ details.setup > summary::before { content: '›'; display: inline-block; transition: transform .15s; font-size: 1.2em; line-height: 1; }
71
+ details.setup[open] > summary::before { transform: rotate(90deg); }
72
+ details.setup .when-open, details.setup[open] .when-closed { display: none; }
73
+ details.setup[open] .when-open { display: inline; }
74
+ details.setup > summary:focus-visible { outline: 3px solid var(--deep); outline-offset: 2px; }
75
+ ol.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
76
+ ol.steps > li {
77
+ counter-increment: step; position: relative;
78
+ background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
79
+ padding: 1.4rem 1.5rem 1.4rem 4.5rem;
26
80
  }
27
- main { max-width: 34rem; padding: 2.5rem 1.5rem; }
28
- h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
29
- p { margin: 0 0 1rem; }
30
- ol { margin: 0 0 1.5rem; padding-left: 1.25rem; }
31
- li { margin-bottom: .35rem; }
32
- code { font-size: .9em; background: #e9e7e2; padding: .1em .35em; border-radius: 3px; }
33
- a.cta { display: inline-block; padding: .55rem 1rem; border-radius: 4px; background: #1b1b1b; color: #fff; text-decoration: none; }
34
- .fine { font-size: .85rem; color: #6b6b63; }
81
+ ol.steps > li::before {
82
+ content: counter(step); position: absolute; left: 1.4rem; top: 1.3rem;
83
+ width: 2.1rem; height: 2.1rem; border-radius: 50%;
84
+ background: var(--accent); color: var(--on-accent);
85
+ display: grid; place-items: center; font-weight: 800;
86
+ }
87
+ h2 { font-size: 1.15rem; margin: 0 0 .4rem; }
88
+ section.where { margin-top: 2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem 1.5rem; }
89
+ p { margin: 0 0 .75rem; }
90
+ li p:last-child { margin-bottom: 0; }
91
+ pre { margin: .6rem 0 .8rem; padding: .85rem 1rem; background: var(--code); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; font-size: .86rem; line-height: 1.55; }
92
+ code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; }
93
+ p code, td code { background: var(--code); padding: .1em .4em; border-radius: 4px; overflow-wrap: anywhere; }
94
+ table { width: 100%; border-collapse: collapse; }
95
+ td { padding: .55rem 0; border-top: 1px solid var(--line); vertical-align: top; }
96
+ tr:first-child td { border-top: 0; }
97
+ td:first-child { width: 12rem; padding-right: 1rem; }
98
+ .fine { margin-top: 2rem; font-size: .85rem; color: var(--muted); text-align: center; }
35
99
  @media (prefers-color-scheme: dark) {
36
- body { background: #16171a; color: #e8e6e3; }
37
- code { background: #26282c; }
38
- a.cta { background: #e8e6e3; color: #16171a; }
39
- .fine { color: #9a9a93; }
100
+ :root {
101
+ --ink: #f6ede4; --muted: #c9b5a5; --ground: #1f1813; --panel: #2a211b; --line: #3b2e25;
102
+ --code: #342922; --accent: #da987c; --on-accent: #25160e; --accent-hover: #e2ae98; --deep: #cb6f48; --link: #e8a688;
103
+ }
104
+ .logo-light { display: none; }
105
+ .logo-dark { display: block; }
106
+ .hero { box-shadow: none; }
107
+ }
108
+ @media (max-width: 560px) {
109
+ .hero { padding: 1.75rem 1.25rem; }
110
+ .hero::after { width: 8rem; height: 8rem; right: -3rem; top: -3rem; }
111
+ ol.steps > li { padding: 3.9rem 1.1rem 1.2rem; }
112
+ td:first-child { width: auto; }
40
113
  }
41
114
  </style>
42
115
  </head>
43
116
  <body>
117
+ <header class="bar">
118
+ <span class="logo-light">${logoSvg}</span>
119
+ <span class="logo-dark">${logoDarkSvg}</span>
120
+ <span class="site">${site}</span>
121
+ </header>
44
122
  <main>
45
- <h1>Nothing is published yet</h1>
46
- <p>${site} is running. There is no published page for visitors to see, so this is what the site serves.</p>
47
- <ol>
48
- <li>Sign in to the backoffice.</li>
49
- <li>Create a page from one of the content types in <code>schema/</code> — if there are none, add one there first.</li>
50
- <li>Publish it. This page goes away.</li>
123
+ <section class="hero">
124
+ <p class="eyebrow">${site} is running</p>
125
+ <h1>Nothing is published yet</h1>
126
+ <p class="lede">Visitors see this page until the site has one of its own.</p>
127
+ <p><a class="cta" href="${backoffice}">Open the back office</a></p>
128
+ </section>
129
+
130
+ <details class="setup">
131
+ <summary><span class="when-closed">Show how to set up your first page</span><span class="when-open">Hide the setup steps</span></summary>
132
+ <ol class="steps">
133
+ <li>
134
+ <h2>Sign in</h2>
135
+ <p>Open the back office at <code>${backoffice}</code>. On your own machine, <code>bun start</code> prints a username and password to sign in with, and a fresh password each time it starts. Set <code>CROMBOLO_ADMIN_PASSWORD</code> to keep the same one.</p>
136
+ </li>
137
+ <li>
138
+ <h2>Configure page metadata</h2>
139
+ <p>A content type says what a kind of page holds: a title, a summary, a body. Add one in the back office under <strong>Settings → Structure</strong>, or from the command line:</p>
140
+ <pre><code>bunx crombolo types new content-type article --at-root
141
+ bunx crombolo types add-property article summary --type textarea</code></pre>
142
+ <p>Either way it is saved as a file, <code>schema/content-types/article.toml</code>, so it travels with your code.</p>
143
+ </li>
144
+ <li>
145
+ <h2>Write its template</h2>
146
+ <p>A new content type comes with a template, <code>components/article.tsx</code>: a function from the page to JSX, rendered to HTML on the server.</p>
147
+ <pre><code>import type { PageProps } from '@crombolo/crombolo'
148
+
149
+ export default function Article({ model }: PageProps) {
150
+ return (
151
+ &lt;html lang="en"&gt;
152
+ &lt;body&gt;
153
+ &lt;h1&gt;{model.text('title')}&lt;/h1&gt;
154
+ &lt;p&gt;{model.text('summary')}&lt;/p&gt;
155
+ &lt;/body&gt;
156
+ &lt;/html&gt;
157
+ )
158
+ }</code></pre>
159
+ <p>Save the file and the next request renders it. There is nothing to rebuild.</p>
160
+ </li>
161
+ <li>
162
+ <h2>Create and publish</h2>
163
+ <p>In the back office, choose <strong>New content</strong> on the Overview, pick your content type, fill it in and press <strong>Save and publish</strong>. This page goes away and your site serves its own.</p>
164
+ </li>
51
165
  </ol>
52
- <p><a class="cta" href="${backoffice}">Open the backoffice</a></p>
53
- <p class="fine">Served with a 404: nothing is published, and a crawler should be told that plainly.</p>
166
+
167
+ <section class="where">
168
+ <h2>Where things live</h2>
169
+ <table>
170
+ <tr><td><code>schema/</code></td><td>content types, data types and languages, as TOML files</td></tr>
171
+ <tr><td><code>components/</code></td><td>templates and the components they share, as <code>.tsx</code></td></tr>
172
+ <tr><td><code>seed/</code></td><td>starting pages and media, as files</td></tr>
173
+ <tr><td><code>crombolo.config.ts</code></td><td>the site's settings: its name, its database, its addresses</td></tr>
174
+ </table>
175
+ </section>
176
+
177
+ <p class="fine">More in the <a href="${DOCS}">getting started guide</a>. This page is served with a 404 because nothing is published, which is what a crawler should be told.</p>
178
+ </details>
54
179
  </main>
55
180
  </body>
56
181
  </html>
@@ -0,0 +1,133 @@
1
+ /**
2
+ * The back office's Overview (story 236), under `<backoffice>/crombolo/api/overview`:
3
+ * pages by last change, how many are drafts or published, and what people did
4
+ * lately, each as the signed-in user may see it. docs/backoffice-hosting.md.
5
+ */
6
+ import { hasSection, type Principal } from '@crombolo/api-management/domain'
7
+ import { hasPathAccess } from '@crombolo/core'
8
+ import {
9
+ AuditLog,
10
+ type Db,
11
+ overviewPageFacts,
12
+ type QueryState,
13
+ queryDocuments,
14
+ } from '@crombolo/data'
15
+ import { contentQueryScope } from './content-query.ts'
16
+
17
+ /** Which pages the list shows. */
18
+ export const OVERVIEW_LISTS = {
19
+ recent: undefined,
20
+ drafts: ['draft'],
21
+ published: ['published', 'changed'],
22
+ } satisfies Record<string, QueryState[] | undefined>
23
+
24
+ export type OverviewList = keyof typeof OVERVIEW_LISTS
25
+
26
+ /** Audit actions that say something to an editor; a sort or a domain change does not. */
27
+ const ACTIVITY = new Set([
28
+ 'Create',
29
+ 'Save',
30
+ 'CreateAndPublish',
31
+ 'SaveAndPublish',
32
+ 'Publish',
33
+ 'PublishWithDescendants',
34
+ 'Unpublish',
35
+ 'Trash',
36
+ 'Restore',
37
+ 'Move',
38
+ 'Copy',
39
+ 'Revert',
40
+ ])
41
+ const ACTIVITY_SHOWN = 6
42
+ /** How far back the feed looks for entries the user may see. */
43
+ const ACTIVITY_SCAN = 200
44
+
45
+ export interface OverviewQuery {
46
+ list: OverviewList
47
+ skip: number
48
+ take: number
49
+ }
50
+
51
+ export async function overview(db: Db, principal: Principal, query: OverviewQuery) {
52
+ const scope = contentQueryScope(principal)
53
+ const states = OVERVIEW_LISTS[query.list]
54
+ const sort = { by: 'updateDate' as const, dir: 'desc' as const }
55
+ const [pages, drafts, published] = await Promise.all([
56
+ queryDocuments(
57
+ db,
58
+ { entity: 'document', state: states, sort, skip: query.skip, take: query.take },
59
+ scope,
60
+ ),
61
+ queryDocuments(
62
+ db,
63
+ { entity: 'document', state: OVERVIEW_LISTS.drafts, skip: 0, take: 0 },
64
+ scope,
65
+ ),
66
+ queryDocuments(
67
+ db,
68
+ { entity: 'document', state: OVERVIEW_LISTS.published, skip: 0, take: 0 },
69
+ scope,
70
+ ),
71
+ ])
72
+
73
+ const entries = (
74
+ await new AuditLog(db).page({ category: 'content' }, { limit: ACTIVITY_SCAN })
75
+ ).items.filter((e) => e.entityType === 'Document' && e.entityKey && ACTIVITY.has(e.action))
76
+ const facts = await overviewPageFacts(db, [
77
+ ...pages.items.map((p) => p.id),
78
+ ...entries.map((e) => e.entityKey as string),
79
+ ])
80
+ const mayRead = (key: string) => {
81
+ const page = facts.get(key.toLowerCase())
82
+ if (!page || !hasPathAccess(scope.start, page.chain, page.trashed)) return false
83
+ return scope.browses?.(page.chain) ?? true
84
+ }
85
+
86
+ const activity = []
87
+ for (const entry of entries) {
88
+ if (activity.length === ACTIVITY_SHOWN) break
89
+ const key = (entry.entityKey as string).toLowerCase()
90
+ if (!mayRead(key)) continue
91
+ activity.push({
92
+ key,
93
+ name: facts.get(key)?.name ?? entry.entityName ?? '',
94
+ action: entry.action,
95
+ who: entry.userName,
96
+ mine: entry.userKey !== null && entry.userKey === principal.id,
97
+ when: entry.occurredAt.toISOString(),
98
+ })
99
+ }
100
+
101
+ return {
102
+ pages: {
103
+ total: pages.total,
104
+ items: pages.items.map((p) => ({
105
+ key: p.id,
106
+ name: p.name,
107
+ type: facts.get(p.id.toLowerCase())?.contentTypeName || p.contentType.alias,
108
+ state: p.state,
109
+ updated: p.updateDate,
110
+ author: facts.get(p.id.toLowerCase())?.author ?? null,
111
+ })),
112
+ },
113
+ counts: { drafts: drafts.total, published: published.total },
114
+ activity,
115
+ // Where New content creates a page: the root, or the user's first start node.
116
+ newPageUnder: scope.start.root ? null : (scope.start.keys[0] ?? null),
117
+ mayReadAudit: hasSection(principal, 'settings'),
118
+ }
119
+ }
120
+
121
+ /** `?list=recent|drafts|published&skip=&take=`, with anything else as the defaults. */
122
+ export function readOverviewQuery(url: URL): OverviewQuery {
123
+ const list = url.searchParams.get('list')
124
+ const whole = (name: string, fallback: number, max: number) => {
125
+ const value = Number(url.searchParams.get(name))
126
+ return Number.isInteger(value) && value >= 0 ? Math.min(value, max) : fallback
127
+ }
128
+ return {
129
+ list: list && list in OVERVIEW_LISTS ? (list as OverviewList) : 'recent',
130
+ skip: whole('skip', 0, Number.MAX_SAFE_INTEGER),
131
+ take: whole('take', 5, 50) || 5,
132
+ }
133
+ }
package/src/server.ts CHANGED
@@ -193,6 +193,7 @@ import { createMediaAccess } from './media-access.ts'
193
193
  import { createMemberAuth, MEMBER_ROUTE_PREFIX } from './member-auth.ts'
194
194
  import { noNodesPage } from './no-nodes.ts'
195
195
  import { NotImplementedLog } from './not-implemented.ts'
196
+ import { overview, readOverviewQuery } from './overview.ts'
196
197
  import { createDeps, PREVIEW_COOKIE, resolveUserLinkSender } from './ports.ts'
197
198
  import {
198
199
  previewSigningSecret,
@@ -2296,6 +2297,16 @@ export async function createServer(config: CromboloConfig = loadConfig()): Promi
2296
2297
  : Response.json({ ok: false, message: outcome.message }, { status: outcome.status })
2297
2298
  }
2298
2299
 
2300
+ // Non-contract: the Content section's Overview (story 236), as the user may see it.
2301
+ if (pathname === `${paths.pluginPath}/api/overview` && request.method === 'GET') {
2302
+ const principal = await authenticate(request)
2303
+ if (!principal) return new Response('Unauthorized', { status: 401 })
2304
+ if (!hasSection(principal, 'content')) return new Response('Forbidden', { status: 403 })
2305
+ return Response.json(await overview(db, principal, readOverviewQuery(url)), {
2306
+ headers: { 'cache-control': 'no-store' },
2307
+ })
2308
+ }
2309
+
2299
2310
  // Non-contract: approval workflows (story 028) — the page's Workflow tab, the
2300
2311
  // Workflows section and its designer. Content or Workflows, as either screen is.
2301
2312
  if (pathname.startsWith(`${paths.pluginPath}/api/approvals/`)) {