alepha 0.19.3 → 0.19.5

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 (289) hide show
  1. package/assets/swagger-ui/swagger-ui-bundle.js +1 -1
  2. package/dist/api/invitations/index.d.ts +790 -0
  3. package/dist/api/invitations/index.d.ts.map +1 -0
  4. package/dist/api/invitations/index.js +665 -0
  5. package/dist/api/invitations/index.js.map +1 -0
  6. package/dist/api/issues/index.d.ts +810 -0
  7. package/dist/api/issues/index.d.ts.map +1 -0
  8. package/dist/api/issues/index.js +447 -0
  9. package/dist/api/issues/index.js.map +1 -0
  10. package/dist/api/jobs/index.browser.js +8 -9
  11. package/dist/api/jobs/index.browser.js.map +1 -1
  12. package/dist/api/jobs/index.d.ts +99 -43
  13. package/dist/api/jobs/index.d.ts.map +1 -1
  14. package/dist/api/jobs/index.js +257 -40
  15. package/dist/api/jobs/index.js.map +1 -1
  16. package/dist/api/notifications/index.browser.js +0 -1
  17. package/dist/api/notifications/index.browser.js.map +1 -1
  18. package/dist/api/notifications/index.d.ts +3 -3
  19. package/dist/api/notifications/index.d.ts.map +1 -1
  20. package/dist/api/notifications/index.js +0 -1
  21. package/dist/api/notifications/index.js.map +1 -1
  22. package/dist/api/parameters/index.browser.js +112 -1
  23. package/dist/api/parameters/index.browser.js.map +1 -1
  24. package/dist/api/parameters/index.d.ts +90 -3
  25. package/dist/api/parameters/index.d.ts.map +1 -1
  26. package/dist/api/parameters/index.js +79 -12
  27. package/dist/api/parameters/index.js.map +1 -1
  28. package/dist/{billing → api/payments}/index.d.ts +67 -49
  29. package/dist/api/payments/index.d.ts.map +1 -0
  30. package/dist/{billing → api/payments}/index.js +108 -74
  31. package/dist/api/payments/index.js.map +1 -0
  32. package/dist/api/subscriptions/index.d.ts +1692 -0
  33. package/dist/api/subscriptions/index.d.ts.map +1 -0
  34. package/dist/api/subscriptions/index.js +1870 -0
  35. package/dist/api/subscriptions/index.js.map +1 -0
  36. package/dist/api/users/index.d.ts +24 -2
  37. package/dist/api/users/index.d.ts.map +1 -1
  38. package/dist/api/users/index.js +176 -36
  39. package/dist/api/users/index.js.map +1 -1
  40. package/dist/api/verifications/index.d.ts +13 -13
  41. package/dist/api/workflows/index.browser.js +246 -0
  42. package/dist/api/workflows/index.browser.js.map +1 -0
  43. package/dist/api/workflows/index.d.ts +1618 -0
  44. package/dist/api/workflows/index.d.ts.map +1 -0
  45. package/dist/api/workflows/index.js +1504 -0
  46. package/dist/api/workflows/index.js.map +1 -0
  47. package/dist/captcha/index.d.ts +142 -0
  48. package/dist/captcha/index.d.ts.map +1 -0
  49. package/dist/captcha/index.js +177 -0
  50. package/dist/captcha/index.js.map +1 -0
  51. package/dist/cli/core/index.d.ts +126 -30
  52. package/dist/cli/core/index.d.ts.map +1 -1
  53. package/dist/cli/core/index.js +106 -67
  54. package/dist/cli/core/index.js.map +1 -1
  55. package/dist/cli/platform/index.d.ts +84 -10
  56. package/dist/cli/platform/index.d.ts.map +1 -1
  57. package/dist/cli/platform/index.js +92 -4
  58. package/dist/cli/platform/index.js.map +1 -1
  59. package/dist/cli/vendor/index.d.ts +60 -10
  60. package/dist/cli/vendor/index.d.ts.map +1 -1
  61. package/dist/cli/vendor/index.js +177 -45
  62. package/dist/cli/vendor/index.js.map +1 -1
  63. package/dist/command/index.d.ts.map +1 -1
  64. package/dist/command/index.js +2 -3
  65. package/dist/command/index.js.map +1 -1
  66. package/dist/core/index.browser.js +21 -2
  67. package/dist/core/index.browser.js.map +1 -1
  68. package/dist/core/index.d.ts +33 -2
  69. package/dist/core/index.d.ts.map +1 -1
  70. package/dist/core/index.js +21 -2
  71. package/dist/core/index.js.map +1 -1
  72. package/dist/core/index.native.js +21 -2
  73. package/dist/core/index.native.js.map +1 -1
  74. package/dist/core/index.workerd.js +21 -2
  75. package/dist/core/index.workerd.js.map +1 -1
  76. package/dist/email/smtp/index.js +24 -8
  77. package/dist/email/smtp/index.js.map +1 -1
  78. package/dist/orm/core/index.browser.js +0 -18
  79. package/dist/orm/core/index.browser.js.map +1 -1
  80. package/dist/orm/core/index.bun.js +6 -23
  81. package/dist/orm/core/index.bun.js.map +1 -1
  82. package/dist/orm/core/index.d.ts +1 -13
  83. package/dist/orm/core/index.d.ts.map +1 -1
  84. package/dist/orm/core/index.js +6 -23
  85. package/dist/orm/core/index.js.map +1 -1
  86. package/dist/orm/postgres/index.bun.js +3 -3
  87. package/dist/orm/postgres/index.bun.js.map +1 -1
  88. package/dist/orm/postgres/index.d.ts.map +1 -1
  89. package/dist/orm/postgres/index.js +3 -3
  90. package/dist/orm/postgres/index.js.map +1 -1
  91. package/dist/react/i18n/index.d.ts +1 -0
  92. package/dist/react/i18n/index.d.ts.map +1 -1
  93. package/dist/react/i18n/index.js +8 -4
  94. package/dist/react/i18n/index.js.map +1 -1
  95. package/dist/react/router/index.browser.js +25 -3
  96. package/dist/react/router/index.browser.js.map +1 -1
  97. package/dist/react/router/index.d.ts +16 -1
  98. package/dist/react/router/index.d.ts.map +1 -1
  99. package/dist/react/router/index.js +25 -3
  100. package/dist/react/router/index.js.map +1 -1
  101. package/dist/security/index.d.ts +28 -0
  102. package/dist/security/index.d.ts.map +1 -1
  103. package/dist/security/index.js +28 -0
  104. package/dist/security/index.js.map +1 -1
  105. package/dist/server/auth/index.d.ts +145 -2
  106. package/dist/server/auth/index.d.ts.map +1 -1
  107. package/dist/server/auth/index.js +364 -63
  108. package/dist/server/auth/index.js.map +1 -1
  109. package/dist/server/cookies/index.d.ts.map +1 -1
  110. package/dist/server/cookies/index.js.map +1 -1
  111. package/dist/websocket/index.d.ts.map +1 -1
  112. package/dist/websocket/index.js.map +1 -1
  113. package/package.json +47 -20
  114. package/src/api/invitations/__tests__/InvitationService.spec.ts +439 -0
  115. package/src/api/invitations/controllers/AdminInvitationController.ts +86 -0
  116. package/src/api/invitations/controllers/InvitationController.ts +84 -0
  117. package/src/api/invitations/entities/invitations.ts +33 -0
  118. package/src/api/invitations/index.ts +65 -0
  119. package/src/api/invitations/jobs/InvitationJobs.ts +37 -0
  120. package/src/api/invitations/providers/InvitationProvider.ts +45 -0
  121. package/src/api/invitations/schemas/createInvitationSchema.ts +12 -0
  122. package/src/api/invitations/schemas/invitationConfigAtom.ts +20 -0
  123. package/src/api/invitations/schemas/invitationQuerySchema.ts +15 -0
  124. package/src/api/invitations/schemas/invitationResourceSchema.ts +6 -0
  125. package/src/api/invitations/schemas/invitationWithResourceInfoSchema.ts +22 -0
  126. package/src/api/invitations/schemas/myInvitationsQuerySchema.ts +10 -0
  127. package/src/api/invitations/services/InvitationService.ts +556 -0
  128. package/src/api/issues/__tests__/IssueService.spec.ts +263 -0
  129. package/src/api/issues/controllers/AdminIssueController.ts +149 -0
  130. package/src/api/issues/controllers/IssueController.ts +44 -0
  131. package/src/api/issues/entities/issues.ts +49 -0
  132. package/src/api/issues/index.ts +53 -0
  133. package/src/api/issues/schemas/createIssueSchema.ts +13 -0
  134. package/src/api/issues/schemas/issueConfigAtom.ts +13 -0
  135. package/src/api/issues/schemas/issueQuerySchema.ts +18 -0
  136. package/src/api/issues/schemas/issueResourceSchema.ts +6 -0
  137. package/src/api/issues/schemas/myIssueQuerySchema.ts +10 -0
  138. package/src/api/issues/schemas/updateIssueSchema.ts +13 -0
  139. package/src/api/issues/services/IssueService.ts +264 -0
  140. package/src/api/jobs/__tests__/$job.spec.ts +876 -0
  141. package/src/api/jobs/controllers/AdminJobController.ts +44 -0
  142. package/src/api/jobs/entities/jobExecutionEntity.ts +0 -2
  143. package/src/api/jobs/index.ts +0 -3
  144. package/src/api/jobs/primitives/$job.ts +22 -11
  145. package/src/api/jobs/providers/JobProvider.ts +229 -19
  146. package/src/api/jobs/schemas/jobConfigAtom.ts +4 -0
  147. package/src/api/jobs/schemas/jobCronInfoSchema.ts +1 -0
  148. package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +0 -1
  149. package/src/api/jobs/schemas/jobQueueDepthSchema.ts +1 -0
  150. package/src/api/jobs/schemas/jobRegistrationSchema.ts +1 -6
  151. package/src/api/jobs/services/JobService.ts +51 -12
  152. package/src/api/notifications/schemas/notificationQuerySchema.ts +0 -1
  153. package/src/api/parameters/__tests__/$parameter.spec.ts +327 -0
  154. package/src/api/parameters/controllers/AdminParameterController.ts +29 -3
  155. package/src/api/parameters/index.browser.ts +12 -0
  156. package/src/api/parameters/primitives/$parameter.ts +20 -3
  157. package/src/api/parameters/services/ParameterProvider.ts +48 -7
  158. package/src/{billing → api/payments}/__tests__/PaymentMethodService.spec.ts +32 -6
  159. package/src/api/payments/__tests__/PaymentService.spec.ts +279 -0
  160. package/src/{billing/controllers/AdminBillingController.ts → api/payments/controllers/AdminPaymentController.ts} +26 -21
  161. package/src/{billing/controllers/BillingController.ts → api/payments/controllers/PaymentController.ts} +23 -11
  162. package/src/{billing → api/payments}/entities/paymentIntents.ts +1 -0
  163. package/src/{billing/errors/BillingError.ts → api/payments/errors/PaymentError.ts} +1 -1
  164. package/src/{billing → api/payments}/index.ts +31 -25
  165. package/src/{billing/providers/MemoryBillingProvider.ts → api/payments/providers/MemoryPaymentProvider.ts} +4 -4
  166. package/src/{billing/providers/BillingProvider.ts → api/payments/providers/PaymentProvider.ts} +9 -2
  167. package/src/{billing → api/payments}/services/PaymentMethodService.ts +5 -5
  168. package/src/{billing/services/BillingService.ts → api/payments/services/PaymentService.ts} +94 -18
  169. package/src/api/subscriptions/__tests__/BillingService.spec.ts +218 -0
  170. package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +278 -0
  171. package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +212 -0
  172. package/src/api/subscriptions/controllers/SubscriptionController.ts +189 -0
  173. package/src/api/subscriptions/entities/subscriptionEvents.ts +54 -0
  174. package/src/api/subscriptions/entities/subscriptions.ts +68 -0
  175. package/src/api/subscriptions/index.ts +144 -0
  176. package/src/api/subscriptions/jobs/SubscriptionJobs.ts +382 -0
  177. package/src/api/subscriptions/middleware/$requireLimit.ts +50 -0
  178. package/src/api/subscriptions/middleware/$requirePlan.ts +49 -0
  179. package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +110 -0
  180. package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +8 -0
  181. package/src/api/subscriptions/schemas/changePlanSchema.ts +9 -0
  182. package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +11 -0
  183. package/src/api/subscriptions/schemas/entitlementsSchema.ts +21 -0
  184. package/src/api/subscriptions/schemas/mrrSchema.ts +13 -0
  185. package/src/api/subscriptions/schemas/planDefinitionSchema.ts +71 -0
  186. package/src/api/subscriptions/schemas/planResourceSchema.ts +25 -0
  187. package/src/api/subscriptions/schemas/subscriptionEventResourceSchema.ts +8 -0
  188. package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +19 -0
  189. package/src/api/subscriptions/schemas/subscriptionResourceSchema.ts +6 -0
  190. package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +32 -0
  191. package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +23 -0
  192. package/src/api/subscriptions/services/BillingService.ts +437 -0
  193. package/src/api/subscriptions/services/SubscriptionConfig.ts +56 -0
  194. package/src/api/subscriptions/services/SubscriptionService.ts +867 -0
  195. package/src/api/subscriptions/services/UsageService.ts +118 -0
  196. package/src/api/users/__tests__/AdminUserController.spec.ts +80 -1
  197. package/src/api/users/__tests__/CredentialService.spec.ts +177 -0
  198. package/src/api/users/__tests__/EmailVerification.spec.ts +29 -18
  199. package/src/api/users/__tests__/PasswordReset.spec.ts +3 -0
  200. package/src/api/users/__tests__/RegistrationService.spec.ts +148 -1
  201. package/src/api/users/__tests__/SessionService.spec.ts +142 -1
  202. package/src/api/users/atoms/realmAuthSettingsAtom.ts +10 -1
  203. package/src/api/users/controllers/UserController.ts +3 -8
  204. package/src/api/users/notifications/UserNotifications.ts +23 -0
  205. package/src/api/users/primitives/$realm.ts +24 -0
  206. package/src/api/users/schemas/loginSchema.ts +1 -1
  207. package/src/api/users/services/CredentialService.ts +57 -7
  208. package/src/api/users/services/RegistrationService.ts +50 -11
  209. package/src/api/users/services/SessionService.ts +64 -9
  210. package/src/api/users/services/UserService.ts +21 -12
  211. package/src/api/workflows/__tests__/$workflow.spec.ts +616 -0
  212. package/src/api/workflows/controllers/AdminWorkflowController.ts +191 -0
  213. package/src/api/workflows/entities/workflowExecutions.ts +74 -0
  214. package/src/api/workflows/entities/workflowStepExecutions.ts +74 -0
  215. package/src/api/workflows/entities/workflowStepLogs.ts +13 -0
  216. package/src/api/workflows/index.browser.ts +22 -0
  217. package/src/api/workflows/index.ts +124 -0
  218. package/src/api/workflows/jobs/WorkflowJobs.ts +77 -0
  219. package/src/api/workflows/primitives/$workflow.ts +202 -0
  220. package/src/api/workflows/providers/WorkflowProvider.ts +1284 -0
  221. package/src/api/workflows/schemas/workflowActivitySchema.ts +15 -0
  222. package/src/api/workflows/schemas/workflowConfigAtom.ts +51 -0
  223. package/src/api/workflows/schemas/workflowExecutionDetailSchema.ts +18 -0
  224. package/src/api/workflows/schemas/workflowExecutionQuerySchema.ts +26 -0
  225. package/src/api/workflows/schemas/workflowExecutionResourceSchema.ts +30 -0
  226. package/src/api/workflows/schemas/workflowRegistrationSchema.ts +26 -0
  227. package/src/api/workflows/schemas/workflowStatsSchema.ts +16 -0
  228. package/src/api/workflows/schemas/workflowStepExecutionResourceSchema.ts +15 -0
  229. package/src/api/workflows/services/WorkflowService.ts +382 -0
  230. package/src/captcha/__tests__/MemoryCaptchaProvider.spec.ts +74 -0
  231. package/src/captcha/index.ts +33 -0
  232. package/src/captcha/providers/CaptchaProvider.ts +17 -0
  233. package/src/captcha/providers/MemoryCaptchaProvider.ts +65 -0
  234. package/src/captcha/providers/TurnstileCaptchaProvider.ts +125 -0
  235. package/src/cli/core/atoms/buildOptions.ts +57 -0
  236. package/src/cli/core/commands/build.ts +2 -0
  237. package/src/cli/core/providers/ViteDevServerProvider.ts +1 -1
  238. package/src/cli/core/services/ViteUtils.ts +5 -2
  239. package/src/cli/core/tasks/BuildClientTask.ts +3 -1
  240. package/src/cli/core/tasks/BuildCloudflareTask.ts +4 -0
  241. package/src/cli/core/tasks/BuildPwaTask.ts +81 -0
  242. package/src/cli/core/templates/webAppRouterTs.ts +5 -58
  243. package/src/cli/platform/adapters/CloudflareAdapter.ts +24 -0
  244. package/src/cli/platform/atoms/platformOptions.ts +19 -3
  245. package/src/cli/platform/hooks/PlatformHook.ts +51 -0
  246. package/src/cli/platform/index.ts +1 -0
  247. package/src/cli/platform/services/CloudflareApi.ts +22 -1
  248. package/src/cli/platform/services/PlatformOrchestrator.ts +67 -2
  249. package/src/cli/vendor/__tests__/VendorService.spec.ts +322 -178
  250. package/src/cli/vendor/commands/VendorCommand.ts +41 -38
  251. package/src/cli/vendor/services/VendorService.ts +234 -31
  252. package/src/command/__tests__/CliProvider.spec.ts +45 -0
  253. package/src/command/providers/CliProvider.ts +3 -4
  254. package/src/core/__tests__/TypeProvider.spec.ts +4 -2
  255. package/src/core/providers/SchemaValidator.ts +1 -1
  256. package/src/core/providers/TypeProvider.ts +46 -3
  257. package/src/orm/__tests__/enums.spec.ts +22 -29
  258. package/src/orm/__tests__/orm-showcase-tests.ts +430 -0
  259. package/src/orm/__tests__/orm-showcase.spec.ts +167 -0
  260. package/src/orm/core/providers/DatabaseTypeProvider.ts +0 -29
  261. package/src/orm/core/services/Repository.ts +20 -6
  262. package/src/orm/postgres/services/PostgresModelBuilder.ts +3 -6
  263. package/src/react/i18n/__tests__/I18nProvider.spec.ts +83 -0
  264. package/src/react/i18n/providers/I18nProvider.ts +12 -10
  265. package/src/react/router/__tests__/$page.browser.spec.tsx +157 -0
  266. package/src/react/router/providers/ReactBrowserProvider.ts +39 -0
  267. package/src/react/router/providers/ReactBrowserRouterProvider.ts +22 -0
  268. package/src/security/__tests__/$secure-combinations.spec.ts +945 -0
  269. package/src/security/primitives/$issuer.ts +3 -1
  270. package/src/security/primitives/$secure.ts +28 -0
  271. package/src/server/auth/index.ts +7 -0
  272. package/src/server/auth/primitives/$auth.ts +37 -3
  273. package/src/server/auth/primitives/$authApple.ts +114 -4
  274. package/src/server/auth/primitives/$authFacebook.ts +98 -0
  275. package/src/server/auth/primitives/$authFranceConnect.ts +105 -0
  276. package/src/server/auth/primitives/$authGithub.ts +22 -16
  277. package/src/server/auth/primitives/$authMicrosoft.ts +88 -0
  278. package/src/server/auth/providers/ServerAuthProvider.ts +197 -72
  279. package/src/server/cookies/providers/ServerCookiesProvider.ts +3 -0
  280. package/src/server/core/__tests__/ServerRouterProvider-errorHandler.spec.ts +1 -1
  281. package/src/websocket/providers/NodeWebSocketServerProvider.ts +3 -1
  282. package/dist/billing/index.d.ts.map +0 -1
  283. package/dist/billing/index.js.map +0 -1
  284. package/src/billing/__tests__/BillingService.spec.ts +0 -136
  285. /package/src/{billing → api/payments}/entities/paymentMethods.ts +0 -0
  286. /package/src/{billing → api/payments}/entities/refunds.ts +0 -0
  287. /package/src/{billing → api/payments}/schemas/intentSchemas.ts +0 -0
  288. /package/src/{billing → api/payments}/schemas/paymentMethodSchemas.ts +0 -0
  289. /package/src/{billing → api/payments}/schemas/refundSchemas.ts +0 -0
