@jskit-ai/database-runtime 0.1.9 → 0.1.10
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/package.descriptor.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default Object.freeze({
|
|
2
2
|
packageVersion: 1,
|
|
3
3
|
packageId: "@jskit-ai/database-runtime",
|
|
4
|
-
version: "0.1.
|
|
4
|
+
version: "0.1.10",
|
|
5
5
|
dependsOn: [
|
|
6
6
|
"@jskit-ai/kernel"
|
|
7
7
|
],
|
|
@@ -55,7 +55,7 @@ export default Object.freeze({
|
|
|
55
55
|
mutations: {
|
|
56
56
|
dependencies: {
|
|
57
57
|
runtime: {
|
|
58
|
-
"@jskit-ai/kernel": "0.1.
|
|
58
|
+
"@jskit-ai/kernel": "0.1.10",
|
|
59
59
|
"dotenv": "^16.4.5",
|
|
60
60
|
"knex": "^3.1.0"
|
|
61
61
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/database-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test"
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"./shared/transactions": "./src/shared/transactions.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jskit-ai/kernel": "0.1.
|
|
28
|
+
"@jskit-ai/kernel": "0.1.10"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/shared/index.js
CHANGED
|
@@ -182,6 +182,20 @@ function toDbJson(value) {
|
|
|
182
182
|
return JSON.stringify(value);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
async function runInTransaction(knex, callback) {
|
|
186
|
+
if (typeof callback !== "function") {
|
|
187
|
+
throw new TypeError("runInTransaction requires callback.");
|
|
188
|
+
}
|
|
189
|
+
if (!knex || typeof knex !== "function") {
|
|
190
|
+
throw new TypeError("runInTransaction requires knex client.");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (typeof knex.transaction !== "function") {
|
|
194
|
+
return callback(knex);
|
|
195
|
+
}
|
|
196
|
+
return knex.transaction(callback);
|
|
197
|
+
}
|
|
198
|
+
|
|
185
199
|
export {
|
|
186
200
|
resolveQueryOptions,
|
|
187
201
|
resolveRepoClient,
|
|
@@ -196,5 +210,6 @@ export {
|
|
|
196
210
|
normalizeIdList,
|
|
197
211
|
normalizeCountRow,
|
|
198
212
|
parseJsonValue,
|
|
199
|
-
toDbJson
|
|
213
|
+
toDbJson,
|
|
214
|
+
runInTransaction
|
|
200
215
|
};
|