@emeryld/rrroutes-client 2.8.2 → 2.8.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.
@@ -1,13 +1,13 @@
1
1
  import { type AnyLeafLowProfile } from '@emeryld/rrroutes-contract';
2
2
  import { type QueryClient } from '@tanstack/react-query';
3
- import type { BranchBuildOptions, BuiltBranch, BuiltLeafMap, RRRoutesClientError, RouteClientFetch } from './routesV3.client.types';
3
+ import type { BranchBuildOptions, BuiltBranch, BuiltForLeaf, BuiltLeafMap, RouteClientFetch } from './routesV3.client.types';
4
4
  type BuildBatchBranchDeps = {
5
5
  fetchRaw: RouteClientFetch;
6
6
  queryClient: QueryClient;
7
7
  validateResponses: boolean;
8
- getBuiltLeaf: (built: unknown) => AnyLeafLowProfile;
8
+ getBuiltLeaf: (built: BuiltForLeaf<any>) => AnyLeafLowProfile;
9
9
  encodeLeafKey: (leaf: AnyLeafLowProfile) => string;
10
10
  toArgsTuple: (args: unknown) => unknown[];
11
11
  };
12
- export declare function buildBatchBranch<T extends BuiltLeafMap<TError>, TError = RRRoutesClientError>(leaves: T, options: BranchBuildOptions, deps: BuildBatchBranchDeps): BuiltBranch<T, TError>;
12
+ export declare function buildBatchBranch<T extends BuiltLeafMap>(leaves: T, options: BranchBuildOptions, deps: BuildBatchBranchDeps): BuiltBranch<T>;
13
13
  export {};
@@ -1,4 +1,4 @@
1
1
  import { type AnyLeafLowProfile } from '@emeryld/rrroutes-contract';
2
- import type { RRRoutesClientError, RouteClient, RouteClientOptions, RouterBuilder } from './routesV3.client.types';
3
- export declare function createRouteClient<Names extends string = string, TError = RRRoutesClientError>(opts: RouteClientOptions<Names>): RouteClient<Names, TError>;
4
- export declare function buildRouter<Routes extends Record<PropertyKey, AnyLeafLowProfile>, Names extends string = string, TError = RRRoutesClientError>(routeClient: RouteClient<Names, TError>, routes: Routes): RouterBuilder<Routes, Names, TError>;
2
+ import type { RouteClient, RouteClientOptions, RouterBuilder } from './routesV3.client.types';
3
+ export declare function createRouteClient<Names extends string = string>(opts: RouteClientOptions<Names>): RouteClient<Names>;
4
+ export declare function buildRouter<Routes extends Record<PropertyKey, AnyLeafLowProfile>, Names extends string = string>(routeClient: RouteClient<Names>, routes: Routes): RouterBuilder<Routes, Names>;
@@ -1,6 +1,6 @@
1
1
  import type { AnyLeafLowProfile } from '@emeryld/rrroutes-contract';
2
2
  import { type QueryClient } from '@tanstack/react-query';
