dobo 2.4.0 → 2.5.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.
@@ -247,9 +247,11 @@ async function driverFactory () {
247
247
 
248
248
  async _updateRecord (model, id, body = {}, options = {}) {
249
249
  if (!this.support.uniqueIndex) await this._checkUnique(model, body, options)
250
- const resp = await this.getRecord(model, id, { noHook: true })
251
- if (!resp.data) throw this.plugin.error('recordNotFound%s%s', id, model.name)
252
- options._data = resp.data
250
+ if (!options._data) {
251
+ const resp = await this.getRecord(model, id, { noHook: true })
252
+ if (!resp.data) throw this.plugin.error('recordNotFound%s%s', id, model.name)
253
+ options._data = resp.data
254
+ }
253
255
  const input = this.sanitizeBody(model, body, true)
254
256
  delete input.id
255
257
  const result = await this.updateRecord(model, id, input, options)
@@ -262,9 +264,11 @@ async function driverFactory () {
262
264
  async _upsertRecord (model, body = {}, options = {}) {
263
265
  if (!this.uniqueIndexSupport) await this._checkUnique(model, body, options)
264
266
  if (isSet(body.id)) {
265
- const resp = await this.getRecord(model, body.id, { noHook: true })
266
- if (!resp.data) throw this.plugin.error('recordNotFound%s%s', body.id, model.name)
267
- options._data = resp.data
267
+ if (!options._data) {
268
+ const resp = await this.getRecord(model, body.id, { noHook: true })
269
+ if (!resp.data) throw this.plugin.error('recordNotFound%s%s', body.id, model.name)
270
+ options._data = resp.data
271
+ }
268
272
  }
269
273
  const input = this.sanitizeBody(model, body)
270
274
  const result = await this.upsertRecord(model, input, options)
@@ -275,9 +279,11 @@ async function driverFactory () {
275
279
  }
276
280
 
277
281
  async _removeRecord (model, id, options = {}) {
278
- const resp = await this.getRecord(model, id, { noHook: true })
279
- if (!resp.data) throw this.plugin.error('recordNotFound%s%s', id, model.name)
280
- options._data = resp.data
282
+ if (!options._data) {
283
+ const resp = await this.getRecord(model, id, { noHook: true })
284
+ if (!resp.data) throw this.plugin.error('recordNotFound%s%s', id, model.name)
285
+ options._data = resp.data
286
+ }
281
287
  const result = await this.removeRecord(model, id, options)
282
288
  if (options.noResult) return
283
289
  result.oldData = this.sanitizeRecord(model, result.oldData)
@@ -124,7 +124,7 @@ export async function copyAttachment (id, options = {}) {
124
124
  if (parts.length === 0) continue
125
125
  fieldName = setField ?? fieldName
126
126
  const file = setFile ?? parts.join('@')
127
- const opts = { source: f, fieldName, file, mimeType, stats, req, silent: true }
127
+ const opts = { source: f, fieldName, file, mimeType, stats, req }
128
128
  const rec = await this.createAttachment(id, opts)
129
129
  if (!rec) continue
130
130
  delete rec.dir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "DBMS for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-01-30
4
+
5
+ - [2.5.0] Add feature to push custom ```options._data```. If provided, this will be used instead of auto generated one.
6
+ - [2.5.0] Remove ```silent``` in ```options``` object
7
+
3
8
  ## 2026-01-29
4
9
 
5
10
  - [2.4.0] Add ```bulkCreateRecords()``` on model & driver