silgi 0.16.1 → 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.
@@ -1,4 +1,4 @@
1
- const version = "0.16.1";
1
+ const version = "0.16.3";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1715,12 +1715,12 @@ async function prepareCoreFile(data, frameworkContext, silgi) {
1715
1715
  " schemas: schemas as any,",
1716
1716
  " uris,",
1717
1717
  " modulesURIs,",
1718
- " routeRules: routeRules as any,",
1719
1718
  ` plugins: [${plugins.join(", ")}],`,
1720
1719
  _data._silgiConfigs.length > 0 ? ` ${_data._silgiConfigs.map((config) => typeof config === "string" ? config : typeof config === "object" ? Object.entries(config).map(([key, value]) => `${key}: ${value}`).join(",\n ") : "").join(",\n ")},` : "",
1721
1720
  " options: mergeDeep(",
1722
1721
  " {",
1723
1722
  " runtimeConfig: {} as SilgiRuntimeOptions,",
1723
+ " routeRules: routeRules as any,",
1724
1724
  " },",
1725
1725
  " moduleOptions || {},",
1726
1726
  " {",
@@ -1,4 +1,4 @@
1
- const version = "0.16.1";
1
+ const version = "0.16.3";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1,4 +1,4 @@
1
- const version = "0.16.1";
1
+ const version = "0.16.3";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -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
@@ -1043,6 +1043,7 @@ interface SilgiRuntimeHooks {
1043
1043
  'event:init': (event: SilgiEvents, data: {
1044
1044
  path: string;
1045
1045
  queryParams?: Record<string, string>;
1046
+ operation: SilgiOperation;
1046
1047
  }) => HookResult;
1047
1048
  'error': CaptureError;
1048
1049
  }
@@ -1043,6 +1043,7 @@ interface SilgiRuntimeHooks {
1043
1043
  'event:init': (event: SilgiEvents, data: {
1044
1044
  path: string;
1045
1045
  queryParams?: Record<string, string>;
1046
+ operation: SilgiOperation;
1046
1047
  }) => HookResult;
1047
1048
  'error': CaptureError;
1048
1049
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.16.1",
4
+ "version": "0.16.3",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {