dobo 2.30.6 → 2.31.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/lib/factory/driver.js
CHANGED
|
@@ -128,8 +128,11 @@ async function driverFactory () {
|
|
|
128
128
|
|
|
129
129
|
async _attachHook (name, model, ...args) {
|
|
130
130
|
const { ns } = this.app.dobo
|
|
131
|
+
const { kebabCase } = this.app.lib._
|
|
131
132
|
const options = last(args)
|
|
132
133
|
if (!options.noDriverHook) {
|
|
134
|
+
const prefix = kebabCase(name).split('-')[0]
|
|
135
|
+
await runHook(`${ns}.driver:${prefix}Any`, model, options)
|
|
133
136
|
await runHook(`${ns}.driver:${name}`, model, ...args)
|
|
134
137
|
await runHook(`${ns}.driver.${camelCase(model.name)}:${name}`, model, ...args)
|
|
135
138
|
}
|
|
@@ -173,7 +173,7 @@ export async function getRefs (records = [], options = {}) {
|
|
|
173
173
|
const { isSet } = this.app.lib.aneka
|
|
174
174
|
const { uniq, without, get } = this.app.lib._
|
|
175
175
|
const { parseQuery } = this.app.dobo
|
|
176
|
-
const props = this.
|
|
176
|
+
const props = this.getNonVirtualProperties().filter(p => isSet(p.ref) && !(options.hidden ?? []).includes(p.name))
|
|
177
177
|
options.refs = options.refs ?? []
|
|
178
178
|
if (props.length > 0) {
|
|
179
179
|
for (const prop of props) {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @param {Array} [options.extFields=[]]
|
|
13
13
|
* @returns {Object}
|
|
14
14
|
*/
|
|
15
|
-
async function sanitizeBody ({ body = {}, partial, strict, extFields = [], noDefault, truncateString, onlyTypes = [], action } = {}) {
|
|
15
|
+
async function sanitizeBody ({ body = {}, partial, strict, extFields = [], noDefault, truncateString, onlyTypes = [], action, allProps } = {}) {
|
|
16
16
|
const { isSet } = this.app.lib.aneka
|
|
17
17
|
const { sanitizeByType } = this.app.dobo
|
|
18
18
|
const { omit, has } = this.app.lib._
|
|
@@ -26,7 +26,8 @@ async function sanitizeBody ({ body = {}, partial, strict, extFields = [], noDef
|
|
|
26
26
|
|
|
27
27
|
const omitted = []
|
|
28
28
|
const details = []
|
|
29
|
-
const
|
|
29
|
+
const props = allProps ? this.properties : this.getNonVirtualProperties()
|
|
30
|
+
const properties = [...props, ...extFields]
|
|
30
31
|
for (const prop of properties) {
|
|
31
32
|
try {
|
|
32
33
|
if (partial && !has(body, prop.name)) {
|
|
@@ -22,7 +22,7 @@ async function sanitizeRecord (record = {}, opts = {}) {
|
|
|
22
22
|
if (!newFields.includes('id')) newFields.unshift('id')
|
|
23
23
|
newFields = without(newFields, ...allHidden)
|
|
24
24
|
const body = fillObject(record, newFields, null)
|
|
25
|
-
const newRecord = await this.sanitizeBody({ body, partial: true, noDefault: true })
|
|
25
|
+
const newRecord = await this.sanitizeBody({ body, partial: true, noDefault: true, allProps: true })
|
|
26
26
|
if (record._ref) newRecord._ref = cloneDeep(record._ref)
|
|
27
27
|
for (const key in newRecord) {
|
|
28
28
|
const prop = this.getProperty(key)
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-06-29
|
|
4
|
+
|
|
5
|
+
- [2.31.0] Add ```dobo.driver:{before|after}Any```
|
|
6
|
+
|
|
3
7
|
## 2026-06-24
|
|
4
8
|
|
|
5
9
|
- [2.30.5] Bug fix in ```model.sanitizeBody()```
|
|
6
10
|
- [2.30.5] Bug fix in ```model.sanitizeRecord()```
|
|
7
11
|
- [2.30.6] Bug fix in ```driver.sanitizeRecord()```
|
|
12
|
+
- [2.30.7] Bug fix in ```util.getRefs()```
|
|
13
|
+
- [2.30.7] Bug fix in ```model.sanitizeBody()```
|
|
14
|
+
- [2.30.7] Bug fix in ```model.sanitizeRecord()```
|
|
8
15
|
|
|
9
16
|
## 2026-06-16
|
|
10
17
|
|