@workflow/world-postgres 4.0.1-beta.3 → 4.1.0-beta.5

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/LICENSE.md CHANGED
@@ -1,21 +1,201 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025 Vercel, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ <http://www.apache.org/licenses/>
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Vercel Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -76,6 +76,39 @@ This package uses PostgreSQL with the following components:
76
76
  - **Drizzle ORM**: For database operations and schema management
77
77
  - **postgres**: For PostgreSQL client connections
78
78
 
79
+ ### Quick Setup with CLI
80
+
81
+ The easiest way to set up your database is using the included CLI tool:
82
+
83
+ ```bash
84
+ pnpm exec workflow-postgres-setup
85
+ # or
86
+ npm exec workflow-postgres-setup
87
+ ```
88
+
89
+ The CLI automatically loads `.env` files and will use the connection string from:
90
+ 1. `WORKFLOW_POSTGRES_URL` environment variable
91
+ 2. `DATABASE_URL` environment variable
92
+ 3. Default: `postgres://world:world@localhost:5432/world`
93
+
94
+ ### Database Schema
95
+
96
+ The setup creates the following tables:
97
+
98
+ - `workflow_runs` - Stores workflow execution runs
99
+ - `workflow_events` - Stores workflow events
100
+ - `workflow_steps` - Stores individual workflow steps
101
+ - `workflow_hooks` - Stores webhook hooks
102
+ - `workflow_stream_chunks` - Stores streaming data chunks
103
+
104
+ You can also access the schema programmatically:
105
+
106
+ ```typescript
107
+ import { runs, events, steps, hooks, streams } from '@workflow/world-postgres';
108
+ // or
109
+ import * as schema from '@workflow/world-postgres/schema';
110
+ ```
111
+
79
112
  Make sure your PostgreSQL database is accessible and the user has sufficient permissions to create tables and manage jobs.
80
113
 
81
114
  ## Features
package/bin/setup.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Simple wrapper to run the CLI from the bin directory
4
+ import('../dist/cli.js')
5
+ .then((module) => {
6
+ // Call the setupDatabase function
7
+ return module.setupDatabase();
8
+ })
9
+ .catch((err) => {
10
+ console.error('Failed to load CLI:', err);
11
+ process.exit(1);
12
+ });
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare function setupDatabase(): Promise<void>;
2
+ export { setupDatabase };
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAQA,iBAAe,aAAa,kBA+C3B;AAOD,OAAO,EAAE,aAAa,EAAE,CAAC"}
package/dist/cli.js ADDED
@@ -0,0 +1,44 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { config } from 'dotenv';
5
+ import postgres from 'postgres';
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ async function setupDatabase() {
8
+ // Load .env file if it exists
9
+ config();
10
+ const connectionString = process.env.WORKFLOW_POSTGRES_URL ||
11
+ process.env.DATABASE_URL ||
12
+ 'postgres://world:world@localhost:5432/world';
13
+ console.log('🔧 Setting up database schema...');
14
+ console.log(`📍 Connection: ${connectionString.replace(/^(\w+:\/\/)([^@]+)@/, '$1[redacted]@')}`);
15
+ try {
16
+ const sql = postgres(connectionString);
17
+ // Read the migration SQL file
18
+ // The migrations are in src/drizzle/migrations, and this CLI is in dist/
19
+ // So we need to go up one level from dist/ to reach src/
20
+ const migrationPath = join(__dirname, '..', 'src', 'drizzle', 'migrations', '0000_redundant_smasher.sql');
21
+ const migrationSQL = await readFile(migrationPath, 'utf-8');
22
+ // Execute the migration
23
+ await sql.unsafe(migrationSQL);
24
+ console.log('✅ Database schema created successfully!');
25
+ console.log('\nCreated tables:');
26
+ console.log(' - workflow_runs');
27
+ console.log(' - workflow_events');
28
+ console.log(' - workflow_steps');
29
+ console.log(' - workflow_hooks');
30
+ console.log(' - workflow_stream_chunks');
31
+ await sql.end();
32
+ process.exit(0);
33
+ }
34
+ catch (error) {
35
+ console.error('❌ Failed to setup database:', error);
36
+ process.exit(1);
37
+ }
38
+ }
39
+ // Check if running as main module
40
+ if (import.meta.url === `file://${process.argv[1]}`) {
41
+ setupDatabase();
42
+ }
43
+ export { setupDatabase };
44
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG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AO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,kCAAkC;AAClC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,aAAa,EAAE,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -188,7 +188,7 @@ export declare const events: import("drizzle-orm/pg-core").PgTableWithColumns<{
188
188
  tableName: "workflow_events";
189
189
  dataType: "string";
190
190
  columnType: "PgVarchar";
191
- data: "step_completed" | "step_failed" | "step_retrying" | "step_started" | "hook_created" | "hook_received" | "hook_disposed" | "workflow_completed" | "workflow_failed" | "workflow_started";
191
+ data: "step_completed" | "step_failed" | "step_retrying" | "step_started" | "hook_created" | "hook_received" | "hook_disposed" | "wait_created" | "wait_completed" | "workflow_completed" | "workflow_failed" | "workflow_started";
192
192
  driverParam: string;
193
193
  notNull: true;
194
194
  hasDefault: false;
@@ -406,6 +406,18 @@ export declare const steps: import("drizzle-orm/pg-core").PgTableWithColumns<{
406
406
  enumValues: undefined;
407
407
  baseColumn: never;
408
408
  }, {}, {}>;
409
+ retryAfter: import("drizzle-orm/pg-core").PgColumn<{
410
+ name: "retry_after";
411
+ tableName: "workflow_steps";
412
+ dataType: "date";
413
+ columnType: "PgTimestamp";
414
+ data: Date;
415
+ driverParam: string;
416
+ notNull: false;
417
+ hasDefault: false;
418
+ enumValues: undefined;
419
+ baseColumn: never;
420
+ }, {}, {}>;
409
421
  };
