appos 0.4.3-0 → 0.5.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/dist/exports/api/index.d.mts +3 -3
  2. package/dist/exports/api/index.mjs +34 -9
  3. package/dist/exports/api/workflows/index.d.mts +2 -2
  4. package/dist/exports/api/workflows/index.mjs +2 -2
  5. package/dist/exports/{auth-By0xx0MI.d.mts → auth-BCOIpGDO.d.mts} +325 -214
  6. package/dist/exports/cli/index.d.mts +105 -106
  7. package/dist/exports/cli/index.mjs +87 -13
  8. package/dist/exports/{constants-BePPc_yF.mjs → constants-BicCnEiJ.mjs} +7 -1
  9. package/dist/exports/{index-Bpo5QE7k.d.mts → index-CiuTp085.d.mts} +580 -614
  10. package/dist/exports/{openapi-crG3j4xx.mjs → openapi-uisUTLq7.mjs} +45 -102
  11. package/dist/exports/{send-email-Bgcdjy-e.mjs → send-email-CXxlkfFL.mjs} +1 -1
  12. package/dist/exports/{server-BlNxgHUc.mjs → server-CA4aI0U6.mjs} +6 -2
  13. package/dist/exports/storybook/index.d.ts +40 -0
  14. package/dist/exports/storybook/index.js +43 -0
  15. package/dist/exports/tests/api.d.mts +2 -2
  16. package/dist/exports/tests/api.mjs +3 -3
  17. package/dist/exports/vite/index.d.mts +19 -3
  18. package/dist/exports/vite/index.mjs +82 -6
  19. package/dist/exports/web/index.d.ts +2247 -700
  20. package/dist/exports/web/index.js +2445 -754
  21. package/dist/exports/web/routes.d.mts +41 -43
  22. package/dist/exports/web/ssr.d.mts +2 -2
  23. package/package.json +48 -31
  24. package/src/storybook/.storybook/main.ts +119 -0
  25. package/src/storybook/.storybook/manager.ts +75 -0
  26. package/src/storybook/.storybook/preview.tsx +76 -0
  27. package/src/storybook/components/ColorGrid.tsx +324 -0
  28. package/src/storybook/components/IconGallery.tsx +268 -0
  29. package/src/storybook/components/SpacingScale.tsx +236 -0
  30. package/src/storybook/components/TypographyScale.tsx +277 -0
  31. package/src/storybook/components/index.ts +3 -0
  32. package/src/storybook/docs/Introduction.mdx +29 -0
  33. package/src/storybook/docs/foundations/Colors.mdx +27 -0
  34. package/src/storybook/docs/foundations/Icons.mdx +26 -0
  35. package/src/storybook/docs/foundations/Spacing.mdx +23 -0
  36. package/src/storybook/docs/foundations/Typography.mdx +39 -0
  37. package/src/storybook/index.ts +147 -0
  38. package/src/storybook/shims/void-elements.js +18 -0
  39. package/src/web/client/auth-paths.ts +148 -0
  40. package/src/web/client/auth.ts +218 -0
  41. package/src/web/client/i18n.d.ts +9 -0
  42. package/src/web/client/i18n.ts +127 -0
  43. package/src/web/client/react-router.ts +84 -0
  44. package/src/web/hooks/index.ts +1 -0
  45. package/src/web/hooks/use-mobile.ts +19 -0
  46. package/src/web/index.ts +42 -0
  47. package/src/web/lib/colors.ts +220 -0
  48. package/src/web/lib/utils.ts +52 -0
  49. package/src/web/routes/auth/_layout.tsx +5 -11
  50. package/src/web/routes.ts +101 -0
  51. package/src/web/server/context.ts +14 -0
  52. package/src/web/server/render.ts +11 -0
  53. package/src/web/ssr.ts +17 -0
  54. package/src/web/ui/accordion.stories.tsx +183 -0
  55. package/src/web/ui/accordion.tsx +134 -0
  56. package/src/web/ui/alert-dialog.stories.tsx +215 -0
  57. package/src/web/ui/alert-dialog.tsx +328 -0
  58. package/src/web/ui/alert.stories.tsx +224 -0
  59. package/src/web/ui/alert.tsx +136 -0
  60. package/src/web/ui/animated-check.stories.tsx +200 -0
  61. package/src/web/ui/animated-check.tsx +98 -0
  62. package/src/web/ui/aspect-ratio.stories.tsx +204 -0
  63. package/src/web/ui/aspect-ratio.tsx +36 -0
  64. package/src/web/ui/auth/__mocks__/auth-context.tsx +273 -0
  65. package/src/web/ui/auth/auth-card.stories.tsx +295 -0
  66. package/src/web/ui/auth/auth-card.tsx +124 -0
  67. package/src/web/ui/auth/auth-layout.stories.tsx +330 -0
  68. package/src/web/ui/auth/auth-layout.tsx +269 -0
  69. package/src/web/ui/auth/captcha-widget.stories.tsx +200 -0
  70. package/src/web/ui/auth/captcha-widget.tsx +197 -0
  71. package/src/web/ui/auth/context.tsx +87 -0
  72. package/src/web/ui/auth/email-input.stories.tsx +167 -0
  73. package/src/web/ui/auth/email-input.tsx +84 -0
  74. package/src/web/ui/auth/forms/email-otp-form.tsx +377 -0
  75. package/src/web/ui/auth/forms/forgot-password-form.tsx +240 -0
  76. package/src/web/ui/auth/forms/index.ts +40 -0
  77. package/src/web/ui/auth/forms/login-form.tsx +486 -0
  78. package/src/web/ui/auth/forms/phone-otp-form.tsx +388 -0
  79. package/src/web/ui/auth/forms/reset-password-form.tsx +331 -0
  80. package/src/web/ui/auth/forms/signup-form.tsx +499 -0
  81. package/src/web/ui/auth/forms/two-factor-form.tsx +410 -0
  82. package/src/web/ui/auth/forms/verify-email-form.tsx +373 -0
  83. package/src/web/ui/auth/hooks.ts +266 -0
  84. package/src/web/ui/auth/index.ts +31 -0
  85. package/src/web/ui/auth/magic-link-form.tsx +191 -0
  86. package/src/web/ui/auth/otp-input.stories.tsx +199 -0
  87. package/src/web/ui/auth/otp-input.tsx +157 -0
  88. package/src/web/ui/auth/passkey-button.stories.tsx +115 -0
  89. package/src/web/ui/auth/passkey-button.tsx +113 -0
  90. package/src/web/ui/auth/passkey-register-button.stories.tsx +109 -0
  91. package/src/web/ui/auth/passkey-register-button.tsx +106 -0
  92. package/src/web/ui/auth/password-input.stories.tsx +287 -0
  93. package/src/web/ui/auth/password-input.tsx +306 -0
  94. package/src/web/ui/auth/phone-input.stories.tsx +160 -0
  95. package/src/web/ui/auth/phone-input.tsx +89 -0
  96. package/src/web/ui/auth/social-buttons.stories.tsx +217 -0
  97. package/src/web/ui/auth/social-buttons.tsx +196 -0
  98. package/src/web/ui/auth/sso-button.stories.tsx +160 -0
  99. package/src/web/ui/auth/sso-button.tsx +108 -0
  100. package/src/web/ui/auth/trust-signals.stories.tsx +208 -0
  101. package/src/web/ui/auth/trust-signals.tsx +260 -0
  102. package/src/web/ui/avatar.stories.tsx +302 -0
  103. package/src/web/ui/avatar.tsx +189 -0
  104. package/src/web/ui/badge.stories.tsx +225 -0
  105. package/src/web/ui/badge.tsx +66 -0
  106. package/src/web/ui/brand.stories.tsx +266 -0
  107. package/src/web/ui/brand.tsx +162 -0
  108. package/src/web/ui/breadcrumb.stories.tsx +271 -0
  109. package/src/web/ui/breadcrumb.tsx +214 -0
  110. package/src/web/ui/button-group.stories.tsx +251 -0
  111. package/src/web/ui/button-group.tsx +87 -0
  112. package/src/web/ui/button.stories.tsx +264 -0
  113. package/src/web/ui/button.tsx +120 -0
  114. package/src/web/ui/calendar.stories.tsx +235 -0
  115. package/src/web/ui/calendar.tsx +221 -0
  116. package/src/web/ui/card.stories.tsx +262 -0
  117. package/src/web/ui/card.tsx +199 -0
  118. package/src/web/ui/carousel.stories.tsx +244 -0
  119. package/src/web/ui/carousel.tsx +241 -0
  120. package/src/web/ui/chart.stories.tsx +833 -0
  121. package/src/web/ui/chart.tsx +390 -0
  122. package/src/web/ui/checkbox.stories.tsx +208 -0
  123. package/src/web/ui/checkbox.tsx +39 -0
  124. package/src/web/ui/collapsible.stories.tsx +239 -0
  125. package/src/web/ui/collapsible.tsx +21 -0
  126. package/src/web/ui/command.stories.tsx +291 -0
  127. package/src/web/ui/command.tsx +189 -0
  128. package/src/web/ui/context-menu.stories.tsx +255 -0
  129. package/src/web/ui/context-menu.tsx +263 -0
  130. package/src/web/ui/dialog.stories.tsx +263 -0
  131. package/src/web/ui/dialog.tsx +273 -0
  132. package/src/web/ui/drawer.stories.tsx +299 -0
  133. package/src/web/ui/drawer.tsx +130 -0
  134. package/src/web/ui/dropdown-menu.stories.tsx +320 -0
  135. package/src/web/ui/dropdown-menu.tsx +263 -0
  136. package/src/web/ui/empty.stories.tsx +204 -0
  137. package/src/web/ui/empty.tsx +101 -0
  138. package/src/web/ui/error-page.stories.tsx +181 -0
  139. package/src/web/ui/error-page.tsx +136 -0
  140. package/src/web/ui/field.stories.tsx +364 -0
  141. package/src/web/ui/field.tsx +252 -0
  142. package/src/web/ui/globals.css +3 -0
  143. package/src/web/ui/hover-card.stories.tsx +261 -0
  144. package/src/web/ui/hover-card.tsx +50 -0
  145. package/src/web/ui/index.ts +55 -0
  146. package/src/web/ui/input-group.stories.tsx +290 -0
  147. package/src/web/ui/input-group.tsx +157 -0
  148. package/src/web/ui/input-otp.stories.tsx +235 -0
  149. package/src/web/ui/input-otp.tsx +86 -0
  150. package/src/web/ui/input.stories.tsx +205 -0
  151. package/src/web/ui/input.tsx +30 -0
  152. package/src/web/ui/item.stories.tsx +348 -0
  153. package/src/web/ui/item.tsx +200 -0
  154. package/src/web/ui/kbd.stories.tsx +236 -0
  155. package/src/web/ui/kbd.tsx +27 -0
  156. package/src/web/ui/label.stories.tsx +180 -0
  157. package/src/web/ui/label.tsx +32 -0
  158. package/src/web/ui/locales/en/ui.json +13 -30
  159. package/src/web/ui/locales/zh-CN/ui.json +17 -34
  160. package/src/web/ui/locales/zh-TW/ui.json +17 -34
  161. package/src/web/ui/menubar.stories.tsx +385 -0
  162. package/src/web/ui/menubar.tsx +273 -0
  163. package/src/web/ui/navigation-menu.stories.tsx +361 -0
  164. package/src/web/ui/navigation-menu.tsx +168 -0
  165. package/src/web/ui/pagination.stories.tsx +312 -0
  166. package/src/web/ui/pagination.tsx +221 -0
  167. package/src/web/ui/popover.stories.tsx +315 -0
  168. package/src/web/ui/popover.tsx +89 -0
  169. package/src/web/ui/progress.stories.tsx +239 -0
  170. package/src/web/ui/progress.tsx +128 -0
  171. package/src/web/ui/radio-group.stories.tsx +315 -0
  172. package/src/web/ui/radio-group.tsx +38 -0
  173. package/src/web/ui/resizable.stories.tsx +304 -0
  174. package/src/web/ui/resizable.tsx +53 -0
  175. package/src/web/ui/scroll-area.stories.tsx +276 -0
  176. package/src/web/ui/scroll-area.tsx +53 -0
  177. package/src/web/ui/select.stories.tsx +314 -0
  178. package/src/web/ui/select.tsx +312 -0
  179. package/src/web/ui/separator.stories.tsx +246 -0
  180. package/src/web/ui/separator.tsx +36 -0
  181. package/src/web/ui/sheet.stories.tsx +417 -0
  182. package/src/web/ui/sheet.tsx +133 -0
  183. package/src/web/ui/sidebar.stories.tsx +402 -0
  184. package/src/web/ui/sidebar.tsx +723 -0
  185. package/src/web/ui/skeleton.stories.tsx +235 -0
  186. package/src/web/ui/skeleton.tsx +26 -0
  187. package/src/web/ui/slider.stories.tsx +294 -0
  188. package/src/web/ui/slider.tsx +75 -0
  189. package/src/web/ui/sonner.stories.tsx +279 -0
  190. package/src/web/ui/sonner.tsx +46 -0
  191. package/src/web/ui/spinner.stories.tsx +204 -0
  192. package/src/web/ui/spinner.tsx +28 -0
  193. package/src/web/ui/switch.stories.tsx +285 -0
  194. package/src/web/ui/switch.tsx +43 -0
  195. package/src/web/ui/table.stories.tsx +362 -0
  196. package/src/web/ui/table.tsx +115 -0
  197. package/src/web/ui/tabs.stories.tsx +401 -0
  198. package/src/web/ui/tabs.tsx +136 -0
  199. package/src/web/ui/textarea.stories.tsx +272 -0
  200. package/src/web/ui/textarea.tsx +28 -0
  201. package/src/web/ui/toggle-group.stories.tsx +334 -0
  202. package/src/web/ui/toggle-group.tsx +88 -0
  203. package/src/web/ui/toggle.stories.tsx +264 -0
  204. package/src/web/ui/toggle.tsx +57 -0
  205. package/src/web/ui/tooltip.stories.tsx +342 -0
  206. package/src/web/ui/tooltip.tsx +116 -0
