@workflow/world-postgres 5.0.0-beta.44 → 5.0.0-beta.45
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.
- package/README.md +140 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/drizzle/schema.d.ts +226 -0
- package/dist/drizzle/schema.d.ts.map +1 -1
- package/dist/drizzle/schema.js +25 -6
- package/dist/executor.d.ts +8 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +79 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/invocation-notifications.d.ts +23 -0
- package/dist/invocation-notifications.d.ts.map +1 -0
- package/dist/invocation-notifications.js +156 -0
- package/dist/invocation-retention.d.ts +11 -0
- package/dist/invocation-retention.d.ts.map +1 -0
- package/dist/invocation-retention.js +14 -0
- package/dist/invocations.d.ts +24 -0
- package/dist/invocations.d.ts.map +1 -0
- package/dist/invocations.js +208 -0
- package/dist/message.d.ts +1 -0
- package/dist/message.d.ts.map +1 -1
- package/dist/message.js +3 -1
- package/dist/queue.d.ts +1 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +205 -38
- package/dist/retention.d.ts.map +1 -1
- package/dist/retention.js +14 -3
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +117 -1
- package/package.json +6 -6
- package/src/drizzle/migrations/0020_add_invocations.sql +13 -0
- package/src/drizzle/migrations/0021_invocation_identity_retention.sql +19 -0
- package/src/drizzle/migrations/0022_invocation_outcomes.sql +3 -0
- package/src/drizzle/migrations/meta/_journal.json +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/world-postgres",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.45",
|
|
4
4
|
"description": "A reference World implementation based on PostgreSQL",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@vercel/queue": "0.5.1",
|
|
42
|
-
"@workflow/errors": "5.0.0-beta.
|
|
42
|
+
"@workflow/errors": "5.0.0-beta.22",
|
|
43
43
|
"@workflow/utils": "5.0.0-beta.10",
|
|
44
|
-
"@workflow/world": "5.0.0-beta.
|
|
45
|
-
"@workflow/world-local": "5.0.0-beta.
|
|
44
|
+
"@workflow/world": "5.0.0-beta.37",
|
|
45
|
+
"@workflow/world-local": "5.0.0-beta.46",
|
|
46
46
|
"cbor-x": "1.6.0",
|
|
47
47
|
"dotenv": "17.3.1",
|
|
48
48
|
"drizzle-orm": "0.45.2",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"@testcontainers/postgresql": "11.12.0",
|
|
56
56
|
"@types/node": "22.19.0",
|
|
57
57
|
"@types/pg": "8.20.0",
|
|
58
|
-
"@workflow/errors": "5.0.0-beta.
|
|
58
|
+
"@workflow/errors": "5.0.0-beta.22",
|
|
59
59
|
"@workflow/tsconfig": "5.0.0-beta.0",
|
|
60
|
-
"@workflow/world-testing": "5.0.0-beta.
|
|
60
|
+
"@workflow/world-testing": "5.0.0-beta.54",
|
|
61
61
|
"drizzle-kit": "0.31.9",
|
|
62
62
|
"typescript": "^6.0.3",
|
|
63
63
|
"undici": "7.29.0",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE "workflow"."workflow_invocations" (
|
|
2
|
+
"sequence" bigserial NOT NULL,
|
|
3
|
+
"run_id" varchar NOT NULL,
|
|
4
|
+
"request_id" varchar NOT NULL,
|
|
5
|
+
"payload" bytea NOT NULL,
|
|
6
|
+
"fingerprint" varchar NOT NULL,
|
|
7
|
+
"result" bytea,
|
|
8
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
9
|
+
"responded_at" timestamp,
|
|
10
|
+
PRIMARY KEY ("run_id", "request_id")
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
CREATE INDEX "workflow_invocations_pending" ON "workflow"."workflow_invocations" ("run_id", "sequence") WHERE "responded_at" IS NULL;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
ALTER TABLE "workflow"."workflow_events" ADD COLUMN "resume_id" varchar;
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "workflow"."workflow_events" ADD COLUMN "resume_payload_digest" varchar;
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
CREATE UNIQUE INDEX "workflow_events_hook_resume_unique" ON "workflow"."workflow_events" ("run_id", "resume_id") WHERE "type" = 'hook_received' AND "resume_id" IS NOT NULL;
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
ALTER TABLE "workflow"."workflow_invocations" ALTER COLUMN "payload" DROP NOT NULL;
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
ALTER TABLE "workflow"."workflow_invocations" ALTER COLUMN "fingerprint" DROP NOT NULL;
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
ALTER TABLE "workflow"."workflow_invocations" ADD COLUMN "expired_at" timestamp;
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
UPDATE "workflow"."workflow_invocations" AS invocation
|
|
14
|
+
SET "payload" = NULL, "result" = NULL, "fingerprint" = NULL,
|
|
15
|
+
"expired_at" = coalesce(invocation.expired_at, run.expired_at, now())
|
|
16
|
+
FROM "workflow"."workflow_runs" AS run
|
|
17
|
+
WHERE invocation.run_id = run.id
|
|
18
|
+
AND (run.expired_at IS NOT NULL OR
|
|
19
|
+
(run.status IN ('completed', 'failed', 'cancelled') AND run.attributes -> '$retention' = '"0"'::jsonb));
|
|
@@ -141,6 +141,27 @@
|
|
|
141
141
|
"when": 1786060800000,
|
|
142
142
|
"tag": "0019_add_event_slots",
|
|
143
143
|
"breakpoints": true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"idx": 20,
|
|
147
|
+
"version": "7",
|
|
148
|
+
"when": 1789430400000,
|
|
149
|
+
"tag": "0020_add_invocations",
|
|
150
|
+
"breakpoints": true
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"idx": 21,
|
|
154
|
+
"version": "7",
|
|
155
|
+
"when": 1789516800000,
|
|
156
|
+
"tag": "0021_invocation_identity_retention",
|
|
157
|
+
"breakpoints": true
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"idx": 22,
|
|
161
|
+
"version": "7",
|
|
162
|
+
"when": 1789603200000,
|
|
163
|
+
"tag": "0022_invocation_outcomes",
|
|
164
|
+
"breakpoints": true
|
|
144
165
|
}
|
|
145
166
|
]
|
|
146
167
|
}
|