waibu 1.0.9 → 1.0.10
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/hook/on-close.js +1 -1
- package/bajo/hook/on-ready.js +1 -1
- package/bajo/intl/en-US.json +14 -0
- package/bajo/intl/id.json +12 -44
- package/bajo/method/not-found.js +1 -1
- package/lib/app.js +3 -3
- package/lib/handle-xml-body.js +1 -1
- package/lib/log-routes.js +1 -1
- package/lib/webapp-scope/attach-intl.js +5 -3
- package/lib/webapp-scope/error-handler.js +2 -2
- package/package.json +1 -1
package/bajo/hook/on-close.js
CHANGED
package/bajo/hook/on-ready.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginPrefixConflic%s%s%s": "Plugin prefix '%s' conflict between '%s' and '%s'",
|
|
3
|
+
"serverIs%s": "Server is %s",
|
|
4
|
+
"closedL": "closed",
|
|
5
|
+
"readyL": "ready",
|
|
6
|
+
"allRoutesConfigDisabled%s": "All '%s' routes are disabled by config",
|
|
7
|
+
"bootApp%s": "Boot app: %s",
|
|
8
|
+
"cantParseXmlBodyWithout%s": "Can't parse XML body unless package '%s' is loaded first",
|
|
9
|
+
"routesL": "routes",
|
|
10
|
+
"routeDisabled%s%s": "Route %s (%s) is disabled",
|
|
11
|
+
"rerouted%s%s": "Rerouted %s -> %s",
|
|
12
|
+
"bootSubApp%s": "Boot sub app: %s",
|
|
13
|
+
"routeNotFound%s%s": "Route '%s (%s)' not found"
|
|
14
|
+
}
|
package/bajo/intl/id.json
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"Conflict": "",
|
|
15
|
-
"Gone": "",
|
|
16
|
-
"Length Required": "",
|
|
17
|
-
"Precondition Failed": "",
|
|
18
|
-
"Payload Too Large": "",
|
|
19
|
-
"URI Too Long": "",
|
|
20
|
-
"Unsupported Media Type": "",
|
|
21
|
-
"Range Not Satisfiable": "",
|
|
22
|
-
"Expectation Failed": "",
|
|
23
|
-
"Im A Teapot": "",
|
|
24
|
-
"Misdirected Request": "",
|
|
25
|
-
"Unprocessable Entity": "",
|
|
26
|
-
"Locked": "",
|
|
27
|
-
"Failed Dependency": "",
|
|
28
|
-
"Too Early": "",
|
|
29
|
-
"Upgrade Required": "",
|
|
30
|
-
"Precondition Required": "",
|
|
31
|
-
"Too Many Requests": "",
|
|
32
|
-
"Request Header Fields Too Large": "",
|
|
33
|
-
"Unavailable For Legal Reasons": "",
|
|
34
|
-
"Internal Server Error": "Kesalahan Internal Server",
|
|
35
|
-
"Not Implemented": "",
|
|
36
|
-
"Bad Gateway": "",
|
|
37
|
-
"Service Unavailable": "",
|
|
38
|
-
"Gateway Timeout": "",
|
|
39
|
-
"HTTP Version Not Supported": "",
|
|
40
|
-
"Variant Also Negotiates": "",
|
|
41
|
-
"Insufficient Storage": "",
|
|
42
|
-
"Loop Detected": "",
|
|
43
|
-
"Bandwidth Limit Exceeded": "",
|
|
44
|
-
"Not Extended": "",
|
|
45
|
-
"Network Authentication Require": ""
|
|
2
|
+
"pluginPrefixConflic%s%s%s": "Ada konflik di prefiks '%s' antara '%s' dan '%s'",
|
|
3
|
+
"serverIs%s": "Server %s",
|
|
4
|
+
"closedL": "tertutup",
|
|
5
|
+
"readyL": "siap sedia",
|
|
6
|
+
"allRoutesConfigDisabled%s": "Semua jalur '%s' dimatikan via konfigurasi",
|
|
7
|
+
"bootApp%s": "Jalankan aplikasi: %s",
|
|
8
|
+
"cantParseXmlBodyWithout%s": "Tidak bisa memparse bodi XML sebelum paket '%s' dimuat terlebih dahulu",
|
|
9
|
+
"routesL": "jalur",
|
|
10
|
+
"routeDisabled%s%s": "Jalur %s (%s) dimatikan",
|
|
11
|
+
"rerouted%s%s": "Jalur dipindahkan %s -> %s",
|
|
12
|
+
"bootSubApp%s": "Boot sub app: %s",
|
|
13
|
+
"routeNotFound%s%s": "Jalur '%s (%s)' tidak ditemukan"
|
|
46
14
|
}
|
package/bajo/method/not-found.js
CHANGED
package/lib/app.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function collect (glob = 'boot.js', baseNs) {
|
|
|
18
18
|
mods.forEach(m => {
|
|
19
19
|
if (!prefixes[m.prefix]) prefixes[m.prefix] = []
|
|
20
20
|
prefixes[m.prefix].push(m.plugin)
|
|
21
|
-
if (prefixes[m.prefix].length > 1) this.fatal('
|
|
21
|
+
if (prefixes[m.prefix].length > 1) this.fatal('pluginPrefixConflic%s%s%s', m.prefix, prefixes[m.prefix][0], prefixes[m.prefix][1])
|
|
22
22
|
})
|
|
23
23
|
return orderBy(mods, ['level'])
|
|
24
24
|
}
|
|
@@ -30,11 +30,11 @@ export async function boot () {
|
|
|
30
30
|
for (const m of mods) {
|
|
31
31
|
const disabled = this.app[m.ns].config.disabled
|
|
32
32
|
if (Array.isArray(disabled) && disabled.length === 1 && ['*', 'all'].includes(disabled[0])) {
|
|
33
|
-
this.log.warn('
|
|
33
|
+
this.log.warn('allRoutesConfigDisabled%s', m.ns)
|
|
34
34
|
continue
|
|
35
35
|
}
|
|
36
36
|
await runHook(`${this.name}.${m.ns}:beforeAppBoot`)
|
|
37
|
-
this.log.debug('
|
|
37
|
+
this.log.debug('bootApp%s', m.ns)
|
|
38
38
|
await this.instance.register(async (ctx) => {
|
|
39
39
|
const plugin = this.app[m.ns]
|
|
40
40
|
plugin.instance = ctx
|
package/lib/handle-xml-body.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
async function xmlBodyParser (ctx, opts = {}) {
|
|
4
4
|
if (!this.app.bajoExtra) {
|
|
5
|
-
this.log.warn('
|
|
5
|
+
this.log.warn('cantParseXmlBodyWithout%s', 'bajo-extra')
|
|
6
6
|
return
|
|
7
7
|
}
|
|
8
8
|
const { importPkg } = this.app.bajo
|
package/lib/log-routes.js
CHANGED
|
@@ -10,7 +10,7 @@ function printRoutes () {
|
|
|
10
10
|
}
|
|
11
11
|
})
|
|
12
12
|
items = orderBy(items, ['url'])
|
|
13
|
-
this.log.debug('
|
|
13
|
+
this.log.debug('loaded%s', this.print.write('routesL'))
|
|
14
14
|
items.forEach(item => {
|
|
15
15
|
this.log.debug('- %s (%s)', item.url, item.methods.join('|'))
|
|
16
16
|
})
|
|
@@ -53,10 +53,12 @@ async function attachIntl (detector = [], req, reply) {
|
|
|
53
53
|
detect.call(this, detector, req, reply)
|
|
54
54
|
const defNs = get(req, 'routeOptions.config.ns', this.name)
|
|
55
55
|
req.t = (text, ...args) => {
|
|
56
|
-
|
|
56
|
+
args.push({ lang: req.lang })
|
|
57
|
+
return this.app[defNs].print.write(text, ...args)
|
|
57
58
|
}
|
|
58
|
-
req.format = (value, type = 'auto', opts) => {
|
|
59
|
-
|
|
59
|
+
req.format = (value, type = 'auto', opts = {}) => {
|
|
60
|
+
opts.lang = opts.lang ?? req.lang
|
|
61
|
+
return this.app.bajo.format(value, type, opts)
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -6,9 +6,9 @@ async function errorHandler (ctx, extHandler) {
|
|
|
6
6
|
reply.send(err.print)
|
|
7
7
|
return
|
|
8
8
|
}
|
|
9
|
-
if (me.app.bajo.config.log.level === 'trace' && !['
|
|
9
|
+
if (me.app.bajo.config.log.level === 'trace' && !['_notFound', '_redirect'].includes(err.message.toLowerCase())) console.error(err)
|
|
10
10
|
if (extHandler) return await extHandler.call(me, err, req, reply, ctx)
|
|
11
|
-
if (err.message
|
|
11
|
+
if (err.message === '_notFound' || err.statusCode === 404) {
|
|
12
12
|
reply.code(err.statusCode)
|
|
13
13
|
return
|
|
14
14
|
}
|