@@ -1,4 +1,4 @@
1
- import { C as defineTestDatabase, D as defineLogger, E as Logger, S as defineMigrationOpts, T as DefineLoggerOptions, _ as DefineTestDatabaseOptions, a as AuthConfig, b as dbChanges, c as DefineAuthOptions, d as createAccessControl, f as defineAuth, g as DefineDatabaseOptions, h as Database, i as Auth$1, l as Role, n as AccessController, o as AuthPasskeyConfig, p as defineEndpointRateLimits, r as AuditAction, s as AuthSessionConfig, t as AccessControlRoles, u as auditActionSchema, v as MigrationType, w as migrationsSchema, x as defineDatabase, y as QualifiedTableNames } from "./auth-By0xx0MI.mjs";
1
+ import { A as defineLogger, C as dbChanges, D as migrationsSchema, E as defineTestDatabase, O as DefineLoggerOptions, S as QualifiedTableNames, T as defineMigrationOpts, a as AuthCaptchaConfig, b as DefineTestDatabaseOptions, c as AuthSessionConfig, d as Role, f as auditActionSchema, g as defineEndpointRateLimits, h as defineAuth, i as Auth$1, k as Logger, l as CaptchaProvider, m as createAccessControl, n as AccessController, o as AuthConfig, p as captchaProviders, r as AuditAction, s as AuthPasskeyConfig, t as AccessControlRoles, u as DefineAuthOptions, v as Database, w as defineDatabase, x as MigrationType, y as DefineDatabaseOptions } from "./auth-BCOIpGDO.mjs";
2
2
  import { c as orm_d_exports } from "./orm-CJrd147z.mjs";
3
3
  import { t as instrumentation_d_exports } from "./instrumentation-CFIspF8-.mjs";
4
4
  import { Auth } from "better-auth";
@@ -35,16 +35,16 @@ type Cache = ReturnType<typeof defineCache>;
35
35
  */
36
36
  type DefineCacheOptions = {
37
37
  /**
38
- * Redis URL(s). Single or comma-separated for cluster.
39
- */
38
+ * Redis URL(s). Single or comma-separated for cluster.
39
+ */
40
40
  url: string;
41
41
  /**
42
- * The logger instance.
43
- */
42
+ * The logger instance.
43
+ */
44
44
  logger: Logger;
45
45
  /**
46
- * The Keyv Redis options.
47
- */
46
+ * The Keyv Redis options.
47
+ */
48
48
  options?: KeyvRedisOptions;
49
49
  };
50
50
  /**
@@ -94,12 +94,12 @@ type Config<T extends z.ZodRawShape = {}> = z.infer<ReturnType<typeof baseSchema
94
94
  */
95
95
  interface EventContext<TInput> {
96
96
  /**
97
- * The application container with access to db, mailer, logger, etc.
98
- */
97
+ * The application container with access to db, mailer, logger, etc.
98
+ */
99
99
  container: Container;
100
100
  /**
101
- * The validated input passed to this event.
102
- */
101
+ * The validated input passed to this event.
102
+ */
103
103
  input: TInput;
104
104
  }
105
105
  /**
@@ -107,12 +107,12 @@ interface EventContext<TInput> {
107
107
  */
108
108
  interface DefineEventBusOptions {
109
109
  /**
110
- * Redis URL for pub/sub.
111
- */
110
+ * Redis URL for pub/sub.
111
+ */
112
112
  dbUrl: string;
113
113
  /**
114
- * Logger instance for error reporting.
115
- */
114
+ * Logger instance for error reporting.
115
+ */
116
116
  logger: Logger;
117
117
  }
118
118
  /**
@@ -134,32 +134,32 @@ type EventBus = ReturnType<typeof defineEventBus>;
134
134
  */
135
135
  declare function defineEventBus(opts: DefineEventBusOptions): {
136
136
  /**
137
- * Publish a message to a channel.
138
- * Auto-connects on first call if not already connected.
139
- *
140
- * @param channel - Channel name
141
- * @param message - Message payload (will be JSON stringified)
142
- */
137
+ * Publish a message to a channel.
138
+ * Auto-connects on first call if not already connected.
139
+ *
140
+ * @param channel - Channel name
141
+ * @param message - Message payload (will be JSON stringified)
142
+ */
143
143
  publish(channel: string, message: unknown): Promise<void>;
144
144
  /**
145
- * Subscribe to a channel. Returns unsubscribe function.
146
- * Uses single connection with callback management.
147
- *
148
- * @param channel - Channel name
149
- * @param callback - Callback for received messages
150
- * @returns Unsubscribe function
151
- */
145
+ * Subscribe to a channel. Returns unsubscribe function.
146
+ * Uses single connection with callback management.
147
+ *
148
+ * @param channel - Channel name
149
+ * @param callback - Callback for received messages
150
+ * @returns Unsubscribe function
151
+ */
152
152
  subscribe(channel: string, callback: (message: unknown) => void): Promise<() => void>;
153
153
  /**
154
- * Check if a channel has any subscribers.
155
- *
156
- * @param channel - Channel name
157
- * @returns true if channel has subscribers
158
- */
154
+ * Check if a channel has any subscribers.
155
+ *
156
+ * @param channel - Channel name
157
+ * @returns true if channel has subscribers
158
+ */
159
159
  hasSubscribers(channel: string): boolean;
160
160
  /**
161
- * Close the Redis connections.
162
- */
161
+ * Close the Redis connections.
162
+ */
163
163
  close(): Promise<void>;
164
164
  };
165
165
  /**
@@ -167,14 +167,14 @@ declare function defineEventBus(opts: DefineEventBusOptions): {
167
167
  */
168
168
  interface DefineEventOptions<TInput extends z.ZodType> {
169
169
  /**
170
- * Zod schema for validating event input.
171
- */
170
+ * Zod schema for validating event input.
171
+ */
172
172
  input: TInput;
173
173
  /**
174
- * In-memory handler that runs only on the emitting server.
175
- *
176
- * @param ctx - Event context with container and input
177
- */
174
+ * In-memory handler that runs only on the emitting server.
175
+ *
176
+ * @param ctx - Event context with container and input
177
+ */
178
178
  run: (ctx: EventContext<z.infer<TInput>>) => Promise<void>;
179
179
  }
180
180
  /**
@@ -182,34 +182,34 @@ interface DefineEventOptions<TInput extends z.ZodType> {
182
182
  */
183
183
  interface Event<TInput> {
184
184
  /**
185
- * The event name (set during registration from filename).
186
- */
185
+ * The event name (set during registration from filename).
186
+ */
187
187
  readonly name: string | null;
188
188
  /**
189
- * Emit this event with the given input.
190
- * Runs in-memory handler, then publishes to Redis (fire-and-forget).
191
- *
192
- * @param input - Input matching the event's input schema.
193
- */
189
+ * Emit this event with the given input.
190
+ * Runs in-memory handler, then publishes to Redis (fire-and-forget).
191
+ *
192
+ * @param input - Input matching the event's input schema.
193
+ */
194
194
  emit(input: TInput): Promise<void>;
195
195
  /**
196
- * The Zod schema for validating input.
197
- */
196
+ * The Zod schema for validating input.
197
+ */
198
198
  inputSchema: z.ZodType<TInput>;
199
199
  /**
200
- * Register this event with the container. Called by the event loader.
201
- *
202
- * @param container - The application container
203
- * @param name - The event name (derived from filename)
204
- */
200
+ * Register this event with the container. Called by the event loader.
201
+ *
202
+ * @param container - The application container
203
+ * @param name - The event name (derived from filename)
204
+ */
205
205
  register(container: Container, name: string): void;
206
206
  /**
207
- * Subscribe to this event via Redis pub/sub.
208
- * Use for tRPC subscriptions, SSE, WebSockets.
209
- *
210
- * @param handler - Handler called when event is emitted on any server
211
- * @returns Unsubscribe function to cleanup the subscription
212
- */
207
+ * Subscribe to this event via Redis pub/sub.
208
+ * Use for tRPC subscriptions, SSE, WebSockets.
209
+ *
210
+ * @param handler - Handler called when event is emitted on any server
211
+ * @returns Unsubscribe function to cleanup the subscription
212
+ */
213
213
  subscribe(handler: (ctx: EventContext<TInput>) => Promise<void>): Promise<() => void>;
214
214
  }
215
215
  /**
@@ -296,12 +296,12 @@ declare const dbChangesEvent: Event<{
296
296
  */
297
297
  interface LoadEventsOptions {
298
298
  /**
299
- * The application container.
300
- */
299
+ * The application container.
300
+ */
301
301
  container: Container;
302
302
  /**
303
- * Optional custom events directory path.
304
- */
303
+ * Optional custom events directory path.
304
+ */
305
305
  eventsDir?: string;
306
306
  }
307
307
  /**
@@ -323,12 +323,12 @@ declare function loadEvents(opts: LoadEventsOptions): Promise<void>;
323
323
  */
324
324
  interface QueueRateLimit {
325
325
  /**
326
- * Maximum number of workflows to start per period.
327
- */
326
+ * Maximum number of workflows to start per period.
327
+ */
328
328
  limitPerPeriod: number;
329
329
  /**
330
- * Time period in seconds.
331
- */
330
+ * Time period in seconds.
331
+ */
332
332
  periodSec: number;
333
333
  }
334
334
  /**
@@ -336,16 +336,16 @@ interface QueueRateLimit {
336
336
  */
337
337
  interface Queue {
338
338
  /**
339
- * The unique name of this queue.
340
- */
339
+ * The unique name of this queue.
340
+ */
341
341
  readonly name: string;
342
342
  /**
343
- * Whether priority ordering is enabled for this queue.
344
- */
343
+ * Whether priority ordering is enabled for this queue.
344
+ */
345
345
  readonly priorityEnabled: boolean;
346
346
  /**
347
- * Whether partitioning is enabled for this queue.
348
- */
347
+ * Whether partitioning is enabled for this queue.
348
+ */
349
349
  readonly partitionQueue: boolean;
350
350
  }
351
351
  /**
@@ -353,30 +353,30 @@ interface Queue {
353
353
  */
