waibu-rest-api 1.0.3 → 1.0.5

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/bajo/config.json CHANGED
@@ -6,9 +6,8 @@
6
6
  "exposeHead": true,
7
7
  "enablePatch": false,
8
8
  "bodyLimit": 1048576,
9
- "i18n": {
10
- "detectors": ["qs", "header"],
11
- "defaultNs": ["dobo", "waibuRestApi"]
9
+ "intl": {
10
+ "detectors": ["qs", "header"]
12
11
  },
13
12
  "format": {
14
13
  "supported": ["json", "xml"],
@@ -2,8 +2,8 @@ const waibuRestApiPreParsing = {
2
2
  level: 9,
3
3
  handler: async function (req, reply) {
4
4
  const { importModule } = this.app.bajo
5
- const attachI18N = await importModule('waibu:/lib/webapp-scope/attach-i18n.js')
6
- await attachI18N.call(this, this.config.i18n.detectors, req, reply)
5
+ const attachI18N = await importModule('waibu:/lib/webapp-scope/attach-intl.js')
6
+ await attachI18N.call(this, this.config.intl.detectors, req, reply)
7
7
  reply.header('Content-Language', req.lang)
8
8
  if (this.config.format.asExt && req.params.format) {
9
9
  if (!this.config.format.supported.includes(req.params.format)) {
package/lib/decorate.js CHANGED
@@ -1,5 +1,4 @@
1
1
  async function decorate (ctx) {
2
- // ctx.decorateRequest('i18n', null)
3
2
  }
4
3
 
5
4
  export default decorate
@@ -5,7 +5,7 @@ async function serveRoute ({ mod, ns, parent }) {
5
5
  const mergeRouteHooks = await importModule('waibu:/lib/webapp-scope/merge-route-hooks.js')
6
6
  const cfgWdb = this.app.waibuDb.config
7
7
  mod.config = mod.config ?? {}
8
- mod.config.prefix = getPluginPrefix(ns)
8
+ mod.config.prefix = getPluginPrefix(ns, 'waibuRestApi')
9
9
  mod.config.pathSrc = mod.url
10
10
  mod.config.webApp = parent ?? ns
11
11
  mod.config.ns = ns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-rest-api",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "REST API for Waibu",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/waibu/boot.js CHANGED
@@ -51,7 +51,7 @@ const boot = {
51
51
  const me = this
52
52
 
53
53
  await eachPlugins(async function ({ dir, alias, ns }) {
54
- const appPrefix = '/' + (ns === me.app.bajo.mainNs && me.config.mountMainAsRoot ? '' : getPluginPrefix(ns))
54
+ const appPrefix = '/' + (ns === me.app.bajo.mainNs && getPluginPrefix(ns, 'waibuRestApi'))
55
55
  const pattern = [
56
56
  `${dir}/${pathPrefix}/**/{${actions.join(',')}}.js`,
57
57
  `${dir}/${pathPrefix}/**/model-builder.*`
File without changes