@tiddlywiki/mws 0.0.21 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +42 -9
  2. package/dist/metafile-esm.json +1 -0
  3. package/dist/mws.d.ts +1 -0
  4. package/dist/mws.js +34710 -0
  5. package/dist/mws.js.map +1 -0
  6. package/editions/mws-docs/tiddlers/$__StoryList.tid +1 -2
  7. package/editions/mws-docs/tiddlers/2025-02-18 - User Management.md.meta +2 -2
  8. package/editions/mws-docs/tiddlers/2025-04-14 - client plugins /342/234/224/357/270/217.md" +31 -0
  9. package/editions/mws-docs/tiddlers/2025-04-14 - client plugins /342/234/224/357/270/217.md.meta" +5 -0
  10. package/editions/mws-docs/tiddlers/{2025-05-04.md → 2025-05-04 - event hooks /342/234/224/357/270/217.md" } +7 -1
  11. package/editions/mws-docs/tiddlers/2025-05-04 - event hooks /342/234/224/357/270/217.md.meta" +5 -0
  12. package/editions/mws-docs/tiddlers/{2025-05-06.md → 2025-05-06 - syncer design.md } +0 -4
  13. package/editions/mws-docs/tiddlers/2025-05-06 - syncer design.md.meta +5 -0
  14. package/editions/mws-docs/tiddlers/Allowed Methods.tid +8 -0
  15. package/editions/mws-docs/tiddlers/Application Access & Security.md +14 -84
  16. package/editions/mws-docs/tiddlers/Application Access & Security.md.meta +1 -1
  17. package/editions/mws-docs/tiddlers/Body Format.md +19 -0
  18. package/editions/mws-docs/tiddlers/Body Format.md.meta +4 -0
  19. package/editions/mws-docs/tiddlers/Checklists and Features.md +0 -3
  20. package/editions/mws-docs/tiddlers/Checklists and Features.md.meta +1 -1
  21. package/editions/mws-docs/tiddlers/Client Plugins.md +17 -0
  22. package/editions/mws-docs/tiddlers/Client Plugins.md.meta +5 -0
  23. package/editions/mws-docs/tiddlers/HTTP API.md +4 -3
  24. package/editions/mws-docs/tiddlers/HTTP API.md.meta +1 -1
  25. package/editions/mws-docs/tiddlers/HelloThere.tid +2 -2
  26. package/editions/mws-docs/tiddlers/Installation.tid +2 -3
  27. package/editions/mws-docs/tiddlers/MWS Architecture.tid +6 -1
  28. package/editions/mws-docs/tiddlers/Multi-user Trust.md +12 -0
  29. package/editions/mws-docs/tiddlers/Multi-user Trust.md.meta +5 -0
  30. package/editions/mws-docs/tiddlers/Notes.tid +5 -3
  31. package/editions/mws-docs/tiddlers/Oracle Attacks.md +29 -0
  32. package/editions/mws-docs/tiddlers/Oracle Attacks.md.meta +5 -0
  33. package/editions/mws-docs/tiddlers/Reference.md +1 -0
  34. package/editions/mws-docs/tiddlers/Reference.md.meta +1 -1
  35. package/editions/mws-docs/tiddlers/Request Handling.md +53 -0
  36. package/editions/mws-docs/tiddlers/Request Handling.md.meta +5 -0
  37. package/editions/mws-docs/tiddlers/Roadmap.tid +7 -0
  38. package/editions/mws-docs/tiddlers/Route Definers.md +206 -0
  39. package/editions/mws-docs/tiddlers/Route Definers.md.meta +5 -0
  40. package/editions/mws-docs/tiddlers/Security.md +75 -0
  41. package/editions/mws-docs/tiddlers/Security.md.meta +5 -0
  42. package/editions/mws-docs/tiddlers/Server Plugins.md +7 -0
  43. package/editions/mws-docs/tiddlers/Server Plugins.md.meta +5 -0
  44. package/editions/mws-docs/tiddlers/Startup Cache.md +28 -0
  45. package/editions/mws-docs/tiddlers/Startup Cache.md.meta +5 -0
  46. package/editions/mws-docs/tiddlers/TiddlerFields.md +5 -0
  47. package/editions/mws-docs/tiddlers/TiddlerFields.md.meta +4 -0
  48. package/editions/mws-docs/tiddlers/Usage.tid +2 -2
  49. package/editions/mws-docs/tiddlers/system/$__mws_cssvar-macro.tid +10 -0
  50. package/editions/mws-docs/tiddlers/system/$__palettes_MUI +143 -0
  51. package/editions/mws-docs/tiddlers/system/$__palettes_MUI.meta +7 -0
  52. package/editions/mws-docs/tiddlers/system/$__palettes_MUI_styles.css +567 -0
  53. package/editions/mws-docs/tiddlers/system/$__palettes_MUI_styles.css.meta +6 -0
  54. package/editions/mws-docs/tiddlers/system/$__theme.tid +6 -0
  55. package/editions/mws-docs/tiddlers/system/SplashScreen.tid +21 -0
  56. package/editions/mws-docs/tiddlers/system/StaticBanner.tid +1 -1
  57. package/editions/mws-docs/tiddlers/system/Styles.tid +13 -0
  58. package/editions/mws-docs/tiddlers/system/palette.tid +4 -1
  59. package/editions/mws-docs/tiddlers/system/sidebarlayout.tid +4 -1
  60. package/editions/mws-docs/tiddlers/x-mws-tiddler.md +35 -0
  61. package/editions/mws-docs/tiddlers/x-mws-tiddler.md.meta +5 -0
  62. package/mws.run.mjs +30 -0
  63. package/package.json +47 -36
  64. package/plugins/client/package-lock.json +46 -83
  65. package/plugins/client/package.json +1 -6
  66. package/plugins/client/plugin.info +2 -2
  67. package/plugins/client/src/fflate.d.ts +1501 -0
  68. package/plugins/client/src/multiwikiclientadaptor.ts +768 -317
  69. package/plugins/client/src/mws.d.ts +4 -0
  70. package/plugins/client/src/types.d.ts +3928 -0
  71. package/plugins/client/tiddlers/en-US.multids +3 -0
  72. package/plugins/client/tiddlers/status/SaveWikiButtonTemplate.tid +3 -0
  73. package/plugins/client/tiddlers/status/icon-cloud.tid +4 -0
  74. package/plugins/client/tiddlers/status/info-segment.tid +8 -0
  75. package/plugins/client/tiddlers/status/readonly-styles.tid +27 -0
  76. package/plugins/client/tiddlers/status/save-offline.tid +7 -0
  77. package/plugins/client/tiddlers/status/save-wiki-button.tid +26 -0
  78. package/plugins/client/tiddlers/status/styles.tid +44 -0
  79. package/plugins/client/tiddlers/status/syncer-actions-copy-logs.tid +6 -0
  80. package/plugins/client/tiddlers/status/syncer-actions-login-status.tid +9 -0
  81. package/plugins/client/tiddlers/status/syncer-actions-login.tid +8 -0
  82. package/plugins/client/tiddlers/status/syncer-actions-logout.tid +8 -0
  83. package/plugins/client/tiddlers/status/syncer-actions-refresh.tid +9 -0
  84. package/plugins/client/tiddlers/status/syncer-actions-save-snapshot.tid +9 -0
  85. package/plugins/client/tiddlers/status/tags-syncerdropdown.tid +2 -0
  86. package/plugins/client/tiddlers/syncer/multiwikiclientadaptor.js +640 -0
  87. package/plugins/client/tiddlers/syncer/syncer.js +831 -0
  88. package/plugins/client/tsconfig.json +19 -16
  89. package/plugins/filter-ast-to-sql/example-run-series.ts +146 -0
  90. package/plugins/server/SplashScreen.tid +150 -0
  91. package/plugins/server/fflate.js +9 -0
  92. package/plugins/server/plugin.info +8 -0
  93. package/plugins/server/readme +1 -0
  94. package/plugins/server/url-polyfill.js +294 -0
  95. package/prisma/client/client.d.ts +1 -0
  96. package/prisma/client/client.js +3 -0
  97. package/prisma/client/default.d.ts +1 -0
  98. package/prisma/client/default.js +3 -0
  99. package/prisma/client/edge.d.ts +1 -0
  100. package/prisma/client/edge.js +297 -0
  101. package/prisma/client/index-browser.js +275 -0
  102. package/prisma/client/index.d.ts +17770 -0
  103. package/prisma/client/index.js +324 -0
  104. package/prisma/client/package.json +173 -0
  105. package/prisma/client/query_engine_bg.js +811 -0
  106. package/prisma/client/query_engine_bg.wasm +0 -0
  107. package/prisma/client/runtime/edge-esm.js +10000 -0
  108. package/prisma/client/runtime/edge.js +10036 -0
  109. package/prisma/client/runtime/index-browser.d.ts +370 -0
  110. package/prisma/client/runtime/index-browser.js +2300 -0
  111. package/prisma/client/runtime/library.d.ts +3681 -0
  112. package/prisma/client/runtime/library.js +10604 -0
  113. package/prisma/client/runtime/react-native.js +10629 -0
  114. package/prisma/client/runtime/wasm-compiler-edge.js +11238 -0
  115. package/prisma/client/runtime/wasm-engine-edge.js +7801 -0
  116. package/prisma/client/schema.prisma +156 -0
  117. package/prisma/client/wasm-edge-light-loader.mjs +4 -0
  118. package/prisma/client/wasm-worker-loader.mjs +4 -0
  119. package/prisma/client/wasm.d.ts +1 -0
  120. package/prisma/client/wasm.js +304 -0
  121. package/prisma/global.ts +53 -0
  122. package/prisma/migrations/{20250406213424_init → 20250606001949_init}/migration.sql +46 -48
  123. package/prisma/migrations/20250613000526_remove_group/migration.sql +22 -0
  124. package/prisma/migrations/20250620014502_settings/migration.sql +5 -0
  125. package/prisma/migrations/20250707205229_recipes/migration.sql +20 -0
  126. package/prisma/migrations/migration_lock.toml +1 -1
  127. package/prisma/notes.md +1 -2
  128. package/prisma/schema.prisma +52 -49
  129. package/prisma/test.sqlite +0 -0
  130. package/prisma/test.sqlite-journal +0 -0
  131. package/public/react-admin/android-chrome-192x192.png +0 -0
  132. package/public/react-admin/android-chrome-512x512.png +0 -0
  133. package/public/react-admin/apple-touch-icon.png +0 -0
  134. package/{react-user-mgmt/public/esm-QKDFEP3B.js → public/react-admin/esm-L4WLVWJN.js} +1 -1
  135. package/public/react-admin/esm-L4WLVWJN.js.map +7 -0
  136. package/public/react-admin/esm-QMNGI3LF.js +3 -0
  137. package/public/react-admin/favicon-16x16.png +0 -0
  138. package/public/react-admin/favicon-32x32.png +0 -0
  139. package/public/react-admin/favicon.ico +0 -0
  140. package/public/react-admin/index.html +36 -0
  141. package/public/react-admin/main.js +268 -0
  142. package/public/react-admin/main.js.map +7 -0
  143. package/public/react-admin/site.webmanifest +20 -0
  144. package/public/react-admin/stats.json +1 -0
  145. package/scripts.mjs +134 -25
  146. package/dist/server.d.ts +0 -945
  147. package/dist/server.js +0 -20775
  148. package/dist/server.js.map +0 -1
  149. package/editions/mws-docs/tiddlers/2025-04-03 - Phases of Development.md +0 -64
  150. package/editions/mws-docs/tiddlers/2025-04-03 - Phases of Development.md.meta +0 -5
  151. package/editions/mws-docs/tiddlers/2025-04-13 - Plugins.md +0 -18
  152. package/editions/mws-docs/tiddlers/2025-04-13 - Plugins.md.meta +0 -5
  153. package/editions/mws-docs/tiddlers/2025-05-04.md.meta +0 -5
  154. package/editions/mws-docs/tiddlers/2025-05-06.md.meta +0 -5
  155. package/editions/mws-docs/tiddlers/Moduler Design.md +0 -29
  156. package/editions/mws-docs/tiddlers/Moduler Design.md.meta +0 -5
  157. package/editions/mws-docs/tiddlers/Request Server.md +0 -20
  158. package/editions/mws-docs/tiddlers/Request Server.md.meta +0 -5
  159. package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Dark +0 -173
  160. package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Dark.meta +0 -6
  161. package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Light +0 -172
  162. package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Light.meta +0 -6
  163. package/plugins/client/tiddlers/config-tiddlers-filter.tid +0 -2
  164. package/plugins/client/tiddlers/config-use-server-sent-events.tid +0 -2
  165. package/plugins/client/tiddlers/info-segment.tid +0 -8
  166. package/plugins/client/tiddlers/multiwikiclientadaptor.js +0 -444
  167. package/prisma/migrations/20250407002306_disconnect_user_tables/migration.sql +0 -52
  168. package/prisma/old-db.sql +0 -144
  169. package/react-user-mgmt/README.md +0 -50
  170. package/react-user-mgmt/eslint.config.js +0 -28
  171. package/react-user-mgmt/package-lock.json +0 -2738
  172. package/react-user-mgmt/package.json +0 -31
  173. package/react-user-mgmt/public/index.html +0 -1
  174. package/react-user-mgmt/public/main.js +0 -295
  175. package/react-user-mgmt/public/main.js.map +0 -7
  176. package/react-user-mgmt/public/stats.json +0 -1
  177. package/react-user-mgmt/tsconfig.json +0 -40
  178. package/react-user-mgmt/types.d.ts +0 -2
  179. package/tiddlywiki-types/boot/boot.d.ts +0 -378
  180. package/tiddlywiki-types/boot/bootprefix.d.ts +0 -110
  181. package/tiddlywiki-types/core/modules/filters.d.ts +0 -107
  182. package/tiddlywiki-types/core/modules/tiddler.d.ts +0 -47
  183. package/tiddlywiki-types/core/modules/wiki-bulkops.d.ts +0 -36
  184. package/tiddlywiki-types/core/modules/wiki.d.ts +0 -208
  185. package/tiddlywiki-types/index.d.ts +0 -7
  186. package/tiddlywiki-types/package.json +0 -3
  187. /package/plugins/client/tiddlers/{sidebarsegment.tid → status/sidebarsegment.tid} +0 -0
  188. /package/plugins/client/tiddlers/{GettingStarted.tid → syncer/GettingStarted.tid} +0 -0
  189. /package/plugins/client/tiddlers/{config-incoming-updates-filter.tid → syncer/config-incoming-updates-filter.tid} +0 -0
  190. /package/plugins/client/tiddlers/{readme.tid → syncer/readme.tid} +0 -0
  191. /package/{react-user-mgmt/public → public/react-admin}/chunk-YALWN5OT.js +0 -0
  192. /package/{react-user-mgmt/public → public/react-admin}/chunk-YALWN5OT.js.map +0 -0
  193. /package/{react-user-mgmt/public/esm-QKDFEP3B.js.map → public/react-admin/esm-QMNGI3LF.js.map} +0 -0
  194. /package/{react-user-mgmt/public → public/react-admin}/favicon.png +0 -0
  195. /package/{react-user-mgmt/public → public/react-admin}/missing-favicon.png +0 -0
  196. /package/{react-user-mgmt/public → public/react-admin}/motovun-jack.jpg +0 -0
  197. /package/{react-user-mgmt/public → public/react-admin}/mws-icon.png +0 -0
  198. /package/{react-user-mgmt/public → public/react-admin}/stats.css +0 -0
  199. /package/{react-user-mgmt/public → public/react-admin}/stats.html +0 -0
  200. /package/{react-user-mgmt/public → public/react-admin}/stats.js +0 -0
  201. /package/{react-user-mgmt/public → public/react-admin}/stats.svg +0 -0
  202. /package/{react-user-mgmt/public → public/react-admin}/vite.svg +0 -0
@@ -0,0 +1,3928 @@
1
+ declare module "prisma/global" {
2
+ import type { Prisma } from "prisma-client";
3
+ global {
4
+ namespace PrismaJson {
5
+ type Recipes_plugin_names = string[];
6
+ type Recipe_bags_partitioned_bags = {
7
+ /** partitioned bags allow each user with write access to write to `${title_prefix}${username}` */
8
+ title_prefix: string;
9
+ /**
10
+ * everyone with acl read can read all tiddlers
11
+ *
12
+ * if this is false, admins can still do this, but they will be in a restricted readonly mode.
13
+ */
14
+ everyone_readable: boolean;
15
+ /**
16
+ * everyone with acl write can write normal tiddlers.
17
+ *
18
+ * site and entity admins can always do this.
19
+ */
20
+ normally_writable: boolean;
21
+ };
22
+ }
23
+ }
24
+ global {
25
+ /**
26
+ * This primarily makes sure that positional arguments are used correctly
27
+ * (so you can't switch a title and bag_name around).
28
+ *
29
+ * If you assign the wrong value (like `5 as PrismaField<"Bags", "bag_name">`),
30
+ * this will result in a type error on the as keyword, allowing you to catch incorrect types quickly.
31
+ */
32
+ type PrismaField<T extends Prisma.ModelName, K extends keyof PrismaPayloadScalars<T>> = ([
33
+ T,
34
+ K
35
+ ] extends ["Tiddlers", "bag_id"] ? PrismaField<"Bags", "bag_id"> : [
36
+ T,
37
+ K
38
+ ] extends ["Sessions", "user_id"] ? PrismaField<"Users", "user_id"> : [
39
+ T,
40
+ K
41
+ ] extends ["Recipe_bags", "bag_id"] ? PrismaField<"Bags", "bag_id"> : [
42
+ T,
43
+ K
44
+ ] extends ["Recipe_bags", "recipe_id"] ? PrismaField<"Recipes", "recipe_id"> : [
45
+ T,
46
+ K
47
+ ] extends ["Recipes", "owner_id"] ? PrismaField<"Users", "user_id"> : [
48
+ T,
49
+ K
50
+ ] extends ["Bags", "owner_id"] ? PrismaField<"Users", "user_id"> : (PrismaPayloadScalars<T>[K] & {
51
+ __prisma_table: T;
52
+ __prisma_field: K;
53
+ })) | (null extends PrismaPayloadScalars<T>[K] ? null : never);
54
+ type PrismaPayloadScalars<T extends Prisma.ModelName> = Prisma.TypeMap["model"][T]["payload"]["scalars"];
55
+ }
56
+ }
57
+ declare module "packages/events/src/index" {
58
+ import EventEmitter from "events";
59
+ /**
60
+ * Server events used throughout the entire server.
61
+ *
62
+ * To find all references to a specific event, use find all occurrences
63
+ * on a usage of the event name string, not on the definition of the event.
64
+ */
65
+ export interface ServerEventsMap {
66
+ }
67
+ export class ServerEvents extends EventEmitter<ServerEventsMap> {
68
+ /** Use emitAsync instead */
69
+ emit: never;
70
+ emitAsync<K>(eventName: keyof ServerEventsMap | K, ...args: K extends keyof ServerEventsMap ? ServerEventsMap[K] : never): Promise<void>;
71
+ }
72
+ /**
73
+ * Server events used throughout the entire server.
74
+ *
75
+ * To find all references to a specific event, use find all occurrences
76
+ * on a usage of the event name string.
77
+ *
78
+ * The listener function is awaited, but the return value is ignored.
79
+ *
80
+ * If any listener throws, the await rejects, and the error is
81
+ * caught by the nearest error handler, if one exists.
82
+ */
83
+ export const serverEvents: ServerEvents;
84
+ }
85
+ declare module "packages/commander/src/BaseCommand" {
86
+ import * as commander from "commander";
87
+ export type CommandClass = {
88
+ new (...args: ConstructorParameters<typeof BaseCommand<any, any>>): BaseCommand<any, any>;
89
+ };
90
+ export type CommandFile = {
91
+ Command: CommandClass;
92
+ info: CommandInfo;
93
+ };
94
+ /**
95
+ * The types for the BaseCommand are as follows:
96
+ *
97
+ * @example
98
+ *
99
+ * BaseCommand<Params, Options>
100
+ * type Params = string[]
101
+ * type Options = { [K: string]: string[] | boolean }
102
+ *
103
+ * @description
104
+ *
105
+ * - Params is all of the strings before the first option
106
+ * - Options is a hashmap of each option, with either a boolean, or an array of strings.
107
+ *
108
+ * The option declaration in info determines how it is parsed.
109
+ *
110
+ * - For options declared with an argument, the value will be an array.
111
+ * - If no value is given, the array will be empty.
112
+ * - If the option is not present in the cli, it will not be added to the hashmap.
113
+ * - For options declared without an argument, the value will be true or it will not be present.
114
+ *
115
+ *
116
+ */
117
+ export abstract class BaseCommand<P extends string[] = string[], O extends object = object> {
118
+ params: P;
119
+ options: O;
120
+ constructor(params: P, options: O);
121
+ abstract execute(): Promise<any>;
122
+ }
123
+ export interface CommandInfo {
124
+ name: string;
125
+ description: string;
126
+ /** The values end up as an array in this.params, so the order is important. */
127
+ arguments: [string, string][];
128
+ /** The values end up in a hashmap of "key": "value", so order is only used in the help. */
129
+ options?: [string, string][];
130
+ internal?: boolean;
131
+ getHelp?: () => string;
132
+ command?(program: commander.Command): commander.Command;
133
+ }
134
+ }
135
+ declare module "packages/commander/src/runCLI" {
136
+ import { BaseCommand, CommandFile } from "packages/commander/src/BaseCommand";
137
+ import * as commander from "commander";
138
+ module "packages/events/src/index" {
139
+ interface ServerEventsMap {
140
+ "cli.register": [commands: Record<string, CommandFile>];
141
+ "cli.commander": [commander.Command];
142
+ "cli.execute.before": [
143
+ name: string,
144
+ params: string[],
145
+ options: Record<string, string | boolean>,
146
+ instance: BaseCommand
147
+ ];
148
+ "cli.execute.after": [
149
+ name: string,
150
+ params: string[],
151
+ options: Record<string, string | boolean>,
152
+ instance: BaseCommand
153
+ ];
154
+ }
155
+ }
156
+ /**
157
+ * Run the following events in order:
158
+ *
159
+ * - `"cli.register"`
160
+ * - `"cli.commander"`
161
+ * - End here if help is requested or no command is specified
162
+ * - `"cli.execute.before"`
163
+ * - The specified command's `execute` method
164
+ * - `"cli.execute.after"`
165
+ */
166
+ export function runCLI(): Promise<undefined>;
167
+ }
168
+ declare module "packages/commander/src/index" {
169
+ export * from "packages/commander/src/BaseCommand";
170
+ export * from "packages/commander/src/runCLI";
171
+ }
172
+ declare module "packages/server/src/utils" {
173
+ export function is<T>(a: any, b: boolean): a is T;
174
+ /** Initiates a timer that must get cancelled before the current turn of the event loop ends */
175
+ export class SyncCheck {
176
+ done: () => void;
177
+ constructor();
178
+ }
179
+ /**
180
+ * If any property returns a function, and that function returns a promise,
181
+ * the proxy will throw an error if the promise is not awaited before the next property access.
182
+ *
183
+ * The stack trace of the error will point to the line where the promise was returned.
184
+ */
185
+ export function createStrictAwaitProxy<T extends object>(instance: T): T;
186
+ export function tryParseJSON<T>(json: string): T | undefined;
187
+ export class TypedGenerator<T extends [any, any][]> {
188
+ private inner;
189
+ private index;
190
+ static checker<T extends [any, any][]>(): {
191
+ /** `const value1 = asV(1, yield asY(0, value0))` */
192
+ asV<I extends number>(index: I, args: T[I][0]): T[I][0];
193
+ /** `const value1 = asV(1, yield asY(0, value0))` */
194
+ asY<I extends number>(index: I, ret: T[I][1]): T[I][1];
195
+ };
196
+ static wrapper<T extends [any, any][]>(): <A extends any[]>(factory: (...args: A) => Generator<any, any, any>) => (...args: A) => TypedGenerator<T>;
197
+ constructor(inner: Generator<any, any, any>, index?: number);
198
+ next<I extends number>(index: I, ...args: T[I][0] extends void ? [] : [T[I][0]]): Promise<(T extends [...any[], T[I]] ? IteratorReturnResult<T[I][1]> : IteratorYieldResult<T[I][1]>)>;
199
+ return(value: any): any;
200
+ throw(e: any): any;
201
+ }
202
+ export function mapAsync<T, U, V>(array: T[], callback: (this: V, value: T, index: number, array: T[]) => Promise<U>, thisArg?: any): Promise<U[]>;
203
+ export function filterAsync<T, V>(array: T[], callback: (this: V, value: T, index: number, array: T[]) => Promise<boolean>, thisArg?: any): Promise<T[]>;
204
+ export class UserError extends Error {
205
+ constructor(message: string);
206
+ }
207
+ /**
208
+ * This returns the resolved path relative to the executing code file,
209
+ * however it uses path.resolve, not require.resolve.
210
+ */
211
+ export function dist_resolve(filepath: string): string;
212
+ export function dist_require_resolve(filepath: string): string;
213
+ export interface JsonArray extends Array<JsonValue> {
214
+ }
215
+ export type JsonObject = {
216
+ [Key in string]?: JsonValue;
217
+ };
218
+ export type JsonValue = string | number | boolean | JsonObject | JsonArray | null | Date;
219
+ }
220
+ declare module "packages/server/src/compression" {
221
+ /*!
222
+ * compression
223
+ * Copyright(c) 2010 Sencha Inc.
224
+ * Copyright(c) 2011 TJ Holowaychuk
225
+ * Copyright(c) 2014 Jonathan Ong
226
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
227
+ * MIT Licensed
228
+ */
229
+ import { DuplexOptions, PassThrough } from "stream";
230
+ import zlib, { BrotliOptions, ZlibOptions } from 'zlib';
231
+ export interface CompressorOptions {
232
+ /** Opts passed to brotli. The default quality param is 4. */
233
+ brotli?: BrotliOptions;
234
+ /** Opts passed to gzip */
235
+ gzip?: ZlibOptions;
236
+ /** Opts passed to deflate */
237
+ deflate?: ZlibOptions;
238
+ /** options to pass to the Passthrough stream used for identity encoding. */
239
+ identity?: DuplexOptions;
240
+ /**
241
+ * source threshold below which to skip compression.
242
+ * only works if content-length header is set.
243
+ *
244
+ * If a string, may be any number with a byte suffix (kb, mb, etc).
245
+ */
246
+ threshold?: number | string;
247
+ /** use a specific encoding if the accept-encoding header is not present, defaults to identity */
248
+ defaultEncoding?: 'br' | 'gzip' | 'deflate' | 'identity';
249
+ }
250
+ export class Compressor {
251
+ private req;
252
+ private res;
253
+ constructor(req: import("http").IncomingMessage | import("http2").Http2ServerRequest, res: import("http").ServerResponse | import("http2").Http2ServerResponse, { identity, brotli, threshold, defaultEncoding, deflate, gzip }: CompressorOptions);
254
+ /** Ends the response. Shortcut for easy removal when switching streams. */
255
+ finisher: () => import("http").ServerResponse<import("http").IncomingMessage> | import("http2").Http2ServerResponse<import("http2").Http2ServerRequest>;
256
+ enabled: boolean;
257
+ method: string;
258
+ threshold: any;
259
+ defaultEncoding: "deflate" | "gzip" | "br" | "identity";
260
+ ended: boolean;
261
+ createStream: (method: string) => PassThrough;
262
+ length: number;
263
+ listeners: any[] | null;
264
+ stream: PassThrough | zlib.Gzip | zlib.BrotliCompress | zlib.Deflate | undefined;
265
+ shouldCompress(): boolean;
266
+ /** This checks all of the headers that have been already set and sets up encoding. */
267
+ beforeWriteHead(): void;
268
+ splitStream(): Promise<void>;
269
+ getEncodingMethod(supportedEncoding: readonly ('br' | 'gzip' | 'deflate' | 'identity')[]): 'br' | 'gzip' | 'deflate' | 'identity' | 'gzip-stream' | '';
270
+ }
271
+ }
272
+ declare module "packages/server/src/streamer" {
273
+ import * as http2 from 'node:http2';
274
+ import { SendOptions } from 'send';
275
+ import { Readable } from 'stream';
276
+ import { IncomingMessage, ServerResponse, IncomingHttpHeaders as NodeIncomingHeaders, OutgoingHttpHeaders } from 'node:http';
277
+ import { Writable } from 'node:stream';
278
+ import { Compressor } from "packages/server/src/compression";
279
+ module 'node:net' {
280
+ interface Socket {
281
+ /** Not defined on net.Socket instances.
282
+ *
283
+ * On tls.Socket instances, */
284
+ encrypted?: boolean;
285
+ }
286
+ }
287
+ export interface IncomingHttpHeaders extends NodeIncomingHeaders {
288
+ "x-requested-with"?: string;
289
+ }
290
+ export const SYMBOL_IGNORE_ERROR: unique symbol;
291
+ export interface SendFileOptions extends Omit<SendOptions, "root" | "dotfiles" | "index" | "start" | "end"> {
292
+ root: string;
293
+ reqpath: string;
294
+ offset?: number;
295
+ length?: number;
296
+ on404?: () => Promise<typeof STREAM_ENDED>;
297
+ onDir?: () => Promise<typeof STREAM_ENDED>;
298
+ /** Index file to send, defaults to false. */
299
+ index?: SendOptions["index"];
300
+ /** @deprecated not implemented */
301
+ prefix?: Buffer;
302
+ /** @deprecated not implemented */
303
+ suffix?: Buffer;
304
+ }
305
+ export type StreamerChunk = {
306
+ data: string;
307
+ encoding: NodeJS.BufferEncoding;
308
+ } | NodeJS.ReadableStream | Readable | Buffer;
309
+ /**
310
+ * The HTTP2 shims used in the request handler are only used for HTTP2 requests.
311
+ * The NodeJS HTTP2 server actually calls the HTTP1 parser for all HTTP1 requests.
312
+ */
313
+ export class Streamer {
314
+ private req;
315
+ private res;
316
+ pathPrefix: string;
317
+ expectSecure: boolean;
318
+ host: string;
319
+ method: string;
320
+ urlInfo: URL;
321
+ url: string;
322
+ headers: IncomingHttpHeaders;
323
+ cookies: URLSearchParams;
324
+ compressor: Compressor;
325
+ constructor(req: IncomingMessage | http2.Http2ServerRequest, res: ServerResponse | http2.Http2ServerResponse, pathPrefix: string, expectSecure: boolean);
326
+ parseCookieString(cookieString: string): URLSearchParams;
327
+ get reader(): Readable;
328
+ get writer(): Writable;
329
+ throw(statusCode: number): void;
330
+ catcher: (error: unknown) => void;
331
+ checkHeadersSentBy(setError: boolean): void;
332
+ toHeadersMap(headers: {
333
+ [x: string]: string | string[] | number | undefined;
334
+ }): Map<string, string[]>;
335
+ readBody: () => Promise<Buffer<ArrayBufferLike>>;
336
+ sendEmpty(status: number, headers?: OutgoingHttpHeaders): typeof STREAM_ENDED;
337
+ sendString(status: number, headers: OutgoingHttpHeaders, data: string, encoding: NodeJS.BufferEncoding): typeof STREAM_ENDED;
338
+ sendBuffer(status: number, headers: OutgoingHttpHeaders, data: Buffer): typeof STREAM_ENDED;
339
+ /** If this is a HEAD request, the stream will be destroyed. */
340
+ sendStream(status: number, headers: OutgoingHttpHeaders, stream: Readable): typeof STREAM_ENDED;
341
+ private sendFD;
342
+ /**
343
+ * Sends a file with the appropriate cache headers, using the `send` npm module.
344
+ *
345
+ * Think of it like a static file server where you are serving files from a directory.
346
+ *
347
+ * @param options.root The directory to serve files from.
348
+ * @param options.reqpath The path to the file relative to the `root` directory.
349
+ * @param options.offset The offset in bytes to start reading the file from.
350
+ * @param options.length The number of bytes to read from the file.
351
+ * @param options.index "index.html" by default, to disable this set false or
352
+ * to supply a new index pass a string or an array in preferred order.
353
+ *
354
+ * If an index.html file is not found, `send` will NOT generate a directory listing.
355
+ *
356
+ * The `send` method will automatically set the `Content-Type` header based on the file extension.
357
+ *
358
+ * If the file is not found, the `send` method will automatically send a 404 response.
359
+ *
360
+
361
+ * @returns STREAM_ENDED
362
+ */
363
+ sendFile(status: number, headers: OutgoingHttpHeaders, options: SendFileOptions): Promise<typeof STREAM_ENDED>;
364
+ sendSSE(retryMilliseconds?: number): {
365
+ /** Emit an SSE event */
366
+ emitEvent: (eventName: string, eventData: any, eventId: string) => void;
367
+ emitComment: (comment: string) => void;
368
+ onClose: (callback: () => void) => void;
369
+ close: () => void;
370
+ };
371
+ setCookie(name: string, value: string, options: {
372
+ /**
373
+
374
+ Defines the host to which the cookie will be sent.
375
+
376
+ Only the current domain can be set as the value, or a domain of a higher order, unless it is a public suffix. Setting the domain will make the cookie available to it, as well as to all its subdomains.
377
+
378
+ If omitted, this attribute defaults to the host of the current document URL, not including subdomains.
379
+
380
+ Contrary to earlier specifications, leading dots in domain names (.example.com) are ignored.
381
+
382
+ Multiple host/domain values are not allowed, but if a domain is specified, then subdomains are always included.
383
+
384
+ */
385
+ domain?: string;
386
+ /**
387
+
388
+ Indicates the path that must exist in the requested URL for the browser to send the Cookie header.
389
+
390
+ The forward slash (`/`) character is interpreted as a directory separator, and subdirectories are matched as well.
391
+
392
+ For example, for `Path=/docs`,
393
+
394
+ - the request paths `/docs`,` /docs/`, `/docs/Web/`, and `/docs/Web/HTTP` will all match.
395
+ - the request paths `/`, `/docsets`, `/fr/docs` will not match.
396
+
397
+ */
398
+ path?: string;
399
+ expires?: Date;
400
+ maxAge?: number;
401
+ secure?: boolean;
402
+ httpOnly?: boolean;
403
+ /**
404
+ Controls whether or not a cookie is sent with cross-site requests: that is, requests originating from a different site, including the scheme, from the site that set the cookie. This provides some protection against certain cross-site attacks, including cross-site request forgery (CSRF) attacks.
405
+
406
+ The possible attribute values are:
407
+
408
+ ### Strict
409
+
410
+ Send the cookie only for requests originating from the same site that set the cookie.
411
+
412
+ ### Lax
413
+
414
+ Send the cookie only for requests originating from the same site that set the cookie, and for cross-site requests that meet both of the following criteria:
415
+
416
+ - The request is a top-level navigation: this essentially means that the request causes the URL shown in the browser's address bar to change.
417
+
418
+ - This would exclude, for example, requests made using the fetch() API, or requests for subresources from <img> or <script> elements, or navigations inside <iframe> elements.
419
+
420
+ - It would include requests made when the user clicks a link in the top-level browsing context from one site to another, or an assignment to document.location, or a <form> submission.
421
+
422
+ - The request uses a safe method: in particular, this excludes POST, PUT, and DELETE.
423
+
424
+ Some browsers use Lax as the default value if SameSite is not specified: see Browser compatibility for details.
425
+
426
+ > Note: When Lax is applied as a default, a more permissive version is used. In this more permissive version, cookies are also included in POST requests, as long as they were set no more than two minutes before the request was made.
427
+
428
+ ### None
429
+
430
+ Send the cookie with both cross-site and same-site requests. The Secure attribute must also be set when using this value.
431
+ */
432
+ sameSite?: "Strict" | "Lax" | "None";
433
+ }): void;
434
+ appendHeader(name: string, value: string): void;
435
+ setHeader(name: string, value: string): void;
436
+ writeHead(status: number, headers?: OutgoingHttpHeaders): void;
437
+ /**
438
+ * Write early hints using 103 Early Hints,
439
+ * silently ignored if the request version is prior to 2.
440
+ *
441
+ * Despite this being an HTTP/1.1 feature, not all browsers
442
+ * correctly implemented it, so this is commonly restricted
443
+ * to HTTP/2.
444
+ *
445
+ * @example
446
+ state.writeEarlyHints({
447
+ 'link': [
448
+ '</styles.css>; rel=preload; as=style',
449
+ '</scripts.js>; rel=preload; as=script',
450
+ ],
451
+ 'x-trace-id': 'id for diagnostics',
452
+ });
453
+ * @param hints
454
+ * @returns
455
+ */
456
+ writeEarlyHints(hints: Record<string, string | string[]>): void;
457
+ pause: boolean;
458
+ /** awaiting is not required. everything happens sync'ly */
459
+ write(chunk: Buffer | string, encoding?: NodeJS.BufferEncoding): Promise<void>;
460
+ end(): typeof STREAM_ENDED;
461
+ /** Destroy the transport stream and possibly the entire connection. */
462
+ destroy(): void;
463
+ get headersSent(): boolean;
464
+ headersSentBy: Error | undefined;
465
+ }
466
+ /**
467
+ * This can be used as the basis of state objects and exposes the
468
+ * relevant streamer interface without allowing private members to be exposed.
469
+ *
470
+ */
471
+ export class StreamerState {
472
+ protected streamer: Streamer;
473
+ readBody: () => Promise<Buffer<ArrayBufferLike>>;
474
+ sendEmpty: (status: number, headers?: OutgoingHttpHeaders) => typeof STREAM_ENDED;
475
+ sendString: (status: number, headers: OutgoingHttpHeaders, data: string, encoding: NodeJS.BufferEncoding) => typeof STREAM_ENDED;
476
+ sendBuffer: (status: number, headers: OutgoingHttpHeaders, data: Buffer) => typeof STREAM_ENDED;
477
+ sendStream: (status: number, headers: OutgoingHttpHeaders, stream: Readable) => typeof STREAM_ENDED;
478
+ sendFile: (status: number, headers: OutgoingHttpHeaders, options: SendFileOptions) => Promise<typeof STREAM_ENDED>;
479
+ sendSSE: (retryMilliseconds?: number) => {
480
+ /** Emit an SSE event */
481
+ emitEvent: (eventName: string, eventData: any, eventId: string) => void;
482
+ emitComment: (comment: string) => void;
483
+ onClose: (callback: () => void) => void;
484
+ close: () => void;
485
+ };
486
+ setCookie: (name: string, value: string, options: {
487
+ /**
488
+
489
+ Defines the host to which the cookie will be sent.
490
+
491
+ Only the current domain can be set as the value, or a domain of a higher order, unless it is a public suffix. Setting the domain will make the cookie available to it, as well as to all its subdomains.
492
+
493
+ If omitted, this attribute defaults to the host of the current document URL, not including subdomains.
494
+
495
+ Contrary to earlier specifications, leading dots in domain names (.example.com) are ignored.
496
+
497
+ Multiple host/domain values are not allowed, but if a domain is specified, then subdomains are always included.
498
+
499
+ */
500
+ domain?: string;
501
+ /**
502
+
503
+ Indicates the path that must exist in the requested URL for the browser to send the Cookie header.
504
+
505
+ The forward slash (`/`) character is interpreted as a directory separator, and subdirectories are matched as well.
506
+
507
+ For example, for `Path=/docs`,
508
+
509
+ - the request paths `/docs`,` /docs/`, `/docs/Web/`, and `/docs/Web/HTTP` will all match.
510
+ - the request paths `/`, `/docsets`, `/fr/docs` will not match.
511
+
512
+ */
513
+ path?: string;
514
+ expires?: Date;
515
+ maxAge?: number;
516
+ secure?: boolean;
517
+ httpOnly?: boolean;
518
+ /**
519
+ Controls whether or not a cookie is sent with cross-site requests: that is, requests originating from a different site, including the scheme, from the site that set the cookie. This provides some protection against certain cross-site attacks, including cross-site request forgery (CSRF) attacks.
520
+
521
+ The possible attribute values are:
522
+
523
+ ### Strict
524
+
525
+ Send the cookie only for requests originating from the same site that set the cookie.
526
+
527
+ ### Lax
528
+
529
+ Send the cookie only for requests originating from the same site that set the cookie, and for cross-site requests that meet both of the following criteria:
530
+
531
+ - The request is a top-level navigation: this essentially means that the request causes the URL shown in the browser's address bar to change.
532
+
533
+ - This would exclude, for example, requests made using the fetch() API, or requests for subresources from <img> or <script> elements, or navigations inside <iframe> elements.
534
+
535
+ - It would include requests made when the user clicks a link in the top-level browsing context from one site to another, or an assignment to document.location, or a <form> submission.
536
+
537
+ - The request uses a safe method: in particular, this excludes POST, PUT, and DELETE.
538
+
539
+ Some browsers use Lax as the default value if SameSite is not specified: see Browser compatibility for details.
540
+
541
+ > Note: When Lax is applied as a default, a more permissive version is used. In this more permissive version, cookies are also included in POST requests, as long as they were set no more than two minutes before the request was made.
542
+
543
+ ### None
544
+
545
+ Send the cookie with both cross-site and same-site requests. The Secure attribute must also be set when using this value.
546
+ */
547
+ sameSite?: "Strict" | "Lax" | "None";
548
+ }) => void;
549
+ /**
550
+ *
551
+ * Sets a single header value. If the header already exists in the to-be-sent
552
+ * headers, its value will be replaced. Use an array of strings to send multiple
553
+ * headers with the same name
554
+ *
555
+ * When headers have been set with `response.setHeader()`, they will be merged
556
+ * with any headers passed to `response.writeHead()`, with the headers passed
557
+ * to `response.writeHead()` given precedence.
558
+ *
559
+ */
560
+ setHeader: (name: string, value: string) => void;
561
+ writeHead: (status: number, headers?: OutgoingHttpHeaders) => void;
562
+ writeEarlyHints: (hints: Record<string, string | string[]>) => void;
563
+ write: (chunk: Buffer | string, encoding?: NodeJS.BufferEncoding) => Promise<void>;
564
+ end: () => typeof STREAM_ENDED;
565
+ /**
566
+ * this will pipe from the specified stream, but will not end the
567
+ * response when the input stream ends. Input stream errors will be
568
+ * caught and reject the promise. The promise will resolve once the
569
+ * input stream ends.
570
+ */
571
+ pipeFrom(stream: Readable): Promise<void>;
572
+ /** sends a status and plain text string body */
573
+ sendSimple(status: number, msg: string): typeof STREAM_ENDED;
574
+ /** Stringify the value (unconditionally) and send it with content-type `application/json` */
575
+ sendJSON<T>(status: number, obj: T): typeof STREAM_ENDED;
576
+ /** End the compression stream, flushing the rest of the compressed data, then begin a brand new stream to concatenate. */
577
+ splitCompressionStream(): Promise<void>;
578
+ STREAM_ENDED: typeof STREAM_ENDED;
579
+ constructor(streamer: Streamer);
580
+ get url(): string;
581
+ get method(): string;
582
+ get headers(): IncomingHttpHeaders;
583
+ get host(): string;
584
+ get urlInfo(): URL;
585
+ get headersSent(): boolean;
586
+ get reader(): Readable;
587
+ get cookies(): URLSearchParams;
588
+ /** This is based on the listener either having a key + cert or having secure set */
589
+ get expectSecure(): boolean;
590
+ /**
591
+ * The path prefix is a essentially folder mount point.
592
+ *
593
+ * It starts with a slash, and ends without a slash (`"/dev"`).
594
+ *
595
+ * If there is not a prefix, it is an empty string (`""`).
596
+ */
597
+ get pathPrefix(): string;
598
+ }
599
+ }
600
+ declare module "packages/server/src/StateObject" {
601
+ import { Streamer, StreamerState } from "packages/server/src/streamer";
602
+ import { BodyFormat, Router } from "packages/server/src/router";
603
+ import { RouteMatch } from "packages/server/src/router";
604
+ import { IncomingHttpHeaders } from 'http';
605
+ export interface ServerRequest<B extends BodyFormat = BodyFormat, M extends string = string, D = unknown> extends ServerRequestClass<B, M, D> {
606
+ }
607
+ export class ServerRequestClass<B extends BodyFormat = BodyFormat, M extends string = string, D = unknown> extends StreamerState {
608
+ /** The bodyformat that ended up taking precedence. This should be correctly typed. */
609
+ bodyFormat: B;
610
+ protected router: Router;
611
+ get method(): M;
612
+ data: B extends "string" ? string : B extends "buffer" ? Buffer : B extends "www-form-urlencoded-urlsearchparams" ? URLSearchParams : B extends "stream" ? undefined : B extends "ignore" ? undefined : D;
613
+ /**
614
+ * an *object from entries* of all the pathParams in the tree mapped to the path regex matches from that route.
615
+ *
616
+ * Object.fromEntries takes the last value if there are duplicates, so conflicting names will have the last value in the path.
617
+ *
618
+ * Conflicting names would be defined on the route definitions, so just change the name there if there is a conflict.
619
+ *
620
+ * pathParams are parsed with `decodeURIComponent` one time.
621
+ */
622
+ pathParams: Record<string, string | undefined>;
623
+ /**
624
+ * The query params. Because these aren't checked anywhere,
625
+ * the value includes undefined since it will be that if
626
+ * the key is not specified at all.
627
+ *
628
+ * This will always satisfy the zod schema: `z.record(z.string(), z.array(z.string()))`
629
+ */
630
+ queryParams: Record<string, string[] | undefined>;
631
+ constructor(streamer: Streamer,
632
+ /** The array of Route tree nodes the request matched. */
633
+ routePath: RouteMatch[],
634
+ /** The bodyformat that ended up taking precedence. This should be correctly typed. */
635
+ bodyFormat: B, router: Router);
636
+ /** type-narrowing helper function. This affects anywhere T is used. */
637
+ isBodyFormat<T extends B, S extends {
638
+ [K in B]: ServerRequest<K, M, D>;
639
+ }[T]>(format: T): this is S;
640
+ /**
641
+ * Checks the request and response headers and calculates the appropriate
642
+ * encoding to use for the response. This may be checked early if you
643
+ * can only support a subset of normal encodings or have precompressed data.
644
+ */
645
+ acceptsEncoding(encoding: ('br' | 'gzip' | 'deflate' | 'identity')[]): "" | "deflate" | "gzip" | "br" | "identity" | "gzip-stream";
646
+ /**
647
+ *
648
+ * Sends a **302** status code and **Location** header to the client.
649
+ *
650
+ * This will add the path prefix to the redirect path
651
+ *
652
+ * - **301 Moved Permanently:** The resource has been permanently moved to a new URL.
653
+ * - **302 Found:** The resource is temporarily located at a different URL.
654
+ * - **303 See Other:** Fetch the resource from another URI using a GET request.
655
+ * - **307 Temporary Redirect:** The resource is temporarily located at a different URL; the same HTTP method should be used.
656
+ * - **308 Permanent Redirect:** The resource has permanently moved; the client should use the new URL in future requests.
657
+ */
658
+ redirect(location: string): typeof STREAM_ENDED;
659
+ /**
660
+ Options include:
661
+ - `cbPartStart(headers,name,filename)` - invoked when a file starts being received
662
+ - `cbPartChunk(chunk)` - invoked when a chunk of a file is received
663
+ - `cbPartEnd()` - invoked when a file finishes being received
664
+ - `cbFinished(err)` - invoked when the all the form data has been processed, optional,
665
+ as it is called immediately before resolving or rejecting the promise.
666
+ The promise will reject with err if there is an error.
667
+ */
668
+ readMultipartData(this: ServerRequest<any, any>, options: {
669
+ cbPartStart: (headers: IncomingHttpHeaders, name: string | null, filename: string | null) => void;
670
+ cbPartChunk: (chunk: Buffer) => void;
671
+ cbPartEnd: () => void;
672
+ cbFinished?: (err: Error | string | null) => void;
673
+ }): Promise<void>;
674
+ }
675
+ }
676
+ declare module "packages/server/src/zodRoute" {
677
+ import { JsonValue } from "packages/server/src/utils";
678
+ import { BodyFormat } from "packages/server/src/router";
679
+ import { ServerRequest } from "packages/server/src/StateObject";
680
+ import { RouteDef } from "packages/server/src/router";
681
+ import { Z2, zod as z } from "packages/server/src/Z2";
682
+ import * as core from "zod/v4/core";
683
+ export function zodRoute<M extends string, B extends "GET" | "HEAD" extends M ? "ignore" : BodyFormat, P extends Record<string, z.ZodType<any, string | undefined>>, Q extends Record<string, z.ZodType<any, string[] | undefined>>, T extends z.ZodTypeAny, R extends JsonValue>(route: ZodRoute<M, B, P, Q, T, R>): ZodRoute<M, B, P, Q, T, R>;
684
+ export type FieldTypeGroups = "STRING" | "JSON";
685
+ export interface ZodRoute<M extends string, B extends BodyFormat, P extends Record<string, z.ZodType<any, string | undefined>>, Q extends Record<string, z.ZodType<any, string[] | undefined>>, T extends z.ZodTypeAny, R extends JsonValue> {
686
+ /**
687
+ * The input will be `Record<string, string>`
688
+ * If a path variable is not set in the request, the path will not match.
689
+ *
690
+ * Expects a Record of zod checks. Every path variable must be included.
691
+ *
692
+ * pathParams are parsed with `decodeURIComponent` one time before being passed to the zod check.
693
+ */
694
+ zodPathParams: (z: Z2<"STRING">) => P;
695
+ /**
696
+ * The input will be `Record<string, string[]>`.
697
+ * If a value is not set, an empty string is used.
698
+ *
699
+ * Expects a Record of zod checks.
700
+ *
701
+ * The default behavior is to remove all query params.
702
+ */
703
+ zodQueryParams?: (z: Z2<"STRING">) => Q;
704
+ /**
705
+ * CORS preflight requests do not include credentials or request headers,
706
+ * so you can't authenticate requests. It is a way to provide information about the endpoint.
707
+ *
708
+ * Be careful, because if you specify the same route with different methods, and set corsRequest
709
+ * on more than one, because only the first one will actually be called.
710
+ */
711
+ corsRequest?: (state: ZodState<"OPTIONS", "ignore", P, Q, z.ZodUndefined>) => Promise<typeof STREAM_ENDED>;
712
+ /**
713
+ * A zod check of the request body result.
714
+ *
715
+ * Only valid for `string`, `json`, and `www-form-urlencoded` body types
716
+ *
717
+ * The default is `undefined` for those types.
718
+ */
719
+ zodRequestBody?: (z: B extends "www-form-urlencoded" ? Z2<"STRING"> : B extends "json" ? Z2<"JSON"> : Z2<any>) => T;
720
+ securityChecks?: RouteDef["securityChecks"];
721
+ method: M[];
722
+ path: string;
723
+ bodyFormat: B;
724
+ inner: (state: {
725
+ [K in M]: ZodState<K, B, P, Q, T>;
726
+ }[M]) => Promise<R>;
727
+ }
728
+ export interface ZodState<M extends string, B extends BodyFormat, P extends Record<string, z.ZodType<any, string | undefined>>, Q extends Record<string, z.ZodType<any, string[] | undefined>>, T extends z.ZodTypeAny> extends ServerRequest<B, M, z.output<T>> {
729
+ pathParams: z.output<z.ZodObject<P, core.$strict>> & Record<string, any>;
730
+ queryParams: z.output<z.ZodObject<Q, core.$strict>> & Record<string, any>;
731
+ }
732
+ export type RouterRouteMap<T> = {
733
+ [K in keyof T as T[K] extends ZodRoute<any, any, any, any, any, any> ? K : never]: T[K] extends ZodRoute<any, any, any, any, infer REQ, infer RES> ? ((data: z.input<REQ>) => Promise<jsonify<RES>>) : `${K & string} does not extend`;
734
+ };
735
+ export type jsonify<T> = T extends void ? null : T extends Promise<any> ? unknown : T extends Date ? string : T extends string | number | boolean | null | undefined ? T : T extends [...any[]] ? number extends T["length"] ? jsonify<T[number]>[] : [...jsonifyTuple<T>] : T extends Array<infer U> ? jsonify<U>[] : T extends object ? {
736
+ [K in keyof T]: jsonify<T[K]>;
737
+ } : unknown;
738
+ export type jsonifyTuple<T> = T extends [infer A, ...infer B] ? [jsonify<A>, ...jsonifyTuple<B>] : T extends [infer A] ? [jsonify<A>] : [];
739
+ export type RouterKeyMap<T, V> = {
740
+ [K in keyof T as T[K] extends ZodRoute<any, any, any, any, any, any> ? K : never]: V;
741
+ };
742
+ }
743
+ declare module "packages/server/src/Z2" {
744
+ import * as z4 from "zod/v4";
745
+ import { FieldTypeGroups } from "packages/server/src/zodRoute";
746
+ export type _zod = typeof z4;
747
+ export interface Z2<T extends FieldTypeGroups> extends _zod {
748
+ }
749
+ export { z4 as zod };
750
+ export const Z2: Z2<any>;
751
+ }
752
+ declare module "packages/server/src/listeners" {
753
+ import { IncomingMessage, Server, ServerResponse } from "node:http";
754
+ import { Http2SecureServer, Http2ServerRequest, Http2ServerResponse } from "node:http2";
755
+ import { Router } from "packages/server/src/router";
756
+ export class ListenerBase {
757
+ server: Http2SecureServer | Server;
758
+ router: Router;
759
+ bindInfo: string;
760
+ options: ListenOptions;
761
+ constructor(server: Http2SecureServer | Server, router: Router, bindInfo: string, options: ListenOptions);
762
+ handleRequest(req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse): void;
763
+ }
764
+ export class ListenerHTTPS extends ListenerBase {
765
+ constructor(router: Router, config: ListenOptions);
766
+ }
767
+ export class ListenerHTTP extends ListenerBase {
768
+ /** Create an http1 server */
769
+ constructor(router: Router, config: ListenOptions);
770
+ }
771
+ export interface ListenOptions {
772
+ port?: string;
773
+ host?: string;
774
+ prefix?: string;
775
+ key?: string;
776
+ cert?: string;
777
+ secure?: boolean;
778
+ redirect?: number;
779
+ }
780
+ }
781
+ declare module "packages/server/src/router" {
782
+ import { zod } from "packages/server/src/Z2";
783
+ import { ServerRequest, ServerRequestClass } from "packages/server/src/StateObject";
784
+ import { Streamer } from "packages/server/src/streamer";
785
+ import { IncomingMessage, ServerResponse } from "node:http";
786
+ import { Http2ServerRequest, Http2ServerResponse } from "node:http2";
787
+ import { ListenOptions } from "packages/server/src/listeners";
788
+ export class Router {
789
+ rootRoute: ServerRoute;
790
+ allowedRequestedWithHeaders: string[];
791
+ constructor(rootRoute: ServerRoute);
792
+ handle(req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse, options: ListenOptions): void;
793
+ handleRequest(req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse, options: ListenOptions): Promise<void>;
794
+ handleStreamer(streamer: Streamer): Promise<void | typeof STREAM_ENDED>;
795
+ /**
796
+ * This is for overriding the server request that gets created. It is not async.
797
+ * If you need to do anything substantial, use the server events.
798
+ */
799
+ createServerRequest<B extends BodyFormat>(streamer: Streamer,
800
+ /** The array of Route tree nodes the request matched. */
801
+ routePath: RouteMatch[],
802
+ /** The bodyformat that ended up taking precedence. This should be correctly typed. */
803
+ bodyFormat: B): ServerRequestClass<B, string, unknown>;
804
+ handleRoute(state: ServerRequest<BodyFormat>, route: RouteMatch[]): Promise<void>;
805
+ findRouteRecursive(routes: ServerRoute[], testPath: string, method: string | null, returnAll: boolean): RouteMatch[][];
806
+ /**
807
+ *
808
+ * Top-level function that starts matching from the root routes.
809
+ * Notice that the pathPrefix is assumed to have been handled beforehand.
810
+ *
811
+ * @param streamer
812
+ * @returns The tree path matched
813
+ */
814
+ findRoute(streamer: Streamer): RouteMatch[];
815
+ }
816
+ export interface RouteMatch {
817
+ route: ServerRoute;
818
+ params: (string | undefined)[];
819
+ remainingPath: string;
820
+ }
821
+ export const zodTransformJSON: (arg: string, ctx: zod.RefinementCtx) => any;
822
+ export const BodyFormats: readonly ["stream", "string", "json", "buffer", "www-form-urlencoded", "www-form-urlencoded-urlsearchparams", "ignore"];
823
+ export type BodyFormat = (typeof BodyFormats)[number];
824
+ export interface RouteDef {
825
+ /**
826
+ * Regex to test the pathname on. It must start with `^`. If this is a child route,
827
+ * it will be tested against the remaining portion of the parent route.
828
+ */
829
+ path: RegExp;
830
+ pathParams?: string[];
831
+ /**
832
+ * The uppercase method names to match this route.
833
+ *
834
+ * If the array is empty and denyFinal is true, it will match all methods.
835
+ *
836
+ * If the array is empty and denyFinal is false, it will throw an error.
837
+ */
838
+ method: string[];
839
+ /**
840
+ * The highest bodyformat in the chain always takes precedent. Type-wise, only one is allowed,
841
+ * but at runtime the first one found is the one used.
842
+ *
843
+ * Note that bodyFormat is completely ignored for GET and HEAD requests.
844
+ */
845
+ bodyFormat?: BodyFormat;
846
+ /** If this route is the last one matched, it will NOT be called, and a 404 will be returned. */
847
+ denyFinal?: boolean;
848
+ securityChecks?: {
849
+ /**
850
+ * If true, the request must have the "x-requested-with" header set to "XMLHttpRequest".
851
+ * This is a common way to check if the request is an AJAX request.
852
+ * If the header is not set, the request will be rejected with a 403 Forbidden.
853
+ */
854
+ requestedWithHeader?: boolean;
855
+ };
856
+ }
857
+ export interface ServerRoute extends RouteDef {
858
+ /**
859
+ * If this route's handler sends headers, the matched child route will not be called.
860
+ */
861
+ handler: (state: ServerRequest) => Promise<typeof STREAM_ENDED>;
862
+ /**
863
+ * ### ROUTING
864
+ *
865
+ * @param route The route definition.
866
+ *
867
+ * If the parent route sends headers, or returns the STREAM_ENDED symbol,
868
+ * this route will not be called.
869
+ *
870
+ * Inner routes are matched on the remaining portion of the parent route
871
+ * using `pathname.slice(match[0].length)`. If the parent route entirely
872
+ * matches the pathname, this route will be matched on "/".
873
+ *
874
+ * If the body format is "stream", "buffer", "ignore" or not yet defined at this level in the tree,
875
+ * then zod cannot be used.
876
+ *
877
+ * Note that GET and HEAD are always bodyFormat: "ignore", regardless of what is set here.
878
+ */
879
+ defineRoute: (route: RouteDef, handler: (state: ServerRequest) => Promise<symbol | void>) => ServerRoute;
880
+ }
881
+ export const ROOT_ROUTE: unique symbol;
882
+ export function createRootRoute(method: string[], handler: (state: ServerRequest) => void): any;
883
+ }
884
+ declare module "packages/server/src/zodRegister" {
885
+ import { ServerRequest } from "packages/server/src/StateObject";
886
+ import { Z2 } from "packages/server/src/Z2";
887
+ import { ServerRoute } from "packages/server/src/router";
888
+ import { zod } from "packages/server/src/index";
889
+ import * as core from "zod/v4/core";
890
+ export const registerZodRoutes: (parent: ServerRoute, router: any, keys: string[]) => void;
891
+ export function checkData<T extends core.$ZodType>(state: ServerRequest, zodRequestBody: (z: Z2<any>) => T): asserts state is ServerRequest & {
892
+ data: zod.infer<T>;
893
+ };
894
+ export function checkQuery<T extends {
895
+ [x: string]: core.$ZodType<unknown, string[] | undefined>;
896
+ }>(state: ServerRequest, zodQueryParams: (z: Z2<"STRING">) => T): asserts state is ServerRequest & {
897
+ queryParams: zod.infer<zod.ZodObject<T>>;
898
+ };
899
+ export function checkPath<T extends {
900
+ [x: string]: core.$ZodType<unknown, string | undefined>;
901
+ }>(state: ServerRequest, zodPathParams: (z: Z2<"STRING">) => T): asserts state is ServerRequest & {
902
+ pathParams: zod.infer<zod.ZodObject<T>>;
903
+ };
904
+ }
905
+ declare module "packages/server/src/index" {
906
+ import { Router, type RouteMatch } from "packages/server/src/router";
907
+ import { ListenerHTTP, ListenerHTTPS, ListenOptions } from "packages/server/src/listeners";
908
+ import type { Streamer } from "packages/server/src/streamer";
909
+ import type { IncomingMessage, ServerResponse } from "http";
910
+ import type { Http2ServerRequest, Http2ServerResponse } from "http2";
911
+ import type { ServerRequest } from "packages/server/src/StateObject";
912
+ import { Z2 } from "packages/server/src/Z2";
913
+ export * from "packages/server/src/listeners";
914
+ export * from "packages/server/src/router";
915
+ export * from "packages/server/src/StateObject";
916
+ export * from "packages/server/src/streamer";
917
+ export * from "packages/server/src/utils";
918
+ export * from "packages/server/src/zodRegister";
919
+ export * from "packages/server/src/zodRoute";
920
+ export * from "packages/server/src/Z2";
921
+ /**
922
+ *
923
+ * Runs the following events in order:
924
+ * - `"zod.make"`
925
+ */
926
+ export function startup(): Promise<void>;
927
+ export function startListening(router: Router, options?: ListenOptions[]): Promise<(ListenerHTTPS | ListenerHTTP)[]>;
928
+ module "packages/events/src/index" {
929
+ interface ServerEventsMap {
930
+ "zod.make": [zod: Z2<any>];
931
+ "request.middleware": [router: Router, req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse, options: ListenOptions];
932
+ "request.streamer": [router: Router, streamer: Streamer];
933
+ "request.state": [router: Router, state: ServerRequest, streamer: Streamer];
934
+ "request.handle": [state: ServerRequest, route: RouteMatch[]];
935
+ "request.fallback": [state: ServerRequest, route: RouteMatch[]];
936
+ "exit": [];
937
+ }
938
+ }
939
+ global {
940
+ const STREAM_ENDED: unique symbol;
941
+ }
942
+ }
943
+ declare module "packages/mws/src/services/PasswordService" {
944
+ import { TypedGenerator } from "packages/server/src/index";
945
+ export type PasswordService = Awaited<ReturnType<typeof createPasswordService>>;
946
+ export function createPasswordService(serverSetup: string): Promise<{
947
+ serverState: Map<string, TypedGenerator<LoginGeneratorStates>>;
948
+ LoginGenerator: (args_0: {
949
+ user_id: PrismaField<"Users", "user_id">;
950
+ startLoginRequest: string;
951
+ registrationRecord: string;
952
+ }) => TypedGenerator<LoginGeneratorStates>;
953
+ PasswordCreation: (userID: string, password: string) => Promise<string & {
954
+ __prisma_table: "Users";
955
+ __prisma_field: "password";
956
+ }>;
957
+ createRegistrationResponse: ({ userID, registrationRequest }: {
958
+ userID: PrismaField<"Users", "user_id">;
959
+ registrationRequest: string;
960
+ }) => Promise<string>;
961
+ startLoginSession: (stater: TypedGenerator<LoginGeneratorStates>) => Promise<string>;
962
+ finishLoginSession: (loginSession: string) => Promise<TypedGenerator<LoginGeneratorStates> | undefined>;
963
+ }>;
964
+ type LoginGeneratorStates = [
965
+ [
966
+ void,
967
+ loginResponse: string
968
+ ],
969
+ [
970
+ finishLoginRequest: string,
971
+ {
972
+ user_id: PrismaField<"Users", "user_id">;
973
+ session: {
974
+ sessionKey: string;
975
+ } | undefined;
976
+ }
977
+ ]
978
+ ];
979
+ }
980
+ declare module "packages/mws/src/services/cache" {
981
+ import { TW } from "tiddlywiki";
982
+ export function startupCache($tw: TW, cachePath: string): Promise<{
983
+ pluginFiles: Map<string, string>;
984
+ pluginHashes: Map<string, string>;
985
+ filePlugins: Map<string, string>;
986
+ requiredPlugins: string[];
987
+ cachePath: string;
988
+ prefix: Buffer<ArrayBuffer>;
989
+ suffix: Buffer<ArrayBuffer>;
990
+ }>;
991
+ export type CacheState = ART<typeof startupCache>;
992
+ }
993
+ declare module "packages/mws/src/ServerState" {
994
+ import { PrismaClient, Prisma } from "prisma-client";
995
+ import { ITXClientDenyList } from "prisma-client/runtime/library";
996
+ import { TW } from "tiddlywiki";
997
+ import { createPasswordService } from "packages/mws/src/services/PasswordService";
998
+ import { startupCache } from "packages/mws/src/services/cache";
999
+ import { Types } from "prisma-client/runtime/library";
1000
+ /** This is an alias for ServerState in case we want to separate the two purposes. */
1001
+ export type SiteConfig = ServerState;
1002
+ export class ServerState {
1003
+ engine: PrismaEngineClient;
1004
+ PasswordService: PasswordService;
1005
+ pluginCache: TiddlerCache;
1006
+ constructor({ wikiPath, cachePath, storePath }: {
1007
+ wikiPath: string;
1008
+ cachePath: string;
1009
+ storePath: string;
1010
+ },
1011
+ /** The $tw instance needs to be disposable once commands are complete. */
1012
+ $tw: TW, engine: PrismaEngineClient, PasswordService: PasswordService, pluginCache: TiddlerCache);
1013
+ settings: {
1014
+ key: string;
1015
+ description: string;
1016
+ valueType: "string" | "boolean" | "number";
1017
+ value?: any;
1018
+ }[];
1019
+ init(): Promise<void>;
1020
+ initSettings(existing: Record<string, string>): Promise<void>;
1021
+ $transaction<R>(fn: (prisma: Omit<ServerState["engine"], ITXClientDenyList>) => Promise<R>, options?: {
1022
+ maxWait?: number;
1023
+ timeout?: number;
1024
+ isolationLevel?: Prisma.TransactionIsolationLevel;
1025
+ }): Promise<R>;
1026
+ $transactionTupleDebug<P extends Prisma.PrismaPromise<any>[]>(fn: (prisma: PrismaTxnClient) => [...P], options?: {
1027
+ isolationLevel?: Prisma.TransactionIsolationLevel;
1028
+ }): Promise<Types.Utils.UnwrapTuple<P>>;
1029
+ wikiPath: string;
1030
+ storePath: string;
1031
+ cachePath: string;
1032
+ versions: {
1033
+ tw5: any;
1034
+ mws: string;
1035
+ };
1036
+ setupRequired: boolean;
1037
+ enableExternalPlugins: boolean;
1038
+ enableGzip: boolean;
1039
+ attachmentsEnabled: boolean;
1040
+ attachmentSizeLimit: number;
1041
+ enableDevServer: boolean;
1042
+ enableDocsRoute: boolean;
1043
+ fieldModules: Record<string, import("tiddlywiki").TiddlerFieldModule>;
1044
+ contentTypeInfo: Record<string, ContentTypeInfo>;
1045
+ getContentType(type?: string): ContentTypeInfo;
1046
+ }
1047
+ global {
1048
+ type PrismaTxnClient = Omit<PrismaEngineClient, ITXClientDenyList>;
1049
+ type PrismaEngineClient = PrismaClient<Prisma.PrismaClientOptions, never, {
1050
+ result: {
1051
+ [T in Uncapitalize<Prisma.ModelName>]: {
1052
+ [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1053
+ compute: () => PrismaField<Capitalize<T>, K>;
1054
+ };
1055
+ };
1056
+ };
1057
+ client: {};
1058
+ model: {};
1059
+ query: {};
1060
+ }>;
1061
+ }
1062
+ export interface ContentTypeInfo {
1063
+ encoding: string;
1064
+ extension: string | string[];
1065
+ flags?: string[];
1066
+ deserializerType?: string;
1067
+ }
1068
+ export type PasswordService = ART<typeof createPasswordService>;
1069
+ export type TiddlerCache = ART<typeof startupCache>;
1070
+ }
1071
+ declare module "packages/mws/src/RequestState" {
1072
+ import { Prisma } from 'prisma-client';
1073
+ import { Types } from 'prisma-client/runtime/library';
1074
+ import { ServerState } from "packages/mws/src/ServerState";
1075
+ import { BodyFormat, RouteMatch, Router, ServerRequestClass, Streamer } from "packages/server/src/index";
1076
+ export class StateObject<B extends BodyFormat = BodyFormat, M extends string = string, D = unknown> extends ServerRequestClass<B, M, D> {
1077
+ config: ServerState;
1078
+ user: import("packages/mws/src/services/sessions").AuthUser;
1079
+ engine: PrismaEngineClient;
1080
+ sendAdmin: () => Promise<symbol>;
1081
+ asserted: boolean;
1082
+ PasswordService: {
1083
+ serverState: Map<string, import("@tiddlywiki/server").TypedGenerator<[[void, loginResponse: string], [finishLoginRequest: string, {
1084
+ user_id: PrismaField<"Users", "user_id">;
1085
+ session: {
1086
+ sessionKey: string;
1087
+ } | undefined;
1088
+ }]]>>;
1089
+ LoginGenerator: (args_0: {
1090
+ user_id: PrismaField<"Users", "user_id">;
1091
+ startLoginRequest: string;
1092
+ registrationRecord: string;
1093
+ }) => import("@tiddlywiki/server").TypedGenerator<[[void, loginResponse: string], [finishLoginRequest: string, {
1094
+ user_id: PrismaField<"Users", "user_id">;
1095
+ session: {
1096
+ sessionKey: string;
1097
+ } | undefined;
1098
+ }]]>;
1099
+ PasswordCreation: (userID: string, password: string) => Promise<string & {
1100
+ __prisma_table: "Users";
1101
+ __prisma_field: "password";
1102
+ }>;
1103
+ createRegistrationResponse: ({ userID, registrationRequest }: {
1104
+ userID: PrismaField<"Users", "user_id">;
1105
+ registrationRequest: string;
1106
+ }) => Promise<string>;
1107
+ startLoginSession: (stater: import("@tiddlywiki/server").TypedGenerator<[[void, loginResponse: string], [finishLoginRequest: string, {
1108
+ user_id: PrismaField<"Users", "user_id">;
1109
+ session: {
1110
+ sessionKey: string;
1111
+ } | undefined;
1112
+ }]]>) => Promise<string>;
1113
+ finishLoginSession: (loginSession: string) => Promise<import("@tiddlywiki/server").TypedGenerator<[[void, loginResponse: string], [finishLoginRequest: string, {
1114
+ user_id: PrismaField<"Users", "user_id">;
1115
+ session: {
1116
+ sessionKey: string;
1117
+ } | undefined;
1118
+ }]]> | undefined>;
1119
+ };
1120
+ pluginCache: {
1121
+ pluginFiles: Map<string, string>;
1122
+ pluginHashes: Map<string, string>;
1123
+ filePlugins: Map<string, string>;
1124
+ requiredPlugins: string[];
1125
+ cachePath: string;
1126
+ prefix: Buffer<ArrayBuffer>;
1127
+ suffix: Buffer<ArrayBuffer>;
1128
+ };
1129
+ constructor(streamer: Streamer, routePath: RouteMatch[], bodyFormat: B, router: Router);
1130
+ okUser(): void;
1131
+ okAdmin(): void;
1132
+ $transaction<T>(fn: (prisma: PrismaTxnClient) => Promise<T>): Promise<T>;
1133
+ $transactionTuple<P extends Prisma.PrismaPromise<any>[]>(arg: (prisma: ServerState["engine"]) => [...P], options?: {
1134
+ isolationLevel?: Prisma.TransactionIsolationLevel;
1135
+ }): Promise<Types.Utils.UnwrapTuple<P>>;
1136
+ makeTiddlerEtag(options: {
1137
+ bag_name: string;
1138
+ revision_id: string | number;
1139
+ }): string;
1140
+ getRecipeACL(recipe_name: PrismaField<"Recipes", "recipe_name">, needWrite: boolean): Promise<{
1141
+ recipe: {
1142
+ recipe_id: string & {
1143
+ __prisma_table: "Recipes";
1144
+ __prisma_field: "recipe_id";
1145
+ };
1146
+ } | null;
1147
+ canRead: unknown;
1148
+ canWrite: unknown;
1149
+ }>;
1150
+ assertRecipeAccess(recipe_name: PrismaField<"Recipes", "recipe_name">, needWrite: boolean): Promise<void>;
1151
+ assertBagAccess(bag_name: PrismaField<"Bags", "bag_name">, needWrite: boolean): Promise<{
1152
+ owner_id: PrismaField<"Bags", "owner_id">;
1153
+ bag_id: string & {
1154
+ __prisma_table: "Bags";
1155
+ __prisma_field: "bag_id";
1156
+ };
1157
+ }>;
1158
+ getBagACL(bag_name: PrismaField<"Bags", "bag_name">, needWrite: boolean): Promise<{
1159
+ bag: {
1160
+ owner_id: PrismaField<"Bags", "owner_id">;
1161
+ bag_id: string & {
1162
+ __prisma_table: "Bags";
1163
+ __prisma_field: "bag_id";
1164
+ };
1165
+ } | null;
1166
+ canRead: unknown;
1167
+ canWrite: unknown;
1168
+ }>;
1169
+ /** If the user isn't logged in, user_id is 0. */
1170
+ getBagWhereACL({ recipe_id, permission, user_id, role_ids }: {
1171
+ /** Recipe ID can be provided as an extra restriction */
1172
+ recipe_id?: string;
1173
+ permission: ACLPermissionName;
1174
+ user_id: string;
1175
+ role_ids: string[];
1176
+ }): ({
1177
+ owner_id: {
1178
+ equals: string;
1179
+ not: null;
1180
+ };
1181
+ acl?: undefined;
1182
+ } | {
1183
+ acl: {
1184
+ some: {
1185
+ permission: {
1186
+ in: ("READ" | "WRITE" | "ADMIN")[];
1187
+ };
1188
+ role_id: {
1189
+ in: string[];
1190
+ };
1191
+ };
1192
+ };
1193
+ owner_id?: undefined;
1194
+ } | {
1195
+ owner_id: {
1196
+ equals: null;
1197
+ not: null;
1198
+ };
1199
+ acl?: undefined;
1200
+ } | {
1201
+ recipe_bags: {
1202
+ some: {
1203
+ position: number | undefined;
1204
+ recipe: {
1205
+ OR: ({
1206
+ owner_id: {
1207
+ equals: string;
1208
+ not: null;
1209
+ };
1210
+ acl?: undefined;
1211
+ } | {
1212
+ acl: {
1213
+ some: {
1214
+ permission: {
1215
+ in: ("READ" | "WRITE" | "ADMIN")[];
1216
+ };
1217
+ role_id: {
1218
+ in: string[];
1219
+ };
1220
+ };
1221
+ };
1222
+ owner_id?: undefined;
1223
+ } | {
1224
+ owner_id: {
1225
+ equals: null;
1226
+ not: null;
1227
+ };
1228
+ acl?: undefined;
1229
+ })[];
1230
+ };
1231
+ with_acl: true;
1232
+ recipe_id: string | undefined;
1233
+ };
1234
+ };
1235
+ })[];
1236
+ getWhereACL({ permission, user_id, role_ids }: {
1237
+ permission: ACLPermissionName;
1238
+ user_id?: string;
1239
+ role_ids?: string[];
1240
+ }): ({
1241
+ owner_id: {
1242
+ equals: string;
1243
+ not: null;
1244
+ };
1245
+ acl?: undefined;
1246
+ } | {
1247
+ acl: {
1248
+ some: {
1249
+ permission: {
1250
+ in: ("READ" | "WRITE" | "ADMIN")[];
1251
+ };
1252
+ role_id: {
1253
+ in: string[];
1254
+ };
1255
+ };
1256
+ };
1257
+ owner_id?: undefined;
1258
+ } | {
1259
+ owner_id: {
1260
+ equals: null;
1261
+ not: null;
1262
+ };
1263
+ acl?: undefined;
1264
+ })[];
1265
+ }
1266
+ export type ACLPermissionName = "READ" | "WRITE" | "ADMIN";
1267
+ }
1268
+ declare module "packages/mws/src/services/sessions" {
1269
+ import { jsonify, JsonValue, RouterKeyMap, ServerRoute, Streamer, Z2, zod, ZodRoute, ZodState } from "packages/server/src/index";
1270
+ import { ServerState } from "packages/mws/src/ServerState";
1271
+ export interface AuthUser {
1272
+ /** User ID. 0 if the user is not logged in. */
1273
+ user_id: PrismaField<"Users", "user_id">;
1274
+ /** User role_ids. This may have length even if the user isn't logged in, to allow ACL for anon. */
1275
+ role_ids: PrismaField<"Roles", "role_id">[];
1276
+ /** Username passed to the client */
1277
+ username: PrismaField<"Users", "username">;
1278
+ /** A session_id isn't guarenteed. There may be a session even if the user isn't logged in, and may not be even if they are, depending on the the situation. */
1279
+ sessionId: PrismaField<"Sessions", "session_id"> | undefined;
1280
+ /** Is this user considered a site-admin. This is determined by the auth service, not MWS. */
1281
+ isAdmin: boolean;
1282
+ /** Is the user logged in? This also means that user_id should be 0. role_ids may still be specified. */
1283
+ isLoggedIn: boolean;
1284
+ }
1285
+ export const SessionKeyMap: RouterKeyMap<SessionManager, true>;
1286
+ /**
1287
+ *
1288
+ * @param path path starting with a forward slash
1289
+ * @param zodRequest the zod for state.data
1290
+ * @param inner the handler to call
1291
+ * @returns the ZodRoute
1292
+ */
1293
+ export function zodSession<P extends string, T extends zod.ZodTypeAny, R extends JsonValue>(path: P, zodRequest: (z: Z2<"JSON">) => T, inner: (state: ZodState<"POST", "json", {}, {}, T>, prisma: PrismaTxnClient) => Promise<R>): ZodSessionRoute<P, T, R>;
1294
+ export interface ZodSessionRoute<PATH extends string, T extends zod.ZodTypeAny, R extends JsonValue> extends ZodRoute<"POST", "json", {}, {}, T, R> {
1295
+ path: PATH;
1296
+ }
1297
+ export type RouterPathRouteMap<T> = {
1298
+ [K in keyof T as T[K] extends ZodSessionRoute<any, any, any> ? K : never]: T[K] extends ZodSessionRoute<infer P, infer REQ, infer RES> ? {
1299
+ (data: zod.input<REQ>): Promise<jsonify<RES>>;
1300
+ path: P;
1301
+ key: K;
1302
+ } : never;
1303
+ };
1304
+ export type SessionManagerMap = RouterPathRouteMap<SessionManager>;
1305
+ export class SessionManager {
1306
+ static defineRoutes(root: ServerRoute): void;
1307
+ static parseIncomingRequest(streamer: Streamer, config: ServerState): Promise<AuthUser>;
1308
+ login1: ZodSessionRoute<"/login/1", zod.ZodObject<{
1309
+ username: zod.ZodType<string & {
1310
+ __prisma_table: "Users";
1311
+ __prisma_field: "username";
1312
+ }, string, zod.z.core.$ZodTypeInternals<string & {
1313
+ __prisma_table: "Users";
1314
+ __prisma_field: "username";
1315
+ }, string>>;
1316
+ startLoginRequest: zod.ZodString;
1317
+ }, zod.z.core.$strip>, {
1318
+ loginResponse: string;
1319
+ loginSession: string;
1320
+ }>;
1321
+ login2: ZodSessionRoute<"/login/2", zod.ZodObject<{
1322
+ finishLoginRequest: zod.ZodString;
1323
+ loginSession: zod.ZodString;
1324
+ skipCookie: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
1325
+ }, zod.z.core.$strip>, {
1326
+ user_id: string & {
1327
+ __prisma_table: "Users";
1328
+ __prisma_field: "user_id";
1329
+ };
1330
+ session_id: string & {
1331
+ __prisma_table: "Sessions";
1332
+ __prisma_field: "session_id";
1333
+ };
1334
+ }>;
1335
+ logout: ZodSessionRoute<"/logout", zod.ZodOptional<zod.ZodObject<{
1336
+ session_id: zod.ZodString;
1337
+ signature: zod.ZodString;
1338
+ skipCookie: zod.ZodBoolean;
1339
+ }, zod.z.core.$strip>>, null>;
1340
+ }
1341
+ export function assertSignature({ session_id, signature, session_key }: {
1342
+ session_id: string;
1343
+ signature: string;
1344
+ session_key: string;
1345
+ }): void;
1346
+ }
1347
+ declare module "packages/mws/src/services/setupDevServer" {
1348
+ import { ServerState } from "packages/mws/src/ServerState";
1349
+ import { ServerRequest } from "packages/server/src/index";
1350
+ export function setupDevServer(config: ServerState): Promise<(state: ServerRequest) => Promise<symbol>>;
1351
+ export function esbuildStartup(): Promise<{
1352
+ ctx: import("esbuild").BuildContext<{
1353
+ entryPoints: string[];
1354
+ bundle: true;
1355
+ target: string;
1356
+ platform: "browser";
1357
+ jsx: "automatic";
1358
+ outdir: string;
1359
+ minify: true;
1360
+ sourcemap: true;
1361
+ metafile: true;
1362
+ splitting: true;
1363
+ format: "esm";
1364
+ }>;
1365
+ port: number;
1366
+ result: import("esbuild").BuildResult<{
1367
+ entryPoints: string[];
1368
+ bundle: true;
1369
+ target: string;
1370
+ platform: "browser";
1371
+ jsx: "automatic";
1372
+ outdir: string;
1373
+ minify: true;
1374
+ sourcemap: true;
1375
+ metafile: true;
1376
+ splitting: true;
1377
+ format: "esm";
1378
+ }>;
1379
+ rootdir: string;
1380
+ publicdir: string;
1381
+ }>;
1382
+ }
1383
+ declare module "packages/mws/src/registerRequest" {
1384
+ import { Router, ServerRoute, BodyFormat } from "packages/server/src/index";
1385
+ import { StateObject } from "packages/mws/src/RequestState";
1386
+ import { ServerState } from "packages/mws/src/ServerState";
1387
+ import { AuthUser } from "packages/mws/src/services/sessions";
1388
+ import { setupDevServer } from "packages/mws/src/services/setupDevServer";
1389
+ import helmet from "helmet";
1390
+ module "packages/events/src/index" {
1391
+ /**
1392
+ * - "mws.router.init" event is emitted after setting the augmentations on Router.
1393
+ */
1394
+ interface ServerEventsMap {
1395
+ "mws.router.init": [router: Router];
1396
+ "mws.routes.important": [root: ServerRoute, config: ServerState];
1397
+ "mws.routes": [root: ServerRoute, config: ServerState];
1398
+ "mws.routes.fallback": [root: ServerRoute, config: ServerState];
1399
+ }
1400
+ }
1401
+ module "packages/server/src/index" {
1402
+ interface ServerRequest<B extends BodyFormat = BodyFormat, M extends string = string, D = unknown> extends StateObject<B, M, D> {
1403
+ }
1404
+ interface Router {
1405
+ config: ServerState;
1406
+ sendAdmin: ART<typeof setupDevServer>;
1407
+ helmet: ART<typeof helmet>;
1408
+ }
1409
+ interface Streamer {
1410
+ user: AuthUser;
1411
+ }
1412
+ }
1413
+ }
1414
+ declare module "packages/mws/src/db/sqlite-adapter" {
1415
+ import { SqlDriverAdapter, SqlMigrationAwareDriverAdapterFactory } from "@prisma/driver-adapter-utils";
1416
+ export class SqliteAdapter {
1417
+ private databasePath;
1418
+ private isDevMode;
1419
+ constructor(databasePath: string, isDevMode: boolean);
1420
+ adapter: SqlMigrationAwareDriverAdapterFactory;
1421
+ init(): Promise<void>;
1422
+ createMigrationsTable(libsql: SqlDriverAdapter): Promise<void>;
1423
+ checkMigrationsTable(libsql: SqlDriverAdapter, migrateExisting: boolean, applied_migrations: Set<string>, prismaFolder: string, initMigration: string): Promise<void>;
1424
+ }
1425
+ }
1426
+ declare module "packages/mws/src/services/tiddlywiki" {
1427
+ module "tiddlywiki" {
1428
+ interface TWUtils {
1429
+ eachAsync: (array: any[], callback: (item: any, index: number) => Promise<void>) => Promise<void>;
1430
+ }
1431
+ interface TWBoot {
1432
+ }
1433
+ }
1434
+ export function bootTiddlyWiki(wikiPath: string): Promise<import("tiddlywiki").TW>;
1435
+ }
1436
+ declare module "packages/mws/src/registerStartup" {
1437
+ import { TW } from "tiddlywiki";
1438
+ import { SqliteAdapter } from "packages/mws/src/db/sqlite-adapter";
1439
+ import { ServerState, TiddlerCache } from "packages/mws/src/ServerState";
1440
+ module "packages/events/src/index" {
1441
+ interface ServerEventsMap {
1442
+ "mws.init.before": [config: ServerState, $tw: TW];
1443
+ "mws.init.after": [config: ServerState, $tw: TW];
1444
+ "mws.adapter.init.before": [adapter: SqliteAdapter];
1445
+ "mws.adapter.init.after": [adapter: SqliteAdapter];
1446
+ "mws.cache.init.before": [cachePath: string, $tw: TW];
1447
+ "mws.cache.init.after": [cache: TiddlerCache, $tw: TW];
1448
+ }
1449
+ }
1450
+ module "packages/commander/src/index" {
1451
+ interface BaseCommand {
1452
+ config: ServerState;
1453
+ $tw: TW;
1454
+ }
1455
+ }
1456
+ }
1457
+ declare module "packages/mws/src/managers/TiddlerStore" {
1458
+ import { TiddlerFields } from "tiddlywiki";
1459
+ /**
1460
+ *
1461
+ @example
1462
+
1463
+ const store = new TiddlerStore_PrismaBase(this.config.engine);
1464
+ await this.config.engine.$transaction(
1465
+ store.saveTiddlersFromPath_PrismaArray(...)
1466
+ );
1467
+
1468
+ await this.config.engine.$transaction(async (prisma) => {
1469
+ const store = new TiddlerStore_PrismaTransaction(prisma);
1470
+ // use the store here
1471
+ });
1472
+ */
1473
+ export class TiddlerStore_PrismaBase {
1474
+ prisma: PrismaTxnClient;
1475
+ constructor(prisma: PrismaTxnClient);
1476
+ validateItemName(name: string, allowPrivilegedCharacters: boolean): "Not a valid string" | "Too long" | "Invalid character(s)" | null;
1477
+ validateItemNames(names: string[], allowPrivilegedCharacters: boolean): string | null;
1478
+ upsertRecipe_PrismaArray(recipe_name: PrismaField<"Recipes", "recipe_name">, description: PrismaField<"Recipes", "description">, bags: {
1479
+ bag_name: PrismaField<"Bags", "bag_name">;
1480
+ with_acl: PrismaField<"Recipe_bags", "with_acl">;
1481
+ }[], plugin_names: string[], { allowPrivilegedCharacters }?: {
1482
+ allowPrivilegedCharacters?: boolean;
1483
+ }): [import("prisma/client").Prisma.Prisma__RecipesClient<{
1484
+ recipe_id: string & {
1485
+ __prisma_table: "Recipes";
1486
+ __prisma_field: "recipe_id";
1487
+ };
1488
+ }, never, {
1489
+ result: { [T in Uncapitalize<import("prisma/client").Prisma.ModelName>]: { [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1490
+ compute: () => PrismaField<Capitalize<T>, K>;
1491
+ }; }; };
1492
+ client: {};
1493
+ model: {};
1494
+ query: {};
1495
+ }, import("prisma/client").Prisma.PrismaClientOptions>, import("prisma/client").Prisma.Prisma__RecipesClient<{
1496
+ description: string & {
1497
+ __prisma_table: "Recipes";
1498
+ __prisma_field: "description";
1499
+ };
1500
+ recipe_id: string & {
1501
+ __prisma_table: "Recipes";
1502
+ __prisma_field: "recipe_id";
1503
+ };
1504
+ recipe_name: string & {
1505
+ __prisma_table: "Recipes";
1506
+ __prisma_field: "recipe_name";
1507
+ };
1508
+ owner_id: PrismaField<"Recipes", "owner_id">;
1509
+ plugin_names: PrismaJson.Recipes_plugin_names & {
1510
+ __prisma_table: "Recipes";
1511
+ __prisma_field: "plugin_names";
1512
+ };
1513
+ skip_required_plugins: PrismaField<"Recipes", "skip_required_plugins">;
1514
+ skip_core: PrismaField<"Recipes", "skip_core">;
1515
+ }, never, {
1516
+ result: { [T in Uncapitalize<import("prisma/client").Prisma.ModelName>]: { [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1517
+ compute: () => PrismaField<Capitalize<T>, K>;
1518
+ }; }; };
1519
+ client: {};
1520
+ model: {};
1521
+ query: {};
1522
+ }, import("prisma/client").Prisma.PrismaClientOptions>];
1523
+ upsertBag_PrismaPromise(bag_name: PrismaField<"Bags", "bag_name">, description: PrismaField<"Bags", "description">, { allowPrivilegedCharacters }?: {
1524
+ allowPrivilegedCharacters?: boolean;
1525
+ }): import("prisma/client").Prisma.Prisma__BagsClient<{
1526
+ bag_id: string & {
1527
+ __prisma_table: "Bags";
1528
+ __prisma_field: "bag_id";
1529
+ };
1530
+ }, never, {
1531
+ result: { [T in Uncapitalize<import("prisma/client").Prisma.ModelName>]: { [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1532
+ compute: () => PrismaField<Capitalize<T>, K>;
1533
+ }; }; };
1534
+ client: {};
1535
+ model: {};
1536
+ query: {};
1537
+ }, import("prisma/client").Prisma.PrismaClientOptions>;
1538
+ saveTiddlersFromPath_PrismaArray(bag_name: PrismaField<"Bags", "bag_name">, tiddlers: TiddlerFields[]): [import("prisma/client").Prisma.PrismaPromise<import("prisma/client").Prisma.BatchPayload>, ...(import("prisma/client").Prisma.PrismaPromise<import("prisma/client").Prisma.BatchPayload> | import("prisma/client").Prisma.Prisma__TiddlersClient<{
1539
+ revision_id: string & {
1540
+ __prisma_table: "Tiddlers";
1541
+ __prisma_field: "revision_id";
1542
+ };
1543
+ }, never, {
1544
+ result: { [T in Uncapitalize<import("prisma/client").Prisma.ModelName>]: { [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1545
+ compute: () => PrismaField<Capitalize<T>, K>;
1546
+ }; }; };
1547
+ client: {};
1548
+ model: {};
1549
+ query: {};
1550
+ }, import("prisma/client").Prisma.PrismaClientOptions>)[]];
1551
+ saveBagTiddlerFields_PrismaArray(tiddlerFields: TiddlerFields, bag_name: PrismaField<"Bags", "bag_name">, attachment_hash: PrismaField<"Tiddlers", "attachment_hash">): [import("prisma/client").Prisma.PrismaPromise<import("prisma/client").Prisma.BatchPayload>, import("prisma/client").Prisma.Prisma__TiddlersClient<{
1552
+ revision_id: string & {
1553
+ __prisma_table: "Tiddlers";
1554
+ __prisma_field: "revision_id";
1555
+ };
1556
+ }, never, {
1557
+ result: { [T in Uncapitalize<import("prisma/client").Prisma.ModelName>]: { [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1558
+ compute: () => PrismaField<Capitalize<T>, K>;
1559
+ }; }; };
1560
+ client: {};
1561
+ model: {};
1562
+ query: {};
1563
+ }, import("prisma/client").Prisma.PrismaClientOptions>];
1564
+ /**
1565
+ Returns {revision_id:} of the delete marker
1566
+ */
1567
+ deleteBagTiddler_PrismaArray(bag_name: PrismaField<"Bags", "bag_name">, title: PrismaField<"Tiddlers", "title">): [import("prisma/client").Prisma.PrismaPromise<import("prisma/client").Prisma.BatchPayload>, import("prisma/client").Prisma.Prisma__TiddlersClient<{
1568
+ revision_id: string & {
1569
+ __prisma_table: "Tiddlers";
1570
+ __prisma_field: "revision_id";
1571
+ };
1572
+ }, never, {
1573
+ result: { [T in Uncapitalize<import("prisma/client").Prisma.ModelName>]: { [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1574
+ compute: () => PrismaField<Capitalize<T>, K>;
1575
+ }; }; };
1576
+ client: {};
1577
+ model: {};
1578
+ query: {};
1579
+ }, import("prisma/client").Prisma.PrismaClientOptions>];
1580
+ }
1581
+ export class TiddlerStore_PrismaTransaction extends TiddlerStore_PrismaBase {
1582
+ prisma: PrismaTxnClient;
1583
+ constructor(prisma: PrismaTxnClient);
1584
+ saveBagTiddlerFields(tiddlerFields: TiddlerFields, bag_name: PrismaField<"Bags", "bag_name">, attachment_hash: PrismaField<"Tiddlers", "attachment_hash">): Promise<{
1585
+ revision_id: string & {
1586
+ __prisma_table: "Tiddlers";
1587
+ __prisma_field: "revision_id";
1588
+ };
1589
+ }>;
1590
+ deleteBagTiddler(bag_name: PrismaField<"Bags", "bag_name">, title: PrismaField<"Tiddlers", "title">): Promise<{
1591
+ revision_id: string & {
1592
+ __prisma_table: "Tiddlers";
1593
+ __prisma_field: "revision_id";
1594
+ };
1595
+ }>;
1596
+ /**
1597
+ * Get the writable bag for the specified recipe.
1598
+ *
1599
+ * If title is specified, the tiddler will be included in bag.tiddlers, if it exists.
1600
+ *
1601
+ * The bag will still be returned even if the tiddler does not exist.
1602
+ */
1603
+ getRecipeWritableBag(recipe_name: PrismaField<"Recipes", "recipe_name">, title?: PrismaField<"Tiddlers", "title">): Promise<{
1604
+ bag_id: string & {
1605
+ __prisma_table: "Bags";
1606
+ __prisma_field: "bag_id";
1607
+ };
1608
+ bag_name: string & {
1609
+ __prisma_table: "Bags";
1610
+ __prisma_field: "bag_name";
1611
+ };
1612
+ tiddlers: {
1613
+ title: string & {
1614
+ __prisma_table: "Tiddlers";
1615
+ __prisma_field: "title";
1616
+ };
1617
+ bag_id: string & {
1618
+ __prisma_table: "Bags";
1619
+ __prisma_field: "bag_id";
1620
+ };
1621
+ revision_id: string & {
1622
+ __prisma_table: "Tiddlers";
1623
+ __prisma_field: "revision_id";
1624
+ };
1625
+ is_deleted: PrismaField<"Tiddlers", "is_deleted">;
1626
+ attachment_hash: PrismaField<"Tiddlers", "attachment_hash">;
1627
+ }[];
1628
+ }>;
1629
+ getRecipeBagWithTiddler({ recipe_name, title }: {
1630
+ recipe_name: string;
1631
+ title: string;
1632
+ }): Promise<({
1633
+ recipe: {
1634
+ description: string & {
1635
+ __prisma_table: "Recipes";
1636
+ __prisma_field: "description";
1637
+ };
1638
+ recipe_id: string & {
1639
+ __prisma_table: "Recipes";
1640
+ __prisma_field: "recipe_id";
1641
+ };
1642
+ recipe_name: string & {
1643
+ __prisma_table: "Recipes";
1644
+ __prisma_field: "recipe_name";
1645
+ };
1646
+ owner_id: PrismaField<"Recipes", "owner_id">;
1647
+ plugin_names: PrismaJson.Recipes_plugin_names & {
1648
+ __prisma_table: "Recipes";
1649
+ __prisma_field: "plugin_names";
1650
+ };
1651
+ skip_required_plugins: PrismaField<"Recipes", "skip_required_plugins">;
1652
+ skip_core: PrismaField<"Recipes", "skip_core">;
1653
+ };
1654
+ bag: {
1655
+ description: string & {
1656
+ __prisma_table: "Bags";
1657
+ __prisma_field: "description";
1658
+ };
1659
+ owner_id: PrismaField<"Bags", "owner_id">;
1660
+ bag_id: string & {
1661
+ __prisma_table: "Bags";
1662
+ __prisma_field: "bag_id";
1663
+ };
1664
+ bag_name: string & {
1665
+ __prisma_table: "Bags";
1666
+ __prisma_field: "bag_name";
1667
+ };
1668
+ };
1669
+ } & {
1670
+ position: number & {
1671
+ __prisma_table: "Recipe_bags";
1672
+ __prisma_field: "position";
1673
+ };
1674
+ recipe_id: string & {
1675
+ __prisma_table: "Recipes";
1676
+ __prisma_field: "recipe_id";
1677
+ };
1678
+ bag_id: string & {
1679
+ __prisma_table: "Bags";
1680
+ __prisma_field: "bag_id";
1681
+ };
1682
+ with_acl: PrismaField<"Recipe_bags", "with_acl">;
1683
+ load_modules: PrismaField<"Recipe_bags", "load_modules">;
1684
+ }) | null>;
1685
+ getRecipeBags(recipe_name: PrismaField<"Recipes", "recipe_name">): Promise<{
1686
+ bag_id: string & {
1687
+ __prisma_table: "Bags";
1688
+ __prisma_field: "bag_id";
1689
+ };
1690
+ bag_name: string & {
1691
+ __prisma_table: "Bags";
1692
+ __prisma_field: "bag_name";
1693
+ };
1694
+ position: number & {
1695
+ __prisma_table: "Recipe_bags";
1696
+ __prisma_field: "position";
1697
+ };
1698
+ }[]>;
1699
+ getBagTiddlers(bag_name: PrismaField<"Bags", "bag_name">, options?: {
1700
+ last_known_revision_id?: PrismaField<"Tiddlers", "revision_id">;
1701
+ include_deleted?: boolean;
1702
+ }): Promise<{
1703
+ bag_id: string;
1704
+ bag_name: string;
1705
+ tiddlers: {
1706
+ title: string;
1707
+ revision_id: string;
1708
+ is_deleted: boolean;
1709
+ }[];
1710
+ }>;
1711
+ getBagTiddlers_PrismaQuery(bag_name: PrismaField<"Bags", "bag_name">, options?: {
1712
+ last_known_revision_id?: PrismaField<"Tiddlers", "revision_id">;
1713
+ include_deleted?: boolean;
1714
+ }): import("prisma/client").Prisma.Prisma__BagsClient<{
1715
+ bag_id: string & {
1716
+ __prisma_table: "Bags";
1717
+ __prisma_field: "bag_id";
1718
+ };
1719
+ bag_name: string & {
1720
+ __prisma_table: "Bags";
1721
+ __prisma_field: "bag_name";
1722
+ };
1723
+ tiddlers: {
1724
+ title: string & {
1725
+ __prisma_table: "Tiddlers";
1726
+ __prisma_field: "title";
1727
+ };
1728
+ revision_id: string & {
1729
+ __prisma_table: "Tiddlers";
1730
+ __prisma_field: "revision_id";
1731
+ };
1732
+ is_deleted: PrismaField<"Tiddlers", "is_deleted">;
1733
+ }[];
1734
+ } | null, null, {
1735
+ result: { [T in Uncapitalize<import("prisma/client").Prisma.ModelName>]: { [K in keyof PrismaPayloadScalars<Capitalize<T>>]: () => {
1736
+ compute: () => PrismaField<Capitalize<T>, K>;
1737
+ }; }; };
1738
+ client: {};
1739
+ model: {};
1740
+ query: {};
1741
+ }, import("prisma/client").Prisma.PrismaClientOptions>;
1742
+ }
1743
+ }
1744
+ declare module "packages/mws/src/commands/load-wiki-folder" {
1745
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
1746
+ export const info: CommandInfo;
1747
+ export class Command extends BaseCommand<[string], {
1748
+ "bag-name"?: string[];
1749
+ "bag-description"?: string[];
1750
+ "recipe-name"?: string[];
1751
+ "recipe-description"?: string[];
1752
+ "overwrite"?: boolean;
1753
+ }> {
1754
+ execute(): Promise<null | undefined>;
1755
+ }
1756
+ }
1757
+ declare module "packages/mws/src/commands/save-archive" {
1758
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
1759
+ export const info: CommandInfo;
1760
+ export class Command extends BaseCommand {
1761
+ get archivePath(): string;
1762
+ prisma?: PrismaTxnClient;
1763
+ execute(): Promise<null>;
1764
+ getRecipes(): Promise<({
1765
+ recipe_bags: {
1766
+ position: number & {
1767
+ __prisma_table: "Recipe_bags";
1768
+ __prisma_field: "position";
1769
+ };
1770
+ recipe_id: string & {
1771
+ __prisma_table: "Recipes";
1772
+ __prisma_field: "recipe_id";
1773
+ };
1774
+ bag_id: string & {
1775
+ __prisma_table: "Bags";
1776
+ __prisma_field: "bag_id";
1777
+ };
1778
+ with_acl: PrismaField<"Recipe_bags", "with_acl">;
1779
+ load_modules: PrismaField<"Recipe_bags", "load_modules">;
1780
+ }[];
1781
+ acl: {
1782
+ recipe_id: string & {
1783
+ __prisma_table: "RecipeAcl";
1784
+ __prisma_field: "recipe_id";
1785
+ };
1786
+ acl_id: number & {
1787
+ __prisma_table: "RecipeAcl";
1788
+ __prisma_field: "acl_id";
1789
+ };
1790
+ role_id: string & {
1791
+ __prisma_table: "RecipeAcl";
1792
+ __prisma_field: "role_id";
1793
+ };
1794
+ permission: PrismaField<"RecipeAcl", "permission">;
1795
+ }[];
1796
+ } & {
1797
+ description: string & {
1798
+ __prisma_table: "Recipes";
1799
+ __prisma_field: "description";
1800
+ };
1801
+ recipe_id: string & {
1802
+ __prisma_table: "Recipes";
1803
+ __prisma_field: "recipe_id";
1804
+ };
1805
+ recipe_name: string & {
1806
+ __prisma_table: "Recipes";
1807
+ __prisma_field: "recipe_name";
1808
+ };
1809
+ owner_id: PrismaField<"Recipes", "owner_id">;
1810
+ plugin_names: PrismaJson.Recipes_plugin_names & {
1811
+ __prisma_table: "Recipes";
1812
+ __prisma_field: "plugin_names";
1813
+ };
1814
+ skip_required_plugins: PrismaField<"Recipes", "skip_required_plugins">;
1815
+ skip_core: PrismaField<"Recipes", "skip_core">;
1816
+ })[]>;
1817
+ getBags(): Promise<{
1818
+ tiddlers: {
1819
+ fields: {
1820
+ [k: string]: string & {
1821
+ __prisma_table: "Fields";
1822
+ __prisma_field: "field_value";
1823
+ };
1824
+ };
1825
+ title: string & {
1826
+ __prisma_table: "Tiddlers";
1827
+ __prisma_field: "title";
1828
+ };
1829
+ bag_id: string & {
1830
+ __prisma_table: "Bags";
1831
+ __prisma_field: "bag_id";
1832
+ };
1833
+ revision_id: string & {
1834
+ __prisma_table: "Tiddlers";
1835
+ __prisma_field: "revision_id";
1836
+ };
1837
+ is_deleted: PrismaField<"Tiddlers", "is_deleted">;
1838
+ attachment_hash: PrismaField<"Tiddlers", "attachment_hash">;
1839
+ }[];
1840
+ acl: {
1841
+ acl_id: number & {
1842
+ __prisma_table: "BagAcl";
1843
+ __prisma_field: "acl_id";
1844
+ };
1845
+ role_id: string & {
1846
+ __prisma_table: "BagAcl";
1847
+ __prisma_field: "role_id";
1848
+ };
1849
+ permission: PrismaField<"BagAcl", "permission">;
1850
+ bag_id: string & {
1851
+ __prisma_table: "BagAcl";
1852
+ __prisma_field: "bag_id";
1853
+ };
1854
+ }[];
1855
+ description: string & {
1856
+ __prisma_table: "Bags";
1857
+ __prisma_field: "description";
1858
+ };
1859
+ owner_id: PrismaField<"Bags", "owner_id">;
1860
+ bag_id: string & {
1861
+ __prisma_table: "Bags";
1862
+ __prisma_field: "bag_id";
1863
+ };
1864
+ bag_name: string & {
1865
+ __prisma_table: "Bags";
1866
+ __prisma_field: "bag_name";
1867
+ };
1868
+ }[]>;
1869
+ getUsers(): Promise<({
1870
+ roles: {
1871
+ description: PrismaField<"Roles", "description">;
1872
+ role_id: string & {
1873
+ __prisma_table: "Roles";
1874
+ __prisma_field: "role_id";
1875
+ };
1876
+ role_name: string & {
1877
+ __prisma_table: "Roles";
1878
+ __prisma_field: "role_name";
1879
+ };
1880
+ }[];
1881
+ sessions: {
1882
+ user_id: string & {
1883
+ __prisma_table: "Users";
1884
+ __prisma_field: "user_id";
1885
+ };
1886
+ created_at: Date & {
1887
+ __prisma_table: "Sessions";
1888
+ __prisma_field: "created_at";
1889
+ };
1890
+ session_id: string & {
1891
+ __prisma_table: "Sessions";
1892
+ __prisma_field: "session_id";
1893
+ };
1894
+ last_accessed: Date & {
1895
+ __prisma_table: "Sessions";
1896
+ __prisma_field: "last_accessed";
1897
+ };
1898
+ session_key: PrismaField<"Sessions", "session_key">;
1899
+ }[];
1900
+ } & {
1901
+ username: string & {
1902
+ __prisma_table: "Users";
1903
+ __prisma_field: "username";
1904
+ };
1905
+ email: string & {
1906
+ __prisma_table: "Users";
1907
+ __prisma_field: "email";
1908
+ };
1909
+ user_id: string & {
1910
+ __prisma_table: "Users";
1911
+ __prisma_field: "user_id";
1912
+ };
1913
+ password: string & {
1914
+ __prisma_table: "Users";
1915
+ __prisma_field: "password";
1916
+ };
1917
+ created_at: Date & {
1918
+ __prisma_table: "Users";
1919
+ __prisma_field: "created_at";
1920
+ };
1921
+ last_login: PrismaField<"Users", "last_login">;
1922
+ })[]>;
1923
+ getRoles(): Promise<{
1924
+ description: PrismaField<"Roles", "description">;
1925
+ role_id: string & {
1926
+ __prisma_table: "Roles";
1927
+ __prisma_field: "role_id";
1928
+ };
1929
+ role_name: string & {
1930
+ __prisma_table: "Roles";
1931
+ __prisma_field: "role_name";
1932
+ };
1933
+ }[]>;
1934
+ saveArchive(): Promise<void>;
1935
+ }
1936
+ }
1937
+ declare module "packages/mws/src/commands/load-archive" {
1938
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
1939
+ export const info: CommandInfo;
1940
+ export class Command extends BaseCommand {
1941
+ execute(): Promise<void>;
1942
+ }
1943
+ /**
1944
+ * This is copied in from the tsup build types for this command, although built with
1945
+ * a modified PrismaField. This should represent the last form of the version 2
1946
+ * archive.
1947
+ */
1948
+ export interface Archiver2Saves {
1949
+ getRecipes(): Promise<({
1950
+ recipe_bags: {
1951
+ recipe_id: number;
1952
+ bag_id: number;
1953
+ with_acl: boolean;
1954
+ position: number;
1955
+ }[];
1956
+ acl: {
1957
+ role_id: number;
1958
+ recipe_id: number;
1959
+ permission: "READ" | "WRITE" | "ADMIN";
1960
+ acl_id: number;
1961
+ }[];
1962
+ } & {
1963
+ description: string;
1964
+ recipe_name: string;
1965
+ recipe_id: number;
1966
+ owner_id: number | null;
1967
+ })[]>;
1968
+ getBags(): Promise<{
1969
+ tiddlers: {
1970
+ fields: {
1971
+ [k: string]: string;
1972
+ };
1973
+ bag_id: number;
1974
+ title: string;
1975
+ tiddler_id: number;
1976
+ is_deleted: boolean;
1977
+ attachment_hash: string | null;
1978
+ }[];
1979
+ acl: {
1980
+ role_id: number;
1981
+ bag_id: number;
1982
+ permission: "READ" | "WRITE" | "ADMIN";
1983
+ acl_id: number;
1984
+ }[];
1985
+ description: string;
1986
+ owner_id: number | null;
1987
+ bag_id: number;
1988
+ bag_name: string;
1989
+ is_plugin: boolean;
1990
+ }[]>;
1991
+ getUsers(): Promise<({
1992
+ roles: {
1993
+ role_id: number;
1994
+ role_name: string;
1995
+ description: string | null;
1996
+ }[];
1997
+ sessions: {
1998
+ user_id: number;
1999
+ created_at: Date;
2000
+ session_id: string;
2001
+ last_accessed: Date;
2002
+ session_key: string | null;
2003
+ }[];
2004
+ groups: {
2005
+ description: string | null;
2006
+ group_id: number;
2007
+ group_name: string;
2008
+ }[];
2009
+ } & {
2010
+ user_id: number;
2011
+ username: string;
2012
+ email: string;
2013
+ password: string;
2014
+ created_at: Date;
2015
+ last_login: Date | null;
2016
+ })[]>;
2017
+ getGroups(): Promise<({
2018
+ roles: {
2019
+ role_id: number;
2020
+ role_name: string;
2021
+ description: string | null;
2022
+ }[];
2023
+ } & {
2024
+ description: string | null;
2025
+ group_id: number;
2026
+ group_name: string;
2027
+ })[]>;
2028
+ getRoles(): Promise<{
2029
+ role_id: number;
2030
+ role_name: string;
2031
+ description: string | null;
2032
+ }[]>;
2033
+ }
2034
+ }
2035
+ declare module "packages/mws/src/commands/init-store" {
2036
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
2037
+ export const info: CommandInfo;
2038
+ export class Command extends BaseCommand {
2039
+ execute(): Promise<any>;
2040
+ setupStore(): Promise<void>;
2041
+ }
2042
+ }
2043
+ declare module "packages/mws/src/commands/manager" {
2044
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
2045
+ export const info: CommandInfo;
2046
+ export class Command extends BaseCommand {
2047
+ execute(): Promise<void>;
2048
+ }
2049
+ }
2050
+ declare module "packages/mws/src/commands/tests-complete" {
2051
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
2052
+ export const info: CommandInfo;
2053
+ export class Command extends BaseCommand {
2054
+ execute(): Promise<void>;
2055
+ }
2056
+ }
2057
+ declare module "packages/mws/src/commands/build-client" {
2058
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
2059
+ export const info: CommandInfo;
2060
+ export class Command extends BaseCommand {
2061
+ execute(): Promise<void>;
2062
+ }
2063
+ }
2064
+ declare module "packages/mws/src/managers/admin-utils" {
2065
+ import { JsonValue, Z2, zod, ZodState } from "packages/server/src/index";
2066
+ export function admin<T extends zod.ZodTypeAny, R extends JsonValue>(zodRequest: (z: Z2<"JSON">) => T, inner: (state: ZodState<"POST", "json", {}, {}, T>, prisma: PrismaTxnClient) => Promise<R>): import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, T, R>;
2067
+ }
2068
+ declare module "packages/mws/src/managers/admin-recipes" {
2069
+ import { RouterKeyMap, RouterRouteMap, ServerRequest, ServerRoute } from "packages/server/src/index";
2070
+ export const RecipeKeyMap: RouterKeyMap<RecipeManager, true>;
2071
+ export type RecipeManagerMap = RouterRouteMap<RecipeManager>;
2072
+ export class RecipeManager {
2073
+ static defineRoutes(root: ServerRoute): void;
2074
+ constructor();
2075
+ recipe_create_or_update: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2076
+ recipe_name: import("zod/v4").ZodType<string & {
2077
+ __prisma_table: "Recipes";
2078
+ __prisma_field: "recipe_name";
2079
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2080
+ __prisma_table: "Recipes";
2081
+ __prisma_field: "recipe_name";
2082
+ }, string>>;
2083
+ description: import("zod/v4").ZodType<string & {
2084
+ __prisma_table: "Recipes";
2085
+ __prisma_field: "description";
2086
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2087
+ __prisma_table: "Recipes";
2088
+ __prisma_field: "description";
2089
+ }, string>>;
2090
+ bag_names: import("zod/v4").ZodArray<import("zod/v4").ZodObject<{
2091
+ bag_name: import("zod/v4").ZodString;
2092
+ with_acl: import("zod/v4").ZodBoolean;
2093
+ }, import("zod/v4/core").$strip>>;
2094
+ plugin_names: import("zod/v4").ZodArray<import("zod/v4").ZodString>;
2095
+ owner_id: import("zod/v4").ZodOptional<import("zod/v4").ZodType<PrismaField<"Recipes", "owner_id">, string | null, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Recipes", "owner_id">, string | null>>>;
2096
+ skip_required_plugins: import("zod/v4").ZodType<PrismaField<"Recipes", "skip_required_plugins">, boolean, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Recipes", "skip_required_plugins">, boolean>>;
2097
+ skip_core: import("zod/v4").ZodType<PrismaField<"Recipes", "skip_core">, boolean, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Recipes", "skip_core">, boolean>>;
2098
+ create_only: import("zod/v4").ZodBoolean;
2099
+ }, import("zod/v4/core").$strip>, {
2100
+ description: string & {
2101
+ __prisma_table: "Recipes";
2102
+ __prisma_field: "description";
2103
+ };
2104
+ recipe_id: string & {
2105
+ __prisma_table: "Recipes";
2106
+ __prisma_field: "recipe_id";
2107
+ };
2108
+ recipe_name: string & {
2109
+ __prisma_table: "Recipes";
2110
+ __prisma_field: "recipe_name";
2111
+ };
2112
+ owner_id: PrismaField<"Recipes", "owner_id">;
2113
+ plugin_names: PrismaJson.Recipes_plugin_names & {
2114
+ __prisma_table: "Recipes";
2115
+ __prisma_field: "plugin_names";
2116
+ };
2117
+ skip_required_plugins: PrismaField<"Recipes", "skip_required_plugins">;
2118
+ skip_core: PrismaField<"Recipes", "skip_core">;
2119
+ }>;
2120
+ bag_create_or_update: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2121
+ bag_name: import("zod/v4").ZodType<string & {
2122
+ __prisma_table: "Bags";
2123
+ __prisma_field: "bag_name";
2124
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2125
+ __prisma_table: "Bags";
2126
+ __prisma_field: "bag_name";
2127
+ }, string>>;
2128
+ description: import("zod/v4").ZodType<string & {
2129
+ __prisma_table: "Bags";
2130
+ __prisma_field: "description";
2131
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2132
+ __prisma_table: "Bags";
2133
+ __prisma_field: "description";
2134
+ }, string>>;
2135
+ owner_id: import("zod/v4").ZodOptional<import("zod/v4").ZodType<PrismaField<"Bags", "owner_id">, string | null, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Bags", "owner_id">, string | null>>>;
2136
+ create_only: import("zod/v4").ZodBoolean;
2137
+ }, import("zod/v4/core").$strip>, {
2138
+ description: string & {
2139
+ __prisma_table: "Bags";
2140
+ __prisma_field: "description";
2141
+ };
2142
+ owner_id: PrismaField<"Bags", "owner_id">;
2143
+ bag_id: string & {
2144
+ __prisma_table: "Bags";
2145
+ __prisma_field: "bag_id";
2146
+ };
2147
+ bag_name: string & {
2148
+ __prisma_table: "Bags";
2149
+ __prisma_field: "bag_name";
2150
+ };
2151
+ }>;
2152
+ assertCreateOrUpdate({ existing, isCreate, owner_id, type, user }: {
2153
+ user: ServerRequest["user"];
2154
+ isCreate: boolean;
2155
+ owner_id?: PrismaField<"Users", "user_id"> | null;
2156
+ existing: {
2157
+ owner_id: PrismaField<"Users", "user_id"> | null;
2158
+ } | null;
2159
+ type: "recipe" | "bag";
2160
+ }): void;
2161
+ recipe_delete: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2162
+ recipe_name: import("zod/v4").ZodString;
2163
+ }, import("zod/v4/core").$strip>, null>;
2164
+ bag_delete: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2165
+ bag_name: import("zod/v4").ZodString;
2166
+ }, import("zod/v4/core").$strip>, null>;
2167
+ recipe_acl_update: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2168
+ recipe_name: import("zod/v4").ZodType<string & {
2169
+ __prisma_table: "Recipes";
2170
+ __prisma_field: "recipe_name";
2171
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2172
+ __prisma_table: "Recipes";
2173
+ __prisma_field: "recipe_name";
2174
+ }, string>>;
2175
+ acl: import("zod/v4").ZodArray<import("zod/v4").ZodObject<{
2176
+ role_id: import("zod/v4").ZodType<string & {
2177
+ __prisma_table: "Roles";
2178
+ __prisma_field: "role_id";
2179
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2180
+ __prisma_table: "Roles";
2181
+ __prisma_field: "role_id";
2182
+ }, string>>;
2183
+ permission: import("zod/v4").ZodEnum<{
2184
+ READ: "READ";
2185
+ WRITE: "WRITE";
2186
+ ADMIN: "ADMIN";
2187
+ }>;
2188
+ }, import("zod/v4/core").$strip>>;
2189
+ }, import("zod/v4/core").$strip>, null>;
2190
+ bag_acl_update: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2191
+ bag_name: import("zod/v4").ZodType<string & {
2192
+ __prisma_table: "Bags";
2193
+ __prisma_field: "bag_name";
2194
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2195
+ __prisma_table: "Bags";
2196
+ __prisma_field: "bag_name";
2197
+ }, string>>;
2198
+ acl: import("zod/v4").ZodArray<import("zod/v4").ZodObject<{
2199
+ role_id: import("zod/v4").ZodType<string & {
2200
+ __prisma_table: "Roles";
2201
+ __prisma_field: "role_id";
2202
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2203
+ __prisma_table: "Roles";
2204
+ __prisma_field: "role_id";
2205
+ }, string>>;
2206
+ permission: import("zod/v4").ZodEnum<{
2207
+ READ: "READ";
2208
+ WRITE: "WRITE";
2209
+ ADMIN: "ADMIN";
2210
+ }>;
2211
+ }, import("zod/v4/core").$strip>>;
2212
+ }, import("zod/v4/core").$strip>, null>;
2213
+ }
2214
+ }
2215
+ declare module "packages/mws/src/managers/admin-users" {
2216
+ import { RouterKeyMap, RouterRouteMap, ServerRoute } from "packages/server/src/index";
2217
+ export const UserKeyMap: RouterKeyMap<UserManager, true>;
2218
+ export type UserManagerMap = RouterRouteMap<UserManager>;
2219
+ export class UserManager {
2220
+ static defineRoutes(root: ServerRoute): void;
2221
+ constructor();
2222
+ user_edit_data: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2223
+ user_id: import("zod/v4").ZodType<string & {
2224
+ __prisma_table: "Users";
2225
+ __prisma_field: "user_id";
2226
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2227
+ __prisma_table: "Users";
2228
+ __prisma_field: "user_id";
2229
+ }, string>>;
2230
+ }, import("zod/v4/core").$strip>, {
2231
+ user: {
2232
+ username: string & {
2233
+ __prisma_table: "Users";
2234
+ __prisma_field: "username";
2235
+ };
2236
+ email: string & {
2237
+ __prisma_table: "Users";
2238
+ __prisma_field: "email";
2239
+ };
2240
+ roles: {
2241
+ description: PrismaField<"Roles", "description">;
2242
+ role_id: string & {
2243
+ __prisma_table: "Roles";
2244
+ __prisma_field: "role_id";
2245
+ };
2246
+ role_name: string & {
2247
+ __prisma_table: "Roles";
2248
+ __prisma_field: "role_name";
2249
+ };
2250
+ }[];
2251
+ user_id: string & {
2252
+ __prisma_table: "Users";
2253
+ __prisma_field: "user_id";
2254
+ };
2255
+ created_at: Date & {
2256
+ __prisma_table: "Users";
2257
+ __prisma_field: "created_at";
2258
+ };
2259
+ last_login: PrismaField<"Users", "last_login">;
2260
+ };
2261
+ allRoles: {
2262
+ description: PrismaField<"Roles", "description">;
2263
+ role_id: string & {
2264
+ __prisma_table: "Roles";
2265
+ __prisma_field: "role_id";
2266
+ };
2267
+ role_name: string & {
2268
+ __prisma_table: "Roles";
2269
+ __prisma_field: "role_name";
2270
+ };
2271
+ }[];
2272
+ }>;
2273
+ user_list: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodUndefined, {
2274
+ last_login: string | undefined;
2275
+ created_at: string;
2276
+ username: string & {
2277
+ __prisma_table: "Users";
2278
+ __prisma_field: "username";
2279
+ };
2280
+ email: string & {
2281
+ __prisma_table: "Users";
2282
+ __prisma_field: "email";
2283
+ };
2284
+ roles: {
2285
+ description: PrismaField<"Roles", "description">;
2286
+ role_id: string & {
2287
+ __prisma_table: "Roles";
2288
+ __prisma_field: "role_id";
2289
+ };
2290
+ role_name: string & {
2291
+ __prisma_table: "Roles";
2292
+ __prisma_field: "role_name";
2293
+ };
2294
+ }[];
2295
+ user_id: string & {
2296
+ __prisma_table: "Users";
2297
+ __prisma_field: "user_id";
2298
+ };
2299
+ }[]>;
2300
+ user_create: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2301
+ username: import("zod/v4").ZodString;
2302
+ email: import("zod/v4").ZodString;
2303
+ role_ids: import("zod/v4").ZodArray<import("zod/v4").ZodType<string & {
2304
+ __prisma_table: "Roles";
2305
+ __prisma_field: "role_id";
2306
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2307
+ __prisma_table: "Roles";
2308
+ __prisma_field: "role_id";
2309
+ }, string>>>;
2310
+ }, import("zod/v4/core").$strip>, {
2311
+ user_id: string & {
2312
+ __prisma_table: "Users";
2313
+ __prisma_field: "user_id";
2314
+ };
2315
+ created_at: Date & {
2316
+ __prisma_table: "Users";
2317
+ __prisma_field: "created_at";
2318
+ };
2319
+ }>;
2320
+ user_update: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2321
+ user_id: import("zod/v4").ZodType<string & {
2322
+ __prisma_table: "Users";
2323
+ __prisma_field: "user_id";
2324
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2325
+ __prisma_table: "Users";
2326
+ __prisma_field: "user_id";
2327
+ }, string>>;
2328
+ username: import("zod/v4").ZodType<string & {
2329
+ __prisma_table: "Users";
2330
+ __prisma_field: "username";
2331
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2332
+ __prisma_table: "Users";
2333
+ __prisma_field: "username";
2334
+ }, string>>;
2335
+ email: import("zod/v4").ZodType<string & {
2336
+ __prisma_table: "Users";
2337
+ __prisma_field: "email";
2338
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2339
+ __prisma_table: "Users";
2340
+ __prisma_field: "email";
2341
+ }, string>>;
2342
+ role_ids: import("zod/v4").ZodArray<import("zod/v4").ZodType<string & {
2343
+ __prisma_table: "Roles";
2344
+ __prisma_field: "role_id";
2345
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2346
+ __prisma_table: "Roles";
2347
+ __prisma_field: "role_id";
2348
+ }, string>>>;
2349
+ }, import("zod/v4/core").$strip>, null>;
2350
+ user_delete: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2351
+ user_id: import("zod/v4").ZodType<string & {
2352
+ __prisma_table: "Users";
2353
+ __prisma_field: "user_id";
2354
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2355
+ __prisma_table: "Users";
2356
+ __prisma_field: "user_id";
2357
+ }, string>>;
2358
+ }, import("zod/v4/core").$strip>, null>;
2359
+ user_update_password: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2360
+ user_id: import("zod/v4").ZodType<string & {
2361
+ __prisma_table: "Users";
2362
+ __prisma_field: "user_id";
2363
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2364
+ __prisma_table: "Users";
2365
+ __prisma_field: "user_id";
2366
+ }, string>>;
2367
+ registrationRequest: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
2368
+ registrationRecord: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
2369
+ session_id: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
2370
+ signature: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
2371
+ }, import("zod/v4/core").$strip>, string | null>;
2372
+ role_create: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2373
+ role_name: import("zod/v4").ZodString;
2374
+ description: import("zod/v4").ZodString;
2375
+ }, import("zod/v4/core").$strip>, {
2376
+ description: PrismaField<"Roles", "description">;
2377
+ role_id: string & {
2378
+ __prisma_table: "Roles";
2379
+ __prisma_field: "role_id";
2380
+ };
2381
+ role_name: string & {
2382
+ __prisma_table: "Roles";
2383
+ __prisma_field: "role_name";
2384
+ };
2385
+ }>;
2386
+ role_update: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2387
+ role_id: import("zod/v4").ZodType<string & {
2388
+ __prisma_table: "Roles";
2389
+ __prisma_field: "role_id";
2390
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2391
+ __prisma_table: "Roles";
2392
+ __prisma_field: "role_id";
2393
+ }, string>>;
2394
+ role_name: import("zod/v4").ZodType<string & {
2395
+ __prisma_table: "Roles";
2396
+ __prisma_field: "role_name";
2397
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
2398
+ __prisma_table: "Roles";
2399
+ __prisma_field: "role_name";
2400
+ }, string>>;
2401
+ description: import("zod/v4").ZodType<PrismaField<"Roles", "description">, string | null, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Roles", "description">, string | null>>;
2402
+ }, import("zod/v4/core").$strip>, {
2403
+ description: PrismaField<"Roles", "description">;
2404
+ role_id: string & {
2405
+ __prisma_table: "Roles";
2406
+ __prisma_field: "role_id";
2407
+ };
2408
+ role_name: string & {
2409
+ __prisma_table: "Roles";
2410
+ __prisma_field: "role_name";
2411
+ };
2412
+ }>;
2413
+ }
2414
+ }
2415
+ declare module "packages/mws/src/managers/admin-settings" {
2416
+ import { RouterKeyMap, RouterRouteMap, ServerRoute } from "packages/server/src/index";
2417
+ export const SettingsKeyMap: RouterKeyMap<SettingsManager, true>;
2418
+ export type SettingsManagerMap = RouterRouteMap<SettingsManager>;
2419
+ class SettingsManager {
2420
+ static defineRoutes(root: ServerRoute): void;
2421
+ settings_read: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodUndefined, {
2422
+ value: (string & {
2423
+ __prisma_table: "Settings";
2424
+ __prisma_field: "value";
2425
+ }) | undefined;
2426
+ key: string;
2427
+ description: string;
2428
+ valueType: "string" | "boolean" | "number";
2429
+ }[]>;
2430
+ settings_update: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
2431
+ key: import("zod/v4").ZodString;
2432
+ value: import("zod/v4").ZodString;
2433
+ }, import("zod/v4/core").$strip>, {
2434
+ success: true;
2435
+ }>;
2436
+ }
2437
+ }
2438
+ declare module "packages/mws/src/managers/WikiStateStore" {
2439
+ import { TiddlerStore_PrismaTransaction } from "packages/mws/src/managers/TiddlerStore";
2440
+ import { ServerRequest } from "packages/server/src/index";
2441
+ /** Basically a bunch of methods to help with wiki routes. */
2442
+ export class WikiStateStore extends TiddlerStore_PrismaTransaction {
2443
+ protected state: ServerRequest;
2444
+ constructor(state: ServerRequest, prisma: PrismaTxnClient);
2445
+ serveIndexFile(recipe_name: PrismaField<"Recipes", "recipe_name">): Promise<symbol>;
2446
+ private serveStoreTiddlers;
2447
+ serveBagTiddler(bag_id: PrismaField<"Bags", "bag_id">, bag_name: PrismaField<"Bags", "bag_name">, title: PrismaField<"Tiddlers", "title">): Promise<symbol>;
2448
+ }
2449
+ }
2450
+ declare module "packages/mws/src/managers/wiki-routes" {
2451
+ import { TiddlerFields } from "tiddlywiki";
2452
+ import { BodyFormat, JsonValue, RouterKeyMap, RouterRouteMap, ServerRoute, zod, ZodRoute } from "packages/server/src/index";
2453
+ export const WikiRouterKeyMap: RouterKeyMap<WikiRoutes, true>;
2454
+ export type TiddlerManagerMap = RouterRouteMap<WikiRoutes>;
2455
+ export interface WikiRoute<M extends string, B extends BodyFormat, P extends Record<string, zod.ZodType<any, string | undefined>>, Q extends Record<string, zod.ZodType<any, string[] | undefined>>, T extends zod.ZodTypeAny, R extends JsonValue> extends ZodRoute<M, B, P, Q, T, R> {
2456
+ routeType: "wiki" | "recipe" | "bag";
2457
+ routeName: string;
2458
+ }
2459
+ module "packages/events/src/index" {
2460
+ interface ServerEventsMap {
2461
+ "mws.tiddler.save": [
2462
+ {
2463
+ recipe_name?: string;
2464
+ bag_name: string;
2465
+ title: string;
2466
+ revision_id: string;
2467
+ }
2468
+ ];
2469
+ "mws.tiddler.delete": [
2470
+ {
2471
+ recipe_name?: string;
2472
+ bag_name: string;
2473
+ title: string;
2474
+ revision_id: string;
2475
+ }
2476
+ ];
2477
+ }
2478
+ }
2479
+ module "packages/server/src/index" {
2480
+ interface IncomingHttpHeaders {
2481
+ 'last-event-id'?: string;
2482
+ }
2483
+ }
2484
+ export class WikiRoutes {
2485
+ static defineRoutes: (root: ServerRoute) => void;
2486
+ handleGetRecipeStatus: ZodRoute<"GET" | "HEAD", "ignore", {
2487
+ recipe_name: zod.ZodType<string & {
2488
+ __prisma_table: "Recipes";
2489
+ __prisma_field: "recipe_name";
2490
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2491
+ __prisma_table: "Recipes";
2492
+ __prisma_field: "recipe_name";
2493
+ }, string>>;
2494
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, {
2495
+ isAdmin: boolean;
2496
+ user_id: string & {
2497
+ __prisma_table: "Users";
2498
+ __prisma_field: "user_id";
2499
+ };
2500
+ username: string & {
2501
+ __prisma_table: "Users";
2502
+ __prisma_field: "username";
2503
+ };
2504
+ isLoggedIn: boolean;
2505
+ isReadOnly: boolean;
2506
+ }>;
2507
+ handleGetRecipeEvents: ZodRoute<"GET" | "HEAD", "ignore", {
2508
+ recipe_name: zod.ZodType<string & {
2509
+ __prisma_table: "Recipes";
2510
+ __prisma_field: "recipe_name";
2511
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2512
+ __prisma_table: "Recipes";
2513
+ __prisma_field: "recipe_name";
2514
+ }, string>>;
2515
+ }, {
2516
+ "first-event-id": zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
2517
+ }, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, never>;
2518
+ handleGetBags: ZodRoute<"GET" | "HEAD", "ignore", {
2519
+ recipe_name: zod.ZodType<string & {
2520
+ __prisma_table: "Recipes";
2521
+ __prisma_field: "recipe_name";
2522
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2523
+ __prisma_table: "Recipes";
2524
+ __prisma_field: "recipe_name";
2525
+ }, string>>;
2526
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, {
2527
+ bag_id: string & {
2528
+ __prisma_table: "Bags";
2529
+ __prisma_field: "bag_id";
2530
+ };
2531
+ bag_name: string & {
2532
+ __prisma_table: "Bags";
2533
+ __prisma_field: "bag_name";
2534
+ };
2535
+ position: number & {
2536
+ __prisma_table: "Recipe_bags";
2537
+ __prisma_field: "position";
2538
+ };
2539
+ }[]>;
2540
+ handleGetBagState: ZodRoute<"GET" | "HEAD", "ignore", {
2541
+ recipe_name: zod.ZodType<string & {
2542
+ __prisma_table: "Recipes";
2543
+ __prisma_field: "recipe_name";
2544
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2545
+ __prisma_table: "Recipes";
2546
+ __prisma_field: "recipe_name";
2547
+ }, string>>;
2548
+ bag_name: zod.ZodType<string & {
2549
+ __prisma_table: "Bags";
2550
+ __prisma_field: "bag_name";
2551
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2552
+ __prisma_table: "Bags";
2553
+ __prisma_field: "bag_name";
2554
+ }, string>>;
2555
+ }, {
2556
+ last_known_revision_id: zod.ZodOptional<zod.ZodArray<zod.ZodType<string & {
2557
+ __prisma_table: "Tiddlers";
2558
+ __prisma_field: "revision_id";
2559
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2560
+ __prisma_table: "Tiddlers";
2561
+ __prisma_field: "revision_id";
2562
+ }, string>>>>;
2563
+ include_deleted: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
2564
+ yes: "yes";
2565
+ no: "no";
2566
+ }>>>;
2567
+ }, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, {
2568
+ bag_id: string;
2569
+ bag_name: string;
2570
+ tiddlers: {
2571
+ title: string;
2572
+ revision_id: string;
2573
+ is_deleted: boolean;
2574
+ }[];
2575
+ }>;
2576
+ handleGetAllBagStates: ZodRoute<"GET" | "HEAD", "ignore", {
2577
+ recipe_name: zod.ZodType<string & {
2578
+ __prisma_table: "Recipes";
2579
+ __prisma_field: "recipe_name";
2580
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2581
+ __prisma_table: "Recipes";
2582
+ __prisma_field: "recipe_name";
2583
+ }, string>>;
2584
+ }, {
2585
+ last_known_revision_id: zod.ZodOptional<zod.ZodArray<zod.ZodType<string & {
2586
+ __prisma_table: "Tiddlers";
2587
+ __prisma_field: "revision_id";
2588
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2589
+ __prisma_table: "Tiddlers";
2590
+ __prisma_field: "revision_id";
2591
+ }, string>>>>;
2592
+ include_deleted: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
2593
+ yes: "yes";
2594
+ no: "no";
2595
+ }>>>;
2596
+ gzip_stream: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
2597
+ yes: "yes";
2598
+ no: "no";
2599
+ }>>>;
2600
+ }, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, {
2601
+ bag_id: string;
2602
+ bag_name: string;
2603
+ position: number;
2604
+ tiddlers: {
2605
+ title: string;
2606
+ revision_id: string;
2607
+ is_deleted: boolean;
2608
+ }[];
2609
+ }[]>;
2610
+ rpcLoadRecipeTiddlerList: ZodRoute<"PUT", "json", {
2611
+ recipe_name: zod.ZodType<string & {
2612
+ __prisma_table: "Recipes";
2613
+ __prisma_field: "recipe_name";
2614
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2615
+ __prisma_table: "Recipes";
2616
+ __prisma_field: "recipe_name";
2617
+ }, string>>;
2618
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodObject<{
2619
+ titles: zod.ZodArray<zod.ZodType<string & {
2620
+ __prisma_table: "Tiddlers";
2621
+ __prisma_field: "title";
2622
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2623
+ __prisma_table: "Tiddlers";
2624
+ __prisma_field: "title";
2625
+ }, string>>>;
2626
+ }, zod.z.core.$strict>, TiddlerFields[]>;
2627
+ handleLoadRecipeTiddler: ZodRoute<"GET" | "HEAD", "ignore", {
2628
+ recipe_name: zod.ZodType<string & {
2629
+ __prisma_table: "Recipes";
2630
+ __prisma_field: "recipe_name";
2631
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2632
+ __prisma_table: "Recipes";
2633
+ __prisma_field: "recipe_name";
2634
+ }, string>>;
2635
+ title: zod.ZodType<string & {
2636
+ __prisma_table: "Tiddlers";
2637
+ __prisma_field: "title";
2638
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2639
+ __prisma_table: "Tiddlers";
2640
+ __prisma_field: "title";
2641
+ }, string>>;
2642
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, never>;
2643
+ handleSaveRecipeTiddler: ZodRoute<"PUT", "string", {
2644
+ recipe_name: zod.ZodType<string & {
2645
+ __prisma_table: "Recipes";
2646
+ __prisma_field: "recipe_name";
2647
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2648
+ __prisma_table: "Recipes";
2649
+ __prisma_field: "recipe_name";
2650
+ }, string>>;
2651
+ title: zod.ZodType<string & {
2652
+ __prisma_table: "Tiddlers";
2653
+ __prisma_field: "title";
2654
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2655
+ __prisma_table: "Tiddlers";
2656
+ __prisma_field: "title";
2657
+ }, string>>;
2658
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodString, {
2659
+ bag_name: string & {
2660
+ __prisma_table: "Bags";
2661
+ __prisma_field: "bag_name";
2662
+ };
2663
+ revision_id: string & {
2664
+ __prisma_table: "Tiddlers";
2665
+ __prisma_field: "revision_id";
2666
+ };
2667
+ }>;
2668
+ handleDeleteRecipeTiddler: ZodRoute<"DELETE", "json", {
2669
+ recipe_name: zod.ZodType<string & {
2670
+ __prisma_table: "Recipes";
2671
+ __prisma_field: "recipe_name";
2672
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2673
+ __prisma_table: "Recipes";
2674
+ __prisma_field: "recipe_name";
2675
+ }, string>>;
2676
+ title: zod.ZodType<string & {
2677
+ __prisma_table: "Tiddlers";
2678
+ __prisma_field: "title";
2679
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2680
+ __prisma_table: "Tiddlers";
2681
+ __prisma_field: "title";
2682
+ }, string>>;
2683
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodUndefined, {
2684
+ bag_name: string & {
2685
+ __prisma_table: "Bags";
2686
+ __prisma_field: "bag_name";
2687
+ };
2688
+ revision_id: string & {
2689
+ __prisma_table: "Tiddlers";
2690
+ __prisma_field: "revision_id";
2691
+ };
2692
+ }>;
2693
+ handleFormMultipartRecipeTiddler: ZodRoute<"POST", "stream", {
2694
+ recipe_name: zod.ZodType<string & {
2695
+ __prisma_table: "Recipes";
2696
+ __prisma_field: "recipe_name";
2697
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2698
+ __prisma_table: "Recipes";
2699
+ __prisma_field: "recipe_name";
2700
+ }, string>>;
2701
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, {
2702
+ bag_name: string & {
2703
+ __prisma_table: "Bags";
2704
+ __prisma_field: "bag_name";
2705
+ };
2706
+ results: {
2707
+ revision_id: string & {
2708
+ __prisma_table: "Tiddlers";
2709
+ __prisma_field: "revision_id";
2710
+ };
2711
+ bag_name: string & {
2712
+ __prisma_table: "Bags";
2713
+ __prisma_field: "bag_name";
2714
+ };
2715
+ };
2716
+ }>;
2717
+ handleLoadBagTiddler: ZodRoute<"GET" | "HEAD", "ignore", {
2718
+ bag_name: zod.ZodType<string & {
2719
+ __prisma_table: "Bags";
2720
+ __prisma_field: "bag_name";
2721
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2722
+ __prisma_table: "Bags";
2723
+ __prisma_field: "bag_name";
2724
+ }, string>>;
2725
+ title: zod.ZodType<string & {
2726
+ __prisma_table: "Tiddlers";
2727
+ __prisma_field: "title";
2728
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2729
+ __prisma_table: "Tiddlers";
2730
+ __prisma_field: "title";
2731
+ }, string>>;
2732
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, never>;
2733
+ handleSaveBagTiddler: ZodRoute<"PUT", "string", {
2734
+ bag_name: zod.ZodType<string & {
2735
+ __prisma_table: "Bags";
2736
+ __prisma_field: "bag_name";
2737
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2738
+ __prisma_table: "Bags";
2739
+ __prisma_field: "bag_name";
2740
+ }, string>>;
2741
+ title: zod.ZodType<string & {
2742
+ __prisma_table: "Tiddlers";
2743
+ __prisma_field: "title";
2744
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2745
+ __prisma_table: "Tiddlers";
2746
+ __prisma_field: "title";
2747
+ }, string>>;
2748
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodString, {
2749
+ revision_id: string & {
2750
+ __prisma_table: "Tiddlers";
2751
+ __prisma_field: "revision_id";
2752
+ };
2753
+ }>;
2754
+ handleDeleteBagTiddler: ZodRoute<"DELETE", "ignore", {
2755
+ bag_name: zod.ZodType<string & {
2756
+ __prisma_table: "Bags";
2757
+ __prisma_field: "bag_name";
2758
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2759
+ __prisma_table: "Bags";
2760
+ __prisma_field: "bag_name";
2761
+ }, string>>;
2762
+ title: zod.ZodType<string & {
2763
+ __prisma_table: "Tiddlers";
2764
+ __prisma_field: "title";
2765
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2766
+ __prisma_table: "Tiddlers";
2767
+ __prisma_field: "title";
2768
+ }, string>>;
2769
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, {
2770
+ revision_id: string & {
2771
+ __prisma_table: "Tiddlers";
2772
+ __prisma_field: "revision_id";
2773
+ };
2774
+ }>;
2775
+ handleFormMultipartBagTiddler: ZodRoute<"POST", "stream", {
2776
+ bag_name: zod.ZodType<string & {
2777
+ __prisma_table: "Bags";
2778
+ __prisma_field: "bag_name";
2779
+ }, string, zod.z.core.$ZodTypeInternals<string & {
2780
+ __prisma_table: "Bags";
2781
+ __prisma_field: "bag_name";
2782
+ }, string>>;
2783
+ }, Record<string, zod.ZodType<any, string[] | undefined, zod.z.core.$ZodTypeInternals<any, string[] | undefined>>>, zod.ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>, {
2784
+ revision_id: string & {
2785
+ __prisma_table: "Tiddlers";
2786
+ __prisma_field: "revision_id";
2787
+ };
2788
+ }>;
2789
+ }
2790
+ }
2791
+ declare module "packages/mws/src/managers/index" {
2792
+ import "packages/mws/src/managers/admin-recipes";
2793
+ import "packages/mws/src/managers/admin-users";
2794
+ import "packages/mws/src/managers/admin-settings";
2795
+ import "packages/mws/src/managers/wiki-routes";
2796
+ import { RouterKeyMap, RouterRouteMap, ServerRoute } from "packages/server/src/index";
2797
+ export * from "packages/mws/src/managers/admin-recipes";
2798
+ export * from "packages/mws/src/managers/admin-users";
2799
+ export * from "packages/mws/src/managers/wiki-routes";
2800
+ export const StatusKeyMap: RouterKeyMap<StatusManager, true>;
2801
+ export type StatusManagerMap = RouterRouteMap<StatusManager>;
2802
+ export class StatusManager {
2803
+ static defineRoutes(root: ServerRoute): void;
2804
+ constructor();
2805
+ index_json: import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodUndefined, {
2806
+ bagList: ({
2807
+ _count: {
2808
+ recipe_bags: number;
2809
+ tiddlers: number;
2810
+ acl: number;
2811
+ };
2812
+ acl: {
2813
+ acl_id: number & {
2814
+ __prisma_table: "BagAcl";
2815
+ __prisma_field: "acl_id";
2816
+ };
2817
+ role_id: string & {
2818
+ __prisma_table: "BagAcl";
2819
+ __prisma_field: "role_id";
2820
+ };
2821
+ permission: PrismaField<"BagAcl", "permission">;
2822
+ bag_id: string & {
2823
+ __prisma_table: "BagAcl";
2824
+ __prisma_field: "bag_id";
2825
+ };
2826
+ }[];
2827
+ } & {
2828
+ description: string & {
2829
+ __prisma_table: "Bags";
2830
+ __prisma_field: "description";
2831
+ };
2832
+ owner_id: PrismaField<"Bags", "owner_id">;
2833
+ bag_id: string & {
2834
+ __prisma_table: "Bags";
2835
+ __prisma_field: "bag_id";
2836
+ };
2837
+ bag_name: string & {
2838
+ __prisma_table: "Bags";
2839
+ __prisma_field: "bag_name";
2840
+ };
2841
+ })[];
2842
+ recipeList: ({
2843
+ _count: {
2844
+ recipe_bags: number;
2845
+ acl: number;
2846
+ };
2847
+ recipe_bags: {
2848
+ position: number & {
2849
+ __prisma_table: "Recipe_bags";
2850
+ __prisma_field: "position";
2851
+ };
2852
+ bag_id: string & {
2853
+ __prisma_table: "Bags";
2854
+ __prisma_field: "bag_id";
2855
+ };
2856
+ with_acl: PrismaField<"Recipe_bags", "with_acl">;
2857
+ }[];
2858
+ acl: {
2859
+ recipe_id: string & {
2860
+ __prisma_table: "RecipeAcl";
2861
+ __prisma_field: "recipe_id";
2862
+ };
2863
+ acl_id: number & {
2864
+ __prisma_table: "RecipeAcl";
2865
+ __prisma_field: "acl_id";
2866
+ };
2867
+ role_id: string & {
2868
+ __prisma_table: "RecipeAcl";
2869
+ __prisma_field: "role_id";
2870
+ };
2871
+ permission: PrismaField<"RecipeAcl", "permission">;
2872
+ }[];
2873
+ } & {
2874
+ description: string & {
2875
+ __prisma_table: "Recipes";
2876
+ __prisma_field: "description";
2877
+ };
2878
+ recipe_id: string & {
2879
+ __prisma_table: "Recipes";
2880
+ __prisma_field: "recipe_id";
2881
+ };
2882
+ recipe_name: string & {
2883
+ __prisma_table: "Recipes";
2884
+ __prisma_field: "recipe_name";
2885
+ };
2886
+ owner_id: PrismaField<"Recipes", "owner_id">;
2887
+ plugin_names: PrismaJson.Recipes_plugin_names & {
2888
+ __prisma_table: "Recipes";
2889
+ __prisma_field: "plugin_names";
2890
+ };
2891
+ skip_required_plugins: PrismaField<"Recipes", "skip_required_plugins">;
2892
+ skip_core: PrismaField<"Recipes", "skip_core">;
2893
+ })[];
2894
+ isAdmin: boolean;
2895
+ user_id: string & {
2896
+ __prisma_table: "Users";
2897
+ __prisma_field: "user_id";
2898
+ };
2899
+ userListUser: false | {
2900
+ username: string & {
2901
+ __prisma_table: "Users";
2902
+ __prisma_field: "username";
2903
+ };
2904
+ user_id: string & {
2905
+ __prisma_table: "Users";
2906
+ __prisma_field: "user_id";
2907
+ };
2908
+ }[];
2909
+ userListAdmin: false | {
2910
+ username: string & {
2911
+ __prisma_table: "Users";
2912
+ __prisma_field: "username";
2913
+ };
2914
+ email: string & {
2915
+ __prisma_table: "Users";
2916
+ __prisma_field: "email";
2917
+ };
2918
+ roles: {
2919
+ description: PrismaField<"Roles", "description">;
2920
+ role_id: string & {
2921
+ __prisma_table: "Roles";
2922
+ __prisma_field: "role_id";
2923
+ };
2924
+ role_name: string & {
2925
+ __prisma_table: "Roles";
2926
+ __prisma_field: "role_name";
2927
+ };
2928
+ }[];
2929
+ user_id: string & {
2930
+ __prisma_table: "Users";
2931
+ __prisma_field: "user_id";
2932
+ };
2933
+ created_at: Date & {
2934
+ __prisma_table: "Users";
2935
+ __prisma_field: "created_at";
2936
+ };
2937
+ last_login: PrismaField<"Users", "last_login">;
2938
+ }[];
2939
+ roleList: {
2940
+ description: PrismaField<"Roles", "description">;
2941
+ role_id: string & {
2942
+ __prisma_table: "Roles";
2943
+ __prisma_field: "role_id";
2944
+ };
2945
+ role_name: string & {
2946
+ __prisma_table: "Roles";
2947
+ __prisma_field: "role_name";
2948
+ };
2949
+ }[];
2950
+ username: string & {
2951
+ __prisma_table: "Users";
2952
+ __prisma_field: "username";
2953
+ };
2954
+ clientPlugins: string[];
2955
+ corePlugins: string[];
2956
+ isLoggedIn: boolean;
2957
+ allowAnonReads: false;
2958
+ allowAnonWrites: false;
2959
+ versions: {
2960
+ tw5: any;
2961
+ mws: string;
2962
+ };
2963
+ }>;
2964
+ }
2965
+ }
2966
+ declare module "packages/mws/src/commands/build-types" {
2967
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
2968
+ export const info: CommandInfo;
2969
+ export class Command extends BaseCommand<[], {}> {
2970
+ execute(): Promise<void>;
2971
+ getEndpoints(): (readonly ["index_json", import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodUndefined, {
2972
+ bagList: ({
2973
+ _count: {
2974
+ recipe_bags: number;
2975
+ tiddlers: number;
2976
+ acl: number;
2977
+ };
2978
+ acl: {
2979
+ acl_id: number & {
2980
+ __prisma_table: "BagAcl";
2981
+ __prisma_field: "acl_id";
2982
+ };
2983
+ role_id: string & {
2984
+ __prisma_table: "BagAcl";
2985
+ __prisma_field: "role_id";
2986
+ };
2987
+ permission: PrismaField<"BagAcl", "permission">;
2988
+ bag_id: string & {
2989
+ __prisma_table: "BagAcl";
2990
+ __prisma_field: "bag_id";
2991
+ };
2992
+ }[];
2993
+ } & {
2994
+ description: string & {
2995
+ __prisma_table: "Bags";
2996
+ __prisma_field: "description";
2997
+ };
2998
+ owner_id: PrismaField<"Bags", "owner_id">;
2999
+ bag_id: string & {
3000
+ __prisma_table: "Bags";
3001
+ __prisma_field: "bag_id";
3002
+ };
3003
+ bag_name: string & {
3004
+ __prisma_table: "Bags";
3005
+ __prisma_field: "bag_name";
3006
+ };
3007
+ })[];
3008
+ recipeList: ({
3009
+ _count: {
3010
+ recipe_bags: number;
3011
+ acl: number;
3012
+ };
3013
+ recipe_bags: {
3014
+ position: number & {
3015
+ __prisma_table: "Recipe_bags";
3016
+ __prisma_field: "position";
3017
+ };
3018
+ bag_id: string & {
3019
+ __prisma_table: "Bags";
3020
+ __prisma_field: "bag_id";
3021
+ };
3022
+ with_acl: PrismaField<"Recipe_bags", "with_acl">;
3023
+ }[];
3024
+ acl: {
3025
+ recipe_id: string & {
3026
+ __prisma_table: "RecipeAcl";
3027
+ __prisma_field: "recipe_id";
3028
+ };
3029
+ acl_id: number & {
3030
+ __prisma_table: "RecipeAcl";
3031
+ __prisma_field: "acl_id";
3032
+ };
3033
+ role_id: string & {
3034
+ __prisma_table: "RecipeAcl";
3035
+ __prisma_field: "role_id";
3036
+ };
3037
+ permission: PrismaField<"RecipeAcl", "permission">;
3038
+ }[];
3039
+ } & {
3040
+ description: string & {
3041
+ __prisma_table: "Recipes";
3042
+ __prisma_field: "description";
3043
+ };
3044
+ recipe_id: string & {
3045
+ __prisma_table: "Recipes";
3046
+ __prisma_field: "recipe_id";
3047
+ };
3048
+ recipe_name: string & {
3049
+ __prisma_table: "Recipes";
3050
+ __prisma_field: "recipe_name";
3051
+ };
3052
+ owner_id: PrismaField<"Recipes", "owner_id">;
3053
+ plugin_names: PrismaJson.Recipes_plugin_names & {
3054
+ __prisma_table: "Recipes";
3055
+ __prisma_field: "plugin_names";
3056
+ };
3057
+ skip_required_plugins: PrismaField<"Recipes", "skip_required_plugins">;
3058
+ skip_core: PrismaField<"Recipes", "skip_core">;
3059
+ })[];
3060
+ isAdmin: boolean;
3061
+ user_id: string & {
3062
+ __prisma_table: "Users";
3063
+ __prisma_field: "user_id";
3064
+ };
3065
+ userListUser: false | {
3066
+ username: string & {
3067
+ __prisma_table: "Users";
3068
+ __prisma_field: "username";
3069
+ };
3070
+ user_id: string & {
3071
+ __prisma_table: "Users";
3072
+ __prisma_field: "user_id";
3073
+ };
3074
+ }[];
3075
+ userListAdmin: false | {
3076
+ username: string & {
3077
+ __prisma_table: "Users";
3078
+ __prisma_field: "username";
3079
+ };
3080
+ email: string & {
3081
+ __prisma_table: "Users";
3082
+ __prisma_field: "email";
3083
+ };
3084
+ roles: {
3085
+ description: PrismaField<"Roles", "description">;
3086
+ role_id: string & {
3087
+ __prisma_table: "Roles";
3088
+ __prisma_field: "role_id";
3089
+ };
3090
+ role_name: string & {
3091
+ __prisma_table: "Roles";
3092
+ __prisma_field: "role_name";
3093
+ };
3094
+ }[];
3095
+ user_id: string & {
3096
+ __prisma_table: "Users";
3097
+ __prisma_field: "user_id";
3098
+ };
3099
+ created_at: Date & {
3100
+ __prisma_table: "Users";
3101
+ __prisma_field: "created_at";
3102
+ };
3103
+ last_login: PrismaField<"Users", "last_login">;
3104
+ }[];
3105
+ roleList: {
3106
+ description: PrismaField<"Roles", "description">;
3107
+ role_id: string & {
3108
+ __prisma_table: "Roles";
3109
+ __prisma_field: "role_id";
3110
+ };
3111
+ role_name: string & {
3112
+ __prisma_table: "Roles";
3113
+ __prisma_field: "role_name";
3114
+ };
3115
+ }[];
3116
+ username: string & {
3117
+ __prisma_table: "Users";
3118
+ __prisma_field: "username";
3119
+ };
3120
+ clientPlugins: string[];
3121
+ corePlugins: string[];
3122
+ isLoggedIn: boolean;
3123
+ allowAnonReads: false;
3124
+ allowAnonWrites: false;
3125
+ versions: {
3126
+ tw5: any;
3127
+ mws: string;
3128
+ };
3129
+ }>] | readonly ["user_edit_data" | "user_list" | "user_create" | "user_update" | "user_delete" | "user_update_password" | "role_create" | "role_update", import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3130
+ user_id: import("zod/v4").ZodType<string & {
3131
+ __prisma_table: "Users";
3132
+ __prisma_field: "user_id";
3133
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3134
+ __prisma_table: "Users";
3135
+ __prisma_field: "user_id";
3136
+ }, string>>;
3137
+ }, import("zod/v4/core").$strip>, {
3138
+ user: {
3139
+ username: string & {
3140
+ __prisma_table: "Users";
3141
+ __prisma_field: "username";
3142
+ };
3143
+ email: string & {
3144
+ __prisma_table: "Users";
3145
+ __prisma_field: "email";
3146
+ };
3147
+ roles: {
3148
+ description: PrismaField<"Roles", "description">;
3149
+ role_id: string & {
3150
+ __prisma_table: "Roles";
3151
+ __prisma_field: "role_id";
3152
+ };
3153
+ role_name: string & {
3154
+ __prisma_table: "Roles";
3155
+ __prisma_field: "role_name";
3156
+ };
3157
+ }[];
3158
+ user_id: string & {
3159
+ __prisma_table: "Users";
3160
+ __prisma_field: "user_id";
3161
+ };
3162
+ created_at: Date & {
3163
+ __prisma_table: "Users";
3164
+ __prisma_field: "created_at";
3165
+ };
3166
+ last_login: PrismaField<"Users", "last_login">;
3167
+ };
3168
+ allRoles: {
3169
+ description: PrismaField<"Roles", "description">;
3170
+ role_id: string & {
3171
+ __prisma_table: "Roles";
3172
+ __prisma_field: "role_id";
3173
+ };
3174
+ role_name: string & {
3175
+ __prisma_table: "Roles";
3176
+ __prisma_field: "role_name";
3177
+ };
3178
+ }[];
3179
+ }> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodUndefined, {
3180
+ last_login: string | undefined;
3181
+ created_at: string;
3182
+ username: string & {
3183
+ __prisma_table: "Users";
3184
+ __prisma_field: "username";
3185
+ };
3186
+ email: string & {
3187
+ __prisma_table: "Users";
3188
+ __prisma_field: "email";
3189
+ };
3190
+ roles: {
3191
+ description: PrismaField<"Roles", "description">;
3192
+ role_id: string & {
3193
+ __prisma_table: "Roles";
3194
+ __prisma_field: "role_id";
3195
+ };
3196
+ role_name: string & {
3197
+ __prisma_table: "Roles";
3198
+ __prisma_field: "role_name";
3199
+ };
3200
+ }[];
3201
+ user_id: string & {
3202
+ __prisma_table: "Users";
3203
+ __prisma_field: "user_id";
3204
+ };
3205
+ }[]> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3206
+ username: import("zod/v4").ZodString;
3207
+ email: import("zod/v4").ZodString;
3208
+ role_ids: import("zod/v4").ZodArray<import("zod/v4").ZodType<string & {
3209
+ __prisma_table: "Roles";
3210
+ __prisma_field: "role_id";
3211
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3212
+ __prisma_table: "Roles";
3213
+ __prisma_field: "role_id";
3214
+ }, string>>>;
3215
+ }, import("zod/v4/core").$strip>, {
3216
+ user_id: string & {
3217
+ __prisma_table: "Users";
3218
+ __prisma_field: "user_id";
3219
+ };
3220
+ created_at: Date & {
3221
+ __prisma_table: "Users";
3222
+ __prisma_field: "created_at";
3223
+ };
3224
+ }> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3225
+ user_id: import("zod/v4").ZodType<string & {
3226
+ __prisma_table: "Users";
3227
+ __prisma_field: "user_id";
3228
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3229
+ __prisma_table: "Users";
3230
+ __prisma_field: "user_id";
3231
+ }, string>>;
3232
+ username: import("zod/v4").ZodType<string & {
3233
+ __prisma_table: "Users";
3234
+ __prisma_field: "username";
3235
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3236
+ __prisma_table: "Users";
3237
+ __prisma_field: "username";
3238
+ }, string>>;
3239
+ email: import("zod/v4").ZodType<string & {
3240
+ __prisma_table: "Users";
3241
+ __prisma_field: "email";
3242
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3243
+ __prisma_table: "Users";
3244
+ __prisma_field: "email";
3245
+ }, string>>;
3246
+ role_ids: import("zod/v4").ZodArray<import("zod/v4").ZodType<string & {
3247
+ __prisma_table: "Roles";
3248
+ __prisma_field: "role_id";
3249
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3250
+ __prisma_table: "Roles";
3251
+ __prisma_field: "role_id";
3252
+ }, string>>>;
3253
+ }, import("zod/v4/core").$strip>, null> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3254
+ user_id: import("zod/v4").ZodType<string & {
3255
+ __prisma_table: "Users";
3256
+ __prisma_field: "user_id";
3257
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3258
+ __prisma_table: "Users";
3259
+ __prisma_field: "user_id";
3260
+ }, string>>;
3261
+ }, import("zod/v4/core").$strip>, null> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3262
+ user_id: import("zod/v4").ZodType<string & {
3263
+ __prisma_table: "Users";
3264
+ __prisma_field: "user_id";
3265
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3266
+ __prisma_table: "Users";
3267
+ __prisma_field: "user_id";
3268
+ }, string>>;
3269
+ registrationRequest: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
3270
+ registrationRecord: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
3271
+ session_id: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
3272
+ signature: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
3273
+ }, import("zod/v4/core").$strip>, string | null> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3274
+ role_name: import("zod/v4").ZodString;
3275
+ description: import("zod/v4").ZodString;
3276
+ }, import("zod/v4/core").$strip>, {
3277
+ description: PrismaField<"Roles", "description">;
3278
+ role_id: string & {
3279
+ __prisma_table: "Roles";
3280
+ __prisma_field: "role_id";
3281
+ };
3282
+ role_name: string & {
3283
+ __prisma_table: "Roles";
3284
+ __prisma_field: "role_name";
3285
+ };
3286
+ }> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3287
+ role_id: import("zod/v4").ZodType<string & {
3288
+ __prisma_table: "Roles";
3289
+ __prisma_field: "role_id";
3290
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3291
+ __prisma_table: "Roles";
3292
+ __prisma_field: "role_id";
3293
+ }, string>>;
3294
+ role_name: import("zod/v4").ZodType<string & {
3295
+ __prisma_table: "Roles";
3296
+ __prisma_field: "role_name";
3297
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3298
+ __prisma_table: "Roles";
3299
+ __prisma_field: "role_name";
3300
+ }, string>>;
3301
+ description: import("zod/v4").ZodType<PrismaField<"Roles", "description">, string | null, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Roles", "description">, string | null>>;
3302
+ }, import("zod/v4/core").$strip>, {
3303
+ description: PrismaField<"Roles", "description">;
3304
+ role_id: string & {
3305
+ __prisma_table: "Roles";
3306
+ __prisma_field: "role_id";
3307
+ };
3308
+ role_name: string & {
3309
+ __prisma_table: "Roles";
3310
+ __prisma_field: "role_name";
3311
+ };
3312
+ }>] | readonly ["recipe_create_or_update" | "bag_create_or_update" | "recipe_delete" | "bag_delete" | "recipe_acl_update" | "bag_acl_update", import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3313
+ recipe_name: import("zod/v4").ZodType<string & {
3314
+ __prisma_table: "Recipes";
3315
+ __prisma_field: "recipe_name";
3316
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3317
+ __prisma_table: "Recipes";
3318
+ __prisma_field: "recipe_name";
3319
+ }, string>>;
3320
+ description: import("zod/v4").ZodType<string & {
3321
+ __prisma_table: "Recipes";
3322
+ __prisma_field: "description";
3323
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3324
+ __prisma_table: "Recipes";
3325
+ __prisma_field: "description";
3326
+ }, string>>;
3327
+ bag_names: import("zod/v4").ZodArray<import("zod/v4").ZodObject<{
3328
+ bag_name: import("zod/v4").ZodString;
3329
+ with_acl: import("zod/v4").ZodBoolean;
3330
+ }, import("zod/v4/core").$strip>>;
3331
+ plugin_names: import("zod/v4").ZodArray<import("zod/v4").ZodString>;
3332
+ owner_id: import("zod/v4").ZodOptional<import("zod/v4").ZodType<PrismaField<"Recipes", "owner_id">, string | null, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Recipes", "owner_id">, string | null>>>;
3333
+ skip_required_plugins: import("zod/v4").ZodType<PrismaField<"Recipes", "skip_required_plugins">, boolean, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Recipes", "skip_required_plugins">, boolean>>;
3334
+ skip_core: import("zod/v4").ZodType<PrismaField<"Recipes", "skip_core">, boolean, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Recipes", "skip_core">, boolean>>;
3335
+ create_only: import("zod/v4").ZodBoolean;
3336
+ }, import("zod/v4/core").$strip>, {
3337
+ description: string & {
3338
+ __prisma_table: "Recipes";
3339
+ __prisma_field: "description";
3340
+ };
3341
+ recipe_id: string & {
3342
+ __prisma_table: "Recipes";
3343
+ __prisma_field: "recipe_id";
3344
+ };
3345
+ recipe_name: string & {
3346
+ __prisma_table: "Recipes";
3347
+ __prisma_field: "recipe_name";
3348
+ };
3349
+ owner_id: PrismaField<"Recipes", "owner_id">;
3350
+ plugin_names: PrismaJson.Recipes_plugin_names & {
3351
+ __prisma_table: "Recipes";
3352
+ __prisma_field: "plugin_names";
3353
+ };
3354
+ skip_required_plugins: PrismaField<"Recipes", "skip_required_plugins">;
3355
+ skip_core: PrismaField<"Recipes", "skip_core">;
3356
+ }> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3357
+ bag_name: import("zod/v4").ZodType<string & {
3358
+ __prisma_table: "Bags";
3359
+ __prisma_field: "bag_name";
3360
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3361
+ __prisma_table: "Bags";
3362
+ __prisma_field: "bag_name";
3363
+ }, string>>;
3364
+ description: import("zod/v4").ZodType<string & {
3365
+ __prisma_table: "Bags";
3366
+ __prisma_field: "description";
3367
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3368
+ __prisma_table: "Bags";
3369
+ __prisma_field: "description";
3370
+ }, string>>;
3371
+ owner_id: import("zod/v4").ZodOptional<import("zod/v4").ZodType<PrismaField<"Bags", "owner_id">, string | null, import("zod/v4/core").$ZodTypeInternals<PrismaField<"Bags", "owner_id">, string | null>>>;
3372
+ create_only: import("zod/v4").ZodBoolean;
3373
+ }, import("zod/v4/core").$strip>, {
3374
+ description: string & {
3375
+ __prisma_table: "Bags";
3376
+ __prisma_field: "description";
3377
+ };
3378
+ owner_id: PrismaField<"Bags", "owner_id">;
3379
+ bag_id: string & {
3380
+ __prisma_table: "Bags";
3381
+ __prisma_field: "bag_id";
3382
+ };
3383
+ bag_name: string & {
3384
+ __prisma_table: "Bags";
3385
+ __prisma_field: "bag_name";
3386
+ };
3387
+ }> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3388
+ recipe_name: import("zod/v4").ZodString;
3389
+ }, import("zod/v4/core").$strip>, null> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3390
+ bag_name: import("zod/v4").ZodString;
3391
+ }, import("zod/v4/core").$strip>, null> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3392
+ recipe_name: import("zod/v4").ZodType<string & {
3393
+ __prisma_table: "Recipes";
3394
+ __prisma_field: "recipe_name";
3395
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3396
+ __prisma_table: "Recipes";
3397
+ __prisma_field: "recipe_name";
3398
+ }, string>>;
3399
+ acl: import("zod/v4").ZodArray<import("zod/v4").ZodObject<{
3400
+ role_id: import("zod/v4").ZodType<string & {
3401
+ __prisma_table: "Roles";
3402
+ __prisma_field: "role_id";
3403
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3404
+ __prisma_table: "Roles";
3405
+ __prisma_field: "role_id";
3406
+ }, string>>;
3407
+ permission: import("zod/v4").ZodEnum<{
3408
+ READ: "READ";
3409
+ WRITE: "WRITE";
3410
+ ADMIN: "ADMIN";
3411
+ }>;
3412
+ }, import("zod/v4/core").$strip>>;
3413
+ }, import("zod/v4/core").$strip>, null> | import("@tiddlywiki/server").ZodRoute<"POST", "json", {}, {}, import("zod/v4").ZodObject<{
3414
+ bag_name: import("zod/v4").ZodType<string & {
3415
+ __prisma_table: "Bags";
3416
+ __prisma_field: "bag_name";
3417
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3418
+ __prisma_table: "Bags";
3419
+ __prisma_field: "bag_name";
3420
+ }, string>>;
3421
+ acl: import("zod/v4").ZodArray<import("zod/v4").ZodObject<{
3422
+ role_id: import("zod/v4").ZodType<string & {
3423
+ __prisma_table: "Roles";
3424
+ __prisma_field: "role_id";
3425
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3426
+ __prisma_table: "Roles";
3427
+ __prisma_field: "role_id";
3428
+ }, string>>;
3429
+ permission: import("zod/v4").ZodEnum<{
3430
+ READ: "READ";
3431
+ WRITE: "WRITE";
3432
+ ADMIN: "ADMIN";
3433
+ }>;
3434
+ }, import("zod/v4/core").$strip>>;
3435
+ }, import("zod/v4/core").$strip>, null>] | readonly ["handleGetRecipeStatus" | "handleGetRecipeEvents" | "handleGetBags" | "handleGetBagState" | "handleGetAllBagStates" | "rpcLoadRecipeTiddlerList" | "handleLoadRecipeTiddler" | "handleSaveRecipeTiddler" | "handleDeleteRecipeTiddler" | "handleFormMultipartRecipeTiddler" | "handleLoadBagTiddler" | "handleSaveBagTiddler" | "handleDeleteBagTiddler" | "handleFormMultipartBagTiddler", import("@tiddlywiki/server").ZodRoute<"GET" | "HEAD", "ignore", {
3436
+ recipe_name: import("zod/v4").ZodType<string & {
3437
+ __prisma_table: "Recipes";
3438
+ __prisma_field: "recipe_name";
3439
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3440
+ __prisma_table: "Recipes";
3441
+ __prisma_field: "recipe_name";
3442
+ }, string>>;
3443
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, {
3444
+ isAdmin: boolean;
3445
+ user_id: string & {
3446
+ __prisma_table: "Users";
3447
+ __prisma_field: "user_id";
3448
+ };
3449
+ username: string & {
3450
+ __prisma_table: "Users";
3451
+ __prisma_field: "username";
3452
+ };
3453
+ isLoggedIn: boolean;
3454
+ isReadOnly: boolean;
3455
+ }> | import("@tiddlywiki/server").ZodRoute<"GET" | "HEAD", "ignore", {
3456
+ recipe_name: import("zod/v4").ZodType<string & {
3457
+ __prisma_table: "Recipes";
3458
+ __prisma_field: "recipe_name";
3459
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3460
+ __prisma_table: "Recipes";
3461
+ __prisma_field: "recipe_name";
3462
+ }, string>>;
3463
+ }, {
3464
+ "first-event-id": import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodString>>;
3465
+ }, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, never> | import("@tiddlywiki/server").ZodRoute<"GET" | "HEAD", "ignore", {
3466
+ recipe_name: import("zod/v4").ZodType<string & {
3467
+ __prisma_table: "Recipes";
3468
+ __prisma_field: "recipe_name";
3469
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3470
+ __prisma_table: "Recipes";
3471
+ __prisma_field: "recipe_name";
3472
+ }, string>>;
3473
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, {
3474
+ bag_id: string & {
3475
+ __prisma_table: "Bags";
3476
+ __prisma_field: "bag_id";
3477
+ };
3478
+ bag_name: string & {
3479
+ __prisma_table: "Bags";
3480
+ __prisma_field: "bag_name";
3481
+ };
3482
+ position: number & {
3483
+ __prisma_table: "Recipe_bags";
3484
+ __prisma_field: "position";
3485
+ };
3486
+ }[]> | import("@tiddlywiki/server").ZodRoute<"GET" | "HEAD", "ignore", {
3487
+ recipe_name: import("zod/v4").ZodType<string & {
3488
+ __prisma_table: "Recipes";
3489
+ __prisma_field: "recipe_name";
3490
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3491
+ __prisma_table: "Recipes";
3492
+ __prisma_field: "recipe_name";
3493
+ }, string>>;
3494
+ bag_name: import("zod/v4").ZodType<string & {
3495
+ __prisma_table: "Bags";
3496
+ __prisma_field: "bag_name";
3497
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3498
+ __prisma_table: "Bags";
3499
+ __prisma_field: "bag_name";
3500
+ }, string>>;
3501
+ }, {
3502
+ last_known_revision_id: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodType<string & {
3503
+ __prisma_table: "Tiddlers";
3504
+ __prisma_field: "revision_id";
3505
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3506
+ __prisma_table: "Tiddlers";
3507
+ __prisma_field: "revision_id";
3508
+ }, string>>>>;
3509
+ include_deleted: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodEnum<{
3510
+ yes: "yes";
3511
+ no: "no";
3512
+ }>>>;
3513
+ }, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, {
3514
+ bag_id: string;
3515
+ bag_name: string;
3516
+ tiddlers: {
3517
+ title: string;
3518
+ revision_id: string;
3519
+ is_deleted: boolean;
3520
+ }[];
3521
+ }> | import("@tiddlywiki/server").ZodRoute<"GET" | "HEAD", "ignore", {
3522
+ recipe_name: import("zod/v4").ZodType<string & {
3523
+ __prisma_table: "Recipes";
3524
+ __prisma_field: "recipe_name";
3525
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3526
+ __prisma_table: "Recipes";
3527
+ __prisma_field: "recipe_name";
3528
+ }, string>>;
3529
+ }, {
3530
+ last_known_revision_id: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodType<string & {
3531
+ __prisma_table: "Tiddlers";
3532
+ __prisma_field: "revision_id";
3533
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3534
+ __prisma_table: "Tiddlers";
3535
+ __prisma_field: "revision_id";
3536
+ }, string>>>>;
3537
+ include_deleted: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodEnum<{
3538
+ yes: "yes";
3539
+ no: "no";
3540
+ }>>>;
3541
+ gzip_stream: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodEnum<{
3542
+ yes: "yes";
3543
+ no: "no";
3544
+ }>>>;
3545
+ }, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, {
3546
+ bag_id: string;
3547
+ bag_name: string;
3548
+ position: number;
3549
+ tiddlers: {
3550
+ title: string;
3551
+ revision_id: string;
3552
+ is_deleted: boolean;
3553
+ }[];
3554
+ }[]> | import("@tiddlywiki/server").ZodRoute<"PUT", "json", {
3555
+ recipe_name: import("zod/v4").ZodType<string & {
3556
+ __prisma_table: "Recipes";
3557
+ __prisma_field: "recipe_name";
3558
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3559
+ __prisma_table: "Recipes";
3560
+ __prisma_field: "recipe_name";
3561
+ }, string>>;
3562
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodObject<{
3563
+ titles: import("zod/v4").ZodArray<import("zod/v4").ZodType<string & {
3564
+ __prisma_table: "Tiddlers";
3565
+ __prisma_field: "title";
3566
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3567
+ __prisma_table: "Tiddlers";
3568
+ __prisma_field: "title";
3569
+ }, string>>>;
3570
+ }, import("zod/v4/core").$strict>, import("tiddlywiki").TiddlerFields[]> | import("@tiddlywiki/server").ZodRoute<"GET" | "HEAD", "ignore", {
3571
+ recipe_name: import("zod/v4").ZodType<string & {
3572
+ __prisma_table: "Recipes";
3573
+ __prisma_field: "recipe_name";
3574
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3575
+ __prisma_table: "Recipes";
3576
+ __prisma_field: "recipe_name";
3577
+ }, string>>;
3578
+ title: import("zod/v4").ZodType<string & {
3579
+ __prisma_table: "Tiddlers";
3580
+ __prisma_field: "title";
3581
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3582
+ __prisma_table: "Tiddlers";
3583
+ __prisma_field: "title";
3584
+ }, string>>;
3585
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, never> | import("@tiddlywiki/server").ZodRoute<"PUT", "string", {
3586
+ recipe_name: import("zod/v4").ZodType<string & {
3587
+ __prisma_table: "Recipes";
3588
+ __prisma_field: "recipe_name";
3589
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3590
+ __prisma_table: "Recipes";
3591
+ __prisma_field: "recipe_name";
3592
+ }, string>>;
3593
+ title: import("zod/v4").ZodType<string & {
3594
+ __prisma_table: "Tiddlers";
3595
+ __prisma_field: "title";
3596
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3597
+ __prisma_table: "Tiddlers";
3598
+ __prisma_field: "title";
3599
+ }, string>>;
3600
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodString, {
3601
+ bag_name: string & {
3602
+ __prisma_table: "Bags";
3603
+ __prisma_field: "bag_name";
3604
+ };
3605
+ revision_id: string & {
3606
+ __prisma_table: "Tiddlers";
3607
+ __prisma_field: "revision_id";
3608
+ };
3609
+ }> | import("@tiddlywiki/server").ZodRoute<"DELETE", "json", {
3610
+ recipe_name: import("zod/v4").ZodType<string & {
3611
+ __prisma_table: "Recipes";
3612
+ __prisma_field: "recipe_name";
3613
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3614
+ __prisma_table: "Recipes";
3615
+ __prisma_field: "recipe_name";
3616
+ }, string>>;
3617
+ title: import("zod/v4").ZodType<string & {
3618
+ __prisma_table: "Tiddlers";
3619
+ __prisma_field: "title";
3620
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3621
+ __prisma_table: "Tiddlers";
3622
+ __prisma_field: "title";
3623
+ }, string>>;
3624
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodUndefined, {
3625
+ bag_name: string & {
3626
+ __prisma_table: "Bags";
3627
+ __prisma_field: "bag_name";
3628
+ };
3629
+ revision_id: string & {
3630
+ __prisma_table: "Tiddlers";
3631
+ __prisma_field: "revision_id";
3632
+ };
3633
+ }> | import("@tiddlywiki/server").ZodRoute<"POST", "stream", {
3634
+ recipe_name: import("zod/v4").ZodType<string & {
3635
+ __prisma_table: "Recipes";
3636
+ __prisma_field: "recipe_name";
3637
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3638
+ __prisma_table: "Recipes";
3639
+ __prisma_field: "recipe_name";
3640
+ }, string>>;
3641
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, {
3642
+ bag_name: string & {
3643
+ __prisma_table: "Bags";
3644
+ __prisma_field: "bag_name";
3645
+ };
3646
+ results: {
3647
+ revision_id: string & {
3648
+ __prisma_table: "Tiddlers";
3649
+ __prisma_field: "revision_id";
3650
+ };
3651
+ bag_name: string & {
3652
+ __prisma_table: "Bags";
3653
+ __prisma_field: "bag_name";
3654
+ };
3655
+ };
3656
+ }> | import("@tiddlywiki/server").ZodRoute<"GET" | "HEAD", "ignore", {
3657
+ bag_name: import("zod/v4").ZodType<string & {
3658
+ __prisma_table: "Bags";
3659
+ __prisma_field: "bag_name";
3660
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3661
+ __prisma_table: "Bags";
3662
+ __prisma_field: "bag_name";
3663
+ }, string>>;
3664
+ title: import("zod/v4").ZodType<string & {
3665
+ __prisma_table: "Tiddlers";
3666
+ __prisma_field: "title";
3667
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3668
+ __prisma_table: "Tiddlers";
3669
+ __prisma_field: "title";
3670
+ }, string>>;
3671
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, never> | import("@tiddlywiki/server").ZodRoute<"PUT", "string", {
3672
+ bag_name: import("zod/v4").ZodType<string & {
3673
+ __prisma_table: "Bags";
3674
+ __prisma_field: "bag_name";
3675
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3676
+ __prisma_table: "Bags";
3677
+ __prisma_field: "bag_name";
3678
+ }, string>>;
3679
+ title: import("zod/v4").ZodType<string & {
3680
+ __prisma_table: "Tiddlers";
3681
+ __prisma_field: "title";
3682
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3683
+ __prisma_table: "Tiddlers";
3684
+ __prisma_field: "title";
3685
+ }, string>>;
3686
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodString, {
3687
+ revision_id: string & {
3688
+ __prisma_table: "Tiddlers";
3689
+ __prisma_field: "revision_id";
3690
+ };
3691
+ }> | import("@tiddlywiki/server").ZodRoute<"DELETE", "ignore", {
3692
+ bag_name: import("zod/v4").ZodType<string & {
3693
+ __prisma_table: "Bags";
3694
+ __prisma_field: "bag_name";
3695
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3696
+ __prisma_table: "Bags";
3697
+ __prisma_field: "bag_name";
3698
+ }, string>>;
3699
+ title: import("zod/v4").ZodType<string & {
3700
+ __prisma_table: "Tiddlers";
3701
+ __prisma_field: "title";
3702
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3703
+ __prisma_table: "Tiddlers";
3704
+ __prisma_field: "title";
3705
+ }, string>>;
3706
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, {
3707
+ revision_id: string & {
3708
+ __prisma_table: "Tiddlers";
3709
+ __prisma_field: "revision_id";
3710
+ };
3711
+ }> | import("@tiddlywiki/server").ZodRoute<"POST", "stream", {
3712
+ bag_name: import("zod/v4").ZodType<string & {
3713
+ __prisma_table: "Bags";
3714
+ __prisma_field: "bag_name";
3715
+ }, string, import("zod/v4/core").$ZodTypeInternals<string & {
3716
+ __prisma_table: "Bags";
3717
+ __prisma_field: "bag_name";
3718
+ }, string>>;
3719
+ }, Record<string, import("zod/v4").ZodType<any, string[] | undefined, import("zod/v4/core").$ZodTypeInternals<any, string[] | undefined>>>, import("zod/v4").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, {
3720
+ revision_id: string & {
3721
+ __prisma_table: "Tiddlers";
3722
+ __prisma_field: "revision_id";
3723
+ };
3724
+ }>])[];
3725
+ }
3726
+ }
3727
+ declare module "packages/mws/src/commands/listen" {
3728
+ import { Router } from "packages/server/src/index";
3729
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
3730
+ export const info: CommandInfo;
3731
+ export const AllowedMethods: ("GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "OPTIONS")[];
3732
+ export type AllowedMethod = (typeof AllowedMethods)[number];
3733
+ export type ListenerRaw = {
3734
+ [key in "port" | "host" | "prefix" | "key" | "cert" | "secure" | "redirect"]?: string | undefined;
3735
+ };
3736
+ module "packages/events/src/index" {
3737
+ interface ServerEventsMap {
3738
+ "listen.router.init": [command: Command, router: Router];
3739
+ }
3740
+ }
3741
+ export class Command extends BaseCommand<[], {
3742
+ listener: ListenerRaw[];
3743
+ allow_hosts: string[];
3744
+ subdomains: boolean;
3745
+ require_https: boolean;
3746
+ }> {
3747
+ execute(): Promise<void>;
3748
+ }
3749
+ }
3750
+ declare module "packages/mws/src/commands/index" {
3751
+ import * as load_wiki_folder from "packages/mws/src/commands/load-wiki-folder";
3752
+ import * as save_archive from "packages/mws/src/commands/save-archive";
3753
+ import * as load_archive from "packages/mws/src/commands/load-archive";
3754
+ import * as init_store from "packages/mws/src/commands/init-store";
3755
+ import * as manager from "packages/mws/src/commands/manager";
3756
+ import * as tests_complete from "packages/mws/src/commands/tests-complete";
3757
+ import * as build_client from "packages/mws/src/commands/build-client";
3758
+ import * as build_types from "packages/mws/src/commands/build-types";
3759
+ import * as listen from "packages/mws/src/commands/listen";
3760
+ export const commands: {
3761
+ readonly listen: typeof listen;
3762
+ readonly load_wiki_folder: typeof load_wiki_folder;
3763
+ readonly load_archive: typeof load_archive;
3764
+ readonly save_archive: typeof save_archive;
3765
+ readonly init_store: typeof init_store;
3766
+ readonly manager: typeof manager;
3767
+ readonly tests_complete: typeof tests_complete;
3768
+ readonly build_client: typeof build_client;
3769
+ readonly build_types: typeof build_types;
3770
+ };
3771
+ }
3772
+ declare module "packages/mws/src/zodAssert" {
3773
+ import { Prisma } from "prisma-client";
3774
+ import { zod } from "packages/server/src/index";
3775
+ type _zod = typeof zod;
3776
+ type ExtraFieldType = "string" | "number" | "parse-number" | "boolean" | "parse-boolean";
3777
+ type FieldTypeGroups = "STRING" | "JSON";
3778
+ type FieldTypeStringSelector<T extends FieldTypeGroups> = T extends "STRING" ? "string" : "string";
3779
+ type FieldTypeNumberSelector<T extends FieldTypeGroups> = T extends "STRING" ? "parse-number" : "number";
3780
+ type FieldTypeBooleanSelector<T extends FieldTypeGroups> = T extends "STRING" ? "parse-boolean" : "boolean";
3781
+ module "packages/server/src/index" {
3782
+ interface Z2<T extends FieldTypeGroups> extends _zod {
3783
+ /**
3784
+ * Tags the resulting value as being from the specified table field.
3785
+ *
3786
+ * The third argument is a string literal that specifies the field type based on the selected field.
3787
+ *
3788
+ * "string" and "parse-number"
3789
+ * - will use decodeURIComponent on the value.
3790
+ * - Require a string length at least one
3791
+ *
3792
+ * You can use .optional(), .nullable(), .nulish() after this to make the field optional.
3793
+ */
3794
+ prismaField<Table extends Prisma.ModelName, Field extends keyof PrismaPayloadScalars<Table>>(table: Table, field: Field, fieldtype: string extends (PrismaPayloadScalars<Table>[Field]) ? FieldTypeStringSelector<T> : number extends (PrismaPayloadScalars<Table>[Field]) ? FieldTypeNumberSelector<T> : boolean extends (PrismaPayloadScalars<Table>[Field]) ? FieldTypeBooleanSelector<T> : never, nullable?: null extends PrismaPayloadScalars<Table>[Field] ? true : false): zod.ZodType<PrismaField<Table, Field>, PrismaPayloadScalars<Table>[Field]>;
3795
+ }
3796
+ }
3797
+ export function prismaField(table: any, field: any, fieldtype: ExtraFieldType, nullable?: boolean): any;
3798
+ }
3799
+ declare module "packages/mws/src/services/tw-routes" {
3800
+ import { ServerRequest } from "packages/server/src/index";
3801
+ /**
3802
+ * `tiddlywiki [+<pluginname> | ++<pluginpath>] [<wikipath>] ...[--command ...args]`
3803
+ *
3804
+ *
3805
+ *
3806
+ * @param options
3807
+ * @param options.rootRoute
3808
+ */
3809
+ export function TW5Route({ mountPath, singleFile, argv, variables, }: {
3810
+ mountPath: string;
3811
+ singleFile: boolean;
3812
+ argv: string[];
3813
+ variables?: Record<string, string>;
3814
+ }): (state: ServerRequest) => Promise<symbol>;
3815
+ }
3816
+ declare module "packages/mws/src/index" {
3817
+ import "prisma/global";
3818
+ import "packages/commander/src/index";
3819
+ import "packages/server/src/index";
3820
+ import "packages/mws/src/registerRequest";
3821
+ import "packages/mws/src/registerStartup";
3822
+ import "packages/mws/src/commands/index";
3823
+ import "packages/mws/src/managers/index";
3824
+ import "packages/mws/src/zodAssert";
3825
+ import "packages/mws/src/RequestState";
3826
+ import "packages/mws/src/ServerState";
3827
+ import "packages/mws/src/services/tw-routes";
3828
+ import "packages/mws/src/services/cache";
3829
+ import "packages/mws/src/services/sessions";
3830
+ export { ZodRoute } from "packages/server/src/index";
3831
+ export * from "packages/mws/src/managers/index";
3832
+ export default function runMWS(oldOptions?: any): Promise<void>;
3833
+ global {
3834
+ /** Awaited Return Type */
3835
+ type ART<T extends (...args: any) => any> = Awaited<ReturnType<T>>;
3836
+ type Complete<T> = {
3837
+ [K in keyof T]-?: T[K];
3838
+ };
3839
+ interface ObjectConstructor {
3840
+ keys<T>(t: T): (string & keyof T)[];
3841
+ }
3842
+ }
3843
+ global {
3844
+ /** helper function which returns the arguments as an array, but typed as a tuple, which is still an array, but positional. */
3845
+ function tuple<P extends any[]>(...arg: P): P;
3846
+ }
3847
+ global {
3848
+ /**
3849
+ * Helper function which narrows the type to only truthy values.
3850
+ *
3851
+ * It uses `!!` so NaN will also be excluded.
3852
+ */
3853
+ function truthy<T>(obj: T): obj is Exclude<T, false | null | undefined | 0 | '' | void>;
3854
+ }
3855
+ }
3856
+ declare module "packages/mws/src/commands/_empty" {
3857
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
3858
+ export const info: CommandInfo;
3859
+ export class Command extends BaseCommand {
3860
+ execute(): Promise<void>;
3861
+ }
3862
+ }
3863
+ declare module "packages/mws/src/commands/load-tiddlers" {
3864
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
3865
+ export const info: CommandInfo;
3866
+ export class Command extends BaseCommand {
3867
+ tiddlersPath: string;
3868
+ bagName: PrismaField<"Bags", "bag_name">;
3869
+ constructor(...args: ConstructorParameters<typeof BaseCommand>);
3870
+ execute(): Promise<"Missing pathname and/or bag name" | null>;
3871
+ }
3872
+ }
3873
+ declare module "packages/mws/src/commands/save-tiddler-text" {
3874
+ import { BaseCommand, CommandInfo } from "packages/commander/src/index";
3875
+ export const info: CommandInfo;
3876
+ export class Command extends BaseCommand {
3877
+ execute(): Promise<void>;
3878
+ }
3879
+ }
3880
+ declare module "packages/mws/src/services/attachments" {
3881
+ import * as fs from "fs";
3882
+ import { TiddlerFields } from "tiddlywiki";
3883
+ import { ServerState } from "packages/mws/src/ServerState";
3884
+ export class AttachmentService {
3885
+ protected config: ServerState;
3886
+ protected prisma: PrismaTxnClient;
3887
+ constructor(config: ServerState, prisma: PrismaTxnClient);
3888
+ makeCanonicalUri(bag_name: string, title: string): string;
3889
+ processOutgoingTiddler({ tiddler, revision_id, bag_name, attachment_hash }: {
3890
+ tiddler: TiddlerFields;
3891
+ revision_id: any;
3892
+ bag_name: PrismaField<"Bags", "bag_name">;
3893
+ attachment_hash: PrismaField<"Tiddlers", "attachment_hash">;
3894
+ }): TiddlerFields;
3895
+ processIncomingTiddler({ tiddlerFields, existing_attachment_hash, existing_canonical_uri }: {
3896
+ tiddlerFields: TiddlerFields;
3897
+ existing_attachment_hash: PrismaField<"Tiddlers", "attachment_hash">;
3898
+ existing_canonical_uri: any;
3899
+ }): Promise<{
3900
+ tiddlerFields: TiddlerFields;
3901
+ attachment_hash: PrismaField<"Tiddlers", "attachment_hash">;
3902
+ }>;
3903
+ isValidAttachmentName(content_hash: string): boolean;
3904
+ saveAttachment(options: {
3905
+ text: string;
3906
+ type: string;
3907
+ reference: string;
3908
+ _canonical_uri: string;
3909
+ }): Promise<PrismaField<"Tiddlers", "attachment_hash">>;
3910
+ private writeMetaFile;
3911
+ adoptAttachment({ incomingFilepath, type, hash, _canonical_uri }: {
3912
+ incomingFilepath: any;
3913
+ type: string;
3914
+ hash: any;
3915
+ _canonical_uri: any;
3916
+ }): Promise<any>;
3917
+ getAttachmentStream(content_hash: string): Promise<{
3918
+ stream: fs.ReadStream;
3919
+ type: any;
3920
+ } | null>;
3921
+ getAttachmentFileSize(content_hash: PrismaField<"Tiddlers", "attachment_hash"> & {}): Promise<number | null>;
3922
+ getAttachmentMetadata(content_hash: PrismaField<"Tiddlers", "attachment_hash"> & {}): Promise<any>;
3923
+ }
3924
+ }
3925
+ declare module "packages/mws/src/utils/index" {
3926
+ export {};
3927
+ }
3928
+ declare module "packages/mws/src/utils/prisma-proxy" { }