354
354
  interface DefineQueueOptions {
355
355
  /**
356
- * Unique name for this queue.
357
- */
356
+ * Unique name for this queue.
357
+ */
358
358
  name: string;
359
359
  /**
360
- * Maximum concurrent workflows per worker process.
361
- */
360
+ * Maximum concurrent workflows per worker process.
361
+ */
362
362
  workerConcurrency?: number;
363
363
  /**
364
- * Maximum concurrent workflows globally across all processes.
365
- */
364
+ * Maximum concurrent workflows globally across all processes.
365
+ */
366
366
  concurrency?: number;
367
367
  /**
368
- * Rate limit for starting workflows.
369
- */
368
+ * Rate limit for starting workflows.
369
+ */
370
370
  rateLimit?: QueueRateLimit;
371
371
  /**
372
- * Enable priority-based queue ordering.
373
- * When enabled, workflows with lower priority numbers execute first.
374
- */
372
+ * Enable priority-based queue ordering.
373
+ * When enabled, workflows with lower priority numbers execute first.
374
+ */
375
375
  priorityEnabled?: boolean;
376
376
  /**
377
- * Enable queue partitioning by partition key.
378
- * Workflows with the same partition key execute serially.
379
- */
377
+ * Enable queue partitioning by partition key.
378
+ * Workflows with the same partition key execute serially.
379
+ */
380
380
  partitionQueue?: boolean;
381
381
  }
382
382
  /**
@@ -402,33 +402,33 @@ declare function defineQueue<N extends string>(options: DefineQueueOptions & {
402
402
  */
403
403
  interface WorkflowStartOptions {
404
404
  /**
405
- * Priority for this workflow execution (lower = higher priority).
406
- * Only effective if queue has priorityEnabled: true.
407
- * Valid range: 0-2147483647
408
- */
405
+ * Priority for this workflow execution (lower = higher priority).
406
+ * Only effective if queue has priorityEnabled: true.
407
+ * Valid range: 0-2147483647
408
+ */
409
409
  priority?: number;
410
410
  /**
411
- * Partition key for partitioned queues.
412
- * Workflows with the same key execute serially.
413
- * Only effective if queue has partitionQueue: true.
414
- */
411
+ * Partition key for partitioned queues.
412
+ * Workflows with the same key execute serially.
413
+ * Only effective if queue has partitionQueue: true.
414
+ */
415
415
  partitionKey?: string;
416
416
  /**
417
- * Deduplication ID to prevent duplicate executions.
418
- * If a workflow with the same deduplicationID is already queued/running,
419
- * returns the existing workflow handle instead of starting a new one.
420
- * Cannot be used with partitionKey.
421
- */
417
+ * Deduplication ID to prevent duplicate executions.
418
+ * If a workflow with the same deduplicationID is already queued/running,
419
+ * returns the existing workflow handle instead of starting a new one.
420
+ * Cannot be used with partitionKey.
421
+ */
422
422
  deduplicationID?: string;
423
423
  /**
424
- * Workflow execution timeout in milliseconds.
425
- */
424
+ * Workflow execution timeout in milliseconds.
425
+ */
426
426
  timeoutMS?: number;
427
427
  /**
428
- * Queue name to use for this workflow start.
429
- * Overrides the queue configured in defineWorkflow().
430
- * Used internally by mailer.sendLater() to pass queue reference.
431
- */
428
+ * Queue name to use for this workflow start.
429
+ * Overrides the queue configured in defineWorkflow().
430
+ * Used internally by mailer.sendLater() to pass queue reference.
431
+ */
432
432
  queueName?: string;
433
433
  }
434
434
  /**
@@ -436,8 +436,8 @@ interface WorkflowStartOptions {
436
436
  */
437
437
  interface QueueFactoryContext {
438
438
  /**
439
- * The application container.
440
- */
439
+ * The application container.
440
+ */
441
441
  container: Container;
442
442
  }
443
443
  /**
@@ -449,25 +449,25 @@ type QueueFactory = (ctx: QueueFactoryContext) => Queue;
449
449
  */
450
450
  interface WorkflowContext<TInput = unknown> {
451
451
  /**
452
- * The application container with access to db, mailer, logger, etc.
453
- */
452
+ * The application container with access to db, mailer, logger, etc.
453
+ */
454
454
  container: Container;
455
455
  /**
456
- * The validated input passed to this workflow.
457
- */
456
+ * The validated input passed to this workflow.
457
+ */
458
458
  input: TInput;
459
459
  /**
460
- * Execute a checkpointed step within the workflow.
461
- * Steps are retried on failure and their results are durably stored.
462
- *
463
- * @param name - Unique name for this step within the workflow
464
- * @param fn - The step function to execute
465
- * @returns The result of the step function
466
- */
460
+ * Execute a checkpointed step within the workflow.
461
+ * Steps are retried on failure and their results are durably stored.
462
+ *
463
+ * @param name - Unique name for this step within the workflow
464
+ * @param fn - The step function to execute
465
+ * @returns The result of the step function
466
+ */
467
467
  step<T>(name: string, fn: () => Promise<T>): Promise<T>;
468
468
  /**
469
- * The unique ID of this workflow execution.
470
- */
469
+ * The unique ID of this workflow execution.
470
+ */
471
471
  workflowId: string;
472
472
  }
473
473
  /**
@@ -475,25 +475,25 @@ interface WorkflowContext<TInput = unknown> {
475
475
  */
476
476
  interface ScheduledWorkflowContext {
477
477
  /**
478
- * The application container with access to db, mailer, logger, etc.
479
- */
478
+ * The application container with access to db, mailer, logger, etc.
479
+ */
480
480
  container: Container;
481
481
  /**
482
- * The time this workflow execution was scheduled for.
483
- */
482
+ * The time this workflow execution was scheduled for.
483
+ */
484
484
  scheduledTime: Date;
485
485
  /**
486
- * Execute a checkpointed step within the workflow.
487
- * Steps are retried on failure and their results are durably stored.
488
- *
489
- * @param name - Unique name for this step within the workflow
490
- * @param fn - The step function to execute
491
- * @returns The result of the step function
492
- */
486
+ * Execute a checkpointed step within the workflow.
487
+ * Steps are retried on failure and their results are durably stored.
488
+ *
489
+ * @param name - Unique name for this step within the workflow
490
+ * @param fn - The step function to execute
491
+ * @returns The result of the step function
492
+ */
493
493
  step<T>(name: string, fn: () => Promise<T>): Promise<T>;
494
494
  /**
495
- * The unique ID of this workflow execution.
496
- */
495
+ * The unique ID of this workflow execution.
496
+ */
497
497
  workflowId: string;
498
498
  }
499
499
  /**
@@ -501,16 +501,16 @@ interface ScheduledWorkflowContext {
501
501
  */
502
502
  interface WorkflowHandle<TOutput> {
503
503
  /**
504
- * Get the current status of the workflow.
505
- */
504
+ * Get the current status of the workflow.
505
+ */
506
506
  getStatus(): Promise<unknown>;
507
507
  /**
508
- * Wait for the workflow to complete and return its result.
509
- */
508
+ * Wait for the workflow to complete and return its result.
509
+ */
510
510
  getResult(): Promise<TOutput>;
511
511
  /**
512
- * The unique ID of this workflow execution.
513
- */
512
+ * The unique ID of this workflow execution.
513
+ */
514
514
  workflowId: string;
515
515
  }
516
516
  /**
@@ -518,34 +518,34 @@ interface WorkflowHandle<TOutput> {
518
518
  */
519
519
  interface DefineWorkflowOptions<TInput extends z.ZodType, TOutput> {
520
520
  /**
521
- * Optional configuration for the workflow.
522
- */
521
+ * Optional configuration for the workflow.
522
+ */
523
523
  config?: {
524
524
  /**
525
- * Maximum number of times to attempt recovery after failure.
526
- */
525
+ * Maximum number of times to attempt recovery after failure.
526
+ */
527
527
  maxRecoveryAttempts?: number;
528
528
  };
529
529
  /**
530
- * Zod schema for validating workflow input.
531
- */
530
+ * Zod schema for validating workflow input.
531
+ */
532
532
  input: TInput;
533
533
  /**
534
- * Optional queue factory function to control workflow execution.
535
- * When specified, workflows are queued with the specified concurrency/rate limits.
536
- *
537
- * @example
538
- * ```typescript
539
- * queue: (ctx) => ctx.container.queues.email
540
- * ```
541
- */
534
+ * Optional queue factory function to control workflow execution.
535
+ * When specified, workflows are queued with the specified concurrency/rate limits.
536
+ *
537
+ * @example
538
+ * ```typescript
539
+ * queue: (ctx) => ctx.container.queues.email
540
+ * ```
541
+ */
542
542
  queue?: QueueFactory;
543
543
  /**
544
- * The workflow function to execute.
545
- *
546
- * @param ctx - Workflow context with container, input, and step helper
547
- * @returns The workflow result
548
- */
544
+ * The workflow function to execute.
545
+ *
546
+ * @param ctx - Workflow context with container, input, and step helper
547
+ * @returns The workflow result
548
+ */
549
549
  run: (ctx: WorkflowContext<z.infer<TInput>>) => Promise<TOutput>;
550
550
  }
551
551
  /**
@@ -585,28 +585,28 @@ interface DefineWorkflowOptions<TInput extends z.ZodType, TOutput> {
585
585
  */
586
586
  declare function defineWorkflow<TInput extends z.ZodType, TOutput>(options: DefineWorkflowOptions<TInput, TOutput>): {
587
587
  /**
588
- * The Zod schema for validating input.
589
- */
588
+ * The Zod schema for validating input.
589
+ */
590
590
  inputSchema: TInput;
591
591
  /**
592
- * The workflow name (set during registration from filename).
593
- */
592
+ * The workflow name (set during registration from filename).
593
+ */
594
594
  readonly name: string | null;
595
595
  /**
596
- * Register this workflow with DBOS. Called by the workflow loader.
597
- *
598
- * @param c - The application container
599
- * @param name - The workflow name (derived from filename)
600
- * @param dbos - The DBOS instance to use for registration
601
- */
596
+ * Register this workflow with DBOS. Called by the workflow loader.
597
+ *
598
+ * @param c - The application container
599
+ * @param name - The workflow name (derived from filename)
600
+ * @param dbos - The DBOS instance to use for registration
601
+ */
602
602
  register(c: Container, name: string, dbos: typeof DBOS): void;
603
603
  /**
604
- * Start this workflow with the given input.
605
- *
606
- * @param input - Input matching the workflow's input schema
607
- * @param startOptions - Optional queue-specific options (priority, partitionKey, etc.)
608
- * @returns A handle to track and retrieve the workflow result
609
- */
604
+ * Start this workflow with the given input.
605
+ *
606
+ * @param input - Input matching the workflow's input schema
607
+ * @param startOptions - Optional queue-specific options (priority, partitionKey, etc.)
608
+ * @returns A handle to track and retrieve the workflow result
609
+ */
610
610
  start(input: z.infer<TInput>, startOptions?: WorkflowStartOptions): Promise<WorkflowHandle<TOutput>>;
611
611
  };
612
612
  /**
@@ -614,31 +614,31 @@ declare function defineWorkflow<TInput extends z.ZodType, TOutput>(options: Defi
614
614
  */
