@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.
Files changed (123) hide show
  1. package/dist/contract/models.d.ts +394 -0
  2. package/dist/contract/models.d.ts.map +1 -1
  3. package/dist/contract/models.js +284 -0
  4. package/dist/contract/models.js.map +1 -1
  5. package/dist/contract/permissions.d.ts +14 -0
  6. package/dist/contract/permissions.d.ts.map +1 -1
  7. package/dist/contract/permissions.js +114 -0
  8. package/dist/contract/permissions.js.map +1 -1
  9. package/dist/contract/properties.d.ts +7 -7
  10. package/dist/contract/router.d.ts +1124 -96
  11. package/dist/contract/router.d.ts.map +1 -1
  12. package/dist/contract/router.js +343 -1
  13. package/dist/contract/router.js.map +1 -1
  14. package/dist/server/_impl.d.ts +983 -1168
  15. package/dist/server/_impl.d.ts.map +1 -1
  16. package/dist/server/_impl.js +308 -0
  17. package/dist/server/_impl.js.map +1 -1
  18. package/dist/server/export/html.d.ts +67 -0
  19. package/dist/server/export/html.d.ts.map +1 -0
  20. package/dist/server/export/html.js +206 -0
  21. package/dist/server/export/html.js.map +1 -0
  22. package/dist/server/export/markdown.d.ts +51 -0
  23. package/dist/server/export/markdown.d.ts.map +1 -0
  24. package/dist/server/export/markdown.js +351 -0
  25. package/dist/server/export/markdown.js.map +1 -0
  26. package/dist/server/export/pdf.d.ts +20 -0
  27. package/dist/server/export/pdf.d.ts.map +1 -0
  28. package/dist/server/export/pdf.js +91 -0
  29. package/dist/server/export/pdf.js.map +1 -0
  30. package/dist/server/export/zip.d.ts +31 -0
  31. package/dist/server/export/zip.d.ts.map +1 -0
  32. package/dist/server/export/zip.js +158 -0
  33. package/dist/server/export/zip.js.map +1 -0
  34. package/dist/server/import/csv.d.ts +77 -0
  35. package/dist/server/import/csv.d.ts.map +1 -0
  36. package/dist/server/import/csv.js +263 -0
  37. package/dist/server/import/csv.js.map +1 -0
  38. package/dist/server/import/html.d.ts +52 -0
  39. package/dist/server/import/html.d.ts.map +1 -0
  40. package/dist/server/import/html.js +472 -0
  41. package/dist/server/import/html.js.map +1 -0
  42. package/dist/server/import/markdown.d.ts +63 -0
  43. package/dist/server/import/markdown.d.ts.map +1 -0
  44. package/dist/server/import/markdown.js +692 -0
  45. package/dist/server/import/markdown.js.map +1 -0
  46. package/dist/server/import/plan.d.ts +70 -0
  47. package/dist/server/import/plan.d.ts.map +1 -0
  48. package/dist/server/import/plan.js +761 -0
  49. package/dist/server/import/plan.js.map +1 -0
  50. package/dist/server/import/ydoc.d.ts +35 -0
  51. package/dist/server/import/ydoc.d.ts.map +1 -0
  52. package/dist/server/import/ydoc.js +91 -0
  53. package/dist/server/import/ydoc.js.map +1 -0
  54. package/dist/server/import/zip.d.ts +63 -0
  55. package/dist/server/import/zip.d.ts.map +1 -0
  56. package/dist/server/import/zip.js +308 -0
  57. package/dist/server/import/zip.js.map +1 -0
  58. package/dist/server/index.d.ts.map +1 -1
  59. package/dist/server/index.js +3 -1
  60. package/dist/server/index.js.map +1 -1
  61. package/dist/server/render.d.ts +158 -0
  62. package/dist/server/render.d.ts.map +1 -1
  63. package/dist/server/render.js +240 -0
  64. package/dist/server/render.js.map +1 -1
  65. package/dist/server/schema.d.ts +704 -1
  66. package/dist/server/schema.d.ts.map +1 -1
  67. package/dist/server/schema.js +254 -1
  68. package/dist/server/schema.js.map +1 -1
  69. package/dist/server/services/databases.d.ts +10 -10
  70. package/dist/server/services/export.d.ts +176 -0
  71. package/dist/server/services/export.d.ts.map +1 -0
  72. package/dist/server/services/export.js +822 -0
  73. package/dist/server/services/export.js.map +1 -0
  74. package/dist/server/services/import.d.ts +109 -0
  75. package/dist/server/services/import.d.ts.map +1 -0
  76. package/dist/server/services/import.js +570 -0
  77. package/dist/server/services/import.js.map +1 -0
  78. package/dist/server/services/index.d.ts +32 -1
  79. package/dist/server/services/index.d.ts.map +1 -1
  80. package/dist/server/services/index.js +87 -4
  81. package/dist/server/services/index.js.map +1 -1
  82. package/dist/server/services/macros.d.ts +83 -0
  83. package/dist/server/services/macros.d.ts.map +1 -0
  84. package/dist/server/services/macros.js +488 -0
  85. package/dist/server/services/macros.js.map +1 -0
  86. package/dist/server/services/publications.d.ts +2 -1
  87. package/dist/server/services/publications.d.ts.map +1 -1
  88. package/dist/server/services/publications.js +43 -4
  89. package/dist/server/services/publications.js.map +1 -1
  90. package/dist/server/services/templates.d.ts +135 -0
  91. package/dist/server/services/templates.d.ts.map +1 -0
  92. package/dist/server/services/templates.js +897 -0
  93. package/dist/server/services/templates.js.map +1 -0
  94. package/dist/server/services/versions.d.ts +13 -1
  95. package/dist/server/services/versions.d.ts.map +1 -1
  96. package/dist/server/services/versions.js +3 -1
  97. package/dist/server/services/versions.js.map +1 -1
  98. package/migrations/0010_transfers.sql +154 -0
  99. package/migrations/0011_templates.sql +157 -0
  100. package/migrations/meta/_journal.json +14 -0
  101. package/package.json +5 -5
  102. package/src/client/components/ExportDialog.svelte +685 -0
  103. package/src/client/components/ImportDialog.svelte +702 -0
  104. package/src/client/components/ImportReport.svelte +310 -0
  105. package/src/client/components/NewSpaceDialog.svelte +77 -8
  106. package/src/client/components/PageEditor.svelte +80 -0
  107. package/src/client/components/PagePicker.svelte +264 -0
  108. package/src/client/components/SaveAsTemplateDialog.svelte +502 -0
  109. package/src/client/components/SidebarSpaces.svelte +112 -1
  110. package/src/client/components/TemplatePicker.svelte +437 -0
  111. package/src/client/i18n.ts +941 -0
  112. package/src/client/index.ts +51 -0
  113. package/src/client/mock.ts +592 -0
  114. package/src/client/module.ts +36 -0
  115. package/src/client/pages/PageView.svelte +86 -0
  116. package/src/client/pages/SpacePage.svelte +20 -4
  117. package/src/client/pages/TransfersPage.svelte +570 -0
  118. package/src/client/permissions.ts +11 -0
  119. package/src/client/query.ts +40 -0
  120. package/src/client/transfers.ts +142 -0
  121. package/src/contract/models.ts +343 -0
  122. package/src/contract/permissions.ts +117 -0
  123. package/src/contract/router.ts +375 -0
@@ -148,6 +148,91 @@ export declare const PublicSitemapEntry: z.ZodObject<{
148
148
  path: z.ZodString;
149
149
  lastModified: z.ZodISODateTime;
150
150
  }, z.core.$strip>;
