@openapi-qraft/react 1.1.4 → 1.2.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 (150) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +83 -31
  3. package/dist/QraftContext.d.ts +16 -5
  4. package/dist/QraftContext.d.ts.map +1 -1
  5. package/dist/QraftContext.js.map +1 -1
  6. package/dist/RequestClient.d.ts +2 -18
  7. package/dist/RequestClient.d.ts.map +1 -1
  8. package/dist/ServiceOperation.d.ts +41 -2
  9. package/dist/ServiceOperation.d.ts.map +1 -1
  10. package/dist/callbacks/cancelQueries.d.ts +2 -2
  11. package/dist/callbacks/cancelQueries.d.ts.map +1 -1
  12. package/dist/callbacks/cancelQueries.js.map +1 -1
  13. package/dist/callbacks/getInfiniteQueryData.d.ts +2 -2
  14. package/dist/callbacks/getInfiniteQueryData.d.ts.map +1 -1
  15. package/dist/callbacks/getInfiniteQueryData.js.map +1 -1
  16. package/dist/callbacks/getInfiniteQueryKey.d.ts +2 -2
  17. package/dist/callbacks/getInfiniteQueryKey.d.ts.map +1 -1
  18. package/dist/callbacks/getInfiniteQueryKey.js.map +1 -1
  19. package/dist/callbacks/getMutationKey.d.ts +2 -2
  20. package/dist/callbacks/getMutationKey.d.ts.map +1 -1
  21. package/dist/callbacks/getMutationKey.js.map +1 -1
  22. package/dist/callbacks/getQueryData.d.ts +2 -2
  23. package/dist/callbacks/getQueryData.d.ts.map +1 -1
  24. package/dist/callbacks/getQueryData.js.map +1 -1
  25. package/dist/callbacks/getQueryKey.d.ts +2 -2
  26. package/dist/callbacks/getQueryKey.d.ts.map +1 -1
  27. package/dist/callbacks/getQueryKey.js.map +1 -1
  28. package/dist/callbacks/invalidateQueries.d.ts +2 -2
  29. package/dist/callbacks/invalidateQueries.d.ts.map +1 -1
  30. package/dist/callbacks/invalidateQueries.js.map +1 -1
  31. package/dist/callbacks/isFetching.d.ts +5 -0
  32. package/dist/callbacks/isFetching.d.ts.map +1 -0
  33. package/dist/callbacks/isFetching.js +5 -0
  34. package/dist/callbacks/isFetching.js.map +1 -0
  35. package/dist/callbacks/mutationFn.d.ts +2 -2
  36. package/dist/callbacks/mutationFn.d.ts.map +1 -1
  37. package/dist/callbacks/mutationFn.js.map +1 -1
  38. package/dist/callbacks/refetchQueries.d.ts +5 -0
  39. package/dist/callbacks/refetchQueries.d.ts.map +1 -0
  40. package/dist/callbacks/refetchQueries.js +5 -0
  41. package/dist/callbacks/refetchQueries.js.map +1 -0
  42. package/dist/callbacks/resetQueries.d.ts +2 -2
  43. package/dist/callbacks/resetQueries.d.ts.map +1 -1
  44. package/dist/callbacks/resetQueries.js.map +1 -1
  45. package/dist/callbacks/setInfiniteQueryData.d.ts +2 -2
  46. package/dist/callbacks/setInfiniteQueryData.d.ts.map +1 -1
  47. package/dist/callbacks/setInfiniteQueryData.js.map +1 -1
  48. package/dist/callbacks/setQueryData.d.ts +2 -2
  49. package/dist/callbacks/setQueryData.d.ts.map +1 -1
  50. package/dist/callbacks/setQueryData.js.map +1 -1
  51. package/dist/callbacks/useInfiniteQuery.d.ts +2 -2
  52. package/dist/callbacks/useInfiniteQuery.d.ts.map +1 -1
  53. package/dist/callbacks/useInfiniteQuery.js +7 -6
  54. package/dist/callbacks/useInfiniteQuery.js.map +1 -1
  55. package/dist/callbacks/useIsFetching.d.ts +5 -0
  56. package/dist/callbacks/useIsFetching.d.ts.map +1 -0
  57. package/dist/callbacks/useIsFetching.js +12 -0
  58. package/dist/callbacks/useIsFetching.js.map +1 -0
  59. package/dist/callbacks/useMutation.d.ts +2 -2
  60. package/dist/callbacks/useMutation.d.ts.map +1 -1
  61. package/dist/callbacks/useMutation.js +8 -7
  62. package/dist/callbacks/useMutation.js.map +1 -1
  63. package/dist/callbacks/useMutationState.d.ts +2 -2
  64. package/dist/callbacks/useMutationState.d.ts.map +1 -1
  65. package/dist/callbacks/useMutationState.js +3 -7
  66. package/dist/callbacks/useMutationState.js.map +1 -1
  67. package/dist/callbacks/useQueries.d.ts +2 -2
  68. package/dist/callbacks/useQueries.d.ts.map +1 -1
  69. package/dist/callbacks/useQueries.js +7 -6
  70. package/dist/callbacks/useQueries.js.map +1 -1
  71. package/dist/callbacks/useQuery.d.ts +3 -3
  72. package/dist/callbacks/useQuery.d.ts.map +1 -1
  73. package/dist/callbacks/useQuery.js +7 -6
  74. package/dist/callbacks/useQuery.js.map +1 -1
  75. package/dist/callbacks/useSuspenseInfiniteQuery.d.ts +2 -2
  76. package/dist/callbacks/useSuspenseInfiniteQuery.d.ts.map +1 -1
  77. package/dist/callbacks/useSuspenseInfiniteQuery.js +7 -6
  78. package/dist/callbacks/useSuspenseInfiniteQuery.js.map +1 -1
  79. package/dist/callbacks/useSuspenseQueries.d.ts +2 -2
  80. package/dist/callbacks/useSuspenseQueries.d.ts.map +1 -1
  81. package/dist/callbacks/useSuspenseQueries.js +7 -6
  82. package/dist/callbacks/useSuspenseQueries.js.map +1 -1
  83. package/dist/callbacks/useSuspenseQuery.d.ts +2 -2
  84. package/dist/callbacks/useSuspenseQuery.d.ts.map +1 -1
  85. package/dist/callbacks/useSuspenseQuery.js +7 -6
  86. package/dist/callbacks/useSuspenseQuery.js.map +1 -1
  87. package/dist/index.d.ts +3 -7
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/index.js.map +1 -1
  91. package/dist/lib/callQueryClientMethodWithQueryFilters.d.ts +2 -2
  92. package/dist/lib/callQueryClientMethodWithQueryFilters.d.ts.map +1 -1
  93. package/dist/lib/callQueryClientMethodWithQueryFilters.js +2 -29
  94. package/dist/lib/callQueryClientMethodWithQueryFilters.js.map +1 -1
  95. package/dist/lib/composeInfiniteQueryKey.d.ts +3 -3
  96. package/dist/lib/composeInfiniteQueryKey.d.ts.map +1 -1
  97. package/dist/lib/composeMutationKey.d.ts +4 -4
  98. package/dist/lib/composeMutationKey.d.ts.map +1 -1
  99. package/dist/lib/composeQueryFilters.d.ts +11 -0
  100. package/dist/lib/composeQueryFilters.d.ts.map +1 -0
  101. package/dist/lib/composeQueryFilters.js +32 -0
  102. package/dist/lib/composeQueryFilters.js.map +1 -0
  103. package/dist/lib/composeQueryKey.d.ts +3 -3
  104. package/dist/lib/composeQueryKey.d.ts.map +1 -1
  105. package/dist/lib/composeQueryKey.js.map +1 -1
  106. package/dist/lib/request.d.ts +50 -17
  107. package/dist/lib/request.d.ts.map +1 -1
  108. package/dist/lib/request.js +42 -31
  109. package/dist/lib/request.js.map +1 -1
  110. package/dist/lib/useQueryClient.d.ts +9 -0
  111. package/dist/lib/useQueryClient.d.ts.map +1 -0
  112. package/dist/lib/useQueryClient.js +15 -0
  113. package/dist/lib/useQueryClient.js.map +1 -0
  114. package/dist/qraftAPIClient.d.ts +7 -7
  115. package/dist/qraftAPIClient.d.ts.map +1 -1
  116. package/package.json +3 -3
  117. package/src/QraftContext.ts +24 -9
  118. package/src/RequestClient.ts +10 -31
  119. package/src/ServiceOperation.ts +93 -1
  120. package/src/callbacks/cancelQueries.ts +3 -3
  121. package/src/callbacks/getInfiniteQueryData.ts +3 -3
  122. package/src/callbacks/getInfiniteQueryKey.ts +3 -3
  123. package/src/callbacks/getMutationKey.ts +3 -3
  124. package/src/callbacks/getQueryData.ts +7 -3
  125. package/src/callbacks/getQueryKey.ts +7 -3
  126. package/src/callbacks/invalidateQueries.ts +3 -3
  127. package/src/callbacks/isFetching.ts +22 -0
  128. package/src/callbacks/mutationFn.ts +3 -3
  129. package/src/callbacks/refetchQueries.ts +22 -0
  130. package/src/callbacks/resetQueries.ts +3 -3
  131. package/src/callbacks/setInfiniteQueryData.ts +4 -4
  132. package/src/callbacks/setQueryData.ts +8 -4
  133. package/src/callbacks/useInfiniteQuery.ts +17 -15
  134. package/src/callbacks/useIsFetching.ts +35 -0
  135. package/src/callbacks/useMutation.ts +23 -17
  136. package/src/callbacks/useMutationState.ts +5 -11
  137. package/src/callbacks/useQueries.ts +20 -14
  138. package/src/callbacks/useQuery.ts +22 -17
  139. package/src/callbacks/useSuspenseInfiniteQuery.ts +17 -15
  140. package/src/callbacks/useSuspenseQueries.ts +16 -14
  141. package/src/callbacks/useSuspenseQuery.ts +17 -15
  142. package/src/index.ts +12 -7
  143. package/src/lib/callQueryClientMethodWithQueryFilters.ts +4 -40
  144. package/src/lib/composeInfiniteQueryKey.ts +3 -3
  145. package/src/lib/composeMutationKey.ts +5 -5
  146. package/src/lib/composeQueryFilters.ts +44 -0
  147. package/src/lib/composeQueryKey.ts +6 -3
  148. package/src/lib/request.ts +136 -74
  149. package/src/lib/useQueryClient.ts +26 -0
  150. package/src/qraftAPIClient.ts +8 -8
