@ditojs/server 2.13.0 → 2.14.1

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.13.0",
3
+ "version": "2.14.1",
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,20 +22,20 @@
22
22
  "node >= 18"
23
23
  ],
24
24
  "dependencies": {
25
- "@ditojs/admin": "^2.13.0",
26
- "@ditojs/build": "^2.13.0",
27
- "@ditojs/router": "^2.13.0",
28
- "@ditojs/utils": "^2.13.0",
25
+ "@ditojs/admin": "^2.14.1",
26
+ "@ditojs/build": "^2.14.1",
27
+ "@ditojs/router": "^2.14.1",
28
+ "@ditojs/utils": "^2.14.1",
29
29
  "@koa/cors": "^4.0.0",
30
30
  "@koa/multer": "^3.0.2",
31
31
  "@originjs/vite-plugin-commonjs": "^1.0.3",
32
- "@vitejs/plugin-vue": "^4.3.4",
33
- "@vue/compiler-sfc": "^3.3.4",
32
+ "@vitejs/plugin-vue": "^4.4.0",
33
+ "@vue/compiler-sfc": "^3.3.6",
34
34
  "ajv": "^8.12.0",
35
35
  "ajv-formats": "^2.1.1",
36
36
  "bcryptjs": "^2.4.3",
37
37
  "bytes": "^3.1.2",
38
- "data-uri-to-buffer": "^5.0.1",
38
+ "data-uri-to-buffer": "^6.0.1",
39
39
  "eventemitter2": "^6.4.9",
40
40
  "file-type": "^18.5.0",
41
41
  "koa": "^2.14.2",
@@ -54,41 +54,41 @@
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.1",
57
+ "nanoid": "^5.0.2",
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": "^2.3.1",
63
- "pino": "^8.15.1",
64
- "pino-pretty": "^10.2.0",
63
+ "pino": "^8.16.0",
64
+ "pino-pretty": "^10.2.3",
65
65
  "pluralize": "^8.0.0",
66
66
  "repl": "^0.1.3",
67
- "type-fest": "^4.3.2",
67
+ "type-fest": "^4.5.0",
68
68
  "uuid": "^9.0.1",
69
- "vite": "^4.4.9",
70
- "vue": "^3.3.4"
69
+ "vite": "^4.5.0",
70
+ "vue": "^3.3.6"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@aws-sdk/client-s3": "^3.0.0",
74
- "knex": ">=2.0.5",
74
+ "knex": ">=3.0.1",
75
75
  "objection": "^3.0.1"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@aws-sdk/client-s3": "^3.304.0",
79
- "@types/koa-bodyparser": "^4.3.10",
80
- "@types/koa-compress": "^4.0.4",
81
- "@types/koa-response-time": "^2.1.3",
82
- "@types/koa-session": "^6.4.2",
83
- "@types/koa-static": "^4.0.2",
84
- "@types/koa__cors": "^4.0.1",
85
- "@types/node": "^20.7.1",
86
- "knex": "^2.5.1",
87
- "objection": "^3.1.1",
79
+ "@types/koa-bodyparser": "^4.3.11",
80
+ "@types/koa-compress": "^4.0.5",
81
+ "@types/koa-response-time": "^2.1.4",
82
+ "@types/koa-session": "^6.4.4",
83
+ "@types/koa-static": "^4.0.3",
84
+ "@types/koa__cors": "^4.0.2",
85
+ "@types/node": "^20.8.7",
86
+ "knex": "^3.0.1",
87
+ "objection": "^3.1.2",
88
88
  "typescript": "^5.2.2"
89
89
  },
90
90
  "types": "types",
91
- "gitHead": "ab9a98856440d8f0f24ae7b2e2e7f840ac956cce",
91
+ "gitHead": "f0bbe90cf7323bdc9a8020b0b2de0f77cd4403c4",
92
92
  "scripts": {
93
93
  "types": "tsc --noEmit --esModuleInterop ./types/index.d.ts"
94
94
  },
@@ -1,7 +1,7 @@
1
1
  import path from 'path'
2
2
  import mime from 'mime-types'
3
- import dataUriToBuffer from 'data-uri-to-buffer'
4
3
  import { v4 as uuidv4 } from 'uuid'
4
+ import { dataUriToBuffer } from 'data-uri-to-buffer'
5
5
  import { isString } from '@ditojs/utils'
6
6
 
7
7
  const SYMBOL_STORAGE = Symbol('storage')
@@ -29,8 +29,9 @@ export class AssetFile {
29
29
  set data(data) {
30
30
  if (isString(data)) {
31
31
  if (data.startsWith('data:')) {
32
- data = dataUriToBuffer(data)
33
- this.type ||= data.type || mime.lookup(this.name)
32
+ const { type, buffer } = dataUriToBuffer(data)
33
+ data = Buffer.from(buffer)
34
+ this.type ||= type || mime.lookup(this.name)
34
35
  } else {
35
36
  data = Buffer.from(data)
36
37
  this.type ||= mime.lookup(this.name) || 'text/plain'
@@ -39,7 +40,7 @@ export class AssetFile {
39
40
  // Buffer & co.
40
41
  data = Buffer.isBuffer(data) ? data : Buffer.from(data)
41
42
  this.type ||= (
42
- data.type ||
43
+ data.type || // See Storage._readFile()
43
44
  mime.lookup(this.name) ||
44
45
  'application/octet-stream'
45
46
  )