615
615
  interface DefineScheduledWorkflowOptions {
616
616
  /**
617
- * Cron expression for when to run the workflow.
618
- * Supports 5-spot (minute hour day month weekday) or
619
- * 6-spot (second minute hour day month weekday) format.
620
- *
621
- * Examples:
622
- * - "0 9 * * *" - Every day at 9am
623
- * - "0,30 * * * *" - Every 30 minutes
624
- * - "0 0 * * * *" - Every hour (6-spot with seconds)
625
- */
617
+ * Cron expression for when to run the workflow.
618
+ * Supports 5-spot (minute hour day month weekday) or
619
+ * 6-spot (second minute hour day month weekday) format.
620
+ *
621
+ * Examples:
622
+ * - "0 9 * * *" - Every day at 9am
623
+ * - "0,30 * * * *" - Every 30 minutes
624
+ * - "0 0 * * * *" - Every hour (6-spot with seconds)
625
+ */
626
626
  crontab: string;
627
627
  /**
628
- * Optional queue factory function to control workflow execution.
629
- * Useful for limiting concurrency when the same scheduled job runs on multiple instances.
630
- *
631
- * @example
632
- * ```typescript
633
- * queue: (ctx) => ctx.container.queues.reports
634
- * ```
635
- */
628
+ * Optional queue factory function to control workflow execution.
629
+ * Useful for limiting concurrency when the same scheduled job runs on multiple instances.
630
+ *
631
+ * @example
632
+ * ```typescript
633
+ * queue: (ctx) => ctx.container.queues.reports
634
+ * ```
635
+ */
636
636
  queue?: QueueFactory;
637
637
  /**
638
- * The workflow function to execute on schedule.
639
- *
640
- * @param ctx - Workflow context with container, scheduledTime, and step helper
641
- */
638
+ * The workflow function to execute on schedule.
639
+ *
640
+ * @param ctx - Workflow context with container, scheduledTime, and step helper
641
+ */
642
642
  run: (ctx: ScheduledWorkflowContext) => Promise<void>;
643
643
  }
644
644
  /**
@@ -661,20 +661,20 @@ interface DefineScheduledWorkflowOptions {
661
661
  */
662
662
  declare function defineScheduledWorkflow(options: DefineScheduledWorkflowOptions): {
663
663
  /**
664
- * The cron expression for this workflow.
665
- */
664
+ * The cron expression for this workflow.
665
+ */
666
666
  crontab: string;
667
667
  /**
668
- * The workflow name (set during registration from filename).
669
- */
668
+ * The workflow name (set during registration from filename).
669
+ */
670
670
  readonly name: string | null;
671
671
  /**
672
- * Register this workflow with DBOS. Called by the workflow loader.
673
- *
674
- * @param c - The application container
675
- * @param name - The workflow name (derived from filename)
676
- * @param dbos - The DBOS instance to use for registration
677
- */
672
+ * Register this workflow with DBOS. Called by the workflow loader.
673
+ *
674
+ * @param c - The application container
675
+ * @param name - The workflow name (derived from filename)
676
+ * @param dbos - The DBOS instance to use for registration
677
+ */
678
678
  register(c: Container, name: string, dbos: typeof DBOS): void;
679
679
  };
680
680
  /**
@@ -682,16 +682,16 @@ declare function defineScheduledWorkflow(options: DefineScheduledWorkflowOptions
682
682
  */
683
683
  interface LoadWorkflowsOptions {
684
684
  /**
685
- * The application container.
686
- */
685
+ * The application container.
686
+ */
687
687
  container: Container;
688
688
  /**
689
- * The DBOS instance to use for registration.
690
- */
689
+ * The DBOS instance to use for registration.
690
+ */
691
691
  dbos: typeof DBOS;
692
692
  /**
693
- * Optional custom workflows directory path.
694
- */
693
+ * Optional custom workflows directory path.
694
+ */
695
695
  workflowsDir?: string;
696
696
  }
697
697
  /**
@@ -714,12 +714,12 @@ declare function loadWorkflows(opts: LoadWorkflowsOptions): Promise<void>;
714
714
  */
715
715
  type MailerPayloadReact = Omit<Mail.Options, "from" | "html" | "text"> & {
716
716
  /**
717
- * The email address to send the email from.
718
- */
717
+ * The email address to send the email from.
718
+ */
719
719
  from?: string;
720
720
  /**
721
- * The React component to render as the email body.
722
- */
721
+ * The React component to render as the email body.
722
+ */
723
723
  react: JSX.Element;
724
724
  };
725
725
  /**
@@ -727,16 +727,16 @@ type MailerPayloadReact = Omit<Mail.Options, "from" | "html" | "text"> & {
727
727
  */
728
728
  type MailerPayloadHtml = Omit<Mail.Options, "from"> & {
729
729
  /**
730
- * The email address to send the email from.
731
- */
730
+ * The email address to send the email from.
731
+ */
732
732
  from?: string;
733
733
  /**
734
- * The HTML content of the email.
735
- */
734
+ * The HTML content of the email.
735
+ */
736
736
  html: string;
737
737
  /**
738
- * The plain text content of the email.
739
- */
738
+ * The plain text content of the email.
739
+ */
740
740
  text: string;
741
741
  };
742
742
  /**
@@ -748,13 +748,13 @@ type MailerPayload = MailerPayloadReact | MailerPayloadHtml;
748
748
  */
