@emeryld/rrroutes-client 2.6.12 → 2.7.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/README.md +1 -1
- package/dist/index.cjs +63 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +63 -25
- package/dist/index.mjs.map +1 -1
- package/dist/routesV3.client.types.d.ts +18 -4
- package/dist/sockets/socketedRoute/socket.client.helper.route.d.ts +2 -2
- package/package.json +1 -1
|
@@ -198,7 +198,21 @@ export type MutationBuildOptionsFor<L extends AnyLeafLowProfile> = Omit<UseMutat
|
|
|
198
198
|
};
|
|
199
199
|
/** Build options narrowed to the method/feed shape of the leaf. */
|
|
200
200
|
export type BuildOptionsFor<L extends AnyLeafLowProfile> = L['method'] extends 'get' ? L['cfg']['feed'] extends true ? InfiniteBuildOptionsFor<L> : QueryBuildOptionsFor<L> : MutationBuildOptionsFor<L>;
|
|
201
|
-
|
|
201
|
+
/** React Query call options for `useEndpoint` on plain GET leaves. */
|
|
202
|
+
export type QueryUseEndpointOptionsFor<L extends AnyLeafLowProfile> = Omit<UseQueryOptions<InferOutput<L>, unknown, InferOutput<L>, QueryKey>, 'queryKey' | 'queryFn'> & {
|
|
203
|
+
onReceive?: OnReceive<L>;
|
|
204
|
+
};
|
|
205
|
+
/** React Query call options for `useEndpoint` on feed GET leaves. */
|
|
206
|
+
export type InfiniteUseEndpointOptionsFor<L extends AnyLeafLowProfile> = Omit<UseInfiniteQueryOptions<InferOutput<L>, unknown, InfiniteData<InferOutput<L>>, QueryKey, Cursor>, 'queryKey' | 'queryFn' | 'getNextPageParam' | 'initialPageParam'> & {
|
|
207
|
+
onReceive?: OnReceive<L>;
|
|
208
|
+
};
|
|
209
|
+
/** React Query call options for `useEndpoint` on mutation leaves. */
|
|
210
|
+
export type MutationUseEndpointOptionsFor<L extends AnyLeafLowProfile> = Omit<UseMutationOptions<InferOutput<L>, unknown, InferBodyInput<L>, unknown>, 'mutationFn' | 'mutationKey'> & {
|
|
211
|
+
onReceive?: OnReceive<L>;
|
|
212
|
+
};
|
|
213
|
+
/** Runtime hook options narrowed to the method/feed shape of the leaf. */
|
|
214
|
+
export type UseEndpointOptionsFor<L extends AnyLeafLowProfile> = L['method'] extends 'get' ? L['cfg']['feed'] extends true ? InfiniteUseEndpointOptionsFor<L> : QueryUseEndpointOptionsFor<L> : MutationUseEndpointOptionsFor<L>;
|
|
215
|
+
export type UseEndpointArgs<L extends AnyLeafLowProfile> = keyof ArgsFor<L> extends never ? [options?: UseEndpointOptionsFor<L>] : [args: ArgsFor<L>, options?: UseEndpointOptionsFor<L>];
|
|
202
216
|
export type QueryUseEndpointResultFor<L extends AnyLeafLowProfile> = UseEndpointResult<L, UseQueryResult<InferOutput<L>, unknown>>;
|
|
203
217
|
export type InfiniteUseEndpointResultFor<L extends AnyLeafLowProfile> = UseEndpointResult<L, UseInfiniteQueryResult<InfiniteData<InferOutput<L>>, unknown>>;
|
|
204
218
|
export type MutationUseEndpointResultFor<L extends AnyLeafLowProfile> = UseEndpointResult<L, UseMutationResult<InferOutput<L>, unknown, InferBodyInput<L>, unknown>>;
|
|
@@ -226,7 +240,7 @@ export type BuiltCommon<L extends AnyLeafLowProfile> = {
|
|
|
226
240
|
export type BuiltQuery<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
|
|
227
241
|
/**
|
|
228
242
|
* React hook bound to the GET leaf.
|
|
229
|
-
* @param args Optional params/query
|
|
243
|
+
* @param args Optional params/query args, followed by optional React Query options.
|
|
230
244
|
*/
|
|
231
245
|
useEndpoint: (...args: UseEndpointArgs<L>) => QueryUseEndpointResultFor<L>;
|
|
232
246
|
/**
|
|
@@ -239,7 +253,7 @@ export type BuiltQuery<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
|
|
|
239
253
|
export type BuiltInfinite<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
|
|
240
254
|
/**
|
|
241
255
|
* React hook bound to an infinite GET leaf.
|
|
242
|
-
* @param args Optional params/query
|
|
256
|
+
* @param args Optional params/query args, followed by optional React Query options.
|
|
243
257
|
*/
|
|
244
258
|
useEndpoint: (...args: UseEndpointArgs<L>) => InfiniteUseEndpointResultFor<L>;
|
|
245
259
|
/**
|
|
@@ -252,7 +266,7 @@ export type BuiltInfinite<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
|
|
|
252
266
|
export type BuiltMutation<L extends AnyLeafLowProfile> = BuiltCommon<L> & {
|
|
253
267
|
/**
|
|
254
268
|
* React hook bound to a mutation leaf.
|
|
255
|
-
* @param args Optional params/query
|
|
269
|
+
* @param args Optional params/query args, followed by optional React Query options.
|
|
256
270
|
*/
|
|
257
271
|
useEndpoint: (...args: UseEndpointArgs<L>) => MutationUseEndpointResultFor<L>;
|
|
258
272
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyLeafLowProfile, EventMap, SocketConnectionConfigOutput, SocketEvent } from '@emeryld/rrroutes-contract';
|
|
2
|
-
import type { BuiltInfinite, BuiltQuery, DataShape, InfiniteUseEndpointResultFor, QueryUseEndpointResultFor, UseEndpointArgs } from '../../routesV3.client.types';
|
|
2
|
+
import type { ArgsFor, BuiltInfinite, BuiltQuery, DataShape, InfiniteUseEndpointResultFor, QueryUseEndpointResultFor, UseEndpointArgs } from '../../routesV3.client.types';
|
|
3
3
|
import type { ClientCtx, ServerEnvelope, SocketClient } from '../socket.client.core';
|
|
4
4
|
import { type SocketedRouteDebugOptions } from './socket.client.helper.debug';
|
|
5
5
|
import { type ToRoomsMapper } from './socket.client.helper.rooms';
|
|
@@ -10,10 +10,10 @@ export type SocketedRouteResult<L extends AnyLeafLowProfile> = (L['cfg']['feed']
|
|
|
10
10
|
export type ApplySocket<L extends AnyLeafLowProfile, S extends SocketEvent> = (args: {
|
|
11
11
|
prev: DataShape<L> | undefined;
|
|
12
12
|
payload: S['__out'];
|
|
13
|
+
args: ArgsFor<L> | undefined;
|
|
13
14
|
meta: {
|
|
14
15
|
envelope?: ServerEnvelope<S['__out']>;
|
|
15
16
|
ctx?: ClientCtx;
|
|
16
|
-
args: UseEndpointArgs<L>;
|
|
17
17
|
};
|
|
18
18
|
}) => DataShape<L> | undefined | null;
|
|
19
19
|
export type SocketedRouteOptions<L extends AnyLeafLowProfile, Events extends EventMap, C extends SocketConnectionConfigOutput> = {
|