@karmaniverous/jeeves-server-core 0.3.0 → 0.5.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 (65) hide show
  1. package/README.md +58 -13
  2. package/dist/openapi.json.js +4038 -0
  3. package/dist/scripts/openapiInfo.d.ts +15 -0
  4. package/dist/src/catalog/browserSafe.test.d.ts +4 -0
  5. package/dist/src/catalog/contentEntries.d.ts +468 -0
  6. package/dist/src/catalog/contentEntries.js +150 -0
  7. package/dist/src/catalog/contentSchemas.d.ts +179 -0
  8. package/dist/src/catalog/contentSchemas.js +195 -0
  9. package/dist/src/catalog/descriptions.d.ts +52 -0
  10. package/dist/src/catalog/descriptions.js +54 -0
  11. package/dist/src/catalog/eventEntries.d.ts +70 -0
  12. package/dist/src/catalog/eventEntries.js +59 -0
  13. package/dist/src/catalog/fileMutateSchema.d.ts +41 -0
  14. package/dist/src/catalog/fileMutateSchema.js +77 -0
  15. package/dist/src/catalog/index.d.ts +15 -0
  16. package/dist/src/catalog/index.js +10 -0
  17. package/dist/src/catalog/oauthEntries.d.ts +125 -0
  18. package/dist/src/catalog/oauthEntries.js +92 -0
  19. package/dist/src/catalog/route.d.ts +137 -0
  20. package/dist/src/catalog/route.js +92 -0
  21. package/dist/src/catalog/runnerEntries.d.ts +145 -0
  22. package/dist/src/catalog/runnerEntries.js +69 -0
  23. package/dist/src/catalog/schemas.test.d.ts +4 -0
  24. package/dist/src/catalog/serverCatalog.d.ts +1143 -0
  25. package/dist/src/catalog/serverCatalog.js +37 -0
  26. package/dist/src/catalog/serverCatalog.test.d.ts +4 -0
  27. package/dist/src/catalog/sharingEntries.d.ts +200 -0
  28. package/dist/src/catalog/sharingEntries.js +146 -0
  29. package/dist/src/catalog/statusSchemas.d.ts +87 -0
  30. package/dist/src/catalog/statusSchemas.js +119 -0
  31. package/dist/src/catalog/utilityEntries.d.ts +151 -0
  32. package/dist/src/catalog/utilityEntries.js +62 -0
  33. package/dist/src/catalog/utilitySchemas.d.ts +98 -0
  34. package/dist/src/catalog/utilitySchemas.js +131 -0
  35. package/dist/src/configAuthSchema.d.ts +100 -0
  36. package/dist/src/configAuthSchema.js +119 -0
  37. package/dist/src/configFeatureSchemas.d.ts +43 -0
  38. package/dist/src/configFeatureSchemas.js +53 -0
  39. package/dist/src/configPrintStyles.d.ts +63 -0
  40. package/dist/src/configPrintStyles.js +98 -0
  41. package/dist/src/configPrintStyles.test.d.ts +1 -0
  42. package/dist/src/crypto.d.ts +6 -13
  43. package/dist/src/crypto.js +7 -32
  44. package/dist/src/crypto.test.d.ts +7 -0
  45. package/dist/src/errors.d.ts +51 -0
  46. package/dist/src/errors.js +97 -0
  47. package/dist/src/errors.test.d.ts +4 -0
  48. package/dist/src/index.d.ts +5 -2
  49. package/dist/src/index.js +18 -3
  50. package/dist/src/openapi.d.ts +13 -0
  51. package/dist/src/openapi.js +17 -0
  52. package/dist/src/openapi.test.d.ts +4 -0
  53. package/dist/src/schema.d.ts +21 -122
  54. package/dist/src/schema.js +39 -153
  55. package/dist/src/schema.publicUrl.test.d.ts +1 -0
  56. package/dist/src/schema.test.d.ts +1 -0
  57. package/dist/src/types.d.ts +7 -0
  58. package/dist/src/urlKey.d.ts +24 -0
  59. package/dist/src/urlKey.js +43 -0
  60. package/dist/src/urlKey.test.d.ts +1 -0
  61. package/openapi.json +3934 -0
  62. package/package.json +31 -16
  63. package/dist/src/endpoints.d.ts +0 -34
  64. package/dist/src/endpoints.js +0 -235
  65. /package/dist/src/{endpoints.test.d.ts → configAuthSchema.test.d.ts} +0 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Location and `info` block of jeeves-server-core's committed OpenAPI document (`openapi.json`), shared by the writer (`write-openapi.ts`) and the drift test. Reads `package.json`; no writes.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import type { OpenApiInfo } from '@karmaniverous/jeeves/openapi';
