silgi 0.7.13 → 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/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 +10 -9
- package/dist/types/index.d.ts +10 -9
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
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
|
|
|
@@ -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>;
|
|
@@ -455,6 +455,7 @@ type ModuleHookContext = Readonly<{
|
|
|
455
455
|
event?: SilgiEvents;
|
|
456
456
|
operation?: SilgiOperation;
|
|
457
457
|
input?: unknown;
|
|
458
|
+
source?: any;
|
|
458
459
|
result?: unknown;
|
|
459
460
|
modules?: SilgiRuntimeActions;
|
|
460
461
|
timestamp?: number;
|
|
@@ -790,7 +791,7 @@ interface MethodSchemaType<Input, Output> {
|
|
|
790
791
|
input?: Input;
|
|
791
792
|
output: Output;
|
|
792
793
|
};
|
|
793
|
-
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
|
|
794
|
+
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<Output>;
|
|
794
795
|
modules?: Partial<SilgiRuntimeActions>;
|
|
795
796
|
storage?: StorageConfig<Input>;
|
|
796
797
|
}
|
|
@@ -802,7 +803,7 @@ type MethodHandlerType<T> = {
|
|
|
802
803
|
input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
|
|
803
804
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
804
805
|
};
|
|
805
|
-
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']>>;
|
|
806
807
|
modules?: Partial<SilgiRuntimeActions>;
|
|
807
808
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
808
809
|
};
|
|
@@ -811,10 +812,10 @@ type MethodHandlerType<T> = {
|
|
|
811
812
|
interface ResolvedMethodHandlerType {
|
|
812
813
|
input?: Partial<BaseSchemaType<any>>;
|
|
813
814
|
output: Partial<BaseSchemaType<any>>;
|
|
814
|
-
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>>;
|
|
815
816
|
modules?: Partial<SilgiRuntimeActions>;
|
|
816
817
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
817
|
-
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>>;
|
|
818
819
|
}
|
|
819
820
|
|
|
820
821
|
type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
@@ -828,7 +829,7 @@ type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
|
828
829
|
};
|
|
829
830
|
type ServiceType<T> = Partial<{
|
|
830
831
|
[Namespace in keyof T]: T[Namespace] extends Record<string, any> ? {
|
|
831
|
-
[Service in keyof T[Namespace]]?: MethodHandlerType<T[Namespace][Service]
|
|
832
|
+
[Service in keyof T[Namespace]]?: Partial<MethodHandlerType<T[Namespace][Service]>>;
|
|
832
833
|
} : never;
|
|
833
834
|
}>;
|
|
834
835
|
type RequiredServiceType<T> = {
|
|
@@ -866,7 +867,7 @@ interface Silgi {
|
|
|
866
867
|
services: ResolvedServiceType;
|
|
867
868
|
shared: SilgiShareds;
|
|
868
869
|
uris: Record<string, any>;
|
|
869
|
-
modulesURIs: Partial<Record<keyof
|
|
870
|
+
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
|
|
870
871
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
871
872
|
plugins: SilgiAppPlugin[];
|
|
872
873
|
framework: FrameworkContext;
|
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
|
|
|
@@ -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>;
|
|
@@ -455,6 +455,7 @@ type ModuleHookContext = Readonly<{
|
|
|
455
455
|
event?: SilgiEvents;
|
|
456
456
|
operation?: SilgiOperation;
|
|
457
457
|
input?: unknown;
|
|
458
|
+
source?: any;
|
|
458
459
|
result?: unknown;
|
|
459
460
|
modules?: SilgiRuntimeActions;
|
|
460
461
|
timestamp?: number;
|
|
@@ -790,7 +791,7 @@ interface MethodSchemaType<Input, Output> {
|
|
|
790
791
|
input?: Input;
|
|
791
792
|
output: Output;
|
|
792
793
|
};
|
|
793
|
-
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
|
|
794
|
+
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents, source: any) => Promise<Output>;
|
|
794
795
|
modules?: Partial<SilgiRuntimeActions>;
|
|
795
796
|
storage?: StorageConfig<Input>;
|
|
796
797
|
}
|
|
@@ -802,7 +803,7 @@ type MethodHandlerType<T> = {
|
|
|
802
803
|
input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
|
|
803
804
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
804
805
|
};
|
|
805
|
-
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']>>;
|
|
806
807
|
modules?: Partial<SilgiRuntimeActions>;
|
|
807
808
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
808
809
|
};
|
|
@@ -811,10 +812,10 @@ type MethodHandlerType<T> = {
|
|
|
811
812
|
interface ResolvedMethodHandlerType {
|
|
812
813
|
input?: Partial<BaseSchemaType<any>>;
|
|
813
814
|
output: Partial<BaseSchemaType<any>>;
|
|
814
|
-
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>>;
|
|
815
816
|
modules?: Partial<SilgiRuntimeActions>;
|
|
816
817
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
817
|
-
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>>;
|
|
818
819
|
}
|
|
819
820
|
|
|
820
821
|
type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
@@ -828,7 +829,7 @@ type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
|
828
829
|
};
|
|
829
830
|
type ServiceType<T> = Partial<{
|
|
830
831
|
[Namespace in keyof T]: T[Namespace] extends Record<string, any> ? {
|
|
831
|
-
[Service in keyof T[Namespace]]?: MethodHandlerType<T[Namespace][Service]
|
|
832
|
+
[Service in keyof T[Namespace]]?: Partial<MethodHandlerType<T[Namespace][Service]>>;
|
|
832
833
|
} : never;
|
|
833
834
|
}>;
|
|
834
835
|
type RequiredServiceType<T> = {
|
|
@@ -866,7 +867,7 @@ interface Silgi {
|
|
|
866
867
|
services: ResolvedServiceType;
|
|
867
868
|
shared: SilgiShareds;
|
|
868
869
|
uris: Record<string, any>;
|
|
869
|
-
modulesURIs: Partial<Record<keyof
|
|
870
|
+
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
|
|
870
871
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
871
872
|
plugins: SilgiAppPlugin[];
|
|
872
873
|
framework: FrameworkContext;
|