@ditojs/server 2.39.0 → 2.41.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.39.0",
3
+ "version": "2.41.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",
@@ -25,10 +25,10 @@
25
25
  "node >= 18"
26
26
  ],
27
27
  "dependencies": {
28
- "@ditojs/admin": "^2.39.0",
29
- "@ditojs/build": "^2.39.0",
30
- "@ditojs/router": "^2.39.0",
31
- "@ditojs/utils": "^2.39.0",
28
+ "@ditojs/admin": "^2.41.0",
29
+ "@ditojs/build": "^2.41.0",
30
+ "@ditojs/router": "^2.41.0",
31
+ "@ditojs/utils": "^2.41.0",
32
32
  "@koa/cors": "^5.0.0",
33
33
  "@koa/multer": "^3.0.2",
34
34
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -46,7 +46,7 @@
46
46
  "koa-compress": "^5.1.1",
47
47
  "koa-conditional-get": "^3.0.0",
48
48
  "koa-etag": "^4.0.0",
49
- "koa-helmet": "^7.1.0",
49
+ "koa-helmet": "^8.0.1",
50
50
  "koa-mount": "^4.0.0",
51
51
  "koa-passport": "^6.0.0",
52
52
  "koa-response-time": "^2.1.0",
@@ -57,7 +57,7 @@
57
57
  "multer": "^1.4.5-lts.1",
58
58
  "multer-s3": "https://github.com/ditojs/multer-s3#dito",
59
59
  "nanoid": "^5.0.9",
60
- "parse-duration": "^1.1.0",
60
+ "parse-duration": "^1.1.1",
61
61
  "passport-local": "^1.0.0",
62
62
  "passthrough-counter": "^1.0.0",
63
63
  "picocolors": "^1.1.1",
@@ -66,7 +66,7 @@
66
66
  "pino-pretty": "^13.0.0",
67
67
  "pluralize": "^8.0.0",
68
68
  "repl": "^0.1.3",
69
- "type-fest": "^4.29.0",
69
+ "type-fest": "^4.30.0",
70
70
  "uuid": "^11.0.3"
71
71
  },
72
72
  "peerDependencies": {
@@ -84,11 +84,11 @@
84
84
  "@types/koa-session": "^6.4.5",
85
85
  "@types/koa-static": "^4.0.4",
86
86
  "@types/koa__cors": "^5.0.0",
87
- "@types/node": "^22.10.0",
87
+ "@types/node": "^22.10.1",
88
88
  "knex": "^3.1.0",
89
89
  "objection": "^3.1.5",
90
90
  "typescript": "^5.7.2"
91
91
  },
92
92
  "types": "types",
93
- "gitHead": "8e08282d852341622dc3555f810e18aa9d2ac7ab"
93
+ "gitHead": "c8da0f4ad5dae6280480cb0d02a882b43120b17e"
94
94
  }
@@ -164,6 +164,23 @@ export class Application extends Koa {
164
164
  this.router[method](path, route)
165
165
  }
166
166
 
167
+ fixModuleClassNames(modules) {
168
+ // Naming fix for a weird vite 6 bug where the model classes are sometimes
169
+ // prefixed with `_`, but only when imported in `vite.config.js`.
170
+ if (isPlainObject(modules)) {
171
+ for (const [key, module] of Object.entries(modules)) {
172
+ if (module?.name?.match(/^_(.*)$/)?.[1] === key) {
173
+ Object.defineProperty(module, 'name', {
174
+ value: key,
175
+ writable: false,
176
+ enumerable: false,
177
+ configurable: true
178
+ })
179
+ }
180
+ }
181
+ }
182
+ }
183
+
167
184
  getStorage(name) {
168
185
  return this.storages[name] || null
169
186
  }
@@ -190,8 +207,9 @@ export class Application extends Koa {
190
207
  }
191
208
 
192
209
  addStorages(storages) {
193
- for (const [name, config] of Object.entries(storages)) {
194
- this.addStorage(config, name)
210
+ this.fixModuleClassNames(storages)
211
+ for (const [key, config] of Object.entries(storages)) {
212
+ this.addStorage(config, key)
195
213
  }
196
214
  }
197
215
 
@@ -230,8 +248,9 @@ export class Application extends Koa {
230
248
  }
231
249
 
232
250
  addServices(services) {
233
- for (const [name, service] of Object.entries(services)) {
234
- this.addService(service, name)
251
+ this.fixModuleClassNames(services)
252
+ for (const [key, service] of Object.entries(services)) {
253
+ this.addService(service, key)
235
254
  }
236
255
  }
237
256
 
@@ -275,6 +294,7 @@ export class Application extends Koa {
275
294
  }
276
295
 
277
296
  addModels(models) {
297
+ this.fixModuleClassNames(models)
278
298
  models = Object.values(models)
279
299
  // First, add all models to the application, so that they can be referenced
280
300
  // by other models, e.g. in `jsonSchema` and `relationMappings`:
@@ -365,6 +385,7 @@ export class Application extends Koa {
365
385
  }
366
386
 
367
387
  addControllers(controllers, namespace) {
388
+ this.fixModuleClassNames(controllers)
368
389
  for (const [key, value] of Object.entries(controllers)) {
369
390
  if (isModule(value) || isPlainObject(value)) {
370
391
  this.addControllers(value, namespace ? `${namespace}/${key}` : key)