3
- import type { BuiltQuery, Fetcher, QueryBuildOptionsFor, RRRoutesClientError, RouteClientDebugEvent } from './routesV3.client.types';
3
+ import type { BuiltQuery, Fetcher, QueryBuildOptionsFor, RouteClientDebugEvent } from './routesV3.client.types';
4
4
  type GetEnv = {
5
5
  baseUrl: string;
6
6
  validateResponses: boolean;
@@ -11,5 +11,5 @@ type GetEnv = {
11
11
  isVerboseDebug: boolean;
12
12
  leafLabel: string;
13
13
  };
14
- export declare function buildGetLeaf<L extends AnyLeafLowProfile, TError = RRRoutesClientError>(leaf: L, rqOpts: QueryBuildOptionsFor<L, TError> | undefined, env: GetEnv): BuiltQuery<L, TError>;
14
+ export declare function buildGetLeaf<L extends AnyLeafLowProfile>(leaf: L, rqOpts: QueryBuildOptionsFor<L> | undefined, env: GetEnv): BuiltQuery<L>;
15
15
  export {};
@@ -1,6 +1,6 @@
1
1
  import type { AnyLeafLowProfile } from '@emeryld/rrroutes-contract';
2
2
  import { type QueryClient } from '@tanstack/react-query';
3
- import type { BuiltInfinite, Fetcher, InfiniteBuildOptionsFor, RRRoutesClientError, RouteClientDebugEvent } from './routesV3.client.types';
3
+ import type { BuiltInfinite, Fetcher, InfiniteBuildOptionsFor, RouteClientDebugEvent } from './routesV3.client.types';
4
4
  type InfiniteEnv = {
5
5
  baseUrl: string;
6
6
  validateResponses: boolean;
@@ -11,5 +11,5 @@ type InfiniteEnv = {
11
11
  isVerboseDebug: boolean;
12
12
  leafLabel: string;
13
13
  };
14
- export declare function buildInfiniteGetLeaf<L extends AnyLeafLowProfile, TError = RRRoutesClientError>(leaf: L, rqOpts: InfiniteBuildOptionsFor<L, TError> | undefined, env: InfiniteEnv): BuiltInfinite<L, TError>;
14
+ export declare function buildInfiniteGetLeaf<L extends AnyLeafLowProfile>(leaf: L, rqOpts: InfiniteBuildOptionsFor<L> | undefined, env: InfiniteEnv): BuiltInfinite<L>;
15
15
  export {};
@@ -1,6 +1,6 @@
1
1
  import type { AnyLeafLowProfile } from '@emeryld/rrroutes-contract';
2
2
  import { type QueryClient } from '@tanstack/react-query';
3
- import type { BuiltMutation, Fetcher, MutationBuildOptionsFor, RRRoutesClientError, RouteClientDebugEvent } from './routesV3.client.types';
3
+ import type { BuiltMutation, Fetcher, MutationBuildOptionsFor, RouteClientDebugEvent } from './routesV3.client.types';
4
4
  type MutationEnv = {
5
5
  baseUrl: string;
6
6
  validateResponses: boolean;
@@ -11,5 +11,5 @@ type MutationEnv = {
11
11
  isVerboseDebug: boolean;
12
12
  leafLabel: string;
13
13
  };
14
- export declare function buildMutationLeaf<L extends AnyLeafLowProfile, TError = RRRoutesClientError>(leaf: L, rqOpts: MutationBuildOptionsFor<L, TError> | undefined, env: MutationEnv): BuiltMutation<L, TError>;
14
+ export declare function buildMutationLeaf<L extends AnyLeafLowProfile>(leaf: L, rqOpts: MutationBuildOptionsFor<L> | undefined, env: MutationEnv): BuiltMutation<L>;
15
15
  export {};
@@ -163,7 +163,7 @@ export type QueryKeysFor<L extends AnyLeafLowProfile, T extends ArgsTuple<L>> =
163
163
  QueryFromArgs<L, T> extends undefined ? {} : QueryFromArgs<L, T>
164
164
  ]>;
165
165
  /** React Query build options specialized for a plain GET leaf. */
166
- export type QueryBuildOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = Omit<UseQueryOptions<InferOutput<L>, TError, InferOutput<L>, QueryKey>, 'queryKey' | 'queryFn'> & {
166
+ export type QueryBuildOptionsFor<L extends AnyLeafLowProfile> = Omit<UseQueryOptions<InferOutput<L>, RRRoutesClientError, InferOutput<L>, QueryKey>, 'queryKey' | 'queryFn'> & {
167
167
  /** Hook invoked after a successful fetch + validation. */
168
168
  onReceive?: OnReceive<L>;
169
169
  };
@@ -196,36 +196,36 @@ type InfiniteBuildOnlyOptionsFor = {
196
196
  splitPageSizeParam?: string;
197
197
  };
198
198
  /** Build options for feed-style GET leaves (`cfg.feed === true`). */
199
- export type InfiniteBuildOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = Omit<UseInfiniteQueryOptions<InferOutput<L>, TError, InfiniteData<InferOutput<L>>, QueryKey, Cursor>, 'queryKey' | 'queryFn' | 'getNextPageParam' | 'initialPageParam'> & InfiniteFeedCursorOptionsFor<L> & InfiniteBuildOnlyOptionsFor & {
199
+ export type InfiniteBuildOptionsFor<L extends AnyLeafLowProfile> = Omit<UseInfiniteQueryOptions<InferOutput<L>, RRRoutesClientError, InfiniteData<InferOutput<L>>, QueryKey, Cursor>, 'queryKey' | 'queryFn' | 'getNextPageParam' | 'initialPageParam'> & InfiniteFeedCursorOptionsFor<L> & InfiniteBuildOnlyOptionsFor & {
200
200
  /** Hook invoked after a successful fetch + validation. */
201
201
  onReceive?: OnReceive<L>;
202
202
  };
203
203
  /** Build options for mutation leaves (non-GET). */
204
- export type MutationBuildOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = Omit<UseMutationOptions<InferOutput<L>, TError, InferBodyInput<L>, unknown>, 'mutationFn' | 'mutationKey'> & {
204
+ export type MutationBuildOptionsFor<L extends AnyLeafLowProfile> = Omit<UseMutationOptions<InferOutput<L>, RRRoutesClientError, InferBodyInput<L>, unknown>, 'mutationFn' | 'mutationKey'> & {
205
205
  /** Hook invoked after a successful fetch + validation. */
206
206
  onReceive?: OnReceive<L>;
207
207
  };
208
208
  /** Build options narrowed to the method/feed shape of the leaf. */
209
- export type BuildOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = L['method'] extends 'get' ? L['cfg']['feed'] extends true ? InfiniteBuildOptionsFor<L, TError> : QueryBuildOptionsFor<L, TError> : MutationBuildOptionsFor<L, TError>;
209
+ export type BuildOptionsFor<L extends AnyLeafLowProfile> = L['method'] extends 'get' ? L['cfg']['feed'] extends true ? InfiniteBuildOptionsFor<L> : QueryBuildOptionsFor<L> : MutationBuildOptionsFor<L>;
210
210
  /** React Query call options for `useEndpoint` on plain GET leaves. */
211
- export type QueryUseEndpointOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = Omit<UseQueryOptions<InferOutput<L>, TError, InferOutput<L>, QueryKey>, 'queryKey' | 'queryFn'> & {
211
+ export type QueryUseEndpointOptionsFor<L extends AnyLeafLowProfile> = Omit<UseQueryOptions<InferOutput<L>, RRRoutesClientError, InferOutput<L>, QueryKey>, 'queryKey' | 'queryFn'> & {
212
212
  onReceive?: OnReceive<L>;
213
213
  };
214
214
  /** React Query call options for `useEndpoint` on feed GET leaves. */
215
- export type InfiniteUseEndpointOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = Omit<UseInfiniteQueryOptions<InferOutput<L>, TError, InfiniteData<InferOutput<L>>, QueryKey, Cursor>, 'queryKey' | 'queryFn' | 'getNextPageParam' | 'initialPageParam'> & {
215
+ export type InfiniteUseEndpointOptionsFor<L extends AnyLeafLowProfile> = Omit<UseInfiniteQueryOptions<InferOutput<L>, RRRoutesClientError, InfiniteData<InferOutput<L>>, QueryKey, Cursor>, 'queryKey' | 'queryFn' | 'getNextPageParam' | 'initialPageParam'> & {
216
216
  /** Hook invoked after a successful fetch + validation. */
217
217
  onReceive?: OnReceive<L>;
218
218
  } & InfiniteFeedCursorOptionsFor<L>;
219
219
  /** React Query call options for `useEndpoint` on mutation leaves. */
220
- export type MutationUseEndpointOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = Omit<UseMutationOptions<InferOutput<L>, TError, InferBodyInput<L>, unknown>, 'mutationFn' | 'mutationKey'> & {
220
+ export type MutationUseEndpointOptionsFor<L extends AnyLeafLowProfile> = Omit<UseMutationOptions<InferOutput<L>, RRRoutesClientError, InferBodyInput<L>, unknown>, 'mutationFn' | 'mutationKey'> & {
221
221
  onReceive?: OnReceive<L>;
222
222
  };
223
223
  /** Runtime hook options narrowed to the method/feed shape of the leaf. */
224
- export type UseEndpointOptionsFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = L['method'] extends 'get' ? L['cfg']['feed'] extends true ? InfiniteUseEndpointOptionsFor<L, TError> : QueryUseEndpointOptionsFor<L, TError> : MutationUseEndpointOptionsFor<L, TError>;
225
- export type UseEndpointArgs<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = keyof ArgsFor<L> extends never ? [options?: UseEndpointOptionsFor<L, TError>] : [args: ArgsFor<L>, options?: UseEndpointOptionsFor<L, TError>];
226
- export type QueryUseEndpointResultFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = UseEndpointResult<L, UseQueryResult<InferOutput<L>, TError>>;
227
- export type InfiniteUseEndpointResultFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = UseEndpointResult<L, UseInfiniteQueryResult<InfiniteData<InferOutput<L>>, TError>>;
228
- export type MutationUseEndpointResultFor<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = UseEndpointResult<L, UseMutationResult<InferOutput<L>, TError, InferBodyInput<L>, unknown>>;
224
+ export type UseEndpointOptionsFor<L extends AnyLeafLowProfile> = L['method'] extends 'get' ? L['cfg']['feed'] extends true ? InfiniteUseEndpointOptionsFor<L> : QueryUseEndpointOptionsFor<L> : MutationUseEndpointOptionsFor<L>;
225
+ export type UseEndpointArgs<L extends AnyLeafLowProfile> = keyof ArgsFor<L> extends never ? [options?: UseEndpointOptionsFor<L>] : [args: ArgsFor<L>, options?: UseEndpointOptionsFor<L>];
226
+ export type QueryUseEndpointResultFor<L extends AnyLeafLowProfile> = UseEndpointResult<L, UseQueryResult<InferOutput<L>, RRRoutesClientError>>;
227
+ export type InfiniteUseEndpointResultFor<L extends AnyLeafLowProfile> = UseEndpointResult<L, UseInfiniteQueryResult<InfiniteData<InferOutput<L>>, RRRoutesClientError>>;
228
+ export type MutationUseEndpointResultFor<L extends AnyLeafLowProfile> = UseEndpointResult<L, UseMutationResult<InferOutput<L>, RRRoutesClientError, InferBodyInput<L>, unknown>>;
229
229
  /** Shared capabilities exposed by every built endpoint helper. */
230
230
  export type BuiltCommon<L extends AnyLeafLowProfile> = {
231
231
  /**
@@ -245,14 +245,16 @@ export type BuiltCommon<L extends AnyLeafLowProfile> = {
245
245
  * @param rest Optional params/query tuple for the leaf.
246
246
  */
247
247
  setData: (...args: SetDataArgs<L>) => DataShape<L> | undefined;
248
+ /** Type-only metadata preserved on built leaves for inference/introspection. */
249
+ __rrroutesLeaf: L;
248
250
  };
249
251
  /** Hook+helpers for a standard GET endpoint. */
250
- export type BuiltQuery<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = BuiltCommon<L> & {
252
+ export type BuiltQuery<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
251
253
  /**
252
254
  * React hook bound to the GET leaf.
253
255
  * @param args Optional params/query args, followed by optional React Query options.
254
256
  */
255
- useEndpoint: (...args: UseEndpointArgs<L, TError>) => QueryUseEndpointResultFor<L, TError>;
257
+ useEndpoint: (...args: UseEndpointArgs<L>) => QueryUseEndpointResultFor<L>;
256
258
  /**
257
259
  * Direct fetch helper mirroring the query hook without touching the cache.
258
260
  * @param args Optional params/query tuple for the leaf.
@@ -260,12 +262,12 @@ export type BuiltQuery<L extends AnyLeafLowProfile, TError = RRRoutesClientError
260
262
  fetch: (...args: QueryFetchArgs<L>) => Promise<InferOutput<L>>;
261
263
  };
262
264
  /** Hook+helpers for a cursor-paginated GET endpoint. */
263
- export type BuiltInfinite<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = BuiltCommon<L> & {
265
+ export type BuiltInfinite<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
264
266
  /**
265
267
  * React hook bound to an infinite GET leaf.
266
268
  * @param args Optional params/query args, followed by optional React Query options.
267
269
  */
268
- useEndpoint: (...args: UseEndpointArgs<L, TError>) => InfiniteUseEndpointResultFor<L, TError>;
270
+ useEndpoint: (...args: UseEndpointArgs<L>) => InfiniteUseEndpointResultFor<L>;
269
271
  /**
270
272
  * Direct fetch helper for a single page of the feed (pass cursor in query args).
271
273
  * @param args Optional params/query tuple for the leaf.
@@ -273,12 +275,12 @@ export type BuiltInfinite<L extends AnyLeafLowProfile, TError = RRRoutesClientEr
273
275
  fetch: (...args: QueryFetchArgs<L>) => Promise<InferOutput<L>>;
274
276
  };
275
277
  /** Hook+helpers for non-GET endpoints (mutations). */
276
- export type BuiltMutation<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = BuiltCommon<L> & {
278
+ export type BuiltMutation<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
277
279
  /**
278
280
  * React hook bound to a mutation leaf.
279
281
  * @param args Optional params/query args, followed by optional React Query options.
280
282
  */
281
- useEndpoint: (...args: UseEndpointArgs<L, TError>) => MutationUseEndpointResultFor<L, TError>;
283
+ useEndpoint: (...args: UseEndpointArgs<L>) => MutationUseEndpointResultFor<L>;
282
284
  /**
283
285
  * Direct fetch helper that bypasses React Query, useful for server actions or scripts.
284
286
  * Pass params/query first (if required), followed by the body payload.
@@ -286,64 +288,59 @@ export type BuiltMutation<L extends AnyLeafLowProfile, TError = RRRoutesClientEr
286
288
  fetch: MutationFetcher<L>;
287
289
  };
288
290
  /** Type-safe union that resolves to the correct built helper for a leaf. */
289
- type BuiltLeafMetadata<L extends AnyLeafLowProfile> = {
290
- metadata: {
291
- leaf: L;
292
- };
293
- };
294
- /** Type-safe union that resolves to the correct built helper for a leaf. */
295
- export type BuiltForLeaf<L extends AnyLeafLowProfile, TError = RRRoutesClientError> = (L['method'] extends 'get' ? L['cfg']['feed'] extends true ? BuiltInfinite<L, TError> : BuiltQuery<L, TError> : BuiltMutation<L, TError>) & BuiltLeafMetadata<L>;
291
+ export type BuiltForLeaf<L extends AnyLeafLowProfile> = L['method'] extends 'get' ? L['cfg']['feed'] extends true ? BuiltInfinite<L> : BuiltQuery<L> : BuiltMutation<L>;
296
292
  type LeafFromBuilt<B> = B extends BuiltForLeaf<infer L> ? L : AnyLeafLowProfile;
297
293
  type SetDataUpdaterFromBuilt<B> = B extends {
298
294
  setData: (updater: infer U, ...args: any[]) => any;
299
295
  } ? U : never;
300
- export type BuiltLeafLike<TError = RRRoutesClientError> = {
296
+ export type BuiltLeafLike = {
301
297
  getQueryKeys: (...args: any[]) => any;
302
298
  invalidate: (...args: any[]) => Promise<void>;
303
299
  setData: (...args: any[]) => any;
304
300
  useEndpoint: (...args: any[]) => any;
305
301
  fetch: (...args: any[]) => Promise<any>;
302
+ __rrroutesLeaf: AnyLeafLowProfile;
306
303
  };
307
- export type BuiltLeafMap<TError = RRRoutesClientError> = Record<string, BuiltLeafLike<TError>>;
304
+ export type BuiltLeafMap = Record<string, BuiltLeafLike>;
308
305
  /** Per-leaf request shape sent to the batch endpoint. */
309
306
  export type BranchFetchInputForLeaf<L extends AnyLeafLowProfile> = Prettify<(keyof ArgsFor<L> extends never ? {} : ArgsFor<L>) & (InferBodyInput<L> extends never ? {} : {
310
307
  body?: InferBodyInput<L>;
311
308
  })>;
312
309
  /** Input payload keyed by alias for branch.fetch/useEndpoint calls. */
313
- export type BranchFetchInput<T extends BuiltLeafMap<any>> = {
310
+ export type BranchFetchInput<T extends BuiltLeafMap> = {
314
311
  [K in keyof T]: BranchFetchInputForLeaf<LeafFromBuilt<T[K]>>;
315
312
  };
316
313
  /** Optional args map for cache-key/invalidation helpers across a branch. */
317
- export type BranchArgsInput<T extends BuiltLeafMap<any>> = Partial<{
314
+ export type BranchArgsInput<T extends BuiltLeafMap> = Partial<{
318
315
  [K in keyof T]: ArgsFor<LeafFromBuilt<T[K]>>;
319
316
  }>;
320
317
  /** Branch fetch output keyed by alias. */
321
- export type BranchFetchOutput<T extends BuiltLeafMap<any>> = {
318
+ export type BranchFetchOutput<T extends BuiltLeafMap> = {
322
319
  [K in keyof T]: Awaited<ReturnType<T[K]['fetch']>>;
323
320
  };
324
321
  /** Per-leaf query keys keyed by alias. */
325
- export type BranchQueryKeysOutput<T extends BuiltLeafMap<any>> = {
322
+ export type BranchQueryKeysOutput<T extends BuiltLeafMap> = {
326
323
  [K in keyof T]: ReturnType<T[K]['getQueryKeys']>;
327
324
  };
328
325
  /** Input payload for branch.setData keyed by alias. */
329
- export type BranchSetDataInput<T extends BuiltLeafMap<any>> = Partial<{
326
+ export type BranchSetDataInput<T extends BuiltLeafMap> = Partial<{
330
327
  [K in keyof T]: {
331
328
  updater: SetDataUpdaterFromBuilt<T[K]>;
332
329
  args?: ArgsFor<LeafFromBuilt<T[K]>>;
333
330
  };
334
331
  }>;
335
332
  /** Output of branch.setData keyed by alias. */
336
- export type BranchSetDataOutput<T extends BuiltLeafMap<any>> = Partial<{
333
+ export type BranchSetDataOutput<T extends BuiltLeafMap> = Partial<{
337
334
  [K in keyof T]: ReturnType<T[K]['setData']>;
338
335
  }>;
339
- type BranchOnReceive<T extends BuiltLeafMap<any>> = (data: BranchFetchOutput<T>) => void;
340
- type BranchOnReceiveRegistrar<T extends BuiltLeafMap<any>> = (listener: BranchOnReceive<T>) => () => void;
336
+ type BranchOnReceive<T extends BuiltLeafMap> = (data: BranchFetchOutput<T>) => void;
337
+ type BranchOnReceiveRegistrar<T extends BuiltLeafMap> = (listener: BranchOnReceive<T>) => () => void;
341
338
  /** React Query options for branch.useEndpoint. */
342
- export type BranchUseEndpointOptions<T extends BuiltLeafMap<any>, TError = RRRoutesClientError> = Omit<UseQueryOptions<BranchFetchOutput<T>, TError, BranchFetchOutput<T>, QueryKey>, 'queryKey' | 'queryFn'> & {
339
+ export type BranchUseEndpointOptions<T extends BuiltLeafMap> = Omit<UseQueryOptions<BranchFetchOutput<T>, RRRoutesClientError, BranchFetchOutput<T>, QueryKey>, 'queryKey' | 'queryFn'> & {
343
340
  onReceive?: BranchOnReceive<T>;
344
341
  };
345
342
  /** Result returned by branch.useEndpoint. */
346
- export type BranchUseEndpointResult<T extends BuiltLeafMap<any>, TError = RRRoutesClientError> = UseQueryResult<BranchFetchOutput<T>, TError> & {
343
+ export type BranchUseEndpointResult<T extends BuiltLeafMap> = UseQueryResult<BranchFetchOutput<T>, RRRoutesClientError> & {
347
344
  onReceive: BranchOnReceiveRegistrar<T>;
348
345
  };
349
346
  /** Configuration for branch helpers that call a server batch endpoint. */
@@ -356,15 +353,15 @@ export type BranchBuildOptions = {
356
353
  headers?: Record<string, string>;
357
354
  };
358
355
  /** Batched helper surface built from a record of built endpoints. */
359
- export type BuiltBranch<T extends BuiltLeafMap<any>, TError = RRRoutesClientError> = {
356
+ export type BuiltBranch<T extends BuiltLeafMap> = {
360
357
  fetch: (input: BranchFetchInput<T>) => Promise<BranchFetchOutput<T>>;
361
- useEndpoint: (input: BranchFetchInput<T>, options?: BranchUseEndpointOptions<T, TError>) => BranchUseEndpointResult<T, TError>;
358
+ useEndpoint: (input: BranchFetchInput<T>, options?: BranchUseEndpointOptions<T>) => BranchUseEndpointResult<T>;
362
359
  getQueryKeys: (input?: BranchArgsInput<T>) => BranchQueryKeysOutput<T>;
363
360
  invalidate: (input?: BranchArgsInput<T>) => Promise<void>;
364
361
  setData: (input: BranchSetDataInput<T>) => BranchSetDataOutput<T>;
365
362
  };
366
363
  /** Public surface returned by `createRouteClient`. */
367
- export type RouteClient<Names extends string = string, TError = RRRoutesClientError> = {
364
+ export type RouteClient<Names extends string = string> = {
368
365
  /**
369
366
  * Invalidate by a key prefix (e.g., ['get','api','users']).
370
367
  * @param prefix Key parts shared by matching endpoints.
@@ -372,11 +369,11 @@ export type RouteClient<Names extends string = string, TError = RRRoutesClientEr
372
369
  */
373
370
  invalidate: (prefix: string[], exact?: boolean) => Promise<void>;
374
371
  /** Build a typed endpoint from a leaf. */
375
- build: <L extends AnyLeafLowProfile>(leaf: L, opts?: BuildOptionsFor<L, TError>,
372
+ build: <L extends AnyLeafLowProfile>(leaf: L, opts?: BuildOptionsFor<L>,
376
373
  /** Optional metadata (third arg) to assign a debug name for filtering via `debug.only`. */
377
- meta?: BuildMeta<Names>) => BuiltForLeaf<L, TError>;
374
+ meta?: BuildMeta<Names>) => BuiltForLeaf<L>;
378
375
  /** Build a batched helper from already-built endpoint helpers. */
379
- buildBranch: <T extends BuiltLeafMap<TError>>(leaves: T, options: BranchBuildOptions) => BuiltBranch<T, TError>;
376
+ buildBranch: <T extends BuiltLeafMap>(leaves: T, options: BranchBuildOptions) => BuiltBranch<T>;
380
377
  /** Underlying React Query client (exposed for advanced scenarios). */
381
378
  queryClient: QueryClient;
382
379
  /**
@@ -389,7 +386,7 @@ export type RouteClient<Names extends string = string, TError = RRRoutesClientEr
389
386
  * Helper signature returned by `buildRouter`, enabling lookups by name instead of leaves.
390
387
  * Accepts the same build options/meta the underlying client does, narrowed per leaf shape.
391
388
  */
392
- export type RouterBuilder<Routes extends Record<PropertyKey, AnyLeafLowProfile>, Names extends string = string, TError = RRRoutesClientError> = <K extends keyof Routes>(key: K, opts?: BuildOptionsFor<Routes[K], TError>, meta?: BuildMeta<Names>) => BuiltForLeaf<Routes[K], TError>;
389
+ export type RouterBuilder<Routes extends Record<PropertyKey, AnyLeafLowProfile>, Names extends string = string> = <K extends keyof Routes>(key: K, opts?: BuildOptionsFor<Routes[K]>, meta?: BuildMeta<Names>) => BuiltForLeaf<Routes[K]>;
393
390
  /**
394
391
  * Arguments for the low-level RouteClient.fetch helper.
395
392
  * This is intentionally NOT tied to AnyLeafLowProfile.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/rrroutes-client",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",