silgi 0.9.13 → 0.9.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 +4 -3
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/types/index.d.mts +92 -90
- package/dist/types/index.d.ts +92 -90
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -146,9 +146,9 @@ async function readCoreFile(silgi) {
|
|
|
146
146
|
});
|
|
147
147
|
try {
|
|
148
148
|
if (silgi.options.commandType === "prepare") {
|
|
149
|
-
injectedResult.code =
|
|
150
|
-
${injectedResult.code}`;
|
|
149
|
+
injectedResult.code = injectedResult.code.replace(/runtimeConfig: \{\}/, "runtimeConfig: globalThis.$silgiSharedRuntimeConfig");
|
|
151
150
|
}
|
|
151
|
+
console.log(injectedResult.code);
|
|
152
152
|
const coreFile = await jiti.evalModule(
|
|
153
153
|
injectedResult.code,
|
|
154
154
|
{
|
|
@@ -631,6 +631,7 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
|
|
|
631
631
|
" moduleOptions || {},",
|
|
632
632
|
" {",
|
|
633
633
|
` present: '${silgi.options.preset}',`,
|
|
634
|
+
" runtimeConfig: {},",
|
|
634
635
|
" ...cliOptions,",
|
|
635
636
|
" },",
|
|
636
637
|
" ) as any,",
|
|
@@ -1799,7 +1800,7 @@ function useCLIRuntimeConfig(silgi) {
|
|
|
1799
1800
|
const _sharedRuntimeConfig = _deepFreeze(
|
|
1800
1801
|
applyEnv(klona(_inlineRuntimeConfig), envOptions)
|
|
1801
1802
|
);
|
|
1802
|
-
|
|
1803
|
+
globalThis.$silgiSharedRuntimeConfig = _sharedRuntimeConfig;
|
|
1803
1804
|
return _sharedRuntimeConfig;
|
|
1804
1805
|
}
|
|
1805
1806
|
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -8,104 +8,15 @@ import { TSConfig } from 'pkg-types';
|
|
|
8
8
|
import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
|
|
9
9
|
import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$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
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
12
11
|
import { Defu } from 'defu';
|
|
13
12
|
import { Unimport } from 'unimport';
|
|
14
13
|
import { Storage, BuiltinDriverName, TransactionOptions, StorageValue } from 'unstorage';
|
|
14
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
16
|
import { s as silgi } from '../shared/silgi.D608K9c5.mjs';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
20
|
-
interface SilgiSchema {
|
|
21
|
-
}
|
|
22
|
-
interface MergedSilgiSchema {
|
|
23
|
-
}
|
|
24
|
-
type BaseSchemaType<T extends StandardSchemaV1> = {
|
|
25
|
-
[Action in BaseSilgiMethodType]?: Record<string, {
|
|
26
|
-
input?: T;
|
|
27
|
-
output?: T;
|
|
28
|
-
router?: T;
|
|
29
|
-
source?: T;
|
|
30
|
-
}>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
interface SilgiURIs {
|
|
34
|
-
}
|
|
35
|
-
type URIsTypes<T extends Record<string, string>> = {
|
|
36
|
-
[K in keyof T]: string;
|
|
37
|
-
};
|
|
38
|
-
type ExtractPath<T extends string> = T extends `${infer Path}` ? Path extends `${infer Service}/${infer Entity}/${infer Method}/${infer Action}` ? {
|
|
39
|
-
service: Service;
|
|
40
|
-
entity: Entity;
|
|
41
|
-
method: Method;
|
|
42
|
-
action: Action;
|
|
43
|
-
} : never : never;
|
|
44
|
-
type GetInput<T extends {
|
|
45
|
-
service: string;
|
|
46
|
-
entity: string;
|
|
47
|
-
method: string;
|
|
48
|
-
action: string;
|
|
49
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
50
|
-
input: infer I;
|
|
51
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
52
|
-
type GetOutput<T extends {
|
|
53
|
-
service: string;
|
|
54
|
-
entity: string;
|
|
55
|
-
method: string;
|
|
56
|
-
action: string;
|
|
57
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
58
|
-
output: infer O;
|
|
59
|
-
} ? O extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O> : never : never : never : never : never : never;
|
|
60
|
-
type GetSource<T extends {
|
|
61
|
-
service: string;
|
|
62
|
-
entity: string;
|
|
63
|
-
method: string;
|
|
64
|
-
action: string;
|
|
65
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
66
|
-
source: infer I;
|
|
67
|
-
} ? I : never : never : never : never : never;
|
|
68
|
-
type GetRouterParams<T extends {
|
|
69
|
-
service: string;
|
|
70
|
-
entity: string;
|
|
71
|
-
method: string;
|
|
72
|
-
action: string;
|
|
73
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
74
|
-
router: infer I;
|
|
75
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
76
|
-
type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TURI>>;
|
|
77
|
-
type ExtractSourceFromURI<TURI extends keyof SilgiURIs> = GetSource<ExtractPath<TURI>>;
|
|
78
|
-
type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
|
|
79
|
-
type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
|
|
80
|
-
|
|
81
|
-
interface SilgiRuntimeMethods {
|
|
82
|
-
}
|
|
83
|
-
interface SilgiNamespaces {
|
|
84
|
-
}
|
|
85
|
-
type CommandType = 'run' | 'prepare' | 'install';
|
|
86
|
-
interface DefaultNamespaces extends SilgiNamespaces {
|
|
87
|
-
}
|
|
88
|
-
interface SilgiRouterTypes {
|
|
89
|
-
}
|
|
90
|
-
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
|
|
91
|
-
interface DefaultHooks {
|
|
92
|
-
}
|
|
93
|
-
type DeepPartial<T> = T extends void ? T : T extends Record<string, any> ? {
|
|
94
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
95
|
-
} : T;
|
|
96
|
-
type Awaitable<T> = T | Promise<T>;
|
|
97
|
-
interface CreateScope {
|
|
98
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
99
|
-
}
|
|
100
|
-
declare global {
|
|
101
|
-
var $silgiStatus: CommandType;
|
|
102
|
-
namespace NodeJS {
|
|
103
|
-
interface Global {
|
|
104
|
-
$silgiStatus: CommandType;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
20
|
interface SilgiCompatibilityIssue {
|
|
110
21
|
name: string;
|
|
111
22
|
message: string;
|
|
@@ -375,6 +286,67 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
375
286
|
interface SilgiEvents extends Record<string, unknown> {
|
|
376
287
|
}
|
|
377
288
|
|
|
289
|
+
interface SilgiSchema {
|
|
290
|
+
}
|
|
291
|
+
interface MergedSilgiSchema {
|
|
292
|
+
}
|
|
293
|
+
type BaseSchemaType<T extends StandardSchemaV1> = {
|
|
294
|
+
[Action in BaseSilgiMethodType]?: Record<string, {
|
|
295
|
+
input?: T;
|
|
296
|
+
output?: T;
|
|
297
|
+
router?: T;
|
|
298
|
+
source?: T;
|
|
299
|
+
}>;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
interface SilgiURIs {
|
|
303
|
+
}
|
|
304
|
+
type URIsTypes<T extends Record<string, string>> = {
|
|
305
|
+
[K in keyof T]: string;
|
|
306
|
+
};
|
|
307
|
+
type ExtractPath<T extends string> = T extends `${infer Path}` ? Path extends `${infer Service}/${infer Entity}/${infer Method}/${infer Action}` ? {
|
|
308
|
+
service: Service;
|
|
309
|
+
entity: Entity;
|
|
310
|
+
method: Method;
|
|
311
|
+
action: Action;
|
|
312
|
+
} : never : never;
|
|
313
|
+
type GetInput<T extends {
|
|
314
|
+
service: string;
|
|
315
|
+
entity: string;
|
|
316
|
+
method: string;
|
|
317
|
+
action: string;
|
|
318
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
319
|
+
input: infer I;
|
|
320
|
+
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
321
|
+
type GetOutput<T extends {
|
|
322
|
+
service: string;
|
|
323
|
+
entity: string;
|
|
324
|
+
method: string;
|
|
325
|
+
action: string;
|
|
326
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
327
|
+
output: infer O;
|
|
328
|
+
} ? O extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O> : never : never : never : never : never : never;
|
|
329
|
+
type GetSource<T extends {
|
|
330
|
+
service: string;
|
|
331
|
+
entity: string;
|
|
332
|
+
method: string;
|
|
333
|
+
action: string;
|
|
334
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
335
|
+
source: infer I;
|
|
336
|
+
} ? I : never : never : never : never : never;
|
|
337
|
+
type GetRouterParams<T extends {
|
|
338
|
+
service: string;
|
|
339
|
+
entity: string;
|
|
340
|
+
method: string;
|
|
341
|
+
action: string;
|
|
342
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
343
|
+
router: infer I;
|
|
344
|
+
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
345
|
+
type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TURI>>;
|
|
346
|
+
type ExtractSourceFromURI<TURI extends keyof SilgiURIs> = GetSource<ExtractPath<TURI>>;
|
|
347
|
+
type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
|
|
348
|
+
type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
|
|
349
|
+
|
|
378
350
|
/**
|
|
379
351
|
* @example
|
|
380
352
|
* namespace: 'coreApi'
|
|
@@ -536,6 +508,36 @@ interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom
|
|
|
536
508
|
getMeta?: () => Promise<ModuleMeta>;
|
|
537
509
|
}
|
|
538
510
|
|
|
511
|
+
interface SilgiRuntimeMethods {
|
|
512
|
+
}
|
|
513
|
+
interface SilgiNamespaces {
|
|
514
|
+
}
|
|
515
|
+
type CommandType = 'run' | 'prepare' | 'install';
|
|
516
|
+
interface DefaultNamespaces extends SilgiNamespaces {
|
|
517
|
+
}
|
|
518
|
+
interface SilgiRouterTypes {
|
|
519
|
+
}
|
|
520
|
+
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
|
|
521
|
+
interface DefaultHooks {
|
|
522
|
+
}
|
|
523
|
+
type DeepPartial<T> = T extends void ? T : T extends Record<string, any> ? {
|
|
524
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
525
|
+
} : T;
|
|
526
|
+
type Awaitable<T> = T | Promise<T>;
|
|
527
|
+
interface CreateScope {
|
|
528
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
529
|
+
}
|
|
530
|
+
declare global {
|
|
531
|
+
var $silgiStatus: CommandType;
|
|
532
|
+
var $silgiSharedRuntimeConfig: SilgiRuntimeOptions;
|
|
533
|
+
namespace NodeJS {
|
|
534
|
+
interface Global {
|
|
535
|
+
$silgiStatus: CommandType;
|
|
536
|
+
$silgiSharedRuntimeConfig: SilgiRuntimeOptions;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
539
541
|
type SilgiPreset = SilgiCLIConfig | (() => SilgiCLIConfig);
|
|
540
542
|
interface SilgiPresetMeta {
|
|
541
543
|
url: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,104 +8,15 @@ import { TSConfig } from 'pkg-types';
|
|
|
8
8
|
import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
|
|
9
9
|
import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$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
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
12
11
|
import { Defu } from 'defu';
|
|
13
12
|
import { Unimport } from 'unimport';
|
|
14
13
|
import { Storage, BuiltinDriverName, TransactionOptions, StorageValue } from 'unstorage';
|
|
14
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
16
|
import { s as silgi } from '../shared/silgi.D608K9c5.js';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
|
20
|
-
interface SilgiSchema {
|
|
21
|
-
}
|
|
22
|
-
interface MergedSilgiSchema {
|
|
23
|
-
}
|
|
24
|
-
type BaseSchemaType<T extends StandardSchemaV1> = {
|
|
25
|
-
[Action in BaseSilgiMethodType]?: Record<string, {
|
|
26
|
-
input?: T;
|
|
27
|
-
output?: T;
|
|
28
|
-
router?: T;
|
|
29
|
-
source?: T;
|
|
30
|
-
}>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
interface SilgiURIs {
|
|
34
|
-
}
|
|
35
|
-
type URIsTypes<T extends Record<string, string>> = {
|
|
36
|
-
[K in keyof T]: string;
|
|
37
|
-
};
|
|
38
|
-
type ExtractPath<T extends string> = T extends `${infer Path}` ? Path extends `${infer Service}/${infer Entity}/${infer Method}/${infer Action}` ? {
|
|
39
|
-
service: Service;
|
|
40
|
-
entity: Entity;
|
|
41
|
-
method: Method;
|
|
42
|
-
action: Action;
|
|
43
|
-
} : never : never;
|
|
44
|
-
type GetInput<T extends {
|
|
45
|
-
service: string;
|
|
46
|
-
entity: string;
|
|
47
|
-
method: string;
|
|
48
|
-
action: string;
|
|
49
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
50
|
-
input: infer I;
|
|
51
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
52
|
-
type GetOutput<T extends {
|
|
53
|
-
service: string;
|
|
54
|
-
entity: string;
|
|
55
|
-
method: string;
|
|
56
|
-
action: string;
|
|
57
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
58
|
-
output: infer O;
|
|
59
|
-
} ? O extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O> : never : never : never : never : never : never;
|
|
60
|
-
type GetSource<T extends {
|
|
61
|
-
service: string;
|
|
62
|
-
entity: string;
|
|
63
|
-
method: string;
|
|
64
|
-
action: string;
|
|
65
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
66
|
-
source: infer I;
|
|
67
|
-
} ? I : never : never : never : never : never;
|
|
68
|
-
type GetRouterParams<T extends {
|
|
69
|
-
service: string;
|
|
70
|
-
entity: string;
|
|
71
|
-
method: string;
|
|
72
|
-
action: string;
|
|
73
|
-
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
74
|
-
router: infer I;
|
|
75
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
76
|
-
type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TURI>>;
|
|
77
|
-
type ExtractSourceFromURI<TURI extends keyof SilgiURIs> = GetSource<ExtractPath<TURI>>;
|
|
78
|
-
type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
|
|
79
|
-
type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
|
|
80
|
-
|
|
81
|
-
interface SilgiRuntimeMethods {
|
|
82
|
-
}
|
|
83
|
-
interface SilgiNamespaces {
|
|
84
|
-
}
|
|
85
|
-
type CommandType = 'run' | 'prepare' | 'install';
|
|
86
|
-
interface DefaultNamespaces extends SilgiNamespaces {
|
|
87
|
-
}
|
|
88
|
-
interface SilgiRouterTypes {
|
|
89
|
-
}
|
|
90
|
-
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
|
|
91
|
-
interface DefaultHooks {
|
|
92
|
-
}
|
|
93
|
-
type DeepPartial<T> = T extends void ? T : T extends Record<string, any> ? {
|
|
94
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
95
|
-
} : T;
|
|
96
|
-
type Awaitable<T> = T | Promise<T>;
|
|
97
|
-
interface CreateScope {
|
|
98
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
99
|
-
}
|
|
100
|
-
declare global {
|
|
101
|
-
var $silgiStatus: CommandType;
|
|
102
|
-
namespace NodeJS {
|
|
103
|
-
interface Global {
|
|
104
|
-
$silgiStatus: CommandType;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
20
|
interface SilgiCompatibilityIssue {
|
|
110
21
|
name: string;
|
|
111
22
|
message: string;
|
|
@@ -375,6 +286,67 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
375
286
|
interface SilgiEvents extends Record<string, unknown> {
|
|
376
287
|
}
|
|
377
288
|
|
|
289
|
+
interface SilgiSchema {
|
|
290
|
+
}
|
|
291
|
+
interface MergedSilgiSchema {
|
|
292
|
+
}
|
|
293
|
+
type BaseSchemaType<T extends StandardSchemaV1> = {
|
|
294
|
+
[Action in BaseSilgiMethodType]?: Record<string, {
|
|
295
|
+
input?: T;
|
|
296
|
+
output?: T;
|
|
297
|
+
router?: T;
|
|
298
|
+
source?: T;
|
|
299
|
+
}>;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
interface SilgiURIs {
|
|
303
|
+
}
|
|
304
|
+
type URIsTypes<T extends Record<string, string>> = {
|
|
305
|
+
[K in keyof T]: string;
|
|
306
|
+
};
|
|
307
|
+
type ExtractPath<T extends string> = T extends `${infer Path}` ? Path extends `${infer Service}/${infer Entity}/${infer Method}/${infer Action}` ? {
|
|
308
|
+
service: Service;
|
|
309
|
+
entity: Entity;
|
|
310
|
+
method: Method;
|
|
311
|
+
action: Action;
|
|
312
|
+
} : never : never;
|
|
313
|
+
type GetInput<T extends {
|
|
314
|
+
service: string;
|
|
315
|
+
entity: string;
|
|
316
|
+
method: string;
|
|
317
|
+
action: string;
|
|
318
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
319
|
+
input: infer I;
|
|
320
|
+
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
321
|
+
type GetOutput<T extends {
|
|
322
|
+
service: string;
|
|
323
|
+
entity: string;
|
|
324
|
+
method: string;
|
|
325
|
+
action: string;
|
|
326
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
327
|
+
output: infer O;
|
|
328
|
+
} ? O extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O> : never : never : never : never : never : never;
|
|
329
|
+
type GetSource<T extends {
|
|
330
|
+
service: string;
|
|
331
|
+
entity: string;
|
|
332
|
+
method: string;
|
|
333
|
+
action: string;
|
|
334
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
335
|
+
source: infer I;
|
|
336
|
+
} ? I : never : never : never : never : never;
|
|
337
|
+
type GetRouterParams<T extends {
|
|
338
|
+
service: string;
|
|
339
|
+
entity: string;
|
|
340
|
+
method: string;
|
|
341
|
+
action: string;
|
|
342
|
+
}> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
|
|
343
|
+
router: infer I;
|
|
344
|
+
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
345
|
+
type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TURI>>;
|
|
346
|
+
type ExtractSourceFromURI<TURI extends keyof SilgiURIs> = GetSource<ExtractPath<TURI>>;
|
|
347
|
+
type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
|
|
348
|
+
type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
|
|
349
|
+
|
|
378
350
|
/**
|
|
379
351
|
* @example
|
|
380
352
|
* namespace: 'coreApi'
|
|
@@ -536,6 +508,36 @@ interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom
|
|
|
536
508
|
getMeta?: () => Promise<ModuleMeta>;
|
|
537
509
|
}
|
|
538
510
|
|
|
511
|
+
interface SilgiRuntimeMethods {
|
|
512
|
+
}
|
|
513
|
+
interface SilgiNamespaces {
|
|
514
|
+
}
|
|
515
|
+
type CommandType = 'run' | 'prepare' | 'install';
|
|
516
|
+
interface DefaultNamespaces extends SilgiNamespaces {
|
|
517
|
+
}
|
|
518
|
+
interface SilgiRouterTypes {
|
|
519
|
+
}
|
|
520
|
+
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
|
|
521
|
+
interface DefaultHooks {
|
|
522
|
+
}
|
|
523
|
+
type DeepPartial<T> = T extends void ? T : T extends Record<string, any> ? {
|
|
524
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
525
|
+
} : T;
|
|
526
|
+
type Awaitable<T> = T | Promise<T>;
|
|
527
|
+
interface CreateScope {
|
|
528
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
529
|
+
}
|
|
530
|
+
declare global {
|
|
531
|
+
var $silgiStatus: CommandType;
|
|
532
|
+
var $silgiSharedRuntimeConfig: SilgiRuntimeOptions;
|
|
533
|
+
namespace NodeJS {
|
|
534
|
+
interface Global {
|
|
535
|
+
$silgiStatus: CommandType;
|
|
536
|
+
$silgiSharedRuntimeConfig: SilgiRuntimeOptions;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
539
541
|
type SilgiPreset = SilgiCLIConfig | (() => SilgiCLIConfig);
|
|
540
542
|
interface SilgiPresetMeta {
|
|
541
543
|
url: string;
|