@buenojs/bueno 0.8.3 → 0.8.5
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/README.md +136 -16
- package/dist/cli/{index.js → bin.js} +3036 -1421
- package/dist/container/index.js +250 -0
- package/dist/context/index.js +219 -0
- package/dist/database/index.js +493 -0
- package/dist/frontend/index.js +7697 -0
- package/dist/health/index.js +364 -0
- package/dist/i18n/index.js +345 -0
- package/dist/index.js +11043 -6482
- package/dist/jobs/index.js +819 -0
- package/dist/lock/index.js +367 -0
- package/dist/logger/index.js +281 -0
- package/dist/metrics/index.js +289 -0
- package/dist/middleware/index.js +77 -0
- package/dist/migrations/index.js +571 -0
- package/dist/modules/index.js +3346 -0
- package/dist/notification/index.js +484 -0
- package/dist/observability/index.js +331 -0
- package/dist/openapi/index.js +776 -0
- package/dist/orm/index.js +1356 -0
- package/dist/router/index.js +886 -0
- package/dist/rpc/index.js +691 -0
- package/dist/schema/index.js +400 -0
- package/dist/telemetry/index.js +595 -0
- package/dist/template/index.js +640 -0
- package/dist/templates/index.js +640 -0
- package/dist/testing/index.js +1111 -0
- package/dist/types/index.js +60 -0
- package/package.json +121 -27
- package/src/cache/index.ts +2 -1
- package/src/cli/bin.ts +2 -2
- package/src/cli/commands/build.ts +183 -165
- package/src/cli/commands/dev.ts +96 -89
- package/src/cli/commands/generate.ts +142 -111
- package/src/cli/commands/help.ts +20 -16
- package/src/cli/commands/index.ts +3 -6
- package/src/cli/commands/migration.ts +124 -105
- package/src/cli/commands/new.ts +392 -438
- package/src/cli/commands/start.ts +81 -79
- package/src/cli/core/args.ts +68 -50
- package/src/cli/core/console.ts +89 -95
- package/src/cli/core/index.ts +4 -4
- package/src/cli/core/prompt.ts +65 -62
- package/src/cli/core/spinner.ts +23 -20
- package/src/cli/index.ts +46 -38
- package/src/cli/templates/database/index.ts +61 -0
- package/src/cli/templates/database/mysql.ts +14 -0
- package/src/cli/templates/database/none.ts +16 -0
- package/src/cli/templates/database/postgresql.ts +14 -0
- package/src/cli/templates/database/sqlite.ts +14 -0
- package/src/cli/templates/deploy.ts +29 -26
- package/src/cli/templates/docker.ts +41 -30
- package/src/cli/templates/frontend/index.ts +63 -0
- package/src/cli/templates/frontend/none.ts +17 -0
- package/src/cli/templates/frontend/react.ts +140 -0
- package/src/cli/templates/frontend/solid.ts +134 -0
- package/src/cli/templates/frontend/svelte.ts +131 -0
- package/src/cli/templates/frontend/vue.ts +130 -0
- package/src/cli/templates/generators/index.ts +339 -0
- package/src/cli/templates/generators/types.ts +56 -0
- package/src/cli/templates/index.ts +35 -2
- package/src/cli/templates/project/api.ts +81 -0
- package/src/cli/templates/project/default.ts +140 -0
- package/src/cli/templates/project/fullstack.ts +111 -0
- package/src/cli/templates/project/index.ts +95 -0
- package/src/cli/templates/project/minimal.ts +45 -0
- package/src/cli/templates/project/types.ts +94 -0
- package/src/cli/templates/project/website.ts +263 -0
- package/src/cli/utils/fs.ts +55 -41
- package/src/cli/utils/index.ts +3 -2
- package/src/cli/utils/strings.ts +47 -33
- package/src/cli/utils/version.ts +47 -0
- package/src/config/env-validation.ts +100 -0
- package/src/config/env.ts +169 -41
- package/src/config/index.ts +28 -20
- package/src/config/loader.ts +25 -16
- package/src/config/merge.ts +21 -10
- package/src/config/types.ts +545 -25
- package/src/config/validation.ts +215 -7
- package/src/container/forward-ref.ts +22 -22
- package/src/container/index.ts +34 -12
- package/src/context/index.ts +11 -1
- package/src/database/index.ts +7 -190
- package/src/database/orm/builder.ts +457 -0
- package/src/database/orm/casts/index.ts +130 -0
- package/src/database/orm/casts/types.ts +25 -0
- package/src/database/orm/compiler.ts +304 -0
- package/src/database/orm/hooks/index.ts +114 -0
- package/src/database/orm/index.ts +61 -0
- package/src/database/orm/model-registry.ts +59 -0
- package/src/database/orm/model.ts +821 -0
- package/src/database/orm/relationships/base.ts +146 -0
- package/src/database/orm/relationships/belongs-to-many.ts +179 -0
- package/src/database/orm/relationships/belongs-to.ts +56 -0
- package/src/database/orm/relationships/has-many.ts +45 -0
- package/src/database/orm/relationships/has-one.ts +41 -0
- package/src/database/orm/relationships/index.ts +11 -0
- package/src/database/orm/scopes/index.ts +55 -0
- package/src/events/__tests__/event-system.test.ts +235 -0
- package/src/events/config.ts +238 -0
- package/src/events/example-usage.ts +185 -0
- package/src/events/index.ts +278 -0
- package/src/events/manager.ts +385 -0
- package/src/events/registry.ts +182 -0
- package/src/events/types.ts +124 -0
- package/src/frontend/api-routes.ts +65 -23
- package/src/frontend/bundler.ts +76 -34
- package/src/frontend/console-client.ts +2 -2
- package/src/frontend/console-stream.ts +94 -38
- package/src/frontend/dev-server.ts +94 -46
- package/src/frontend/file-router.ts +61 -19
- package/src/frontend/frameworks/index.ts +37 -10
- package/src/frontend/frameworks/react.ts +10 -8
- package/src/frontend/frameworks/solid.ts +11 -9
- package/src/frontend/frameworks/svelte.ts +15 -9
- package/src/frontend/frameworks/vue.ts +13 -11
- package/src/frontend/hmr-client.ts +12 -10
- package/src/frontend/hmr.ts +146 -103
- package/src/frontend/index.ts +14 -5
- package/src/frontend/islands.ts +41 -22
- package/src/frontend/isr.ts +59 -37
- package/src/frontend/layout.ts +36 -21
- package/src/frontend/ssr/react.ts +74 -27
- package/src/frontend/ssr/solid.ts +54 -20
- package/src/frontend/ssr/svelte.ts +48 -14
- package/src/frontend/ssr/vue.ts +50 -18
- package/src/frontend/ssr.ts +83 -39
- package/src/frontend/types.ts +91 -56
- package/src/health/index.ts +21 -9
- package/src/i18n/engine.ts +305 -0
- package/src/i18n/index.ts +38 -0
- package/src/i18n/loader.ts +218 -0
- package/src/i18n/middleware.ts +164 -0
- package/src/i18n/negotiator.ts +162 -0
- package/src/i18n/types.ts +158 -0
- package/src/index.ts +179 -27
- package/src/jobs/drivers/memory.ts +315 -0
- package/src/jobs/drivers/redis.ts +459 -0
- package/src/jobs/index.ts +30 -0
- package/src/jobs/queue.ts +281 -0
- package/src/jobs/types.ts +295 -0
- package/src/jobs/worker.ts +380 -0
- package/src/logger/index.ts +1 -3
- package/src/logger/transports/index.ts +62 -22
- package/src/metrics/index.ts +25 -16
- package/src/migrations/index.ts +9 -0
- package/src/modules/filters.ts +13 -17
- package/src/modules/guards.ts +49 -26
- package/src/modules/index.ts +409 -298
- package/src/modules/interceptors.ts +58 -20
- package/src/modules/lazy.ts +11 -19
- package/src/modules/lifecycle.ts +15 -7
- package/src/modules/metadata.ts +15 -5
- package/src/modules/pipes.ts +94 -72
- package/src/notification/channels/base.ts +68 -0
- package/src/notification/channels/email.ts +105 -0
- package/src/notification/channels/push.ts +104 -0
- package/src/notification/channels/sms.ts +105 -0
- package/src/notification/channels/whatsapp.ts +104 -0
- package/src/notification/index.ts +48 -0
- package/src/notification/service.ts +354 -0
- package/src/notification/types.ts +344 -0
- package/src/observability/__tests__/observability.test.ts +483 -0
- package/src/observability/breadcrumbs.ts +114 -0
- package/src/observability/index.ts +136 -0
- package/src/observability/interceptor.ts +85 -0
- package/src/observability/service.ts +303 -0
- package/src/observability/trace.ts +37 -0
- package/src/observability/types.ts +196 -0
- package/src/openapi/__tests__/decorators.test.ts +335 -0
- package/src/openapi/__tests__/document-builder.test.ts +285 -0
- package/src/openapi/__tests__/route-scanner.test.ts +334 -0
- package/src/openapi/__tests__/schema-generator.test.ts +275 -0
- package/src/openapi/decorators.ts +328 -0
- package/src/openapi/document-builder.ts +274 -0
- package/src/openapi/index.ts +112 -0
- package/src/openapi/metadata.ts +112 -0
- package/src/openapi/route-scanner.ts +289 -0
- package/src/openapi/schema-generator.ts +256 -0
- package/src/openapi/swagger-module.ts +166 -0
- package/src/openapi/types.ts +398 -0
- package/src/orm/index.ts +10 -0
- package/src/rpc/index.ts +3 -1
- package/src/schema/index.ts +9 -0
- package/src/security/index.ts +15 -6
- package/src/ssg/index.ts +9 -8
- package/src/telemetry/index.ts +76 -22
- package/src/template/index.ts +7 -0
- package/src/templates/engine.ts +224 -0
- package/src/templates/index.ts +9 -0
- package/src/templates/loader.ts +331 -0
- package/src/templates/renderers/markdown.ts +212 -0
- package/src/templates/renderers/simple.ts +269 -0
- package/src/templates/types.ts +154 -0
- package/src/testing/index.ts +100 -27
- package/src/types/optional-deps.d.ts +347 -187
- package/src/validation/index.ts +92 -2
- package/src/validation/schemas.ts +536 -0
- package/tests/integration/fullstack.test.ts +4 -4
- package/tests/unit/database.test.ts +2 -72
- package/tests/unit/env-validation.test.ts +166 -0
- package/tests/unit/events.test.ts +910 -0
- package/tests/unit/i18n.test.ts +455 -0
- package/tests/unit/jobs.test.ts +493 -0
- package/tests/unit/notification.test.ts +988 -0
- package/tests/unit/observability.test.ts +453 -0
- package/tests/unit/orm/builder.test.ts +323 -0
- package/tests/unit/orm/casts.test.ts +179 -0
- package/tests/unit/orm/compiler.test.ts +220 -0
- package/tests/unit/orm/eager-loading.test.ts +285 -0
- package/tests/unit/orm/hooks.test.ts +191 -0
- package/tests/unit/orm/model.test.ts +373 -0
- package/tests/unit/orm/relationships.test.ts +303 -0
- package/tests/unit/orm/scopes.test.ts +74 -0
- package/tests/unit/templates-simple.test.ts +53 -0
- package/tests/unit/templates.test.ts +454 -0
- package/tests/unit/validation.test.ts +18 -24
- package/tsconfig.json +11 -3
|
@@ -1,219 +1,379 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type declarations for optional peer dependencies
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* These modules are optional peer dependencies for SSR rendering.
|
|
5
5
|
* Users need to install them separately if they want to use SSR features.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
// React types
|
|
9
9
|
declare module "react" {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
10
|
+
export type ReactElement = {
|
|
11
|
+
type: unknown;
|
|
12
|
+
props: Record<string, unknown>;
|
|
13
|
+
key: string | number | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ReactNode =
|
|
17
|
+
| ReactElement
|
|
18
|
+
| string
|
|
19
|
+
| number
|
|
20
|
+
| boolean
|
|
21
|
+
| null
|
|
22
|
+
| undefined
|
|
23
|
+
| Iterable<ReactNode>;
|
|
24
|
+
|
|
25
|
+
export function createElement(
|
|
26
|
+
type: string | ((props: unknown) => ReactElement),
|
|
27
|
+
props?: Record<string, unknown> | null,
|
|
28
|
+
...children: ReactNode[]
|
|
29
|
+
): ReactElement;
|
|
30
|
+
|
|
31
|
+
export const Suspense: (props: {
|
|
32
|
+
fallback?: ReactNode;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}) => ReactElement;
|
|
35
|
+
|
|
36
|
+
export const Fragment: unique symbol;
|
|
37
|
+
|
|
38
|
+
export function useState<T>(
|
|
39
|
+
initialState: T,
|
|
40
|
+
): [T, (value: T | ((prev: T) => T)) => void];
|
|
41
|
+
export function useEffect(
|
|
42
|
+
effect: () => void | (() => void),
|
|
43
|
+
deps?: unknown[],
|
|
44
|
+
): void;
|
|
45
|
+
export function useContext<T>(context: ReactContext<T>): T;
|
|
46
|
+
export function createContext<T>(defaultValue: T): ReactContext<T>;
|
|
47
|
+
export function useRef<T>(initialValue: T): { current: T };
|
|
48
|
+
export function useMemo<T>(factory: () => T, deps?: unknown[]): T;
|
|
49
|
+
export function useCallback<T extends (...args: unknown[]) => unknown>(
|
|
50
|
+
callback: T,
|
|
51
|
+
deps?: unknown[],
|
|
52
|
+
): T;
|
|
53
|
+
export function useReducer<S, A>(
|
|
54
|
+
reducer: (state: S, action: A) => S,
|
|
55
|
+
initialArg: S,
|
|
56
|
+
): [S, (action: A) => void];
|
|
57
|
+
|
|
58
|
+
export interface ReactContext<T> {
|
|
59
|
+
Provider: (props: { value: T; children?: ReactNode }) => ReactElement;
|
|
60
|
+
Consumer: (props: { children: (value: T) => ReactNode }) => ReactElement;
|
|
61
|
+
displayName?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const version: string;
|
|
65
|
+
export default {
|
|
66
|
+
createElement,
|
|
67
|
+
Suspense,
|
|
68
|
+
Fragment,
|
|
69
|
+
useState,
|
|
70
|
+
useEffect,
|
|
71
|
+
useContext,
|
|
72
|
+
createContext,
|
|
73
|
+
useRef,
|
|
74
|
+
useMemo,
|
|
75
|
+
useCallback,
|
|
76
|
+
useReducer,
|
|
77
|
+
version,
|
|
78
|
+
};
|
|
47
79
|
}
|
|
48
80
|
|
|
49
81
|
declare module "react-dom/server" {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
import type { ReactElement } from "react";
|
|
83
|
+
|
|
84
|
+
export function renderToString(element: ReactElement): string;
|
|
85
|
+
export function renderToStaticMarkup(element: ReactElement): string;
|
|
86
|
+
export function renderToPipeableStream(
|
|
87
|
+
element: ReactElement,
|
|
88
|
+
options?: {
|
|
89
|
+
bootstrapScripts?: string[];
|
|
90
|
+
bootstrapModules?: string[];
|
|
91
|
+
identifierPrefix?: string;
|
|
92
|
+
namespaceURI?: string;
|
|
93
|
+
nonce?: string;
|
|
94
|
+
onAllReady?: () => void;
|
|
95
|
+
onError?: (error: Error) => void;
|
|
96
|
+
onShellReady?: () => void;
|
|
97
|
+
onShellError?: (error: Error) => void;
|
|
98
|
+
},
|
|
99
|
+
): { pipe: (destination: unknown) => void; abort: () => void };
|
|
100
|
+
|
|
101
|
+
export function renderToReadableStream(
|
|
102
|
+
element: ReactElement,
|
|
103
|
+
options?: {
|
|
104
|
+
bootstrapScripts?: string[];
|
|
105
|
+
bootstrapModules?: string[];
|
|
106
|
+
identifierPrefix?: string;
|
|
107
|
+
namespaceURI?: string;
|
|
108
|
+
nonce?: string;
|
|
109
|
+
onError?: (error: Error) => void;
|
|
110
|
+
},
|
|
111
|
+
): Promise<ReadableStream<Uint8Array> & { allReady: Promise<void> }>;
|
|
74
112
|
}
|
|
75
113
|
|
|
76
114
|
// SolidJS types
|
|
77
115
|
declare module "solid-js" {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
export type Accessor<T> = () => T;
|
|
117
|
+
export type Setter<T> = (value: T | ((prev: T) => T)) => void;
|
|
118
|
+
export type Signal<T> = [Accessor<T>, Setter<T>];
|
|
119
|
+
|
|
120
|
+
export function createSignal<T>(
|
|
121
|
+
value: T,
|
|
122
|
+
options?: { equals?: boolean | ((prev: T, next: T) => boolean) },
|
|
123
|
+
): Signal<T>;
|
|
124
|
+
export function createEffect(fn: () => void | (() => void)): void;
|
|
125
|
+
export function createMemo<T>(
|
|
126
|
+
fn: () => T,
|
|
127
|
+
value?: T,
|
|
128
|
+
options?: { equals?: boolean | ((prev: T, next: T) => boolean) },
|
|
129
|
+
): Accessor<T>;
|
|
130
|
+
export function onMount(fn: () => void): void;
|
|
131
|
+
export function onCleanup(fn: () => void): void;
|
|
132
|
+
export function onError(fn: (err: Error) => void): void;
|
|
133
|
+
|
|
134
|
+
export function untrack<T>(fn: () => T): T;
|
|
135
|
+
export function batch<T>(fn: () => T): T;
|
|
136
|
+
|
|
137
|
+
export function For<T>(props: {
|
|
138
|
+
each: T[];
|
|
139
|
+
fallback?: unknown;
|
|
140
|
+
children: (item: T, index: Accessor<number>) => unknown;
|
|
141
|
+
}): unknown;
|
|
142
|
+
export function Show(props: {
|
|
143
|
+
when: unknown;
|
|
144
|
+
keyed?: boolean;
|
|
145
|
+
fallback?: unknown;
|
|
146
|
+
children: unknown;
|
|
147
|
+
}): unknown;
|
|
148
|
+
export function Switch(props: {
|
|
149
|
+
fallback?: unknown;
|
|
150
|
+
children: unknown;
|
|
151
|
+
}): unknown;
|
|
152
|
+
export function Match(props: {
|
|
153
|
+
when: unknown;
|
|
154
|
+
keyed?: boolean;
|
|
155
|
+
children: unknown;
|
|
156
|
+
}): unknown;
|
|
157
|
+
export function Index<T>(props: {
|
|
158
|
+
each: T[];
|
|
159
|
+
fallback?: unknown;
|
|
160
|
+
children: (item: Accessor<T>, index: number) => unknown;
|
|
161
|
+
}): unknown;
|
|
162
|
+
|
|
163
|
+
export function children(fn: () => unknown): Accessor<unknown>;
|
|
164
|
+
export function mergeProps<T extends object>(...sources: T[]): T;
|
|
165
|
+
export function splitProps<T extends object>(
|
|
166
|
+
props: T,
|
|
167
|
+
...keys: (keyof T)[][]
|
|
168
|
+
): T[];
|
|
169
|
+
|
|
170
|
+
export const Suspense: (props: {
|
|
171
|
+
fallback?: unknown;
|
|
172
|
+
children?: unknown;
|
|
173
|
+
}) => unknown;
|
|
174
|
+
|
|
175
|
+
export interface JSX {
|
|
176
|
+
Element: unknown;
|
|
177
|
+
IntrinsicElements: Record<string, unknown>;
|
|
178
|
+
}
|
|
108
179
|
}
|
|
109
180
|
|
|
110
181
|
declare module "solid-js/web" {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
182
|
+
export function renderToString(
|
|
183
|
+
code: () => unknown,
|
|
184
|
+
options?: { nonce?: string; renderId?: string },
|
|
185
|
+
): string;
|
|
186
|
+
export function renderToStringAsync(
|
|
187
|
+
code: () => unknown,
|
|
188
|
+
options?: { timeoutMs?: number; nonce?: string; renderId?: string },
|
|
189
|
+
): Promise<string>;
|
|
190
|
+
export function renderToStream(
|
|
191
|
+
code: () => unknown,
|
|
192
|
+
options?: { nonce?: string; renderId?: string },
|
|
193
|
+
): ReadableStream<Uint8Array>;
|
|
194
|
+
export function hydrate(code: () => unknown, element: Element): void;
|
|
195
|
+
export function Dynamic(props: {
|
|
196
|
+
component: unknown;
|
|
197
|
+
[key: string]: unknown;
|
|
198
|
+
}): unknown;
|
|
199
|
+
export function Portal(props: {
|
|
200
|
+
mount?: Element;
|
|
201
|
+
useShadow?: boolean;
|
|
202
|
+
children: unknown;
|
|
203
|
+
}): unknown;
|
|
204
|
+
export function Assets(props: { children: unknown }): unknown;
|
|
205
|
+
export function HydrationScript(props?: { nonce?: string }): unknown;
|
|
119
206
|
}
|
|
120
207
|
|
|
121
208
|
// Svelte types
|
|
122
209
|
declare module "svelte/server" {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
210
|
+
export interface SvelteComponent {
|
|
211
|
+
render(props?: Record<string, unknown>): {
|
|
212
|
+
html: string;
|
|
213
|
+
head: string;
|
|
214
|
+
css: { code: string };
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function render(
|
|
219
|
+
component: typeof SvelteComponent,
|
|
220
|
+
options?: { props?: Record<string, unknown> },
|
|
221
|
+
): { html: string; head: string; css: { code: string } };
|
|
128
222
|
}
|
|
129
223
|
|
|
130
224
|
// Vue types
|
|
131
225
|
declare module "vue" {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
226
|
+
export type Component = unknown;
|
|
227
|
+
|
|
228
|
+
export function createApp(
|
|
229
|
+
rootComponent: Component,
|
|
230
|
+
rootProps?: Record<string, unknown>,
|
|
231
|
+
): {
|
|
232
|
+
mount(rootContainer: Element | string): unknown;
|
|
233
|
+
unmount(): void;
|
|
234
|
+
provide<T>(key: string | symbol, value: T): void;
|
|
235
|
+
component(name: string, component: Component): void;
|
|
236
|
+
directive(name: string, directive: unknown): void;
|
|
237
|
+
use(plugin: unknown, ...options: unknown[]): void;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export function createSSRApp(
|
|
241
|
+
rootComponent: Component,
|
|
242
|
+
rootProps?: Record<string, unknown>,
|
|
243
|
+
): ReturnType<typeof createApp>;
|
|
244
|
+
|
|
245
|
+
export function defineComponent(options: {
|
|
246
|
+
name?: string;
|
|
247
|
+
props?: Record<string, unknown>;
|
|
248
|
+
setup?: (props: Record<string, unknown>, ctx: unknown) => unknown;
|
|
249
|
+
render?: (ctx: unknown) => unknown;
|
|
250
|
+
template?: string;
|
|
251
|
+
components?: Record<string, Component>;
|
|
252
|
+
directives?: Record<string, unknown>;
|
|
253
|
+
data?: () => Record<string, unknown>;
|
|
254
|
+
computed?: Record<string, (this: unknown) => unknown>;
|
|
255
|
+
methods?: Record<string, (this: unknown, ...args: unknown[]) => unknown>;
|
|
256
|
+
watch?: Record<string, unknown>;
|
|
257
|
+
emits?: string[] | Record<string, unknown>;
|
|
258
|
+
[key: string]: unknown;
|
|
259
|
+
}): Component;
|
|
260
|
+
|
|
261
|
+
export function ref<T>(value: T): { value: T };
|
|
262
|
+
export function reactive<T extends object>(obj: T): T;
|
|
263
|
+
export function computed<T>(fn: () => T): { readonly value: T };
|
|
264
|
+
export function watch(
|
|
265
|
+
source: unknown,
|
|
266
|
+
callback: (
|
|
267
|
+
value: unknown,
|
|
268
|
+
oldValue: unknown,
|
|
269
|
+
onCleanup: (fn: () => void) => void,
|
|
270
|
+
) => void,
|
|
271
|
+
options?: { immediate?: boolean; deep?: boolean },
|
|
272
|
+
): () => void;
|
|
273
|
+
export function watchEffect(
|
|
274
|
+
fn: (onCleanup: (fn: () => void) => void) => void,
|
|
275
|
+
): () => void;
|
|
276
|
+
export function onMounted(fn: () => void): void;
|
|
277
|
+
export function onUnmounted(fn: () => void): void;
|
|
278
|
+
export function onServerPrefetch(fn: () => Promise<void>): void;
|
|
279
|
+
|
|
280
|
+
export function h(
|
|
281
|
+
type: string | Component,
|
|
282
|
+
props?: Record<string, unknown> | null,
|
|
283
|
+
children?: unknown,
|
|
284
|
+
): unknown;
|
|
285
|
+
export function defineAsyncComponent(
|
|
286
|
+
loader: () => Promise<{ default: Component }>,
|
|
287
|
+
): Component;
|
|
288
|
+
export function provide(key: string | symbol, value: unknown): void;
|
|
289
|
+
export function inject<T>(
|
|
290
|
+
key: string | symbol,
|
|
291
|
+
defaultValue?: T,
|
|
292
|
+
): T | undefined;
|
|
293
|
+
export function useSSRContext(): Record<string, unknown>;
|
|
294
|
+
|
|
295
|
+
export const version: string;
|
|
177
296
|
}
|
|
178
297
|
|
|
179
298
|
declare module "vue/server-renderer" {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
299
|
+
export function renderToString(
|
|
300
|
+
app: unknown,
|
|
301
|
+
options?: { context?: Record<string, unknown> },
|
|
302
|
+
): Promise<string>;
|
|
303
|
+
export function renderToStream(
|
|
304
|
+
app: unknown,
|
|
305
|
+
options?: { context?: Record<string, unknown> },
|
|
306
|
+
): ReadableStream<Uint8Array>;
|
|
307
|
+
export function renderToWebStream(
|
|
308
|
+
app: unknown,
|
|
309
|
+
options?: { context?: Record<string, unknown> },
|
|
310
|
+
): ReadableStream<Uint8Array>;
|
|
311
|
+
export function renderToNodeStream(
|
|
312
|
+
app: unknown,
|
|
313
|
+
options?: { context?: Record<string, unknown> },
|
|
314
|
+
): NodeJS.ReadableStream;
|
|
184
315
|
}
|
|
185
316
|
|
|
186
317
|
declare module "vue-router" {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
318
|
+
import type { Component } from "vue";
|
|
319
|
+
|
|
320
|
+
export interface RouteRecordRaw {
|
|
321
|
+
path: string;
|
|
322
|
+
name?: string;
|
|
323
|
+
component?: Component;
|
|
324
|
+
components?: Record<string, Component>;
|
|
325
|
+
redirect?: string | ((to: unknown) => string);
|
|
326
|
+
alias?: string | string[];
|
|
327
|
+
children?: RouteRecordRaw[];
|
|
328
|
+
meta?: Record<string, unknown>;
|
|
329
|
+
beforeEnter?: (to: unknown, from: unknown, next: () => void) => void;
|
|
330
|
+
props?:
|
|
331
|
+
| boolean
|
|
332
|
+
| Record<string, unknown>
|
|
333
|
+
| ((to: unknown) => Record<string, unknown>);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface Router {
|
|
337
|
+
isReady(): Promise<void>;
|
|
338
|
+
push(
|
|
339
|
+
to:
|
|
340
|
+
| string
|
|
341
|
+
| {
|
|
342
|
+
path: string;
|
|
343
|
+
query?: Record<string, string>;
|
|
344
|
+
params?: Record<string, string>;
|
|
345
|
+
},
|
|
346
|
+
): void;
|
|
347
|
+
replace(
|
|
348
|
+
to:
|
|
349
|
+
| string
|
|
350
|
+
| {
|
|
351
|
+
path: string;
|
|
352
|
+
query?: Record<string, string>;
|
|
353
|
+
params?: Record<string, string>;
|
|
354
|
+
},
|
|
355
|
+
): void;
|
|
356
|
+
go(delta: number): void;
|
|
357
|
+
back(): void;
|
|
358
|
+
forward(): void;
|
|
359
|
+
beforeEach(
|
|
360
|
+
guard: (to: unknown, from: unknown, next: () => void) => void,
|
|
361
|
+
): () => void;
|
|
362
|
+
currentRoute: {
|
|
363
|
+
path: string;
|
|
364
|
+
params: Record<string, string>;
|
|
365
|
+
query: Record<string, string>;
|
|
366
|
+
name: string | symbol | null;
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export function createRouter(options: {
|
|
371
|
+
history: unknown;
|
|
372
|
+
routes: RouteRecordRaw[];
|
|
373
|
+
}): Router;
|
|
374
|
+
export function createWebHistory(base?: string): unknown;
|
|
375
|
+
export function createWebHashHistory(base?: string): unknown;
|
|
376
|
+
export function createMemoryHistory(base?: string): unknown;
|
|
377
|
+
export function useRoute(): Router["currentRoute"];
|
|
378
|
+
export function useRouter(): Router;
|
|
379
|
+
}
|
package/src/validation/index.ts
CHANGED
|
@@ -270,7 +270,97 @@ export function assertStandardSchema(
|
|
|
270
270
|
): asserts schema is StandardSchema {
|
|
271
271
|
if (!isStandardSchema(schema)) {
|
|
272
272
|
throw new Error(
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
`${name} must implement Standard Schema interface. Supported: Zod 4+, Valibot v1+, ArkType, Typia 7+`,
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// ============= Environment Variable Validation =============
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Validate environment variables against a schema
|
|
282
|
+
*
|
|
283
|
+
* @param schema - Validation schema for environment variables
|
|
284
|
+
* @param envVars - Environment variables to validate
|
|
285
|
+
* @returns Validation result with transformed values or error details
|
|
286
|
+
*/
|
|
287
|
+
export async function validateEnv<T>(
|
|
288
|
+
schema: StandardSchema<unknown, T>,
|
|
289
|
+
envVars: Record<string, string>,
|
|
290
|
+
): Promise<ValidationResult<T>> {
|
|
291
|
+
try {
|
|
292
|
+
// Validate the environment variables
|
|
293
|
+
const result = await validate(schema, envVars);
|
|
294
|
+
|
|
295
|
+
if (!result.success) {
|
|
296
|
+
// Format error messages with context
|
|
297
|
+
const formattedIssues = result.issues.map((issue) => {
|
|
298
|
+
const path = issue.path?.join(".") || "root";
|
|
299
|
+
return {
|
|
300
|
+
...issue,
|
|
301
|
+
message: `Environment variable validation failed for ${path}: ${issue.message}`,
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
return {
|
|
306
|
+
success: false,
|
|
307
|
+
issues: formattedIssues,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return result;
|
|
312
|
+
} catch (error) {
|
|
313
|
+
return {
|
|
314
|
+
success: false,
|
|
315
|
+
issues: [
|
|
316
|
+
{
|
|
317
|
+
message: `Environment variable validation failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Validate environment variables with detailed error reporting
|
|
326
|
+
*
|
|
327
|
+
* @param schema - Validation schema for environment variables
|
|
328
|
+
* @param envVars - Environment variables to validate
|
|
329
|
+
* @returns Validation result with transformed values or detailed error information
|
|
330
|
+
*/
|
|
331
|
+
export function validateEnvSync<T>(
|
|
332
|
+
schema: StandardSchema<unknown, T>,
|
|
333
|
+
envVars: Record<string, string>,
|
|
334
|
+
): ValidationResult<T> {
|
|
335
|
+
try {
|
|
336
|
+
// Validate the environment variables
|
|
337
|
+
const result = validateSync(schema, envVars);
|
|
338
|
+
|
|
339
|
+
if (!result.success) {
|
|
340
|
+
// Format error messages with context
|
|
341
|
+
const formattedIssues = result.issues.map((issue) => {
|
|
342
|
+
const path = issue.path?.join(".") || "root";
|
|
343
|
+
return {
|
|
344
|
+
...issue,
|
|
345
|
+
message: `Environment variable validation failed for ${path}: ${issue.message}`,
|
|
346
|
+
};
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
return {
|
|
350
|
+
success: false,
|
|
351
|
+
issues: formattedIssues,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return result;
|
|
356
|
+
} catch (error) {
|
|
357
|
+
return {
|
|
358
|
+
success: false,
|
|
359
|
+
issues: [
|
|
360
|
+
{
|
|
361
|
+
message: `Environment variable validation failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
};
|
|
275
365
|
}
|
|
276
366
|
}
|