mulink 1.1.4 → 1.1.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/dist/.tsbuildinfo +1 -1
- package/dist/lib/{chunk-FH22JEFH.cjs → chunk-KGPDAGXX.cjs} +44 -20
- package/dist/lib/chunk-KGPDAGXX.cjs.map +1 -0
- package/dist/lib/{chunk-ANAYISGK.js → chunk-UMUBEOOK.js} +44 -20
- package/dist/lib/chunk-UMUBEOOK.js.map +1 -0
- package/dist/lib/cli.cjs +16 -16
- package/dist/lib/cli.js +1 -1
- package/dist/lib/client.cjs +18 -18
- package/dist/lib/client.js +2 -2
- package/dist/lib/index.cjs +15 -15
- package/dist/lib/index.js +1 -1
- package/package.json +1 -1
- package/dist/lib/chunk-ANAYISGK.js.map +0 -1
- package/dist/lib/chunk-FH22JEFH.cjs.map +0 -1
|
@@ -3464,10 +3464,7 @@ ${actions}`;
|
|
|
3464
3464
|
parameterProcessing = "";
|
|
3465
3465
|
requestOptionsParams = "";
|
|
3466
3466
|
}
|
|
3467
|
-
const parsedInputType = hasRequestBody || hasAnyParams ? schemaName.includes("\n") ? `z.infer<typeof z.object({
|
|
3468
|
-
body: ${operationName}RequestSchema,
|
|
3469
|
-
params: ${operationName}ParamsSchema
|
|
3470
|
-
})>` : `z.infer<typeof ${schemaName}>` : "void";
|
|
3467
|
+
const parsedInputType = hasRequestBody || hasAnyParams ? schemaName.includes("\n") ? `z.infer<typeof z.object({ body: ${operationName}RequestSchema, params: ${operationName}ParamsSchema })>` : `z.infer<typeof ${schemaName}>` : "void";
|
|
3471
3468
|
const ctxType = requiresAuth || hasRateLimit ? "{ user?: any; ratelimit?: { remaining: number } }" : "any";
|
|
3472
3469
|
const ctxDeclaration = requiresAuth || hasRateLimit ? `ctx: ${ctxType}` : "ctx?: any";
|
|
3473
3470
|
const actionArgsType = `{
|
|
@@ -4401,8 +4398,8 @@ export function useBridgeQuery<TData = unknown, TError = Error>(
|
|
|
4401
4398
|
refetchOnWindowFocus: true,
|
|
4402
4399
|
refetchOnReconnect: true,
|
|
4403
4400
|
refetchOnMount: 'always',
|
|
4404
|
-
placeholderData: (previousData
|
|
4405
|
-
retry: (failureCount: number, error:
|
|
4401
|
+
placeholderData: (previousData) => previousData as TData | undefined,
|
|
4402
|
+
retry: (failureCount: number, error: TError) => {
|
|
4406
4403
|
if (error instanceof Error && error.message.includes('4')) return false
|
|
4407
4404
|
return failureCount < 3
|
|
4408
4405
|
},
|
|
@@ -4428,7 +4425,7 @@ export function useBridgeInfiniteQuery<TData = unknown, TError = Error>(
|
|
|
4428
4425
|
refetchOnWindowFocus: true,
|
|
4429
4426
|
refetchOnReconnect: true,
|
|
4430
4427
|
refetchOnMount: 'always',
|
|
4431
|
-
retry: (failureCount: number, error:
|
|
4428
|
+
retry: (failureCount: number, error: TError) => {
|
|
4432
4429
|
if (error instanceof Error && error.message.includes('4')) return false
|
|
4433
4430
|
return failureCount < 3
|
|
4434
4431
|
},
|
|
@@ -4450,7 +4447,7 @@ export function useBridgeSuspenseQuery<TData = unknown, TError = Error>(
|
|
|
4450
4447
|
queryFn: queryFn as QueryFunction<TData, QueryKey>,
|
|
4451
4448
|
staleTime: 5 * 60 * 1000,
|
|
4452
4449
|
gcTime: 10 * 60 * 1000,
|
|
4453
|
-
retry: (failureCount: number, error:
|
|
4450
|
+
retry: (failureCount: number, error: TError) => {
|
|
4454
4451
|
if (error instanceof Error && error.message.includes('4')) return false
|
|
4455
4452
|
return failureCount < 3
|
|
4456
4453
|
},
|
|
@@ -7632,7 +7629,7 @@ var UploadGenerator = class {
|
|
|
7632
7629
|
};
|
|
7633
7630
|
const presignedEndpoint = presignedEnabled ? this.findPresignedEndpoint(schema.endpoints) || (extractedUploadConfig.presignedEndpoint ? schema.endpoints.find((e) => e.path === extractedUploadConfig.presignedEndpoint) || null : null) : null;
|
|
7634
7631
|
generatedFiles.push(this.generateUploadUtilities(uploadProvider, uploadStrategy, presignedEndpoint));
|
|
7635
|
-
generatedFiles.push(this.generateUseUploadFileHook(uploadProvider, uploadStrategy));
|
|
7632
|
+
generatedFiles.push(this.generateUseUploadFileHook(uploadProvider, uploadStrategy, context));
|
|
7636
7633
|
for (const endpoint of uploadEndpoints) {
|
|
7637
7634
|
generatedFiles.push(this.generateUploadHook(
|
|
7638
7635
|
endpoint,
|
|
@@ -8281,8 +8278,19 @@ export function ${hookName}Upload(options?: {
|
|
|
8281
8278
|
const method = this.toPascalCase(endpoint.method.toLowerCase());
|
|
8282
8279
|
return [...pathParts, method].join("");
|
|
8283
8280
|
}
|
|
8284
|
-
generateUseUploadFileHook(uploadProvider, uploadStrategy) {
|
|
8281
|
+
generateUseUploadFileHook(uploadProvider, uploadStrategy, context) {
|
|
8285
8282
|
const uploadUtilsImport = this.buildImportPath("services/uploadUtils");
|
|
8283
|
+
const uploadEndpoints = context?.schema?.endpoints?.filter(
|
|
8284
|
+
(e) => e.metadata?.fileUpload || e.path.toLowerCase().includes("upload") || e.operationId && e.operationId.toLowerCase().includes("upload")
|
|
8285
|
+
) || [];
|
|
8286
|
+
const firstUploadEndpoint = uploadEndpoints[0];
|
|
8287
|
+
let uploadMethodName = "uploadFile";
|
|
8288
|
+
let uploadClientTag = "files";
|
|
8289
|
+
if (firstUploadEndpoint) {
|
|
8290
|
+
this.getOperationName(firstUploadEndpoint);
|
|
8291
|
+
uploadMethodName = toActionName(firstUploadEndpoint.operationId || firstUploadEndpoint.id);
|
|
8292
|
+
uploadClientTag = toValidIdentifier(firstUploadEndpoint.tags[0] || "files");
|
|
8293
|
+
}
|
|
8286
8294
|
const content = `'use client'
|
|
8287
8295
|
|
|
8288
8296
|
import { useMutation } from '@tanstack/react-query'
|
|
@@ -8328,13 +8336,21 @@ export function useUploadFile(options?: {
|
|
|
8328
8336
|
// Mulink will generate the upload endpoint from your OpenAPI schema
|
|
8329
8337
|
const { apiClient } = await import('${this.buildImportPath("client")}')
|
|
8330
8338
|
|
|
8331
|
-
// Try to find upload endpoint in
|
|
8339
|
+
// Try to find upload endpoint in generated client
|
|
8332
8340
|
try {
|
|
8333
|
-
|
|
8334
|
-
|
|
8341
|
+
${firstUploadEndpoint ? `
|
|
8342
|
+
// Use the detected upload endpoint
|
|
8343
|
+
const response = await apiClient.${uploadClientTag}?.${uploadMethodName}?.({
|
|
8344
|
+
body: formData as any,
|
|
8345
|
+
params: { query: {} }
|
|
8346
|
+
})` : `
|
|
8347
|
+
// Try common upload endpoint names
|
|
8348
|
+
const response = await apiClient.files?.uploadFileApiV1FilesUploadPost?.({
|
|
8349
|
+
body: formData as any,
|
|
8350
|
+
params: { query: {} }
|
|
8335
8351
|
}) || await apiClient.default?.uploadFile?.({
|
|
8336
8352
|
body: formData as any
|
|
8337
|
-
})
|
|
8353
|
+
})`}
|
|
8338
8354
|
return response?.data?.url || response?.data?.file_url || response?.data?.url || ''
|
|
8339
8355
|
} catch (error) {
|
|
8340
8356
|
console.warn('[Mulink] Upload endpoint not found in generated client, using fallback')
|
|
@@ -8347,13 +8363,21 @@ export function useUploadFile(options?: {
|
|
|
8347
8363
|
// Mulink will generate the upload endpoint from your OpenAPI schema
|
|
8348
8364
|
const { apiClient } = await import('${this.buildImportPath("client")}')
|
|
8349
8365
|
|
|
8350
|
-
// Try to find upload endpoint in
|
|
8366
|
+
// Try to find upload endpoint in generated client
|
|
8351
8367
|
try {
|
|
8352
|
-
|
|
8353
|
-
|
|
8368
|
+
${firstUploadEndpoint ? `
|
|
8369
|
+
// Use the detected upload endpoint
|
|
8370
|
+
const response = await apiClient.${uploadClientTag}?.${uploadMethodName}?.({
|
|
8371
|
+
body: formData as any,
|
|
8372
|
+
params: { query: {} }
|
|
8373
|
+
})` : `
|
|
8374
|
+
// Try common upload endpoint names
|
|
8375
|
+
const response = await apiClient.files?.uploadFileApiV1FilesUploadPost?.({
|
|
8376
|
+
body: formData as any,
|
|
8377
|
+
params: { query: {} }
|
|
8354
8378
|
}) || await apiClient.default?.uploadFile?.({
|
|
8355
8379
|
body: formData as any
|
|
8356
|
-
})
|
|
8380
|
+
})`}
|
|
8357
8381
|
return response?.data?.url || response?.data?.file_url || response?.data?.url || ''
|
|
8358
8382
|
} catch (error) {
|
|
8359
8383
|
console.warn('[Mulink] Upload endpoint not found in generated client, using fallback')
|
|
@@ -9754,5 +9778,5 @@ ${errorMessages}`,
|
|
|
9754
9778
|
};
|
|
9755
9779
|
|
|
9756
9780
|
export { BridgeCore, BridgeError, BridgeLogger, ConfigurationLoader, FileSystemManager, GenerationError, LogLevel, NextJsCodeGenerator, OpenApiSchemaParser, SchemaParseError, ValidationError, VersionChecker, __name, checkAndNotifyUpdates, createBridgeVersionChecker };
|
|
9757
|
-
//# sourceMappingURL=chunk-
|
|
9758
|
-
//# sourceMappingURL=chunk-
|
|
9781
|
+
//# sourceMappingURL=chunk-UMUBEOOK.js.map
|
|
9782
|
+
//# sourceMappingURL=chunk-UMUBEOOK.js.map
|