silgi 0.37.0 → 0.37.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.mjs +1 -1
- package/dist/core/index.mjs +51 -41
- package/dist/index.mjs +0 -1
- package/dist/runtime/internal/next.mjs +1 -26
- package/dist/runtime/internal/nitro.mjs +1 -32
- package/dist/types/index.d.mts +593 -593
- package/package.json +1 -1
package/dist/types/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { ApifulConfig } from 'apiful/config';
|
|
|
2
2
|
import { C12InputConfig, ResolvedConfig, ConfigWatcher, WatchConfigOptions } from 'c12';
|
|
3
3
|
import { ChokidarOptions } from 'chokidar';
|
|
4
4
|
import { DateString, CompatibilityDateSpec, CompatibilityDates } from 'compatx';
|
|
5
|
-
import { ConsolaInstance,
|
|
5
|
+
import { ConsolaInstance, ConsolaOptions, LogLevel } from 'consola';
|
|
6
6
|
import { Hookable, NestedHooks } from 'hookable';
|
|
7
7
|
import { Ignore, Options } from 'ignore';
|
|
8
8
|
import { TSConfig } from 'pkg-types';
|
|
@@ -11,7 +11,7 @@ import { ResolvedServiceDefinition as ResolvedServiceDefinition$1, SilgiRuntimeS
|
|
|
11
11
|
import { Adapter, TablesSchema, InferModelTypes } from 'unadapter/types';
|
|
12
12
|
import { UnimportPluginOptions } from 'unimport/unplugin';
|
|
13
13
|
import * as h3 from 'h3';
|
|
14
|
-
import {
|
|
14
|
+
import { HTTPMethod as HTTPMethod$1, Session, H3Event } from 'h3';
|
|
15
15
|
import * as nitropack_types from 'nitropack/types';
|
|
16
16
|
import { NitroRuntimeConfig } from 'nitropack/types';
|
|
17
17
|
import { Defu } from 'defu';
|
|
@@ -21,12 +21,12 @@ import { Stats } from 'node:fs';
|
|
|
21
21
|
import { ESMImport, ESMCodeGenOptions } from 'knitwork';
|
|
22
22
|
import { Unimport } from 'unimport';
|
|
23
23
|
import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
|
|
24
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
25
|
-
import { ProviderName } from 'std-env';
|
|
26
24
|
import { ServerRequest } from 'srvx';
|
|
25
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
27
26
|
import { NitroApp } from 'nitropack';
|
|
28
27
|
import { RouterContext } from 'rou3';
|
|
29
28
|
import { silgiFetch } from 'silgi';
|
|
29
|
+
import { ProviderName } from 'std-env';
|
|
30
30
|
import { FetchOptions, FetchResponse } from 'ofetch';
|
|
31
31
|
|
|
32
32
|
interface SilgiCompatibilityIssue {
|
|
@@ -321,6 +321,59 @@ interface GenerateAppOptions {
|
|
|
321
321
|
filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
|
|
325
|
+
type AllPaths = SilgiRouterTypes extends {
|
|
326
|
+
keys: infer U;
|
|
327
|
+
} ? keyof U extends never ? string : keyof U : string;
|
|
328
|
+
type ExtractPathParams<T extends string> = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
329
|
+
[K in Param]: string;
|
|
330
|
+
} & ExtractPathParams<Rest> : T extends `${infer _Start}:${infer Param}` ? {
|
|
331
|
+
[K in Param]: string;
|
|
332
|
+
} : unknown;
|
|
333
|
+
|
|
334
|
+
type HttpMethod = 'get' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'head' | 'patch' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace';
|
|
335
|
+
type RouterParams<R extends AllPaths | (string & {})> = ExtractPathParams<R>;
|
|
336
|
+
type SilgiFetchOptions<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]> = {
|
|
337
|
+
method?: M;
|
|
338
|
+
params?: ExtractPathParams<P>;
|
|
339
|
+
body?: SilgiRouterTypes[BasePath][M]['input'];
|
|
340
|
+
} & Omit<FetchOptions, 'method' | 'body' | 'params'>;
|
|
341
|
+
type SilgiFetchClient = <P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: BasePath, options?: SilgiFetchOptions<P, BasePath, M>) => Promise<FetchResponse<SilgiRouterTypes[BasePath][M]['output']>>;
|
|
342
|
+
|
|
343
|
+
interface SilgiAppPlugin {
|
|
344
|
+
(silgi: Silgi): Promise<void> | void;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
interface CapturedErrorContext {
|
|
348
|
+
event?: SilgiEvent;
|
|
349
|
+
[key: string]: unknown;
|
|
350
|
+
}
|
|
351
|
+
type CaptureError = (silgi: Silgi, error: Error, context: CapturedErrorContext) => void;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* The listeners to Silgi
|
|
355
|
+
*/
|
|
356
|
+
interface SilgiRuntimeHooks {
|
|
357
|
+
/**
|
|
358
|
+
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
359
|
+
* @param silgi The configured Silgi object
|
|
360
|
+
* @returns Promise
|
|
361
|
+
*/
|
|
362
|
+
'ready': (silgi: Silgi) => HookResult;
|
|
363
|
+
/**
|
|
364
|
+
* Called when silgi instance is gracefully closing.
|
|
365
|
+
* @param silgi The configured silgi object
|
|
366
|
+
* @returns Promise
|
|
367
|
+
*/
|
|
368
|
+
'close': (silgi: Silgi) => HookResult;
|
|
369
|
+
'request:on': (event: SilgiEvent) => HookResult;
|
|
370
|
+
'fetch:before': (context: ModuleHookContext) => HookResult;
|
|
371
|
+
'fetch:after': (context: ModuleHookContext) => HookResult;
|
|
372
|
+
'fetch:error': (context: ModuleHookContext) => HookResult;
|
|
373
|
+
'fetch:finally': (context: Omit<ModuleHookContext, 'event'>) => HookResult;
|
|
374
|
+
'error': CaptureError;
|
|
375
|
+
}
|
|
376
|
+
|
|
324
377
|
type ServiceMethods<Schema extends SilgiSchema$1, Path extends keyof Schema, Resolved extends boolean = false, HiddenParameters extends boolean = false> = {
|
|
325
378
|
[M in keyof Schema[Path]]?: ServiceSetup<Schema, Path, M, Resolved, HiddenParameters>;
|
|
326
379
|
};
|
|
@@ -404,440 +457,68 @@ interface SilgiURL {
|
|
|
404
457
|
queryParams?: Record<string, string>;
|
|
405
458
|
}
|
|
406
459
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
interface SilgiCompatibility {
|
|
415
|
-
/**
|
|
416
|
-
* Required silgi version in semver format.
|
|
417
|
-
* @example `^3.2.0` or `>=3.13.0`.
|
|
418
|
-
*/
|
|
419
|
-
silgi?: string;
|
|
420
|
-
}
|
|
421
|
-
interface ModuleMeta {
|
|
422
|
-
/** Module name. */
|
|
423
|
-
name?: string;
|
|
424
|
-
/** Module description. */
|
|
425
|
-
description?: string;
|
|
426
|
-
/** Module author. */
|
|
427
|
-
author?: string;
|
|
428
|
-
/** Module license. */
|
|
429
|
-
license?: string;
|
|
430
|
-
/** Module version. */
|
|
431
|
-
version?: string;
|
|
432
|
-
/**
|
|
433
|
-
* The configuration key used within `silgi.config` for this module's options.
|
|
434
|
-
* For example, `@silgijs/axios` uses `axios`.
|
|
435
|
-
*/
|
|
436
|
-
configKey?: string;
|
|
437
|
-
/**
|
|
438
|
-
* Constraints for the versions of silgi or features this module requires.
|
|
439
|
-
*/
|
|
440
|
-
compatibility?: SilgiCompatibility;
|
|
441
|
-
/**
|
|
442
|
-
* @private
|
|
443
|
-
*/
|
|
444
|
-
_modules?: {
|
|
445
|
-
[key: string]: string;
|
|
460
|
+
type CustomDriverName = string & {
|
|
461
|
+
_custom?: any;
|
|
462
|
+
};
|
|
463
|
+
interface StorageMounts {
|
|
464
|
+
[path: string]: {
|
|
465
|
+
driver: BuiltinDriverName | CustomDriverName;
|
|
466
|
+
[option: string]: any;
|
|
446
467
|
};
|
|
447
|
-
/**
|
|
448
|
-
* @private
|
|
449
|
-
*/
|
|
450
|
-
_packageName?: string;
|
|
451
|
-
cliToRuntimeOptionsKeys?: string[];
|
|
452
|
-
readonly afterDependencies?: ReadonlyArray<string>;
|
|
453
|
-
readonly beforeDependencies?: ReadonlyArray<string>;
|
|
454
|
-
readonly requiredDependencies?: ReadonlyArray<string>;
|
|
455
|
-
[key: string]: unknown;
|
|
456
|
-
}
|
|
457
|
-
interface ResolvedModuleMeta extends ModuleMeta {
|
|
458
|
-
configKey: string;
|
|
459
|
-
name: string;
|
|
460
468
|
}
|
|
461
|
-
|
|
462
|
-
url: SilgiURL;
|
|
463
|
-
input?: unknown;
|
|
464
|
-
result?: unknown;
|
|
465
|
-
modules?: SilgiRuntimeActions;
|
|
466
|
-
error?: Error;
|
|
467
|
-
success?: boolean;
|
|
468
|
-
cached?: boolean;
|
|
469
|
-
}>;
|
|
470
|
-
/** The options received. */
|
|
471
|
-
type ModuleOptionsCustom = Record<string, any>;
|
|
472
|
-
type Prettify<T> = {
|
|
473
|
-
[K in keyof T]: T[K];
|
|
474
|
-
} & {};
|
|
475
|
-
type ResolvedModuleOptions<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>> = Prettify<Defu<Partial<TOptions>, [
|
|
476
|
-
Partial<TOptions>,
|
|
477
|
-
TOptionsDefaults
|
|
478
|
-
]>>;
|
|
479
|
-
interface ModuleDefinition<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>, TWith extends boolean> {
|
|
480
|
-
meta?: ModuleMeta;
|
|
481
|
-
defaults?: TOptionsDefaults | ((silgi: SilgiCLI) => Awaitable<TOptionsDefaults>);
|
|
482
|
-
hooks?: Partial<SilgiCLIHooks>;
|
|
483
|
-
setup?: (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI & SilgiModuleOptions) => ModuleSetupReturn;
|
|
469
|
+
interface SilgiStorageBase {
|
|
484
470
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
setup?: number;
|
|
492
|
-
[key: string]: number | undefined;
|
|
493
|
-
};
|
|
471
|
+
type StorageKeyGenerator<TInput> = (input: TInput) => string | Promise<string>;
|
|
472
|
+
interface StorageConfig<TInput> {
|
|
473
|
+
options: TransactionOptions;
|
|
474
|
+
base: 'memory' | keyof SilgiStorageBase;
|
|
475
|
+
key?: StorageKeyGenerator<TInput>;
|
|
476
|
+
scope?: 'request' | 'global';
|
|
494
477
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
478
|
+
interface StorageKeyParams<TInput = unknown> {
|
|
479
|
+
url: SilgiURL;
|
|
480
|
+
input: TInput;
|
|
481
|
+
requestId?: string;
|
|
482
|
+
keyGenerator?: StorageKeyGenerator<TInput>;
|
|
483
|
+
storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
|
|
500
484
|
}
|
|
501
485
|
|
|
502
|
-
interface
|
|
503
|
-
}
|
|
504
|
-
type CommandType = 'run' | 'prepare' | 'install' | 'dev' | 'init';
|
|
505
|
-
interface SilgiRouterTypes {
|
|
506
|
-
}
|
|
507
|
-
interface DefaultHooks {
|
|
486
|
+
interface SilgiRuntimeConfig {
|
|
508
487
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
var __nitro__: {
|
|
526
|
-
useRuntimeConfig?: <T extends NitroRuntimeConfig = NitroRuntimeConfig>(event?: H3Event) => T;
|
|
488
|
+
interface SilgiOptions {
|
|
489
|
+
consolaOptions?: Partial<ConsolaOptions>;
|
|
490
|
+
present: PresetNameInput;
|
|
491
|
+
hooks: Partial<SilgiRuntimeHooks & DefaultHooks>;
|
|
492
|
+
/**
|
|
493
|
+
* Set to `true` to enable debug mode.
|
|
494
|
+
*
|
|
495
|
+
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser.
|
|
496
|
+
*
|
|
497
|
+
* @default false
|
|
498
|
+
*/
|
|
499
|
+
debug: boolean;
|
|
500
|
+
storage: StorageMounts;
|
|
501
|
+
putStorage?: Storage<StorageValue>;
|
|
502
|
+
runtimeConfig: SilgiRuntimeConfig & {
|
|
527
503
|
[key: string]: any;
|
|
528
504
|
};
|
|
505
|
+
captureError: CaptureError;
|
|
506
|
+
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
|
|
507
|
+
[key: string]: any;
|
|
529
508
|
}
|
|
530
509
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
stdName?: ProviderName;
|
|
540
|
-
aliases?: string[];
|
|
541
|
-
static?: boolean;
|
|
542
|
-
compatibilityDate?: DateString;
|
|
510
|
+
/**
|
|
511
|
+
* Main interface containing all route definitions.
|
|
512
|
+
* Example:
|
|
513
|
+
* {
|
|
514
|
+
* "/api/blueSpace/basket/getBook": { ... }
|
|
515
|
+
* }
|
|
516
|
+
*/
|
|
517
|
+
interface Routers {
|
|
543
518
|
}
|
|
544
|
-
|
|
545
|
-
type Schema = 'zod' | 'valibot' | 'arkType' | 'typebox';
|
|
546
519
|
/**
|
|
547
|
-
*
|
|
548
|
-
|
|
549
|
-
interface SilgiCLIOptions extends PresetOptions {
|
|
550
|
-
_config: SilgiCLIConfig;
|
|
551
|
-
_c12: ResolvedConfig<SilgiCLIConfig> | ConfigWatcher<SilgiCLIConfig>;
|
|
552
|
-
_cli?: {
|
|
553
|
-
command?: string;
|
|
554
|
-
};
|
|
555
|
-
commandType: CommandType;
|
|
556
|
-
commands: Commands$1[];
|
|
557
|
-
schemaVendor: Schema | Schema[];
|
|
558
|
-
environments: DotenvOptions$1[];
|
|
559
|
-
activeEnvironment: 'prod' | 'docker' | 'staging' | 'testing' | '.env' | (string & {});
|
|
560
|
-
envOptions: EnvOptions$1;
|
|
561
|
-
runtimeConfig: SilgiRuntimeConfig$1 & {
|
|
562
|
-
[key: string]: any;
|
|
563
|
-
};
|
|
564
|
-
storages: string[];
|
|
565
|
-
hooks: NestedHooks<SilgiCLIHooks$1>;
|
|
566
|
-
plugins: {
|
|
567
|
-
path: string;
|
|
568
|
-
packageImport: string;
|
|
569
|
-
}[];
|
|
570
|
-
baseURL: string;
|
|
571
|
-
compatibilityDate: CompatibilityDates;
|
|
572
|
-
modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
573
|
-
_modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
574
|
-
isPreparingModules: boolean;
|
|
575
|
-
debug: true | {
|
|
576
|
-
command?: boolean;
|
|
577
|
-
install?: boolean;
|
|
578
|
-
};
|
|
579
|
-
preset: PresetName;
|
|
580
|
-
static: boolean;
|
|
581
|
-
logLevel: LogLevel;
|
|
582
|
-
appConfig: AppConfig;
|
|
583
|
-
appConfigFiles: string[];
|
|
584
|
-
codegen: {
|
|
585
|
-
env: {
|
|
586
|
-
safeList: string[][];
|
|
587
|
-
};
|
|
588
|
-
};
|
|
589
|
-
storage: StorageMounts$1;
|
|
590
|
-
devStorage: StorageMounts$1;
|
|
591
|
-
workspaceDir: string;
|
|
592
|
-
rootDir: string;
|
|
593
|
-
srcDir: string;
|
|
594
|
-
migrationDir: string;
|
|
595
|
-
scanDirs: string[];
|
|
596
|
-
build: {
|
|
597
|
-
dir: string;
|
|
598
|
-
typesDir: string;
|
|
599
|
-
/**
|
|
600
|
-
* It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
* @example
|
|
604
|
-
* ```js
|
|
605
|
-
* templates: [
|
|
606
|
-
* {
|
|
607
|
-
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative
|
|
608
|
-
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir
|
|
609
|
-
* }
|
|
610
|
-
* ]
|
|
611
|
-
* ```
|
|
612
|
-
*/
|
|
613
|
-
templates: SilgiTemplate$1<any>[];
|
|
614
|
-
};
|
|
615
|
-
modulesDir: string[];
|
|
616
|
-
output: {
|
|
617
|
-
dir: string;
|
|
618
|
-
serverDir: string;
|
|
619
|
-
publicDir: string;
|
|
620
|
-
};
|
|
621
|
-
serverDir: string;
|
|
622
|
-
clientDir: string;
|
|
623
|
-
silgi: {
|
|
624
|
-
/**
|
|
625
|
-
* @default "{serverDir}/silgi"
|
|
626
|
-
*/
|
|
627
|
-
serverDir: string;
|
|
628
|
-
clientDir: string;
|
|
629
|
-
/**
|
|
630
|
-
* @default "{serverDir}/public"
|
|
631
|
-
*/
|
|
632
|
-
publicDir: string;
|
|
633
|
-
/**
|
|
634
|
-
* @default "{silgi.serverDir}/utils"
|
|
635
|
-
*/
|
|
636
|
-
utilsDir: string;
|
|
637
|
-
/**
|
|
638
|
-
* @default "{silgi.serverDir}/types"
|
|
639
|
-
*/
|
|
640
|
-
typesDir: string;
|
|
641
|
-
/**
|
|
642
|
-
* @default "{silgi.serverDir}/vfs"
|
|
643
|
-
*/
|
|
644
|
-
vfsDir: string;
|
|
645
|
-
};
|
|
646
|
-
imports: UnimportPluginOptions | false;
|
|
647
|
-
watchOptions: ChokidarOptions;
|
|
648
|
-
nodeModulesDirs: string[];
|
|
649
|
-
devServer: {
|
|
650
|
-
watch: string[];
|
|
651
|
-
};
|
|
652
|
-
framework: SilgiFrameworkInfo$1;
|
|
653
|
-
/**
|
|
654
|
-
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building.
|
|
655
|
-
*
|
|
656
|
-
* @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","**\/-*.*"]
|
|
657
|
-
*/
|
|
658
|
-
ignore: Array<string>;
|
|
659
|
-
/**
|
|
660
|
-
* Whether Nuxt is running in development mode.
|
|
661
|
-
*
|
|
662
|
-
* Normally, you should not need to set this.
|
|
663
|
-
*
|
|
664
|
-
* @default false
|
|
665
|
-
*/
|
|
666
|
-
dev: boolean;
|
|
667
|
-
/**
|
|
668
|
-
* jiti with stub mode
|
|
669
|
-
* @default false
|
|
670
|
-
*/
|
|
671
|
-
stub: boolean;
|
|
672
|
-
/**
|
|
673
|
-
* Whether your app is being unit tested.
|
|
674
|
-
*
|
|
675
|
-
* @default false
|
|
676
|
-
*/
|
|
677
|
-
test: boolean;
|
|
678
|
-
extensions: string[];
|
|
679
|
-
future: {
|
|
680
|
-
/**
|
|
681
|
-
* This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and Vite.
|
|
682
|
-
*
|
|
683
|
-
* It improves type support when using modern libraries with `exports`.
|
|
684
|
-
* You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
|
|
685
|
-
*
|
|
686
|
-
* @default true
|
|
687
|
-
*
|
|
688
|
-
* @see [TypeScript PR implementing `bundler` module resolution](https://github.com/microsoft/TypeScript/pull/51669)
|
|
689
|
-
*/
|
|
690
|
-
typescriptBundlerResolution: boolean;
|
|
691
|
-
};
|
|
692
|
-
typescript: {
|
|
693
|
-
/**
|
|
694
|
-
* 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)
|
|
695
|
-
*
|
|
696
|
-
* @default true
|
|
697
|
-
*/
|
|
698
|
-
strict: boolean;
|
|
699
|
-
/**
|
|
700
|
-
* 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`.
|
|
701
|
-
*
|
|
702
|
-
* @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"]
|
|
703
|
-
*/
|
|
704
|
-
hoist: Array<string>;
|
|
705
|
-
/**
|
|
706
|
-
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors.
|
|
707
|
-
*
|
|
708
|
-
* @default false
|
|
709
|
-
*/
|
|
710
|
-
includeWorkspace: boolean;
|
|
711
|
-
/**
|
|
712
|
-
* Enable build-time type checking.
|
|
713
|
-
*
|
|
714
|
-
* 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.
|
|
715
|
-
*
|
|
716
|
-
* @default false
|
|
717
|
-
*
|
|
718
|
-
* @see [Nuxt TypeScript docs](https://nuxt.com/docs/guide/concepts/typescript)
|
|
719
|
-
*/
|
|
720
|
-
typeCheck: boolean | 'build';
|
|
721
|
-
/**
|
|
722
|
-
* You can extend generated `.nuxt/tsconfig.json` using this option.
|
|
723
|
-
*
|
|
724
|
-
*/
|
|
725
|
-
tsConfig: TSConfig;
|
|
726
|
-
/**
|
|
727
|
-
* Generate a `*.vue` shim.
|
|
728
|
-
*
|
|
729
|
-
* We recommend instead letting the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) generate accurate types for your components.
|
|
730
|
-
* 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.
|
|
731
|
-
*
|
|
732
|
-
* @default false
|
|
733
|
-
*/
|
|
734
|
-
shim: boolean;
|
|
735
|
-
/**
|
|
736
|
-
* @default "types/silgi.tsconfig.json"
|
|
737
|
-
*/
|
|
738
|
-
tsconfigPath: string;
|
|
739
|
-
/**
|
|
740
|
-
* @default true
|
|
741
|
-
*/
|
|
742
|
-
generateTsConfig: boolean;
|
|
743
|
-
/**
|
|
744
|
-
* @default ['silgiTypes']
|
|
745
|
-
*/
|
|
746
|
-
customConditions: string[];
|
|
747
|
-
/**
|
|
748
|
-
* Enable generating runtime configuration types.
|
|
749
|
-
*
|
|
750
|
-
* @default true
|
|
751
|
-
*/
|
|
752
|
-
generateRuntimeConfigTypes: boolean;
|
|
753
|
-
/**
|
|
754
|
-
* @default false
|
|
755
|
-
* Behavior of import paths in auto-generated silgi files
|
|
756
|
-
*/
|
|
757
|
-
removeFileExtension: boolean;
|
|
758
|
-
};
|
|
759
|
-
alias: Record<string, string>;
|
|
760
|
-
/**
|
|
761
|
-
* @default ['silgi']
|
|
762
|
-
*/
|
|
763
|
-
conditions: string[];
|
|
764
|
-
/**
|
|
765
|
-
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
* @see [node-ignore](https://github.com/kaelzhang/node-ignore)
|
|
769
|
-
*
|
|
770
|
-
* @example
|
|
771
|
-
* ```js
|
|
772
|
-
* ignoreOptions: {
|
|
773
|
-
* ignorecase: false
|
|
774
|
-
* }
|
|
775
|
-
* ```
|
|
776
|
-
*/
|
|
777
|
-
ignoreOptions: Options;
|
|
778
|
-
installPackages: Record<'dependencies' | 'devDependencies', Record<string, string>>;
|
|
779
|
-
apiFul: ApifulConfig;
|
|
780
|
-
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* Silgi input config (silgi.config)
|
|
784
|
-
*/
|
|
785
|
-
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate' | '_config' | '_c12' | 'consola'>>, C12InputConfig<SilgiCLIConfig>, Partial<SilgiModuleOptions> {
|
|
786
|
-
preset?: PresetNameInput;
|
|
787
|
-
extends?: string | string[] | SilgiPreset;
|
|
788
|
-
compatibilityDate?: CompatibilityDateSpec;
|
|
789
|
-
}
|
|
790
|
-
interface AppConfig {
|
|
791
|
-
[key: string]: any;
|
|
792
|
-
}
|
|
793
|
-
interface LoadConfigOptions {
|
|
794
|
-
watch?: boolean;
|
|
795
|
-
c12?: WatchConfigOptions;
|
|
796
|
-
compatibilityDate?: CompatibilityDateSpec;
|
|
797
|
-
consola?: ConsolaInstance;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
|
|
801
|
-
type AllPaths = SilgiRouterTypes extends {
|
|
802
|
-
keys: infer U;
|
|
803
|
-
} ? keyof U extends never ? string : keyof U : string;
|
|
804
|
-
type ExtractPathParams<T extends string> = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
805
|
-
[K in Param]: string;
|
|
806
|
-
} & ExtractPathParams<Rest> : T extends `${infer _Start}:${infer Param}` ? {
|
|
807
|
-
[K in Param]: string;
|
|
808
|
-
} : unknown;
|
|
809
|
-
|
|
810
|
-
type HttpMethod = 'get' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'head' | 'patch' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace';
|
|
811
|
-
type RouterParams<R extends AllPaths | (string & {})> = ExtractPathParams<R>;
|
|
812
|
-
type SilgiFetchOptions<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]> = {
|
|
813
|
-
method?: M;
|
|
814
|
-
params?: ExtractPathParams<P>;
|
|
815
|
-
body?: SilgiRouterTypes[BasePath][M]['input'];
|
|
816
|
-
} & Omit<FetchOptions, 'method' | 'body' | 'params'>;
|
|
817
|
-
type SilgiFetchClient = <P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: BasePath, options?: SilgiFetchOptions<P, BasePath, M>) => Promise<FetchResponse<SilgiRouterTypes[BasePath][M]['output']>>;
|
|
818
|
-
|
|
819
|
-
interface SilgiAppPlugin {
|
|
820
|
-
(silgi: Silgi): Promise<void> | void;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
interface CapturedErrorContext {
|
|
824
|
-
event?: SilgiEvent;
|
|
825
|
-
[key: string]: unknown;
|
|
826
|
-
}
|
|
827
|
-
type CaptureError = (silgi: Silgi, error: Error, context: CapturedErrorContext) => void;
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Main interface containing all route definitions.
|
|
831
|
-
* Example:
|
|
832
|
-
* {
|
|
833
|
-
* "/api/blueSpace/basket/getBook": { ... }
|
|
834
|
-
* }
|
|
835
|
-
*/
|
|
836
|
-
interface Routers {
|
|
837
|
-
}
|
|
838
|
-
/**
|
|
839
|
-
* Extracts the prefix (first segment) from a URL, including the leading slash.
|
|
840
|
-
* @example ExtractPrefix<'/api/blueSpace/basket'> // '/api'
|
|
520
|
+
* Extracts the prefix (first segment) from a URL, including the leading slash.
|
|
521
|
+
* @example ExtractPrefix<'/api/blueSpace/basket'> // '/api'
|
|
841
522
|
*/
|
|
842
523
|
type ExtractPrefix<URL extends string> = URL extends `/${infer Prefix}/${string}` ? `/${Prefix}` : never;
|
|
843
524
|
/**
|
|
@@ -953,208 +634,527 @@ type MethodSchemas<PathParamsStr extends string = ''> = {
|
|
|
953
634
|
interface ResolvedSchema {
|
|
954
635
|
[routePath: string]: MethodSchemas<string>;
|
|
955
636
|
}
|
|
956
|
-
/**
|
|
957
|
-
* Represents a schema definition that has been fully resolved,
|
|
958
|
-
* typically after processing and validating all schema components.
|
|
959
|
-
*/
|
|
960
|
-
interface ResolvedSchemaDefinition {
|
|
961
|
-
[key: string]: {
|
|
962
|
-
[method: string]: BaseMethodSchema;
|
|
637
|
+
/**
|
|
638
|
+
* Represents a schema definition that has been fully resolved,
|
|
639
|
+
* typically after processing and validating all schema components.
|
|
640
|
+
*/
|
|
641
|
+
interface ResolvedSchemaDefinition {
|
|
642
|
+
[key: string]: {
|
|
643
|
+
[method: string]: BaseMethodSchema;
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
interface SilgiRuntimeShareds extends SilgiRuntimeSharedsExtend {
|
|
648
|
+
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
649
|
+
runtimeConfig: SilgiRuntimeConfig;
|
|
650
|
+
$fetch: typeof silgiFetch;
|
|
651
|
+
silgi: Silgi;
|
|
652
|
+
}
|
|
653
|
+
interface SilgiRuntimeSharedsExtend {
|
|
654
|
+
}
|
|
655
|
+
interface ExtendShared {
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
type StandardHTTPMethod = 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE';
|
|
659
|
+
type HTTPMethod = SilgiRuntimeMethods extends Record<string, any> ? keyof SilgiRuntimeMethods | StandardHTTPMethod : StandardHTTPMethod;
|
|
660
|
+
interface SilgiRoute {
|
|
661
|
+
route: string;
|
|
662
|
+
method?: HTTPMethod;
|
|
663
|
+
service: ServiceSetup;
|
|
664
|
+
schema: ResolvedSchemaDefinition;
|
|
665
|
+
}
|
|
666
|
+
interface Silgi {
|
|
667
|
+
router: RouterContext<SilgiRoute>;
|
|
668
|
+
routerPrefixs: string[];
|
|
669
|
+
schemas: ResolvedSchemaDefinition;
|
|
670
|
+
services: ResolvedServiceDefinition;
|
|
671
|
+
shared: SilgiRuntimeShareds;
|
|
672
|
+
plugins: SilgiAppPlugin[];
|
|
673
|
+
framework?: {
|
|
674
|
+
nitro?: NitroApp;
|
|
675
|
+
};
|
|
676
|
+
_ignore?: Ignore;
|
|
677
|
+
hooks: Hookable<SilgiRuntimeHooks & DefaultHooks>;
|
|
678
|
+
hook: Silgi['hooks']['hook'];
|
|
679
|
+
callHook: Silgi['hooks']['callHook'];
|
|
680
|
+
addHooks: Silgi['hooks']['addHooks'];
|
|
681
|
+
ready: () => Promise<void>;
|
|
682
|
+
close: () => Promise<void>;
|
|
683
|
+
logger: ConsolaInstance;
|
|
684
|
+
storage: Storage;
|
|
685
|
+
envOptions: EnvOptions;
|
|
686
|
+
options: SilgiOptions & SilgiRuntimeOptions;
|
|
687
|
+
captureError: CaptureError;
|
|
688
|
+
}
|
|
689
|
+
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiRuntimeOptions> {
|
|
690
|
+
options: DeepPartial<SilgiOptions>;
|
|
691
|
+
}
|
|
692
|
+
interface BuildSilgi {
|
|
693
|
+
framework?: {
|
|
694
|
+
nitro?: NitroApp;
|
|
695
|
+
};
|
|
696
|
+
modules?: Partial<SilgiRuntimeOptions>;
|
|
697
|
+
options?: Partial<SilgiOptions>;
|
|
698
|
+
}
|
|
699
|
+
type CustomRequestInit<Schema extends SilgiSchema = SilgiSchema, Route extends keyof Schema = keyof Schema, Method extends keyof Schema[Route] = keyof Schema[Route], _Resolved extends boolean = true, _HiddenParameters extends boolean = true> = Omit<RequestInit, 'body' | 'headers' | 'method'> & {
|
|
700
|
+
method: Method;
|
|
701
|
+
body?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
702
|
+
input?: infer I;
|
|
703
|
+
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : unknown : unknown : unknown : unknown;
|
|
704
|
+
headers?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
705
|
+
headers?: infer H;
|
|
706
|
+
} ? H extends StandardSchemaV1 ? StandardSchemaV1.InferInput<H> : unknown : unknown : unknown : unknown;
|
|
707
|
+
} & (Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
708
|
+
pathParams?: infer P;
|
|
709
|
+
} ? P extends StandardSchemaV1 ? {
|
|
710
|
+
pathParams: StandardSchemaV1.InferInput<P>;
|
|
711
|
+
} : {
|
|
712
|
+
pathParams?: unknown;
|
|
713
|
+
} : {
|
|
714
|
+
pathParams?: unknown;
|
|
715
|
+
} : {
|
|
716
|
+
pathParams?: unknown;
|
|
717
|
+
} : {
|
|
718
|
+
pathParams?: unknown;
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
interface ExtendContext {
|
|
722
|
+
}
|
|
723
|
+
interface SilgiRuntimeContext extends Record<string, any> {
|
|
724
|
+
params?: Record<string, string>;
|
|
725
|
+
/**
|
|
726
|
+
* Matched router Node
|
|
727
|
+
*
|
|
728
|
+
* @experimental The object structure may change in non-major version.
|
|
729
|
+
*/
|
|
730
|
+
matchedRoute?: SilgiRoute;
|
|
731
|
+
sessions?: Record<string, Session>;
|
|
732
|
+
clientAddress?: string;
|
|
733
|
+
source?: any;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Bu nitrojs, h3 event or request context.
|
|
737
|
+
*/
|
|
738
|
+
interface SilgiEvent extends Record<string, unknown> {
|
|
739
|
+
/**
|
|
740
|
+
* Event context.
|
|
741
|
+
*/
|
|
742
|
+
readonly context: SilgiRuntimeContext;
|
|
743
|
+
/**
|
|
744
|
+
* Incoming HTTP request info.
|
|
745
|
+
*
|
|
746
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
747
|
+
*/
|
|
748
|
+
readonly req: ServerRequest;
|
|
749
|
+
/**
|
|
750
|
+
* Access to the parsed request URL.
|
|
751
|
+
*
|
|
752
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/URL)
|
|
753
|
+
*/
|
|
754
|
+
readonly url: URL;
|
|
755
|
+
/**
|
|
756
|
+
* Prepared HTTP response.
|
|
757
|
+
*/
|
|
758
|
+
readonly res: {
|
|
759
|
+
status?: number;
|
|
760
|
+
statusText?: string;
|
|
761
|
+
readonly headers: Headers;
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
interface SilgiRuntimeActions {
|
|
766
|
+
}
|
|
767
|
+
interface SilgiModuleOptions {
|
|
768
|
+
}
|
|
769
|
+
interface SilgiRuntimeOptions {
|
|
770
|
+
}
|
|
771
|
+
type SilgiModuleInput = (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false);
|
|
772
|
+
interface SilgiCompatibility {
|
|
773
|
+
/**
|
|
774
|
+
* Required silgi version in semver format.
|
|
775
|
+
* @example `^3.2.0` or `>=3.13.0`.
|
|
776
|
+
*/
|
|
777
|
+
silgi?: string;
|
|
778
|
+
}
|
|
779
|
+
interface ModuleMeta {
|
|
780
|
+
/** Module name. */
|
|
781
|
+
name?: string;
|
|
782
|
+
/** Module description. */
|
|
783
|
+
description?: string;
|
|
784
|
+
/** Module author. */
|
|
785
|
+
author?: string;
|
|
786
|
+
/** Module license. */
|
|
787
|
+
license?: string;
|
|
788
|
+
/** Module version. */
|
|
789
|
+
version?: string;
|
|
790
|
+
/**
|
|
791
|
+
* The configuration key used within `silgi.config` for this module's options.
|
|
792
|
+
* For example, `@silgijs/axios` uses `axios`.
|
|
793
|
+
*/
|
|
794
|
+
configKey?: string;
|
|
795
|
+
/**
|
|
796
|
+
* Constraints for the versions of silgi or features this module requires.
|
|
797
|
+
*/
|
|
798
|
+
compatibility?: SilgiCompatibility;
|
|
799
|
+
/**
|
|
800
|
+
* @private
|
|
801
|
+
*/
|
|
802
|
+
_modules?: {
|
|
803
|
+
[key: string]: string;
|
|
963
804
|
};
|
|
805
|
+
/**
|
|
806
|
+
* @private
|
|
807
|
+
*/
|
|
808
|
+
_packageName?: string;
|
|
809
|
+
cliToRuntimeOptionsKeys?: string[];
|
|
810
|
+
readonly afterDependencies?: ReadonlyArray<string>;
|
|
811
|
+
readonly beforeDependencies?: ReadonlyArray<string>;
|
|
812
|
+
readonly requiredDependencies?: ReadonlyArray<string>;
|
|
813
|
+
[key: string]: unknown;
|
|
964
814
|
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
};
|
|
969
|
-
interface StorageMounts {
|
|
970
|
-
[path: string]: {
|
|
971
|
-
driver: BuiltinDriverName | CustomDriverName;
|
|
972
|
-
[option: string]: any;
|
|
973
|
-
};
|
|
815
|
+
interface ResolvedModuleMeta extends ModuleMeta {
|
|
816
|
+
configKey: string;
|
|
817
|
+
name: string;
|
|
974
818
|
}
|
|
975
|
-
|
|
819
|
+
type ModuleHookContext = Readonly<{
|
|
820
|
+
event?: SilgiEvent;
|
|
821
|
+
url: SilgiURL;
|
|
822
|
+
input?: unknown;
|
|
823
|
+
result?: unknown;
|
|
824
|
+
route: SilgiRoute;
|
|
825
|
+
error?: Error;
|
|
826
|
+
success?: boolean;
|
|
827
|
+
cached?: boolean;
|
|
828
|
+
}>;
|
|
829
|
+
/** The options received. */
|
|
830
|
+
type ModuleOptionsCustom = Record<string, any>;
|
|
831
|
+
type Prettify<T> = {
|
|
832
|
+
[K in keyof T]: T[K];
|
|
833
|
+
} & {};
|
|
834
|
+
type ResolvedModuleOptions<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>> = Prettify<Defu<Partial<TOptions>, [
|
|
835
|
+
Partial<TOptions>,
|
|
836
|
+
TOptionsDefaults
|
|
837
|
+
]>>;
|
|
838
|
+
interface ModuleDefinition<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>, TWith extends boolean> {
|
|
839
|
+
meta?: ModuleMeta;
|
|
840
|
+
defaults?: TOptionsDefaults | ((silgi: SilgiCLI) => Awaitable<TOptionsDefaults>);
|
|
841
|
+
hooks?: Partial<SilgiCLIHooks>;
|
|
842
|
+
setup?: (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI & SilgiModuleOptions) => ModuleSetupReturn;
|
|
976
843
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
844
|
+
interface ModuleSetupInstallResult {
|
|
845
|
+
/**
|
|
846
|
+
* Timing information for the initial setup
|
|
847
|
+
*/
|
|
848
|
+
timings?: {
|
|
849
|
+
/** Total time took for module setup in ms */
|
|
850
|
+
setup?: number;
|
|
851
|
+
[key: string]: number | undefined;
|
|
852
|
+
};
|
|
983
853
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
|
|
854
|
+
type ModuleSetupReturn = Awaitable<false | void | ModuleSetupInstallResult>;
|
|
855
|
+
interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions> = Partial<TOptions>, TWith extends boolean = false> {
|
|
856
|
+
(this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI): ModuleSetupReturn;
|
|
857
|
+
getOptions?: (inlineOptions?: Partial<TOptions>, silgi?: SilgiCLI) => Promise<TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions>;
|
|
858
|
+
getMeta?: () => Promise<ModuleMeta>;
|
|
990
859
|
}
|
|
991
860
|
|
|
992
|
-
interface
|
|
993
|
-
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
994
|
-
runtimeConfig: SilgiRuntimeConfig;
|
|
995
|
-
$fetch: typeof silgiFetch;
|
|
996
|
-
silgi: Silgi;
|
|
861
|
+
interface SilgiRuntimeMethods {
|
|
997
862
|
}
|
|
998
|
-
|
|
863
|
+
type CommandType = 'run' | 'prepare' | 'install' | 'dev' | 'init';
|
|
864
|
+
interface SilgiRouterTypes {
|
|
999
865
|
}
|
|
1000
|
-
interface
|
|
866
|
+
interface DefaultHooks {
|
|
867
|
+
}
|
|
868
|
+
type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends Record<string, any> ? {
|
|
869
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
870
|
+
} : T;
|
|
871
|
+
type DeepRequired<T> = T extends (...args: any[]) => any ? T : T extends Record<string, any> ? {
|
|
872
|
+
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
873
|
+
} : T;
|
|
874
|
+
type Awaitable<T> = T | Promise<T>;
|
|
875
|
+
declare global {
|
|
876
|
+
var $silgiStatus: CommandType;
|
|
877
|
+
var _silgi_runtime: SilgiRuntimeOptions;
|
|
878
|
+
namespace NodeJS {
|
|
879
|
+
interface Global {
|
|
880
|
+
$silgiStatus: CommandType;
|
|
881
|
+
_silgi_runtime: SilgiRuntimeOptions;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
var __nitro__: {
|
|
885
|
+
useRuntimeConfig?: <T extends NitroRuntimeConfig = NitroRuntimeConfig>(event?: H3Event) => T;
|
|
886
|
+
[key: string]: any;
|
|
887
|
+
};
|
|
1001
888
|
}
|
|
1002
889
|
|
|
1003
|
-
type
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
890
|
+
type SilgiPreset = (SilgiCLIConfig & {
|
|
891
|
+
_meta?: SilgiPresetMeta;
|
|
892
|
+
}) | (() => SilgiCLIConfig & {
|
|
893
|
+
_meta?: SilgiPresetMeta;
|
|
894
|
+
});
|
|
895
|
+
interface SilgiPresetMeta {
|
|
896
|
+
url: string;
|
|
897
|
+
name: string;
|
|
898
|
+
stdName?: ProviderName;
|
|
899
|
+
aliases?: string[];
|
|
900
|
+
static?: boolean;
|
|
901
|
+
compatibilityDate?: DateString;
|
|
1010
902
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
903
|
+
|
|
904
|
+
type Schema = 'zod' | 'valibot' | 'arkType' | 'typebox';
|
|
905
|
+
/**
|
|
906
|
+
* SilgiCLI normalized options (silgi.options)
|
|
907
|
+
*/
|
|
908
|
+
interface SilgiCLIOptions extends PresetOptions {
|
|
909
|
+
_config: SilgiCLIConfig;
|
|
910
|
+
_c12: ResolvedConfig<SilgiCLIConfig> | ConfigWatcher<SilgiCLIConfig>;
|
|
911
|
+
_cli?: {
|
|
912
|
+
command?: string;
|
|
913
|
+
};
|
|
914
|
+
commandType: CommandType;
|
|
915
|
+
commands: Commands$1[];
|
|
916
|
+
schemaVendor: Schema | Schema[];
|
|
917
|
+
environments: DotenvOptions$1[];
|
|
918
|
+
activeEnvironment: 'prod' | 'docker' | 'staging' | 'testing' | '.env' | (string & {});
|
|
919
|
+
envOptions: EnvOptions$1;
|
|
920
|
+
runtimeConfig: SilgiRuntimeConfig$1 & {
|
|
921
|
+
[key: string]: any;
|
|
922
|
+
};
|
|
923
|
+
storages: string[];
|
|
924
|
+
hooks: NestedHooks<SilgiCLIHooks$1>;
|
|
925
|
+
plugins: {
|
|
926
|
+
path: string;
|
|
927
|
+
packageImport: string;
|
|
928
|
+
}[];
|
|
929
|
+
baseURL: string;
|
|
930
|
+
compatibilityDate: CompatibilityDates;
|
|
931
|
+
modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
932
|
+
_modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
933
|
+
isPreparingModules: boolean;
|
|
934
|
+
debug: true | {
|
|
935
|
+
command?: boolean;
|
|
936
|
+
install?: boolean;
|
|
937
|
+
};
|
|
938
|
+
preset: PresetName;
|
|
939
|
+
static: boolean;
|
|
940
|
+
logLevel: LogLevel;
|
|
941
|
+
appConfig: AppConfig;
|
|
942
|
+
appConfigFiles: string[];
|
|
943
|
+
codegen: {
|
|
944
|
+
env: {
|
|
945
|
+
safeList: string[][];
|
|
946
|
+
};
|
|
947
|
+
};
|
|
948
|
+
storage: StorageMounts$1;
|
|
949
|
+
devStorage: StorageMounts$1;
|
|
950
|
+
workspaceDir: string;
|
|
951
|
+
rootDir: string;
|
|
952
|
+
srcDir: string;
|
|
953
|
+
migrationDir: string;
|
|
954
|
+
scanDirs: string[];
|
|
955
|
+
build: {
|
|
956
|
+
dir: string;
|
|
957
|
+
typesDir: string;
|
|
958
|
+
/**
|
|
959
|
+
* It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
|
|
960
|
+
*
|
|
961
|
+
*
|
|
962
|
+
* @example
|
|
963
|
+
* ```js
|
|
964
|
+
* templates: [
|
|
965
|
+
* {
|
|
966
|
+
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative
|
|
967
|
+
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir
|
|
968
|
+
* }
|
|
969
|
+
* ]
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
templates: SilgiTemplate$1<any>[];
|
|
973
|
+
};
|
|
974
|
+
modulesDir: string[];
|
|
975
|
+
output: {
|
|
976
|
+
dir: string;
|
|
977
|
+
serverDir: string;
|
|
978
|
+
publicDir: string;
|
|
979
|
+
};
|
|
980
|
+
serverDir: string;
|
|
981
|
+
clientDir: string;
|
|
982
|
+
silgi: {
|
|
983
|
+
/**
|
|
984
|
+
* @default "{serverDir}/silgi"
|
|
985
|
+
*/
|
|
986
|
+
serverDir: string;
|
|
987
|
+
clientDir: string;
|
|
988
|
+
/**
|
|
989
|
+
* @default "{serverDir}/public"
|
|
990
|
+
*/
|
|
991
|
+
publicDir: string;
|
|
992
|
+
/**
|
|
993
|
+
* @default "{silgi.serverDir}/utils"
|
|
994
|
+
*/
|
|
995
|
+
utilsDir: string;
|
|
996
|
+
/**
|
|
997
|
+
* @default "{silgi.serverDir}/types"
|
|
998
|
+
*/
|
|
999
|
+
typesDir: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* @default "{silgi.serverDir}/vfs"
|
|
1002
|
+
*/
|
|
1003
|
+
vfsDir: string;
|
|
1020
1004
|
};
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
ready: () => Promise<void>;
|
|
1027
|
-
close: () => Promise<void>;
|
|
1028
|
-
logger: ConsolaInstance;
|
|
1029
|
-
storage: Storage;
|
|
1030
|
-
envOptions: EnvOptions;
|
|
1031
|
-
options: SilgiOptions & SilgiRuntimeOptions;
|
|
1032
|
-
captureError: CaptureError;
|
|
1033
|
-
}
|
|
1034
|
-
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiRuntimeOptions> {
|
|
1035
|
-
options: DeepPartial<SilgiOptions>;
|
|
1036
|
-
}
|
|
1037
|
-
interface BuildSilgi {
|
|
1038
|
-
framework?: {
|
|
1039
|
-
nitro?: NitroApp;
|
|
1005
|
+
imports: UnimportPluginOptions | false;
|
|
1006
|
+
watchOptions: ChokidarOptions;
|
|
1007
|
+
nodeModulesDirs: string[];
|
|
1008
|
+
devServer: {
|
|
1009
|
+
watch: string[];
|
|
1040
1010
|
};
|
|
1041
|
-
|
|
1042
|
-
options?: Partial<SilgiOptions>;
|
|
1043
|
-
}
|
|
1044
|
-
type CustomRequestInit<Schema extends SilgiSchema = SilgiSchema, Route extends keyof Schema = keyof Schema, Method extends keyof Schema[Route] = keyof Schema[Route], _Resolved extends boolean = true, _HiddenParameters extends boolean = true> = Omit<RequestInit, 'body' | 'headers' | 'method'> & {
|
|
1045
|
-
method: Method;
|
|
1046
|
-
body?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
1047
|
-
input?: infer I;
|
|
1048
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : unknown : unknown : unknown : unknown;
|
|
1049
|
-
headers?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
1050
|
-
headers?: infer H;
|
|
1051
|
-
} ? H extends StandardSchemaV1 ? StandardSchemaV1.InferInput<H> : unknown : unknown : unknown : unknown;
|
|
1052
|
-
} & (Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
1053
|
-
pathParams?: infer P;
|
|
1054
|
-
} ? P extends StandardSchemaV1 ? {
|
|
1055
|
-
pathParams: StandardSchemaV1.InferInput<P>;
|
|
1056
|
-
} : {
|
|
1057
|
-
pathParams?: unknown;
|
|
1058
|
-
} : {
|
|
1059
|
-
pathParams?: unknown;
|
|
1060
|
-
} : {
|
|
1061
|
-
pathParams?: unknown;
|
|
1062
|
-
} : {
|
|
1063
|
-
pathParams?: unknown;
|
|
1064
|
-
});
|
|
1065
|
-
|
|
1066
|
-
interface ExtendContext {
|
|
1067
|
-
}
|
|
1068
|
-
interface SilgiRuntimeContext extends Record<string, any> {
|
|
1069
|
-
params?: Record<string, string>;
|
|
1011
|
+
framework: SilgiFrameworkInfo$1;
|
|
1070
1012
|
/**
|
|
1071
|
-
*
|
|
1013
|
+
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building.
|
|
1072
1014
|
*
|
|
1073
|
-
* @
|
|
1074
|
-
*/
|
|
1075
|
-
matchedRoute?: SilgiRoute;
|
|
1076
|
-
sessions?: Record<string, Session>;
|
|
1077
|
-
clientAddress?: string;
|
|
1078
|
-
source?: any;
|
|
1079
|
-
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Bu nitrojs, h3 event or request context.
|
|
1082
|
-
*/
|
|
1083
|
-
interface SilgiEvent extends Record<string, unknown> {
|
|
1084
|
-
/**
|
|
1085
|
-
* Event context.
|
|
1015
|
+
* @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","**\/-*.*"]
|
|
1086
1016
|
*/
|
|
1087
|
-
|
|
1017
|
+
ignore: Array<string>;
|
|
1088
1018
|
/**
|
|
1089
|
-
*
|
|
1019
|
+
* Whether Nuxt is running in development mode.
|
|
1090
1020
|
*
|
|
1091
|
-
*
|
|
1092
|
-
*/
|
|
1093
|
-
readonly req: ServerRequest;
|
|
1094
|
-
/**
|
|
1095
|
-
* Access to the parsed request URL.
|
|
1021
|
+
* Normally, you should not need to set this.
|
|
1096
1022
|
*
|
|
1097
|
-
*
|
|
1023
|
+
* @default false
|
|
1098
1024
|
*/
|
|
1099
|
-
|
|
1025
|
+
dev: boolean;
|
|
1100
1026
|
/**
|
|
1101
|
-
*
|
|
1027
|
+
* jiti with stub mode
|
|
1028
|
+
* @default false
|
|
1102
1029
|
*/
|
|
1103
|
-
|
|
1104
|
-
status?: number;
|
|
1105
|
-
statusText?: string;
|
|
1106
|
-
readonly headers: Headers;
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
/**
|
|
1111
|
-
* The listeners to Silgi
|
|
1112
|
-
*/
|
|
1113
|
-
interface SilgiRuntimeHooks {
|
|
1030
|
+
stub: boolean;
|
|
1114
1031
|
/**
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1117
|
-
* @
|
|
1032
|
+
* Whether your app is being unit tested.
|
|
1033
|
+
*
|
|
1034
|
+
* @default false
|
|
1118
1035
|
*/
|
|
1119
|
-
|
|
1036
|
+
test: boolean;
|
|
1037
|
+
extensions: string[];
|
|
1038
|
+
future: {
|
|
1039
|
+
/**
|
|
1040
|
+
* This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and Vite.
|
|
1041
|
+
*
|
|
1042
|
+
* It improves type support when using modern libraries with `exports`.
|
|
1043
|
+
* You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
|
|
1044
|
+
*
|
|
1045
|
+
* @default true
|
|
1046
|
+
*
|
|
1047
|
+
* @see [TypeScript PR implementing `bundler` module resolution](https://github.com/microsoft/TypeScript/pull/51669)
|
|
1048
|
+
*/
|
|
1049
|
+
typescriptBundlerResolution: boolean;
|
|
1050
|
+
};
|
|
1051
|
+
typescript: {
|
|
1052
|
+
/**
|
|
1053
|
+
* 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)
|
|
1054
|
+
*
|
|
1055
|
+
* @default true
|
|
1056
|
+
*/
|
|
1057
|
+
strict: boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* 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`.
|
|
1060
|
+
*
|
|
1061
|
+
* @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"]
|
|
1062
|
+
*/
|
|
1063
|
+
hoist: Array<string>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors.
|
|
1066
|
+
*
|
|
1067
|
+
* @default false
|
|
1068
|
+
*/
|
|
1069
|
+
includeWorkspace: boolean;
|
|
1070
|
+
/**
|
|
1071
|
+
* Enable build-time type checking.
|
|
1072
|
+
*
|
|
1073
|
+
* 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.
|
|
1074
|
+
*
|
|
1075
|
+
* @default false
|
|
1076
|
+
*
|
|
1077
|
+
* @see [Nuxt TypeScript docs](https://nuxt.com/docs/guide/concepts/typescript)
|
|
1078
|
+
*/
|
|
1079
|
+
typeCheck: boolean | 'build';
|
|
1080
|
+
/**
|
|
1081
|
+
* You can extend generated `.nuxt/tsconfig.json` using this option.
|
|
1082
|
+
*
|
|
1083
|
+
*/
|
|
1084
|
+
tsConfig: TSConfig;
|
|
1085
|
+
/**
|
|
1086
|
+
* Generate a `*.vue` shim.
|
|
1087
|
+
*
|
|
1088
|
+
* We recommend instead letting the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) generate accurate types for your components.
|
|
1089
|
+
* 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.
|
|
1090
|
+
*
|
|
1091
|
+
* @default false
|
|
1092
|
+
*/
|
|
1093
|
+
shim: boolean;
|
|
1094
|
+
/**
|
|
1095
|
+
* @default "types/silgi.tsconfig.json"
|
|
1096
|
+
*/
|
|
1097
|
+
tsconfigPath: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* @default true
|
|
1100
|
+
*/
|
|
1101
|
+
generateTsConfig: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* @default ['silgiTypes']
|
|
1104
|
+
*/
|
|
1105
|
+
customConditions: string[];
|
|
1106
|
+
/**
|
|
1107
|
+
* Enable generating runtime configuration types.
|
|
1108
|
+
*
|
|
1109
|
+
* @default true
|
|
1110
|
+
*/
|
|
1111
|
+
generateRuntimeConfigTypes: boolean;
|
|
1112
|
+
/**
|
|
1113
|
+
* @default false
|
|
1114
|
+
* Behavior of import paths in auto-generated silgi files
|
|
1115
|
+
*/
|
|
1116
|
+
removeFileExtension: boolean;
|
|
1117
|
+
};
|
|
1118
|
+
alias: Record<string, string>;
|
|
1120
1119
|
/**
|
|
1121
|
-
*
|
|
1122
|
-
* @param silgi The configured silgi object
|
|
1123
|
-
* @returns Promise
|
|
1120
|
+
* @default ['silgi']
|
|
1124
1121
|
*/
|
|
1125
|
-
|
|
1126
|
-
'app:setup:start': (silgi: Silgi) => HookResult;
|
|
1127
|
-
'request:on': (event: SilgiEvent) => HookResult;
|
|
1128
|
-
'fetch:before': (context: ModuleHookContext) => HookResult;
|
|
1129
|
-
'fetch:after': (context: ModuleHookContext) => HookResult;
|
|
1130
|
-
'fetch:error': (context: Omit<ModuleHookContext, 'event'>) => HookResult;
|
|
1131
|
-
'fetch:finally': (context: Omit<ModuleHookContext, 'event'>) => HookResult;
|
|
1132
|
-
'error': CaptureError;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
interface SilgiRuntimeConfig {
|
|
1136
|
-
}
|
|
1137
|
-
interface SilgiOptions {
|
|
1138
|
-
consolaOptions?: Partial<ConsolaOptions>;
|
|
1139
|
-
present: PresetNameInput;
|
|
1140
|
-
hooks: Partial<SilgiRuntimeHooks & DefaultHooks>;
|
|
1122
|
+
conditions: string[];
|
|
1141
1123
|
/**
|
|
1142
|
-
*
|
|
1124
|
+
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
|
|
1143
1125
|
*
|
|
1144
|
-
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser.
|
|
1145
1126
|
*
|
|
1146
|
-
* @
|
|
1127
|
+
* @see [node-ignore](https://github.com/kaelzhang/node-ignore)
|
|
1128
|
+
*
|
|
1129
|
+
* @example
|
|
1130
|
+
* ```js
|
|
1131
|
+
* ignoreOptions: {
|
|
1132
|
+
* ignorecase: false
|
|
1133
|
+
* }
|
|
1134
|
+
* ```
|
|
1147
1135
|
*/
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
runtimeConfig: SilgiRuntimeConfig & {
|
|
1152
|
-
[key: string]: any;
|
|
1153
|
-
};
|
|
1154
|
-
captureError: CaptureError;
|
|
1136
|
+
ignoreOptions: Options;
|
|
1137
|
+
installPackages: Record<'dependencies' | 'devDependencies', Record<string, string>>;
|
|
1138
|
+
apiFul: ApifulConfig;
|
|
1155
1139
|
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Silgi input config (silgi.config)
|
|
1143
|
+
*/
|
|
1144
|
+
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate' | '_config' | '_c12' | 'consola'>>, C12InputConfig<SilgiCLIConfig>, Partial<SilgiModuleOptions> {
|
|
1145
|
+
preset?: PresetNameInput;
|
|
1146
|
+
extends?: string | string[] | SilgiPreset;
|
|
1147
|
+
compatibilityDate?: CompatibilityDateSpec;
|
|
1148
|
+
}
|
|
1149
|
+
interface AppConfig {
|
|
1156
1150
|
[key: string]: any;
|
|
1157
1151
|
}
|
|
1152
|
+
interface LoadConfigOptions {
|
|
1153
|
+
watch?: boolean;
|
|
1154
|
+
c12?: WatchConfigOptions;
|
|
1155
|
+
compatibilityDate?: CompatibilityDateSpec;
|
|
1156
|
+
consola?: ConsolaInstance;
|
|
1157
|
+
}
|
|
1158
1158
|
|
|
1159
1159
|
interface DotenvOptions {
|
|
1160
1160
|
/**
|