alepha 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/api-jobs/index.d.ts +26 -26
  2. package/dist/api-users/index.d.ts +1 -1
  3. package/dist/cli/{dist-Sz2EXvQX.cjs → dist-Dl9Vl7Ur.js} +17 -13
  4. package/dist/cli/{dist-BBPjuQ56.js.map → dist-Dl9Vl7Ur.js.map} +1 -1
  5. package/dist/cli/index.d.ts +3 -11
  6. package/dist/cli/index.js +106 -74
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/email/index.js +71 -73
  9. package/dist/email/index.js.map +1 -1
  10. package/dist/orm/index.d.ts +1 -1
  11. package/dist/orm/index.js.map +1 -1
  12. package/dist/queue/index.d.ts +4 -4
  13. package/dist/retry/index.d.ts +1 -1
  14. package/dist/retry/index.js +2 -2
  15. package/dist/retry/index.js.map +1 -1
  16. package/dist/scheduler/index.d.ts +6 -6
  17. package/dist/security/index.d.ts +28 -28
  18. package/dist/server/index.js +1 -1
  19. package/dist/server/index.js.map +1 -1
  20. package/dist/server-health/index.d.ts +17 -17
  21. package/dist/server-metrics/index.js +170 -174
  22. package/dist/server-metrics/index.js.map +1 -1
  23. package/dist/server-security/index.d.ts +9 -9
  24. package/dist/vite/index.js +4 -5
  25. package/dist/vite/index.js.map +1 -1
  26. package/dist/websocket/index.d.ts +7 -7
  27. package/package.json +52 -103
  28. package/src/cli/apps/AlephaPackageBuilderCli.ts +7 -2
  29. package/src/cli/assets/appRouterTs.ts +9 -0
  30. package/src/cli/assets/indexHtml.ts +2 -1
  31. package/src/cli/assets/mainBrowserTs.ts +10 -0
  32. package/src/cli/commands/CoreCommands.ts +6 -5
  33. package/src/cli/commands/DrizzleCommands.ts +65 -57
  34. package/src/cli/commands/VerifyCommands.ts +1 -1
  35. package/src/cli/services/ProjectUtils.ts +44 -38
  36. package/src/orm/providers/DrizzleKitProvider.ts +1 -1
  37. package/src/retry/descriptors/$retry.ts +5 -3
  38. package/src/server/providers/NodeHttpServerProvider.ts +1 -1
  39. package/src/vite/helpers/boot.ts +3 -3
  40. package/dist/api-files/index.cjs +0 -1293
  41. package/dist/api-files/index.cjs.map +0 -1
  42. package/dist/api-files/index.d.cts +0 -829
  43. package/dist/api-jobs/index.cjs +0 -274
  44. package/dist/api-jobs/index.cjs.map +0 -1
  45. package/dist/api-jobs/index.d.cts +0 -654
  46. package/dist/api-notifications/index.cjs +0 -380
  47. package/dist/api-notifications/index.cjs.map +0 -1
  48. package/dist/api-notifications/index.d.cts +0 -289
  49. package/dist/api-parameters/index.cjs +0 -66
  50. package/dist/api-parameters/index.cjs.map +0 -1
  51. package/dist/api-parameters/index.d.cts +0 -84
  52. package/dist/api-users/index.cjs +0 -6009
  53. package/dist/api-users/index.cjs.map +0 -1
  54. package/dist/api-users/index.d.cts +0 -4740
  55. package/dist/api-verifications/index.cjs +0 -407
  56. package/dist/api-verifications/index.cjs.map +0 -1
  57. package/dist/api-verifications/index.d.cts +0 -207
  58. package/dist/batch/index.cjs +0 -408
  59. package/dist/batch/index.cjs.map +0 -1
  60. package/dist/batch/index.d.cts +0 -330
  61. package/dist/bin/index.cjs +0 -17
  62. package/dist/bin/index.cjs.map +0 -1
  63. package/dist/bin/index.d.cts +0 -1
  64. package/dist/bucket/index.cjs +0 -303
  65. package/dist/bucket/index.cjs.map +0 -1
  66. package/dist/bucket/index.d.cts +0 -355
  67. package/dist/cache/index.cjs +0 -241
  68. package/dist/cache/index.cjs.map +0 -1
  69. package/dist/cache/index.d.cts +0 -202
  70. package/dist/cache-redis/index.cjs +0 -84
  71. package/dist/cache-redis/index.cjs.map +0 -1
  72. package/dist/cache-redis/index.d.cts +0 -40
  73. package/dist/cli/chunk-DSlc6foC.cjs +0 -43
  74. package/dist/cli/dist-BBPjuQ56.js +0 -2778
  75. package/dist/cli/dist-Sz2EXvQX.cjs.map +0 -1
  76. package/dist/cli/index.cjs +0 -1241
  77. package/dist/cli/index.cjs.map +0 -1
  78. package/dist/cli/index.d.cts +0 -422
  79. package/dist/command/index.cjs +0 -693
  80. package/dist/command/index.cjs.map +0 -1
  81. package/dist/command/index.d.cts +0 -340
  82. package/dist/core/index.cjs +0 -2264
  83. package/dist/core/index.cjs.map +0 -1
  84. package/dist/core/index.d.cts +0 -1927
  85. package/dist/datetime/index.cjs +0 -318
  86. package/dist/datetime/index.cjs.map +0 -1
  87. package/dist/datetime/index.d.cts +0 -145
  88. package/dist/email/index.cjs +0 -10874
  89. package/dist/email/index.cjs.map +0 -1
  90. package/dist/email/index.d.cts +0 -186
  91. package/dist/fake/index.cjs +0 -34641
  92. package/dist/fake/index.cjs.map +0 -1
  93. package/dist/fake/index.d.cts +0 -74
  94. package/dist/file/index.cjs +0 -1212
  95. package/dist/file/index.cjs.map +0 -1
  96. package/dist/file/index.d.cts +0 -698
  97. package/dist/lock/index.cjs +0 -226
  98. package/dist/lock/index.cjs.map +0 -1
  99. package/dist/lock/index.d.cts +0 -361
  100. package/dist/lock-redis/index.cjs +0 -113
  101. package/dist/lock-redis/index.cjs.map +0 -1
  102. package/dist/lock-redis/index.d.cts +0 -24
  103. package/dist/logger/index.cjs +0 -521
  104. package/dist/logger/index.cjs.map +0 -1
  105. package/dist/logger/index.d.cts +0 -281
  106. package/dist/orm/index.cjs +0 -2986
  107. package/dist/orm/index.cjs.map +0 -1
  108. package/dist/orm/index.d.cts +0 -2213
  109. package/dist/queue/index.cjs +0 -1044
  110. package/dist/queue/index.cjs.map +0 -1
  111. package/dist/queue/index.d.cts +0 -1265
  112. package/dist/queue-redis/index.cjs +0 -873
  113. package/dist/queue-redis/index.cjs.map +0 -1
  114. package/dist/queue-redis/index.d.cts +0 -82
  115. package/dist/redis/index.cjs +0 -153
  116. package/dist/redis/index.cjs.map +0 -1
  117. package/dist/redis/index.d.cts +0 -82
  118. package/dist/retry/index.cjs +0 -146
  119. package/dist/retry/index.cjs.map +0 -1
  120. package/dist/retry/index.d.cts +0 -172
  121. package/dist/router/index.cjs +0 -111
  122. package/dist/router/index.cjs.map +0 -1
  123. package/dist/router/index.d.cts +0 -46
  124. package/dist/scheduler/index.cjs +0 -576
  125. package/dist/scheduler/index.cjs.map +0 -1
  126. package/dist/scheduler/index.d.cts +0 -145
  127. package/dist/security/index.cjs +0 -2402
  128. package/dist/security/index.cjs.map +0 -1
  129. package/dist/security/index.d.cts +0 -598
  130. package/dist/server/index.cjs +0 -1680
  131. package/dist/server/index.cjs.map +0 -1
  132. package/dist/server/index.d.cts +0 -810
  133. package/dist/server-auth/index.cjs +0 -3146
  134. package/dist/server-auth/index.cjs.map +0 -1
  135. package/dist/server-auth/index.d.cts +0 -1164
  136. package/dist/server-cache/index.cjs +0 -252
  137. package/dist/server-cache/index.cjs.map +0 -1
  138. package/dist/server-cache/index.d.cts +0 -164
  139. package/dist/server-compress/index.cjs +0 -141
  140. package/dist/server-compress/index.cjs.map +0 -1
  141. package/dist/server-compress/index.d.cts +0 -38
  142. package/dist/server-cookies/index.cjs +0 -234
  143. package/dist/server-cookies/index.cjs.map +0 -1
  144. package/dist/server-cookies/index.d.cts +0 -144
  145. package/dist/server-cors/index.cjs +0 -201
  146. package/dist/server-cors/index.cjs.map +0 -1
  147. package/dist/server-cors/index.d.cts +0 -140
  148. package/dist/server-health/index.cjs +0 -62
  149. package/dist/server-health/index.cjs.map +0 -1
  150. package/dist/server-health/index.d.cts +0 -58
  151. package/dist/server-helmet/index.cjs +0 -131
  152. package/dist/server-helmet/index.cjs.map +0 -1
  153. package/dist/server-helmet/index.d.cts +0 -97
  154. package/dist/server-links/index.cjs +0 -992
  155. package/dist/server-links/index.cjs.map +0 -1
  156. package/dist/server-links/index.d.cts +0 -513
  157. package/dist/server-metrics/index.cjs +0 -4535
  158. package/dist/server-metrics/index.cjs.map +0 -1
  159. package/dist/server-metrics/index.d.cts +0 -35
  160. package/dist/server-multipart/index.cjs +0 -237
  161. package/dist/server-multipart/index.cjs.map +0 -1
  162. package/dist/server-multipart/index.d.cts +0 -50
  163. package/dist/server-proxy/index.cjs +0 -186
  164. package/dist/server-proxy/index.cjs.map +0 -1
  165. package/dist/server-proxy/index.d.cts +0 -234
  166. package/dist/server-rate-limit/index.cjs +0 -241
  167. package/dist/server-rate-limit/index.cjs.map +0 -1
  168. package/dist/server-rate-limit/index.d.cts +0 -183
  169. package/dist/server-security/index.cjs +0 -316
  170. package/dist/server-security/index.cjs.map +0 -1
  171. package/dist/server-security/index.d.cts +0 -173
  172. package/dist/server-static/index.cjs +0 -170
  173. package/dist/server-static/index.cjs.map +0 -1
  174. package/dist/server-static/index.d.cts +0 -121
  175. package/dist/server-swagger/index.cjs +0 -1021
  176. package/dist/server-swagger/index.cjs.map +0 -1
  177. package/dist/server-swagger/index.d.cts +0 -382
  178. package/dist/sms/index.cjs +0 -221
  179. package/dist/sms/index.cjs.map +0 -1
  180. package/dist/sms/index.d.cts +0 -130
  181. package/dist/thread/index.cjs +0 -350
  182. package/dist/thread/index.cjs.map +0 -1
  183. package/dist/thread/index.d.cts +0 -260
  184. package/dist/topic/index.cjs +0 -282
  185. package/dist/topic/index.cjs.map +0 -1
  186. package/dist/topic/index.d.cts +0 -523
  187. package/dist/topic-redis/index.cjs +0 -71
  188. package/dist/topic-redis/index.cjs.map +0 -1
  189. package/dist/topic-redis/index.d.cts +0 -42
  190. package/dist/vite/index.cjs +0 -1077
  191. package/dist/vite/index.cjs.map +0 -1
  192. package/dist/vite/index.d.cts +0 -542
  193. package/dist/websocket/index.cjs +0 -1117
  194. package/dist/websocket/index.cjs.map +0 -1
  195. package/dist/websocket/index.d.cts +0 -861