410
422
  dialect: "pg";
411
423
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/drizzle/schema.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,iBAAiB,iMAG7B,CAAC;AAEF,eAAO,MAAM,UAAU,2KAGtB,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBhB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAclB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBjB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBjB,CAAC;AAQF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYnB,CAAC"}
@@ -54,6 +54,7 @@ export const steps = pgTable('workflow_steps', {
54
54
  .defaultNow()
55
55
  .$onUpdateFn(() => new Date())
56
56
  .notNull(),
57
+ retryAfter: timestamp('retry_after'),
57
58
  }, (tb) => ({
58
59
  runFk: index().on(tb.runId),
59
60
  statusIdx: index().on(tb.status),
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/drizzle/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,gBAAgB,EAEhB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,OAAO,EACP,KAAK,EACL,MAAM,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W,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;IAC7C,SAAS,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE;IACzD,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAqB;CACvB,EACjC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACP,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAC3B,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;CAC/B,CAAC,CACH,CAAC;AAEF,MAAM,KAAK,GAAG,UAAU,CAAmD;IACzE,QAAQ;QACN,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAC5B,wBAAwB,EACxB;IACE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAoB,CAAC,OAAO,EAAE;IAC1D,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;IACxC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAClC,SAAS,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE;IACzD,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;CAC9B,EACD,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACP,UAAU,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CAC/D,CAAC,CACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,4 +3,6 @@ import type { PostgresWorldConfig } from './config.js';
3
3
  export declare function createWorld(config?: PostgresWorldConfig): World & {
4
4
  start(): Promise<void>;
5
5
  };
6
+ export type { PostgresWorldConfig } from './config.js';
7
+ export * from './drizzle/schema.js';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAoBvD,wBAAgB,WAAW,CACzB,MAAM,GAAE,mBAQP,GACA,KAAK,GAAG;IAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAkBpC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAoBvD,wBAAgB,WAAW,CACzB,MAAM,GAAE,mBAQP,GACA,KAAK,GAAG;IAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAkBpC;AAGD,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,cAAc,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -36,4 +36,5 @@ export function createWorld(config = {
36
36
  },
37
37
  };
38
38
  }
39
+ export * from './drizzle/schema.js';
39
40
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,cAAc,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,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,EAAE,OAAO,CAAC,CAAC;IAEnD,OAAO;QACL,GAAG,OAAO;QACV,GAAG,QAAQ;QACX,GAAG,KAAK;QACR,KAAK,CAAC,KAAK;YACT,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC;AAID,cAAc,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "name": "@workflow/world-postgres",
3
- "version": "4.0.1-beta.3",
3
+ "version": "4.1.0-beta.5",
4
4
  "description": "A reference World implementation based on PostgreSQL",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
+ "bin": {
8
+ "workflow-postgres-setup": "./bin/setup.js"
9
+ },
7
10
  "files": [
8
- "dist"
11
+ "dist",
12
+ "bin",
13
+ "src/drizzle/migrations"
9
14
  ],
10
15
  "publishConfig": {
11
16
  "access": "public"
12
17
  },
13
- "license": "MIT",
18
+ "license": "Apache-2.0",
14
19
  "repository": {
15
20
  "type": "git",
16
21
  "url": "https://github.com/vercel/workflow.git",
@@ -20,27 +25,37 @@
20
25
  ".": {
21
26
  "types": "./dist/index.d.ts",
22
27
  "default": "./dist/index.js"
23
- }
28
+ },
29
+ "./schema": {
30
+ "types": "./dist/drizzle/schema.d.ts",
31
+ "default": "./dist/drizzle/schema.js"
32
+ },
33
+ "./cli": {
34
+ "types": "./dist/cli.d.ts",
35
+ "default": "./dist/cli.js"
36
+ },
37
+ "./migrations/*.sql": "./src/drizzle/migrations/*.sql"
24
38
  },
25
39
  "dependencies": {
26
40
  "@vercel/queue": "0.0.0-alpha.23",
41
+ "dotenv": "^16.4.5",
27
42
  "drizzle-orm": "^0.31.2",
28
43
  "pg-boss": "^11.0.7",
29
44
  "postgres": "^3.4.7",
30
45
  "ulid": "^3.0.1",
31
46
  "zod": "4.1.11",
32
- "@workflow/errors": "4.0.1-beta.1",
33
- "@workflow/world": "4.0.1-beta.2",
34
- "@workflow/world-local": "4.0.1-beta.2"
47
+ "@workflow/errors": "4.0.1-beta.3",
48
+ "@workflow/world-local": "4.0.1-beta.4",
49
+ "@workflow/world": "4.0.1-beta.4"
35
50
  },
36
51
  "devDependencies": {
37
52
  "@testcontainers/postgresql": "^11.7.1",
38
- "@types/node": "24.6.2",
53
+ "@types/node": "22.19.0",
39
54
  "drizzle-kit": "^0.22.7",
40
55
  "vitest": "^3.2.4",
41
- "@workflow/errors": "4.0.1-beta.1",
56
+ "@workflow/errors": "4.0.1-beta.3",
42
57
  "@workflow/tsconfig": "4.0.1-beta.0",
43
- "@workflow/world-testing": "4.0.1-beta.5"
58
+ "@workflow/world-testing": "4.0.1-beta.8"
44
59
  },
45
60
  "keywords": [],
46
61
  "author": "",
@@ -0,0 +1,80 @@
1
+ DO $$ BEGIN
2
+ CREATE TYPE "public"."step_status" AS ENUM('pending', 'running', 'completed', 'failed', 'cancelled');
3
+ EXCEPTION
4
+ WHEN duplicate_object THEN null;
5
+ END $$;
6
+ --> statement-breakpoint
7
+ DO $$ BEGIN
8
+ CREATE TYPE "public"."status" AS ENUM('pending', 'running', 'completed', 'failed', 'paused', 'cancelled');
9
+ EXCEPTION
10
+ WHEN duplicate_object THEN null;
11
+ END $$;
12
+ --> statement-breakpoint
13
+ CREATE TABLE IF NOT EXISTS "workflow_events" (
14
+ "id" varchar PRIMARY KEY NOT NULL,
15
+ "type" varchar NOT NULL,
16
+ "correlation_id" varchar,
17
+ "created_at" timestamp DEFAULT now() NOT NULL,
18
+ "run_id" varchar NOT NULL,
19
+ "payload" jsonb
20
+ );
21
+ --> statement-breakpoint
22
+ CREATE TABLE IF NOT EXISTS "workflow_hooks" (
23
+ "run_id" varchar NOT NULL,
24
+ "hook_id" varchar PRIMARY KEY NOT NULL,
25
+ "token" varchar NOT NULL,
26
+ "owner_id" varchar NOT NULL,
27
+ "project_id" varchar NOT NULL,
28
+ "environment" varchar NOT NULL,
29
+ "created_at" timestamp DEFAULT now() NOT NULL,
30
+ "metadata" jsonb
31
+ );
32
+ --> statement-breakpoint
33
+ CREATE TABLE IF NOT EXISTS "workflow_runs" (
34
+ "id" varchar PRIMARY KEY NOT NULL,
35
+ "output" jsonb,
36
+ "deployment_id" varchar NOT NULL,
37
+ "status" "status" NOT NULL,
38
+ "name" varchar NOT NULL,
39
+ "execution_context" jsonb,
40
+ "input" jsonb NOT NULL,
41
+ "error" text,
42
+ "error_code" varchar,
43
+ "created_at" timestamp DEFAULT now() NOT NULL,
44
+ "updated_at" timestamp DEFAULT now() NOT NULL,
45
+ "completed_at" timestamp,
46
+ "started_at" timestamp
47
+ );
48
+ --> statement-breakpoint
49
+ CREATE TABLE IF NOT EXISTS "workflow_steps" (
50
+ "run_id" varchar NOT NULL,
51
+ "step_id" varchar PRIMARY KEY NOT NULL,
52
+ "step_name" varchar NOT NULL,
53
+ "status" "step_status" NOT NULL,
54
+ "input" jsonb NOT NULL,
55
+ "output" jsonb,
56
+ "error" text,
57
+ "error_code" varchar,
58
+ "attempt" integer NOT NULL,
59
+ "started_at" timestamp,
60
+ "completed_at" timestamp,
61
+ "created_at" timestamp DEFAULT now() NOT NULL,
62
+ "updated_at" timestamp DEFAULT now() NOT NULL
63
+ );
64
+ --> statement-breakpoint
65
+ CREATE TABLE IF NOT EXISTS "workflow_stream_chunks" (
66
+ "id" varchar NOT NULL,
67
+ "stream_id" varchar NOT NULL,
68
+ "data" "bytea" NOT NULL,
69
+ "created_at" timestamp DEFAULT now() NOT NULL,
70
+ "eof" boolean NOT NULL,
71
+ CONSTRAINT "workflow_stream_chunks_stream_id_id_pk" PRIMARY KEY("stream_id","id")
72
+ );
73
+ --> statement-breakpoint
74
+ CREATE INDEX IF NOT EXISTS "workflow_events_run_id_index" ON "workflow_events" USING btree ("run_id");--> statement-breakpoint
75
+ CREATE INDEX IF NOT EXISTS "workflow_hooks_run_id_index" ON "workflow_hooks" USING btree ("run_id");--> statement-breakpoint
76
+ CREATE INDEX IF NOT EXISTS "workflow_hooks_token_index" ON "workflow_hooks" USING btree ("token");--> statement-breakpoint
77
+ CREATE INDEX IF NOT EXISTS "workflow_runs_name_index" ON "workflow_runs" USING btree ("name");--> statement-breakpoint
78
+ CREATE INDEX IF NOT EXISTS "workflow_runs_status_index" ON "workflow_runs" USING btree ("status");--> statement-breakpoint
79
+ CREATE INDEX IF NOT EXISTS "workflow_steps_run_id_index" ON "workflow_steps" USING btree ("run_id");--> statement-breakpoint
80
+ CREATE INDEX IF NOT EXISTS "workflow_steps_status_index" ON "workflow_steps" USING btree ("status");