alepha 0.11.5 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -100
  3. package/api/files.d.ts +168 -169
  4. package/api/jobs.d.ts +263 -154
  5. package/api/notifications.d.ts +28 -29
  6. package/api/users.d.ts +476 -477
  7. package/batch.d.ts +59 -493
  8. package/bucket.d.ts +20 -11
  9. package/cache/redis.d.ts +1 -1
  10. package/cache.d.ts +1 -1
  11. package/command.d.ts +24 -7
  12. package/core.d.ts +299 -222
  13. package/datetime.d.ts +4 -29
  14. package/devtools.d.ts +166 -284
  15. package/email.d.ts +45 -2
  16. package/fake.d.ts +1 -1
  17. package/file.d.ts +1 -1
  18. package/lock/redis.d.ts +1 -1
  19. package/lock.d.ts +1 -1
  20. package/logger.d.ts +11 -9
  21. package/package.json +51 -51
  22. package/postgres.d.ts +480 -198
  23. package/queue/redis.d.ts +1 -1
  24. package/queue.d.ts +1 -1
  25. package/react/auth.d.ts +7 -2
  26. package/react/form.d.ts +39 -16
  27. package/react/head.d.ts +1 -1
  28. package/react/i18n.d.ts +2 -2
  29. package/react.d.ts +66 -41
  30. package/redis.d.ts +1 -1
  31. package/retry.d.ts +84 -21
  32. package/scheduler.d.ts +1 -1
  33. package/security.d.ts +29 -29
  34. package/server/cache.d.ts +1 -1
  35. package/server/compress.d.ts +9 -3
  36. package/server/cookies.d.ts +1 -1
  37. package/server/cors.d.ts +28 -10
  38. package/server/health.d.ts +18 -19
  39. package/server/helmet.d.ts +44 -15
  40. package/server/links.d.ts +37 -31
  41. package/server/metrics.d.ts +1 -1
  42. package/server/multipart.d.ts +1 -1
  43. package/server/proxy.d.ts +1 -1
  44. package/server/security.d.ts +8 -3
  45. package/server/static.d.ts +1 -1
  46. package/server/swagger.d.ts +19 -6
  47. package/server.d.ts +1 -1
  48. package/topic/redis.d.ts +1 -1
  49. package/topic.d.ts +1 -1
  50. package/ui.d.ts +142 -12
  51. package/vite.d.ts +2 -2
package/api/jobs.d.ts CHANGED
@@ -1,100 +1,84 @@
1
- import * as _alepha_core2 from "alepha";
2
- import { Alepha, Static } from "alepha";
3
- import "alepha/scheduler";
1
+ import * as _alepha_core1 from "alepha";
2
+ import { Alepha, Async, Descriptor, KIND, Static } from "alepha";
4
3
  import "alepha/server/security";
5
- import * as _alepha_postgres48 from "alepha/postgres";
4
+ import * as _alepha_postgres0 from "alepha/postgres";
6
5
  import * as _alepha_server0 from "alepha/server";
7
- import { DateTimeProvider } from "alepha/datetime";
8
- import * as typebox82 from "typebox";
9
- import * as dayjs11 from "dayjs";
6
+ import { DateTime, DateTimeProvider } from "alepha/datetime";
7
+ import { LockDescriptor } from "alepha/lock";
8
+ import { CronProvider } from "alepha/scheduler";
9
+ import * as typebox79 from "typebox";
10
10
 
11
11
  //#region src/schemas/jobExecutionQuerySchema.d.ts
