duron 0.1.0 → 0.2.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.
@@ -404,6 +404,7 @@ class ActionContext<TInput extends z.ZodObject, TOutput extends z.ZodObject, TVa
404
404
  })
405
405
  }
406
406
  this.#input = job.input ?? {}
407
+ this.step = this.step.bind(this)
407
408
  }
408
409
 
409
410
  // ============================================================================
@@ -1,64 +0,0 @@
1
- CREATE SCHEMA IF NOT EXISTS "duron";
2
- --> statement-breakpoint
3
- CREATE TABLE "duron"."job_steps" (
4
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
5
- "job_id" uuid NOT NULL,
6
- "name" text NOT NULL,
7
- "status" text DEFAULT 'active' NOT NULL,
8
- "output" jsonb,
9
- "error" jsonb,
10
- "started_at" timestamp with time zone DEFAULT now() NOT NULL,
11
- "finished_at" timestamp with time zone,
12
- "timeout_ms" integer NOT NULL,
13
- "expires_at" timestamp with time zone,
14
- "retries_limit" integer DEFAULT 0 NOT NULL,
15
- "retries_count" integer DEFAULT 0 NOT NULL,
16
- "delayed_ms" integer,
17
- "history_failed_attempts" jsonb DEFAULT '{}'::jsonb NOT NULL,
18
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
19
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
20
- CONSTRAINT "unique_job_step_name" UNIQUE("job_id","name"),
21
- CONSTRAINT "job_steps_status_check" CHECK ("duron"."job_steps"."status" IN ('active','completed','failed','cancelled'))
22
- );
23
- --> statement-breakpoint
24
- CREATE TABLE "duron"."jobs" (
25
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
26
- "action_name" text NOT NULL,
27
- "group_key" text NOT NULL,
28
- "status" text DEFAULT 'created' NOT NULL,
29
- "checksum" text NOT NULL,
30
- "input" jsonb DEFAULT '{}'::jsonb NOT NULL,
31
- "output" jsonb,
32
- "error" jsonb,
33
- "timeout_ms" integer NOT NULL,
34
- "expires_at" timestamp with time zone,
35
- "started_at" timestamp with time zone,
36
- "finished_at" timestamp with time zone,
37
- "owner_id" text,
38
- "concurrency_limit" integer DEFAULT 10 NOT NULL,
39
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
40
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
41
- CONSTRAINT "jobs_status_check" CHECK ("duron"."jobs"."status" IN ('created','active','completed','failed','cancelled'))
42
- );
43
- --> statement-breakpoint
44
- ALTER TABLE "duron"."job_steps" ADD CONSTRAINT "job_steps_job_id_jobs_id_fk" FOREIGN KEY ("job_id") REFERENCES "duron"."jobs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
45
- CREATE INDEX "idx_job_steps_job_id" ON "duron"."job_steps" USING btree ("job_id");--> statement-breakpoint
46
- CREATE INDEX "idx_job_steps_status" ON "duron"."job_steps" USING btree ("status");--> statement-breakpoint
47
- CREATE INDEX "idx_job_steps_name" ON "duron"."job_steps" USING btree ("name");--> statement-breakpoint
48
- CREATE INDEX "idx_job_steps_expires_at" ON "duron"."job_steps" USING btree ("expires_at");--> statement-breakpoint
49
- CREATE INDEX "idx_job_steps_job_status" ON "duron"."job_steps" USING btree ("job_id","status");--> statement-breakpoint
50
- CREATE INDEX "idx_job_steps_job_name" ON "duron"."job_steps" USING btree ("job_id","name");--> statement-breakpoint
51
- CREATE INDEX "idx_job_steps_output_fts" ON "duron"."job_steps" USING gin (to_tsvector('english', "output"::text));--> statement-breakpoint
52
- CREATE INDEX "idx_jobs_action_name" ON "duron"."jobs" USING btree ("action_name");--> statement-breakpoint
53
- CREATE INDEX "idx_jobs_status" ON "duron"."jobs" USING btree ("status");--> statement-breakpoint
54
- CREATE INDEX "idx_jobs_group_key" ON "duron"."jobs" USING btree ("group_key");--> statement-breakpoint
55
- CREATE INDEX "idx_jobs_started_at" ON "duron"."jobs" USING btree ("started_at");--> statement-breakpoint
56
- CREATE INDEX "idx_jobs_finished_at" ON "duron"."jobs" USING btree ("finished_at");--> statement-breakpoint
57
- CREATE INDEX "idx_jobs_expires_at" ON "duron"."jobs" USING btree ("expires_at");--> statement-breakpoint
58
- CREATE INDEX "idx_jobs_owner_id" ON "duron"."jobs" USING btree ("owner_id");--> statement-breakpoint
59
- CREATE INDEX "idx_jobs_checksum" ON "duron"."jobs" USING btree ("checksum");--> statement-breakpoint
60
- CREATE INDEX "idx_jobs_concurrency_limit" ON "duron"."jobs" USING btree ("concurrency_limit");--> statement-breakpoint
61
- CREATE INDEX "idx_jobs_action_status" ON "duron"."jobs" USING btree ("action_name","status");--> statement-breakpoint
62
- CREATE INDEX "idx_jobs_action_group" ON "duron"."jobs" USING btree ("action_name","group_key");--> statement-breakpoint
63
- CREATE INDEX "idx_jobs_input_fts" ON "duron"."jobs" USING gin (to_tsvector('english', "input"::text));--> statement-breakpoint
64
- CREATE INDEX "idx_jobs_output_fts" ON "duron"."jobs" USING gin (to_tsvector('english', "output"::text));
@@ -1,606 +0,0 @@
1
- {
2
- "id": "0811651b-5d13-459d-a0b0-52497e58c2b4",
3
- "prevId": "00000000-0000-0000-0000-000000000000",
4
- "version": "7",
5
- "dialect": "postgresql",
6
- "tables": {
7
- "duron.job_steps": {
8
- "name": "job_steps",
9
- "schema": "duron",
10
- "columns": {
11
- "id": {
12
- "name": "id",
13
- "type": "uuid",
14
- "primaryKey": true,
15
- "notNull": true,
16
- "default": "gen_random_uuid()"
17
- },
18
- "job_id": {
19
- "name": "job_id",
20
- "type": "uuid",
21
- "primaryKey": false,
22
- "notNull": true
23
- },
24
- "name": {
25
- "name": "name",
26
- "type": "text",
27
- "primaryKey": false,
28
- "notNull": true
29
- },
30
- "status": {
31
- "name": "status",
32
- "type": "text",
33
- "primaryKey": false,
34
- "notNull": true,
35
- "default": "'active'"
36
- },
37
- "output": {
38
- "name": "output",
39
- "type": "jsonb",
40
- "primaryKey": false,
41
- "notNull": false
42
- },
43
- "error": {
44
- "name": "error",
45
- "type": "jsonb",
46
- "primaryKey": false,
47
- "notNull": false
48
- },
49
- "started_at": {
50
- "name": "started_at",
51
- "type": "timestamp with time zone",
52
- "primaryKey": false,
53
- "notNull": true,
54
- "default": "now()"
55
- },
56
- "finished_at": {
57
- "name": "finished_at",
58
- "type": "timestamp with time zone",
59
- "primaryKey": false,
60
- "notNull": false
61
- },
62
- "timeout_ms": {
63
- "name": "timeout_ms",
64
- "type": "integer",
65
- "primaryKey": false,
66
- "notNull": true
67
- },
68
- "expires_at": {
69
- "name": "expires_at",
70
- "type": "timestamp with time zone",
71
- "primaryKey": false,
72
- "notNull": false
73
- },
74
- "retries_limit": {
75
- "name": "retries_limit",
76
- "type": "integer",
77
- "primaryKey": false,
78
- "notNull": true,
79
- "default": 0
80
- },
81
- "retries_count": {
82
- "name": "retries_count",
83
- "type": "integer",
84
- "primaryKey": false,
85
- "notNull": true,
86
- "default": 0
87
- },
88
- "delayed_ms": {
89
- "name": "delayed_ms",
90
- "type": "integer",
91
- "primaryKey": false,
92
- "notNull": false
93
- },
94
- "history_failed_attempts": {
95
- "name": "history_failed_attempts",
96
- "type": "jsonb",
97
- "primaryKey": false,
98
- "notNull": true,
99
- "default": "'{}'::jsonb"
100
- },
101
- "created_at": {
102
- "name": "created_at",
103
- "type": "timestamp with time zone",
104
- "primaryKey": false,
105
- "notNull": true,
106
- "default": "now()"
107
- },
108
- "updated_at": {
109
- "name": "updated_at",
110
- "type": "timestamp with time zone",
111
- "primaryKey": false,
112
- "notNull": true,
113
- "default": "now()"
114
- }
115
- },
116
- "indexes": {
117
- "idx_job_steps_job_id": {
118
- "name": "idx_job_steps_job_id",
119
- "columns": [
120
- {
121
- "expression": "job_id",
122
- "isExpression": false,
123
- "asc": true,
124
- "nulls": "last"
125
- }
126
- ],
127
- "isUnique": false,
128
- "concurrently": false,
129
- "method": "btree",
130
- "with": {}
131
- },
132
- "idx_job_steps_status": {
133
- "name": "idx_job_steps_status",
134
- "columns": [
135
- {
136
- "expression": "status",
137
- "isExpression": false,
138
- "asc": true,
139
- "nulls": "last"
140
- }
141
- ],
142
- "isUnique": false,
143
- "concurrently": false,
144
- "method": "btree",
145
- "with": {}
146
- },
147
- "idx_job_steps_name": {
148
- "name": "idx_job_steps_name",
149
- "columns": [
150
- {
151
- "expression": "name",
152
- "isExpression": false,
153
- "asc": true,
154
- "nulls": "last"
155
- }
156
- ],
157
- "isUnique": false,
158
- "concurrently": false,
159
- "method": "btree",
160
- "with": {}
161
- },
162
- "idx_job_steps_expires_at": {
163
- "name": "idx_job_steps_expires_at",
164
- "columns": [
165
- {
166
- "expression": "expires_at",
167
- "isExpression": false,
168
- "asc": true,
169
- "nulls": "last"
170
- }
171
- ],
172
- "isUnique": false,
173
- "concurrently": false,
174
- "method": "btree",
175
- "with": {}
176
- },
177
- "idx_job_steps_job_status": {
178
- "name": "idx_job_steps_job_status",
179
- "columns": [
180
- {
181
- "expression": "job_id",
182
- "isExpression": false,
183
- "asc": true,
184
- "nulls": "last"
185
- },
186
- {
187
- "expression": "status",
188
- "isExpression": false,
189
- "asc": true,
190
- "nulls": "last"
191
- }
192
- ],
193
- "isUnique": false,
194
- "concurrently": false,
195
- "method": "btree",
196
- "with": {}
197
- },
198
- "idx_job_steps_job_name": {
199
- "name": "idx_job_steps_job_name",
200
- "columns": [
201
- {
202
- "expression": "job_id",
203
- "isExpression": false,
204
- "asc": true,
205
- "nulls": "last"
206
- },
207
- {
208
- "expression": "name",
209
- "isExpression": false,
210
- "asc": true,
211
- "nulls": "last"
212
- }
213
- ],
214
- "isUnique": false,
215
- "concurrently": false,
216
- "method": "btree",
217
- "with": {}
218
- },
219
- "idx_job_steps_output_fts": {
220
- "name": "idx_job_steps_output_fts",
221
- "columns": [
222
- {
223
- "expression": "to_tsvector('english', \"output\"::text)",
224
- "asc": true,
225
- "isExpression": true,
226
- "nulls": "last"
227
- }
228
- ],
229
- "isUnique": false,
230
- "concurrently": false,
231
- "method": "gin",
232
- "with": {}
233
- }
234
- },
235
- "foreignKeys": {
236
- "job_steps_job_id_jobs_id_fk": {
237
- "name": "job_steps_job_id_jobs_id_fk",
238
- "tableFrom": "job_steps",
239
- "tableTo": "jobs",
240
- "schemaTo": "duron",
241
- "columnsFrom": ["job_id"],
242
- "columnsTo": ["id"],
243
- "onDelete": "cascade",
244
- "onUpdate": "no action"
245
- }
246
- },
247
- "compositePrimaryKeys": {},
248
- "uniqueConstraints": {
249
- "unique_job_step_name": {
250
- "name": "unique_job_step_name",
251
- "nullsNotDistinct": false,
252
- "columns": ["job_id", "name"]
253
- }
254
- },
255
- "policies": {},
256
- "checkConstraints": {
257
- "job_steps_status_check": {
258
- "name": "job_steps_status_check",
259
- "value": "\"duron\".\"job_steps\".\"status\" IN ('active','completed','failed','cancelled')"
260
- }
261
- },
262
- "isRLSEnabled": false
263
- },
264
- "duron.jobs": {
265
- "name": "jobs",
266
- "schema": "duron",
267
- "columns": {
268
- "id": {
269
- "name": "id",
270
- "type": "uuid",
271
- "primaryKey": true,
272
- "notNull": true,
273
- "default": "gen_random_uuid()"
274
- },
275
- "action_name": {
276
- "name": "action_name",
277
- "type": "text",
278
- "primaryKey": false,
279
- "notNull": true
280
- },
281
- "group_key": {
282
- "name": "group_key",
283
- "type": "text",
284
- "primaryKey": false,
285
- "notNull": true
286
- },
287
- "status": {
288
- "name": "status",
289
- "type": "text",
290
- "primaryKey": false,
291
- "notNull": true,
292
- "default": "'created'"
293
- },
294
- "checksum": {
295
- "name": "checksum",
296
- "type": "text",
297
- "primaryKey": false,
298
- "notNull": true
299
- },
300
- "input": {
301
- "name": "input",
302
- "type": "jsonb",
303
- "primaryKey": false,
304
- "notNull": true,
305
- "default": "'{}'::jsonb"
306
- },
307
- "output": {
308
- "name": "output",
309
- "type": "jsonb",
310
- "primaryKey": false,
311
- "notNull": false
312
- },
313
- "error": {
314
- "name": "error",
315
- "type": "jsonb",
316
- "primaryKey": false,
317
- "notNull": false
318
- },
319
- "timeout_ms": {
320
- "name": "timeout_ms",
321
- "type": "integer",
322
- "primaryKey": false,
323
- "notNull": true
324
- },
325
- "expires_at": {
326
- "name": "expires_at",
327
- "type": "timestamp with time zone",
328
- "primaryKey": false,
329
- "notNull": false
330
- },
331
- "started_at": {
332
- "name": "started_at",
333
- "type": "timestamp with time zone",
334
- "primaryKey": false,
335
- "notNull": false
336
- },
337
- "finished_at": {
338
- "name": "finished_at",
339
- "type": "timestamp with time zone",
340
- "primaryKey": false,
341
- "notNull": false
342
- },
343
- "owner_id": {
344
- "name": "owner_id",
345
- "type": "text",
346
- "primaryKey": false,
347
- "notNull": false
348
- },
349
- "concurrency_limit": {
350
- "name": "concurrency_limit",
351
- "type": "integer",
352
- "primaryKey": false,
353
- "notNull": true,
354
- "default": 10
355
- },
356
- "created_at": {
357
- "name": "created_at",
358
- "type": "timestamp with time zone",
359
- "primaryKey": false,
360
- "notNull": true,
361
- "default": "now()"
362
- },
363
- "updated_at": {
364
- "name": "updated_at",
365
- "type": "timestamp with time zone",
366
- "primaryKey": false,
367
- "notNull": true,
368
- "default": "now()"
369
- }
370
- },
371
- "indexes": {
372
- "idx_jobs_action_name": {
373
- "name": "idx_jobs_action_name",
374
- "columns": [
375
- {
376
- "expression": "action_name",
377
- "isExpression": false,
378
- "asc": true,
379
- "nulls": "last"
380
- }
381
- ],
382
- "isUnique": false,
383
- "concurrently": false,
384
- "method": "btree",
385
- "with": {}
386
- },
387
- "idx_jobs_status": {
388
- "name": "idx_jobs_status",
389
- "columns": [
390
- {
391
- "expression": "status",
392
- "isExpression": false,
393
- "asc": true,
394
- "nulls": "last"
395
- }
396
- ],
397
- "isUnique": false,
398
- "concurrently": false,
399
- "method": "btree",
400
- "with": {}
401
- },
402
- "idx_jobs_group_key": {
403
- "name": "idx_jobs_group_key",
404
- "columns": [
405
- {
406
- "expression": "group_key",
407
- "isExpression": false,
408
- "asc": true,
409
- "nulls": "last"
410
- }
411
- ],
412
- "isUnique": false,
413
- "concurrently": false,
414
- "method": "btree",
415
- "with": {}
416
- },
417
- "idx_jobs_started_at": {
418
- "name": "idx_jobs_started_at",
419
- "columns": [
420
- {
421
- "expression": "started_at",
422
- "isExpression": false,
423
- "asc": true,
424
- "nulls": "last"
425
- }
426
- ],
427
- "isUnique": false,
428
- "concurrently": false,
429
- "method": "btree",
430
- "with": {}
431
- },
432
- "idx_jobs_finished_at": {
433
- "name": "idx_jobs_finished_at",
434
- "columns": [
435
- {
436
- "expression": "finished_at",
437
- "isExpression": false,
438
- "asc": true,
439
- "nulls": "last"
440
- }
441
- ],
442
- "isUnique": false,
443
- "concurrently": false,
444
- "method": "btree",
445
- "with": {}
446
- },
447
- "idx_jobs_expires_at": {
448
- "name": "idx_jobs_expires_at",
449
- "columns": [
450
- {
451
- "expression": "expires_at",
452
- "isExpression": false,
453
- "asc": true,
454
- "nulls": "last"
455
- }
456
- ],
457
- "isUnique": false,
458
- "concurrently": false,
459
- "method": "btree",
460
- "with": {}
461
- },
462
- "idx_jobs_owner_id": {
463
- "name": "idx_jobs_owner_id",
464
- "columns": [
465
- {
466
- "expression": "owner_id",
467
- "isExpression": false,
468
- "asc": true,
469
- "nulls": "last"
470
- }
471
- ],
472
- "isUnique": false,
473
- "concurrently": false,
474
- "method": "btree",
475
- "with": {}
476
- },
477
- "idx_jobs_checksum": {
478
- "name": "idx_jobs_checksum",
479
- "columns": [
480
- {
481
- "expression": "checksum",
482
- "isExpression": false,
483
- "asc": true,
484
- "nulls": "last"
485
- }
486
- ],
487
- "isUnique": false,
488
- "concurrently": false,
489
- "method": "btree",
490
- "with": {}
491
- },
492
- "idx_jobs_concurrency_limit": {
493
- "name": "idx_jobs_concurrency_limit",
494
- "columns": [
495
- {
496
- "expression": "concurrency_limit",
497
- "isExpression": false,
498
- "asc": true,
499
- "nulls": "last"
500
- }
501
- ],
502
- "isUnique": false,
503
- "concurrently": false,
504
- "method": "btree",
505
- "with": {}
506
- },
507
- "idx_jobs_action_status": {
508
- "name": "idx_jobs_action_status",
509
- "columns": [
510
- {
511
- "expression": "action_name",
512
- "isExpression": false,
513
- "asc": true,
514
- "nulls": "last"
515
- },
516
- {
517
- "expression": "status",
518
- "isExpression": false,
519
- "asc": true,
520
- "nulls": "last"
521
- }
522
- ],
523
- "isUnique": false,
524
- "concurrently": false,
525
- "method": "btree",
526
- "with": {}
527
- },
528
- "idx_jobs_action_group": {
529
- "name": "idx_jobs_action_group",
530
- "columns": [
531
- {
532
- "expression": "action_name",
533
- "isExpression": false,
534
- "asc": true,
535
- "nulls": "last"
536
- },
537
- {
538
- "expression": "group_key",
539
- "isExpression": false,
540
- "asc": true,
541
- "nulls": "last"
542
- }
543
- ],
544
- "isUnique": false,
545
- "concurrently": false,
546
- "method": "btree",
547
- "with": {}
548
- },
549
- "idx_jobs_input_fts": {
550
- "name": "idx_jobs_input_fts",
551
- "columns": [
552
- {
553
- "expression": "to_tsvector('english', \"input\"::text)",
554
- "asc": true,
555
- "isExpression": true,
556
- "nulls": "last"
557
- }
558
- ],
559
- "isUnique": false,
560
- "concurrently": false,
561
- "method": "gin",
562
- "with": {}
563
- },
564
- "idx_jobs_output_fts": {
565
- "name": "idx_jobs_output_fts",
566
- "columns": [
567
- {
568
- "expression": "to_tsvector('english', \"output\"::text)",
569
- "asc": true,
570
- "isExpression": true,
571
- "nulls": "last"
572
- }
573
- ],
574
- "isUnique": false,
575
- "concurrently": false,
576
- "method": "gin",
577
- "with": {}
578
- }
579
- },
580
- "foreignKeys": {},
581
- "compositePrimaryKeys": {},
582
- "uniqueConstraints": {},
583
- "policies": {},
584
- "checkConstraints": {
585
- "jobs_status_check": {
586
- "name": "jobs_status_check",
587
- "value": "\"duron\".\"jobs\".\"status\" IN ('created','active','completed','failed','cancelled')"
588
- }
589
- },
590
- "isRLSEnabled": false
591
- }
592
- },
593
- "enums": {},
594
- "schemas": {
595
- "duron": "duron"
596
- },
597
- "sequences": {},
598
- "roles": {},
599
- "policies": {},
600
- "views": {},
601
- "_meta": {
602
- "columns": {},
603
- "schemas": {},
604
- "tables": {}
605
- }
606
- }
@@ -1,13 +0,0 @@
1
- {
2
- "version": "7",
3
- "dialect": "postgresql",
4
- "entries": [
5
- {
6
- "idx": 0,
7
- "version": "7",
8
- "when": 1764618532294,
9
- "tag": "0000_lethal_speed_demon",
10
- "breakpoints": true
11
- }
12
- ]
13
- }