silgi 0.3.2 → 0.3.4

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,7 +1,7 @@
1
1
  import * as unstorage from 'unstorage';
2
2
  import * as net from 'net';
3
3
  import * as consola from 'consola';
4
- import { D as DeepPartial, S as SilgiOptions, a as SilgiModuleOptions } from '../shared/silgi.Bv3UrLx7.mjs';
4
+ import { D as DeepPartial, S as SilgiOptions, a as SilgiModuleOptions } from '../shared/silgi.ClpvycKI.mjs';
5
5
  import 'hookable';
6
6
  import 'ignore';
7
7
  import '@standard-schema/spec';
@@ -1,7 +1,7 @@
1
1
  import * as unstorage from 'unstorage';
2
2
  import * as net from 'net';
3
3
  import * as consola from 'consola';
4
- import { D as DeepPartial, S as SilgiOptions, a as SilgiModuleOptions } from '../shared/silgi.Bv3UrLx7.js';
4
+ import { D as DeepPartial, S as SilgiOptions, a as SilgiModuleOptions } from '../shared/silgi.ClpvycKI.js';
5
5
  import 'hookable';
6
6
  import 'ignore';
7
7
  import '@standard-schema/spec';
@@ -3,7 +3,7 @@ import consola from 'consola';
3
3
 
4
4
  const name = "silgi";
5
5
  const type = "module";
6
- const version = "0.3.2";
6
+ const version = "0.3.4";
7
7
  const packageManager = "pnpm@9.15.1";
8
8
  const sideEffects = false;
