silgi 0.10.6 → 0.10.8

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.10.6";
1
+ const version = "0.10.8";
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.10.6";
1
+ const version = "0.10.8";
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.10.6";
1
+ const version = "0.10.8";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1,3 +1,4 @@
1
+ import { consola } from "consola";
1
2
  import { createError, defineEventHandler, getQuery, H3Error, readBody } from "h3";
2
3
  import { silgi, SilgiError, useSilgi } from "silgi/core";
3
4
  export default async function addNitroApp(silgiCtx = useSilgi()) {
@@ -22,13 +23,7 @@ export default async function addNitroApp(silgiCtx = useSilgi()) {
22
23
  }
23
24
  } catch (error) {
24
25
  if (error instanceof H3Error) {
25
- throw createError({
26
- statusCode: error.statusCode,
27
- message: error.message,
28
- data: error.data
29
- // unhandled: false,
30
- // fatal: false,
31
- });
26
+ throw error;
32
27
  }
33
28
  if (SilgiError.isError(error)) {
34
29
  throw createError({
@@ -42,6 +37,11 @@ export default async function addNitroApp(silgiCtx = useSilgi()) {
42
37
  }
43
38
  });
44
39
  }
40
+ consola.withTag("silgi/nitro/srn").error(error);
41
+ throw createError({
42
+ statusCode: 500,
43
+ message: "Internal Server Error"
44
+ });
45
45
  }
46
46
  }));
47
47
  }
@@ -9,7 +9,7 @@ export function createSilgiFetch(options, localFetch) {
9
9
  method: opts?.method || "get"
10
10
  };
11
11
  const $fetch = getFetch(url, finalOpts, localFetch);
12
- return $fetch(fillPath(url, opts.params), finalOpts);
12
+ return $fetch(fillPath(url, opts?.params), finalOpts);
13
13
  };
14
14
  }
15
15
  export function silgi$fetch(url, opts) {
@@ -18,7 +18,7 @@ export function silgi$fetch(url, opts) {
18
18
  method: opts?.method || "get"
19
19
  };
20
20
  const $fetch = getFetch(url, finalOpts);
21
- return $fetch(fillPath(url, opts.params), finalOpts);
21
+ return $fetch(fillPath(url, opts?.params), finalOpts);
22
22
  }
23
23
  function getFetch(url, opts, localFetch) {
24
24
  if (import.meta.server && localFetch) {
@@ -29,16 +29,15 @@ function getFetch(url, opts, localFetch) {
29
29
  return globalThis.$fetch;
30
30
  }
31
31
  function fillPath(path, params) {
32
- if (!params) {
33
- if (path.includes(":"))
34
- throw new Error("Parametreler dogru kullanmal\u0131s\u0131n\u0131z");
32
+ if (!params || Object.keys(params).length === 0) {
35
33
  return path;
36
34
  }
37
- if (!path.includes(":"))
38
- throw new Error("Path parametler : ile belirtilmelidir");
39
35
  let result = path;
40
36
  for (const [key, value] of Object.entries(params)) {
41
- result = result.replace(`:${key}`, value);
37
+ const pattern = `:${key}`;
38
+ if (result.includes(pattern)) {
39
+ result = result.replace(pattern, value);
40
+ }
42
41
  }
43
42
  return result;
44
43
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.10.6",
4
+ "version": "0.10.8",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -133,7 +133,7 @@
133
133
  "knitwork": "^1.2.0",
134
134
  "mlly": "^1.7.4",
135
135
  "ofetch": "^1.4.1",
136
- "ohash": "^2.0.8",
136
+ "ohash": "^2.0.9",
137
137
  "pathe": "^2.0.3",
138
138
  "picocolors": "^1.1.1",
139
139
  "pkg-types": "^2.0.1",
@@ -147,7 +147,7 @@
147
147
  "untyped": "^2.0.0"
148
148
  },
149
149
  "devDependencies": {
150
- "@antfu/eslint-config": "^4.3.0",
150
+ "@antfu/eslint-config": "^4.4.0",
151
151
  "@nuxt/kit": "^3.15.4",
152
152
  "@nuxt/schema": "^3.15.4",
153
153
  "@types/node": "^22.13.8",