749
749
  interface Mailer {
750
750
  /**
751
- * Send an email immediately.
752
- */
751
+ * Send an email immediately.
752
+ */
753
753
  send(payload: MailerPayload): Promise<void>;
754
754
  /**
755
- * Send an email durably via workflow.
756
- * Pre-renders React components before starting workflow.
757
- */
755
+ * Send an email durably via workflow.
756
+ * Pre-renders React components before starting workflow.
757
+ */
758
758
  sendLater(payload: MailerPayload): Promise<WorkflowHandle<{
759
759
  sent: boolean;
760
760
  }>>;
@@ -764,16 +764,16 @@ interface Mailer {
764
764
  */
765
765
  interface MailerWithQueue {
766
766
  /**
767
- * Send an email immediately.
768
- */
767
+ * Send an email immediately.
768
+ */
769
769
  send(payload: MailerPayload): Promise<void>;
770
770
  /**
771
- * Send an email durably via workflow.
772
- * Pre-renders React components before starting workflow.
773
- *
774
- * @param payload - The mailer payload with React component or direct HTML+text.
775
- * @param startOptions - Optional workflow start options (priority, partitionKey, etc.).
776
- */
771
+ * Send an email durably via workflow.
772
+ * Pre-renders React components before starting workflow.
773
+ *
774
+ * @param payload - The mailer payload with React component or direct HTML+text.
775
+ * @param startOptions - Optional workflow start options (priority, partitionKey, etc.).
776
+ */
777
777
  sendLater(payload: MailerPayload, startOptions?: WorkflowStartOptions): Promise<WorkflowHandle<{
778
778
  sent: boolean;
779
779
  }>>;
@@ -783,12 +783,12 @@ interface MailerWithQueue {
783
783
  */
784
784
  interface DefineMailerOptions {
785
785
  /**
786
- * The default email address to use as the sender.
787
- */
786
+ * The default email address to use as the sender.
787
+ */
788
788
  from: string;
789
789
  /**
790
- * The SMTP URL to use for sending emails.
791
- */
790
+ * The SMTP URL to use for sending emails.
791
+ */
792
792
  smtpUrl: string;
793
793
  }
794
794
  /**
@@ -796,9 +796,9 @@ interface DefineMailerOptions {
796
796
  */
797
797
  interface DefineMailerOptionsWithQueue<TQueue extends Queue> extends DefineMailerOptions {
798
798
  /**
799
- * Queue for sendLater() durable workflow execution.
800
- * When provided, sendLater() accepts startOptions (priority, partitionKey, etc.).
801
- */
799
+ * Queue for sendLater() durable workflow execution.
800
+ * When provided, sendLater() accepts startOptions (priority, partitionKey, etc.).
801
+ */
802
802
  queue: TQueue;
803
803
  }
804
804
  /**
@@ -1592,28 +1592,28 @@ type ImageTransformations = z.infer<typeof transformationsSchema>;
1592
1592
  */
1593
1593
  interface DefineS3DiskOptions {
1594
1594
  /**
1595
- * The S3 bucket name.
1596
- */
1595
+ * The S3 bucket name.
1596
+ */
1597
1597
  bucket: string;
1598
1598
  /**
1599
- * Optional credentials. If not provided, uses default AWS credential chain.
1600
- */
1599
+ * Optional credentials. If not provided, uses default AWS credential chain.
1600
+ */
1601
1601
  credentials?: {
1602
1602
  accessKeyId: string;
1603
1603
  secretAccessKey: string;
1604
1604
  };
1605
1605
  /**
1606
- * Optional S3 endpoint for S3-compatible services (e.g., MinIO, LocalStack).
1607
- */
1606
+ * Optional S3 endpoint for S3-compatible services (e.g., MinIO, LocalStack).
1607
+ */
1608
1608
  endpoint?: string;
1609
1609
  /**
1610
- * The AWS region.
1611
- */
1610
+ * The AWS region.
1611
+ */
1612
1612
  region: string;
1613
1613
  /**
1614
- * Bucket visibility (private or public).
1615
- * @default "private"
1616
- */
1614
+ * Bucket visibility (private or public).
1615
+ * @default "private"
1616
+ */
1617
1617
  visibility?: "private" | "public";
1618
1618
  }
1619
1619
  /**
@@ -1652,44 +1652,44 @@ type DatabaseWithStorage = NodePgDatabase<StorageTables, StorageRelationsConfig>
1652
1652
  */
1653
1653
  interface DefineStorageOptions<TDisks extends Record<string, FSDriverOptions | S3DriverOptions>, TDb extends NodePgDatabase<any, any> = DatabaseWithStorage, TAttachments extends Partial<Record<ExtractTableNames<TDb>, readonly string[]>> = Record<never, never>> {
1654
1654
  /**
1655
- * Type-safe attachment name configuration.
1656
- * Maps table names to valid attachment names for that table.
1657
- *
1658
- * @example
1659
- * ```typescript
1660
- * attachments: {
1661
- * users: ["avatar", "documents"] as const,
1662
- * posts: ["images", "cover"] as const,
1663
- * }
1664
- * ```
1665
- */
1655
+ * Type-safe attachment name configuration.
1656
+ * Maps table names to valid attachment names for that table.
1657
+ *
1658
+ * @example
1659
+ * ```typescript
1660
+ * attachments: {
1661
+ * users: ["avatar", "documents"] as const,
1662
+ * posts: ["images", "cover"] as const,
1663
+ * }
1664
+ * ```
1665
+ */
1666
1666
  attachments?: TAttachments;
1667
1667
  /**
1668
- * The database instance with storage schema and relations.
1669
- */
1668
+ * The database instance with storage schema and relations.
1669
+ */
1670
1670
  database: TDb;
1671
1671
  /**
1672
- * The default disk name.
1673
- */
1672
+ * The default disk name.
1673
+ */
1674
1674
  default?: keyof TDisks;
1675
1675
  /**
1676
- * The disk configurations.
1677
- */
1676
+ * The disk configurations.
1677
+ */
1678
1678
  disks?: TDisks;
1679
1679
  /**
1680
- * Optional public endpoint for signed URLs (for S3 disks).
1681
- *
1682
- * If provided, signed URLs will use this endpoint to be browser-accessible.
1683
- */
1680
+ * Optional public endpoint for signed URLs (for S3 disks).
1681
+ *
1682
+ * If provided, signed URLs will use this endpoint to be browser-accessible.
1683
+ */
1684
1684
  publicEndpoint?: string;
1685
1685
  /**
1686
- * Cron expression for unattached blob purge schedule.
1687
- * @default "0 0 * * *" (midnight daily)
1688
- */
1686
+ * Cron expression for unattached blob purge schedule.
1687
+ * @default "0 0 * * *" (midnight daily)
1688
+ */
1689
1689
  purgeCron?: string;
1690
1690
  /**
1691
- * Secret key for signing blob IDs. Required for signedId() / findSigned() methods.
1692
- */
1691
+ * Secret key for signing blob IDs. Required for signedId() / findSigned() methods.
1692
+ */
1693
1693
  secret: string;
1694
1694
  }
1695
1695
  /**
@@ -1727,35 +1727,35 @@ type AttachmentName<TAttachments extends Partial<Record<string, readonly string[
1727
1727
  */
1728
1728
  declare class StorageService<TDiskNames extends string = string, TTableNames extends string = string, TAttachments extends Partial<Record<TTableNames, readonly string[]>> = Record<never, never>> {
1729
1729
  /**
1730
- * The drive manager for file operations.
1731
- */
1730
+ * The drive manager for file operations.
1731
+ */
1732
1732
  readonly drive: DriveManager<any>;
1733
1733
  /**
1734
- * The database instance with storage schema and relations.
1735
- */
1734
+ * The database instance with storage schema and relations.
1735
+ */
1736
1736
  readonly db: DatabaseWithStorage;
1737
1737
  /**
1738
- * The default disk name.
1739
- */
1738
+ * The default disk name.
1739
+ */
1740
1740
  readonly defaultDisk: TDiskNames;
1741
1741
  /**
1742
- * Cron expression for unattached blob purge schedule.
1743
- *
1744
- * @default "0 0 * * *"
1745
- */
1742
+ * Cron expression for unattached blob purge schedule.
1743
+ *
1744
+ * @default "0 0 * * *"
1745
+ */
1746
1746
  readonly purgeCron?: string;
1747
1747
  /**
1748
- * Secret key for signing blob IDs.
1749
- */
1748
+ * Secret key for signing blob IDs.
1749
+ */
1750
1750
  readonly secret: string;
1751
1751
  /**
1752
- * Drive manager for generating signed URLs (public endpoint).
1753
- */
1752
+ * Drive manager for generating signed URLs (public endpoint).
1753
+ */
1754
1754
  readonly signedUrlDrive: DriveManager<any>;
1755
1755
  constructor(drive: DriveManager<any>, db: DatabaseWithStorage, defaultDisk: TDiskNames, secret: string, signedUrlDrive: DriveManager<any>, purgeCron?: string);
1756
1756
  /**
1757
- * Create a blob record and upload file.
1758
- */
1757
+ * Create a blob record and upload file.
1758
+ */
1759
1759
  createBlob(file: Buffer | Uint8Array, options: {
1760
1760
  filename: string;
1761
1761
  contentType?: string;
@@ -1764,40 +1764,40 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
1764
1764
  prefix?: string;
1765
1765
  }): Promise<StorageBlob>;
1766
1766
  /**
1767
- * Get blob by ID.
1768
- */
1767
+ * Get blob by ID.
1768
+ */
1769
1769
  getBlob(id: string): Promise<StorageBlob | null>;
1770
1770
  /**
1771
- * Download blob content.
1772
- */
1771
+ * Download blob content.
1772
+ */
1773
1773
  downloadBlob(id: string): Promise<Buffer | null>;
1774
1774
  /**
1775
- * Delete blob and its content.
1776
- */
1775
+ * Delete blob and its content.
1776
+ */
1777
1777
  deleteBlob(id: string): Promise<boolean>;
1778
1778
  /**
1779
- * Get signed URL for blob. If blob is on public service, returns permanent
1780
- * URL instead.
1781
- */
1779
+ * Get signed URL for blob. If blob is on public service, returns permanent
1780
+ * URL instead.
1781
+ */
1782
1782
  getSignedUrl(id: string, options?: {
1783
1783
  expiresIn?: number;
1784
1784
  disposition?: "inline" | "attachment";
1785
1785
  filename?: string;
1786
1786
  }): Promise<string | null>;
1787
1787
  /**
1788
- * Get permanent public URL (no expiration).
1789
- * Works for blobs on public storage service.
1790
- */
1788
+ * Get permanent public URL (no expiration).
1789
+ * Works for blobs on public storage service.
1790
+ */
1791
1791
  getPublicUrl(id: string): Promise<string | null>;
1792
1792
  /**
1793
- * Create attachment between a record and blob.
1794
- *
1795
- * @param recordType - The table name (e.g., 'users')
1796
- * @param recordId - The record ID
1797
- * @param blobId - The blob ID to attach
1798
- * @param name - The attachment name (e.g., 'avatar')
1799
- * @param replaceExisting - If true, replaces existing attachment with same name (for one-to-one)
1800
- */
1793
+ * Create attachment between a record and blob.
1794
+ *
1795
+ * @param recordType - The table name (e.g., 'users')
1796
+ * @param recordId - The record ID
1797
+ * @param blobId - The blob ID to attach
1798
+ * @param name - The attachment name (e.g., 'avatar')
1799
+ * @param replaceExisting - If true, replaces existing attachment with same name (for one-to-one)
1800
+ */
1801
1801
  createAttachment(recordType: string, recordId: string, blobId: string, name: string, replaceExisting?: boolean): Promise<{
1802
1802
  name: string;
1803
1803
  id: string;
@@ -1807,8 +1807,8 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
1807
1807
  blobId: string;
1808
1808
  }>;
1809
1809
  /**
1810
- * Get attachments for a record with their associated blobs.
1811
- */
1810
+ * Get attachments for a record with their associated blobs.
1811
+ */
1812
1812
  getAttachments(recordType: string, recordId: string, name?: string): Promise<{
1813
1813
  name: string;
1814
1814
  id: string;
@@ -1829,10 +1829,10 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
1829
1829
  } | null;
1830
1830
  }[]>;
1831
1831
  /**
1832
- * Get attachments by their IDs with associated blobs.
1833
- *
1834
- * @param attachmentIds - Array of attachment IDs to fetch.
1835
- */
1832
+ * Get attachments by their IDs with associated blobs.
1833
+ *
1834
+ * @param attachmentIds - Array of attachment IDs to fetch.
1835
+ */
1836
1836
  getAttachmentsByIds(attachmentIds: string[]): Promise<{
1837
1837
  name: string;
1838
1838
  id: string;
@@ -1853,17 +1853,17 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
1853
1853
  } | null;
1854
1854
  }[]>;
1855
1855
  /**
1856
- * Delete a single attachment by ID.
1857
- */
1856
+ * Delete a single attachment by ID.
1857
+ */
1858
1858
  deleteAttachment(attachmentId: string): Promise<boolean>;
1859
1859
  /**
1860
- * Delete attachments for a record (without deleting the blobs).
1861
- */
1860
+ * Delete attachments for a record (without deleting the blobs).
1861
+ */
1862
1862
  deleteAttachments(recordType: string, recordId: string, name?: string): Promise<number>;
1863
1863
  /**
1864
- * Get direct upload credentials (for S3). Also creates a pending blob record
1865
- * that will be finalized after upload.
1866
- */
1864
+ * Get direct upload credentials (for S3). Also creates a pending blob record
1865
+ * that will be finalized after upload.
1866
+ */
1867
1867
  getDirectUploadUrl(options: {
1868
1868
  contentType?: string;
1869
1869
  expiresIn?: number;
@@ -1877,83 +1877,83 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
1877
1877
  url: string;
1878
1878
  } | null>;
1879
1879
  /**
1880
- * Finalize a direct upload by updating blob metadata. Call this after the
1881
- * client has uploaded to S3.
1882
- */
1880
+ * Finalize a direct upload by updating blob metadata. Call this after the
1881
+ * client has uploaded to S3.
1882
+ */
1883
1883
  finalizeDirectUpload(blobId: string, actualSize: number): Promise<void>;
1884
1884
  /**
1885
- * Update blob metadata (for automatic extraction).
1886
- */
1885
+ * Update blob metadata (for automatic extraction).
1886
+ */
1887
1887
  updateBlobMetadata(blobId: string, metadata: Record<string, any>): Promise<void>;
1888
1888
  /**
1889
- * Get existing variant or return null.
1890
- */
1889
+ * Get existing variant or return null.
1890
+ */
1891
1891
  getVariant(blobId: string, transformations: ImageTransformations): Promise<StorageBlob | null>;
1892
1892
  /**
1893
- * Create variant blob and record.
1894
- */
1893
+ * Create variant blob and record.
1894
+ */
1895
1895
  createVariant(blobId: string, transformations: ImageTransformations, variantBuffer: Buffer): Promise<StorageBlob>;
1896
1896
  /**
1897
- * Get blobs that have no attachments (orphaned). Useful for cleanup jobs.
1898
- */
1897
+ * Get blobs that have no attachments (orphaned). Useful for cleanup jobs.
1898
+ */
1899
1899
  getUnattachedBlobs(options?: {
1900
1900
  olderThan?: string;
1901
1901
  limit?: number;
1902
1902
  }): Promise<StorageBlob[]>;
1903
1903
  /**
1904
- * Get pending blobs that were never finalized (stuck direct uploads).
1905
- */
1904
+ * Get pending blobs that were never finalized (stuck direct uploads).
1905
+ */
1906
1906
  getPendingBlobs(olderThan?: string): Promise<StorageBlob[]>;
1907
1907
  /**
1908
- * Purge unattached blobs.
1909
- */
1908
+ * Purge unattached blobs.
1909
+ */
1910
1910
  purgeUnattached(olderThan?: string): Promise<number>;
1911
1911
  /**
1912
- * Create a signed, tamper-proof reference to a blob.
1913
- * Use findSigned() to resolve back to blob.
1914
- *
1915
- * Algorithm:
1916
- * 1. Create payload with blobId and optional expiration timestamp
1917
- * 2. JSON stringify and base64url encode the payload
1918
- * 3. Create HMAC-SHA256 signature of the encoded payload
1919
- * 4. Return payload.signature format
1920
- *
1921
- * @param blobId - The blob ID to sign
1922
- * @param expiresIn - Seconds until expiry. Pass undefined/null for non-expiring. Default: 3600 (1 hour)
1923
- */
1912
+ * Create a signed, tamper-proof reference to a blob.
1913
+ * Use findSigned() to resolve back to blob.
1914
+ *
1915
+ * Algorithm:
1916
+ * 1. Create payload with blobId and optional expiration timestamp
1917
+ * 2. JSON stringify and base64url encode the payload
1918
+ * 3. Create HMAC-SHA256 signature of the encoded payload
1919
+ * 4. Return payload.signature format
1920
+ *
1921
+ * @param blobId - The blob ID to sign
1922
+ * @param expiresIn - Seconds until expiry. Pass undefined/null for non-expiring. Default: 3600 (1 hour)
1923
+ */
1924
1924
  signedId(blobId: string, expiresIn?: number | null): string;
1925
1925
  /**
1926
- * Find blob by signed ID. Returns null if invalid or expired.
1927
- * Uses constant-time comparison to prevent timing attacks.
1928
- * Supports both expiring and non-expiring signed IDs.
1929
- *
1930
- * Algorithm:
1931
- * 1. Split signed ID into payload and signature
1932
- * 2. Decode and recompute expected signature
1933
- * 3. Use timingSafeEqual for constant-time comparison
1934
- * 4. Check expiration timestamp (if present)
1935
- * 5. Return blob if valid, null otherwise
1936
- */
1926
+ * Find blob by signed ID. Returns null if invalid or expired.
1927
+ * Uses constant-time comparison to prevent timing attacks.
1928
+ * Supports both expiring and non-expiring signed IDs.
1929
+ *
1930
+ * Algorithm:
1931
+ * 1. Split signed ID into payload and signature
1932
+ * 2. Decode and recompute expected signature
1933
+ * 3. Use timingSafeEqual for constant-time comparison
1934
+ * 4. Check expiration timestamp (if present)
1935
+ * 5. Return blob if valid, null otherwise
1936
+ */
1937
1937
  findSigned(signedId: string): Promise<StorageBlob | null>;
1938
1938
  /**
1939
- * Get a single attachment handle (one-to-one relationship).
1940
- * Similar to Rails' `has_one_attached :avatar`.
1941
- *
1942
- * Algorithm:
1943
- * Returns an object with methods to manage a single attachment:
1944
- * - attach(): Replace existing attachment with new blob
1945
- * - get(): Get attached blob or null
1946
- * - url(): Get signed URL
1947
- * - variant(): Get/generate image variant
1948
- * - purge(): Delete attachment and blob
1949
- *
1950
- * @template TTable - The table name (must be in TTableNames)
1951
- */
1939
+ * Get a single attachment handle (one-to-one relationship).
1940
+ * Similar to Rails' `has_one_attached :avatar`.
1941
+ *
1942
+ * Algorithm:
1943
+ * Returns an object with methods to manage a single attachment:
1944
+ * - attach(): Replace existing attachment with new blob
1945
+ * - get(): Get attached blob or null
1946
+ * - url(): Get signed URL
1947
+ * - variant(): Get/generate image variant
1948
+ * - purge(): Delete attachment and blob
1949
+ *
1950
+ * @template TTable - The table name (must be in TTableNames)
1951
+ */
1952
1952
  one<TTable extends TTableNames>(recordType: TTable, recordId: string, name: AttachmentName<TAttachments, TTable>): {
1953
1953
  /**
1954
- * Attach a blob to this record (replaces existing).
1955
- * Auto-triggers extractBlobMetadata workflow.
1956
- */
1954
+ * Attach a blob to this record (replaces existing).
1955
+ * Auto-triggers extractBlobMetadata workflow.
1956
+ */
1957
1957
  attach(blobId: string): Promise<{
1958
1958
  name: string;
1959
1959
  id: string;
@@ -1961,77 +1961,61 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
1961
1961
  recordType: string;
1962
1962
  recordId: string;
1963
1963
  blobId: string;
1964
- }>;
1965
- /** Get the attached blob or null. */
1966
- get(): Promise<StorageBlob | null>;
1967
- /** Check if a blob is attached. */
1968
- attached(): Promise<boolean>;
1969
- /** Get signed URL or null. */
1964
+ }>; /** Get the attached blob or null. */
1965
+ get(): Promise<StorageBlob | null>; /** Check if a blob is attached. */
1966
+ attached(): Promise<boolean>; /** Get signed URL or null. */
1970
1967
  url(options?: {
1971
1968
  expiresIn?: number;
1972
1969
  disposition?: "inline" | "attachment";
1973
- }): Promise<string | null>;
1974
- /** Get permanent public URL or null. */
1975
- publicUrl(): Promise<string | null>;
1976
- /** Get blob metadata or null. */
1977
- metadata(): Promise<Record<string, unknown> | null>;
1978
- /** Check if metadata has been extracted. */
1979
- analyzed(): Promise<boolean>;
1980
- /** Check if blob supports preview/variant generation. */
1970
+ }): Promise<string | null>; /** Get permanent public URL or null. */
1971
+ publicUrl(): Promise<string | null>; /** Get blob metadata or null. */
1972
+ metadata(): Promise<Record<string, unknown> | null>; /** Check if metadata has been extracted. */
1973
+ analyzed(): Promise<boolean>; /** Check if blob supports preview/variant generation. */
1981
1974
  representable(): Promise<boolean>;
1982
1975
  /**
1983
- * Get variant URL. Auto-enqueues generation if not ready.
1984
- * Returns URL if variant exists, null if generating.
1985
- */
1976
+ * Get variant URL. Auto-enqueues generation if not ready.
1977
+ * Returns URL if variant exists, null if generating.
1978
+ */
1986
1979
  variant(transformations: ImageTransformations, expiresIn?: number): Promise<string | null>;
1987
1980
  /**
1988
- * Get preview URL. Auto-enqueues generation if not ready.
1989
- * Returns URL if preview exists, null if generating.
1990
- */
1991
- preview(expiresIn?: number, timeInSeconds?: number): Promise<string | null>;
1992
- /** Detach blob from record (keeps blob for reuse). */
1993
- detach(): Promise<boolean>;
1994
- /** Delete attachment AND blob immediately. */
1995
- purge(): Promise<boolean>;
1996
- /** Enqueue attachment and blob deletion in background. */
1997
- purgeLater(): Promise<boolean>;
1998
- /** Download blob content as Buffer. */
1999
- download(): Promise<Buffer | null>;
2000
- /** Download to temp file, run callback, auto-cleanup. */
1981
+ * Get preview URL. Auto-enqueues generation if not ready.
1982
+ * Returns URL if preview exists, null if generating.
1983
+ */
1984
+ preview(expiresIn?: number, timeInSeconds?: number): Promise<string | null>; /** Detach blob from record (keeps blob for reuse). */
1985
+ detach(): Promise<boolean>; /** Delete attachment AND blob immediately. */
1986
+ purge(): Promise<boolean>; /** Enqueue attachment and blob deletion in background. */
1987
+ purgeLater(): Promise<boolean>; /** Download blob content as Buffer. */
1988
+ download(): Promise<Buffer | null>; /** Download to temp file, run callback, auto-cleanup. */
2001
1989
  open<T>(callback: (filePath: string) => Promise<T> | T): Promise<T | null>;
2002
1990
  /**
2003
- * Smart representation - variant for images, preview for videos/PDFs.
2004
- * Auto-enqueues generation if not ready.
2005
- */
2006
- representation(transformations: ImageTransformations, expiresIn?: number): Promise<string | null>;
2007
- /** Get blob's byte size. */
2008
- byteSize(): Promise<number | null>;
2009
- /** Get blob's content type. */
2010
- contentType(): Promise<string | null>;
2011
- /** Get blob's filename. */
2012
- filename(): Promise<string | null>;
2013
- /** Get signed, tamper-proof ID for the blob. */
1991
+ * Smart representation - variant for images, preview for videos/PDFs.
1992
+ * Auto-enqueues generation if not ready.
1993
+ */
1994
+ representation(transformations: ImageTransformations, expiresIn?: number): Promise<string | null>; /** Get blob's byte size. */
1995
+ byteSize(): Promise<number | null>; /** Get blob's content type. */
1996
+ contentType(): Promise<string | null>; /** Get blob's filename. */
1997
+ filename(): Promise<string | null>; /** Get signed, tamper-proof ID for the blob. */
2014
1998
  signedId(expiresIn?: number): Promise<string | null>;
2015
1999
  };
2016
2000
  /**
2017
- * Get a multiple attachment handle (one-to-many relationship).
2018
- * Similar to Rails' `has_many_attached :images`.
2019
- *
2020
- * Algorithm:
2021
- * Returns an object with methods to manage multiple attachments:
2022
- * - attach(): Add blobs (doesn't replace existing)
2023
- * - list(): Get all attached blobs
2024
- * - urls(): Get signed URLs for all
2025
- * - variants(): Get/generate variants for all
2026
- * - purge(): Delete all or specific attachment
2027
- *
2028
- * @template TTable - The table name (must be in TTableNames)
2029
- */
2001
+ * Get a multiple attachment handle (one-to-many relationship).
2002
+ * Similar to Rails' `has_many_attached :images`.
2003
+ *
2004
+ * Algorithm:
2005
+ * Returns an object with methods to manage multiple attachments:
2006
+ * - attach(): Add blobs (doesn't replace existing)
2007
+ * - list(): Get all attached blobs
2008
+ * - urls(): Get signed URLs for all
2009
+ * - variants(): Get/generate variants for all
2010
+ * - purge(): Delete all or specific attachment
2011
+ *
2012
+ * @template TTable - The table name (must be in TTableNames)
2013
+ */
2030
2014
  many<TTable extends TTableNames>(recordType: TTable, recordId: string, name: AttachmentName<TAttachments, TTable>): {
2031
2015
  /**
2032
- * Attach one or more blobs (adds to existing, doesn't replace).
2033
- * Auto-triggers extractBlobMetadata for each blob.
2034
- */
2016
+ * Attach one or more blobs (adds to existing, doesn't replace).
2017
+ * Auto-triggers extractBlobMetadata for each blob.
2018
+ */
2035
2019
  attach(blobIds: string | string[]): Promise<{
2036
2020
  name: string;
2037
2021
  id: string;
@@ -2039,49 +2023,31 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
2039
2023
  recordType: string;
2040
2024
  recordId: string;
2041
2025
  blobId: string;
2042
- }[]>;
2043
- /** Get all attached blobs. */
2044
- list(): Promise<StorageBlob[]>;
2045
- /** Count attached blobs. */
2046
- count(): Promise<number>;
2047
- /** Get signed URLs for all blobs. */
2026
+ }[]>; /** Get all attached blobs. */
2027
+ list(): Promise<StorageBlob[]>; /** Count attached blobs. */
2028
+ count(): Promise<number>; /** Get signed URLs for all blobs. */
2048
2029
  urls(options?: {
2049
2030
  expiresIn?: number;
2050
- }): Promise<string[]>;
2051
- /** Get public URLs for all blobs. */
2052
- publicUrls(): Promise<(string | null)[]>;
2053
- /** Get metadata for all blobs. */
2054
- metadata(): Promise<(Record<string, unknown> | null)[]>;
2055
- /** Check which blobs have been analyzed. */
2056
- analyzed(): Promise<boolean[]>;
2057
- /** Check which blobs support preview/variants. */
2058
- representable(): Promise<boolean[]>;
2059
- /** Get variant URLs for all blobs. Auto-enqueues if not ready. */
2060
- variants(transformations: ImageTransformations, expiresIn?: number): Promise<(string | null)[]>;
2061
- /** Get preview URLs for all blobs. Auto-enqueues if not ready. */
2062
- previews(expiresIn?: number, timeInSeconds?: number): Promise<(string | null)[]>;
2063
- /** Detach specific blob or all blobs (keeps blobs for reuse). */
2064
- detach(blobId?: string): Promise<number>;
2065
- /** Delete specific or all attachments AND blobs immediately. */
2066
- purge(blobId?: string): Promise<number>;
2067
- /** Enqueue specific or all attachments for background deletion. */
2068
- purgeLater(blobId?: string): Promise<number>;
2069
- /** Download all blobs as Buffers. */
2070
- download(): Promise<Buffer[]>;
2071
- /** Download each blob to temp file, run callback for each. */
2031
+ }): Promise<string[]>; /** Get public URLs for all blobs. */
2032
+ publicUrls(): Promise<(string | null)[]>; /** Get metadata for all blobs. */
2033
+ metadata(): Promise<(Record<string, unknown> | null)[]>; /** Check which blobs have been analyzed. */
2034
+ analyzed(): Promise<boolean[]>; /** Check which blobs support preview/variants. */
2035
+ representable(): Promise<boolean[]>; /** Get variant URLs for all blobs. Auto-enqueues if not ready. */
2036
+ variants(transformations: ImageTransformations, expiresIn?: number): Promise<(string | null)[]>; /** Get preview URLs for all blobs. Auto-enqueues if not ready. */
2037
+ previews(expiresIn?: number, timeInSeconds?: number): Promise<(string | null)[]>; /** Detach specific blob or all blobs (keeps blobs for reuse). */
2038
+ detach(blobId?: string): Promise<number>; /** Delete specific or all attachments AND blobs immediately. */
2039
+ purge(blobId?: string): Promise<number>; /** Enqueue specific or all attachments for background deletion. */
2040
+ purgeLater(blobId?: string): Promise<number>; /** Download all blobs as Buffers. */
2041
+ download(): Promise<Buffer[]>; /** Download each blob to temp file, run callback for each. */
2072
2042
  open<T>(callback: (filePath: string, blob: StorageBlob) => Promise<T> | T): Promise<T[]>;
2073
2043
  /**
2074
- * Smart representations - variant for images, preview for videos/PDFs.
2075
- * Auto-enqueues generation if not ready.
2076
- */
2077
- representations(transformations: ImageTransformations, expiresIn?: number): Promise<(string | null)[]>;
2078
- /** Get byte sizes for all blobs. */
2079
- byteSizes(): Promise<number[]>;
2080
- /** Get content types for all blobs. */
2081
- contentTypes(): Promise<(string | null)[]>;
2082
- /** Get filenames for all blobs. */
2083
- filenames(): Promise<string[]>;
2084
- /** Get signed IDs for all blobs. */
2044
+ * Smart representations - variant for images, preview for videos/PDFs.
2045
+ * Auto-enqueues generation if not ready.
2046
+ */
2047
+ representations(transformations: ImageTransformations, expiresIn?: number): Promise<(string | null)[]>; /** Get byte sizes for all blobs. */
2048
+ byteSizes(): Promise<number[]>; /** Get content types for all blobs. */
2049
+ contentTypes(): Promise<(string | null)[]>; /** Get filenames for all blobs. */
2050
+ filenames(): Promise<string[]>; /** Get signed IDs for all blobs. */
2085
2051
  signedIds(expiresIn?: number): Promise<string[]>;
2086
2052
  };
