@happyvertical/smrt-jobs 0.30.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/AGENTS.md +71 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +151 -0
  5. package/dist/__smrt-register__.d.ts +2 -0
  6. package/dist/__smrt-register__.d.ts.map +1 -0
  7. package/dist/background-policy.d.ts +121 -0
  8. package/dist/background-policy.d.ts.map +1 -0
  9. package/dist/chunks/runner-DV8FBO0y.js +1642 -0
  10. package/dist/chunks/runner-DV8FBO0y.js.map +1 -0
  11. package/dist/chunks/worker-liveness-DOTjoIjr.js +65 -0
  12. package/dist/chunks/worker-liveness-DOTjoIjr.js.map +1 -0
  13. package/dist/error-redaction.d.ts +48 -0
  14. package/dist/error-redaction.d.ts.map +1 -0
  15. package/dist/index.d.ts +13 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +926 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/job-builder.d.ts +94 -0
  20. package/dist/job-builder.d.ts.map +1 -0
  21. package/dist/job-handle.d.ts +71 -0
  22. package/dist/job-handle.d.ts.map +1 -0
  23. package/dist/logger-extension.d.ts +58 -0
  24. package/dist/logger-extension.d.ts.map +1 -0
  25. package/dist/manifest.json +1327 -0
  26. package/dist/object-extension.d.ts +68 -0
  27. package/dist/object-extension.d.ts.map +1 -0
  28. package/dist/playground.d.ts +2 -0
  29. package/dist/playground.d.ts.map +1 -0
  30. package/dist/playground.js +179 -0
  31. package/dist/playground.js.map +1 -0
  32. package/dist/runner.d.ts +189 -0
  33. package/dist/runner.d.ts.map +1 -0
  34. package/dist/runner.js +15 -0
  35. package/dist/runner.js.map +1 -0
  36. package/dist/schedule-runner.d.ts +151 -0
  37. package/dist/schedule-runner.d.ts.map +1 -0
  38. package/dist/smrt-job-event.d.ts +54 -0
  39. package/dist/smrt-job-event.d.ts.map +1 -0
  40. package/dist/smrt-job.d.ts +215 -0
  41. package/dist/smrt-job.d.ts.map +1 -0
  42. package/dist/smrt-knowledge.json +508 -0
  43. package/dist/smrt-worker.d.ts +72 -0
  44. package/dist/smrt-worker.d.ts.map +1 -0
  45. package/dist/stale-recovery.d.ts +34 -0
  46. package/dist/stale-recovery.d.ts.map +1 -0
  47. package/dist/svelte/components/JobActions.svelte +103 -0
  48. package/dist/svelte/components/JobActions.svelte.d.ts +23 -0
  49. package/dist/svelte/components/JobActions.svelte.d.ts.map +1 -0
  50. package/dist/svelte/components/JobDashboard.svelte +199 -0
  51. package/dist/svelte/components/JobDashboard.svelte.d.ts +27 -0
  52. package/dist/svelte/components/JobDashboard.svelte.d.ts.map +1 -0
  53. package/dist/svelte/components/JobDetail.svelte +256 -0
  54. package/dist/svelte/components/JobDetail.svelte.d.ts +17 -0
  55. package/dist/svelte/components/JobDetail.svelte.d.ts.map +1 -0
  56. package/dist/svelte/components/JobList.svelte +360 -0
  57. package/dist/svelte/components/JobList.svelte.d.ts +28 -0
  58. package/dist/svelte/components/JobList.svelte.d.ts.map +1 -0
  59. package/dist/svelte/components/JobStats.svelte +242 -0
  60. package/dist/svelte/components/JobStats.svelte.d.ts +15 -0
  61. package/dist/svelte/components/JobStats.svelte.d.ts.map +1 -0
  62. package/dist/svelte/components/JobStatusBadge.svelte +23 -0
  63. package/dist/svelte/components/JobStatusBadge.svelte.d.ts +9 -0
  64. package/dist/svelte/components/JobStatusBadge.svelte.d.ts.map +1 -0
  65. package/dist/svelte/components/types.d.ts +9 -0
  66. package/dist/svelte/components/types.d.ts.map +1 -0
  67. package/dist/svelte/components/types.js +8 -0
  68. package/dist/svelte/i18n.d.ts +22 -0
  69. package/dist/svelte/i18n.d.ts.map +1 -0
  70. package/dist/svelte/i18n.js +22 -0
  71. package/dist/svelte/index.d.ts +25 -0
  72. package/dist/svelte/index.d.ts.map +1 -0
  73. package/dist/svelte/index.js +28 -0
  74. package/dist/svelte/playground.d.ts +329 -0
  75. package/dist/svelte/playground.d.ts.map +1 -0
  76. package/dist/svelte/playground.js +174 -0
  77. package/dist/svelte/types.d.ts +191 -0
  78. package/dist/svelte/types.d.ts.map +1 -0
  79. package/dist/svelte/types.js +87 -0
  80. package/dist/ui.d.ts +10 -0
  81. package/dist/ui.d.ts.map +1 -0
  82. package/dist/ui.js +69 -0
  83. package/dist/ui.js.map +1 -0
  84. package/dist/worker-liveness-thread.d.ts +2 -0
  85. package/dist/worker-liveness-thread.d.ts.map +1 -0
  86. package/dist/worker-liveness-thread.js +66 -0
  87. package/dist/worker-liveness-thread.js.map +1 -0
  88. package/dist/worker-liveness-ticker.d.ts +30 -0
  89. package/dist/worker-liveness-ticker.d.ts.map +1 -0
  90. package/dist/worker-liveness.d.ts +71 -0
  91. package/dist/worker-liveness.d.ts.map +1 -0
  92. package/package.json +93 -0
