dobo 2.8.0 → 2.8.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/extend/dobo/driver/memory.js +1 -1
- package/index.js +1 -1
- package/lib/collect-models.js +2 -1
- package/lib/factory/model/upsert-record.js +5 -2
- package/package.json +1 -1
- package/wiki/CHANGES.md +10 -0
|
@@ -159,7 +159,7 @@ async function memoryDriverFactory () {
|
|
|
159
159
|
_getCursor (model, filter) {
|
|
160
160
|
const criteria = filter.query ?? {}
|
|
161
161
|
const q = new Query(criteria, { idKey: '_id' })
|
|
162
|
-
return q.find(this.storage[model.name])
|
|
162
|
+
return q.find(this.storage[model.name] ?? [])
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
package/index.js
CHANGED
package/lib/collect-models.js
CHANGED
|
@@ -302,11 +302,12 @@ async function collectModels () {
|
|
|
302
302
|
await eachPlugins(async function ({ file }) {
|
|
303
303
|
const { readConfig } = this.app.bajo
|
|
304
304
|
const { pascalCase } = this.app.lib.aneka
|
|
305
|
-
const { isPlainObject } = this.app.lib._
|
|
305
|
+
const { isPlainObject, isEmpty } = this.app.lib._
|
|
306
306
|
|
|
307
307
|
const base = path.basename(file, path.extname(file))
|
|
308
308
|
const defName = pascalCase(`${this.alias} ${base}`)
|
|
309
309
|
const item = await readConfig(file, { ns: this.ns, ignoreError: true })
|
|
310
|
+
if (isEmpty(item)) return undefined
|
|
310
311
|
if (!isPlainObject(item)) me.fatal('invalidModel%s', defName)
|
|
311
312
|
item.name = item.name ?? defName
|
|
312
313
|
item.collName = item.collName ?? item.name
|
|
@@ -31,14 +31,17 @@ async function native (body = {}, opts = {}) {
|
|
|
31
31
|
|
|
32
32
|
async function manual (body = {}, options = {}) {
|
|
33
33
|
const { isSet } = this.app.lib.aneka
|
|
34
|
+
const { get, omit } = this.app.lib._
|
|
34
35
|
if (isSet(body.id)) body.id = this.sanitizeId(body.id)
|
|
35
36
|
let old = false
|
|
36
37
|
if (isSet(body.id)) {
|
|
37
38
|
try {
|
|
38
39
|
old = await this.driver._getRecord(this, body.id, { noHook: true, noModelHook: true })
|
|
39
|
-
} catch (err) {
|
|
40
|
+
} catch (err) {
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
|
-
|
|
43
|
+
const id = get(old, 'dara.id')
|
|
44
|
+
if (id) return await this.updateRecord(old.data.id, omit(body, ['id']), options)
|
|
42
45
|
return await this.createRecord(body, options)
|
|
43
46
|
}
|
|
44
47
|
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-02-24
|
|
4
|
+
|
|
5
|
+
- [2.8.2] Bug fix on field type ```textType```
|
|
6
|
+
- [2.8.2] Bug fix on ```collect-models.js``` when empty model is returned
|
|
7
|
+
|
|
8
|
+
## 2026-02-23
|
|
9
|
+
|
|
10
|
+
- [2.8.1] Bug fix on ```memory._getCursor()```
|
|
11
|
+
- [2.8.1] Bug fix on ```model.upsertRecord()```
|
|
12
|
+
|
|
3
13
|
## 2026-02-22
|
|
4
14
|
|
|
5
15
|
- [2.8.0] Add ```warnings``` to response object
|