waibu-db 2.1.2 → 2.1.4

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.
@@ -1,14 +1,5 @@
1
1
  async function find (req, reply) {
2
- const { isSet } = this.app.lib.aneka
3
- const { parseObject } = this.app.lib
4
- let { fields, count } = this.getParams(req)
5
- let rels = []
6
- const headers = parseObject(req.headers, { parseValue: true })
7
- if (isSet(headers['x-count'])) count = headers['x-count']
8
- if (isSet(headers['x-rels'])) rels = headers['x-rels']
9
- if (typeof rels === 'string' && !['*', 'all'].includes(rels)) rels = [rels]
10
- const options = { fields, count, rels }
11
- return await this.findRecord({ req, reply, options })
2
+ return await this.findRecord({ req, reply })
12
3
  }
13
4
 
14
5
  export default find
package/lib/prep-crud.js CHANGED
@@ -1,7 +1,9 @@
1
1
  async function prepCrud ({ model, body, id, req, reply, options = {}, args }) {
2
+ const { isSet } = this.app.lib.aneka
2
3
  const { parseFilter } = this.app.waibu
3
4
  const { pascalCase } = this.app.lib.aneka
4
5
  const { cloneDeep, has } = this.app.lib._
6
+ const { parseObject } = this.app.lib
5
7
  const cfgWeb = this.app.waibu.getConfig()
6
8
  const opts = cloneDeep(options)
7
9
  const params = this.getParams(req, ...args)
@@ -18,6 +20,13 @@ async function prepCrud ({ model, body, id, req, reply, options = {}, args }) {
18
20
  stats = stats ?? req.query.stats
19
21
  mimeType = mimeType ?? req.query.mimeType
20
22
 
23
+ let refs = []
24
+ const headers = parseObject(req.headers, { parseValue: true })
25
+ if (isSet(headers['x-count'])) options.count = headers['x-count']
26
+ if (isSet(headers['x-refs'])) refs = headers['x-refs']
27
+ if (typeof refs === 'string' && !['*', 'all'].includes(refs)) refs = [refs]
28
+ if (refs.length > 0) options.refs = refs
29
+
21
30
  const recId = id ?? params.id ?? req.query.id
22
31
  model = model ?? pascalCase(params.model)
23
32
  const mdl = this.app.dobo.getModel(model)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-01-17
4
+
5
+ - [2.1.4] Bug fix
6
+
7
+ ## 2026-01-16
8
+
9
+ - [2.1.2] Bug fix on model references
10
+
3
11
  ## 2026-01-13
4
12
 
5
13
  - [2.1.1] Bug fix on waibuMpa's widgeting system