@@ -0,0 +1,44 @@
1
+ import { composeQueryKey } from './composeQueryKey.js';
2
+ import type { OperationRequestSchema } from './request.js';
3
+
4
+ /**
5
+ * Replaces the `parameters` field in the filters with a `queryKey` field based on the schema.
6
+ * If no filters are provided, a `queryKey` will be composed schema's base query key.
7
+ * @param schema
8
+ * @param filters
9
+ */
10
+ export function composeQueryFilters<Filters extends object>(
11
+ schema: OperationRequestSchema,
12
+ filters: Filters | undefined
13
+ ) {
14
+ if (!filters) {
15
+ return {
16
+ queryKey: composeQueryKey(schema, undefined),
17
+ };
18
+ }
19
+
20
+ if (filters && 'queryKey' in filters && 'parameters' in filters) {
21
+ throw new Error(
22
+ `'composeQueryFilters': 'queryKey' and 'parameters' cannot be used together`
23
+ );
24
+ }
25
+
26
+ if ('queryKey' in filters) {
27
+ return filters;
28
+ }
29
+
30
+ if ('parameters' in filters) {
31
+ const { parameters, ...filtersWithoutParameters } = filters;
32
+
33
+ Object.assign(filtersWithoutParameters, {
34
+ queryKey: composeQueryKey(schema, parameters),
35
+ });
36
+
37
+ return filtersWithoutParameters;
38
+ }
39
+
40
+ return {
41
+ ...filters,
42
+ queryKey: composeQueryKey(schema, undefined),
43
+ };
44
+ }
@@ -1,7 +1,10 @@
1
- import type { RequestClientSchema } from '../RequestClient.js';
2
- import { ServiceOperationQueryKey } from '../ServiceOperation.js';
1
+ import type { ServiceOperationQueryKey } from '../ServiceOperation.js';
2
+ import type { OperationRequestSchema } from './request.js';
3
3
 
