mulink 1.1.1 → 1.1.3

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.
@@ -3465,7 +3465,10 @@ ${actions}`;
3465
3465
  })>` : `z.infer<typeof ${schemaName}>` : "void";
3466
3466
  const ctxType = requiresAuth || hasRateLimit ? "{ user?: any; ratelimit?: { remaining: number } }" : "any";
3467
3467
  const ctxDeclaration = requiresAuth || hasRateLimit ? `ctx: ${ctxType}` : "ctx?: any";
3468
- const actionArgsType = `{ parsedInput: ${parsedInputType}; ${ctxDeclaration} }`;
3468
+ const actionArgsType = `{
3469
+ parsedInput: ${parsedInputType};
3470
+ ${ctxDeclaration}
3471
+ }`;
3469
3472
  const clientName = requiresAuth || hasRateLimit ? "authActionClient" : "actionClientWithMeta";
3470
3473
  const rateLimitCode = hasRateLimit ? `
3471
3474
  ${this.commentLine("Rate limiting", 6)} const { userAgent, ip } = await getClientInfo()
@@ -3852,6 +3855,7 @@ ${Object.keys(endpointsByTag).map((tag) => `export * from './${toValidIdentifier
3852
3855
  const staleTime = this.getStaleTime(endpoint);
3853
3856
  const pathParameters = endpoint.parameters.filter((parameter) => parameter.in === "path");
3854
3857
  const queryParameters = endpoint.parameters.filter((parameter) => parameter.in === "query");
3858
+ const hasPageParam = queryParameters.some((param) => param.name === "page");
3855
3859
  const hasSearchParams = endpoint.path.includes("search") || endpoint.path.includes("list");
3856
3860
  endpoint.parameters.length > 0;
3857
3861
  const parameterTypes = [];
@@ -3920,18 +3924,37 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3920
3924
 
3921
3925
  return useInfiniteQuery({
3922
3926
  queryKey: [...${queryKey}, 'infinite', searchParams],
3927
+ initialPageParam: 1,
3923
3928
  queryFn: async ({ pageParam = 1, signal }: { pageParam?: number; signal?: AbortSignal }) => {
3924
3929
  try {
3925
- const result = await resolveActionResult<${returnType}>(${actionName}(${actionCallParams.replace(queryParamObject, "{ ...searchParams, page: pageParam, limit: searchParams.limit }")}))
3930
+ const paginationParams = ${hasPageParam ? "{ ...searchParams, page: pageParam, limit: searchParams.limit }" : "{ ...searchParams, limit: searchParams.limit }"}
3931
+ const result = await resolveActionResult<${returnType}>(${actionName}(${actionCallParams.replace(queryParamObject, "paginationParams")}))
3926
3932
  return result
3927
3933
  } catch (error) {
3928
3934
  handleActionError(error)
3929
3935
  }
3930
3936
  },
3931
3937
  getNextPageParam: (lastPage: ${returnType}, allPages: ${returnType}[]) => {
3932
- if (lastPage?.hasMore || (Array.isArray(lastPage) && lastPage.length === searchParams.limit)) {
3938
+ // Check if response has pagination metadata
3939
+ if (lastPage && typeof lastPage === 'object' && 'hasMore' in lastPage && (lastPage as any).hasMore) {
3933
3940
  return allPages.length + 1
3934
3941
  }
3942
+ // Fallback: check if array length matches limit (suggesting more pages)
3943
+ if (Array.isArray(lastPage) && lastPage.length === searchParams.limit) {
3944
+ return allPages.length + 1
3945
+ }
3946
+ // Check if response has total and we haven't loaded all items
3947
+ if (lastPage && typeof lastPage === 'object' && 'total' in lastPage && Array.isArray((lastPage as any).files || (lastPage as any).items || lastPage)) {
3948
+ const items = (lastPage as any).files || (lastPage as any).items || lastPage
3949
+ const total = (lastPage as any).total || 0
3950
+ const loaded = allPages.reduce((sum, page) => {
3951
+ const pageItems = (page as any)?.files || (page as any)?.items || (Array.isArray(page) ? page : [])
3952
+ return sum + (Array.isArray(pageItems) ? pageItems.length : 0)
3953
+ }, 0)
3954
+ if (loaded < total) {
3955
+ return allPages.length + 1
3956
+ }
3957
+ }
3935
3958
  return undefined
3936
3959
  },
3937
3960
  staleTime: ${staleTime},
@@ -3940,9 +3963,7 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3940
3963
  refetchOnWindowFocus: true,
3941
3964
  refetchOnReconnect: true,
3942
3965
  refetchOnMount: 'always',
3943
- placeholderData: (previousData: ${returnType} | undefined) => previousData,
3944
3966
  retry: 3,
3945
- initialData: initialData as ${returnType} | undefined,
3946
3967
  ...restOptions
3947
3968
  })
3948
3969
  }
@@ -4385,13 +4406,13 @@ export function useBridgeInfiniteQuery<TData = unknown, TError = Error>(
4385
4406
  ) {
4386
4407
  return useInfiniteQuery<TData, TError>({
4387
4408
  queryKey,
4409
+ initialPageParam: 1,
4388
4410
  queryFn: queryFn as QueryFunction<TData, QueryKey>,
4389
4411
  staleTime: 5 * 60 * 1000,
4390
4412
  gcTime: 10 * 60 * 1000,
4391
4413
  refetchOnWindowFocus: true,
4392
4414
  refetchOnReconnect: true,
4393
4415
  refetchOnMount: 'always',
4394
- placeholderData: (previousData: TData | undefined) => previousData,
4395
4416
  retry: (failureCount: number, error: Error) => {
4396
4417
  if (error instanceof Error && error.message.includes('4')) return false
4397
4418
  return failureCount < 3
@@ -9718,5 +9739,5 @@ ${errorMessages}`,
9718
9739
  };
9719
9740
 
9720
9741
  export { BridgeCore, BridgeError, BridgeLogger, ConfigurationLoader, FileSystemManager, GenerationError, LogLevel, NextJsCodeGenerator, OpenApiSchemaParser, SchemaParseError, ValidationError, VersionChecker, __name, checkAndNotifyUpdates, createBridgeVersionChecker };
9721
- //# sourceMappingURL=chunk-ALNOUWFZ.js.map
9722
- //# sourceMappingURL=chunk-ALNOUWFZ.js.map
9742
+ //# sourceMappingURL=chunk-6SOQENFC.js.map
9743
+ //# sourceMappingURL=chunk-6SOQENFC.js.map