7
+ /** The committed document. */
8
+ export declare const OPENAPI_FILE: string;
9
+ /**
10
+ * The document's `info`: title, jeeves-server-core's current version,
11
+ * description.
12
+ *
13
+ * @returns OpenAPI `info`.
14
+ */
15
+ export declare function openApiInfo(): OpenApiInfo;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The `./catalog` entry is browser-safe: its whole import graph (core's own modules and the parts of `@karmaniverous/jeeves/catalog` it loads) reaches only `zod` and `@karmaniverous/jeeves/catalog`, never a Node built-in or any other package.
3
+ */
4
+ export {};
@@ -0,0 +1,468 @@
1
+ /**
2
+ * The content entries of the server catalog: drives, browse, file content, write and mutate, raw, exports, export cache clear, link info, diagrams and public content. Content and navigation entries take the share parameters (`shareQuerySchema`) in their query. Pure.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { z } from 'zod';
7
+ /** The content entries. */
8
+ export declare const CONTENT_ENTRIES: readonly [{
9
+ readonly query: z.ZodObject<{
10
+ exp: z.ZodOptional<z.ZodString>;
11
+ d: z.ZodOptional<z.ZodString>;
12
+ dirs: z.ZodOptional<z.ZodString>;
13
+ s: z.ZodOptional<z.ZodString>;
14
+ key: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ readonly response: z.ZodArray<z.ZodObject<{
17
+ letter: z.ZodString;
18
+ label: z.ZodString;
19
+ }, z.core.$strip>>;
20
+ readonly auth: {
21
+ readonly schemes: readonly [{
22
+ readonly in: "query";
23
+ readonly name: "k";
24
+ }, {
25
+ readonly in: "cookie";
26
+ readonly name: "jeeves_session";
27
+ }];
28
+ };
29
+ readonly kind: "read";
30
+ readonly name: "drives";
31
+ readonly method: "GET";
32
+ readonly path: "/api/drives";
33
+ readonly description: "List available root drives/labels configured on the server.";
34
+ }, {
35
+ readonly params: z.ZodObject<{
36
+ '*': z.ZodString;
37
+ }, z.core.$strip>;
38
+ readonly query: z.ZodObject<{
39
+ exp: z.ZodOptional<z.ZodString>;
40
+ d: z.ZodOptional<z.ZodString>;
41
+ dirs: z.ZodOptional<z.ZodString>;
42
+ s: z.ZodOptional<z.ZodString>;
43
+ key: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ readonly response: z.ZodUnion<readonly [z.ZodObject<{
46
+ type: z.ZodLiteral<"file">;
47
+ path: z.ZodString;
48
+ ext: z.ZodString;
49
+ size: z.ZodNumber;
50
+ mtime: z.ZodString;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ path: z.ZodString;
53
+ entries: z.ZodArray<z.ZodObject<{
54
+ name: z.ZodString;
55
+ type: z.ZodEnum<{
56
+ file: "file";
57
+ directory: "directory";
58
+ }>;
59
+ ext: z.ZodString;
60
+ size: z.ZodNullable<z.ZodNumber>;
61
+ mtime: z.ZodNullable<z.ZodString>;
62
+ itemCount: z.ZodNullable<z.ZodNumber>;
63
+ shareUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ }, z.core.$strip>>;
65
+ breadcrumbs: z.ZodArray<z.ZodObject<{
66
+ label: z.ZodString;
67
+ path: z.ZodString;
68
+ }, z.core.$strip>>;
69
+ isInsider: z.ZodBoolean;
70
+ }, z.core.$strip>]>;
71
+ readonly auth: {
72
+ readonly schemes: readonly [{
73
+ readonly in: "query";
74
+ readonly name: "k";
75
+ }, {
76
+ readonly in: "cookie";
77
+ readonly name: "jeeves_session";
78
+ }];
79
+ };
80
+ readonly kind: "read";
81
+ readonly name: "browse";
82
+ readonly method: "GET";
83
+ readonly path: "/api/path/*";
84
+ readonly description: "Get file or directory metadata. For files: size, mtime, content type, rendered HTML availability. For directories: listing of entries.";
85
+ }, {
86
+ readonly params: z.ZodObject<{
87
+ '*': z.ZodString;
88
+ }, z.core.$strip>;
89
+ readonly query: z.ZodObject<{
90
+ exp: z.ZodOptional<z.ZodString>;
91
+ d: z.ZodOptional<z.ZodString>;
92
+ dirs: z.ZodOptional<z.ZodString>;
93
+ s: z.ZodOptional<z.ZodString>;
94
+ key: z.ZodOptional<z.ZodString>;
95
+ raw: z.ZodOptional<z.ZodString>;
96
+ render_diagrams: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ readonly response: z.ZodObject<{
99
+ type: z.ZodEnum<{
100
+ plantuml: "plantuml";
101
+ text: "text";
102
+ markdown: "markdown";
103
+ mermaid: "mermaid";
104
+ svg: "svg";
105
+ csv: "csv";
106
+ image: "image";
107
+ binary: "binary";
108
+ }>;
109
+ content: z.ZodOptional<z.ZodString>;
110
+ html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
111
+ headings: z.ZodOptional<z.ZodArray<z.ZodObject<{
112
+ level: z.ZodNumber;
113
+ text: z.ZodString;
114
+ slug: z.ZodString;
115
+ }, z.core.$strip>>>;
116
+ size: z.ZodOptional<z.ZodNumber>;
117
+ fileName: z.ZodString;
118
+ breadcrumbs: z.ZodArray<z.ZodObject<{
119
+ label: z.ZodString;
120
+ path: z.ZodString;
121
+ }, z.core.$strip>>;
122
+ isInsider: z.ZodBoolean;
123
+ mtime: z.ZodOptional<z.ZodNumber>;
124
+ renderAs: z.ZodOptional<z.ZodString>;
125
+ matchedRules: z.ZodOptional<z.ZodArray<z.ZodString>>;
126
+ title: z.ZodOptional<z.ZodString>;
127
+ }, z.core.$strip>;
128
+ readonly auth: {
129
+ readonly schemes: readonly [{
130
+ readonly in: "query";
131
+ readonly name: "k";
132
+ }, {
133
+ readonly in: "cookie";
134
+ readonly name: "jeeves_session";
135
+ }];
136
+ };
137
+ readonly kind: "read";
138
+ readonly name: "fileContent";
139
+ readonly method: "GET";
140
+ readonly path: "/api/file/*";
141
+ readonly description: "Get a file with type-specific handling: Markdown, CSV and diagrams rendered to HTML, other text as is, images and binaries by name. `raw=1` skips rendering.";
142
+ }, {
143
+ readonly params: z.ZodObject<{
144
+ '*': z.ZodString;
145
+ }, z.core.$strip>;
146
+ readonly query: z.ZodObject<{
147
+ exp: z.ZodOptional<z.ZodString>;
148
+ d: z.ZodOptional<z.ZodString>;
149
+ dirs: z.ZodOptional<z.ZodString>;
150
+ s: z.ZodOptional<z.ZodString>;
151
+ key: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strip>;
153
+ readonly body: z.ZodObject<{
154
+ content: z.ZodString;
155
+ }, z.core.$strip>;
156
+ readonly response: z.ZodObject<{
157
+ ok: z.ZodLiteral<true>;
158
+ path: z.ZodString;
159
+ size: z.ZodNumber;
160
+ }, z.core.$strip>;
161
+ readonly auth: {
162
+ readonly schemes: readonly [{
163
+ readonly in: "query";
164
+ readonly name: "k";
165
+ }, {
166
+ readonly in: "cookie";
167
+ readonly name: "jeeves_session";
168
+ }];
169
+ readonly insiderOnly: true;
170
+ };
171
+ readonly kind: "write";
172
+ readonly name: "fileWrite";
173
+ readonly method: "PUT";
174
+ readonly path: "/api/file/*";
175
+ readonly description: "Overwrite the content of an existing file. Insider-only; the file must already exist.";
176
+ }, {
177
+ readonly params: z.ZodObject<{
178
+ '*': z.ZodString;
179
+ }, z.core.$strip>;
180
+ readonly query: z.ZodObject<{
181
+ exp: z.ZodOptional<z.ZodString>;
182
+ d: z.ZodOptional<z.ZodString>;
183
+ dirs: z.ZodOptional<z.ZodString>;
184
+ s: z.ZodOptional<z.ZodString>;
185
+ key: z.ZodOptional<z.ZodString>;
186
+ }, z.core.$strip>;
187
+ readonly body: z.ZodObject<{
188
+ action: z.ZodEnum<{
189
+ "edit-block": "edit-block";
190
+ "delete-block": "delete-block";
191
+ "insert-block": "insert-block";
192
+ "edit-cell": "edit-cell";
193
+ "toggle-checkbox": "toggle-checkbox";
194
+ }>;
195
+ startLine: z.ZodOptional<z.ZodNumber>;
196
+ endLine: z.ZodOptional<z.ZodNumber>;
197
+ content: z.ZodOptional<z.ZodString>;
198
+ atLine: z.ZodOptional<z.ZodNumber>;
199
+ position: z.ZodOptional<z.ZodEnum<{
200
+ before: "before";
201
+ after: "after";
202
+ }>>;
203
+ context: z.ZodOptional<z.ZodString>;
204
+ line: z.ZodOptional<z.ZodNumber>;
205
+ col: z.ZodOptional<z.ZodNumber>;
206
+ index: z.ZodOptional<z.ZodNumber>;
207
+ checked: z.ZodOptional<z.ZodBoolean>;
208
+ }, z.core.$strip>;
209
+ readonly response: z.ZodObject<{
210
+ ok: z.ZodLiteral<true>;
211
+ }, z.core.$strip>;
212
+ readonly auth: {
213
+ readonly schemes: readonly [{
214
+ readonly in: "query";
215
+ readonly name: "k";
216
+ }, {
217
+ readonly in: "cookie";
218
+ readonly name: "jeeves_session";
219
+ }];
220
+ readonly insiderOnly: true;
221
+ };
222
+ readonly kind: "write";
223
+ readonly name: "fileMutate";
224
+ readonly method: "POST";
225
+ readonly path: "/api/file/*";
226
+ readonly description: "Apply a structured mutation to a .md file. Insider-only. Supports: edit-block, delete-block, insert-block, edit-cell, toggle-checkbox.";
227
+ }, {
228
+ readonly params: z.ZodObject<{
229
+ '*': z.ZodString;
230
+ }, z.core.$strip>;
231
+ readonly query: z.ZodObject<{
232
+ exp: z.ZodOptional<z.ZodString>;
233
+ d: z.ZodOptional<z.ZodString>;
234
+ dirs: z.ZodOptional<z.ZodString>;
235
+ s: z.ZodOptional<z.ZodString>;
236
+ key: z.ZodOptional<z.ZodString>;
237
+ download: z.ZodOptional<z.ZodString>;
238
+ }, z.core.$strip>;
239
+ readonly response: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
240
+ readonly contentType: "application/octet-stream";
241
+ readonly auth: {
242
+ readonly schemes: readonly [{
243
+ readonly in: "query";
244
+ readonly name: "k";
245
+ }, {
246
+ readonly in: "cookie";
247
+ readonly name: "jeeves_session";
248
+ }];
249
+ };
250
+ readonly kind: "read";
251
+ readonly name: "raw";
252
+ readonly method: "GET";
253
+ readonly path: "/api/raw/*";
254
+ readonly description: "Download a file as is, with its own content type. `download=1` always sends it as an attachment.";
255
+ }, {
256
+ readonly params: z.ZodObject<{
257
+ '*': z.ZodString;
258
+ }, z.core.$strip>;
259
+ readonly query: z.ZodObject<{
260
+ exp: z.ZodOptional<z.ZodString>;
261
+ d: z.ZodOptional<z.ZodString>;
262
+ dirs: z.ZodOptional<z.ZodString>;
263
+ s: z.ZodOptional<z.ZodString>;
264
+ key: z.ZodOptional<z.ZodString>;
265
+ format: z.ZodOptional<z.ZodEnum<{
266
+ pdf: "pdf";
267
+ docx: "docx";
268
+ zip: "zip";
269
+ tar: "tar";
270
+ }>>;
271
+ }, z.core.$strip>;
272
+ readonly response: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
273
+ readonly contentType: "application/octet-stream";
274
+ readonly auth: {
275
+ readonly schemes: readonly [{
276
+ readonly in: "query";
277
+ readonly name: "k";
278
+ }, {
279
+ readonly in: "cookie";
280
+ readonly name: "jeeves_session";
281
+ }];
282
+ };
283
+ readonly kind: "read";
284
+ readonly name: "export";
285
+ readonly method: "GET";
286
+ readonly path: "/api/export/*";
287
+ readonly description: "Export a Markdown document as PDF or DOCX, or a directory as a ZIP or Tar archive (archives for insiders only).";
288
+ }, {
289
+ readonly params: z.ZodObject<{
290
+ '*': z.ZodString;
291
+ }, z.core.$strip>;
292
+ readonly query: z.ZodObject<{
293
+ exp: z.ZodOptional<z.ZodString>;
294
+ d: z.ZodOptional<z.ZodString>;
295
+ dirs: z.ZodOptional<z.ZodString>;
296
+ s: z.ZodOptional<z.ZodString>;
297
+ key: z.ZodOptional<z.ZodString>;
298
+ }, z.core.$strip>;
299
+ readonly response: z.ZodObject<{
300
+ cleared: z.ZodObject<{
301
+ exports: z.ZodNumber;
302
+ diagrams: z.ZodNumber;
303
+ }, z.core.$strip>;
304
+ }, z.core.$strip>;
305
+ readonly auth: {
306
+ readonly schemes: readonly [{
307
+ readonly in: "query";
308
+ readonly name: "k";
309
+ }, {
310
+ readonly in: "cookie";
311
+ readonly name: "jeeves_session";
312
+ }];
313
+ readonly insiderOnly: true;
314
+ };
315
+ readonly kind: "write";
316
+ readonly name: "exportCacheClear";
317
+ readonly method: "DELETE";
318
+ readonly path: "/api/export-cache/*";
319
+ readonly description: "Clear the export and diagram caches for a given path.";
320
+ }, {
321
+ readonly params: z.ZodObject<{
322
+ '*': z.ZodString;
323
+ }, z.core.$strip>;
324
+ readonly query: z.ZodObject<{
325
+ exp: z.ZodOptional<z.ZodString>;
326
+ d: z.ZodOptional<z.ZodString>;
327
+ dirs: z.ZodOptional<z.ZodString>;
328
+ s: z.ZodOptional<z.ZodString>;
329
+ key: z.ZodOptional<z.ZodString>;
330
+ format: z.ZodOptional<z.ZodString>;
331
+ }, z.core.$strip>;
332
+ readonly response: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
333
+ readonly contentType: "application/octet-stream";
334
+ readonly auth: {
335
+ readonly schemes: readonly [{
336
+ readonly in: "query";
337
+ readonly name: "k";
338
+ }, {
339
+ readonly in: "cookie";
340
+ readonly name: "jeeves_session";
341
+ }];
342
+ };
343
+ readonly kind: "read";
344
+ readonly name: "exportMermaid";
345
+ readonly method: "GET";
346
+ readonly path: "/api/mermaid-export/*";
347
+ readonly description: "Export a Mermaid diagram file as SVG, PNG or PDF.";
348
+ }, {
349
+ readonly params: z.ZodObject<{
350
+ '*': z.ZodString;
351
+ }, z.core.$strip>;
352
+ readonly query: z.ZodObject<{
353
+ exp: z.ZodOptional<z.ZodString>;
354
+ d: z.ZodOptional<z.ZodString>;
355
+ dirs: z.ZodOptional<z.ZodString>;
356
+ s: z.ZodOptional<z.ZodString>;
357
+ key: z.ZodOptional<z.ZodString>;
358
+ format: z.ZodOptional<z.ZodString>;
359
+ }, z.core.$strip>;
360
+ readonly response: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
361
+ readonly contentType: "application/octet-stream";
362
+ readonly auth: {
363
+ readonly schemes: readonly [{
364
+ readonly in: "query";
365
+ readonly name: "k";
366
+ }, {
367
+ readonly in: "cookie";
368
+ readonly name: "jeeves_session";
369
+ }];
370
+ };
371
+ readonly kind: "read";
372
+ readonly name: "exportPlantUml";
373
+ readonly method: "GET";
374
+ readonly path: "/api/plantuml-export/*";
375
+ readonly description: "Export a PlantUML diagram file in one of the formats the configured renderers support (SVG, PNG, PDF, EPS).";
376
+ }, {
377
+ readonly params: z.ZodObject<{
378
+ '*': z.ZodString;
379
+ }, z.core.$strip>;
380
+ readonly query: z.ZodObject<{
381
+ exp: z.ZodOptional<z.ZodString>;
382
+ d: z.ZodOptional<z.ZodString>;
383
+ dirs: z.ZodOptional<z.ZodString>;
384
+ s: z.ZodOptional<z.ZodString>;
385
+ key: z.ZodOptional<z.ZodString>;
386
+ }, z.core.$strip>;
387
+ readonly response: z.ZodObject<{
388
+ exists: z.ZodBoolean;
389
+ isDirectory: z.ZodOptional<z.ZodBoolean>;
390
+ pageUrl: z.ZodOptional<z.ZodString>;
391
+ rawUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
392
+ downloadUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
393
+ exportLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
394
+ format: z.ZodString;
395
+ url: z.ZodString;
396
+ }, z.core.$strip>>>;
397
+ }, z.core.$strip>;
398
+ readonly auth: {
399
+ readonly schemes: readonly [{
400
+ readonly in: "query";
401
+ readonly name: "k";
402
+ }, {
403
+ readonly in: "cookie";
404
+ readonly name: "jeeves_session";
405
+ }];
406
+ };
407
+ readonly kind: "read";
408
+ readonly name: "linkInfo";
409
+ readonly method: "GET";
410
+ readonly path: "/api/link-info/*";
411
+ readonly description: "Query available link types for a path (exists, page URL, raw URL, export links for PDF/DOCX/SVG/PNG).";
412
+ }, {
413
+ readonly params: z.ZodObject<{
414
+ type: z.ZodEnum<{
415
+ plantuml: "plantuml";
416
+ mermaid: "mermaid";
417
+ }>;
418
+ hash: z.ZodString;
419
+ }, z.core.$strip>;
420
+ readonly response: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
421
+ readonly contentType: "image/svg+xml";
422
+ readonly auth: "none";
423
+ readonly kind: "read";
424
+ readonly name: "diagram";
425
+ readonly method: "GET";
426
+ readonly path: "/api/diagram/:type/:hash";
427
+ readonly description: "Get a diagram embedded in a rendered document, as SVG, by its type and content hash.";
428
+ }, {
429
+ readonly params: z.ZodObject<{
430
+ slug: z.ZodString;
431
+ }, z.core.$strip>;
432
+ readonly response: z.ZodObject<{
433
+ type: z.ZodEnum<{
434
+ plantuml: "plantuml";
435
+ text: "text";
436
+ markdown: "markdown";
437
+ mermaid: "mermaid";
438
+ svg: "svg";
439
+ csv: "csv";
440
+ image: "image";
441
+ binary: "binary";
442
+ }>;
443
+ content: z.ZodOptional<z.ZodString>;
444
+ html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
445
+ headings: z.ZodOptional<z.ZodArray<z.ZodObject<{
446
+ level: z.ZodNumber;
447
+ text: z.ZodString;
448
+ slug: z.ZodString;
449
+ }, z.core.$strip>>>;
450
+ size: z.ZodOptional<z.ZodNumber>;
451
+ fileName: z.ZodString;
452
+ breadcrumbs: z.ZodArray<z.ZodObject<{
453
+ label: z.ZodString;
454
+ path: z.ZodString;
455
+ }, z.core.$strip>>;
456
+ isInsider: z.ZodBoolean;
457
+ mtime: z.ZodOptional<z.ZodNumber>;
458
+ renderAs: z.ZodOptional<z.ZodString>;
459
+ matchedRules: z.ZodOptional<z.ZodArray<z.ZodString>>;
460
+ title: z.ZodOptional<z.ZodString>;
461
+ }, z.core.$strip>;
462
+ readonly auth: "none";
463
+ readonly kind: "read";
464
+ readonly name: "publicContent";
465
+ readonly method: "GET";
466
+ readonly path: "/api/public-content/:slug";
467
+ readonly description: "Get one of the public pages of the server (readme, privacy, terms) rendered as Markdown.";
468
+ }];
@@ -0,0 +1,150 @@
1
+ import { z } from 'zod';
2
+ import { drivesResponseSchema, browseResponseSchema, fileContentResponseSchema, fileWriteResponseSchema, fileWriteBodySchema, okResponseSchema, exportCacheClearResponseSchema, linkInfoResponseSchema, fileContentQuerySchema } from './contentSchemas.js';
3
+ import { fileMutateBodySchema } from './fileMutateSchema.js';
4
+ import { KEY_OR_SESSION, shareQuerySchema, browsePathParams, INSIDER_ONLY, PUBLIC, route, wildcardParams } from './route.js';
5
+
6
+ /**
7
+ * The content entries of the server catalog: drives, browse, file content, write and mutate, raw, exports, export cache clear, link info, diagrams and public content. Content and navigation entries take the share parameters (`shareQuerySchema`) in their query. Pure.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ /** Bytes: the response of a binary entry. */
12
+ const bytes = z.instanceof(Uint8Array);
13
+ /** Content type of binary entries whose type depends on the file. */
14
+ const OCTET_STREAM = 'application/octet-stream';
15
+ /** An optional `format` query field. */
16
+ const formatQuery = (description) => z.string().optional().describe(description);
17
+ /** The content entries. */
18
+ const CONTENT_ENTRIES = [
19
+ {
20
+ ...route('drives', 'GET', '/api/drives'),
21
+ query: shareQuerySchema,
22
+ response: drivesResponseSchema,
23
+ auth: KEY_OR_SESSION,
24
+ kind: 'read',
25
+ },
26
+ {
27
+ ...route('browse', 'GET', '/api/path/*'),
28
+ params: wildcardParams('Browse path (e.g. "<drive>/path/to/dir")'),
29
+ query: shareQuerySchema,
30
+ response: browseResponseSchema,
31
+ auth: KEY_OR_SESSION,
32
+ kind: 'read',
33
+ },
34
+ {
35
+ ...route('fileContent', 'GET', '/api/file/*'),
36
+ params: browsePathParams,
37
+ query: shareQuerySchema.extend(fileContentQuerySchema.shape),
38
+ response: fileContentResponseSchema,
39
+ auth: KEY_OR_SESSION,
40
+ kind: 'read',
41
+ },
42
+ {
43
+ ...route('fileWrite', 'PUT', '/api/file/*'),
44
+ params: browsePathParams,
45
+ query: shareQuerySchema,
46
+ body: fileWriteBodySchema,
47
+ response: fileWriteResponseSchema,
48
+ auth: INSIDER_ONLY,
49
+ kind: 'write',
50
+ },
51
+ {
52
+ ...route('fileMutate', 'POST', '/api/file/*'),
53
+ params: wildcardParams('File path (must be a .md file)'),
54
+ query: shareQuerySchema,
55
+ body: fileMutateBodySchema,
56
+ response: okResponseSchema,
57
+ auth: INSIDER_ONLY,
58
+ kind: 'write',
59
+ },
60
+ {
61
+ ...route('raw', 'GET', '/api/raw/*'),
62
+ params: browsePathParams,
63
+ query: shareQuerySchema.extend({
64
+ download: z
65
+ .string()
66
+ .optional()
67
+ .describe('1 (or true): send Content-Disposition: attachment for any file type.'),
68
+ }),
69
+ response: bytes,
70
+ contentType: OCTET_STREAM,
71
+ auth: KEY_OR_SESSION,
72
+ kind: 'read',
73
+ },
74
+ {
75
+ ...route('export', 'GET', '/api/export/*'),
76
+ params: browsePathParams,
77
+ query: shareQuerySchema.extend({
78
+ format: z
79
+ .enum(['pdf', 'docx', 'zip', 'tar'])
80
+ .optional()
81
+ .describe('pdf (default) or docx for Markdown documents; zip or tar for directories.'),
82
+ }),
83
+ response: bytes,
84
+ contentType: OCTET_STREAM,
85
+ auth: KEY_OR_SESSION,
86
+ kind: 'read',
87
+ },
88
+ {
89
+ ...route('exportCacheClear', 'DELETE', '/api/export-cache/*'),
90
+ params: wildcardParams('Browse path to clear caches for'),
91
+ query: shareQuerySchema,
92
+ response: exportCacheClearResponseSchema,
93
+ auth: INSIDER_ONLY,
94
+ kind: 'write',
95
+ },
96
+ {
97
+ ...route('exportMermaid', 'GET', '/api/mermaid-export/*'),
98
+ params: browsePathParams,
99
+ query: shareQuerySchema.extend({
100
+ format: formatQuery('svg (default), png or pdf.'),
101
+ }),
102
+ response: bytes,
103
+ contentType: OCTET_STREAM,
104
+ auth: KEY_OR_SESSION,
105
+ kind: 'read',
106
+ },
107
+ {
108
+ ...route('exportPlantUml', 'GET', '/api/plantuml-export/*'),
109
+ params: browsePathParams,
110
+ query: shareQuerySchema.extend({
111
+ format: formatQuery('svg (default), or another format the renderers support (png, pdf, eps).'),
112
+ }),
113
+ response: bytes,
114
+ contentType: OCTET_STREAM,
115
+ auth: KEY_OR_SESSION,
116
+ kind: 'read',
117
+ },
118
+ {
119
+ ...route('linkInfo', 'GET', '/api/link-info/*'),
120
+ params: browsePathParams,
121
+ query: shareQuerySchema,
122
+ response: linkInfoResponseSchema,
123
+ auth: KEY_OR_SESSION,
124
+ kind: 'read',
125
+ },
126
+ {
127
+ ...route('diagram', 'GET', '/api/diagram/:type/:hash'),
128
+ params: z.object({
129
+ type: z.enum(['mermaid', 'plantuml']).describe('Diagram type.'),
130
+ hash: z
131
+ .string()
132
+ .describe('SHA-256 of the diagram source (hex), optionally with .svg.'),
133
+ }),
134
+ response: bytes,
135
+ contentType: 'image/svg+xml',
136
+ auth: PUBLIC,
137
+ kind: 'read',
138
+ },
139
+ {
140
+ ...route('publicContent', 'GET', '/api/public-content/:slug'),
141
+ params: z.object({
142
+ slug: z.string().describe('Page: readme, privacy or terms.'),
143
+ }),
144
+ response: fileContentResponseSchema,
145
+ auth: PUBLIC,
146
+ kind: 'read',
147
+ },
148
+ ];
149
+
150
+ export { CONTENT_ENTRIES };