@pikku/kysely 0.12.14 → 0.12.15
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sql } from 'kysely';
|
|
1
2
|
import { parseJson } from './kysely-json.js';
|
|
2
3
|
export class KyselyWorkflowRunService {
|
|
3
4
|
db;
|
|
@@ -82,6 +83,9 @@ export class KyselyWorkflowRunService {
|
|
|
82
83
|
.select(eb.fn.countAll().as('cnt'))
|
|
83
84
|
.whereRef('workflowStepHistory.workflowStepId', '=', 's.workflowStepId')
|
|
84
85
|
.as('attemptCount'))
|
|
86
|
+
.select(sql `(SELECT MAX(h.running_at) FROM workflow_step_history h WHERE h.workflow_step_id = s.workflow_step_id)`.as('runningAt'))
|
|
87
|
+
.select(sql `(SELECT MAX(h.succeeded_at) FROM workflow_step_history h WHERE h.workflow_step_id = s.workflow_step_id)`.as('succeededAt'))
|
|
88
|
+
.select(sql `(SELECT MAX(h.failed_at) FROM workflow_step_history h WHERE h.workflow_step_id = s.workflow_step_id)`.as('failedAt'))
|
|
85
89
|
.where('s.workflowRunId', '=', runId)
|
|
86
90
|
.orderBy('s.createdAt', 'asc')
|
|
87
91
|
.execute();
|
|
@@ -99,6 +103,15 @@ export class KyselyWorkflowRunService {
|
|
|
99
103
|
retryDelay: row.retryDelay ?? undefined,
|
|
100
104
|
createdAt: new Date(row.createdAt),
|
|
101
105
|
updatedAt: new Date(row.updatedAt),
|
|
106
|
+
runningAt: row.runningAt
|
|
107
|
+
? new Date(row.runningAt)
|
|
108
|
+
: undefined,
|
|
109
|
+
succeededAt: row.succeededAt
|
|
110
|
+
? new Date(row.succeededAt)
|
|
111
|
+
: undefined,
|
|
112
|
+
failedAt: row.failedAt
|
|
113
|
+
? new Date(row.failedAt)
|
|
114
|
+
: undefined,
|
|
102
115
|
}));
|
|
103
116
|
}
|
|
104
117
|
async getRunHistory(runId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/kysely",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.15",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"prepublishOnly": "yarn build"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@pikku/core": "^0.12.
|
|
23
|
+
"@pikku/core": "^0.12.28"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"kysely": "^0.28.12"
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
WorkflowRunService,
|
|
6
6
|
} from '@pikku/core/workflow'
|
|
7
7
|
import type { Kysely } from 'kysely'
|
|
8
|
+
import { sql } from 'kysely'
|
|
8
9
|
import type { KyselyPikkuDB } from './kysely-tables.js'
|
|
9
10
|
import { parseJson } from './kysely-json.js'
|
|
10
11
|
|
|
@@ -111,6 +112,15 @@ export class KyselyWorkflowRunService implements WorkflowRunService {
|
|
|
111
112
|
)
|
|
112
113
|
.as('attemptCount')
|
|
113
114
|
)
|
|
115
|
+
.select(
|
|
116
|
+
sql<string | null>`(SELECT MAX(h.running_at) FROM workflow_step_history h WHERE h.workflow_step_id = s.workflow_step_id)`.as('runningAt')
|
|
117
|
+
)
|
|
118
|
+
.select(
|
|
119
|
+
sql<string | null>`(SELECT MAX(h.succeeded_at) FROM workflow_step_history h WHERE h.workflow_step_id = s.workflow_step_id)`.as('succeededAt')
|
|
120
|
+
)
|
|
121
|
+
.select(
|
|
122
|
+
sql<string | null>`(SELECT MAX(h.failed_at) FROM workflow_step_history h WHERE h.workflow_step_id = s.workflow_step_id)`.as('failedAt')
|
|
123
|
+
)
|
|
114
124
|
.where('s.workflowRunId', '=', runId)
|
|
115
125
|
.orderBy('s.createdAt', 'asc')
|
|
116
126
|
.execute()
|
|
@@ -129,6 +139,15 @@ export class KyselyWorkflowRunService implements WorkflowRunService {
|
|
|
129
139
|
retryDelay: row.retryDelay ?? undefined,
|
|
130
140
|
createdAt: new Date(row.createdAt as unknown as string),
|
|
131
141
|
updatedAt: new Date(row.updatedAt as unknown as string),
|
|
142
|
+
runningAt: row.runningAt
|
|
143
|
+
? new Date(row.runningAt as unknown as string)
|
|
144
|
+
: undefined,
|
|
145
|
+
succeededAt: row.succeededAt
|
|
146
|
+
? new Date(row.succeededAt as unknown as string)
|
|
147
|
+
: undefined,
|
|
148
|
+
failedAt: row.failedAt
|
|
149
|
+
? new Date(row.failedAt as unknown as string)
|
|
150
|
+
: undefined,
|
|
132
151
|
}))
|
|
133
152
|
}
|
|
134
153
|
|