waibu-rest-api 1.2.0 → 1.2.2

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.
@@ -8,11 +8,12 @@ async function routeByModelBuilder ({ file, ctx, dir, pathPrefix, ns, parent })
8
8
  const { isSet } = this.lib.aneka
9
9
  const { methodMap, getParams } = this.app.waibuDb
10
10
  const { getInfo } = this.app.dobo
11
- const { camelCase, omit, merge, keys, filter } = this.lib._
11
+ const { isFunction, camelCase, omit, merge, keys, filter } = this.lib._
12
12
  const builder = await readConfig(file, { ns, ignoreError: true })
13
13
  builder.disabled = builder.disabled ?? []
14
14
  const { schema } = getInfo(builder.model)
15
- const url = path.dirname(file).replace(`${dir}/${pathPrefix}`, '').replaceAll('@', ':')
15
+ let url = path.dirname(file).replace(`${dir}/${pathPrefix}`, '').replaceAll('@', ':')
16
+ if (isFunction(builder.url)) url = await builder.url.call(this)
16
17
  const methods = keys(methodMap)
17
18
  if (this.config.enablePatch) methods.push('replace')
18
19
  const me = this
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "waibu-rest-api",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "REST API for Waibu",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "type": "module",
10
+ "bajo": {
11
+ "type": "plugin"
12
+ },
10
13
  "repository": {
11
14
  "type": "git",
12
15
  "url": "git+https://github.com/ardhi/waibu-rest-api.git"