wexts 4.1.5 → 4.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -49
- package/bin/wexts.cjs +2 -2
- package/dist/chunk-27NEYQD2.mjs +222 -0
- package/dist/chunk-27NEYQD2.mjs.map +1 -0
- package/dist/chunk-2LJVUMXW.js +228 -0
- package/dist/chunk-2LJVUMXW.js.map +1 -0
- package/dist/chunk-5DBFN65W.mjs +183 -0
- package/dist/chunk-5DBFN65W.mjs.map +1 -0
- package/dist/chunk-75HBI2XG.js +504 -0
- package/dist/chunk-75HBI2XG.js.map +1 -0
- package/dist/chunk-AVMQJWYD.js +95 -0
- package/dist/chunk-AVMQJWYD.js.map +1 -0
- package/dist/chunk-C2AG7Q3C.mjs +65 -0
- package/dist/chunk-C2AG7Q3C.mjs.map +1 -0
- package/dist/chunk-DS5KVVWJ.mjs +95 -0
- package/dist/chunk-DS5KVVWJ.mjs.map +1 -0
- package/dist/chunk-FUPLZMSR.mjs +228 -0
- package/dist/chunk-FUPLZMSR.mjs.map +1 -0
- package/dist/chunk-HLT3IHJY.js +183 -0
- package/dist/chunk-HLT3IHJY.js.map +1 -0
- package/dist/chunk-L77ANWWT.mjs +22 -0
- package/dist/chunk-L77ANWWT.mjs.map +1 -0
- package/dist/chunk-P3Q4I5FD.js +222 -0
- package/dist/chunk-P3Q4I5FD.js.map +1 -0
- package/dist/chunk-VBIQGUDI.mjs +504 -0
- package/dist/chunk-VBIQGUDI.mjs.map +1 -0
- package/dist/chunk-WCKSKU3C.js +65 -0
- package/dist/chunk-WCKSKU3C.js.map +1 -0
- package/dist/chunk-XE4OXN2W.js +12 -0
- package/dist/chunk-XE4OXN2W.js.map +1 -0
- package/dist/cli/index.d.mts +23 -0
- package/dist/cli/index.d.ts +23 -0
- package/dist/cli/index.js +745 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +747 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/client/index.d.mts +43 -0
- package/dist/client/index.d.ts +43 -0
- package/dist/client/index.js +187 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.mjs +166 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/codegen/index.d.mts +2 -0
- package/dist/codegen/index.d.ts +2 -0
- package/dist/codegen/index.js +16 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/index.mjs +16 -0
- package/dist/codegen/index.mjs.map +1 -0
- package/dist/decorators-BiQtOHuF.d.ts +60 -0
- package/dist/decorators-vBopODtr.d.mts +60 -0
- package/dist/dev-server/index.d.mts +1 -0
- package/dist/dev-server/index.d.ts +1 -0
- package/dist/dev-server/index.js +13 -0
- package/dist/dev-server/index.js.map +1 -0
- package/dist/dev-server/index.mjs +13 -0
- package/dist/dev-server/index.mjs.map +1 -0
- package/dist/errors-D545UvXf.d.mts +37 -0
- package/dist/errors-D545UvXf.d.ts +37 -0
- package/dist/index-7RvU-jGE.d.mts +66 -0
- package/dist/index-7RvU-jGE.d.ts +66 -0
- package/dist/index-CJKs4wtN.d.ts +92 -0
- package/dist/index-CUR6CnLk.d.ts +27 -0
- package/dist/index-h66Vq9dK.d.mts +92 -0
- package/dist/index-tqmYsTUn.d.mts +27 -0
- package/dist/index.d.mts +289 -0
- package/dist/index.d.ts +289 -0
- package/dist/index.js +544 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +544 -0
- package/dist/index.mjs.map +1 -0
- package/dist/nest/index.d.mts +2 -0
- package/dist/nest/index.d.ts +2 -0
- package/dist/nest/index.js +36 -0
- package/dist/nest/index.js.map +1 -0
- package/dist/nest/index.mjs +36 -0
- package/dist/nest/index.mjs.map +1 -0
- package/dist/next/index.d.mts +66 -0
- package/dist/next/index.d.ts +66 -0
- package/dist/next/index.js +282 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/index.mjs +251 -0
- package/dist/next/index.mjs.map +1 -0
- package/dist/rpc/index.d.mts +32 -0
- package/dist/rpc/index.d.ts +32 -0
- package/dist/rpc/index.js +19 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/rpc/index.mjs +1 -0
- package/dist/rpc/index.mjs.map +1 -0
- package/dist/runtime/index.d.mts +55 -0
- package/dist/runtime/index.d.ts +55 -0
- package/dist/runtime/index.js +15 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/index.mjs +15 -0
- package/dist/runtime/index.mjs.map +1 -0
- package/dist/server/index.d.mts +7 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +58 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +58 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/types/index.d.mts +12 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types-CQ_aexOX.d.mts +32 -0
- package/dist/types-CQ_aexOX.d.ts +32 -0
- package/dist/vercel-builder/index.d.mts +58 -0
- package/dist/vercel-builder/index.d.ts +58 -0
- package/dist/vercel-builder/index.js +330 -0
- package/dist/vercel-builder/index.js.map +1 -0
- package/dist/vercel-builder/index.mjs +330 -0
- package/dist/vercel-builder/index.mjs.map +1 -0
- package/package.json +153 -153
- package/templates/.dockerignore +43 -43
- package/templates/.env.example +17 -17
- package/templates/Dockerfile +60 -60
- package/templates/Procfile +1 -1
- package/templates/README.md +67 -67
- package/templates/api-sdk.ts +115 -115
- package/templates/docker-compose.yml +34 -34
- package/templates/nestjs-api/.env.example +3 -3
- package/templates/nestjs-api/README.md +87 -87
- package/templates/nestjs-api/nest-cli.json +6 -6
- package/templates/nestjs-api/package.json +40 -40
- package/templates/nestjs-api/prisma/migrations/20251123205437_init/migration.sql +24 -24
- package/templates/nestjs-api/prisma/migrations/migration_lock.toml +3 -3
- package/templates/nestjs-api/prisma/schema.prisma +29 -29
- package/templates/nestjs-api/src/app.module.ts +17 -17
- package/templates/nestjs-api/src/auth/auth.controller.ts +27 -27
- package/templates/nestjs-api/src/auth/auth.module.ts +37 -37
- package/templates/nestjs-api/src/auth/auth.service.ts +86 -86
- package/templates/nestjs-api/src/auth/dto/auth.dto.ts +22 -22
- package/templates/nestjs-api/src/auth/guards/jwt-auth.guard.ts +5 -5
- package/templates/nestjs-api/src/auth/strategies/jwt.strategy.ts +27 -27
- package/templates/nestjs-api/src/main.ts +32 -32
- package/templates/nestjs-api/src/prisma/prisma.module.ts +9 -9
- package/templates/nestjs-api/src/prisma/prisma.service.ts +14 -14
- package/templates/nestjs-api/src/todos/dto/todo.dto.ts +24 -24
- package/templates/nestjs-api/src/todos/todos.controller.ts +39 -39
- package/templates/nestjs-api/src/todos/todos.module.ts +11 -11
- package/templates/nestjs-api/src/todos/todos.service.ts +53 -53
- package/templates/nestjs-api/src/users/users.controller.ts +14 -14
- package/templates/nestjs-api/src/users/users.module.ts +12 -12
- package/templates/nestjs-api/src/users/users.service.ts +19 -19
- package/templates/nestjs-api/tsconfig.json +39 -39
- package/templates/nextjs-web/README.md +76 -76
- package/templates/nextjs-web/app/actions/auth.ts +108 -108
- package/templates/nextjs-web/app/dashboard/error.tsx +39 -39
- package/templates/nextjs-web/app/dashboard/loading.tsx +14 -14
- package/templates/nextjs-web/app/dashboard/page.tsx +5 -5
- package/templates/nextjs-web/app/globals.css +93 -93
- package/templates/nextjs-web/app/layout.tsx +29 -29
- package/templates/nextjs-web/app/login/page.tsx +5 -5
- package/templates/nextjs-web/app/page.tsx +28 -28
- package/templates/nextjs-web/app/register/page.tsx +5 -5
- package/templates/nextjs-web/components/ui/button.tsx +56 -56
- package/templates/nextjs-web/components/ui/card.tsx +79 -79
- package/templates/nextjs-web/components/ui/input.tsx +25 -25
- package/templates/nextjs-web/components/ui/label.tsx +24 -24
- package/templates/nextjs-web/features/auth/LoginForm.tsx +140 -140
- package/templates/nextjs-web/features/auth/RegisterForm.tsx +159 -159
- package/templates/nextjs-web/features/auth/api.ts +35 -35
- package/templates/nextjs-web/features/auth/index.ts +3 -3
- package/templates/nextjs-web/features/dashboard/DashboardView.tsx +204 -204
- package/templates/nextjs-web/features/dashboard/api.ts +9 -9
- package/templates/nextjs-web/features/dashboard/components.tsx +74 -74
- package/templates/nextjs-web/features/dashboard/index.ts +3 -3
- package/templates/nextjs-web/hooks/index.ts +4 -4
- package/templates/nextjs-web/lib/api-client.ts +89 -89
- package/templates/nextjs-web/lib/api.ts +115 -115
- package/templates/nextjs-web/lib/axios-global-config.ts +17 -17
- package/templates/nextjs-web/lib/utils.ts +6 -6
- package/templates/nextjs-web/lib/wexts-client.ts +4 -4
- package/templates/nextjs-web/next-env.d.ts +6 -6
- package/templates/nextjs-web/next.config.ts +20 -20
- package/templates/nextjs-web/package.json +37 -37
- package/templates/nextjs-web/postcss.config.js +6 -6
- package/templates/nextjs-web/tailwind.config.ts +69 -69
- package/templates/nextjs-web/tsconfig.json +41 -41
- package/templates/nixpacks.toml +11 -11
- package/templates/root-package.json +31 -31
- package/templates/server.ts +66 -66
- package/templates/tsconfig.json +30 -30
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
export { i as Codegen } from './index-h66Vq9dK.mjs';
|
|
2
|
+
export { i as DevServer } from './index-7RvU-jGE.mjs';
|
|
3
|
+
export { i as Nest } from './index-tqmYsTUn.mjs';
|
|
4
|
+
import React, { ReactNode } from 'react';
|
|
5
|
+
import { R as RpcAuthPolicy, b as RpcInvocationRequest, c as RpcInvocationResponse, a as RpcManifest, d as RpcMethodManifest, e as RpcParameterManifest, f as RpcServiceManifest } from './types-CQ_aexOX.mjs';
|
|
6
|
+
export { d as WextsCodegenError, W as WextsError, e as WextsErrorOptions, a as WextsRpcError, b as WextsRuntimeError, c as WextsSecurityError, f as formatWextsError } from './errors-D545UvXf.mjs';
|
|
7
|
+
import './decorators-vBopODtr.mjs';
|
|
8
|
+
|
|
9
|
+
interface FusionConfig {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
declare class ConfigLoader {
|
|
13
|
+
private config;
|
|
14
|
+
private configDir;
|
|
15
|
+
constructor(configDir?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Load configuration from file or environment
|
|
18
|
+
*/
|
|
19
|
+
load(key: string, defaultValue?: any): any;
|
|
20
|
+
/**
|
|
21
|
+
* Set configuration value
|
|
22
|
+
*/
|
|
23
|
+
set(key: string, value: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get all configuration
|
|
26
|
+
*/
|
|
27
|
+
getAll(): FusionConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Parse environment value (handles JSON strings)
|
|
30
|
+
*/
|
|
31
|
+
private parseEnvValue;
|
|
32
|
+
}
|
|
33
|
+
declare const config: ConfigLoader;
|
|
34
|
+
declare function load(key: string, defaultValue?: any): any;
|
|
35
|
+
|
|
36
|
+
declare enum LogLevel {
|
|
37
|
+
DEBUG = 0,
|
|
38
|
+
INFO = 1,
|
|
39
|
+
WARN = 2,
|
|
40
|
+
ERROR = 3
|
|
41
|
+
}
|
|
42
|
+
interface LoggerOptions {
|
|
43
|
+
level?: LogLevel;
|
|
44
|
+
prefix?: string;
|
|
45
|
+
timestamp?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare class Logger {
|
|
48
|
+
private level;
|
|
49
|
+
private prefix;
|
|
50
|
+
private timestamp;
|
|
51
|
+
constructor(options?: LoggerOptions);
|
|
52
|
+
private formatMessage;
|
|
53
|
+
debug(...args: any[]): void;
|
|
54
|
+
info(...args: any[]): void;
|
|
55
|
+
warn(...args: any[]): void;
|
|
56
|
+
error(...args: any[]): void;
|
|
57
|
+
success(...args: any[]): void;
|
|
58
|
+
}
|
|
59
|
+
declare const logger: Logger;
|
|
60
|
+
declare function createLogger(options: LoggerOptions): Logger;
|
|
61
|
+
|
|
62
|
+
declare class FileSystem {
|
|
63
|
+
/**
|
|
64
|
+
* Read file as string
|
|
65
|
+
*/
|
|
66
|
+
readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Write file
|
|
69
|
+
*/
|
|
70
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Read JSON file
|
|
73
|
+
*/
|
|
74
|
+
readJSON<T = any>(filePath: string): Promise<T>;
|
|
75
|
+
/**
|
|
76
|
+
* Write JSON file
|
|
77
|
+
*/
|
|
78
|
+
writeJSON(filePath: string, data: any, pretty?: boolean): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Check if file/directory exists
|
|
81
|
+
*/
|
|
82
|
+
exists(filePath: string): Promise<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Ensure directory exists (create if not)
|
|
85
|
+
*/
|
|
86
|
+
ensureDir(dirPath: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Copy file
|
|
89
|
+
*/
|
|
90
|
+
copyFile(src: string, dest: string): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Read directory
|
|
93
|
+
*/
|
|
94
|
+
readDir(dirPath: string): Promise<string[]>;
|
|
95
|
+
}
|
|
96
|
+
declare const filesystem: FileSystem;
|
|
97
|
+
|
|
98
|
+
declare class ProcessManager {
|
|
99
|
+
/**
|
|
100
|
+
* Setup process error handlers
|
|
101
|
+
*/
|
|
102
|
+
static initialize(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Graceful shutdown helper
|
|
105
|
+
*/
|
|
106
|
+
static shutdown(cleanup: () => Promise<void>): Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare class FusionError extends Error {
|
|
110
|
+
code?: string | undefined;
|
|
111
|
+
constructor(message: string, code?: string | undefined);
|
|
112
|
+
}
|
|
113
|
+
declare class ConfigError extends FusionError {
|
|
114
|
+
constructor(message: string);
|
|
115
|
+
}
|
|
116
|
+
declare class ValidationError extends FusionError {
|
|
117
|
+
constructor(message: string);
|
|
118
|
+
}
|
|
119
|
+
declare class APIError extends FusionError {
|
|
120
|
+
statusCode?: number | undefined;
|
|
121
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type index$5_APIError = APIError;
|
|
125
|
+
declare const index$5_APIError: typeof APIError;
|
|
126
|
+
type index$5_ConfigError = ConfigError;
|
|
127
|
+
declare const index$5_ConfigError: typeof ConfigError;
|
|
128
|
+
type index$5_ConfigLoader = ConfigLoader;
|
|
129
|
+
declare const index$5_ConfigLoader: typeof ConfigLoader;
|
|
130
|
+
type index$5_FileSystem = FileSystem;
|
|
131
|
+
declare const index$5_FileSystem: typeof FileSystem;
|
|
132
|
+
type index$5_FusionConfig = FusionConfig;
|
|
133
|
+
type index$5_FusionError = FusionError;
|
|
134
|
+
declare const index$5_FusionError: typeof FusionError;
|
|
135
|
+
type index$5_LogLevel = LogLevel;
|
|
136
|
+
declare const index$5_LogLevel: typeof LogLevel;
|
|
137
|
+
type index$5_Logger = Logger;
|
|
138
|
+
declare const index$5_Logger: typeof Logger;
|
|
139
|
+
type index$5_LoggerOptions = LoggerOptions;
|
|
140
|
+
type index$5_ProcessManager = ProcessManager;
|
|
141
|
+
declare const index$5_ProcessManager: typeof ProcessManager;
|
|
142
|
+
type index$5_ValidationError = ValidationError;
|
|
143
|
+
declare const index$5_ValidationError: typeof ValidationError;
|
|
144
|
+
declare const index$5_config: typeof config;
|
|
145
|
+
declare const index$5_createLogger: typeof createLogger;
|
|
146
|
+
declare const index$5_filesystem: typeof filesystem;
|
|
147
|
+
declare const index$5_load: typeof load;
|
|
148
|
+
declare const index$5_logger: typeof logger;
|
|
149
|
+
declare namespace index$5 {
|
|
150
|
+
export { index$5_APIError as APIError, index$5_ConfigError as ConfigError, index$5_ConfigLoader as ConfigLoader, index$5_FileSystem as FileSystem, type index$5_FusionConfig as FusionConfig, index$5_FusionError as FusionError, index$5_LogLevel as LogLevel, index$5_Logger as Logger, type index$5_LoggerOptions as LoggerOptions, index$5_ProcessManager as ProcessManager, index$5_ValidationError as ValidationError, index$5_config as config, index$5_createLogger as createLogger, index$5_filesystem as filesystem, index$5_load as load, index$5_logger as logger };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare const loader: {
|
|
154
|
+
load: () => {};
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
declare const index$4_loader: typeof loader;
|
|
158
|
+
declare namespace index$4 {
|
|
159
|
+
export { index$4_loader as loader };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
declare const server: {
|
|
163
|
+
start: () => void;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
declare const index$3_server: typeof server;
|
|
167
|
+
declare namespace index$3 {
|
|
168
|
+
export { index$3_server as server };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface ScaffoldOptions {
|
|
172
|
+
projectName: string;
|
|
173
|
+
template: 'monorepo' | 'api' | 'web';
|
|
174
|
+
packageManager?: 'npm' | 'pnpm' | 'yarn';
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @deprecated Use the `wexts create` CLI and `examples/hello-rpc` canonical scaffold instead.
|
|
178
|
+
*/
|
|
179
|
+
declare class ProjectScaffolder {
|
|
180
|
+
scaffold(options: ScaffoldOptions): Promise<void>;
|
|
181
|
+
private createMonorepo;
|
|
182
|
+
private createNestJSApp;
|
|
183
|
+
private createNextJSApp;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
type index$2_ProjectScaffolder = ProjectScaffolder;
|
|
187
|
+
declare const index$2_ProjectScaffolder: typeof ProjectScaffolder;
|
|
188
|
+
type index$2_ScaffoldOptions = ScaffoldOptions;
|
|
189
|
+
declare namespace index$2 {
|
|
190
|
+
export { index$2_ProjectScaffolder as ProjectScaffolder, type index$2_ScaffoldOptions as ScaffoldOptions };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class FusionFetcher {
|
|
194
|
+
private baseUrl;
|
|
195
|
+
constructor(baseUrl?: string);
|
|
196
|
+
private request;
|
|
197
|
+
get<T>(path: string): Promise<T>;
|
|
198
|
+
post<T>(path: string, body: any): Promise<T>;
|
|
199
|
+
put<T>(path: string, body: any): Promise<T>;
|
|
200
|
+
delete<T>(path: string): Promise<T>;
|
|
201
|
+
}
|
|
202
|
+
type WextsRpcClient = Record<string, Record<string, (...args: unknown[]) => Promise<unknown>>>;
|
|
203
|
+
|
|
204
|
+
interface FusionContextType {
|
|
205
|
+
client: FusionFetcher;
|
|
206
|
+
wexts: WextsRpcClient;
|
|
207
|
+
}
|
|
208
|
+
interface FusionProviderProps {
|
|
209
|
+
children: ReactNode;
|
|
210
|
+
baseUrl?: string;
|
|
211
|
+
rpcBaseUrl?: string;
|
|
212
|
+
rpcClient?: object;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* FusionProvider - Provides API client to React components
|
|
216
|
+
* Usage:
|
|
217
|
+
* ```tsx
|
|
218
|
+
* <FusionProvider baseUrl="/api">
|
|
219
|
+
* <App />
|
|
220
|
+
* </FusionProvider>
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
declare function FusionProvider({ children, baseUrl, rpcBaseUrl, rpcClient }: FusionProviderProps): React.JSX.Element;
|
|
224
|
+
/**
|
|
225
|
+
* useFusion hook - Access API client in components
|
|
226
|
+
* Usage:
|
|
227
|
+
* ```tsx
|
|
228
|
+
* const { client } = useFusion();
|
|
229
|
+
* const data = await client.get('/users');
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
declare function useFusion(): FusionContextType;
|
|
233
|
+
declare function useWexts<TClient = WextsRpcClient>(): TClient;
|
|
234
|
+
|
|
235
|
+
interface AuthUser {
|
|
236
|
+
id: string;
|
|
237
|
+
email: string;
|
|
238
|
+
name?: string;
|
|
239
|
+
}
|
|
240
|
+
interface UseAuthReturn {
|
|
241
|
+
user: AuthUser | null;
|
|
242
|
+
loading: boolean;
|
|
243
|
+
login: (email: string, password: string) => Promise<void>;
|
|
244
|
+
logout: () => Promise<void>;
|
|
245
|
+
isAuthenticated: boolean;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* useAuth hook - Authentication state management
|
|
249
|
+
* Usage:
|
|
250
|
+
* ```tsx
|
|
251
|
+
* const { user, login, logout, isAuthenticated } = useAuth();
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
declare function useAuth(): UseAuthReturn;
|
|
255
|
+
|
|
256
|
+
type index$1_AuthUser = AuthUser;
|
|
257
|
+
declare const index$1_FusionProvider: typeof FusionProvider;
|
|
258
|
+
type index$1_FusionProviderProps = FusionProviderProps;
|
|
259
|
+
type index$1_UseAuthReturn = UseAuthReturn;
|
|
260
|
+
declare const index$1_useAuth: typeof useAuth;
|
|
261
|
+
declare const index$1_useFusion: typeof useFusion;
|
|
262
|
+
declare const index$1_useWexts: typeof useWexts;
|
|
263
|
+
declare namespace index$1 {
|
|
264
|
+
export { type index$1_AuthUser as AuthUser, index$1_FusionProvider as FusionProvider, type index$1_FusionProviderProps as FusionProviderProps, type index$1_UseAuthReturn as UseAuthReturn, index$1_useAuth as useAuth, index$1_useFusion as useFusion, index$1_useWexts as useWexts };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare const index_RpcAuthPolicy: typeof RpcAuthPolicy;
|
|
268
|
+
declare const index_RpcInvocationRequest: typeof RpcInvocationRequest;
|
|
269
|
+
declare const index_RpcInvocationResponse: typeof RpcInvocationResponse;
|
|
270
|
+
declare const index_RpcManifest: typeof RpcManifest;
|
|
271
|
+
declare const index_RpcMethodManifest: typeof RpcMethodManifest;
|
|
272
|
+
declare const index_RpcParameterManifest: typeof RpcParameterManifest;
|
|
273
|
+
declare const index_RpcServiceManifest: typeof RpcServiceManifest;
|
|
274
|
+
declare namespace index {
|
|
275
|
+
export { index_RpcAuthPolicy as RpcAuthPolicy, index_RpcInvocationRequest as RpcInvocationRequest, index_RpcInvocationResponse as RpcInvocationResponse, index_RpcManifest as RpcManifest, index_RpcMethodManifest as RpcMethodManifest, index_RpcParameterManifest as RpcParameterManifest, index_RpcServiceManifest as RpcServiceManifest };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
interface User {
|
|
279
|
+
id: string;
|
|
280
|
+
email: string;
|
|
281
|
+
name?: string;
|
|
282
|
+
}
|
|
283
|
+
interface Todo {
|
|
284
|
+
id: string;
|
|
285
|
+
title: string;
|
|
286
|
+
completed: boolean;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export { index$4 as Config, index$5 as Core, index$2 as CreateFusion, index$3 as Insight, index$1 as Next, index as Rpc, type Todo, type User };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
export { i as Codegen } from './index-CJKs4wtN.js';
|
|
2
|
+
export { i as DevServer } from './index-7RvU-jGE.js';
|
|
3
|
+
export { i as Nest } from './index-CUR6CnLk.js';
|
|
4
|
+
import React, { ReactNode } from 'react';
|
|
5
|
+
import { R as RpcAuthPolicy, b as RpcInvocationRequest, c as RpcInvocationResponse, a as RpcManifest, d as RpcMethodManifest, e as RpcParameterManifest, f as RpcServiceManifest } from './types-CQ_aexOX.js';
|
|
6
|
+
export { d as WextsCodegenError, W as WextsError, e as WextsErrorOptions, a as WextsRpcError, b as WextsRuntimeError, c as WextsSecurityError, f as formatWextsError } from './errors-D545UvXf.js';
|
|
7
|
+
import './decorators-BiQtOHuF.js';
|
|
8
|
+
|
|
9
|
+
interface FusionConfig {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
declare class ConfigLoader {
|
|
13
|
+
private config;
|
|
14
|
+
private configDir;
|
|
15
|
+
constructor(configDir?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Load configuration from file or environment
|
|
18
|
+
*/
|
|
19
|
+
load(key: string, defaultValue?: any): any;
|
|
20
|
+
/**
|
|
21
|
+
* Set configuration value
|
|
22
|
+
*/
|
|
23
|
+
set(key: string, value: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get all configuration
|
|
26
|
+
*/
|
|
27
|
+
getAll(): FusionConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Parse environment value (handles JSON strings)
|
|
30
|
+
*/
|
|
31
|
+
private parseEnvValue;
|
|
32
|
+
}
|
|
33
|
+
declare const config: ConfigLoader;
|
|
34
|
+
declare function load(key: string, defaultValue?: any): any;
|
|
35
|
+
|
|
36
|
+
declare enum LogLevel {
|
|
37
|
+
DEBUG = 0,
|
|
38
|
+
INFO = 1,
|
|
39
|
+
WARN = 2,
|
|
40
|
+
ERROR = 3
|
|
41
|
+
}
|
|
42
|
+
interface LoggerOptions {
|
|
43
|
+
level?: LogLevel;
|
|
44
|
+
prefix?: string;
|
|
45
|
+
timestamp?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare class Logger {
|
|
48
|
+
private level;
|
|
49
|
+
private prefix;
|
|
50
|
+
private timestamp;
|
|
51
|
+
constructor(options?: LoggerOptions);
|
|
52
|
+
private formatMessage;
|
|
53
|
+
debug(...args: any[]): void;
|
|
54
|
+
info(...args: any[]): void;
|
|
55
|
+
warn(...args: any[]): void;
|
|
56
|
+
error(...args: any[]): void;
|
|
57
|
+
success(...args: any[]): void;
|
|
58
|
+
}
|
|
59
|
+
declare const logger: Logger;
|
|
60
|
+
declare function createLogger(options: LoggerOptions): Logger;
|
|
61
|
+
|
|
62
|
+
declare class FileSystem {
|
|
63
|
+
/**
|
|
64
|
+
* Read file as string
|
|
65
|
+
*/
|
|
66
|
+
readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Write file
|
|
69
|
+
*/
|
|
70
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Read JSON file
|
|
73
|
+
*/
|
|
74
|
+
readJSON<T = any>(filePath: string): Promise<T>;
|
|
75
|
+
/**
|
|
76
|
+
* Write JSON file
|
|
77
|
+
*/
|
|
78
|
+
writeJSON(filePath: string, data: any, pretty?: boolean): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Check if file/directory exists
|
|
81
|
+
*/
|
|
82
|
+
exists(filePath: string): Promise<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Ensure directory exists (create if not)
|
|
85
|
+
*/
|
|
86
|
+
ensureDir(dirPath: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Copy file
|
|
89
|
+
*/
|
|
90
|
+
copyFile(src: string, dest: string): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Read directory
|
|
93
|
+
*/
|
|
94
|
+
readDir(dirPath: string): Promise<string[]>;
|
|
95
|
+
}
|
|
96
|
+
declare const filesystem: FileSystem;
|
|
97
|
+
|
|
98
|
+
declare class ProcessManager {
|
|
99
|
+
/**
|
|
100
|
+
* Setup process error handlers
|
|
101
|
+
*/
|
|
102
|
+
static initialize(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Graceful shutdown helper
|
|
105
|
+
*/
|
|
106
|
+
static shutdown(cleanup: () => Promise<void>): Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare class FusionError extends Error {
|
|
110
|
+
code?: string | undefined;
|
|
111
|
+
constructor(message: string, code?: string | undefined);
|
|
112
|
+
}
|
|
113
|
+
declare class ConfigError extends FusionError {
|
|
114
|
+
constructor(message: string);
|
|
115
|
+
}
|
|
116
|
+
declare class ValidationError extends FusionError {
|
|
117
|
+
constructor(message: string);
|
|
118
|
+
}
|
|
119
|
+
declare class APIError extends FusionError {
|
|
120
|
+
statusCode?: number | undefined;
|
|
121
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type index$5_APIError = APIError;
|
|
125
|
+
declare const index$5_APIError: typeof APIError;
|
|
126
|
+
type index$5_ConfigError = ConfigError;
|
|
127
|
+
declare const index$5_ConfigError: typeof ConfigError;
|
|
128
|
+
type index$5_ConfigLoader = ConfigLoader;
|
|
129
|
+
declare const index$5_ConfigLoader: typeof ConfigLoader;
|
|
130
|
+
type index$5_FileSystem = FileSystem;
|
|
131
|
+
declare const index$5_FileSystem: typeof FileSystem;
|
|
132
|
+
type index$5_FusionConfig = FusionConfig;
|
|
133
|
+
type index$5_FusionError = FusionError;
|
|
134
|
+
declare const index$5_FusionError: typeof FusionError;
|
|
135
|
+
type index$5_LogLevel = LogLevel;
|
|
136
|
+
declare const index$5_LogLevel: typeof LogLevel;
|
|
137
|
+
type index$5_Logger = Logger;
|
|
138
|
+
declare const index$5_Logger: typeof Logger;
|
|
139
|
+
type index$5_LoggerOptions = LoggerOptions;
|
|
140
|
+
type index$5_ProcessManager = ProcessManager;
|
|
141
|
+
declare const index$5_ProcessManager: typeof ProcessManager;
|
|
142
|
+
type index$5_ValidationError = ValidationError;
|
|
143
|
+
declare const index$5_ValidationError: typeof ValidationError;
|
|
144
|
+
declare const index$5_config: typeof config;
|
|
145
|
+
declare const index$5_createLogger: typeof createLogger;
|
|
146
|
+
declare const index$5_filesystem: typeof filesystem;
|
|
147
|
+
declare const index$5_load: typeof load;
|
|
148
|
+
declare const index$5_logger: typeof logger;
|
|
149
|
+
declare namespace index$5 {
|
|
150
|
+
export { index$5_APIError as APIError, index$5_ConfigError as ConfigError, index$5_ConfigLoader as ConfigLoader, index$5_FileSystem as FileSystem, type index$5_FusionConfig as FusionConfig, index$5_FusionError as FusionError, index$5_LogLevel as LogLevel, index$5_Logger as Logger, type index$5_LoggerOptions as LoggerOptions, index$5_ProcessManager as ProcessManager, index$5_ValidationError as ValidationError, index$5_config as config, index$5_createLogger as createLogger, index$5_filesystem as filesystem, index$5_load as load, index$5_logger as logger };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare const loader: {
|
|
154
|
+
load: () => {};
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
declare const index$4_loader: typeof loader;
|
|
158
|
+
declare namespace index$4 {
|
|
159
|
+
export { index$4_loader as loader };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
declare const server: {
|
|
163
|
+
start: () => void;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
declare const index$3_server: typeof server;
|
|
167
|
+
declare namespace index$3 {
|
|
168
|
+
export { index$3_server as server };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface ScaffoldOptions {
|
|
172
|
+
projectName: string;
|
|
173
|
+
template: 'monorepo' | 'api' | 'web';
|
|
174
|
+
packageManager?: 'npm' | 'pnpm' | 'yarn';
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @deprecated Use the `wexts create` CLI and `examples/hello-rpc` canonical scaffold instead.
|
|
178
|
+
*/
|
|
179
|
+
declare class ProjectScaffolder {
|
|
180
|
+
scaffold(options: ScaffoldOptions): Promise<void>;
|
|
181
|
+
private createMonorepo;
|
|
182
|
+
private createNestJSApp;
|
|
183
|
+
private createNextJSApp;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
type index$2_ProjectScaffolder = ProjectScaffolder;
|
|
187
|
+
declare const index$2_ProjectScaffolder: typeof ProjectScaffolder;
|
|
188
|
+
type index$2_ScaffoldOptions = ScaffoldOptions;
|
|
189
|
+
declare namespace index$2 {
|
|
190
|
+
export { index$2_ProjectScaffolder as ProjectScaffolder, type index$2_ScaffoldOptions as ScaffoldOptions };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class FusionFetcher {
|
|
194
|
+
private baseUrl;
|
|
195
|
+
constructor(baseUrl?: string);
|
|
196
|
+
private request;
|
|
197
|
+
get<T>(path: string): Promise<T>;
|
|
198
|
+
post<T>(path: string, body: any): Promise<T>;
|
|
199
|
+
put<T>(path: string, body: any): Promise<T>;
|
|
200
|
+
delete<T>(path: string): Promise<T>;
|
|
201
|
+
}
|
|
202
|
+
type WextsRpcClient = Record<string, Record<string, (...args: unknown[]) => Promise<unknown>>>;
|
|
203
|
+
|
|
204
|
+
interface FusionContextType {
|
|
205
|
+
client: FusionFetcher;
|
|
206
|
+
wexts: WextsRpcClient;
|
|
207
|
+
}
|
|
208
|
+
interface FusionProviderProps {
|
|
209
|
+
children: ReactNode;
|
|
210
|
+
baseUrl?: string;
|
|
211
|
+
rpcBaseUrl?: string;
|
|
212
|
+
rpcClient?: object;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* FusionProvider - Provides API client to React components
|
|
216
|
+
* Usage:
|
|
217
|
+
* ```tsx
|
|
218
|
+
* <FusionProvider baseUrl="/api">
|
|
219
|
+
* <App />
|
|
220
|
+
* </FusionProvider>
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
declare function FusionProvider({ children, baseUrl, rpcBaseUrl, rpcClient }: FusionProviderProps): React.JSX.Element;
|
|
224
|
+
/**
|
|
225
|
+
* useFusion hook - Access API client in components
|
|
226
|
+
* Usage:
|
|
227
|
+
* ```tsx
|
|
228
|
+
* const { client } = useFusion();
|
|
229
|
+
* const data = await client.get('/users');
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
declare function useFusion(): FusionContextType;
|
|
233
|
+
declare function useWexts<TClient = WextsRpcClient>(): TClient;
|
|
234
|
+
|
|
235
|
+
interface AuthUser {
|
|
236
|
+
id: string;
|
|
237
|
+
email: string;
|
|
238
|
+
name?: string;
|
|
239
|
+
}
|
|
240
|
+
interface UseAuthReturn {
|
|
241
|
+
user: AuthUser | null;
|
|
242
|
+
loading: boolean;
|
|
243
|
+
login: (email: string, password: string) => Promise<void>;
|
|
244
|
+
logout: () => Promise<void>;
|
|
245
|
+
isAuthenticated: boolean;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* useAuth hook - Authentication state management
|
|
249
|
+
* Usage:
|
|
250
|
+
* ```tsx
|
|
251
|
+
* const { user, login, logout, isAuthenticated } = useAuth();
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
declare function useAuth(): UseAuthReturn;
|
|
255
|
+
|
|
256
|
+
type index$1_AuthUser = AuthUser;
|
|
257
|
+
declare const index$1_FusionProvider: typeof FusionProvider;
|
|
258
|
+
type index$1_FusionProviderProps = FusionProviderProps;
|
|
259
|
+
type index$1_UseAuthReturn = UseAuthReturn;
|
|
260
|
+
declare const index$1_useAuth: typeof useAuth;
|
|
261
|
+
declare const index$1_useFusion: typeof useFusion;
|
|
262
|
+
declare const index$1_useWexts: typeof useWexts;
|
|
263
|
+
declare namespace index$1 {
|
|
264
|
+
export { type index$1_AuthUser as AuthUser, index$1_FusionProvider as FusionProvider, type index$1_FusionProviderProps as FusionProviderProps, type index$1_UseAuthReturn as UseAuthReturn, index$1_useAuth as useAuth, index$1_useFusion as useFusion, index$1_useWexts as useWexts };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare const index_RpcAuthPolicy: typeof RpcAuthPolicy;
|
|
268
|
+
declare const index_RpcInvocationRequest: typeof RpcInvocationRequest;
|
|
269
|
+
declare const index_RpcInvocationResponse: typeof RpcInvocationResponse;
|
|
270
|
+
declare const index_RpcManifest: typeof RpcManifest;
|
|
271
|
+
declare const index_RpcMethodManifest: typeof RpcMethodManifest;
|
|
272
|
+
declare const index_RpcParameterManifest: typeof RpcParameterManifest;
|
|
273
|
+
declare const index_RpcServiceManifest: typeof RpcServiceManifest;
|
|
274
|
+
declare namespace index {
|
|
275
|
+
export { index_RpcAuthPolicy as RpcAuthPolicy, index_RpcInvocationRequest as RpcInvocationRequest, index_RpcInvocationResponse as RpcInvocationResponse, index_RpcManifest as RpcManifest, index_RpcMethodManifest as RpcMethodManifest, index_RpcParameterManifest as RpcParameterManifest, index_RpcServiceManifest as RpcServiceManifest };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
interface User {
|
|
279
|
+
id: string;
|
|
280
|
+
email: string;
|
|
281
|
+
name?: string;
|
|
282
|
+
}
|
|
283
|
+
interface Todo {
|
|
284
|
+
id: string;
|
|
285
|
+
title: string;
|
|
286
|
+
completed: boolean;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export { index$4 as Config, index$5 as Core, index$2 as CreateFusion, index$3 as Insight, index$1 as Next, index as Rpc, type Todo, type User };
|