waibu-db 2.1.2 → 2.1.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.
@@ -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,4 +1,5 @@
1
1
  async function prepCrud ({ model, body, id, req, reply, options = {}, args }) {
2
+ const { parseObject, 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._
@@ -18,6 +19,13 @@ async function prepCrud ({ model, body, id, req, reply, options = {}, args }) {
18
19
  stats = stats ?? req.query.stats
19
20
  mimeType = mimeType ?? req.query.mimeType
20
21
 
22
+ let refs = []
23
+ const headers = parseObject(req.headers, { parseValue: true })
24
+ if (isSet(headers['x-count'])) options.count = headers['x-count']
25
+ if (isSet(headers['x-refs'])) refs = headers['x-refs']
26
+ if (typeof refs === 'string' && !['*', 'all'].includes(refs)) refs = [refs]
27
+ if (refs.length > 0) options.refs = refs
28
+
21
29
  const recId = id ?? params.id ?? req.query.id
22
30
  model = model ?? pascalCase(params.model)
23
31
  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.3",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-01-16
4
+
5
+ - [2.1.2] Bug fix on model references
6
+
3
7
  ## 2026-01-13
4
8
 
5
9
  - [2.1.1] Bug fix on waibuMpa's widgeting system