@@ -0,0 +1,1327 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "timestamp": 1782177079355,
4
+ "packageName": "@happyvertical/smrt-jobs",
5
+ "packageVersion": "0.30.0",
6
+ "objects": {
7
+ "@happyvertical/smrt-jobs:SmrtJobEvent": {
8
+ "name": "smrtjobevent",
9
+ "className": "SmrtJobEvent",
10
+ "qualifiedName": "@happyvertical/smrt-jobs:SmrtJobEvent",
11
+ "collection": "smrtjobevents",
12
+ "filePath": "/home/runner/_work/smrt/smrt/packages/jobs/src/smrt-job-event.ts",
13
+ "packageName": "@happyvertical/smrt-jobs",
14
+ "fields": {
15
+ "tenantId": {
16
+ "type": "text",
17
+ "required": false,
18
+ "_meta": {
19
+ "sqlType": "UUID",
20
+ "nullable": true,
21
+ "__tenancy": {
22
+ "isTenantIdField": true,
23
+ "autoFilter": true,
24
+ "required": false,
25
+ "autoPopulate": true,
26
+ "nullable": true,
27
+ "mode": "optional",
28
+ "field": "tenantId",
29
+ "allowSuperAdminBypass": false
30
+ }
31
+ }
32
+ },
33
+ "jobId": {
34
+ "type": "foreignKey",
35
+ "required": true,
36
+ "related": "SmrtJob",
37
+ "_meta": {
38
+ "required": true
39
+ }
40
+ },
41
+ "type": {
42
+ "type": "text",
43
+ "required": true,
44
+ "default": "log",
45
+ "_meta": {
46
+ "required": true,
47
+ "default": "log"
48
+ }
49
+ },
50
+ "level": {
51
+ "type": "text",
52
+ "required": true,
53
+ "default": "info",
54
+ "_meta": {
55
+ "required": true,
56
+ "default": "info"
57
+ }
58
+ },
59
+ "stage": {
60
+ "type": "text",
61
+ "required": false,
62
+ "_meta": {
63
+ "nullable": true
64
+ }
65
+ },
66
+ "progress": {
67
+ "type": "integer",
68
+ "required": false,
69
+ "_meta": {
70
+ "nullable": true
71
+ }
72
+ },
73
+ "message": {
74
+ "type": "text",
75
+ "required": true,
76
+ "default": "",
77
+ "_meta": {
78
+ "required": true,
79
+ "default": ""
80
+ }
81
+ },
82
+ "data": {
83
+ "type": "json",
84
+ "required": false,
85
+ "_meta": {}
86
+ },
87
+ "createdAt": {
88
+ "type": "datetime",
89
+ "required": true,
90
+ "_meta": {
91
+ "required": true
92
+ }
93
+ }
94
+ },
95
+ "methods": {
96
+ "toCursor": {
97
+ "name": "toCursor",
98
+ "async": false,
99
+ "parameters": [],
100
+ "returnType": "string",
101
+ "isStatic": false,
102
+ "isPublic": true
103
+ }
104
+ },
105
+ "decoratorConfig": {
106
+ "tableName": "_smrt_job_events",
107
+ "api": false,
108
+ "cli": {
109
+ "include": [
110
+ "list",
111
+ "get"
112
+ ],
113
+ "http": false,
114
+ "skipApiCheck": true
115
+ },
116
+ "mcp": false,
117
+ "tenantScoped": {
118
+ "mode": "optional"
119
+ }
120
+ },
121
+ "extends": "SmrtObject",
122
+ "exportName": "SmrtJobEvent",
123
+ "collectionExportName": "SmrtJobEventCollection",
124
+ "validationRules": [
125
+ {
126
+ "field": "jobId",
127
+ "rule": "required",
128
+ "fieldType": "foreignKey"
129
+ },
130
+ {
131
+ "field": "type",
132
+ "rule": "required",
133
+ "fieldType": "text"
134
+ },
135
+ {
136
+ "field": "level",
137
+ "rule": "required",
138
+ "fieldType": "text"
139
+ },
140
+ {
141
+ "field": "message",
142
+ "rule": "required",
143
+ "fieldType": "text"
144
+ },
145
+ {
146
+ "field": "createdAt",
147
+ "rule": "required",
148
+ "fieldType": "datetime"
149
+ }
150
+ ],
151
+ "schema": {
152
+ "tableName": "_smrt_job_events",
153
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_job_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"job_id\" UUID NOT NULL,\n \"type\" TEXT NOT NULL DEFAULT 'log',\n \"level\" TEXT NOT NULL DEFAULT 'info',\n \"stage\" TEXT,\n \"progress\" INTEGER,\n \"message\" TEXT NOT NULL DEFAULT '',\n \"data\" JSON\n);",
154
+ "columns": {
155
+ "id": {
156
+ "type": "UUID",
157
+ "primaryKey": true,
158
+ "referenceKind": "id",
159
+ "notNull": true
160
+ },
161
+ "slug": {
162
+ "type": "TEXT",
163
+ "notNull": true
164
+ },
165
+ "context": {
166
+ "type": "TEXT",
167
+ "notNull": true,
168
+ "default": ""
169
+ },
170
+ "created_at": {
171
+ "type": "TIMESTAMP",
172
+ "notNull": true,
173
+ "default": "current_timestamp"
174
+ },
175
+ "updated_at": {
176
+ "type": "TIMESTAMP",
177
+ "notNull": true,
178
+ "default": "current_timestamp"
179
+ },
180
+ "tenant_id": {
181
+ "type": "UUID",
182
+ "referenceKind": "tenantId",
183
+ "notNull": false,
184
+ "unique": false
185
+ },
186
+ "job_id": {
187
+ "type": "UUID",
188
+ "referenceKind": "foreignKey",
189
+ "notNull": true,
190
+ "unique": false
191
+ },
192
+ "type": {
193
+ "type": "TEXT",
194
+ "notNull": true,
195
+ "unique": false,
196
+ "default": "log"
197
+ },
198
+ "level": {
199
+ "type": "TEXT",
200
+ "notNull": true,
201
+ "unique": false,
202
+ "default": "info"
203
+ },
204
+ "stage": {
205
+ "type": "TEXT",
206
+ "notNull": false,
207
+ "unique": false
208
+ },
209
+ "progress": {
210
+ "type": "INTEGER",
211
+ "notNull": false,
212
+ "unique": false
213
+ },
214
+ "message": {
215
+ "type": "TEXT",
216
+ "notNull": true,
217
+ "unique": false,
218
+ "default": ""
219
+ },
220
+ "data": {
221
+ "type": "JSON",
222
+ "notNull": false,
223
+ "unique": false
224
+ }
225
+ },
226
+ "indexes": [
227
+ {
228
+ "name": "_smrt_job_events_id_idx",
229
+ "columns": [
230
+ "id"
231
+ ]
232
+ },
233
+ {
234
+ "name": "_smrt_job_events_slug_context_idx",
235
+ "columns": [
236
+ "slug",
237
+ "context"
238
+ ],
239
+ "unique": true
240
+ }
241
+ ],
242
+ "version": "8a9faeec"
243
+ }
244
+ },
245
+ "@happyvertical/smrt-jobs:SmrtJobEventCollection": {
246
+ "name": "smrtjobeventcollection",
247
+ "className": "SmrtJobEventCollection",
248
+ "qualifiedName": "@happyvertical/smrt-jobs:SmrtJobEventCollection",
249
+ "collection": "smrtjobevents",
250
+ "filePath": "/home/runner/_work/smrt/smrt/packages/jobs/src/smrt-job-event.ts",
251
+ "packageName": "@happyvertical/smrt-jobs",
252
+ "fields": {},
253
+ "methods": {
254
+ "initialize": {
255
+ "name": "initialize",
256
+ "async": true,
257
+ "parameters": [],
258
+ "returnType": "Promise",
259
+ "isStatic": false,
260
+ "isPublic": true
261
+ },
262
+ "append": {
263
+ "name": "append",
264
+ "async": true,
265
+ "parameters": [
266
+ {
267
+ "name": "input",
268
+ "type": "SmrtJobEventData",
269
+ "optional": false
270
+ }
271
+ ],
272
+ "returnType": "Promise<SmrtJobEvent>",
273
+ "isStatic": false,
274
+ "isPublic": true
275
+ },
276
+ "listByJob": {
277
+ "name": "listByJob",
278
+ "async": true,
279
+ "parameters": [
280
+ {
281
+ "name": "jobId",
282
+ "type": "string",
283
+ "optional": false
284
+ },
285
+ {
286
+ "name": "options",
287
+ "type": "ListJobEventsOptions",
288
+ "optional": true
289
+ }
290
+ ],
291
+ "returnType": "Promise<SmrtJobEvent[]>",
292
+ "isStatic": false,
293
+ "isPublic": true
294
+ },
295
+ "listSinceCursor": {
296
+ "name": "listSinceCursor",
297
+ "async": true,
298
+ "parameters": [
299
+ {
300
+ "name": "options",
301
+ "type": "any",
302
+ "optional": true
303
+ }
304
+ ],
305
+ "returnType": "Promise<SmrtJobEvent[]>",
306
+ "isStatic": false,
307
+ "isPublic": true
308
+ },
309
+ "latestProgressByJobIds": {
310
+ "name": "latestProgressByJobIds",
311
+ "async": true,
312
+ "parameters": [
313
+ {
314
+ "name": "jobIds",
315
+ "type": "string[]",
316
+ "optional": false
317
+ },
318
+ {
319
+ "name": "options",
320
+ "type": "object",
321
+ "optional": true
322
+ }
323
+ ],
324
+ "returnType": "Promise<Map<string, SmrtJobEvent>>",
325
+ "isStatic": false,
326
+ "isPublic": true
327
+ }
328
+ },
329
+ "decoratorConfig": {
330
+ "tableName": "_smrt_job_events"
331
+ },
332
+ "extends": "SmrtCollection",
333
+ "extendsTypeArg": "SmrtJobEvent",
334
+ "exportName": "SmrtJobEventCollection",
335
+ "collectionExportName": "SmrtJobEventCollectionCollection",
336
+ "schema": {
337
+ "tableName": "_smrt_job_events",
338
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_job_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
339
+ "columns": {
340
+ "id": {
341
+ "type": "UUID",
342
+ "primaryKey": true,
343
+ "referenceKind": "id",
344
+ "notNull": true
345
+ },
346
+ "slug": {
347
+ "type": "TEXT",
348
+ "notNull": true
349
+ },
350
+ "context": {
351
+ "type": "TEXT",
352
+ "notNull": true,
353
+ "default": ""
354
+ },
355
+ "created_at": {
356
+ "type": "TIMESTAMP",
357
+ "notNull": true,
358
+ "default": "current_timestamp"
359
+ },
360
+ "updated_at": {
361
+ "type": "TIMESTAMP",
362
+ "notNull": true,
363
+ "default": "current_timestamp"
364
+ }
365
+ },
366
+ "indexes": [
367
+ {
368
+ "name": "_smrt_job_events_id_idx",
369
+ "columns": [
370
+ "id"
371
+ ]
372
+ },
373
+ {
374
+ "name": "_smrt_job_events_slug_context_idx",
375
+ "columns": [
376
+ "slug",
377
+ "context"
378
+ ],
379
+ "unique": true
380
+ }
381
+ ],
382
+ "version": "bcf5b3bc"
383
+ }
384
+ },
385
+ "@happyvertical/smrt-jobs:SmrtJob": {
386
+ "name": "smrtjob",
387
+ "className": "SmrtJob",
388
+ "qualifiedName": "@happyvertical/smrt-jobs:SmrtJob",
389
+ "collection": "smrtjobs",
390
+ "filePath": "/home/runner/_work/smrt/smrt/packages/jobs/src/smrt-job.ts",
391
+ "packageName": "@happyvertical/smrt-jobs",
392
+ "fields": {
393
+ "tenantId": {
394
+ "type": "text",
395
+ "required": false,
396
+ "_meta": {
397
+ "sqlType": "UUID",
398
+ "nullable": true,
399
+ "__tenancy": {
400
+ "isTenantIdField": true,
401
+ "autoFilter": true,
402
+ "required": false,
403
+ "autoPopulate": true,
404
+ "nullable": true,
405
+ "mode": "optional",
406
+ "field": "tenantId",
407
+ "allowSuperAdminBypass": false
408
+ }
409
+ }
410
+ },
411
+ "queue": {
412
+ "type": "text",
413
+ "required": true,
414
+ "default": "default",
415
+ "_meta": {
416
+ "required": true,
417
+ "default": "default"
418
+ }
419
+ },
420
+ "objectType": {
421
+ "type": "text",
422
+ "required": true,
423
+ "_meta": {
424
+ "required": true
425
+ }
426
+ },
427
+ "objectId": {
428
+ "type": "text",
429
+ "required": false,
430
+ "_meta": {
431
+ "nullable": true
432
+ }
433
+ },
434
+ "method": {
435
+ "type": "text",
436
+ "required": true,
437
+ "_meta": {
438
+ "required": true
439
+ }
440
+ },
441
+ "args": {
442
+ "type": "json",
443
+ "required": false,
444
+ "_meta": {}
445
+ },
446
+ "runAt": {
447
+ "type": "datetime",
448
+ "required": true,
449
+ "_meta": {
450
+ "required": true
451
+ }
452
+ },
453
+ "priority": {
454
+ "type": "integer",
455
+ "required": true,
456
+ "default": 50,
457
+ "_meta": {
458
+ "required": true,
459
+ "default": 50
460
+ }
461
+ },
462
+ "status": {
463
+ "type": "text",
464
+ "required": true,
465
+ "default": "pending",
466
+ "_meta": {
467
+ "required": true,
468
+ "default": "pending"
469
+ }
470
+ },
471
+ "attempts": {
472
+ "type": "integer",
473
+ "required": true,
474
+ "default": 0,
475
+ "_meta": {
476
+ "required": true,
477
+ "default": 0
478
+ }
479
+ },
480
+ "maxAttempts": {
481
+ "type": "integer",
482
+ "required": true,
483
+ "default": 3,
484
+ "_meta": {
485
+ "required": true,
486
+ "default": 3
487
+ }
488
+ },
489
+ "timeout": {
490
+ "type": "integer",
491
+ "required": true,
492
+ "default": 300000,
493
+ "_meta": {
494
+ "required": true,
495
+ "default": 300000
496
+ }
497
+ },
498
+ "timeoutBehavior": {
499
+ "type": "text",
500
+ "required": true,
501
+ "default": "fail",
502
+ "_meta": {
503
+ "required": true,
504
+ "default": "fail"
505
+ }
506
+ },
507
+ "startedAt": {
508
+ "type": "datetime",
509
+ "required": false,
510
+ "_meta": {
511
+ "nullable": true
512
+ }
513
+ },
514
+ "completedAt": {
515
+ "type": "datetime",
516
+ "required": false,
517
+ "_meta": {
518
+ "nullable": true
519
+ }
520
+ },
521
+ "lastError": {
522
+ "type": "text",
523
+ "required": false,
524
+ "_meta": {
525
+ "nullable": true
526
+ }
527
+ },
528
+ "resultPointer": {
529
+ "type": "text",
530
+ "required": false,
531
+ "_meta": {
532
+ "nullable": true
533
+ }
534
+ },
535
+ "retryStrategy": {
536
+ "type": "json",
537
+ "required": false,
538
+ "_meta": {}
539
+ },
540
+ "workerId": {
541
+ "type": "text",
542
+ "required": false,
543
+ "_meta": {
544
+ "nullable": true
545
+ }
546
+ },
547
+ "workerHeartbeat": {
548
+ "type": "datetime",
549
+ "required": false,
550
+ "_meta": {
551
+ "nullable": true
552
+ }
553
+ }
554
+ },
555
+ "methods": {
556
+ "save": {
557
+ "name": "save",
558
+ "async": true,
559
+ "parameters": [],
560
+ "returnType": "Promise",
561
+ "isStatic": false,
562
+ "isPublic": true
563
+ },
564
+ "retry": {
565
+ "name": "retry",
566
+ "async": true,
567
+ "parameters": [],
568
+ "returnType": "Promise<void>",
569
+ "isStatic": false,
570
+ "isPublic": true
571
+ },
572
+ "cancel": {
573
+ "name": "cancel",
574
+ "async": true,
575
+ "parameters": [],
576
+ "returnType": "Promise<void>",
577
+ "isStatic": false,
578
+ "isPublic": true
579
+ },
580
+ "getDescription": {
581
+ "name": "getDescription",
582
+ "async": false,
583
+ "parameters": [],
584
+ "returnType": "string",
585
+ "isStatic": false,
586
+ "isPublic": true
587
+ }
588
+ },
589
+ "decoratorConfig": {
590
+ "tableName": "_smrt_jobs",
591
+ "api": false,
592
+ "cli": {
593
+ "include": [
594
+ "list",
595
+ "get",
596
+ "retry",
597
+ "cancel"
598
+ ],
599
+ "skipApiCheck": true,
600
+ "http": false
601
+ },
602
+ "mcp": false,
603
+ "tenantScoped": {
604
+ "mode": "optional"
605
+ }
606
+ },
607
+ "extends": "SmrtObject",
608
+ "exportName": "SmrtJob",
609
+ "collectionExportName": "SmrtJobCollection",
610
+ "validationRules": [
611
+ {
612
+ "field": "queue",
613
+ "rule": "required",
614
+ "fieldType": "text"
615
+ },
616
+ {
617
+ "field": "objectType",
618
+ "rule": "required",
619
+ "fieldType": "text"
620
+ },
621
+ {
622
+ "field": "method",
623
+ "rule": "required",
624
+ "fieldType": "text"
625
+ },
626
+ {
627
+ "field": "runAt",
628
+ "rule": "required",
629
+ "fieldType": "datetime"
630
+ },
631
+ {
632
+ "field": "priority",
633
+ "rule": "required",
634
+ "fieldType": "integer"
635
+ },
636
+ {
637
+ "field": "status",
638
+ "rule": "required",
639
+ "fieldType": "text"
640
+ },
641
+ {
642
+ "field": "attempts",
643
+ "rule": "required",
644
+ "fieldType": "integer"
645
+ },
646
+ {
647
+ "field": "maxAttempts",
648
+ "rule": "required",
649
+ "fieldType": "integer"
650
+ },
651
+ {
652
+ "field": "timeout",
653
+ "rule": "required",
654
+ "fieldType": "integer"
655
+ },
656
+ {
657
+ "field": "timeoutBehavior",
658
+ "rule": "required",
659
+ "fieldType": "text"
660
+ }
661
+ ],
662
+ "schema": {
663
+ "tableName": "_smrt_jobs",
664
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_jobs\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"queue\" TEXT NOT NULL DEFAULT 'default',\n \"object_type\" TEXT NOT NULL,\n \"object_id\" TEXT,\n \"method\" TEXT NOT NULL,\n \"args\" JSON,\n \"run_at\" TIMESTAMP NOT NULL,\n \"priority\" INTEGER NOT NULL DEFAULT 50,\n \"status\" TEXT NOT NULL DEFAULT 'pending',\n \"attempts\" INTEGER NOT NULL DEFAULT 0,\n \"max_attempts\" INTEGER NOT NULL DEFAULT 3,\n \"timeout\" INTEGER NOT NULL DEFAULT 300000,\n \"timeout_behavior\" TEXT NOT NULL DEFAULT 'fail',\n \"started_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"last_error\" TEXT,\n \"result_pointer\" TEXT,\n \"retry_strategy\" JSON,\n \"worker_id\" TEXT,\n \"worker_heartbeat\" TIMESTAMP\n);",
665
+ "columns": {
666
+ "id": {
667
+ "type": "UUID",
668
+ "primaryKey": true,
669
+ "referenceKind": "id",
670
+ "notNull": true
671
+ },
672
+ "slug": {
673
+ "type": "TEXT",
674
+ "notNull": true
675
+ },
676
+ "context": {
677
+ "type": "TEXT",
678
+ "notNull": true,
679
+ "default": ""
680
+ },
681
+ "created_at": {
682
+ "type": "TIMESTAMP",
683
+ "notNull": true,
684
+ "default": "current_timestamp"
685
+ },
686
+ "updated_at": {
687
+ "type": "TIMESTAMP",
688
+ "notNull": true,
689
+ "default": "current_timestamp"
690
+ },
691
+ "tenant_id": {
692
+ "type": "UUID",
693
+ "referenceKind": "tenantId",
694
+ "notNull": false,
695
+ "unique": false
696
+ },
697
+ "queue": {
698
+ "type": "TEXT",
699
+ "notNull": true,
700
+ "unique": false,
701
+ "default": "default"
702
+ },
703
+ "object_type": {
704
+ "type": "TEXT",
705
+ "notNull": true,
706
+ "unique": false
707
+ },
708
+ "object_id": {
709
+ "type": "TEXT",
710
+ "notNull": false,
711
+ "unique": false
712
+ },
713
+ "method": {
714
+ "type": "TEXT",
715
+ "notNull": true,
716
+ "unique": false
717
+ },
718
+ "args": {
719
+ "type": "JSON",
720
+ "notNull": false,
721
+ "unique": false
722
+ },
723
+ "run_at": {
724
+ "type": "TIMESTAMP",
725
+ "notNull": true,
726
+ "unique": false
727
+ },
728
+ "priority": {
729
+ "type": "INTEGER",
730
+ "notNull": true,
731
+ "unique": false,
732
+ "default": 50
733
+ },
734
+ "status": {
735
+ "type": "TEXT",
736
+ "notNull": true,
737
+ "unique": false,
738
+ "default": "pending"
739
+ },
740
+ "attempts": {
741
+ "type": "INTEGER",
742
+ "notNull": true,
743
+ "unique": false,
744
+ "default": 0
745
+ },
746
+ "max_attempts": {
747
+ "type": "INTEGER",
748
+ "notNull": true,
749
+ "unique": false,
750
+ "default": 3
751
+ },
752
+ "timeout": {
753
+ "type": "INTEGER",
754
+ "notNull": true,
755
+ "unique": false,
756
+ "default": 300000
757
+ },
758
+ "timeout_behavior": {
759
+ "type": "TEXT",
760
+ "notNull": true,
761
+ "unique": false,
762
+ "default": "fail"
763
+ },
764
+ "started_at": {
765
+ "type": "TIMESTAMP",
766
+ "notNull": false,
767
+ "unique": false
768
+ },
769
+ "completed_at": {
770
+ "type": "TIMESTAMP",
771
+ "notNull": false,
772
+ "unique": false
773
+ },
774
+ "last_error": {
775
+ "type": "TEXT",
776
+ "notNull": false,
777
+ "unique": false
778
+ },
779
+ "result_pointer": {
780
+ "type": "TEXT",
781
+ "notNull": false,
782
+ "unique": false
783
+ },
784
+ "retry_strategy": {
785
+ "type": "JSON",
786
+ "notNull": false,
787
+ "unique": false
788
+ },
789
+ "worker_id": {
790
+ "type": "TEXT",
791
+ "notNull": false,
792
+ "unique": false
793
+ },
794
+ "worker_heartbeat": {
795
+ "type": "TIMESTAMP",
796
+ "notNull": false,
797
+ "unique": false
798
+ }
799
+ },
800
+ "indexes": [
801
+ {
802
+ "name": "_smrt_jobs_id_idx",
803
+ "columns": [
804
+ "id"
805
+ ]
806
+ },
807
+ {
808
+ "name": "_smrt_jobs_slug_context_idx",
809
+ "columns": [
810
+ "slug",
811
+ "context"
812
+ ],
813
+ "unique": true
814
+ }
815
+ ],
816
+ "version": "0e543f33"
817
+ }
818
+ },
819
+ "@happyvertical/smrt-jobs:SmrtJobCollection": {
820
+ "name": "smrtjobcollection",
821
+ "className": "SmrtJobCollection",
822
+ "qualifiedName": "@happyvertical/smrt-jobs:SmrtJobCollection",
823
+ "collection": "smrtjobs",
824
+ "filePath": "/home/runner/_work/smrt/smrt/packages/jobs/src/smrt-job.ts",
825
+ "packageName": "@happyvertical/smrt-jobs",
826
+ "fields": {},
827
+ "methods": {
828
+ "initialize": {
829
+ "name": "initialize",
830
+ "async": true,
831
+ "parameters": [],
832
+ "returnType": "Promise",
833
+ "isStatic": false,
834
+ "isPublic": true
835
+ },
836
+ "listByStatus": {
837
+ "name": "listByStatus",
838
+ "async": true,
839
+ "parameters": [
840
+ {
841
+ "name": "status",
842
+ "type": "JobStatus | JobStatus[]",
843
+ "optional": false
844
+ },
845
+ {
846
+ "name": "options",
847
+ "type": "object",
848
+ "optional": true
849
+ }
850
+ ],
851
+ "returnType": "Promise<SmrtJob[]>",
852
+ "isStatic": false,
853
+ "isPublic": true
854
+ },
855
+ "listReady": {
856
+ "name": "listReady",
857
+ "async": true,
858
+ "parameters": [
859
+ {
860
+ "name": "options",
861
+ "type": "object",
862
+ "optional": true
863
+ }
864
+ ],
865
+ "returnType": "Promise<SmrtJob[]>",
866
+ "isStatic": false,
867
+ "isPublic": true
868
+ },
869
+ "claimReady": {
870
+ "name": "claimReady",
871
+ "async": true,
872
+ "parameters": [
873
+ {
874
+ "name": "options",
875
+ "type": "ClaimReadyOptions",
876
+ "optional": false
877
+ }
878
+ ],
879
+ "returnType": "Promise<SmrtJob[]>",
880
+ "isStatic": false,
881
+ "isPublic": true
882
+ },
883
+ "countInFlightForTenant": {
884
+ "name": "countInFlightForTenant",
885
+ "async": true,
886
+ "parameters": [
887
+ {
888
+ "name": "tenantId",
889
+ "type": "string | null",
890
+ "optional": false
891
+ }
892
+ ],
893
+ "returnType": "Promise<number>",
894
+ "isStatic": false,
895
+ "isPublic": true
896
+ },
897
+ "enqueueJob": {
898
+ "name": "enqueueJob",
899
+ "async": true,
900
+ "parameters": [
901
+ {
902
+ "name": "data",
903
+ "type": "SmrtJobData",
904
+ "optional": false
905
+ },
906
+ {
907
+ "name": "options",
908
+ "type": "EnqueueJobOptions",
909
+ "optional": true
910
+ }
911
+ ],
912
+ "returnType": "Promise<SmrtJob>",
913
+ "isStatic": false,
914
+ "isPublic": true
915
+ },
916
+ "stats": {
917
+ "name": "stats",
918
+ "async": true,
919
+ "parameters": [
920
+ {
921
+ "name": "queue",
922
+ "type": "string",
923
+ "optional": true
924
+ }
925
+ ],
926
+ "returnType": "Promise<object>",
927
+ "isStatic": false,
928
+ "isPublic": true
929
+ },
930
+ "cleanup": {
931
+ "name": "cleanup",
932
+ "async": true,
933
+ "parameters": [
934
+ {
935
+ "name": "options",
936
+ "type": "object",
937
+ "optional": false
938
+ }
939
+ ],
940
+ "returnType": "Promise<number>",
941
+ "isStatic": false,
942
+ "isPublic": true
943
+ }
944
+ },
945
+ "decoratorConfig": {
946
+ "tableName": "_smrt_jobs"
947
+ },
948
+ "extends": "SmrtCollection",
949
+ "extendsTypeArg": "SmrtJob",
950
+ "exportName": "SmrtJobCollection",
951
+ "collectionExportName": "SmrtJobCollectionCollection",
952
+ "schema": {
953
+ "tableName": "_smrt_jobs",
954
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_jobs\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
955
+ "columns": {
956
+ "id": {
957
+ "type": "UUID",
958
+ "primaryKey": true,
959
+ "referenceKind": "id",
960
+ "notNull": true
961
+ },
962
+ "slug": {
963
+ "type": "TEXT",
964
+ "notNull": true
965
+ },
966
+ "context": {
967
+ "type": "TEXT",
968
+ "notNull": true,
969
+ "default": ""
970
+ },
971
+ "created_at": {
972
+ "type": "TIMESTAMP",
973
+ "notNull": true,
974
+ "default": "current_timestamp"
975
+ },
976
+ "updated_at": {
977
+ "type": "TIMESTAMP",
978
+ "notNull": true,
979
+ "default": "current_timestamp"
980
+ }
981
+ },
982
+ "indexes": [
983
+ {
984
+ "name": "_smrt_jobs_id_idx",
985
+ "columns": [
986
+ "id"
987
+ ]
988
+ },
989
+ {
990
+ "name": "_smrt_jobs_slug_context_idx",
991
+ "columns": [
992
+ "slug",
993
+ "context"
994
+ ],
995
+ "unique": true
996
+ }
997
+ ],
998
+ "version": "d99c04d1"
999
+ }
1000
+ },
1001
+ "@happyvertical/smrt-jobs:SmrtWorker": {
1002
+ "name": "smrtworker",
1003
+ "className": "SmrtWorker",
1004
+ "qualifiedName": "@happyvertical/smrt-jobs:SmrtWorker",
1005
+ "collection": "smrtworkers",
1006
+ "filePath": "/home/runner/_work/smrt/smrt/packages/jobs/src/smrt-worker.ts",
1007
+ "packageName": "@happyvertical/smrt-jobs",
1008
+ "fields": {
1009
+ "workerId": {
1010
+ "type": "text",
1011
+ "required": true,
1012
+ "_meta": {
1013
+ "required": true
1014
+ }
1015
+ },
1016
+ "pid": {
1017
+ "type": "integer",
1018
+ "required": false,
1019
+ "_meta": {
1020
+ "nullable": true
1021
+ }
1022
+ },
1023
+ "hostname": {
1024
+ "type": "text",
1025
+ "required": false,
1026
+ "_meta": {
1027
+ "nullable": true
1028
+ }
1029
+ },
1030
+ "startedAt": {
1031
+ "type": "datetime",
1032
+ "required": false,
1033
+ "_meta": {
1034
+ "nullable": true
1035
+ }
1036
+ },
1037
+ "heartbeatAt": {
1038
+ "type": "datetime",
1039
+ "required": false,
1040
+ "_meta": {
1041
+ "nullable": true
1042
+ }
1043
+ },
1044
+ "leaseExpiresAt": {
1045
+ "type": "datetime",
1046
+ "required": false,
1047
+ "_meta": {
1048
+ "nullable": true
1049
+ }
1050
+ },
1051
+ "status": {
1052
+ "type": "text",
1053
+ "required": true,
1054
+ "default": "running",
1055
+ "_meta": {
1056
+ "required": true,
1057
+ "default": "running"
1058
+ }
1059
+ }
1060
+ },
1061
+ "methods": {},
1062
+ "decoratorConfig": {
1063
+ "tableName": "_smrt_workers",
1064
+ "conflictColumns": [
1065
+ "worker_id"
1066
+ ],
1067
+ "api": false,
1068
+ "cli": false,
1069
+ "mcp": false
1070
+ },
1071
+ "extends": "SmrtObject",
1072
+ "exportName": "SmrtWorker",
1073
+ "collectionExportName": "SmrtWorkerCollection",
1074
+ "validationRules": [
1075
+ {
1076
+ "field": "workerId",
1077
+ "rule": "required",
1078
+ "fieldType": "text"
1079
+ },
1080
+ {
1081
+ "field": "status",
1082
+ "rule": "required",
1083
+ "fieldType": "text"
1084
+ }
1085
+ ],
1086
+ "schema": {
1087
+ "tableName": "_smrt_workers",
1088
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_workers\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"worker_id\" TEXT NOT NULL,\n \"pid\" INTEGER,\n \"hostname\" TEXT,\n \"started_at\" TIMESTAMP,\n \"heartbeat_at\" TIMESTAMP,\n \"lease_expires_at\" TIMESTAMP,\n \"status\" TEXT NOT NULL DEFAULT 'running'\n);",
1089
+ "columns": {
1090
+ "id": {
1091
+ "type": "UUID",
1092
+ "primaryKey": true,
1093
+ "referenceKind": "id",
1094
+ "notNull": true
1095
+ },
1096
+ "slug": {
1097
+ "type": "TEXT",
1098
+ "notNull": true
1099
+ },
1100
+ "context": {
1101
+ "type": "TEXT",
1102
+ "notNull": true,
1103
+ "default": ""
1104
+ },
1105
+ "created_at": {
1106
+ "type": "TIMESTAMP",
1107
+ "notNull": true,
1108
+ "default": "current_timestamp"
1109
+ },
1110
+ "updated_at": {
1111
+ "type": "TIMESTAMP",
1112
+ "notNull": true,
1113
+ "default": "current_timestamp"
1114
+ },
1115
+ "worker_id": {
1116
+ "type": "TEXT",
1117
+ "notNull": true,
1118
+ "unique": false
1119
+ },
1120
+ "pid": {
1121
+ "type": "INTEGER",
1122
+ "notNull": false,
1123
+ "unique": false
1124
+ },
1125
+ "hostname": {
1126
+ "type": "TEXT",
1127
+ "notNull": false,
1128
+ "unique": false
1129
+ },
1130
+ "started_at": {
1131
+ "type": "TIMESTAMP",
1132
+ "notNull": false,
1133
+ "unique": false
1134
+ },
1135
+ "heartbeat_at": {
1136
+ "type": "TIMESTAMP",
1137
+ "notNull": false,
1138
+ "unique": false
1139
+ },
1140
+ "lease_expires_at": {
1141
+ "type": "TIMESTAMP",
1142
+ "notNull": false,
1143
+ "unique": false
1144
+ },
1145
+ "status": {
1146
+ "type": "TEXT",
1147
+ "notNull": true,
1148
+ "unique": false,
1149
+ "default": "running"
1150
+ }
1151
+ },
1152
+ "indexes": [
1153
+ {
1154
+ "name": "_smrt_workers_id_idx",
1155
+ "columns": [
1156
+ "id"
1157
+ ]
1158
+ },
1159
+ {
1160
+ "name": "_smrt_workers_worker_id_idx",
1161
+ "columns": [
1162
+ "worker_id"
1163
+ ],
1164
+ "unique": true
1165
+ }
1166
+ ],
1167
+ "version": "bfaad669"
1168
+ }
1169
+ },
1170
+ "@happyvertical/smrt-jobs:SmrtWorkerCollection": {
1171
+ "name": "smrtworkercollection",
1172
+ "className": "SmrtWorkerCollection",
1173
+ "qualifiedName": "@happyvertical/smrt-jobs:SmrtWorkerCollection",
1174
+ "collection": "smrtworkers",
1175
+ "filePath": "/home/runner/_work/smrt/smrt/packages/jobs/src/smrt-worker.ts",
1176
+ "packageName": "@happyvertical/smrt-jobs",
1177
+ "fields": {},
1178
+ "methods": {
1179
+ "assertReady": {
1180
+ "name": "assertReady",
1181
+ "async": true,
1182
+ "parameters": [],
1183
+ "returnType": "Promise<void>",
1184
+ "isStatic": false,
1185
+ "isPublic": true
1186
+ },
1187
+ "tableReady": {
1188
+ "name": "tableReady",
1189
+ "async": true,
1190
+ "parameters": [],
1191
+ "returnType": "Promise<boolean>",
1192
+ "isStatic": false,
1193
+ "isPublic": true
1194
+ },
1195
+ "registerWorker": {
1196
+ "name": "registerWorker",
1197
+ "async": true,
1198
+ "parameters": [
1199
+ {
1200
+ "name": "input",
1201
+ "type": "RegisterWorkerInput",
1202
+ "optional": false
1203
+ }
1204
+ ],
1205
+ "returnType": "Promise<void>",
1206
+ "isStatic": false,
1207
+ "isPublic": true
1208
+ },
1209
+ "renewLease": {
1210
+ "name": "renewLease",
1211
+ "async": true,
1212
+ "parameters": [
1213
+ {
1214
+ "name": "workerKey",
1215
+ "type": "string",
1216
+ "optional": false
1217
+ },
1218
+ {
1219
+ "name": "leaseTtlMs",
1220
+ "type": "number",
1221
+ "optional": false
1222
+ }
1223
+ ],
1224
+ "returnType": "Promise<void>",
1225
+ "isStatic": false,
1226
+ "isPublic": true
1227
+ },
1228
+ "expireWorker": {
1229
+ "name": "expireWorker",
1230
+ "async": true,
1231
+ "parameters": [
1232
+ {
1233
+ "name": "workerKey",
1234
+ "type": "string",
1235
+ "optional": false
1236
+ }
1237
+ ],
1238
+ "returnType": "Promise<void>",
1239
+ "isStatic": false,
1240
+ "isPublic": true
1241
+ },
1242
+ "freshLeaseWorkerKeys": {
1243
+ "name": "freshLeaseWorkerKeys",
1244
+ "async": true,
1245
+ "parameters": [],
1246
+ "returnType": "Promise<Set<string>>",
1247
+ "isStatic": false,
1248
+ "isPublic": true
1249
+ },
1250
+ "pruneExpired": {
1251
+ "name": "pruneExpired",
1252
+ "async": true,
1253
+ "parameters": [
1254
+ {
1255
+ "name": "graceMs",
1256
+ "type": "number",
1257
+ "optional": false
1258
+ }
1259
+ ],
1260
+ "returnType": "Promise<void>",
1261
+ "isStatic": false,
1262
+ "isPublic": true
1263
+ }
1264
+ },
1265
+ "decoratorConfig": {
1266
+ "tableName": "_smrt_workers"
1267
+ },
1268
+ "extends": "SmrtCollection",
1269
+ "extendsTypeArg": "SmrtWorker",
1270
+ "exportName": "SmrtWorkerCollection",
1271
+ "collectionExportName": "SmrtWorkerCollectionCollection",
1272
+ "schema": {
1273
+ "tableName": "_smrt_workers",
1274
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_workers\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1275
+ "columns": {
1276
+ "id": {
1277
+ "type": "UUID",
1278
+ "primaryKey": true,
1279
+ "referenceKind": "id",
1280
+ "notNull": true
1281
+ },
1282
+ "slug": {
1283
+ "type": "TEXT",
1284
+ "notNull": true
1285
+ },
1286
+ "context": {
1287
+ "type": "TEXT",
1288
+ "notNull": true,
1289
+ "default": ""
1290
+ },
1291
+ "created_at": {
1292
+ "type": "TIMESTAMP",
1293
+ "notNull": true,
1294
+ "default": "current_timestamp"
1295
+ },
1296
+ "updated_at": {
1297
+ "type": "TIMESTAMP",
1298
+ "notNull": true,
1299
+ "default": "current_timestamp"
1300
+ }
1301
+ },
1302
+ "indexes": [
1303
+ {
1304
+ "name": "_smrt_workers_id_idx",
1305
+ "columns": [
1306
+ "id"
1307
+ ]
1308
+ },
1309
+ {
1310
+ "name": "_smrt_workers_slug_context_idx",
1311
+ "columns": [
1312
+ "slug",
1313
+ "context"
1314
+ ],
1315
+ "unique": true
1316
+ }
1317
+ ],
1318
+ "version": "d3a7edbd"
1319
+ }
1320
+ }
1321
+ },
1322
+ "moduleType": "smrt",
1323
+ "smrtDependencies": [
1324
+ "@happyvertical/smrt-core",
1325
+ "@happyvertical/smrt-tenancy"
1326
+ ]
1327
+ }