@contractspec/lib.jobs 1.57.0 → 1.59.0

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 (92) hide show
  1. package/dist/contracts/index.d.ts +494 -500
  2. package/dist/contracts/index.d.ts.map +1 -1
  3. package/dist/contracts/index.js +298 -461
  4. package/dist/entities/index.d.ts +117 -122
  5. package/dist/entities/index.d.ts.map +1 -1
  6. package/dist/entities/index.js +170 -193
  7. package/dist/events.d.ts +297 -303
  8. package/dist/events.d.ts.map +1 -1
  9. package/dist/events.js +199 -351
  10. package/dist/handlers/gmail-sync-handler.d.ts +5 -9
  11. package/dist/handlers/gmail-sync-handler.d.ts.map +1 -1
  12. package/dist/handlers/gmail-sync-handler.js +8 -8
  13. package/dist/handlers/index.d.ts +5 -9
  14. package/dist/handlers/index.d.ts.map +1 -1
  15. package/dist/handlers/index.js +53 -10
  16. package/dist/handlers/ping-job.d.ts +6 -10
  17. package/dist/handlers/ping-job.d.ts.map +1 -1
  18. package/dist/handlers/ping-job.js +13 -12
  19. package/dist/handlers/storage-document-handler.d.ts +7 -11
  20. package/dist/handlers/storage-document-handler.d.ts.map +1 -1
  21. package/dist/handlers/storage-document-handler.js +15 -13
  22. package/dist/index.d.ts +7 -24
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1366 -64
  25. package/dist/jobs.capability.d.ts +2 -7
  26. package/dist/jobs.capability.d.ts.map +1 -1
  27. package/dist/jobs.capability.js +29 -33
  28. package/dist/jobs.feature.d.ts +1 -6
  29. package/dist/jobs.feature.d.ts.map +1 -1
  30. package/dist/jobs.feature.js +45 -108
  31. package/dist/node/contracts/index.js +318 -0
  32. package/dist/node/entities/index.js +174 -0
  33. package/dist/node/events.js +200 -0
  34. package/dist/node/handlers/gmail-sync-handler.js +9 -0
  35. package/dist/node/handlers/index.js +55 -0
  36. package/dist/node/handlers/ping-job.js +14 -0
  37. package/dist/node/handlers/storage-document-handler.js +16 -0
  38. package/dist/node/index.js +1368 -0
  39. package/dist/node/jobs.capability.js +28 -0
  40. package/dist/node/jobs.feature.js +46 -0
  41. package/dist/node/queue/gcp-cloud-tasks.js +66 -0
  42. package/dist/node/queue/gcp-pubsub.js +54 -0
  43. package/dist/node/queue/index.js +478 -0
  44. package/dist/node/queue/memory-queue.js +160 -0
  45. package/dist/node/queue/register-defined-job.js +15 -0
  46. package/dist/node/queue/scaleway-sqs-queue.js +206 -0
  47. package/dist/node/queue/types.js +10 -0
  48. package/dist/node/scheduler/index.js +117 -0
  49. package/dist/queue/gcp-cloud-tasks.d.ts +33 -36
  50. package/dist/queue/gcp-cloud-tasks.d.ts.map +1 -1
  51. package/dist/queue/gcp-cloud-tasks.js +65 -59
  52. package/dist/queue/gcp-pubsub.d.ts +18 -21
  53. package/dist/queue/gcp-pubsub.d.ts.map +1 -1
  54. package/dist/queue/gcp-pubsub.js +53 -45
  55. package/dist/queue/index.d.ts +6 -15
  56. package/dist/queue/index.d.ts.map +1 -1
  57. package/dist/queue/index.js +476 -20
  58. package/dist/queue/memory-queue.d.ts +25 -29
  59. package/dist/queue/memory-queue.d.ts.map +1 -1
  60. package/dist/queue/memory-queue.js +159 -138
  61. package/dist/queue/register-defined-job.d.ts +3 -7
  62. package/dist/queue/register-defined-job.d.ts.map +1 -1
  63. package/dist/queue/register-defined-job.js +14 -14
  64. package/dist/queue/scaleway-sqs-queue.d.ts +31 -35
  65. package/dist/queue/scaleway-sqs-queue.d.ts.map +1 -1
  66. package/dist/queue/scaleway-sqs-queue.js +205 -173
  67. package/dist/queue/types.d.ts +2 -8
  68. package/dist/queue/types.d.ts.map +1 -1
  69. package/dist/queue/types.js +11 -12
  70. package/dist/scheduler/index.d.ts +68 -72
  71. package/dist/scheduler/index.d.ts.map +1 -1
  72. package/dist/scheduler/index.js +113 -141
  73. package/package.json +176 -50
  74. package/dist/_virtual/_rolldown/runtime.js +0 -36
  75. package/dist/contracts/index.js.map +0 -1
  76. package/dist/entities/index.js.map +0 -1
  77. package/dist/events.js.map +0 -1
  78. package/dist/handlers/gmail-sync-handler.js.map +0 -1
  79. package/dist/handlers/index.js.map +0 -1
  80. package/dist/handlers/ping-job.js.map +0 -1
  81. package/dist/handlers/storage-document-handler.js.map +0 -1
  82. package/dist/index.js.map +0 -1
  83. package/dist/jobs.capability.js.map +0 -1
  84. package/dist/jobs.feature.js.map +0 -1
  85. package/dist/queue/gcp-cloud-tasks.js.map +0 -1
  86. package/dist/queue/gcp-pubsub.js.map +0 -1
  87. package/dist/queue/index.js.map +0 -1
  88. package/dist/queue/memory-queue.js.map +0 -1
  89. package/dist/queue/register-defined-job.js.map +0 -1
  90. package/dist/queue/scaleway-sqs-queue.js.map +0 -1
  91. package/dist/queue/types.js.map +0 -1
  92. package/dist/scheduler/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"mappings":";;;;;;;cA0Ga,gBAAA,EAAgB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU3B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,eAAA,EAAe,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU1B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;cAKW,iBAAA,EAAiB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU5B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;cAKW,cAAA,EAAc,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAUzB,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,gBAAA,EAAgB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU3B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;cAKW,oBAAA,EAAoB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAW/B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;cAKW,iBAAA,EAAiB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU5B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;cAKW,0BAAA,EAA0B,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAUrC,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;AAzCF;;cA8Ca,SAAA;;;YASZ,yBAAA,CAAA,SAAA"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAuGA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;GAU3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;GAU1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;GAU5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;GAUzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;GAU3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;GAW/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;GAU5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;GAUrC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASrB,CAAC"}
