@kernhq/module-quire 0.13.1 → 0.15.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/contract/models.d.ts +394 -0
- package/dist/contract/models.d.ts.map +1 -1
- package/dist/contract/models.js +284 -0
- package/dist/contract/models.js.map +1 -1
- package/dist/contract/permissions.d.ts +14 -0
- package/dist/contract/permissions.d.ts.map +1 -1
- package/dist/contract/permissions.js +114 -0
- package/dist/contract/permissions.js.map +1 -1
- package/dist/contract/properties.d.ts +7 -7
- package/dist/contract/router.d.ts +1124 -96
- package/dist/contract/router.d.ts.map +1 -1
- package/dist/contract/router.js +343 -1
- package/dist/contract/router.js.map +1 -1
- package/dist/server/_impl.d.ts +983 -1168
- package/dist/server/_impl.d.ts.map +1 -1
- package/dist/server/_impl.js +308 -0
- package/dist/server/_impl.js.map +1 -1
- package/dist/server/export/html.d.ts +67 -0
- package/dist/server/export/html.d.ts.map +1 -0
- package/dist/server/export/html.js +206 -0
- package/dist/server/export/html.js.map +1 -0
- package/dist/server/export/markdown.d.ts +51 -0
- package/dist/server/export/markdown.d.ts.map +1 -0
- package/dist/server/export/markdown.js +351 -0
- package/dist/server/export/markdown.js.map +1 -0
- package/dist/server/export/pdf.d.ts +20 -0
- package/dist/server/export/pdf.d.ts.map +1 -0
- package/dist/server/export/pdf.js +91 -0
- package/dist/server/export/pdf.js.map +1 -0
- package/dist/server/export/zip.d.ts +31 -0
- package/dist/server/export/zip.d.ts.map +1 -0
- package/dist/server/export/zip.js +158 -0
- package/dist/server/export/zip.js.map +1 -0
- package/dist/server/import/csv.d.ts +77 -0
- package/dist/server/import/csv.d.ts.map +1 -0
- package/dist/server/import/csv.js +263 -0
- package/dist/server/import/csv.js.map +1 -0
- package/dist/server/import/html.d.ts +52 -0
- package/dist/server/import/html.d.ts.map +1 -0
- package/dist/server/import/html.js +472 -0
- package/dist/server/import/html.js.map +1 -0
- package/dist/server/import/markdown.d.ts +63 -0
- package/dist/server/import/markdown.d.ts.map +1 -0
- package/dist/server/import/markdown.js +692 -0
- package/dist/server/import/markdown.js.map +1 -0
- package/dist/server/import/plan.d.ts +70 -0
- package/dist/server/import/plan.d.ts.map +1 -0
- package/dist/server/import/plan.js +761 -0
- package/dist/server/import/plan.js.map +1 -0
- package/dist/server/import/ydoc.d.ts +35 -0
- package/dist/server/import/ydoc.d.ts.map +1 -0
- package/dist/server/import/ydoc.js +91 -0
- package/dist/server/import/ydoc.js.map +1 -0
- package/dist/server/import/zip.d.ts +63 -0
- package/dist/server/import/zip.d.ts.map +1 -0
- package/dist/server/import/zip.js +308 -0
- package/dist/server/import/zip.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/render.d.ts +158 -0
- package/dist/server/render.d.ts.map +1 -1
- package/dist/server/render.js +240 -0
- package/dist/server/render.js.map +1 -1
- package/dist/server/schema.d.ts +704 -1
- package/dist/server/schema.d.ts.map +1 -1
- package/dist/server/schema.js +254 -1
- package/dist/server/schema.js.map +1 -1
- package/dist/server/services/databases.d.ts +10 -10
- package/dist/server/services/export.d.ts +176 -0
- package/dist/server/services/export.d.ts.map +1 -0
- package/dist/server/services/export.js +822 -0
- package/dist/server/services/export.js.map +1 -0
- package/dist/server/services/import.d.ts +109 -0
- package/dist/server/services/import.d.ts.map +1 -0
- package/dist/server/services/import.js +570 -0
- package/dist/server/services/import.js.map +1 -0
- package/dist/server/services/index.d.ts +32 -1
- package/dist/server/services/index.d.ts.map +1 -1
- package/dist/server/services/index.js +87 -4
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/macros.d.ts +83 -0
- package/dist/server/services/macros.d.ts.map +1 -0
- package/dist/server/services/macros.js +488 -0
- package/dist/server/services/macros.js.map +1 -0
- package/dist/server/services/publications.d.ts +2 -1
- package/dist/server/services/publications.d.ts.map +1 -1
- package/dist/server/services/publications.js +43 -4
- package/dist/server/services/publications.js.map +1 -1
- package/dist/server/services/templates.d.ts +135 -0
- package/dist/server/services/templates.d.ts.map +1 -0
- package/dist/server/services/templates.js +897 -0
- package/dist/server/services/templates.js.map +1 -0
- package/dist/server/services/versions.d.ts +13 -1
- package/dist/server/services/versions.d.ts.map +1 -1
- package/dist/server/services/versions.js +3 -1
- package/dist/server/services/versions.js.map +1 -1
- package/migrations/0010_transfers.sql +154 -0
- package/migrations/0011_templates.sql +157 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +5 -5
- package/src/client/components/ExportDialog.svelte +685 -0
- package/src/client/components/ImportDialog.svelte +702 -0
- package/src/client/components/ImportReport.svelte +310 -0
- package/src/client/components/NewSpaceDialog.svelte +77 -8
- package/src/client/components/PageEditor.svelte +80 -0
- package/src/client/components/PagePicker.svelte +264 -0
- package/src/client/components/SaveAsTemplateDialog.svelte +502 -0
- package/src/client/components/SidebarSpaces.svelte +112 -1
- package/src/client/components/TemplatePicker.svelte +437 -0
- package/src/client/i18n.ts +941 -0
- package/src/client/index.ts +51 -0
- package/src/client/mock.ts +592 -0
- package/src/client/module.ts +36 -0
- package/src/client/pages/PageView.svelte +86 -0
- package/src/client/pages/SpacePage.svelte +20 -4
- package/src/client/pages/TransfersPage.svelte +570 -0
- package/src/client/permissions.ts +11 -0
- package/src/client/query.ts +40 -0
- package/src/client/transfers.ts +142 -0
- package/src/contract/models.ts +343 -0
- package/src/contract/permissions.ts +117 -0
- package/src/contract/router.ts +375 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/server/services/templates.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,SAAS,EAAwB,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAExE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAUtD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACl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AAK,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;QAC9D,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Principal } from '@kernhq/contracts';
|
|
2
2
|
import { type Kernel, type Tx } from '@kernhq/kernel';
|
|
3
3
|
import type { PageVersion } from '../../contract/index.js';
|
|
4
|
+
import { type MacroResolver, type MacroStrings } from '../render.js';
|
|
4
5
|
import { pageVersions } from '../schema.js';
|
|
5
6
|
import type { QuireAccess } from './access.js';
|
|
6
7
|
type VersionRow = typeof pageVersions.$inferSelect;
|
|
@@ -76,9 +77,9 @@ export declare function quireVersions(kernel: Kernel, access: QuireAccess): {
|
|
|
76
77
|
kind: string;
|
|
77
78
|
size: number;
|
|
78
79
|
authorId: string | null;
|
|
79
|
-
text: string;
|
|
80
80
|
html: string | null;
|
|
81
81
|
state: Buffer<ArrayBufferLike>;
|
|
82
|
+
text: string;
|
|
82
83
|
snapshot: Buffer<ArrayBufferLike> | null;
|
|
83
84
|
}>;
|
|
84
85
|
/** What a reader is served, once somebody decides it is ready. */
|
|
@@ -168,6 +169,17 @@ export declare function quireVersions(kernel: Kernel, access: QuireAccess): {
|
|
|
168
169
|
*/
|
|
169
170
|
html(tx: Tx, workspaceId: string, state: Buffer | Uint8Array | null, opts?: {
|
|
170
171
|
pictures?: "signed" | "referenced";
|
|
172
|
+
/**
|
|
173
|
+
* What the macros that read other pages were told, for whoever this render is for.
|
|
174
|
+
*
|
|
175
|
+
* Absent — which is what the publish-time render passes — draws every reading macro as an
|
|
176
|
+
* empty frame. That is not an oversight to fix later: this output is **stored** in
|
|
177
|
+
* `page_versions.html`, and a resolved macro in a stored row is a set of page titles frozen
|
|
178
|
+
* at publish time and served for ever, including after those pages are unpublished. The
|
|
179
|
+
* public read re-resolves them per read instead. See `publications.html`.
|
|
180
|
+
*/
|
|
181
|
+
macros?: MacroResolver;
|
|
182
|
+
macroStrings?: MacroStrings;
|
|
171
183
|
}): Promise<string>;
|
|
172
184
|
};
|
|
173
185
|
export type QuireVersions = ReturnType<typeof quireVersions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../src/server/services/versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAa,KAAK,MAAM,EAAE,KAAK,EAAE,EAAU,MAAM,gBAAgB,CAAA;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../src/server/services/versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAa,KAAK,MAAM,EAAE,KAAK,EAAE,EAAU,MAAM,gBAAgB,CAAA;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EAIlB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAS,YAAY,EAAU,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C,KAAK,UAAU,GAAG,OAAO,YAAY,CAAC,YAAY,CAAA;AAKlD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,oBAAoB,CAAA;AACvD,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAA8C,CAAA;AAE9F,wBAAgB,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAalF;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;IAS7D;;;;;;OAMG;gBAEG,EAAE,eACO,MAAM,UAC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2
|
import { and, desc, eq, inArray, lt } from 'drizzle-orm';
|
|
3
3
|
import { pageDocFromBase64, pageDocFromState } from '../document.js';
|
|
4
|
-
import { referencesIn, renderPageDoc, textFromPageDoc } from '../render.js';
|
|
4
|
+
import { referencesIn, renderPageDoc, textFromPageDoc, } from '../render.js';
|
|
5
5
|
import { pages, pageVersions, spaces } from '../schema.js';
|
|
6
6
|
import { documentNameOf } from './pages.js';
|
|
7
7
|
/** How much of the prose a version list shows without loading the document. */
|
|
@@ -270,6 +270,8 @@ export function quireVersions(kernel, access) {
|
|
|
270
270
|
return renderPageDoc(doc, {
|
|
271
271
|
fileSrc: (id) => sources.get(id) ?? null,
|
|
272
272
|
pageHref: (id) => hrefs.get(id) ?? null,
|
|
273
|
+
macros: opts.macros,
|
|
274
|
+
macroStrings: opts.macroStrings,
|
|
273
275
|
});
|
|
274
276
|
},
|
|
275
277
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/server/services/versions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAwB,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/server/services/versions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAwB,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAGL,YAAY,EACZ,aAA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AAE;yBACH,CAAC,CAAA;wBACF,IAAI,CAAC,IAAI,EAAE,GAAG;4BAAE,OAAM;wBACtB,OAAO,CAAC,GAAG,CACT,EAAE,EACF,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE;4BACxC,WAAW,EAAE,QAAQ;4BACrB,WAAW,EAAE,IAAI,CAAC,QAAQ;yBAC3B,CAAC,CACH,CAAA;oBACH,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACb,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,wCAAwC,CAAC,CAAA;oBAC7F,CAAC;gBACH,CAAC,CAAC,CACH,CAAA;YACH,CAAC;YAED,OAAO,aAAa,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI;gBACxC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI;gBACvC,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,YAAY,EAAE,IAAI,CAAC,YAAY;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
-- Getting work in and out: a request to export a page, a subtree or a space, and a request to import
|
|
2
|
+
-- a Notion, Confluence or Markdown export into a space.
|
|
3
|
+
--
|
|
4
|
+
-- Hand-written rather than generated, like 0001, 0006 and 0008, because drizzle-kit writes neither
|
|
5
|
+
-- the policy nor the guards. Every statement is idempotent: `create table`, `create index` and
|
|
6
|
+
-- `create policy` throw on a replay, and a module migration that throws takes down the **whole host
|
|
7
|
+
-- service** rather than its own module — `core` hosts five. Drizzle keys applied migrations by
|
|
8
|
+
-- content hash, so regenerating the journal replays every file against a schema that already has its
|
|
9
|
+
-- objects.
|
|
10
|
+
--
|
|
11
|
+
--
|
|
12
|
+
-- WHY THESE ARE ROWS AND NOT REQUESTS
|
|
13
|
+
--
|
|
14
|
+
-- The work is unbounded on both sides. A space is a tree of arbitrary size; PDF means a round trip to
|
|
15
|
+
-- Gotenberg per page; a Notion export is a zip with thousands of files in it. A job that outlives its
|
|
16
|
+
-- HTTP request is what lets progress be reported, a failure be read afterwards by somebody who was
|
|
17
|
+
-- not watching, and a retry happen without the browser having stayed open. That is the whole reason
|
|
18
|
+
-- `state`, `counts`, `error` and `finished_at` are columns rather than fields of a response.
|
|
19
|
+
--
|
|
20
|
+
--
|
|
21
|
+
-- WHAT THESE TABLES DO NOT DO
|
|
22
|
+
--
|
|
23
|
+
-- Neither of them is a permission. "You may not export a page you may not read" and "an import writes
|
|
24
|
+
-- only into a space you may write to" are decided by the procedure, against the same space bindings
|
|
25
|
+
-- every other read in this module goes through, before a row is written at all. The policy below is
|
|
26
|
+
-- the tenant fence and nothing more — it stops workspace B seeing workspace A's jobs, and it has
|
|
27
|
+
-- nothing to say about which pages within one workspace went into an artefact. Do not read a row's
|
|
28
|
+
-- existence as evidence that anybody was allowed to ask for it.
|
|
29
|
+
CREATE TABLE IF NOT EXISTS "mod_quire"."export_jobs" (
|
|
30
|
+
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
31
|
+
"workspace_id" uuid NOT NULL,
|
|
32
|
+
-- Not null, where every other `created_by` in this schema is nullable. The artefact is the hazard:
|
|
33
|
+
-- a subtree export flattens pages with different readerships into one file, so whoever may fetch
|
|
34
|
+
-- it may read everything that went into it. Fencing the download to the person who asked needs a
|
|
35
|
+
-- person to fence it to, and a row whose requester has gone null cannot be fenced.
|
|
36
|
+
"requested_by" uuid NOT NULL,
|
|
37
|
+
-- `page` | `subtree` | `space`
|
|
38
|
+
"scope" text NOT NULL,
|
|
39
|
+
-- the page for `page` and `subtree`, the space for `space`; `scope` says which
|
|
40
|
+
"target_id" uuid NOT NULL,
|
|
41
|
+
-- `markdown` | `html` | `docx` | `pdf`
|
|
42
|
+
"format" text NOT NULL,
|
|
43
|
+
-- `queued` | `running` | `done` | `failed`
|
|
44
|
+
"state" text DEFAULT 'queued' NOT NULL,
|
|
45
|
+
-- The artefact in storage: written when the job finishes, null until then. Null while running is
|
|
46
|
+
-- what keeps a half file from being offered — the uploader writes the bytes, then the job records
|
|
47
|
+
-- the id, so this never points at a file that is still arriving. An id is not a URL: the download
|
|
48
|
+
-- is a signed URL a procedure mints, never a storage key a client assembles. See 0009 for what
|
|
49
|
+
-- that rule cost the last time it was broken.
|
|
50
|
+
"file_id" uuid,
|
|
51
|
+
-- Diagnostic text, in the language of whatever failed. Not a user-facing string: what a screen
|
|
52
|
+
-- shows comes from a message key chosen from `state`, and this is what makes the same failure
|
|
53
|
+
-- answerable a week later.
|
|
54
|
+
"error" text,
|
|
55
|
+
-- `{ total, done, skipped, failed }`. `skipped` is load-bearing: a subtree export by somebody who
|
|
56
|
+
-- may not read one of its children leaves that child out, and the count is the difference between
|
|
57
|
+
-- an export that is missing pages and an export that says so.
|
|
58
|
+
"counts" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
59
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
60
|
+
-- null while `queued` or `running`; set once, on the move to `done` or `failed`
|
|
61
|
+
"finished_at" timestamp with time zone
|
|
62
|
+
);
|
|
63
|
+
--> statement-breakpoint
|
|
64
|
+
|
|
65
|
+
-- The same shape pointed the other way, with one addition that carries the weight of the feature.
|
|
66
|
+
--
|
|
67
|
+
-- `report` is jsonb rather than a table, and that is a decision rather than a shortcut.
|
|
68
|
+
--
|
|
69
|
+
-- It is written by one job and read whole, as one document, by one screen: the person who ran the
|
|
70
|
+
-- import looking at what happened to their import. Nothing joins to an entry, nothing updates an
|
|
71
|
+
-- entry after the fact, nothing holds a foreign key into one, and no entry outlives its job. A
|
|
72
|
+
-- row-per-file table would be four thousand inserts to render a list only ever fetched by
|
|
73
|
+
-- `where job_id = $1`, plus a second tenant table with its own `workspace_id`, its own policy, its
|
|
74
|
+
-- own `TENANT_TABLES` entry and its own retention rule — all to store a document. Here, dropping the
|
|
75
|
+
-- job drops its report; there is nothing to sweep. The size is the part worth checking rather than
|
|
76
|
+
-- assuming: an entry is a path, one of three words, and either a uuid or a sentence, so a
|
|
77
|
+
-- five-thousand-file import is a few hundred kilobytes — one TOASTed value, read once.
|
|
78
|
+
--
|
|
79
|
+
-- **What would change if somebody wanted to query across imports** — "every file that failed for this
|
|
80
|
+
-- reason, across every import this month" — is that this stops being the right shape, and not by a
|
|
81
|
+
-- little. `jsonb_array_elements` over the whole table can answer it, but no index helps: a GIN index
|
|
82
|
+
-- on the column serves containment (`@>`), not a predicate plus an ordering inside the array. The
|
|
83
|
+
-- change is a `mod_quire.import_entries` table — `job_id`, `workspace_id`, `path`, `outcome`,
|
|
84
|
+
-- `page_id`, `reason` — indexed on `(workspace_id, outcome, created_at)`, written by the same worker,
|
|
85
|
+
-- with the existing rows backfilled by expanding this column through `jsonb_to_recordset`. It is a
|
|
86
|
+
-- tenant table, so it arrives with the full triple and a `TENANT_TABLES` entry, and it needs the
|
|
87
|
+
-- retention rule the column gets for free. The threshold is exactly that question: while every read
|
|
88
|
+
-- names one job, the column is right.
|
|
89
|
+
CREATE TABLE IF NOT EXISTS "mod_quire"."import_jobs" (
|
|
90
|
+
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
91
|
+
"workspace_id" uuid NOT NULL,
|
|
92
|
+
-- not null for the same reason as `export_jobs.requested_by`
|
|
93
|
+
"requested_by" uuid NOT NULL,
|
|
94
|
+
-- `notion` | `confluence` | `markdown`
|
|
95
|
+
"source" text NOT NULL,
|
|
96
|
+
-- the space being written into. An import always targets one space; there is no `scope` here.
|
|
97
|
+
"target_id" uuid NOT NULL,
|
|
98
|
+
-- The uploaded archive, and **not** called `file_id` on purpose. `export_jobs.file_id` is the file
|
|
99
|
+
-- a job produces and is null until it succeeds; this is the file a job consumes and exists before
|
|
100
|
+
-- the job does. One name pointing in two directions across two tables read by one screen is how a
|
|
101
|
+
-- worker writes its output id over the pointer to its input — losing the archive, so the job
|
|
102
|
+
-- cannot be retried and nothing reports that anything went missing.
|
|
103
|
+
"source_file_id" uuid NOT NULL,
|
|
104
|
+
-- `queued` | `running` | `done` | `failed`
|
|
105
|
+
"state" text DEFAULT 'queued' NOT NULL,
|
|
106
|
+
-- why the *job* failed; why one *file* failed is that file's entry in `report`
|
|
107
|
+
"error" text,
|
|
108
|
+
-- `{ total, done, skipped, failed }` — the same counters as an export, over files rather than pages
|
|
109
|
+
"counts" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
110
|
+
-- one entry per file: `{ path, outcome, pageId, reason }`, where outcome is imported|skipped|failed
|
|
111
|
+
"report" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
112
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
113
|
+
-- null while `queued` or `running`; set once, on the move to `done` or `failed`
|
|
114
|
+
"finished_at" timestamp with time zone
|
|
115
|
+
);
|
|
116
|
+
--> statement-breakpoint
|
|
117
|
+
|
|
118
|
+
-- Newest first, because that is the only order a list of jobs is ever read in — the one you just
|
|
119
|
+
-- started is the one you are looking for. `DESC NULLS LAST` rather than a plain index scanned
|
|
120
|
+
-- backwards so the ordering is the index's own, matching `recent_views_ws_user_idx` in 0007.
|
|
121
|
+
CREATE INDEX IF NOT EXISTS "export_jobs_ws_created_idx" ON "mod_quire"."export_jobs" USING btree ("workspace_id","created_at" DESC NULLS LAST);--> statement-breakpoint
|
|
122
|
+
|
|
123
|
+
-- "What is still running here", asked by the worker picking up work and by every client polling a
|
|
124
|
+
-- job it started. Leading with the state after the workspace keeps that probe off the rows of every
|
|
125
|
+
-- export the workspace has ever finished.
|
|
126
|
+
CREATE INDEX IF NOT EXISTS "export_jobs_ws_state_idx" ON "mod_quire"."export_jobs" USING btree ("workspace_id","state","created_at");--> statement-breakpoint
|
|
127
|
+
CREATE INDEX IF NOT EXISTS "import_jobs_ws_created_idx" ON "mod_quire"."import_jobs" USING btree ("workspace_id","created_at" DESC NULLS LAST);--> statement-breakpoint
|
|
128
|
+
CREATE INDEX IF NOT EXISTS "import_jobs_ws_state_idx" ON "mod_quire"."import_jobs" USING btree ("workspace_id","state","created_at");--> statement-breakpoint
|
|
129
|
+
|
|
130
|
+
-- Row-level security, the same triple every tenant table gets.
|
|
131
|
+
--
|
|
132
|
+
-- `force` matters: without it the table owner bypasses the policy, and the owner is the role the
|
|
133
|
+
-- service connects as. A *superuser* bypasses RLS whatever this says, and the development and CI
|
|
134
|
+
-- roles are superusers — so a test that does not connect as an unprivileged NOBYPASSRLS role proves
|
|
135
|
+
-- nothing about isolation.
|
|
136
|
+
--
|
|
137
|
+
-- Note what this does and does not fence, because these two tables invite the wrong reading. It is
|
|
138
|
+
-- the tenant boundary: workspace B cannot see workspace A's jobs, in either direction. It says
|
|
139
|
+
-- nothing about which *pages* went into an artefact, nothing about whether the requester was allowed
|
|
140
|
+
-- to ask, and nothing about who may download the result. Those are the procedure's job, decided
|
|
141
|
+
-- against the same space bindings as every other read in this module, before the row exists.
|
|
142
|
+
ALTER TABLE "mod_quire"."export_jobs" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
143
|
+
ALTER TABLE "mod_quire"."export_jobs" FORCE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
144
|
+
DROP POLICY IF EXISTS "export_jobs_ws_isolation" ON "mod_quire"."export_jobs";--> statement-breakpoint
|
|
145
|
+
CREATE POLICY "export_jobs_ws_isolation" ON "mod_quire"."export_jobs"
|
|
146
|
+
USING (workspace_id::text = current_setting('app.workspace_id', true))
|
|
147
|
+
WITH CHECK (workspace_id::text = current_setting('app.workspace_id', true));--> statement-breakpoint
|
|
148
|
+
|
|
149
|
+
ALTER TABLE "mod_quire"."import_jobs" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
150
|
+
ALTER TABLE "mod_quire"."import_jobs" FORCE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
151
|
+
DROP POLICY IF EXISTS "import_jobs_ws_isolation" ON "mod_quire"."import_jobs";--> statement-breakpoint
|
|
152
|
+
CREATE POLICY "import_jobs_ws_isolation" ON "mod_quire"."import_jobs"
|
|
153
|
+
USING (workspace_id::text = current_setting('app.workspace_id', true))
|
|
154
|
+
WITH CHECK (workspace_id::text = current_setting('app.workspace_id', true));
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
-- A page, or a whole space, saved so it can be made again.
|
|
2
|
+
--
|
|
3
|
+
-- Hand-written rather than generated, like 0001, 0006, 0008 and 0010, because drizzle-kit writes
|
|
4
|
+
-- neither the policy nor the guards. Every statement is idempotent: `create table`, `create index`
|
|
5
|
+
-- and `create policy` throw on a replay, and a module migration that throws takes down the **whole
|
|
6
|
+
-- host service** rather than its own module — `core` hosts five. Drizzle keys applied migrations by
|
|
7
|
+
-- content hash, so regenerating the journal replays every file against a schema that already has its
|
|
8
|
+
-- objects. The two `check` constraints are inline in `create table if not exists` on purpose: there
|
|
9
|
+
-- they inherit that guard, where a separate `alter table … add constraint` would need a
|
|
10
|
+
-- `drop constraint if exists` in front of it and is the shape that has broken this before.
|
|
11
|
+
--
|
|
12
|
+
--
|
|
13
|
+
-- WHERE THE FIVE STARTERS LIVE, AND WHY IT IS NOT IN THIS TABLE
|
|
14
|
+
--
|
|
15
|
+
-- Meeting notes, decision record, requirements, retrospective and how-to are **constants in the
|
|
16
|
+
-- module**, not rows seeded here. Three reasons, and the first one alone settles it.
|
|
17
|
+
--
|
|
18
|
+
-- *A migration has no workspace to seed into.* Every tenant table in `mod_quire` carries
|
|
19
|
+
-- `workspace_id NOT NULL` and is fenced by a policy that reads `app.workspace_id`. A migration runs
|
|
20
|
+
-- once per **database**, before any workspace exists and then never again — so a seeded row would
|
|
21
|
+
-- need either a nullable `workspace_id`, which makes `templates` the one table in this schema RLS
|
|
22
|
+
-- does not actually cover, or a second mechanism hooked to workspace creation, which then has to be
|
|
23
|
+
-- re-run against every workspace that already existed each time a sixth starter is added. Both are
|
|
24
|
+
-- worse than the thing they solve.
|
|
25
|
+
--
|
|
26
|
+
-- *A row is frozen at the release that wrote it.* Improving the retrospective starter in 0.15 does
|
|
27
|
+
-- nothing for a workspace created under 0.14, and making it do something means an `UPDATE` in a
|
|
28
|
+
-- migration — which overwrites whatever the customer changed. A constant improves for everybody on
|
|
29
|
+
-- the release that ships it, and overwrites nothing, because nothing was ever copied.
|
|
30
|
+
--
|
|
31
|
+
-- *A row holds one language.* Every user-facing string in Kern goes through `t()` in five locales.
|
|
32
|
+
-- A seeded row's name, description and prose would be English in an Arabic workspace for ever; a
|
|
33
|
+
-- constant's strings are message keys resolved per reader.
|
|
34
|
+
--
|
|
35
|
+
-- What that costs is the thing the trade is usually made for: a constant cannot be edited. That is
|
|
36
|
+
-- what `built_in` and `key` buy back, and how they work is written on the columns below.
|
|
37
|
+
CREATE TABLE IF NOT EXISTS "mod_quire"."templates" (
|
|
38
|
+
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
39
|
+
"workspace_id" uuid NOT NULL,
|
|
40
|
+
-- Null is a workspace-wide template, offered wherever a page is made. A space id scopes it to one
|
|
41
|
+
-- space, which is what a team wanting their own "incident report" without putting it in everybody
|
|
42
|
+
-- else's picker actually asks for. Nullable rather than two tables because every read is the same
|
|
43
|
+
-- read — "what may I make here" — and a union of two tables to answer one question is how the
|
|
44
|
+
-- workspace-wide half ends up quietly missing from one of the three places that asks.
|
|
45
|
+
"space_id" uuid,
|
|
46
|
+
-- `page` — one page, `doc` is its body.
|
|
47
|
+
-- `space` — a whole space, `doc` is `{ pages: [...] }`, a tree of titles and bodies.
|
|
48
|
+
-- Text with no check constraint, like `spaces.visibility`, `pages.kind` and `export_jobs.scope`:
|
|
49
|
+
-- the enum in the contract is what closes these, and one column in the schema enforcing its domain
|
|
50
|
+
-- in the database while eight do not teaches nothing except that the rule is arbitrary.
|
|
51
|
+
"kind" text DEFAULT 'page' NOT NULL,
|
|
52
|
+
-- Which shipped starter this row **replaces**, or null for somebody's own template.
|
|
53
|
+
--
|
|
54
|
+
-- A starter is a constant, so it has a stable key (`meeting-notes`, `decision-record`,
|
|
55
|
+
-- `requirements`, `retrospective`, `how-to`) rather than a uuid — there is no row to have an id.
|
|
56
|
+
-- The picker reads the constants and the rows together, and a row with a key takes the place of
|
|
57
|
+
-- the starter it names instead of appearing beside it. So editing a starter is copy-on-write: the
|
|
58
|
+
-- first edit in a workspace writes one row, before that there are none, and resetting is deleting
|
|
59
|
+
-- that row — after which the shipped starter comes back, current and translated.
|
|
60
|
+
--
|
|
61
|
+
-- Deliberately **not** validated against the starter set, here or in the contract's row parser. A
|
|
62
|
+
-- release that stops shipping a starter would otherwise turn every override of it into a parse
|
|
63
|
+
-- failure, which is a picker that throws rather than a picker missing one entry. A key naming a
|
|
64
|
+
-- starter that no longer exists is an ordinary custom template, and that is the read side's rule.
|
|
65
|
+
"key" text,
|
|
66
|
+
-- True exactly when this row occupies a shipped starter's slot — see `key`. The pair is what keeps
|
|
67
|
+
-- the flag honest: something writes it (the first edit of a starter), something reads it (the
|
|
68
|
+
-- picker, deciding whether to draw the constant or the row), and the check constraint below stops
|
|
69
|
+
-- the two from drifting apart. A boolean nothing sets is the failure this project keeps naming
|
|
70
|
+
-- about capabilities and permission keys, and it is the same failure here.
|
|
71
|
+
"built_in" boolean DEFAULT false NOT NULL,
|
|
72
|
+
"name" text NOT NULL,
|
|
73
|
+
"description" text DEFAULT '' NOT NULL,
|
|
74
|
+
-- a Lucide icon name or an emoji, as everywhere else in this schema
|
|
75
|
+
"icon" text,
|
|
76
|
+
-- The body. A `PageDoc` for `kind = 'page'`; `{ pages: [ { title, icon, doc, children } ] }` for
|
|
77
|
+
-- `kind = 'space'`. Always a JSON *object* rather than sometimes an array, so the default is a
|
|
78
|
+
-- shape and not a lie, and so the two are told apart by their keys rather than by their type.
|
|
79
|
+
--
|
|
80
|
+
-- Whatever a person can write, a template can hold — which means this column is bound by the same
|
|
81
|
+
-- rule as everything else that stores a page: a node the editor can produce and `renderPageDoc`
|
|
82
|
+
-- cannot draw is a template that makes blank pages. Nothing here can check that; `render.test.ts`
|
|
83
|
+
-- is what does.
|
|
84
|
+
"doc" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
85
|
+
-- `[{ name, label, type, options, default, required }]` — what somebody is asked before the page
|
|
86
|
+
-- is made, so `{{sprint}}` in the body becomes a sprint. `{{date}}` and `{{author}}` are not in
|
|
87
|
+
-- here: they are filled from the request and need declaring by nobody.
|
|
88
|
+
--
|
|
89
|
+
-- JSONB rather than a `template_variables` table for the same reason `import_jobs.report` is a
|
|
90
|
+
-- column: it is written whole, read whole, by one screen, nothing joins to an entry and no entry
|
|
91
|
+
-- outlives its template. A table would be a second tenant table with its own `workspace_id`, its
|
|
92
|
+
-- own policy and its own `TENANT_TABLES` entry to store a list of at most a dozen field
|
|
93
|
+
-- definitions that are only ever fetched by `where template_id = $1`.
|
|
94
|
+
"variables" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
95
|
+
-- Nullable, like every other `created_by` in this schema and unlike the two job tables. A template
|
|
96
|
+
-- is not an artefact that flattens other people's readerships into one file, so there is nothing
|
|
97
|
+
-- here that has to be fenced to a person; a template whose author has left the workspace is still
|
|
98
|
+
-- the team's template, and nulling the author must not take it away from them.
|
|
99
|
+
"created_by" uuid,
|
|
100
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
101
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
102
|
+
-- `key` is present exactly when `built_in` is true. Written as an equality rather than as two
|
|
103
|
+
-- `or`ed halves because both sides are non-nullable booleans, so the constraint can never evaluate
|
|
104
|
+
-- to NULL and be satisfied by accident — the usual way a check constraint stops checking.
|
|
105
|
+
CONSTRAINT "templates_key_matches_built_in" CHECK ("built_in" = ("key" IS NOT NULL)),
|
|
106
|
+
-- A space template makes a space, so it cannot live inside one. Without this the picker for space
|
|
107
|
+
-- creation has to decide what a space-scoped space template means, and every answer is a guess.
|
|
108
|
+
CONSTRAINT "templates_space_kind" CHECK ("kind" <> 'space' OR "space_id" IS NULL)
|
|
109
|
+
);
|
|
110
|
+
--> statement-breakpoint
|
|
111
|
+
|
|
112
|
+
-- The only read that matters, and it is one index rather than two.
|
|
113
|
+
--
|
|
114
|
+
-- "What may I make here" is `kind = 'page' and (space_id = $1 or space_id is null)`, and this is
|
|
115
|
+
-- what serves it — one index rather than a second one for the workspace-wide half.
|
|
116
|
+
--
|
|
117
|
+
-- `name` is last so the read is covered, not so the read comes back sorted: measured, the plan is an
|
|
118
|
+
-- index-only scan with the `or` applied as a filter inside it, and the `order by` is a sort over the
|
|
119
|
+
-- handful of rows that come out. That is the right trade at this size, and it is worth writing down
|
|
120
|
+
-- because the shape suggests otherwise — an index whose trailing column is the sort key usually does
|
|
121
|
+
-- supply the order, and here the disjunction on the column before it is what stops it.
|
|
122
|
+
--
|
|
123
|
+
-- There is deliberately **no** `(workspace_id, created_at desc)` index, unlike `export_jobs` and
|
|
124
|
+
-- `import_jobs` next door. Those accumulate a row per request for ever and are read newest-first;
|
|
125
|
+
-- a workspace has tens of templates, read by name, and an index nothing needs is a write nobody
|
|
126
|
+
-- asked for.
|
|
127
|
+
CREATE INDEX IF NOT EXISTS "templates_ws_kind_space_idx" ON "mod_quire"."templates" USING btree ("workspace_id","kind","space_id","name");--> statement-breakpoint
|
|
128
|
+
|
|
129
|
+
-- One override per starter per workspace. Two rows both claiming `retrospective` would make which
|
|
130
|
+
-- one the picker draws a coin toss, and "reset to the shipped one" would delete half the change.
|
|
131
|
+
-- Partial, because `key` is null on every template somebody wrote themselves and a plain unique
|
|
132
|
+
-- index over a nullable column constrains nothing at all in Postgres — NULLs never collide.
|
|
133
|
+
--
|
|
134
|
+
-- Names are **not** unique, in either direction. A workspace calling its own template "Meeting
|
|
135
|
+
-- notes" beside the starter of that name is a thing people mean to do, and a constraint refusing it
|
|
136
|
+
-- would be the database having an opinion about wording.
|
|
137
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "templates_ws_key_uq" ON "mod_quire"."templates" USING btree ("workspace_id","key") WHERE "key" IS NOT NULL;--> statement-breakpoint
|
|
138
|
+
|
|
139
|
+
-- Row-level security, the same triple every tenant table gets.
|
|
140
|
+
--
|
|
141
|
+
-- `force` matters: without it the table owner bypasses the policy, and the owner is the role the
|
|
142
|
+
-- service connects as. A *superuser* bypasses RLS whatever this says, and the development and CI
|
|
143
|
+
-- roles are superusers — so a test that does not connect as an unprivileged NOBYPASSRLS role proves
|
|
144
|
+
-- nothing about isolation.
|
|
145
|
+
--
|
|
146
|
+
-- This is the tenant fence and nothing more. It does not decide who may *use* a template — a
|
|
147
|
+
-- space-scoped template belongs to a space, and whether the person asking may read that space is
|
|
148
|
+
-- settled by the procedure against the same space bindings as every other read in this module. Nor
|
|
149
|
+
-- does it decide what a template may *contain*: a template made from a page the author could read
|
|
150
|
+
-- carries that page's prose to whoever makes a page from it, which is a copy and not a leak, and is
|
|
151
|
+
-- the procedure's call at the moment of saving rather than this policy's.
|
|
152
|
+
ALTER TABLE "mod_quire"."templates" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
153
|
+
ALTER TABLE "mod_quire"."templates" FORCE ROW LEVEL SECURITY;--> statement-breakpoint
|
|
154
|
+
DROP POLICY IF EXISTS "templates_ws_isolation" ON "mod_quire"."templates";--> statement-breakpoint
|
|
155
|
+
CREATE POLICY "templates_ws_isolation" ON "mod_quire"."templates"
|
|
156
|
+
USING (workspace_id::text = current_setting('app.workspace_id', true))
|
|
157
|
+
WITH CHECK (workspace_id::text = current_setting('app.workspace_id', true));
|
|
@@ -71,6 +71,20 @@
|
|
|
71
71
|
"when": 1787954227617,
|
|
72
72
|
"tag": "0009_public_asset_references",
|
|
73
73
|
"breakpoints": true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"idx": 10,
|
|
77
|
+
"version": "7",
|
|
78
|
+
"when": 1788040627617,
|
|
79
|
+
"tag": "0010_transfers",
|
|
80
|
+
"breakpoints": true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"idx": 11,
|
|
84
|
+
"version": "7",
|
|
85
|
+
"when": 1788127027617,
|
|
86
|
+
"tag": "0011_templates",
|
|
87
|
+
"breakpoints": true
|
|
74
88
|
}
|
|
75
89
|
]
|
|
76
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernhq/module-quire",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Kern Quire: collaborative documents, spaces and page trees",
|
|
5
5
|
"homepage": "https://github.com/KernAIO/module-quire#readme",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@kernhq/contracts": "^0.7.0",
|
|
56
|
-
"@kernhq/kernel": "^0.
|
|
57
|
-
"@kernhq/ui": "^0.
|
|
56
|
+
"@kernhq/kernel": "^0.8.0",
|
|
57
|
+
"@kernhq/ui": "^0.13.0",
|
|
58
58
|
"@tanstack/svelte-query": "^6.1.0",
|
|
59
59
|
"svelte": "^5.46.0"
|
|
60
60
|
},
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"@biomejs/biome": "^2.0.0",
|
|
74
74
|
"@changesets/cli": "^2.27.0",
|
|
75
75
|
"@kernhq/contracts": "^0.7.0",
|
|
76
|
-
"@kernhq/kernel": "^0.
|
|
76
|
+
"@kernhq/kernel": "^0.8.0",
|
|
77
77
|
"@kernhq/tsconfig": "^0.1.0",
|
|
78
|
-
"@kernhq/ui": "^0.
|
|
78
|
+
"@kernhq/ui": "^0.13.0",
|
|
79
79
|
"@tanstack/svelte-query": "^6.1.0",
|
|
80
80
|
"@types/node": "^24.0.0",
|
|
81
81
|
"@types/pg": "^8.15.0",
|