@@ -0,0 +1,1618 @@
1
+ import * as _$alepha from "alepha";
2
+ import { Alepha, AlephaError, KIND, Primitive, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
3
+ import { LockProvider } from "alepha/lock";
4
+ import * as _$alepha_server0 from "alepha/server";
5
+ import * as _$alepha_orm0 from "alepha/orm";
6
+ import { DatabaseProvider } from "alepha/orm";
7
+ import { DateTimeProvider, DurationLike } from "alepha/datetime";
8
+ import * as _$alepha_logger0 from "alepha/logger";
9
+ import { BuildExtraConfigColumns, SQL, SQLWrapper } from "drizzle-orm";
10
+ import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
11
+ import * as _$typebox from "typebox";
12
+ //#region ../../src/orm/core/schemas/insertSchema.d.ts
13
+ /**
14
+ * Transforms a TObject schema for insert operations.
15
+ * All default properties at the root level are made optional.
16
+ * Generated columns are excluded entirely.
17
+ *
18
+ * @example
19
+ * Before: { name: string; age: number(default=0); fullName: generated }
20
+ * After: { name: string; age?: number; }
21
+ */
22
+ type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
23
+ [PG_GENERATED]: any;
24
+ } ? never : K]: T["properties"][K] extends {
25
+ [PG_DEFAULT]: any;
26
+ } | {
27
+ "~optional": true;
28
+ } ? TOptional<T["properties"][K]> : T["properties"][K] }>;
29
+ //#endregion
30
+ //#region ../../src/orm/core/schemas/updateSchema.d.ts
31
+ /**
32
+ * Transforms a TObject schema for update operations.
33
+ * All optional properties at the root level are made nullable (i.e., `T | null`).
34
+ * Generated columns are excluded entirely.
35
+ *
36
+ * @example
37
+ * Before: { name?: string; age: number; fullName: generated }
38
+ * After: { name?: string | null; age: number; }
39
+ */
40
+ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
41
+ [PG_GENERATED]: any;
42
+ } ? never : K]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
43
+ //#endregion
44
+ //#region ../../src/orm/core/primitives/$entity.d.ts
45
+ interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
46
+ /**
47
+ * The database table name that will be created for this entity.
48
+ * If not provided, name will be inferred from the $repository variable name.
49
+ */
50
+ name: string;
51
+ /**
52
+ * TypeBox schema defining the table structure and column types.
53
+ */
54
+ schema: T;
55
+ /**
56
+ * Database indexes to create for query optimization.
57
+ */
58
+ indexes?: (Keys | {
59
+ /**
60
+ * Single column to index.
61
+ */
62
+ column: Keys;
63
+ /**
64
+ * Whether this should be a unique index (enforces uniqueness constraint).
65
+ */
66
+ unique?: boolean;
67
+ /**
68
+ * Custom name for the index. If not provided, generates name automatically.
69
+ */
70
+ name?: string;
71
+ /**
72
+ * Partial index condition. Only rows matching this SQL expression are indexed.
73
+ */
74
+ where?: SQL;
75
+ } | {
76
+ /**
77
+ * Multiple columns for composite index (order matters for query optimization).
78
+ */
79
+ columns: Keys[];
80
+ /**
81
+ * Whether this should be a unique index (enforces uniqueness constraint).
82
+ */
83
+ unique?: boolean;
84
+ /**
85
+ * Custom name for the index. If not provided, generates name automatically.
86
+ */
87
+ name?: string;
88
+ /**
89
+ * Partial index condition. Only rows matching this SQL expression are indexed.
90
+ */
91
+ where?: SQL;
92
+ } | {
93
+ /**
94
+ * SQL expressions for expression-based indexes.
95
+ *
96
+ * Can include column references and SQL functions like `LOWER()`, `UPPER()`, etc.
97
+ * Columns and expressions can be mixed together.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * // Case-insensitive unique username per realm
102
+ * indexes: [{
103
+ * expressions: (self) => [self.realm, sql`LOWER(${self.username})`],
104
+ * unique: true,
105
+ * name: "users_realm_username_lower_idx",
106
+ * }]
107
+ * ```
108
+ */
109
+ expressions: (self: Record<Keys & string, any>) => (SQL | any)[];
110
+ /**
111
+ * Whether this should be a unique index (enforces uniqueness constraint).
112
+ */
113
+ unique?: boolean;
114
+ /**
115
+ * Custom name for the index. If not provided, generates name automatically.
116
+ */
117
+ name: string;
118
+ /**
119
+ * Partial index condition. Only rows matching this SQL expression are indexed.
120
+ */
121
+ where?: SQL;
122
+ })[];
123
+ /**
124
+ * Foreign key constraints to maintain referential integrity.
125
+ */
126
+ foreignKeys?: Array<{
127
+ /**
128
+ * Optional name for the foreign key constraint.
129
+ */
130
+ name?: string;
131
+ /**
132
+ * Local columns that reference the foreign table.
133
+ */
134
+ columns: Array<keyof Static<T>>;
135
+ /**
136
+ * Referenced columns in the foreign table.
137
+ * Must be EntityColumn references from other entities.
138
+ */
139
+ foreignColumns: Array<() => EntityColumn<any>>;
140
+ }>;
141
+ /**
142
+ * Additional table constraints for data validation.
143
+ *
144
+ * Constraints enforce business rules at the database level, providing
145
+ * an additional layer of data integrity beyond application validation.
146
+ *
147
+ * **Constraint Types**:
148
+ * - **Unique constraints**: Prevent duplicate values across columns
149
+ * - **Check constraints**: Enforce custom validation rules with SQL expressions
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * constraints: [
154
+ * {
155
+ * name: "unique_user_email",
156
+ * columns: ["email"],
157
+ * unique: true
158
+ * },
159
+ * {
160
+ * name: "valid_age_range",
161
+ * columns: ["age"],
162
+ * check: sql`age >= 0 AND age <= 150`
163
+ * },
164
+ * {
165
+ * name: "unique_user_username_per_tenant",
166
+ * columns: ["tenantId", "username"],
167
+ * unique: true
168
+ * }
169
+ * ]
170
+ * ```
171
+ */
172
+ constraints?: Array<{
173
+ /**
174
+ * Columns involved in this constraint.
175
+ */
176
+ columns: Array<keyof Static<T>>;
177
+ /**
178
+ * Optional name for the constraint.
179
+ */
180
+ name?: string;
181
+ /**
182
+ * Whether this is a unique constraint.
183
+ */
184
+ unique?: boolean | {};
185
+ /**
186
+ * SQL expression for check constraint validation.
187
+ */
188
+ check?: SQL;
189
+ }>;
190
+ /**
191
+ * Advanced Drizzle ORM configuration for complex table setups.
192
+ */
193
+ config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
194
+ }
195
+ declare class EntityPrimitive<T extends TObject = TObject> {
196
+ readonly options: EntityPrimitiveOptions<T>;
197
+ constructor(options: EntityPrimitiveOptions<T>);
198
+ alias(alias: string): this;
199
+ get cols(): EntityColumns<T>;
200
+ get name(): string;
201
+ get schema(): T;
202
+ get insertSchema(): TObjectInsert<T>;
203
+ get updateSchema(): TObjectUpdate<T>;
204
+ }
205
+ /**
206
+ * Convert a schema to columns.
207
+ */
208
+ type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
209
+ type EntityColumn<T extends TObject> = {
210
+ name: string;
211
+ entity: EntityPrimitive<T>;
212
+ };
213
+ type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
214
+ //#endregion
215
+ //#region ../../src/orm/core/constants/PG_SYMBOLS.d.ts
216
+ declare const PG_DEFAULT: unique symbol;
217
+ declare const PG_PRIMARY_KEY: unique symbol;
218
+ declare const PG_CREATED_AT: unique symbol;
219
+ declare const PG_UPDATED_AT: unique symbol;
220
+ declare const PG_DELETED_AT: unique symbol;
221
+ declare const PG_VERSION: unique symbol;
222
+ declare const PG_IDENTITY: unique symbol;
223
+ declare const PG_ENUM: unique symbol;
224
+ declare const PG_REF: unique symbol;
225
+ declare const PG_GENERATED: unique symbol;
226
+ declare const PG_ORGANIZATION: unique symbol;
227
+ /**
228
+ * @deprecated Use `PG_IDENTITY` instead.
229
+ */
230
+ declare const PG_SERIAL: unique symbol;
231
+ type PgSymbols = {
232
+ [PG_DEFAULT]: {};
233
+ [PG_PRIMARY_KEY]: {};
234
+ [PG_CREATED_AT]: {};
235
+ [PG_UPDATED_AT]: {};
236
+ [PG_DELETED_AT]: {};
237
+ [PG_VERSION]: {};
238
+ [PG_IDENTITY]: PgIdentityOptions;
239
+ [PG_REF]: PgRefOptions;
240
+ [PG_ENUM]: PgEnumOptions;
241
+ [PG_GENERATED]: PgGeneratedOptions;
242
+ [PG_ORGANIZATION]: {};
243
+ /**
244
+ * @deprecated Use `PG_IDENTITY` instead.
245
+ */
246
+ [PG_SERIAL]: {};
247
+ };
248
+ type PgSymbolKeys = keyof PgSymbols;
249
+ type PgIdentityOptions = {
250
+ mode: "always" | "byDefault";
251
+ } & PgSequenceOptions & {
252
+ name?: string;
253
+ };
254
+ interface PgEnumOptions {
255
+ name?: string;
256
+ description?: string;
257
+ }
258
+ interface PgGeneratedOptions {
259
+ /**
260
+ * SQL expression for the generated column.
261
+ */
262
+ expression: SQL;
263
+ /**
264
+ * Storage mode for the generated column.
265
+ * - `"stored"` — value is computed on write and stored on disk (default for PostgreSQL).
266
+ * - `"virtual"` — value is computed on read (default for SQLite).
267
+ */
268
+ mode?: "stored" | "virtual";
269
+ }
270
+ interface PgRefOptions {
271
+ ref: () => {
272
+ name: string;
273
+ entity: EntityPrimitive;
274
+ };
275
+ actions?: {
276
+ onUpdate?: UpdateDeleteAction;
277
+ onDelete?: UpdateDeleteAction;
278
+ };
279
+ }
280
+ //#endregion
281
+ //#region ../../src/orm/core/interfaces/PgQuery.d.ts
282
+ type PgStatic<T extends TObject, Relations extends PgRelationMap<T>> = Static<T> & { [K in keyof Relations]: Static<Relations[K]["join"]["schema"]> & (Relations[K]["with"] extends PgRelationMap<TObject> ? PgStatic<Relations[K]["join"]["schema"], Relations[K]["with"]> : {}) };
283
+ type PgRelationMap<Base extends TObject> = Record<string, PgRelation<Base>>;
284
+ type PgRelation<Base extends TObject> = {
285
+ type?: "left" | "inner" | "right";
286
+ join: {
287
+ schema: TObject;
288
+ name: string;
289
+ };
290
+ on: SQLWrapper | [keyof Static<Base>, {
291
+ name: string;
292
+ }];
293
+ with?: PgRelationMap<TObject>;
294
+ };
295
+ //#endregion
296
+ //#region ../../src/orm/core/helpers/pgAttr.d.ts
297
+ /**
298
+ * Type representation.
299
+ */
300
+ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
301
+ //#endregion
302
+ //#region ../../src/orm/core/schemas/databaseEnvSchema.d.ts
303
+ /**
304
+ * Base database environment schema.
305
+ *
306
+ * Defines the `DATABASE_URL` connection string used by all ORM providers
307
+ * to determine the database driver and connection target.
308
+ *
309
+ * Supported URL formats:
310
+ * - `sqlite://:memory:` or `sqlite://./path/to/db` — SQLite (Node.js or Bun)
311
+ * - `postgres://user:password@host:port/database` — PostgreSQL (Node.js or Bun)
312
+ * - `pglite://:memory:` or `pglite://./path` — PGlite (embedded Postgres)
313
+ * - `d1://BINDING_NAME` — Cloudflare D1
314
+ * - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
315
+ */
316
+ declare const databaseEnvSchema: _$alepha.TObject<{
317
+ DATABASE_URL: _$alepha.TOptional<_$alepha.TString>;
318
+ /**
319
+ * Enable or disable push-based schema synchronization (drizzle-kit push).
320
+ *
321
+ * Defaults to `true` in development and test, `false` in production.
322
+ * Set to `false` in development to skip automatic schema sync
323
+ * (e.g. when managing migrations manually).
324
+ */
325
+ DATABASE_SYNC: _$alepha.TOptional<_$alepha.TBoolean>;
326
+ }>;
327
+ declare module "alepha" {
328
+ interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
329
+ } //# sourceMappingURL=databaseEnvSchema.d.ts.map
330
+ //#endregion
331
+ //#region ../../src/api/workflows/entities/workflowExecutions.d.ts
332
+ declare const workflowExecutions: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
333
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
334
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
335
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
336
+ workflowName: _$alepha.TString;
337
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
338
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
339
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
340
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
341
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
342
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
343
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
344
+ error: _$alepha.TOptional<_$alepha.TString>;
345
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
346
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
347
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
348
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
349
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
350
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
351
+ priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
352
+ }>>;
353
+ type WorkflowExecutionEntity = Static<typeof workflowExecutions.schema>;
354
+ type WorkflowStatus = "pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled";
355
+ //#endregion
356
+ //#region ../../src/api/workflows/entities/workflowStepExecutions.d.ts
357
+ declare const workflowStepExecutions: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
358
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
359
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
360
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
361
+ workflowExecutionId: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
362
+ stepName: _$alepha.TString;
363
+ stepIndex: _$alepha.TInteger;
364
+ stepType: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof _$alepha_orm0.PG_DEFAULT>;
365
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
366
+ branchName: _$alepha.TOptional<_$alepha.TString>;
367
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof _$alepha_orm0.PG_DEFAULT>;
368
+ attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
369
+ maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
370
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
371
+ error: _$alepha.TOptional<_$alepha.TString>;
372
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
373
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
374
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
375
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
376
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
377
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
378
+ }>>;
379
+ type WorkflowStepExecutionEntity = Static<typeof workflowStepExecutions.schema>;
380
+ type WorkflowStepStatus = "pending" | "running" | "completed" | "failed" | "skipped" | "waiting" | "compensating" | "compensated" | "compensation_failed" | "cancelled";
381
+ //#endregion
382
+ //#region ../../src/api/workflows/primitives/$workflow.d.ts
383
+ type WorkflowPriority = "critical" | "high" | "normal" | "low";
384
+ interface WorkflowRetryOptions {
385
+ retries: number;
386
+ backoff?: DurationLike | WorkflowRetryBackoff;
387
+ when?: (error: Error) => boolean;
388
+ }
389
+ interface WorkflowRetryBackoff {
390
+ initial: DurationLike;
391
+ factor?: number;
392
+ max?: DurationLike;
393
+ jitter?: boolean;
394
+ }
395
+ interface StepHandlerArgs<TInput extends TSchema = TSchema> {
396
+ payload: Static<TInput>;
397
+ results: Record<string, unknown>;
398
+ context: {
399
+ workflowId: string;
400
+ executionId: string;
401
+ stepName: string;
402
+ attempt: number;
403
+ };
404
+ signal: AbortSignal;
405
+ }
406
+ interface StepCompensateArgs<TInput extends TSchema = TSchema> {
407
+ payload: Static<TInput>;
408
+ result: unknown;
409
+ results: Record<string, unknown>;
410
+ context: {
411
+ workflowId: string;
412
+ executionId: string;
413
+ stepName: string;
414
+ error: Error;
415
+ };
416
+ }
417
+ interface StepConditionArgs<TInput extends TSchema = TSchema> {
418
+ payload: Static<TInput>;
419
+ results: Record<string, unknown>;
420
+ }
421
+ interface HandlerStep<TInput extends TSchema = TSchema> {
422
+ name: string;
423
+ type?: "handler";
424
+ handler: (args: StepHandlerArgs<TInput>) => Promise<unknown>;
425
+ compensate?: (args: StepCompensateArgs<TInput>) => Promise<void>;
426
+ retry?: WorkflowRetryOptions;
427
+ timeout?: DurationLike;
428
+ when?: (args: StepConditionArgs<TInput>) => boolean | Promise<boolean>;
429
+ }
430
+ type WorkflowStep<TInput extends TSchema = TSchema> = HandlerStep<TInput>;
431
+ interface WorkflowPrimitiveOptions<TInput extends TSchema = TSchema> {
432
+ /**
433
+ * TypeBox schema for the workflow input payload.
434
+ */
435
+ schema: TInput;
436
+ /**
437
+ * Ordered list of steps. Executed sequentially.
438
+ */
439
+ steps: Array<WorkflowStep<TInput>>;
440
+ /**
441
+ * Error strategy.
442
+ * - "compensate": Run compensate functions in reverse order (saga pattern).
443
+ * - "fail": Mark workflow as failed, no compensation.
444
+ * @default "compensate"
445
+ */
446
+ onError?: "compensate" | "fail";
447
+ /**
448
+ * Maximum total duration for the entire workflow.
449
+ */
450
+ timeout?: DurationLike;
451
+ /**
452
+ * Priority for the workflow's job dispatches.
453
+ * @default "normal"
454
+ */
455
+ priority?: WorkflowPriority;
456
+ /**
457
+ * Tags for filtering/grouping in admin UI.
458
+ */
459
+ tags?: string[];
460
+ }
461
+ interface WorkflowStartOptions {
462
+ key?: string;
463
+ priority?: WorkflowPriority;
464
+ delay?: DurationLike;
465
+ triggeredBy?: string;
466
+ triggeredByName?: string;
467
+ tags?: string[];
468
+ }
469
+ declare class WorkflowPrimitive<TInput extends TSchema = TSchema> extends Primitive<WorkflowPrimitiveOptions<TInput>> {
470
+ protected readonly workflowProvider: WorkflowProvider;
471
+ get name(): string;
472
+ protected onInit(): void;
473
+ /**
474
+ * Start a new workflow execution.
475
+ */
476
+ start(payload: Static<TInput>, options?: WorkflowStartOptions): Promise<string>;
477
+ /**
478
+ * Send a signal to a waiting step on a specific execution.
479
+ */
480
+ signal(executionId: string, stepName: string, payload?: unknown): Promise<void>;
481
+ /**
482
+ * Cancel a running execution.
483
+ */
484
+ cancel(executionId: string, options?: {
485
+ compensate?: boolean;
486
+ }): Promise<void>;
487
+ /**
488
+ * Retry a failed/timed-out execution from the failed step.
489
+ */
490
+ retry(executionId: string): Promise<void>;
491
+ /**
492
+ * Restart a terminal execution from the beginning (new execution).
493
+ */
494
+ restart(executionId: string): Promise<string>;
495
+ /**
496
+ * Get the status of an execution.
497
+ */
498
+ status(executionId: string): Promise<{
499
+ steps: PgStatic<_$alepha.TObject<{
500
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
501
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
502
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
503
+ workflowExecutionId: PgAttr<_$alepha.TString, typeof PG_REF>;
504
+ stepName: _$alepha.TString;
505
+ stepIndex: _$alepha.TInteger;
506
+ stepType: PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof PG_DEFAULT>;
507
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
508
+ branchName: _$alepha.TOptional<_$alepha.TString>;
509
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof PG_DEFAULT>;
510
+ attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
511
+ maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
512
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
513
+ error: _$alepha.TOptional<_$alepha.TString>;
514
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
515
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
516
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
517
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
518
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
519
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
520
+ }>, PgRelationMap<_$alepha.TObject<{
521
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
522
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
523
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
524
+ workflowExecutionId: PgAttr<_$alepha.TString, typeof PG_REF>;
525
+ stepName: _$alepha.TString;
526
+ stepIndex: _$alepha.TInteger;
527
+ stepType: PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof PG_DEFAULT>;
528
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
529
+ branchName: _$alepha.TOptional<_$alepha.TString>;
530
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof PG_DEFAULT>;
531
+ attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
532
+ maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
533
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
534
+ error: _$alepha.TOptional<_$alepha.TString>;
535
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
536
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
537
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
538
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
539
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
540
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
541
+ }>>>[];
542
+ tags?: string[] | undefined;
543
+ payload?: _$typebox.StaticRecord<[], "Decode", {}, {
544
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
545
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
546
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
547
+ workflowName: _$alepha.TString;
548
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
549
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
550
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof PG_DEFAULT>;
551
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
552
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
553
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
554
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
555
+ error: _$alepha.TOptional<_$alepha.TString>;
556
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
557
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
558
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
559
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
560
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
561
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
562
+ priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
563
+ }, "^.*$", _$alepha.TAny> | undefined;
564
+ currentStep?: string | undefined;
565
+ startedAt?: string | undefined;
566
+ completedAt?: string | undefined;
567
+ deadlineAt?: string | undefined;
568
+ error?: string | undefined;
569
+ errorStep?: string | undefined;
570
+ triggeredBy?: string | undefined;
571
+ triggeredByName?: string | undefined;
572
+ cancelledBy?: string | undefined;
573
+ cancelledByName?: string | undefined;
574
+ key?: string | null | undefined;
575
+ id: string;
576
+ createdAt: string;
577
+ updatedAt: string;
578
+ workflowName: string;
579
+ status: "pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled";
580
+ priority: number;
581
+ }>;
582
+ }
583
+ declare const $workflow: {
584
+ <TInput extends TSchema>(options: WorkflowPrimitiveOptions<TInput>): WorkflowPrimitive<TInput>;
585
+ [KIND]: typeof WorkflowPrimitive;
586
+ };
587
+ //#endregion
588
+ //#region ../../src/api/workflows/providers/WorkflowProvider.d.ts
589
+ interface WorkflowRegistration$1 {
590
+ name: string;
591
+ options: WorkflowPrimitiveOptions;
592
+ }
593
+ interface CancelOptions {
594
+ compensate?: boolean;
595
+ cancelledBy?: string;
596
+ cancelledByName?: string;
597
+ }
598
+ declare class WorkflowProvider {
599
+ protected readonly alepha: Alepha;
600
+ protected readonly dt: DateTimeProvider;
601
+ protected readonly lockProvider: LockProvider;
602
+ protected readonly config: Readonly<{
603
+ recovery: {
604
+ staleThreshold: number;
605
+ };
606
+ logMaxEntries: number;
607
+ drainTimeout: number;
608
+ defaultStepTimeout: number;
609
+ retentionDays: number;
610
+ maxConcurrentWorkflows: number;
611
+ maxStepsPerWorkflow: number;
612
+ }>;
613
+ protected readonly log: _$alepha_logger0.Logger;
614
+ protected readonly executions: _$alepha_orm0.Repository<_$alepha.TObject<{
615
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
616
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
617
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
618
+ workflowName: _$alepha.TString;
619
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
620
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
621
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
622
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
623
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
624
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
625
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
626
+ error: _$alepha.TOptional<_$alepha.TString>;
627
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
628
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
629
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
630
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
631
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
632
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
633
+ priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
634
+ }>>;
635
+ protected readonly stepExecutions: _$alepha_orm0.Repository<_$alepha.TObject<{
636
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
637
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
638
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
639
+ workflowExecutionId: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
640
+ stepName: _$alepha.TString;
641
+ stepIndex: _$alepha.TInteger;
642
+ stepType: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof _$alepha_orm0.PG_DEFAULT>;
643
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
644
+ branchName: _$alepha.TOptional<_$alepha.TString>;
645
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof _$alepha_orm0.PG_DEFAULT>;
646
+ attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
647
+ maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
648
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
649
+ error: _$alepha.TOptional<_$alepha.TString>;
650
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
651
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
652
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
653
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
654
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
655
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
656
+ }>>;
657
+ protected readonly stepLogs: _$alepha_orm0.Repository<_$alepha.TObject<{
658
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
659
+ logs: _$alepha.TArray<_$alepha.TObject<{
660
+ level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
661
+ message: _$alepha.TString;
662
+ service: _$alepha.TString;
663
+ module: _$alepha.TString;
664
+ context: _$alepha.TOptional<_$alepha.TString>;
665
+ app: _$alepha.TOptional<_$alepha.TString>;
666
+ data: _$alepha.TOptional<_$alepha.TAny>;
667
+ timestamp: _$alepha.TNumber;
668
+ }>>;
669
+ }>>;
670
+ protected readonly workflows: Map<string, WorkflowRegistration$1>;
671
+ protected readonly pausedWorkflows: Set<string>;
672
+ protected readonly inFlight: Set<Promise<void>>;
673
+ protected readonly abortControllers: Map<string, AbortController>;
674
+ protected readonly logs: Map<string, {
675
+ data?: any;
676
+ context?: string | undefined;
677
+ app?: string | undefined;
678
+ level: "SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
679
+ message: string;
680
+ service: string;
681
+ module: string;
682
+ timestamp: number;
683
+ }[]>;
684
+ protected stopping: boolean;
685
+ /**
686
+ * When set, step dispatches go through a queue.
687
+ * Set by WorkflowJobs on start.
688
+ */
689
+ stepDispatch: ((workflowId: string, stepName: string, priority: number) => Promise<void>) | null;
690
+ register(primitive: WorkflowPrimitive<any>): void;
691
+ getRegisteredWorkflows(): Map<string, WorkflowRegistration$1>;
692
+ start(workflowName: string, payload: unknown, options?: WorkflowStartOptions): Promise<string>;
693
+ processStep(workflowId: string, stepName: string): Promise<void>;
694
+ protected processStepInner(workflowId: string, stepName: string): Promise<void>;
695
+ protected executeHandlerStep(workflow: WorkflowExecutionEntity, stepExec: WorkflowStepExecutionEntity, stepDef: HandlerStep): Promise<void>;
696
+ protected handleStepFailure(workflow: WorkflowExecutionEntity, stepExec: WorkflowStepExecutionEntity, stepDef: HandlerStep, error: Error, _context: string): Promise<void>;
697
+ protected advance(workflowId: string): Promise<void>;
698
+ compensate(workflowId: string, context?: {
699
+ failedStep?: string;
700
+ error?: Error;
701
+ }): Promise<void>;
702
+ cancel(workflowId: string, options?: CancelOptions): Promise<void>;
703
+ /**
704
+ * Send a signal to a waiting workflow step.
705
+ */
706
+ signal(workflowId: string, stepName: string, payload?: unknown, signalledBy?: string): Promise<void>;
707
+ retry(workflowId: string): Promise<void>;
708
+ restart(workflowId: string): Promise<string>;
709
+ getExecution(workflowId: string): Promise<{
710
+ steps: _$alepha_orm0.PgStatic<_$alepha.TObject<{
711
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
712
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
713
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
714
+ workflowExecutionId: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
715
+ stepName: _$alepha.TString;
716
+ stepIndex: _$alepha.TInteger;
717
+ stepType: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof _$alepha_orm0.PG_DEFAULT>;
718
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
719
+ branchName: _$alepha.TOptional<_$alepha.TString>;
720
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof _$alepha_orm0.PG_DEFAULT>;
721
+ attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
722
+ maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
723
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
724
+ error: _$alepha.TOptional<_$alepha.TString>;
725
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
726
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
727
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
728
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
729
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
730
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
731
+ }>, _$alepha_orm0.PgRelationMap<_$alepha.TObject<{
732
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
733
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
734
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
735
+ workflowExecutionId: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
736
+ stepName: _$alepha.TString;
737
+ stepIndex: _$alepha.TInteger;
738
+ stepType: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof _$alepha_orm0.PG_DEFAULT>;
739
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
740
+ branchName: _$alepha.TOptional<_$alepha.TString>;
741
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof _$alepha_orm0.PG_DEFAULT>;
742
+ attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
743
+ maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
744
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
745
+ error: _$alepha.TOptional<_$alepha.TString>;
746
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
747
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
748
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
749
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
750
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
751
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
752
+ }>>>[];
753
+ tags?: string[] | undefined;
754
+ payload?: _$typebox.StaticRecord<[], "Decode", {}, {
755
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
756
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
757
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
758
+ workflowName: _$alepha.TString;
759
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
760
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
761
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
762
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
763
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
764
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
765
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
766
+ error: _$alepha.TOptional<_$alepha.TString>;
767
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
768
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
769
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
770
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
771
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
772
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
773
+ priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
774
+ }, "^.*$", _$alepha.TAny> | undefined;
775
+ currentStep?: string | undefined;
776
+ startedAt?: string | undefined;
777
+ completedAt?: string | undefined;
778
+ deadlineAt?: string | undefined;
779
+ error?: string | undefined;
780
+ errorStep?: string | undefined;
781
+ triggeredBy?: string | undefined;
782
+ triggeredByName?: string | undefined;
783
+ cancelledBy?: string | undefined;
784
+ cancelledByName?: string | undefined;
785
+ key?: string | null | undefined;
786
+ id: string;
787
+ createdAt: string;
788
+ updatedAt: string;
789
+ workflowName: string;
790
+ status: "pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled";
791
+ priority: number;
792
+ }>;
793
+ pauseWorkflow(name: string): void;
794
+ resumeWorkflow(name: string): Promise<void>;
795
+ isWorkflowPaused(name: string): boolean;
796
+ getPausedWorkflows(): string[];
797
+ protected dispatchStep(workflowId: string, stepName: string, priority: number): Promise<void>;
798
+ protected assembleResults(workflowId: string): Promise<Record<string, unknown>>;
799
+ protected findStepExecution(workflowId: string, stepName: string): Promise<WorkflowStepExecutionEntity | undefined>;
800
+ protected computeBackoff(retryOpts: WorkflowRetryOptions, attempt: number): string;
801
+ protected writeLogs(stepExecutionId: string, context: string): Promise<void>;
802
+ protected getRegistration(name: string): WorkflowRegistration$1;
803
+ recoverySweep(): Promise<void>;
804
+ timeoutSweep(): Promise<void>;
805
+ purge(): Promise<void>;
806
+ protected readonly onStart: _$alepha.HookPrimitive<"start">;
807
+ protected readonly onStop: _$alepha.HookPrimitive<"stop">;
808
+ }
809
+ //#endregion
810
+ //#region ../../src/api/workflows/schemas/workflowActivitySchema.d.ts
811
+ declare const workflowActivityPointSchema: _$alepha.TObject<{
812
+ date: _$alepha.TString;
813
+ completed: _$alepha.TInteger;
814
+ failed: _$alepha.TInteger;
815
+ }>;
816
+ type WorkflowActivityPoint = Static<typeof workflowActivityPointSchema>;
817
+ declare const workflowActivityQuerySchema: _$alepha.TObject<{
818
+ days: _$alepha.TOptional<_$alepha.TInteger>;
819
+ }>;
820
+ type WorkflowActivityQuery = Static<typeof workflowActivityQuerySchema>;
821
+ //#endregion
822
+ //#region ../../src/api/workflows/schemas/workflowExecutionQuerySchema.d.ts
823
+ declare const workflowExecutionQuerySchema: _$alepha.TObject<{
824
+ page: _$alepha.TOptional<_$alepha.TInteger>;
825
+ size: _$alepha.TOptional<_$alepha.TInteger>;
826
+ sort: _$alepha.TOptional<_$alepha.TString>;
827
+ workflow: _$alepha.TOptional<_$alepha.TString>;
828
+ status: _$alepha.TOptional<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">>;
829
+ from: _$alepha.TOptional<_$alepha.TString>;
830
+ to: _$alepha.TOptional<_$alepha.TString>;
831
+ }>;
832
+ type WorkflowExecutionQuery = Static<typeof workflowExecutionQuerySchema>;
833
+ //#endregion
834
+ //#region ../../src/api/workflows/schemas/workflowExecutionResourceSchema.d.ts
835
+ declare const workflowExecutionCanSchema: _$alepha.TObject<{
836
+ retry: _$alepha.TBoolean;
837
+ cancel: _$alepha.TBoolean;
838
+ compensate: _$alepha.TBoolean;
839
+ restart: _$alepha.TBoolean;
840
+ signal: _$alepha.TOptional<_$alepha.TObject<{
841
+ stepName: _$alepha.TString;
842
+ schema: _$alepha.TOptional<_$alepha.TAny>;
843
+ }>>;
844
+ }>;
845
+ type WorkflowExecutionCan = Static<typeof workflowExecutionCanSchema>;
846
+ declare const workflowExecutionResourceSchema: _$alepha.TObject<{
847
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
848
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
849
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
850
+ workflowName: _$alepha.TString;
851
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
852
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
853
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof PG_DEFAULT>;
854
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
855
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
856
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
857
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
858
+ error: _$alepha.TOptional<_$alepha.TString>;
859
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
860
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
861
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
862
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
863
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
864
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
865
+ priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
866
+ can: _$alepha.TObject<{
867
+ retry: _$alepha.TBoolean;
868
+ cancel: _$alepha.TBoolean;
869
+ compensate: _$alepha.TBoolean;
870
+ restart: _$alepha.TBoolean;
871
+ signal: _$alepha.TOptional<_$alepha.TObject<{
872
+ stepName: _$alepha.TString;
873
+ schema: _$alepha.TOptional<_$alepha.TAny>;
874
+ }>>;
875
+ }>;
876
+ }>;
877
+ type WorkflowExecutionResource = Static<typeof workflowExecutionResourceSchema>;
878
+ //#endregion
879
+ //#region ../../src/api/workflows/schemas/workflowRegistrationSchema.d.ts
880
+ declare const workflowRegistrationSchema: _$alepha.TObject<{
881
+ name: _$alepha.TString;
882
+ stepCount: _$alepha.TInteger;
883
+ steps: _$alepha.TArray<_$alepha.TObject<{
884
+ name: _$alepha.TString;
885
+ type: _$alepha.TUnsafe<"handler" | "signal" | "parallel">;
886
+ hasCompensate: _$alepha.TBoolean;
887
+ hasRetry: _$alepha.TBoolean;
888
+ timeout: _$alepha.TOptional<_$alepha.TString>;
889
+ }>>;
890
+ onError: _$alepha.TUnsafe<"compensate" | "fail">;
891
+ timeout: _$alepha.TOptional<_$alepha.TString>;
892
+ priority: _$alepha.TString;
893
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
894
+ paused: _$alepha.TBoolean;
895
+ running: _$alepha.TInteger;
896
+ pending: _$alepha.TInteger;
897
+ waiting: _$alepha.TInteger;
898
+ failed: _$alepha.TInteger;
899
+ }>;
900
+ type WorkflowRegistration = Static<typeof workflowRegistrationSchema>;
901
+ //#endregion
902
+ //#region ../../src/api/workflows/schemas/workflowStatsSchema.d.ts
903
+ declare const workflowStatsSchema: _$alepha.TObject<{
904
+ registered: _$alepha.TInteger;
905
+ running: _$alepha.TInteger;
906
+ pending: _$alepha.TInteger;
907
+ waiting: _$alepha.TInteger;
908
+ completed: _$alepha.TInteger;
909
+ failed: _$alepha.TInteger;
910
+ compensated: _$alepha.TInteger;
911
+ compensationFailed: _$alepha.TInteger;
912
+ cancelled: _$alepha.TInteger;
913
+ timedOut: _$alepha.TInteger;
914
+ }>;
915
+ type WorkflowStats = Static<typeof workflowStatsSchema>;
916
+ //#endregion
917
+ //#region ../../src/api/workflows/services/WorkflowService.d.ts
918
+ declare class WorkflowService {
919
+ protected readonly alepha: Alepha;
920
+ protected readonly dt: DateTimeProvider;
921
+ protected readonly log: _$alepha_logger0.Logger;
922
+ protected readonly workflowProvider: WorkflowProvider;
923
+ protected readonly database: DatabaseProvider;
924
+ protected readonly executions: _$alepha_orm0.Repository<_$alepha.TObject<{
925
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
926
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
927
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
928
+ workflowName: _$alepha.TString;
929
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
930
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
931
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
932
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
933
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
934
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
935
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
936
+ error: _$alepha.TOptional<_$alepha.TString>;
937
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
938
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
939
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
940
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
941
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
942
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
943
+ priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
944
+ }>>;
945
+ protected readonly stepExecutions: _$alepha_orm0.Repository<_$alepha.TObject<{
946
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
947
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
948
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
949
+ workflowExecutionId: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
950
+ stepName: _$alepha.TString;
951
+ stepIndex: _$alepha.TInteger;
952
+ stepType: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof _$alepha_orm0.PG_DEFAULT>;
953
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
954
+ branchName: _$alepha.TOptional<_$alepha.TString>;
955
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof _$alepha_orm0.PG_DEFAULT>;
956
+ attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
957
+ maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
958
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
959
+ error: _$alepha.TOptional<_$alepha.TString>;
960
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
961
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
962
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
963
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
964
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
965
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
966
+ }>>;
967
+ /**
968
+ * Compute available actions for a workflow execution based on its status.
969
+ */
970
+ protected computeCan(status: string, signalStepName?: string): WorkflowExecutionCan;
971
+ /**
972
+ * Convert an ISO date string to the raw SQL parameter format
973
+ * expected by the current database dialect.
974
+ *
975
+ * - PostgreSQL: ISO string (timestamp comparison)
976
+ * - SQLite: epoch milliseconds (integer comparison)
977
+ */
978
+ protected toRawDate(iso: string): string | number;
979
+ /**
980
+ * Get aggregate stats for the workflow engine.
981
+ */
982
+ getStats(days?: number): Promise<WorkflowStats>;
983
+ /**
984
+ * Get the full workflow registry with live counts.
985
+ */
986
+ getRegistry(): Promise<WorkflowRegistration[]>;
987
+ /**
988
+ * Paginated query for workflow executions.
989
+ */
990
+ findExecutions(query?: WorkflowExecutionQuery): Promise<{
991
+ content: {
992
+ can: {
993
+ signal?: {
994
+ schema?: any;
995
+ stepName: string;
996
+ } | undefined;
997
+ retry: boolean;
998
+ cancel: boolean;
999
+ compensate: boolean;
1000
+ restart: boolean;
1001
+ };
1002
+ tags?: string[] | undefined;
1003
+ payload?: _$typebox.StaticRecord<[], "Decode", {}, {
1004
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
1005
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1006
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1007
+ workflowName: _$alepha.TString;
1008
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
1009
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1010
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
1011
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
1012
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1013
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1014
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1015
+ error: _$alepha.TOptional<_$alepha.TString>;
1016
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
1017
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
1018
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
1019
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
1020
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
1021
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
1022
+ priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
1023
+ }, "^.*$", _$alepha.TAny> | undefined;
1024
+ currentStep?: string | undefined;
1025
+ startedAt?: string | undefined;
1026
+ completedAt?: string | undefined;
1027
+ deadlineAt?: string | undefined;
1028
+ error?: string | undefined;
1029
+ errorStep?: string | undefined;
1030
+ triggeredBy?: string | undefined;
1031
+ triggeredByName?: string | undefined;
1032
+ cancelledBy?: string | undefined;
1033
+ cancelledByName?: string | undefined;
1034
+ key?: string | null | undefined;
1035
+ id: string;
1036
+ createdAt: string;
1037
+ updatedAt: string;
1038
+ workflowName: string;
1039
+ status: "pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled";
1040
+ priority: number;
1041
+ }[];
1042
+ page: _$alepha.StaticDecode<typeof _$alepha.pageMetadataSchema>;
1043
+ }>;
1044
+ /**
1045
+ * Get a single workflow execution with step details.
1046
+ */
1047
+ getExecution(id: string): Promise<{
1048
+ can: {
1049
+ signal?: {
1050
+ schema?: any;
1051
+ stepName: string;
1052
+ } | undefined;
1053
+ retry: boolean;
1054
+ cancel: boolean;
1055
+ compensate: boolean;
1056
+ restart: boolean;
1057
+ };
1058
+ steps: _$alepha_orm0.PgStatic<_$alepha.TObject<{
1059
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
1060
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1061
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1062
+ workflowExecutionId: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
1063
+ stepName: _$alepha.TString;
1064
+ stepIndex: _$alepha.TInteger;
1065
+ stepType: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof _$alepha_orm0.PG_DEFAULT>;
1066
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
1067
+ branchName: _$alepha.TOptional<_$alepha.TString>;
1068
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof _$alepha_orm0.PG_DEFAULT>;
1069
+ attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
1070
+ maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
1071
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1072
+ error: _$alepha.TOptional<_$alepha.TString>;
1073
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1074
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1075
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1076
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1077
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
1078
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
1079
+ }>, _$alepha_orm0.PgRelationMap<_$alepha.TObject<{
1080
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
1081
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1082
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1083
+ workflowExecutionId: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
1084
+ stepName: _$alepha.TString;
1085
+ stepIndex: _$alepha.TInteger;
1086
+ stepType: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof _$alepha_orm0.PG_DEFAULT>;
1087
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
1088
+ branchName: _$alepha.TOptional<_$alepha.TString>;
1089
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof _$alepha_orm0.PG_DEFAULT>;
1090
+ attempt: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
1091
+ maxAttempts: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
1092
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1093
+ error: _$alepha.TOptional<_$alepha.TString>;
1094
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1095
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1096
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1097
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1098
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
1099
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
1100
+ }>>>[];
1101
+ tags?: string[] | undefined;
1102
+ payload?: _$typebox.StaticRecord<[], "Decode", {}, {
1103
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
1104
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1105
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
1106
+ workflowName: _$alepha.TString;
1107
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
1108
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1109
+ status: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof _$alepha_orm0.PG_DEFAULT>;
1110
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
1111
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1112
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1113
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1114
+ error: _$alepha.TOptional<_$alepha.TString>;
1115
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
1116
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
1117
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
1118
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
1119
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
1120
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
1121
+ priority: _$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_DEFAULT>;
1122
+ }, "^.*$", _$alepha.TAny> | undefined;
1123
+ currentStep?: string | undefined;
1124
+ startedAt?: string | undefined;
1125
+ completedAt?: string | undefined;
1126
+ deadlineAt?: string | undefined;
1127
+ error?: string | undefined;
1128
+ errorStep?: string | undefined;
1129
+ triggeredBy?: string | undefined;
1130
+ triggeredByName?: string | undefined;
1131
+ cancelledBy?: string | undefined;
1132
+ cancelledByName?: string | undefined;
1133
+ key?: string | null | undefined;
1134
+ id: string;
1135
+ createdAt: string;
1136
+ updatedAt: string;
1137
+ workflowName: string;
1138
+ status: "pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled";
1139
+ priority: number;
1140
+ }>;
1141
+ /**
1142
+ * Get daily activity (completed/failed) over a date range.
1143
+ */
1144
+ getActivity(days?: number): Promise<WorkflowActivityPoint[]>;
1145
+ /**
1146
+ * Start a new workflow execution by name.
1147
+ */
1148
+ triggerWorkflow(name: string, payload?: Record<string, unknown>, options?: {
1149
+ key?: string;
1150
+ tags?: string[];
1151
+ triggeredBy?: string;
1152
+ triggeredByName?: string;
1153
+ }): Promise<{
1154
+ id: string;
1155
+ }>;
1156
+ /**
1157
+ * Cancel a running workflow execution.
1158
+ */
1159
+ cancelExecution(id: string, context?: {
1160
+ compensate?: boolean;
1161
+ cancelledBy?: string;
1162
+ cancelledByName?: string;
1163
+ }): Promise<{
1164
+ ok: boolean;
1165
+ }>;
1166
+ /**
1167
+ * Retry a failed/timed-out workflow from the failed step.
1168
+ */
1169
+ retryExecution(id: string): Promise<{
1170
+ ok: boolean;
1171
+ }>;
1172
+ /**
1173
+ * Restart a terminal workflow as a new execution.
1174
+ */
1175
+ restartExecution(id: string): Promise<{
1176
+ id: string;
1177
+ }>;
1178
+ /**
1179
+ * Trigger compensation on a failed/timed-out workflow.
1180
+ */
1181
+ compensateExecution(id: string): Promise<{
1182
+ ok: boolean;
1183
+ }>;
1184
+ /**
1185
+ * Send a signal to a waiting workflow step.
1186
+ */
1187
+ signalExecution(id: string, stepName: string, payload?: Record<string, unknown>, signalledBy?: string): Promise<{
1188
+ ok: boolean;
1189
+ }>;
1190
+ }
1191
+ //#endregion
1192
+ //#region ../../src/api/workflows/controllers/AdminWorkflowController.d.ts
1193
+ declare class AdminWorkflowController {
1194
+ protected readonly url: string;
1195
+ protected readonly group: string;
1196
+ protected readonly workflowService: WorkflowService;
1197
+ readonly getRegistry: _$alepha_server0.ActionPrimitiveFn<{
1198
+ response: _$alepha.TArray<_$alepha.TObject<{
1199
+ name: _$alepha.TString;
1200
+ stepCount: _$alepha.TInteger;
1201
+ steps: _$alepha.TArray<_$alepha.TObject<{
1202
+ name: _$alepha.TString;
1203
+ type: _$alepha.TUnsafe<"handler" | "signal" | "parallel">;
1204
+ hasCompensate: _$alepha.TBoolean;
1205
+ hasRetry: _$alepha.TBoolean;
1206
+ timeout: _$alepha.TOptional<_$alepha.TString>;
1207
+ }>>;
1208
+ onError: _$alepha.TUnsafe<"compensate" | "fail">;
1209
+ timeout: _$alepha.TOptional<_$alepha.TString>;
1210
+ priority: _$alepha.TString;
1211
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
1212
+ paused: _$alepha.TBoolean;
1213
+ running: _$alepha.TInteger;
1214
+ pending: _$alepha.TInteger;
1215
+ waiting: _$alepha.TInteger;
1216
+ failed: _$alepha.TInteger;
1217
+ }>>;
1218
+ }>;
1219
+ readonly getStats: _$alepha_server0.ActionPrimitiveFn<{
1220
+ query: _$alepha.TObject<{
1221
+ days: _$alepha.TOptional<_$alepha.TInteger>;
1222
+ }>;
1223
+ response: _$alepha.TObject<{
1224
+ registered: _$alepha.TInteger;
1225
+ running: _$alepha.TInteger;
1226
+ pending: _$alepha.TInteger;
1227
+ waiting: _$alepha.TInteger;
1228
+ completed: _$alepha.TInteger;
1229
+ failed: _$alepha.TInteger;
1230
+ compensated: _$alepha.TInteger;
1231
+ compensationFailed: _$alepha.TInteger;
1232
+ cancelled: _$alepha.TInteger;
1233
+ timedOut: _$alepha.TInteger;
1234
+ }>;
1235
+ }>;
1236
+ readonly getActivity: _$alepha_server0.ActionPrimitiveFn<{
1237
+ query: _$alepha.TObject<{
1238
+ days: _$alepha.TOptional<_$alepha.TInteger>;
1239
+ }>;
1240
+ response: _$alepha.TArray<_$alepha.TObject<{
1241
+ date: _$alepha.TString;
1242
+ completed: _$alepha.TInteger;
1243
+ failed: _$alepha.TInteger;
1244
+ }>>;
1245
+ }>;
1246
+ readonly findExecutions: _$alepha_server0.ActionPrimitiveFn<{
1247
+ query: _$alepha.TObject<{
1248
+ page: _$alepha.TOptional<_$alepha.TInteger>;
1249
+ size: _$alepha.TOptional<_$alepha.TInteger>;
1250
+ sort: _$alepha.TOptional<_$alepha.TString>;
1251
+ workflow: _$alepha.TOptional<_$alepha.TString>;
1252
+ status: _$alepha.TOptional<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">>;
1253
+ from: _$alepha.TOptional<_$alepha.TString>;
1254
+ to: _$alepha.TOptional<_$alepha.TString>;
1255
+ }>;
1256
+ response: _$alepha.TPage<_$alepha.TObject<{
1257
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1258
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1259
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1260
+ workflowName: _$alepha.TString;
1261
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
1262
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1263
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof PG_DEFAULT>;
1264
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
1265
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1266
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1267
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1268
+ error: _$alepha.TOptional<_$alepha.TString>;
1269
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
1270
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
1271
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
1272
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
1273
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
1274
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
1275
+ priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1276
+ can: _$alepha.TObject<{
1277
+ retry: _$alepha.TBoolean;
1278
+ cancel: _$alepha.TBoolean;
1279
+ compensate: _$alepha.TBoolean;
1280
+ restart: _$alepha.TBoolean;
1281
+ signal: _$alepha.TOptional<_$alepha.TObject<{
1282
+ stepName: _$alepha.TString;
1283
+ schema: _$alepha.TOptional<_$alepha.TAny>;
1284
+ }>>;
1285
+ }>;
1286
+ }>>;
1287
+ }>;
1288
+ readonly getExecution: _$alepha_server0.ActionPrimitiveFn<{
1289
+ params: _$alepha.TObject<{
1290
+ id: _$alepha.TString;
1291
+ }>;
1292
+ response: _$alepha.TObject<{
1293
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1294
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1295
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1296
+ workflowName: _$alepha.TString;
1297
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
1298
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1299
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof PG_DEFAULT>;
1300
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
1301
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1302
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1303
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1304
+ error: _$alepha.TOptional<_$alepha.TString>;
1305
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
1306
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
1307
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
1308
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
1309
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
1310
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
1311
+ priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1312
+ can: _$alepha.TObject<{
1313
+ retry: _$alepha.TBoolean;
1314
+ cancel: _$alepha.TBoolean;
1315
+ compensate: _$alepha.TBoolean;
1316
+ restart: _$alepha.TBoolean;
1317
+ signal: _$alepha.TOptional<_$alepha.TObject<{
1318
+ stepName: _$alepha.TString;
1319
+ schema: _$alepha.TOptional<_$alepha.TAny>;
1320
+ }>>;
1321
+ }>;
1322
+ steps: _$alepha.TArray<_$alepha.TObject<{
1323
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1324
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1325
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1326
+ workflowExecutionId: PgAttr<_$alepha.TString, typeof PG_REF>;
1327
+ stepName: _$alepha.TString;
1328
+ stepIndex: _$alepha.TInteger;
1329
+ stepType: PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof PG_DEFAULT>;
1330
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
1331
+ branchName: _$alepha.TOptional<_$alepha.TString>;
1332
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof PG_DEFAULT>;
1333
+ attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1334
+ maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1335
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1336
+ error: _$alepha.TOptional<_$alepha.TString>;
1337
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1338
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1339
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1340
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1341
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
1342
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
1343
+ }>>;
1344
+ }>;
1345
+ }>;
1346
+ readonly startWorkflow: _$alepha_server0.ActionPrimitiveFn<{
1347
+ body: _$alepha.TObject<{
1348
+ name: _$alepha.TString;
1349
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1350
+ key: _$alepha.TOptional<_$alepha.TString>;
1351
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
1352
+ }>;
1353
+ response: _$alepha.TObject<{
1354
+ id: _$alepha.TString;
1355
+ }>;
1356
+ }>;
1357
+ readonly signalStep: _$alepha_server0.ActionPrimitiveFn<{
1358
+ params: _$alepha.TObject<{
1359
+ id: _$alepha.TString;
1360
+ }>;
1361
+ body: _$alepha.TObject<{
1362
+ stepName: _$alepha.TString;
1363
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1364
+ }>;
1365
+ response: _$alepha.TObject<{
1366
+ ok: _$alepha.TBoolean;
1367
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
1368
+ count: _$alepha.TOptional<_$alepha.TNumber>;
1369
+ }>;
1370
+ }>;
1371
+ readonly cancelExecution: _$alepha_server0.ActionPrimitiveFn<{
1372
+ params: _$alepha.TObject<{
1373
+ id: _$alepha.TString;
1374
+ }>;
1375
+ response: _$alepha.TObject<{
1376
+ ok: _$alepha.TBoolean;
1377
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
1378
+ count: _$alepha.TOptional<_$alepha.TNumber>;
1379
+ }>;
1380
+ }>;
1381
+ readonly retryExecution: _$alepha_server0.ActionPrimitiveFn<{
1382
+ params: _$alepha.TObject<{
1383
+ id: _$alepha.TString;
1384
+ }>;
1385
+ response: _$alepha.TObject<{
1386
+ ok: _$alepha.TBoolean;
1387
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
1388
+ count: _$alepha.TOptional<_$alepha.TNumber>;
1389
+ }>;
1390
+ }>;
1391
+ readonly restartExecution: _$alepha_server0.ActionPrimitiveFn<{
1392
+ params: _$alepha.TObject<{
1393
+ id: _$alepha.TString;
1394
+ }>;
1395
+ response: _$alepha.TObject<{
1396
+ id: _$alepha.TString;
1397
+ }>;
1398
+ }>;
1399
+ readonly compensateExecution: _$alepha_server0.ActionPrimitiveFn<{
1400
+ params: _$alepha.TObject<{
1401
+ id: _$alepha.TString;
1402
+ }>;
1403
+ response: _$alepha.TObject<{
1404
+ ok: _$alepha.TBoolean;
1405
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
1406
+ count: _$alepha.TOptional<_$alepha.TNumber>;
1407
+ }>;
1408
+ }>;
1409
+ }
1410
+ //#endregion
1411
+ //#region ../../src/api/workflows/entities/workflowStepLogs.d.ts
1412
+ declare const workflowStepLogs: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
1413
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
1414
+ logs: _$alepha.TArray<_$alepha.TObject<{
1415
+ level: _$alepha.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
1416
+ message: _$alepha.TString;
1417
+ service: _$alepha.TString;
1418
+ module: _$alepha.TString;
1419
+ context: _$alepha.TOptional<_$alepha.TString>;
1420
+ app: _$alepha.TOptional<_$alepha.TString>;
1421
+ data: _$alepha.TOptional<_$alepha.TAny>;
1422
+ timestamp: _$alepha.TNumber;
1423
+ }>>;
1424
+ }>>;
1425
+ type WorkflowStepLogEntity = Static<typeof workflowStepLogs.schema>;
1426
+ //#endregion
1427
+ //#region ../../src/api/workflows/schemas/workflowConfigAtom.d.ts
1428
+ declare const workflowConfig: _$alepha.Atom<_$alepha.TObject<{
1429
+ defaultStepTimeout: _$alepha.TInteger;
1430
+ retentionDays: _$alepha.TInteger;
1431
+ recovery: _$alepha.TObject<{
1432
+ staleThreshold: _$alepha.TInteger;
1433
+ }>;
1434
+ maxConcurrentWorkflows: _$alepha.TInteger;
1435
+ maxStepsPerWorkflow: _$alepha.TInteger;
1436
+ drainTimeout: _$alepha.TInteger;
1437
+ logMaxEntries: _$alepha.TInteger;
1438
+ }>, "alepha.workflows">;
1439
+ type WorkflowConfig = Static<typeof workflowConfig.schema>;
1440
+ declare module "alepha" {
1441
+ interface State {
1442
+ [workflowConfig.key]: WorkflowConfig;
1443
+ }
1444
+ } //# sourceMappingURL=workflowConfigAtom.d.ts.map
1445
+ //#endregion
1446
+ //#region ../../src/api/workflows/schemas/workflowExecutionDetailSchema.d.ts
1447
+ declare const workflowExecutionDetailSchema: _$alepha.TObject<{
1448
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1449
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1450
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1451
+ workflowName: _$alepha.TString;
1452
+ tags: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
1453
+ payload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1454
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "waiting_for_signal" | "completed" | "failed" | "timed_out" | "compensating" | "compensated" | "compensation_failed" | "cancelled">, typeof PG_DEFAULT>;
1455
+ currentStep: _$alepha.TOptional<_$alepha.TString>;
1456
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1457
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1458
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1459
+ error: _$alepha.TOptional<_$alepha.TString>;
1460
+ errorStep: _$alepha.TOptional<_$alepha.TString>;
1461
+ triggeredBy: _$alepha.TOptional<_$alepha.TString>;
1462
+ triggeredByName: _$alepha.TOptional<_$alepha.TString>;
1463
+ cancelledBy: _$alepha.TOptional<_$alepha.TString>;
1464
+ cancelledByName: _$alepha.TOptional<_$alepha.TString>;
1465
+ key: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TNull, _$alepha.TString]>>;
1466
+ priority: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1467
+ can: _$alepha.TObject<{
1468
+ retry: _$alepha.TBoolean;
1469
+ cancel: _$alepha.TBoolean;
1470
+ compensate: _$alepha.TBoolean;
1471
+ restart: _$alepha.TBoolean;
1472
+ signal: _$alepha.TOptional<_$alepha.TObject<{
1473
+ stepName: _$alepha.TString;
1474
+ schema: _$alepha.TOptional<_$alepha.TAny>;
1475
+ }>>;
1476
+ }>;
1477
+ steps: _$alepha.TArray<_$alepha.TObject<{
1478
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1479
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1480
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1481
+ workflowExecutionId: PgAttr<_$alepha.TString, typeof PG_REF>;
1482
+ stepName: _$alepha.TString;
1483
+ stepIndex: _$alepha.TInteger;
1484
+ stepType: PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof PG_DEFAULT>;
1485
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
1486
+ branchName: _$alepha.TOptional<_$alepha.TString>;
1487
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof PG_DEFAULT>;
1488
+ attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1489
+ maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1490
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1491
+ error: _$alepha.TOptional<_$alepha.TString>;
1492
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1493
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1494
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1495
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1496
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
1497
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
1498
+ }>>;
1499
+ }>;
1500
+ type WorkflowExecutionDetail = Static<typeof workflowExecutionDetailSchema>;
1501
+ //#endregion
1502
+ //#region ../../src/api/workflows/schemas/workflowStepExecutionResourceSchema.d.ts
1503
+ declare const workflowStepExecutionResourceSchema: _$alepha.TObject<{
1504
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1505
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1506
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1507
+ workflowExecutionId: PgAttr<_$alepha.TString, typeof PG_REF>;
1508
+ stepName: _$alepha.TString;
1509
+ stepIndex: _$alepha.TInteger;
1510
+ stepType: PgAttr<_$alepha.TUnsafe<"handler" | "signal" | "parallel">, typeof PG_DEFAULT>;
1511
+ parentStepId: _$alepha.TOptional<_$alepha.TString>;
1512
+ branchName: _$alepha.TOptional<_$alepha.TString>;
1513
+ status: PgAttr<_$alepha.TUnsafe<"pending" | "running" | "completed" | "failed" | "compensating" | "compensated" | "compensation_failed" | "cancelled" | "skipped" | "waiting">, typeof PG_DEFAULT>;
1514
+ attempt: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1515
+ maxAttempts: PgAttr<_$alepha.TInteger, typeof PG_DEFAULT>;
1516
+ result: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1517
+ error: _$alepha.TOptional<_$alepha.TString>;
1518
+ startedAt: _$alepha.TOptional<_$alepha.TString>;
1519
+ completedAt: _$alepha.TOptional<_$alepha.TString>;
1520
+ deadlineAt: _$alepha.TOptional<_$alepha.TString>;
1521
+ signalPayload: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
1522
+ signalledBy: _$alepha.TOptional<_$alepha.TString>;
1523
+ signalledAt: _$alepha.TOptional<_$alepha.TString>;
1524
+ }>;
1525
+ type WorkflowStepExecutionResource = Static<typeof workflowStepExecutionResourceSchema>;
1526
+ //#endregion
1527
+ //#region ../../src/api/workflows/index.d.ts
1528
+ declare module "alepha" {
1529
+ interface Hooks {
1530
+ "workflow:started": {
1531
+ workflowName: string;
1532
+ workflowId: string;
1533
+ };
1534
+ "workflow:step:begin": {
1535
+ workflowName: string;
1536
+ workflowId: string;
1537
+ stepName: string;
1538
+ };
1539
+ "workflow:step:completed": {
1540
+ workflowName: string;
1541
+ workflowId: string;
1542
+ stepName: string;
1543
+ result: unknown;
1544
+ };
1545
+ "workflow:step:failed": {
1546
+ workflowName: string;
1547
+ workflowId: string;
1548
+ stepName: string;
1549
+ error: Error;
1550
+ };
1551
+ "workflow:step:skipped": {
1552
+ workflowName: string;
1553
+ workflowId: string;
1554
+ stepName: string;
1555
+ };
1556
+ "workflow:signal:received": {
1557
+ workflowName: string;
1558
+ workflowId: string;
1559
+ stepName: string;
1560
+ payload: unknown;
1561
+ };
1562
+ "workflow:signal:timeout": {
1563
+ workflowName: string;
1564
+ workflowId: string;
1565
+ stepName: string;
1566
+ };
1567
+ "workflow:completed": {
1568
+ workflowName: string;
1569
+ workflowId: string;
1570
+ };
1571
+ "workflow:failed": {
1572
+ workflowName: string;
1573
+ workflowId: string;
1574
+ error: Error;
1575
+ stepName: string;
1576
+ };
1577
+ "workflow:compensating": {
1578
+ workflowName: string;
1579
+ workflowId: string;
1580
+ stepName: string;
1581
+ };
1582
+ "workflow:compensated": {
1583
+ workflowName: string;
1584
+ workflowId: string;
1585
+ };
1586
+ "workflow:compensation:failed": {
1587
+ workflowName: string;
1588
+ workflowId: string;
1589
+ stepName: string;
1590
+ error: Error;
1591
+ };
1592
+ "workflow:cancelled": {
1593
+ workflowName: string;
1594
+ workflowId: string;
1595
+ };
1596
+ "workflow:timed_out": {
1597
+ workflowName: string;
1598
+ workflowId: string;
1599
+ };
1600
+ }
1601
+ }
1602
+ /**
1603
+ * Durable workflow engine for long-running business processes.
1604
+ *
1605
+ * **Features:**
1606
+ * - Declarative, multi-step workflows with typed payloads
1607
+ * - Saga-pattern compensation for failure recovery
1608
+ * - Per-step retry with exponential backoff
1609
+ * - Workflow-level timeout and cancellation
1610
+ * - Deduplication via unique keys
1611
+ * - Per-execution log capture
1612
+ *
1613
+ * @module alepha.api.workflows
1614
+ */
1615
+ declare const AlephaApiWorkflows: _$alepha.Service<_$alepha.Module>;
1616
+ //#endregion
1617
+ export { $workflow, AdminWorkflowController, AlephaApiWorkflows, CancelOptions, HandlerStep, StepCompensateArgs, StepConditionArgs, StepHandlerArgs, WorkflowActivityPoint, WorkflowActivityQuery, WorkflowConfig, WorkflowExecutionCan, WorkflowExecutionDetail, WorkflowExecutionEntity, WorkflowExecutionQuery, WorkflowExecutionResource, WorkflowPrimitive, WorkflowPrimitiveOptions, WorkflowPriority, WorkflowProvider, WorkflowRegistration, WorkflowRetryBackoff, WorkflowRetryOptions, WorkflowService, WorkflowStartOptions, WorkflowStats, WorkflowStatus, WorkflowStep, WorkflowStepExecutionEntity, WorkflowStepExecutionResource, WorkflowStepLogEntity, WorkflowStepStatus, workflowActivityPointSchema, workflowActivityQuerySchema, workflowConfig, workflowExecutionCanSchema, workflowExecutionDetailSchema, workflowExecutionQuerySchema, workflowExecutionResourceSchema, workflowExecutions, workflowRegistrationSchema, workflowStatsSchema, workflowStepExecutionResourceSchema, workflowStepExecutions, workflowStepLogs };
1618
+ //# sourceMappingURL=index.d.ts.map