@ditojs/server 2.17.0 → 2.19.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/server",
3
- "version": "2.17.0",
3
+ "version": "2.19.0",
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,15 +22,15 @@
22
22
  "node >= 18"
23
23
  ],
24
24
  "dependencies": {
25
- "@ditojs/admin": "^2.17.0",
26
- "@ditojs/build": "^2.17.0",
27
- "@ditojs/router": "^2.17.0",
28
- "@ditojs/utils": "^2.17.0",
29
- "@koa/cors": "^4.0.0",
25
+ "@ditojs/admin": "^2.19.0",
26
+ "@ditojs/build": "^2.19.0",
27
+ "@ditojs/router": "^2.19.0",
28
+ "@ditojs/utils": "^2.19.0",
29
+ "@koa/cors": "^5.0.0",
30
30
  "@koa/multer": "^3.0.2",
31
31
  "@originjs/vite-plugin-commonjs": "^1.0.3",
32
- "@vitejs/plugin-vue": "^4.5.0",
33
- "@vue/compiler-sfc": "^3.3.9",
32
+ "@vitejs/plugin-vue": "^5.0.2",
33
+ "@vue/compiler-sfc": "^3.4.3",
34
34
  "ajv": "^8.12.0",
35
35
  "ajv-formats": "^2.1.1",
36
36
  "bcryptjs": "^2.4.3",
@@ -38,7 +38,7 @@
38
38
  "data-uri-to-buffer": "^6.0.1",
39
39
  "eventemitter2": "^6.4.9",
40
40
  "file-type": "^18.7.0",
41
- "koa": "^2.14.2",
41
+ "koa": "^2.15.0",
42
42
  "koa-bodyparser": "^4.4.1",
43
43
  "koa-compose": "^4.1.0",
44
44
  "koa-compress": "^5.1.1",
@@ -54,20 +54,20 @@
54
54
  "mime-types": "^2.1.35",
55
55
  "multer": "^1.4.5-lts.1",
56
56
  "multer-s3": "https://github.com/ditojs/multer-s3#dito",
57
- "nanoid": "^5.0.3",
57
+ "nanoid": "^5.0.4",
58
58
  "parse-duration": "^1.1.0",
59
59
  "passport-local": "^1.0.0",
60
60
  "passthrough-counter": "^1.0.0",
61
61
  "picocolors": "^1.0.0",
62
62
  "picomatch": "^3.0.1",
63
- "pino": "^8.16.2",
64
- "pino-pretty": "^10.2.3",
63
+ "pino": "^8.17.2",
64
+ "pino-pretty": "^10.3.1",
65
65
  "pluralize": "^8.0.0",
66
66
  "repl": "^0.1.3",
67
- "type-fest": "^4.8.2",
67
+ "type-fest": "^4.9.0",
68
68
  "uuid": "^9.0.1",
69
- "vite": "^5.0.4",
70
- "vue": "^3.3.9"
69
+ "vite": "^5.0.10",
70
+ "vue": "^3.4.3"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@aws-sdk/client-s3": "^3.0.0",
@@ -81,14 +81,14 @@
81
81
  "@types/koa-response-time": "^2.1.5",
82
82
  "@types/koa-session": "^6.4.5",
83
83
  "@types/koa-static": "^4.0.4",
84
- "@types/koa__cors": "^4.0.3",
85
- "@types/node": "^20.10.1",
86
- "knex": "^3.0.1",
84
+ "@types/koa__cors": "^5.0.0",
85
+ "@types/node": "^20.10.6",
86
+ "knex": "^3.1.0",
87
87
  "objection": "^3.1.3",
88
- "typescript": "^5.3.2"
88
+ "typescript": "^5.3.3"
89
89
  },
90
90
  "types": "types",
91
- "gitHead": "e0609d98891263c136320e65480c42ad7a289b4b",
91
+ "gitHead": "e2509f3306ebc3d08be2e00d18f5594bfba3f658",
92
92
  "scripts": {
93
93
  "types": "tsc --noEmit --esModuleInterop ./types/index.d.ts"
94
94
  },
@@ -882,6 +882,7 @@ export class Application extends Koa {
882
882
  storage,
883
883
  addedFiles,
884
884
  removedFiles,
885
+ changedFiles,
885
886
  trx = null
886
887
  ) {
887
888
  let importedFiles = []
@@ -889,7 +890,7 @@ export class Application extends Koa {
889
890
  if (AssetModel) {
890
891
  importedFiles = await this.addForeignAssets(
891
892
  storage,
892
- addedFiles,
893
+ [...addedFiles, ...changedFiles],
893
894
  trx
894
895
  )
895
896
  if (
@@ -11,7 +11,7 @@ export function logRequests({ ignoreUrlPattern } = {}) {
11
11
  return next()
12
12
  }
13
13
  // request
14
- const start = Date.now()
14
+ const start = performance.now()
15
15
 
16
16
  logRequest(ctx)
17
17
 
@@ -108,8 +108,10 @@ function logResponse({ ctx, start, length, err }) {
108
108
  }
109
109
 
110
110
  function formatTime(start) {
111
- const delta = Date.now() - start
112
- return delta < 10000 ? delta + 'ms' : Math.round(delta / 1000) + 's'
111
+ const delta = performance.now() - start
112
+ return delta < 10000
113
+ ? +delta.toFixed(2) + 'ms'
114
+ : +(delta / 1000).toFixed(2) + 's'
113
115
  }
114
116
 
115
117
  const colorCodes = {
@@ -7,6 +7,7 @@ import {
7
7
  isPromise,
8
8
  asArray,
9
9
  flatten,
10
+ equals,
10
11
  parseDataPath,
11
12
  normalizeDataPath,
12
13
  getValueAtDataPath,
@@ -1066,8 +1067,12 @@ export class Model extends objection.Model {
1066
1067
  const afterFiles = afterFilesPerDataPath[dataPath] || []
1067
1068
  const beforeByKey = mapFilesByKey(beforeFiles)
1068
1069
  const afterByKey = mapFilesByKey(afterFiles)
1069
- const removedFiles = beforeFiles.filter(file => !afterByKey[file.key])
1070
1070
  const addedFiles = afterFiles.filter(file => !beforeByKey[file.key])
1071
+ const removedFiles = beforeFiles.filter(file => !afterByKey[file.key])
1072
+ const changedFiles = afterFiles.filter(file => {
1073
+ const beforeFile = beforeByKey[file.key]
1074
+ return beforeFile && !equals(file, beforeFile)
1075
+ })
1071
1076
  // Also handle modified files, which are files where the data property
1072
1077
  // is changed before update / patch, meaning the file is changed.
1073
1078
  // NOTE: This will change the content for all the references to it,
@@ -1080,6 +1085,7 @@ export class Model extends objection.Model {
1080
1085
  storage,
1081
1086
  addedFiles,
1082
1087
  removedFiles,
1088
+ changedFiles,
1083
1089
  transaction
1084
1090
  ))
1085
1091
  )