151
+ /**
152
+ * An export job, plus the one thing that cannot be stored on it: a link to the artefact.
153
+ *
154
+ * `downloadUrl` is minted per request and is null in every state but `done`. It is composed here
155
+ * rather than written into `export_jobs` because a signed storage URL is the object's key, so a
156
+ * stored one is both an address that leaks the workspace and file uuids and an address that stops
157
+ * working an hour later — and, worse, a fence applied once at the moment the job finished rather
158
+ * than every time somebody asks. A subtree export flattens pages of different readerships into one
159
+ * file, so the moment of the fetch is the moment that has to be checked.
160
+ */
161
+ export declare const ExportJobDetail: z.ZodObject<{
162
+ id: z.ZodUUID;
163
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
164
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
165
+ scope: z.ZodEnum<{
166
+ page: "page";
167
+ subtree: "subtree";
168
+ space: "space";
169
+ }>;
170
+ targetId: z.ZodUUID;
171
+ format: z.ZodEnum<{
172
+ markdown: "markdown";
173
+ html: "html";
174
+ docx: "docx";
175
+ pdf: "pdf";
176
+ }>;
177
+ state: z.ZodEnum<{
178
+ queued: "queued";
179
+ running: "running";
180
+ done: "done";
181
+ failed: "failed";
182
+ }>;
183
+ fileId: z.ZodNullable<z.ZodUUID>;
184
+ error: z.ZodNullable<z.ZodString>;
185
+ counts: z.ZodObject<{
186
+ total: z.ZodDefault<z.ZodNumber>;
187
+ done: z.ZodDefault<z.ZodNumber>;
188
+ skipped: z.ZodDefault<z.ZodNumber>;
189
+ failed: z.ZodDefault<z.ZodNumber>;
190
+ }, z.core.$strip>;
191
+ createdAt: z.ZodISODateTime;
192
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
193
+ downloadUrl: z.ZodNullable<z.ZodString>;
194
+ }, z.core.$strip>;
195
+ export type ExportJobDetail = z.infer<typeof ExportJobDetail>;
196
+ /**
197
+ * An import job **without its report**, which is the only shape a list can afford to carry.
198
+ *
199
+ * The report is one row per file, and a Notion export is thousands of files — so twenty jobs in a
200
+ * list is a response of megabytes to draw a table of dates and states. `get` carries the whole thing
201
+ * because that screen is somebody looking at one import and asking what happened to their files,
202
+ * which is the question the report exists to answer.
203
+ *
204
+ * Omitted rather than truncated on purpose. A report cut off at fifty rows is one that has quietly
205
+ * stopped being the complete account of the archive, and a person reading "23 skipped" beside a list
206
+ * of twelve would have no way to know which. Absent is a state a client can render; incomplete is not.
207
+ */
208
+ export declare const ImportJobSummary: z.ZodObject<{
209
+ id: z.ZodUUID;
210
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
211
+ error: z.ZodNullable<z.ZodString>;
212
+ createdAt: z.ZodISODateTime;
213
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
214
+ targetId: z.ZodUUID;
215
+ state: z.ZodEnum<{
216
+ queued: "queued";
217
+ running: "running";
218
+ done: "done";
219
+ failed: "failed";
220
+ }>;
221
+ counts: z.ZodObject<{
222
+ total: z.ZodDefault<z.ZodNumber>;
223
+ done: z.ZodDefault<z.ZodNumber>;
224
+ skipped: z.ZodDefault<z.ZodNumber>;
225
+ failed: z.ZodDefault<z.ZodNumber>;
226
+ }, z.core.$strip>;
227
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
228
+ source: z.ZodEnum<{
229
+ markdown: "markdown";
230
+ notion: "notion";
231
+ confluence: "confluence";
232
+ }>;
233
+ sourceFileId: z.ZodUUID;
234
+ }, z.core.$strip>;
235
+ export type ImportJobSummary = z.infer<typeof ImportJobSummary>;
151
236
  /**
152
237
  * One picture from a published page, **as bytes rather than as an address**.
153
238
  *
@@ -200,6 +285,80 @@ export declare const PublicBasePath: z.ZodDefault<z.ZodString>;
200
285
  * segment starting with an underscore and no published page can be shadowed by this one.
201
286
  */
202
287
  export declare const PUBLIC_ASSET_SEGMENT = "__media";
