waibu-rest-api 2.1.1 → 2.2.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
async function xml (req, reply, payload) {
|
|
2
2
|
const { importPkg } = this.app.bajo
|
|
3
|
-
const { XMLBuilder } = await importPkg('bajoExtra:fast-xml-parser'
|
|
3
|
+
const { XMLBuilder } = await importPkg('bajoExtra:fast-xml-parser')
|
|
4
4
|
const { get, set, isPlainObject, isArray } = this.app.lib._
|
|
5
5
|
const { wrapper, valueAsAttributes, declaration } = this.config.format.xml.response
|
|
6
6
|
|
|
@@ -39,10 +39,11 @@ async function routeByModelBuilder ({ file, ctx, dir, pathPrefix, ns, parent })
|
|
|
39
39
|
if (isSet(headers['x-count'])) count = headers['x-count']
|
|
40
40
|
if (isSet(headers['x-refs'])) refs = headers['x-refs']
|
|
41
41
|
if (typeof refs === 'string' && !['*', 'all'].includes(refs)) refs = [refs]
|
|
42
|
-
const options = { fields, count, refs }
|
|
42
|
+
const options = { fields, count, refs, dynHooks: builder.hooks ?? [] }
|
|
43
43
|
options.hidden = builder.hidden ?? []
|
|
44
44
|
options.queryHandler = builder.queryHandler
|
|
45
45
|
if (method === 'replace') options.partial = false
|
|
46
|
+
if (['get', 'remove', 'update'].includes(method)) options.throwNotFound = true
|
|
46
47
|
const data = await helper({ model: builder.model, req, reply, ctx: this, options })
|
|
47
48
|
data.success = true
|
|
48
49
|
data.statusCode = method === 'create' ? 201 : 200
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
-
## 2026-
|
|
3
|
+
## 2026-01-30
|
|
4
|
+
|
|
5
|
+
- [2.2.1] Bug fix if output format is in xml
|
|
6
|
+
|
|
7
|
+
## 2026-01-24
|
|
8
|
+
|
|
9
|
+
- [2.2.0] Add ```hooks``` property to model builder that will be considered as dynamic hoooks by models
|
|
10
|
+
|
|
11
|
+
## 2026-01-16
|
|
4
12
|
|
|
5
13
|
- [2.1.1] Bug fix on model references
|
|
6
14
|
|