mulink 1.1.0 → 1.1.2

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,7 @@ ${actions}`;
3465
3465
  parameterProcessing = "";
3466
3466
  requestOptionsParams = "";
3467
3467
  }
3468
- const parsedInputType = hasRequestBody || hasAnyParams ? `z.infer<typeof ${schemaName}>` : "void";
3468
+ const parsedInputType = hasRequestBody || hasAnyParams ? schemaName.includes("\n") ? `z.infer<typeof z.object({ body: ${operationName}RequestSchema, params: ${operationName}ParamsSchema })>` : `z.infer<typeof ${schemaName}>` : "void";
3469
3469
  const ctxType = requiresAuth || hasRateLimit ? "{ user?: any; ratelimit?: { remaining: number } }" : "any";
3470
3470
  const ctxDeclaration = requiresAuth || hasRateLimit ? `ctx: ${ctxType}` : "ctx?: any";
3471
3471
  const actionArgsType = `{ parsedInput: ${parsedInputType}; ${ctxDeclaration} }`;
@@ -3923,6 +3923,7 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3923
3923
 
3924
3924
  return useInfiniteQuery({
3925
3925
  queryKey: [...${queryKey}, 'infinite', searchParams],
3926
+ initialPageParam: 1,
3926
3927
  queryFn: async ({ pageParam = 1, signal }: { pageParam?: number; signal?: AbortSignal }) => {
3927
3928
  try {
3928
3929
  const result = await resolveActionResult<${returnType}>(${actionName}(${actionCallParams.replace(queryParamObject, "{ ...searchParams, page: pageParam, limit: searchParams.limit }")}))
@@ -3932,9 +3933,26 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3932
3933
  }
3933
3934
  },
3934
3935
  getNextPageParam: (lastPage: ${returnType}, allPages: ${returnType}[]) => {
3935
- if (lastPage?.hasMore || (Array.isArray(lastPage) && lastPage.length === searchParams.limit)) {
3936
+ // Check if response has pagination metadata
3937
+ if (lastPage && typeof lastPage === 'object' && 'hasMore' in lastPage && (lastPage as any).hasMore) {
3936
3938
  return allPages.length + 1
3937
3939
  }
3940
+ // Fallback: check if array length matches limit (suggesting more pages)
3941
+ if (Array.isArray(lastPage) && lastPage.length === searchParams.limit) {
3942
+ return allPages.length + 1
3943
+ }
3944
+ // Check if response has total and we haven't loaded all items
3945
+ if (lastPage && typeof lastPage === 'object' && 'total' in lastPage && Array.isArray((lastPage as any).files || (lastPage as any).items || lastPage)) {
3946
+ const items = (lastPage as any).files || (lastPage as any).items || lastPage
3947
+ const total = (lastPage as any).total || 0
3948
+ const loaded = allPages.reduce((sum, page) => {
3949
+ const pageItems = (page as any)?.files || (page as any)?.items || (Array.isArray(page) ? page : [])
3950
+ return sum + (Array.isArray(pageItems) ? pageItems.length : 0)
3951
+ }, 0)
3952
+ if (loaded < total) {
3953
+ return allPages.length + 1
3954
+ }
3955
+ }
3938
3956
  return undefined
3939
3957
  },
3940
3958
  staleTime: ${staleTime},
@@ -3943,9 +3961,7 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3943
3961
  refetchOnWindowFocus: true,
3944
3962
  refetchOnReconnect: true,
3945
3963
  refetchOnMount: 'always',
3946
- placeholderData: (previousData: ${returnType} | undefined) => previousData,
3947
3964
  retry: 3,
3948
- initialData: initialData as ${returnType} | undefined,
3949
3965
  ...restOptions
3950
3966
  })
3951
3967
  }
@@ -4388,13 +4404,13 @@ export function useBridgeInfiniteQuery<TData = unknown, TError = Error>(
4388
4404
  ) {
4389
4405
  return useInfiniteQuery<TData, TError>({
4390
4406
  queryKey,
4407
+ initialPageParam: 1,
4391
4408
  queryFn: queryFn as QueryFunction<TData, QueryKey>,
4392
4409
  staleTime: 5 * 60 * 1000,
4393
4410
  gcTime: 10 * 60 * 1000,
4394
4411
  refetchOnWindowFocus: true,
4395
4412
  refetchOnReconnect: true,
4396
4413
  refetchOnMount: 'always',
4397
- placeholderData: (previousData: TData | undefined) => previousData,
4398
4414
  retry: (failureCount: number, error: Error) => {
4399
4415
  if (error instanceof Error && error.message.includes('4')) return false
4400
4416
  return failureCount < 3
@@ -9735,5 +9751,5 @@ exports.VersionChecker = VersionChecker;
9735
9751
  exports.__name = __name;
9736
9752
  exports.checkAndNotifyUpdates = checkAndNotifyUpdates;
9737
9753
  exports.createBridgeVersionChecker = createBridgeVersionChecker;
9738
- //# sourceMappingURL=chunk-MBBHRJ7J.cjs.map
9739
- //# sourceMappingURL=chunk-MBBHRJ7J.cjs.map
9754
+ //# sourceMappingURL=chunk-LTXRMKAN.cjs.map
9755
+ //# sourceMappingURL=chunk-LTXRMKAN.cjs.map