silgi 0.16.2 → 0.16.3
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/dist/_chunks/index.mjs
CHANGED
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getQuery, H3Error, readBody } from "h3";
|
|
2
|
-
import { silgi, SilgiError, useSilgi } from "silgi/core";
|
|
2
|
+
import { ErrorFactory, HttpStatus, parseURI, silgi, SilgiError, useSilgi } from "silgi/core";
|
|
3
3
|
export default async function addNitroApp(silgiCtx = useSilgi()) {
|
|
4
4
|
const nitro = silgiCtx.framework;
|
|
5
5
|
nitro.router.use("/srn/**", defineEventHandler(async (event) => {
|
|
@@ -13,9 +13,14 @@ export default async function addNitroApp(silgiCtx = useSilgi()) {
|
|
|
13
13
|
} else {
|
|
14
14
|
newPath = `${event.path}?method=${event.method}`;
|
|
15
15
|
}
|
|
16
|
+
const operation = parseURI(newPath, silgiCtx.uris);
|
|
17
|
+
if (!operation) {
|
|
18
|
+
throw ErrorFactory.create({ message: "Invalid URI", httpStatus: HttpStatus.BAD_REQUEST });
|
|
19
|
+
}
|
|
16
20
|
await silgiCtx.callHook("event:init", event, {
|
|
17
21
|
path: newPath,
|
|
18
|
-
queryParams: query
|
|
22
|
+
queryParams: query,
|
|
23
|
+
operation
|
|
19
24
|
});
|
|
20
25
|
const data = await silgiConnect.execute(newPath, {
|
|
21
26
|
...body
|
package/dist/types/index.d.mts
CHANGED
package/dist/types/index.d.ts
CHANGED