mulink 1.0.0
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/LICENSE +70 -0
- package/README.md +1031 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/lib/chunk-F6QVO6NR.cjs +9541 -0
- package/dist/lib/chunk-F6QVO6NR.cjs.map +1 -0
- package/dist/lib/chunk-SMOCRKWL.js +9521 -0
- package/dist/lib/chunk-SMOCRKWL.js.map +1 -0
- package/dist/lib/cli.cjs +340 -0
- package/dist/lib/cli.cjs.map +1 -0
- package/dist/lib/cli.d.cts +1 -0
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +338 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/client.cjs +70 -0
- package/dist/lib/client.cjs.map +1 -0
- package/dist/lib/client.d.cts +9 -0
- package/dist/lib/client.d.ts +9 -0
- package/dist/lib/client.js +16 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/index.cjs +64 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.cts +15 -0
- package/dist/lib/index.d.ts +15 -0
- package/dist/lib/index.js +3 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/version-checker-BWdifiXN.d.cts +576 -0
- package/dist/lib/version-checker-BWdifiXN.d.ts +576 -0
- package/package.json +126 -0
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
import { OpenAPIV3, OpenAPIV2 } from 'openapi-types';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
interface BridgeConfiguration {
|
|
5
|
+
/** OpenAPI schema URL or file path */
|
|
6
|
+
schema: string;
|
|
7
|
+
/** Output directory for generated files */
|
|
8
|
+
outputDir: string;
|
|
9
|
+
/** Framework configuration */
|
|
10
|
+
framework: FrameworkConfiguration;
|
|
11
|
+
/** API configuration */
|
|
12
|
+
api: ApiConfiguration;
|
|
13
|
+
/** Authentication configuration */
|
|
14
|
+
auth?: AuthConfiguration;
|
|
15
|
+
/** Caching configuration */
|
|
16
|
+
cache?: CacheConfiguration;
|
|
17
|
+
/** File upload configuration */
|
|
18
|
+
uploads?: UploadConfiguration;
|
|
19
|
+
/** Development options */
|
|
20
|
+
dev?: DevelopmentConfiguration;
|
|
21
|
+
/** Plugin configurations */
|
|
22
|
+
plugins?: PluginConfiguration[];
|
|
23
|
+
/** Custom type mappings */
|
|
24
|
+
typeMappings?: Record<string, string>;
|
|
25
|
+
/** Generation options */
|
|
26
|
+
generation?: GenerationConfiguration;
|
|
27
|
+
}
|
|
28
|
+
interface FrameworkConfiguration {
|
|
29
|
+
type: 'nextjs';
|
|
30
|
+
version?: string;
|
|
31
|
+
router: 'app' | 'pages';
|
|
32
|
+
features: {
|
|
33
|
+
serverActions: boolean;
|
|
34
|
+
middleware: boolean;
|
|
35
|
+
streaming: boolean;
|
|
36
|
+
revalidation: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** Streaming configuration */
|
|
39
|
+
streaming?: StreamingConfiguration;
|
|
40
|
+
}
|
|
41
|
+
interface ApiConfiguration {
|
|
42
|
+
baseUrl: string;
|
|
43
|
+
timeout: number;
|
|
44
|
+
retries: number;
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
interceptors?: {
|
|
47
|
+
request?: string[];
|
|
48
|
+
response?: string[];
|
|
49
|
+
};
|
|
50
|
+
/** Next.js 16: Custom user agent for fetch requests */
|
|
51
|
+
userAgent?: string;
|
|
52
|
+
/** Custom error handler configuration */
|
|
53
|
+
errorHandling?: ErrorHandlingConfiguration;
|
|
54
|
+
/** Custom middleware imports */
|
|
55
|
+
customMiddleware?: CustomMiddlewareConfiguration[];
|
|
56
|
+
}
|
|
57
|
+
interface ErrorHandlingConfiguration {
|
|
58
|
+
/** Enable automatic auth error handling */
|
|
59
|
+
enableAuthErrorHandling?: boolean;
|
|
60
|
+
/** Path to custom auth error handler (default: @/lib/auth-error-handler) */
|
|
61
|
+
authErrorHandlerPath?: string;
|
|
62
|
+
/** Generate auth error handler if it doesn't exist */
|
|
63
|
+
generateAuthErrorHandler?: boolean;
|
|
64
|
+
/** Custom error handler paths */
|
|
65
|
+
customHandlers?: Record<string, string>;
|
|
66
|
+
}
|
|
67
|
+
interface CustomMiddlewareConfiguration {
|
|
68
|
+
/** Middleware name */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Import path for the middleware */
|
|
71
|
+
importPath: string;
|
|
72
|
+
/** Whether to include in default middleware stack */
|
|
73
|
+
includeInDefault?: boolean;
|
|
74
|
+
/** Middleware priority (lower = earlier in stack) */
|
|
75
|
+
priority?: number;
|
|
76
|
+
}
|
|
77
|
+
interface AuthConfiguration {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
provider: 'next-auth' | 'clerk' | 'custom';
|
|
80
|
+
middleware?: boolean;
|
|
81
|
+
publicPaths?: string[];
|
|
82
|
+
/** Path to auth utility (default: @/lib/auth) */
|
|
83
|
+
authPath?: string;
|
|
84
|
+
/** Custom auth token getter function name */
|
|
85
|
+
tokenGetter?: string;
|
|
86
|
+
/** OAuth providers configuration */
|
|
87
|
+
oauth?: {
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
providers?: ('google' | 'github' | 'discord' | 'microsoft' | 'apple')[];
|
|
90
|
+
/** Custom OAuth callback URL */
|
|
91
|
+
callbackUrl?: string;
|
|
92
|
+
};
|
|
93
|
+
/** MFA (Multi-Factor Authentication) configuration */
|
|
94
|
+
mfa?: {
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
/** Support TOTP (Time-based One-Time Password) */
|
|
97
|
+
totp?: boolean;
|
|
98
|
+
/** Support backup codes */
|
|
99
|
+
backupCodes?: boolean;
|
|
100
|
+
};
|
|
101
|
+
/** Passkeys (WebAuthn) configuration */
|
|
102
|
+
passkeys?: {
|
|
103
|
+
enabled: boolean;
|
|
104
|
+
/** Require user verification */
|
|
105
|
+
requireUserVerification?: boolean;
|
|
106
|
+
/** Timeout in milliseconds */
|
|
107
|
+
timeout?: number;
|
|
108
|
+
};
|
|
109
|
+
/** Session configuration */
|
|
110
|
+
session?: {
|
|
111
|
+
/** Session strategy: 'jwt' or 'database' */
|
|
112
|
+
strategy?: 'jwt' | 'database';
|
|
113
|
+
/** Maximum session age in seconds */
|
|
114
|
+
maxAge?: number;
|
|
115
|
+
/** JWT maximum age in seconds */
|
|
116
|
+
jwtMaxAge?: number;
|
|
117
|
+
};
|
|
118
|
+
/** Token refresh configuration */
|
|
119
|
+
tokenRefresh?: {
|
|
120
|
+
/** Enable automatic token refresh */
|
|
121
|
+
enabled?: boolean;
|
|
122
|
+
/** Refresh token before expiry (in seconds) */
|
|
123
|
+
refreshBeforeExpiry?: number;
|
|
124
|
+
};
|
|
125
|
+
/** Account status checking */
|
|
126
|
+
accountStatus?: {
|
|
127
|
+
/** Check account status on token refresh */
|
|
128
|
+
checkOnRefresh?: boolean;
|
|
129
|
+
/** Auto-logout on account suspension */
|
|
130
|
+
autoLogoutOnSuspension?: boolean;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
interface CacheConfiguration {
|
|
134
|
+
strategy: 'memory' | 'redis' | 'database';
|
|
135
|
+
ttl: number;
|
|
136
|
+
tags: boolean;
|
|
137
|
+
revalidation: 'time' | 'on-demand' | 'both';
|
|
138
|
+
/** Next.js 16: Enable cache tags for granular invalidation */
|
|
139
|
+
cacheTags?: boolean;
|
|
140
|
+
/** Next.js 16: Enable connection keep-alive for persistent connections */
|
|
141
|
+
persistentConnections?: boolean;
|
|
142
|
+
}
|
|
143
|
+
interface DevelopmentConfiguration {
|
|
144
|
+
logging: boolean;
|
|
145
|
+
validation: boolean;
|
|
146
|
+
mocking: boolean;
|
|
147
|
+
watch: boolean;
|
|
148
|
+
}
|
|
149
|
+
interface PluginConfiguration {
|
|
150
|
+
name: string;
|
|
151
|
+
options?: Record<string, unknown>;
|
|
152
|
+
}
|
|
153
|
+
interface GenerationConfiguration {
|
|
154
|
+
typescript: boolean;
|
|
155
|
+
strict: boolean;
|
|
156
|
+
comments: boolean;
|
|
157
|
+
examples: boolean;
|
|
158
|
+
tests: boolean;
|
|
159
|
+
}
|
|
160
|
+
interface UploadConfiguration {
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
strategy: 'standard' | 'external' | 'presigned';
|
|
163
|
+
provider?: 'uploadthing' | 'vercel-blob' | 'standard' | 's3' | 'minio';
|
|
164
|
+
compression?: {
|
|
165
|
+
enabled: boolean;
|
|
166
|
+
formats?: ('gzip' | 'webp' | 'brotli')[];
|
|
167
|
+
};
|
|
168
|
+
security?: {
|
|
169
|
+
maxSize?: string;
|
|
170
|
+
allowedTypes?: string[];
|
|
171
|
+
scan?: 'clamav' | 'none';
|
|
172
|
+
};
|
|
173
|
+
/** Enable presigned URL uploads (direct to S3/MinIO) */
|
|
174
|
+
presignedUploads?: {
|
|
175
|
+
enabled: boolean;
|
|
176
|
+
/** Endpoint path for generating presigned URLs (e.g., '/api/v1/files/presign-upload') */
|
|
177
|
+
presignEndpoint?: string;
|
|
178
|
+
/** Fallback to backend upload if presigned upload fails */
|
|
179
|
+
fallbackToBackend?: boolean;
|
|
180
|
+
};
|
|
181
|
+
/** Progress tracking configuration */
|
|
182
|
+
progressTracking?: {
|
|
183
|
+
enabled: boolean;
|
|
184
|
+
/** Use XMLHttpRequest for better progress tracking (default: true) */
|
|
185
|
+
useXHR?: boolean;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
interface StreamingConfiguration {
|
|
189
|
+
enabled: boolean;
|
|
190
|
+
/** Support for Server-Sent Events (SSE) */
|
|
191
|
+
sse?: {
|
|
192
|
+
enabled: boolean;
|
|
193
|
+
/** Auto-reconnect on connection loss */
|
|
194
|
+
autoReconnect?: boolean;
|
|
195
|
+
/** Reconnect delay in milliseconds */
|
|
196
|
+
reconnectDelay?: number;
|
|
197
|
+
/** Maximum reconnect attempts */
|
|
198
|
+
maxReconnectAttempts?: number;
|
|
199
|
+
};
|
|
200
|
+
/** Support for WebSocket streaming */
|
|
201
|
+
websocket?: {
|
|
202
|
+
enabled: boolean;
|
|
203
|
+
/** WebSocket URL pattern */
|
|
204
|
+
urlPattern?: string;
|
|
205
|
+
};
|
|
206
|
+
/** Support for HTTP streaming (ReadableStream) */
|
|
207
|
+
httpStreaming?: {
|
|
208
|
+
enabled: boolean;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
type OpenApiDocument = OpenAPIV3.Document | OpenAPIV2.Document;
|
|
212
|
+
interface ParsedApiSchema {
|
|
213
|
+
version: '2.0' | '3.0' | '3.1';
|
|
214
|
+
document: OpenAPIV3.Document;
|
|
215
|
+
openApiSpec: OpenAPIV3.Document;
|
|
216
|
+
endpoints: ApiEndpointDefinition[];
|
|
217
|
+
schemas: SchemaDefinition[];
|
|
218
|
+
security: SecuritySchemeDefinition[];
|
|
219
|
+
servers: ServerDefinition[];
|
|
220
|
+
metadata: SchemaMetadata;
|
|
221
|
+
}
|
|
222
|
+
interface ApiEndpointDefinition {
|
|
223
|
+
id: string;
|
|
224
|
+
path: string;
|
|
225
|
+
method: HttpMethod;
|
|
226
|
+
operationId?: string;
|
|
227
|
+
summary?: string;
|
|
228
|
+
description?: string;
|
|
229
|
+
tags: string[];
|
|
230
|
+
parameters: ParameterDefinition[];
|
|
231
|
+
requestBody?: RequestBodyDefinition;
|
|
232
|
+
responses: ApiResponseDefinition[];
|
|
233
|
+
security: SecurityRequirement[];
|
|
234
|
+
deprecated: boolean;
|
|
235
|
+
metadata: EndpointMetadata;
|
|
236
|
+
}
|
|
237
|
+
interface ParameterDefinition {
|
|
238
|
+
name: string;
|
|
239
|
+
in: 'path' | 'query' | 'header' | 'cookie';
|
|
240
|
+
required: boolean;
|
|
241
|
+
schema: z.ZodSchema;
|
|
242
|
+
description?: string;
|
|
243
|
+
example?: unknown;
|
|
244
|
+
deprecated: boolean;
|
|
245
|
+
}
|
|
246
|
+
interface RequestBodyDefinition {
|
|
247
|
+
required: boolean;
|
|
248
|
+
description?: string;
|
|
249
|
+
content: MediaTypeDefinition[];
|
|
250
|
+
}
|
|
251
|
+
interface MediaTypeDefinition {
|
|
252
|
+
type: string;
|
|
253
|
+
schema: z.ZodSchema;
|
|
254
|
+
examples?: Record<string, unknown>;
|
|
255
|
+
}
|
|
256
|
+
interface ApiResponseDefinition {
|
|
257
|
+
statusCode: string;
|
|
258
|
+
description: string;
|
|
259
|
+
content?: MediaTypeDefinition[];
|
|
260
|
+
headers?: Record<string, ParameterDefinition>;
|
|
261
|
+
}
|
|
262
|
+
interface SchemaDefinition {
|
|
263
|
+
name: string;
|
|
264
|
+
schema: z.ZodSchema;
|
|
265
|
+
description?: string;
|
|
266
|
+
example?: unknown;
|
|
267
|
+
deprecated: boolean;
|
|
268
|
+
}
|
|
269
|
+
interface SecuritySchemeDefinition {
|
|
270
|
+
name: string;
|
|
271
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
272
|
+
scheme?: string;
|
|
273
|
+
bearerFormat?: string;
|
|
274
|
+
flows?: unknown;
|
|
275
|
+
}
|
|
276
|
+
interface ServerDefinition {
|
|
277
|
+
url: string;
|
|
278
|
+
description?: string;
|
|
279
|
+
variables?: Record<string, unknown>;
|
|
280
|
+
}
|
|
281
|
+
interface SchemaMetadata {
|
|
282
|
+
title: string;
|
|
283
|
+
version: string;
|
|
284
|
+
description?: string;
|
|
285
|
+
contact?: unknown;
|
|
286
|
+
license?: unknown;
|
|
287
|
+
externalDocs?: unknown;
|
|
288
|
+
timestamp: number;
|
|
289
|
+
}
|
|
290
|
+
interface EndpointMetadata {
|
|
291
|
+
requiresAuth: boolean;
|
|
292
|
+
cacheStrategy: CacheStrategy;
|
|
293
|
+
revalidationTags: string[];
|
|
294
|
+
rateLimit?: RateLimit;
|
|
295
|
+
timeout?: number;
|
|
296
|
+
streaming: boolean;
|
|
297
|
+
fileUpload: boolean;
|
|
298
|
+
}
|
|
299
|
+
interface SecurityRequirement {
|
|
300
|
+
[name: string]: string[];
|
|
301
|
+
}
|
|
302
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
303
|
+
type CacheStrategy = 'no-cache' | 'force-cache' | 'revalidate' | 'default';
|
|
304
|
+
interface RateLimit {
|
|
305
|
+
requests: number;
|
|
306
|
+
window: number;
|
|
307
|
+
}
|
|
308
|
+
interface GenerationContext {
|
|
309
|
+
config: BridgeConfiguration;
|
|
310
|
+
schema: ParsedApiSchema;
|
|
311
|
+
outputDir: string;
|
|
312
|
+
timestamp: number;
|
|
313
|
+
}
|
|
314
|
+
interface GeneratedFile {
|
|
315
|
+
path: string;
|
|
316
|
+
content: string;
|
|
317
|
+
type: 'typescript' | 'javascript' | 'json';
|
|
318
|
+
metadata?: FileMetadata;
|
|
319
|
+
}
|
|
320
|
+
interface FileMetadata {
|
|
321
|
+
exports: string[];
|
|
322
|
+
imports: string[];
|
|
323
|
+
dependencies: string[];
|
|
324
|
+
}
|
|
325
|
+
declare class BridgeError extends Error {
|
|
326
|
+
readonly code: string;
|
|
327
|
+
readonly details?: unknown;
|
|
328
|
+
constructor(message: string, code: string, details?: unknown);
|
|
329
|
+
}
|
|
330
|
+
declare class ValidationError extends BridgeError {
|
|
331
|
+
readonly errors: z.ZodError;
|
|
332
|
+
constructor(message: string, errors: z.ZodError);
|
|
333
|
+
}
|
|
334
|
+
declare class SchemaParseError extends BridgeError {
|
|
335
|
+
readonly schemaUrl: string;
|
|
336
|
+
constructor(message: string, schemaUrl: string);
|
|
337
|
+
}
|
|
338
|
+
declare class GenerationError extends BridgeError {
|
|
339
|
+
readonly file?: string;
|
|
340
|
+
constructor(message: string, file?: string);
|
|
341
|
+
}
|
|
342
|
+
interface BridgePlugin {
|
|
343
|
+
name: string;
|
|
344
|
+
version: string;
|
|
345
|
+
transform(content: string, context: GenerationContext): Promise<string>;
|
|
346
|
+
validate?(config: BridgeConfiguration): Promise<void>;
|
|
347
|
+
setup?(context: GenerationContext): Promise<void>;
|
|
348
|
+
cleanup?(context: GenerationContext): Promise<void>;
|
|
349
|
+
}
|
|
350
|
+
interface ClientConfiguration {
|
|
351
|
+
baseUrl: string;
|
|
352
|
+
timeout?: number;
|
|
353
|
+
retries?: number;
|
|
354
|
+
headers?: Record<string, string>;
|
|
355
|
+
auth?: {
|
|
356
|
+
type: 'bearer' | 'apiKey' | 'basic';
|
|
357
|
+
token?: string;
|
|
358
|
+
apiKey?: string;
|
|
359
|
+
username?: string;
|
|
360
|
+
password?: string;
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
interface RequestConfiguration extends Omit<RequestInit, 'cache' | 'priority'> {
|
|
364
|
+
timeout?: number;
|
|
365
|
+
retries?: number;
|
|
366
|
+
retryDelay?: number;
|
|
367
|
+
enableCache?: boolean;
|
|
368
|
+
deduplication?: boolean;
|
|
369
|
+
validation?: boolean;
|
|
370
|
+
requestCache?: RequestCache;
|
|
371
|
+
priority?: number;
|
|
372
|
+
circuitBreaker?: boolean;
|
|
373
|
+
streaming?: boolean;
|
|
374
|
+
compression?: boolean;
|
|
375
|
+
prefetch?: boolean;
|
|
376
|
+
background?: boolean;
|
|
377
|
+
/** Next.js 16: Cache tags for granular invalidation */
|
|
378
|
+
cacheTags?: string[];
|
|
379
|
+
/** Next.js 16: Connection type for persistent connections */
|
|
380
|
+
connection?: 'keep-alive' | 'close';
|
|
381
|
+
/** Next.js 16: Update cache tags dynamically */
|
|
382
|
+
updateTag?: (tag: string) => void;
|
|
383
|
+
}
|
|
384
|
+
interface ClientResponse<T = any> {
|
|
385
|
+
data: T;
|
|
386
|
+
status: number;
|
|
387
|
+
statusText: string;
|
|
388
|
+
headers: Headers;
|
|
389
|
+
cached?: boolean;
|
|
390
|
+
retryCount?: number;
|
|
391
|
+
responseTime?: number;
|
|
392
|
+
fromCache?: boolean;
|
|
393
|
+
compressed?: boolean;
|
|
394
|
+
etag?: string;
|
|
395
|
+
}
|
|
396
|
+
interface StreamingResponse<T = any> {
|
|
397
|
+
data: AsyncIterable<T>;
|
|
398
|
+
status: number;
|
|
399
|
+
statusText: string;
|
|
400
|
+
headers: Headers;
|
|
401
|
+
controller: AbortController;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
declare class BridgeCore {
|
|
405
|
+
private readonly logger;
|
|
406
|
+
private readonly schemaParser;
|
|
407
|
+
private readonly fileManager;
|
|
408
|
+
constructor();
|
|
409
|
+
generate(configuration: BridgeConfiguration): Promise<void>;
|
|
410
|
+
private validateConfiguration;
|
|
411
|
+
private generateFiles;
|
|
412
|
+
private writeFiles;
|
|
413
|
+
private logGenerationSummary;
|
|
414
|
+
validateSchema(schemaUrl: string): Promise<boolean>;
|
|
415
|
+
getSchemaInfo(schemaUrl: string): Promise<ParsedApiSchema['metadata']>;
|
|
416
|
+
clearCache(): void;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
declare class OpenApiSchemaParser {
|
|
420
|
+
private schemaCache;
|
|
421
|
+
parse(schemaUrl: string): Promise<ParsedApiSchema>;
|
|
422
|
+
private fetchSchema;
|
|
423
|
+
private parseDocument;
|
|
424
|
+
private detectVersion;
|
|
425
|
+
private normalizeDocument;
|
|
426
|
+
private convertV2ToV3;
|
|
427
|
+
private extractEndpoints;
|
|
428
|
+
private extractParameters;
|
|
429
|
+
private extractRequestBody;
|
|
430
|
+
private extractResponses;
|
|
431
|
+
private extractSchemas;
|
|
432
|
+
private extractSecurity;
|
|
433
|
+
private extractServers;
|
|
434
|
+
private extractMetadata;
|
|
435
|
+
private extractEndpointMetadata;
|
|
436
|
+
private hasFileUpload;
|
|
437
|
+
private resolveReference;
|
|
438
|
+
private convertSchemaToZod;
|
|
439
|
+
clearCache(): void;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
declare class ConfigurationLoader {
|
|
443
|
+
load(configPath?: string): Promise<BridgeConfiguration>;
|
|
444
|
+
createDefault(framework?: 'nextjs'): Promise<BridgeConfiguration>;
|
|
445
|
+
save(config: BridgeConfiguration, configPath?: string): Promise<void>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
interface FileOptions {
|
|
449
|
+
atomic?: boolean;
|
|
450
|
+
backup?: boolean;
|
|
451
|
+
encoding?: BufferEncoding;
|
|
452
|
+
}
|
|
453
|
+
declare class FileSystemManager {
|
|
454
|
+
writeFile(filePath: string, content: string, options?: FileOptions): Promise<void>;
|
|
455
|
+
readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
|
|
456
|
+
exists(filePath: string): Promise<boolean>;
|
|
457
|
+
getFileHash(filePath: string): Promise<string>;
|
|
458
|
+
removeDir(dirPath: string): Promise<void>;
|
|
459
|
+
findFiles(dir: string, pattern: RegExp, recursive?: boolean): Promise<string[]>;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
declare enum LogLevel {
|
|
463
|
+
DEBUG = 0,
|
|
464
|
+
INFO = 1,
|
|
465
|
+
WARN = 2,
|
|
466
|
+
ERROR = 3
|
|
467
|
+
}
|
|
468
|
+
interface LoggerOptions {
|
|
469
|
+
level?: LogLevel;
|
|
470
|
+
prefix?: string;
|
|
471
|
+
timestamp?: boolean;
|
|
472
|
+
colors?: boolean;
|
|
473
|
+
}
|
|
474
|
+
declare class BridgeLogger {
|
|
475
|
+
options: Required<LoggerOptions>;
|
|
476
|
+
constructor(options?: LoggerOptions);
|
|
477
|
+
private shouldLog;
|
|
478
|
+
private formatMessage;
|
|
479
|
+
debug(message: string, ...args: unknown[]): void;
|
|
480
|
+
info(message: string, ...args: unknown[]): void;
|
|
481
|
+
success(message: string, ...args: unknown[]): void;
|
|
482
|
+
warn(message: string, ...args: unknown[]): void;
|
|
483
|
+
error(message: string, ...args: unknown[]): void;
|
|
484
|
+
spinner(message: string): {
|
|
485
|
+
succeed: (msg?: string) => void;
|
|
486
|
+
fail: (msg?: string) => void;
|
|
487
|
+
stop: () => void;
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
interface VersionInfo {
|
|
492
|
+
current: string;
|
|
493
|
+
latest: string;
|
|
494
|
+
isOutdated: boolean;
|
|
495
|
+
updateAvailable: boolean;
|
|
496
|
+
}
|
|
497
|
+
type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'unknown';
|
|
498
|
+
declare class VersionChecker {
|
|
499
|
+
private logger;
|
|
500
|
+
private packageName;
|
|
501
|
+
private currentVersion;
|
|
502
|
+
private cache;
|
|
503
|
+
private readonly CACHE_DURATION;
|
|
504
|
+
constructor(packageName: string, currentVersion: string, logger?: BridgeLogger);
|
|
505
|
+
/**
|
|
506
|
+
* Check if a new version is available
|
|
507
|
+
*/
|
|
508
|
+
checkForUpdates(): Promise<VersionInfo | null>;
|
|
509
|
+
/**
|
|
510
|
+
* Detect the package manager being used
|
|
511
|
+
*/
|
|
512
|
+
detectPackageManager(): PackageManager;
|
|
513
|
+
/**
|
|
514
|
+
* Get the appropriate upgrade command for the detected package manager
|
|
515
|
+
*/
|
|
516
|
+
getUpgradeCommand(versionInfo: VersionInfo): string;
|
|
517
|
+
/**
|
|
518
|
+
* Get a user-friendly update message
|
|
519
|
+
*/
|
|
520
|
+
getUpdateMessage(versionInfo: VersionInfo): string;
|
|
521
|
+
/**
|
|
522
|
+
* Display update notification to user
|
|
523
|
+
*/
|
|
524
|
+
displayUpdateNotification(versionInfo: VersionInfo, options?: {
|
|
525
|
+
showIfUpToDate?: boolean;
|
|
526
|
+
force?: boolean;
|
|
527
|
+
professional?: boolean;
|
|
528
|
+
}): void;
|
|
529
|
+
/**
|
|
530
|
+
* Fetch the latest version from npm registry
|
|
531
|
+
*/
|
|
532
|
+
private fetchLatestVersion;
|
|
533
|
+
/**
|
|
534
|
+
* Compare two semantic versions
|
|
535
|
+
*/
|
|
536
|
+
private isVersionOutdated;
|
|
537
|
+
/**
|
|
538
|
+
* Parse semantic version string into array of numbers
|
|
539
|
+
*/
|
|
540
|
+
private parseVersion;
|
|
541
|
+
/**
|
|
542
|
+
* Get cached version info if available and not expired
|
|
543
|
+
*/
|
|
544
|
+
private getCachedVersion;
|
|
545
|
+
/**
|
|
546
|
+
* Cache version info
|
|
547
|
+
*/
|
|
548
|
+
private cacheVersion;
|
|
549
|
+
/**
|
|
550
|
+
* Clear version cache
|
|
551
|
+
*/
|
|
552
|
+
clearCache(): void;
|
|
553
|
+
/**
|
|
554
|
+
* Get current version
|
|
555
|
+
*/
|
|
556
|
+
getCurrentVersion(): string;
|
|
557
|
+
/**
|
|
558
|
+
* Get package name
|
|
559
|
+
*/
|
|
560
|
+
getPackageName(): string;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Create a version checker instance for the Mulink library
|
|
564
|
+
*/
|
|
565
|
+
declare function createBridgeVersionChecker(logger?: BridgeLogger): VersionChecker;
|
|
566
|
+
/**
|
|
567
|
+
* Check for updates and display notification
|
|
568
|
+
*/
|
|
569
|
+
declare function checkAndNotifyUpdates(options?: {
|
|
570
|
+
showIfUpToDate?: boolean;
|
|
571
|
+
force?: boolean;
|
|
572
|
+
professional?: boolean;
|
|
573
|
+
logger?: BridgeLogger;
|
|
574
|
+
}): Promise<VersionInfo | null>;
|
|
575
|
+
|
|
576
|
+
export { type ApiConfiguration as A, type BridgeConfiguration as B, ConfigurationLoader as C, type DevelopmentConfiguration as D, type EndpointMetadata as E, FileSystemManager as F, type GenerationContext as G, type HttpMethod as H, GenerationError as I, type ClientConfiguration as J, type RequestConfiguration as K, LogLevel as L, type ClientResponse as M, type StreamingResponse as N, OpenApiSchemaParser as O, type PluginConfiguration as P, type RequestBodyDefinition as R, type SchemaDefinition as S, VersionChecker as V, type GeneratedFile as a, BridgeCore as b, BridgeLogger as c, createBridgeVersionChecker as d, checkAndNotifyUpdates as e, type FrameworkConfiguration as f, type AuthConfiguration as g, type CacheConfiguration as h, type GenerationConfiguration as i, type OpenApiDocument as j, type ParsedApiSchema as k, type ApiEndpointDefinition as l, type ParameterDefinition as m, type ApiResponseDefinition as n, type SecuritySchemeDefinition as o, type ServerDefinition as p, type SchemaMetadata as q, type SecurityRequirement as r, type CacheStrategy as s, type RateLimit as t, type FileMetadata as u, type BridgePlugin as v, type VersionInfo as w, BridgeError as x, ValidationError as y, SchemaParseError as z };
|
package/package.json
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mulink",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Universal type-safe API integration library for modern web applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/lib/index.d.ts",
|
|
9
|
+
"import": "./dist/lib/index.js",
|
|
10
|
+
"require": "./dist/lib/index.cjs"
|
|
11
|
+
},
|
|
12
|
+
"./client": {
|
|
13
|
+
"types": "./dist/lib/client.d.ts",
|
|
14
|
+
"import": "./dist/lib/client.js",
|
|
15
|
+
"require": "./dist/lib/client.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./cli": {
|
|
18
|
+
"types": "./dist/lib/cli.d.ts",
|
|
19
|
+
"import": "./dist/lib/cli.js",
|
|
20
|
+
"require": "./dist/lib/cli.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/lib/index.cjs",
|
|
25
|
+
"module": "./dist/lib/index.js",
|
|
26
|
+
"types": "./dist/lib/index.d.ts",
|
|
27
|
+
"bin": {
|
|
28
|
+
"mulink": "./dist/lib/cli.cjs"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup",
|
|
32
|
+
"dev": "tsup --watch",
|
|
33
|
+
"test": "vitest",
|
|
34
|
+
"test:ui": "vitest --ui",
|
|
35
|
+
"test:coverage": "vitest --coverage",
|
|
36
|
+
"test:watch": "vitest --watch",
|
|
37
|
+
"lint": "eslint src/**/*.ts --fix",
|
|
38
|
+
"lint:check": "eslint src/**/*.ts",
|
|
39
|
+
"format": "prettier --write src/**/*.ts",
|
|
40
|
+
"format:check": "prettier --check src/**/*.ts",
|
|
41
|
+
"type-check": "tsc --noEmit",
|
|
42
|
+
"clean": "rimraf dist",
|
|
43
|
+
"prepublish": "npm run build",
|
|
44
|
+
"prepublishOnly": "npm run test && npm run lint && npm run type-check",
|
|
45
|
+
"release": "npm run build && npm publish",
|
|
46
|
+
"analyze": "ANALYZE=true npm run build"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"api",
|
|
50
|
+
"mulverse",
|
|
51
|
+
"Mohemed AlHabob",
|
|
52
|
+
"Obaidullah AlQurashi",
|
|
53
|
+
"mulink",
|
|
54
|
+
"typescript",
|
|
55
|
+
"codegen",
|
|
56
|
+
"openapi",
|
|
57
|
+
"rest",
|
|
58
|
+
"graphql",
|
|
59
|
+
"react",
|
|
60
|
+
"nextjs",
|
|
61
|
+
"vite",
|
|
62
|
+
"type-safety",
|
|
63
|
+
"developer-experience",
|
|
64
|
+
"code-generation",
|
|
65
|
+
"api-client"
|
|
66
|
+
],
|
|
67
|
+
"author": "Mohemed Alhabob",
|
|
68
|
+
"license": "MUV",
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "https://github.com/mulverseco/mulink"
|
|
72
|
+
},
|
|
73
|
+
"bugs": {
|
|
74
|
+
"url": "https://github.com/mulverseco/mulink/issues"
|
|
75
|
+
},
|
|
76
|
+
"homepage": "https://mulverse.com/projects/libraries/mulink",
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@apidevtools/swagger-parser": "^10.1.0",
|
|
79
|
+
"commander": "^11.1.0",
|
|
80
|
+
"lz-string": "^1.5.0",
|
|
81
|
+
"openapi-types": "^12.1.3",
|
|
82
|
+
"server-only": "^0.0.1",
|
|
83
|
+
"swagger2openapi": "^7.0.8",
|
|
84
|
+
"zod": "^3.0.0"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@types/eslint": "^9.6.1",
|
|
88
|
+
"@types/estree": "^1.0.8",
|
|
89
|
+
"@types/node": "^20.10.0",
|
|
90
|
+
"@types/swagger2openapi": "^7.0.4",
|
|
91
|
+
"@typescript-eslint/eslint-plugin": "^6.13.0",
|
|
92
|
+
"@typescript-eslint/parser": "^6.13.0",
|
|
93
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
94
|
+
"eslint": "^8.54.0",
|
|
95
|
+
"prettier": "^3.1.0",
|
|
96
|
+
"rimraf": "^5.0.10",
|
|
97
|
+
"tsup": "^8.5.0",
|
|
98
|
+
"typescript": "^5.3.0",
|
|
99
|
+
"vitest": "^1.0.0"
|
|
100
|
+
},
|
|
101
|
+
"peerDependencies": {
|
|
102
|
+
"@tanstack/react-query": "^5.0.0",
|
|
103
|
+
"next": ">=14.0.0 <17.0.0",
|
|
104
|
+
"react": ">=18.0.0",
|
|
105
|
+
"zod": "^3.0.0"
|
|
106
|
+
},
|
|
107
|
+
"peerDependenciesMeta": {
|
|
108
|
+
"@tanstack/react-query": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"next-auth": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"next-safe-action": {
|
|
115
|
+
"optional": true
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"files": [
|
|
119
|
+
"dist",
|
|
120
|
+
"README.md",
|
|
121
|
+
"LICENSE"
|
|
122
|
+
],
|
|
123
|
+
"engines": {
|
|
124
|
+
"node": ">=18.0.0"
|
|
125
|
+
}
|
|
126
|
+
}
|