@lssm/lib.jobs 0.0.0-canary-20251217054315 → 0.0.0-canary-20251217060433

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.
@@ -0,0 +1,387 @@
1
+ import * as _lssm_lib_schema0 from "@lssm/lib.schema";
2
+ import * as _lssm_lib_contracts0 from "@lssm/lib.contracts";
3
+
4
+ //#region src/events.d.ts
5
+ /**
6
+ * Emitted when a job is enqueued.
7
+ */
8
+ declare const JobEnqueuedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
9
+ jobId: {
10
+ type: _lssm_lib_schema0.FieldType<string, string>;
11
+ isOptional: false;
12
+ };
13
+ type: {
14
+ type: _lssm_lib_schema0.FieldType<string, string>;
15
+ isOptional: false;
16
+ };
17
+ priority: {
18
+ type: _lssm_lib_schema0.FieldType<number, number>;
19
+ isOptional: false;
20
+ };
21
+ scheduledAt: {
22
+ type: _lssm_lib_schema0.FieldType<Date, string>;
23
+ isOptional: true;
24
+ };
25
+ tenantId: {
26
+ type: _lssm_lib_schema0.FieldType<string, string>;
27
+ isOptional: true;
28
+ };
29
+ enqueuedAt: {
30
+ type: _lssm_lib_schema0.FieldType<Date, string>;
31
+ isOptional: false;
32
+ };
33
+ }>>;
34
+ /**
35
+ * Emitted when a job starts processing.
36
+ */
37
+ declare const JobStartedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
38
+ jobId: {
39
+ type: _lssm_lib_schema0.FieldType<string, string>;
40
+ isOptional: false;
41
+ };
42
+ type: {
43
+ type: _lssm_lib_schema0.FieldType<string, string>;
44
+ isOptional: false;
45
+ };
46
+ attempt: {
47
+ type: _lssm_lib_schema0.FieldType<number, number>;
48
+ isOptional: false;
49
+ };
50
+ startedAt: {
51
+ type: _lssm_lib_schema0.FieldType<Date, string>;
52
+ isOptional: false;
53
+ };
54
+ }>>;
55
+ /**
56
+ * Emitted when a job completes successfully.
57
+ */
58
+ declare const JobCompletedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
59
+ jobId: {
60
+ type: _lssm_lib_schema0.FieldType<string, string>;
61
+ isOptional: false;
62
+ };
63
+ type: {
64
+ type: _lssm_lib_schema0.FieldType<string, string>;
65
+ isOptional: false;
66
+ };
67
+ attempt: {
68
+ type: _lssm_lib_schema0.FieldType<number, number>;
69
+ isOptional: false;
70
+ };
71
+ durationMs: {
72
+ type: _lssm_lib_schema0.FieldType<number, number>;
73
+ isOptional: false;
74
+ };
75
+ completedAt: {
76
+ type: _lssm_lib_schema0.FieldType<Date, string>;
77
+ isOptional: false;
78
+ };
79
+ }>>;
80
+ /**
81
+ * Emitted when a job fails (single attempt).
82
+ */
83
+ declare const JobFailedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
84
+ jobId: {
85
+ type: _lssm_lib_schema0.FieldType<string, string>;
86
+ isOptional: false;
87
+ };
88
+ type: {
89
+ type: _lssm_lib_schema0.FieldType<string, string>;
90
+ isOptional: false;
91
+ };
92
+ attempt: {
93
+ type: _lssm_lib_schema0.FieldType<number, number>;
94
+ isOptional: false;
95
+ };
96
+ error: {
97
+ type: _lssm_lib_schema0.FieldType<string, string>;
98
+ isOptional: false;
99
+ };
100
+ willRetry: {
101
+ type: _lssm_lib_schema0.FieldType<boolean, boolean>;
102
+ isOptional: false;
103
+ };
104
+ failedAt: {
105
+ type: _lssm_lib_schema0.FieldType<Date, string>;
106
+ isOptional: false;
107
+ };
108
+ }>>;
109
+ /**
110
+ * Emitted when a job is being retried.
111
+ */
112
+ declare const JobRetryingEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
113
+ jobId: {
114
+ type: _lssm_lib_schema0.FieldType<string, string>;
115
+ isOptional: false;
116
+ };
117
+ type: {
118
+ type: _lssm_lib_schema0.FieldType<string, string>;
119
+ isOptional: false;
120
+ };
121
+ attempt: {
122
+ type: _lssm_lib_schema0.FieldType<number, number>;
123
+ isOptional: false;
124
+ };
125
+ nextAttemptAt: {
126
+ type: _lssm_lib_schema0.FieldType<Date, string>;
127
+ isOptional: false;
128
+ };
129
+ backoffMs: {
130
+ type: _lssm_lib_schema0.FieldType<number, number>;
131
+ isOptional: false;
132
+ };
133
+ }>>;
134
+ /**
135
+ * Emitted when a job is moved to dead letter queue.
136
+ */
137
+ declare const JobDeadLetteredEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
138
+ jobId: {
139
+ type: _lssm_lib_schema0.FieldType<string, string>;
140
+ isOptional: false;
141
+ };
142
+ type: {
143
+ type: _lssm_lib_schema0.FieldType<string, string>;
144
+ isOptional: false;
145
+ };
146
+ attempts: {
147
+ type: _lssm_lib_schema0.FieldType<number, number>;
148
+ isOptional: false;
149
+ };
150
+ lastError: {
151
+ type: _lssm_lib_schema0.FieldType<string, string>;
152
+ isOptional: false;
153
+ };
154
+ deadLetteredAt: {
155
+ type: _lssm_lib_schema0.FieldType<Date, string>;
156
+ isOptional: false;
157
+ };
158
+ }>>;
159
+ /**
160
+ * Emitted when a job is cancelled.
161
+ */
162
+ declare const JobCancelledEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
163
+ jobId: {
164
+ type: _lssm_lib_schema0.FieldType<string, string>;
165
+ isOptional: false;
166
+ };
167
+ type: {
168
+ type: _lssm_lib_schema0.FieldType<string, string>;
169
+ isOptional: false;
170
+ };
171
+ cancelledBy: {
172
+ type: _lssm_lib_schema0.FieldType<string, string>;
173
+ isOptional: true;
174
+ };
175
+ cancelledAt: {
176
+ type: _lssm_lib_schema0.FieldType<Date, string>;
177
+ isOptional: false;
178
+ };
179
+ }>>;
180
+ /**
181
+ * Emitted when a scheduled job is triggered.
182
+ */
183
+ declare const ScheduledJobTriggeredEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
184
+ scheduleName: {
185
+ type: _lssm_lib_schema0.FieldType<string, string>;
186
+ isOptional: false;
187
+ };
188
+ jobId: {
189
+ type: _lssm_lib_schema0.FieldType<string, string>;
190
+ isOptional: false;
191
+ };
192
+ jobType: {
193
+ type: _lssm_lib_schema0.FieldType<string, string>;
194
+ isOptional: false;
195
+ };
196
+ triggeredAt: {
197
+ type: _lssm_lib_schema0.FieldType<Date, string>;
198
+ isOptional: false;
199
+ };
200
+ nextRunAt: {
201
+ type: _lssm_lib_schema0.FieldType<Date, string>;
202
+ isOptional: true;
203
+ };
204
+ }>>;
205
+ /**
206
+ * All job events.
207
+ */
208
+ declare const JobEvents: {
209
+ JobEnqueuedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
210
+ jobId: {
211
+ type: _lssm_lib_schema0.FieldType<string, string>;
212
+ isOptional: false;
213
+ };
214
+ type: {
215
+ type: _lssm_lib_schema0.FieldType<string, string>;
216
+ isOptional: false;
217
+ };
218
+ priority: {
219
+ type: _lssm_lib_schema0.FieldType<number, number>;
220
+ isOptional: false;
221
+ };
222
+ scheduledAt: {
223
+ type: _lssm_lib_schema0.FieldType<Date, string>;
224
+ isOptional: true;
225
+ };
226
+ tenantId: {
227
+ type: _lssm_lib_schema0.FieldType<string, string>;
228
+ isOptional: true;
229
+ };
230
+ enqueuedAt: {
231
+ type: _lssm_lib_schema0.FieldType<Date, string>;
232
+ isOptional: false;
233
+ };
234
+ }>>;
235
+ JobStartedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
236
+ jobId: {
237
+ type: _lssm_lib_schema0.FieldType<string, string>;
238
+ isOptional: false;
239
+ };
240
+ type: {
241
+ type: _lssm_lib_schema0.FieldType<string, string>;
242
+ isOptional: false;
243
+ };
244
+ attempt: {
245
+ type: _lssm_lib_schema0.FieldType<number, number>;
246
+ isOptional: false;
247
+ };
248
+ startedAt: {
249
+ type: _lssm_lib_schema0.FieldType<Date, string>;
250
+ isOptional: false;
251
+ };
252
+ }>>;
253
+ JobCompletedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
254
+ jobId: {
255
+ type: _lssm_lib_schema0.FieldType<string, string>;
256
+ isOptional: false;
257
+ };
258
+ type: {
259
+ type: _lssm_lib_schema0.FieldType<string, string>;
260
+ isOptional: false;
261
+ };
262
+ attempt: {
263
+ type: _lssm_lib_schema0.FieldType<number, number>;
264
+ isOptional: false;
265
+ };
266
+ durationMs: {
267
+ type: _lssm_lib_schema0.FieldType<number, number>;
268
+ isOptional: false;
269
+ };
270
+ completedAt: {
271
+ type: _lssm_lib_schema0.FieldType<Date, string>;
272
+ isOptional: false;
273
+ };
274
+ }>>;
275
+ JobFailedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
276
+ jobId: {
277
+ type: _lssm_lib_schema0.FieldType<string, string>;
278
+ isOptional: false;
279
+ };
280
+ type: {
281
+ type: _lssm_lib_schema0.FieldType<string, string>;
282
+ isOptional: false;
283
+ };
284
+ attempt: {
285
+ type: _lssm_lib_schema0.FieldType<number, number>;
286
+ isOptional: false;
287
+ };
288
+ error: {
289
+ type: _lssm_lib_schema0.FieldType<string, string>;
290
+ isOptional: false;
291
+ };
292
+ willRetry: {
293
+ type: _lssm_lib_schema0.FieldType<boolean, boolean>;
294
+ isOptional: false;
295
+ };
296
+ failedAt: {
297
+ type: _lssm_lib_schema0.FieldType<Date, string>;
298
+ isOptional: false;
299
+ };
300
+ }>>;
301
+ JobRetryingEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
302
+ jobId: {
303
+ type: _lssm_lib_schema0.FieldType<string, string>;
304
+ isOptional: false;
305
+ };
306
+ type: {
307
+ type: _lssm_lib_schema0.FieldType<string, string>;
308
+ isOptional: false;
309
+ };
310
+ attempt: {
311
+ type: _lssm_lib_schema0.FieldType<number, number>;
312
+ isOptional: false;
313
+ };
314
+ nextAttemptAt: {
315
+ type: _lssm_lib_schema0.FieldType<Date, string>;
316
+ isOptional: false;
317
+ };
318
+ backoffMs: {
319
+ type: _lssm_lib_schema0.FieldType<number, number>;
320
+ isOptional: false;
321
+ };
322
+ }>>;
323
+ JobDeadLetteredEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
324
+ jobId: {
325
+ type: _lssm_lib_schema0.FieldType<string, string>;
326
+ isOptional: false;
327
+ };
328
+ type: {
329
+ type: _lssm_lib_schema0.FieldType<string, string>;
330
+ isOptional: false;
331
+ };
332
+ attempts: {
333
+ type: _lssm_lib_schema0.FieldType<number, number>;
334
+ isOptional: false;
335
+ };
336
+ lastError: {
337
+ type: _lssm_lib_schema0.FieldType<string, string>;
338
+ isOptional: false;
339
+ };
340
+ deadLetteredAt: {
341
+ type: _lssm_lib_schema0.FieldType<Date, string>;
342
+ isOptional: false;
343
+ };
344
+ }>>;
345
+ JobCancelledEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
346
+ jobId: {
347
+ type: _lssm_lib_schema0.FieldType<string, string>;
348
+ isOptional: false;
349
+ };
350
+ type: {
351
+ type: _lssm_lib_schema0.FieldType<string, string>;
352
+ isOptional: false;
353
+ };
354
+ cancelledBy: {
355
+ type: _lssm_lib_schema0.FieldType<string, string>;
356
+ isOptional: true;
357
+ };
358
+ cancelledAt: {
359
+ type: _lssm_lib_schema0.FieldType<Date, string>;
360
+ isOptional: false;
361
+ };
362
+ }>>;
363
+ ScheduledJobTriggeredEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
364
+ scheduleName: {
365
+ type: _lssm_lib_schema0.FieldType<string, string>;
366
+ isOptional: false;
367
+ };
368
+ jobId: {
369
+ type: _lssm_lib_schema0.FieldType<string, string>;
370
+ isOptional: false;
371
+ };
372
+ jobType: {
373
+ type: _lssm_lib_schema0.FieldType<string, string>;
374
+ isOptional: false;
375
+ };
376
+ triggeredAt: {
377
+ type: _lssm_lib_schema0.FieldType<Date, string>;
378
+ isOptional: false;
379
+ };
380
+ nextRunAt: {
381
+ type: _lssm_lib_schema0.FieldType<Date, string>;
382
+ isOptional: true;
383
+ };
384
+ }>>;
385
+ };
386
+ //#endregion
387
+ export { JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEvents, JobFailedEvent, JobRetryingEvent, JobStartedEvent, ScheduledJobTriggeredEvent };
@@ -0,0 +1,9 @@
1
+ import { JobHandler } from "@lssm/lib.contracts/jobs/queue";
2
+ import { GmailIngestionAdapter } from "@lssm/lib.knowledge/ingestion/gmail-adapter";
3
+ import { EmailThreadListQuery } from "@lssm/lib.contracts/integrations/providers/email";
4
+
5
+ //#region src/handlers/gmail-sync-handler.d.ts
6
+ interface GmailSyncJobPayload extends EmailThreadListQuery {}
7
+ declare function createGmailSyncHandler(adapter: GmailIngestionAdapter): JobHandler<GmailSyncJobPayload>;
8
+ //#endregion
9
+ export { GmailSyncJobPayload, createGmailSyncHandler };
@@ -0,0 +1,9 @@
1
+ import { GmailSyncJobPayload, createGmailSyncHandler } from "./gmail-sync-handler.js";
2
+ import { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob } from "./ping-job.js";
3
+ import { StorageDocumentJobPayload, createStorageDocumentHandler } from "./storage-document-handler.js";
4
+ import { JobQueue } from "@lssm/lib.contracts/jobs/queue";
5
+
6
+ //#region src/handlers/index.d.ts
7
+ declare function registerAllJobs(queue: JobQueue): void;
8
+ //#endregion
9
+ export { GmailSyncJobPayload, PING_JOB_TYPE, PingPayload, PingPayloadSchema, StorageDocumentJobPayload, createGmailSyncHandler, createStorageDocumentHandler, pingJob, registerAllJobs };
@@ -0,0 +1,10 @@
1
+ import * as z from "zod";
2
+ import { DefinedJob } from "@lssm/lib.contracts/jobs/define-job";
3
+
4
+ //#region src/handlers/ping-job.d.ts
5
+ declare const PING_JOB_TYPE: "core.ping";
6
+ declare const PingPayloadSchema: z.ZodObject<{}, z.core.$strip>;
7
+ type PingPayload = z.infer<typeof PingPayloadSchema>;
8
+ declare const pingJob: DefinedJob<PingPayload>;
9
+ //#endregion
10
+ export { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob };
@@ -0,0 +1,12 @@
1
+ import { JobHandler } from "@lssm/lib.contracts/jobs/queue";
2
+ import { ObjectStorageProvider } from "@lssm/lib.contracts/integrations/providers/storage";
3
+ import { StorageIngestionAdapter } from "@lssm/lib.knowledge/ingestion/storage-adapter";
4
+
5
+ //#region src/handlers/storage-document-handler.d.ts
6
+ interface StorageDocumentJobPayload {
7
+ bucket: string;
8
+ key: string;
9
+ }
10
+ declare function createStorageDocumentHandler(storage: ObjectStorageProvider, adapter: StorageIngestionAdapter): JobHandler<StorageDocumentJobPayload>;
11
+ //#endregion
12
+ export { StorageDocumentJobPayload, createStorageDocumentHandler };
@@ -0,0 +1,24 @@
1
+ import { __export, __reExport } from "./_virtual/rolldown_runtime.js";
2
+ import { CancelJobContract, CreateScheduledJobContract, EnqueueJobContract, GetJobContract, GetQueueStatsContract, JobModel, ListScheduledJobsContract, QueueStatsModel, ScheduledJobModel, ToggleScheduledJobContract } from "./contracts/index.js";
3
+ import { JobEntity, JobExecutionEntity, JobStatusEnum, ScheduledJobEntity, jobEntities, jobsSchemaContribution } from "./entities/index.js";
4
+ import { JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEvents, JobFailedEvent, JobRetryingEvent, JobStartedEvent, ScheduledJobTriggeredEvent } from "./events.js";
5
+ import { GmailSyncJobPayload, createGmailSyncHandler } from "./handlers/gmail-sync-handler.js";
6
+ import { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob } from "./handlers/ping-job.js";
7
+ import { StorageDocumentJobPayload, createStorageDocumentHandler } from "./handlers/storage-document-handler.js";
8
+ import { registerAllJobs } from "./handlers/index.js";
9
+ import { MemoryJobQueue, MemoryQueueOptions } from "./queue/memory-queue.js";
10
+ import { ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials } from "./queue/scaleway-sqs-queue.js";
11
+ import { GcpCloudTasksQueue, GcpCloudTasksQueueOptions } from "./queue/gcp-cloud-tasks.js";
12
+ import { GcpPubSubQueue, GcpPubSubQueueOptions } from "./queue/gcp-pubsub.js";
13
+ import { registerDefinedJob } from "./queue/register-defined-job.js";
14
+ import { index_d_exports as index_d_exports$1 } from "./queue/index.js";
15
+ import { ActiveSchedule, JobScheduler, ScheduledJobConfig, createScheduler, defineSchedule } from "./scheduler/index.js";
16
+ import { JobsFeature } from "./jobs.feature.js";
17
+ export * from "@lssm/lib.contracts/jobs/queue";
18
+
19
+ //#region src/index.d.ts
20
+ declare namespace index_d_exports {
21
+ export { ActiveSchedule, CancelJobContract, CreateScheduledJobContract, EnqueueJobContract, GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, GetJobContract, GetQueueStatsContract, GmailSyncJobPayload, JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEntity, JobEvents, JobExecutionEntity, JobFailedEvent, JobModel, JobRetryingEvent, JobScheduler, JobStartedEvent, JobStatusEnum, JobsFeature, ListScheduledJobsContract, MemoryJobQueue, MemoryQueueOptions, PING_JOB_TYPE, PingPayload, PingPayloadSchema, QueueStatsModel, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, ScheduledJobConfig, ScheduledJobEntity, ScheduledJobModel, ScheduledJobTriggeredEvent, StorageDocumentJobPayload, ToggleScheduledJobContract, createGmailSyncHandler, createScheduler, createStorageDocumentHandler, defineSchedule, jobEntities, jobsSchemaContribution, pingJob, registerAllJobs, registerDefinedJob };
22
+ }
23
+ //#endregion
24
+ export { ActiveSchedule, CancelJobContract, CreateScheduledJobContract, EnqueueJobContract, GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, GetJobContract, GetQueueStatsContract, GmailSyncJobPayload, JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEntity, JobEvents, JobExecutionEntity, JobFailedEvent, JobModel, JobRetryingEvent, JobScheduler, JobStartedEvent, JobStatusEnum, JobsFeature, ListScheduledJobsContract, MemoryJobQueue, MemoryQueueOptions, PING_JOB_TYPE, PingPayload, PingPayloadSchema, QueueStatsModel, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, ScheduledJobConfig, ScheduledJobEntity, ScheduledJobModel, ScheduledJobTriggeredEvent, StorageDocumentJobPayload, ToggleScheduledJobContract, createGmailSyncHandler, createScheduler, createStorageDocumentHandler, defineSchedule, jobEntities, jobsSchemaContribution, pingJob, registerAllJobs, registerDefinedJob };
@@ -0,0 +1,11 @@
1
+ import { FeatureModuleSpec } from "@lssm/lib.contracts";
2
+
3
+ //#region src/jobs.feature.d.ts
4
+
5
+ /**
6
+ * Jobs feature module that bundles job queue management,
7
+ * background processing, and scheduled task capabilities.
8
+ */
9
+ declare const JobsFeature: FeatureModuleSpec;
10
+ //#endregion
11
+ export { JobsFeature };
@@ -0,0 +1,41 @@
1
+ import { types_d_exports } from "./types.js";
2
+
3
+ //#region src/queue/gcp-cloud-tasks.d.ts
4
+ interface CloudTasksClientLike {
5
+ createTask(request: {
6
+ parent: string;
7
+ task: {
8
+ httpRequest: {
9
+ httpMethod: number | string;
10
+ url: string;
11
+ body: Buffer;
12
+ headers?: Record<string, string>;
13
+ oidcToken?: {
14
+ serviceAccountEmail: string;
15
+ };
16
+ };
17
+ scheduleTime?: {
18
+ seconds: number;
19
+ };
20
+ };
21
+ }): Promise<unknown>;
22
+ }
23
+ interface GcpCloudTasksQueueOptions {
24
+ client: CloudTasksClientLike;
25
+ projectId: string;
26
+ location: string;
27
+ queue: string;
28
+ resolveUrl(jobType: string): string;
29
+ serviceAccountEmail?: string;
30
+ }
31
+ declare class GcpCloudTasksQueue implements types_d_exports.JobQueue {
32
+ private readonly options;
33
+ private readonly handlers;
34
+ constructor(options: GcpCloudTasksQueueOptions);
35
+ enqueue<TPayload>(jobType: string, payload: TPayload, options?: types_d_exports.EnqueueOptions): Promise<types_d_exports.Job<TPayload>>;
36
+ register<TPayload, TResult = void>(jobType: string, handler: types_d_exports.JobHandler<TPayload, TResult>): void;
37
+ start(): void;
38
+ stop(): Promise<void>;
39
+ }
40
+ //#endregion
41
+ export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions };
@@ -0,0 +1,25 @@
1
+ import { types_d_exports } from "./types.js";
2
+
3
+ //#region src/queue/gcp-pubsub.d.ts
4
+ interface PubSubClientLike {
5
+ topic(name: string): {
6
+ publishMessage(message: {
7
+ data: Buffer;
8
+ }): Promise<string>;
9
+ };
10
+ }
11
+ interface GcpPubSubQueueOptions {
12
+ client: PubSubClientLike;
13
+ topicName: string;
14
+ }
15
+ declare class GcpPubSubQueue implements types_d_exports.JobQueue {
16
+ private readonly options;
17
+ private readonly handlers;
18
+ constructor(options: GcpPubSubQueueOptions);
19
+ enqueue<TPayload>(jobType: string, payload: TPayload, options?: types_d_exports.EnqueueOptions): Promise<types_d_exports.Job<TPayload>>;
20
+ register<TPayload, TResult = void>(jobType: string, handler: types_d_exports.JobHandler<TPayload, TResult>): void;
21
+ start(): void;
22
+ stop(): Promise<void>;
23
+ }
24
+ //#endregion
25
+ export { GcpPubSubQueue, GcpPubSubQueueOptions };
@@ -0,0 +1,15 @@
1
+ import { __export, __reExport } from "../_virtual/rolldown_runtime.js";
2
+ import { types_d_exports } from "./types.js";
3
+ import { MemoryJobQueue, MemoryQueueOptions } from "./memory-queue.js";
4
+ import { ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials } from "./scaleway-sqs-queue.js";
5
+ import { GcpCloudTasksQueue, GcpCloudTasksQueueOptions } from "./gcp-cloud-tasks.js";
6
+ import { GcpPubSubQueue, GcpPubSubQueueOptions } from "./gcp-pubsub.js";
7
+ import { registerDefinedJob } from "./register-defined-job.js";
8
+ export * from "@lssm/lib.contracts/jobs/queue";
9
+
10
+ //#region src/queue/index.d.ts
11
+ declare namespace index_d_exports {
12
+ export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, MemoryJobQueue, MemoryQueueOptions, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, registerDefinedJob };
13
+ }
14
+ //#endregion
15
+ export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, MemoryJobQueue, MemoryQueueOptions, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, index_d_exports, registerDefinedJob };
@@ -0,0 +1,34 @@
1
+ import { types_d_exports } from "./types.js";
2
+
3
+ //#region src/queue/memory-queue.d.ts
4
+ interface MemoryQueueOptions {
5
+ /** Poll interval in milliseconds */
6
+ pollIntervalMs?: number;
7
+ /** Maximum concurrent jobs */
8
+ concurrency?: number;
9
+ /** Default retry policy */
10
+ retryPolicy?: types_d_exports.RetryPolicy;
11
+ }
12
+ /**
13
+ * In-memory job queue for development and testing.
14
+ */
15
+ declare class MemoryJobQueue implements types_d_exports.JobQueue {
16
+ private readonly jobs;
17
+ private readonly handlers;
18
+ private timer?;
19
+ private activeCount;
20
+ private readonly pollIntervalMs;
21
+ private readonly concurrency;
22
+ private readonly retryPolicy;
23
+ constructor(options?: MemoryQueueOptions);
24
+ enqueue<TPayload>(jobType: string, payload: TPayload, options?: types_d_exports.EnqueueOptions): Promise<types_d_exports.Job<TPayload>>;
25
+ register<TPayload, TResult = void>(jobType: string, handler: types_d_exports.JobHandler<TPayload, TResult>): void;
26
+ start(): void;
27
+ stop(): Promise<void>;
28
+ getJob(jobId: string): Promise<types_d_exports.Job | null>;
29
+ cancelJob(jobId: string): Promise<boolean>;
30
+ getStats(): Promise<types_d_exports.QueueStats>;
31
+ private processNext;
32
+ }
33
+ //#endregion
34
+ export { MemoryJobQueue, MemoryQueueOptions };
@@ -0,0 +1,7 @@
1
+ import { JobQueue } from "@lssm/lib.contracts/jobs/queue";
2
+ import { DefinedJob } from "@lssm/lib.contracts/jobs/define-job";
3
+
4
+ //#region src/queue/register-defined-job.d.ts
5
+ declare function registerDefinedJob<TPayload>(queue: JobQueue, def: DefinedJob<TPayload>): void;
6
+ //#endregion
7
+ export { registerDefinedJob };
@@ -0,0 +1,38 @@
1
+ import { types_d_exports } from "./types.js";
2
+ import { Logger } from "@lssm/lib.logger";
3
+
4
+ //#region src/queue/scaleway-sqs-queue.d.ts
5
+ interface ScalewaySqsQueueCredentials {
6
+ accessKeyId: string;
7
+ secretAccessKey: string;
8
+ }
9
+ interface ScalewaySqsQueueConfig {
10
+ queueUrl: string;
11
+ region?: string;
12
+ endpoint?: string;
13
+ waitTimeSeconds?: number;
14
+ maxNumberOfMessages?: number;
15
+ visibilityTimeoutSeconds?: number;
16
+ credentials?: ScalewaySqsQueueCredentials;
17
+ logger?: Logger;
18
+ }
19
+ declare class ScalewaySqsJobQueue implements types_d_exports.JobQueue {
20
+ private readonly sqs;
21
+ private readonly queueUrl;
22
+ private readonly waitTimeSeconds;
23
+ private readonly maxNumberOfMessages;
24
+ private readonly visibilityTimeoutSeconds;
25
+ private readonly handlers;
26
+ private readonly logger?;
27
+ private running;
28
+ constructor(config: ScalewaySqsQueueConfig);
29
+ enqueue<TPayload>(jobType: string, payload: TPayload, options?: types_d_exports.EnqueueOptions): Promise<types_d_exports.Job<TPayload>>;
30
+ register<TPayload, TResult = void>(jobType: string, handler: types_d_exports.JobHandler<TPayload, TResult>): void;
31
+ start(): void;
32
+ stop(): Promise<void>;
33
+ private pollLoop;
34
+ private deleteMessage;
35
+ private sleep;
36
+ }
37
+ //#endregion
38
+ export { ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials };
@@ -0,0 +1,7 @@
1
+ export * from "@lssm/lib.contracts/jobs/queue";
2
+
3
+ //#region src/queue/types.d.ts
4
+
5
+ import * as import___lssm_lib_contracts_jobs_queue from "@lssm/lib.contracts/jobs/queue";
6
+ //#endregion
7
+ export { import___lssm_lib_contracts_jobs_queue as types_d_exports };