9
9
  const exports = {
@@ -69,6 +69,8 @@ const scripts = {
69
69
  };
70
70
  const peerDependencies = {
71
71
  "@nuxt/kit": "^3.15.3",
72
+ nitropack: "^2.10.4",
73
+ nuxt: "^3.15.3",
72
74
  typescript: "^5.7.3",
73
75
  zod: "^3.24.1"
74
76
  };
@@ -76,6 +78,12 @@ const peerDependenciesMeta = {
76
78
  "@nuxt/kit": {
77
79
  optional: true
78
80
  },
81
+ nitropack: {
82
+ optional: true
83
+ },
84
+ nuxt: {
85
+ optional: true
86
+ },
79
87
  zod: {
80
88
  optional: true
81
89
  }
@@ -98,7 +106,6 @@ const dependencies = {
98
106
  jiti: "^2.4.2",
99
107
  klona: "^2.0.6",
100
108
  mlly: "^1.7.4",
101
- nitropack: "^2.10.4",
102
109
  ofetch: "^1.4.1",
103
110
  pathe: "^2.0.2",
104
111
  "pkg-types": "^1.3.1",
@@ -117,6 +124,8 @@ const devDependencies = {
117
124
  "@nuxt/kit": "^3.15.3",
118
125
  "@types/node": "^22.10.7",
119
126
  "@types/semver": "^7.5.8",
127
+ nitropack: "^2.10.4",
128
+ nuxt: "^3.15.3",
120
129
  unbuild: "^3.3.1",
121
130
  vitest: "^3.0.3",
122
131
  zod: "^3.24.1"
@@ -0,0 +1,10 @@
1
+ import type { SilgiRouterTypes } from '../../../../src/types/global';
2
+ import { type UseFetchOptions } from 'nuxt/app';
3
+ export declare function useSilgiFetch<Route extends keyof SilgiRouterTypes, Method extends Extract<keyof SilgiRouterTypes[Route], string>>(url: Route | (() => Route), options?: Omit<UseFetchOptions<SilgiRouterTypes[Route][Method] extends {
4
+ output: any;
5
+ } ? SilgiRouterTypes[Route][Method]['output'] : any, any, any, any, Route>, 'method' | 'body'> & {
6
+ method?: Method;
7
+ body?: SilgiRouterTypes[Route][Method] extends {
8
+ input: any;
9
+ } ? SilgiRouterTypes[Route][Method]['input'] : never;
10
+ }): import("nuxt/app").AsyncData<any, import("ofetch").FetchError<any> | null>;
@@ -0,0 +1,7 @@
1
+ import { useFetch } from "nuxt/app";
2
+ export function useSilgiFetch(url, options) {
3
+ return useFetch(url, {
4
+ ...options,
5
+ method: options?.method?.toUpperCase() ?? "GET"
6
+ });
7
+ }
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as SilgiConfig, c as SilgiHelper, d as SilgiRouterTypes, M as ModuleOptions, e as ModuleDefinition, f as SilgiModule, B as BaseSchemaType, g as SilgiServiceInterface, h as DefaultNamespaces, i as Silgi, j as SilgiOperation, k as MergedSilgiSchema, l as ServiceType, m as SilgiSchema, R as RequiredServiceType, n as SilgiModuleShared } from './shared/silgi.Bv3UrLx7.mjs';
2
- export { F as Awaitable, G as CreateScope, D as DeepPartial, C as DefaultHooks, A as DefaultMethods, E as ExtendShared, u as ExtractInputFromURI, v as ExtractOutputFromURI, w as ExtractRouterParamsFromURI, s as SilgiDefaultShared, o as SilgiEvent, z as SilgiHook, p as SilgiModuleMethods, a as SilgiModuleOptions, q as SilgiModules, r as SilgiNamespaces, S as SilgiOptions, x as SilgiStorageBase, t as SilgiURIs, U as URIsTypes, y as silgi } from './shared/silgi.Bv3UrLx7.mjs';
1
+ import { b as SilgiConfig, c as SilgiHelper, d as SilgiRouterTypes, M as ModuleOptions, e as ModuleDefinition, f as SilgiModule, B as BaseSchemaType, g as SilgiServiceInterface, h as DefaultNamespaces, i as Silgi, j as SilgiOperation, k as MergedSilgiSchema, l as ServiceType, m as SilgiSchema, R as RequiredServiceType, n as SilgiModuleShared } from './shared/silgi.ClpvycKI.mjs';
2
+ export { F as Awaitable, G as CreateScope, D as DeepPartial, C as DefaultHooks, A as DefaultMethods, E as ExtendShared, u as ExtractInputFromURI, v as ExtractOutputFromURI, w as ExtractRouterParamsFromURI, s as SilgiDefaultShared, o as SilgiEvent, z as SilgiHook, p as SilgiModuleMethods, a as SilgiModuleOptions, q as SilgiModules, r as SilgiNamespaces, S as SilgiOptions, x as SilgiStorageBase, t as SilgiURIs, U as URIsTypes, y as silgi } from './shared/silgi.ClpvycKI.mjs';
3
3
  import { FetchOptions } from 'ofetch';
4
4
  import { StandardSchemaV1 } from '@standard-schema/spec';
5
5
  import * as unctx_index from 'unctx/index';
@@ -58,15 +58,17 @@ declare class SilgiError extends Error {
58
58
  type RequestBodyOption<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
59
59
  input: any;
60
60
  } ? {
61
- body: SilgiRouterTypes[Route][Method]['input'];
61
+ body?: SilgiRouterTypes[Route][Method]['input'];
62
62
  } : {
63
63
  body?: never;
64
64
  };
65
- type DefaultMethod<Route extends keyof SilgiRouterTypes> = 'get' extends keyof SilgiRouterTypes[Route] ? 'get' : keyof SilgiRouterTypes[Route];
66
- type OpenFetchOptions<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>> = Partial<{
67
- method: Method;
68
- }> & RequestBodyOption<Route, Method> & Omit<FetchOptions, 'query' | 'body' | 'method'>;
69
- type SilgiFetchClient = <Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>>(url: Route, options?: OpenFetchOptions<Route, Method>) => Promise<SilgiRouterTypes[Route][Method]['output']>;
65
+ type DefaultMethod<Route extends keyof SilgiRouterTypes> = keyof SilgiRouterTypes[Route];
66
+ type SilgiFetchOptions<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = keyof SilgiRouterTypes[Route]> = {
67
+ method?: Method;
68
+ } & RequestBodyOption<Route, Method> & Omit<FetchOptions, 'query' | 'body' | 'method'>;
69
+ type SilgiFetchClient = <Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>>(url: Route, options?: SilgiFetchOptions<Route, Method>) => Promise<SilgiRouterTypes[Route][Method] extends {
70
+ output: any;
71
+ } ? SilgiRouterTypes[Route][Method]['output'] : any>;
70
72
  declare function createSilgiFetch(options: FetchOptions | ((options: FetchOptions) => FetchOptions), localFetch?: typeof globalThis.$fetch): SilgiFetchClient;
71
73
 
72
74
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as SilgiConfig, c as SilgiHelper, d as SilgiRouterTypes, M as ModuleOptions, e as ModuleDefinition, f as SilgiModule, B as BaseSchemaType, g as SilgiServiceInterface, h as DefaultNamespaces, i as Silgi, j as SilgiOperation, k as MergedSilgiSchema, l as ServiceType, m as SilgiSchema, R as RequiredServiceType, n as SilgiModuleShared } from './shared/silgi.Bv3UrLx7.js';
2
- export { F as Awaitable, G as CreateScope, D as DeepPartial, C as DefaultHooks, A as DefaultMethods, E as ExtendShared, u as ExtractInputFromURI, v as ExtractOutputFromURI, w as ExtractRouterParamsFromURI, s as SilgiDefaultShared, o as SilgiEvent, z as SilgiHook, p as SilgiModuleMethods, a as SilgiModuleOptions, q as SilgiModules, r as SilgiNamespaces, S as SilgiOptions, x as SilgiStorageBase, t as SilgiURIs, U as URIsTypes, y as silgi } from './shared/silgi.Bv3UrLx7.js';
1
+ import { b as SilgiConfig, c as SilgiHelper, d as SilgiRouterTypes, M as ModuleOptions, e as ModuleDefinition, f as SilgiModule, B as BaseSchemaType, g as SilgiServiceInterface, h as DefaultNamespaces, i as Silgi, j as SilgiOperation, k as MergedSilgiSchema, l as ServiceType, m as SilgiSchema, R as RequiredServiceType, n as SilgiModuleShared } from './shared/silgi.ClpvycKI.js';
2
+ export { F as Awaitable, G as CreateScope, D as DeepPartial, C as DefaultHooks, A as DefaultMethods, E as ExtendShared, u as ExtractInputFromURI, v as ExtractOutputFromURI, w as ExtractRouterParamsFromURI, s as SilgiDefaultShared, o as SilgiEvent, z as SilgiHook, p as SilgiModuleMethods, a as SilgiModuleOptions, q as SilgiModules, r as SilgiNamespaces, S as SilgiOptions, x as SilgiStorageBase, t as SilgiURIs, U as URIsTypes, y as silgi } from './shared/silgi.ClpvycKI.js';
3
3
  import { FetchOptions } from 'ofetch';
4
4
  import { StandardSchemaV1 } from '@standard-schema/spec';
5
5
  import * as unctx_index from 'unctx/index';
@@ -58,15 +58,17 @@ declare class SilgiError extends Error {
58
58
  type RequestBodyOption<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
59
59
  input: any;
60
60
  } ? {
61
- body: SilgiRouterTypes[Route][Method]['input'];
61
+ body?: SilgiRouterTypes[Route][Method]['input'];
62
62
  } : {
63
63
  body?: never;
64
64
  };
65
- type DefaultMethod<Route extends keyof SilgiRouterTypes> = 'get' extends keyof SilgiRouterTypes[Route] ? 'get' : keyof SilgiRouterTypes[Route];
66
- type OpenFetchOptions<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>> = Partial<{
67
- method: Method;
68
- }> & RequestBodyOption<Route, Method> & Omit<FetchOptions, 'query' | 'body' | 'method'>;
69
- type SilgiFetchClient = <Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>>(url: Route, options?: OpenFetchOptions<Route, Method>) => Promise<SilgiRouterTypes[Route][Method]['output']>;
65
+ type DefaultMethod<Route extends keyof SilgiRouterTypes> = keyof SilgiRouterTypes[Route];
66
+ type SilgiFetchOptions<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = keyof SilgiRouterTypes[Route]> = {
67
+ method?: Method;
68
+ } & RequestBodyOption<Route, Method> & Omit<FetchOptions, 'query' | 'body' | 'method'>;
69
+ type SilgiFetchClient = <Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>>(url: Route, options?: SilgiFetchOptions<Route, Method>) => Promise<SilgiRouterTypes[Route][Method] extends {
70
+ output: any;
71
+ } ? SilgiRouterTypes[Route][Method]['output'] : any>;
70
72
  declare function createSilgiFetch(options: FetchOptions | ((options: FetchOptions) => FetchOptions), localFetch?: typeof globalThis.$fetch): SilgiFetchClient;
71
73
 
72
74
  /**
@@ -81,6 +81,7 @@ interface DefaultMethods {
81
81
  post: string;
82
82
  put: string;
83
83
  delete: string;
84
+ [key: string]: string;
84
85
  }
85
86
  interface DefaultMethods {
86
87
  get: string;
@@ -81,6 +81,7 @@ interface DefaultMethods {
81
81
  post: string;
82
82
  put: string;
83
83
  delete: string;
84
+ [key: string]: string;
84
85
  }
85
86
  interface DefaultMethods {
86
87
  get: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.3.2",
4
+ "version": "0.3.4",
5
5
  "sideEffects": false,
6
6
  "exports": {
7
7
  ".": {
@@ -52,6 +52,8 @@
52
52
  ],
53
53
  "peerDependencies": {
54
54
  "@nuxt/kit": "^3.15.3",
55
+ "nitropack": "^2.10.4",
56
+ "nuxt": "^3.15.3",
55
57
  "typescript": "^5.7.3",
56
58
  "zod": "^3.24.1"
57
59
  },
@@ -59,6 +61,12 @@
59
61
  "@nuxt/kit": {
60
62
  "optional": true
61
63
  },
64
+ "nitropack": {
65
+ "optional": true
66
+ },
67
+ "nuxt": {
68
+ "optional": true
69
+ },
62
70
  "zod": {
63
71
  "optional": true
64
72
  }
@@ -81,7 +89,6 @@
81
89
  "jiti": "^2.4.2",
82
90
  "klona": "^2.0.6",
83
91
  "mlly": "^1.7.4",
84
- "nitropack": "^2.10.4",
85
92
  "ofetch": "^1.4.1",
86
93
  "pathe": "^2.0.2",
87
94
  "pkg-types": "^1.3.1",
@@ -100,6 +107,8 @@
100
107
  "@nuxt/kit": "^3.15.3",
101
108
  "@types/node": "^22.10.7",
102
109
  "@types/semver": "^7.5.8",
110
+ "nitropack": "^2.10.4",
111
+ "nuxt": "^3.15.3",
103
112
  "unbuild": "^3.3.1",
104
113
  "vitest": "^3.0.3",
105
114
  "zod": "^3.24.1"