@tuyau/react-query 0.0.1-next.2 → 1.0.0-beta.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.
Files changed (3) hide show
  1. package/build/index.d.ts +116 -268
  2. package/build/index.js +136 -233
  3. package/package.json +12 -16
package/build/index.d.ts CHANGED
@@ -1,100 +1,108 @@
1
- import { IsNever } from '@tuyau/utils/types';
2
- import { SkipToken, DataTag, QueryFilters, UseMutationOptions, DefinedInitialDataOptions, UnusedSkipTokenOptions, UndefinedInitialDataOptions, DefinedInitialDataInfiniteOptions, UnusedSkipTokenInfiniteOptions, UndefinedInitialDataInfiniteOptions, QueryClient } from '@tanstack/react-query';
3
- import { GeneratedRoutes, TuyauClient, QueryParameters, ApiDefinition } from '@tuyau/client';
4
- import * as React from 'react';
1
+ import { AdonisEndpoint, RawRequestArgs, Method, UnionToIntersection, StrKeys, Split } from '@tuyau/core/types';
2
+ import * as _tanstack_react_query from '@tanstack/react-query';
3
+ import { SkipToken, DataTag, QueryFilters, WithRequired as WithRequired$1, UseMutationOptions, InfiniteData, InfiniteQueryObserverOptions, DefinedInitialDataOptions, UndefinedInitialDataOptions, UnusedSkipTokenOptions, QueryClient } from '@tanstack/react-query';
4
+ import { Tuyau } from '@tuyau/core/client';
5
5
 
6
6
  /**
7
- * Type definition for query options with overloads for different scenarios
7
+ * Decorate query endpoints with Tanstack queries abilities
8
8
  */
