@ditojs/server 2.10.5 → 2.10.7

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.10.5",
3
+ "version": "2.10.7",
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,8 +22,8 @@
22
22
  "node >= 18"
23
23
  ],
24
24
  "dependencies": {
25
- "@ditojs/admin": "^2.10.5",
26
- "@ditojs/build": "^2.10.0",
25
+ "@ditojs/admin": "^2.10.7",
26
+ "@ditojs/build": "^2.10.7",
27
27
  "@ditojs/router": "^2.10.5",
28
28
  "@ditojs/utils": "^2.10.5",
29
29
  "@koa/cors": "^4.0.0",
@@ -61,12 +61,12 @@
61
61
  "picocolors": "^1.0.0",
62
62
  "picomatch": "^2.3.1",
63
63
  "pino": "^8.14.1",
64
- "pino-pretty": "^10.0.0",
64
+ "pino-pretty": "^10.0.1",
65
65
  "pluralize": "^8.0.0",
66
66
  "repl": "^0.1.3",
67
67
  "type-fest": "^3.12.0",
68
68
  "uuid": "^9.0.0",
69
- "vite": "^4.3.9",
69
+ "vite": "^4.4.2",
70
70
  "vue": "^3.3.4"
71
71
  },
72
72
  "peerDependencies": {
@@ -82,13 +82,13 @@
82
82
  "@types/koa-session": "^6.4.1",
83
83
  "@types/koa-static": "^4.0.2",
84
84
  "@types/koa__cors": "^4.0.0",
85
- "@types/node": "^20.3.2",
85
+ "@types/node": "^20.4.1",
86
86
  "knex": "^2.4.2",
87
87
  "objection": "^3.0.4",
88
88
  "typescript": "^5.1.6"
89
89
  },
90
90
  "types": "types",
91
- "gitHead": "7549d96fcd1d5b9fb8e6b7d1e5573df954d9dbff",
91
+ "gitHead": "3d02df42dc8d7ee782d35f53c3877cc3e9fb88c7",
92
92
  "scripts": {
93
93
  "types": "tsc --noEmit --esModuleInterop ./types/index.d.ts"
94
94
  },
@@ -667,9 +667,33 @@ export class Application extends Koa {
667
667
  knex.typeParsers &&
668
668
  this.knex.client.driver
669
669
  ) {
670
+ const { types } = this.knex.client.driver
671
+ // Support type parser mappings defined in user-land.
670
672
  for (const [type, parser] of Object.entries(knex.typeParsers)) {
671
- this.knex.client.driver.types.setTypeParser(type, parser)
673
+ types.setTypeParser(type, parser)
672
674
  }
675
+ // Automatically setup array type parsers for numeric and int8.
676
+ const setupArrayParser = (valueType, arrayType) => {
677
+ if (
678
+ valueType in knex.typeParsers &&
679
+ !(arrayType in knex.typeParsers)
680
+ ) {
681
+ const parseValue = types.getTypeParser(valueType)
682
+ const parseArray = types.getTypeParser(arrayType)
683
+ types.setTypeParser(arrayType, text =>
684
+ parseArray(text).map(value =>
685
+ value === null ? value : parseValue(value)
686
+ )
687
+ )
688
+ }
689
+ }
690
+
691
+ setupArrayParser(1700, 1231) // numeric
692
+ setupArrayParser(20, 1016) // int8
693
+ // setupArrayParser(21, 1005) // int2
694
+ // setupArrayParser(23, 1007) // int4
695
+ // setupArrayParser(700, 1021) // float4
696
+ // setupArrayParser(701, 1022) // float8
673
697
  }
674
698
  if (log.sql) {
675
699
  this.setupKnexLogging()