@abraca/junis 2.85.0 → 2.87.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/module.d.mts +17 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +253 -21
- package/dist/runtime/assets/css/jun.css +1 -1
- package/dist/runtime/components/JunCampfirePresence.client.vue +75 -10
- package/dist/runtime/components/JunCollectionIntro.d.vue.ts +11 -0
- package/dist/runtime/components/JunCollectionIntro.vue +45 -0
- package/dist/runtime/components/JunCollectionIntro.vue.d.ts +11 -0
- package/dist/runtime/components/JunConfigRow.d.vue.ts +43 -0
- package/dist/runtime/components/JunConfigRow.vue +34 -0
- package/dist/runtime/components/JunConfigRow.vue.d.ts +43 -0
- package/dist/runtime/components/JunDocSurface.vue +3 -0
- package/dist/runtime/components/JunFooter.vue +1 -1
- package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +30 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +30 -0
- package/dist/runtime/components/JunLinksRow.d.vue.ts +16 -1
- package/dist/runtime/components/JunLinksRow.vue +17 -7
- package/dist/runtime/components/JunLinksRow.vue.d.ts +16 -1
- package/dist/runtime/components/JunMedia.client.d.vue.ts +1 -1
- package/dist/runtime/components/JunMedia.client.vue.d.ts +1 -1
- package/dist/runtime/components/JunNavigation.vue +21 -4
- package/dist/runtime/components/JunNoteLinks.d.vue.ts +6 -0
- package/dist/runtime/components/JunNoteLinks.vue +57 -0
- package/dist/runtime/components/JunNoteLinks.vue.d.ts +6 -0
- package/dist/runtime/components/JunPageHero.d.vue.ts +8 -2
- package/dist/runtime/components/JunPageHero.vue +15 -3
- package/dist/runtime/components/JunPageHero.vue.d.ts +8 -2
- package/dist/runtime/components/JunReaders.d.vue.ts +11 -0
- package/dist/runtime/components/JunReaders.vue +99 -0
- package/dist/runtime/components/JunReaders.vue.d.ts +11 -0
- package/dist/runtime/components/JunSearch.client.vue +2 -2
- package/dist/runtime/components/JunSectionPresence.d.vue.ts +17 -0
- package/dist/runtime/components/JunSectionPresence.vue +99 -0
- package/dist/runtime/components/JunSectionPresence.vue.d.ts +17 -0
- package/dist/runtime/components/JunThreadComposer.d.vue.ts +37 -0
- package/dist/runtime/components/JunThreadComposer.vue +54 -0
- package/dist/runtime/components/JunThreadComposer.vue.d.ts +37 -0
- package/dist/runtime/components/JunTravellersChip.vue +35 -5
- package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +1 -1
- package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +1 -1
- package/dist/runtime/components/JunViewControl.d.vue.ts +29 -0
- package/dist/runtime/components/JunViewControl.vue +340 -0
- package/dist/runtime/components/JunViewControl.vue.d.ts +29 -0
- package/dist/runtime/components/JunViewControls.d.vue.ts +27 -0
- package/dist/runtime/components/JunViewControls.vue +94 -0
- package/dist/runtime/components/JunViewControls.vue.d.ts +27 -0
- package/dist/runtime/components/renderers/JunAppsRenderer.vue +45 -4
- package/dist/runtime/components/renderers/JunCinemaRenderer.vue +42 -4
- package/dist/runtime/components/renderers/JunConfigRenderer.vue +348 -225
- package/dist/runtime/components/renderers/JunCourseRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunCourseRenderer.vue +229 -0
- package/dist/runtime/components/renderers/JunCourseRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunCvRenderer.vue +44 -6
- package/dist/runtime/components/renderers/JunDeckRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunDeckRenderer.vue +370 -0
- package/dist/runtime/components/renderers/JunDeckRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +151 -23
- package/dist/runtime/components/renderers/JunFestivalRenderer.vue +41 -4
- package/dist/runtime/components/renderers/JunGardenRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue +280 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunGlobeRenderer.vue +43 -26
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +96 -14
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +28 -129
- package/dist/runtime/components/renderers/JunItemRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunItemRenderer.vue +398 -0
- package/dist/runtime/components/renderers/JunItemRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunJournalRenderer.vue +141 -11
- package/dist/runtime/components/renderers/JunLibraryRenderer.vue +295 -12
- package/dist/runtime/components/renderers/JunLinksRenderer.vue +33 -1
- package/dist/runtime/components/renderers/JunLiveRenderer.vue +37 -1
- package/dist/runtime/components/renderers/JunMosaicRenderer.vue +3 -2
- package/dist/runtime/components/renderers/JunMovieRenderer.vue +32 -5
- package/dist/runtime/components/renderers/JunNowRenderer.vue +38 -5
- package/dist/runtime/components/renderers/JunPollRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunPollRenderer.vue +231 -0
- package/dist/runtime/components/renderers/JunPollRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.vue +74 -18
- package/dist/runtime/components/renderers/JunServicesRenderer.vue +40 -2
- package/dist/runtime/components/renderers/JunStatsRenderer.vue +37 -50
- package/dist/runtime/components/renderers/JunThreadRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunThreadRenderer.vue +304 -0
- package/dist/runtime/components/renderers/JunThreadRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +32 -4
- package/dist/runtime/components/renderers/JunUsesRenderer.vue +51 -5
- package/dist/runtime/components/renderers/JunWallRenderer.vue +60 -5
- package/dist/runtime/composables/useJunDeck.d.ts +66 -0
- package/dist/runtime/composables/useJunDeck.js +61 -0
- package/dist/runtime/composables/useJunDocPage.d.ts +14 -11
- package/dist/runtime/composables/useJunDocPage.js +67 -3
- package/dist/runtime/composables/useJunFollow.d.ts +65 -9
- package/dist/runtime/composables/useJunFollow.js +237 -20
- package/dist/runtime/composables/useJunGarden.d.ts +67 -0
- package/dist/runtime/composables/useJunGarden.js +92 -0
- package/dist/runtime/composables/useJunPresence.d.ts +26 -0
- package/dist/runtime/composables/useJunPresence.js +9 -2
- package/dist/runtime/composables/useJunSections.d.ts +73 -0
- package/dist/runtime/composables/useJunSections.js +117 -0
- package/dist/runtime/composables/useJunSettings.d.ts +1 -1
- package/dist/runtime/composables/useJunSettings.js +5 -1
- package/dist/runtime/composables/useJunSiteConfig.d.ts +37 -0
- package/dist/runtime/composables/useJunTheme.js +40 -2
- package/dist/runtime/composables/useJunViewOptions.d.ts +85 -0
- package/dist/runtime/composables/useJunViewOptions.js +63 -0
- package/dist/runtime/pages/doc.vue +52 -42
- package/dist/runtime/pages/index.vue +61 -35
- package/dist/runtime/plugins/jun-doc-tree.d.ts +2 -0
- package/dist/runtime/plugins/jun-doc-tree.js +26 -0
- package/dist/runtime/server/api/health.get.d.ts +19 -0
- package/dist/runtime/server/api/health.get.js +40 -0
- package/dist/runtime/server/api/links.get.d.ts +19 -0
- package/dist/runtime/server/api/links.get.js +37 -0
- package/dist/runtime/server/api/resolve/[...slug].get.d.ts +9 -0
- package/dist/runtime/server/api/resolve/[...slug].get.js +7 -2
- package/dist/runtime/server/api/stats.get.js +2 -1
- package/dist/runtime/server/api/tree.get.d.ts +9 -0
- package/dist/runtime/server/api/tree.get.js +23 -0
- package/dist/runtime/server/janitor/junJanitorActor.d.ts +13 -0
- package/dist/runtime/server/janitor/junJanitorActor.js +36 -5
- package/dist/runtime/server/janitor/junJanitorChores.js +8 -0
- package/dist/runtime/server/plugins/jun-bootstrap.js +103 -15
- package/dist/runtime/server/plugins/jun-doc-cache.js +42 -4
- package/dist/runtime/server/plugins/jun-janitor.js +7 -0
- package/dist/runtime/server/plugins/jun-rpc.js +293 -0
- package/dist/runtime/server/plugins/jun-watchdog.d.ts +2 -0
- package/dist/runtime/server/plugins/jun-watchdog.js +54 -0
- package/dist/runtime/server/routes/sitemap.xml.get.js +2 -0
- package/dist/runtime/server/utils/junBoot.d.ts +1 -0
- package/dist/runtime/server/utils/junBoot.js +4 -0
- package/dist/runtime/server/utils/junCache.d.ts +17 -0
- package/dist/runtime/server/utils/junCache.js +5 -0
- package/dist/runtime/server/utils/junSeedGate.d.ts +68 -0
- package/dist/runtime/server/utils/junSeedGate.js +41 -0
- package/dist/runtime/types.d.ts +57 -1
- package/dist/runtime/utils/junCourse.d.ts +106 -0
- package/dist/runtime/utils/junCourse.js +65 -0
- package/dist/runtime/utils/junGarden.d.ts +193 -0
- package/dist/runtime/utils/junGarden.js +233 -0
- package/dist/runtime/utils/junMetaSchemas.js +8 -1
- package/dist/runtime/utils/junModeration.d.ts +67 -0
- package/dist/runtime/utils/junModeration.js +20 -0
- package/dist/runtime/utils/junMotion.d.ts +26 -0
- package/dist/runtime/utils/junMotion.js +31 -0
- package/dist/runtime/utils/junPeople.d.ts +43 -0
- package/dist/runtime/utils/junPeople.js +9 -0
- package/dist/runtime/utils/junPoll.d.ts +79 -0
- package/dist/runtime/utils/junPoll.js +82 -0
- package/dist/runtime/utils/junReadiness.d.ts +131 -0
- package/dist/runtime/utils/junReadiness.js +69 -0
- package/dist/runtime/utils/junSections.d.ts +115 -0
- package/dist/runtime/utils/junSections.js +45 -0
- package/dist/runtime/utils/junSlides.d.ts +66 -0
- package/dist/runtime/utils/junSlides.js +47 -0
- package/dist/runtime/utils/junThread.d.ts +81 -0
- package/dist/runtime/utils/junThread.js +75 -0
- package/dist/runtime/utils/junViewSpecs.d.ts +671 -0
- package/dist/runtime/utils/junViewSpecs.js +534 -0
- package/dist/runtime/utils/junViewValues.d.ts +125 -0
- package/dist/runtime/utils/junViewValues.js +104 -0
- package/dist/types.d.mts +1 -1
- package/package.json +5 -1
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import * as Y from "yjs";
|
|
2
|
+
import {
|
|
3
|
+
junCapBallots,
|
|
4
|
+
junMyBallot,
|
|
5
|
+
junNextBallot,
|
|
6
|
+
junPollBallots,
|
|
7
|
+
junPollChoices,
|
|
8
|
+
junTallyVotes
|
|
9
|
+
} from "../../utils/junPoll.js";
|
|
10
|
+
import { junCanReplyTo } from "../../utils/junThread.js";
|
|
11
|
+
import { junCapProgress, junCourseProgress, junNextProgress } from "../../utils/junCourse.js";
|
|
2
12
|
import { AbracadabraProvider } from "@abraca/dabra";
|
|
3
13
|
import { defineNitroPlugin, useRuntimeConfig } from "nitropack/runtime";
|
|
4
14
|
const SYNC_TIMEOUT_MS = 8e3;
|
|
@@ -50,6 +60,35 @@ const reactSchema = {
|
|
|
50
60
|
return { docId: v.docId };
|
|
51
61
|
}
|
|
52
62
|
};
|
|
63
|
+
const voteSchema = {
|
|
64
|
+
parse(value) {
|
|
65
|
+
const v = value;
|
|
66
|
+
if (typeof v?.docId !== "string" || !v.docId) throw new Error("docId required");
|
|
67
|
+
const choice = typeof v?.choice === "number" ? v.choice : Number(v?.choice);
|
|
68
|
+
if (!Number.isInteger(choice) || choice < 0 || choice > 64) throw new Error("choice must be an index");
|
|
69
|
+
return { docId: v.docId, choice };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const postSchema = {
|
|
73
|
+
parse(value) {
|
|
74
|
+
const v = value;
|
|
75
|
+
if (typeof v?.docId !== "string" || !v.docId) throw new Error("docId required");
|
|
76
|
+
const message = cleanText(String(v?.message ?? ""));
|
|
77
|
+
if (!message) throw new Error("message is empty");
|
|
78
|
+
if (message.length > MAX_MESSAGE) throw new Error(`message too long (max ${MAX_MESSAGE})`);
|
|
79
|
+
const handle = cleanText(String(v.handle ?? "")).replace(/\n/g, " ").slice(0, MAX_HANDLE) || "Traveller";
|
|
80
|
+
const replyTo = typeof v?.replyTo === "string" && v.replyTo ? v.replyTo : null;
|
|
81
|
+
return { docId: v.docId, message, handle, replyTo };
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const stepSchema = {
|
|
85
|
+
parse(value) {
|
|
86
|
+
const v = value;
|
|
87
|
+
if (typeof v?.docId !== "string" || !v.docId) throw new Error("docId required");
|
|
88
|
+
if (typeof v?.stepId !== "string" || !v.stepId) throw new Error("stepId required");
|
|
89
|
+
return { docId: v.docId, stepId: v.stepId };
|
|
90
|
+
}
|
|
91
|
+
};
|
|
53
92
|
export default defineNitroPlugin((nitroApp) => {
|
|
54
93
|
const jun = useRuntimeConfig().public.jun;
|
|
55
94
|
if (!jun?.features?.rpc) return;
|
|
@@ -408,6 +447,260 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
408
447
|
}
|
|
409
448
|
}),
|
|
410
449
|
// @ts-expect-error — server auto-import from @abraca/nuxt
|
|
450
|
+
defineRpcHandler({
|
|
451
|
+
method: "jun.thread.post@1",
|
|
452
|
+
schema: postSchema,
|
|
453
|
+
/**
|
|
454
|
+
* Post to a `jun-thread`.
|
|
455
|
+
*
|
|
456
|
+
* The guestbook's signature with one more field. Every post is a
|
|
457
|
+
* hidden child DOCUMENT rather than an entry in a blob of meta, so
|
|
458
|
+
* moderation, the trash, search exclusion and the permission cascade
|
|
459
|
+
* all work without inventing anything — and adding a reply never
|
|
460
|
+
* rewrites somebody else's words, which a nested structure in one
|
|
461
|
+
* document would do on every post.
|
|
462
|
+
*/
|
|
463
|
+
async handler({ docId, message, handle, replyTo }, ctx) {
|
|
464
|
+
if (siteConfig().guestbookEnabled === false) {
|
|
465
|
+
throw new RpcError("DISABLED", "the conversation is closed right now");
|
|
466
|
+
}
|
|
467
|
+
const page = plain(sharedTree().get(docId));
|
|
468
|
+
const threadType = jun?.typeIds?.thread;
|
|
469
|
+
if (!page || page.trashed || threadType && page.type !== threadType) {
|
|
470
|
+
throw new RpcError("NOT_FOUND", "no conversation here");
|
|
471
|
+
}
|
|
472
|
+
if (page.meta?.threadClosed === true) {
|
|
473
|
+
throw new RpcError("DISABLED", "this conversation is closed");
|
|
474
|
+
}
|
|
475
|
+
const siblings = [];
|
|
476
|
+
const now = Date.now();
|
|
477
|
+
let mineRecent = 0;
|
|
478
|
+
let recentAny = 0;
|
|
479
|
+
sharedTree().forEach((e, id2) => {
|
|
480
|
+
const entry = plain(e);
|
|
481
|
+
if (!entry || entry.parentId !== docId || entry.trashed) return;
|
|
482
|
+
siblings.push({ id: id2, parentId: entry.parentId, trashed: entry.trashed, meta: entry.meta });
|
|
483
|
+
const date = typeof entry.meta?.date === "number" ? entry.meta.date : 0;
|
|
484
|
+
if (date > now - FLOOD_WINDOW_MS) recentAny++;
|
|
485
|
+
if (entry.meta?.signerId === ctx.from && date > now - PER_SIGNER_COOLDOWN_MS) mineRecent++;
|
|
486
|
+
});
|
|
487
|
+
if (!junCanReplyTo(siblings, docId, replyTo)) {
|
|
488
|
+
throw new RpcError("NOT_FOUND", "that post is not in this conversation");
|
|
489
|
+
}
|
|
490
|
+
if (mineRecent > 0) {
|
|
491
|
+
throw new RpcError("RATE_LIMITED", "one at a time \u2014 try again in a moment");
|
|
492
|
+
}
|
|
493
|
+
if (recentAny >= FLOOD_MAX) {
|
|
494
|
+
throw new RpcError("RATE_LIMITED", "this conversation is busy \u2014 try again in a minute");
|
|
495
|
+
}
|
|
496
|
+
const id = crypto.randomUUID();
|
|
497
|
+
await withRootTree(
|
|
498
|
+
(tree) => {
|
|
499
|
+
tree.set(id, {
|
|
500
|
+
label: handle,
|
|
501
|
+
type: "doc",
|
|
502
|
+
parentId: docId,
|
|
503
|
+
order: now,
|
|
504
|
+
createdAt: now,
|
|
505
|
+
updatedAt: now,
|
|
506
|
+
meta: {
|
|
507
|
+
hidden: true,
|
|
508
|
+
message,
|
|
509
|
+
// The SERVER stamps who wrote this, never the client.
|
|
510
|
+
signerId: ctx.from,
|
|
511
|
+
signerHandle: handle,
|
|
512
|
+
date: now,
|
|
513
|
+
...replyTo ? { replyTo } : {}
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
() => !!sharedTree().get(id)
|
|
518
|
+
);
|
|
519
|
+
try {
|
|
520
|
+
await runner.client.createChild(docId, { child_id: id, label: handle, doc_type: "doc" });
|
|
521
|
+
} catch (err) {
|
|
522
|
+
console.warn(`[jun:rpc] register post ${id} failed:`, err?.message ?? err);
|
|
523
|
+
}
|
|
524
|
+
return { id, date: now };
|
|
525
|
+
}
|
|
526
|
+
}),
|
|
527
|
+
// @ts-expect-error — server auto-import from @abraca/nuxt
|
|
528
|
+
defineRpcHandler({
|
|
529
|
+
method: "jun.course.step@1",
|
|
530
|
+
schema: stepSchema,
|
|
531
|
+
/**
|
|
532
|
+
* Tick (or untick) a step of a `jun-course`.
|
|
533
|
+
*
|
|
534
|
+
* The fourth write path of this shape, and the one where the rule
|
|
535
|
+
* matters most: progress is a claim about a PERSON, so it is keyed by
|
|
536
|
+
* `ctx.from` — the identity the server stamped. A second tab, a
|
|
537
|
+
* reload and a reconnect are one learner, and nobody can tick a step
|
|
538
|
+
* on somebody else's behalf.
|
|
539
|
+
*
|
|
540
|
+
* The step must be a CHILD of the course. Without that check any
|
|
541
|
+
* document id would be storable as progress, which turns a narrow
|
|
542
|
+
* write path into a general-purpose one — the same reason the poll
|
|
543
|
+
* checks its choice index and the thread checks its parent.
|
|
544
|
+
*/
|
|
545
|
+
async handler({ docId, stepId }, ctx) {
|
|
546
|
+
if (siteConfig().reactionsEnabled === false) {
|
|
547
|
+
throw new RpcError("DISABLED", "this course is not taking progress right now");
|
|
548
|
+
}
|
|
549
|
+
const page = plain(sharedTree().get(docId));
|
|
550
|
+
const courseType = jun?.typeIds?.course;
|
|
551
|
+
if (!page || page.trashed || courseType && page.type !== courseType) {
|
|
552
|
+
throw new RpcError("NOT_FOUND", "no course here");
|
|
553
|
+
}
|
|
554
|
+
const stepIds = () => {
|
|
555
|
+
const out = [];
|
|
556
|
+
sharedTree().forEach((e, id) => {
|
|
557
|
+
const entry2 = plain(e);
|
|
558
|
+
if (!entry2 || entry2.parentId !== docId || entry2.trashed) return;
|
|
559
|
+
out.push({ id, order: typeof entry2.order === "number" ? entry2.order : 0 });
|
|
560
|
+
});
|
|
561
|
+
return out.sort((a, b) => a.order - b.order).map((step) => step.id);
|
|
562
|
+
};
|
|
563
|
+
if (!stepIds().includes(stepId)) {
|
|
564
|
+
throw new RpcError("NOT_FOUND", "that step is not part of this course");
|
|
565
|
+
}
|
|
566
|
+
let stored = [];
|
|
567
|
+
let refused = false;
|
|
568
|
+
await withRootTree(
|
|
569
|
+
(tree) => {
|
|
570
|
+
const entry2 = plain(tree.get(docId));
|
|
571
|
+
if (!entry2) {
|
|
572
|
+
throw new RpcError("NOT_FOUND", "no course here");
|
|
573
|
+
}
|
|
574
|
+
const ids2 = stepIds();
|
|
575
|
+
const progress2 = junCourseProgress(entry2.meta, ids2);
|
|
576
|
+
if (!junCapProgress(progress2, ctx.from)) {
|
|
577
|
+
refused = true;
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
const next = junNextProgress(progress2[ctx.from], ids2, stepId);
|
|
581
|
+
if (next === null) {
|
|
582
|
+
refused = true;
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
stored = next;
|
|
586
|
+
const kept = Object.fromEntries(
|
|
587
|
+
Object.entries(progress2).filter(([person]) => person !== ctx.from)
|
|
588
|
+
);
|
|
589
|
+
tree.set(docId, {
|
|
590
|
+
...entry2,
|
|
591
|
+
// `updatedAt` deliberately not bumped: ticking a step is not
|
|
592
|
+
// an edit of the course, and bumping it would put every course
|
|
593
|
+
// at the top of every "recently changed" list forever.
|
|
594
|
+
meta: {
|
|
595
|
+
...entry2.meta ?? {},
|
|
596
|
+
courseProgress: next.length ? { ...kept, [ctx.from]: next } : kept
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
},
|
|
600
|
+
() => {
|
|
601
|
+
if (refused) return true;
|
|
602
|
+
const entry2 = plain(sharedTree().get(docId));
|
|
603
|
+
const mine = junCourseProgress(entry2?.meta, stepIds())[ctx.from] ?? [];
|
|
604
|
+
return mine.length === stored.length && mine.every((id, i) => id === stored[i]);
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
if (refused) {
|
|
608
|
+
throw new RpcError("LIMIT", "this course cannot take any more progress");
|
|
609
|
+
}
|
|
610
|
+
const entry = plain(sharedTree().get(docId));
|
|
611
|
+
const ids = stepIds();
|
|
612
|
+
const progress = junCourseProgress(entry?.meta, ids);
|
|
613
|
+
return {
|
|
614
|
+
mine: stored,
|
|
615
|
+
people: Object.keys(progress).length,
|
|
616
|
+
finished: Object.values(progress).filter((l) => ids.length > 0 && l.length === ids.length).length
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
}),
|
|
620
|
+
// @ts-expect-error — server auto-import from @abraca/nuxt
|
|
621
|
+
defineRpcHandler({
|
|
622
|
+
method: "jun.poll.vote@1",
|
|
623
|
+
schema: voteSchema,
|
|
624
|
+
/**
|
|
625
|
+
* Cast a vote on a `jun-poll`.
|
|
626
|
+
*
|
|
627
|
+
* The same shape as the guestbook's signature and for the same
|
|
628
|
+
* reason: a visitor has no write access to this document, so the
|
|
629
|
+
* server writes on their behalf after checking who they are. What
|
|
630
|
+
* it stores is keyed by `ctx.from` — the identity the SERVER
|
|
631
|
+
* stamped — which is what makes "one vote per person" true rather
|
|
632
|
+
* than merely intended. A client-supplied voter id would make
|
|
633
|
+
* ballot-stuffing a one-line change.
|
|
634
|
+
*/
|
|
635
|
+
async handler({ docId, choice }, ctx) {
|
|
636
|
+
if (siteConfig().reactionsEnabled === false) {
|
|
637
|
+
throw new RpcError("DISABLED", "voting is off right now");
|
|
638
|
+
}
|
|
639
|
+
const page = plain(sharedTree().get(docId));
|
|
640
|
+
const pollType = jun?.typeIds?.poll;
|
|
641
|
+
if (!page || page.trashed || pollType && page.type !== pollType) {
|
|
642
|
+
throw new RpcError("NOT_FOUND", "no poll here");
|
|
643
|
+
}
|
|
644
|
+
const choices = junPollChoices(page.meta?.pollOptions);
|
|
645
|
+
if (!choices.length) {
|
|
646
|
+
throw new RpcError("NOT_FOUND", "this poll has no choices yet");
|
|
647
|
+
}
|
|
648
|
+
if (choice >= choices.length) {
|
|
649
|
+
throw new RpcError("INVALID", "no such choice");
|
|
650
|
+
}
|
|
651
|
+
let stored = [];
|
|
652
|
+
let refused = false;
|
|
653
|
+
await withRootTree(
|
|
654
|
+
(tree) => {
|
|
655
|
+
const entry2 = plain(tree.get(docId));
|
|
656
|
+
if (!entry2) {
|
|
657
|
+
throw new RpcError("NOT_FOUND", "no poll here");
|
|
658
|
+
}
|
|
659
|
+
const live = junPollChoices(entry2.meta?.pollOptions);
|
|
660
|
+
const ballots = junPollBallots(entry2.meta?.pollVotes, live.length);
|
|
661
|
+
const next = junNextBallot(junMyBallot(ballots, ctx.from), choice, {
|
|
662
|
+
multiple: entry2.meta?.pollMultiple === true,
|
|
663
|
+
revote: entry2.meta?.pollRevote !== false
|
|
664
|
+
});
|
|
665
|
+
if (next === null) {
|
|
666
|
+
refused = true;
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
stored = next;
|
|
670
|
+
const kept = Object.fromEntries(
|
|
671
|
+
Object.entries(ballots).filter(([voter]) => voter !== ctx.from)
|
|
672
|
+
);
|
|
673
|
+
const votes = junCapBallots(
|
|
674
|
+
next.length ? { ...kept, [ctx.from]: next } : kept
|
|
675
|
+
);
|
|
676
|
+
tree.set(docId, {
|
|
677
|
+
...entry2,
|
|
678
|
+
// `updatedAt` deliberately not bumped — a vote is not an
|
|
679
|
+
// edit, and bumping it would put every poll at the top of
|
|
680
|
+
// every "recently changed" list forever.
|
|
681
|
+
meta: { ...entry2.meta ?? {}, pollVotes: votes }
|
|
682
|
+
});
|
|
683
|
+
},
|
|
684
|
+
() => {
|
|
685
|
+
if (refused) return true;
|
|
686
|
+
const entry2 = plain(sharedTree().get(docId));
|
|
687
|
+
const live = junPollChoices(entry2?.meta?.pollOptions);
|
|
688
|
+
const mine = junMyBallot(junPollBallots(entry2?.meta?.pollVotes, live.length), ctx.from);
|
|
689
|
+
return mine.length === stored.length && mine.every((c, i) => c === stored[i]);
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
if (refused) {
|
|
693
|
+
throw new RpcError("LIMIT", "this poll only takes one vote per person");
|
|
694
|
+
}
|
|
695
|
+
const entry = plain(sharedTree().get(docId));
|
|
696
|
+
const tally = junTallyVotes(
|
|
697
|
+
junPollBallots(entry?.meta?.pollVotes, choices.length),
|
|
698
|
+
choices.length
|
|
699
|
+
);
|
|
700
|
+
return { mine: stored, counts: tally.counts, voters: tally.voters };
|
|
701
|
+
}
|
|
702
|
+
}),
|
|
703
|
+
// @ts-expect-error — server auto-import from @abraca/nuxt
|
|
411
704
|
defineRpcHandler({
|
|
412
705
|
method: "jun.react@1",
|
|
413
706
|
schema: reactSchema,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineNitroPlugin, useRuntimeConfig, useStorage } from "nitropack/runtime";
|
|
2
|
+
import { junDocTree, junHeartbeat, junSlugMap } from "../utils/junCache.js";
|
|
3
|
+
import { junBootedAt } from "../utils/junBoot.js";
|
|
4
|
+
import { junReadiness, junShouldWarn } from "../../utils/junReadiness.js";
|
|
5
|
+
const TICK_MS = 2e4;
|
|
6
|
+
const WARN_EVERY_MS = 6e4;
|
|
7
|
+
export default defineNitroPlugin((nitroApp) => {
|
|
8
|
+
const jun = useRuntimeConfig().public.jun ?? {};
|
|
9
|
+
const apiBase = jun.apiBase ?? "/api/_jun";
|
|
10
|
+
const docCacheOn = jun.features?.docCache !== false;
|
|
11
|
+
let lastWarnedAt = null;
|
|
12
|
+
let lastState = null;
|
|
13
|
+
let timer = null;
|
|
14
|
+
async function look() {
|
|
15
|
+
const storage = useStorage();
|
|
16
|
+
const [tree, slugs, bodyKeys, beat] = await Promise.all([
|
|
17
|
+
junDocTree(),
|
|
18
|
+
junSlugMap(),
|
|
19
|
+
storage.getKeys("doc-cache:html"),
|
|
20
|
+
junHeartbeat()
|
|
21
|
+
]);
|
|
22
|
+
const heartbeatAgeMs = beat && beat.at >= junBootedAt() ? Date.now() - beat.at : null;
|
|
23
|
+
const verdict = junReadiness({
|
|
24
|
+
treeSize: Object.keys(tree).length,
|
|
25
|
+
slugCount: Object.keys(slugs).length,
|
|
26
|
+
bodyCount: bodyKeys.length,
|
|
27
|
+
ageMs: Date.now() - junBootedAt(),
|
|
28
|
+
heartbeatAgeMs,
|
|
29
|
+
expectHeartbeat: docCacheOn
|
|
30
|
+
});
|
|
31
|
+
if (verdict.state === "ready" && lastState !== "ready") {
|
|
32
|
+
console.log(`[jun:watchdog] SSR is ready \u2014 ${verdict.reason}`);
|
|
33
|
+
lastWarnedAt = null;
|
|
34
|
+
}
|
|
35
|
+
if (junShouldWarn(verdict.state, lastWarnedAt, Date.now(), WARN_EVERY_MS)) {
|
|
36
|
+
lastWarnedAt = Date.now();
|
|
37
|
+
const log = verdict.state === "dead" ? console.error : console.warn;
|
|
38
|
+
log(
|
|
39
|
+
`[jun:watchdog] THIS DEPLOYMENT CANNOT SERVER-RENDER \u2014 ${verdict.reason}
|
|
40
|
+
[jun:watchdog] ${verdict.hint ?? ""}
|
|
41
|
+
[jun:watchdog] Details: GET ${apiBase}/health (503 while this lasts). The site still works in a browser, which is exactly why this needs saying.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
lastState = verdict.state;
|
|
45
|
+
}
|
|
46
|
+
const first = setTimeout(() => {
|
|
47
|
+
void look();
|
|
48
|
+
timer = setInterval(() => void look(), TICK_MS);
|
|
49
|
+
}, TICK_MS);
|
|
50
|
+
nitroApp.hooks.hook("close", () => {
|
|
51
|
+
clearTimeout(first);
|
|
52
|
+
if (timer) clearInterval(timer);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -14,6 +14,8 @@ export default defineEventHandler(async (event) => {
|
|
|
14
14
|
if (e.meta?.draft === true) return false;
|
|
15
15
|
if (e.meta?.signerId) return false;
|
|
16
16
|
if ((e.type ?? "").endsWith("-redirect")) return false;
|
|
17
|
+
if (e.meta?.paneDoc || e.meta?.paneWidget) return false;
|
|
18
|
+
if (e.meta?.t != null) return false;
|
|
17
19
|
return true;
|
|
18
20
|
}).map(([, slug]) => `${site}/${slug}`);
|
|
19
21
|
setResponseHeader(event, "content-type", "application/xml; charset=utf-8");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function junBootedAt(): number;
|
|
@@ -33,6 +33,23 @@ export declare function junDocTree(): Promise<Record<string, JunTreeEntry>>;
|
|
|
33
33
|
* disagreeing about what a page is.
|
|
34
34
|
*/
|
|
35
35
|
export declare function junCountedDocIds(tree: Record<string, JunTreeEntry>, rootDocId: string): Set<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Where the doc-cache runner stamps that it is alive.
|
|
38
|
+
*
|
|
39
|
+
* A cache is not a runner: `/app/.data` persists across container restarts, so a
|
|
40
|
+
* complete cache can outlive the process that filled it — and a deployment whose
|
|
41
|
+
* runners never booted then looks perfectly healthy while serving a frozen
|
|
42
|
+
* snapshot. `junReadiness` treats a missing or stale stamp as dead however
|
|
43
|
+
* complete the cache looks. Found by reproducing the jun.is failure, not by
|
|
44
|
+
* reading the code.
|
|
45
|
+
*/
|
|
46
|
+
export declare const JUN_HEARTBEAT_KEY = "doc-cache:jun-heartbeat";
|
|
47
|
+
export interface JunHeartbeat {
|
|
48
|
+
at: number;
|
|
49
|
+
docs: number;
|
|
50
|
+
}
|
|
51
|
+
/** The last sweep's stamp, or `null` when this process has never swept. */
|
|
52
|
+
export declare function junHeartbeat(): Promise<JunHeartbeat | null>;
|
|
36
53
|
/** Document id → canonical slug, as persisted by the doc-tree-cache runner. */
|
|
37
54
|
export declare function junSlugMap(): Promise<Record<string, string>>;
|
|
38
55
|
/** A document's cached HTML body, or `null` if it has not been rendered yet. */
|
|
@@ -20,6 +20,11 @@ export function junCountedDocIds(tree, rootDocId) {
|
|
|
20
20
|
}
|
|
21
21
|
return out;
|
|
22
22
|
}
|
|
23
|
+
export const JUN_HEARTBEAT_KEY = "doc-cache:jun-heartbeat";
|
|
24
|
+
export async function junHeartbeat() {
|
|
25
|
+
const beat = await useStorage().getItem(JUN_HEARTBEAT_KEY);
|
|
26
|
+
return beat && typeof beat.at === "number" ? beat : null;
|
|
27
|
+
}
|
|
23
28
|
export async function junSlugMap() {
|
|
24
29
|
const map = await useStorage().getItem(
|
|
25
30
|
"doc-cache:slug-map"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One signal, from the seeder to the janitor: **the site is finished being
|
|
3
|
+
* built.**
|
|
4
|
+
*
|
|
5
|
+
* ── The bug this replaces ────────────────────────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* The janitor waited a flat `BOOT_DELAY_MS` (20s) before capturing its
|
|
8
|
+
* baseline, with a comment saying exactly why — *"capturing a baseline mid-seed
|
|
9
|
+
* would record a half-built site as the clean state"* — and a guess in place of
|
|
10
|
+
* a signal.
|
|
11
|
+
*
|
|
12
|
+
* The guess loses on a first boot. Measured on the playground: 127 documents,
|
|
13
|
+
* 117 bodies and then four generated PNGs uploaded over HTTP, and the upload
|
|
14
|
+
* pass is the one that finishes last because it is the only part waiting on a
|
|
15
|
+
* network round trip per item. The janitor's baseline landed BETWEEN the tree
|
|
16
|
+
* write and the photo patch, so `coverUploadId` on every wall photograph looked
|
|
17
|
+
* like something a visitor had added — and in `clean` mode it was reverted,
|
|
18
|
+
* once, permanently, before anybody ever saw the Wall.
|
|
19
|
+
*
|
|
20
|
+
* The symptom is not janitor-shaped at all: **the Wall renders its title and no
|
|
21
|
+
* photographs**, on a site whose seeder logged `uploaded 4 wall photo(s)`. The
|
|
22
|
+
* tell is a tree entry that still carries `seedWallPhoto: true` — the seeder
|
|
23
|
+
* deletes that key in the same write that adds the cover — and a
|
|
24
|
+
* `janitor:inspect` that reports the site matching its baseline exactly, because
|
|
25
|
+
* by then it does.
|
|
26
|
+
*
|
|
27
|
+
* ── Why a module-scoped promise ──────────────────────────────────────────────
|
|
28
|
+
*
|
|
29
|
+
* Both plugins live in ONE Nitro process, so the simplest correct channel is a
|
|
30
|
+
* shared module. Either side may touch it first: whoever does creates the
|
|
31
|
+
* promise, the seeder resolves it, the janitor awaits it. Nitro's plugin order
|
|
32
|
+
* therefore does not matter, which is the property a storage key or a hook would
|
|
33
|
+
* not have given without more ceremony.
|
|
34
|
+
*
|
|
35
|
+
* The wait is BOUNDED and the caller passes the bound. A seeder that dies
|
|
36
|
+
* without settling must not leave the janitor asleep forever — it would present
|
|
37
|
+
* as "the janitor never starts", which is the single hardest failure to read in
|
|
38
|
+
* this subsystem.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Called by the seeder as it starts, so a janitor that asks first has something
|
|
42
|
+
* to wait on rather than resolving immediately.
|
|
43
|
+
*/
|
|
44
|
+
export declare function junSeedStarted(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Called by the seeder when the tree, the bodies AND the uploads are all in.
|
|
47
|
+
* Idempotent, and safe to call from a `finally` — a seed that failed halfway is
|
|
48
|
+
* still a seed that is no longer writing, which is what the janitor is waiting
|
|
49
|
+
* to know.
|
|
50
|
+
*/
|
|
51
|
+
export declare function junSeedFinished(): void;
|
|
52
|
+
/** Has the seeder already finished (or never started) in this process? */
|
|
53
|
+
export declare function junSeedSettled(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Is there a seeder in this process at all?
|
|
56
|
+
*
|
|
57
|
+
* The janitor must not wait on a gate nobody will open — a site with
|
|
58
|
+
* `seed.enabled: false` has no seeder, and waiting out the full bound there
|
|
59
|
+
* would delay the baseline for no reason. Safe to call after the janitor's own
|
|
60
|
+
* boot delay: both plugins register their runners in the same tick, so a seeder
|
|
61
|
+
* that exists has claimed the gate long before anybody asks.
|
|
62
|
+
*/
|
|
63
|
+
export declare function junSeedExpected(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Wait for the seed to finish, or for `timeoutMs`, whichever comes first.
|
|
66
|
+
* Resolves immediately when the seed has already settled.
|
|
67
|
+
*/
|
|
68
|
+
export declare function junWaitForSeed(timeoutMs: number): Promise<boolean>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
let settled = false;
|
|
2
|
+
let resolveGate = null;
|
|
3
|
+
let gate = null;
|
|
4
|
+
function ensure() {
|
|
5
|
+
if (!gate) {
|
|
6
|
+
gate = new Promise((resolve) => {
|
|
7
|
+
resolveGate = resolve;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return gate;
|
|
11
|
+
}
|
|
12
|
+
export function junSeedStarted() {
|
|
13
|
+
if (settled) return;
|
|
14
|
+
ensure();
|
|
15
|
+
}
|
|
16
|
+
export function junSeedFinished() {
|
|
17
|
+
settled = true;
|
|
18
|
+
ensure();
|
|
19
|
+
resolveGate?.();
|
|
20
|
+
resolveGate = null;
|
|
21
|
+
}
|
|
22
|
+
export function junSeedSettled() {
|
|
23
|
+
return settled;
|
|
24
|
+
}
|
|
25
|
+
export function junSeedExpected() {
|
|
26
|
+
return gate !== null;
|
|
27
|
+
}
|
|
28
|
+
export async function junWaitForSeed(timeoutMs) {
|
|
29
|
+
if (settled) return true;
|
|
30
|
+
const promise = ensure();
|
|
31
|
+
let timer;
|
|
32
|
+
const timeout = new Promise((resolve) => {
|
|
33
|
+
timer = setTimeout(() => resolve(false), timeoutMs);
|
|
34
|
+
});
|
|
35
|
+
try {
|
|
36
|
+
const won = await Promise.race([promise.then(() => true), timeout]);
|
|
37
|
+
return won;
|
|
38
|
+
} finally {
|
|
39
|
+
if (timer) clearTimeout(timer);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - DETAIL pages are the children of a list page and render one document.
|
|
17
17
|
* - SYSTEM pages are singletons that configure or describe the site itself.
|
|
18
18
|
*/
|
|
19
|
-
export type JunPageTypeKey = 'apps' | 'journal' | 'live' | 'links' | 'cv' | 'wall' | 'uses' | 'library' | 'guestbook' | 'cinema' | 'festival' | 'services' | 'app' | 'entry' | 'now' | 'movie' | 'track' | 'globe' | 'mosaic' | 'config' | 'redirect' | 'stats' | 'home';
|
|
19
|
+
export type JunPageTypeKey = 'apps' | 'journal' | 'live' | 'links' | 'cv' | 'wall' | 'uses' | 'library' | 'guestbook' | 'cinema' | 'festival' | 'services' | 'poll' | 'thread' | 'garden' | 'course' | 'app' | 'entry' | 'now' | 'movie' | 'track' | 'globe' | 'mosaic' | 'deck' | 'config' | 'redirect' | 'stats' | 'home';
|
|
20
20
|
/** Per-page-type overrides. `true` keeps every default; `false` never registers it. */
|
|
21
21
|
export interface JunPageTypeOverride {
|
|
22
22
|
/** Display name in pickers, breadcrumbs and the type switcher. */
|
|
@@ -800,6 +800,21 @@ export interface JunMosaicOptions {
|
|
|
800
800
|
*/
|
|
801
801
|
maxDepth?: number;
|
|
802
802
|
}
|
|
803
|
+
/**
|
|
804
|
+
* The site's house style for its renderers — page-type KEY → option key →
|
|
805
|
+
* value, e.g. `{ library: { variant: 'grid', covers: true } }`.
|
|
806
|
+
*
|
|
807
|
+
* Read by `useJunViewOptions`, which resolves a page's display settings in three
|
|
808
|
+
* steps: the document's own `meta.junView`, then this, then the renderer's own
|
|
809
|
+
* default. A document that stores nothing follows whatever is set here, so
|
|
810
|
+
* changing a value later reaches every page that never disagreed with it.
|
|
811
|
+
*
|
|
812
|
+
* Deliberately loose: each renderer declares its own option keys next to the
|
|
813
|
+
* layout they drive, so a union of every valid key would have to be maintained
|
|
814
|
+
* here as well and would be wrong the moment a renderer gained an option.
|
|
815
|
+
* Unknown keys and out-of-range values are ignored rather than rendered.
|
|
816
|
+
*/
|
|
817
|
+
export type JunRendererDefaults = Record<string, Record<string, string | boolean | number>>;
|
|
803
818
|
/** Which external-service adapters the `services` page type may call. */
|
|
804
819
|
export interface JunServicesOptions {
|
|
805
820
|
/**
|
|
@@ -880,6 +895,11 @@ export interface JunRuntimeOptions {
|
|
|
880
895
|
mosaic: Required<JunMosaicOptions>;
|
|
881
896
|
/** Enabled service adapters + their cache TTL. See `JunServicesOptions`. */
|
|
882
897
|
services: Required<JunServicesOptions>;
|
|
898
|
+
/**
|
|
899
|
+
* Per-page-type display defaults — the site's house style, resolved under
|
|
900
|
+
* each document's own `meta.junView`. See `JunRendererDefaults`.
|
|
901
|
+
*/
|
|
902
|
+
renderers: JunRendererDefaults;
|
|
883
903
|
/** Clicking a node in a renderer: navigate to its page, or open the slideover. */
|
|
884
904
|
nodePanel: 'navigate' | 'slideover';
|
|
885
905
|
/** Which context-menu items exist. Resolved — every key filled. */
|
|
@@ -899,4 +919,40 @@ export interface JunRuntimeOptions {
|
|
|
899
919
|
* client-only and never runs for them.
|
|
900
920
|
*/
|
|
901
921
|
jsonLd: Record<string, JunJsonLdSpec>;
|
|
922
|
+
/**
|
|
923
|
+
* COLLECTION type id → how its unclaimed children present as pages.
|
|
924
|
+
*
|
|
925
|
+
* A Library row, a gear item, a CV station and a links row are all
|
|
926
|
+
* `type: 'doc'` children of a typed parent. They are reachable — every
|
|
927
|
+
* collection renderer links each row to its own page — and until this
|
|
928
|
+
* existed they rendered as a bare editor: no cover, no author, no rating,
|
|
929
|
+
* nothing the shelf above them displays.
|
|
930
|
+
*
|
|
931
|
+
* The presentation is derived from the PARENT rather than from a type on
|
|
932
|
+
* the child, and that is the whole design. Children are `doc` on every site
|
|
933
|
+
* that already exists, so a child-side type would have improved nothing
|
|
934
|
+
* without a migration — and it would have fought the rule that makes page
|
|
935
|
+
* types convertible in the first place: a collection renders every child,
|
|
936
|
+
* including one it did not create.
|
|
937
|
+
*
|
|
938
|
+
* A child with its OWN registered type (an `entry` under a journal, a
|
|
939
|
+
* `movie` under a cinema) is never overridden — it has a renderer already.
|
|
940
|
+
*/
|
|
941
|
+
itemParents: Record<string, JunItemPresentation>;
|
|
942
|
+
/**
|
|
943
|
+
* The registered type id the item renderer is mounted under. Internal: it
|
|
944
|
+
* is not a `JunPageTypeKey`, never appears in the type switcher, and is
|
|
945
|
+
* never written to a document — pages are handed it as a synthetic type at
|
|
946
|
+
* render time.
|
|
947
|
+
*/
|
|
948
|
+
itemType: string;
|
|
949
|
+
}
|
|
950
|
+
/** How one collection's unclaimed children render as their own pages. */
|
|
951
|
+
export interface JunItemPresentation {
|
|
952
|
+
/** Singular noun for the back-link and the type line — "Book", "Tool". */
|
|
953
|
+
label: string;
|
|
954
|
+
/** Lucide icon for the item, when the document has none of its own. */
|
|
955
|
+
icon: string;
|
|
956
|
+
/** Structured data for the item, built from the server cache like every other. */
|
|
957
|
+
jsonLd?: JunJsonLdSpec;
|
|
902
958
|
}
|