silgi 0.3.13 → 0.4.0

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.
Files changed (69) hide show
  1. package/README.md +1 -31
  2. package/cli.d.ts +1 -0
  3. package/config.d.ts +1 -0
  4. package/core.d.ts +1 -0
  5. package/dist/_chunks/index.mjs +233 -0
  6. package/dist/cli/compatibility.mjs +42 -0
  7. package/dist/cli/index.mjs +3 -184
  8. package/dist/cli/prepare.mjs +1346 -0
  9. package/dist/config/index.d.mts +5 -0
  10. package/dist/config/index.d.ts +5 -0
  11. package/dist/core/index.d.mts +136 -0
  12. package/dist/core/index.d.ts +136 -0
  13. package/dist/core/index.mjs +1444 -0
  14. package/dist/ecosystem/nitro/index.mjs +21 -29
  15. package/dist/ecosystem/nuxt/module.mjs +4 -25
  16. package/dist/kit/index.d.mts +90 -0
  17. package/dist/kit/index.d.ts +90 -0
  18. package/dist/kit/index.mjs +316 -0
  19. package/dist/meta/index.d.mts +3 -0
  20. package/dist/meta/index.d.ts +3 -0
  21. package/dist/meta/index.mjs +1 -0
  22. package/dist/presets/_all.gen.d.ts +2 -0
  23. package/dist/presets/_all.gen.mjs +8 -0
  24. package/dist/presets/_resolve.d.ts +8 -0
  25. package/dist/presets/_resolve.mjs +58 -0
  26. package/dist/presets/_types.gen.d.ts +5 -0
  27. package/dist/presets/_types.gen.mjs +1 -0
  28. package/dist/presets/h3/preset.d.ts +2 -0
  29. package/dist/presets/h3/preset.mjs +22 -0
  30. package/dist/presets/index.d.mts +1 -0
  31. package/dist/presets/index.d.ts +2 -0
  32. package/dist/presets/index.mjs +1 -0
  33. package/dist/presets/nitro/preset.d.ts +2 -0
  34. package/dist/presets/nitro/preset.mjs +26 -0
  35. package/dist/presets/npmpackage/preset.d.ts +2 -0
  36. package/dist/presets/npmpackage/preset.mjs +23 -0
  37. package/dist/runtime/index.d.ts +1 -0
  38. package/dist/runtime/index.mjs +1 -0
  39. package/dist/runtime/internal/debug.d.ts +2 -0
  40. package/dist/runtime/internal/debug.mjs +5 -0
  41. package/dist/runtime/internal/nitro.d.ts +2 -0
  42. package/dist/runtime/internal/nitro.mjs +45 -0
  43. package/dist/runtime/internal/plugin.d.ts +3 -0
  44. package/dist/runtime/internal/plugin.mjs +4 -0
  45. package/dist/shared/silgi.40ZJYm8F.d.mts +11 -0
  46. package/dist/shared/silgi.40ZJYm8F.d.ts +11 -0
  47. package/dist/shared/{silgi.ClpvycKI.d.mts → silgi.D8h2AAVk.d.ts} +451 -437
  48. package/dist/shared/{silgi.ClpvycKI.d.ts → silgi.DSHNePNA.d.mts} +451 -437
  49. package/dist/types/index.d.mts +42 -0
  50. package/dist/types/index.d.ts +42 -0
  51. package/dist/types/index.mjs +1 -0
  52. package/kit.d.ts +1 -0
  53. package/meta.d.ts +1 -0
  54. package/package.json +89 -39
  55. package/presets.d.ts +1 -0
  56. package/runtime-meta.d.ts +4 -0
  57. package/runtime-meta.mjs +32 -0
  58. package/runtime.d.ts +1 -0
  59. package/types.d.ts +1 -0
  60. package/bin/silgi.mjs +0 -3
  61. package/dist/chunks/generate.mjs +0 -1257
  62. package/dist/cli/config.d.mts +0 -1633
  63. package/dist/cli/config.d.ts +0 -1633
  64. package/dist/index.d.mts +0 -198
  65. package/dist/index.d.ts +0 -198
  66. package/dist/index.mjs +0 -503
  67. package/dist/shared/silgi.D2yb1XAa.mjs +0 -842
  68. /package/dist/{chunks → cli}/init.mjs +0 -0
  69. /package/dist/{cli/config.mjs → config/index.mjs} +0 -0