12
- declare const jobExecutionQuerySchema: typebox82.TObject<{
13
- page: typebox82.TOptional<typebox82.TInteger>;
14
- size: typebox82.TOptional<typebox82.TInteger>;
15
- sort: typebox82.TOptional<typebox82.TString>;
16
- status: typebox82.TOptional<typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">>;
17
- job: typebox82.TOptional<typebox82.TString>;
12
+ declare const jobExecutionQuerySchema: typebox79.TObject<{
13
+ page: typebox79.TOptional<typebox79.TInteger>;
14
+ size: typebox79.TOptional<typebox79.TInteger>;
15
+ sort: typebox79.TOptional<typebox79.TString>;
16
+ status: typebox79.TOptional<typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">>;
17
+ job: typebox79.TOptional<typebox79.TString>;
18
18
  }>;
19
19
  type JobExecutionQuery = Static<typeof jobExecutionQuerySchema>;
20
20
  //#endregion
21
21
  //#region src/services/JobService.d.ts
22
22
  declare class JobService {
23
23
  protected readonly alepha: Alepha;
24
- protected readonly executionRepository: _alepha_postgres48.RepositoryDescriptor<typebox82.TObject<{
25
- id: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TString, typeof _alepha_postgres48.PG_PRIMARY_KEY>, typeof _alepha_postgres48.PG_DEFAULT>;
26
- version: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TInteger, typeof _alepha_postgres48.PG_VERSION>, typeof _alepha_postgres48.PG_DEFAULT>;
27
- createdAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_CREATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
28
- updatedAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_UPDATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
29
- finishedAt: typebox82.TOptional<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>>;
30
- job: typebox82.TString;
31
- status: typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
32
- error: typebox82.TOptional<typebox82.TString>;
33
- logs: typebox82.TOptional<typebox82.TArray<typebox82.TObject<{
34
- level: typebox82.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
35
- message: typebox82.TString;
36
- service: typebox82.TString;
37
- module: typebox82.TString;
38
- context: typebox82.TOptional<typebox82.TString>;
39
- app: typebox82.TOptional<typebox82.TString>;
40
- data: typebox82.TOptional<typebox82.TAny>;
41
- timestamp: typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>;
24
+ protected readonly executionRepository: _alepha_postgres0.Repository<typebox79.TObject<{
25
+ id: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_PRIMARY_KEY>, typeof _alepha_postgres0.PG_DEFAULT>;
26
+ version: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TInteger, typeof _alepha_postgres0.PG_VERSION>, typeof _alepha_postgres0.PG_DEFAULT>;
27
+ createdAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_CREATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
28
+ updatedAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_UPDATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
29
+ finishedAt: typebox79.TOptional<typebox79.TString>;
30
+ job: typebox79.TString;
31
+ status: typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
32
+ error: typebox79.TOptional<typebox79.TString>;
33
+ logs: typebox79.TOptional<typebox79.TArray<typebox79.TObject<{
34
+ level: typebox79.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
35
+ message: typebox79.TString;
36
+ service: typebox79.TString;
37
+ module: typebox79.TString;
38
+ context: typebox79.TOptional<typebox79.TString>;
39
+ app: typebox79.TOptional<typebox79.TString>;
40
+ data: typebox79.TOptional<typebox79.TAny>;
41
+ timestamp: typebox79.TString;
42
42
  }>>>;
43
43
  }>>;
44
- protected readonly dtp: DateTimeProvider;
45
- protected readonly logs: Map<string, {
46
- context?: string | undefined;
47
- app?: string | undefined;
48
- data?: any;
49
- level: "SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
50
- message: string;
51
- service: string;
52
- module: string;
53
- timestamp: dayjs11.Dayjs;
54
- }[]>;
55
- protected readonly onLogs: _alepha_core2.HookDescriptor<"log">;
56
- protected readonly onSchedulerBegin: _alepha_core2.HookDescriptor<"scheduler:begin">;
57
- protected readonly onSchedulerError: _alepha_core2.HookDescriptor<"scheduler:error">;
58
- readonly onSchedulerSuccess: _alepha_core2.HookDescriptor<"scheduler:success">;
59
- readonly onSchedulerEnd: _alepha_core2.HookDescriptor<"scheduler:end">;
60
44
  getJobs(): Promise<string[]>;
61
- getJobExecutions(query?: JobExecutionQuery): Promise<_alepha_core2.Page<_alepha_postgres48.PgStatic<typebox82.TObject<{
62
- id: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TString, typeof _alepha_postgres48.PG_PRIMARY_KEY>, typeof _alepha_postgres48.PG_DEFAULT>;
63
- version: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TInteger, typeof _alepha_postgres48.PG_VERSION>, typeof _alepha_postgres48.PG_DEFAULT>;
64
- createdAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_CREATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
65
- updatedAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_UPDATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
66
- finishedAt: typebox82.TOptional<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>>;
67
- job: typebox82.TString;
68
- status: typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
69
- error: typebox82.TOptional<typebox82.TString>;
70
- logs: typebox82.TOptional<typebox82.TArray<typebox82.TObject<{
71
- level: typebox82.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
72
- message: typebox82.TString;
73
- service: typebox82.TString;
74
- module: typebox82.TString;
75
- context: typebox82.TOptional<typebox82.TString>;
76
- app: typebox82.TOptional<typebox82.TString>;
77
- data: typebox82.TOptional<typebox82.TAny>;
78
- timestamp: typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>;
45
+ getJobExecutions(query?: JobExecutionQuery): Promise<_alepha_core1.Page<_alepha_postgres0.PgStatic<typebox79.TObject<{
46
+ id: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_PRIMARY_KEY>, typeof _alepha_postgres0.PG_DEFAULT>;
47
+ version: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TInteger, typeof _alepha_postgres0.PG_VERSION>, typeof _alepha_postgres0.PG_DEFAULT>;
48
+ createdAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_CREATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
49
+ updatedAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_UPDATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
50
+ finishedAt: typebox79.TOptional<typebox79.TString>;
51
+ job: typebox79.TString;
52
+ status: typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
53
+ error: typebox79.TOptional<typebox79.TString>;
54
+ logs: typebox79.TOptional<typebox79.TArray<typebox79.TObject<{
55
+ level: typebox79.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
56
+ message: typebox79.TString;
57
+ service: typebox79.TString;
58
+ module: typebox79.TString;
59
+ context: typebox79.TOptional<typebox79.TString>;
60
+ app: typebox79.TOptional<typebox79.TString>;
61
+ data: typebox79.TOptional<typebox79.TAny>;
62
+ timestamp: typebox79.TString;
79
63
  }>>>;
80
- }>, _alepha_postgres48.PgRelationMap<typebox82.TObject<{
81
- id: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TString, typeof _alepha_postgres48.PG_PRIMARY_KEY>, typeof _alepha_postgres48.PG_DEFAULT>;
82
- version: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TInteger, typeof _alepha_postgres48.PG_VERSION>, typeof _alepha_postgres48.PG_DEFAULT>;
83
- createdAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_CREATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
84
- updatedAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_UPDATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
85
- finishedAt: typebox82.TOptional<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>>;
86
- job: typebox82.TString;
87
- status: typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
88
- error: typebox82.TOptional<typebox82.TString>;
89
- logs: typebox82.TOptional<typebox82.TArray<typebox82.TObject<{
90
- level: typebox82.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
91
- message: typebox82.TString;
92
- service: typebox82.TString;
93
- module: typebox82.TString;
94
- context: typebox82.TOptional<typebox82.TString>;
95
- app: typebox82.TOptional<typebox82.TString>;
96
- data: typebox82.TOptional<typebox82.TAny>;
97
- timestamp: typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>;
64
+ }>, _alepha_postgres0.PgRelationMap<typebox79.TObject<{
65
+ id: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_PRIMARY_KEY>, typeof _alepha_postgres0.PG_DEFAULT>;
66
+ version: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TInteger, typeof _alepha_postgres0.PG_VERSION>, typeof _alepha_postgres0.PG_DEFAULT>;
67
+ createdAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_CREATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
68
+ updatedAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_UPDATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
69
+ finishedAt: typebox79.TOptional<typebox79.TString>;
70
+ job: typebox79.TString;
71
+ status: typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
72
+ error: typebox79.TOptional<typebox79.TString>;
73
+ logs: typebox79.TOptional<typebox79.TArray<typebox79.TObject<{
74
+ level: typebox79.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
75
+ message: typebox79.TString;
76
+ service: typebox79.TString;
77
+ module: typebox79.TString;
78
+ context: typebox79.TOptional<typebox79.TString>;
79
+ app: typebox79.TOptional<typebox79.TString>;
80
+ data: typebox79.TOptional<typebox79.TAny>;
81
+ timestamp: typebox79.TString;
98
82
  }>>>;
99
83
  }>>>>>;
100
84
  triggerJob(name: string): Promise<{
@@ -108,98 +92,223 @@ declare class JobController {
108
92
  protected readonly group: string;
109
93
  protected readonly jobService: JobService;
110
94
  readonly getJobs: _alepha_server0.ActionDescriptorFn<{
111
- response: typebox82.TArray<typebox82.TString>;
95
+ response: typebox79.TArray<typebox79.TString>;
112
96
  }>;
113
97
  readonly getJobExecutions: _alepha_server0.ActionDescriptorFn<{
114
- query: typebox82.TObject<{
115
- page: typebox82.TOptional<typebox82.TInteger>;
116
- size: typebox82.TOptional<typebox82.TInteger>;
117
- sort: typebox82.TOptional<typebox82.TString>;
118
- status: typebox82.TOptional<typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">>;
119
- job: typebox82.TOptional<typebox82.TString>;
98
+ query: typebox79.TObject<{
99
+ page: typebox79.TOptional<typebox79.TInteger>;
100
+ size: typebox79.TOptional<typebox79.TInteger>;
101
+ sort: typebox79.TOptional<typebox79.TString>;
102
+ status: typebox79.TOptional<typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">>;
103
+ job: typebox79.TOptional<typebox79.TString>;
120
104
  }>;
121
- response: _alepha_core2.TPage<typebox82.TObject<{
122
- id: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TString, typeof _alepha_postgres48.PG_PRIMARY_KEY>, typeof _alepha_postgres48.PG_DEFAULT>;
123
- version: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TInteger, typeof _alepha_postgres48.PG_VERSION>, typeof _alepha_postgres48.PG_DEFAULT>;
124
- createdAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_CREATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
125
- updatedAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_UPDATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
126
- finishedAt: typebox82.TOptional<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>>;
127
- job: typebox82.TString;
128
- status: typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
129
- error: typebox82.TOptional<typebox82.TString>;
130
- logs: typebox82.TOptional<typebox82.TArray<typebox82.TObject<{
131
- level: typebox82.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
132
- message: typebox82.TString;
133
- service: typebox82.TString;
134
- module: typebox82.TString;
135
- context: typebox82.TOptional<typebox82.TString>;
136
- app: typebox82.TOptional<typebox82.TString>;
137
- data: typebox82.TOptional<typebox82.TAny>;
138
- timestamp: typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>;
105
+ response: _alepha_core1.TPage<typebox79.TObject<{
106
+ id: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_PRIMARY_KEY>, typeof _alepha_postgres0.PG_DEFAULT>;
107
+ version: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TInteger, typeof _alepha_postgres0.PG_VERSION>, typeof _alepha_postgres0.PG_DEFAULT>;
108
+ createdAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_CREATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
109
+ updatedAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_UPDATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
110
+ finishedAt: typebox79.TOptional<typebox79.TString>;
111
+ job: typebox79.TString;
112
+ status: typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
113
+ error: typebox79.TOptional<typebox79.TString>;
114
+ logs: typebox79.TOptional<typebox79.TArray<typebox79.TObject<{
115
+ level: typebox79.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
116
+ message: typebox79.TString;
117
+ service: typebox79.TString;
118
+ module: typebox79.TString;
119
+ context: typebox79.TOptional<typebox79.TString>;
120
+ app: typebox79.TOptional<typebox79.TString>;
121
+ data: typebox79.TOptional<typebox79.TAny>;
122
+ timestamp: typebox79.TString;
139
123
  }>>>;
140
124
  }>>;
141
125
  }>;
142
126
  readonly triggerJob: _alepha_server0.ActionDescriptorFn<{
143
- body: typebox82.TObject<{
144
- name: typebox82.TString;
127
+ body: typebox79.TObject<{
128
+ name: typebox79.TString;
145
129
  }>;
146
- response: typebox82.TObject<{
147
- ok: typebox82.TBoolean;
148
- id: typebox82.TOptional<typebox82.TUnion<[typebox82.TString, typebox82.TInteger]>>;
149
- count: typebox82.TOptional<typebox82.TNumber>;
130
+ response: typebox79.TObject<{
131
+ ok: typebox79.TBoolean;
132
+ id: typebox79.TOptional<typebox79.TUnion<[typebox79.TString, typebox79.TInteger]>>;
133
+ count: typebox79.TOptional<typebox79.TNumber>;
150
134
  }>;
151
135
  }>;
152
136
  }
153
137
  //#endregion
138
+ //#region src/providers/JobProvider.d.ts
139
+ declare const envSchema: _alepha_core1.TObject<{
140
+ JOB_PREFIX: _alepha_core1.TOptional<_alepha_core1.TString>;
141
+ }>;
142
+ declare module "alepha" {
143
+ interface Env extends Partial<Static<typeof envSchema>> {}
144
+ }
145
+ /**
146
+ * Provider for job management and execution.
147
+ * Handles job lifecycle, execution tracking, log capturing, and event emission.
148
+ */
149
+ declare class JobProvider {
150
+ protected readonly alepha: Alepha;
151
+ protected readonly dateTimeProvider: DateTimeProvider;
152
+ protected readonly cronProvider: CronProvider;
153
+ protected readonly executionRepository: _alepha_postgres0.Repository<_alepha_core1.TObject<{
154
+ id: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<_alepha_core1.TString, typeof _alepha_postgres0.PG_PRIMARY_KEY>, typeof _alepha_postgres0.PG_DEFAULT>;
155
+ version: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TInteger, typeof _alepha_postgres0.PG_VERSION>, typeof _alepha_postgres0.PG_DEFAULT>;
156
+ createdAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<_alepha_core1.TString, typeof _alepha_postgres0.PG_CREATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
157
+ updatedAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<_alepha_core1.TString, typeof _alepha_postgres0.PG_UPDATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
158
+ finishedAt: _alepha_core1.TOptional<_alepha_core1.TString>;
159
+ job: _alepha_core1.TString;
160
+ status: typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
161
+ error: _alepha_core1.TOptional<_alepha_core1.TString>;
162
+ logs: _alepha_core1.TOptional<typebox79.TArray<_alepha_core1.TObject<{
163
+ level: typebox79.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
164
+ message: _alepha_core1.TString;
165
+ service: _alepha_core1.TString;
166
+ module: _alepha_core1.TString;
167
+ context: _alepha_core1.TOptional<_alepha_core1.TString>;
168
+ app: _alepha_core1.TOptional<_alepha_core1.TString>;
169
+ data: _alepha_core1.TOptional<typebox79.TAny>;
170
+ timestamp: _alepha_core1.TString;
171
+ }>>>;
172
+ }>>;
173
+ protected readonly env: {
174
+ JOB_PREFIX?: string | undefined;
175
+ };
176
+ protected readonly logs: Map<string, {
177
+ context?: string | undefined;
178
+ app?: string | undefined;
179
+ data?: any;
180
+ level: "SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
181
+ message: string;
182
+ service: string;
183
+ module: string;
184
+ timestamp: string;
185
+ }[]>;
186
+ protected readonly jobs: Map<string, JobRegistration>;
187
+ /**
188
+ * Register and set up a job for execution (called during descriptor initialization).
189
+ */
190
+ registerJob(options: Job): JobRegistration;
191
+ /**
192
+ * Trigger a job by name.
193
+ */
194
+ triggerJob(jobName: string): Promise<void>;
195
+ /**
196
+ * Execute a job handler (called by the job descriptor).
197
+ */
198
+ executeJob(jobName: string, handler: (args: {
199
+ now: DateTime;
200
+ }) => Async<void>): Promise<void>;
201
+ }
202
+ interface Job {
203
+ /**
204
+ * Name of the job.
205
+ */
206
+ name: string;
207
+ /**
208
+ * Optional description of the job.
209
+ */
210
+ description?: string;
211
+ /**
212
+ * Function to run on schedule.
213
+ */
214
+ handler: (args: {
215
+ now: DateTime;
216
+ }) => Async<void>;
217
+ /**
218
+ * Cron expression to run the job.
219
+ */
220
+ cron?: string;
221
+ /**
222
+ * If true, the job will be locked and only one instance will run at a time.
223
+ * You probably need to import {@link AlephaLockRedis} for distributed locking.
224
+ *
225
+ * @default true
226
+ */
227
+ lock?: boolean;
228
+ /**
229
+ * Optional prefix for job lock keys.
230
+ */
231
+ lockPrefix?: string;
232
+ }
233
+ interface JobRegistration {
234
+ name: string;
235
+ options: Job;
236
+ lockDescriptor: LockDescriptor<() => Promise<void>> | null;
237
+ }
238
+ //#endregion
239
+ //#region src/descriptors/$job.d.ts
240
+ /**
241
+ * Job descriptor - a drop-in replacement for $scheduler with built-in execution tracking.
242
+ */
243
+ declare const $job: {
244
+ (options: JobDescriptorOptions): JobDescriptor;
245
+ [KIND]: typeof JobDescriptor;
246
+ };
247
+ type JobDescriptorOptions = Omit<Job, "name"> & {
248
+ /**
249
+ * Name of the job. Defaults to the descriptor property name.
250
+ */
251
+ name?: string;
252
+ };
253
+ declare class JobDescriptor extends Descriptor<JobDescriptorOptions> {
254
+ protected readonly jobProvider: JobProvider;
255
+ get name(): string;
256
+ protected onInit(): void;
257
+ trigger(): Promise<void>;
258
+ }
259
+ interface JobHandlerArguments {
260
+ now: DateTime;
261
+ }
262
+ //#endregion
154
263
  //#region src/entities/jobExecutions.d.ts
155
- declare const jobExecutions: _alepha_postgres48.EntityDescriptor<typebox82.TObject<{
156
- id: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TString, typeof _alepha_postgres48.PG_PRIMARY_KEY>, typeof _alepha_postgres48.PG_DEFAULT>;
157
- version: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TInteger, typeof _alepha_postgres48.PG_VERSION>, typeof _alepha_postgres48.PG_DEFAULT>;
158
- createdAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_CREATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
159
- updatedAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_UPDATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
160
- finishedAt: typebox82.TOptional<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>>;
161
- job: typebox82.TString;
162
- status: typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
163
- error: typebox82.TOptional<typebox82.TString>;
164
- logs: typebox82.TOptional<typebox82.TArray<typebox82.TObject<{
165
- level: typebox82.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
166
- message: typebox82.TString;
167
- service: typebox82.TString;
168
- module: typebox82.TString;
169
- context: typebox82.TOptional<typebox82.TString>;
170
- app: typebox82.TOptional<typebox82.TString>;
171
- data: typebox82.TOptional<typebox82.TAny>;
172
- timestamp: typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>;
264
+ declare const jobExecutions: _alepha_postgres0.EntityDescriptor<typebox79.TObject<{
265
+ id: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_PRIMARY_KEY>, typeof _alepha_postgres0.PG_DEFAULT>;
266
+ version: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TInteger, typeof _alepha_postgres0.PG_VERSION>, typeof _alepha_postgres0.PG_DEFAULT>;
267
+ createdAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_CREATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
268
+ updatedAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_UPDATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
269
+ finishedAt: typebox79.TOptional<typebox79.TString>;
270
+ job: typebox79.TString;
271
+ status: typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
272
+ error: typebox79.TOptional<typebox79.TString>;
273
+ logs: typebox79.TOptional<typebox79.TArray<typebox79.TObject<{
274
+ level: typebox79.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
275
+ message: typebox79.TString;
276
+ service: typebox79.TString;
277
+ module: typebox79.TString;
278
+ context: typebox79.TOptional<typebox79.TString>;
279
+ app: typebox79.TOptional<typebox79.TString>;
280
+ data: typebox79.TOptional<typebox79.TAny>;
281
+ timestamp: typebox79.TString;
173
282
  }>>>;
174
283
  }>>;
175
284
  type JobExecutionEntity = Static<typeof jobExecutions.schema>;
176
285
  //#endregion
177
286
  //#region src/schemas/jobExecutionResourceSchema.d.ts
178
- declare const jobExecutionResourceSchema: typebox82.TObject<{
179
- id: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TString, typeof _alepha_postgres48.PG_PRIMARY_KEY>, typeof _alepha_postgres48.PG_DEFAULT>;
180
- version: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TInteger, typeof _alepha_postgres48.PG_VERSION>, typeof _alepha_postgres48.PG_DEFAULT>;
181
- createdAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_CREATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
182
- updatedAt: _alepha_postgres48.PgAttr<_alepha_postgres48.PgAttr<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>, typeof _alepha_postgres48.PG_UPDATED_AT>, typeof _alepha_postgres48.PG_DEFAULT>;
183
- finishedAt: typebox82.TOptional<typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>>;
184
- job: typebox82.TString;
185
- status: typebox82.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
186
- error: typebox82.TOptional<typebox82.TString>;
187
- logs: typebox82.TOptional<typebox82.TArray<typebox82.TObject<{
188
- level: typebox82.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
189
- message: typebox82.TString;
190
- service: typebox82.TString;
191
- module: typebox82.TString;
192
- context: typebox82.TOptional<typebox82.TString>;
193
- app: typebox82.TOptional<typebox82.TString>;
194
- data: typebox82.TOptional<typebox82.TAny>;
195
- timestamp: typebox82.TCodec<typebox82.TString, dayjs11.Dayjs>;
287
+ declare const jobExecutionResourceSchema: typebox79.TObject<{
288
+ id: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_PRIMARY_KEY>, typeof _alepha_postgres0.PG_DEFAULT>;
289
+ version: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TInteger, typeof _alepha_postgres0.PG_VERSION>, typeof _alepha_postgres0.PG_DEFAULT>;
290
+ createdAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_CREATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
291
+ updatedAt: _alepha_postgres0.PgAttr<_alepha_postgres0.PgAttr<typebox79.TString, typeof _alepha_postgres0.PG_UPDATED_AT>, typeof _alepha_postgres0.PG_DEFAULT>;
292
+ finishedAt: typebox79.TOptional<typebox79.TString>;
293
+ job: typebox79.TString;
294
+ status: typebox79.TUnsafe<"STARTED" | "FAILED" | "COMPLETED">;
295
+ error: typebox79.TOptional<typebox79.TString>;
296
+ logs: typebox79.TOptional<typebox79.TArray<typebox79.TObject<{
297
+ level: typebox79.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
298
+ message: typebox79.TString;
299
+ service: typebox79.TString;
300
+ module: typebox79.TString;
301
+ context: typebox79.TOptional<typebox79.TString>;
302
+ app: typebox79.TOptional<typebox79.TString>;
303
+ data: typebox79.TOptional<typebox79.TAny>;
304
+ timestamp: typebox79.TString;
196
305
  }>>>;
197
306
  }>;
198
307
  type JobExecutionResource = Static<typeof jobExecutionResourceSchema>;
199
308
  //#endregion
200
309
  //#region src/schemas/triggerJobSchema.d.ts
201
- declare const triggerJobSchema: typebox82.TObject<{
202
- name: typebox82.TString;
310
+ declare const triggerJobSchema: typebox79.TObject<{
311
+ name: typebox79.TString;
203
312
  }>;
204
313
  type TriggerJob = Static<typeof triggerJobSchema>;
205
314
  //#endregion
@@ -212,7 +321,7 @@ type TriggerJob = Static<typeof triggerJobSchema>;
212
321
  *
213
322
  * @module alepha.api.jobs
214
323
  */
215
- declare const AlephaApiJobs: _alepha_core2.Service<_alepha_core2.Module<{}>>;
324
+ declare const AlephaApiJobs: _alepha_core1.Service<_alepha_core1.Module>;
216
325
  //#endregion
217
- export { AlephaApiJobs, JobController, JobExecutionEntity, JobExecutionQuery, JobExecutionResource, JobService, TriggerJob, jobExecutionQuerySchema, jobExecutionResourceSchema, jobExecutions, triggerJobSchema };
326
+ export { $job, AlephaApiJobs, Job, JobController, JobDescriptor, JobDescriptorOptions, JobExecutionEntity, JobExecutionQuery, JobExecutionResource, JobHandlerArguments, JobProvider, JobRegistration, JobService, TriggerJob, jobExecutionQuerySchema, jobExecutionResourceSchema, jobExecutions, triggerJobSchema };
218
327
  //# sourceMappingURL=index.d.ts.map