package/dist/events.js CHANGED
@@ -1,353 +1,201 @@
1
+ // @bun
2
+ // src/events.ts
1
3
  import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
- import { StabilityEnum, defineEvent } from "@contractspec/lib.contracts";
3
-
4
- //#region src/events.ts
5
- const JobEnqueuedPayload = defineSchemaModel({
6
- name: "JobEnqueuedEventPayload",
7
- description: "Payload when a job is added to the queue",
8
- fields: {
9
- jobId: {
10
- type: ScalarTypeEnum.String_unsecure(),
11
- isOptional: false
12
- },
13
- type: {
14
- type: ScalarTypeEnum.String_unsecure(),
15
- isOptional: false
16
- },
17
- priority: {
18
- type: ScalarTypeEnum.Int_unsecure(),
19
- isOptional: false
20
- },
21
- scheduledAt: {
22
- type: ScalarTypeEnum.DateTime(),
23
- isOptional: true
24
- },
25
- tenantId: {
26
- type: ScalarTypeEnum.String_unsecure(),
27
- isOptional: true
28
- },
29
- enqueuedAt: {
30
- type: ScalarTypeEnum.DateTime(),
31
- isOptional: false
32
- }
33
- }
34
- });
35
- const JobStartedPayload = defineSchemaModel({
36
- name: "JobStartedEventPayload",
37
- description: "Payload when a job starts processing",
38
- fields: {
39
- jobId: {
40
- type: ScalarTypeEnum.String_unsecure(),
41
- isOptional: false
42
- },
43
- type: {
44
- type: ScalarTypeEnum.String_unsecure(),
45
- isOptional: false
46
- },
47
- attempt: {
48
- type: ScalarTypeEnum.Int_unsecure(),
49
- isOptional: false
50
- },
51
- startedAt: {
52
- type: ScalarTypeEnum.DateTime(),
53
- isOptional: false
54
- }
55
- }
56
- });
57
- const JobCompletedPayload = defineSchemaModel({
58
- name: "JobCompletedEventPayload",
59
- description: "Payload when a job completes successfully",
60
- fields: {
61
- jobId: {
62
- type: ScalarTypeEnum.String_unsecure(),
63
- isOptional: false
64
- },
65
- type: {
66
- type: ScalarTypeEnum.String_unsecure(),
67
- isOptional: false
68
- },
69
- attempt: {
70
- type: ScalarTypeEnum.Int_unsecure(),
71
- isOptional: false
72
- },
73
- durationMs: {
74
- type: ScalarTypeEnum.Int_unsecure(),
75
- isOptional: false
76
- },
77
- completedAt: {
78
- type: ScalarTypeEnum.DateTime(),
79
- isOptional: false
80
- }
81
- }
82
- });
83
- const JobFailedPayload = defineSchemaModel({
84
- name: "JobFailedEventPayload",
85
- description: "Payload when a job attempt fails",
86
- fields: {
87
- jobId: {
88
- type: ScalarTypeEnum.String_unsecure(),
89
- isOptional: false
90
- },
91
- type: {
92
- type: ScalarTypeEnum.String_unsecure(),
93
- isOptional: false
94
- },
95
- attempt: {
96
- type: ScalarTypeEnum.Int_unsecure(),
97
- isOptional: false
98
- },
99
- error: {
100
- type: ScalarTypeEnum.String_unsecure(),
101
- isOptional: false
102
- },
103
- willRetry: {
104
- type: ScalarTypeEnum.Boolean(),
105
- isOptional: false
106
- },
107
- failedAt: {
108
- type: ScalarTypeEnum.DateTime(),
109
- isOptional: false
110
- }
111
- }
112
- });
113
- const JobRetryingPayload = defineSchemaModel({
114
- name: "JobRetryingEventPayload",
115
- description: "Payload when a job is scheduled for retry",
116
- fields: {
117
- jobId: {
118
- type: ScalarTypeEnum.String_unsecure(),
119
- isOptional: false
120
- },
121
- type: {
122
- type: ScalarTypeEnum.String_unsecure(),
123
- isOptional: false
124
- },
125
- attempt: {
126
- type: ScalarTypeEnum.Int_unsecure(),
127
- isOptional: false
128
- },
129
- nextAttemptAt: {
130
- type: ScalarTypeEnum.DateTime(),
131
- isOptional: false
132
- },
133
- backoffMs: {
134
- type: ScalarTypeEnum.Int_unsecure(),
135
- isOptional: false
136
- }
137
- }
138
- });
139
- const JobDeadLetteredPayload = defineSchemaModel({
140
- name: "JobDeadLetteredEventPayload",
141
- description: "Payload when a job is moved to dead letter queue",
142
- fields: {
143
- jobId: {
144
- type: ScalarTypeEnum.String_unsecure(),
145
- isOptional: false
146
- },
147
- type: {
148
- type: ScalarTypeEnum.String_unsecure(),
149
- isOptional: false
150
- },
151
- attempts: {
152
- type: ScalarTypeEnum.Int_unsecure(),
153
- isOptional: false
154
- },
155
- lastError: {
156
- type: ScalarTypeEnum.String_unsecure(),
157
- isOptional: false
158
- },
159
- deadLetteredAt: {
160
- type: ScalarTypeEnum.DateTime(),
161
- isOptional: false
162
- }
163
- }
164
- });
165
- const JobCancelledPayload = defineSchemaModel({
166
- name: "JobCancelledEventPayload",
167
- description: "Payload when a job is cancelled",
168
- fields: {
169
- jobId: {
170
- type: ScalarTypeEnum.String_unsecure(),
171
- isOptional: false
172
- },
173
- type: {
174
- type: ScalarTypeEnum.String_unsecure(),
175
- isOptional: false
176
- },
177
- cancelledBy: {
178
- type: ScalarTypeEnum.String_unsecure(),
179
- isOptional: true
180
- },
181
- cancelledAt: {
182
- type: ScalarTypeEnum.DateTime(),
183
- isOptional: false
184
- }
185
- }
186
- });
187
- const ScheduledJobTriggeredPayload = defineSchemaModel({
188
- name: "ScheduledJobTriggeredEventPayload",
189
- description: "Payload when a scheduled job is triggered",
190
- fields: {
191
- scheduleName: {
192
- type: ScalarTypeEnum.String_unsecure(),
193
- isOptional: false
194
- },
195
- jobId: {
196
- type: ScalarTypeEnum.String_unsecure(),
197
- isOptional: false
198
- },
199
- jobType: {
200
- type: ScalarTypeEnum.String_unsecure(),
201
- isOptional: false
202
- },
203
- triggeredAt: {
204
- type: ScalarTypeEnum.DateTime(),
205
- isOptional: false
206
- },
207
- nextRunAt: {
208
- type: ScalarTypeEnum.DateTime(),
209
- isOptional: true
210
- }
211
- }
212
- });
213
- /**
214
- * Emitted when a job is enqueued.
215
- */
216
- const JobEnqueuedEvent = defineEvent({
217
- meta: {
218
- key: "job.enqueued",
219
- version: "1.0.0",
220
- description: "A job has been added to the queue.",
221
- stability: StabilityEnum.Stable,
222
- owners: ["@contractspec.libs.jobs"],
223
- tags: ["job-queue", "lifecycle"]
224
- },
225
- payload: JobEnqueuedPayload
226
- });
227
- /**
228
- * Emitted when a job starts processing.
229
- */
230
- const JobStartedEvent = defineEvent({
231
- meta: {
232
- key: "job.started",
233
- version: "1.0.0",
234
- description: "A job has started processing.",
235
- stability: StabilityEnum.Stable,
236
- owners: ["@contractspec.libs.jobs"],
237
- tags: ["job-queue", "lifecycle"]
238
- },
239
- payload: JobStartedPayload
240
- });
241
- /**
242
- * Emitted when a job completes successfully.
243
- */
244
- const JobCompletedEvent = defineEvent({
245
- meta: {
246
- key: "job.completed",
247
- version: "1.0.0",
248
- description: "A job has completed successfully.",
249
- stability: StabilityEnum.Stable,
250
- owners: ["@contractspec.libs.jobs"],
251
- tags: ["job-queue", "lifecycle"]
252
- },
253
- payload: JobCompletedPayload
254
- });
255
- /**
256
- * Emitted when a job fails (single attempt).
257
- */
258
- const JobFailedEvent = defineEvent({
259
- meta: {
260
- key: "job.failed",
261
- version: "1.0.0",
262
- description: "A job attempt has failed.",
263
- stability: StabilityEnum.Stable,
264
- owners: ["@contractspec.libs.jobs"],
265
- tags: [
266
- "job-queue",
267
- "lifecycle",
268
- "error"
269
- ]
270
- },
271
- payload: JobFailedPayload
272
- });
273
- /**
274
- * Emitted when a job is being retried.
275
- */
276
- const JobRetryingEvent = defineEvent({
277
- meta: {
278
- key: "job.retrying",
279
- version: "1.0.0",
280
- description: "A job is being scheduled for retry.",
281
- stability: StabilityEnum.Stable,
282
- owners: ["@contractspec.libs.jobs"],
283
- tags: [
284
- "job-queue",
285
- "lifecycle",
286
- "retry"
287
- ]
288
- },
289
- payload: JobRetryingPayload
290
- });
291
- /**
292
- * Emitted when a job is moved to dead letter queue.
293
- */
294
- const JobDeadLetteredEvent = defineEvent({
295
- meta: {
296
- key: "job.dead_lettered",
297
- version: "1.0.0",
298
- description: "A job has exhausted all retries and moved to dead letter queue.",
299
- stability: StabilityEnum.Stable,
300
- owners: ["@contractspec.libs.jobs"],
301
- tags: [
302
- "job-queue",
303
- "lifecycle",
304
- "error"
305
- ]
306
- },
307
- payload: JobDeadLetteredPayload
308
- });
309
- /**
310
- * Emitted when a job is cancelled.
311
- */
312
- const JobCancelledEvent = defineEvent({
313
- meta: {
314
- key: "job.cancelled",
315
- version: "1.0.0",
316
- description: "A job has been cancelled.",
317
- stability: StabilityEnum.Stable,
318
- owners: ["@contractspec.libs.jobs"],
319
- tags: ["job-queue", "lifecycle"]
320
- },
321
- payload: JobCancelledPayload
322
- });
323
- /**
324
- * Emitted when a scheduled job is triggered.
325
- */
326
- const ScheduledJobTriggeredEvent = defineEvent({
327
- meta: {
328
- key: "scheduler.job_triggered",
329
- version: "1.0.0",
330
- description: "A scheduled job has been triggered.",
331
- stability: StabilityEnum.Stable,
332
- owners: ["@contractspec.libs.jobs"],
333
- tags: ["job-queue", "scheduler"]
334
- },
335
- payload: ScheduledJobTriggeredPayload
336
- });
337
- /**
338
- * All job events.
339
- */
340
- const JobEvents = {
341
- JobEnqueuedEvent,
342
- JobStartedEvent,
343
- JobCompletedEvent,
344
- JobFailedEvent,
345
- JobRetryingEvent,
346
- JobDeadLetteredEvent,
347
- JobCancelledEvent,
348
- ScheduledJobTriggeredEvent
4
+ import { defineEvent, StabilityEnum } from "@contractspec/lib.contracts";
5
+ var JobEnqueuedPayload = defineSchemaModel({
6
+ name: "JobEnqueuedEventPayload",
7
+ description: "Payload when a job is added to the queue",
8
+ fields: {
9
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
+ priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
12
+ scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
13
+ tenantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
14
+ enqueuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
15
+ }
16
+ });
17
+ var JobStartedPayload = defineSchemaModel({
18
+ name: "JobStartedEventPayload",
19
+ description: "Payload when a job starts processing",
20
+ fields: {
21
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
+ attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
24
+ startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
25
+ }
26
+ });
27
+ var JobCompletedPayload = defineSchemaModel({
28
+ name: "JobCompletedEventPayload",
29
+ description: "Payload when a job completes successfully",
30
+ fields: {
31
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
32
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
33
+ attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
34
+ durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
35
+ completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
36
+ }
37
+ });
38
+ var JobFailedPayload = defineSchemaModel({
39
+ name: "JobFailedEventPayload",
40
+ description: "Payload when a job attempt fails",
41
+ fields: {
42
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
43
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
44
+ attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
45
+ error: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
46
+ willRetry: { type: ScalarTypeEnum.Boolean(), isOptional: false },
47
+ failedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
48
+ }
49
+ });
50
+ var JobRetryingPayload = defineSchemaModel({
51
+ name: "JobRetryingEventPayload",
52
+ description: "Payload when a job is scheduled for retry",
53
+ fields: {
54
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
55
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
56
+ attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
57
+ nextAttemptAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
58
+ backoffMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
59
+ }
60
+ });
61
+ var JobDeadLetteredPayload = defineSchemaModel({
62
+ name: "JobDeadLetteredEventPayload",
63
+ description: "Payload when a job is moved to dead letter queue",
64
+ fields: {
65
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
66
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
67
+ attempts: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
68
+ lastError: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
69
+ deadLetteredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
70
+ }
71
+ });
72
+ var JobCancelledPayload = defineSchemaModel({
73
+ name: "JobCancelledEventPayload",
74
+ description: "Payload when a job is cancelled",
75
+ fields: {
76
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
77
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
78
+ cancelledBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
79
+ cancelledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
80
+ }
81
+ });
82
+ var ScheduledJobTriggeredPayload = defineSchemaModel({
83
+ name: "ScheduledJobTriggeredEventPayload",
84
+ description: "Payload when a scheduled job is triggered",
85
+ fields: {
86
+ scheduleName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
87
+ jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
88
+ jobType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
89
+ triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
90
+ nextRunAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
91
+ }
92
+ });
93
+ var JobEnqueuedEvent = defineEvent({
94
+ meta: {
95
+ key: "job.enqueued",
96
+ version: "1.0.0",
97
+ description: "A job has been added to the queue.",
98
+ stability: StabilityEnum.Stable,
99
+ owners: ["@contractspec.libs.jobs"],
100
+ tags: ["job-queue", "lifecycle"]
101
+ },
102
+ payload: JobEnqueuedPayload
103
+ });
104
+ var JobStartedEvent = defineEvent({
105
+ meta: {
106
+ key: "job.started",
107
+ version: "1.0.0",
108
+ description: "A job has started processing.",
109
+ stability: StabilityEnum.Stable,
110
+ owners: ["@contractspec.libs.jobs"],
111
+ tags: ["job-queue", "lifecycle"]
112
+ },
113
+ payload: JobStartedPayload
114
+ });
115
+ var JobCompletedEvent = defineEvent({
116
+ meta: {
117
+ key: "job.completed",
118
+ version: "1.0.0",
119
+ description: "A job has completed successfully.",
120
+ stability: StabilityEnum.Stable,
121
+ owners: ["@contractspec.libs.jobs"],
122
+ tags: ["job-queue", "lifecycle"]
123
+ },
124
+ payload: JobCompletedPayload
125
+ });
126
+ var JobFailedEvent = defineEvent({
127
+ meta: {
128
+ key: "job.failed",
129
+ version: "1.0.0",
130
+ description: "A job attempt has failed.",
131
+ stability: StabilityEnum.Stable,
132
+ owners: ["@contractspec.libs.jobs"],
133
+ tags: ["job-queue", "lifecycle", "error"]
134
+ },
135
+ payload: JobFailedPayload
136
+ });
137
+ var JobRetryingEvent = defineEvent({
138
+ meta: {
139
+ key: "job.retrying",
140
+ version: "1.0.0",
141
+ description: "A job is being scheduled for retry.",
142
+ stability: StabilityEnum.Stable,
143
+ owners: ["@contractspec.libs.jobs"],
144
+ tags: ["job-queue", "lifecycle", "retry"]
145
+ },
146
+ payload: JobRetryingPayload
147
+ });
148
+ var JobDeadLetteredEvent = defineEvent({
149
+ meta: {
150
+ key: "job.dead_lettered",
151
+ version: "1.0.0",
152
+ description: "A job has exhausted all retries and moved to dead letter queue.",
153
+ stability: StabilityEnum.Stable,
154
+ owners: ["@contractspec.libs.jobs"],
155
+ tags: ["job-queue", "lifecycle", "error"]
156
+ },
157
+ payload: JobDeadLetteredPayload
158
+ });
159
+ var JobCancelledEvent = defineEvent({
160
+ meta: {
161
+ key: "job.cancelled",
162
+ version: "1.0.0",
163
+ description: "A job has been cancelled.",
164
+ stability: StabilityEnum.Stable,
165
+ owners: ["@contractspec.libs.jobs"],
166
+ tags: ["job-queue", "lifecycle"]
167
+ },
168
+ payload: JobCancelledPayload
169
+ });
170
+ var ScheduledJobTriggeredEvent = defineEvent({
171
+ meta: {
172
+ key: "scheduler.job_triggered",
173
+ version: "1.0.0",
174
+ description: "A scheduled job has been triggered.",
175
+ stability: StabilityEnum.Stable,
176
+ owners: ["@contractspec.libs.jobs"],
177
+ tags: ["job-queue", "scheduler"]
178
+ },
179
+ payload: ScheduledJobTriggeredPayload
180
+ });
181
+ var JobEvents = {
182
+ JobEnqueuedEvent,
183
+ JobStartedEvent,
184
+ JobCompletedEvent,
185
+ JobFailedEvent,
186
+ JobRetryingEvent,
187
+ JobDeadLetteredEvent,
188
+ JobCancelledEvent,
189
+ ScheduledJobTriggeredEvent
190
+ };
191
+ export {
192
+ ScheduledJobTriggeredEvent,
193
+ JobStartedEvent,
194
+ JobRetryingEvent,
195
+ JobFailedEvent,
196
+ JobEvents,
197
+ JobEnqueuedEvent,
198
+ JobDeadLetteredEvent,
199
+ JobCompletedEvent,
200
+ JobCancelledEvent
349
201
  };
350
-
351
- //#endregion
352
- export { JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEvents, JobFailedEvent, JobRetryingEvent, JobStartedEvent, ScheduledJobTriggeredEvent };
353
- //# sourceMappingURL=events.js.map
@@ -1,10 +1,6 @@
1
- import { JobHandler } from "@contractspec/lib.contracts/jobs/queue";
2
- import { GmailIngestionAdapter } from "@contractspec/lib.knowledge/ingestion/gmail-adapter";
3
- import { EmailThreadListQuery } from "@contractspec/lib.contracts/integrations/providers/email";
4
-
5
- //#region src/handlers/gmail-sync-handler.d.ts
6
- type GmailSyncJobPayload = EmailThreadListQuery;
7
- declare function createGmailSyncHandler(adapter: GmailIngestionAdapter): JobHandler<GmailSyncJobPayload>;
8
- //#endregion
9
- export { GmailSyncJobPayload, createGmailSyncHandler };
1
+ import type { JobHandler } from '@contractspec/lib.contracts/jobs/queue';
2
+ import type { GmailIngestionAdapter } from '@contractspec/lib.knowledge/ingestion/gmail-adapter';
3
+ import type { EmailThreadListQuery } from '@contractspec/lib.contracts/integrations/providers/email';
4
+ export type GmailSyncJobPayload = EmailThreadListQuery;
5
+ export declare function createGmailSyncHandler(adapter: GmailIngestionAdapter): JobHandler<GmailSyncJobPayload>;
10
6
  //# sourceMappingURL=gmail-sync-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gmail-sync-handler.d.ts","names":[],"sources":["../../src/handlers/gmail-sync-handler.ts"],"mappings":";;;;;KAIY,mBAAA,GAAsB,oBAAA;AAAA,iBAElB,sBAAA,CACd,OAAA,EAAS,qBAAA,GACR,UAAA,CAAW,mBAAA"}
1
+ {"version":3,"file":"gmail-sync-handler.d.ts","sourceRoot":"","sources":["../../src/handlers/gmail-sync-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAErG,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEvD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,qBAAqB,GAC7B,UAAU,CAAC,mBAAmB,CAAC,CAIjC"}
@@ -1,10 +1,10 @@
1
- //#region src/handlers/gmail-sync-handler.ts
1
+ // @bun
2
+ // src/handlers/gmail-sync-handler.ts
2
3
  function createGmailSyncHandler(adapter) {
3
- return async (job) => {
4
- await adapter.syncThreads(job.payload);
5
- };
4
+ return async (job) => {
5
+ await adapter.syncThreads(job.payload);
6
+ };
6
7
  }
7
-
8
- //#endregion
9
- export { createGmailSyncHandler };
10
- //# sourceMappingURL=gmail-sync-handler.js.map
8
+ export {
9
+ createGmailSyncHandler
10
+ };
@@ -1,10 +1,6 @@
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 "@contractspec/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 };
1
+ export * from './ping-job';
2
+ export * from './gmail-sync-handler';
3
+ export * from './storage-document-handler';
4
+ import type { JobQueue } from '@contractspec/lib.contracts/jobs/queue';
5
+ export declare function registerAllJobs(queue: JobQueue): void;
10
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/handlers/index.ts"],"mappings":";;;;;;iBAUgB,eAAA,CAAgB,KAAA,EAAO,QAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAOvE,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAIrD"}