@dbos-inc/knex-datasource 3.0.8-preview → 3.0.8-preview.g493d2d1c2b
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/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -76
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +71 -90
- package/package.json +5 -6
- package/tests/config.test.ts +1 -1
- package/tests/datasource.test.ts +41 -164
- package/tests/test-helpers.ts +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { type Knex } from 'knex';
|
|
|
3
3
|
export type TransactionConfig = Pick<Knex.TransactionConfig, 'isolationLevel' | 'readOnly'>;
|
|
4
4
|
export declare class KnexDataSource implements DBOSDataSource<TransactionConfig> {
|
|
5
5
|
#private;
|
|
6
|
-
readonly name: string;
|
|
7
6
|
static get client(): Knex.Transaction;
|
|
8
7
|
static initializeInternalSchema(config: Knex.Config): Promise<void>;
|
|
8
|
+
readonly name: string;
|
|
9
9
|
constructor(name: string, config: Knex.Config);
|
|
10
10
|
runTransaction<T>(callback: () => Promise<T>, funcName: string, config?: TransactionConfig): Promise<T>;
|
|
11
|
-
registerTransaction<This, Args extends unknown[], Return>(func: (this: This, ...args: Args) => Promise<Return>,
|
|
12
|
-
transaction(config?: TransactionConfig): <This, Args extends unknown[], Return>(_target: object, propertyKey:
|
|
11
|
+
registerTransaction<This, Args extends unknown[], Return>(func: (this: This, ...args: Args) => Promise<Return>, name: string, config?: TransactionConfig): (this: This, ...args: Args) => Promise<Return>;
|
|
12
|
+
transaction(config?: TransactionConfig): <This, Args extends unknown[], Return>(_target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<(this: This, ...args: Args) => Promise<Return>>) => TypedPropertyDescriptor<(this: This, ...args: Args) => Promise<Return>>;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,cAAc,EAEf,MAAM,+BAA+B,CAAC;AAEvC,OAAa,EAAE,KAAK,IAAI,EAAE,MAAM,MAAM,CAAC;AAavC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,GAAG,UAAU,CAAC,CAAC;AAuI5F,qBAAa,cAAe,YAAW,cAAc,CAAC,iBAAiB,CAAC;;IACtE,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,CASpC;WAEY,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM;IAkBzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAGV,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM;IAMvC,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB;IAIhG,mBAAmB,CAAC,IAAI,EAAE,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EACtD,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,EACpD,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,iBAAiB,GACzB,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC;IAIjD,WAAW,CAAC,MAAM,CAAC,EAAE,iBAAiB,mDAIzB,MAAM,eACF,MAAM,cACP,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,QAAQ,MAAM,CAAC,CAAC,oCAAxC,IAAI,WAAW,IAAI,KAAK,QAAQ,MAAM,CAAC;CAWvF"}
|
package/dist/index.js
CHANGED
|
@@ -11,68 +11,36 @@ const async_hooks_1 = require("async_hooks");
|
|
|
11
11
|
const knex_1 = __importDefault(require("knex"));
|
|
12
12
|
const superjson_1 = require("superjson");
|
|
13
13
|
const asyncLocalCtx = new async_hooks_1.AsyncLocalStorage();
|
|
14
|
-
class
|
|
14
|
+
class KnexDSTH {
|
|
15
15
|
name;
|
|
16
|
-
config;
|
|
17
16
|
dsType = 'KnexDataSource';
|
|
18
|
-
#
|
|
17
|
+
#knexDB;
|
|
19
18
|
constructor(name, config) {
|
|
20
19
|
this.name = name;
|
|
21
|
-
this
|
|
20
|
+
this.#knexDB = (0, knex_1.default)(config);
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.#knexDBField = (0, knex_1.default)(this.config);
|
|
26
|
-
await knexDB?.destroy();
|
|
22
|
+
initialize() {
|
|
23
|
+
return Promise.resolve();
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.#knexDBField = undefined;
|
|
31
|
-
await knexDB?.destroy();
|
|
25
|
+
destroy() {
|
|
26
|
+
return this.#knexDB.destroy();
|
|
32
27
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
throw new Error(`DataSource ${this.name} is not initialized.`);
|
|
36
|
-
}
|
|
37
|
-
return this.#knexDBField;
|
|
38
|
-
}
|
|
39
|
-
async #checkExecution(workflowID, stepID) {
|
|
40
|
-
const result = await this.#knexDB('transaction_completion')
|
|
28
|
+
static async #checkExecution(client, workflowID, functionNum) {
|
|
29
|
+
const result = await client('transaction_completion')
|
|
41
30
|
.withSchema('dbos')
|
|
42
|
-
.select('output'
|
|
31
|
+
.select('output')
|
|
43
32
|
.where({
|
|
44
33
|
workflow_id: workflowID,
|
|
45
|
-
function_num:
|
|
34
|
+
function_num: functionNum,
|
|
46
35
|
})
|
|
47
36
|
.first();
|
|
48
|
-
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
const { output, error } = result;
|
|
52
|
-
return error !== null ? { error } : { output };
|
|
37
|
+
return result === undefined ? undefined : { output: result.output };
|
|
53
38
|
}
|
|
54
|
-
async #
|
|
55
|
-
try {
|
|
56
|
-
await this.#knexDB('transaction_completion').withSchema('dbos').insert({
|
|
57
|
-
workflow_id: workflowID,
|
|
58
|
-
function_num: stepID,
|
|
59
|
-
error,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
if ((0, datasource_1.isPGKeyConflictError)(error)) {
|
|
64
|
-
throw new dbos_sdk_1.DBOSWorkflowConflictError(workflowID);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
static async #recordOutput(client, workflowID, stepID, output) {
|
|
39
|
+
static async #recordOutput(client, workflowID, functionNum, output) {
|
|
72
40
|
try {
|
|
73
41
|
await client('transaction_completion').withSchema('dbos').insert({
|
|
74
42
|
workflow_id: workflowID,
|
|
75
|
-
function_num:
|
|
43
|
+
function_num: functionNum,
|
|
76
44
|
output,
|
|
77
45
|
});
|
|
78
46
|
}
|
|
@@ -87,52 +55,57 @@ class KnexTransactionHandler {
|
|
|
87
55
|
}
|
|
88
56
|
async invokeTransactionFunction(config, target, func, ...args) {
|
|
89
57
|
const workflowID = dbos_sdk_1.DBOS.workflowID;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
58
|
+
if (workflowID === undefined) {
|
|
59
|
+
throw new Error('Workflow ID is not set.');
|
|
60
|
+
}
|
|
61
|
+
const functionNum = dbos_sdk_1.DBOS.stepID;
|
|
62
|
+
if (functionNum === undefined) {
|
|
63
|
+
throw new Error('Function Number is not set.');
|
|
93
64
|
}
|
|
94
65
|
const readOnly = config?.readOnly ?? false;
|
|
95
|
-
const saveResults = !readOnly && workflowID !== undefined;
|
|
96
|
-
// Retry loop if appropriate
|
|
97
66
|
let retryWaitMS = 1;
|
|
98
67
|
const backoffFactor = 1.5;
|
|
99
|
-
const maxRetryWaitMS = 2000;
|
|
68
|
+
const maxRetryWaitMS = 2000;
|
|
100
69
|
while (true) {
|
|
101
|
-
// Check to see if this tx has already been executed
|
|
102
|
-
const previousResult = saveResults ? await this.#checkExecution(workflowID, stepID) : undefined;
|
|
103
|
-
if (previousResult) {
|
|
104
|
-
dbos_sdk_1.DBOS.span?.setAttribute('cached', true);
|
|
105
|
-
if ('error' in previousResult) {
|
|
106
|
-
throw superjson_1.SuperJSON.parse(previousResult.error);
|
|
107
|
-
}
|
|
108
|
-
return (previousResult.output ? superjson_1.SuperJSON.parse(previousResult.output) : null);
|
|
109
|
-
}
|
|
110
70
|
try {
|
|
111
71
|
const result = await this.#knexDB.transaction(async (client) => {
|
|
72
|
+
// Check to see if this tx has already been executed
|
|
73
|
+
const previousResult = readOnly || !workflowID ? undefined : await KnexDSTH.#checkExecution(client, workflowID, functionNum);
|
|
74
|
+
if (previousResult) {
|
|
75
|
+
return (previousResult.output ? superjson_1.SuperJSON.parse(previousResult.output) : null);
|
|
76
|
+
}
|
|
112
77
|
// execute user's transaction function
|
|
113
78
|
const result = await asyncLocalCtx.run({ client }, async () => {
|
|
114
79
|
return (await func.call(target, ...args));
|
|
115
80
|
});
|
|
116
81
|
// save the output of read/write transactions
|
|
117
|
-
if (
|
|
118
|
-
await
|
|
82
|
+
if (!readOnly && workflowID) {
|
|
83
|
+
await KnexDSTH.#recordOutput(client, workflowID, functionNum, superjson_1.SuperJSON.stringify(result));
|
|
84
|
+
// Note, existing code wraps #recordOutput call in a try/catch block that
|
|
85
|
+
// converts DB error with code 25P02 to DBOSFailedSqlTransactionError.
|
|
86
|
+
// However, existing code doesn't make any logic decisions based on that error type.
|
|
87
|
+
// DBOSFailedSqlTransactionError does stored WF ID and function name, so I assume that info is logged out somewhere
|
|
119
88
|
}
|
|
120
89
|
return result;
|
|
121
90
|
}, { isolationLevel: config?.isolationLevel, readOnly: config?.readOnly });
|
|
91
|
+
// TODO: span.setStatus({ code: SpanStatusCode.OK });
|
|
92
|
+
// TODO: this.tracer.endSpan(span);
|
|
122
93
|
return result;
|
|
123
94
|
}
|
|
124
95
|
catch (error) {
|
|
125
96
|
if ((0, datasource_1.isPGRetriableTransactionError)(error)) {
|
|
126
|
-
|
|
97
|
+
// TODO: span.addEvent('TXN SERIALIZATION FAILURE', { retryWaitMillis: retryWaitMillis }, performance.now());
|
|
127
98
|
await new Promise((resolve) => setTimeout(resolve, retryWaitMS));
|
|
128
99
|
retryWaitMS = Math.min(retryWaitMS * backoffFactor, maxRetryWaitMS);
|
|
129
100
|
continue;
|
|
130
101
|
}
|
|
131
102
|
else {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
103
|
+
// TODO: span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
|
|
104
|
+
// TODO: this.tracer.endSpan(span);
|
|
105
|
+
// TODO: currently, we are *not* recording errors in the txOutput table.
|
|
106
|
+
// For normal execution, this is fine because we also store tx step results (output and error) in the sysdb operation output table.
|
|
107
|
+
// However, I'm concerned that we have a dueling execution hole where one tx fails while another succeeds.
|
|
108
|
+
// This implies that we can end up in a situation where the step output records an error but the txOutput table records success.
|
|
136
109
|
throw error;
|
|
137
110
|
}
|
|
138
111
|
}
|
|
@@ -140,38 +113,46 @@ class KnexTransactionHandler {
|
|
|
140
113
|
}
|
|
141
114
|
}
|
|
142
115
|
class KnexDataSource {
|
|
143
|
-
name;
|
|
144
116
|
static get client() {
|
|
145
117
|
if (!dbos_sdk_1.DBOS.isInTransaction()) {
|
|
146
118
|
throw new Error('invalid use of KnexDataSource.client outside of a DBOS transaction.');
|
|
147
119
|
}
|
|
148
120
|
const ctx = asyncLocalCtx.getStore();
|
|
149
121
|
if (!ctx) {
|
|
150
|
-
throw new Error('
|
|
122
|
+
throw new Error('No async local context found.');
|
|
151
123
|
}
|
|
152
124
|
return ctx.client;
|
|
153
125
|
}
|
|
154
126
|
static async initializeInternalSchema(config) {
|
|
155
127
|
const knexDB = (0, knex_1.default)(config);
|
|
156
128
|
try {
|
|
157
|
-
await knexDB.
|
|
158
|
-
await knexDB.
|
|
129
|
+
await knexDB.schema.createSchemaIfNotExists('dbos');
|
|
130
|
+
const exists = await knexDB.schema.withSchema('dbos').hasTable('transaction_completion');
|
|
131
|
+
if (!exists) {
|
|
132
|
+
await knexDB.schema.withSchema('dbos').createTable('transaction_completion', (table) => {
|
|
133
|
+
table.string('workflow_id').notNullable();
|
|
134
|
+
table.integer('function_num').notNullable();
|
|
135
|
+
table.string('output').nullable();
|
|
136
|
+
table.primary(['workflow_id', 'function_num']);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
159
139
|
}
|
|
160
140
|
finally {
|
|
161
141
|
await knexDB.destroy();
|
|
162
142
|
}
|
|
163
143
|
}
|
|
144
|
+
name;
|
|
164
145
|
#provider;
|
|
165
146
|
constructor(name, config) {
|
|
166
147
|
this.name = name;
|
|
167
|
-
this.#provider = new
|
|
148
|
+
this.#provider = new KnexDSTH(name, config);
|
|
168
149
|
(0, datasource_1.registerDataSource)(this.#provider);
|
|
169
150
|
}
|
|
170
151
|
async runTransaction(callback, funcName, config) {
|
|
171
152
|
return await (0, datasource_1.runTransaction)(callback, funcName, { dsName: this.name, config });
|
|
172
153
|
}
|
|
173
|
-
registerTransaction(func,
|
|
174
|
-
return (0, datasource_1.registerTransaction)(this.name, func, { name
|
|
154
|
+
registerTransaction(func, name, config) {
|
|
155
|
+
return (0, datasource_1.registerTransaction)(this.name, func, { name }, config);
|
|
175
156
|
}
|
|
176
157
|
transaction(config) {
|
|
177
158
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
@@ -180,7 +161,7 @@ class KnexDataSource {
|
|
|
180
161
|
if (!descriptor.value) {
|
|
181
162
|
throw Error('Use of decorator when original method is undefined');
|
|
182
163
|
}
|
|
183
|
-
descriptor.value = ds.registerTransaction(descriptor.value,
|
|
164
|
+
descriptor.value = ds.registerTransaction(descriptor.value, propertyKey.toString(), config);
|
|
184
165
|
return descriptor;
|
|
185
166
|
};
|
|
186
167
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,qCAAqC;;;;;;AAErC,iDAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,qCAAqC;;;;;;AAErC,iDAAqE;AACrE,8DAQuC;AACvC,6CAAgD;AAChD,gDAAuC;AACvC,yCAAsC;AActC,MAAM,aAAa,GAAG,IAAI,+BAAiB,EAAyB,CAAC;AAErE,MAAM,QAAQ;IACH,IAAI,CAAS;IACb,MAAM,GAAG,gBAAgB,CAAC;IAC1B,OAAO,CAAO;IAEvB,YAAY,IAAY,EAAE,MAAmB;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAA,cAAI,EAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,eAAe,CAC1B,MAAwB,EACxB,UAAkB,EAClB,WAAmB;QAEnB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAyB,wBAAwB,CAAC;aAC1E,UAAU,CAAC,MAAM,CAAC;aAClB,MAAM,CAAC,QAAQ,CAAC;aAChB,KAAK,CAAC;YACL,WAAW,EAAE,UAAU;YACvB,YAAY,EAAE,WAAW;SAC1B,CAAC;aACD,KAAK,EAAE,CAAC;QACX,OAAO,MAAM,KAA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