dobo 2.26.1 → 2.26.3
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 +0 -6
- package/lib/factory/driver.js +1 -1
- package/lib/factory/model/create-record.js +1 -1
- package/lib/factory/model/remove-record.js +1 -1
- package/lib/factory/model/update-record.js +1 -1
- package/lib/factory/model/upsert-record.js +1 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +7 -0
|
@@ -129,12 +129,6 @@ async function memoryDriverFactory () {
|
|
|
129
129
|
return result
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
async findOneRecord (model, filter = {}, options = {}) {
|
|
133
|
-
filter.limit = 1
|
|
134
|
-
const result = await this.findRecord(model, filter, options)
|
|
135
|
-
return { data: result.data[0] }
|
|
136
|
-
}
|
|
137
|
-
|
|
138
132
|
async findAllRecord (model, filter = {}, options = {}) {
|
|
139
133
|
const { sort } = filter
|
|
140
134
|
const { data: count = 0 } = await this.countRecord(model, filter, options)
|
package/lib/factory/driver.js
CHANGED
|
@@ -150,7 +150,7 @@ async function driverFactory () {
|
|
|
150
150
|
if (isSet(body[field])) query[field] = body[field]
|
|
151
151
|
}
|
|
152
152
|
if (isEmpty(query)) continue
|
|
153
|
-
const data = await
|
|
153
|
+
const { data } = await model.findOneRecord({ query }, options)
|
|
154
154
|
if (!isEmpty(data)) {
|
|
155
155
|
if (['updateRecord', 'upsertRecord'].includes(options.action)) {
|
|
156
156
|
let eq = true
|
|
@@ -20,8 +20,8 @@ async function createRecord (...args) {
|
|
|
20
20
|
await execDynHook.call(this, 'beforeCreateRecord', input, options)
|
|
21
21
|
if (!noValidation) await execValidation.call(this, input, options)
|
|
22
22
|
let result = options.record ?? (await this.driver._createRecord(this, input, options)) ?? {}
|
|
23
|
-
await handleReq.call(this, result.data.id, 'created', options)
|
|
24
23
|
if (noResult) return
|
|
24
|
+
await handleReq.call(this, result.data.id, 'created', options)
|
|
25
25
|
result = result ?? {}
|
|
26
26
|
const { warnings } = getDefaultValues(options)
|
|
27
27
|
if (!warnings) delete result.warnings
|
|
@@ -45,9 +45,9 @@ async function removeRecord (...args) {
|
|
|
45
45
|
await execModelHook.call(this, 'beforeRemoveRecord', id, options)
|
|
46
46
|
await execDynHook.call(this, 'beforeRemoveRecord', id, options)
|
|
47
47
|
const result = options.record ?? (await this.driver._removeRecord(this, id, options)) ?? {}
|
|
48
|
+
if (noResult) return
|
|
48
49
|
await handleReq.call(this, result.oldData.id, 'removed', options)
|
|
49
50
|
await clearCache.call(this, id)
|
|
50
|
-
if (noResult) return
|
|
51
51
|
const { warnings } = getDefaultValues(options)
|
|
52
52
|
if (!warnings) delete result.warnings
|
|
53
53
|
if (!noResultSanitizer) result.oldData = await this.sanitizeRecord(result.oldData, options)
|
|
@@ -67,9 +67,9 @@ async function updateRecord (...args) {
|
|
|
67
67
|
await execDynHook.call(this, 'beforeUpdateRecord', id, input, options)
|
|
68
68
|
if (!noValidation) await execValidation.call(this, input, options)
|
|
69
69
|
const result = await this.driver._updateRecord(this, id, input, options)
|
|
70
|
+
if (noResult) return
|
|
70
71
|
await handleReq.call(this, result.data.id, 'updated', options)
|
|
71
72
|
await clearCache.call(this, id)
|
|
72
|
-
if (noResult) return
|
|
73
73
|
const { warnings } = getDefaultValues(options)
|
|
74
74
|
if (!warnings) delete result.warnings
|
|
75
75
|
if (isSet(options.refs)) await getRefs.call(this, [result.data], options)
|
|
@@ -16,9 +16,9 @@ async function native (body = {}, opts = {}) {
|
|
|
16
16
|
await execModelHook.call(this, 'beforeUpsertRecord', input, options)
|
|
17
17
|
await execDynHook.call(this, 'beforeUpsertRecord', input, options)
|
|
18
18
|
const result = options.record ?? (await this.driver._upsertRecord(this, input, options)) ?? {}
|
|
19
|
+
if (noResult) return
|
|
19
20
|
await handleReq.call(this, result.data.id, 'upserted', options)
|
|
20
21
|
await clearCache.call(this, body.id)
|
|
21
|
-
if (noResult) return
|
|
22
22
|
const { warnings } = getDefaultValues(options)
|
|
23
23
|
if (!warnings) delete result.warnings
|
|
24
24
|
if (isSet(options.refs)) await getRefs.call(this, [result.data], options)
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-05-29
|
|
4
|
+
|
|
5
|
+
- [2.26.1] Bug fix in ```model.updateRecord()```
|
|
6
|
+
- [2.26.1] Bug fix in ```model.upsertRecord()```
|
|
7
|
+
- [2.26.1] Bug fix in ```model.removeRecord()```
|
|
8
|
+
|
|
3
9
|
## 2026-05-26
|
|
4
10
|
|
|
5
11
|
- [2.26.0] Add loading multiple model schema as in one ```model.js``` file
|
|
6
12
|
- [2.26.0] Remove caching feature of model schema
|
|
7
13
|
- [2.26.0] Change driver hook name with this syntax: ```dobo.driver:<action>```
|
|
8
14
|
- [2.26.1] Bug fix in ```memory.js```
|
|
15
|
+
- [2.26.2] Bug fix in ```driver.js```
|
|
9
16
|
|
|
10
17
|
## 2026-05-22
|
|
11
18
|
|