2087
2053
  }
@@ -2092,76 +2058,76 @@ declare class StorageService<TDiskNames extends string = string, TTableNames ext
2092
2058
  */
2093
2059
  interface ServerConfig {
2094
2060
  /**
2095
- * The host address the server will bind to.
2096
- *
2097
- * @default "0.0.0.0"
2098
- */
2061
+ * The host address the server will bind to.
2062
+ *
2063
+ * @default "0.0.0.0"
2064
+ */
2099
2065
  host?: string;
2100
2066
  /**
2101
- * The port number the server will listen on.
2102
- */
2067
+ * The port number the server will listen on.
2068
+ */
2103
2069
  port: number;
2104
2070
  /**
2105
- * Request timeout in milliseconds. Requests exceeding this duration
2106
- * will receive a 408 Request Timeout response.
2107
- *
2108
- * @default 30000
2109
- */
2071
+ * Request timeout in milliseconds. Requests exceeding this duration
2072
+ * will receive a 408 Request Timeout response.
2073
+ *
2074
+ * @default 30000
2075
+ */
2110
2076
  timeout?: number;
2111
2077
  /**
2112
- * Maximum request body size for JSON and URL-encoded payloads.
2113
- * Supports bytes.js format strings (e.g., "1mb", "500kb", "10mb").
2114
- *
2115
- * @default "1mb"
2116
- */
2078
+ * Maximum request body size for JSON and URL-encoded payloads.
2079
+ * Supports bytes.js format strings (e.g., "1mb", "500kb", "10mb").
2080
+ *
2081
+ * @default "1mb"
2082
+ */
2117
2083
  bodyLimit?: string;
2118
2084
  /**
2119
- * The path for the health check endpoint.
2120
- *
2121
- * @default "/health"
2122
- */
2085
+ * The path for the health check endpoint.
2086
+ *
2087
+ * @default "/health"
2088
+ */
2123
2089
  healthPath?: string;
2124
2090
  /**
2125
- * CORS configuration. Omit or set to undefined to disable.
2126
- *
2127
- * @example
2128
- * cors: { origin: "https://example.com", credentials: true }
2129
- */
2091
+ * CORS configuration. Omit or set to undefined to disable.
2092
+ *
2093
+ * @example
2094
+ * cors: { origin: "https://example.com", credentials: true }
2095
+ */
2130
2096
  cors?: CorsOptions;
2131
2097
  /**
2132
- * Security headers configuration (via helmet). Omit or set to undefined to disable.
2133
- * Recommended for production deployments.
2134
- *
2135
- * @example
2136
- * helmet: { contentSecurityPolicy: false } // Enable with CSP disabled
2137
- * helmet: {} // Enable with all defaults
2138
- */
2098
+ * Security headers configuration (via helmet). Omit or set to undefined to disable.
2099
+ * Recommended for production deployments.
2100
+ *
2101
+ * @example
2102
+ * helmet: { contentSecurityPolicy: false } // Enable with CSP disabled
2103
+ * helmet: {} // Enable with all defaults
2104
+ */
2139
2105
  helmet?: HelmetOptions;
2140
2106
  /**
2141
- * Rate limiting configuration. Array of express-rate-limit options.
2142
- * Each config is applied as a separate middleware - use `skip` function for path-specific limits.
2143
- * Redis store is automatically configured if `redisUrl` is provided.
2144
- *
2145
- * @example
2146
- * // Global rate limit
2147
- * rateLimit: [{ windowMs: 60000, limit: 100 }]
2148
- *
2149
- * @example
2150
- * // Path-specific rate limits
2151
- * rateLimit: [
2152
- * { windowMs: 900000, limit: 5, skip: (req) => !req.path.startsWith("/api/auth") },
2153
- * { windowMs: 60000, limit: 100 }, // Default for all other routes
2154
- * ]
2155
- */
2107
+ * Rate limiting configuration. Array of express-rate-limit options.
2108
+ * Each config is applied as a separate middleware - use `skip` function for path-specific limits.
2109
+ * Redis store is automatically configured if `redisUrl` is provided.
2110
+ *
2111
+ * @example
2112
+ * // Global rate limit
2113
+ * rateLimit: [{ windowMs: 60000, limit: 100 }]
2114
+ *
2115
+ * @example
2116
+ * // Path-specific rate limits
2117
+ * rateLimit: [
2118
+ * { windowMs: 900000, limit: 5, skip: (req) => !req.path.startsWith("/api/auth") },
2119
+ * { windowMs: 60000, limit: 100 }, // Default for all other routes
2120
+ * ]
2121
+ */
2156
2122
  rateLimit?: Options[];
2157
2123
  /**
2158
- * Redis URL for rate limiting store (for multi-instance deployments).
2159
- * Server auto-connects and cleans up on shutdown.
2160
- * If omitted, uses in-memory store (not suitable for production clusters).
2161
- *
2162
- * @example
2163
- * redisUrl: "redis://localhost:6379"
2164
- */
2124
+ * Redis URL for rate limiting store (for multi-instance deployments).
2125
+ * Server auto-connects and cleans up on shutdown.
2126
+ * If omitted, uses in-memory store (not suitable for production clusters).
2127
+ *
2128
+ * @example
2129
+ * redisUrl: "redis://localhost:6379"
2130
+ */
2165
2131
  redisUrl?: string;
2166
2132
  }