9
- interface TuyauReactQueryOptions<EDef extends EndpointDef, TParams = Record<string, string | number>> {
10
- <TData = UnionFromSuccessStatuses<EDef['response']>>(input: {
11
- payload?: EDef['request'];
12
- params?: TParams;
13
- } | SkipToken, opts: DefinedTuyauQueryOptionsIn<UnionFromSuccessStatuses<EDef['response']>, TData, any>): DefinedTuyauQueryOptionsOut<UnionFromSuccessStatuses<EDef['response']>, TData, any>;
14
- <TData = UnionFromSuccessStatuses<EDef['response']>>(input: {
15
- payload?: EDef['request'];
16
- params?: TParams;
17
- }, opts?: UnusedSkipTokenTuyauQueryOptionsIn<UnionFromSuccessStatuses<EDef['response']>, TData, any>): UnusedSkipTokenTuyauQueryOptionsOut<UnionFromSuccessStatuses<EDef['response']>, TData, any>;
18
- <TData = UnionFromSuccessStatuses<EDef['response']>>(input?: {
19
- payload?: EDef['request'];
20
- params?: TParams;
21
- } | SkipToken, opts?: UndefinedTuyauQueryOptionsIn<UnionFromSuccessStatuses<EDef['response']>, TData, any>): UndefinedTuyauQueryOptionsOut<UnionFromSuccessStatuses<EDef['response']>, TData, any>;
9
+ interface DecorateQueryFn<EDef extends AdonisEndpoint> extends TypeHelper<EDef> {
10
+ queryOptions: TuyauReactQueryOptions<EDef>;
11
+ queryKey: (args?: RawRequestArgs<EDef>) => DataTag<TuyauQueryKey, EDef['types']['response']>;
12
+ queryFilter: (args?: RawRequestArgs<EDef>, filters?: QueryFilters<DataTag<TuyauQueryKey, EDef['types']['response']>>) => WithRequired$1<QueryFilters<DataTag<TuyauQueryKey, EDef['types']['response']>>, 'queryKey'>;
22
13
  }
23
14
  /**
24
- * Interface for query function decorators
15
+ * Type definition for query options with overloads for different scenarios
25
16
  */
26
- interface DecorateQueryFn<EDef extends EndpointDef, TParams = Record<string, string | number>> extends TypeHelper<EDef> {
27
- queryOptions: TuyauReactQueryOptions<EDef, TParams>;
28
- queryKey: (input?: {
29
- payload?: Partial<EDef['request']>;
30
- params?: TParams;
31
- }) => DataTag<TuyauQueryKey, UnionFromSuccessStatuses<EDef['response']>, any>;
32
- queryFilter: (input?: {
33
- payload?: Partial<EDef['request']>;
34
- params?: TParams;
35
- }, filters?: QueryFilters<DataTag<TuyauQueryKey, UnionFromSuccessStatuses<EDef['response']>, any>>) => WithRequired<QueryFilters<DataTag<TuyauQueryKey, UnionFromSuccessStatuses<EDef['response']>, any>>, 'queryKey'>;
17
+ interface TuyauReactQueryOptions<EDef extends AdonisEndpoint> {
18
+ <TData = EDef['types']['response']>(input: RawRequestArgs<EDef> | SkipToken, opts: DefinedTuyauQueryOptionsIn<EDef['types']['response'], TData, unknown>): DefinedTuyauQueryOptionsOut<EDef['types']['response'], TData, unknown>;
19
+ <TData = EDef['types']['response']>(input: RawRequestArgs<EDef>, opts?: UnusedSkipTokenTuyauQueryOptionsIn<EDef['types']['response'], TData, unknown>): UnusedSkipTokenTuyauQueryOptionsOut<EDef['types']['response'], TData, unknown>;
20
+ <TData = EDef['types']['response']>(input?: RawRequestArgs<EDef> | SkipToken, opts?: UndefinedTuyauQueryOptionsIn<EDef['types']['response'], TData, unknown>): UndefinedTuyauQueryOptionsOut<EDef['types']['response'], TData, unknown>;
36
21
  }
37
22
 
38
23
  /**
39
- * Interface for mutation function decorators
24
+ * Omits the key without removing a potential union
25
+ */
26
+ type DistributiveOmit<TObj, TKey extends keyof any> = TObj extends any ? Omit<TObj, TKey> : never;
27
+ /**
28
+ * Make certain keys required in a type
40
29
  */
41
- interface DecorateMutationFn<EDef extends EndpointDef, TParams = Record<string, string | number>> extends TypeHelper<EDef> {
42
- mutationOptions: TuyauReactMutationOptions<EDef, TParams>;
30
+ type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
31
+
32
+ type ReservedOptions = 'mutationKey' | 'mutationFn';
33
+ interface TuyauMutationOptionsIn<TInput, TError, TOutput, TContext> extends DistributiveOmit<UseMutationOptions<TOutput, TError, TInput, TContext>, ReservedOptions>, TuyauQueryBaseOptions {
34
+ }
35
+ interface TuyauMutationOptionsOut<TInput, TError, TOutput, TContext> extends UseMutationOptions<TOutput, TError, TInput, TContext> {
36
+ mutationKey: TuyauMutationKey;
37
+ }
38
+ interface TuyauReactMutationOptions<TDef extends AdonisEndpoint> {
39
+ <TContext = unknown>(opts?: TuyauMutationOptionsIn<RawRequestArgs<TDef>, any, TDef['types']['response'], TContext>): TuyauMutationOptionsOut<RawRequestArgs<TDef>, any, TDef['types']['response'], TContext>;
40
+ }
41
+ declare function getMutationKeyInternal(options: {
42
+ segments: string[];
43
+ }): TuyauMutationKey;
44
+ interface DecorateMutationFn<EDef extends AdonisEndpoint> extends TypeHelper<EDef> {
45
+ mutationOptions: TuyauReactMutationOptions<EDef>;
43
46
  mutationKey: () => TuyauMutationKey;
44
47
  }
48
+ interface TuyauMutationOptionsOptions {
49
+ opts?: TuyauMutationOptionsIn<any, any, any, any>;
50
+ routeName: string;
51
+ client: Tuyau<any>;
52
+ }
53
+ declare function tuyauMutationOptions(options: TuyauMutationOptionsOptions): _tanstack_react_query.WithRequired<UseMutationOptions<unknown, any, any, any>, "mutationKey">;
54
+
45
55
  /**
46
- * Output type for mutation options
56
+ * Infinite query options input type
47
57
  */
48
- interface TuyauMutationOptionsOut<TInput, TError, TOutput, TContext, TParams = Record<string, string | number>> extends UseMutationOptions<TOutput, TError, TInput extends undefined | {} | Record<string, never> | unknown ? {
49
- payload?: TInput;
50
- params?: TParams;
51
- } : {
52
- payload: TInput;
53
- params?: TParams;
54
- }, TContext> {
55
- mutationKey: TuyauMutationKey;
58
+ interface TuyauInfiniteQueryOptionsIn<TQueryFnData, TError, TData> extends DistributiveOmit<InfiniteQueryObserverOptions<TQueryFnData, TError, TData>, 'queryKey' | 'queryFn' | 'queryHashFn' | 'queryHash'>, TuyauQueryBaseOptions {
59
+ /**
60
+ * The key that will be used for the page parameter in the request.
61
+ * For example, if your API expects ?page=1, set this to 'page'.
62
+ * If your API expects ?cursor=abc, set this to 'cursor'.
63
+ */
64
+ pageParamKey?: string;
56
65
  }
57
66
  /**
58
- * Type definition for mutation options
67
+ * Infinite query options output type
59
68
  */
60
- interface TuyauReactMutationOptions<TDef extends EndpointDef, TParams = Record<string, string | number>> {
61
- <TContext = unknown>(opts?: TuyauMutationOptionsIn<TDef['request'], any, UnionFromSuccessStatuses<TDef['response']>, TContext, TParams>): TuyauMutationOptionsOut<TDef['request'], any, UnionFromSuccessStatuses<TDef['response']>, TContext, TParams>;
69
+ interface TuyauInfiniteQueryOptionsOut<TQueryFnData, TError, TData> extends Omit<InfiniteQueryObserverOptions<TQueryFnData, TError, TData>, 'queryKey'> {
70
+ queryKey: DataTag<TuyauQueryKey, TData>;
62
71
  }
63
-
64
72
  /**
65
- * Extract union type from successful HTTP status codes (200-299)
73
+ * Type definition for infinite query options
66
74
  */
67
- type UnionFromSuccessStatuses<Res extends Record<number, unknown>> = Res[Extract<keyof Res, 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226>];
75
+ interface TuyauReactInfiniteQueryOptions<EDef extends AdonisEndpoint> {
76
+ <TData = InfiniteData<EDef['types']['response']>>(input: RawRequestArgs<EDef> | SkipToken, opts: TuyauInfiniteQueryOptionsIn<EDef['types']['response'], unknown, TData>): TuyauInfiniteQueryOptionsOut<EDef['types']['response'], unknown, TData>;
77
+ <TData = InfiniteData<EDef['types']['response']>>(input?: RawRequestArgs<EDef> | SkipToken, opts?: TuyauInfiniteQueryOptionsIn<EDef['types']['response'], unknown, TData>): TuyauInfiniteQueryOptionsOut<EDef['types']['response'], unknown, TData>;
78
+ }
68
79
  /**
69
- * Base endpoint definition structure
80
+ * Decorate query endpoints with infinite query capabilities
70
81
  */
71
- type EndpointDef = {
72
- request: Record<string, unknown>;
73
- response: Record<number, unknown>;
74
- };
82
+ interface DecorateInfiniteQueryFn<EDef extends AdonisEndpoint> extends TypeHelper<EDef> {
83
+ infiniteQueryOptions: TuyauReactInfiniteQueryOptions<EDef>;
84
+ infiniteQueryKey: (args?: RawRequestArgs<EDef>) => DataTag<TuyauQueryKey, InfiniteData<EDef['types']['response']>>;
85
+ infiniteQueryFilter: (args?: RawRequestArgs<EDef>, filters?: QueryFilters<DataTag<TuyauQueryKey, InfiniteData<EDef['types']['response']>>>) => WithRequired$1<QueryFilters<DataTag<TuyauQueryKey, InfiniteData<EDef['types']['response']>>>, 'queryKey'>;
86
+ }
87
+
88
+ /**
89
+ * Query type identifier
90
+ */
91
+ type QueryType = 'any' | 'infinite' | 'query';
75
92
  /**
76
93
  * Tuyau-specific query key structure
77
94
  */
78
95
  type TuyauQueryKey = [
79
96
  readonly string[],
80
97
  {
81
- payload?: unknown;
82
- params?: unknown;
83
- type?: 'infinite' | 'query';
98
+ request?: RawRequestArgs<any>;
99
+ type?: Exclude<QueryType, 'any'>;
84
100
  }?
85
101
  ];
86
102
  /**
87
103
  * Tuyau-specific mutation key structure
88
104
  */
89
105
  type TuyauMutationKey = [readonly string[]];
90
- /**
91
- * Omits the key without removing a potential union
92
- */
93
- type DistributiveOmit<TObj, TKey extends keyof any> = TObj extends any ? Omit<TObj, TKey> : never;
94
- /**
95
- * Make certain keys required in a type
96
- */
97
- type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
98
106
  /**
99
107
  * Query options with defined initial data
100
108
  */
@@ -113,57 +121,21 @@ interface UnusedSkipTokenTuyauQueryOptionsIn<TQueryFnData, TData, TError> extend
113
121
  /**
114
122
  * Output type for query options with defined initial data
115
123
  */
116
- interface DefinedTuyauQueryOptionsOut<TQueryFnData, TData, TError> extends DefinedInitialDataOptions<TQueryFnData, TError, TData, TuyauQueryKey>, TuyauQueryOptionsResult {
124
+ interface DefinedTuyauQueryOptionsOut<TQueryFnData, TData, TError> extends DefinedInitialDataOptions<TQueryFnData, TError, TData, TuyauQueryKey> {
117
125
  queryKey: DataTag<TuyauQueryKey, TData, TError>;
118
126
  }
119
127
  /**
120
128
  * Output type for query options with undefined initial data
121
129
  */
122
- interface UndefinedTuyauQueryOptionsOut<TQueryFnData, TData, TError> extends UndefinedInitialDataOptions<TQueryFnData, TError, TData, TuyauQueryKey>, TuyauQueryOptionsResult {
130
+ interface UndefinedTuyauQueryOptionsOut<TQueryFnData, TData, TError> extends UndefinedInitialDataOptions<TQueryFnData, TError, TData, TuyauQueryKey> {
123
131
  queryKey: DataTag<TuyauQueryKey, TData, TError>;
124
132
  }
125
133
  /**
126
134
  * Output type for query options with unused skip token
127
135
  */
128
- interface UnusedSkipTokenTuyauQueryOptionsOut<TQueryFnData, TData, TError> extends UnusedSkipTokenOptions<TQueryFnData, TError, TData, TuyauQueryKey>, TuyauQueryOptionsResult {
136
+ interface UnusedSkipTokenTuyauQueryOptionsOut<TQueryFnData, TData, TError> extends UnusedSkipTokenOptions<TQueryFnData, TError, TData, TuyauQueryKey> {
129
137
  queryKey: DataTag<TuyauQueryKey, TData, TError>;
130
138
  }
131
- /**
132
- * Input type for mutation options
133
- */
134
- interface TuyauMutationOptionsIn<TInput, TError, TOutput, TContext, TParams = Record<string, string | number>> extends DistributiveOmit<UseMutationOptions<TOutput, TError, {
135
- payload: TInput;
136
- params?: TParams;
137
- }, TContext>, 'mutationKey' | 'mutationFn'> {
138
- /**
139
- * Route parameters to be passed to the mutation
140
- */
141
- params?: TParams;
142
- }
143
- /**
144
- * Interface for router keyable decorators (pathKey, pathFilter)
145
- */
146
- interface DecorateRouterKeyable {
147
- pathKey: () => TuyauQueryKey;
148
- pathFilter: (filters?: QueryFilters<TuyauQueryKey>) => WithRequired<QueryFilters<TuyauQueryKey>, 'queryKey'>;
149
- }
150
- interface TypeHelper<EDef extends EndpointDef> {
151
- /**
152
- * @internal
153
- */
154
- '~types': {
155
- request: EDef['request'];
156
- response: EDef['response'];
157
- };
158
- }
159
- /**
160
- * Infer request type from an endpoint
161
- */
162
- type InferRequestType<Endpoint extends DecorateQueryFn<any> | DecorateMutationFn<any>> = Endpoint['~types']['request'];
163
- /**
164
- * Infer response type from an endpoint
165
- */
166
- type InferResponseType<Endpoint extends DecorateQueryFn<any> | DecorateMutationFn<any>> = Endpoint['~types']['response']['200'];
167
139
  /**
168
140
  * Tuyau-specific request options for React Query integration
169
141
  */
@@ -177,180 +149,56 @@ interface TuyauReactRequestOptions {
177
149
  * Base options for Tuyau queries
178
150
  */
179
151
  interface TuyauQueryBaseOptions {
180
- /**
181
- * Tuyau-related options
182
- */
183
152
  tuyau?: TuyauReactRequestOptions;
184
153
  }
185
- /**
186
- * Result interface for Tuyau query options
187
- */
188
- interface TuyauQueryOptionsResult {
189
- tuyau: {
190
- path: string[];
191
- type: 'query';
192
- };
193
- }
194
-
195
- /**
196
- * Reserved infinite query options that should not be overridden
197
- */
198
- type InfiniteQueryReservedOptions = 'queryKey' | 'queryFn' | 'queryHashFn' | 'queryHash';
199
- /**
200
- * Tuyau infinite data structure
201
- */
202
- type TuyauInfiniteData<TData> = {
203
- pages: TData[];
204
- pageParams: unknown[];
205
- };
206
- /**
207
- * Infinite query options with undefined initial data
208
- */
209
- interface UndefinedTuyauInfiniteQueryOptionsIn<TQueryFnData, TData, TError, TRequest, TPageParamKey extends keyof TRequest> extends DistributiveOmit<UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TuyauInfiniteData<TData>, TuyauQueryKey, ExtractPageParamType<TRequest, TPageParamKey> | null>, InfiniteQueryReservedOptions>, TuyauQueryBaseOptions {
210
- pageParamKey: TPageParamKey;
211
- }
212
- /**
213
- * Infinite query options with defined initial data
214
- */
215
- interface DefinedTuyauInfiniteQueryOptionsIn<TQueryFnData, TData, TError, TRequest, TPageParamKey extends keyof TRequest> extends DistributiveOmit<DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TuyauInfiniteData<TData>, TuyauQueryKey, ExtractPageParamType<TRequest, TPageParamKey> | null>, InfiniteQueryReservedOptions>, TuyauQueryBaseOptions {
216
- pageParamKey: TPageParamKey;
217
- }
218
- type ExtractPageParamType<TRequest, TPageParamKey extends keyof TRequest> = TRequest[TPageParamKey];
219
- /**
220
- * Infinite query options with unused skip token
221
- */
222
- interface UnusedSkipTokenTuyauInfiniteQueryOptionsIn<TQueryFnData, TData, TError, TRequest, TPageParamKey extends keyof TRequest> extends DistributiveOmit<UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TuyauInfiniteData<TData>, TuyauQueryKey, ExtractPageParamType<TRequest, TPageParamKey>>, InfiniteQueryReservedOptions>, TuyauQueryBaseOptions {
223
- pageParamKey: TPageParamKey;
224
- }
225
- /**
226
- * Output type for infinite query options with undefined initial data
227
- */
228
- interface UndefinedTuyauInfiniteQueryOptionsOut<TQueryFnData, TData, TError> extends UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TuyauInfiniteData<TData>, TuyauQueryKey, unknown> {
229
- queryKey: DataTag<TuyauQueryKey, TuyauInfiniteData<TData>, TError>;
230
- tuyau: {
231
- path: string[];
232
- type: 'infinite';
233
- };
234
- }
235
- /**
236
- * Output type for infinite query options with defined initial data
237
- */
238
- interface DefinedTuyauInfiniteQueryOptionsOut<TQueryFnData, TData, TError> extends DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TuyauInfiniteData<TData>, TuyauQueryKey, unknown> {
239
- queryKey: DataTag<TuyauQueryKey, TuyauInfiniteData<TData>, TError>;
240
- tuyau: {
241
- path: string[];
242
- type: 'infinite';
243
- };
154
+ interface DecorateRouterKeyable {
155
+ pathKey: () => TuyauQueryKey;
156
+ pathFilter: (filters?: QueryFilters<TuyauQueryKey>) => WithRequired<QueryFilters<TuyauQueryKey>, 'queryKey'>;
244
157
  }
245
- /**
246
- * Output type for infinite query options with unused skip token
247
- */
248
- interface UnusedSkipTokenTuyauInfiniteQueryOptionsOut<TQueryFnData, TData, TError> extends UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TuyauInfiniteData<TData>, TuyauQueryKey, unknown> {
249
- queryKey: DataTag<TuyauQueryKey, TuyauInfiniteData<TData>, TError>;
250
- tuyau: {
251
- path: string[];
252
- type: 'infinite';
158
+ type EndpointNode<E extends AdonisEndpoint> = E extends {
159
+ methods: readonly (infer M extends Method)[];
160
+ } ? M extends 'GET' | 'HEAD' ? DecorateQueryFn<E> & DecorateInfiniteQueryFn<E> & DecorateRouterKeyable : DecorateMutationFn<E> & DecorateRouterKeyable : DecorateRouterKeyable;
161
+ interface TypeHelper<EDef extends AdonisEndpoint> {
162
+ /**
163
+ * @internal
164
+ */
165
+ '~types': {
166
+ request: EDef['types']['body'];
167
+ response: EDef['types']['response'];
253
168
  };
254
169
  }
255
- /**
256
- * Type definition for infinite query options with overloads for different scenarios
257
- */
258
- interface TuyauReactInfiniteQueryOptions<EDef extends EndpointDef, TParams = Record<string, string | number>> {
259
- <TData = UnionFromSuccessStatuses<EDef['response']>, TPageParamKey extends keyof EDef['request'] = string>(input: {
260
- payload?: Omit<EDef['request'], TPageParamKey>;
261
- params?: TParams;
262
- } | SkipToken, opts: DefinedTuyauInfiniteQueryOptionsIn<UnionFromSuccessStatuses<EDef['response']>, TData, any, EDef['request'], TPageParamKey>): DefinedTuyauInfiniteQueryOptionsOut<UnionFromSuccessStatuses<EDef['response']>, TData, any>;
263
- <TData = UnionFromSuccessStatuses<EDef['response']>, TPageParamKey extends keyof EDef['request'] = string>(input: {
264
- payload?: Omit<EDef['request'], TPageParamKey>;
265
- params?: TParams;
266
- }, opts: UnusedSkipTokenTuyauInfiniteQueryOptionsIn<UnionFromSuccessStatuses<EDef['response']>, TData, any, EDef['request'], TPageParamKey>): UnusedSkipTokenTuyauInfiniteQueryOptionsOut<UnionFromSuccessStatuses<EDef['response']>, TData, any>;
267
- <TData = UnionFromSuccessStatuses<EDef['response']>, TPageParamKey extends keyof EDef['request'] = string>(input?: {
268
- payload?: Omit<EDef['request'], TPageParamKey>;
269
- params?: TParams;
270
- } | SkipToken, opts?: UndefinedTuyauInfiniteQueryOptionsIn<UnionFromSuccessStatuses<EDef['response']>, TData, any, EDef['request'], TPageParamKey>): UndefinedTuyauInfiniteQueryOptionsOut<UnionFromSuccessStatuses<EDef['response']>, TData, any>;
271
- }
272
- /**
273
- * Interface for infinite query function decorators
274
- */
275
- interface DecorateInfiniteQueryFn<EDef extends EndpointDef, TParams = Record<string, string | number>> {
276
- infiniteQueryOptions: TuyauReactInfiniteQueryOptions<EDef, TParams>;
277
- infiniteQueryKey: (input?: {
278
- payload?: Partial<EDef['request']>;
279
- params?: TParams;
280
- }) => DataTag<TuyauQueryKey, TuyauInfiniteData<UnionFromSuccessStatuses<EDef['response']>>, any>;
281
- infiniteQueryFilter: (input?: {
282
- payload?: Partial<EDef['request']>;
283
- params?: TParams;
284
- }, filters?: QueryFilters<DataTag<TuyauQueryKey, TuyauInfiniteData<UnionFromSuccessStatuses<EDef['response']>>, any>>) => WithRequired<QueryFilters<DataTag<TuyauQueryKey, TuyauInfiniteData<UnionFromSuccessStatuses<EDef['response']>>, any>>, 'queryKey'>;
285
- }
170
+ type SetAtPathWithKeyable<Path extends string[], V> = Path extends [
171
+ infer H extends string,
172
+ ...infer T extends string[]
173
+ ] ? {
174
+ [K in H]: T['length'] extends 0 ? V : SetAtPathWithKeyable<T, V> & DecorateRouterKeyable;
175
+ } : {};
176
+ type BuildNamespaces<R extends Record<string, AdonisEndpoint>> = UnionToIntersection<{
177
+ [K in StrKeys<R>]: SetAtPathWithKeyable<Split<K>, EndpointNode<R[K]>>;
178
+ }[StrKeys<R>]> & DecorateRouterKeyable;
179
+ type TuyauReactQuery<R extends Record<string, AdonisEndpoint>> = BuildNamespaces<R>;
286
180
 
287
- /**
288
- * Options for configuring the Tuyau React Query client
289
- */
290
- interface TuyauReactQueryClientOptions<D extends Record<string, any>, R extends GeneratedRoutes> {
291
- client: TuyauClient<D, R>;
181
+ declare function createTuyauReactQueryClient<D extends Record<string, AdonisEndpoint>>(options: {
182
+ client: Tuyau<D>;
292
183
  queryClient: QueryClient | (() => QueryClient);
293
- /**
294
- * Global Tuyau-specific request options
295
- */
296
184
  globalOptions?: TuyauReactRequestOptions;
297
- }
298
- /**
299
- * Create the Tuyau React Query client
300
- */
301
- declare function createTuyauReactQueryClient<D extends Record<string, any>, R extends GeneratedRoutes>(options: TuyauReactQueryClientOptions<D, R>): TuyauReactQuery<D> & DecorateRouterKeyable;
302
- /**
303
- * Main type for the Tuyau React Query client
304
- * Maps route definitions to appropriate query or mutation decorators
305
- */
306
- type TuyauReactQuery<in out Route extends Record<string, any>, NotProvidedParams = {}> = {
307
- [K in keyof Route as K extends `:${string}` ? never : K]: Route[K] extends {
308
- response: infer _Res extends Record<number, unknown>;
309
- request: infer _Request;
310
- } ? K extends '$get' | '$head' ? DecorateQueryFn<Route[K], NotProvidedParams> & DecorateInfiniteQueryFn<Route[K], NotProvidedParams> & DecorateRouterKeyable : // POST, PUT, PATCH, DELETE methods become mutations
311
- DecorateMutationFn<Route[K], NotProvidedParams> & DecorateRouterKeyable : K extends '$url' ? (options?: {
312
- query?: QueryParameters;
313
- }) => string : CreateParams<Route[K], NotProvidedParams> & DecorateRouterKeyable;
314
- };
315
- /**
316
- * Extract path parameters from route keys
317
- */
318
- type ExtractPathParams<Route> = Extract<keyof Route, `:${string}`>;
319
- /**
320
- * Convert path parameter to object type
321
- */
322
- type PathParamToObject<Path extends string> = Path extends `:${infer Param}` ? {
323
- [K in Param]: string | number;
324
- } : never;
325
- /**
326
- * Create the route parameter function signature
327
- */
328
- type CreateParamFunction<Route extends Record<string, any>, Path extends string, NotProvidedParams> = (params: PathParamToObject<Path>) => TuyauReactQuery<Route[Path], NotProvidedParams> & CreateParams<Route[Path], NotProvidedParams & PathParamToObject<Path>>;
329
- /**
330
- * Create the parameter property mappings
331
- */
332
- type CreateParamProperties<Route extends Record<string, any>, Path extends string, NotProvidedParams> = {
333
- [K in keyof Route as K extends `:${string}` ? K : never]: TuyauReactQuery<Route[K], NotProvidedParams & PathParamToObject<Path>> & DecorateRouterKeyable;
334
- };
335
- /**
336
- * Type for handling route parameters
337
- */
338
- type CreateParams<Route extends Record<string, any>, NotProvidedParams = {}> = ExtractPathParams<Route> extends infer Path extends string ? IsNever<Path> extends true ? TuyauReactQuery<Route, NotProvidedParams> & DecorateRouterKeyable : CreateParamFunction<Route, Path, NotProvidedParams> & TuyauReactQuery<Route, NotProvidedParams> & CreateParamProperties<Route, Path, NotProvidedParams> & DecorateRouterKeyable : never;
185
+ }): TuyauReactQuery<D> & DecorateRouterKeyable;
339
186
 
340
- type InferTuyauClient<API extends ApiDefinition> = TuyauClient<API['definition'], API['routes'] extends GeneratedRoutes ? API['routes'] : any>;
341
- type InferTuyauReactQuery<API extends ApiDefinition> = TuyauReactQuery<API['definition']>;
342
- interface CreateTuyauContextResult<API extends ApiDefinition> {
343
- TuyauProvider: React.FC<{
344
- children: React.ReactNode;
345
- queryClient: QueryClient;
346
- client: InferTuyauClient<API>;
347
- }>;
348
- useTuyau: () => InferTuyauReactQuery<API>;
349
- useTuyauClient: () => InferTuyauClient<API>;
187
+ interface TuyauQueryOptionsOptions {
188
+ request: RawRequestArgs<any> | SkipToken;
189
+ opts?: TuyauQueryBaseOptions;
190
+ queryKey: TuyauQueryKey;
191
+ routeName: string;
192
+ client: Tuyau<any>;
193
+ globalOptions?: TuyauReactRequestOptions;
350
194
  }
351
- /**
352
- * Create a set of type-safe provider-consumers for Tuyau with React Query
353
- */
354
- declare function createTuyauContext<API extends ApiDefinition>(): CreateTuyauContextResult<API>;
195
+ declare function tuyauQueryOptions(options: TuyauQueryOptionsOptions): _tanstack_react_query.UseQueryOptions<any, Error, any, readonly unknown[]> & {
196
+ initialData?: any;
197
+ } & {
198
+ queryKey: readonly unknown[] & {
199
+ [dataTagSymbol]: any;
200
+ [dataTagErrorSymbol]: Error;
201
+ };
202
+ };
355
203
 
356
- export { type CreateTuyauContextResult, type InferRequestType, type InferResponseType, type TuyauReactInfiniteQueryOptions, type TuyauReactMutationOptions, type TuyauReactQuery, type TuyauReactQueryOptions, createTuyauContext, createTuyauReactQueryClient };
204
+ export { type DecorateMutationFn, type DecorateRouterKeyable, type DefinedTuyauQueryOptionsIn, type DefinedTuyauQueryOptionsOut, type EndpointNode, type QueryType, type TuyauMutationKey, type TuyauMutationOptionsIn, type TuyauMutationOptionsOptions, type TuyauMutationOptionsOut, type TuyauQueryBaseOptions, type TuyauQueryKey, type TuyauQueryOptionsOptions, type TuyauReactMutationOptions, type TuyauReactQuery, type TuyauReactRequestOptions, type TypeHelper, type UndefinedTuyauQueryOptionsIn, type UndefinedTuyauQueryOptionsOut, type UnusedSkipTokenTuyauQueryOptionsIn, type UnusedSkipTokenTuyauQueryOptionsOut, createTuyauReactQueryClient, getMutationKeyInternal, tuyauMutationOptions, tuyauQueryOptions };
package/build/index.js CHANGED
@@ -1,273 +1,176 @@
1
- // src/main.ts
2
- import {
3
- createTuyauRecursiveProxy
4
- } from "@tuyau/client";
5
-
6
1
  // src/utils.ts
7
- function unwrapLazyArg(arg) {
8
- return typeof arg === "function" ? arg() : arg;
9
- }
2
+ import { skipToken } from "@tanstack/react-query";
10
3
  function isObject(value) {
11
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
12
5
  }
13
- function buildRequestPath(path, params) {
14
- if (!params) return path.map(String);
15
- const result = [];
16
- for (const segment of path) {
17
- const segmentStr = String(segment);
18
- if (segmentStr.includes("/")) {
19
- const parts = segmentStr.split("/");
20
- for (const part of parts) {
21
- if (part.startsWith(":")) {
22
- const paramName = part.slice(1);
23
- result.push(params[paramName]?.toString() || part);
24
- } else {
25
- result.push(part);
26
- }
27
- }
28
- } else if (segmentStr.startsWith(":")) {
29
- const paramName = segmentStr.slice(1);
30
- result.push(params[paramName]?.toString() || segmentStr);
31
- } else {
32
- result.push(segmentStr);
33
- }
34
- }
35
- return result;
6
+ function invoke(fn) {
7
+ return fn?.();
36
8
  }
37
-
38
- // src/query.ts
39
- import {
40
- queryOptions,
41
- skipToken
42
- } from "@tanstack/react-query";
43
- function getQueryKeyInternal(path, input, type) {
44
- let params;
45
- let payload;
46
- if (isObject(input)) {
47
- if ("params" in input && input.params && typeof input.params === "object") {
48
- params = input.params;
49
- }
50
- if ("payload" in input) {
51
- payload = input.payload;
52
- } else if (!("params" in input)) {
53
- payload = input;
54
- }
55
- } else {
56
- payload = input;
57
- }
58
- const splitPath = path.flatMap((part) => part.toString().split("/"));
59
- if (!input && (!type || type === "any")) {
9
+ function buildKey(opts) {
10
+ const { segments, request, type } = opts;
11
+ const splitPath = segments.flatMap((part) => part.split("."));
12
+ if (!request && type === "any") {
60
13
  return splitPath.length ? [splitPath] : [];
61
14
  }
15
+ if (type === "infinite" && isObject(request) && ("direction" in request || "cursor" in request)) {
16
+ const { cursor: _, direction: __, ...inputWithoutCursorAndDirection } = request;
17
+ return [splitPath, { request: inputWithoutCursorAndDirection, type: "infinite" }];
18
+ }
62
19
  return [
63
20
  splitPath,
64
21
  {
65
- ...typeof payload !== "undefined" && payload !== skipToken && { payload },
66
- ...typeof params !== "undefined" && { params },
22
+ ...typeof request !== "undefined" && request !== skipToken && { request },
67
23
  ...type && type !== "any" && { type }
68
24
  }
69
25
  ];
70
26
  }
27
+
28
+ // src/query.ts
29
+ import { queryOptions, skipToken as skipToken2 } from "@tanstack/react-query";
71
30
  function tuyauQueryOptions(options) {
72
- const { input, opts, queryKey, path, client, globalOptions } = options;
73
- const inputIsSkipToken = input === skipToken;
74
- const queryFn = inputIsSkipToken ? skipToken : async (queryFnContext) => {
75
- const { payload, requestPath } = extractInputAndPath(input, path);
76
- const effectiveAbortOnUnmount = opts?.tuyau?.abortOnUnmount ?? globalOptions?.abortOnUnmount ?? false;
77
- const actualOpts = {
78
- ...opts,
79
- tuyau: {
80
- ...globalOptions,
81
- ...opts?.tuyau,
82
- ...effectiveAbortOnUnmount ? { signal: queryFnContext.signal } : { signal: null }
83
- }
31
+ const { request, routeName, opts, queryKey, client, globalOptions } = options;
32
+ const queryFn = invoke(() => {
33
+ if (request === skipToken2) return skipToken2;
34
+ return async (queryFnContext) => {
35
+ const effectiveAbortOnUnmount = opts?.tuyau?.abortOnUnmount ?? globalOptions?.abortOnUnmount ?? false;
36
+ return await client.request(routeName, {
37
+ ...request,
38
+ ...effectiveAbortOnUnmount ? { signal: queryFnContext.signal } : {}
39
+ });
84
40
  };
85
- return await client.$fetch({ paths: requestPath, input: payload, queryOptions: actualOpts });
86
- };
87
- return Object.assign(queryOptions({ ...opts, queryKey, queryFn }), {
88
- tuyau: { path, type: "query" }
89
41
  });
90
- }
91
- function extractInputAndPath(input, path) {
92
- if (typeof input !== "object" || input === null || !("payload" in input) && !("params" in input)) {
93
- return { payload: input, requestPath: path };
94
- }
95
- const { payload, params } = input;
96
- const requestPath = buildRequestPath(path, params);
97
- return { payload, requestPath };
42
+ return queryOptions({ ...opts, queryKey, queryFn });
98
43
  }
99
44
 
100
45
  // src/infinite_query.ts
101
46
  import {
102
47
  infiniteQueryOptions,
103
- skipToken as skipToken2
48
+ skipToken as skipToken3
104
49
  } from "@tanstack/react-query";
105
- function extractInfiniteInputAndPath(input, path, pageParamKey, pageParam) {
106
- if (typeof input !== "object" || input === null || !("payload" in input) && !("params" in input)) {
107
- const payload2 = typeof input === "object" && input !== null ? input : {};
108
- const enhancedPayload2 = { ...payload2, [pageParamKey]: pageParam };
109
- return { payload: enhancedPayload2, requestPath: path };
110
- }
111
- const { payload, params } = input;
112
- const requestPath = buildRequestPath(path, params);
113
- const enhancedPayload = { ...payload, [pageParamKey]: pageParam };
114
- return { payload: enhancedPayload, requestPath };
115
- }
116
50
  function tuyauInfiniteQueryOptions(options) {
117
- const { input, opts, queryKey, path, client, globalOptions } = options;
118
- const inputIsSkipToken = input === skipToken2;
119
- if (!opts?.pageParamKey) {
120
- throw new Error("pageParamKey is required for infinite queries");
121
- }
122
- const queryFn = inputIsSkipToken ? skipToken2 : async (queryFnContext) => {
123
- const { payload, requestPath } = extractInfiniteInputAndPath(
124
- input,
125
- path,
126
- opts.pageParamKey,
127
- queryFnContext.pageParam
128
- );
129
- const effectiveAbortOnUnmount = opts?.tuyau?.abortOnUnmount ?? globalOptions?.abortOnUnmount ?? false;
130
- const actualOpts = {
131
- ...opts,
132
- tuyau: {
133
- ...globalOptions,
134
- ...opts?.tuyau,
135
- ...effectiveAbortOnUnmount ? { signal: queryFnContext.signal } : { signal: null }
51
+ const { request, routeName, opts, queryKey, client, globalOptions } = options;
52
+ const queryFn = invoke(() => {
53
+ if (request === skipToken3) return skipToken3;
54
+ return async (queryFnContext) => {
55
+ const { pageParam } = queryFnContext;
56
+ const effectiveAbortOnUnmount = opts?.tuyau?.abortOnUnmount ?? globalOptions?.abortOnUnmount ?? false;
57
+ const pageParamKey = opts?.pageParamKey || "page";
58
+ let requestArgs;
59
+ if (typeof request === "object" && request !== null) {
60
+ if (pageParam !== void 0) {
61
+ requestArgs = {
62
+ ...request,
63
+ query: { ...request.query, [pageParamKey]: pageParam }
64
+ };
65
+ } else {
66
+ requestArgs = request;
67
+ }
68
+ } else {
69
+ requestArgs = { query: pageParam !== void 0 ? { [pageParamKey]: pageParam } : {} };
136
70
  }
71
+ return await client.request(routeName, {
72
+ ...requestArgs,
73
+ ...effectiveAbortOnUnmount ? { signal: queryFnContext.signal } : {}
74
+ });
137
75
  };
138
- return await client.$fetch({ paths: requestPath, input: payload, queryOptions: actualOpts });
139
- };
140
- return Object.assign(
141
- infiniteQueryOptions({
142
- ...opts,
143
- queryKey,
144
- queryFn,
145
- initialPageParam: opts?.initialPageParam ?? null
146
- }),
147
- { tuyau: { path, type: "infinite" } }
148
- );
76
+ });
77
+ return infiniteQueryOptions({
78
+ ...opts,
79
+ queryKey,
80
+ queryFn,
81
+ initialPageParam: opts?.initialPageParam ?? 1,
82
+ getNextPageParam: opts?.getNextPageParam ?? (() => null),
83
+ getPreviousPageParam: opts?.getPreviousPageParam
84
+ });
149
85
  }
150
86
 
151
87
  // src/mutation.ts
152
- import {
153
- mutationOptions
154
- } from "@tanstack/react-query";
155
- function getMutationKeyInternal(path) {
156
- const splitPath = path.flatMap((part) => part.toString().split("."));
157
- return splitPath.length ? [splitPath] : [];
88
+ import { mutationOptions } from "@tanstack/react-query";
89
+ function getMutationKeyInternal(options) {
90
+ const key = [options.segments.flatMap((part) => part.split("."))];
91
+ return key;
158
92
  }
159
- function tuyauMutationOptions(args) {
160
- const { opts, path, client, overrides } = args;
161
- const queryClient = unwrapLazyArg(args.queryClient);
162
- const mutationKey = getMutationKeyInternal(path);
163
- const defaultOpts = queryClient.defaultMutationOptions(
164
- queryClient.getMutationDefaults(mutationKey)
165
- );
166
- const mutationSuccessOverride = overrides?.onSuccess ?? ((options) => options.originalFn());
167
- const mutationFn = async (input) => {
168
- const requestPath = buildRequestPath(path, input.params);
169
- return await client.$fetch({ paths: requestPath, input: input.payload });
93
+ function tuyauMutationOptions(options) {
94
+ const { opts, routeName, client } = options;
95
+ const mutationKey = getMutationKeyInternal({ segments: routeName.split(".") });
96
+ const mutationFn = async (request) => {
97
+ const requestArgs = request || {};
98
+ return await client.request(routeName, requestArgs);
170
99
  };
171
- const onSuccess = (data, variables, context) => {
172
- const originalFn = () => {
173
- if (opts?.onSuccess) return opts.onSuccess(data, variables, context);
174
- if (defaultOpts?.onSuccess) return defaultOpts.onSuccess(data, variables, context);
175
- };
176
- return mutationSuccessOverride({
177
- originalFn,
178
- queryClient,
179
- meta: opts?.meta ?? defaultOpts?.meta ?? {}
180
- });
181
- };
182
- return Object.assign(mutationOptions({ ...opts, mutationKey, mutationFn, onSuccess }), {
183
- tuyau: { path, type: "mutation" }
184
- });
100
+ return mutationOptions({ ...opts, mutationKey, mutationFn });
185
101
  }
186
102
 
187
103
  // src/main.ts
188
- function createTuyauReactQueryClient(options) {
189
- return createTuyauRecursiveProxy(({ args, executeIfRouteParamCall, paths, patternPaths }) => {
190
- const fnName = paths.at(-1);
191
- const path = paths.slice(0, -1);
192
- const patternPath = patternPaths ? patternPaths.slice(0, -1) : path;
193
- const [arg1, arg2] = args;
194
- if (fnName === "queryOptions") {
195
- return tuyauQueryOptions({
196
- input: arg1,
197
- opts: arg2 || {},
198
- queryKey: getQueryKeyInternal(patternPath, arg1, "query"),
199
- queryClient: unwrapLazyArg(options.queryClient),
200
- client: options.client,
201
- path,
202
- globalOptions: options.globalOptions
203
- });
204
- }
205
- if (fnName === "infiniteQueryOptions") {
206
- return tuyauInfiniteQueryOptions({
207
- input: arg1,
208
- opts: arg2 || {},
209
- queryKey: getQueryKeyInternal(patternPath, arg1, "infinite"),
210
- queryClient: unwrapLazyArg(options.queryClient),
211
- client: options.client,
212
- path,
213
- globalOptions: options.globalOptions
214
- });
215
- }
216
- if (fnName === "queryKey") return getQueryKeyInternal(patternPath, arg1, "query");
217
- if (fnName === "infiniteQueryKey") return getQueryKeyInternal(patternPath, arg1, "infinite");
218
- if (fnName === "pathKey") return getQueryKeyInternal(patternPath);
219
- if (fnName === "queryFilter") {
220
- return { ...arg2, queryKey: getQueryKeyInternal(patternPath, arg1, "query") };
221
- }
222
- if (fnName === "infiniteQueryFilter") {
223
- return { ...arg2, queryKey: getQueryKeyInternal(patternPath, arg1, "infinite") };
224
- }
225
- if (fnName === "pathFilter") {
226
- return { ...arg1, queryKey: getQueryKeyInternal(patternPath) };
227
- }
228
- if (fnName === "mutationOptions") {
229
- return tuyauMutationOptions({
230
- path,
231
- opts: arg1,
232
- queryClient: unwrapLazyArg(options.queryClient),
233
- client: options.client
234
- });
235
- }
236
- if (fnName === "mutationKey") return getMutationKeyInternal(path);
237
- const newProxy = executeIfRouteParamCall({ fnName, body: args[0] });
238
- if (newProxy) return newProxy;
239
- throw new Error(`Method ${fnName} not found on Tuyau client`);
240
- });
104
+ function segmentsToRouteName(segments) {
105
+ return segments.join(".");
241
106
  }
242
-
243
- // src/context.tsx
244
- import * as React from "react";
245
- function createTuyauContext() {
246
- const TuyauClientContext = React.createContext(null);
247
- const TuyauContext = React.createContext(null);
248
- function TuyauProvider(props) {
249
- const value = React.useMemo(
250
- () => createTuyauReactQueryClient({
251
- client: props.client,
252
- queryClient: props.queryClient
107
+ function createTuyauReactQueryClient(options) {
108
+ const { client, globalOptions } = options;
109
+ function makeReactQueryNamed(segments) {
110
+ const routeName = segmentsToRouteName(segments);
111
+ const decoratedEndpoint = {
112
+ /**
113
+ * Queries
114
+ */
115
+ queryOptions: (request, opts) => {
116
+ return tuyauQueryOptions({
117
+ opts,
118
+ client,
119
+ request,
120
+ routeName,
121
+ globalOptions,
122
+ queryKey: buildKey({ segments, request, type: "query" })
123
+ });
124
+ },
125
+ queryKey: (request) => buildKey({ segments, request, type: "query" }),
126
+ queryFilter: (request, filters) => ({
127
+ queryKey: buildKey({ segments, request, type: "query" }),
128
+ ...filters
253
129
  }),
254
- [props.client, props.queryClient]
255
- );
256
- return /* @__PURE__ */ React.createElement(TuyauClientContext.Provider, { value: props.client }, /* @__PURE__ */ React.createElement(TuyauContext.Provider, { value }, props.children));
257
- }
258
- function useTuyau() {
259
- const utils = React.useContext(TuyauContext);
260
- if (!utils) throw new Error("useTuyau() can only be used inside of a <TuyauProvider>");
261
- return utils;
262
- }
263
- function useTuyauClient() {
264
- const client = React.useContext(TuyauClientContext);
265
- if (!client) throw new Error("useTuyauClient() can only be used inside of a <TuyauProvider>");
266
- return client;
130
+ /**
131
+ * Infinite Queries
132
+ */
133
+ infiniteQueryOptions: (request, opts) => {
134
+ return tuyauInfiniteQueryOptions({
135
+ opts,
136
+ client,
137
+ request,
138
+ routeName,
139
+ globalOptions,
140
+ queryKey: buildKey({ segments, request, type: "infinite" })
141
+ });
142
+ },
143
+ infiniteQueryKey: (request) => buildKey({ segments, request, type: "infinite" }),
144
+ infiniteQueryFilter: (request, filters) => ({
145
+ queryKey: buildKey({ segments, request, type: "infinite" }),
146
+ ...filters
147
+ }),
148
+ /**
149
+ * Mutations
150
+ */
151
+ mutationOptions: (opts) => tuyauMutationOptions({ opts, client, routeName }),
152
+ mutationKey: () => getMutationKeyInternal({ segments }),
153
+ /**
154
+ * Paths
155
+ */
156
+ pathKey: () => buildKey({ segments, type: "any" }),
157
+ pathFilter: (filters) => ({
158
+ queryKey: buildKey({ segments, type: "any" }),
159
+ ...filters
160
+ })
161
+ };
162
+ return new Proxy(decoratedEndpoint, {
163
+ get: (target, prop) => {
164
+ if (prop in target) return target[prop];
165
+ return makeReactQueryNamed([...segments, String(prop)]);
166
+ }
167
+ });
267
168
  }
268
- return { TuyauProvider, useTuyau, useTuyauClient };
169
+ return makeReactQueryNamed([]);
269
170
  }
270
171
  export {
271
- createTuyauContext,
272
- createTuyauReactQueryClient
172
+ createTuyauReactQueryClient,
173
+ getMutationKeyInternal,
174
+ tuyauMutationOptions,
175
+ tuyauQueryOptions
273
176
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tuyau/react-query",
3
3
  "type": "module",
4
- "version": "0.0.1-next.2",
4
+ "version": "1.0.0-beta.0",
5
5
  "description": "React Query plugin for Tuyau",
6
6
  "author": "Julien Ripouteau <julien@ripouteau.com>",
7
7
  "license": "ISC",
@@ -15,21 +15,17 @@
15
15
  ],
16
16
  "peerDependencies": {
17
17
  "@tanstack/react-query": "^5.74.7",
18
- "@tuyau/client": "^0.2.11-next.0"
19
- },
20
- "dependencies": {
21
- "@tuyau/utils": "0.0.9"
18
+ "@tuyau/core": "1.0.0-beta.2"
22
19
  },
23
20
  "devDependencies": {
24
- "@adonisjs/core": "^6.19.0",
25
- "@happy-dom/global-registrator": "^17.6.3",
26
- "@tanstack/react-query": "^5.83.0",
21
+ "@adonisjs/core": "^7.0.0-next.10",
22
+ "@happy-dom/global-registrator": "^20.0.10",
23
+ "@tanstack/react-query": "^5.90.7",
27
24
  "@testing-library/react": "^16.3.0",
28
- "@types/react": "^19.1.8",
29
- "@vinejs/vine": "^3.0.1",
30
- "nock": "^14.0.6",
31
- "react": "^19.1.0",
32
- "@tuyau/client": "0.2.11-next.2"
25
+ "@types/react": "^19.2.2",
26
+ "@vinejs/vine": "^4.1.0",
27
+ "react": "^19.2.0",
28
+ "@tuyau/core": "1.0.0-beta.2"
33
29
  },
34
30
  "tsup": {
35
31
  "entry": [
@@ -43,14 +39,14 @@
43
39
  },
44
40
  "publishConfig": {
45
41
  "access": "public",
46
- "tag": "latest"
42
+ "tag": "beta"
47
43
  },
48
44
  "scripts": {
49
45
  "lint": "eslint .",
50
46
  "typecheck": "tsc --noEmit",
51
47
  "build": "tsup-node",
52
- "test": "c8 node --enable-source-maps --loader ts-node/esm bin/test.ts",
53
- "quick:test": "node --enable-source-maps --loader ts-node/esm bin/test.ts",
48
+ "test": "pnpm quick:test",
49
+ "quick:test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts --force-exit",
54
50
  "checks": "pnpm lint && pnpm typecheck"
55
51
  }
56
52
  }