silgi 0.7.42 → 0.7.44
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/_chunks/index.mjs +1 -1
- package/dist/cli/prepare.mjs +8 -8
- package/dist/core/index.d.mts +9 -6
- package/dist/core/index.d.ts +9 -6
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/runtime/internal/defu.d.ts +1 -0
- package/dist/runtime/internal/defu.mjs +4 -0
- package/dist/shared/silgi.D608K9c5.d.mts +7 -0
- package/dist/shared/silgi.D608K9c5.d.ts +7 -0
- package/dist/types/index.d.mts +18 -18
- package/dist/types/index.d.ts +18 -18
- package/package.json +5 -5
- package/dist/shared/silgi.sABAerQU.d.mts +0 -11
- package/dist/shared/silgi.sABAerQU.d.ts +0 -11
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -538,7 +538,7 @@ async function schemaTemplate(silgi) {
|
|
|
538
538
|
" interface SilgiURIs extends SilgiURIsMerge {}",
|
|
539
539
|
" interface SilgiRuntimeContext extends SilgiModuleContextExtends {}",
|
|
540
540
|
" interface SilgiEvents extends SilgiModuleEventsExtends {}",
|
|
541
|
-
" interface
|
|
541
|
+
" interface SilgiRuntimeShareds extends SilgiModuleSharedExtends {}",
|
|
542
542
|
" interface SilgiRuntimeActions extends RuntimeActionExtends {}",
|
|
543
543
|
" interface SilgiModuleOptions extends SilgiModuleOptionExtend {}",
|
|
544
544
|
" interface SilgiRuntimeOptions extends SilgiRuntimeOptionExtends {}",
|
|
@@ -577,13 +577,13 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
577
577
|
import: [],
|
|
578
578
|
from: "./vfs"
|
|
579
579
|
},
|
|
580
|
-
"defu": {
|
|
580
|
+
"silgi/runtime/internal/defu": {
|
|
581
581
|
import: [
|
|
582
582
|
{
|
|
583
|
-
name: "
|
|
583
|
+
name: "mergeDeep"
|
|
584
584
|
}
|
|
585
585
|
],
|
|
586
|
-
from: "defu"
|
|
586
|
+
from: "silgi/runtime/internal/defu"
|
|
587
587
|
}
|
|
588
588
|
};
|
|
589
589
|
importItems = { ...data._importItems, ...importItems };
|
|
@@ -675,7 +675,7 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
675
675
|
}),
|
|
676
676
|
shareds.length > 0 ? "])" : "}",
|
|
677
677
|
"",
|
|
678
|
-
`export const _silgiOptions
|
|
678
|
+
`export const _silgiOptions = ${JSON.stringify(_silgiOptions, null, 2)}`,
|
|
679
679
|
"",
|
|
680
680
|
"export async function buildSilgi(framework: FrameworkContext, moduleOptions?: Partial<SilgiRuntimeOptions>,buildOptions?: Partial<BuildConfig>) {",
|
|
681
681
|
"",
|
|
@@ -693,7 +693,7 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
693
693
|
` plugins: [${plugins.join(", ")}],`,
|
|
694
694
|
_silgiConfigs.length > 0 ? ` ${_silgiConfigs.map((config) => typeof config === "string" ? config : typeof config === "object" ? Object.entries(config).map(([key, value]) => `${key}: ${value}`).join(",\n ") : "").join(",\n ")},` : "",
|
|
695
695
|
" ...buildOptions,",
|
|
696
|
-
" options:
|
|
696
|
+
" options: mergeDeep(",
|
|
697
697
|
" moduleOptions || {},",
|
|
698
698
|
" {",
|
|
699
699
|
` present: '${silgi.options.preset}',`,
|
|
@@ -888,10 +888,10 @@ async function registerModuleExportScan(silgi) {
|
|
|
888
888
|
});
|
|
889
889
|
options.actions.push({ key: configKey, value: importName });
|
|
890
890
|
}
|
|
891
|
-
if (exportedTypes.includes("
|
|
891
|
+
if (exportedTypes.includes("ModuleRuntimeShareds")) {
|
|
892
892
|
const importName = pascalCase(`${configKey}Shared`);
|
|
893
893
|
options.importItems[configKey].import.push({
|
|
894
|
-
name: `
|
|
894
|
+
name: `ModuleRuntimeShareds as ${importName}`,
|
|
895
895
|
type: true
|
|
896
896
|
});
|
|
897
897
|
options.shareds.push({ key: configKey, value: importName });
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType,
|
|
2
|
-
export {
|
|
1
|
+
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiRuntimeSharedExtends, SilgiEvents, DefaultNamespaces, BaseSchemaType, StorageConfig, SilgiCLI } from 'silgi/types';
|
|
2
|
+
export { s as silgi } from '../shared/silgi.D608K9c5.mjs';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
+
import { Storage, StorageValue } from 'unstorage';
|
|
4
5
|
import * as unctx from 'unctx';
|
|
5
|
-
import 'unstorage';
|
|
6
6
|
|
|
7
7
|
declare function createSilgi(config: SilgiConfig): Promise<Silgi>;
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ declare function parseURI(uri: string, uris: Record<string, URITemplate>): Silgi
|
|
|
19
19
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
20
20
|
declare function mergeSchemas<T extends MergedSilgiSchema[]>(typesOrArray: [...T] | T): UnionToIntersection<T[number]>;
|
|
21
21
|
declare function mergeServices<T extends ServiceType<SilgiSchema>[]>(servicesOrArray: [...T] | T): RequiredServiceType<SilgiSchema>;
|
|
22
|
-
declare function mergeShared<T extends
|
|
22
|
+
declare function mergeShared<T extends SilgiRuntimeSharedExtends[]>(sharedOrArray: [...T] | T): UnionToIntersection<T[number]>;
|
|
23
23
|
|
|
24
24
|
declare function getEvent<T>(event?: SilgiEvents): T;
|
|
25
25
|
|
|
@@ -31,7 +31,10 @@ declare function createSchema<T extends Partial<Record<keyof DefaultNamespaces,
|
|
|
31
31
|
|
|
32
32
|
declare function createService<T extends SilgiSchema>(variables: ServiceType<T>): ServiceType<T>;
|
|
33
33
|
|
|
34
|
-
declare function createShared(shared: Partial<
|
|
34
|
+
declare function createShared(shared: Partial<SilgiRuntimeSharedExtends>): SilgiRuntimeSharedExtends;
|
|
35
|
+
|
|
36
|
+
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
37
|
+
declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
|
|
35
38
|
|
|
36
39
|
declare enum HttpStatus {
|
|
37
40
|
/** [100] Server has received the request headers and client should proceed to send the request body */
|
|
@@ -253,4 +256,4 @@ declare function useSilgiCLI(): SilgiCLI;
|
|
|
253
256
|
*/
|
|
254
257
|
declare function tryUseSilgiCLI(): SilgiCLI | null;
|
|
255
258
|
|
|
256
|
-
export { type BaseError, ErrorCategory, ErrorFactory, type ErrorMetadata, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, getEvent, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, silgiCLICtx, silgiCtx, tryUseSilgi, tryUseSilgiCLI, useSilgi, useSilgiCLI };
|
|
259
|
+
export { type BaseError, ErrorCategory, ErrorFactory, type ErrorMetadata, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, createStorage, getEvent, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, silgiCLICtx, silgiCtx, tryUseSilgi, tryUseSilgiCLI, useSilgi, useSilgiCLI, useSilgiStorage };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType,
|
|
2
|
-
export {
|
|
1
|
+
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiRuntimeSharedExtends, SilgiEvents, DefaultNamespaces, BaseSchemaType, StorageConfig, SilgiCLI } from 'silgi/types';
|
|
2
|
+
export { s as silgi } from '../shared/silgi.D608K9c5.js';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
+
import { Storage, StorageValue } from 'unstorage';
|
|
4
5
|
import * as unctx from 'unctx';
|
|
5
|
-
import 'unstorage';
|
|
6
6
|
|
|
7
7
|
declare function createSilgi(config: SilgiConfig): Promise<Silgi>;
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ declare function parseURI(uri: string, uris: Record<string, URITemplate>): Silgi
|
|
|
19
19
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
20
20
|
declare function mergeSchemas<T extends MergedSilgiSchema[]>(typesOrArray: [...T] | T): UnionToIntersection<T[number]>;
|
|
21
21
|
declare function mergeServices<T extends ServiceType<SilgiSchema>[]>(servicesOrArray: [...T] | T): RequiredServiceType<SilgiSchema>;
|
|
22
|
-
declare function mergeShared<T extends
|
|
22
|
+
declare function mergeShared<T extends SilgiRuntimeSharedExtends[]>(sharedOrArray: [...T] | T): UnionToIntersection<T[number]>;
|
|
23
23
|
|
|
24
24
|
declare function getEvent<T>(event?: SilgiEvents): T;
|
|
25
25
|
|
|
@@ -31,7 +31,10 @@ declare function createSchema<T extends Partial<Record<keyof DefaultNamespaces,
|
|
|
31
31
|
|
|
32
32
|
declare function createService<T extends SilgiSchema>(variables: ServiceType<T>): ServiceType<T>;
|
|
33
33
|
|
|
34
|
-
declare function createShared(shared: Partial<
|
|
34
|
+
declare function createShared(shared: Partial<SilgiRuntimeSharedExtends>): SilgiRuntimeSharedExtends;
|
|
35
|
+
|
|
36
|
+
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
37
|
+
declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
|
|
35
38
|
|
|
36
39
|
declare enum HttpStatus {
|
|
37
40
|
/** [100] Server has received the request headers and client should proceed to send the request body */
|
|
@@ -253,4 +256,4 @@ declare function useSilgiCLI(): SilgiCLI;
|
|
|
253
256
|
*/
|
|
254
257
|
declare function tryUseSilgiCLI(): SilgiCLI | null;
|
|
255
258
|
|
|
256
|
-
export { type BaseError, ErrorCategory, ErrorFactory, type ErrorMetadata, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, getEvent, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, silgiCLICtx, silgiCtx, tryUseSilgi, tryUseSilgiCLI, useSilgi, useSilgiCLI };
|
|
259
|
+
export { type BaseError, ErrorCategory, ErrorFactory, type ErrorMetadata, ErrorSeverity, HttpStatus, SilgiError, createSchema, createService, createShared, createSilgi, createStorage, getEvent, isBaseError, mergeSchemas, mergeServices, mergeShared, parseURI, silgiCLICtx, silgiCtx, tryUseSilgi, tryUseSilgiCLI, useSilgi, useSilgiCLI, useSilgiStorage };
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeDeep(source: any, ...defaults: any[]): any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI } from 'silgi/types';
|
|
2
|
+
|
|
3
|
+
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
4
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { silgi as s };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI } from 'silgi/types';
|
|
2
|
+
|
|
3
|
+
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
4
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { silgi as s };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -6,14 +6,14 @@ import { Hookable, NestedHooks } from 'hookable';
|
|
|
6
6
|
import { Ignore, Options } from 'ignore';
|
|
7
7
|
import { TSConfig } from 'pkg-types';
|
|
8
8
|
import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
|
|
9
|
-
import { ResolvedServiceType as ResolvedServiceType$1,
|
|
9
|
+
import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
|
|
10
10
|
import { UnimportPluginOptions } from 'unimport/unplugin';
|
|
11
11
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
12
12
|
import { Defu } from 'defu';
|
|
13
13
|
import { Unimport } from 'unimport';
|
|
14
|
-
import { Storage, BuiltinDriverName, TransactionOptions } from 'unstorage';
|
|
14
|
+
import { Storage, BuiltinDriverName, TransactionOptions, StorageValue } from 'unstorage';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
|
-
import {
|
|
16
|
+
import { s as silgi } from '../shared/silgi.D608K9c5.mjs';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
@@ -124,7 +124,7 @@ interface ImportItem {
|
|
|
124
124
|
interface SilgiCLI {
|
|
125
125
|
_ignore?: Ignore;
|
|
126
126
|
services: ResolvedServiceType$1;
|
|
127
|
-
shareds:
|
|
127
|
+
shareds: SilgiRuntimeShareds$1;
|
|
128
128
|
uris: Record<string, any>;
|
|
129
129
|
schemas: Record<string, any>;
|
|
130
130
|
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions$1 | (string & {}), any>>;
|
|
@@ -742,15 +742,6 @@ interface LoadConfigOptions {
|
|
|
742
742
|
compatibilityDate?: CompatibilityDateSpec;
|
|
743
743
|
}
|
|
744
744
|
|
|
745
|
-
interface SilgiShareds extends ModuleRuntimeShared {
|
|
746
|
-
storage: (...data: Parameters<typeof useSilgiStorage>) => ReturnType<typeof useSilgiStorage>;
|
|
747
|
-
silgi: SilgiFunction;
|
|
748
|
-
}
|
|
749
|
-
interface ModuleRuntimeShared {
|
|
750
|
-
}
|
|
751
|
-
interface ExtendShared {
|
|
752
|
-
}
|
|
753
|
-
|
|
754
745
|
type CustomDriverName = string & {
|
|
755
746
|
_custom?: any;
|
|
756
747
|
};
|
|
@@ -777,6 +768,15 @@ interface StorageKeyParams<TInput = unknown> {
|
|
|
777
768
|
storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
|
|
778
769
|
}
|
|
779
770
|
|
|
771
|
+
interface SilgiRuntimeShareds extends SilgiRuntimeSharedExtends {
|
|
772
|
+
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
773
|
+
silgi: SilgiFunction;
|
|
774
|
+
}
|
|
775
|
+
interface SilgiRuntimeSharedExtends {
|
|
776
|
+
}
|
|
777
|
+
interface ExtendShared {
|
|
778
|
+
}
|
|
779
|
+
|
|
780
780
|
type EventHandlerResponse<T = undefined> = T extends undefined ? void : void | T | Promise<T>;
|
|
781
781
|
type MethodHandlerType<T> = {
|
|
782
782
|
[Action in keyof T]: T[Action] extends Record<string, any> ? {
|
|
@@ -786,7 +786,7 @@ type MethodHandlerType<T> = {
|
|
|
786
786
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
787
787
|
source?: StandardSchemaV1.InferInput<T[Action][Method]['source']>;
|
|
788
788
|
};
|
|
789
|
-
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared:
|
|
789
|
+
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<T[Action][Method]['source']>) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
|
|
790
790
|
modules?: Partial<SilgiRuntimeActions>;
|
|
791
791
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
792
792
|
};
|
|
@@ -795,10 +795,10 @@ type MethodHandlerType<T> = {
|
|
|
795
795
|
interface ResolvedMethodHandlerType {
|
|
796
796
|
input?: Partial<BaseSchemaType<any>>;
|
|
797
797
|
output: Partial<BaseSchemaType<any>>;
|
|
798
|
-
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared:
|
|
798
|
+
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
799
799
|
modules?: Partial<SilgiRuntimeActions>;
|
|
800
800
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
801
|
-
execute: (input: StandardSchemaV1.InferInput<any>, shared:
|
|
801
|
+
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
802
802
|
}
|
|
803
803
|
|
|
804
804
|
/**
|
|
@@ -874,7 +874,7 @@ interface FrameworkContext {
|
|
|
874
874
|
interface Silgi {
|
|
875
875
|
schemas: any;
|
|
876
876
|
services: ResolvedServiceType;
|
|
877
|
-
shared:
|
|
877
|
+
shared: SilgiRuntimeShareds;
|
|
878
878
|
uris: Record<string, any>;
|
|
879
879
|
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
|
|
880
880
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
@@ -948,4 +948,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
948
948
|
|
|
949
949
|
declare const autoImportTypes: string[];
|
|
950
950
|
|
|
951
|
-
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type
|
|
951
|
+
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ import { Hookable, NestedHooks } from 'hookable';
|
|
|
6
6
|
import { Ignore, Options } from 'ignore';
|
|
7
7
|
import { TSConfig } from 'pkg-types';
|
|
8
8
|
import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
|
|
9
|
-
import { ResolvedServiceType as ResolvedServiceType$1,
|
|
9
|
+
import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
|
|
10
10
|
import { UnimportPluginOptions } from 'unimport/unplugin';
|
|
11
11
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
12
12
|
import { Defu } from 'defu';
|
|
13
13
|
import { Unimport } from 'unimport';
|
|
14
|
-
import { Storage, BuiltinDriverName, TransactionOptions } from 'unstorage';
|
|
14
|
+
import { Storage, BuiltinDriverName, TransactionOptions, StorageValue } from 'unstorage';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
|
-
import {
|
|
16
|
+
import { s as silgi } from '../shared/silgi.D608K9c5.js';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
@@ -124,7 +124,7 @@ interface ImportItem {
|
|
|
124
124
|
interface SilgiCLI {
|
|
125
125
|
_ignore?: Ignore;
|
|
126
126
|
services: ResolvedServiceType$1;
|
|
127
|
-
shareds:
|
|
127
|
+
shareds: SilgiRuntimeShareds$1;
|
|
128
128
|
uris: Record<string, any>;
|
|
129
129
|
schemas: Record<string, any>;
|
|
130
130
|
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions$1 | (string & {}), any>>;
|
|
@@ -742,15 +742,6 @@ interface LoadConfigOptions {
|
|
|
742
742
|
compatibilityDate?: CompatibilityDateSpec;
|
|
743
743
|
}
|
|
744
744
|
|
|
745
|
-
interface SilgiShareds extends ModuleRuntimeShared {
|
|
746
|
-
storage: (...data: Parameters<typeof useSilgiStorage>) => ReturnType<typeof useSilgiStorage>;
|
|
747
|
-
silgi: SilgiFunction;
|
|
748
|
-
}
|
|
749
|
-
interface ModuleRuntimeShared {
|
|
750
|
-
}
|
|
751
|
-
interface ExtendShared {
|
|
752
|
-
}
|
|
753
|
-
|
|
754
745
|
type CustomDriverName = string & {
|
|
755
746
|
_custom?: any;
|
|
756
747
|
};
|
|
@@ -777,6 +768,15 @@ interface StorageKeyParams<TInput = unknown> {
|
|
|
777
768
|
storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
|
|
778
769
|
}
|
|
779
770
|
|
|
771
|
+
interface SilgiRuntimeShareds extends SilgiRuntimeSharedExtends {
|
|
772
|
+
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
773
|
+
silgi: SilgiFunction;
|
|
774
|
+
}
|
|
775
|
+
interface SilgiRuntimeSharedExtends {
|
|
776
|
+
}
|
|
777
|
+
interface ExtendShared {
|
|
778
|
+
}
|
|
779
|
+
|
|
780
780
|
type EventHandlerResponse<T = undefined> = T extends undefined ? void : void | T | Promise<T>;
|
|
781
781
|
type MethodHandlerType<T> = {
|
|
782
782
|
[Action in keyof T]: T[Action] extends Record<string, any> ? {
|
|
@@ -786,7 +786,7 @@ type MethodHandlerType<T> = {
|
|
|
786
786
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
787
787
|
source?: StandardSchemaV1.InferInput<T[Action][Method]['source']>;
|
|
788
788
|
};
|
|
789
|
-
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared:
|
|
789
|
+
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<T[Action][Method]['source']>) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
|
|
790
790
|
modules?: Partial<SilgiRuntimeActions>;
|
|
791
791
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
792
792
|
};
|
|
@@ -795,10 +795,10 @@ type MethodHandlerType<T> = {
|
|
|
795
795
|
interface ResolvedMethodHandlerType {
|
|
796
796
|
input?: Partial<BaseSchemaType<any>>;
|
|
797
797
|
output: Partial<BaseSchemaType<any>>;
|
|
798
|
-
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared:
|
|
798
|
+
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
799
799
|
modules?: Partial<SilgiRuntimeActions>;
|
|
800
800
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
801
|
-
execute: (input: StandardSchemaV1.InferInput<any>, shared:
|
|
801
|
+
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
802
802
|
}
|
|
803
803
|
|
|
804
804
|
/**
|
|
@@ -874,7 +874,7 @@ interface FrameworkContext {
|
|
|
874
874
|
interface Silgi {
|
|
875
875
|
schemas: any;
|
|
876
876
|
services: ResolvedServiceType;
|
|
877
|
-
shared:
|
|
877
|
+
shared: SilgiRuntimeShareds;
|
|
878
878
|
uris: Record<string, any>;
|
|
879
879
|
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
|
|
880
880
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
@@ -948,4 +948,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
948
948
|
|
|
949
949
|
declare const autoImportTypes: string[];
|
|
950
950
|
|
|
951
|
-
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type
|
|
951
|
+
export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silgi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.44",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"import": "./dist/presets/index.mjs"
|
|
43
43
|
},
|
|
44
44
|
"./runtime": {
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"silgiCore": "./dist/runtime/*.ts",
|
|
46
|
+
"silgiCoreTypes": "./dist/runtime/*.ts",
|
|
47
47
|
"types": "./runtime.d.ts",
|
|
48
48
|
"import": "./dist/runtime/index.mjs"
|
|
49
49
|
},
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"import": "./runtime-meta.mjs"
|
|
53
53
|
},
|
|
54
54
|
"./runtime/*": {
|
|
55
|
-
"
|
|
56
|
-
"
|
|
55
|
+
"silgiCore": "./dist/runtime/*.ts",
|
|
56
|
+
"silgiCoreTypes": "./dist/runtime/*.ts",
|
|
57
57
|
"types": "./dist/runtime/*.d.ts",
|
|
58
58
|
"import": "./dist/runtime/*.mjs"
|
|
59
59
|
},
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
|
|
2
|
-
import { Storage, StorageValue } from 'unstorage';
|
|
3
|
-
|
|
4
|
-
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
5
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
9
|
-
declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
|
|
10
|
-
|
|
11
|
-
export { createStorage as c, silgi as s, useSilgiStorage as u };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
|
|
2
|
-
import { Storage, StorageValue } from 'unstorage';
|
|
3
|
-
|
|
4
|
-
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
5
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
9
|
-
declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
|
|
10
|
-
|
|
11
|
-
export { createStorage as c, silgi as s, useSilgiStorage as u };
|