2167
2133
  /**
@@ -2169,8 +2135,8 @@ interface ServerConfig {
2169
2135
  */
2170
2136
  interface WorkerConfig {
2171
2137
  /**
2172
- * The system database URL for DBOS.
2173
- */
2138
+ * The system database URL for DBOS.
2139
+ */
2174
2140
  dbUrl: string;
2175
2141
  }
2176
2142
  /**
@@ -2179,52 +2145,52 @@ interface WorkerConfig {
2179
2145
  */
2180
2146
  interface AppContainer<TDb extends Record<"primary", Database> & Record<string, Database> = Record<"primary", Database> & Record<string, Database>> {
2181
2147
  /**
2182
- * The application auth configuration.
2183
- */
2148
+ * The application auth configuration.
2149
+ */
2184
2150
  auth: Auth$1<TDb>;
2185
2151
  /**
2186
- * A map of caches available in the application.
2187
- */
2152
+ * A map of caches available in the application.
2153
+ */
2188
2154
  cache: Record<string, Cache>;
2189
2155
  /**
2190
- * The application configuration.
2191
- */
2156
+ * The application configuration.
2157
+ */
2192
2158
  config: Config;
2193
2159
  /**
2194
- * A map of databases available in the application.
2195
- */
2160
+ * A map of databases available in the application.
2161
+ */
2196
2162
  db: TDb;
2197
2163
  /**
2198
- * The i18n instance for internationalization.
2199
- */
2164
+ * The i18n instance for internationalization.
2165
+ */
2200
2166
  i18n: i18n;
2201
2167
  /**
2202
- * The logger instance for logging messages.
2203
- */
2168
+ * The logger instance for logging messages.
2169
+ */
2204
2170
  logger: Logger;
2205
2171
  /**
2206
- * The event bus for in-memory and Redis pub/sub messaging.
2207
- */
2172
+ * The event bus for in-memory and Redis pub/sub messaging.
2173
+ */
2208
2174
  eventBus: EventBus;
2209
2175
  /**
2210
- * The mailer instance for sending emails.
2211
- */
2176
+ * The mailer instance for sending emails.
2177
+ */
2212
2178
  mailer: Mailer;
2213
2179
  /**
2214
- * A map of workflow queues for controlling execution concurrency.
2215
- */
2180
+ * A map of workflow queues for controlling execution concurrency.
2181
+ */
2216
2182
  queues: Record<string, Queue>;
2217
2183
  /**
2218
- * Server configuration for the HTTP server.
2219
- */
2184
+ * Server configuration for the HTTP server.
2185
+ */
2220
2186
  server: ServerConfig;
2221
2187
  /**
2222
- * A map of storage services available in the application.
2223
- */
2188
+ * A map of storage services available in the application.
2189
+ */
2224
2190
  storage: Record<"primary", Storage> & Record<string, Storage>;
2225
2191
  /**
2226
- * Worker configuration for the DBOS workflow worker.
2227
- */
2192
+ * Worker configuration for the DBOS workflow worker.
2193
+ */
2228
2194
  worker: WorkerConfig;
2229
2195
  }
2230
2196
  /**
@@ -2291,16 +2257,16 @@ declare function defineAppContainer<T extends AppContainer>(container: T): T;
2291
2257
  */
2292
2258
  interface RequestMetadata {
2293
2259
  /**
2294
- * Client's IP address from X-Forwarded-For or RemoteAddr.
2295
- */
2260
+ * Client's IP address from X-Forwarded-For or RemoteAddr.
2261
+ */
2296
2262
  ipAddress: string;
2297
2263
  /**
2298
- * Client's User-Agent header.
2299
- */
2264
+ * Client's User-Agent header.
2265
+ */
2300
2266
  userAgent: string;
2301
2267
  /**
2302
- * Client IP's country from CF-IPCountry header.
2303
- */
2268
+ * Client IP's country from CF-IPCountry header.
2269
+ */
2304
2270
  country: string;
2305
2271
  }
2306
2272
  //#endregion
