silgi 0.24.0 → 0.24.2
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/cli/index.d.mts +0 -1
- package/dist/cli/index.mjs +2 -1
- package/dist/cli/prepare.mjs +2 -2
- package/dist/presets/index.d.mts +2 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/runtime/{index.d.ts → index.d.mts} +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/lib/config.mjs +2 -2
- package/package.json +5 -3
- package/dist/cli/config/index.d.ts +0 -11
- package/dist/cli/index.d.ts +0 -2
- package/dist/index.d.ts +0 -268
- package/dist/kit/index.d.ts +0 -152
- package/dist/presets/index.d.ts +0 -2
- package/dist/shared/silgi.Cs0ZUUXV.d.ts +0 -7
- package/dist/types/index.d.ts +0 -1138
- /package/dist/presets/{_all.gen.d.ts → _all.gen.d.mts} +0 -0
- /package/dist/presets/{_resolve.d.ts → _resolve.d.mts} +0 -0
- /package/dist/presets/{_types.gen.d.ts → _types.gen.d.mts} +0 -0
- /package/dist/presets/h3/{preset.d.ts → preset.d.mts} +0 -0
- /package/dist/presets/nitro/{preset.d.ts → preset.d.mts} +0 -0
- /package/dist/presets/npmpackage/{preset.d.ts → preset.d.mts} +0 -0
- /package/dist/presets/nuxt/{preset.d.ts → preset.d.mts} +0 -0
- /package/dist/runtime/internal/{config.d.ts → config.d.mts} +0 -0
- /package/dist/runtime/internal/{debug.d.ts → debug.d.mts} +0 -0
- /package/dist/runtime/internal/{defu.d.ts → defu.d.mts} +0 -0
- /package/dist/runtime/internal/{index.d.ts → index.d.mts} +0 -0
- /package/dist/runtime/internal/{nitro.d.ts → nitro.d.mts} +0 -0
- /package/dist/runtime/internal/{nuxt.d.ts → nuxt.d.mts} +0 -0
- /package/dist/runtime/internal/{ofetch.d.ts → ofetch.d.mts} +0 -0
- /package/dist/runtime/internal/{plugin.d.ts → plugin.d.mts} +0 -0
package/dist/types/index.d.ts
DELETED
|
@@ -1,1138 +0,0 @@
|
|
|
1
|
-
import { C12InputConfig, ResolvedConfig, ConfigWatcher, WatchConfigOptions } from 'c12';
|
|
2
|
-
import { ChokidarOptions } from 'chokidar';
|
|
3
|
-
import { DateString, CompatibilityDateSpec, CompatibilityDates } from 'compatx';
|
|
4
|
-
import { ConsolaInstance, LogLevel, ConsolaOptions } from 'consola';
|
|
5
|
-
import { Hookable, NestedHooks } from 'hookable';
|
|
6
|
-
import { Ignore, Options } from 'ignore';
|
|
7
|
-
import { TSConfig } from 'pkg-types';
|
|
8
|
-
import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
|
|
9
|
-
import { ResolvedServiceType as ResolvedServiceType$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, RouteRules as RouteRules$1, ModuleMeta as ModuleMeta$1, SilgiModule as SilgiModule$1, SilgiRouteRules as SilgiRouteRules$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$1, SilgiRuntimeConfig as SilgiRuntimeConfig$1, ServiceParseModule as ServiceParseModule$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
|
|
10
|
-
import { UnimportPluginOptions } from 'unimport/unplugin';
|
|
11
|
-
import { Defu } from 'defu';
|
|
12
|
-
import { Stats } from 'node:fs';
|
|
13
|
-
import { Unimport } from 'unimport';
|
|
14
|
-
import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
|
|
15
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
16
|
-
import { ProviderName } from 'std-env';
|
|
17
|
-
import { s as silgi } from '../shared/silgi.Cs0ZUUXV.js';
|
|
18
|
-
|
|
19
|
-
type HookResult = Promise<void> | void;
|
|
20
|
-
|
|
21
|
-
interface SilgiCompatibilityIssue {
|
|
22
|
-
name: string;
|
|
23
|
-
message: string;
|
|
24
|
-
}
|
|
25
|
-
interface SilgiCompatibilityIssues extends Array<SilgiCompatibilityIssue> {
|
|
26
|
-
/**
|
|
27
|
-
* Return formatted error message.
|
|
28
|
-
*/
|
|
29
|
-
toString: () => string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface ImportItem {
|
|
33
|
-
importItems: {
|
|
34
|
-
[key: string]: {
|
|
35
|
-
import: {
|
|
36
|
-
type?: boolean;
|
|
37
|
-
name: string;
|
|
38
|
-
key: string;
|
|
39
|
-
}[];
|
|
40
|
-
from: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
customImports: string[];
|
|
44
|
-
customContent?: string[];
|
|
45
|
-
}
|
|
46
|
-
interface SilgiCommands {
|
|
47
|
-
}
|
|
48
|
-
interface SilgiCLI {
|
|
49
|
-
_ignore?: Ignore;
|
|
50
|
-
errors: {
|
|
51
|
-
type: 'Parser';
|
|
52
|
-
path?: string;
|
|
53
|
-
}[];
|
|
54
|
-
services: ResolvedServiceType$1;
|
|
55
|
-
shareds: SilgiRuntimeShareds$1;
|
|
56
|
-
uris: Record<string, any>;
|
|
57
|
-
schemas: Record<string, any>;
|
|
58
|
-
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions$1 | (string & {}), any>>;
|
|
59
|
-
scannedURIs: Map<string, string>;
|
|
60
|
-
templates: SilgiTemplate[];
|
|
61
|
-
routeRules: RouteRules$1;
|
|
62
|
-
hooks: Hookable<SilgiCLIHooks>;
|
|
63
|
-
hook: SilgiCLI['hooks']['hook'];
|
|
64
|
-
callHook: SilgiCLI['hooks']['callHook'];
|
|
65
|
-
addHooks: SilgiCLI['hooks']['addHooks'];
|
|
66
|
-
storage: Storage;
|
|
67
|
-
unimport?: Unimport;
|
|
68
|
-
logger: ConsolaInstance;
|
|
69
|
-
close: () => Promise<void>;
|
|
70
|
-
updateConfig: (config: SilgiCLIDynamicConfig) => void | Promise<void>;
|
|
71
|
-
scanModules: Array<{
|
|
72
|
-
meta: ModuleMeta$1;
|
|
73
|
-
module: SilgiModule$1;
|
|
74
|
-
timings?: Record<string, number | undefined>;
|
|
75
|
-
entryPath?: string;
|
|
76
|
-
installed?: boolean;
|
|
77
|
-
options: Record<string, any>;
|
|
78
|
-
}>;
|
|
79
|
-
options: SilgiCLIOptions;
|
|
80
|
-
_requiredModules: Record<string, boolean>;
|
|
81
|
-
commands: Record<string, Record<string, {
|
|
82
|
-
type: 'function' | 'command';
|
|
83
|
-
handler: string;
|
|
84
|
-
description?: string;
|
|
85
|
-
tags?: (keyof SilgiCommands)[];
|
|
86
|
-
enabled?: boolean;
|
|
87
|
-
}>>;
|
|
88
|
-
}
|
|
89
|
-
type SilgiCLIDynamicConfig = Pick<SilgiCLIConfig, 'routeRules'>;
|
|
90
|
-
interface SilgiFrameworkInfo {
|
|
91
|
-
name?: 'silgi' | (string & {});
|
|
92
|
-
version?: string;
|
|
93
|
-
}
|
|
94
|
-
/** Build info written to `.output/silgi.json` or `.silgi/dev/silgi.json` */
|
|
95
|
-
interface NitroBuildInfo {
|
|
96
|
-
date: string;
|
|
97
|
-
preset: PresetName;
|
|
98
|
-
framework: SilgiFrameworkInfo;
|
|
99
|
-
versions: {
|
|
100
|
-
silgi: string;
|
|
101
|
-
[key: string]: string;
|
|
102
|
-
};
|
|
103
|
-
commands?: {
|
|
104
|
-
preview?: string;
|
|
105
|
-
deploy?: string;
|
|
106
|
-
};
|
|
107
|
-
dev?: {
|
|
108
|
-
pid: number;
|
|
109
|
-
workerAddress: {
|
|
110
|
-
host: string;
|
|
111
|
-
port: number;
|
|
112
|
-
socketPath?: string;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
config?: Partial<PresetOptions>;
|
|
116
|
-
}
|
|
117
|
-
interface ScanFile {
|
|
118
|
-
context: string;
|
|
119
|
-
object: {
|
|
120
|
-
schemas: any;
|
|
121
|
-
uris: any;
|
|
122
|
-
services: any;
|
|
123
|
-
shareds: any;
|
|
124
|
-
modulesURIs: any;
|
|
125
|
-
};
|
|
126
|
-
path: string;
|
|
127
|
-
}
|
|
128
|
-
type TemplateDefaultOptions = Record<string, any>;
|
|
129
|
-
interface SilgiTemplate<Options = TemplateDefaultOptions> {
|
|
130
|
-
/** resolved output file path (generated) */
|
|
131
|
-
dst?: string;
|
|
132
|
-
/** The target filename once the template is copied into the Silgi buildDir */
|
|
133
|
-
filename?: string;
|
|
134
|
-
/** An options object that will be accessible within the template via `<% options %>` */
|
|
135
|
-
options?: Options;
|
|
136
|
-
/** The resolved path to the source file to be template */
|
|
137
|
-
src?: string;
|
|
138
|
-
/** Provided compile option instead of src */
|
|
139
|
-
where?: 'server' | 'client' | '.silgi';
|
|
140
|
-
getContents?: (data: {
|
|
141
|
-
app: SilgiCLI;
|
|
142
|
-
options: Options;
|
|
143
|
-
}) => string | Promise<string>;
|
|
144
|
-
/** Write to filesystem */
|
|
145
|
-
write?: boolean;
|
|
146
|
-
skipIfExists?: boolean;
|
|
147
|
-
}
|
|
148
|
-
interface ResolvedSilgiTemplate<Options = TemplateDefaultOptions> extends SilgiTemplate<Options> {
|
|
149
|
-
filename: string;
|
|
150
|
-
dst: string;
|
|
151
|
-
modified?: boolean;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
interface SilgiCLIHooks extends SilgiHooks {
|
|
155
|
-
/**
|
|
156
|
-
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
157
|
-
* @param silgi The configured Silgi object
|
|
158
|
-
* @returns Promise
|
|
159
|
-
*/
|
|
160
|
-
'ready': (silgi: SilgiCLI) => HookResult;
|
|
161
|
-
/**
|
|
162
|
-
* Called when silgi instance is gracefully closing.
|
|
163
|
-
* @param silgi The configured silgi object
|
|
164
|
-
* @returns Promise
|
|
165
|
-
*/
|
|
166
|
-
'close': (silgi: SilgiCLI) => HookResult;
|
|
167
|
-
'reload:scan': (path: string, stats?: Stats) => HookResult;
|
|
168
|
-
'prepare:createCoreFramework': (options: Pick<ImportItem, 'customImports' | 'importItems'> & {
|
|
169
|
-
functions?: {
|
|
170
|
-
name: string;
|
|
171
|
-
params?: string[];
|
|
172
|
-
}[];
|
|
173
|
-
}) => HookResult;
|
|
174
|
-
'prepare:createDTSFramework': (options: ImportItem) => HookResult;
|
|
175
|
-
/**
|
|
176
|
-
* Allows extending compatibility checks.
|
|
177
|
-
* @param compatibility Compatibility object
|
|
178
|
-
* @param issues Issues to be mapped
|
|
179
|
-
* @returns Promise
|
|
180
|
-
*/
|
|
181
|
-
'kit:compatibility': (compatibility: SilgiCompatibility, issues: SilgiCompatibilityIssues) => HookResult;
|
|
182
|
-
/**
|
|
183
|
-
* Called before Nuxi writes `.nuxt/tsconfig.json` and `.nuxt/nuxt.d.ts`, allowing addition of custom references and declarations in `nuxt.d.ts`, or directly modifying the options in `tsconfig.json`
|
|
184
|
-
* @param options Objects containing `references`, `declarations`, `tsConfig`
|
|
185
|
-
* @returns Promise
|
|
186
|
-
*/
|
|
187
|
-
'prepare:types': (options: {
|
|
188
|
-
references: TSReference[];
|
|
189
|
-
declarations: string[];
|
|
190
|
-
tsConfig: TSConfig;
|
|
191
|
-
}) => HookResult;
|
|
192
|
-
'prepare:core.ts': (data: PrepareCore) => HookResult;
|
|
193
|
-
'after:prepare:core.ts': (content: string[]) => HookResult;
|
|
194
|
-
'prepare:scan.ts': (data: Pick<ImportItem, 'customImports' | 'importItems'> & {
|
|
195
|
-
uris: Record<string, string>;
|
|
196
|
-
services: string[];
|
|
197
|
-
shareds: string[];
|
|
198
|
-
schemas: string[];
|
|
199
|
-
modulesURIs: Record<string, string>;
|
|
200
|
-
}) => HookResult;
|
|
201
|
-
'after:prepare:scan.ts': (content: string[]) => HookResult;
|
|
202
|
-
'prepare:schema.ts': (options: {
|
|
203
|
-
options: {
|
|
204
|
-
key: string;
|
|
205
|
-
value: string;
|
|
206
|
-
}[];
|
|
207
|
-
runtimeOptions: {
|
|
208
|
-
key: string;
|
|
209
|
-
value: string;
|
|
210
|
-
}[];
|
|
211
|
-
methods: {
|
|
212
|
-
key: string;
|
|
213
|
-
value: string;
|
|
214
|
-
}[];
|
|
215
|
-
routeRules: {
|
|
216
|
-
key: string;
|
|
217
|
-
value: string;
|
|
218
|
-
}[];
|
|
219
|
-
routeRulesConfig: {
|
|
220
|
-
key: string;
|
|
221
|
-
value: string;
|
|
222
|
-
}[];
|
|
223
|
-
contexts: {
|
|
224
|
-
key: string;
|
|
225
|
-
value: string;
|
|
226
|
-
}[];
|
|
227
|
-
actions: {
|
|
228
|
-
key: string;
|
|
229
|
-
value: string;
|
|
230
|
-
}[];
|
|
231
|
-
shareds: {
|
|
232
|
-
key: string;
|
|
233
|
-
value: string;
|
|
234
|
-
}[];
|
|
235
|
-
events: {
|
|
236
|
-
key: string;
|
|
237
|
-
value: string;
|
|
238
|
-
/**
|
|
239
|
-
* If extends is true, it won't be added to the key value interface.
|
|
240
|
-
* interface SilgiModuleEventsExtends extends SilgiEvents {}
|
|
241
|
-
*/
|
|
242
|
-
extends?: boolean;
|
|
243
|
-
isSilgiContext?: boolean;
|
|
244
|
-
}[];
|
|
245
|
-
hooks: {
|
|
246
|
-
key: string;
|
|
247
|
-
value: string;
|
|
248
|
-
}[];
|
|
249
|
-
runtimeHooks: {
|
|
250
|
-
key: string;
|
|
251
|
-
value: string;
|
|
252
|
-
}[];
|
|
253
|
-
} & ImportItem) => HookResult;
|
|
254
|
-
'after:prepare:schema.ts': (content: string[]) => HookResult;
|
|
255
|
-
'prepare:framework.d.ts': (options: {} & ImportItem) => HookResult;
|
|
256
|
-
'prepare:configs.ts': (cliOptions: Record<string, any>) => HookResult;
|
|
257
|
-
/**
|
|
258
|
-
* Called during `SilgiCLI` generation, to allow customizing, modifying or adding new files to the build directory (either virtually or to written to `.nuxt`).
|
|
259
|
-
* @param app The configured `SilgiCLI` object
|
|
260
|
-
* @returns Promise
|
|
261
|
-
*/
|
|
262
|
-
'app:templates': (app: SilgiCLI) => HookResult;
|
|
263
|
-
/**
|
|
264
|
-
* Called after templates are compiled into the [virtual file system](https://nuxt.com/docs/guide/directory-structure/nuxt#virtual-file-system) (vfs).
|
|
265
|
-
* @param app The configured `SilgiCLI` object
|
|
266
|
-
* @returns Promise
|
|
267
|
-
*/
|
|
268
|
-
'app:templatesGenerated': (app: SilgiCLI, templates: ResolvedSilgiTemplate[], options?: GenerateAppOptions) => HookResult;
|
|
269
|
-
'scanFiles:done': (app: SilgiCLI) => HookResult;
|
|
270
|
-
'prepare:commands': (commands: SilgiCLI['commands']) => HookResult;
|
|
271
|
-
'prepare:installPackages': (packages: Record<'dependencies' | 'devDependencies', Record<string, string>>) => HookResult;
|
|
272
|
-
}
|
|
273
|
-
type TSReference = {
|
|
274
|
-
types: string;
|
|
275
|
-
} | {
|
|
276
|
-
path: string;
|
|
277
|
-
};
|
|
278
|
-
interface SilgiHooks {
|
|
279
|
-
}
|
|
280
|
-
interface GenerateAppOptions {
|
|
281
|
-
filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
|
|
282
|
-
}
|
|
283
|
-
interface PrepareCore extends ImportItem {
|
|
284
|
-
buildSilgiExtraContent: string[];
|
|
285
|
-
beforeBuildSilgiExtraContent: {
|
|
286
|
-
value: string;
|
|
287
|
-
type: 'function' | 'variable';
|
|
288
|
-
}[];
|
|
289
|
-
afterCliOptions: string[];
|
|
290
|
-
_silgiConfigs: any[];
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Bu nitrojs, h3 event or request context.
|
|
295
|
-
*/
|
|
296
|
-
interface SilgiEvents extends Record<string, unknown> {
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
interface SilgiSchema {
|
|
300
|
-
}
|
|
301
|
-
interface MergedSilgiSchema {
|
|
302
|
-
}
|
|
303
|
-
type BaseSchemaType<T extends StandardSchemaV1> = {
|
|
304
|
-
[Action in BaseSilgiMethodType]?: Record<string, {
|
|
305
|
-
input?: T;
|
|
306
|
-
output?: T;
|
|
307
|
-
pathParams?: T;
|
|
308
|
-
queryParams?: T;
|
|
309
|
-
source?: T;
|
|
310
|
-
}>;
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
interface SilgiURIs {
|
|
314
|
-
}
|
|
315
|
-
type URIsTypes<T extends Record<string, string>> = {
|
|
316
|
-
[K in keyof T]: string;
|
|
317
|
-
};
|
|
318
|
-
type ExtractPath<T extends string> = T extends `${infer Path}` ? Path extends `${infer Service}/${infer Entity}/${infer Method}/${infer Action}` ? {
|
|
319
|
-
service: Service;
|
|
320
|
-
entity: Entity;
|
|
321
|
-
method: Method;
|
|
322
|
-
action: Action;
|
|
323
|
-
} : never : never;
|
|
324
|
-
type GetInput<T extends {
|
|
325
|
-
service: string;
|
|
326
|
-
entity: string;
|
|
327
|
-
method: string;
|
|
328
|
-
action: string;
|
|
329
|
-
}> = 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 {
|
|
330
|
-
input: infer I;
|
|
331
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
|
|
332
|
-
type GetOutput<T extends {
|
|
333
|
-
service: string;
|
|
334
|
-
entity: string;
|
|
335
|
-
method: string;
|
|
336
|
-
action: string;
|
|
337
|
-
}> = 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 {
|
|
338
|
-
output: infer O;
|
|
339
|
-
} ? O extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O> : never : never : never : never : never : never;
|
|
340
|
-
type GetSource<T extends {
|
|
341
|
-
service: string;
|
|
342
|
-
entity: string;
|
|
343
|
-
method: string;
|
|
344
|
-
action: string;
|
|
345
|
-
}> = 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 {
|
|
346
|
-
source: infer I;
|
|
347
|
-
} ? I : never : never : never : never : never;
|
|
348
|
-
type GetQueryParams<T extends {
|
|
349
|
-
service: string;
|
|
350
|
-
entity: string;
|
|
351
|
-
method: string;
|
|
352
|
-
action: string;
|
|
353
|
-
}> = 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 {
|
|
354
|
-
queryParams: infer Q;
|
|
355
|
-
} ? Q : never : never : never : never : never;
|
|
356
|
-
type GetPathParams<T extends {
|
|
357
|
-
service: string;
|
|
358
|
-
entity: string;
|
|
359
|
-
method: string;
|
|
360
|
-
action: string;
|
|
361
|
-
}> = 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 {
|
|
362
|
-
pathParams: infer Q;
|
|
363
|
-
} ? Q : never : never : never : never : never;
|
|
364
|
-
type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TURI>>;
|
|
365
|
-
type ExtractSourceFromURI<TURI extends keyof SilgiURIs> = GetSource<ExtractPath<TURI>>;
|
|
366
|
-
type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
|
|
367
|
-
type ExtractQueryParamsFromURI<TURI extends keyof SilgiURIs> = GetQueryParams<ExtractPath<TURI>>;
|
|
368
|
-
type ExtractPathParamsFromURI<TURI extends keyof SilgiURIs> = GetPathParams<ExtractPath<TURI>>;
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* @example
|
|
372
|
-
* namespace: 'coreApi'
|
|
373
|
-
* serviceName: 'basket'
|
|
374
|
-
* method: 'post'
|
|
375
|
-
* action: 'createBasket'
|
|
376
|
-
*/
|
|
377
|
-
interface SilgiOperation {
|
|
378
|
-
/**
|
|
379
|
-
* 'coreApi'
|
|
380
|
-
* 'storageApi'
|
|
381
|
-
*/
|
|
382
|
-
namespaceName: keyof DefaultNamespaces;
|
|
383
|
-
/**
|
|
384
|
-
* 'basket'
|
|
385
|
-
* 'user'
|
|
386
|
-
*/
|
|
387
|
-
serviceName: string;
|
|
388
|
-
/**
|
|
389
|
-
* 'post'
|
|
390
|
-
* 'delete'
|
|
391
|
-
*/
|
|
392
|
-
methodName: string;
|
|
393
|
-
/**
|
|
394
|
-
* 'createBasket'
|
|
395
|
-
* 'deleteUser'
|
|
396
|
-
*/
|
|
397
|
-
actionName: string;
|
|
398
|
-
/**
|
|
399
|
-
* 'coreApi/basket/post/createBasket'
|
|
400
|
-
*/
|
|
401
|
-
raw: string;
|
|
402
|
-
/**
|
|
403
|
-
* '/book/basket/getAllBaskets'
|
|
404
|
-
*/
|
|
405
|
-
uri: keyof SilgiURIs;
|
|
406
|
-
/**
|
|
407
|
-
* ['coreApi', 'book', 'basket', 'getAllBaskets']
|
|
408
|
-
*/
|
|
409
|
-
parts: string[];
|
|
410
|
-
/**
|
|
411
|
-
* {id: '123', name: 'John', bookId: '456', authorId: '789'}
|
|
412
|
-
*/
|
|
413
|
-
routerParams?: Record<string, string | undefined>;
|
|
414
|
-
/**
|
|
415
|
-
* url ?limit=10&page=1
|
|
416
|
-
* {limit: '10', page: '1'}
|
|
417
|
-
*/
|
|
418
|
-
query?: Record<string, string>;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
interface SilgiRuntimeActions {
|
|
422
|
-
}
|
|
423
|
-
interface SilgiModuleOptions {
|
|
424
|
-
}
|
|
425
|
-
interface SilgiRuntimeOptions {
|
|
426
|
-
}
|
|
427
|
-
type SilgiModuleInput = (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false);
|
|
428
|
-
interface SilgiCompatibility {
|
|
429
|
-
/**
|
|
430
|
-
* Required silgi version in semver format.
|
|
431
|
-
* @example `^3.2.0` or `>=3.13.0`.
|
|
432
|
-
*/
|
|
433
|
-
silgi?: string;
|
|
434
|
-
}
|
|
435
|
-
interface ModuleMeta {
|
|
436
|
-
/** Module name. */
|
|
437
|
-
name?: string;
|
|
438
|
-
/** Module description. */
|
|
439
|
-
description?: string;
|
|
440
|
-
/** Module author. */
|
|
441
|
-
author?: string;
|
|
442
|
-
/** Module license. */
|
|
443
|
-
license?: string;
|
|
444
|
-
/** Module version. */
|
|
445
|
-
version?: string;
|
|
446
|
-
/**
|
|
447
|
-
* The configuration key used within `silgi.config` for this module's options.
|
|
448
|
-
* For example, `@silgijs/axios` uses `axios`.
|
|
449
|
-
*/
|
|
450
|
-
configKey?: string;
|
|
451
|
-
/**
|
|
452
|
-
* Constraints for the versions of silgi or features this module requires.
|
|
453
|
-
*/
|
|
454
|
-
compatibility?: SilgiCompatibility;
|
|
455
|
-
/**
|
|
456
|
-
* @private
|
|
457
|
-
*/
|
|
458
|
-
_modules?: {
|
|
459
|
-
[key: string]: string;
|
|
460
|
-
};
|
|
461
|
-
/**
|
|
462
|
-
* @private
|
|
463
|
-
*/
|
|
464
|
-
_packageName?: string;
|
|
465
|
-
cliToRuntimeOptionsKeys?: string[];
|
|
466
|
-
readonly afterDependencies?: ReadonlyArray<string>;
|
|
467
|
-
readonly beforeDependencies?: ReadonlyArray<string>;
|
|
468
|
-
readonly requiredDependencies?: ReadonlyArray<string>;
|
|
469
|
-
[key: string]: unknown;
|
|
470
|
-
}
|
|
471
|
-
interface ResolvedModuleMeta extends ModuleMeta {
|
|
472
|
-
configKey: string;
|
|
473
|
-
name: string;
|
|
474
|
-
}
|
|
475
|
-
type ModuleHookContext = Readonly<{
|
|
476
|
-
event?: SilgiEvents;
|
|
477
|
-
operation?: SilgiOperation;
|
|
478
|
-
input?: unknown;
|
|
479
|
-
source?: any;
|
|
480
|
-
result?: unknown;
|
|
481
|
-
modules?: SilgiRuntimeActions;
|
|
482
|
-
timestamp?: number;
|
|
483
|
-
meta?: Record<string, unknown>;
|
|
484
|
-
error?: Error;
|
|
485
|
-
success?: boolean;
|
|
486
|
-
cached?: boolean;
|
|
487
|
-
config: {
|
|
488
|
-
returnNull: boolean;
|
|
489
|
-
};
|
|
490
|
-
}>;
|
|
491
|
-
/** The options received. */
|
|
492
|
-
type ModuleOptionsCustom = Record<string, any>;
|
|
493
|
-
type Prettify<T> = {
|
|
494
|
-
[K in keyof T]: T[K];
|
|
495
|
-
} & {};
|
|
496
|
-
type ResolvedModuleOptions<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>> = Prettify<Defu<Partial<TOptions>, [
|
|
497
|
-
Partial<TOptions>,
|
|
498
|
-
TOptionsDefaults
|
|
499
|
-
]>>;
|
|
500
|
-
interface ModuleDefinition<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>, TWith extends boolean> {
|
|
501
|
-
meta?: ModuleMeta;
|
|
502
|
-
defaults?: TOptionsDefaults | ((silgi: SilgiCLI) => Awaitable<TOptionsDefaults>);
|
|
503
|
-
hooks?: Partial<SilgiCLIHooks>;
|
|
504
|
-
setup?: (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI & SilgiModuleOptions) => ModuleSetupReturn;
|
|
505
|
-
}
|
|
506
|
-
interface ModuleSetupInstallResult {
|
|
507
|
-
/**
|
|
508
|
-
* Timing information for the initial setup
|
|
509
|
-
*/
|
|
510
|
-
timings?: {
|
|
511
|
-
/** Total time took for module setup in ms */
|
|
512
|
-
setup?: number;
|
|
513
|
-
[key: string]: number | undefined;
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
type ModuleSetupReturn = Awaitable<false | void | ModuleSetupInstallResult>;
|
|
517
|
-
interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions> = Partial<TOptions>, TWith extends boolean = false> {
|
|
518
|
-
(this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI): ModuleSetupReturn;
|
|
519
|
-
getOptions?: (inlineOptions?: Partial<TOptions>, silgi?: SilgiCLI) => Promise<TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions>;
|
|
520
|
-
getMeta?: () => Promise<ModuleMeta>;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
interface SilgiRuntimeMethods {
|
|
524
|
-
}
|
|
525
|
-
interface SilgiNamespaces {
|
|
526
|
-
}
|
|
527
|
-
type CommandType = 'run' | 'prepare' | 'install';
|
|
528
|
-
interface DefaultNamespaces extends SilgiNamespaces {
|
|
529
|
-
}
|
|
530
|
-
interface SilgiRouterTypes {
|
|
531
|
-
}
|
|
532
|
-
type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
|
|
533
|
-
interface DefaultHooks {
|
|
534
|
-
}
|
|
535
|
-
type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends Record<string, any> ? {
|
|
536
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
537
|
-
} : T;
|
|
538
|
-
type Awaitable<T> = T | Promise<T>;
|
|
539
|
-
interface CreateScope {
|
|
540
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
541
|
-
}
|
|
542
|
-
declare global {
|
|
543
|
-
var $silgiStatus: CommandType;
|
|
544
|
-
var $silgiSharedRuntimeConfig: SilgiRuntimeOptions;
|
|
545
|
-
namespace NodeJS {
|
|
546
|
-
interface Global {
|
|
547
|
-
$silgiStatus: CommandType;
|
|
548
|
-
$silgiSharedRuntimeConfig: SilgiRuntimeOptions;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
type SilgiPreset = SilgiCLIConfig | (() => SilgiCLIConfig);
|
|
554
|
-
interface SilgiPresetMeta {
|
|
555
|
-
url: string;
|
|
556
|
-
name: string;
|
|
557
|
-
stdName?: ProviderName;
|
|
558
|
-
aliases?: string[];
|
|
559
|
-
static?: boolean;
|
|
560
|
-
compatibilityDate?: DateString;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* SilgiCLI normalized options (silgi.options)
|
|
565
|
-
*/
|
|
566
|
-
interface SilgiCLIOptions extends PresetOptions {
|
|
567
|
-
_config: SilgiCLIConfig;
|
|
568
|
-
_c12: ResolvedConfig<SilgiCLIConfig> | ConfigWatcher<SilgiCLIConfig>;
|
|
569
|
-
_cli?: {
|
|
570
|
-
command?: string;
|
|
571
|
-
};
|
|
572
|
-
commandType: CommandType;
|
|
573
|
-
routeRules: SilgiRouteRules$1;
|
|
574
|
-
environments: DotenvOptions$1[];
|
|
575
|
-
activeEnvironment: string;
|
|
576
|
-
envOptions: EnvOptions$1;
|
|
577
|
-
runtimeConfig: SilgiRuntimeConfig$1 & {
|
|
578
|
-
[key: string]: any;
|
|
579
|
-
};
|
|
580
|
-
serviceParseModules: ServiceParseModule$1[];
|
|
581
|
-
storages: string[];
|
|
582
|
-
namespaces: string[];
|
|
583
|
-
hooks: NestedHooks<SilgiCLIHooks$1>;
|
|
584
|
-
plugins: {
|
|
585
|
-
path: string;
|
|
586
|
-
packageImport: string;
|
|
587
|
-
}[];
|
|
588
|
-
compatibilityDate: CompatibilityDates;
|
|
589
|
-
modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
590
|
-
_modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
591
|
-
isPreparingModules: boolean;
|
|
592
|
-
debug: boolean;
|
|
593
|
-
preset: PresetName;
|
|
594
|
-
static: boolean;
|
|
595
|
-
logLevel: LogLevel;
|
|
596
|
-
appConfig: AppConfig;
|
|
597
|
-
appConfigFiles: string[];
|
|
598
|
-
storage: StorageMounts$1;
|
|
599
|
-
devStorage: StorageMounts$1;
|
|
600
|
-
workspaceDir: string;
|
|
601
|
-
rootDir: string;
|
|
602
|
-
srcDir: string;
|
|
603
|
-
scanDirs: string[];
|
|
604
|
-
build: {
|
|
605
|
-
dir: string;
|
|
606
|
-
typesDir: string;
|
|
607
|
-
/**
|
|
608
|
-
* It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
* @example
|
|
612
|
-
* ```js
|
|
613
|
-
* templates: [
|
|
614
|
-
* {
|
|
615
|
-
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative
|
|
616
|
-
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir
|
|
617
|
-
* }
|
|
618
|
-
* ]
|
|
619
|
-
* ```
|
|
620
|
-
*/
|
|
621
|
-
templates: SilgiTemplate$1<any>[];
|
|
622
|
-
};
|
|
623
|
-
modulesDir: string[];
|
|
624
|
-
output: {
|
|
625
|
-
dir: string;
|
|
626
|
-
serverDir: string;
|
|
627
|
-
publicDir: string;
|
|
628
|
-
};
|
|
629
|
-
serverDir: string;
|
|
630
|
-
clientDir: string;
|
|
631
|
-
silgi: {
|
|
632
|
-
/**
|
|
633
|
-
* @default "{serverDir}/silgi"
|
|
634
|
-
*/
|
|
635
|
-
serverDir: string;
|
|
636
|
-
clientDir: string;
|
|
637
|
-
/**
|
|
638
|
-
* @default "{serverDir}/public"
|
|
639
|
-
*/
|
|
640
|
-
publicDir: string;
|
|
641
|
-
/**
|
|
642
|
-
* @default "{silgi.serverDir}/utils"
|
|
643
|
-
*/
|
|
644
|
-
utilsDir: string;
|
|
645
|
-
/**
|
|
646
|
-
* @default "{silgi.serverDir}/types"
|
|
647
|
-
*/
|
|
648
|
-
typesDir: string;
|
|
649
|
-
/**
|
|
650
|
-
* @default "{silgi.serverDir}/vfs"
|
|
651
|
-
*/
|
|
652
|
-
vfsDir: string;
|
|
653
|
-
};
|
|
654
|
-
imports: UnimportPluginOptions | false;
|
|
655
|
-
watchOptions: ChokidarOptions;
|
|
656
|
-
nodeModulesDirs: string[];
|
|
657
|
-
devServer: {
|
|
658
|
-
watch: string[];
|
|
659
|
-
};
|
|
660
|
-
framework: SilgiFrameworkInfo$1;
|
|
661
|
-
/**
|
|
662
|
-
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building.
|
|
663
|
-
*
|
|
664
|
-
* @default ["**\/*.stories.{js,cts,mts,ts,jsx,tsx}","**\/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}","**\/*.d.{cts,mts,ts}","**\/.{pnpm-store,vercel,netlify,output,git,cache,data}",".nuxt/analyze",".nuxt","**\/-*.*"]
|
|
665
|
-
*/
|
|
666
|
-
ignore: Array<string>;
|
|
667
|
-
/**
|
|
668
|
-
* Whether Nuxt is running in development mode.
|
|
669
|
-
*
|
|
670
|
-
* Normally, you should not need to set this.
|
|
671
|
-
*
|
|
672
|
-
* @default false
|
|
673
|
-
*/
|
|
674
|
-
dev: boolean;
|
|
675
|
-
/**
|
|
676
|
-
* jiti with stub mode
|
|
677
|
-
* @default false
|
|
678
|
-
*/
|
|
679
|
-
stub: boolean;
|
|
680
|
-
/**
|
|
681
|
-
* Whether your app is being unit tested.
|
|
682
|
-
*
|
|
683
|
-
* @default false
|
|
684
|
-
*/
|
|
685
|
-
test: boolean;
|
|
686
|
-
extensions: string[];
|
|
687
|
-
future: {
|
|
688
|
-
/**
|
|
689
|
-
* This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and Vite.
|
|
690
|
-
*
|
|
691
|
-
* It improves type support when using modern libraries with `exports`.
|
|
692
|
-
* You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
|
|
693
|
-
*
|
|
694
|
-
* @default true
|
|
695
|
-
*
|
|
696
|
-
* @see [TypeScript PR implementing `bundler` module resolution](https://github.com/microsoft/TypeScript/pull/51669)
|
|
697
|
-
*/
|
|
698
|
-
typescriptBundlerResolution: boolean;
|
|
699
|
-
};
|
|
700
|
-
typescript: {
|
|
701
|
-
/**
|
|
702
|
-
* TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks)
|
|
703
|
-
*
|
|
704
|
-
* @default true
|
|
705
|
-
*/
|
|
706
|
-
strict: boolean;
|
|
707
|
-
/**
|
|
708
|
-
* Modules to generate deep aliases for within `compilerOptions.paths`. This does not yet support subpaths. It may be necessary when using Nuxt within a pnpm monorepo with `shamefully-hoist=false`.
|
|
709
|
-
*
|
|
710
|
-
* @default ["nitro/types","nitro/runtime","defu","h3","consola","ofetch","@unhead/vue","@nuxt/devtools","vue","@vue/runtime-core","@vue/compiler-sfc","vue-router","vue-router/auto-routes","unplugin-vue-router/client","@nuxt/schema","nuxt"]
|
|
711
|
-
*/
|
|
712
|
-
hoist: Array<string>;
|
|
713
|
-
/**
|
|
714
|
-
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors.
|
|
715
|
-
*
|
|
716
|
-
* @default false
|
|
717
|
-
*/
|
|
718
|
-
includeWorkspace: boolean;
|
|
719
|
-
/**
|
|
720
|
-
* Enable build-time type checking.
|
|
721
|
-
*
|
|
722
|
-
* If set to true, this will type check in development. You can restrict this to build-time type checking by setting it to `build`. Requires to install `typescript` and `vue-tsc` as dev dependencies.
|
|
723
|
-
*
|
|
724
|
-
* @default false
|
|
725
|
-
*
|
|
726
|
-
* @see [Nuxt TypeScript docs](https://nuxt.com/docs/guide/concepts/typescript)
|
|
727
|
-
*/
|
|
728
|
-
typeCheck: boolean | 'build';
|
|
729
|
-
/**
|
|
730
|
-
* You can extend generated `.nuxt/tsconfig.json` using this option.
|
|
731
|
-
*
|
|
732
|
-
*/
|
|
733
|
-
tsConfig: TSConfig;
|
|
734
|
-
/**
|
|
735
|
-
* Generate a `*.vue` shim.
|
|
736
|
-
*
|
|
737
|
-
* We recommend instead letting the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) generate accurate types for your components.
|
|
738
|
-
* Note that you may wish to set this to `true` if you are using other libraries, such as ESLint, that are unable to understand the type of `.vue` files.
|
|
739
|
-
*
|
|
740
|
-
* @default false
|
|
741
|
-
*/
|
|
742
|
-
shim: boolean;
|
|
743
|
-
/**
|
|
744
|
-
* @default "types/silgi.tsconfig.json"
|
|
745
|
-
*/
|
|
746
|
-
tsconfigPath: string;
|
|
747
|
-
/**
|
|
748
|
-
* @default true
|
|
749
|
-
*/
|
|
750
|
-
generateTsConfig: boolean;
|
|
751
|
-
/**
|
|
752
|
-
* @default ['silgiTypes']
|
|
753
|
-
*/
|
|
754
|
-
customConditions: string[];
|
|
755
|
-
/**
|
|
756
|
-
* Enable generating runtime configuration types.
|
|
757
|
-
*
|
|
758
|
-
* @default true
|
|
759
|
-
*/
|
|
760
|
-
generateRuntimeConfigTypes: boolean;
|
|
761
|
-
/**
|
|
762
|
-
* @default false
|
|
763
|
-
* Behavior of import paths in auto-generated silgi files
|
|
764
|
-
*/
|
|
765
|
-
removeFileExtension: boolean;
|
|
766
|
-
};
|
|
767
|
-
alias: Record<string, string>;
|
|
768
|
-
/**
|
|
769
|
-
* @default ['silgi']
|
|
770
|
-
*/
|
|
771
|
-
conditions: string[];
|
|
772
|
-
/**
|
|
773
|
-
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
|
|
774
|
-
*
|
|
775
|
-
*
|
|
776
|
-
* @see [node-ignore](https://github.com/kaelzhang/node-ignore)
|
|
777
|
-
*
|
|
778
|
-
* @example
|
|
779
|
-
* ```js
|
|
780
|
-
* ignoreOptions: {
|
|
781
|
-
* ignorecase: false
|
|
782
|
-
* }
|
|
783
|
-
* ```
|
|
784
|
-
*/
|
|
785
|
-
ignoreOptions: Options;
|
|
786
|
-
commands: Record<string, Record<string, {
|
|
787
|
-
type: 'function' | 'command';
|
|
788
|
-
handler: string;
|
|
789
|
-
description?: string;
|
|
790
|
-
}>>;
|
|
791
|
-
installPackages: Record<'dependencies' | 'devDependencies', Record<string, string>>;
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* Silgi input config (silgi.config)
|
|
795
|
-
*/
|
|
796
|
-
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate' | '_config' | '_c12'>>, C12InputConfig<SilgiCLIConfig>, Partial<SilgiModuleOptions> {
|
|
797
|
-
preset?: PresetNameInput;
|
|
798
|
-
extends?: string | string[] | SilgiPreset;
|
|
799
|
-
compatibilityDate?: CompatibilityDateSpec;
|
|
800
|
-
}
|
|
801
|
-
interface AppConfig {
|
|
802
|
-
[key: string]: any;
|
|
803
|
-
}
|
|
804
|
-
interface LoadConfigOptions {
|
|
805
|
-
watch?: boolean;
|
|
806
|
-
c12?: WatchConfigOptions;
|
|
807
|
-
compatibilityDate?: CompatibilityDateSpec;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
interface EnvOptions {
|
|
811
|
-
prefix?: string;
|
|
812
|
-
altPrefix?: string;
|
|
813
|
-
silgiPrefix?: string;
|
|
814
|
-
envExpansion?: boolean;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
interface DefaultRouteConfig extends SilgiRuntimeRouteRulesConfig {
|
|
818
|
-
splat?: boolean;
|
|
819
|
-
doubleSplat?: boolean;
|
|
820
|
-
[key: string]: any;
|
|
821
|
-
}
|
|
822
|
-
interface DefaultRouteRules extends SilgiRuntimeRouteRules {
|
|
823
|
-
[key: string]: any;
|
|
824
|
-
}
|
|
825
|
-
type SilgiRouteRules = Record<DefaultRouteRules extends string ? DefaultRouteRules : string, DefaultRouteConfig>;
|
|
826
|
-
interface SilgiRuntimeRouteRules {
|
|
827
|
-
}
|
|
828
|
-
interface SilgiRuntimeRouteRulesConfig {
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Interface for the object returned by createRouteRules
|
|
832
|
-
*/
|
|
833
|
-
interface RouteRules {
|
|
834
|
-
readonly rules: Record<string, DefaultRouteConfig>;
|
|
835
|
-
readonly mergedRules: Record<string, DefaultRouteConfig>;
|
|
836
|
-
importRules: (config: Record<string, DefaultRouteConfig>) => void;
|
|
837
|
-
exportRules: () => Record<string, DefaultRouteConfig>;
|
|
838
|
-
addRule: (pattern: string, config: DefaultRouteConfig) => void;
|
|
839
|
-
updateRule: (pattern: string, config: Partial<DefaultRouteConfig>) => void;
|
|
840
|
-
removeRule: (pattern: string) => void;
|
|
841
|
-
matchesRule: (url: string, pattern: string) => boolean;
|
|
842
|
-
getMatchingPatterns: (url: string) => string[];
|
|
843
|
-
getConfig: (url: string) => DefaultRouteConfig | null;
|
|
844
|
-
getParams: (url: string, pattern: string) => Record<string, string> | null;
|
|
845
|
-
match: (url: string) => {
|
|
846
|
-
pattern: string;
|
|
847
|
-
config: DefaultRouteConfig;
|
|
848
|
-
params: Record<string, string> | null;
|
|
849
|
-
} | null;
|
|
850
|
-
clear: () => void;
|
|
851
|
-
clearMergedRules: () => void;
|
|
852
|
-
precomputeMergedRules: (urls: string[]) => void;
|
|
853
|
-
setMergedRule: (url: string, config: DefaultRouteConfig) => void;
|
|
854
|
-
getMergedRules: () => Record<string, DefaultRouteConfig>;
|
|
855
|
-
configure: (config: Record<string, DefaultRouteConfig>) => void;
|
|
856
|
-
updateMergeRules: () => Record<string, DefaultRouteConfig>;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
type CustomDriverName = string & {
|
|
860
|
-
_custom?: any;
|
|
861
|
-
};
|
|
862
|
-
interface StorageMounts {
|
|
863
|
-
[path: string]: {
|
|
864
|
-
driver: BuiltinDriverName | CustomDriverName;
|
|
865
|
-
[option: string]: any;
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
interface SilgiStorageBase {
|
|
869
|
-
}
|
|
870
|
-
type StorageKeyGenerator<TInput> = (input: TInput) => string | Promise<string>;
|
|
871
|
-
interface StorageConfig<TInput> {
|
|
872
|
-
options: TransactionOptions;
|
|
873
|
-
base: 'memory' | keyof SilgiStorageBase;
|
|
874
|
-
key?: StorageKeyGenerator<TInput>;
|
|
875
|
-
scope?: 'request' | 'global';
|
|
876
|
-
}
|
|
877
|
-
interface StorageKeyParams<TInput = unknown> {
|
|
878
|
-
operation: SilgiOperation;
|
|
879
|
-
input: TInput;
|
|
880
|
-
requestId?: string;
|
|
881
|
-
keyGenerator?: StorageKeyGenerator<TInput>;
|
|
882
|
-
storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
interface SilgiRuntimeShareds extends SilgiRuntimeSharedsExtend {
|
|
886
|
-
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
887
|
-
silgi: SilgiFunction;
|
|
888
|
-
runtimeConfig: SilgiRuntimeConfig;
|
|
889
|
-
}
|
|
890
|
-
interface SilgiRuntimeSharedsExtend {
|
|
891
|
-
}
|
|
892
|
-
interface ExtendShared {
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
type EventHandlerResponse<T = undefined> = T extends undefined ? void : void | T | Promise<T>;
|
|
896
|
-
type MethodHandlerType<T> = {
|
|
897
|
-
routeRules?: DefaultRouteConfig;
|
|
898
|
-
} & {
|
|
899
|
-
[Action in keyof T]: T[Action] extends Record<string, any> ? {
|
|
900
|
-
routeRules?: DefaultRouteConfig;
|
|
901
|
-
} & {
|
|
902
|
-
[Method in keyof T[Action]]?: {
|
|
903
|
-
default?: {
|
|
904
|
-
input?: StandardSchemaV1.InferInput<T[Action][Method]['input']> & {
|
|
905
|
-
parameters: StandardSchemaV1.InferInput<T[Action][Method]['pathParams']> & StandardSchemaV1.InferInput<T[Action][Method]['queryParams']>;
|
|
906
|
-
};
|
|
907
|
-
output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
|
|
908
|
-
source?: StandardSchemaV1.InferInput<T[Action][Method]['source']>;
|
|
909
|
-
};
|
|
910
|
-
handler: (input: StandardSchemaV1.InferInput<T[Action][Method]['input']> & {
|
|
911
|
-
parameters: StandardSchemaV1.InferInput<T[Action][Method]['pathParams']> & StandardSchemaV1.InferInput<T[Action][Method]['queryParams']>;
|
|
912
|
-
}, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<T[Action][Method]['source']>) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
|
|
913
|
-
modules?: Partial<SilgiRuntimeActions>;
|
|
914
|
-
routeRules?: DefaultRouteConfig;
|
|
915
|
-
storage?: StorageConfig<T[Action][Method]['input']>;
|
|
916
|
-
};
|
|
917
|
-
} : never;
|
|
918
|
-
};
|
|
919
|
-
interface ResolvedMethodHandlerType {
|
|
920
|
-
input?: Partial<BaseSchemaType<any>>;
|
|
921
|
-
output: Partial<BaseSchemaType<any>>;
|
|
922
|
-
handler: (input: StandardSchemaV1.InferInput<any> & {
|
|
923
|
-
parameters: any;
|
|
924
|
-
}, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
925
|
-
modules?: Partial<SilgiRuntimeActions>;
|
|
926
|
-
storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
|
|
927
|
-
routeRules?: SilgiRouteRules;
|
|
928
|
-
execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiRuntimeShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
|
|
932
|
-
[Action in keyof T]: T[Action] extends Record<string, any> ? {
|
|
933
|
-
[Method in keyof T[Action]]: {
|
|
934
|
-
input: T[Action][Method]['input'];
|
|
935
|
-
output: T[Action][Method]['output'];
|
|
936
|
-
/**
|
|
937
|
-
* Example: /api/v1/users/{id}/{name}/{surname}
|
|
938
|
-
*/
|
|
939
|
-
pathParams: T[Action][Method]['pathParams'];
|
|
940
|
-
/**
|
|
941
|
-
* Example: /api/v1/users?name=ali&surname=veli
|
|
942
|
-
*/
|
|
943
|
-
queryParams: T[Action][Method]['queryParams'];
|
|
944
|
-
source: T[Action][Method]['source'];
|
|
945
|
-
};
|
|
946
|
-
} : never;
|
|
947
|
-
};
|
|
948
|
-
type ServiceType<T> = Partial<{
|
|
949
|
-
[Namespace in keyof T]: T[Namespace] extends Record<string, any> ? {
|
|
950
|
-
routeRules?: DefaultRouteConfig;
|
|
951
|
-
} & {
|
|
952
|
-
[Service in keyof T[Namespace]]?: Partial<MethodHandlerType<T[Namespace][Service]>>;
|
|
953
|
-
} : never;
|
|
954
|
-
}>;
|
|
955
|
-
type RequiredServiceType<T> = {
|
|
956
|
-
[K in keyof T]-?: T[K] extends Record<string, any> ? {
|
|
957
|
-
[P in keyof T[K]]-?: MethodHandlerType<T[K][P]>;
|
|
958
|
-
} : never;
|
|
959
|
-
};
|
|
960
|
-
/**
|
|
961
|
-
* const test: ResolvedServiceType = {
|
|
962
|
-
aaa: {
|
|
963
|
-
bbb: {
|
|
964
|
-
delete: {
|
|
965
|
-
storage: {
|
|
966
|
-
handler: () => {}
|
|
967
|
-
},
|
|
968
|
-
},
|
|
969
|
-
},
|
|
970
|
-
},
|
|
971
|
-
}
|
|
972
|
-
*/
|
|
973
|
-
type ResolvedServiceType = {
|
|
974
|
-
[K in string]: {
|
|
975
|
-
[P in string]: {
|
|
976
|
-
[Q in BaseSilgiMethodType]?: {
|
|
977
|
-
[M in string]: ResolvedMethodHandlerType;
|
|
978
|
-
};
|
|
979
|
-
};
|
|
980
|
-
};
|
|
981
|
-
};
|
|
982
|
-
|
|
983
|
-
interface FrameworkContext {
|
|
984
|
-
}
|
|
985
|
-
interface Silgi {
|
|
986
|
-
schemas: any;
|
|
987
|
-
services: ResolvedServiceType;
|
|
988
|
-
shared: SilgiRuntimeShareds;
|
|
989
|
-
uris: Record<string, any>;
|
|
990
|
-
modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
|
|
991
|
-
scannedHandlers: Map<string, ResolvedMethodHandlerType>;
|
|
992
|
-
plugins: SilgiAppPlugin[];
|
|
993
|
-
framework: FrameworkContext;
|
|
994
|
-
routeRules: RouteRules;
|
|
995
|
-
_ignore?: Ignore;
|
|
996
|
-
hooks: Hookable<SilgiRuntimeHooks & DefaultHooks>;
|
|
997
|
-
hook: Silgi['hooks']['hook'];
|
|
998
|
-
callHook: Silgi['hooks']['callHook'];
|
|
999
|
-
addHooks: Silgi['hooks']['addHooks'];
|
|
1000
|
-
ready: () => Promise<void>;
|
|
1001
|
-
close: () => Promise<void>;
|
|
1002
|
-
logger: ConsolaInstance;
|
|
1003
|
-
storage: Storage;
|
|
1004
|
-
envOptions: EnvOptions;
|
|
1005
|
-
options: SilgiOptions & SilgiRuntimeOptions;
|
|
1006
|
-
captureError: CaptureError;
|
|
1007
|
-
}
|
|
1008
|
-
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiRuntimeOptions> {
|
|
1009
|
-
options: DeepPartial<SilgiOptions>;
|
|
1010
|
-
}
|
|
1011
|
-
type SilgiFunction = typeof silgi;
|
|
1012
|
-
|
|
1013
|
-
interface SilgiAppPlugin {
|
|
1014
|
-
(silgi: Silgi): Promise<void> | void;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
interface CapturedErrorContext {
|
|
1018
|
-
event?: SilgiEvents;
|
|
1019
|
-
[key: string]: unknown;
|
|
1020
|
-
}
|
|
1021
|
-
type CaptureError = (error: Error, context: CapturedErrorContext) => void;
|
|
1022
|
-
|
|
1023
|
-
/**
|
|
1024
|
-
* The listeners to Silgi
|
|
1025
|
-
*/
|
|
1026
|
-
interface SilgiRuntimeHooks {
|
|
1027
|
-
/**
|
|
1028
|
-
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
1029
|
-
* @param silgi The configured Silgi object
|
|
1030
|
-
* @returns Promise
|
|
1031
|
-
*/
|
|
1032
|
-
'ready': (silgi: Silgi) => HookResult;
|
|
1033
|
-
/**
|
|
1034
|
-
* Called when silgi instance is gracefully closing.
|
|
1035
|
-
* @param silgi The configured silgi object
|
|
1036
|
-
* @returns Promise
|
|
1037
|
-
*/
|
|
1038
|
-
'close': (silgi: Silgi) => HookResult;
|
|
1039
|
-
'app:setup:start': (silgi: Silgi) => HookResult;
|
|
1040
|
-
'execute:before': (context: ModuleHookContext) => HookResult;
|
|
1041
|
-
'execute:after': (context: ModuleHookContext) => HookResult;
|
|
1042
|
-
'execute:error': (context: ModuleHookContext) => HookResult;
|
|
1043
|
-
'execute:finally': (context: ModuleHookContext) => HookResult;
|
|
1044
|
-
'event:init': (event: SilgiEvents, data: {
|
|
1045
|
-
path: string;
|
|
1046
|
-
queryParams?: Record<string, string>;
|
|
1047
|
-
operation: SilgiOperation;
|
|
1048
|
-
}) => HookResult;
|
|
1049
|
-
'error': CaptureError;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
interface SilgiRuntimeConfig {
|
|
1053
|
-
}
|
|
1054
|
-
interface SilgiOptions {
|
|
1055
|
-
consolaOptions?: Partial<ConsolaOptions>;
|
|
1056
|
-
routeRules: SilgiRouteRules;
|
|
1057
|
-
present: PresetNameInput;
|
|
1058
|
-
hooks: Partial<SilgiRuntimeHooks & DefaultHooks>;
|
|
1059
|
-
/**
|
|
1060
|
-
* Set to `true` to enable debug mode.
|
|
1061
|
-
*
|
|
1062
|
-
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser.
|
|
1063
|
-
*
|
|
1064
|
-
* @default false
|
|
1065
|
-
*/
|
|
1066
|
-
debug: boolean;
|
|
1067
|
-
storage: StorageMounts;
|
|
1068
|
-
putStorage?: Storage<StorageValue>;
|
|
1069
|
-
runtimeConfig: SilgiRuntimeConfig & {
|
|
1070
|
-
[key: string]: any;
|
|
1071
|
-
};
|
|
1072
|
-
captureError: CaptureError;
|
|
1073
|
-
[key: string]: any;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
interface SilgiRuntimeContext extends Record<string, any> {
|
|
1077
|
-
}
|
|
1078
|
-
interface ExtendContext {
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
interface DotenvOptions {
|
|
1082
|
-
/**
|
|
1083
|
-
* The project root directory (either absolute or relative to the current working directory).
|
|
1084
|
-
*/
|
|
1085
|
-
cwd: string;
|
|
1086
|
-
/**
|
|
1087
|
-
* What file to look in for environment variables (either absolute or relative
|
|
1088
|
-
* to the current working directory). For example, `.env`.
|
|
1089
|
-
*/
|
|
1090
|
-
fileName?: string;
|
|
1091
|
-
/**
|
|
1092
|
-
* Whether to interpolate variables within .env.
|
|
1093
|
-
*
|
|
1094
|
-
* @example
|
|
1095
|
-
* ```env
|
|
1096
|
-
* BASE_DIR="/test"
|
|
1097
|
-
* # resolves to "/test/further"
|
|
1098
|
-
* ANOTHER_DIR="${BASE_DIR}/further"
|
|
1099
|
-
* ```
|
|
1100
|
-
*/
|
|
1101
|
-
interpolate?: boolean;
|
|
1102
|
-
/**
|
|
1103
|
-
* An object describing environment variables (key, value pairs).
|
|
1104
|
-
*/
|
|
1105
|
-
env?: NodeJS.ProcessEnv;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
interface GraphQLJSON {
|
|
1109
|
-
queries: any;
|
|
1110
|
-
mutations: any;
|
|
1111
|
-
types: any;
|
|
1112
|
-
inputs: any;
|
|
1113
|
-
references: any;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
interface BaseNamespaceType extends Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>> {
|
|
1117
|
-
}
|
|
1118
|
-
type Namespaces<T extends BaseNamespaceType> = {
|
|
1119
|
-
[K in keyof T]: {
|
|
1120
|
-
[P in keyof T[K]]: T[K][P] extends BaseSchemaType<StandardSchemaV1> ? SilgiServiceInterface<T[K][P]> : never;
|
|
1121
|
-
};
|
|
1122
|
-
};
|
|
1123
|
-
|
|
1124
|
-
interface ServiceParse {
|
|
1125
|
-
node: ResolvedMethodHandlerType;
|
|
1126
|
-
basePath: string;
|
|
1127
|
-
silgi: SilgiCLI;
|
|
1128
|
-
modulesURIs: Record<string, Record<string, any>>;
|
|
1129
|
-
pathLength: number;
|
|
1130
|
-
}
|
|
1131
|
-
interface ServiceParseModule {
|
|
1132
|
-
(params: ServiceParse): Awaited<void> | void;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
declare const autoImportTypes: string[];
|
|
1136
|
-
|
|
1137
|
-
export { autoImportTypes };
|
|
1138
|
-
export type { AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, CaptureError, CapturedErrorContext, CommandType, CreateScope, DeepPartial, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenerateAppOptions, GraphQLJSON, HookResult, ImportItem, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, PrepareCore, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, URIsTypes };
|