288
+ /**
289
+ * One row of the picker: a shipped starter, or a template somebody saved.
290
+ *
291
+ * The two are one list on purpose. A person choosing what to write does not care which of them came
292
+ * with Kern, so a screen that draws "Templates" and "Your templates" as separate sections is asking
293
+ * them to know something about our packaging — and it makes the override rule invisible, because a
294
+ * starter a workspace has edited would appear in the second list while its shipped twin sat in the
295
+ * first.
296
+ *
297
+ * **`id` is null for a shipped starter, and that is the whole shape of the compromise.** A starter is
298
+ * a constant in the module rather than a row in the customer's database — `migrations/0011` argues
299
+ * why at length — so there is no row for it to have an id, and `key` is what addresses it instead.
300
+ * `instantiate` therefore takes one of the two and refuses both.
301
+ *
302
+ * `name` and `description` arrive **already in the reader's language**. A starter's strings are a
303
+ * table in the module resolved against `principal.locale`, so a client renders whatever it is given
304
+ * and never has to know which entries are ours.
305
+ */
306
+ export declare const TemplateChoice: z.ZodObject<{
307
+ id: z.ZodNullable<z.ZodUUID>;
308
+ key: z.ZodNullable<z.ZodString>;
309
+ builtIn: z.ZodBoolean;
310
+ kind: z.ZodEnum<{
311
+ page: "page";
312
+ space: "space";
313
+ }>;
314
+ spaceId: z.ZodNullable<z.ZodUUID>;
315
+ name: z.ZodString;
316
+ description: z.ZodString;
317
+ icon: z.ZodNullable<z.ZodString>;
318
+ variables: z.ZodArray<z.ZodObject<{
319
+ name: z.ZodString;
320
+ label: z.ZodString;
321
+ type: z.ZodEnum<{
322
+ number: "number";
323
+ date: "date";
324
+ text: "text";
325
+ select: "select";
326
+ user: "user";
327
+ }>;
328
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
329
+ default: z.ZodDefault<z.ZodNullable<z.ZodString>>;
330
+ required: z.ZodDefault<z.ZodBoolean>;
331
+ }, z.core.$strip>>;
332
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
333
+ }, z.core.$strip>;
334
+ export type TemplateChoice = z.infer<typeof TemplateChoice>;
335
+ /**
336
+ * What somebody typed into the form a template asked for.
337
+ *
338
+ * Strings whatever the variable's type, because substitution is textual: a `date` variable puts
339
+ * characters into a paragraph exactly as a `text` one does, and the type only ever decided which
340
+ * control the person was shown. Storing a number here would mean the server deciding how to format
341
+ * it, in a locale it would have to guess.
342
+ *
343
+ * A key naming no declared variable is ignored rather than refused — a client one release ahead is
344
+ * a normal thing during a rolling deploy, and refusing the whole page over a spare field is not.
345
+ */
346
+ export declare const TemplateValues: z.ZodRecord<z.ZodString, z.ZodString>;
347
+ /**
348
+ * What making something from a template produced.
349
+ *
350
+ * One shape for both kinds, rather than `Page` for one and `Space` for the other. The caller's next
351
+ * move is the same either way — open what was just made — and a union output would make every
352
+ * client branch on `kind` to find out where to navigate. `pageCount` is what the screen reports:
353
+ * a space template that made eleven pages should say so, because that is a lot of pages to have
354
+ * appeared in a sidebar without warning.
355
+ */
356
+ export declare const TemplateResult: z.ZodObject<{
357
+ spaceId: z.ZodUUID;
358
+ pageId: z.ZodNullable<z.ZodUUID>;
359
+ pageCount: z.ZodNumber;
360
+ }, z.core.$strip>;
361
+ export type TemplateResult = z.infer<typeof TemplateResult>;
203
362
  export declare const quireContract: {
204
363
  readonly spaces: {
205
364
  readonly list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
@@ -1443,9 +1602,9 @@ export declare const quireContract: {
1443
1602
  type: z.ZodEnum<{
1444
1603
  number: "number";
1445
1604
  date: "date";
1446
- email: "email";
1447
1605
  text: "text";
1448
1606
  select: "select";
1607
+ email: "email";
1449
1608
  multi_select: "multi_select";
1450
1609
  status: "status";
1451
1610
  person: "person";
@@ -1467,9 +1626,9 @@ export declare const quireContract: {
1467
1626
  label: z.ZodString;
1468
1627
  colour: z.ZodDefault<z.ZodString>;
1469
1628
  group: z.ZodOptional<z.ZodEnum<{
1629
+ done: "done";
1470
1630
  todo: "todo";
1471
1631
  doing: "doing";
1472
- done: "done";
1473
1632
  }>>;
1474
1633
  }, z.core.$strip>>>;
1475
1634
  format: z.ZodOptional<z.ZodString>;
@@ -1610,9 +1769,9 @@ export declare const quireContract: {
1610
1769
  type: z.ZodEnum<{
1611
1770
  number: "number";
1612
1771
  date: "date";
1613
- email: "email";
1614
1772
  text: "text";
1615
1773
  select: "select";
1774
+ email: "email";
1616
1775
  multi_select: "multi_select";
1617
1776
  status: "status";
1618
1777
  person: "person";
@@ -1634,9 +1793,9 @@ export declare const quireContract: {
1634
1793
  label: z.ZodString;
1635
1794
  colour: z.ZodDefault<z.ZodString>;
1636
1795
  group: z.ZodOptional<z.ZodEnum<{
1796
+ done: "done";
1637
1797
  todo: "todo";
1638
1798
  doing: "doing";
1639
- done: "done";
1640
1799
  }>>;
1641
1800
  }, z.core.$strip>>>;
1642
1801
  format: z.ZodOptional<z.ZodString>;
@@ -1843,9 +2002,9 @@ export declare const quireContract: {
1843
2002
  type: z.ZodEnum<{
1844
2003
  number: "number";
1845
2004
  date: "date";
1846
- email: "email";
1847
2005
  text: "text";
1848
2006
  select: "select";
2007
+ email: "email";
1849
2008
  multi_select: "multi_select";
1850
2009
  status: "status";
1851
2010
  person: "person";
@@ -1867,9 +2026,9 @@ export declare const quireContract: {
1867
2026
  label: z.ZodString;
1868
2027
  colour: z.ZodDefault<z.ZodString>;
1869
2028
  group: z.ZodOptional<z.ZodEnum<{
2029
+ done: "done";
1870
2030
  todo: "todo";
1871
2031
  doing: "doing";
1872
- done: "done";
1873
2032
  }>>;
1874
2033
  }, z.core.$strip>>>;
1875
2034
  format: z.ZodOptional<z.ZodString>;
@@ -2113,9 +2272,9 @@ export declare const quireContract: {
2113
2272
  type: z.ZodEnum<{
2114
2273
  number: "number";
2115
2274
  date: "date";
2116
- email: "email";
2117
2275
  text: "text";
2118
2276
  select: "select";
2277
+ email: "email";
2119
2278
  multi_select: "multi_select";
2120
2279
  status: "status";
2121
2280
  person: "person";
@@ -2137,9 +2296,9 @@ export declare const quireContract: {
2137
2296
  label: z.ZodString;
2138
2297
  colour: z.ZodDefault<z.ZodString>;
2139
2298
  group: z.ZodOptional<z.ZodEnum<{
2299
+ done: "done";
2140
2300
  todo: "todo";
2141
2301
  doing: "doing";
2142
- done: "done";
2143
2302
  }>>;
2144
2303
  }, z.core.$strip>>>;
2145
2304
  format: z.ZodOptional<z.ZodString>;
@@ -2175,9 +2334,9 @@ export declare const quireContract: {
2175
2334
  type: z.ZodEnum<{
2176
2335
  number: "number";
2177
2336
  date: "date";
2178
- email: "email";
2179
2337
  text: "text";
2180
2338
  select: "select";
2339
+ email: "email";
2181
2340
  multi_select: "multi_select";
2182
2341
  status: "status";
2183
2342
  person: "person";
@@ -2199,9 +2358,9 @@ export declare const quireContract: {
2199
2358
  label: z.ZodString;
2200
2359
  colour: z.ZodDefault<z.ZodString>;
2201
2360
  group: z.ZodOptional<z.ZodEnum<{
2361
+ done: "done";
2202
2362
  todo: "todo";
2203
2363
  doing: "doing";
2204
- done: "done";
2205
2364
  }>>;
2206
2365
  }, z.core.$strip>>>;
2207
2366
  format: z.ZodOptional<z.ZodString>;
@@ -2261,9 +2420,9 @@ export declare const quireContract: {
2261
2420
  type: z.ZodOptional<z.ZodEnum<{
2262
2421
  number: "number";
2263
2422
  date: "date";
2264
- email: "email";
2265
2423
  text: "text";
2266
2424
  select: "select";
2425
+ email: "email";
2267
2426
  multi_select: "multi_select";
2268
2427
  status: "status";
2269
2428
  person: "person";
@@ -2285,9 +2444,9 @@ export declare const quireContract: {
2285
2444
  label: z.ZodString;
2286
2445
  colour: z.ZodDefault<z.ZodString>;
2287
2446
  group: z.ZodOptional<z.ZodEnum<{
2447
+ done: "done";
2288
2448
  todo: "todo";
2289
2449
  doing: "doing";
2290
- done: "done";
2291
2450
  }>>;
2292
2451
  }, z.core.$strip>>>;
2293
2452
  format: z.ZodOptional<z.ZodString>;
@@ -2324,9 +2483,9 @@ export declare const quireContract: {
2324
2483
  type: z.ZodEnum<{
2325
2484
  number: "number";
2326
2485
  date: "date";
2327
- email: "email";
2328
2486
  text: "text";
2329
2487
  select: "select";
2488
+ email: "email";
2330
2489
  multi_select: "multi_select";
2331
2490
  status: "status";
2332
2491
  person: "person";
@@ -2348,9 +2507,9 @@ export declare const quireContract: {
2348
2507
  label: z.ZodString;
2349
2508
  colour: z.ZodDefault<z.ZodString>;
2350
2509
  group: z.ZodOptional<z.ZodEnum<{
2510
+ done: "done";
2351
2511
  todo: "todo";
2352
2512
  doing: "doing";
2353
- done: "done";
2354
2513
  }>>;
2355
2514
  }, z.core.$strip>>>;
2356
2515
  format: z.ZodOptional<z.ZodString>;
@@ -2421,9 +2580,9 @@ export declare const quireContract: {
2421
2580
  type: z.ZodEnum<{
2422
2581
  number: "number";
2423
2582
  date: "date";
2424
- email: "email";
2425
2583
  text: "text";
2426
2584
  select: "select";
2585
+ email: "email";
2427
2586
  multi_select: "multi_select";
2428
2587
  status: "status";
2429
2588
  person: "person";
@@ -2445,9 +2604,9 @@ export declare const quireContract: {
2445
2604
  label: z.ZodString;
2446
2605
  colour: z.ZodDefault<z.ZodString>;
2447
2606
  group: z.ZodOptional<z.ZodEnum<{
2607
+ done: "done";
2448
2608
  todo: "todo";
2449
2609
  doing: "doing";
2450
- done: "done";
2451
2610
  }>>;
2452
2611
  }, z.core.$strip>>>;
2453
2612
  format: z.ZodOptional<z.ZodString>;
@@ -3400,35 +3559,73 @@ export declare const quireContract: {
3400
3559
  };
3401
3560
  }>, Record<never, never>>;
3402
3561
  };
3403
- readonly publishing: {
3404
- /** Make what is written now the version readers are served. Only meaningful for a `page`. */
3405
- readonly publish: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3406
- workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3407
- pageId: z.ZodUUID;
3408
- label: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3409
- }, z.core.$strip>, z.ZodObject<{
3410
- id: z.ZodUUID;
3562
+ /**
3563
+ * What somebody writes with: a page, or a whole space, saved so it can be made again.
3564
+ *
3565
+ * **The five starters Kern ships are constants in this module, not rows in a customer's
3566
+ * database.** `migrations/0011_templates.sql` argues that at length; the consequences visible from
3567
+ * here are three. `list` answers starters and rows in one list, with a row carrying a starter's
3568
+ * `key` standing *in place of* that starter rather than beside it. A starter has no id, so
3569
+ * `instantiate` takes `templateId` **or** `starterKey` and refuses both. And `get`, `update` and
3570
+ * `remove` take an id, which means they are about rows only — a starter has nothing to fetch or
3571
+ * delete, and "reset this one" is deleting the row that replaced it.
3572
+ *
3573
+ * Reading is `quire.space.view` and writing is `quire.space.manage`, exactly as `labels.*` next
3574
+ * door, and for the same reason: a template is part of a space's furniture rather than one page's
3575
+ * content. Changing it changes what everybody in the space is offered when they make a page, which
3576
+ * is not a thing somebody who may edit one page should be able to do to everybody else's.
3577
+ *
3578
+ * `instantiate` is the exception and asks `quire.page.create`, because what it does is make a
3579
+ * page. Somebody who may write in a space may use its templates; only somebody who configures the
3580
+ * space may change them.
3581
+ */
3582
+ readonly templates: {
3583
+ /**
3584
+ * What may be made here: the starters, plus this workspace's own, with overrides applied.
3585
+ *
3586
+ * `spaceId` is the space being written into, and null asks the workspace-wide question — which
3587
+ * is what the "New space" picker needs, because there is no space yet. With a space named, the
3588
+ * answer is that space's templates *and* the workspace-wide ones: a template scoped to a space
3589
+ * is an addition to what is offered there, never a replacement for what is offered everywhere.
3590
+ *
3591
+ * No body comes back. Thirty page documents to draw thirty names is thirty documents nobody
3592
+ * reads — see `TemplateSummary`. `instantiate` is what reads one.
3593
+ */
3594
+ readonly list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3411
3595
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3412
- spaceId: z.ZodUUID;
3413
- parentId: z.ZodNullable<z.ZodUUID>;
3414
- position: z.ZodString;
3596
+ kind: z.ZodDefault<z.ZodEnum<{
3597
+ page: "page";
3598
+ space: "space";
3599
+ }>>;
3600
+ spaceId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
3601
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
3602
+ id: z.ZodNullable<z.ZodUUID>;
3603
+ key: z.ZodNullable<z.ZodString>;
3604
+ builtIn: z.ZodBoolean;
3415
3605
  kind: z.ZodEnum<{
3416
3606
  page: "page";
3417
- live: "live";
3418
- database: "database";
3607
+ space: "space";
3419
3608
  }>;
3420
- title: z.ZodString;
3609
+ spaceId: z.ZodNullable<z.ZodUUID>;
3610
+ name: z.ZodString;
3611
+ description: z.ZodString;
3421
3612
  icon: z.ZodNullable<z.ZodString>;
3422
- coverUrl: z.ZodNullable<z.ZodString>;
3423
- publishedVersionId: z.ZodNullable<z.ZodUUID>;
3424
- hasUnpublishedChanges: z.ZodBoolean;
3425
- createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
3426
- updatedBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
3427
- createdAt: z.ZodISODateTime;
3428
- updatedAt: z.ZodISODateTime;
3429
- archivedAt: z.ZodNullable<z.ZodISODateTime>;
3430
- deletedAt: z.ZodNullable<z.ZodISODateTime>;
3431
- }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
3613
+ variables: z.ZodArray<z.ZodObject<{
3614
+ name: z.ZodString;
3615
+ label: z.ZodString;
3616
+ type: z.ZodEnum<{
3617
+ number: "number";
3618
+ date: "date";
3619
+ text: "text";
3620
+ select: "select";
3621
+ user: "user";
3622
+ }>;
3623
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
3624
+ default: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3625
+ required: z.ZodDefault<z.ZodBoolean>;
3626
+ }, z.core.$strip>>;
3627
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
3628
+ }, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
3432
3629
  BAD_REQUEST: {
3433
3630
  data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
3434
3631
  };
@@ -3451,32 +3648,46 @@ export declare const quireContract: {
3451
3648
  }, z.core.$strip>;
3452
3649
  };
3453
3650
  }>, Record<never, never>>;
3454
- /** Throw the draft away and go back to what readers can already see. */
3455
- readonly revert: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3651
+ /**
3652
+ * One saved template, body and all — what the edit screen loads.
3653
+ *
3654
+ * Rows only. A starter has no row, and inventing an id for it would make every other procedure
3655
+ * here have to tell the two kinds of id apart.
3656
+ */
3657
+ readonly get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3456
3658
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3457
- pageId: z.ZodUUID;
3659
+ templateId: z.ZodUUID;
3458
3660
  }, z.core.$strip>, z.ZodObject<{
3459
3661
  id: z.ZodUUID;
3460
3662
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3461
- spaceId: z.ZodUUID;
3462
- parentId: z.ZodNullable<z.ZodUUID>;
3463
- position: z.ZodString;
3663
+ spaceId: z.ZodNullable<z.ZodUUID>;
3464
3664
  kind: z.ZodEnum<{
3465
3665
  page: "page";
3466
- live: "live";
3467
- database: "database";
3666
+ space: "space";
3468
3667
  }>;
3469
- title: z.ZodString;
3668
+ key: z.ZodNullable<z.ZodString>;
3669
+ builtIn: z.ZodBoolean;
3670
+ name: z.ZodString;
3671
+ description: z.ZodString;
3470
3672
  icon: z.ZodNullable<z.ZodString>;
3471
- coverUrl: z.ZodNullable<z.ZodString>;
3472
- publishedVersionId: z.ZodNullable<z.ZodUUID>;
3473
- hasUnpublishedChanges: z.ZodBoolean;
3673
+ doc: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3674
+ variables: z.ZodArray<z.ZodObject<{
3675
+ name: z.ZodString;
3676
+ label: z.ZodString;
3677
+ type: z.ZodEnum<{
3678
+ number: "number";
3679
+ date: "date";
3680
+ text: "text";
3681
+ select: "select";
3682
+ user: "user";
3683
+ }>;
3684
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
3685
+ default: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3686
+ required: z.ZodDefault<z.ZodBoolean>;
3687
+ }, z.core.$strip>>;
3474
3688
  createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
3475
- updatedBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
3476
3689
  createdAt: z.ZodISODateTime;
3477
3690
  updatedAt: z.ZodISODateTime;
3478
- archivedAt: z.ZodNullable<z.ZodISODateTime>;
3479
- deletedAt: z.ZodNullable<z.ZodISODateTime>;
3480
3691
  }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
3481
3692
  BAD_REQUEST: {
3482
3693
  data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -3500,37 +3711,82 @@ export declare const quireContract: {
3500
3711
  }, z.core.$strip>;
3501
3712
  };
3502
3713
  }>, Record<never, never>>;
3503
- };
3504
- /**
3505
- * Who has published what, from the inside. Every procedure here is authenticated and asks
3506
- * `quire.page.publish` about the **root page**, because that is the page whose subtree is being
3507
- * handed to the internet.
3508
- */
3509
- readonly publications: {
3510
- readonly list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3714
+ /**
3715
+ * Save what is written now as a template.
3716
+ *
3717
+ * `sourceId` names the page for `kind: 'page'` and the **space** for `kind: 'space'`, the same
3718
+ * shape as `exports.start`'s `targetId` and for the same reason: the two kinds have nothing in
3719
+ * common to point at, and two nullable id fields would let a caller send both. The procedure is
3720
+ * named for the common case; a space template reads the space's whole tree.
3721
+ *
3722
+ * `key` is what makes a starter editable at all. Passing one writes a row that **replaces** that
3723
+ * starter in this workspace's picker; deleting the row brings the shipped one back, current and
3724
+ * translated. One row per starter per workspace — the second is a conflict, not a second entry.
3725
+ */
3726
+ readonly createFromPage: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3511
3727
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3512
- spaceId: z.ZodUUID;
3513
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
3728
+ kind: z.ZodDefault<z.ZodEnum<{
3729
+ page: "page";
3730
+ space: "space";
3731
+ }>>;
3732
+ sourceId: z.ZodUUID;
3733
+ spaceId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
3734
+ name: z.ZodString;
3735
+ description: z.ZodDefault<z.ZodString>;
3736
+ icon: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3737
+ variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
3738
+ name: z.ZodString;
3739
+ label: z.ZodString;
3740
+ type: z.ZodEnum<{
3741
+ number: "number";
3742
+ date: "date";
3743
+ text: "text";
3744
+ select: "select";
3745
+ user: "user";
3746
+ }>;
3747
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
3748
+ default: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3749
+ required: z.ZodDefault<z.ZodBoolean>;
3750
+ }, z.core.$strip>>>;
3751
+ key: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
3752
+ "meeting-notes": "meeting-notes";
3753
+ "decision-record": "decision-record";
3754
+ requirements: "requirements";
3755
+ retrospective: "retrospective";
3756
+ "how-to": "how-to";
3757
+ }>>>;
3758
+ }, z.core.$strip>, z.ZodObject<{
3514
3759
  id: z.ZodUUID;
3515
3760
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3516
- rootPageId: z.ZodUUID;
3517
- includeDescendants: z.ZodBoolean;
3518
- slug: z.ZodString;
3519
- hasPassword: z.ZodBoolean;
3520
- expiresAt: z.ZodNullable<z.ZodISODateTime>;
3521
- seoTitle: z.ZodString;
3522
- seoDescription: z.ZodString;
3523
- ogImageUrl: z.ZodNullable<z.ZodString>;
3524
- indexable: z.ZodBoolean;
3525
- theme: z.ZodEnum<{
3526
- auto: "auto";
3527
- light: "light";
3528
- dark: "dark";
3761
+ spaceId: z.ZodNullable<z.ZodUUID>;
3762
+ kind: z.ZodEnum<{
3763
+ page: "page";
3764
+ space: "space";
3529
3765
  }>;
3766
+ key: z.ZodNullable<z.ZodString>;
3767
+ builtIn: z.ZodBoolean;
3768
+ name: z.ZodString;
3769
+ description: z.ZodString;
3770
+ icon: z.ZodNullable<z.ZodString>;
3771
+ doc: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3772
+ variables: z.ZodArray<z.ZodObject<{
3773
+ name: z.ZodString;
3774
+ label: z.ZodString;
3775
+ type: z.ZodEnum<{
3776
+ number: "number";
3777
+ date: "date";
3778
+ text: "text";
3779
+ select: "select";
3780
+ user: "user";
3781
+ }>;
3782
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
3783
+ default: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3784
+ required: z.ZodDefault<z.ZodBoolean>;
3785
+ }, z.core.$strip>>;
3530
3786
  createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
3531
3787
  createdAt: z.ZodISODateTime;
3532
3788
  updatedAt: z.ZodISODateTime;
3533
- }, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
3789
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
3534
3790
  BAD_REQUEST: {
3535
3791
  data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
3536
3792
  };
@@ -3553,26 +3809,64 @@ export declare const quireContract: {
3553
3809
  }, z.core.$strip>;
3554
3810
  };
3555
3811
  }>, Record<never, never>>;
3556
- readonly get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3812
+ /**
3813
+ * Rename it, re-scope it, change what it asks for — or replace its body with a page's.
3814
+ *
3815
+ * `sourceId` is three-valued like `publications.update`'s password: a page (or space) id takes
3816
+ * the body from there again, and leaving the key out changes nothing. Without that, updating a
3817
+ * template's name would be a separate act from updating its prose, and the second one would have
3818
+ * no procedure at all.
3819
+ */
3820
+ readonly update: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3557
3821
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3558
- publicationId: z.ZodUUID;
3822
+ templateId: z.ZodUUID;
3823
+ name: z.ZodOptional<z.ZodString>;
3824
+ description: z.ZodOptional<z.ZodString>;
3825
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3826
+ spaceId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
3827
+ variables: z.ZodOptional<z.ZodArray<z.ZodObject<{
3828
+ name: z.ZodString;
3829
+ label: z.ZodString;
3830
+ type: z.ZodEnum<{
3831
+ number: "number";
3832
+ date: "date";
3833
+ text: "text";
3834
+ select: "select";
3835
+ user: "user";
3836
+ }>;
3837
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
3838
+ default: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3839
+ required: z.ZodDefault<z.ZodBoolean>;
3840
+ }, z.core.$strip>>>;
3841
+ sourceId: z.ZodOptional<z.ZodUUID>;
3559
3842
  }, z.core.$strip>, z.ZodObject<{
3560
3843
  id: z.ZodUUID;
3561
3844
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3562
- rootPageId: z.ZodUUID;
3563
- includeDescendants: z.ZodBoolean;
3564
- slug: z.ZodString;
3565
- hasPassword: z.ZodBoolean;
3566
- expiresAt: z.ZodNullable<z.ZodISODateTime>;
3567
- seoTitle: z.ZodString;
3568
- seoDescription: z.ZodString;
3569
- ogImageUrl: z.ZodNullable<z.ZodString>;
3570
- indexable: z.ZodBoolean;
3571
- theme: z.ZodEnum<{
3572
- auto: "auto";
3573
- light: "light";
3574
- dark: "dark";
3845
+ spaceId: z.ZodNullable<z.ZodUUID>;
3846
+ kind: z.ZodEnum<{
3847
+ page: "page";
3848
+ space: "space";
3575
3849
  }>;
3850
+ key: z.ZodNullable<z.ZodString>;
3851
+ builtIn: z.ZodBoolean;
3852
+ name: z.ZodString;
3853
+ description: z.ZodString;
3854
+ icon: z.ZodNullable<z.ZodString>;
3855
+ doc: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3856
+ variables: z.ZodArray<z.ZodObject<{
3857
+ name: z.ZodString;
3858
+ label: z.ZodString;
3859
+ type: z.ZodEnum<{
3860
+ number: "number";
3861
+ date: "date";
3862
+ text: "text";
3863
+ select: "select";
3864
+ user: "user";
3865
+ }>;
3866
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
3867
+ default: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3868
+ required: z.ZodDefault<z.ZodBoolean>;
3869
+ }, z.core.$strip>>;
3576
3870
  createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
3577
3871
  createdAt: z.ZodISODateTime;
3578
3872
  updatedAt: z.ZodISODateTime;
@@ -3599,9 +3893,301 @@ export declare const quireContract: {
3599
3893
  }, z.core.$strip>;
3600
3894
  };
3601
3895
  }>, Record<never, never>>;
3602
- readonly create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3896
+ /**
3897
+ * Delete it. For a row that replaced a starter this is "reset": the shipped one comes back.
3898
+ *
3899
+ * Nothing made from a template is touched — a page is a page once it exists, and a template that
3900
+ * took its pages with it would be a delete nobody could afford to press.
3901
+ */
3902
+ readonly remove: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3603
3903
  workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3604
- rootPageId: z.ZodUUID;
3904
+ templateId: z.ZodUUID;
3905
+ }, z.core.$strip>, z.ZodObject<{
3906
+ ok: z.ZodLiteral<true>;
3907
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
3908
+ BAD_REQUEST: {
3909
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
3910
+ };
3911
+ UNAUTHORIZED: {};
3912
+ FORBIDDEN: {
3913
+ data: z.ZodOptional<z.ZodObject<{
3914
+ permission: z.ZodOptional<z.ZodString>;
3915
+ }, z.core.$strip>>;
3916
+ };
3917
+ NOT_FOUND: {};
3918
+ CONFLICT: {
3919
+ data: z.ZodOptional<z.ZodObject<{
3920
+ reason: z.ZodOptional<z.ZodString>;
3921
+ }, z.core.$strip>>;
3922
+ };
3923
+ RATE_LIMITED: {};
3924
+ MODULE_DISABLED: {
3925
+ data: z.ZodObject<{
3926
+ module: z.ZodString;
3927
+ }, z.core.$strip>;
3928
+ };
3929
+ }>, Record<never, never>>;
3930
+ /**
3931
+ * Make the thing: a page, or a whole space and its tree.
3932
+ *
3933
+ * Exactly one of `templateId` and `starterKey` — a starter is a constant with no id, and a
3934
+ * union input would be a shape oRPC has to route. Both, or neither, is a bad request.
3935
+ *
3936
+ * `values` fills what the template declared. `{{date}}`, `{{time}}`, `{{author}}` and
3937
+ * `{{space}}` are filled by the server from the request and are declared by nobody; a name the
3938
+ * template never declared is left in the page as it was written, because deleting text somebody
3939
+ * typed is worse than showing them a placeholder they can see and fix.
3940
+ *
3941
+ * Substitution happens **in text, never in JSON**. A value containing a quote, a brace or a
3942
+ * newline is characters in a paragraph and cannot be anything else — see `services/templates.ts`.
3943
+ */
3944
+ readonly instantiate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3945
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3946
+ templateId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
3947
+ starterKey: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
3948
+ "meeting-notes": "meeting-notes";
3949
+ "decision-record": "decision-record";
3950
+ requirements: "requirements";
3951
+ retrospective: "retrospective";
3952
+ "how-to": "how-to";
3953
+ }>>>;
3954
+ spaceId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
3955
+ parentId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
3956
+ afterId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
3957
+ title: z.ZodDefault<z.ZodString>;
3958
+ key: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3959
+ name: z.ZodDefault<z.ZodString>;
3960
+ values: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
3961
+ }, z.core.$strip>, z.ZodObject<{
3962
+ spaceId: z.ZodUUID;
3963
+ pageId: z.ZodNullable<z.ZodUUID>;
3964
+ pageCount: z.ZodNumber;
3965
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
3966
+ BAD_REQUEST: {
3967
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
3968
+ };
3969
+ UNAUTHORIZED: {};
3970
+ FORBIDDEN: {
3971
+ data: z.ZodOptional<z.ZodObject<{
3972
+ permission: z.ZodOptional<z.ZodString>;
3973
+ }, z.core.$strip>>;
3974
+ };
3975
+ NOT_FOUND: {};
3976
+ CONFLICT: {
3977
+ data: z.ZodOptional<z.ZodObject<{
3978
+ reason: z.ZodOptional<z.ZodString>;
3979
+ }, z.core.$strip>>;
3980
+ };
3981
+ RATE_LIMITED: {};
3982
+ MODULE_DISABLED: {
3983
+ data: z.ZodObject<{
3984
+ module: z.ZodString;
3985
+ }, z.core.$strip>;
3986
+ };
3987
+ }>, Record<never, never>>;
3988
+ };
3989
+ readonly publishing: {
3990
+ /** Make what is written now the version readers are served. Only meaningful for a `page`. */
3991
+ readonly publish: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
3992
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3993
+ pageId: z.ZodUUID;
3994
+ label: z.ZodDefault<z.ZodNullable<z.ZodString>>;
3995
+ }, z.core.$strip>, z.ZodObject<{
3996
+ id: z.ZodUUID;
3997
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
3998
+ spaceId: z.ZodUUID;
3999
+ parentId: z.ZodNullable<z.ZodUUID>;
4000
+ position: z.ZodString;
4001
+ kind: z.ZodEnum<{
4002
+ page: "page";
4003
+ live: "live";
4004
+ database: "database";
4005
+ }>;
4006
+ title: z.ZodString;
4007
+ icon: z.ZodNullable<z.ZodString>;
4008
+ coverUrl: z.ZodNullable<z.ZodString>;
4009
+ publishedVersionId: z.ZodNullable<z.ZodUUID>;
4010
+ hasUnpublishedChanges: z.ZodBoolean;
4011
+ createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
4012
+ updatedBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
4013
+ createdAt: z.ZodISODateTime;
4014
+ updatedAt: z.ZodISODateTime;
4015
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
4016
+ deletedAt: z.ZodNullable<z.ZodISODateTime>;
4017
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4018
+ BAD_REQUEST: {
4019
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4020
+ };
4021
+ UNAUTHORIZED: {};
4022
+ FORBIDDEN: {
4023
+ data: z.ZodOptional<z.ZodObject<{
4024
+ permission: z.ZodOptional<z.ZodString>;
4025
+ }, z.core.$strip>>;
4026
+ };
4027
+ NOT_FOUND: {};
4028
+ CONFLICT: {
4029
+ data: z.ZodOptional<z.ZodObject<{
4030
+ reason: z.ZodOptional<z.ZodString>;
4031
+ }, z.core.$strip>>;
4032
+ };
4033
+ RATE_LIMITED: {};
4034
+ MODULE_DISABLED: {
4035
+ data: z.ZodObject<{
4036
+ module: z.ZodString;
4037
+ }, z.core.$strip>;
4038
+ };
4039
+ }>, Record<never, never>>;
4040
+ /** Throw the draft away and go back to what readers can already see. */
4041
+ readonly revert: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4042
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4043
+ pageId: z.ZodUUID;
4044
+ }, z.core.$strip>, z.ZodObject<{
4045
+ id: z.ZodUUID;
4046
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4047
+ spaceId: z.ZodUUID;
4048
+ parentId: z.ZodNullable<z.ZodUUID>;
4049
+ position: z.ZodString;
4050
+ kind: z.ZodEnum<{
4051
+ page: "page";
4052
+ live: "live";
4053
+ database: "database";
4054
+ }>;
4055
+ title: z.ZodString;
4056
+ icon: z.ZodNullable<z.ZodString>;
4057
+ coverUrl: z.ZodNullable<z.ZodString>;
4058
+ publishedVersionId: z.ZodNullable<z.ZodUUID>;
4059
+ hasUnpublishedChanges: z.ZodBoolean;
4060
+ createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
4061
+ updatedBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
4062
+ createdAt: z.ZodISODateTime;
4063
+ updatedAt: z.ZodISODateTime;
4064
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
4065
+ deletedAt: z.ZodNullable<z.ZodISODateTime>;
4066
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4067
+ BAD_REQUEST: {
4068
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4069
+ };
4070
+ UNAUTHORIZED: {};
4071
+ FORBIDDEN: {
4072
+ data: z.ZodOptional<z.ZodObject<{
4073
+ permission: z.ZodOptional<z.ZodString>;
4074
+ }, z.core.$strip>>;
4075
+ };
4076
+ NOT_FOUND: {};
4077
+ CONFLICT: {
4078
+ data: z.ZodOptional<z.ZodObject<{
4079
+ reason: z.ZodOptional<z.ZodString>;
4080
+ }, z.core.$strip>>;
4081
+ };
4082
+ RATE_LIMITED: {};
4083
+ MODULE_DISABLED: {
4084
+ data: z.ZodObject<{
4085
+ module: z.ZodString;
4086
+ }, z.core.$strip>;
4087
+ };
4088
+ }>, Record<never, never>>;
4089
+ };
4090
+ /**
4091
+ * Who has published what, from the inside. Every procedure here is authenticated and asks
4092
+ * `quire.page.publish` about the **root page**, because that is the page whose subtree is being
4093
+ * handed to the internet.
4094
+ */
4095
+ readonly publications: {
4096
+ readonly list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4097
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4098
+ spaceId: z.ZodUUID;
4099
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
4100
+ id: z.ZodUUID;
4101
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4102
+ rootPageId: z.ZodUUID;
4103
+ includeDescendants: z.ZodBoolean;
4104
+ slug: z.ZodString;
4105
+ hasPassword: z.ZodBoolean;
4106
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
4107
+ seoTitle: z.ZodString;
4108
+ seoDescription: z.ZodString;
4109
+ ogImageUrl: z.ZodNullable<z.ZodString>;
4110
+ indexable: z.ZodBoolean;
4111
+ theme: z.ZodEnum<{
4112
+ auto: "auto";
4113
+ light: "light";
4114
+ dark: "dark";
4115
+ }>;
4116
+ createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
4117
+ createdAt: z.ZodISODateTime;
4118
+ updatedAt: z.ZodISODateTime;
4119
+ }, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4120
+ BAD_REQUEST: {
4121
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4122
+ };
4123
+ UNAUTHORIZED: {};
4124
+ FORBIDDEN: {
4125
+ data: z.ZodOptional<z.ZodObject<{
4126
+ permission: z.ZodOptional<z.ZodString>;
4127
+ }, z.core.$strip>>;
4128
+ };
4129
+ NOT_FOUND: {};
4130
+ CONFLICT: {
4131
+ data: z.ZodOptional<z.ZodObject<{
4132
+ reason: z.ZodOptional<z.ZodString>;
4133
+ }, z.core.$strip>>;
4134
+ };
4135
+ RATE_LIMITED: {};
4136
+ MODULE_DISABLED: {
4137
+ data: z.ZodObject<{
4138
+ module: z.ZodString;
4139
+ }, z.core.$strip>;
4140
+ };
4141
+ }>, Record<never, never>>;
4142
+ readonly get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4143
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4144
+ publicationId: z.ZodUUID;
4145
+ }, z.core.$strip>, z.ZodObject<{
4146
+ id: z.ZodUUID;
4147
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4148
+ rootPageId: z.ZodUUID;
4149
+ includeDescendants: z.ZodBoolean;
4150
+ slug: z.ZodString;
4151
+ hasPassword: z.ZodBoolean;
4152
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
4153
+ seoTitle: z.ZodString;
4154
+ seoDescription: z.ZodString;
4155
+ ogImageUrl: z.ZodNullable<z.ZodString>;
4156
+ indexable: z.ZodBoolean;
4157
+ theme: z.ZodEnum<{
4158
+ auto: "auto";
4159
+ light: "light";
4160
+ dark: "dark";
4161
+ }>;
4162
+ createdBy: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UserId", "out">>;
4163
+ createdAt: z.ZodISODateTime;
4164
+ updatedAt: z.ZodISODateTime;
4165
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4166
+ BAD_REQUEST: {
4167
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4168
+ };
4169
+ UNAUTHORIZED: {};
4170
+ FORBIDDEN: {
4171
+ data: z.ZodOptional<z.ZodObject<{
4172
+ permission: z.ZodOptional<z.ZodString>;
4173
+ }, z.core.$strip>>;
4174
+ };
4175
+ NOT_FOUND: {};
4176
+ CONFLICT: {
4177
+ data: z.ZodOptional<z.ZodObject<{
4178
+ reason: z.ZodOptional<z.ZodString>;
4179
+ }, z.core.$strip>>;
4180
+ };
4181
+ RATE_LIMITED: {};
4182
+ MODULE_DISABLED: {
4183
+ data: z.ZodObject<{
4184
+ module: z.ZodString;
4185
+ }, z.core.$strip>;
4186
+ };
4187
+ }>, Record<never, never>>;
4188
+ readonly create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4189
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4190
+ rootPageId: z.ZodUUID;
3605
4191
  slug: z.ZodString;
