@duraflows/kysely 4.1.0 → 5.0.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.
- package/README.md +1 -0
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +8 -3
- package/dist/cjs/kysely-database.d.ts +10 -0
- package/dist/cjs/kysely-definition-store.d.ts +17 -0
- package/dist/cjs/kysely-definition-store.js +57 -0
- package/dist/cjs/kysely-history-store.js +3 -0
- package/dist/cjs/kysely-instance-store.js +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -2
- package/dist/kysely-database.d.ts +10 -0
- package/dist/kysely-definition-store.d.ts +17 -0
- package/dist/kysely-definition-store.js +53 -0
- package/dist/kysely-history-store.js +3 -0
- package/dist/kysely-instance-store.js +3 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -110,6 +110,7 @@ Factory function that creates all required persistence providers from a `Kysely<
|
|
|
110
110
|
- `instanceStore` -- `KyselyWorkflowInstanceStore`
|
|
111
111
|
- `historyStore` -- `KyselyWorkflowHistoryStore`
|
|
112
112
|
- `transactionRunner` -- `KyselyTransactionRunner`
|
|
113
|
+
- `definitionStore` -- `KyselyWorkflowDefinitionStore`
|
|
113
114
|
|
|
114
115
|
Options (all optional; omitting them keeps the previous behaviour):
|
|
115
116
|
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export { KyselyTransactionRunner } from "./kysely-transaction-runner.js";
|
|
|
7
7
|
export type { KyselyTransactionRunnerOptions } from "./kysely-transaction-runner.js";
|
|
8
8
|
export { KyselyWorkflowInstanceStore } from "./kysely-instance-store.js";
|
|
9
9
|
export { KyselyWorkflowHistoryStore } from "./kysely-history-store.js";
|
|
10
|
-
export
|
|
10
|
+
export { KyselyWorkflowDefinitionStore } from "./kysely-definition-store.js";
|
|
11
|
+
export type { WorkflowDatabase, WorkflowInstancesTable, WorkflowHistoryTable, WorkflowDefinitionsTable, } from "./kysely-database.js";
|
|
11
12
|
/**
|
|
12
13
|
* Options accepted by {@link kyselyWorkflowProviders}. Every field is optional
|
|
13
14
|
* and omitting the argument entirely reproduces the pre-existing behaviour.
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KyselyWorkflowHistoryStore = exports.KyselyWorkflowInstanceStore = exports.KyselyTransactionRunner = exports.KyselyTransactionContext = void 0;
|
|
3
|
+
exports.KyselyWorkflowDefinitionStore = exports.KyselyWorkflowHistoryStore = exports.KyselyWorkflowInstanceStore = exports.KyselyTransactionRunner = exports.KyselyTransactionContext = void 0;
|
|
4
4
|
exports.kyselyWorkflowProviders = kyselyWorkflowProviders;
|
|
5
5
|
exports.kyselyWorkflowProvidersFromTransaction = kyselyWorkflowProvidersFromTransaction;
|
|
6
6
|
const kysely_instance_store_js_1 = require("./kysely-instance-store.js");
|
|
7
7
|
const kysely_history_store_js_1 = require("./kysely-history-store.js");
|
|
8
|
+
const kysely_definition_store_js_1 = require("./kysely-definition-store.js");
|
|
8
9
|
const kysely_transaction_runner_js_1 = require("./kysely-transaction-runner.js");
|
|
9
10
|
const kysely_transaction_context_js_1 = require("./kysely-transaction-context.js");
|
|
10
11
|
var kysely_transaction_context_js_2 = require("./kysely-transaction-context.js");
|
|
@@ -15,6 +16,8 @@ var kysely_instance_store_js_2 = require("./kysely-instance-store.js");
|
|
|
15
16
|
Object.defineProperty(exports, "KyselyWorkflowInstanceStore", { enumerable: true, get: function () { return kysely_instance_store_js_2.KyselyWorkflowInstanceStore; } });
|
|
16
17
|
var kysely_history_store_js_2 = require("./kysely-history-store.js");
|
|
17
18
|
Object.defineProperty(exports, "KyselyWorkflowHistoryStore", { enumerable: true, get: function () { return kysely_history_store_js_2.KyselyWorkflowHistoryStore; } });
|
|
19
|
+
var kysely_definition_store_js_2 = require("./kysely-definition-store.js");
|
|
20
|
+
Object.defineProperty(exports, "KyselyWorkflowDefinitionStore", { enumerable: true, get: function () { return kysely_definition_store_js_2.KyselyWorkflowDefinitionStore; } });
|
|
18
21
|
/**
|
|
19
22
|
* Creates long-lived persistence providers from a Kysely instance.
|
|
20
23
|
*
|
|
@@ -28,7 +31,8 @@ function kyselyWorkflowProviders(db, options = {}) {
|
|
|
28
31
|
const transactionRunner = new kysely_transaction_runner_js_1.KyselyTransactionRunner(narrowed, options);
|
|
29
32
|
const instanceStore = new kysely_instance_store_js_1.KyselyWorkflowInstanceStore(narrowed);
|
|
30
33
|
const historyStore = new kysely_history_store_js_1.KyselyWorkflowHistoryStore(narrowed);
|
|
31
|
-
|
|
34
|
+
const definitionStore = new kysely_definition_store_js_1.KyselyWorkflowDefinitionStore(narrowed);
|
|
35
|
+
return { instanceStore, historyStore, transactionRunner, definitionStore };
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* Creates providers pre-bound to an existing Kysely transaction.
|
|
@@ -49,6 +53,7 @@ function kyselyWorkflowProvidersFromTransaction(trx) {
|
|
|
49
53
|
};
|
|
50
54
|
const instanceStore = new kysely_instance_store_js_1.KyselyWorkflowInstanceStore(narrowed);
|
|
51
55
|
const historyStore = new kysely_history_store_js_1.KyselyWorkflowHistoryStore(narrowed);
|
|
52
|
-
|
|
56
|
+
const definitionStore = new kysely_definition_store_js_1.KyselyWorkflowDefinitionStore(narrowed);
|
|
57
|
+
return { instanceStore, historyStore, transactionRunner, definitionStore };
|
|
53
58
|
}
|
|
54
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -17,6 +17,7 @@ export interface WorkflowInstancesTable {
|
|
|
17
17
|
workflow_name: string;
|
|
18
18
|
current_state: string;
|
|
19
19
|
version: number;
|
|
20
|
+
definition_version: number | null;
|
|
20
21
|
expires_at: Date | null;
|
|
21
22
|
last_transition_at: Date;
|
|
22
23
|
context_json: JsonObjectColumn;
|
|
@@ -35,11 +36,20 @@ export interface WorkflowHistoryTable {
|
|
|
35
36
|
rejected_by: string | null;
|
|
36
37
|
command_results_json: JsonArrayColumn;
|
|
37
38
|
trigger_metadata_json: JsonObjectColumn;
|
|
39
|
+
definition_version: number | null;
|
|
38
40
|
created_at: Generated<Date>;
|
|
39
41
|
}
|
|
42
|
+
export interface WorkflowDefinitionsTable {
|
|
43
|
+
workflow_name: string;
|
|
44
|
+
version: number;
|
|
45
|
+
content_hash: string;
|
|
46
|
+
definition_json: JsonObjectColumn;
|
|
47
|
+
registered_at: Generated<Date>;
|
|
48
|
+
}
|
|
40
49
|
export interface WorkflowDatabase {
|
|
41
50
|
workflow_instances: WorkflowInstancesTable;
|
|
42
51
|
workflow_history: WorkflowHistoryTable;
|
|
52
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
43
53
|
}
|
|
44
54
|
export {};
|
|
45
55
|
//# sourceMappingURL=kysely-database.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
import type { WorkflowDefinitionStore, StoredWorkflowDefinition, WorkflowDefinition } from "@duraflows/core";
|
|
3
|
+
import type { WorkflowDatabase } from "./kysely-database.js";
|
|
4
|
+
export declare class KyselyWorkflowDefinitionStore implements WorkflowDefinitionStore {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor(db: Kysely<WorkflowDatabase>);
|
|
7
|
+
private getExecutor;
|
|
8
|
+
ensure(record: {
|
|
9
|
+
workflowName: string;
|
|
10
|
+
version: number;
|
|
11
|
+
contentHash: string;
|
|
12
|
+
definitionJson: WorkflowDefinition;
|
|
13
|
+
}): Promise<StoredWorkflowDefinition>;
|
|
14
|
+
findByNameAndVersion(workflowName: string, version: number): Promise<StoredWorkflowDefinition | null>;
|
|
15
|
+
private mapRow;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=kysely-definition-store.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KyselyWorkflowDefinitionStore = void 0;
|
|
4
|
+
const core_1 = require("@duraflows/core");
|
|
5
|
+
const kysely_transaction_context_js_1 = require("./kysely-transaction-context.js");
|
|
6
|
+
class KyselyWorkflowDefinitionStore {
|
|
7
|
+
db;
|
|
8
|
+
constructor(db) {
|
|
9
|
+
this.db = db;
|
|
10
|
+
}
|
|
11
|
+
getExecutor() {
|
|
12
|
+
return kysely_transaction_context_js_1.KyselyTransactionContext.getTransaction(this.db) ?? this.db;
|
|
13
|
+
}
|
|
14
|
+
async ensure(record) {
|
|
15
|
+
const executor = this.getExecutor();
|
|
16
|
+
await executor
|
|
17
|
+
.insertInto("workflow_definitions")
|
|
18
|
+
.values({
|
|
19
|
+
workflow_name: record.workflowName,
|
|
20
|
+
version: record.version,
|
|
21
|
+
content_hash: record.contentHash,
|
|
22
|
+
definition_json: JSON.stringify(record.definitionJson),
|
|
23
|
+
})
|
|
24
|
+
.onConflict((oc) => oc.columns(["workflow_name", "version"]).doNothing())
|
|
25
|
+
.execute();
|
|
26
|
+
const stored = await this.findByNameAndVersion(record.workflowName, record.version);
|
|
27
|
+
if (!stored) {
|
|
28
|
+
// The row we just ensured must exist; its absence means the statement
|
|
29
|
+
// did not do what the adapter assumes. Fail loudly.
|
|
30
|
+
throw new core_1.WorkflowError(`Failed to ensure workflow definition "${record.workflowName}" version ${record.version}`);
|
|
31
|
+
}
|
|
32
|
+
return stored;
|
|
33
|
+
}
|
|
34
|
+
async findByNameAndVersion(workflowName, version) {
|
|
35
|
+
const executor = this.getExecutor();
|
|
36
|
+
const row = await executor
|
|
37
|
+
.selectFrom("workflow_definitions")
|
|
38
|
+
.selectAll()
|
|
39
|
+
.where("workflow_name", "=", workflowName)
|
|
40
|
+
.where("version", "=", version)
|
|
41
|
+
.executeTakeFirst();
|
|
42
|
+
if (!row)
|
|
43
|
+
return null;
|
|
44
|
+
return this.mapRow(row);
|
|
45
|
+
}
|
|
46
|
+
mapRow(row) {
|
|
47
|
+
return {
|
|
48
|
+
workflowName: row.workflow_name,
|
|
49
|
+
version: row.version,
|
|
50
|
+
contentHash: row.content_hash,
|
|
51
|
+
definitionJson: row.definition_json,
|
|
52
|
+
registeredAt: row.registered_at,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.KyselyWorkflowDefinitionStore = KyselyWorkflowDefinitionStore;
|
|
57
|
+
//# sourceMappingURL=kysely-definition-store.js.map
|
|
@@ -25,6 +25,7 @@ class KyselyWorkflowHistoryStore {
|
|
|
25
25
|
rejected_by: entry.rejectedBy ?? null,
|
|
26
26
|
command_results_json: JSON.stringify(entry.commandResultsJson),
|
|
27
27
|
trigger_metadata_json: JSON.stringify(entry.triggerMetadata ?? {}),
|
|
28
|
+
definition_version: entry.definitionVersion ?? null,
|
|
28
29
|
})
|
|
29
30
|
.returning("uuid")
|
|
30
31
|
// `INSERT ... RETURNING` always yields a row, so an empty result means the
|
|
@@ -56,6 +57,8 @@ class KyselyWorkflowHistoryStore {
|
|
|
56
57
|
rejectedBy: row.rejected_by ?? undefined,
|
|
57
58
|
commandResultsJson: row.command_results_json,
|
|
58
59
|
triggerMetadata: row.trigger_metadata_json,
|
|
60
|
+
definitionVersion: row.definition_version ?? undefined,
|
|
61
|
+
createdAt: row.created_at,
|
|
59
62
|
}));
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -20,6 +20,7 @@ class KyselyWorkflowInstanceStore {
|
|
|
20
20
|
workflow_name: instance.workflowName,
|
|
21
21
|
current_state: instance.currentState,
|
|
22
22
|
version: instance.version,
|
|
23
|
+
definition_version: instance.definitionVersion,
|
|
23
24
|
expires_at: instance.expiresAt,
|
|
24
25
|
last_transition_at: instance.lastTransitionAt,
|
|
25
26
|
context_json: JSON.stringify(instance.context),
|
|
@@ -59,6 +60,7 @@ class KyselyWorkflowInstanceStore {
|
|
|
59
60
|
.set({
|
|
60
61
|
current_state: instance.currentState,
|
|
61
62
|
version: instance.version,
|
|
63
|
+
definition_version: instance.definitionVersion,
|
|
62
64
|
expires_at: instance.expiresAt,
|
|
63
65
|
last_transition_at: instance.lastTransitionAt,
|
|
64
66
|
context_json: JSON.stringify(instance.context),
|
|
@@ -95,6 +97,7 @@ class KyselyWorkflowInstanceStore {
|
|
|
95
97
|
workflowName: row.workflow_name,
|
|
96
98
|
currentState: row.current_state,
|
|
97
99
|
version: row.version,
|
|
100
|
+
definitionVersion: row.definition_version ?? null,
|
|
98
101
|
expiresAt: row.expires_at,
|
|
99
102
|
lastTransitionAt: row.last_transition_at,
|
|
100
103
|
context: row.context_json,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export { KyselyTransactionRunner } from "./kysely-transaction-runner.js";
|
|
|
7
7
|
export type { KyselyTransactionRunnerOptions } from "./kysely-transaction-runner.js";
|
|
8
8
|
export { KyselyWorkflowInstanceStore } from "./kysely-instance-store.js";
|
|
9
9
|
export { KyselyWorkflowHistoryStore } from "./kysely-history-store.js";
|
|
10
|
-
export
|
|
10
|
+
export { KyselyWorkflowDefinitionStore } from "./kysely-definition-store.js";
|
|
11
|
+
export type { WorkflowDatabase, WorkflowInstancesTable, WorkflowHistoryTable, WorkflowDefinitionsTable, } from "./kysely-database.js";
|
|
11
12
|
/**
|
|
12
13
|
* Options accepted by {@link kyselyWorkflowProviders}. Every field is optional
|
|
13
14
|
* and omitting the argument entirely reproduces the pre-existing behaviour.
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { KyselyWorkflowInstanceStore } from "./kysely-instance-store.js";
|
|
2
2
|
import { KyselyWorkflowHistoryStore } from "./kysely-history-store.js";
|
|
3
|
+
import { KyselyWorkflowDefinitionStore } from "./kysely-definition-store.js";
|
|
3
4
|
import { KyselyTransactionRunner } from "./kysely-transaction-runner.js";
|
|
4
5
|
import { KyselyTransactionContext } from "./kysely-transaction-context.js";
|
|
5
6
|
export { KyselyTransactionContext } from "./kysely-transaction-context.js";
|
|
6
7
|
export { KyselyTransactionRunner } from "./kysely-transaction-runner.js";
|
|
7
8
|
export { KyselyWorkflowInstanceStore } from "./kysely-instance-store.js";
|
|
8
9
|
export { KyselyWorkflowHistoryStore } from "./kysely-history-store.js";
|
|
10
|
+
export { KyselyWorkflowDefinitionStore } from "./kysely-definition-store.js";
|
|
9
11
|
/**
|
|
10
12
|
* Creates long-lived persistence providers from a Kysely instance.
|
|
11
13
|
*
|
|
@@ -19,7 +21,8 @@ export function kyselyWorkflowProviders(db, options = {}) {
|
|
|
19
21
|
const transactionRunner = new KyselyTransactionRunner(narrowed, options);
|
|
20
22
|
const instanceStore = new KyselyWorkflowInstanceStore(narrowed);
|
|
21
23
|
const historyStore = new KyselyWorkflowHistoryStore(narrowed);
|
|
22
|
-
|
|
24
|
+
const definitionStore = new KyselyWorkflowDefinitionStore(narrowed);
|
|
25
|
+
return { instanceStore, historyStore, transactionRunner, definitionStore };
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* Creates providers pre-bound to an existing Kysely transaction.
|
|
@@ -40,6 +43,7 @@ export function kyselyWorkflowProvidersFromTransaction(trx) {
|
|
|
40
43
|
};
|
|
41
44
|
const instanceStore = new KyselyWorkflowInstanceStore(narrowed);
|
|
42
45
|
const historyStore = new KyselyWorkflowHistoryStore(narrowed);
|
|
43
|
-
|
|
46
|
+
const definitionStore = new KyselyWorkflowDefinitionStore(narrowed);
|
|
47
|
+
return { instanceStore, historyStore, transactionRunner, definitionStore };
|
|
44
48
|
}
|
|
45
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -17,6 +17,7 @@ export interface WorkflowInstancesTable {
|
|
|
17
17
|
workflow_name: string;
|
|
18
18
|
current_state: string;
|
|
19
19
|
version: number;
|
|
20
|
+
definition_version: number | null;
|
|
20
21
|
expires_at: Date | null;
|
|
21
22
|
last_transition_at: Date;
|
|
22
23
|
context_json: JsonObjectColumn;
|
|
@@ -35,11 +36,20 @@ export interface WorkflowHistoryTable {
|
|
|
35
36
|
rejected_by: string | null;
|
|
36
37
|
command_results_json: JsonArrayColumn;
|
|
37
38
|
trigger_metadata_json: JsonObjectColumn;
|
|
39
|
+
definition_version: number | null;
|
|
38
40
|
created_at: Generated<Date>;
|
|
39
41
|
}
|
|
42
|
+
export interface WorkflowDefinitionsTable {
|
|
43
|
+
workflow_name: string;
|
|
44
|
+
version: number;
|
|
45
|
+
content_hash: string;
|
|
46
|
+
definition_json: JsonObjectColumn;
|
|
47
|
+
registered_at: Generated<Date>;
|
|
48
|
+
}
|
|
40
49
|
export interface WorkflowDatabase {
|
|
41
50
|
workflow_instances: WorkflowInstancesTable;
|
|
42
51
|
workflow_history: WorkflowHistoryTable;
|
|
52
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
43
53
|
}
|
|
44
54
|
export {};
|
|
45
55
|
//# sourceMappingURL=kysely-database.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
import type { WorkflowDefinitionStore, StoredWorkflowDefinition, WorkflowDefinition } from "@duraflows/core";
|
|
3
|
+
import type { WorkflowDatabase } from "./kysely-database.js";
|
|
4
|
+
export declare class KyselyWorkflowDefinitionStore implements WorkflowDefinitionStore {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor(db: Kysely<WorkflowDatabase>);
|
|
7
|
+
private getExecutor;
|
|
8
|
+
ensure(record: {
|
|
9
|
+
workflowName: string;
|
|
10
|
+
version: number;
|
|
11
|
+
contentHash: string;
|
|
12
|
+
definitionJson: WorkflowDefinition;
|
|
13
|
+
}): Promise<StoredWorkflowDefinition>;
|
|
14
|
+
findByNameAndVersion(workflowName: string, version: number): Promise<StoredWorkflowDefinition | null>;
|
|
15
|
+
private mapRow;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=kysely-definition-store.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { WorkflowError } from "@duraflows/core";
|
|
2
|
+
import { KyselyTransactionContext } from "./kysely-transaction-context.js";
|
|
3
|
+
export class KyselyWorkflowDefinitionStore {
|
|
4
|
+
db;
|
|
5
|
+
constructor(db) {
|
|
6
|
+
this.db = db;
|
|
7
|
+
}
|
|
8
|
+
getExecutor() {
|
|
9
|
+
return KyselyTransactionContext.getTransaction(this.db) ?? this.db;
|
|
10
|
+
}
|
|
11
|
+
async ensure(record) {
|
|
12
|
+
const executor = this.getExecutor();
|
|
13
|
+
await executor
|
|
14
|
+
.insertInto("workflow_definitions")
|
|
15
|
+
.values({
|
|
16
|
+
workflow_name: record.workflowName,
|
|
17
|
+
version: record.version,
|
|
18
|
+
content_hash: record.contentHash,
|
|
19
|
+
definition_json: JSON.stringify(record.definitionJson),
|
|
20
|
+
})
|
|
21
|
+
.onConflict((oc) => oc.columns(["workflow_name", "version"]).doNothing())
|
|
22
|
+
.execute();
|
|
23
|
+
const stored = await this.findByNameAndVersion(record.workflowName, record.version);
|
|
24
|
+
if (!stored) {
|
|
25
|
+
// The row we just ensured must exist; its absence means the statement
|
|
26
|
+
// did not do what the adapter assumes. Fail loudly.
|
|
27
|
+
throw new WorkflowError(`Failed to ensure workflow definition "${record.workflowName}" version ${record.version}`);
|
|
28
|
+
}
|
|
29
|
+
return stored;
|
|
30
|
+
}
|
|
31
|
+
async findByNameAndVersion(workflowName, version) {
|
|
32
|
+
const executor = this.getExecutor();
|
|
33
|
+
const row = await executor
|
|
34
|
+
.selectFrom("workflow_definitions")
|
|
35
|
+
.selectAll()
|
|
36
|
+
.where("workflow_name", "=", workflowName)
|
|
37
|
+
.where("version", "=", version)
|
|
38
|
+
.executeTakeFirst();
|
|
39
|
+
if (!row)
|
|
40
|
+
return null;
|
|
41
|
+
return this.mapRow(row);
|
|
42
|
+
}
|
|
43
|
+
mapRow(row) {
|
|
44
|
+
return {
|
|
45
|
+
workflowName: row.workflow_name,
|
|
46
|
+
version: row.version,
|
|
47
|
+
contentHash: row.content_hash,
|
|
48
|
+
definitionJson: row.definition_json,
|
|
49
|
+
registeredAt: row.registered_at,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=kysely-definition-store.js.map
|
|
@@ -22,6 +22,7 @@ export class KyselyWorkflowHistoryStore {
|
|
|
22
22
|
rejected_by: entry.rejectedBy ?? null,
|
|
23
23
|
command_results_json: JSON.stringify(entry.commandResultsJson),
|
|
24
24
|
trigger_metadata_json: JSON.stringify(entry.triggerMetadata ?? {}),
|
|
25
|
+
definition_version: entry.definitionVersion ?? null,
|
|
25
26
|
})
|
|
26
27
|
.returning("uuid")
|
|
27
28
|
// `INSERT ... RETURNING` always yields a row, so an empty result means the
|
|
@@ -53,6 +54,8 @@ export class KyselyWorkflowHistoryStore {
|
|
|
53
54
|
rejectedBy: row.rejected_by ?? undefined,
|
|
54
55
|
commandResultsJson: row.command_results_json,
|
|
55
56
|
triggerMetadata: row.trigger_metadata_json,
|
|
57
|
+
definitionVersion: row.definition_version ?? undefined,
|
|
58
|
+
createdAt: row.created_at,
|
|
56
59
|
}));
|
|
57
60
|
}
|
|
58
61
|
}
|
|
@@ -17,6 +17,7 @@ export class KyselyWorkflowInstanceStore {
|
|
|
17
17
|
workflow_name: instance.workflowName,
|
|
18
18
|
current_state: instance.currentState,
|
|
19
19
|
version: instance.version,
|
|
20
|
+
definition_version: instance.definitionVersion,
|
|
20
21
|
expires_at: instance.expiresAt,
|
|
21
22
|
last_transition_at: instance.lastTransitionAt,
|
|
22
23
|
context_json: JSON.stringify(instance.context),
|
|
@@ -56,6 +57,7 @@ export class KyselyWorkflowInstanceStore {
|
|
|
56
57
|
.set({
|
|
57
58
|
current_state: instance.currentState,
|
|
58
59
|
version: instance.version,
|
|
60
|
+
definition_version: instance.definitionVersion,
|
|
59
61
|
expires_at: instance.expiresAt,
|
|
60
62
|
last_transition_at: instance.lastTransitionAt,
|
|
61
63
|
context_json: JSON.stringify(instance.context),
|
|
@@ -92,6 +94,7 @@ export class KyselyWorkflowInstanceStore {
|
|
|
92
94
|
workflowName: row.workflow_name,
|
|
93
95
|
currentState: row.current_state,
|
|
94
96
|
version: row.version,
|
|
97
|
+
definitionVersion: row.definition_version ?? null,
|
|
95
98
|
expiresAt: row.expires_at,
|
|
96
99
|
lastTransitionAt: row.last_transition_at,
|
|
97
100
|
context: row.context_json,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duraflows/kysely",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "PostgreSQL persistence adapter for duraflows using `kysely`. Integrates with kysely's type-safe query builder and AsyncLocalStorage-based transaction context.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"duraflows",
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@duraflows/core": "^
|
|
55
|
-
"kysely": "^0.29.
|
|
54
|
+
"@duraflows/core": "^5.0.0",
|
|
55
|
+
"kysely": "^0.29.5"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@types/pg": "^8.
|
|
59
|
-
"kysely": "^0.29.
|
|
60
|
-
"pg": "^8.
|
|
61
|
-
"@duraflows/
|
|
62
|
-
"@duraflows/
|
|
58
|
+
"@types/pg": "^8.21.0",
|
|
59
|
+
"kysely": "^0.29.5",
|
|
60
|
+
"pg": "^8.23.0",
|
|
61
|
+
"@duraflows/core": "5.0.0",
|
|
62
|
+
"@duraflows/pg": "5.0.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsc --build"
|