silgi 0.7.4 → 0.7.6
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 +83 -74
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/ecosystem/nuxt/module.d.mts +3 -3
- package/dist/ecosystem/nuxt/module.d.ts +3 -3
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/shared/{silgi.BFbL2aof.d.mts → silgi.BuspmWeq.d.mts} +2 -2
- package/dist/shared/{silgi.BFbL2aof.d.ts → silgi.BuspmWeq.d.ts} +2 -2
- package/dist/types/index.d.mts +38 -39
- package/dist/types/index.d.ts +38 -39
- package/package.json +4 -3
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -64,14 +64,14 @@ async function h3Framework(silgi, skip = false) {
|
|
|
64
64
|
silgi.hook("prepare:createDTSFramework", (data) => {
|
|
65
65
|
data.importItems["silgi/types"] = {
|
|
66
66
|
import: [
|
|
67
|
-
{ name: "
|
|
67
|
+
{ name: "SilgiRuntimeContext", type: true }
|
|
68
68
|
],
|
|
69
69
|
from: "silgi/types"
|
|
70
70
|
};
|
|
71
71
|
data.customContent?.push(
|
|
72
72
|
"",
|
|
73
73
|
'declare module "h3" {',
|
|
74
|
-
" interface H3EventContext extends
|
|
74
|
+
" interface H3EventContext extends SilgiRuntimeContext {}",
|
|
75
75
|
"}",
|
|
76
76
|
""
|
|
77
77
|
);
|
|
@@ -343,7 +343,7 @@ async function createCoreFramework(silgi) {
|
|
|
343
343
|
const importItems = {
|
|
344
344
|
"silgi/types": {
|
|
345
345
|
import: [
|
|
346
|
-
{ name: "
|
|
346
|
+
{ name: "SilgiRuntimeContext", type: true }
|
|
347
347
|
],
|
|
348
348
|
from: "silgi/types"
|
|
349
349
|
}
|
|
@@ -381,7 +381,7 @@ async function createDTSFramework(silgi) {
|
|
|
381
381
|
const importItems = {
|
|
382
382
|
"silgi/types": {
|
|
383
383
|
import: [
|
|
384
|
-
{ name: "
|
|
384
|
+
{ name: "SilgiRuntimeContext", type: true }
|
|
385
385
|
],
|
|
386
386
|
from: "silgi/types"
|
|
387
387
|
}
|
|
@@ -429,7 +429,7 @@ async function schemaTemplate(silgi) {
|
|
|
429
429
|
import: [
|
|
430
430
|
{ name: "URIsTypes", type: true },
|
|
431
431
|
{ name: "Namespaces", type: true },
|
|
432
|
-
{ name: "
|
|
432
|
+
{ name: "SilgiRuntimeContext", type: true }
|
|
433
433
|
],
|
|
434
434
|
from: "silgi/types"
|
|
435
435
|
}
|
|
@@ -449,14 +449,15 @@ async function schemaTemplate(silgi) {
|
|
|
449
449
|
const data = {
|
|
450
450
|
importItems,
|
|
451
451
|
customImports: [],
|
|
452
|
-
|
|
452
|
+
options: [],
|
|
453
453
|
contexts: [],
|
|
454
|
-
|
|
454
|
+
actions: [],
|
|
455
455
|
shareds: [],
|
|
456
456
|
events: [],
|
|
457
457
|
storeBase: [],
|
|
458
458
|
hooks: [],
|
|
459
|
-
runtimeHooks: []
|
|
459
|
+
runtimeHooks: [],
|
|
460
|
+
runtimeOptions: []
|
|
460
461
|
};
|
|
461
462
|
const storeBase = [];
|
|
462
463
|
await silgi.callHook("prepare:schema.ts", data);
|
|
@@ -487,19 +488,17 @@ async function schemaTemplate(silgi) {
|
|
|
487
488
|
if (item.isSilgiContext) {
|
|
488
489
|
addSilgiContext = true;
|
|
489
490
|
}
|
|
490
|
-
return !item.extends && !addSilgiContext ? ` ${item.key}: ${item.value}` : item.isSilgiContext ? " context:
|
|
491
|
+
return !item.extends && !addSilgiContext ? ` ${item.key}: ${item.value}` : item.isSilgiContext ? " context: SilgiRuntimeContext" : "";
|
|
491
492
|
}).join(",\n")}
|
|
492
493
|
}` : "interface SilgiModuleEventsExtends {}",
|
|
493
494
|
"",
|
|
494
|
-
|
|
495
|
+
`type RuntimeActionExtends = ${data.actions?.length ? data.actions.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
495
496
|
"",
|
|
496
|
-
"
|
|
497
|
-
...(data.methods || []).map(({ key, value }) => ` ${key}: ${value},`),
|
|
498
|
-
"}",
|
|
497
|
+
`type SilgiModuleSharedExtends = ${data.shareds.length ? data.shareds.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
499
498
|
"",
|
|
500
|
-
"
|
|
501
|
-
|
|
502
|
-
"}"
|
|
499
|
+
`type SilgiModuleOptionExtend = ${data.options?.length ? data.options.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
500
|
+
"",
|
|
501
|
+
`type SilgiRuntimeOptionExtends = ${data.runtimeOptions?.length ? data.runtimeOptions.map(({ value }) => `${value}`).join(" & ") : "{}"}`,
|
|
503
502
|
"",
|
|
504
503
|
"interface SilgiStorageBaseExtends {",
|
|
505
504
|
...(storeBase || []).map((value) => ` ${value}: ''`),
|
|
@@ -514,15 +513,15 @@ async function schemaTemplate(silgi) {
|
|
|
514
513
|
" interface SilgiSchema extends SchemaExtends {}",
|
|
515
514
|
" interface SilgiNamespaces extends InferredNamespaces {}",
|
|
516
515
|
" interface SilgiStorageBase extends SilgiStorageBaseExtends {}",
|
|
517
|
-
" interface SilgiModules extends SilgiModuleOptionsExtends {}",
|
|
518
516
|
" interface SilgiURIs extends SilgiURIsMerge {}",
|
|
519
|
-
" interface
|
|
520
|
-
" interface
|
|
521
|
-
" interface
|
|
522
|
-
" interface
|
|
523
|
-
" interface
|
|
524
|
-
" interface
|
|
525
|
-
" interface
|
|
517
|
+
" interface SilgiRuntimeContext extends SilgiModuleContextExtends {}",
|
|
518
|
+
" interface SilgiEvents extends SilgiModuleEventsExtends {}",
|
|
519
|
+
" interface SilgiShareds extends SilgiModuleSharedExtends {}",
|
|
520
|
+
" interface SilgiRuntimeActions extends RuntimeActionExtends {}",
|
|
521
|
+
" interface SilgiModuleOptions extends SilgiModuleOptionExtend {}",
|
|
522
|
+
" interface SilgiRuntimeOptions extends SilgiRuntimeOptionExtends {}",
|
|
523
|
+
" interface SilgiRuntimeHooks extends SilgiRuntimeHooksExtends {}",
|
|
524
|
+
" interface SilgiHooks extends ModuleHooksExtend {}",
|
|
526
525
|
"}",
|
|
527
526
|
"",
|
|
528
527
|
"export {}"
|
|
@@ -543,7 +542,7 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
543
542
|
},
|
|
544
543
|
"silgi/types": {
|
|
545
544
|
import: [
|
|
546
|
-
{ name: "
|
|
545
|
+
{ name: "SilgiRuntimeOptions", type: true },
|
|
547
546
|
{ name: "SilgiOptions", type: true },
|
|
548
547
|
{ name: "FrameworkContext", type: true },
|
|
549
548
|
{ name: "DeepPartial", type: true },
|
|
@@ -642,9 +641,9 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
642
641
|
}),
|
|
643
642
|
shareds.length > 0 ? "])" : "}",
|
|
644
643
|
"",
|
|
645
|
-
`export const _silgiOptions: DeepPartial<
|
|
644
|
+
`export const _silgiOptions: DeepPartial<SilgiRuntimeOptions> = ${JSON.stringify(_silgiOptions, null, 2)}`,
|
|
646
645
|
"",
|
|
647
|
-
"export async function buildSilgi(framework: FrameworkContext, moduleOptions?: Partial<
|
|
646
|
+
"export async function buildSilgi(framework: FrameworkContext, moduleOptions?: Partial<SilgiRuntimeOptions>,buildOptions?: Partial<BuildConfig>, ) {",
|
|
648
647
|
" const silgi = await createSilgi({",
|
|
649
648
|
" framework,",
|
|
650
649
|
" shared: shareds as any,",
|
|
@@ -813,53 +812,63 @@ async function registerModuleExportScan(silgi) {
|
|
|
813
812
|
from: module.meta._packageName ? moduleName : relativeWithDot(silgi.options.build.typesDir, module.entryPath)
|
|
814
813
|
};
|
|
815
814
|
const exportedTypes = exports.filter((exp) => exp.type).map((exp) => exp.name);
|
|
816
|
-
if (
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
815
|
+
if (!module.meta._packageName) {
|
|
816
|
+
if (exportedTypes.includes("ModuleOptions")) {
|
|
817
|
+
const importName = pascalCase(`${configKey}Config`);
|
|
818
|
+
options.importItems[configKey].import.push({
|
|
819
|
+
name: `ModuleOptions as ${importName}`,
|
|
820
|
+
type: true
|
|
821
|
+
});
|
|
822
|
+
options.options.push({ key: configKey, value: importName });
|
|
823
|
+
}
|
|
824
|
+
if (exportedTypes.includes("SilgiRuntimeOptions")) {
|
|
825
|
+
const importName = pascalCase(`${configKey}RuntimeConfig`);
|
|
826
|
+
options.importItems[configKey].import.push({
|
|
827
|
+
name: `SilgiRuntimeOptions as ${importName}`,
|
|
828
|
+
type: true
|
|
829
|
+
});
|
|
830
|
+
options.runtimeOptions.push({ key: configKey, value: importName });
|
|
831
|
+
}
|
|
832
|
+
if (exportedTypes.includes("ModuleRuntimeContext")) {
|
|
833
|
+
const importName = pascalCase(`${configKey}RuntimeContext`);
|
|
834
|
+
options.importItems[configKey].import.push({
|
|
835
|
+
name: `ModuleRuntimeContext as ${importName}`,
|
|
836
|
+
type: true
|
|
837
|
+
});
|
|
838
|
+
options.contexts.push({ key: configKey, value: importName });
|
|
839
|
+
}
|
|
840
|
+
if (exportedTypes.includes("ModuleRuntimeAction")) {
|
|
841
|
+
const importName = pascalCase(`${configKey}Action`);
|
|
842
|
+
options.importItems[configKey].import.push({
|
|
843
|
+
name: `ModuleRuntimeAction as ${importName}`,
|
|
844
|
+
type: true
|
|
845
|
+
});
|
|
846
|
+
options.actions.push({ key: configKey, value: importName });
|
|
847
|
+
}
|
|
848
|
+
if (exportedTypes.includes("ModuleRuntimeShared")) {
|
|
849
|
+
const importName = pascalCase(`${configKey}Shared`);
|
|
850
|
+
options.importItems[configKey].import.push({
|
|
851
|
+
name: `ModuleRuntimeShared as ${importName}`,
|
|
852
|
+
type: true
|
|
853
|
+
});
|
|
854
|
+
options.shareds.push({ key: configKey, value: importName });
|
|
855
|
+
}
|
|
856
|
+
if (exportedTypes.includes("ModuleHooks")) {
|
|
857
|
+
const importName = pascalCase(`${configKey}Hooks`);
|
|
858
|
+
options.importItems[configKey].import.push({
|
|
859
|
+
name: `ModuleHooks as ${importName}`,
|
|
860
|
+
type: true
|
|
861
|
+
});
|
|
862
|
+
options.hooks.push({ key: configKey, value: importName });
|
|
863
|
+
}
|
|
864
|
+
if (exportedTypes.includes("ModuleRuntimeHooks")) {
|
|
865
|
+
const importName = pascalCase(`${configKey}RuntimeHooks`);
|
|
866
|
+
options.importItems[configKey].import.push({
|
|
867
|
+
name: `ModuleRuntimeHooks as ${importName}`,
|
|
868
|
+
type: true
|
|
869
|
+
});
|
|
870
|
+
options.runtimeHooks.push({ key: configKey, value: importName });
|
|
871
|
+
}
|
|
863
872
|
}
|
|
864
873
|
}
|
|
865
874
|
});
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SilgiConfig, Silgi, SilgiRouterTypes, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared,
|
|
1
|
+
import { SilgiConfig, Silgi, SilgiRouterTypes, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared, SilgiEvents, DefaultNamespaces, BaseSchemaType, SilgiCLI } from 'silgi/types';
|
|
2
2
|
import { FetchOptions } from 'ofetch';
|
|
3
|
-
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.
|
|
3
|
+
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.BuspmWeq.mjs';
|
|
4
4
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
5
|
import * as unctx from 'unctx';
|
|
6
6
|
import 'unstorage';
|
|
@@ -52,7 +52,7 @@ declare function mergeSchemas<T extends MergedSilgiSchema[]>(typesOrArray: [...T
|
|
|
52
52
|
declare function mergeServices<T extends ServiceType<SilgiSchema>[]>(servicesOrArray: [...T] | T): RequiredServiceType<SilgiSchema>;
|
|
53
53
|
declare function mergeShared<T extends ModuleRuntimeShared[]>(sharedOrArray: [...T] | T): UnionToIntersection<T[number]>;
|
|
54
54
|
|
|
55
|
-
declare function getEvent<T>(event?:
|
|
55
|
+
declare function getEvent<T>(event?: SilgiEvents): T;
|
|
56
56
|
|
|
57
57
|
declare function createSchema<T extends Partial<Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>>>>(silgiType: T): {
|
|
58
58
|
[K in keyof T]: {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SilgiConfig, Silgi, SilgiRouterTypes, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared,
|
|
1
|
+
import { SilgiConfig, Silgi, SilgiRouterTypes, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared, SilgiEvents, DefaultNamespaces, BaseSchemaType, SilgiCLI } from 'silgi/types';
|
|
2
2
|
import { FetchOptions } from 'ofetch';
|
|
3
|
-
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.
|
|
3
|
+
export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.BuspmWeq.js';
|
|
4
4
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
5
|
import * as unctx from 'unctx';
|
|
6
6
|
import 'unstorage';
|
|
@@ -52,7 +52,7 @@ declare function mergeSchemas<T extends MergedSilgiSchema[]>(typesOrArray: [...T
|
|
|
52
52
|
declare function mergeServices<T extends ServiceType<SilgiSchema>[]>(servicesOrArray: [...T] | T): RequiredServiceType<SilgiSchema>;
|
|
53
53
|
declare function mergeShared<T extends ModuleRuntimeShared[]>(sharedOrArray: [...T] | T): UnionToIntersection<T[number]>;
|
|
54
54
|
|
|
55
|
-
declare function getEvent<T>(event?:
|
|
55
|
+
declare function getEvent<T>(event?: SilgiEvents): T;
|
|
56
56
|
|
|
57
57
|
declare function createSchema<T extends Partial<Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>>>>(silgiType: T): {
|
|
58
58
|
[K in keyof T]: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface SilgiModuleOptions {
|
|
4
4
|
}
|
|
5
|
-
declare const _default: _nuxt_schema.NuxtModule<
|
|
5
|
+
declare const _default: _nuxt_schema.NuxtModule<SilgiModuleOptions, SilgiModuleOptions, false>;
|
|
6
6
|
|
|
7
|
-
export { type
|
|
7
|
+
export { type SilgiModuleOptions, _default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface SilgiModuleOptions {
|
|
4
4
|
}
|
|
5
|
-
declare const _default: _nuxt_schema.NuxtModule<
|
|
5
|
+
declare const _default: _nuxt_schema.NuxtModule<SilgiModuleOptions, SilgiModuleOptions, false>;
|
|
6
6
|
|
|
7
|
-
export { type
|
|
7
|
+
export { type SilgiModuleOptions, _default as default };
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
|
|
2
2
|
import { Storage, StorageValue } from 'unstorage';
|
|
3
3
|
|
|
4
|
-
declare function silgi(event?:
|
|
4
|
+
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
5
5
|
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
6
6
|
};
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
|
|
2
2
|
import { Storage, StorageValue } from 'unstorage';
|
|
3
3
|
|
|
4
|
-
declare function silgi(event?:
|
|
4
|
+
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
5
5
|
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
6
6
|
};
|
|
7
7
|
|
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, SilgiShareds as SilgiShareds$1, SilgiOptions as SilgiOptions$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.BuspmWeq.mjs';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
@@ -76,8 +76,6 @@ interface DefaultNamespaces extends SilgiNamespaces {
|
|
|
76
76
|
}
|
|
77
77
|
interface SilgiRouterTypes {
|
|
78
78
|
}
|
|
79
|
-
interface SilgiHook {
|
|
80
|
-
}
|
|
81
79
|
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiMethods;
|
|
82
80
|
interface DefaultHooks {
|
|
83
81
|
}
|
|
@@ -116,10 +114,10 @@ interface ImportItem {
|
|
|
116
114
|
interface SilgiCLI {
|
|
117
115
|
_ignore?: Ignore;
|
|
118
116
|
services: ResolvedServiceType$1;
|
|
119
|
-
shareds:
|
|
117
|
+
shareds: SilgiShareds$1;
|
|
120
118
|
uris: Record<string, any>;
|
|
121
119
|
schemas: Record<string, any>;
|
|
122
|
-
modulesURIs: Partial<Record<keyof
|
|
120
|
+
modulesURIs: Partial<Record<keyof SilgiOptions$1, any>>;
|
|
123
121
|
scannedURIs: Map<string, string>;
|
|
124
122
|
templates: SilgiTemplate[];
|
|
125
123
|
hooks: Hookable<SilgiCLIHooks>;
|
|
@@ -209,13 +207,17 @@ type TSReference = {
|
|
|
209
207
|
} | {
|
|
210
208
|
path: string;
|
|
211
209
|
};
|
|
212
|
-
interface
|
|
210
|
+
interface SilgiHooks {
|
|
213
211
|
}
|
|
214
212
|
interface GenerateAppOptions {
|
|
215
213
|
filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
|
|
216
214
|
}
|
|
217
215
|
interface SchemaPreparationOptions extends ImportItem {
|
|
218
|
-
|
|
216
|
+
options: {
|
|
217
|
+
key: string;
|
|
218
|
+
value: string;
|
|
219
|
+
}[];
|
|
220
|
+
runtimeOptions: {
|
|
219
221
|
key: string;
|
|
220
222
|
value: string;
|
|
221
223
|
}[];
|
|
@@ -223,7 +225,7 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
223
225
|
key: string;
|
|
224
226
|
value: string;
|
|
225
227
|
}[];
|
|
226
|
-
|
|
228
|
+
actions: {
|
|
227
229
|
key: string;
|
|
228
230
|
value: string;
|
|
229
231
|
}[];
|
|
@@ -236,7 +238,7 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
236
238
|
value: string;
|
|
237
239
|
/**
|
|
238
240
|
* Extend olursa key value interface icine eklenmez.
|
|
239
|
-
* interface SilgiModuleEventsExtends extends
|
|
241
|
+
* interface SilgiModuleEventsExtends extends SilgiEvents {}
|
|
240
242
|
*/
|
|
241
243
|
extends?: boolean;
|
|
242
244
|
isSilgiContext?: boolean;
|
|
@@ -251,7 +253,7 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
251
253
|
value: string;
|
|
252
254
|
}[];
|
|
253
255
|
}
|
|
254
|
-
interface SilgiCLIHooks extends
|
|
256
|
+
interface SilgiCLIHooks extends SilgiHooks {
|
|
255
257
|
/**
|
|
256
258
|
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
257
259
|
* @param silgi The configured Silgi object
|
|
@@ -333,7 +335,7 @@ interface SilgiCLIHooks extends ModuleHooks {
|
|
|
333
335
|
/**
|
|
334
336
|
* Bu nitrojs, h3 event or request context.
|
|
335
337
|
*/
|
|
336
|
-
interface
|
|
338
|
+
interface SilgiEvents extends Record<string, unknown> {
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
/**
|
|
@@ -387,11 +389,11 @@ interface SilgiOperation {
|
|
|
387
389
|
query?: Record<string, string>;
|
|
388
390
|
}
|
|
389
391
|
|
|
390
|
-
interface
|
|
392
|
+
interface SilgiRuntimeActions {
|
|
391
393
|
}
|
|
392
|
-
interface
|
|
394
|
+
interface SilgiModuleOptions {
|
|
393
395
|
}
|
|
394
|
-
interface
|
|
396
|
+
interface SilgiRuntimeOptions {
|
|
395
397
|
}
|
|
396
398
|
type SilgiModuleInput = (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false);
|
|
397
399
|
interface SilgiCompatibility {
|
|
@@ -446,11 +448,11 @@ interface ResolvedModuleMeta extends ModuleMeta {
|
|
|
446
448
|
name: string;
|
|
447
449
|
}
|
|
448
450
|
type ModuleHookContext = Readonly<{
|
|
449
|
-
event?:
|
|
451
|
+
event?: SilgiEvents;
|
|
450
452
|
operation?: SilgiOperation;
|
|
451
453
|
input?: unknown;
|
|
452
454
|
result?: unknown;
|
|
453
|
-
modules?:
|
|
455
|
+
modules?: SilgiRuntimeActions;
|
|
454
456
|
timestamp?: number;
|
|
455
457
|
meta?: Record<string, unknown>;
|
|
456
458
|
error?: Error;
|
|
@@ -487,7 +489,6 @@ interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom
|
|
|
487
489
|
getOptions?: (inlineOptions?: Partial<TOptions>, silgi?: SilgiCLI) => Promise<TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions>;
|
|
488
490
|
getMeta?: () => Promise<ModuleMeta>;
|
|
489
491
|
}
|
|
490
|
-
type ModuleConfigurations = SilgiModuleMethods;
|
|
491
492
|
|
|
492
493
|
type SilgiPreset = SilgiCLIConfig | (() => SilgiCLIConfig);
|
|
493
494
|
interface SilgiPresetMeta {
|
|
@@ -710,7 +711,7 @@ interface SilgiCLIOptions extends PresetOptions {
|
|
|
710
711
|
/**
|
|
711
712
|
* Silgi input config (silgi.config)
|
|
712
713
|
*/
|
|
713
|
-
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate'>>, C12InputConfig<SilgiCLIConfig>, DeepPartial<
|
|
714
|
+
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate'>>, C12InputConfig<SilgiCLIConfig>, DeepPartial<SilgiModuleOptions> {
|
|
714
715
|
preset?: PresetNameInput;
|
|
715
716
|
extends?: string | string[] | SilgiPreset;
|
|
716
717
|
compatibilityDate?: CompatibilityDateSpec;
|
|
@@ -765,7 +766,7 @@ interface SilgiOptions {
|
|
|
765
766
|
[key: string]: any;
|
|
766
767
|
}
|
|
767
768
|
|
|
768
|
-
interface
|
|
769
|
+
interface SilgiRuntimeContext extends Record<string, any> {
|
|
769
770
|
}
|
|
770
771
|
interface ExtendContext {
|
|
771
772
|
}
|
|
@@ -778,7 +779,7 @@ interface GraphQLJSON {
|
|
|
778
779
|
references: any;
|
|
779
780
|
}
|
|
780
781
|
|
|
781
|
-
interface
|
|
782
|
+
interface SilgiShareds extends ModuleRuntimeShared {
|
|
782
783
|
storage: (...data: Parameters<typeof useSilgiStorage>) => ReturnType<typeof useSilgiStorage>;
|
|
783
784
|
silgi: SilgiFunction;
|
|
784
785
|
}
|
|
@@ -792,8 +793,8 @@ interface MethodSchemaType<Input, Output> {
|
|
|
792
793
|
input?: Input;
|
|
793
794
|
output: Output;
|
|
794
795
|
};
|
|
795
|
-
handler: (input: Input, shared:
|
|
796
|
-
modules?: Partial<
|
|
796
|
+
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
|
|
797
|
+
modules?: Partial<SilgiRuntimeActions>;
|
|
797
798
|
storage?: StorageConfig<Input>;
|
|
798
799
|
}
|
|
799
800
|
type EventHandlerResponse<T = undefined> = T extends undefined ? void : void | T | Promise<T>;
|
|
@@ -804,8 +805,8 @@ type MethodHandlerType<T> = {
|
|
|
804
805
|
input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
|
|
805
806
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
806
807
|
};
|
|
807
|
-
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared:
|
|
808
|
-
modules?: Partial<
|
|
808
|
+
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']>>;
|
|
809
|
+
modules?: Partial<SilgiRuntimeActions>;
|
|
809
810
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
810
811
|
};
|
|
811
812
|
} : never;
|
|
@@ -813,10 +814,10 @@ type MethodHandlerType<T> = {
|
|
|
813
814
|
interface ResolvedMethodHandlerType {
|
|
814
815
|
input?: Partial<BaseSchemaType<any>>;
|
|
815
816
|
output: Partial<BaseSchemaType<any>>;
|
|
816
|
-
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared:
|
|
817
|
-
modules?: Partial<
|
|
817
|
+
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
818
|
+
modules?: Partial<SilgiRuntimeActions>;
|
|
818
819
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
819
|
-
execute: (input: StandardSchemaV1.InferInput<any>, shared:
|
|
820
|
+
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
820
821
|
}
|
|
821
822
|
|
|
822
823
|
type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
@@ -866,14 +867,14 @@ interface FrameworkContext {
|
|
|
866
867
|
interface Silgi {
|
|
867
868
|
schemas: any;
|
|
868
869
|
services: ResolvedServiceType;
|
|
869
|
-
shared:
|
|
870
|
+
shared: SilgiShareds;
|
|
870
871
|
uris: Record<string, any>;
|
|
871
|
-
modulesURIs: Partial<Record<keyof
|
|
872
|
+
modulesURIs: Partial<Record<keyof SilgiOptions, any>>;
|
|
872
873
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
873
874
|
plugins: SilgiAppPlugin[];
|
|
874
875
|
framework: FrameworkContext;
|
|
875
876
|
_ignore?: Ignore;
|
|
876
|
-
hooks: Hookable<
|
|
877
|
+
hooks: Hookable<SilgiRuntimeHooks & DefaultHooks>;
|
|
877
878
|
hook: Silgi['hooks']['hook'];
|
|
878
879
|
callHook: Silgi['hooks']['callHook'];
|
|
879
880
|
addHooks: Silgi['hooks']['addHooks'];
|
|
@@ -881,10 +882,10 @@ interface Silgi {
|
|
|
881
882
|
close: () => Promise<void>;
|
|
882
883
|
logger: ConsolaInstance;
|
|
883
884
|
storage: Storage;
|
|
884
|
-
options: SilgiOptions &
|
|
885
|
+
options: SilgiOptions & SilgiRuntimeOptions;
|
|
885
886
|
captureError: CaptureError;
|
|
886
887
|
}
|
|
887
|
-
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<
|
|
888
|
+
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiRuntimeOptions> {
|
|
888
889
|
options: DeepPartial<SilgiOptions>;
|
|
889
890
|
}
|
|
890
891
|
interface BuildConfig extends Partial<Omit<SilgiConfig, 'services' | 'shared' | 'schemas' | 'uris' | 'modulesURIs' | 'plugins' | 'framework' | 'ready' | 'close' | 'captureError' | '_ignore' | 'plugins' | 'scannedHandlers' | 'options'>> {
|
|
@@ -896,17 +897,15 @@ interface SilgiAppPlugin {
|
|
|
896
897
|
}
|
|
897
898
|
|
|
898
899
|
interface CapturedErrorContext {
|
|
899
|
-
event?:
|
|
900
|
+
event?: SilgiEvents;
|
|
900
901
|
[key: string]: unknown;
|
|
901
902
|
}
|
|
902
903
|
type CaptureError = (error: Error, context: CapturedErrorContext) => void;
|
|
903
904
|
|
|
904
|
-
interface ModuleRuntimeHooks {
|
|
905
|
-
}
|
|
906
905
|
/**
|
|
907
906
|
* The listeners to Silgi
|
|
908
907
|
*/
|
|
909
|
-
interface
|
|
908
|
+
interface SilgiRuntimeHooks {
|
|
910
909
|
/**
|
|
911
910
|
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
912
911
|
* @param silgi The configured Silgi object
|
|
@@ -924,7 +923,7 @@ interface SilgiHooks extends ModuleRuntimeHooks {
|
|
|
924
923
|
'action:after': (context: ModuleHookContext) => HookResult;
|
|
925
924
|
'action:error': (context: ModuleHookContext) => HookResult;
|
|
926
925
|
'action:finally': (context: ModuleHookContext) => HookResult;
|
|
927
|
-
'event:before': (event:
|
|
926
|
+
'event:before': (event: SilgiEvents) => HookResult;
|
|
928
927
|
'error': CaptureError;
|
|
929
928
|
}
|
|
930
929
|
|
|
@@ -938,4 +937,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
938
937
|
|
|
939
938
|
declare const autoImportTypes: string[];
|
|
940
939
|
|
|
941
|
-
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
|
|
940
|
+
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 SilgiMethods, 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 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,
|
|
9
|
+
import { ResolvedServiceType as ResolvedServiceType$1, SilgiShareds as SilgiShareds$1, SilgiOptions as SilgiOptions$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.BuspmWeq.js';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
@@ -76,8 +76,6 @@ interface DefaultNamespaces extends SilgiNamespaces {
|
|
|
76
76
|
}
|
|
77
77
|
interface SilgiRouterTypes {
|
|
78
78
|
}
|
|
79
|
-
interface SilgiHook {
|
|
80
|
-
}
|
|
81
79
|
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiMethods;
|
|
82
80
|
interface DefaultHooks {
|
|
83
81
|
}
|
|
@@ -116,10 +114,10 @@ interface ImportItem {
|
|
|
116
114
|
interface SilgiCLI {
|
|
117
115
|
_ignore?: Ignore;
|
|
118
116
|
services: ResolvedServiceType$1;
|
|
119
|
-
shareds:
|
|
117
|
+
shareds: SilgiShareds$1;
|
|
120
118
|
uris: Record<string, any>;
|
|
121
119
|
schemas: Record<string, any>;
|
|
122
|
-
modulesURIs: Partial<Record<keyof
|
|
120
|
+
modulesURIs: Partial<Record<keyof SilgiOptions$1, any>>;
|
|
123
121
|
scannedURIs: Map<string, string>;
|
|
124
122
|
templates: SilgiTemplate[];
|
|
125
123
|
hooks: Hookable<SilgiCLIHooks>;
|
|
@@ -209,13 +207,17 @@ type TSReference = {
|
|
|
209
207
|
} | {
|
|
210
208
|
path: string;
|
|
211
209
|
};
|
|
212
|
-
interface
|
|
210
|
+
interface SilgiHooks {
|
|
213
211
|
}
|
|
214
212
|
interface GenerateAppOptions {
|
|
215
213
|
filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
|
|
216
214
|
}
|
|
217
215
|
interface SchemaPreparationOptions extends ImportItem {
|
|
218
|
-
|
|
216
|
+
options: {
|
|
217
|
+
key: string;
|
|
218
|
+
value: string;
|
|
219
|
+
}[];
|
|
220
|
+
runtimeOptions: {
|
|
219
221
|
key: string;
|
|
220
222
|
value: string;
|
|
221
223
|
}[];
|
|
@@ -223,7 +225,7 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
223
225
|
key: string;
|
|
224
226
|
value: string;
|
|
225
227
|
}[];
|
|
226
|
-
|
|
228
|
+
actions: {
|
|
227
229
|
key: string;
|
|
228
230
|
value: string;
|
|
229
231
|
}[];
|
|
@@ -236,7 +238,7 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
236
238
|
value: string;
|
|
237
239
|
/**
|
|
238
240
|
* Extend olursa key value interface icine eklenmez.
|
|
239
|
-
* interface SilgiModuleEventsExtends extends
|
|
241
|
+
* interface SilgiModuleEventsExtends extends SilgiEvents {}
|
|
240
242
|
*/
|
|
241
243
|
extends?: boolean;
|
|
242
244
|
isSilgiContext?: boolean;
|
|
@@ -251,7 +253,7 @@ interface SchemaPreparationOptions extends ImportItem {
|
|
|
251
253
|
value: string;
|
|
252
254
|
}[];
|
|
253
255
|
}
|
|
254
|
-
interface SilgiCLIHooks extends
|
|
256
|
+
interface SilgiCLIHooks extends SilgiHooks {
|
|
255
257
|
/**
|
|
256
258
|
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
257
259
|
* @param silgi The configured Silgi object
|
|
@@ -333,7 +335,7 @@ interface SilgiCLIHooks extends ModuleHooks {
|
|
|
333
335
|
/**
|
|
334
336
|
* Bu nitrojs, h3 event or request context.
|
|
335
337
|
*/
|
|
336
|
-
interface
|
|
338
|
+
interface SilgiEvents extends Record<string, unknown> {
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
/**
|
|
@@ -387,11 +389,11 @@ interface SilgiOperation {
|
|
|
387
389
|
query?: Record<string, string>;
|
|
388
390
|
}
|
|
389
391
|
|
|
390
|
-
interface
|
|
392
|
+
interface SilgiRuntimeActions {
|
|
391
393
|
}
|
|
392
|
-
interface
|
|
394
|
+
interface SilgiModuleOptions {
|
|
393
395
|
}
|
|
394
|
-
interface
|
|
396
|
+
interface SilgiRuntimeOptions {
|
|
395
397
|
}
|
|
396
398
|
type SilgiModuleInput = (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false);
|
|
397
399
|
interface SilgiCompatibility {
|
|
@@ -446,11 +448,11 @@ interface ResolvedModuleMeta extends ModuleMeta {
|
|
|
446
448
|
name: string;
|
|
447
449
|
}
|
|
448
450
|
type ModuleHookContext = Readonly<{
|
|
449
|
-
event?:
|
|
451
|
+
event?: SilgiEvents;
|
|
450
452
|
operation?: SilgiOperation;
|
|
451
453
|
input?: unknown;
|
|
452
454
|
result?: unknown;
|
|
453
|
-
modules?:
|
|
455
|
+
modules?: SilgiRuntimeActions;
|
|
454
456
|
timestamp?: number;
|
|
455
457
|
meta?: Record<string, unknown>;
|
|
456
458
|
error?: Error;
|
|
@@ -487,7 +489,6 @@ interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom
|
|
|
487
489
|
getOptions?: (inlineOptions?: Partial<TOptions>, silgi?: SilgiCLI) => Promise<TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions>;
|
|
488
490
|
getMeta?: () => Promise<ModuleMeta>;
|
|
489
491
|
}
|
|
490
|
-
type ModuleConfigurations = SilgiModuleMethods;
|
|
491
492
|
|
|
492
493
|
type SilgiPreset = SilgiCLIConfig | (() => SilgiCLIConfig);
|
|
493
494
|
interface SilgiPresetMeta {
|
|
@@ -710,7 +711,7 @@ interface SilgiCLIOptions extends PresetOptions {
|
|
|
710
711
|
/**
|
|
711
712
|
* Silgi input config (silgi.config)
|
|
712
713
|
*/
|
|
713
|
-
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate'>>, C12InputConfig<SilgiCLIConfig>, DeepPartial<
|
|
714
|
+
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate'>>, C12InputConfig<SilgiCLIConfig>, DeepPartial<SilgiModuleOptions> {
|
|
714
715
|
preset?: PresetNameInput;
|
|
715
716
|
extends?: string | string[] | SilgiPreset;
|
|
716
717
|
compatibilityDate?: CompatibilityDateSpec;
|
|
@@ -765,7 +766,7 @@ interface SilgiOptions {
|
|
|
765
766
|
[key: string]: any;
|
|
766
767
|
}
|
|
767
768
|
|
|
768
|
-
interface
|
|
769
|
+
interface SilgiRuntimeContext extends Record<string, any> {
|
|
769
770
|
}
|
|
770
771
|
interface ExtendContext {
|
|
771
772
|
}
|
|
@@ -778,7 +779,7 @@ interface GraphQLJSON {
|
|
|
778
779
|
references: any;
|
|
779
780
|
}
|
|
780
781
|
|
|
781
|
-
interface
|
|
782
|
+
interface SilgiShareds extends ModuleRuntimeShared {
|
|
782
783
|
storage: (...data: Parameters<typeof useSilgiStorage>) => ReturnType<typeof useSilgiStorage>;
|
|
783
784
|
silgi: SilgiFunction;
|
|
784
785
|
}
|
|
@@ -792,8 +793,8 @@ interface MethodSchemaType<Input, Output> {
|
|
|
792
793
|
input?: Input;
|
|
793
794
|
output: Output;
|
|
794
795
|
};
|
|
795
|
-
handler: (input: Input, shared:
|
|
796
|
-
modules?: Partial<
|
|
796
|
+
handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
|
|
797
|
+
modules?: Partial<SilgiRuntimeActions>;
|
|
797
798
|
storage?: StorageConfig<Input>;
|
|
798
799
|
}
|
|
799
800
|
type EventHandlerResponse<T = undefined> = T extends undefined ? void : void | T | Promise<T>;
|
|
@@ -804,8 +805,8 @@ type MethodHandlerType<T> = {
|
|
|
804
805
|
input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
|
|
805
806
|
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
806
807
|
};
|
|
807
|
-
handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared:
|
|
808
|
-
modules?: Partial<
|
|
808
|
+
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']>>;
|
|
809
|
+
modules?: Partial<SilgiRuntimeActions>;
|
|
809
810
|
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
810
811
|
};
|
|
811
812
|
} : never;
|
|
@@ -813,10 +814,10 @@ type MethodHandlerType<T> = {
|
|
|
813
814
|
interface ResolvedMethodHandlerType {
|
|
814
815
|
input?: Partial<BaseSchemaType<any>>;
|
|
815
816
|
output: Partial<BaseSchemaType<any>>;
|
|
816
|
-
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared:
|
|
817
|
-
modules?: Partial<
|
|
817
|
+
handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
818
|
+
modules?: Partial<SilgiRuntimeActions>;
|
|
818
819
|
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
819
|
-
execute: (input: StandardSchemaV1.InferInput<any>, shared:
|
|
820
|
+
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
820
821
|
}
|
|
821
822
|
|
|
822
823
|
type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
@@ -866,14 +867,14 @@ interface FrameworkContext {
|
|
|
866
867
|
interface Silgi {
|
|
867
868
|
schemas: any;
|
|
868
869
|
services: ResolvedServiceType;
|
|
869
|
-
shared:
|
|
870
|
+
shared: SilgiShareds;
|
|
870
871
|
uris: Record<string, any>;
|
|
871
|
-
modulesURIs: Partial<Record<keyof
|
|
872
|
+
modulesURIs: Partial<Record<keyof SilgiOptions, any>>;
|
|
872
873
|
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
873
874
|
plugins: SilgiAppPlugin[];
|
|
874
875
|
framework: FrameworkContext;
|
|
875
876
|
_ignore?: Ignore;
|
|
876
|
-
hooks: Hookable<
|
|
877
|
+
hooks: Hookable<SilgiRuntimeHooks & DefaultHooks>;
|
|
877
878
|
hook: Silgi['hooks']['hook'];
|
|
878
879
|
callHook: Silgi['hooks']['callHook'];
|
|
879
880
|
addHooks: Silgi['hooks']['addHooks'];
|
|
@@ -881,10 +882,10 @@ interface Silgi {
|
|
|
881
882
|
close: () => Promise<void>;
|
|
882
883
|
logger: ConsolaInstance;
|
|
883
884
|
storage: Storage;
|
|
884
|
-
options: SilgiOptions &
|
|
885
|
+
options: SilgiOptions & SilgiRuntimeOptions;
|
|
885
886
|
captureError: CaptureError;
|
|
886
887
|
}
|
|
887
|
-
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<
|
|
888
|
+
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiRuntimeOptions> {
|
|
888
889
|
options: DeepPartial<SilgiOptions>;
|
|
889
890
|
}
|
|
890
891
|
interface BuildConfig extends Partial<Omit<SilgiConfig, 'services' | 'shared' | 'schemas' | 'uris' | 'modulesURIs' | 'plugins' | 'framework' | 'ready' | 'close' | 'captureError' | '_ignore' | 'plugins' | 'scannedHandlers' | 'options'>> {
|
|
@@ -896,17 +897,15 @@ interface SilgiAppPlugin {
|
|
|
896
897
|
}
|
|
897
898
|
|
|
898
899
|
interface CapturedErrorContext {
|
|
899
|
-
event?:
|
|
900
|
+
event?: SilgiEvents;
|
|
900
901
|
[key: string]: unknown;
|
|
901
902
|
}
|
|
902
903
|
type CaptureError = (error: Error, context: CapturedErrorContext) => void;
|
|
903
904
|
|
|
904
|
-
interface ModuleRuntimeHooks {
|
|
905
|
-
}
|
|
906
905
|
/**
|
|
907
906
|
* The listeners to Silgi
|
|
908
907
|
*/
|
|
909
|
-
interface
|
|
908
|
+
interface SilgiRuntimeHooks {
|
|
910
909
|
/**
|
|
911
910
|
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
912
911
|
* @param silgi The configured Silgi object
|
|
@@ -924,7 +923,7 @@ interface SilgiHooks extends ModuleRuntimeHooks {
|
|
|
924
923
|
'action:after': (context: ModuleHookContext) => HookResult;
|
|
925
924
|
'action:error': (context: ModuleHookContext) => HookResult;
|
|
926
925
|
'action:finally': (context: ModuleHookContext) => HookResult;
|
|
927
|
-
'event:before': (event:
|
|
926
|
+
'event:before': (event: SilgiEvents) => HookResult;
|
|
928
927
|
'error': CaptureError;
|
|
929
928
|
}
|
|
930
929
|
|
|
@@ -938,4 +937,4 @@ type Namespaces<T extends BaseNamespaceType> = {
|
|
|
938
937
|
|
|
939
938
|
declare const autoImportTypes: string[];
|
|
940
939
|
|
|
941
|
-
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
|
|
940
|
+
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 SilgiMethods, 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 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/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.6",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -189,9 +189,10 @@
|
|
|
189
189
|
"scripts": {
|
|
190
190
|
"build:package": "unbuild",
|
|
191
191
|
"build": "pnpm gen-presets && pnpm build:package && pnpm build:builder && pnpm install && pnpm generate && pnpm build:modules",
|
|
192
|
+
"build:modules": "pnpm --filter '@silgi/graphql' build && pnpm --filter '@silgi/betterAuth' build && pnpm --filter '@silgi/permission' build && pnpm --filter '@silgi/openapi' build && pnpm --filter '@silgi/scalar' build && pnpm --filter '@silgi/yoga' build",
|
|
193
|
+
"prepare:modules": "pnpm --filter '@silgi/graphql' build:stub && pnpm --filter '@silgi/betterAuth' build:stub && pnpm --filter '@silgi/permission' build:stub && pnpm --filter '@silgi/openapi' build:stub && pnpm --filter '@silgi/scalar' build:stub && pnpm --filter '@silgi/yoga' build:stub",
|
|
192
194
|
"build:builder": "pnpm --filter './module-builder' build",
|
|
193
|
-
"build:prepare": "pnpm build:stub && pnpm --filter './module-builder' build:stub --stub && pnpm
|
|
194
|
-
"build:modules": "pnpm --filter './modules/*' build",
|
|
195
|
+
"build:prepare": "pnpm build:stub && pnpm --filter './module-builder' build:stub --stub && pnpm prepare:modules",
|
|
195
196
|
"build:stub": "pnpm gen-presets && unbuild --stub && pnpm --filter './module-builder' build:stub && pnpm --filter './modules/*' build:stub",
|
|
196
197
|
"dev:k6": "k6 run ./__tests__/k6.js",
|
|
197
198
|
"test": "vitest",
|