silgi 0.24.9 → 0.24.11
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/cli/index.mjs +1 -1
- package/dist/runtime/internal/debug.d.mts +1 -2
- package/dist/runtime/internal/debug.mjs +1 -1
- package/dist/runtime/internal/index.d.mts +6 -1
- package/dist/runtime/internal/index.mjs +20 -1
- package/dist/runtime/internal/nitro.d.mts +2 -1
- package/dist/runtime/internal/nitro.mjs +2 -1
- package/dist/runtime/internal/nuxt.d.mts +1 -11
- package/dist/runtime/internal/ofetch.d.mts +2 -20
- package/dist/runtime/internal/ofetch.mjs +0 -3
- package/dist/types/index.d.mts +21 -1
- package/package.json +2 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const debugPlugin: SilgiAppPlugin;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { debugPlugin, } from './debug';
|
|
2
|
+
export { mergeDeep, } from './defu';
|
|
3
|
+
export { addNitroApp, } from './nitro';
|
|
4
|
+
export { useSilgiFetch, } from './nuxt';
|
|
5
|
+
export { createSilgiFetch, silgi$fetch, } from './ofetch';
|
|
6
|
+
export { defineSilgiPlugin, silgiPlugin, } from './plugin';
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
debugPlugin
|
|
3
|
+
} from "./debug.mjs";
|
|
4
|
+
export {
|
|
5
|
+
mergeDeep
|
|
6
|
+
} from "./defu.mjs";
|
|
7
|
+
export {
|
|
8
|
+
addNitroApp
|
|
9
|
+
} from "./nitro.mjs";
|
|
10
|
+
export {
|
|
11
|
+
useSilgiFetch
|
|
12
|
+
} from "./nuxt.mjs";
|
|
13
|
+
export {
|
|
14
|
+
createSilgiFetch,
|
|
15
|
+
silgi$fetch
|
|
16
|
+
} from "./ofetch";
|
|
17
|
+
export {
|
|
18
|
+
defineSilgiPlugin,
|
|
19
|
+
silgiPlugin
|
|
20
|
+
} from "./plugin.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getQuery, H3Error, readBody } from "h3";
|
|
2
2
|
import { ErrorFactory, HttpStatus, parseURI, silgi, SilgiError, useSilgi } from "silgi";
|
|
3
|
-
export
|
|
3
|
+
export async function addNitroApp(silgiCtx = useSilgi()) {
|
|
4
4
|
const nitro = silgiCtx.framework;
|
|
5
5
|
nitro.router.use("/srn/**", defineEventHandler(async (event) => {
|
|
6
6
|
try {
|
|
@@ -51,3 +51,4 @@ export default async function addNitroApp(silgiCtx = useSilgi()) {
|
|
|
51
51
|
}
|
|
52
52
|
}));
|
|
53
53
|
}
|
|
54
|
+
export default addNitroApp;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import type { AsyncData, UseFetchOptions } from 'nuxt/app';
|
|
2
2
|
import type { FetchError } from 'ofetch';
|
|
3
|
-
import type { SilgiRouterTypes } from 'silgi/types';
|
|
4
|
-
type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
|
|
5
|
-
type AllPaths = SilgiRouterTypes extends {
|
|
6
|
-
keys: infer U;
|
|
7
|
-
} ? keyof U extends never ? string : keyof U : string;
|
|
8
|
-
type ExtractPathParams<T extends string> = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
9
|
-
[K in Param]: string;
|
|
10
|
-
} & ExtractPathParams<Rest> : T extends `${infer _Start}:${infer Param}` ? {
|
|
11
|
-
[K in Param]: string;
|
|
12
|
-
} : unknown;
|
|
3
|
+
import type { AllPaths, ExtractPathParams, SilgiRouterTypes, TrimAfterFourSlashes } from 'silgi/types';
|
|
13
4
|
export declare function useSilgiFetch<T, P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(path: P, options?: {
|
|
14
5
|
method?: M;
|
|
15
6
|
params?: ExtractPathParams<P>;
|
|
16
7
|
body?: SilgiRouterTypes[BasePath][M]['input'];
|
|
17
8
|
} & Omit<UseFetchOptions<T>, 'method' | 'body' | 'params'>): AsyncData<SilgiRouterTypes[BasePath][M]["output"], FetchError | null>;
|
|
18
|
-
export {};
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { SilgiRouterTypes } from 'silgi/types';
|
|
3
|
-
type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
|
|
4
|
-
type AllPaths = SilgiRouterTypes extends {
|
|
5
|
-
keys: infer U;
|
|
6
|
-
} ? keyof U extends never ? string : keyof U : string;
|
|
7
|
-
type ExtractPathParams<T extends string> = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
8
|
-
[K in Param]: string;
|
|
9
|
-
} & ExtractPathParams<Rest> : T extends `${infer _Start}:${infer Param}` ? {
|
|
10
|
-
[K in Param]: string;
|
|
11
|
-
} : object;
|
|
12
|
-
export type RouterParams<R extends AllPaths | (string & {})> = ExtractPathParams<R>;
|
|
13
|
-
type SilgiFetchOptions<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]> = {
|
|
14
|
-
method?: M;
|
|
15
|
-
params?: ExtractPathParams<P>;
|
|
16
|
-
body?: SilgiRouterTypes[BasePath][M]['input'];
|
|
17
|
-
} & Omit<FetchOptions, 'method' | 'body' | 'params'>;
|
|
18
|
-
export type SilgiFetchClient = <P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: BasePath, options?: SilgiFetchOptions<P, BasePath, M>) => Promise<FetchResponse<SilgiRouterTypes[BasePath][M]['output']>>;
|
|
19
|
-
export declare function silgiFetchRequestInterceptor(ctx: FetchContext): void;
|
|
1
|
+
import type { FetchOptions, FetchResponse } from 'ofetch';
|
|
2
|
+
import type { AllPaths, SilgiFetchClient, SilgiFetchOptions, SilgiRouterTypes, TrimAfterFourSlashes } from 'silgi/types';
|
|
20
3
|
export declare function createSilgiFetch(options: FetchOptions | ((options: FetchOptions) => FetchOptions), localFetch?: typeof globalThis.$fetch): SilgiFetchClient;
|
|
21
4
|
export declare function silgi$fetch<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: P, opts?: SilgiFetchOptions<P, BasePath, M>): Promise<FetchResponse<SilgiRouterTypes[BasePath][M]['output']>>;
|
|
22
|
-
export {};
|
package/dist/types/index.d.mts
CHANGED
|
@@ -14,6 +14,7 @@ import { Unimport } from 'unimport';
|
|
|
14
14
|
import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
|
|
15
15
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
16
16
|
import { ProviderName } from 'std-env';
|
|
17
|
+
import { FetchOptions, FetchResponse } from 'ofetch';
|
|
17
18
|
|
|
18
19
|
type HookResult = Promise<void> | void;
|
|
19
20
|
|
|
@@ -806,6 +807,25 @@ interface LoadConfigOptions {
|
|
|
806
807
|
compatibilityDate?: CompatibilityDateSpec;
|
|
807
808
|
}
|
|
808
809
|
|
|
810
|
+
type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
|
|
811
|
+
type AllPaths = SilgiRouterTypes extends {
|
|
812
|
+
keys: infer U;
|
|
813
|
+
} ? keyof U extends never ? string : keyof U : string;
|
|
814
|
+
type ExtractPathParams<T extends string> = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
815
|
+
[K in Param]: string;
|
|
816
|
+
} & ExtractPathParams<Rest> : T extends `${infer _Start}:${infer Param}` ? {
|
|
817
|
+
[K in Param]: string;
|
|
818
|
+
} : object;
|
|
819
|
+
|
|
820
|
+
type HttpMethod = 'get' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'head' | 'patch' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace';
|
|
821
|
+
type RouterParams<R extends AllPaths | (string & {})> = ExtractPathParams<R>;
|
|
822
|
+
type SilgiFetchOptions<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]> = {
|
|
823
|
+
method?: M;
|
|
824
|
+
params?: ExtractPathParams<P>;
|
|
825
|
+
body?: SilgiRouterTypes[BasePath][M]['input'];
|
|
826
|
+
} & Omit<FetchOptions, 'method' | 'body' | 'params'>;
|
|
827
|
+
type SilgiFetchClient = <P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: BasePath, options?: SilgiFetchOptions<P, BasePath, M>) => Promise<FetchResponse<SilgiRouterTypes[BasePath][M]['output']>>;
|
|
828
|
+
|
|
809
829
|
interface EnvOptions {
|
|
810
830
|
prefix?: string;
|
|
811
831
|
altPrefix?: string;
|
|
@@ -1133,4 +1153,4 @@ interface ServiceParseModule {
|
|
|
1133
1153
|
(params: ServiceParse): Awaited<void> | void;
|
|
1134
1154
|
}
|
|
1135
1155
|
|
|
1136
|
-
export type { AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, CaptureError, CapturedErrorContext, CommandType, CreateScope, DeepPartial, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenerateAppOptions, GraphQLJSON, HookResult, ImportItem, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, PrepareCore, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, URIsTypes };
|
|
1156
|
+
export type { AllPaths, AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, CaptureError, CapturedErrorContext, CommandType, CreateScope, DeepPartial, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParams, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenerateAppOptions, GraphQLJSON, HookResult, HttpMethod, ImportItem, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, PrepareCore, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, RouterParams, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, TrimAfterFourSlashes, URIsTypes };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silgi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.24.
|
|
4
|
+
"version": "0.24.11",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"./presets": "./dist/presets/index.mjs",
|
|
17
17
|
"./runtime": "./dist/runtime/index.mjs",
|
|
18
18
|
"./runtime/internal": "./dist/runtime/internal/index.mjs",
|
|
19
|
+
"./runtime/internal/*": "./dist/runtime/internal/*.mjs",
|
|
19
20
|
"./runtime/meta": "./lib/runtime-meta.mjs"
|
|
20
21
|
},
|
|
21
22
|
"main": "./dist/index.mjs",
|