waibu-rest-api 2.2.1 → 2.3.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/extend/waibu/boot.js +22 -22
- package/lib/decorate.js +1 -1
- package/lib/doc-schema/for-find.js +1 -1
- package/lib/doc-schema/general.js +13 -13
- package/lib/doc-schema/lib.js +3 -3
- package/lib/doc-schema/model.js +8 -8
- package/lib/doc-schema/params.js +2 -2
- package/lib/doc-schema/qs.js +2 -2
- package/lib/error.js +5 -5
- package/lib/handle-response.js +2 -2
- package/lib/not-found.js +5 -5
- package/lib/route-by-model-builder.js +4 -4
- package/lib/route-by-verb.js +3 -3
- package/lib/sub-app.js +3 -3
- package/package.json +1 -1
- package/wiki/CHANGES.md +4 -0
package/extend/waibu/boot.js
CHANGED
|
@@ -2,8 +2,8 @@ import path from 'path'
|
|
|
2
2
|
import decorate from '../../lib/decorate.js'
|
|
3
3
|
import routeByModelBuilder from '../../lib/route-by-model-builder.js'
|
|
4
4
|
import routeByVerb from '../../lib/route-by-verb.js'
|
|
5
|
-
import notFound from '../../lib/not-found.js'
|
|
6
|
-
import error from '../../lib/error.js'
|
|
5
|
+
// import notFound from '../../lib/not-found.js'
|
|
6
|
+
// import error from '../../lib/error.js'
|
|
7
7
|
import subApp from '../../lib/sub-app.js'
|
|
8
8
|
import handleResponse from '../../lib/handle-response.js'
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ function formatExt (item) {
|
|
|
15
15
|
|
|
16
16
|
const boot = {
|
|
17
17
|
level: 10,
|
|
18
|
-
handler: async function (
|
|
18
|
+
handler: async function (prefix) {
|
|
19
19
|
const { importPkg, eachPlugins, importModule, runHook } = this.app.bajo
|
|
20
20
|
const { fastGlob } = this.app.lib
|
|
21
21
|
const { getPluginPrefix } = this.app.waibu
|
|
@@ -30,22 +30,22 @@ const boot = {
|
|
|
30
30
|
const reroutedPath = await importModule('waibu:/lib/webapp-scope/rerouted-path.js')
|
|
31
31
|
|
|
32
32
|
const pathPrefix = `${this.ns}/route`
|
|
33
|
-
await this.docSchemaGeneral(
|
|
33
|
+
await this.docSchemaGeneral()
|
|
34
34
|
await routeHook.call(this, this.ns)
|
|
35
|
-
await decorate.call(this
|
|
35
|
+
await decorate.call(this)
|
|
36
36
|
if (this.config.format.supported.includes('xml')) {
|
|
37
|
-
await handleXmlBody.call(this,
|
|
37
|
+
await handleXmlBody.call(this, this.config.format.xml.bodyParser)
|
|
38
38
|
}
|
|
39
|
-
await
|
|
40
|
-
await
|
|
41
|
-
await handleRateLimit.call(this,
|
|
42
|
-
await handleCors.call(this,
|
|
43
|
-
await handleHelmet.call(this,
|
|
44
|
-
await handleMultipart.call(this,
|
|
45
|
-
await handleCompress.call(this,
|
|
46
|
-
await handleResponse.call(this
|
|
47
|
-
await error.call(this
|
|
48
|
-
await runHook(`${this.ns}:beforeCreateRoutes`,
|
|
39
|
+
await this.webAppCtx.register(accepts)
|
|
40
|
+
await this.webAppCtx.register(bodyParser)
|
|
41
|
+
await handleRateLimit.call(this, this.config.rateLimit)
|
|
42
|
+
await handleCors.call(this, this.config.cors)
|
|
43
|
+
await handleHelmet.call(this, this.config.helmet)
|
|
44
|
+
await handleMultipart.call(this, this.config.multipart)
|
|
45
|
+
await handleCompress.call(this, this.config.compress)
|
|
46
|
+
await handleResponse.call(this)
|
|
47
|
+
// await error.call(this)
|
|
48
|
+
await runHook(`${this.ns}:beforeCreateRoutes`, this.webAppCtx)
|
|
49
49
|
const actions = ['find', 'get', 'create', 'update', 'remove']
|
|
50
50
|
if (this.config.enablePatch) actions.push('replace')
|
|
51
51
|
const me = this
|
|
@@ -59,11 +59,11 @@ const boot = {
|
|
|
59
59
|
]
|
|
60
60
|
const files = await fastGlob(pattern)
|
|
61
61
|
if (files.length === 0) return undefined
|
|
62
|
-
await
|
|
62
|
+
await me.webAppCtx.register(async (appCtx) => {
|
|
63
63
|
for (const file of files) {
|
|
64
64
|
const base = path.basename(file, path.extname(file))
|
|
65
65
|
const action = base === 'model-builder' ? 'routeByModelBuilder' : 'routeByVerb'
|
|
66
|
-
let mods = await routeActions[action].call(me, { file, appCtx,
|
|
66
|
+
let mods = await routeActions[action].call(me, { file, appCtx, dir, pathPrefix, ns, alias, parent: me.ns })
|
|
67
67
|
if (!Array.isArray(mods)) mods = [mods]
|
|
68
68
|
for (const mod of mods) {
|
|
69
69
|
const fullPath = appPrefix === '/' ? mod.url : (appPrefix + mod.url)
|
|
@@ -78,15 +78,15 @@ const boot = {
|
|
|
78
78
|
mod.config.pathReroutedTo = rpath
|
|
79
79
|
this.log.warn('rerouted%s%s', `${prefix}${fullPath}`, `${prefix}${rpath}`)
|
|
80
80
|
mod.url = me.config.format.asExt ? formatExt(rpath) : rpath
|
|
81
|
-
await
|
|
81
|
+
await me.webAppCtx.route(mod)
|
|
82
82
|
} else await appCtx.route(mod)
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}, { prefix: appPrefix })
|
|
86
86
|
})
|
|
87
|
-
await runHook(`${this.ns}:afterCreateRoutes`,
|
|
88
|
-
await subApp.call(this
|
|
89
|
-
await notFound.call(this
|
|
87
|
+
await runHook(`${this.ns}:afterCreateRoutes`, this.webAppCtx)
|
|
88
|
+
await subApp.call(this)
|
|
89
|
+
// await notFound.call(this)
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
package/lib/decorate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
async function buildErrResp (
|
|
1
|
+
async function buildErrResp () {
|
|
2
2
|
const { cloneDeep, merge, each, get } = this.app.lib._
|
|
3
3
|
const cfg = this.config
|
|
4
4
|
const cfgWdb = this.app.waibuDb.config
|
|
@@ -43,12 +43,12 @@ async function buildErrResp (ctx) {
|
|
|
43
43
|
props[key] = item.properties[k]
|
|
44
44
|
})
|
|
45
45
|
item.properties = props
|
|
46
|
-
await this.docSchemaLib(
|
|
46
|
+
await this.docSchemaLib(type + 'Resp', item)
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
async function buildFilter (
|
|
51
|
-
await this.docSchemaParams(
|
|
50
|
+
async function buildFilter () {
|
|
51
|
+
await this.docSchemaParams('qsFilter',
|
|
52
52
|
'query||NQL/Mongo Query. Leave empty to disable query',
|
|
53
53
|
'limit|integer|Number of records per page. Must be >= 1|' + this.app.dobo.config.default.filter.limit,
|
|
54
54
|
'page|integer|Desired page number. Must be >= 1|1',
|
|
@@ -58,22 +58,22 @@ async function buildFilter (ctx) {
|
|
|
58
58
|
)
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
async function buildFields (
|
|
62
|
-
await this.docSchemaParams(
|
|
61
|
+
async function buildFields () {
|
|
62
|
+
await this.docSchemaParams('qsFields',
|
|
63
63
|
'fields||Comma delimited fields to show. Leave empty to show all fields',
|
|
64
64
|
true
|
|
65
65
|
)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
async function buildParamsId (
|
|
69
|
-
await this.docSchemaParams(
|
|
68
|
+
async function buildParamsId () {
|
|
69
|
+
await this.docSchemaParams('paramsId', 'id||Record ID')
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
async function docSchemaGeneral (
|
|
73
|
-
await buildErrResp.call(this
|
|
74
|
-
await buildFilter.call(this
|
|
75
|
-
await buildParamsId.call(this
|
|
76
|
-
await buildFields.call(this
|
|
72
|
+
async function docSchemaGeneral () {
|
|
73
|
+
await buildErrResp.call(this)
|
|
74
|
+
await buildFilter.call(this)
|
|
75
|
+
await buildParamsId.call(this)
|
|
76
|
+
await buildFields.call(this)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export default docSchemaGeneral
|
package/lib/doc-schema/lib.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
async function docSchemaLib (
|
|
1
|
+
async function docSchemaLib (name, obj) {
|
|
2
2
|
const { merge } = this.app.lib._
|
|
3
|
-
if (
|
|
3
|
+
if (this.webAppCtx.getSchema(name)) return
|
|
4
4
|
const value = merge({}, obj, { $id: name })
|
|
5
|
-
|
|
5
|
+
this.webAppCtx.addSchema(value)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export default docSchemaLib
|
package/lib/doc-schema/model.js
CHANGED
|
@@ -46,7 +46,7 @@ async function buildPropsReqs ({ model, method, options = {} }) {
|
|
|
46
46
|
return { properties, required }
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
async function buildResponse ({
|
|
49
|
+
async function buildResponse ({ model, method, options }) {
|
|
50
50
|
const { merge, cloneDeep } = this.app.lib._
|
|
51
51
|
const { transformResult } = this.app.waibuRestApi
|
|
52
52
|
const cfgWdb = this.app.waibuDb.config
|
|
@@ -57,7 +57,7 @@ async function buildResponse ({ ctx, model, method, options }) {
|
|
|
57
57
|
for (const k of keys) {
|
|
58
58
|
const name = 'model' + model.name
|
|
59
59
|
const props = cloneDeep(properties)
|
|
60
|
-
await this.docSchemaLib(
|
|
60
|
+
await this.docSchemaLib(name, {
|
|
61
61
|
type: 'object',
|
|
62
62
|
properties: props
|
|
63
63
|
})
|
|
@@ -105,14 +105,14 @@ async function buildResponse ({ ctx, model, method, options }) {
|
|
|
105
105
|
result['2xx'].properties = transformResult({ data: merge({}, await buildData.call(this, ['oldData']), { success, statusCode }) })
|
|
106
106
|
} else if (method === 'find') {
|
|
107
107
|
result['2xx'].properties = transformResult({
|
|
108
|
-
data: await this.docSchemaForFind(
|
|
108
|
+
data: await this.docSchemaForFind({ type: 'object', properties }),
|
|
109
109
|
options: { forFind: true }
|
|
110
110
|
})
|
|
111
111
|
}
|
|
112
112
|
return result
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
async function docSchemaModel ({ model, method,
|
|
115
|
+
async function docSchemaModel ({ model, method, options = {} }) {
|
|
116
116
|
const mdl = this.app.dobo.getModel(model)
|
|
117
117
|
const { omit } = this.app.lib._
|
|
118
118
|
const out = {
|
|
@@ -130,7 +130,7 @@ async function docSchemaModel ({ model, method, ctx, options = {} }) {
|
|
|
130
130
|
const { properties } = await buildPropsReqs.call(this, { model: mdl, method, options })
|
|
131
131
|
const name = 'model' + mdl.name + 'Update'
|
|
132
132
|
delete properties._rel
|
|
133
|
-
await this.docSchemaLib(
|
|
133
|
+
await this.docSchemaLib(name, {
|
|
134
134
|
type: 'object',
|
|
135
135
|
properties: omit(properties, ['id'])
|
|
136
136
|
})
|
|
@@ -140,7 +140,7 @@ async function docSchemaModel ({ model, method, ctx, options = {} }) {
|
|
|
140
140
|
const { properties, required } = await buildPropsReqs.call(this, { model: mdl, method, options })
|
|
141
141
|
const name = 'model' + model.name + 'Replace'
|
|
142
142
|
delete properties._rel
|
|
143
|
-
await this.docSchemaLib(
|
|
143
|
+
await this.docSchemaLib(name, {
|
|
144
144
|
type: 'object',
|
|
145
145
|
properties: omit(properties, ['id']),
|
|
146
146
|
required
|
|
@@ -151,7 +151,7 @@ async function docSchemaModel ({ model, method, ctx, options = {} }) {
|
|
|
151
151
|
const { properties, required } = await buildPropsReqs.call(this, { model: mdl, method, options })
|
|
152
152
|
const name = 'model' + model.name + 'Create'
|
|
153
153
|
delete properties._rel
|
|
154
|
-
await this.docSchemaLib(
|
|
154
|
+
await this.docSchemaLib(name, {
|
|
155
155
|
type: 'object',
|
|
156
156
|
properties,
|
|
157
157
|
required
|
|
@@ -159,7 +159,7 @@ async function docSchemaModel ({ model, method, ctx, options = {} }) {
|
|
|
159
159
|
out.body = { $ref: name + '#' }
|
|
160
160
|
out.querystring = { $ref: 'qsFields#' }
|
|
161
161
|
}
|
|
162
|
-
out.response = await buildResponse.call(this, {
|
|
162
|
+
out.response = await buildResponse.call(this, { model: mdl, method, options })
|
|
163
163
|
return out
|
|
164
164
|
}
|
|
165
165
|
|
package/lib/doc-schema/params.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
async function docSchemaParams (
|
|
1
|
+
async function docSchemaParams (paramName, ...args) {
|
|
2
2
|
const { each, isEmpty, keys, last, isBoolean } = this.app.lib._
|
|
3
3
|
const cfgWeb = this.app.waibu.getConfig()
|
|
4
4
|
let transform = false
|
|
@@ -22,7 +22,7 @@ async function docSchemaParams (ctx, paramName, ...args) {
|
|
|
22
22
|
delete item.properties[k]
|
|
23
23
|
})
|
|
24
24
|
}
|
|
25
|
-
if (!isEmpty(args)) await this.docSchemaLib(
|
|
25
|
+
if (!isEmpty(args)) await this.docSchemaLib(paramName, item)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export default docSchemaParams
|
package/lib/doc-schema/qs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
async function docSchemaQs (
|
|
1
|
+
async function docSchemaQs (paramName, ...args) {
|
|
2
2
|
const { each, isEmpty } = this.app.lib._
|
|
3
3
|
const item = {
|
|
4
4
|
type: 'object',
|
|
@@ -9,7 +9,7 @@ async function docSchemaQs (ctx, paramName, ...args) {
|
|
|
9
9
|
if (isEmpty(type)) type = 'string'
|
|
10
10
|
item.properties[name] = { type, description: this.t(description) }
|
|
11
11
|
})
|
|
12
|
-
if (!isEmpty(args)) await this.docSchemaLib(
|
|
12
|
+
if (!isEmpty(args)) await this.docSchemaLib(paramName, item)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default docSchemaQs
|
package/lib/error.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { handler } from './not-found.js'
|
|
2
2
|
|
|
3
|
-
const extHandler = async function (err, req, reply
|
|
3
|
+
const extHandler = async function (err, req, reply) {
|
|
4
4
|
err.statusCode = err.statusCode ?? 500
|
|
5
5
|
const msg = err.message
|
|
6
6
|
if (msg === '_notFound' || err.statusCode === 404) {
|
|
7
|
-
return handler.call(this, req, reply
|
|
7
|
+
return handler.call(this, req, reply)
|
|
8
8
|
}
|
|
9
|
-
const data =
|
|
9
|
+
const data = this.webAppCtx.httpErrors.createError(err.statusCode, msg)
|
|
10
10
|
data.statusCode = err.statusCode
|
|
11
11
|
data.details = err.details
|
|
12
12
|
return this.transformResult({ data, req, reply })
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async function error (
|
|
15
|
+
async function error () {
|
|
16
16
|
const { importModule } = this.app.bajo
|
|
17
17
|
const errorHandler = await importModule('waibu:/lib/webapp-scope/error-handler.js')
|
|
18
|
-
await errorHandler.call(this,
|
|
18
|
+
await errorHandler.call(this, extHandler)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export default error
|
package/lib/handle-response.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import xml from './handle-response/xml.js'
|
|
2
2
|
|
|
3
|
-
async function handleResponse (
|
|
3
|
+
async function handleResponse () {
|
|
4
4
|
const me = this
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
this.webAppCtx.addHook('onSend', async function (req, reply, payload) {
|
|
7
7
|
let type = req.params.format
|
|
8
8
|
if (!type) {
|
|
9
9
|
const types = req.accepts().types()
|
package/lib/not-found.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export function handler (req, reply
|
|
1
|
+
export function handler (req, reply) {
|
|
2
2
|
const msg = this.t('routeNotFound%s%s', req.url, req.method)
|
|
3
|
-
const data =
|
|
3
|
+
const data = this.webAppCtx.httpErrors.createError(404, msg)
|
|
4
4
|
return this.transformResult({ data, req, reply })
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
async function notFound (
|
|
7
|
+
async function notFound () {
|
|
8
8
|
const me = this
|
|
9
|
-
await
|
|
10
|
-
return handler.call(me, req, reply
|
|
9
|
+
await this.webAppCtx.setNotFoundHandler(async function (req, reply) {
|
|
10
|
+
return handler.call(me, req, reply)
|
|
11
11
|
})
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
import serveRoute from './serve-route.js'
|
|
3
3
|
|
|
4
|
-
async function routeByModelBuilder ({ file,
|
|
4
|
+
async function routeByModelBuilder ({ file, dir, pathPrefix, ns, parent }) {
|
|
5
5
|
const { readConfig } = this.app.bajo
|
|
6
6
|
const { parseObject } = this.app.lib
|
|
7
7
|
const { isSet } = this.app.lib.aneka
|
|
@@ -22,7 +22,7 @@ async function routeByModelBuilder ({ file, ctx, dir, pathPrefix, ns, parent })
|
|
|
22
22
|
if (disabled) continue
|
|
23
23
|
const mod = omit(builder, ['model', 'url', 'method', 'handler', 'hidden', ...methods])
|
|
24
24
|
const customMod = builder[method] ?? {}
|
|
25
|
-
if (!customMod.schema) customMod.schema = await this.docSchemaModel({ model: builder.model, method,
|
|
25
|
+
if (!customMod.schema) customMod.schema = await this.docSchemaModel({ model: builder.model, method, options: { hidden: builder.hidden } })
|
|
26
26
|
let mapmethod = methodMap[method]
|
|
27
27
|
if (this.config.enablePatch) {
|
|
28
28
|
if (method === 'replace') mapmethod = 'PUT'
|
|
@@ -44,7 +44,7 @@ async function routeByModelBuilder ({ file, ctx, dir, pathPrefix, ns, parent })
|
|
|
44
44
|
options.queryHandler = builder.queryHandler
|
|
45
45
|
if (method === 'replace') options.partial = false
|
|
46
46
|
if (['get', 'remove', 'update'].includes(method)) options.throwNotFound = true
|
|
47
|
-
const data = await helper({ model: builder.model, req, reply,
|
|
47
|
+
const data = await helper({ model: builder.model, req, reply, options })
|
|
48
48
|
data.success = true
|
|
49
49
|
data.statusCode = method === 'create' ? 201 : 200
|
|
50
50
|
if (method === 'find') options.forFind = true
|
|
@@ -71,7 +71,7 @@ async function routeByModelBuilder ({ file, ctx, dir, pathPrefix, ns, parent })
|
|
|
71
71
|
const helper = me.app.waibuDb[camelCase(`create ${req.params.stat}`)]
|
|
72
72
|
if (!helper) throw this.error('_notFound')
|
|
73
73
|
const options = { queryHandler: builder.queryHandler }
|
|
74
|
-
const data = await helper({ model: builder.model, req, reply,
|
|
74
|
+
const data = await helper({ model: builder.model, req, reply, options })
|
|
75
75
|
data.success = true
|
|
76
76
|
data.statusCode = method === 'create' ? 201 : 200
|
|
77
77
|
options.forFind = true
|
package/lib/route-by-verb.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
import serveRoute from './serve-route.js'
|
|
3
3
|
|
|
4
|
-
async function routeByVerb ({ file,
|
|
4
|
+
async function routeByVerb ({ file, appCtx, dir, pathPrefix, ns, alias, parent }) {
|
|
5
5
|
const { importModule } = this.app.bajo
|
|
6
6
|
const { parseObject } = this.app.lib
|
|
7
7
|
const { isSet } = this.app.lib.aneka
|
|
@@ -18,7 +18,7 @@ async function routeByVerb ({ file, ctx, appCtx, dir, pathPrefix, ns, alias, par
|
|
|
18
18
|
}
|
|
19
19
|
let mod = await importModule(file)
|
|
20
20
|
if (isFunction(mod)) {
|
|
21
|
-
if (mod.length <= 1) mod = await mod.call(this
|
|
21
|
+
if (mod.length <= 1) mod = await mod.call(this)
|
|
22
22
|
else mod = { handler: mod }
|
|
23
23
|
}
|
|
24
24
|
mod.url = mod.url ?? url
|
|
@@ -40,7 +40,7 @@ async function routeByVerb ({ file, ctx, appCtx, dir, pathPrefix, ns, alias, par
|
|
|
40
40
|
$ref: '5xxResp#'
|
|
41
41
|
}
|
|
42
42
|
if (action === 'find') defSchema.querystring = { $ref: 'qsFilter#' }
|
|
43
|
-
if (isFunction(mod.schema)) mod.schema = await mod.schema.call(this, appCtx
|
|
43
|
+
if (isFunction(mod.schema)) mod.schema = await mod.schema.call(this, appCtx)
|
|
44
44
|
mod.schema = merge({}, defSchema, mod.schema ?? {})
|
|
45
45
|
const oldHandler = mod.handler
|
|
46
46
|
mod.handler = async function (req, reply) {
|
package/lib/sub-app.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
async function subApp (
|
|
1
|
+
async function subApp () {
|
|
2
2
|
const { importModule, runHook } = this.app.bajo
|
|
3
|
-
const { collect } = await importModule('waibu:/lib/app.js', { asDefaultImport: false })
|
|
3
|
+
const { collect } = await importModule('waibu:/lib/web-app.js', { asDefaultImport: false })
|
|
4
4
|
const mods = await collect.call(this.app[this.ns], 'boot.js', 'waibuRestApi')
|
|
5
5
|
for (const m of mods) {
|
|
6
6
|
this.log.debug('bootSubApp%s', m.ns)
|
|
7
|
-
await
|
|
7
|
+
await this.webAppCtx.register(async (subCtx) => {
|
|
8
8
|
this.app[m.ns].instance = subCtx
|
|
9
9
|
await runHook(`${this.ns}.${m.alias}:afterCreateContext`, subCtx)
|
|
10
10
|
await m.handler.call(this.app[m.ns], subCtx, m.prefix)
|
package/package.json
CHANGED