silgi 0.7.12 → 0.7.15
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 +21 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +14 -5
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/shared/{silgi.BuspmWeq.d.mts → silgi.De7qOt2x.d.mts} +1 -1
- package/dist/shared/{silgi.BuspmWeq.d.ts → silgi.De7qOt2x.d.ts} +1 -1
- package/dist/types/index.d.mts +17 -12
- package/dist/types/index.d.ts +17 -12
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -476,7 +476,8 @@ async function schemaTemplate(silgi) {
|
|
|
476
476
|
storeBase: [],
|
|
477
477
|
hooks: [],
|
|
478
478
|
runtimeHooks: [],
|
|
479
|
-
runtimeOptions: []
|
|
479
|
+
runtimeOptions: [],
|
|
480
|
+
methods: []
|
|
480
481
|
};
|
|
481
482
|
const storeBase = [];
|
|
482
483
|
await silgi.callHook("prepare:schema.ts", data);
|
|
@@ -513,6 +514,8 @@ async function schemaTemplate(silgi) {
|
|
|
513
514
|
"",
|
|
514
515
|
`type RuntimeActionExtends = ${data.actions?.length ? data.actions.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
515
516
|
"",
|
|
517
|
+
`type RuntimeMethodExtends = ${data.methods?.length ? data.methods.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
518
|
+
"",
|
|
516
519
|
`type SilgiModuleSharedExtends = ${data.shareds.length ? data.shareds.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
517
520
|
"",
|
|
518
521
|
`type SilgiModuleOptionExtend = ${data.options?.length ? data.options.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
@@ -541,6 +544,7 @@ async function schemaTemplate(silgi) {
|
|
|
541
544
|
" interface SilgiRuntimeOptions extends SilgiRuntimeOptionExtends {}",
|
|
542
545
|
" interface SilgiRuntimeHooks extends SilgiRuntimeHooksExtends {}",
|
|
543
546
|
" interface SilgiHooks extends ModuleHooksExtend {}",
|
|
547
|
+
" interface SilgiRuntimeMethods extends RuntimeMethodExtends {}",
|
|
544
548
|
"}",
|
|
545
549
|
"",
|
|
546
550
|
"export {}"
|
|
@@ -888,6 +892,22 @@ async function registerModuleExportScan(silgi) {
|
|
|
888
892
|
});
|
|
889
893
|
options.runtimeHooks.push({ key: configKey, value: importName });
|
|
890
894
|
}
|
|
895
|
+
if (exportedTypes.includes("ModuleRuntimeOptions")) {
|
|
896
|
+
const importName = pascalCase(`${configKey}RuntimeOptions`);
|
|
897
|
+
options.importItems[configKey].import.push({
|
|
898
|
+
name: `ModuleRuntimeOptions as ${importName}`,
|
|
899
|
+
type: true
|
|
900
|
+
});
|
|
901
|
+
options.runtimeOptions.push({ key: configKey, value: importName });
|
|
902
|
+
}
|
|
903
|
+
if (exportedTypes.includes("SilgiRuntimeMethods")) {
|
|
904
|
+
const importName = pascalCase(`${configKey}RuntimeMethods`);
|
|
905
|
+
options.importItems[configKey].import.push({
|
|
906
|
+
name: `SilgiRuntimeMethods as ${importName}`,
|
|
907
|
+
type: true
|
|
908
|
+
});
|
|
909
|
+
options.methods.push({ key: configKey, value: importName });
|
|
910
|
+
}
|
|
891
911
|
}
|
|
892
912
|
}
|
|
893
913
|
});
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared, SilgiEvents, DefaultNamespaces, BaseSchemaType, SilgiCLI } from 'silgi/types';
|
|
2
|
-
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.
|
|
2
|
+
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.De7qOt2x.mjs';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
4
|
import * as unctx from 'unctx';
|
|
5
5
|
import 'unstorage';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared, SilgiEvents, DefaultNamespaces, BaseSchemaType, SilgiCLI } from 'silgi/types';
|
|
2
|
-
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.
|
|
2
|
+
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.De7qOt2x.js';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
4
|
import * as unctx from 'unctx';
|
|
5
5
|
import 'unstorage';
|
package/dist/core/index.mjs
CHANGED
|
@@ -601,12 +601,12 @@ async function createSilgi(config) {
|
|
|
601
601
|
|
|
602
602
|
function silgi(event) {
|
|
603
603
|
return {
|
|
604
|
-
execute: (uriString, input) => {
|
|
605
|
-
return execute(uriString, input, event);
|
|
604
|
+
execute: (uriString, input, source) => {
|
|
605
|
+
return execute(uriString, input, event, source);
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
|
-
async function execute(uriString, input, event) {
|
|
609
|
+
async function execute(uriString, input, event, source) {
|
|
610
610
|
const silgiCtx = useSilgi();
|
|
611
611
|
if (event) {
|
|
612
612
|
await silgiCtx.callHook("event:before", event);
|
|
@@ -634,7 +634,8 @@ async function execute(uriString, input, event) {
|
|
|
634
634
|
input,
|
|
635
635
|
event,
|
|
636
636
|
modules: handler.modules,
|
|
637
|
-
result
|
|
637
|
+
result,
|
|
638
|
+
source
|
|
638
639
|
});
|
|
639
640
|
const cacheData = await cacheExecute(input, operation, handler, event);
|
|
640
641
|
if (cacheData?.success) {
|
|
@@ -647,7 +648,13 @@ async function execute(uriString, input, event) {
|
|
|
647
648
|
query: operation.query
|
|
648
649
|
};
|
|
649
650
|
silgiCtx.shared.silgi = (_event) => silgi(_event || event);
|
|
650
|
-
result = await handler?.handler(
|
|
651
|
+
result = await handler?.handler(
|
|
652
|
+
router,
|
|
653
|
+
input,
|
|
654
|
+
silgiCtx.shared,
|
|
655
|
+
event,
|
|
656
|
+
source
|
|
657
|
+
);
|
|
651
658
|
success = true;
|
|
652
659
|
}
|
|
653
660
|
await silgiCtx.callHook("action:after", {
|
|
@@ -656,6 +663,7 @@ async function execute(uriString, input, event) {
|
|
|
656
663
|
event,
|
|
657
664
|
result,
|
|
658
665
|
success,
|
|
666
|
+
source,
|
|
659
667
|
modules: handler.modules
|
|
660
668
|
});
|
|
661
669
|
if (!cached) {
|
|
@@ -668,6 +676,7 @@ async function execute(uriString, input, event) {
|
|
|
668
676
|
await silgiCtx.callHook("action:error", {
|
|
669
677
|
input,
|
|
670
678
|
event,
|
|
679
|
+
source,
|
|
671
680
|
error: err instanceof Error ? err : new Error(String(err)),
|
|
672
681
|
timestamp: Date.now()
|
|
673
682
|
});
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractOutputFromURI, Silg
|
|
|
2
2
|
import { Storage, StorageValue } from 'unstorage';
|
|
3
3
|
|
|
4
4
|
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
5
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI
|
|
5
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: string) => Promise<ExtractOutputFromURI<TURI>>;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
@@ -2,7 +2,7 @@ import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractOutputFromURI, Silg
|
|
|
2
2
|
import { Storage, StorageValue } from 'unstorage';
|
|
3
3
|
|
|
4
4
|
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
5
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI
|
|
5
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: string) => Promise<ExtractOutputFromURI<TURI>>;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
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, SilgiShareds as SilgiShareds$1,
|
|
9
|
+
import { ResolvedServiceType as ResolvedServiceType$1, SilgiShareds as SilgiShareds$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
14
|
import { Storage, BuiltinDriverName, TransactionOptions } from 'unstorage';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
|
-
import { u as useSilgiStorage, s as silgi } from '../shared/silgi.
|
|
16
|
+
import { u as useSilgiStorage, s as silgi } from '../shared/silgi.De7qOt2x.mjs';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
@@ -68,7 +68,7 @@ type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TU
|
|
|
68
68
|
type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
|
|
69
69
|
type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
|
|
70
70
|
|
|
71
|
-
interface
|
|
71
|
+
interface SilgiRuntimeMethods {
|
|
72
72
|
}
|
|
73
73
|
interface SilgiNamespaces {
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ interface DefaultNamespaces extends SilgiNamespaces {
|
|
|
76
76
|
}
|
|
77
77
|
interface SilgiRouterTypes {
|
|
78
78
|
}
|
|
79
|
-
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof
|
|
79
|
+
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
|
|
80
80
|
interface DefaultHooks {
|
|
81
81
|
}
|
|
82
82
|
type DeepPartial<T> = T extends void ? T : T extends Record<string, any> ? {
|
|
@@ -117,7 +117,7 @@ interface SilgiCLI {
|
|
|
117
117
|
shareds: SilgiShareds$1;
|
|
118
118
|
uris: Record<string, any>;
|
|
119
119
|
schemas: Record<string, any>;
|
|
120
|
-
modulesURIs: Partial<Record<keyof
|
|
120
|
+
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions$1 | (string & {}), any>>;
|
|
121
121
|
scannedURIs: Map<string, string>;
|
|
122
122
|
templates: SilgiTemplate[];
|
|
123
123
|
hooks: Hookable<SilgiCLIHooks>;
|
|
@@ -221,6 +221,10 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
221
221
|
key: string;
|
|
222
222
|
value: string;
|
|
223
223
|
}[];
|
|
224
|
+
methods: {
|
|
225
|
+
key: string;
|
|
226
|
+
value: string;
|
|
227
|
+
}[];
|
|
224
228
|
contexts: {
|
|
225
229
|
key: string;
|
|
226
230
|
value: string;
|
|
@@ -451,6 +455,7 @@ type ModuleHookContext = Readonly<{
|
|
|
451
455
|
event?: SilgiEvents;
|
|
452
456
|
operation?: SilgiOperation;
|
|
453
457
|
input?: unknown;
|
|
458
|
+
source?: any;
|
|
454
459
|
result?: unknown;
|
|
455
460
|
modules?: SilgiRuntimeActions;
|
|
456
461
|
timestamp?: number;
|
|
@@ -786,7 +791,7 @@ interface MethodSchemaType<Input, Output> {
|
|
|
786
791
|
input?: Input;
|
|
787
792
|
output: Output;
|
|
788
793
|
};
|
|
789
|
-
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
|
|
794
|
+
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<Output>;
|
|
790
795
|
modules?: Partial<SilgiRuntimeActions>;
|
|
791
796
|
storage?: StorageConfig<Input>;
|
|
792
797
|
}
|
|
@@ -798,7 +803,7 @@ type MethodHandlerType<T> = {
|
|
|
798
803
|
input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
|
|
799
804
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
800
805
|
};
|
|
801
|
-
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
|
|
806
|
+
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents, source: any) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
|
|
802
807
|
modules?: Partial<SilgiRuntimeActions>;
|
|
803
808
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
804
809
|
};
|
|
@@ -807,10 +812,10 @@ type MethodHandlerType<T> = {
|
|
|
807
812
|
interface ResolvedMethodHandlerType {
|
|
808
813
|
input?: Partial<BaseSchemaType<any>>;
|
|
809
814
|
output: Partial<BaseSchemaType<any>>;
|
|
810
|
-
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
815
|
+
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
811
816
|
modules?: Partial<SilgiRuntimeActions>;
|
|
812
817
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
813
|
-
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
818
|
+
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
814
819
|
}
|
|
815
820
|
|
|
816
821
|
type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
@@ -824,7 +829,7 @@ type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
|
824
829
|
};
|
|
825
830
|
type ServiceType<T> = Partial<{
|
|
826
831
|
[Namespace in keyof T]: T[Namespace] extends Record<string, any> ? {
|
|
827
|
-
[Service in keyof T[Namespace]]?: MethodHandlerType<T[Namespace][Service]
|
|
832
|
+
[Service in keyof T[Namespace]]?: Partial<MethodHandlerType<T[Namespace][Service]>>;
|
|
828
833
|
} : never;
|
|
829
834
|
}>;
|
|
830
835
|
type RequiredServiceType<T> = {
|
|
@@ -862,7 +867,7 @@ interface Silgi {
|
|
|
862
867
|
services: ResolvedServiceType;
|
|
863
868
|
shared: SilgiShareds;
|
|
864
869
|
uris: Record<string, any>;
|
|
865
|
-
modulesURIs: Partial<Record<keyof
|
|
870
|
+
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
|
|
866
871
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
867
872
|
plugins: SilgiAppPlugin[];
|
|
868
873
|
framework: FrameworkContext;
|
|
@@ -934,4 +939,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
934
939
|
|
|
935
940
|
declare const autoImportTypes: string[];
|
|
936
941
|
|
|
937
|
-
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 FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type MethodSchemaType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, 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
|
|
942
|
+
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 FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type MethodSchemaType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, 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 SilgiSchema, type SilgiServiceInterface, type SilgiShareds, 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, SilgiShareds as SilgiShareds$1,
|
|
9
|
+
import { ResolvedServiceType as ResolvedServiceType$1, SilgiShareds as SilgiShareds$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
14
|
import { Storage, BuiltinDriverName, TransactionOptions } from 'unstorage';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
|
-
import { u as useSilgiStorage, s as silgi } from '../shared/silgi.
|
|
16
|
+
import { u as useSilgiStorage, s as silgi } from '../shared/silgi.De7qOt2x.js';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
@@ -68,7 +68,7 @@ type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TU
|
|
|
68
68
|
type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
|
|
69
69
|
type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
|
|
70
70
|
|
|
71
|
-
interface
|
|
71
|
+
interface SilgiRuntimeMethods {
|
|
72
72
|
}
|
|
73
73
|
interface SilgiNamespaces {
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ interface DefaultNamespaces extends SilgiNamespaces {
|
|
|
76
76
|
}
|
|
77
77
|
interface SilgiRouterTypes {
|
|
78
78
|
}
|
|
79
|
-
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof
|
|
79
|
+
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
|
|
80
80
|
interface DefaultHooks {
|
|
81
81
|
}
|
|
82
82
|
type DeepPartial<T> = T extends void ? T : T extends Record<string, any> ? {
|
|
@@ -117,7 +117,7 @@ interface SilgiCLI {
|
|
|
117
117
|
shareds: SilgiShareds$1;
|
|
118
118
|
uris: Record<string, any>;
|
|
119
119
|
schemas: Record<string, any>;
|
|
120
|
-
modulesURIs: Partial<Record<keyof
|
|
120
|
+
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions$1 | (string & {}), any>>;
|
|
121
121
|
scannedURIs: Map<string, string>;
|
|
122
122
|
templates: SilgiTemplate[];
|
|
123
123
|
hooks: Hookable<SilgiCLIHooks>;
|
|
@@ -221,6 +221,10 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
221
221
|
key: string;
|
|
222
222
|
value: string;
|
|
223
223
|
}[];
|
|
224
|
+
methods: {
|
|
225
|
+
key: string;
|
|
226
|
+
value: string;
|
|
227
|
+
}[];
|
|
224
228
|
contexts: {
|
|
225
229
|
key: string;
|
|
226
230
|
value: string;
|
|
@@ -451,6 +455,7 @@ type ModuleHookContext = Readonly<{
|
|
|
451
455
|
event?: SilgiEvents;
|
|
452
456
|
operation?: SilgiOperation;
|
|
453
457
|
input?: unknown;
|
|
458
|
+
source?: any;
|
|
454
459
|
result?: unknown;
|
|
455
460
|
modules?: SilgiRuntimeActions;
|
|
456
461
|
timestamp?: number;
|
|
@@ -786,7 +791,7 @@ interface MethodSchemaType<Input, Output> {
|
|
|
786
791
|
input?: Input;
|
|
787
792
|
output: Output;
|
|
788
793
|
};
|
|
789
|
-
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
|
|
794
|
+
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<Output>;
|
|
790
795
|
modules?: Partial<SilgiRuntimeActions>;
|
|
791
796
|
storage?: StorageConfig<Input>;
|
|
792
797
|
}
|
|
@@ -798,7 +803,7 @@ type MethodHandlerType<T> = {
|
|
|
798
803
|
input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
|
|
799
804
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
800
805
|
};
|
|
801
|
-
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
|
|
806
|
+
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents, source: any) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
|
|
802
807
|
modules?: Partial<SilgiRuntimeActions>;
|
|
803
808
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
804
809
|
};
|
|
@@ -807,10 +812,10 @@ type MethodHandlerType<T> = {
|
|
|
807
812
|
interface ResolvedMethodHandlerType {
|
|
808
813
|
input?: Partial<BaseSchemaType<any>>;
|
|
809
814
|
output: Partial<BaseSchemaType<any>>;
|
|
810
|
-
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
815
|
+
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
811
816
|
modules?: Partial<SilgiRuntimeActions>;
|
|
812
817
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
813
|
-
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
818
|
+
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
814
819
|
}
|
|
815
820
|
|
|
816
821
|
type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
@@ -824,7 +829,7 @@ type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
|
824
829
|
};
|
|
825
830
|
type ServiceType<T> = Partial<{
|
|
826
831
|
[Namespace in keyof T]: T[Namespace] extends Record<string, any> ? {
|
|
827
|
-
[Service in keyof T[Namespace]]?: MethodHandlerType<T[Namespace][Service]
|
|
832
|
+
[Service in keyof T[Namespace]]?: Partial<MethodHandlerType<T[Namespace][Service]>>;
|
|
828
833
|
} : never;
|
|
829
834
|
}>;
|
|
830
835
|
type RequiredServiceType<T> = {
|
|
@@ -862,7 +867,7 @@ interface Silgi {
|
|
|
862
867
|
services: ResolvedServiceType;
|
|
863
868
|
shared: SilgiShareds;
|
|
864
869
|
uris: Record<string, any>;
|
|
865
|
-
modulesURIs: Partial<Record<keyof
|
|
870
|
+
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
|
|
866
871
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
867
872
|
plugins: SilgiAppPlugin[];
|
|
868
873
|
framework: FrameworkContext;
|
|
@@ -934,4 +939,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
934
939
|
|
|
935
940
|
declare const autoImportTypes: string[];
|
|
936
941
|
|
|
937
|
-
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 FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type MethodSchemaType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, 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
|
|
942
|
+
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 FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type MethodSchemaType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, 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 SilgiSchema, type SilgiServiceInterface, type SilgiShareds, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
|