package/dist/index.d.mts DELETED
@@ -1,198 +0,0 @@
1
- import { b as SilgiConfig, c as SilgiHelper, d as SilgiRouterTypes, S as SilgiOptions, 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, x as SilgiStorageBase, t as SilgiURIs, U as URIsTypes, y as silgi } from './shared/silgi.ClpvycKI.mjs';
3
- import { FetchContext, FetchOptions } from 'ofetch';
4
- import { LoadConfigOptions } from 'c12';
5
- import { StandardSchemaV1 } from '@standard-schema/spec';
6
- import * as unctx_index from 'unctx/index';
7
- import 'consola';
8
- import 'hookable';
9
- import 'ignore';
10
- import 'unstorage';
11
- import 'defu';
12
- import 'h3';
13
- import 'pkg-types';
14
- import 'nitropack/types';
15
-
16
- declare function createSilgi(config: SilgiConfig): Promise<SilgiHelper>;
17
-
18
- declare enum SilgiErrorCode {
19
- AUTH_UNAUTHORIZED = "AUTH_UNAUTHORIZED",
20
- AUTH_MISSING_CONTEXT = "AUTH_MISSING_CONTEXT",
21
- AUTH_INVALID_CONTEXT = "AUTH_INVALID_CONTEXT",
22
- AUTH_PERMISSION_DENIED = "AUTH_PERMISSION_DENIED",
23
- PLUGIN_ERROR = "PLUGIN_ERROR",
24
- METHOD_NOT_FOUND = "METHOD_NOT_FOUND",
25
- EXECUTION_ERROR = "EXECUTION_ERROR",
26
- CACHE_ERROR = "CACHE_ERROR",
27
- PLUGIN_ALREADY_EXISTS = "PLUGIN_ALREADY_EXISTS",
28
- PLUGIN_NOT_FOUND = "PLUGIN_NOT_FOUND",
29
- PLUGIN_INIT_ERROR = "PLUGIN_INIT_ERROR"
30
- }
31
- interface SilgiErrorOptions {
32
- code: SilgiErrorCode | string;
33
- message: string;
34
- cause?: Error;
35
- details?: Record<string, unknown>;
36
- meta?: Record<string, unknown>;
37
- }
38
- declare class SilgiError extends Error {
39
- readonly code: string;
40
- readonly details?: Record<string, unknown>;
41
- readonly meta?: Record<string, unknown>;
42
- readonly timestamp: number;
43
- cause?: Error;
44
- constructor(options: SilgiErrorOptions);
45
- toString(): string;
46
- toJSON(): {
47
- name: string;
48
- code: string;
49
- message: string;
50
- details: Record<string, unknown> | undefined;
51
- meta: Record<string, unknown> | undefined;
52
- timestamp: number;
53
- stack: string | undefined;
54
- };
55
- static createFrom(error: unknown, code?: string): SilgiError;
56
- static isSilgiError(error: unknown): error is SilgiError;
57
- }
58
-
59
- type FetchResponseData<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
60
- output: any;
61
- } ? SilgiRouterTypes[Route][Method]['output'] : never;
62
- type MethodOption<M, P> = 'get' extends keyof P ? {
63
- method?: M;
64
- } : {
65
- method: M;
66
- };
67
- type ParamsOption<T> = T extends {
68
- parameters?: any;
69
- query?: any;
70
- } ? T['parameters'] : Record<string, never>;
71
- type RequestBodyOption<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
72
- input: any;
73
- } ? {
74
- body: SilgiRouterTypes[Route][Method]['input'];
75
- } : {
76
- body?: never;
77
- };
78
- type RouterParams<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
79
- params: any;
80
- } ? {
81
- params?: SilgiRouterTypes[Route][Method]['params'];
82
- } : {
83
- params?: never;
84
- };
85
- type FilterMethods<T extends keyof SilgiRouterTypes> = keyof SilgiRouterTypes[T];
86
- type DefaultMethod<Route extends keyof SilgiRouterTypes> = keyof SilgiRouterTypes[Route];
87
- type SilgiFetchOptions<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>> = {
88
- method?: Method;
89
- } & RequestBodyOption<Route, Method> & RouterParams<Route, Method> & Omit<FetchOptions, 'query' | 'body' | 'method'>;
90
- type SilgiFetchClient = <Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>, ResT = FetchResponseData<Route, Method>>(url: Route, options?: SilgiFetchOptions<Route, Method>) => Promise<ResT>;
91
- declare function silgiFetchRequestInterceptor(ctx: FetchContext): void;
92
- declare function createSilgiFetch(options: FetchOptions | ((options: FetchOptions) => FetchOptions), localFetch?: typeof globalThis.$fetch): SilgiFetchClient;
93
-
94
- interface LoadSilgiConfigOptions extends Omit<LoadConfigOptions<SilgiOptions>, 'overrides'> {
95
- overrides?: Exclude<LoadConfigOptions<SilgiOptions>['overrides'], Promise<any> | void>;
96
- }
97
- declare function loadSilgiConfig(opts: LoadSilgiConfigOptions): Promise<SilgiOptions>;
98
-
99
- /**
100
- * Define a Nuxt module, automatically merging defaults with user provided options, installing
101
- * any hooks that are provided, and calling an optional setup function for full control.
102
- */
103
- declare function defineSilgiModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | SilgiModule<TOptions, Partial<TOptions>, false>): SilgiModule<TOptions, TOptions, false>;
104
- declare function defineSilgiModule<TOptions extends ModuleOptions>(): {
105
- with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | SilgiModule<TOptions, TOptionsDefaults, true>) => SilgiModule<TOptions, TOptionsDefaults, true>;
106
- };
107
-
108
- interface ResolvePathOptions {
109
- modulesDir?: string[];
110
- /** Base for resolving paths from. Default is Nuxt rootDir. */
111
- cwd?: string;
112
- /** An object of aliases. Default is Nuxt configured aliases. */
113
- alias?: Record<string, string>;
114
- /** The file extensions to try. Default is Nuxt configured extensions. */
115
- extensions?: string[];
116
- /**
117
- * Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path.
118
- *
119
- * @default false
120
- */
121
- fallbackToOriginal?: boolean;
122
- }
123
- interface Resolver {
124
- resolve: (...path: string[]) => string;
125
- resolvePath: (path: string, opts?: ResolvePathOptions) => Promise<string>;
126
- }
127
- /**
128
- * Create a relative resolver
129
- */
130
- declare function createResolver(base: string | URL): Resolver;
131
-
132
- declare function relativeWithDot(from: string, to: string): string;
133
-
134
- interface SilgiModuleContext extends Record<string, any> {
135
- }
136
- interface ExtendContext {
137
- }
138
-
139
- interface BaseNamespaceType extends Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>> {
140
- }
141
- type Namespaces<T extends BaseNamespaceType> = {
142
- [K in keyof T]: {
143
- [P in keyof T[K]]: T[K][P] extends BaseSchemaType<StandardSchemaV1> ? SilgiServiceInterface<T[K][P]> : never;
144
- };
145
- };
146
-
147
- declare const silgiCtx: unctx_index.UseContext<Silgi>;
148
- declare function useShared(): Silgi["options"]["shared"];
149
- declare function useSilgi(): Silgi;
150
- declare function useHook(): Silgi["hooks"]["hook"];
151
- declare function normalizeResult<T>(result: T): T;
152
- /**
153
- * Get access to Nuxt instance.
154
- *
155
- * Returns null if Nuxt instance is unavailable.
156
- * @example
157
- * ```js
158
- * const silgi = tryUseSilgi()
159
- * if (silgi) {
160
- * // Do something
161
- * }
162
- * ```
163
- */
164
- declare function tryUseSilgi(): Silgi | null;
165
-
166
- /**
167
- *
168
- *
169
- * @example
170
- * srnResorce: 'coreApi.basket.post.createBasket'
171
- * const { namespace, serviceName, action, method } = cliResorceParse(srnResorce)
172
- *
173
- * namespace: 'coreApi'
174
- * serviceName: 'basket'
175
- * action: 'post'
176
- * method: 'createBasket'
177
- *
178
- */
179
- declare function parseURI(uri: string, uris?: object): SilgiOperation;
180
-
181
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
182
- declare function mergeSchemas<T extends MergedSilgiSchema[]>(typesOrArray: [...T] | T): UnionToIntersection<T[number]>;
183
- declare function mergeServices<T extends ServiceType<SilgiSchema>[]>(servicesOrArray: [...T] | T): RequiredServiceType<SilgiSchema>;
184
- declare function mergeShared<T extends SilgiModuleShared[]>(sharedOrArray: [...T] | T): UnionToIntersection<T[number]>;
185
-
186
- declare function createService<T extends SilgiSchema>(variables: ServiceType<T>): ServiceType<T>;
187
-
188
- declare function createShared(shared: Partial<SilgiModuleShared>): SilgiModuleShared;
189
-
190
- declare function createSchema<T extends Partial<Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>>>>(silgiType: T): {
191
- [K in keyof T]: {
192
- [P in keyof T[K]]: T[K][P];
193
- };
194
- };
195
-
196
- declare const types: string[];
197
-
198
- export { DefaultNamespaces, type ExtendContext, type FetchResponseData, type FilterMethods, MergedSilgiSchema, type MethodOption, type Namespaces, type ParamsOption, type RequestBodyOption, type RouterParams, ServiceType, Silgi, SilgiError, type SilgiFetchClient, SilgiHelper, type SilgiModuleContext, SilgiModuleShared, SilgiOptions, SilgiRouterTypes, SilgiSchema, createResolver, createSchema, createService, createShared, createSilgi, createSilgiFetch, defineSilgiModule, loadSilgiConfig, mergeSchemas, mergeServices, mergeShared, normalizeResult, parseURI, relativeWithDot, silgiCtx, silgiFetchRequestInterceptor, tryUseSilgi, types, useHook, useShared, useSilgi };
package/dist/index.d.ts DELETED
@@ -1,198 +0,0 @@
1
- import { b as SilgiConfig, c as SilgiHelper, d as SilgiRouterTypes, S as SilgiOptions, 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, x as SilgiStorageBase, t as SilgiURIs, U as URIsTypes, y as silgi } from './shared/silgi.ClpvycKI.js';
3
- import { FetchContext, FetchOptions } from 'ofetch';
4
- import { LoadConfigOptions } from 'c12';
5
- import { StandardSchemaV1 } from '@standard-schema/spec';
6
- import * as unctx_index from 'unctx/index';
7
- import 'consola';
8
- import 'hookable';
9
- import 'ignore';
10
- import 'unstorage';
11
- import 'defu';
12
- import 'h3';
13
- import 'pkg-types';
14
- import 'nitropack/types';
15
-
16
- declare function createSilgi(config: SilgiConfig): Promise<SilgiHelper>;
17
-
18
- declare enum SilgiErrorCode {
19
- AUTH_UNAUTHORIZED = "AUTH_UNAUTHORIZED",
20
- AUTH_MISSING_CONTEXT = "AUTH_MISSING_CONTEXT",
21
- AUTH_INVALID_CONTEXT = "AUTH_INVALID_CONTEXT",
22
- AUTH_PERMISSION_DENIED = "AUTH_PERMISSION_DENIED",
23
- PLUGIN_ERROR = "PLUGIN_ERROR",
24
- METHOD_NOT_FOUND = "METHOD_NOT_FOUND",
25
- EXECUTION_ERROR = "EXECUTION_ERROR",
26
- CACHE_ERROR = "CACHE_ERROR",
27
- PLUGIN_ALREADY_EXISTS = "PLUGIN_ALREADY_EXISTS",
28
- PLUGIN_NOT_FOUND = "PLUGIN_NOT_FOUND",
29
- PLUGIN_INIT_ERROR = "PLUGIN_INIT_ERROR"
30
- }
31
- interface SilgiErrorOptions {
32
- code: SilgiErrorCode | string;
33
- message: string;
34
- cause?: Error;
35
- details?: Record<string, unknown>;
36
- meta?: Record<string, unknown>;
37
- }
38
- declare class SilgiError extends Error {
39
- readonly code: string;
40
- readonly details?: Record<string, unknown>;
41
- readonly meta?: Record<string, unknown>;
42
- readonly timestamp: number;
43
- cause?: Error;
44
- constructor(options: SilgiErrorOptions);
45
- toString(): string;
46
- toJSON(): {
47
- name: string;
48
- code: string;
49
- message: string;
50
- details: Record<string, unknown> | undefined;
51
- meta: Record<string, unknown> | undefined;
52
- timestamp: number;
53
- stack: string | undefined;
54
- };
55
- static createFrom(error: unknown, code?: string): SilgiError;
56
- static isSilgiError(error: unknown): error is SilgiError;
57
- }
58
-
59
- type FetchResponseData<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
60
- output: any;
61
- } ? SilgiRouterTypes[Route][Method]['output'] : never;
62
- type MethodOption<M, P> = 'get' extends keyof P ? {
63
- method?: M;
64
- } : {
65
- method: M;
66
- };
67
- type ParamsOption<T> = T extends {
68
- parameters?: any;
69
- query?: any;
70
- } ? T['parameters'] : Record<string, never>;
71
- type RequestBodyOption<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
72
- input: any;
73
- } ? {
74
- body: SilgiRouterTypes[Route][Method]['input'];
75
- } : {
76
- body?: never;
77
- };
78
- type RouterParams<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route]> = SilgiRouterTypes[Route][Method] extends {
79
- params: any;
80
- } ? {
81
- params?: SilgiRouterTypes[Route][Method]['params'];
82
- } : {
83
- params?: never;
84
- };
85
- type FilterMethods<T extends keyof SilgiRouterTypes> = keyof SilgiRouterTypes[T];
86
- type DefaultMethod<Route extends keyof SilgiRouterTypes> = keyof SilgiRouterTypes[Route];
87
- type SilgiFetchOptions<Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>> = {
88
- method?: Method;
89
- } & RequestBodyOption<Route, Method> & RouterParams<Route, Method> & Omit<FetchOptions, 'query' | 'body' | 'method'>;
90
- type SilgiFetchClient = <Route extends keyof SilgiRouterTypes, Method extends keyof SilgiRouterTypes[Route] = DefaultMethod<Route>, ResT = FetchResponseData<Route, Method>>(url: Route, options?: SilgiFetchOptions<Route, Method>) => Promise<ResT>;
91
- declare function silgiFetchRequestInterceptor(ctx: FetchContext): void;
92
- declare function createSilgiFetch(options: FetchOptions | ((options: FetchOptions) => FetchOptions), localFetch?: typeof globalThis.$fetch): SilgiFetchClient;
93
-
94
- interface LoadSilgiConfigOptions extends Omit<LoadConfigOptions<SilgiOptions>, 'overrides'> {
95
- overrides?: Exclude<LoadConfigOptions<SilgiOptions>['overrides'], Promise<any> | void>;
96
- }
97
- declare function loadSilgiConfig(opts: LoadSilgiConfigOptions): Promise<SilgiOptions>;
98
-
99
- /**
100
- * Define a Nuxt module, automatically merging defaults with user provided options, installing
101
- * any hooks that are provided, and calling an optional setup function for full control.
102
- */
103
- declare function defineSilgiModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | SilgiModule<TOptions, Partial<TOptions>, false>): SilgiModule<TOptions, TOptions, false>;
104
- declare function defineSilgiModule<TOptions extends ModuleOptions>(): {
105
- with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | SilgiModule<TOptions, TOptionsDefaults, true>) => SilgiModule<TOptions, TOptionsDefaults, true>;
106
- };
107
-
108
- interface ResolvePathOptions {
109
- modulesDir?: string[];
110
- /** Base for resolving paths from. Default is Nuxt rootDir. */
111
- cwd?: string;
112
- /** An object of aliases. Default is Nuxt configured aliases. */
113
- alias?: Record<string, string>;
114
- /** The file extensions to try. Default is Nuxt configured extensions. */
115
- extensions?: string[];
116
- /**
117
- * Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path.
118
- *
119
- * @default false
120
- */
121
- fallbackToOriginal?: boolean;
122
- }
123
- interface Resolver {
124
- resolve: (...path: string[]) => string;
125
- resolvePath: (path: string, opts?: ResolvePathOptions) => Promise<string>;
126
- }
127
- /**
128
- * Create a relative resolver
129
- */
130
- declare function createResolver(base: string | URL): Resolver;
131
-
132
- declare function relativeWithDot(from: string, to: string): string;
133
-
134
- interface SilgiModuleContext extends Record<string, any> {
135
- }
136
- interface ExtendContext {
137
- }
138
-
139
- interface BaseNamespaceType extends Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>> {
140
- }
141
- type Namespaces<T extends BaseNamespaceType> = {
142
- [K in keyof T]: {
143
- [P in keyof T[K]]: T[K][P] extends BaseSchemaType<StandardSchemaV1> ? SilgiServiceInterface<T[K][P]> : never;
144
- };
145
- };
146
-
147
- declare const silgiCtx: unctx_index.UseContext<Silgi>;
148
- declare function useShared(): Silgi["options"]["shared"];
149
- declare function useSilgi(): Silgi;
150
- declare function useHook(): Silgi["hooks"]["hook"];
151
- declare function normalizeResult<T>(result: T): T;
152
- /**
153
- * Get access to Nuxt instance.
154
- *
155
- * Returns null if Nuxt instance is unavailable.
156
- * @example
157
- * ```js
158
- * const silgi = tryUseSilgi()
159
- * if (silgi) {
160
- * // Do something
161
- * }
162
- * ```
163
- */
164
- declare function tryUseSilgi(): Silgi | null;
165
-
166
- /**
167
- *
168
- *
169
- * @example
170
- * srnResorce: 'coreApi.basket.post.createBasket'
171
- * const { namespace, serviceName, action, method } = cliResorceParse(srnResorce)
172
- *
173
- * namespace: 'coreApi'
174
- * serviceName: 'basket'
175
- * action: 'post'
176
- * method: 'createBasket'
177
- *
178
- */
179
- declare function parseURI(uri: string, uris?: object): SilgiOperation;
180
-
181
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
182
- declare function mergeSchemas<T extends MergedSilgiSchema[]>(typesOrArray: [...T] | T): UnionToIntersection<T[number]>;
183
- declare function mergeServices<T extends ServiceType<SilgiSchema>[]>(servicesOrArray: [...T] | T): RequiredServiceType<SilgiSchema>;
184
- declare function mergeShared<T extends SilgiModuleShared[]>(sharedOrArray: [...T] | T): UnionToIntersection<T[number]>;
185
-
186
- declare function createService<T extends SilgiSchema>(variables: ServiceType<T>): ServiceType<T>;
187
-
188
- declare function createShared(shared: Partial<SilgiModuleShared>): SilgiModuleShared;
189
-
190
- declare function createSchema<T extends Partial<Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>>>>(silgiType: T): {
191
- [K in keyof T]: {
192
- [P in keyof T[K]]: T[K][P];
193
- };
194
- };
195
-
196
- declare const types: string[];
197
-
198
- export { DefaultNamespaces, type ExtendContext, type FetchResponseData, type FilterMethods, MergedSilgiSchema, type MethodOption, type Namespaces, type ParamsOption, type RequestBodyOption, type RouterParams, ServiceType, Silgi, SilgiError, type SilgiFetchClient, SilgiHelper, type SilgiModuleContext, SilgiModuleShared, SilgiOptions, SilgiRouterTypes, SilgiSchema, createResolver, createSchema, createService, createShared, createSilgi, createSilgiFetch, defineSilgiModule, loadSilgiConfig, mergeSchemas, mergeServices, mergeShared, normalizeResult, parseURI, relativeWithDot, silgiCtx, silgiFetchRequestInterceptor, tryUseSilgi, types, useHook, useShared, useSilgi };