dobo 2.18.1 → 2.18.2
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/index.js +5 -2
- package/lib/collect-models.js +4 -2
- package/lib/factory/model/sanitize-record.js +4 -6
- package/package.json +1 -1
- package/wiki/CHANGES.md +7 -0
package/index.js
CHANGED
|
@@ -501,9 +501,12 @@ async function factory (pkgName) {
|
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
getDefaultValues = (options = {}) => {
|
|
504
|
+
const { defaultsDeep } = this.app.lib.aneka
|
|
504
505
|
const key = 'default.filter'
|
|
505
|
-
let config = this.
|
|
506
|
-
|
|
506
|
+
let config = this.getConfig(key)
|
|
507
|
+
config.hardCap = this.config.default.hardCap
|
|
508
|
+
config.warnings = this.config.default.warnings
|
|
509
|
+
if (options.req) config = defaultsDeep({}, options.req.getSetting('dobo:default'), config)
|
|
507
510
|
const { limit, maxLimit, maxPage, hardCap, warnings } = config
|
|
508
511
|
const t = options.req ? options.req.t : this.t
|
|
509
512
|
return { limit, maxLimit, hardCap, maxPage, warnings, t }
|
package/lib/collect-models.js
CHANGED
|
@@ -10,7 +10,7 @@ import actionFactory from './factory/action.js'
|
|
|
10
10
|
* @param {Array} [indexes] - Container array to fill up found index
|
|
11
11
|
*/
|
|
12
12
|
async function sanitizeProp (model, prop, indexes) {
|
|
13
|
-
const { isEmpty, isString, keys, pick, isArray, isPlainObject } = this.app.lib._
|
|
13
|
+
const { isEmpty, isString, keys, pick, isArray, isPlainObject, omit } = this.app.lib._
|
|
14
14
|
const allPropKeys = this.getAllPropertyKeys(model.connection.driver)
|
|
15
15
|
const propType = this.constructor.propertyType
|
|
16
16
|
if (isString(prop)) {
|
|
@@ -39,7 +39,9 @@ async function sanitizeProp (model, prop, indexes) {
|
|
|
39
39
|
else {
|
|
40
40
|
const feature = this.getFeature(prop.type)
|
|
41
41
|
if (!feature) this.fatal('unknownPropType%s%s', prop.type, model.name)
|
|
42
|
-
|
|
42
|
+
const opts = omit(prop, ['name', 'type'])
|
|
43
|
+
opts.field = prop.name
|
|
44
|
+
await applyFeature.call(this, model, feature, opts, indexes)
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -46,10 +46,10 @@ async function sanitizeRecord (record = {}, opts = {}) {
|
|
|
46
46
|
})
|
|
47
47
|
value = (values.find(v => v.value === value) ?? {}).text ?? value
|
|
48
48
|
}
|
|
49
|
-
if (prop.format)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
if (prop.format === false) newRecord[key] = value + ''
|
|
50
|
+
else if (isFunction(prop.format)) newRecord[key] = await prop.format.call(this, value, newRecord, opts)
|
|
51
|
+
else if (isString(prop.format)) newRecord[key] = await callHandler(this.plugin, this, value, newRecord, opts)
|
|
52
|
+
else {
|
|
53
53
|
const options = {
|
|
54
54
|
lang: get(opts, 'req.lang'),
|
|
55
55
|
latitude: ['lat', 'latitude'].includes(key),
|
|
@@ -57,8 +57,6 @@ async function sanitizeRecord (record = {}, opts = {}) {
|
|
|
57
57
|
}
|
|
58
58
|
newRecord[key] = format(value, prop.type, options)
|
|
59
59
|
}
|
|
60
|
-
// exception
|
|
61
|
-
if (['year'].includes(key)) newRecord[key] = (get(newRecord, `_orig.${key}`, newRecord[key]) + '')
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
if (record._ref) newRecord._ref = record._ref
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-04-18
|
|
4
|
+
|
|
5
|
+
- [2.18.2] Bug fix in ```config``` object
|
|
6
|
+
- [2.18.2] Bug fix in ```getDefaultValues```
|
|
7
|
+
- [2.18.2] Bug fix in ```sanitizeProp()``` in ```collect-models.js```
|
|
8
|
+
- [2.18.2] Bug fix in ```sanitizeRecord()``` for prop with ```format``` set to ```false```
|
|
9
|
+
|
|
3
10
|
## 2026-04-17
|
|
4
11
|
|
|
5
12
|
- [2.18.1] Bug fix in ```model.createAttachment()```
|