alepha 0.20.6 → 0.20.7

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 (243) hide show
  1. package/AGENTS.md +0 -1
  2. package/CLAUDE.md +0 -1
  3. package/assets/agents-template.md +0 -1
  4. package/dist/api/audits/index.browser.js +1 -0
  5. package/dist/api/audits/index.browser.js.map +1 -1
  6. package/dist/api/audits/index.d.ts +370 -355
  7. package/dist/api/audits/index.d.ts.map +1 -1
  8. package/dist/api/audits/index.js +1 -0
  9. package/dist/api/audits/index.js.map +1 -1
  10. package/dist/api/files/index.browser.js +1 -0
  11. package/dist/api/files/index.browser.js.map +1 -1
  12. package/dist/api/files/index.d.ts +179 -170
  13. package/dist/api/files/index.d.ts.map +1 -1
  14. package/dist/api/files/index.js +1 -0
  15. package/dist/api/files/index.js.map +1 -1
  16. package/dist/api/jobs/index.browser.js +7 -0
  17. package/dist/api/jobs/index.browser.js.map +1 -1
  18. package/dist/api/jobs/index.d.ts +271 -262
  19. package/dist/api/jobs/index.d.ts.map +1 -1
  20. package/dist/api/jobs/index.js +21 -3
  21. package/dist/api/jobs/index.js.map +1 -1
  22. package/dist/api/keys/index.d.ts +198 -192
  23. package/dist/api/keys/index.d.ts.map +1 -1
  24. package/dist/api/keys/index.js +1 -0
  25. package/dist/api/keys/index.js.map +1 -1
  26. package/dist/api/notifications/index.d.ts +246 -245
  27. package/dist/api/notifications/index.d.ts.map +1 -1
  28. package/dist/api/organizations/index.d.ts +100 -97
  29. package/dist/api/organizations/index.d.ts.map +1 -1
  30. package/dist/api/parameters/index.d.ts +323 -320
  31. package/dist/api/parameters/index.d.ts.map +1 -1
  32. package/dist/api/payments/index.d.ts +431 -376
  33. package/dist/api/payments/index.d.ts.map +1 -1
  34. package/dist/api/payments/index.js +202 -87
  35. package/dist/api/payments/index.js.map +1 -1
  36. package/dist/api/subscriptions/index.d.ts +1695 -0
  37. package/dist/api/subscriptions/index.d.ts.map +1 -0
  38. package/dist/api/subscriptions/index.js +1919 -0
  39. package/dist/api/subscriptions/index.js.map +1 -0
  40. package/dist/api/users/index.d.ts +863 -847
  41. package/dist/api/users/index.d.ts.map +1 -1
  42. package/dist/api/verifications/index.d.ts +126 -125
  43. package/dist/api/verifications/index.d.ts.map +1 -1
  44. package/dist/bucket/index.d.ts +3 -2
  45. package/dist/bucket/index.d.ts.map +1 -1
  46. package/dist/cache/core/index.d.ts +114 -4
  47. package/dist/cache/core/index.d.ts.map +1 -1
  48. package/dist/cache/core/index.js +181 -15
  49. package/dist/cache/core/index.js.map +1 -1
  50. package/dist/cache/core/index.workerd.js +181 -15
  51. package/dist/cache/core/index.workerd.js.map +1 -1
  52. package/dist/cache/database/index.d.ts +20 -19
  53. package/dist/cache/database/index.d.ts.map +1 -1
  54. package/dist/cache/redis/index.d.ts +3 -2
  55. package/dist/cache/redis/index.d.ts.map +1 -1
  56. package/dist/cli/core/index.d.ts +113 -129
  57. package/dist/cli/core/index.d.ts.map +1 -1
  58. package/dist/cli/core/index.js +75 -7
  59. package/dist/cli/core/index.js.map +1 -1
  60. package/dist/cli/devtools/index.d.ts +3 -2
  61. package/dist/cli/devtools/index.d.ts.map +1 -1
  62. package/dist/cli/platform/index.d.ts +346 -290
  63. package/dist/cli/platform/index.d.ts.map +1 -1
  64. package/dist/cli/platform/index.js +105 -6
  65. package/dist/cli/platform/index.js.map +1 -1
  66. package/dist/cli/vendor/index.d.ts +12 -11
  67. package/dist/cli/vendor/index.d.ts.map +1 -1
  68. package/dist/command/index.d.ts +5 -4
  69. package/dist/command/index.d.ts.map +1 -1
  70. package/dist/core/index.browser.js +1 -1
  71. package/dist/core/index.browser.js.map +1 -1
  72. package/dist/core/index.d.ts +119 -118
  73. package/dist/core/index.d.ts.map +1 -1
  74. package/dist/core/index.js +1 -1
  75. package/dist/core/index.js.map +1 -1
  76. package/dist/core/index.native.js +1 -1
  77. package/dist/core/index.native.js.map +1 -1
  78. package/dist/core/index.workerd.js +1 -1
  79. package/dist/core/index.workerd.js.map +1 -1
  80. package/dist/crypto/index.d.ts +3 -2
  81. package/dist/crypto/index.d.ts.map +1 -1
  82. package/dist/email/core/index.d.ts +3 -2
  83. package/dist/email/core/index.d.ts.map +1 -1
  84. package/dist/email/smtp/index.d.ts +7 -6
  85. package/dist/email/smtp/index.d.ts.map +1 -1
  86. package/dist/lock/core/index.d.ts +5 -4
  87. package/dist/lock/core/index.d.ts.map +1 -1
  88. package/dist/logger/index.d.ts +10 -9
  89. package/dist/logger/index.d.ts.map +1 -1
  90. package/dist/mcp/index.d.ts +9 -8
  91. package/dist/mcp/index.d.ts.map +1 -1
  92. package/dist/mcp/index.js +1 -1
  93. package/dist/mcp/index.js.map +1 -1
  94. package/dist/orm/core/index.browser.js +9 -3
  95. package/dist/orm/core/index.browser.js.map +1 -1
  96. package/dist/orm/core/index.bun.js +31 -10
  97. package/dist/orm/core/index.bun.js.map +1 -1
  98. package/dist/orm/core/index.d.ts +33 -14
  99. package/dist/orm/core/index.d.ts.map +1 -1
  100. package/dist/orm/core/index.js +31 -10
  101. package/dist/orm/core/index.js.map +1 -1
  102. package/dist/orm/postgres/index.d.ts +6 -5
  103. package/dist/orm/postgres/index.d.ts.map +1 -1
  104. package/dist/queue/core/index.d.ts +5 -4
  105. package/dist/queue/core/index.d.ts.map +1 -1
  106. package/dist/queue/redis/index.d.ts +3 -2
  107. package/dist/queue/redis/index.d.ts.map +1 -1
  108. package/dist/react/form/index.d.ts +5 -0
  109. package/dist/react/form/index.d.ts.map +1 -1
  110. package/dist/react/form/index.js +6 -4
  111. package/dist/react/form/index.js.map +1 -1
  112. package/dist/react/i18n/index.d.ts +2 -1
  113. package/dist/react/i18n/index.d.ts.map +1 -1
  114. package/dist/react/router/index.d.ts +206 -205
  115. package/dist/react/router/index.d.ts.map +1 -1
  116. package/dist/react/ui/index.d.ts +11 -11
  117. package/dist/react/ui/index.d.ts.map +1 -1
  118. package/dist/scheduler/index.d.ts +3 -2
  119. package/dist/scheduler/index.d.ts.map +1 -1
  120. package/dist/security/index.browser.js +29 -1
  121. package/dist/security/index.browser.js.map +1 -1
  122. package/dist/security/index.d.ts +82 -35
  123. package/dist/security/index.d.ts.map +1 -1
  124. package/dist/security/index.js +56 -3
  125. package/dist/security/index.js.map +1 -1
  126. package/dist/server/auth/index.d.ts +163 -158
  127. package/dist/server/auth/index.d.ts.map +1 -1
  128. package/dist/server/auth/index.js +16 -4
  129. package/dist/server/auth/index.js.map +1 -1
  130. package/dist/server/core/index.d.ts +35 -34
  131. package/dist/server/core/index.d.ts.map +1 -1
  132. package/dist/server/cors/index.d.ts +7 -6
  133. package/dist/server/cors/index.d.ts.map +1 -1
  134. package/dist/server/health/index.d.ts +16 -15
  135. package/dist/server/health/index.d.ts.map +1 -1
  136. package/dist/server/links/index.d.ts +51 -50
  137. package/dist/server/links/index.d.ts.map +1 -1
  138. package/dist/server/rate-limit/index.d.ts +6 -5
  139. package/dist/server/rate-limit/index.d.ts.map +1 -1
  140. package/dist/server/swagger/index.d.ts +2 -1
  141. package/dist/server/swagger/index.d.ts.map +1 -1
  142. package/dist/topic/redis/index.d.ts +3 -2
  143. package/dist/topic/redis/index.d.ts.map +1 -1
  144. package/package.json +16 -32
  145. package/src/api/audits/entities/audits.ts +1 -0
  146. package/src/api/files/entities/files.ts +1 -0
  147. package/src/api/jobs/__tests__/$job.spec.ts +92 -40
  148. package/src/api/jobs/entities/jobExecutionEntity.ts +1 -0
  149. package/src/api/jobs/providers/JobProvider.ts +20 -5
  150. package/src/api/jobs/schemas/jobConfigAtom.ts +5 -0
  151. package/src/api/keys/entities/apiKeyEntity.ts +1 -0
  152. package/src/api/payments/controllers/MockCheckoutController.ts +146 -0
  153. package/src/api/payments/index.ts +3 -0
  154. package/src/api/payments/providers/MemoryPaymentProvider.ts +9 -4
  155. package/src/api/payments/providers/PaymentProvider.ts +25 -9
  156. package/src/api/payments/services/PaymentService.ts +3 -0
  157. package/src/api/subscriptions/__tests__/BillingService.spec.ts +218 -0
  158. package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +278 -0
  159. package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +212 -0
  160. package/src/api/subscriptions/controllers/SubscriptionController.ts +189 -0
  161. package/src/api/subscriptions/entities/subscriptionEvents.ts +54 -0
  162. package/src/api/subscriptions/entities/subscriptions.ts +68 -0
  163. package/src/api/subscriptions/index.ts +133 -0
  164. package/src/api/subscriptions/jobs/SubscriptionJobs.ts +382 -0
  165. package/src/api/subscriptions/middleware/$requireLimit.ts +50 -0
  166. package/src/api/subscriptions/middleware/$requirePlan.ts +49 -0
  167. package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +110 -0
  168. package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +8 -0
  169. package/src/api/subscriptions/schemas/changePlanSchema.ts +9 -0
  170. package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +11 -0
  171. package/src/api/subscriptions/schemas/entitlementsSchema.ts +21 -0
  172. package/src/api/subscriptions/schemas/mrrSchema.ts +13 -0
  173. package/src/api/subscriptions/schemas/planDefinitionSchema.ts +71 -0
  174. package/src/api/subscriptions/schemas/planResourceSchema.ts +25 -0
  175. package/src/api/subscriptions/schemas/subscriptionEventResourceSchema.ts +8 -0
  176. package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +19 -0
  177. package/src/api/subscriptions/schemas/subscriptionResourceSchema.ts +6 -0
  178. package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +32 -0
  179. package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +23 -0
  180. package/src/api/subscriptions/services/BillingService.ts +437 -0
  181. package/src/api/subscriptions/services/SubscriptionConfig.ts +56 -0
  182. package/src/api/subscriptions/services/SubscriptionService.ts +867 -0
  183. package/src/api/subscriptions/services/UsageService.ts +118 -0
  184. package/src/cache/core/__tests__/$cache.memory.spec.ts +450 -0
  185. package/src/cache/core/__tests__/$cache.swr.spec.ts +394 -0
  186. package/src/cache/core/index.ts +16 -0
  187. package/src/cache/core/primitives/$cache.ts +347 -21
  188. package/src/cli/core/tasks/BuildCloudflareTask.ts +16 -0
  189. package/src/cli/core/templates/agentMd.ts +39 -4
  190. package/src/cli/core/templates/biomeJson.ts +25 -1
  191. package/src/cli/core/templates/saasAdminLayoutTsx.ts +2 -2
  192. package/src/cli/platform/__tests__/CloudflareAdapter.spec.ts +117 -0
  193. package/src/cli/platform/adapters/CloudflareAdapter.ts +104 -7
  194. package/src/cli/platform/atoms/platformOptions.ts +13 -0
  195. package/src/cli/platform/schemas/platform.ts +1 -0
  196. package/src/cli/platform/services/CloudflareApi.ts +61 -0
  197. package/src/cli/platform/services/PlatformOrchestrator.ts +9 -4
  198. package/src/core/__tests__/$module.spec.ts +2 -2
  199. package/src/core/primitives/$module.ts +4 -4
  200. package/src/mcp/providers/McpServerProvider.ts +1 -1
  201. package/src/orm/core/providers/DatabaseTypeProvider.ts +9 -3
  202. package/src/orm/core/providers/drivers/DatabaseProvider.ts +1 -1
  203. package/src/orm/core/schemas/insertSchema.ts +10 -2
  204. package/src/orm/core/services/Repository.ts +27 -7
  205. package/src/react/form/hooks/useFormState.ts +8 -1
  206. package/src/react/form/index.ts +10 -1
  207. package/src/react/form/services/FormModel.ts +9 -3
  208. package/src/security/atoms/currentTenantAtom.ts +34 -0
  209. package/src/security/index.browser.ts +1 -0
  210. package/src/security/index.ts +12 -1
  211. package/src/security/primitives/$issuer.ts +17 -1
  212. package/src/security/providers/SecurityProvider.ts +37 -0
  213. package/src/server/auth/__tests__/validateRedirectUri.spec.ts +78 -0
  214. package/src/server/auth/providers/ServerAuthProvider.ts +21 -5
  215. package/tsconfig.base.json +2 -1
  216. package/dist/react/websocket/index.d.ts +0 -117
  217. package/dist/react/websocket/index.d.ts.map +0 -1
  218. package/dist/react/websocket/index.js +0 -108
  219. package/dist/react/websocket/index.js.map +0 -1
  220. package/dist/websocket/index.browser.js +0 -848
  221. package/dist/websocket/index.browser.js.map +0 -1
  222. package/dist/websocket/index.d.ts +0 -876
  223. package/dist/websocket/index.d.ts.map +0 -1
  224. package/dist/websocket/index.js +0 -1185
  225. package/dist/websocket/index.js.map +0 -1
  226. package/src/react/websocket/hooks/useRoom.tsx +0 -251
  227. package/src/react/websocket/index.ts +0 -7
  228. package/src/websocket/__tests__/$channel.spec.ts +0 -30
  229. package/src/websocket/__tests__/$websocket-new.spec.ts +0 -195
  230. package/src/websocket/__tests__/RoomManager.spec.ts +0 -146
  231. package/src/websocket/__tests__/websocket-integration.spec.ts +0 -951
  232. package/src/websocket/errors/WebSocketError.ts +0 -34
  233. package/src/websocket/index.browser.ts +0 -25
  234. package/src/websocket/index.shared.ts +0 -8
  235. package/src/websocket/index.ts +0 -85
  236. package/src/websocket/interfaces/WebSocketInterfaces.ts +0 -252
  237. package/src/websocket/primitives/$channel.ts +0 -131
  238. package/src/websocket/primitives/$websocket.ts +0 -107
  239. package/src/websocket/providers/NodeWebSocketServerProvider.ts +0 -617
  240. package/src/websocket/providers/WebSocketServerProvider.ts +0 -56
  241. package/src/websocket/services/RoomManager.ts +0 -160
  242. package/src/websocket/services/WebSocketClient.ts +0 -642
  243. package/src/websocket/services/WebSocketTopicService.ts +0 -108
