@spfn/workflow 0.1.0-alpha.2
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 +21 -0
- package/README.md +702 -0
- package/dist/entities/workflow-execution.d.ts +169 -0
- package/dist/entities/workflow-execution.js +48 -0
- package/dist/entities/workflow-execution.js.map +1 -0
- package/dist/entities/workflow-step-execution.d.ts +203 -0
- package/dist/entities/workflow-step-execution.js +94 -0
- package/dist/entities/workflow-step-execution.js.map +1 -0
- package/dist/index.d.ts +545 -0
- package/dist/index.js +824 -0
- package/dist/index.js.map +1 -0
- package/dist/status-JJY5KGcN.d.ts +10 -0
- package/migrations/0000_even_thunderbolt_ross.sql +36 -0
- package/migrations/meta/0000_snapshot.json +308 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +76 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
2
|
+
import { W as WorkflowStatus } from '../status-JJY5KGcN.js';
|
|
3
|
+
|
|
4
|
+
declare const workflowExecutions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
5
|
+
name: "executions";
|
|
6
|
+
schema: string;
|
|
7
|
+
columns: {
|
|
8
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
9
|
+
name: "created_at";
|
|
10
|
+
tableName: "executions";
|
|
11
|
+
dataType: "date";
|
|
12
|
+
columnType: "PgTimestamp";
|
|
13
|
+
data: Date;
|
|
14
|
+
driverParam: string;
|
|
15
|
+
notNull: true;
|
|
16
|
+
hasDefault: true;
|
|
17
|
+
isPrimaryKey: false;
|
|
18
|
+
isAutoincrement: false;
|
|
19
|
+
hasRuntimeDefault: false;
|
|
20
|
+
enumValues: undefined;
|
|
21
|
+
baseColumn: never;
|
|
22
|
+
identity: undefined;
|
|
23
|
+
generated: undefined;
|
|
24
|
+
}, {}, {}>;
|
|
25
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
26
|
+
name: "updated_at";
|
|
27
|
+
tableName: "executions";
|
|
28
|
+
dataType: "date";
|
|
29
|
+
columnType: "PgTimestamp";
|
|
30
|
+
data: Date;
|
|
31
|
+
driverParam: string;
|
|
32
|
+
notNull: true;
|
|
33
|
+
hasDefault: true;
|
|
34
|
+
isPrimaryKey: false;
|
|
35
|
+
isAutoincrement: false;
|
|
36
|
+
hasRuntimeDefault: false;
|
|
37
|
+
enumValues: undefined;
|
|
38
|
+
baseColumn: never;
|
|
39
|
+
identity: undefined;
|
|
40
|
+
generated: undefined;
|
|
41
|
+
}, {}, {}>;
|
|
42
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
43
|
+
name: "id";
|
|
44
|
+
tableName: "executions";
|
|
45
|
+
dataType: "string";
|
|
46
|
+
columnType: "PgText";
|
|
47
|
+
data: string;
|
|
48
|
+
driverParam: string;
|
|
49
|
+
notNull: true;
|
|
50
|
+
hasDefault: true;
|
|
51
|
+
isPrimaryKey: true;
|
|
52
|
+
isAutoincrement: false;
|
|
53
|
+
hasRuntimeDefault: true;
|
|
54
|
+
enumValues: [string, ...string[]];
|
|
55
|
+
baseColumn: never;
|
|
56
|
+
identity: undefined;
|
|
57
|
+
generated: undefined;
|
|
58
|
+
}, {}, {}>;
|
|
59
|
+
workflowName: drizzle_orm_pg_core.PgColumn<{
|
|
60
|
+
name: "workflow_name";
|
|
61
|
+
tableName: "executions";
|
|
62
|
+
dataType: "string";
|
|
63
|
+
columnType: "PgText";
|
|
64
|
+
data: string;
|
|
65
|
+
driverParam: string;
|
|
66
|
+
notNull: true;
|
|
67
|
+
hasDefault: false;
|
|
68
|
+
isPrimaryKey: false;
|
|
69
|
+
isAutoincrement: false;
|
|
70
|
+
hasRuntimeDefault: false;
|
|
71
|
+
enumValues: [string, ...string[]];
|
|
72
|
+
baseColumn: never;
|
|
73
|
+
identity: undefined;
|
|
74
|
+
generated: undefined;
|
|
75
|
+
}, {}, {}>;
|
|
76
|
+
status: drizzle_orm_pg_core.PgColumn<{
|
|
77
|
+
name: "status";
|
|
78
|
+
tableName: "executions";
|
|
79
|
+
dataType: "string";
|
|
80
|
+
columnType: "PgText";
|
|
81
|
+
data: WorkflowStatus;
|
|
82
|
+
driverParam: string;
|
|
83
|
+
notNull: true;
|
|
84
|
+
hasDefault: true;
|
|
85
|
+
isPrimaryKey: false;
|
|
86
|
+
isAutoincrement: false;
|
|
87
|
+
hasRuntimeDefault: false;
|
|
88
|
+
enumValues: [string, ...string[]];
|
|
89
|
+
baseColumn: never;
|
|
90
|
+
identity: undefined;
|
|
91
|
+
generated: undefined;
|
|
92
|
+
}, {}, {
|
|
93
|
+
$type: WorkflowStatus;
|
|
94
|
+
}>;
|
|
95
|
+
input: drizzle_orm_pg_core.PgColumn<{
|
|
96
|
+
name: "input";
|
|
97
|
+
tableName: "executions";
|
|
98
|
+
dataType: "json";
|
|
99
|
+
columnType: "PgJsonb";
|
|
100
|
+
data: unknown;
|
|
101
|
+
driverParam: unknown;
|
|
102
|
+
notNull: false;
|
|
103
|
+
hasDefault: false;
|
|
104
|
+
isPrimaryKey: false;
|
|
105
|
+
isAutoincrement: false;
|
|
106
|
+
hasRuntimeDefault: false;
|
|
107
|
+
enumValues: undefined;
|
|
108
|
+
baseColumn: never;
|
|
109
|
+
identity: undefined;
|
|
110
|
+
generated: undefined;
|
|
111
|
+
}, {}, {}>;
|
|
112
|
+
currentStep: drizzle_orm_pg_core.PgColumn<{
|
|
113
|
+
name: "current_step";
|
|
114
|
+
tableName: "executions";
|
|
115
|
+
dataType: "number";
|
|
116
|
+
columnType: "PgInteger";
|
|
117
|
+
data: number;
|
|
118
|
+
driverParam: string | number;
|
|
119
|
+
notNull: true;
|
|
120
|
+
hasDefault: true;
|
|
121
|
+
isPrimaryKey: false;
|
|
122
|
+
isAutoincrement: false;
|
|
123
|
+
hasRuntimeDefault: false;
|
|
124
|
+
enumValues: undefined;
|
|
125
|
+
baseColumn: never;
|
|
126
|
+
identity: undefined;
|
|
127
|
+
generated: undefined;
|
|
128
|
+
}, {}, {}>;
|
|
129
|
+
error: drizzle_orm_pg_core.PgColumn<{
|
|
130
|
+
name: "error";
|
|
131
|
+
tableName: "executions";
|
|
132
|
+
dataType: "string";
|
|
133
|
+
columnType: "PgText";
|
|
134
|
+
data: string;
|
|
135
|
+
driverParam: string;
|
|
136
|
+
notNull: false;
|
|
137
|
+
hasDefault: false;
|
|
138
|
+
isPrimaryKey: false;
|
|
139
|
+
isAutoincrement: false;
|
|
140
|
+
hasRuntimeDefault: false;
|
|
141
|
+
enumValues: [string, ...string[]];
|
|
142
|
+
baseColumn: never;
|
|
143
|
+
identity: undefined;
|
|
144
|
+
generated: undefined;
|
|
145
|
+
}, {}, {}>;
|
|
146
|
+
completedAt: drizzle_orm_pg_core.PgColumn<{
|
|
147
|
+
name: "completed_at";
|
|
148
|
+
tableName: "executions";
|
|
149
|
+
dataType: "date";
|
|
150
|
+
columnType: "PgTimestamp";
|
|
151
|
+
data: Date;
|
|
152
|
+
driverParam: string;
|
|
153
|
+
notNull: false;
|
|
154
|
+
hasDefault: false;
|
|
155
|
+
isPrimaryKey: false;
|
|
156
|
+
isAutoincrement: false;
|
|
157
|
+
hasRuntimeDefault: false;
|
|
158
|
+
enumValues: undefined;
|
|
159
|
+
baseColumn: never;
|
|
160
|
+
identity: undefined;
|
|
161
|
+
generated: undefined;
|
|
162
|
+
}, {}, {}>;
|
|
163
|
+
};
|
|
164
|
+
dialect: "pg";
|
|
165
|
+
}>;
|
|
166
|
+
type WorkflowExecution = typeof workflowExecutions.$inferSelect;
|
|
167
|
+
type NewWorkflowExecution = typeof workflowExecutions.$inferInsert;
|
|
168
|
+
|
|
169
|
+
export { type NewWorkflowExecution, type WorkflowExecution, workflowExecutions };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { timestamp, text, integer, jsonb, index } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { createSchema, timestamps } from '@spfn/core/db';
|
|
3
|
+
|
|
4
|
+
// src/entities/workflow-execution.entity.ts
|
|
5
|
+
var workflowSchema = createSchema("@spfn/workflow");
|
|
6
|
+
|
|
7
|
+
// src/entities/workflow-execution.entity.ts
|
|
8
|
+
var workflowExecutions = workflowSchema.table(
|
|
9
|
+
"executions",
|
|
10
|
+
{
|
|
11
|
+
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
12
|
+
/**
|
|
13
|
+
* Workflow name (identifier)
|
|
14
|
+
*/
|
|
15
|
+
workflowName: text("workflow_name").notNull(),
|
|
16
|
+
/**
|
|
17
|
+
* Execution status
|
|
18
|
+
*/
|
|
19
|
+
status: text("status").$type().notNull().default("pending"),
|
|
20
|
+
/**
|
|
21
|
+
* Input data (JSON)
|
|
22
|
+
*/
|
|
23
|
+
input: jsonb("input"),
|
|
24
|
+
/**
|
|
25
|
+
* Current step index
|
|
26
|
+
*/
|
|
27
|
+
currentStep: integer("current_step").notNull().default(0),
|
|
28
|
+
/**
|
|
29
|
+
* Error message (if failed)
|
|
30
|
+
*/
|
|
31
|
+
error: text("error"),
|
|
32
|
+
/**
|
|
33
|
+
* Completed timestamp
|
|
34
|
+
*/
|
|
35
|
+
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
36
|
+
...timestamps()
|
|
37
|
+
},
|
|
38
|
+
(table) => [
|
|
39
|
+
index("wf_exec_workflow_name_idx").on(table.workflowName),
|
|
40
|
+
index("wf_exec_status_idx").on(table.status),
|
|
41
|
+
index("wf_exec_created_at_idx").on(table.createdAt),
|
|
42
|
+
index("wf_exec_workflow_status_idx").on(table.workflowName, table.status)
|
|
43
|
+
]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export { workflowExecutions };
|
|
47
|
+
//# sourceMappingURL=workflow-execution.js.map
|
|
48
|
+
//# sourceMappingURL=workflow-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/entities/schema.ts","../../src/entities/workflow-execution.entity.ts"],"names":[],"mappings":";;;;AAYO,IAAM,cAAA,GAAiB,aAAa,gBAAgB,CAAA;;;ACDpD,IAAM,qBAAqB,cAAA,CAAe,KAAA;AAAA,EAC7C,YAAA;AAAA,EACA;AAAA,IACI,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA,GAAa,UAAA,CAAW,MAAM,MAAA,CAAO,UAAA,EAAY,CAAA;AAAA;AAAA;AAAA;AAAA,IAKhE,YAAA,EAAc,IAAA,CAAK,eAAe,CAAA,CAAE,OAAA,EAAQ;AAAA;AAAA;AAAA;AAAA,IAK5C,MAAA,EAAQ,KAAK,QAAQ,CAAA,CAAE,OAAsB,CAAE,OAAA,EAAQ,CAAE,OAAA,CAAQ,SAAS,CAAA;AAAA;AAAA;AAAA;AAAA,IAK1E,KAAA,EAAO,MAAM,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA,IAKpB,aAAa,OAAA,CAAQ,cAAc,EAAE,OAAA,EAAQ,CAAE,QAAQ,CAAC,CAAA;AAAA;AAAA;AAAA;AAAA,IAKxD,KAAA,EAAO,KAAK,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA,IAKnB,aAAa,SAAA,CAAU,cAAA,EAAgB,EAAE,YAAA,EAAc,MAAM,CAAA;AAAA,IAE7D,GAAG,UAAA;AAAW,GAClB;AAAA,EACA,CAAC,KAAA,KAAU;AAAA,IACP,KAAA,CAAM,2BAA2B,CAAA,CAAE,EAAA,CAAG,MAAM,YAAY,CAAA;AAAA,IACxD,KAAA,CAAM,oBAAoB,CAAA,CAAE,EAAA,CAAG,MAAM,MAAM,CAAA;AAAA,IAC3C,KAAA,CAAM,wBAAwB,CAAA,CAAE,EAAA,CAAG,MAAM,SAAS,CAAA;AAAA,IAClD,MAAM,6BAA6B,CAAA,CAAE,GAAG,KAAA,CAAM,YAAA,EAAc,MAAM,MAAM;AAAA;AAEhF","file":"workflow-execution.js","sourcesContent":["/**\n * @spfn/workflow - Database Schema Definition\n *\n * Defines the 'spfn_workflow' PostgreSQL schema for all workflow-related tables\n */\n\nimport { createSchema } from '@spfn/core/db';\n\n/**\n * Workflow schema for all workflow execution tables\n * Tables: executions, step_executions\n */\nexport const workflowSchema = createSchema('@spfn/workflow');\n","/**\n * Workflow Execution Entity\n *\n * Stores the state of workflow executions\n */\n\nimport { text, integer, timestamp, jsonb, index } from 'drizzle-orm/pg-core';\nimport { timestamps } from '@spfn/core/db';\nimport type { WorkflowStatus } from '../types';\nimport { workflowSchema } from './schema';\n\nexport const workflowExecutions = workflowSchema.table(\n 'executions',\n {\n id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),\n\n /**\n * Workflow name (identifier)\n */\n workflowName: text('workflow_name').notNull(),\n\n /**\n * Execution status\n */\n status: text('status').$type<WorkflowStatus>().notNull().default('pending'),\n\n /**\n * Input data (JSON)\n */\n input: jsonb('input'),\n\n /**\n * Current step index\n */\n currentStep: integer('current_step').notNull().default(0),\n\n /**\n * Error message (if failed)\n */\n error: text('error'),\n\n /**\n * Completed timestamp\n */\n completedAt: timestamp('completed_at', { withTimezone: true }),\n\n ...timestamps(),\n },\n (table) => [\n index('wf_exec_workflow_name_idx').on(table.workflowName),\n index('wf_exec_status_idx').on(table.status),\n index('wf_exec_created_at_idx').on(table.createdAt),\n index('wf_exec_workflow_status_idx').on(table.workflowName, table.status),\n ]\n);\n\nexport type WorkflowExecution = typeof workflowExecutions.$inferSelect;\nexport type NewWorkflowExecution = typeof workflowExecutions.$inferInsert;\n"]}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
2
|
+
import { a as WorkflowStepStatus } from '../status-JJY5KGcN.js';
|
|
3
|
+
|
|
4
|
+
declare const workflowStepExecutions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
5
|
+
name: "step_executions";
|
|
6
|
+
schema: string;
|
|
7
|
+
columns: {
|
|
8
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
9
|
+
name: "created_at";
|
|
10
|
+
tableName: "step_executions";
|
|
11
|
+
dataType: "date";
|
|
12
|
+
columnType: "PgTimestamp";
|
|
13
|
+
data: Date;
|
|
14
|
+
driverParam: string;
|
|
15
|
+
notNull: true;
|
|
16
|
+
hasDefault: true;
|
|
17
|
+
isPrimaryKey: false;
|
|
18
|
+
isAutoincrement: false;
|
|
19
|
+
hasRuntimeDefault: false;
|
|
20
|
+
enumValues: undefined;
|
|
21
|
+
baseColumn: never;
|
|
22
|
+
identity: undefined;
|
|
23
|
+
generated: undefined;
|
|
24
|
+
}, {}, {}>;
|
|
25
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
26
|
+
name: "updated_at";
|
|
27
|
+
tableName: "step_executions";
|
|
28
|
+
dataType: "date";
|
|
29
|
+
columnType: "PgTimestamp";
|
|
30
|
+
data: Date;
|
|
31
|
+
driverParam: string;
|
|
32
|
+
notNull: true;
|
|
33
|
+
hasDefault: true;
|
|
34
|
+
isPrimaryKey: false;
|
|
35
|
+
isAutoincrement: false;
|
|
36
|
+
hasRuntimeDefault: false;
|
|
37
|
+
enumValues: undefined;
|
|
38
|
+
baseColumn: never;
|
|
39
|
+
identity: undefined;
|
|
40
|
+
generated: undefined;
|
|
41
|
+
}, {}, {}>;
|
|
42
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
43
|
+
name: "id";
|
|
44
|
+
tableName: "step_executions";
|
|
45
|
+
dataType: "string";
|
|
46
|
+
columnType: "PgText";
|
|
47
|
+
data: string;
|
|
48
|
+
driverParam: string;
|
|
49
|
+
notNull: true;
|
|
50
|
+
hasDefault: true;
|
|
51
|
+
isPrimaryKey: true;
|
|
52
|
+
isAutoincrement: false;
|
|
53
|
+
hasRuntimeDefault: true;
|
|
54
|
+
enumValues: [string, ...string[]];
|
|
55
|
+
baseColumn: never;
|
|
56
|
+
identity: undefined;
|
|
57
|
+
generated: undefined;
|
|
58
|
+
}, {}, {}>;
|
|
59
|
+
executionId: drizzle_orm_pg_core.PgColumn<{
|
|
60
|
+
name: "execution_id";
|
|
61
|
+
tableName: "step_executions";
|
|
62
|
+
dataType: "string";
|
|
63
|
+
columnType: "PgText";
|
|
64
|
+
data: string;
|
|
65
|
+
driverParam: string;
|
|
66
|
+
notNull: true;
|
|
67
|
+
hasDefault: false;
|
|
68
|
+
isPrimaryKey: false;
|
|
69
|
+
isAutoincrement: false;
|
|
70
|
+
hasRuntimeDefault: false;
|
|
71
|
+
enumValues: [string, ...string[]];
|
|
72
|
+
baseColumn: never;
|
|
73
|
+
identity: undefined;
|
|
74
|
+
generated: undefined;
|
|
75
|
+
}, {}, {}>;
|
|
76
|
+
stepName: drizzle_orm_pg_core.PgColumn<{
|
|
77
|
+
name: "step_name";
|
|
78
|
+
tableName: "step_executions";
|
|
79
|
+
dataType: "string";
|
|
80
|
+
columnType: "PgText";
|
|
81
|
+
data: string;
|
|
82
|
+
driverParam: string;
|
|
83
|
+
notNull: true;
|
|
84
|
+
hasDefault: false;
|
|
85
|
+
isPrimaryKey: false;
|
|
86
|
+
isAutoincrement: false;
|
|
87
|
+
hasRuntimeDefault: false;
|
|
88
|
+
enumValues: [string, ...string[]];
|
|
89
|
+
baseColumn: never;
|
|
90
|
+
identity: undefined;
|
|
91
|
+
generated: undefined;
|
|
92
|
+
}, {}, {}>;
|
|
93
|
+
stepIndex: drizzle_orm_pg_core.PgColumn<{
|
|
94
|
+
name: "step_index";
|
|
95
|
+
tableName: "step_executions";
|
|
96
|
+
dataType: "number";
|
|
97
|
+
columnType: "PgInteger";
|
|
98
|
+
data: number;
|
|
99
|
+
driverParam: string | number;
|
|
100
|
+
notNull: true;
|
|
101
|
+
hasDefault: false;
|
|
102
|
+
isPrimaryKey: false;
|
|
103
|
+
isAutoincrement: false;
|
|
104
|
+
hasRuntimeDefault: false;
|
|
105
|
+
enumValues: undefined;
|
|
106
|
+
baseColumn: never;
|
|
107
|
+
identity: undefined;
|
|
108
|
+
generated: undefined;
|
|
109
|
+
}, {}, {}>;
|
|
110
|
+
status: drizzle_orm_pg_core.PgColumn<{
|
|
111
|
+
name: "status";
|
|
112
|
+
tableName: "step_executions";
|
|
113
|
+
dataType: "string";
|
|
114
|
+
columnType: "PgText";
|
|
115
|
+
data: WorkflowStepStatus;
|
|
116
|
+
driverParam: string;
|
|
117
|
+
notNull: true;
|
|
118
|
+
hasDefault: true;
|
|
119
|
+
isPrimaryKey: false;
|
|
120
|
+
isAutoincrement: false;
|
|
121
|
+
hasRuntimeDefault: false;
|
|
122
|
+
enumValues: [string, ...string[]];
|
|
123
|
+
baseColumn: never;
|
|
124
|
+
identity: undefined;
|
|
125
|
+
generated: undefined;
|
|
126
|
+
}, {}, {
|
|
127
|
+
$type: WorkflowStepStatus;
|
|
128
|
+
}>;
|
|
129
|
+
output: drizzle_orm_pg_core.PgColumn<{
|
|
130
|
+
name: "output";
|
|
131
|
+
tableName: "step_executions";
|
|
132
|
+
dataType: "json";
|
|
133
|
+
columnType: "PgJsonb";
|
|
134
|
+
data: unknown;
|
|
135
|
+
driverParam: unknown;
|
|
136
|
+
notNull: false;
|
|
137
|
+
hasDefault: false;
|
|
138
|
+
isPrimaryKey: false;
|
|
139
|
+
isAutoincrement: false;
|
|
140
|
+
hasRuntimeDefault: false;
|
|
141
|
+
enumValues: undefined;
|
|
142
|
+
baseColumn: never;
|
|
143
|
+
identity: undefined;
|
|
144
|
+
generated: undefined;
|
|
145
|
+
}, {}, {}>;
|
|
146
|
+
error: drizzle_orm_pg_core.PgColumn<{
|
|
147
|
+
name: "error";
|
|
148
|
+
tableName: "step_executions";
|
|
149
|
+
dataType: "string";
|
|
150
|
+
columnType: "PgText";
|
|
151
|
+
data: string;
|
|
152
|
+
driverParam: string;
|
|
153
|
+
notNull: false;
|
|
154
|
+
hasDefault: false;
|
|
155
|
+
isPrimaryKey: false;
|
|
156
|
+
isAutoincrement: false;
|
|
157
|
+
hasRuntimeDefault: false;
|
|
158
|
+
enumValues: [string, ...string[]];
|
|
159
|
+
baseColumn: never;
|
|
160
|
+
identity: undefined;
|
|
161
|
+
generated: undefined;
|
|
162
|
+
}, {}, {}>;
|
|
163
|
+
startedAt: drizzle_orm_pg_core.PgColumn<{
|
|
164
|
+
name: "started_at";
|
|
165
|
+
tableName: "step_executions";
|
|
166
|
+
dataType: "date";
|
|
167
|
+
columnType: "PgTimestamp";
|
|
168
|
+
data: Date;
|
|
169
|
+
driverParam: string;
|
|
170
|
+
notNull: false;
|
|
171
|
+
hasDefault: false;
|
|
172
|
+
isPrimaryKey: false;
|
|
173
|
+
isAutoincrement: false;
|
|
174
|
+
hasRuntimeDefault: false;
|
|
175
|
+
enumValues: undefined;
|
|
176
|
+
baseColumn: never;
|
|
177
|
+
identity: undefined;
|
|
178
|
+
generated: undefined;
|
|
179
|
+
}, {}, {}>;
|
|
180
|
+
completedAt: drizzle_orm_pg_core.PgColumn<{
|
|
181
|
+
name: "completed_at";
|
|
182
|
+
tableName: "step_executions";
|
|
183
|
+
dataType: "date";
|
|
184
|
+
columnType: "PgTimestamp";
|
|
185
|
+
data: Date;
|
|
186
|
+
driverParam: string;
|
|
187
|
+
notNull: false;
|
|
188
|
+
hasDefault: false;
|
|
189
|
+
isPrimaryKey: false;
|
|
190
|
+
isAutoincrement: false;
|
|
191
|
+
hasRuntimeDefault: false;
|
|
192
|
+
enumValues: undefined;
|
|
193
|
+
baseColumn: never;
|
|
194
|
+
identity: undefined;
|
|
195
|
+
generated: undefined;
|
|
196
|
+
}, {}, {}>;
|
|
197
|
+
};
|
|
198
|
+
dialect: "pg";
|
|
199
|
+
}>;
|
|
200
|
+
type WorkflowStepExecution = typeof workflowStepExecutions.$inferSelect;
|
|
201
|
+
type NewWorkflowStepExecution = typeof workflowStepExecutions.$inferInsert;
|
|
202
|
+
|
|
203
|
+
export { type NewWorkflowStepExecution, type WorkflowStepExecution, workflowStepExecutions };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { timestamp, text, integer, jsonb, index } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { createSchema, timestamps } from '@spfn/core/db';
|
|
3
|
+
|
|
4
|
+
// src/entities/workflow-step-execution.entity.ts
|
|
5
|
+
var workflowSchema = createSchema("@spfn/workflow");
|
|
6
|
+
|
|
7
|
+
// src/entities/workflow-execution.entity.ts
|
|
8
|
+
var workflowExecutions = workflowSchema.table(
|
|
9
|
+
"executions",
|
|
10
|
+
{
|
|
11
|
+
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
12
|
+
/**
|
|
13
|
+
* Workflow name (identifier)
|
|
14
|
+
*/
|
|
15
|
+
workflowName: text("workflow_name").notNull(),
|
|
16
|
+
/**
|
|
17
|
+
* Execution status
|
|
18
|
+
*/
|
|
19
|
+
status: text("status").$type().notNull().default("pending"),
|
|
20
|
+
/**
|
|
21
|
+
* Input data (JSON)
|
|
22
|
+
*/
|
|
23
|
+
input: jsonb("input"),
|
|
24
|
+
/**
|
|
25
|
+
* Current step index
|
|
26
|
+
*/
|
|
27
|
+
currentStep: integer("current_step").notNull().default(0),
|
|
28
|
+
/**
|
|
29
|
+
* Error message (if failed)
|
|
30
|
+
*/
|
|
31
|
+
error: text("error"),
|
|
32
|
+
/**
|
|
33
|
+
* Completed timestamp
|
|
34
|
+
*/
|
|
35
|
+
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
36
|
+
...timestamps()
|
|
37
|
+
},
|
|
38
|
+
(table) => [
|
|
39
|
+
index("wf_exec_workflow_name_idx").on(table.workflowName),
|
|
40
|
+
index("wf_exec_status_idx").on(table.status),
|
|
41
|
+
index("wf_exec_created_at_idx").on(table.createdAt),
|
|
42
|
+
index("wf_exec_workflow_status_idx").on(table.workflowName, table.status)
|
|
43
|
+
]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// src/entities/workflow-step-execution.entity.ts
|
|
47
|
+
var workflowStepExecutions = workflowSchema.table(
|
|
48
|
+
"step_executions",
|
|
49
|
+
{
|
|
50
|
+
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
51
|
+
/**
|
|
52
|
+
* Parent workflow execution ID
|
|
53
|
+
*/
|
|
54
|
+
executionId: text("execution_id").notNull().references(() => workflowExecutions.id, { onDelete: "cascade" }),
|
|
55
|
+
/**
|
|
56
|
+
* Step name (job name)
|
|
57
|
+
*/
|
|
58
|
+
stepName: text("step_name").notNull(),
|
|
59
|
+
/**
|
|
60
|
+
* Step index in the workflow
|
|
61
|
+
*/
|
|
62
|
+
stepIndex: integer("step_index").notNull(),
|
|
63
|
+
/**
|
|
64
|
+
* Step execution status
|
|
65
|
+
*/
|
|
66
|
+
status: text("status").$type().notNull().default("pending"),
|
|
67
|
+
/**
|
|
68
|
+
* Step output data (JSON or URL reference for large data)
|
|
69
|
+
*/
|
|
70
|
+
output: jsonb("output"),
|
|
71
|
+
/**
|
|
72
|
+
* Error message (if failed)
|
|
73
|
+
*/
|
|
74
|
+
error: text("error"),
|
|
75
|
+
/**
|
|
76
|
+
* Started timestamp
|
|
77
|
+
*/
|
|
78
|
+
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
79
|
+
/**
|
|
80
|
+
* Completed timestamp
|
|
81
|
+
*/
|
|
82
|
+
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
83
|
+
...timestamps()
|
|
84
|
+
},
|
|
85
|
+
(table) => [
|
|
86
|
+
index("wf_step_exec_execution_id_idx").on(table.executionId),
|
|
87
|
+
index("wf_step_exec_status_idx").on(table.status),
|
|
88
|
+
index("wf_step_exec_exec_step_idx").on(table.executionId, table.stepIndex)
|
|
89
|
+
]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
export { workflowStepExecutions };
|
|
93
|
+
//# sourceMappingURL=workflow-step-execution.js.map
|
|
94
|
+
//# sourceMappingURL=workflow-step-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/entities/schema.ts","../../src/entities/workflow-execution.entity.ts","../../src/entities/workflow-step-execution.entity.ts"],"names":["text","integer","jsonb","timestamp","timestamps","index"],"mappings":";;;;AAYO,IAAM,cAA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* @spfn/workflow - Database Schema Definition\n *\n * Defines the 'spfn_workflow' PostgreSQL schema for all workflow-related tables\n */\n\nimport { createSchema } from '@spfn/core/db';\n\n/**\n * Workflow schema for all workflow execution tables\n * Tables: executions, step_executions\n */\nexport const workflowSchema = createSchema('@spfn/workflow');\n","/**\n * Workflow Execution Entity\n *\n * Stores the state of workflow executions\n */\n\nimport { text, integer, timestamp, jsonb, index } from 'drizzle-orm/pg-core';\nimport { timestamps } from '@spfn/core/db';\nimport type { WorkflowStatus } from '../types';\nimport { workflowSchema } from './schema';\n\nexport const workflowExecutions = workflowSchema.table(\n 'executions',\n {\n id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),\n\n /**\n * Workflow name (identifier)\n */\n workflowName: text('workflow_name').notNull(),\n\n /**\n * Execution status\n */\n status: text('status').$type<WorkflowStatus>().notNull().default('pending'),\n\n /**\n * Input data (JSON)\n */\n input: jsonb('input'),\n\n /**\n * Current step index\n */\n currentStep: integer('current_step').notNull().default(0),\n\n /**\n * Error message (if failed)\n */\n error: text('error'),\n\n /**\n * Completed timestamp\n */\n completedAt: timestamp('completed_at', { withTimezone: true }),\n\n ...timestamps(),\n },\n (table) => [\n index('wf_exec_workflow_name_idx').on(table.workflowName),\n index('wf_exec_status_idx').on(table.status),\n index('wf_exec_created_at_idx').on(table.createdAt),\n index('wf_exec_workflow_status_idx').on(table.workflowName, table.status),\n ]\n);\n\nexport type WorkflowExecution = typeof workflowExecutions.$inferSelect;\nexport type NewWorkflowExecution = typeof workflowExecutions.$inferInsert;\n","/**\n * Workflow Step Execution Entity\n *\n * Stores the state of individual step executions within a workflow\n */\n\nimport { text, integer, timestamp, jsonb, index } from 'drizzle-orm/pg-core';\nimport { timestamps } from '@spfn/core/db';\nimport type { WorkflowStepStatus } from '../types';\nimport { workflowExecutions } from './workflow-execution.entity';\nimport { workflowSchema } from './schema';\n\nexport const workflowStepExecutions = workflowSchema.table(\n 'step_executions',\n {\n id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),\n\n /**\n * Parent workflow execution ID\n */\n executionId: text('execution_id')\n .notNull()\n .references(() => workflowExecutions.id, { onDelete: 'cascade' }),\n\n /**\n * Step name (job name)\n */\n stepName: text('step_name').notNull(),\n\n /**\n * Step index in the workflow\n */\n stepIndex: integer('step_index').notNull(),\n\n /**\n * Step execution status\n */\n status: text('status').$type<WorkflowStepStatus>().notNull().default('pending'),\n\n /**\n * Step output data (JSON or URL reference for large data)\n */\n output: jsonb('output'),\n\n /**\n * Error message (if failed)\n */\n error: text('error'),\n\n /**\n * Started timestamp\n */\n startedAt: timestamp('started_at', { withTimezone: true }),\n\n /**\n * Completed timestamp\n */\n completedAt: timestamp('completed_at', { withTimezone: true }),\n\n ...timestamps(),\n },\n (table) => [\n index('wf_step_exec_execution_id_idx').on(table.executionId),\n index('wf_step_exec_status_idx').on(table.status),\n index('wf_step_exec_exec_step_idx').on(table.executionId, table.stepIndex),\n ]\n);\n\nexport type WorkflowStepExecution = typeof workflowStepExecutions.$inferSelect;\nexport type NewWorkflowStepExecution = typeof workflowStepExecutions.$inferInsert;\n"]}
|