3606
4192
  includeDescendants: z.ZodDefault<z.ZodBoolean>;
3607
4193
  password: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -3791,6 +4377,448 @@ export declare const quireContract: {
3791
4377
  };
3792
4378
  }>, Record<never, never>>;
3793
4379
  };
4380
+ /**
4381
+ * Taking work out: a page, a page and everything under it, or a whole space, as a file.
4382
+ *
4383
+ * Three procedures and no fourth, which is the shape worth explaining. There is no `download`:
4384
+ * `get` carries a `downloadUrl` it mints as it answers, so the permission is checked on the
4385
+ * request that fetches the file rather than baked into a link that outlives the check. And there
4386
+ * is no `cancel`: a job either finishes or fails, both terminal, and a cancel that races a worker
4387
+ * writing an artefact is a way to end up with an object nothing points at.
4388
+ *
4389
+ * **What the artefact contains is decided by the job, not by the caller.** `start` names a scope
4390
+ * and a format; every page under that scope is then checked against the requester's own
4391
+ * `quire.page.view`, and a page they may not read is left out and counted in `skipped`. So a
4392
+ * subtree export by somebody with a page-scoped DENY is a smaller file, not a refusal — and
4393
+ * `counts.skipped` is how they find out, which is the difference between an export that is quietly
4394
+ * missing pages and one that says how many.
4395
+ *
4396
+ * `format: 'docx'` is declared in `ExportFormat` and refused by `start` today: see the note in
4397
+ * `services/export.ts` for what makes a *correct* Word file more than a matter of effort, and why
4398
+ * a refusal is better than a document that may not open.
4399
+ */
4400
+ readonly exports: {
4401
+ /** Queue one. The answer is a row to watch, never the file — see the note above. */
4402
+ readonly start: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4403
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4404
+ scope: z.ZodEnum<{
4405
+ page: "page";
4406
+ subtree: "subtree";
4407
+ space: "space";
4408
+ }>;
4409
+ targetId: z.ZodUUID;
4410
+ format: z.ZodEnum<{
4411
+ markdown: "markdown";
4412
+ html: "html";
4413
+ docx: "docx";
4414
+ pdf: "pdf";
4415
+ }>;
4416
+ }, z.core.$strip>, z.ZodObject<{
4417
+ id: z.ZodUUID;
4418
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4419
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
4420
+ scope: z.ZodEnum<{
4421
+ page: "page";
4422
+ subtree: "subtree";
4423
+ space: "space";
4424
+ }>;
4425
+ targetId: z.ZodUUID;
4426
+ format: z.ZodEnum<{
4427
+ markdown: "markdown";
4428
+ html: "html";
4429
+ docx: "docx";
4430
+ pdf: "pdf";
4431
+ }>;
4432
+ state: z.ZodEnum<{
4433
+ queued: "queued";
4434
+ running: "running";
4435
+ done: "done";
4436
+ failed: "failed";
4437
+ }>;
4438
+ fileId: z.ZodNullable<z.ZodUUID>;
4439
+ error: z.ZodNullable<z.ZodString>;
4440
+ counts: z.ZodObject<{
4441
+ total: z.ZodDefault<z.ZodNumber>;
4442
+ done: z.ZodDefault<z.ZodNumber>;
4443
+ skipped: z.ZodDefault<z.ZodNumber>;
4444
+ failed: z.ZodDefault<z.ZodNumber>;
4445
+ }, z.core.$strip>;
4446
+ createdAt: z.ZodISODateTime;
4447
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
4448
+ downloadUrl: z.ZodNullable<z.ZodString>;
4449
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4450
+ BAD_REQUEST: {
4451
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4452
+ };
4453
+ UNAUTHORIZED: {};
4454
+ FORBIDDEN: {
4455
+ data: z.ZodOptional<z.ZodObject<{
4456
+ permission: z.ZodOptional<z.ZodString>;
4457
+ }, z.core.$strip>>;
4458
+ };
4459
+ NOT_FOUND: {};
4460
+ CONFLICT: {
4461
+ data: z.ZodOptional<z.ZodObject<{
4462
+ reason: z.ZodOptional<z.ZodString>;
4463
+ }, z.core.$strip>>;
4464
+ };
4465
+ RATE_LIMITED: {};
4466
+ MODULE_DISABLED: {
4467
+ data: z.ZodObject<{
4468
+ module: z.ZodString;
4469
+ }, z.core.$strip>;
4470
+ };
4471
+ }>, Record<never, never>>;
4472
+ /** Where it has got to, and — once it is `done` — a link that is good for a few minutes. */
4473
+ readonly get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4474
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4475
+ jobId: z.ZodUUID;
4476
+ }, z.core.$strip>, z.ZodObject<{
4477
+ id: z.ZodUUID;
4478
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4479
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
4480
+ scope: z.ZodEnum<{
4481
+ page: "page";
4482
+ subtree: "subtree";
4483
+ space: "space";
4484
+ }>;
4485
+ targetId: z.ZodUUID;
4486
+ format: z.ZodEnum<{
4487
+ markdown: "markdown";
4488
+ html: "html";
4489
+ docx: "docx";
4490
+ pdf: "pdf";
4491
+ }>;
4492
+ state: z.ZodEnum<{
4493
+ queued: "queued";
4494
+ running: "running";
4495
+ done: "done";
4496
+ failed: "failed";
4497
+ }>;
4498
+ fileId: z.ZodNullable<z.ZodUUID>;
4499
+ error: z.ZodNullable<z.ZodString>;
4500
+ counts: z.ZodObject<{
4501
+ total: z.ZodDefault<z.ZodNumber>;
4502
+ done: z.ZodDefault<z.ZodNumber>;
4503
+ skipped: z.ZodDefault<z.ZodNumber>;
4504
+ failed: z.ZodDefault<z.ZodNumber>;
4505
+ }, z.core.$strip>;
4506
+ createdAt: z.ZodISODateTime;
4507
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
4508
+ downloadUrl: z.ZodNullable<z.ZodString>;
4509
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4510
+ BAD_REQUEST: {
4511
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4512
+ };
4513
+ UNAUTHORIZED: {};
4514
+ FORBIDDEN: {
4515
+ data: z.ZodOptional<z.ZodObject<{
4516
+ permission: z.ZodOptional<z.ZodString>;
4517
+ }, z.core.$strip>>;
4518
+ };
4519
+ NOT_FOUND: {};
4520
+ CONFLICT: {
4521
+ data: z.ZodOptional<z.ZodObject<{
4522
+ reason: z.ZodOptional<z.ZodString>;
4523
+ }, z.core.$strip>>;
4524
+ };
4525
+ RATE_LIMITED: {};
4526
+ MODULE_DISABLED: {
4527
+ data: z.ZodObject<{
4528
+ module: z.ZodString;
4529
+ }, z.core.$strip>;
4530
+ };
4531
+ }>, Record<never, never>>;
4532
+ /**
4533
+ * This person's own exports, newest first.
4534
+ *
4535
+ * Deliberately not the workspace's. Row-level security fences the tenant, which is not a privacy
4536
+ * boundary, so the `requested_by` filter in the query is the only thing that keeps one person's
4537
+ * export of the salary handbook out of everybody else's list — the same rule `favorites.list`
4538
+ * and `recents.list` follow.
4539
+ */
4540
+ readonly list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4541
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4542
+ limit: z.ZodDefault<z.ZodNumber>;
4543
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
4544
+ id: z.ZodUUID;
4545
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4546
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
4547
+ scope: z.ZodEnum<{
4548
+ page: "page";
4549
+ subtree: "subtree";
4550
+ space: "space";
4551
+ }>;
4552
+ targetId: z.ZodUUID;
4553
+ format: z.ZodEnum<{
4554
+ markdown: "markdown";
4555
+ html: "html";
4556
+ docx: "docx";
4557
+ pdf: "pdf";
4558
+ }>;
4559
+ state: z.ZodEnum<{
4560
+ queued: "queued";
4561
+ running: "running";
4562
+ done: "done";
4563
+ failed: "failed";
4564
+ }>;
4565
+ fileId: z.ZodNullable<z.ZodUUID>;
4566
+ error: z.ZodNullable<z.ZodString>;
4567
+ counts: z.ZodObject<{
4568
+ total: z.ZodDefault<z.ZodNumber>;
4569
+ done: z.ZodDefault<z.ZodNumber>;
4570
+ skipped: z.ZodDefault<z.ZodNumber>;
4571
+ failed: z.ZodDefault<z.ZodNumber>;
4572
+ }, z.core.$strip>;
4573
+ createdAt: z.ZodISODateTime;
4574
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
4575
+ }, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4576
+ BAD_REQUEST: {
4577
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4578
+ };
4579
+ UNAUTHORIZED: {};
4580
+ FORBIDDEN: {
4581
+ data: z.ZodOptional<z.ZodObject<{
4582
+ permission: z.ZodOptional<z.ZodString>;
4583
+ }, z.core.$strip>>;
4584
+ };
4585
+ NOT_FOUND: {};
4586
+ CONFLICT: {
4587
+ data: z.ZodOptional<z.ZodObject<{
4588
+ reason: z.ZodOptional<z.ZodString>;
4589
+ }, z.core.$strip>>;
4590
+ };
4591
+ RATE_LIMITED: {};
4592
+ MODULE_DISABLED: {
4593
+ data: z.ZodObject<{
4594
+ module: z.ZodString;
4595
+ }, z.core.$strip>;
4596
+ };
4597
+ }>, Record<never, never>>;
4598
+ };
4599
+ /**
4600
+ * Getting work in: a Notion export, a Confluence export or a folder of Markdown, into one space.
4601
+ *
4602
+ * **The failure list is the feature.** A real export has files that will not map — an attachment,
4603
+ * a `.csv` with no header, a page whose link points outside what was exported — and an import that
4604
+ * silently drops forty pages is worse than one that refuses. So every file in the archive gets a
4605
+ * row in `report` saying whether it became a page, was deliberately left out, or could not be read,
4606
+ * and `counts.total` is exactly the number of rows: nothing in the archive goes unaccounted for.
4607
+ *
4608
+ * Three things follow from the archive being read whole before anything is written, and each is
4609
+ * worth knowing before reading the handlers:
4610
+ *
4611
+ * - **an import is all or nothing.** A zip that fails half way leaves the space exactly as it
4612
+ * was, because the plan is built in memory and written in one transaction;
4613
+ * - **links between imported pages are rewritten to Quire page ids**, which needs every id to
4614
+ * exist before any body is resolved — a link to a page further down the archive is the normal
4615
+ * case, not the exception. A link that resolves to nothing becomes plain text rather than a
4616
+ * dead link, and the report names the target it could not find;
4617
+ * - **a `.csv` becomes a database with typed columns**, guessed from the values and reported.
4618
+ *
4619
+ * `quire.page.import` is `dangerous`, as the tracker marks its own imports: this is the one thing
4620
+ * in the module that writes hundreds of pages into a space in one act, and it is not undone by
4621
+ * pressing something.
4622
+ */
4623
+ readonly imports: {
4624
+ /**
4625
+ * Queue one. The answer is a row to watch; nothing has been written to the space yet.
4626
+ *
4627
+ * `fileId` is an upload — a core file the browser has already put in place — and not the archive
4628
+ * itself. A zip is up to a few hundred megabytes, which is a file to be uploaded and then named,
4629
+ * never a request body.
4630
+ */
4631
+ readonly start: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4632
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4633
+ spaceId: z.ZodUUID;
4634
+ source: z.ZodEnum<{
4635
+ markdown: "markdown";
4636
+ notion: "notion";
4637
+ confluence: "confluence";
4638
+ }>;
4639
+ fileId: z.ZodUUID;
4640
+ }, z.core.$strip>, z.ZodObject<{
4641
+ id: z.ZodUUID;
4642
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4643
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
4644
+ source: z.ZodEnum<{
4645
+ markdown: "markdown";
4646
+ notion: "notion";
4647
+ confluence: "confluence";
4648
+ }>;
4649
+ targetId: z.ZodUUID;
4650
+ sourceFileId: z.ZodUUID;
4651
+ state: z.ZodEnum<{
4652
+ queued: "queued";
4653
+ running: "running";
4654
+ done: "done";
4655
+ failed: "failed";
4656
+ }>;
4657
+ error: z.ZodNullable<z.ZodString>;
4658
+ counts: z.ZodObject<{
4659
+ total: z.ZodDefault<z.ZodNumber>;
4660
+ done: z.ZodDefault<z.ZodNumber>;
4661
+ skipped: z.ZodDefault<z.ZodNumber>;
4662
+ failed: z.ZodDefault<z.ZodNumber>;
4663
+ }, z.core.$strip>;
4664
+ report: z.ZodArray<z.ZodObject<{
4665
+ path: z.ZodString;
4666
+ outcome: z.ZodEnum<{
4667
+ failed: "failed";
4668
+ skipped: "skipped";
4669
+ imported: "imported";
4670
+ }>;
4671
+ pageId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
4672
+ reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4673
+ }, z.core.$strip>>;
4674
+ createdAt: z.ZodISODateTime;
4675
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
4676
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4677
+ BAD_REQUEST: {
4678
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4679
+ };
4680
+ UNAUTHORIZED: {};
4681
+ FORBIDDEN: {
4682
+ data: z.ZodOptional<z.ZodObject<{
4683
+ permission: z.ZodOptional<z.ZodString>;
4684
+ }, z.core.$strip>>;
4685
+ };
4686
+ NOT_FOUND: {};
4687
+ CONFLICT: {
4688
+ data: z.ZodOptional<z.ZodObject<{
4689
+ reason: z.ZodOptional<z.ZodString>;
4690
+ }, z.core.$strip>>;
4691
+ };
4692
+ RATE_LIMITED: {};
4693
+ MODULE_DISABLED: {
4694
+ data: z.ZodObject<{
4695
+ module: z.ZodString;
4696
+ }, z.core.$strip>;
4697
+ };
4698
+ }>, Record<never, never>>;
4699
+ /** Where it has got to, and — once it has finished — what happened to every file in it. */
4700
+ readonly get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4701
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4702
+ jobId: z.ZodUUID;
4703
+ }, z.core.$strip>, z.ZodObject<{
4704
+ id: z.ZodUUID;
4705
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4706
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
4707
+ source: z.ZodEnum<{
4708
+ markdown: "markdown";
4709
+ notion: "notion";
4710
+ confluence: "confluence";
4711
+ }>;
4712
+ targetId: z.ZodUUID;
4713
+ sourceFileId: z.ZodUUID;
4714
+ state: z.ZodEnum<{
4715
+ queued: "queued";
4716
+ running: "running";
4717
+ done: "done";
4718
+ failed: "failed";
4719
+ }>;
4720
+ error: z.ZodNullable<z.ZodString>;
4721
+ counts: z.ZodObject<{
4722
+ total: z.ZodDefault<z.ZodNumber>;
4723
+ done: z.ZodDefault<z.ZodNumber>;
4724
+ skipped: z.ZodDefault<z.ZodNumber>;
4725
+ failed: z.ZodDefault<z.ZodNumber>;
4726
+ }, z.core.$strip>;
4727
+ report: z.ZodArray<z.ZodObject<{
4728
+ path: z.ZodString;
4729
+ outcome: z.ZodEnum<{
4730
+ failed: "failed";
4731
+ skipped: "skipped";
4732
+ imported: "imported";
4733
+ }>;
4734
+ pageId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
4735
+ reason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4736
+ }, z.core.$strip>>;
4737
+ createdAt: z.ZodISODateTime;
4738
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
4739
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4740
+ BAD_REQUEST: {
4741
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4742
+ };
4743
+ UNAUTHORIZED: {};
4744
+ FORBIDDEN: {
4745
+ data: z.ZodOptional<z.ZodObject<{
4746
+ permission: z.ZodOptional<z.ZodString>;
4747
+ }, z.core.$strip>>;
4748
+ };
4749
+ NOT_FOUND: {};
4750
+ CONFLICT: {
4751
+ data: z.ZodOptional<z.ZodObject<{
4752
+ reason: z.ZodOptional<z.ZodString>;
4753
+ }, z.core.$strip>>;
4754
+ };
4755
+ RATE_LIMITED: {};
4756
+ MODULE_DISABLED: {
4757
+ data: z.ZodObject<{
4758
+ module: z.ZodString;
4759
+ }, z.core.$strip>;
4760
+ };
4761
+ }>, Record<never, never>>;
4762
+ /**
4763
+ * This person's own imports, newest first, without their reports — see `ImportJobSummary`.
4764
+ *
4765
+ * Deliberately not the workspace's, for the same reason `exports.list` is not: row-level security
4766
+ * fences the tenant, which is not a privacy boundary, so the `requested_by` filter in the query
4767
+ * is the only thing that keeps one person's import out of everybody else's list.
4768
+ */
4769
+ readonly list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4770
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4771
+ limit: z.ZodDefault<z.ZodNumber>;
4772
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
4773
+ id: z.ZodUUID;
4774
+ workspaceId: z.core.$ZodBranded<z.ZodUUID, "WorkspaceId", "out">;
4775
+ error: z.ZodNullable<z.ZodString>;
4776
+ createdAt: z.ZodISODateTime;
4777
+ requestedBy: z.core.$ZodBranded<z.ZodUUID, "UserId", "out">;
4778
+ targetId: z.ZodUUID;
4779
+ state: z.ZodEnum<{
4780
+ queued: "queued";
4781
+ running: "running";
4782
+ done: "done";
4783
+ failed: "failed";
4784
+ }>;
4785
+ counts: z.ZodObject<{
4786
+ total: z.ZodDefault<z.ZodNumber>;
4787
+ done: z.ZodDefault<z.ZodNumber>;
4788
+ skipped: z.ZodDefault<z.ZodNumber>;
4789
+ failed: z.ZodDefault<z.ZodNumber>;
4790
+ }, z.core.$strip>;
4791
+ finishedAt: z.ZodNullable<z.ZodISODateTime>;
4792
+ source: z.ZodEnum<{
4793
+ markdown: "markdown";
4794
+ notion: "notion";
4795
+ confluence: "confluence";
4796
+ }>;
4797
+ sourceFileId: z.ZodUUID;
4798
+ }, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
4799
+ BAD_REQUEST: {
4800
+ data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4801
+ };
4802
+ UNAUTHORIZED: {};
4803
+ FORBIDDEN: {
4804
+ data: z.ZodOptional<z.ZodObject<{
4805
+ permission: z.ZodOptional<z.ZodString>;
4806
+ }, z.core.$strip>>;
4807
+ };
4808
+ NOT_FOUND: {};
4809
+ CONFLICT: {
4810
+ data: z.ZodOptional<z.ZodObject<{
4811
+ reason: z.ZodOptional<z.ZodString>;
4812
+ }, z.core.$strip>>;
4813
+ };
4814
+ RATE_LIMITED: {};
4815
+ MODULE_DISABLED: {
4816
+ data: z.ZodObject<{
4817
+ module: z.ZodString;
4818
+ }, z.core.$strip>;
4819
+ };
4820
+ }>, Record<never, never>>;
4821
+ };
3794
4822
  /**
3795
4823
  * The signed-out surface. **This is the only part of Kern with no principal behind it.**
3796
4824
  *