@@ -2309,51 +2275,51 @@ declare global {
2309
2275
  namespace Express {
2310
2276
  interface Locals {
2311
2277
  /**
2312
- * The application container with services and dependencies.
2313
- */
2278
+ * The application container with services and dependencies.
2279
+ */
2314
2280
  container: AppContainer;
2315
2281
  }
2316
2282
  interface Request {
2317
2283
  /**
2318
- * The API key, or null if not authenticated via API key.
2319
- */
2284
+ * The API key, or null if not authenticated via API key.
2285
+ */
2320
2286
  apiKey: ApiKey | null;
2321
2287
  /**
2322
- * The text direction for the detected language (e.g., "ltr" or "rtl").
2323
- */
2288
+ * The text direction for the detected language (e.g., "ltr" or "rtl").
2289
+ */
2324
2290
  dir: string;
2325
2291
  /**
2326
- * The idempotency key provided in the request headers.
2327
- */
2292
+ * The idempotency key provided in the request headers.
2293
+ */
2328
2294
  idempotencyKey?: string;
2329
2295
  /**
2330
- * The detected language from the request's Accept-Language header.
2331
- */
2296
+ * The detected language from the request's Accept-Language header.
2297
+ */
2332
2298
  language: string;
2333
2299
  /**
2334
- * The list of supported languages.
2335
- */
2300
+ * The list of supported languages.
2301
+ */
2336
2302
  languages: readonly string[];
2337
2303
  /**
2338
- * Metadata about the request for logging purposes.
2339
- */
2304
+ * Metadata about the request for logging purposes.
2305
+ */
2340
2306
  metadata: RequestMetadata;
2341
2307
  /**
2342
- * Request body in raw bytes
2343
- */
2308
+ * Request body in raw bytes
2309
+ */
2344
2310
  rawBody?: Buffer;
2345
2311
  /**
2346
- * The unique request ID for tracing purposes.
2347
- */
2312
+ * The unique request ID for tracing purposes.
2313
+ */
2348
2314
  requestId: string;
2349
2315
  /**
2350
- * The translation function for the detected language.
2351
- */
2316
+ * The translation function for the detected language.
2317
+ */
2352
2318
  t: TFunction;
2353
2319
  /**
2354
- * Error context from tRPC onError callback. Used by request-logger to
2355
- * include rich error details.
2356
- */
2320
+ * Error context from tRPC onError callback. Used by request-logger to
2321
+ * include rich error details.
2322
+ */
2357
2323
  __trpcError?: {
2358
2324
  message: string;
2359
2325
  code: string;
@@ -2372,24 +2338,24 @@ type SessionData = NonNullable<Awaited<ReturnType<Auth["api"]["getSession"]>>>;
2372
2338
  */
2373
2339
  interface AppContext {
2374
2340
  /**
2375
- * The API key data, or null if not authenticated via API key.
2376
- */
2341
+ * The API key data, or null if not authenticated via API key.
2342
+ */
2377
2343
  apiKeyId?: string;
2378
2344
  /**
2379
- * Application container with services and dependencies.
2380
- */
2381
- container: AppContainer;
2345
+ * Application container with services and dependencies.
2346
+ */
2347
+ container: Container;
2382
2348
  /**
2383
- * The incoming request object.
2384
- */
2349
+ * The incoming request object.
2350
+ */
2385
2351
  request: Request;
2386
2352
  /**
2387
- * The current session ID, or null if not authenticated.
2388
- */
2353
+ * The current session ID, or null if not authenticated.
2354
+ */
2389
2355
  sessionId?: string;
2390
2356
  /**
2391
- * The current user ID, or null if not authenticated.
2392
- */
2357
+ * The current user ID, or null if not authenticated.
2358
+ */
2393
2359
  userId?: string;
2394
2360
  }
2395
2361
  /**
@@ -2397,20 +2363,20 @@ interface AppContext {
2397
2363
  */
2398
2364
  interface DefineAppContextOpts {
2399
2365
  /**
2400
- * The API key data, or null if not authenticated via API key.
2401
- */
2366
+ * The API key data, or null if not authenticated via API key.
2367
+ */
2402
2368
  apiKey: ApiKey | null;
2403
2369
  /**
2404
- * Application container with services and dependencies.
2405
- */
2370
+ * Application container with services and dependencies.
2371
+ */
2406
2372
  container: AppContainer;
2407
2373
  /**
2408
- * Set to true to fetch session (tRPC). False for API key auth (OpenAPI).
2409
- */
2374
+ * Set to true to fetch session (tRPC). False for API key auth (OpenAPI).
2375
+ */
2410
2376
  fetchSession?: boolean;
2411
2377
  /**
2412
- * The incoming request object.
2413
- */
2378
+ * The incoming request object.
2379
+ */
2414
2380
  request: Request;
2415
2381
  }
2416
2382
  /**
@@ -6875,7 +6841,7 @@ declare function defineTypedResponses<TResponses extends Record<number, {
6875
6841
  }>>(responses: TResponses): { [K in keyof TResponses as GetMethodName<K>]: K extends number ? TResponses[K]["schema"] extends z.ZodNull ? () => ResponseMarker<null> : <T extends z.infer<TResponses[K]["schema"]>>(data: Exact<T, z.infer<TResponses[K]["schema"]>>) => ResponseMarker<z.infer<TResponses[K]["schema"]>> : never } & {
6876
6842
  status: <S extends keyof TResponses & number>(statusCode: S, data: TResponses[S]["schema"] extends z.ZodNull ? undefined : Exact<z.infer<TResponses[S]["schema"]>, z.infer<TResponses[S]["schema"]>>) => ResponseMarker;
6877
6843
  };
6878
- type GetMethodName<K$1> = K$1 extends 200 ? "ok" : K$1 extends 201 ? "created" : K$1 extends 202 ? "accepted" : K$1 extends 204 ? "noContent" : K$1 extends 400 ? "badRequest" : K$1 extends 401 ? "unauthorized" : K$1 extends 403 ? "forbidden" : K$1 extends 404 ? "notFound" : K$1 extends 409 ? "conflict" : K$1 extends 422 ? "unprocessableEntity" : K$1 extends 500 ? "internalServerError" : never;
6844
+ type GetMethodName<K> = K extends 200 ? "ok" : K extends 201 ? "created" : K extends 202 ? "accepted" : K extends 204 ? "noContent" : K extends 400 ? "badRequest" : K extends 401 ? "unauthorized" : K extends 403 ? "forbidden" : K extends 404 ? "notFound" : K extends 409 ? "conflict" : K extends 422 ? "unprocessableEntity" : K extends 500 ? "internalServerError" : never;
6879
6845
  /**
6880
6846
  * Handler parameters with full type safety for request inputs.
6881
6847
  */
@@ -7157,12 +7123,12 @@ type RedisClient = ReturnType<typeof createClient> | ReturnType<typeof createClu
7157
7123
  */
7158
7124
  interface DefineRedisClientOptions {
7159
7125
  /**
7160
- * Logger instance for error reporting.
7161
- */
7126
+ * Logger instance for error reporting.
7127
+ */
7162
7128
  logger: Logger;
7163
7129
  /**
7164
- * Redis URL(s). Single: "redis://localhost:6379", Cluster: comma-separated URLs
7165
- */
7130
+ * Redis URL(s). Single: "redis://localhost:6379", Cluster: comma-separated URLs
7131
+ */
7166
7132
  url: string;
7167
7133
  }
7168
7134
  /**
@@ -7180,7 +7146,7 @@ interface DefineRedisClientOptions {
7180
7146
  */
7181
7147
  declare function defineRedisClient(opts: DefineRedisClientOptions): RedisClient;
7182
7148
  declare namespace index_d_exports {
7183
- export { AccessControlRoles, AccessController, AppContainer, AppContext, AuditAction, Auth$1 as Auth, AuthConfig, AuthPasskeyConfig, AuthSessionConfig, Cache, Config, Container, CustomTypeOptions, Database, DatabaseWithStorage, DbChangeInput, DefineAppContextOpts, DefineAuthOptions, DefineCacheOptions, DefineDatabaseOptions, DefineEventBusOptions, DefineLoggerOptions, DefineMailerOptions, DefineMailerOptionsWithQueue, DefineOpenAPIConfig, DefineOpenAPIConfigInput, DefineOpenAPIReturn, DefineQueueOptions, DefineRedisClientOptions, DefineS3DiskOptions, DefineStorageOptions, DefineTestDatabaseOptions, Event, EventBus, EventContext, HandlerParams, I18nInitOptions, Logger, Mailer, MailerPayload, MailerPayloadHtml, MailerPayloadReact, MailerWithQueue, Middleware, MigrationType, NewStorageAttachment, NewStorageBlob, NewStorageVariantRecord, OpenAPIMethodSpec, OpenAPIObjectConfigV31, OpenAPIRegistration, QualifiedTableNames, Queue, QueueFactory, QueueFactoryContext, QueueRateLimit, RedisClient, Role, RouteModule, ScheduledWorkflowContext, ServerConfig, SessionData, Storage, StorageAttachment, StorageBlob, StorageRelations, StorageRelationsConfig, StorageService, StorageTables, StorageVariantRecord, ValidationErrorResponse, WorkerConfig, WorkflowContext, WorkflowHandle, WorkflowStartOptions, auditActionSchema, baseSchema, createAccessControl, dbChangeInputSchema, dbChanges, dbChangesEvent, defaultI18nConfig, defineAppContainer, defineAppContext, defineAuth, defineAuthSchema, defineCache, defineConfig, defineDatabase, defineEndpointRateLimits, defineEvent, defineEventBus, defineI18n, defineLogger, defineMailer, defineMiddleware, defineMigrationOpts, defineOpenAPI, defineOpenAPIConfig, defineOpenAPIEndpoint, defineQueue, defineRedisClient, defineS3Disk, defineScheduledWorkflow, defineStorage, defineStorageSchema, defineTestDatabase, defineTypedResponses, defineWorkflow, generateOpenAPIDocument, i18n$1 as i18n, loadAndRegisterAPIRoutes, loadEvents, loadMiddleware, loadWorkflows, migrationsSchema, registerRoutes, scanAPIRoutes, withOtelSpan, writeOpenAPISpecs };
7149
+ export { AccessControlRoles, AccessController, AppContainer, AppContext, AuditAction, Auth$1 as Auth, AuthCaptchaConfig, AuthConfig, AuthPasskeyConfig, AuthSessionConfig, Cache, CaptchaProvider, Config, Container, CustomTypeOptions, Database, DatabaseWithStorage, DbChangeInput, DefineAppContextOpts, DefineAuthOptions, DefineCacheOptions, DefineDatabaseOptions, DefineEventBusOptions, DefineLoggerOptions, DefineMailerOptions, DefineMailerOptionsWithQueue, DefineOpenAPIConfig, DefineOpenAPIConfigInput, DefineOpenAPIReturn, DefineQueueOptions, DefineRedisClientOptions, DefineS3DiskOptions, DefineStorageOptions, DefineTestDatabaseOptions, Event, EventBus, EventContext, HandlerParams, I18nInitOptions, Logger, Mailer, MailerPayload, MailerPayloadHtml, MailerPayloadReact, MailerWithQueue, Middleware, MigrationType, NewStorageAttachment, NewStorageBlob, NewStorageVariantRecord, OpenAPIMethodSpec, OpenAPIObjectConfigV31, OpenAPIRegistration, QualifiedTableNames, Queue, QueueFactory, QueueFactoryContext, QueueRateLimit, RedisClient, Role, RouteModule, ScheduledWorkflowContext, ServerConfig, SessionData, Storage, StorageAttachment, StorageBlob, StorageRelations, StorageRelationsConfig, StorageService, StorageTables, StorageVariantRecord, ValidationErrorResponse, WorkerConfig, WorkflowContext, WorkflowHandle, WorkflowStartOptions, auditActionSchema, baseSchema, captchaProviders, createAccessControl, dbChangeInputSchema, dbChanges, dbChangesEvent, defaultI18nConfig, defineAppContainer, defineAppContext, defineAuth, defineAuthSchema, defineCache, defineConfig, defineDatabase, defineEndpointRateLimits, defineEvent, defineEventBus, defineI18n, defineLogger, defineMailer, defineMiddleware, defineMigrationOpts, defineOpenAPI, defineOpenAPIConfig, defineOpenAPIEndpoint, defineQueue, defineRedisClient, defineS3Disk, defineScheduledWorkflow, defineStorage, defineStorageSchema, defineTestDatabase, defineTypedResponses, defineWorkflow, generateOpenAPIDocument, i18n$1 as i18n, loadAndRegisterAPIRoutes, loadEvents, loadMiddleware, loadWorkflows, migrationsSchema, registerRoutes, scanAPIRoutes, withOtelSpan, writeOpenAPISpecs };
7184
7150
  }
7185
7151
  //#endregion
7186
7152
  export { StorageAttachment as $, defaultI18nConfig as A, EventBus as At, ServerConfig as B, Cache as Bt, scanAPIRoutes as C, defineQueue as Ct, loadMiddleware as D, DbChangeInput as Dt, defineMiddleware as E, loadWorkflows as Et, DefineAppContextOpts as F, defineEventBus as Ft, DefineStorageOptions as G, defineAppContainer as H, defineCache as Ht, SessionData as I, loadEvents as It, defineS3Disk as J, Storage as K, defineAppContext as L, Config as Lt, i18n$1 as M, dbChangeInputSchema as Mt, defineAuthSchema as N, dbChangesEvent as Nt, App as O, DefineEventBusOptions as Ot, AppContext as P, defineEvent as Pt, NewStorageVariantRecord as Q, AppContainer as R, baseSchema as Rt, registerRoutes as S, WorkflowStartOptions as St, Middleware as T, defineWorkflow as Tt, DatabaseWithStorage as U, WorkerConfig as V, DefineCacheOptions as Vt, DefineS3DiskOptions as W, NewStorageAttachment as X, defineStorage as Y, NewStorageBlob as Z, defineOpenAPIConfig as _, QueueFactoryContext as _t, defineRedisClient as a, defineStorageSchema as at, generateOpenAPIDocument as b, WorkflowContext as bt, DefineOpenAPIConfigInput as c, Mailer as ct, OpenAPIMethodSpec as d, MailerPayloadReact as dt, StorageBlob as et, OpenAPIObjectConfigV31 as f, MailerWithQueue as ft, defineOpenAPI as g, QueueFactory as gt, ValidationErrorResponse as h, Queue as ht, RedisClient as i, StorageVariantRecord as it, defineI18n as j, EventContext as jt, I18nInitOptions as k, Event as kt, DefineOpenAPIReturn as l, MailerPayload as lt, RouteModule as m, DefineQueueOptions as mt, index_d_exports as n, StorageRelationsConfig as nt, withOtelSpan as o, DefineMailerOptions as ot, OpenAPIRegistration as p, defineMailer as pt, StorageService as q, DefineRedisClientOptions as r, StorageTables as rt, DefineOpenAPIConfig as s, DefineMailerOptionsWithQueue as st, CustomTypeOptions as t, StorageRelations as tt, HandlerParams as u, MailerPayloadHtml as ut, defineOpenAPIEndpoint as v, QueueRateLimit as vt, writeOpenAPISpecs as w, defineScheduledWorkflow as wt, loadAndRegisterAPIRoutes as x, WorkflowHandle as xt, defineTypedResponses as y, ScheduledWorkflowContext as yt, Container as z, defineConfig as zt };