@@ -8,6 +8,7 @@ import * as _$alepha_logger0 from "alepha/logger";
8
8
  import { LogEntry } from "alepha/logger";
9
9
  import * as _$alepha_orm0 from "alepha/orm";
10
10
  import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
11
+ import * as _$typebox from "typebox";
11
12
  import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
12
13
  import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
13
14
  //#region ../../src/orm/core/schemas/insertSchema.d.ts
@@ -24,6 +25,8 @@ type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"] as
24
25
  [PG_GENERATED]: any;
25
26
  } ? never : K]: T["properties"][K] extends {
26
27
  [PG_DEFAULT]: any;
28
+ } | {
29
+ [PG_ORGANIZATION]: any;
27
30
  } | {
28
31
  "~optional": true;
29
32
  } ? TOptional<T["properties"][K]> : T["properties"][K] }>;
@@ -299,8 +302,8 @@ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]:
299
302
  * - `d1://BINDING_NAME` — Cloudflare D1
300
303
  * - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
301
304
  */
302
- declare const databaseEnvSchema: _$alepha.TObject<{
303
- DATABASE_URL: _$alepha.TOptional<_$alepha.TString>;
305
+ declare const databaseEnvSchema: _$typebox.TObject<{
306
+ DATABASE_URL: _$typebox.TOptional<_$typebox.TString>;
304
307
  /**
305
308
  * Enable or disable push-based schema synchronization (drizzle-kit push).
306
309
  *
@@ -308,7 +311,7 @@ declare const databaseEnvSchema: _$alepha.TObject<{
308
311
  * Set to `false` in development to skip automatic schema sync
309
312
  * (e.g. when managing migrations manually).
310
313
  */
311
- DATABASE_SYNC: _$alepha.TOptional<_$alepha.TBoolean>;
314
+ DATABASE_SYNC: _$typebox.TOptional<_$typebox.TBoolean>;
312
315
  }>;
313
316
  declare module "alepha" {
314
317
  interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
@@ -332,35 +335,35 @@ declare module "alepha" {
332
335
  * - sweep picks due ones → pending
333
336
  * - cancel → cancelled
334
337
  */
335
- declare const jobExecutionEntity: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
336
- id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
337
- createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
338
- updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
339
- jobName: _$alepha.TString;
340
- key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
341
- status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
342
- priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
343
- attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
344
- maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
345
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
346
- scheduledAt: _$alepha.TOptional<_$alepha.TString>;
347
- startedAt: _$alepha.TOptional<_$alepha.TString>;
348
- completedAt: _$alepha.TOptional<_$alepha.TString>;
349
- error: _$alepha.TOptional<_$alepha.TString>;
350
- logs: _$alepha.TOptional<_$alepha.TArray<_$alepha.TObject<{
351
- level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
352
- message: _$alepha.TString;
353
- service: _$alepha.TString;
354
- module: _$alepha.TString;
355
- context: _$alepha.TOptional<_$alepha.TString>;
356
- app: _$alepha.TOptional<_$alepha.TString>;
357
- data: _$alepha.TOptional<_$alepha.TAny>;
358
- timestamp: _$alepha.TNumber;
338
+ declare const jobExecutionEntity: _$alepha_orm0.EntityPrimitive<_$typebox.TObject<{
339
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
340
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
341
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
342
+ jobName: _$typebox.TString;
343
+ key: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TNull, _$typebox.TString]>>;
344
+ status: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
345
+ priority: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
346
+ attempt: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
347
+ maxAttempts: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
348
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
349
+ scheduledAt: _$typebox.TOptional<_$typebox.TString>;
350
+ startedAt: _$typebox.TOptional<_$typebox.TString>;
351
+ completedAt: _$typebox.TOptional<_$typebox.TString>;
352
+ error: _$typebox.TOptional<_$typebox.TString>;
353
+ logs: _$typebox.TOptional<_$typebox.TArray<_$typebox.TObject<{
354
+ level: _$typebox.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
355
+ message: _$typebox.TString;
356
+ service: _$typebox.TString;
357
+ module: _$typebox.TString;
358
+ context: _$typebox.TOptional<_$typebox.TString>;
359
+ app: _$typebox.TOptional<_$typebox.TString>;
360
+ data: _$typebox.TOptional<_$typebox.TAny>;
361
+ timestamp: _$typebox.TNumber;
359
362
  }>>>;
360
- triggeredBy: _$alepha.TOptional<_$alepha.TString>;
361
- triggeredByName: _$alepha.TOptional<_$alepha.TString>;
362
- cancelledBy: _$alepha.TOptional<_$alepha.TString>;
363
- cancelledByName: _$alepha.TOptional<_$alepha.TString>;
363
+ triggeredBy: _$typebox.TOptional<_$typebox.TString>;
364
+ triggeredByName: _$typebox.TOptional<_$typebox.TString>;
365
+ cancelledBy: _$typebox.TOptional<_$typebox.TString>;
366
+ cancelledByName: _$typebox.TOptional<_$typebox.TString>;
364
367
  }>>;
365
368
  type JobExecutionEntity = Static<typeof jobExecutionEntity.schema>;
366
369
  type JobStatus = "pending" | "running" | "scheduled" | "ok" | "error" | "cancelled";
@@ -610,7 +613,11 @@ type JobEffectiveMode = "cron" | "queue" | "direct";
610
613
  * - re-enqueue pending rows older than `staleThreshold`
611
614
  * - mark crashed running rows as failed and apply retry policy
612
615
  * - move `scheduled` rows with `scheduledAt <= now` to pending + dispatch
613
- * - trim per-job history beyond `keepLastSuccess` / `keepLastError`
616
+ *
617
+ * Trim runs on its own cron (`trimCron`, default hourly):
618
+ * - per-job history trimmed beyond `keepLastSuccess` / `keepLastError`
619
+ * - decoupled from sweep because trim cost scales with job count, not
620
+ * retry latency — running it every sweep is wasted work for most apps.
614
621
  */
615
622
  declare class JobProvider {
616
623
  protected readonly alepha: Alepha;
@@ -619,6 +626,7 @@ declare class JobProvider {
619
626
  protected readonly lockProvider: LockProvider;
620
627
  protected readonly config: Readonly<{
621
628
  sweepCron: string;
629
+ trimCron: string;
622
630
  staleThreshold: number;
623
631
  runTimeout: number;
624
632
  keepLastSuccess: number;
@@ -636,35 +644,35 @@ declare class JobProvider {
636
644
  protected dispatcherRef?: JobDispatcher;
637
645
  get dispatcher(): JobDispatcher;
638
646
  protected readonly log: _$alepha_logger0.Logger;
639
- protected readonly executions: _$alepha_orm0.Repository<_$alepha.TObject<{
640
- id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
641
- createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
642
- updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
643
- jobName: _$alepha.TString;
644
- key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
645
- status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
646
- priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
647
- attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
648
- maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
649
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
650
- scheduledAt: _$alepha.TOptional<_$alepha.TString>;
651
- startedAt: _$alepha.TOptional<_$alepha.TString>;
652
- completedAt: _$alepha.TOptional<_$alepha.TString>;
653
- error: _$alepha.TOptional<_$alepha.TString>;
654
- logs: _$alepha.TOptional<_$alepha.TArray<_$alepha.TObject<{
655
- level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
656
- message: _$alepha.TString;
657
- service: _$alepha.TString;
658
- module: _$alepha.TString;
659
- context: _$alepha.TOptional<_$alepha.TString>;
660
- app: _$alepha.TOptional<_$alepha.TString>;
661
- data: _$alepha.TOptional<_$alepha.TAny>;
662
- timestamp: _$alepha.TNumber;
647
+ protected readonly executions: _$alepha_orm0.Repository<_$typebox.TObject<{
648
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
649
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
650
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
651
+ jobName: _$typebox.TString;
652
+ key: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TNull, _$typebox.TString]>>;
653
+ status: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
654
+ priority: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
655
+ attempt: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
656
+ maxAttempts: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
657
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
658
+ scheduledAt: _$typebox.TOptional<_$typebox.TString>;
659
+ startedAt: _$typebox.TOptional<_$typebox.TString>;
660
+ completedAt: _$typebox.TOptional<_$typebox.TString>;
661
+ error: _$typebox.TOptional<_$typebox.TString>;
662
+ logs: _$typebox.TOptional<_$typebox.TArray<_$typebox.TObject<{
663
+ level: _$typebox.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
664
+ message: _$typebox.TString;
665
+ service: _$typebox.TString;
666
+ module: _$typebox.TString;
667
+ context: _$typebox.TOptional<_$typebox.TString>;
668
+ app: _$typebox.TOptional<_$typebox.TString>;
669
+ data: _$typebox.TOptional<_$typebox.TAny>;
670
+ timestamp: _$typebox.TNumber;
663
671
  }>>>;
664
- triggeredBy: _$alepha.TOptional<_$alepha.TString>;
665
- triggeredByName: _$alepha.TOptional<_$alepha.TString>;
666
- cancelledBy: _$alepha.TOptional<_$alepha.TString>;
667
- cancelledByName: _$alepha.TOptional<_$alepha.TString>;
672
+ triggeredBy: _$typebox.TOptional<_$typebox.TString>;
673
+ triggeredByName: _$typebox.TOptional<_$typebox.TString>;
674
+ cancelledBy: _$typebox.TOptional<_$typebox.TString>;
675
+ cancelledByName: _$typebox.TOptional<_$typebox.TString>;
668
676
  }>>;
669
677
  protected readonly jobs: Map<string, JobRuntimeRegistration>;
670
678
  protected readonly inFlight: Set<Promise<void>>;
@@ -803,8 +811,8 @@ declare class JobProvider {
803
811
  * path is 2 queries instead of 3.
804
812
  */
805
813
  protected claim(executionId: string): Promise<{
806
- error?: string | undefined;
807
814
  key?: string | null | undefined;
815
+ error?: string | undefined;
808
816
  payload?: Record<string, any> | undefined;
809
817
  scheduledAt?: string | undefined;
810
818
  startedAt?: string | undefined;
@@ -823,12 +831,12 @@ declare class JobProvider {
823
831
  triggeredByName?: string | undefined;
824
832
  cancelledBy?: string | undefined;
825
833
  cancelledByName?: string | undefined;
826
- priority: number;
827
- status: "ok" | "error" | "pending" | "running" | "scheduled" | "cancelled";
834
+ jobName: string;
828
835
  id: string;
829
836
  createdAt: string;
830
837
  updatedAt: string;
831
- jobName: string;
838
+ status: "pending" | "running" | "scheduled" | "ok" | "error" | "cancelled";
839
+ priority: number;
832
840
  attempt: number;
833
841
  maxAttempts: number;
834
842
  } | null>;
@@ -850,9 +858,9 @@ declare class JobProvider {
850
858
  }
851
859
  //#endregion
852
860
  //#region ../../src/api/jobs/schemas/jobExecutionQuerySchema.d.ts
853
- declare const jobExecutionQuerySchema: _$alepha.TObject<{
854
- status: _$alepha.TOptional<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">>;
855
- limit: _$alepha.TOptional<_$alepha.TInteger>;
861
+ declare const jobExecutionQuerySchema: _$typebox.TObject<{
862
+ status: _$typebox.TOptional<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">>;
863
+ limit: _$typebox.TOptional<_$typebox.TInteger>;
856
864
  }>;
857
865
  type JobExecutionQuery = Static<typeof jobExecutionQuerySchema>;
858
866
  //#endregion
@@ -867,57 +875,57 @@ type JobExecutionQuery = Static<typeof jobExecutionQuerySchema>;
867
875
  * `JobService` is responsible for the int → string transform.
868
876
  * - `can` derives the available admin actions from the row's status.
869
877
  */
870
- declare const jobExecutionResourceSchema: _$alepha.TObject<{
871
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
872
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
873
- updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
874
- jobName: _$alepha.TString;
875
- key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
876
- status: PgAttr<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">, typeof PG_DEFAULT>;
877
- priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
878
- attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
879
- maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
880
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
881
- scheduledAt: _$alepha.TOptional<_$alepha.TString>;
882
- startedAt: _$alepha.TOptional<_$alepha.TString>;
883
- completedAt: _$alepha.TOptional<_$alepha.TString>;
884
- error: _$alepha.TOptional<_$alepha.TString>;
885
- logs: _$alepha.TOptional<_$alepha.TArray<_$alepha.TObject<{
886
- level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
887
- message: _$alepha.TString;
888
- service: _$alepha.TString;
889
- module: _$alepha.TString;
890
- context: _$alepha.TOptional<_$alepha.TString>;
891
- app: _$alepha.TOptional<_$alepha.TString>;
892
- data: _$alepha.TOptional<_$alepha.TAny>;
893
- timestamp: _$alepha.TNumber;
878
+ declare const jobExecutionResourceSchema: _$typebox.TObject<{
879
+ id: PgAttr<PgAttr<_$typebox.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
880
+ createdAt: PgAttr<PgAttr<_$typebox.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
881
+ updatedAt: PgAttr<PgAttr<_$typebox.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
882
+ jobName: _$typebox.TString;
883
+ key: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TNull, _$typebox.TString]>>;
884
+ status: PgAttr<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">, typeof PG_DEFAULT>;
885
+ priority: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
886
+ attempt: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
887
+ maxAttempts: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
888
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
889
+ scheduledAt: _$typebox.TOptional<_$typebox.TString>;
890
+ startedAt: _$typebox.TOptional<_$typebox.TString>;
891
+ completedAt: _$typebox.TOptional<_$typebox.TString>;
892
+ error: _$typebox.TOptional<_$typebox.TString>;
893
+ logs: _$typebox.TOptional<_$typebox.TArray<_$typebox.TObject<{
894
+ level: _$typebox.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
895
+ message: _$typebox.TString;
896
+ service: _$typebox.TString;
897
+ module: _$typebox.TString;
898
+ context: _$typebox.TOptional<_$typebox.TString>;
899
+ app: _$typebox.TOptional<_$typebox.TString>;
900
+ data: _$typebox.TOptional<_$typebox.TAny>;
901
+ timestamp: _$typebox.TNumber;
894
902
  }>>>;
895
- triggeredBy: _$alepha.TOptional<_$alepha.TString>;
896
- triggeredByName: _$alepha.TOptional<_$alepha.TString>;
897
- cancelledBy: _$alepha.TOptional<_$alepha.TString>;
898
- cancelledByName: _$alepha.TOptional<_$alepha.TString>;
899
- can: _$alepha.TObject<{
900
- retry: _$alepha.TBoolean;
901
- cancel: _$alepha.TBoolean;
903
+ triggeredBy: _$typebox.TOptional<_$typebox.TString>;
904
+ triggeredByName: _$typebox.TOptional<_$typebox.TString>;
905
+ cancelledBy: _$typebox.TOptional<_$typebox.TString>;
906
+ cancelledByName: _$typebox.TOptional<_$typebox.TString>;
907
+ can: _$typebox.TObject<{
908
+ retry: _$typebox.TBoolean;
909
+ cancel: _$typebox.TBoolean;
902
910
  }>;
903
911
  }>;
904
912
  type JobExecutionResource = Static<typeof jobExecutionResourceSchema>;
905
913
  //#endregion
906
914
  //#region ../../src/api/jobs/schemas/jobRegistrationSchema.d.ts
907
- declare const jobRegistrationSchema: _$alepha.TObject<{
908
- name: _$alepha.TString;
909
- description: _$alepha.TOptional<_$alepha.TString>;
910
- type: _$alepha.TUnsafe<"cron" | "queue" | "direct">;
911
- priority: _$alepha.TUnsafe<"critical" | "high" | "normal" | "low">;
912
- cron: _$alepha.TOptional<_$alepha.TString>;
913
- timeout: _$alepha.TOptional<_$alepha.TString>;
914
- retry: _$alepha.TOptional<_$alepha.TObject<{
915
- retries: _$alepha.TInteger;
915
+ declare const jobRegistrationSchema: _$typebox.TObject<{
916
+ name: _$typebox.TString;
917
+ description: _$typebox.TOptional<_$typebox.TString>;
918
+ type: _$typebox.TUnsafe<"queue" | "direct" | "cron">;
919
+ priority: _$typebox.TUnsafe<"critical" | "high" | "normal" | "low">;
920
+ cron: _$typebox.TOptional<_$typebox.TString>;
921
+ timeout: _$typebox.TOptional<_$typebox.TString>;
922
+ retry: _$typebox.TOptional<_$typebox.TObject<{
923
+ retries: _$typebox.TInteger;
916
924
  }>>;
917
- recent: _$alepha.TObject<{
918
- ok: _$alepha.TInteger;
919
- error: _$alepha.TInteger;
920
- lastRun: _$alepha.TOptional<_$alepha.TString>;
925
+ recent: _$typebox.TObject<{
926
+ ok: _$typebox.TInteger;
927
+ error: _$typebox.TInteger;
928
+ lastRun: _$typebox.TOptional<_$typebox.TString>;
921
929
  }>;
922
930
  }>;
923
931
  type JobRegistration = Static<typeof jobRegistrationSchema>;
@@ -935,35 +943,35 @@ declare class JobService {
935
943
  protected readonly alepha: Alepha;
936
944
  protected readonly log: _$alepha_logger0.Logger;
937
945
  protected readonly jobProvider: JobProvider;
938
- protected readonly executions: _$alepha_orm0.Repository<_$alepha.TObject<{
939
- id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
940
- createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
941
- updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
942
- jobName: _$alepha.TString;
943
- key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
944
- status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
945
- priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
946
- attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
947
- maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
948
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
949
- scheduledAt: _$alepha.TOptional<_$alepha.TString>;
950
- startedAt: _$alepha.TOptional<_$alepha.TString>;
951
- completedAt: _$alepha.TOptional<_$alepha.TString>;
952
- error: _$alepha.TOptional<_$alepha.TString>;
953
- logs: _$alepha.TOptional<_$alepha.TArray<_$alepha.TObject<{
954
- level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
955
- message: _$alepha.TString;
956
- service: _$alepha.TString;
957
- module: _$alepha.TString;
958
- context: _$alepha.TOptional<_$alepha.TString>;
959
- app: _$alepha.TOptional<_$alepha.TString>;
960
- data: _$alepha.TOptional<_$alepha.TAny>;
961
- timestamp: _$alepha.TNumber;
946
+ protected readonly executions: _$alepha_orm0.Repository<_$typebox.TObject<{
947
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
948
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
949
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
950
+ jobName: _$typebox.TString;
951
+ key: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TNull, _$typebox.TString]>>;
952
+ status: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
953
+ priority: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
954
+ attempt: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
955
+ maxAttempts: _$alepha_orm0.PgAttr<_$typebox.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
956
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
957
+ scheduledAt: _$typebox.TOptional<_$typebox.TString>;
958
+ startedAt: _$typebox.TOptional<_$typebox.TString>;
959
+ completedAt: _$typebox.TOptional<_$typebox.TString>;
960
+ error: _$typebox.TOptional<_$typebox.TString>;
961
+ logs: _$typebox.TOptional<_$typebox.TArray<_$typebox.TObject<{
962
+ level: _$typebox.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
963
+ message: _$typebox.TString;
964
+ service: _$typebox.TString;
965
+ module: _$typebox.TString;
966
+ context: _$typebox.TOptional<_$typebox.TString>;
967
+ app: _$typebox.TOptional<_$typebox.TString>;
968
+ data: _$typebox.TOptional<_$typebox.TAny>;
969
+ timestamp: _$typebox.TNumber;
962
970
  }>>>;
963
- triggeredBy: _$alepha.TOptional<_$alepha.TString>;
964
- triggeredByName: _$alepha.TOptional<_$alepha.TString>;
965
- cancelledBy: _$alepha.TOptional<_$alepha.TString>;
966
- cancelledByName: _$alepha.TOptional<_$alepha.TString>;
971
+ triggeredBy: _$typebox.TOptional<_$typebox.TString>;
972
+ triggeredByName: _$typebox.TOptional<_$typebox.TString>;
973
+ cancelledBy: _$typebox.TOptional<_$typebox.TString>;
974
+ cancelledByName: _$typebox.TOptional<_$typebox.TString>;
967
975
  }>>;
968
976
  protected computeCan(status: string): {
969
977
  retry: boolean;
@@ -988,8 +996,8 @@ declare class JobService {
988
996
  * Recent executions for a single job, ORDER BY startedAt DESC.
989
997
  */
990
998
  getExecutions(jobName: string, query?: JobExecutionQuery): Promise<{
991
- error?: string | undefined;
992
999
  key?: string | null | undefined;
1000
+ error?: string | undefined;
993
1001
  payload?: Record<string, any> | undefined;
994
1002
  scheduledAt?: string | undefined;
995
1003
  startedAt?: string | undefined;
@@ -1008,12 +1016,12 @@ declare class JobService {
1008
1016
  triggeredByName?: string | undefined;
1009
1017
  cancelledBy?: string | undefined;
1010
1018
  cancelledByName?: string | undefined;
1011
- priority: number;
1012
- status: "ok" | "error" | "pending" | "running" | "scheduled" | "cancelled";
1019
+ jobName: string;
1013
1020
  id: string;
1014
1021
  createdAt: string;
1015
1022
  updatedAt: string;
1016
- jobName: string;
1023
+ status: "pending" | "running" | "scheduled" | "ok" | "error" | "cancelled";
1024
+ priority: number;
1017
1025
  attempt: number;
1018
1026
  maxAttempts: number;
1019
1027
  can: {
@@ -1025,8 +1033,8 @@ declare class JobService {
1025
1033
  * Full execution detail (includes captured logs).
1026
1034
  */
1027
1035
  getExecution(id: string): Promise<{
1028
- error?: string | undefined;
1029
1036
  key?: string | null | undefined;
1037
+ error?: string | undefined;
1030
1038
  payload?: Record<string, any> | undefined;
1031
1039
  scheduledAt?: string | undefined;
1032
1040
  startedAt?: string | undefined;
@@ -1045,12 +1053,12 @@ declare class JobService {
1045
1053
  triggeredByName?: string | undefined;
1046
1054
  cancelledBy?: string | undefined;
1047
1055
  cancelledByName?: string | undefined;
1048
- priority: number;
1049
- status: "ok" | "error" | "pending" | "running" | "scheduled" | "cancelled";
1056
+ jobName: string;
1050
1057
  id: string;
1051
1058
  createdAt: string;
1052
1059
  updatedAt: string;
1053
- jobName: string;
1060
+ status: "pending" | "running" | "scheduled" | "ok" | "error" | "cancelled";
1061
+ priority: number;
1054
1062
  attempt: number;
1055
1063
  maxAttempts: number;
1056
1064
  can: {
@@ -1090,136 +1098,136 @@ declare class AdminJobController {
1090
1098
  protected readonly group: string;
1091
1099
  protected readonly jobService: JobService;
1092
1100
  readonly listJobs: _$alepha_server0.ActionPrimitiveFn<{
1093
- response: _$alepha.TArray<_$alepha.TObject<{
1094
- name: _$alepha.TString;
1095
- description: _$alepha.TOptional<_$alepha.TString>;
1096
- type: _$alepha.TUnsafe<"cron" | "queue" | "direct">;
1097
- priority: _$alepha.TUnsafe<"critical" | "high" | "normal" | "low">;
1098
- cron: _$alepha.TOptional<_$alepha.TString>;
1099
- timeout: _$alepha.TOptional<_$alepha.TString>;
1100
- retry: _$alepha.TOptional<_$alepha.TObject<{
1101
- retries: _$alepha.TInteger;
1101
+ response: _$typebox.TArray<_$typebox.TObject<{
1102
+ name: _$typebox.TString;
1103
+ description: _$typebox.TOptional<_$typebox.TString>;
1104
+ type: _$typebox.TUnsafe<"queue" | "direct" | "cron">;
1105
+ priority: _$typebox.TUnsafe<"critical" | "high" | "normal" | "low">;
1106
+ cron: _$typebox.TOptional<_$typebox.TString>;
1107
+ timeout: _$typebox.TOptional<_$typebox.TString>;
1108
+ retry: _$typebox.TOptional<_$typebox.TObject<{
1109
+ retries: _$typebox.TInteger;
1102
1110
  }>>;
1103
- recent: _$alepha.TObject<{
1104
- ok: _$alepha.TInteger;
1105
- error: _$alepha.TInteger;
1106
- lastRun: _$alepha.TOptional<_$alepha.TString>;
1111
+ recent: _$typebox.TObject<{
1112
+ ok: _$typebox.TInteger;
1113
+ error: _$typebox.TInteger;
1114
+ lastRun: _$typebox.TOptional<_$typebox.TString>;
1107
1115
  }>;
1108
1116
  }>>;
1109
1117
  }>;
1110
1118
  readonly listExecutions: _$alepha_server0.ActionPrimitiveFn<{
1111
- params: _$alepha.TObject<{
1112
- name: _$alepha.TString;
1119
+ params: _$typebox.TObject<{
1120
+ name: _$typebox.TString;
1113
1121
  }>;
1114
- query: _$alepha.TObject<{
1115
- status: _$alepha.TOptional<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">>;
1116
- limit: _$alepha.TOptional<_$alepha.TInteger>;
1122
+ query: _$typebox.TObject<{
1123
+ status: _$typebox.TOptional<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">>;
1124
+ limit: _$typebox.TOptional<_$typebox.TInteger>;
1117
1125
  }>;
1118
- response: _$alepha.TArray<_$alepha.TObject<{
1119
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1120
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1121
- updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1122
- jobName: _$alepha.TString;
1123
- key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
1124
- status: PgAttr<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">, typeof PG_DEFAULT>;
1125
- priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1126
- attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1127
- maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1128
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1129
- scheduledAt: _$alepha.TOptional<_$alepha.TString>;
1130
- startedAt: _$alepha.TOptional<_$alepha.TString>;
1131
- completedAt: _$alepha.TOptional<_$alepha.TString>;
1132
- error: _$alepha.TOptional<_$alepha.TString>;
1133
- logs: _$alepha.TOptional<_$alepha.TArray<_$alepha.TObject<{
1134
- level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
1135
- message: _$alepha.TString;
1136
- service: _$alepha.TString;
1137
- module: _$alepha.TString;
1138
- context: _$alepha.TOptional<_$alepha.TString>;
1139
- app: _$alepha.TOptional<_$alepha.TString>;
1140
- data: _$alepha.TOptional<_$alepha.TAny>;
1141
- timestamp: _$alepha.TNumber;
1126
+ response: _$typebox.TArray<_$typebox.TObject<{
1127
+ id: PgAttr<PgAttr<_$typebox.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1128
+ createdAt: PgAttr<PgAttr<_$typebox.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1129
+ updatedAt: PgAttr<PgAttr<_$typebox.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1130
+ jobName: _$typebox.TString;
1131
+ key: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TNull, _$typebox.TString]>>;
1132
+ status: PgAttr<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">, typeof PG_DEFAULT>;
1133
+ priority: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
1134
+ attempt: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
1135
+ maxAttempts: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
1136
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
1137
+ scheduledAt: _$typebox.TOptional<_$typebox.TString>;
1138
+ startedAt: _$typebox.TOptional<_$typebox.TString>;
1139
+ completedAt: _$typebox.TOptional<_$typebox.TString>;
1140
+ error: _$typebox.TOptional<_$typebox.TString>;
1141
+ logs: _$typebox.TOptional<_$typebox.TArray<_$typebox.TObject<{
1142
+ level: _$typebox.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
1143
+ message: _$typebox.TString;
1144
+ service: _$typebox.TString;
1145
+ module: _$typebox.TString;
1146
+ context: _$typebox.TOptional<_$typebox.TString>;
1147
+ app: _$typebox.TOptional<_$typebox.TString>;
1148
+ data: _$typebox.TOptional<_$typebox.TAny>;
1149
+ timestamp: _$typebox.TNumber;
1142
1150
  }>>>;
1143
- triggeredBy: _$alepha.TOptional<_$alepha.TString>;
1144
- triggeredByName: _$alepha.TOptional<_$alepha.TString>;
1145
- cancelledBy: _$alepha.TOptional<_$alepha.TString>;
1146
- cancelledByName: _$alepha.TOptional<_$alepha.TString>;
1147
- can: _$alepha.TObject<{
1148
- retry: _$alepha.TBoolean;
1149
- cancel: _$alepha.TBoolean;
1151
+ triggeredBy: _$typebox.TOptional<_$typebox.TString>;
1152
+ triggeredByName: _$typebox.TOptional<_$typebox.TString>;
1153
+ cancelledBy: _$typebox.TOptional<_$typebox.TString>;
1154
+ cancelledByName: _$typebox.TOptional<_$typebox.TString>;
1155
+ can: _$typebox.TObject<{
1156
+ retry: _$typebox.TBoolean;
1157
+ cancel: _$typebox.TBoolean;
1150
1158
  }>;
1151
1159
  }>>;
1152
1160
  }>;
1153
1161
  readonly getExecution: _$alepha_server0.ActionPrimitiveFn<{
1154
- params: _$alepha.TObject<{
1155
- id: _$alepha.TString;
1162
+ params: _$typebox.TObject<{
1163
+ id: _$typebox.TString;
1156
1164
  }>;
1157
- response: _$alepha.TObject<{
1158
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1159
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1160
- updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1161
- jobName: _$alepha.TString;
1162
- key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
1163
- status: PgAttr<_$alepha.TUnsafe<"ok" | "error" | "pending" | "running" | "scheduled" | "cancelled">, typeof PG_DEFAULT>;
1164
- priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1165
- attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1166
- maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1167
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1168
- scheduledAt: _$alepha.TOptional<_$alepha.TString>;
1169
- startedAt: _$alepha.TOptional<_$alepha.TString>;
1170
- completedAt: _$alepha.TOptional<_$alepha.TString>;
1171
- error: _$alepha.TOptional<_$alepha.TString>;
1172
- logs: _$alepha.TOptional<_$alepha.TArray<_$alepha.TObject<{
1173
- level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
1174
- message: _$alepha.TString;
1175
- service: _$alepha.TString;
1176
- module: _$alepha.TString;
1177
- context: _$alepha.TOptional<_$alepha.TString>;
1178
- app: _$alepha.TOptional<_$alepha.TString>;
1179
- data: _$alepha.TOptional<_$alepha.TAny>;
1180
- timestamp: _$alepha.TNumber;
1165
+ response: _$typebox.TObject<{
1166
+ id: PgAttr<PgAttr<_$typebox.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1167
+ createdAt: PgAttr<PgAttr<_$typebox.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1168
+ updatedAt: PgAttr<PgAttr<_$typebox.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1169
+ jobName: _$typebox.TString;
1170
+ key: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TNull, _$typebox.TString]>>;
1171
+ status: PgAttr<_$typebox.TUnsafe<"pending" | "running" | "scheduled" | "ok" | "error" | "cancelled">, typeof PG_DEFAULT>;
1172
+ priority: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
1173
+ attempt: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
1174
+ maxAttempts: PgAttr<_$typebox.TInteger, typeof PG_DEFAULT>;
1175
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
1176
+ scheduledAt: _$typebox.TOptional<_$typebox.TString>;
1177
+ startedAt: _$typebox.TOptional<_$typebox.TString>;
1178
+ completedAt: _$typebox.TOptional<_$typebox.TString>;
1179
+ error: _$typebox.TOptional<_$typebox.TString>;
1180
+ logs: _$typebox.TOptional<_$typebox.TArray<_$typebox.TObject<{
1181
+ level: _$typebox.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
1182
+ message: _$typebox.TString;
1183
+ service: _$typebox.TString;
1184
+ module: _$typebox.TString;
1185
+ context: _$typebox.TOptional<_$typebox.TString>;
1186
+ app: _$typebox.TOptional<_$typebox.TString>;
1187
+ data: _$typebox.TOptional<_$typebox.TAny>;
1188
+ timestamp: _$typebox.TNumber;
1181
1189
  }>>>;
1182
- triggeredBy: _$alepha.TOptional<_$alepha.TString>;
1183
- triggeredByName: _$alepha.TOptional<_$alepha.TString>;
1184
- cancelledBy: _$alepha.TOptional<_$alepha.TString>;
1185
- cancelledByName: _$alepha.TOptional<_$alepha.TString>;
1186
- can: _$alepha.TObject<{
1187
- retry: _$alepha.TBoolean;
1188
- cancel: _$alepha.TBoolean;
1190
+ triggeredBy: _$typebox.TOptional<_$typebox.TString>;
1191
+ triggeredByName: _$typebox.TOptional<_$typebox.TString>;
1192
+ cancelledBy: _$typebox.TOptional<_$typebox.TString>;
1193
+ cancelledByName: _$typebox.TOptional<_$typebox.TString>;
1194
+ can: _$typebox.TObject<{
1195
+ retry: _$typebox.TBoolean;
1196
+ cancel: _$typebox.TBoolean;
1189
1197
  }>;
1190
1198
  }>;
1191
1199
  }>;
1192
1200
  readonly triggerJob: _$alepha_server0.ActionPrimitiveFn<{
1193
- params: _$alepha.TObject<{
1194
- name: _$alepha.TString;
1201
+ params: _$typebox.TObject<{
1202
+ name: _$typebox.TString;
1195
1203
  }>;
1196
- body: _$alepha.TObject<{
1197
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1204
+ body: _$typebox.TObject<{
1205
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
1198
1206
  }>;
1199
- response: _$alepha.TObject<{
1200
- ok: _$alepha.TBoolean;
1201
- id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
1202
- count: _$alepha.TOptional<_$alepha.TNumber>;
1207
+ response: _$typebox.TObject<{
1208
+ ok: _$typebox.TBoolean;
1209
+ id: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TString, _$typebox.TInteger]>>;
1210
+ count: _$typebox.TOptional<_$typebox.TNumber>;
1203
1211
  }>;
1204
1212
  }>;
1205
1213
  readonly retryExecution: _$alepha_server0.ActionPrimitiveFn<{
1206
- params: _$alepha.TObject<{
1207
- id: _$alepha.TString;
1214
+ params: _$typebox.TObject<{
1215
+ id: _$typebox.TString;
1208
1216
  }>;
1209
- response: _$alepha.TObject<{
1210
- ok: _$alepha.TBoolean;
1211
- id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
1212
- count: _$alepha.TOptional<_$alepha.TNumber>;
1217
+ response: _$typebox.TObject<{
1218
+ ok: _$typebox.TBoolean;
1219
+ id: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TString, _$typebox.TInteger]>>;
1220
+ count: _$typebox.TOptional<_$typebox.TNumber>;
1213
1221
  }>;
1214
1222
  }>;
1215
1223
  readonly cancelExecution: _$alepha_server0.ActionPrimitiveFn<{
1216
- params: _$alepha.TObject<{
1217
- id: _$alepha.TString;
1224
+ params: _$typebox.TObject<{
1225
+ id: _$typebox.TString;
1218
1226
  }>;
1219
- response: _$alepha.TObject<{
1220
- ok: _$alepha.TBoolean;
1221
- id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
1222
- count: _$alepha.TOptional<_$alepha.TNumber>;
1227
+ response: _$typebox.TObject<{
1228
+ ok: _$typebox.TBoolean;
1229
+ id: _$typebox.TOptional<_$typebox.TUnion<[_$typebox.TString, _$typebox.TInteger]>>;
1230
+ count: _$typebox.TOptional<_$typebox.TNumber>;
1223
1231
  }>;
1224
1232
  }>;
1225
1233
  }
@@ -1270,9 +1278,9 @@ declare class JobQueueProvider extends JobDispatcher {
1270
1278
  protected readonly alepha: Alepha;
1271
1279
  protected jobProviderRef?: JobProvider;
1272
1280
  protected getJobProvider(): JobProvider;
1273
- protected readonly queue: _$alepha_queue0.QueuePrimitive<_$alepha.TObject<{
1274
- jobName: _$alepha.TString;
1275
- executionId: _$alepha.TString;
1281
+ protected readonly queue: _$alepha_queue0.QueuePrimitive<_$typebox.TObject<{
1282
+ jobName: _$typebox.TString;
1283
+ executionId: _$typebox.TString;
1276
1284
  }>>;
1277
1285
  dispatch(jobName: string, executionId: string): Promise<void>;
1278
1286
  /**
@@ -1293,14 +1301,15 @@ declare class JobQueueProvider extends JobDispatcher {
1293
1301
  }
1294
1302
  //#endregion
1295
1303
  //#region ../../src/api/jobs/schemas/jobConfigAtom.d.ts
1296
- declare const jobConfig: _$alepha.Atom<_$alepha.TObject<{
1297
- sweepCron: _$alepha.TString;
1298
- staleThreshold: _$alepha.TInteger;
1299
- runTimeout: _$alepha.TInteger;
1300
- keepLastSuccess: _$alepha.TInteger;
1301
- keepLastError: _$alepha.TInteger;
1302
- logMaxEntries: _$alepha.TInteger;
1303
- drainTimeout: _$alepha.TInteger;
1304
+ declare const jobConfig: _$alepha.Atom<_$typebox.TObject<{
1305
+ sweepCron: _$typebox.TString;
1306
+ trimCron: _$typebox.TString;
1307
+ staleThreshold: _$typebox.TInteger;
1308
+ runTimeout: _$typebox.TInteger;
1309
+ keepLastSuccess: _$typebox.TInteger;
1310
+ keepLastError: _$typebox.TInteger;
1311
+ logMaxEntries: _$typebox.TInteger;
1312
+ drainTimeout: _$typebox.TInteger;
1304
1313
  }>, "alepha.jobs">;
1305
1314
  type JobConfig = Static<typeof jobConfig.schema>;
1306
1315
  declare module "alepha" {
@@ -1310,8 +1319,8 @@ declare module "alepha" {
1310
1319
  } //# sourceMappingURL=jobConfigAtom.d.ts.map
1311
1320
  //#endregion
1312
1321
  //#region ../../src/api/jobs/schemas/triggerJobSchema.d.ts
1313
- declare const triggerJobSchema: _$alepha.TObject<{
1314
- payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1322
+ declare const triggerJobSchema: _$typebox.TObject<{
1323
+ payload: _$typebox.TOptional<_$typebox.TRecord<"^.*$", _$typebox.TAny>>;
1315
1324
  }>;
1316
1325
  type TriggerJob = Static<typeof triggerJobSchema>;
1317
1326
  //#endregion