waibu-rest-api 2.8.0 → 2.8.1

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/index.js CHANGED
@@ -143,6 +143,7 @@ async function factory (pkgName) {
143
143
  const { each, keys, omit, get } = this.app.lib._
144
144
  const cfg = this.config
145
145
  const cfgWdb = this.app.waibuDb.config
146
+ if (!options.showWarnings) delete data.warnings
146
147
  if (reply) {
147
148
  reply.code(req.method.toUpperCase() === 'POST' ? 201 : 200)
148
149
  if (cfgWdb.dbModel.dataOnly) {
@@ -35,13 +35,15 @@ async function routeByModelBuilder ({ file, dir, pathPrefix, ns, parent }) {
35
35
  method: mapmethod,
36
36
  handler: async function (req, reply) {
37
37
  const helper = me.app.waibuDb[`${method === 'replace' ? 'update' : method}Record`]
38
- let { fields, count } = getParams(req)
38
+ const { fields } = getParams(req)
39
+ let count = true
39
40
  let refs = []
40
41
  const headers = parseObject(req.headers, { parseValue: true })
41
- if (isSet(headers['x-count'])) count = headers['x-count']
42
+ if (headers['x-nocount']) count = false
42
43
  if (isSet(headers['x-refs'])) refs = headers['x-refs']
43
44
  if (typeof refs === 'string' && !['*', 'all'].includes(refs)) refs = [refs]
44
45
  const options = { fields, count, refs, dynHooks: builder.hooks ?? [] }
46
+ if (headers['x-warnings']) options.showWarnings = true
45
47
  options.hidden = builder.hidden ?? []
46
48
  options.queryHandler = builder.queryHandler
47
49
  if (method === 'replace') options.partial = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-rest-api",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "REST API for Waibu",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -3,6 +3,7 @@
3
3
  ## 2026-03-30
4
4
 
5
5
  - [2.8.0] Add inter site module support
6
+ - [2.8.1] Bug fix in ```options.limit```, removed due to use ```findAllRecords()```
6
7
 
7
8
  ## 2026-03-22
8
9