@ditojs/server 2.0.3 → 2.0.4
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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dito.js Server – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
|
|
6
6
|
"repository": "https://github.com/ditojs/dito/tree/master/packages/server",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node >= 18"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ditojs/admin": "^2.0.
|
|
25
|
+
"@ditojs/admin": "^2.0.4",
|
|
26
26
|
"@ditojs/build": "^2.0.0",
|
|
27
27
|
"@ditojs/router": "^2.0.1",
|
|
28
28
|
"@ditojs/utils": "^2.0.1",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"typescript": "^5.0.3"
|
|
91
91
|
},
|
|
92
92
|
"types": "types",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "e2236a6758c7716a20f8e9fc7c7787521782d6d4",
|
|
94
94
|
"scripts": {
|
|
95
95
|
"types": "tsc --noEmit ./src/index.d.ts"
|
|
96
96
|
},
|
package/src/app/Application.js
CHANGED
|
@@ -566,6 +566,7 @@ export class Application extends Koa {
|
|
|
566
566
|
if (app.session) {
|
|
567
567
|
const {
|
|
568
568
|
modelClass,
|
|
569
|
+
autoCommit = true,
|
|
569
570
|
...options
|
|
570
571
|
} = getOptions(app.session)
|
|
571
572
|
if (modelClass) {
|
|
@@ -575,7 +576,25 @@ export class Application extends Koa {
|
|
|
575
576
|
// eslint-disable-next-line new-cap
|
|
576
577
|
options.ContextStore = SessionStore(modelClass)
|
|
577
578
|
}
|
|
579
|
+
options.autoCommit = false
|
|
578
580
|
this.use(session(options, this))
|
|
581
|
+
this.use(async (ctx, next) => {
|
|
582
|
+
const { transacted } = ctx.route
|
|
583
|
+
try {
|
|
584
|
+
await next()
|
|
585
|
+
if (autoCommit && transacted) {
|
|
586
|
+
// When transacted, only commit when there are no errors. Otherwise,
|
|
587
|
+
// the commit will fail and the original error will be lost.
|
|
588
|
+
await ctx.session.commit()
|
|
589
|
+
}
|
|
590
|
+
} finally {
|
|
591
|
+
// When not transacted, keep the original behavior of always
|
|
592
|
+
// committing.
|
|
593
|
+
if (autoCommit && !transacted) {
|
|
594
|
+
await ctx.session.commit()
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
})
|
|
579
598
|
}
|
|
580
599
|
// 6. passport
|
|
581
600
|
if (app.passport) {
|
|
@@ -273,13 +273,14 @@ const coreDependencies = [
|
|
|
273
273
|
|
|
274
274
|
'vue',
|
|
275
275
|
'@vue/*',
|
|
276
|
+
'@vueuse/*',
|
|
276
277
|
'@lk77/vue3-color',
|
|
277
278
|
'@kyvg/vue3-notification',
|
|
278
|
-
'vue-draggable-plus',
|
|
279
279
|
'vue-multiselect',
|
|
280
280
|
'vue-router',
|
|
281
281
|
'vue-upload-component',
|
|
282
282
|
'tinycolor2',
|
|
283
|
+
'sortablejs',
|
|
283
284
|
'@tiptap/*',
|
|
284
285
|
'prosemirror-*',
|
|
285
286
|
'linkifyjs',
|