bajo 1.2.0 → 1.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.
- package/boot/class/bajo-core.js +22 -2
- package/package.json +1 -1
package/boot/class/bajo-core.js
CHANGED
|
@@ -106,11 +106,31 @@ class BajoCore extends Plugin {
|
|
|
106
106
|
}
|
|
107
107
|
if (!this.app[ns]) throw this.error('unknownPluginOrNotLoaded%s')
|
|
108
108
|
}
|
|
109
|
-
const fullPath = path
|
|
110
109
|
let qs
|
|
111
110
|
[path, qs] = path.split('?')
|
|
112
111
|
qs = querystring.parse(qs) ?? {}
|
|
113
|
-
|
|
112
|
+
// normalize path
|
|
113
|
+
const parts = path.split('/')
|
|
114
|
+
const realParts = []
|
|
115
|
+
const params = {}
|
|
116
|
+
for (const idx in parts) {
|
|
117
|
+
const part = parts[idx]
|
|
118
|
+
if (part[0] !== ':' || part.indexOf('|') === -1) {
|
|
119
|
+
realParts.push(part)
|
|
120
|
+
continue
|
|
121
|
+
}
|
|
122
|
+
const [key, val] = part.split('|')
|
|
123
|
+
parts[idx] = key
|
|
124
|
+
params[key.slice(1)] = val
|
|
125
|
+
realParts.push(val)
|
|
126
|
+
}
|
|
127
|
+
path = parts.join('/')
|
|
128
|
+
const realPath = realParts.join('/')
|
|
129
|
+
let fullPath = path
|
|
130
|
+
if (!isEmpty(qs)) fullPath += ('?' + querystring.stringify(qs))
|
|
131
|
+
let realFullPath = realPath
|
|
132
|
+
if (!isEmpty(qs)) realFullPath += ('?' + querystring.stringify(qs))
|
|
133
|
+
return { ns, path, subNs, subSubNs, qs, fullPath, fullNs, realPath, realFullPath }
|
|
114
134
|
}
|
|
115
135
|
|
|
116
136
|
buildCollections = async (options = {}) => {
|