4
- export function composeQueryKey<TSchema extends RequestClientSchema, TParams>(
4
+ export function composeQueryKey<
5
+ TSchema extends OperationRequestSchema,
6
+ TParams,
7
+ >(
5
8
  schema: TSchema,
6
9
  parameters: TParams | undefined
7
10
  ): ServiceOperationQueryKey<TSchema, TParams> {
@@ -2,49 +2,65 @@
2
2
  * @throws {error: object|string, response: Response} if the request fails
3
3
  */
4
4
  export async function request<T>(
5
- config: { baseUrl: string },
6
- requestInit: APIRequestInit,
7
- {
8
- urlSerializer: urlSerializerFunc,
9
- bodySerializer: bodySerializerFunc,
10
- }: {
11
- urlSerializer: typeof urlSerializer;
12
- bodySerializer: typeof bodySerializer;
13
- }
5
+ options: RequestOptions,
6
+ schema: OperationRequestSchema,
7
+ requestInfo: OperationRequestInfo
14
8
  ): Promise<T> {
15
- const {
16
- method,
17
- url,
18
- parameters,
19
- mediaType,
20
- headers,
21
- body,
22
- ...requestInitRest
23
- } = requestInit;
24
-
25
- const requestBody = bodySerializerFunc({
26
- method,
27
- mediaType,
28
- body,
29
- });
9
+ return baseRequest(
10
+ isRequiredRequestOptions(options)
11
+ ? options
12
+ : {
13
+ urlSerializer,
14
+ bodySerializer,
15
+ ...options,
16
+ },
17
+ schema,
18
+ requestInfo
19
+ );
20
+ }
30
21
 
31
- const response = await fetch(urlSerializerFunc(config, { url, parameters }), {
32
- method: method.toUpperCase(),
33
- body: requestBody,
34
- headers: mergeHeaders(
35
- {
36
- Accept: 'application/json',
37
- 'Content-Type': mediaType ?? getBodyContentType(body),
38
- },
39
- headers,
40
- parameters?.header,
41
- requestBody instanceof FormData
42
- ? // remove `Content-Type` if serialized body is FormData; browser will correctly set Content-Type & boundary expression
43
- { 'Content-Type': null }
44
- : undefined
45
- ),
46
- ...requestInitRest,
47
- });
22
+ export interface RequestOptions {
23
+ baseUrl: string;
24
+ urlSerializer?: URLSerializer;
25
+ bodySerializer?: BodySerializer;
26
+ }
27
+
28
+ type URLSerializer = typeof urlSerializer;
29
+ type BodySerializer = typeof bodySerializer;
30
+
31
+ /**
32
+ * @throws {error: object|string, response: Response} if the request fails
33
+ */
34
+ export async function baseRequest<T>(
35
+ options: Required<RequestOptions>,
36
+ schema: OperationRequestSchema,
37
+ requestInfo: OperationRequestInfo,
38
+ customFetch = fetch
39
+ ): Promise<T> {
40
+ const { parameters, headers, body, ...requestInfoRest } = requestInfo;
41
+
42
+ const requestBody = options.bodySerializer(schema, requestInfo);
43
+
44
+ const response = await customFetch(
45
+ options.urlSerializer(options.baseUrl, schema, requestInfo),
46
+ {
47
+ method: schema.method.toUpperCase(),
48
+ body: requestBody,
49
+ headers: mergeHeaders(
50
+ {
51
+ Accept: 'application/json',
52
+ 'Content-Type': schema.mediaType ?? getBodyContentType(body),
53
+ },
54
+ headers,
55
+ parameters?.header,
56
+ requestBody instanceof FormData
57
+ ? // remove `Content-Type` if serialized body is FormData; browser will correctly set Content-Type & boundary expression
58
+ { 'Content-Type': null }
59
+ : undefined
60
+ ),
61
+ ...requestInfoRest,
62
+ }
63
+ );
48
64
 
49
65
  // clone response to allow multiple reads
50
66
  const clonedResponse = response.clone();
@@ -57,21 +73,25 @@ export async function request<T>(
57
73
  }
58
74
 
59
75
  export function urlSerializer(
60
- config: { baseUrl: string },
61
- { url, parameters }: Pick<APIRequestInit, 'url' | 'parameters'>
76
+ baseUrl: string,
77
+ schema: OperationRequestSchema,
78
+ info: OperationRequestInfo
62
79
  ): string {
63
- const path = url.replace(/{(.*?)}/g, (substring: string, group: string) => {
64
- if (parameters?.path?.hasOwnProperty(group)) {
65
- return encodeURI(String(parameters?.path[group]));
80
+ const path = schema.url.replace(
81
+ /{(.*?)}/g,
82
+ (substring: string, group: string) => {
83
+ if (info.parameters?.path?.hasOwnProperty(group)) {
84
+ return encodeURI(String(info.parameters?.path[group]));
85
+ }
86
+ return substring;
66
87
  }
67
- return substring;
68
- });
88
+ );
69
89
 
70
- if (parameters?.query) {
71
- return `${config.baseUrl}${path}${getQueryString(parameters.query)}`;
90
+ if (info.parameters?.query) {
91
+ return `${baseUrl}${path}${getQueryString(info.parameters.query)}`;
72
92
  }
73
93
 
74
- return `${config.baseUrl}${path}`;
94
+ return `${baseUrl}${path}`;
75
95
  }
76
96
 
77
97
  function getQueryString(params: Record<string, any>): string {
@@ -133,38 +153,37 @@ function mergeHeaders(...allHeaders: (HeadersOptions | undefined)[]) {
133
153
  return headers;
134
154
  }
135
155
 
136
- export function bodySerializer(options: {
137
- method: APIRequestInit['method'];
138
- mediaType: APIRequestInit['mediaType'];
139
- body: APIRequestInit['body'];
140
- }) {
141
- if (options.body === undefined) return;
156
+ export function bodySerializer(
157
+ schema: OperationRequestSchema,
158
+ info: OperationRequestInfo
159
+ ) {
160
+ if (info.body === undefined) return;
142
161
 
143
162
  if (
144
- options.method === 'get' ||
145
- options.method === 'head' ||
146
- options.method === 'options'
163
+ schema.method === 'get' ||
164
+ schema.method === 'head' ||
165
+ schema.method === 'options'
147
166
  )
148
167
  return;
149
168
 
150
- if (options.mediaType?.includes('/form-data'))
151
- return getRequestBodyFormData(options);
169
+ if (schema.mediaType?.includes('/form-data'))
170
+ return getRequestBodyFormData(info);
152
171
 
153
172
  if (
154
- !options.mediaType?.includes('/json') &&
155
- (typeof options.body === 'string' ||
156
- options.body instanceof Blob ||
157
- options.body instanceof FormData)
173
+ !schema.mediaType?.includes('/json') &&
174
+ (typeof info.body === 'string' ||
175
+ info.body instanceof Blob ||
176
+ info.body instanceof FormData)
158
177
  ) {
159
- return options.body;
178
+ return info.body;
160
179
  }
161
180
 
162
- return JSON.stringify(options.body);
181
+ return JSON.stringify(info.body);
163
182
  }
164
183
 
165
184
  function getRequestBodyFormData({
166
185
  body,
167
- }: Pick<APIRequestInit, 'body'>): FormData | undefined {
186
+ }: Pick<OperationRequestInfo, 'body'>): FormData | undefined {
168
187
  if (body instanceof FormData) return body;
169
188
  if (body === null) return;
170
189
 
@@ -203,7 +222,7 @@ function getRequestBodyFormData({
203
222
  return formData;
204
223
  }
205
224
 
206
- function getBodyContentType(body: APIRequestInit['body']) {
225
+ function getBodyContentType(body: OperationRequestInfo['body']) {
207
226
  if (!body) return;
208
227
  if (body instanceof Blob) return body.type || 'application/octet-stream';
209
228
  if (typeof body === 'string') return 'text/plain';
@@ -242,12 +261,27 @@ async function getResponseBody<T>(response: Response): Promise<T | undefined> {
242
261
  return response.text() as Promise<T>;
243
262
  }
244
263
 
264
+ function isRequiredRequestOptions<T extends RequestOptions>(
265
+ options: RequestOptions
266
+ ): options is Required<RequestOptions> {
267
+ return Boolean(options.urlSerializer && options.bodySerializer);
268
+ }
269
+
245
270
  // To have definitely typed headers without a conversion to stings
246
271
  export type HeadersOptions =
247
272
  | HeadersInit
248
273
  | Record<string, string | number | boolean | null | undefined>;
249
274
 
250
- export type APIRequestInit = {
275
+ export interface OperationRequestSchema {
276
+ /**
277
+ * Operation path
278
+ * @example /user/{id}
279
+ */
280
+ readonly url: string;
281
+
282
+ /**
283
+ * Operation method
284
+ */
251
285
  readonly method:
252
286
  | 'get'
253
287
  | 'put'
@@ -257,14 +291,42 @@ export type APIRequestInit = {
257
291
  | 'options'
258
292
  | 'head'
259
293
  | 'trace';
260
- readonly url: string;
294
+
295
+ /**
296
+ * Media type of the request body
297
+ * @example application/json
298
+ */
299
+ readonly mediaType?: string;
300
+ }
301
+
302
+ export interface OperationRequestInfo
303
+ extends Omit<RequestInit, 'headers' | 'method' | 'body'> {
304
+ /**
305
+ * OpenAPI parameters
306
+ * @example
307
+ * ```ts
308
+ * { path: {id: 1}, query: {search: 'hello'} }
309
+ * ```
310
+ */
261
311
  readonly parameters?: {
262
312
  readonly path?: Record<string, any>;
263
313
  readonly cookie?: Record<string, any>;
264
314
  readonly header?: Record<string, any>;
265
315
  readonly query?: Record<string, any>;
266
316
  };
317
+ /**
318
+ * Request body
319
+ * @example { name: 'John' }
320
+ */
267
321
  readonly body?: BodyInit | Record<string, unknown> | null;
268
- readonly mediaType?: string;
322
+ /**
323
+ * Request headers
324
+ * @example { 'X-Auth': '123' }
325
+ */
269
326
  readonly headers?: HeadersOptions;
270
- } & Omit<RequestInit, 'headers' | 'method' | 'body'>;
327
+
328
+ /**
329
+ * Tanstack Query Meta
330
+ */
331
+ meta?: Record<string, unknown>;
332
+ }
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+
3
+ import { useContext } from 'react';
4
+
5
+ import {
6
+ QueryClient,
7
+ useQueryClient as useQueryClientTanstack,
8
+ } from '@tanstack/react-query';
9
+
10
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
11
+ import { QraftContext } from '../QraftContext.js';
12
+
13
+ /**
14
+ * Get the QueryClient from the QraftContext or the provided QueryClient argument.
15
+ * @param qraftOptions if `queryClient` is not provided, will be taken from context
16
+ * @param queryClient If not provided, will be taken this instance
17
+ */
18
+ export function useQueryClient(
19
+ qraftOptions: QraftClientOptions | undefined,
20
+ queryClient: QueryClient | undefined
21
+ ) {
22
+ const queryClientByContext = useContext(qraftOptions?.context ?? QraftContext)
23
+ ?.queryClient;
24
+
25
+ return useQueryClientTanstack(queryClient ?? queryClientByContext);
26
+ }
@@ -1,12 +1,12 @@
1
- import { Context } from 'react';
1
+ import type { Context } from 'react';
2
2
 
3
3
  import { createRecursiveProxy } from './lib/createRecursiveProxy.js';
4
- import { QraftContextValue } from './QraftContext.js';
5
- import type { RequestClientSchema } from './RequestClient.js';
4
+ import type { OperationRequestSchema } from './lib/request.js';
5
+ import type { QraftContextValue } from './QraftContext.js';
6
6
 
7
- export type QraftClientOptions = {
7
+ export interface QraftClientOptions {
8
8
  context?: Context<QraftContextValue>;
9
- };
9
+ }
10
10
 
11
11
  export const qraftAPIClient = <
12
12
  Services extends ServicesOutput<Services>,
@@ -50,7 +50,7 @@ export const qraftAPIClient = <
50
50
 
51
51
  function isServiceOperation(
52
52
  input: unknown
53
- ): input is { schema: RequestClientSchema } {
53
+ ): input is { schema: OperationRequestSchema } {
54
54
  return input !== null && typeof input === 'object' && 'schema' in input;
55
55
  }
56
56
 
@@ -63,7 +63,7 @@ function getByPath(obj: Record<string, unknown>, path: string[]) {
63
63
 
64
64
  type ServicesOutput<Services> = {
65
65
  [service in keyof Services]: {
66
- [method in keyof Services[service]]: { schema: RequestClientSchema };
66
+ [method in keyof Services[service]]: { schema: OperationRequestSchema };
67
67
  };
68
68
  };
69
69
 
@@ -82,7 +82,7 @@ type ServicesCallbacksFilter<
82
82
  Callbacks,
83
83
  > = Services extends {
84
84
  [serviceName in keyof Services]: {
85
- [method in keyof Services[serviceName]]: { schema: RequestClientSchema };
85
+ [method in keyof Services[serviceName]]: { schema: OperationRequestSchema };
86
86
  };
87
87
  }
88
88
  ? {