@@ -1,654 +0,0 @@
1
- import * as alepha224 from "alepha";
2
- import { Alepha, Async, Descriptor, KIND, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
3
- import * as alepha_server0 from "alepha/server";
4
- import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
5
- import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
6
- import { DateTime, DateTimeProvider } from "alepha/datetime";
7
- import "alepha/logger";
8
- import "alepha/retry";
9
- import { LockDescriptor } from "alepha/lock";
10
- import * as alepha_orm0 from "alepha/orm";
11
- import { CronProvider } from "alepha/scheduler";
12
-
13
- //#region src/orm/schemas/insertSchema.d.ts
14
- /**
15
- * Transforms a TObject schema for insert operations.
16
- * All default properties at the root level are made optional.
17
- *
18
- * @example
19
- * Before: { name: string; age: number(default=0); }
20
- * After: { name: string; age?: number; }
21
- */
22
- type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends {
23
- [PG_DEFAULT]: any;
24
- } | {
25
- "~optional": true;
26
- } ? TOptional<T["properties"][K]> : T["properties"][K] }>;
27
- //#endregion
28
- //#region src/orm/schemas/updateSchema.d.ts
29
- /**
30
- * Transforms a TObject schema for update operations.
31
- * All optional properties at the root level are made nullable (i.e., `T | null`).
32
- * This allows an API endpoint to explicitly accept `null` to clear an optional field in the database.
33
- *
34
- * @example
35
- * Before: { name?: string; age: number; }
36
- * After: { name?: string | null; age: number; }
37
- */
38
- type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
39
- //#endregion
40
- //#region src/orm/descriptors/$entity.d.ts
41
- interface EntityDescriptorOptions<T extends TObject, Keys = keyof Static<T>> {
42
- /**
43
- * The database table name that will be created for this entity.
44
- * If not provided, name will be inferred from the $repository variable name.
45
- */
46
- name: string;
47
- /**
48
- * TypeBox schema defining the table structure and column types.
49
- */
50
- schema: T;
51
- /**
52
- * Database indexes to create for query optimization.
53
- */
54
- indexes?: (Keys | {
55
- /**
56
- * Single column to index.
57
- */
58
- column: Keys;
59
- /**
60
- * Whether this should be a unique index (enforces uniqueness constraint).
61
- */
62
- unique?: boolean;
63
- /**
64
- * Custom name for the index. If not provided, generates name automatically.
65
- */
66
- name?: string;
67
- } | {
68
- /**
69
- * Multiple columns for composite index (order matters for query optimization).
70
- */
71
- columns: Keys[];
72
- /**
73
- * Whether this should be a unique index (enforces uniqueness constraint).
74
- */
75
- unique?: boolean;
76
- /**
77
- * Custom name for the index. If not provided, generates name automatically.
78
- */
79
- name?: string;
80
- })[];
81
- /**
82
- * Foreign key constraints to maintain referential integrity.
83
- */
84
- foreignKeys?: Array<{
85
- /**
86
- * Optional name for the foreign key constraint.
87
- */
88
- name?: string;
89
- /**
90
- * Local columns that reference the foreign table.
91
- */
92
- columns: Array<keyof Static<T>>;
93
- /**
94
- * Referenced columns in the foreign table.
95
- * Must be EntityColumn references from other entities.
96
- */
97
- foreignColumns: Array<() => EntityColumn<any>>;
98
- }>;
99
- /**
100
- * Additional table constraints for data validation.
101
- *
102
- * Constraints enforce business rules at the database level, providing
103
- * an additional layer of data integrity beyond application validation.
104
- *
105
- * **Constraint Types**:
106
- * - **Unique constraints**: Prevent duplicate values across columns
107
- * - **Check constraints**: Enforce custom validation rules with SQL expressions
108
- *
109
- * @example
110
- * ```ts
111
- * constraints: [
112
- * {
113
- * name: "unique_user_email",
114
- * columns: ["email"],
115
- * unique: true
116
- * },
117
- * {
118
- * name: "valid_age_range",
119
- * columns: ["age"],
120
- * check: sql`age >= 0 AND age <= 150`
121
- * },
122
- * {
123
- * name: "unique_user_username_per_tenant",
124
- * columns: ["tenantId", "username"],
125
- * unique: true
126
- * }
127
- * ]
128
- * ```
129
- */
130
- constraints?: Array<{
131
- /**
132
- * Columns involved in this constraint.
133
- */
134
- columns: Array<keyof Static<T>>;
135
- /**
136
- * Optional name for the constraint.
137
- */
138
- name?: string;
139
- /**
140
- * Whether this is a unique constraint.
141
- */
142
- unique?: boolean | {};
143
- /**
144
- * SQL expression for check constraint validation.
145
- */
146
- check?: SQL;
147
- }>;
148
- /**
149
- * Advanced Drizzle ORM configuration for complex table setups.
150
- */
151
- config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
152
- }
153
- declare class EntityDescriptor<T extends TObject = TObject> {
154
- readonly options: EntityDescriptorOptions<T>;
155
- constructor(options: EntityDescriptorOptions<T>);
156
- alias(alias: string): this;
157
- get cols(): EntityColumns<T>;
158
- get name(): string;
159
- get schema(): T;
160
- get insertSchema(): TObjectInsert<T>;
161
- get updateSchema(): TObjectUpdate<T>;
162
- }
163
- /**
164
- * Convert a schema to columns.
165
- */
166
- type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
167
- type EntityColumn<T extends TObject> = {
168
- name: string;
169
- entity: EntityDescriptor<T>;
170
- };
171
- type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
172
- //#endregion
173
- //#region src/orm/constants/PG_SYMBOLS.d.ts
174
- declare const PG_DEFAULT: unique symbol;
175
- declare const PG_PRIMARY_KEY: unique symbol;
176
- declare const PG_CREATED_AT: unique symbol;
177
- declare const PG_UPDATED_AT: unique symbol;
178
- declare const PG_DELETED_AT: unique symbol;
179
- declare const PG_VERSION: unique symbol;
180
- declare const PG_IDENTITY: unique symbol;
181
- declare const PG_ENUM: unique symbol;
182
- declare const PG_REF: unique symbol;
183
- /**
184
- * @deprecated Use `PG_IDENTITY` instead.
185
- */
186
- declare const PG_SERIAL: unique symbol;
187
- type PgSymbols = {
188
- [PG_DEFAULT]: {};
189
- [PG_PRIMARY_KEY]: {};
190
- [PG_CREATED_AT]: {};
191
- [PG_UPDATED_AT]: {};
192
- [PG_DELETED_AT]: {};
193
- [PG_VERSION]: {};
194
- [PG_IDENTITY]: PgIdentityOptions;
195
- [PG_REF]: PgRefOptions;
196
- [PG_ENUM]: PgEnumOptions;
197
- /**
198
- * @deprecated Use `PG_IDENTITY` instead.
199
- */
200
- [PG_SERIAL]: {};
201
- };
202
- type PgSymbolKeys = keyof PgSymbols;
203
- type PgIdentityOptions = {
204
- mode: "always" | "byDefault";
205
- } & PgSequenceOptions & {
206
- name?: string;
207
- };
208
- interface PgEnumOptions {
209
- name?: string;
210
- description?: string;
211
- }
212
- interface PgRefOptions {
213
- ref: () => {
214
- name: string;
215
- entity: EntityDescriptor;
216
- };
217
- actions?: {
218
- onUpdate?: UpdateDeleteAction;
219
- onDelete?: UpdateDeleteAction;
220
- };
221
- }
222
- //#endregion
223
- //#region src/orm/helpers/pgAttr.d.ts
224
- /**
225
- * Type representation.
226
- */
227
- type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
228
- //#endregion
229
- //#region src/orm/providers/drivers/NodePostgresProvider.d.ts
230
- declare module "alepha" {
231
- interface Env extends Partial<Static<typeof envSchema$1>> {}
232
- }
233
- declare const envSchema$1: alepha224.TObject<{
234
- /**
235
- * Main configuration for database connection.
236
- * Accept a string in the format of a Postgres connection URL.
237
- * Example: postgres://user:password@localhost:5432/database
238
- * or
239
- * Example: postgres://user:password@localhost:5432/database?sslmode=require
240
- */
241
- DATABASE_URL: alepha224.TOptional<alepha224.TString>;
242
- /**
243
- * In addition to the DATABASE_URL, you can specify the postgres schema name.
244
- *
245
- * It will monkey patch drizzle tables.
246
- */
247
- POSTGRES_SCHEMA: alepha224.TOptional<alepha224.TString>;
248
- }>;
249
- //#endregion
250
- //#region src/orm/providers/drivers/NodeSqliteProvider.d.ts
251
- /**
252
- * Configuration options for the Node.js SQLite database provider.
253
- */
254
- declare const nodeSqliteOptions: alepha224.Atom<alepha224.TObject<{
255
- path: alepha224.TOptional<alepha224.TString>;
256
- }>, "alepha.postgres.node-sqlite.options">;
257
- type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
258
- declare module "alepha" {
259
- interface State {
260
- [nodeSqliteOptions.key]: NodeSqliteProviderOptions;
261
- }
262
- }
263
- /**
264
- * Add a fake support for SQLite in Node.js based on Postgres interfaces.
265
- *
266
- * This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
267
- * This is NOT recommended for production use.
268
- */
269
- //#endregion
270
- //#region src/orm/index.d.ts
271
- declare module "alepha" {
272
- interface Hooks {
273
- /**
274
- * Fires before creating an entity in the repository.
275
- */
276
- "repository:create:before": {
277
- tableName: string;
278
- data: any;
279
- };
280
- /**
281
- * Fires after creating an entity in the repository.
282
- */
283
- "repository:create:after": {
284
- tableName: string;
285
- data: any;
286
- entity: any;
287
- };
288
- /**
289
- * Fires before updating entities in the repository.
290
- */
291
- "repository:update:before": {
292
- tableName: string;
293
- where: any;
294
- data: any;
295
- };
296
- /**
297
- * Fires after updating entities in the repository.
298
- */
299
- "repository:update:after": {
300
- tableName: string;
301
- where: any;
302
- data: any;
303
- entities: any[];
304
- };
305
- /**
306
- * Fires before deleting entities from the repository.
307
- */
308
- "repository:delete:before": {
309
- tableName: string;
310
- where: any;
311
- };
312
- /**
313
- * Fires after deleting entities from the repository.
314
- */
315
- "repository:delete:after": {
316
- tableName: string;
317
- where: any;
318
- ids: Array<string | number>;
319
- };
320
- /**
321
- * Fires before reading entities from the repository.
322
- */
323
- "repository:read:before": {
324
- tableName: string;
325
- query: any;
326
- };
327
- /**
328
- * Fires after reading entities from the repository.
329
- */
330
- "repository:read:after": {
331
- tableName: string;
332
- query: any;
333
- entities: any[];
334
- };
335
- }
336
- }
337
- //#endregion
338
- //#region src/api-jobs/schemas/jobExecutionQuerySchema.d.ts
339
- declare const jobExecutionQuerySchema: alepha224.TObject<{
340
- page: alepha224.TOptional<alepha224.TInteger>;
341
- size: alepha224.TOptional<alepha224.TInteger>;
342
- sort: alepha224.TOptional<alepha224.TString>;
343
- status: alepha224.TOptional<alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">>;
344
- job: alepha224.TOptional<alepha224.TString>;
345
- }>;
346
- type JobExecutionQuery = Static<typeof jobExecutionQuerySchema>;
347
- //#endregion
348
- //#region src/api-jobs/services/JobService.d.ts
349
- declare class JobService {
350
- protected readonly alepha: Alepha;
351
- protected readonly executionRepository: alepha_orm0.Repository<alepha224.TObject<{
352
- id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
353
- version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
354
- createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
355
- updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
356
- finishedAt: alepha224.TOptional<alepha224.TString>;
357
- job: alepha224.TString;
358
- status: alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
359
- error: alepha224.TOptional<alepha224.TString>;
360
- logs: alepha224.TOptional<alepha224.TArray<alepha224.TObject<{
361
- level: alepha224.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
362
- message: alepha224.TString;
363
- service: alepha224.TString;
364
- module: alepha224.TString;
365
- context: alepha224.TOptional<alepha224.TString>;
366
- app: alepha224.TOptional<alepha224.TString>;
367
- data: alepha224.TOptional<alepha224.TAny>;
368
- timestamp: alepha224.TNumber;
369
- }>>>;
370
- }>>;
371
- getJobs(): Promise<string[]>;
372
- getJobExecutions(query?: JobExecutionQuery): Promise<alepha224.Page<alepha_orm0.PgStatic<alepha224.TObject<{
373
- id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
374
- version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
375
- createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
376
- updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
377
- finishedAt: alepha224.TOptional<alepha224.TString>;
378
- job: alepha224.TString;
379
- status: alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
380
- error: alepha224.TOptional<alepha224.TString>;
381
- logs: alepha224.TOptional<alepha224.TArray<alepha224.TObject<{
382
- level: alepha224.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
383
- message: alepha224.TString;
384
- service: alepha224.TString;
385
- module: alepha224.TString;
386
- context: alepha224.TOptional<alepha224.TString>;
387
- app: alepha224.TOptional<alepha224.TString>;
388
- data: alepha224.TOptional<alepha224.TAny>;
389
- timestamp: alepha224.TNumber;
390
- }>>>;
391
- }>, alepha_orm0.PgRelationMap<alepha224.TObject<{
392
- id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
393
- version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
394
- createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
395
- updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
396
- finishedAt: alepha224.TOptional<alepha224.TString>;
397
- job: alepha224.TString;
398
- status: alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
399
- error: alepha224.TOptional<alepha224.TString>;
400
- logs: alepha224.TOptional<alepha224.TArray<alepha224.TObject<{
401
- level: alepha224.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
402
- message: alepha224.TString;
403
- service: alepha224.TString;
404
- module: alepha224.TString;
405
- context: alepha224.TOptional<alepha224.TString>;
406
- app: alepha224.TOptional<alepha224.TString>;
407
- data: alepha224.TOptional<alepha224.TAny>;
408
- timestamp: alepha224.TNumber;
409
- }>>>;
410
- }>>>>>;
411
- triggerJob(name: string): Promise<{
412
- ok: boolean;
413
- }>;
414
- }
415
- //#endregion
416
- //#region src/api-jobs/controllers/JobController.d.ts
417
- declare class JobController {
418
- protected readonly url: string;
419
- protected readonly group: string;
420
- protected readonly jobService: JobService;
421
- readonly getJobs: alepha_server0.ActionDescriptorFn<{
422
- response: alepha224.TArray<alepha224.TString>;
423
- }>;
424
- readonly getJobExecutions: alepha_server0.ActionDescriptorFn<{
425
- query: alepha224.TObject<{
426
- page: alepha224.TOptional<alepha224.TInteger>;
427
- size: alepha224.TOptional<alepha224.TInteger>;
428
- sort: alepha224.TOptional<alepha224.TString>;
429
- status: alepha224.TOptional<alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">>;
430
- job: alepha224.TOptional<alepha224.TString>;
431
- }>;
432
- response: alepha224.TPage<alepha224.TObject<{
433
- id: PgAttr<PgAttr<alepha224.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
434
- version: PgAttr<PgAttr<alepha224.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
435
- createdAt: PgAttr<PgAttr<alepha224.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
436
- updatedAt: PgAttr<PgAttr<alepha224.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
437
- finishedAt: alepha224.TOptional<alepha224.TString>;
438
- job: alepha224.TString;
439
- status: alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
440
- error: alepha224.TOptional<alepha224.TString>;
441
- logs: alepha224.TOptional<alepha224.TArray<alepha224.TObject<{
442
- level: alepha224.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
443
- message: alepha224.TString;
444
- service: alepha224.TString;
445
- module: alepha224.TString;
446
- context: alepha224.TOptional<alepha224.TString>;
447
- app: alepha224.TOptional<alepha224.TString>;
448
- data: alepha224.TOptional<alepha224.TAny>;
449
- timestamp: alepha224.TNumber;
450
- }>>>;
451
- }>>;
452
- }>;
453
- readonly triggerJob: alepha_server0.ActionDescriptorFn<{
454
- body: alepha224.TObject<{
455
- name: alepha224.TString;
456
- }>;
457
- response: alepha224.TObject<{
458
- ok: alepha224.TBoolean;
459
- id: alepha224.TOptional<alepha224.TUnion<[alepha224.TString, alepha224.TInteger]>>;
460
- count: alepha224.TOptional<alepha224.TNumber>;
461
- }>;
462
- }>;
463
- }
464
- //#endregion
465
- //#region src/api-jobs/providers/JobProvider.d.ts
466
- declare const envSchema: alepha224.TObject<{
467
- JOB_PREFIX: alepha224.TOptional<alepha224.TString>;
468
- }>;
469
- declare module "alepha" {
470
- interface Env extends Partial<Static<typeof envSchema>> {}
471
- }
472
- /**
473
- * Provider for job management and execution.
474
- * Handles job lifecycle, execution tracking, log capturing, and event emission.
475
- */
476
- declare class JobProvider {
477
- protected readonly alepha: Alepha;
478
- protected readonly dateTimeProvider: DateTimeProvider;
479
- protected readonly cronProvider: CronProvider;
480
- protected readonly executionRepository: alepha_orm0.Repository<alepha224.TObject<{
481
- id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
482
- version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
483
- createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
484
- updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
485
- finishedAt: alepha224.TOptional<alepha224.TString>;
486
- job: alepha224.TString;
487
- status: alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
488
- error: alepha224.TOptional<alepha224.TString>;
489
- logs: alepha224.TOptional<alepha224.TArray<alepha224.TObject<{
490
- level: alepha224.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
491
- message: alepha224.TString;
492
- service: alepha224.TString;
493
- module: alepha224.TString;
494
- context: alepha224.TOptional<alepha224.TString>;
495
- app: alepha224.TOptional<alepha224.TString>;
496
- data: alepha224.TOptional<alepha224.TAny>;
497
- timestamp: alepha224.TNumber;
498
- }>>>;
499
- }>>;
500
- protected readonly env: {
501
- JOB_PREFIX?: string | undefined;
502
- };
503
- protected readonly logs: Map<string, {
504
- context?: string | undefined;
505
- app?: string | undefined;
506
- data?: any;
507
- level: "SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
508
- message: string;
509
- service: string;
510
- module: string;
511
- timestamp: number;
512
- }[]>;
513
- protected readonly jobs: Map<string, JobRegistration>;
514
- /**
515
- * Register and set up a job for execution (called during descriptor initialization).
516
- */
517
- registerJob(options: Job): JobRegistration;
518
- /**
519
- * Trigger a job by name.
520
- */
521
- triggerJob(jobName: string): Promise<void>;
522
- /**
523
- * Execute a job handler (called by the job descriptor).
524
- */
525
- executeJob(jobName: string, handler: (args: {
526
- now: DateTime;
527
- }) => Async<void>): Promise<void>;
528
- }
529
- interface Job {
530
- /**
531
- * Name of the job.
532
- */
533
- name: string;
534
- /**
535
- * Optional description of the job.
536
- */
537
- description?: string;
538
- /**
539
- * Function to run on schedule.
540
- */
541
- handler: (args: {
542
- now: DateTime;
543
- }) => Async<void>;
544
- /**
545
- * Cron expression to run the job.
546
- */
547
- cron?: string;
548
- /**
549
- * If true, the job will be locked and only one instance will run at a time.
550
- * You probably need to import {@link AlephaLockRedis} for distributed locking.
551
- *
552
- * @default true
553
- */
554
- lock?: boolean;
555
- /**
556
- * Optional prefix for job lock keys.
557
- */
558
- lockPrefix?: string;
559
- }
560
- interface JobRegistration {
561
- name: string;
562
- options: Job;
563
- lockDescriptor: LockDescriptor<() => Promise<void>> | null;
564
- }
565
- //#endregion
566
- //#region src/api-jobs/descriptors/$job.d.ts
567
- /**
568
- * Job descriptor - a drop-in replacement for $scheduler with built-in execution tracking.
569
- */
570
- declare const $job: {
571
- (options: JobDescriptorOptions): JobDescriptor;
572
- [KIND]: typeof JobDescriptor;
573
- };
574
- type JobDescriptorOptions = Omit<Job, "name"> & {
575
- /**
576
- * Name of the job. Defaults to the descriptor property name.
577
- */
578
- name?: string;
579
- };
580
- declare class JobDescriptor extends Descriptor<JobDescriptorOptions> {
581
- protected readonly jobProvider: JobProvider;
582
- get name(): string;
583
- protected onInit(): void;
584
- trigger(): Promise<void>;
585
- }
586
- interface JobHandlerArguments {
587
- now: DateTime;
588
- }
589
- //#endregion
590
- //#region src/api-jobs/entities/jobExecutions.d.ts
591
- declare const jobExecutions: alepha_orm0.EntityDescriptor<alepha224.TObject<{
592
- id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
593
- version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
594
- createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
595
- updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha224.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
596
- finishedAt: alepha224.TOptional<alepha224.TString>;
597
- job: alepha224.TString;
598
- status: alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
599
- error: alepha224.TOptional<alepha224.TString>;
600
- logs: alepha224.TOptional<alepha224.TArray<alepha224.TObject<{
601
- level: alepha224.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
602
- message: alepha224.TString;
603
- service: alepha224.TString;
604
- module: alepha224.TString;
605
- context: alepha224.TOptional<alepha224.TString>;
606
- app: alepha224.TOptional<alepha224.TString>;
607
- data: alepha224.TOptional<alepha224.TAny>;
608
- timestamp: alepha224.TNumber;
609
- }>>>;
610
- }>>;
611
- type JobExecutionEntity = Static<typeof jobExecutions.schema>;
612
- //#endregion
613
- //#region src/api-jobs/schemas/jobExecutionResourceSchema.d.ts
614
- declare const jobExecutionResourceSchema: alepha224.TObject<{
615
- id: PgAttr<PgAttr<alepha224.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
616
- version: PgAttr<PgAttr<alepha224.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
617
- createdAt: PgAttr<PgAttr<alepha224.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
618
- updatedAt: PgAttr<PgAttr<alepha224.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
619
- finishedAt: alepha224.TOptional<alepha224.TString>;
620
- job: alepha224.TString;
621
- status: alepha224.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
622
- error: alepha224.TOptional<alepha224.TString>;
623
- logs: alepha224.TOptional<alepha224.TArray<alepha224.TObject<{
624
- level: alepha224.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
625
- message: alepha224.TString;
626
- service: alepha224.TString;
627
- module: alepha224.TString;
628
- context: alepha224.TOptional<alepha224.TString>;
629
- app: alepha224.TOptional<alepha224.TString>;
630
- data: alepha224.TOptional<alepha224.TAny>;
631
- timestamp: alepha224.TNumber;
632
- }>>>;
633
- }>;
634
- type JobExecutionResource = Static<typeof jobExecutionResourceSchema>;
635
- //#endregion
636
- //#region src/api-jobs/schemas/triggerJobSchema.d.ts
637
- declare const triggerJobSchema: alepha224.TObject<{
638
- name: alepha224.TString;
639
- }>;
640
- type TriggerJob = Static<typeof triggerJobSchema>;
641
- //#endregion
642
- //#region src/api-jobs/index.d.ts
643
- /**
644
- * Provides job management API endpoints for Alepha applications.
645
- *
646
- * This module includes job queue operations, job status monitoring,
647
- * and background task management capabilities.
648
- *
649
- * @module alepha.api.jobs
650
- */
651
- declare const AlephaApiJobs: alepha224.Service<alepha224.Module>;
652
- //#endregion
653
- export { $job, AlephaApiJobs, Job, JobController, JobDescriptor, JobDescriptorOptions, JobExecutionEntity, JobExecutionQuery, JobExecutionResource, JobHandlerArguments, JobProvider, JobRegistration, JobService, TriggerJob, jobExecutionQuerySchema, jobExecutionResourceSchema, jobExecutions, triggerJobSchema };
654
- //# sourceMappingURL=index.d.cts.map