@navios/react-query 0.1.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/dist/index.js ADDED
@@ -0,0 +1,345 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/react-query/src/index.mts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ declareClient: () => declareClient,
24
+ makeInfiniteQueryOptions: () => makeInfiniteQueryOptions,
25
+ makeMutation: () => makeMutation,
26
+ makeQueryOptions: () => makeQueryOptions,
27
+ mutationKeyCreator: () => mutationKeyCreator,
28
+ queryKeyCreator: () => queryKeyCreator
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
31
+
32
+ // packages/react-query/src/utils/query-key-creator.mts
33
+ var import_common = require("@navios/common");
34
+ function queryKeyCreator(config, options, isInfinite) {
35
+ const url = config.url;
36
+ const urlParts = url.split("/").filter(Boolean);
37
+ return {
38
+ template: urlParts,
39
+ // @ts-expect-error We have correct types in return type
40
+ dataTag: (params) => {
41
+ var _a;
42
+ const queryParams = params && "querySchema" in config && "params" in params ? (_a = config.querySchema) == null ? void 0 : _a.parse(params.params) : [];
43
+ return [
44
+ ...options.keyPrefix ?? [],
45
+ ...urlParts.map(
46
+ (part) => part.startsWith("$") ? (
47
+ // @ts-expect-error TS2339 We know that the urlParams are defined only if the url has params
48
+ params.urlParams[part.slice(1)].toString()
49
+ ) : part
50
+ ),
51
+ ...options.keySuffix ?? [],
52
+ queryParams ?? []
53
+ ];
54
+ },
55
+ // @ts-expect-error We have correct types in return type
56
+ filterKey: (params) => {
57
+ return [
58
+ ...options.keyPrefix ?? [],
59
+ ...urlParts.map(
60
+ (part) => part.startsWith("$") ? (
61
+ // @ts-expect-error TS2339 We know that the urlParams are defined only if the url has params
62
+ params.urlParams[part.slice(1)].toString()
63
+ ) : part
64
+ ),
65
+ ...options.keySuffix ?? []
66
+ ];
67
+ },
68
+ bindToUrl: (params) => {
69
+ return (0, import_common.bindUrlParams)(url, params ?? {});
70
+ }
71
+ };
72
+ }
73
+
74
+ // packages/react-query/src/utils/mutation-key.creator.mts
75
+ function mutationKeyCreator(config, options = {
76
+ processResponse: (data) => data
77
+ }) {
78
+ const queryKey = queryKeyCreator(config, options, false);
79
+ return (params) => {
80
+ return queryKey.filterKey(params);
81
+ };
82
+ }
83
+
84
+ // packages/react-query/src/make-infinite-query-options.mts
85
+ var import_react_query = require("@tanstack/react-query");
86
+ function makeInfiniteQueryOptions(endpoint, options, baseQuery = {}) {
87
+ const config = endpoint.config;
88
+ const queryKey = queryKeyCreator(config, options, true);
89
+ const processResponse = options.processResponse;
90
+ const res = (params) => {
91
+ return (0, import_react_query.infiniteQueryOptions)({
92
+ // @ts-expect-error TS2322 We know the type
93
+ queryKey: queryKey.dataTag(params),
94
+ queryFn: async ({ signal, pageParam }) => {
95
+ let result;
96
+ try {
97
+ result = await endpoint({
98
+ signal,
99
+ // @ts-expect-error TS2345 We bind the url params only if the url has params
100
+ urlParams: params.urlParams,
101
+ params: {
102
+ ..."params" in params ? params.params : {},
103
+ ...pageParam
104
+ }
105
+ });
106
+ } catch (err) {
107
+ if (options.onFail) {
108
+ options.onFail(err);
109
+ }
110
+ throw err;
111
+ }
112
+ return processResponse(result);
113
+ },
114
+ getNextPageParam: options.getNextPageParam,
115
+ initialPageParam: options.initialPageParam ?? config.querySchema.parse("params" in params ? params.params : {}),
116
+ ...baseQuery
117
+ });
118
+ };
119
+ res.queryKey = queryKey;
120
+ res.use = (params) => {
121
+ return (0, import_react_query.useInfiniteQuery)(res(params));
122
+ };
123
+ res.useSuspense = (params) => {
124
+ return (0, import_react_query.useSuspenseInfiniteQuery)(res(params));
125
+ };
126
+ res.invalidate = (queryClient, params) => {
127
+ return queryClient.invalidateQueries({
128
+ // @ts-expect-error We add additional function to the result
129
+ queryKey: res.queryKey.dataTag(params)
130
+ });
131
+ };
132
+ res.invalidateAll = (queryClient, params) => {
133
+ return queryClient.invalidateQueries({
134
+ // @ts-expect-error We add additional function to the result
135
+ queryKey: res.queryKey.filterKey(params),
136
+ exact: false
137
+ });
138
+ };
139
+ return res;
140
+ }
141
+
142
+ // packages/react-query/src/make-mutation.mts
143
+ var import_react_query2 = require("@tanstack/react-query");
144
+ function makeMutation(endpoint, options) {
145
+ const config = endpoint.config;
146
+ const mutationKey = mutationKeyCreator(config, options);
147
+ const result = (keyParams) => {
148
+ const queryClient = (0, import_react_query2.useQueryClient)();
149
+ const {
150
+ useKey,
151
+ useContext,
152
+ onError,
153
+ onSuccess,
154
+ keyPrefix,
155
+ keySuffix,
156
+ processResponse,
157
+ ...rest
158
+ } = options;
159
+ const context = useContext == null ? void 0 : useContext();
160
+ return (0, import_react_query2.useMutation)(
161
+ {
162
+ ...rest,
163
+ mutationKey: useKey ? mutationKey({
164
+ urlParams: keyParams
165
+ }) : void 0,
166
+ scope: useKey ? {
167
+ id: JSON.stringify(
168
+ mutationKey({
169
+ urlParams: keyParams
170
+ })
171
+ )
172
+ } : void 0,
173
+ async mutationFn(params) {
174
+ const response = await endpoint(params);
175
+ return processResponse(response);
176
+ },
177
+ onSuccess: onSuccess ? (data, variables) => {
178
+ return onSuccess == null ? void 0 : onSuccess(queryClient, data, variables, context);
179
+ } : void 0,
180
+ onError: onError ? (err, variables) => {
181
+ return onError == null ? void 0 : onError(queryClient, err, variables, context);
182
+ } : void 0
183
+ },
184
+ queryClient
185
+ );
186
+ };
187
+ result.useIsMutating = (keyParams) => {
188
+ if (!options.useKey) {
189
+ throw new Error(
190
+ "useIsMutating can only be used when useKey is set to true"
191
+ );
192
+ }
193
+ const isMutating = (0, import_react_query2.useIsMutating)({
194
+ mutationKey: mutationKey({
195
+ urlParams: keyParams
196
+ })
197
+ });
198
+ return isMutating > 0;
199
+ };
200
+ result.mutationKey = mutationKey;
201
+ return result;
202
+ }
203
+
204
+ // packages/react-query/src/make-query-options.mts
205
+ var import_react_query3 = require("@tanstack/react-query");
206
+ function makeQueryOptions(endpoint, options, baseQuery = {}) {
207
+ const config = endpoint.config;
208
+ const queryKey = queryKeyCreator(config, options, false);
209
+ const processResponse = options.processResponse;
210
+ const result = (params) => {
211
+ return (0, import_react_query3.queryOptions)({
212
+ queryKey: queryKey.dataTag(params),
213
+ queryFn: async ({ signal }) => {
214
+ let result2;
215
+ try {
216
+ result2 = await endpoint({
217
+ signal,
218
+ ...params
219
+ });
220
+ } catch (err) {
221
+ if (options.onFail) {
222
+ options.onFail(err);
223
+ }
224
+ throw err;
225
+ }
226
+ return processResponse(result2);
227
+ },
228
+ ...baseQuery
229
+ });
230
+ };
231
+ result.queryKey = queryKey;
232
+ result.use = (params) => {
233
+ return (0, import_react_query3.useInfiniteQuery)(result(params));
234
+ };
235
+ result.useSuspense = (params) => {
236
+ return (0, import_react_query3.useSuspenseInfiniteQuery)(result(params));
237
+ };
238
+ result.invalidate = (queryClient, params) => {
239
+ return queryClient.invalidateQueries({
240
+ // @ts-expect-error We add additional function to the result
241
+ queryKey: result.queryKey.dataTag(params)
242
+ });
243
+ };
244
+ result.invalidateAll = (queryClient, params) => {
245
+ return queryClient.invalidateQueries({
246
+ // @ts-expect-error We add additional function to the result
247
+ queryKey: result.queryKey.filterKey(params),
248
+ exact: false
249
+ });
250
+ };
251
+ return result;
252
+ }
253
+
254
+ // packages/react-query/src/declare-client.mts
255
+ function declareClient({
256
+ api,
257
+ defaults = {}
258
+ }) {
259
+ function query(config) {
260
+ const endpoint = api.declareEndpoint({
261
+ // @ts-expect-error we accept only specific methods
262
+ method: config.method,
263
+ url: config.url,
264
+ querySchema: config.querySchema,
265
+ responseSchema: config.responseSchema
266
+ });
267
+ return makeQueryOptions(endpoint, {
268
+ ...defaults,
269
+ processResponse: config.processResponse ?? ((data) => data)
270
+ });
271
+ }
272
+ function queryFromEndpoint(endpoint, options) {
273
+ return makeQueryOptions(endpoint, {
274
+ ...defaults,
275
+ processResponse: (options == null ? void 0 : options.processResponse) ?? ((data) => data)
276
+ });
277
+ }
278
+ function infiniteQuery(config) {
279
+ const endpoint = api.declareEndpoint({
280
+ // @ts-expect-error we accept only specific methods
281
+ method: config.method,
282
+ url: config.url,
283
+ querySchema: config.querySchema,
284
+ responseSchema: config.responseSchema
285
+ });
286
+ return makeInfiniteQueryOptions(endpoint, {
287
+ ...defaults,
288
+ processResponse: config.processResponse ?? ((data) => data),
289
+ getNextPageParam: config.getNextPageParam,
290
+ getPreviousPageParam: config.getPreviousPageParam,
291
+ initialPageParam: config.initialPageParam
292
+ });
293
+ }
294
+ function infiniteQueryFromEndpoint(endpoint, options) {
295
+ return makeInfiniteQueryOptions(endpoint, {
296
+ ...defaults,
297
+ processResponse: (options == null ? void 0 : options.processResponse) ?? ((data) => data),
298
+ getNextPageParam: options.getNextPageParam,
299
+ getPreviousPageParam: options == null ? void 0 : options.getPreviousPageParam,
300
+ initialPageParam: options == null ? void 0 : options.initialPageParam
301
+ });
302
+ }
303
+ function mutation(config) {
304
+ const endpoint = api.declareEndpoint({
305
+ // @ts-expect-error We forgot about the DELETE method in original makeMutation
306
+ method: config.method,
307
+ url: config.url,
308
+ querySchema: config.querySchema,
309
+ requestSchema: config.requestSchema,
310
+ responseSchema: config.responseSchema
311
+ });
312
+ return makeMutation(endpoint, {
313
+ processResponse: config.processResponse ?? ((data) => data),
314
+ useContext: config.useContext,
315
+ // @ts-expect-error We forgot about the DELETE method in original makeMutation
316
+ onSuccess: config.onSuccess,
317
+ // @ts-expect-error We forgot about the DELETE method in original makeMutation
318
+ onError: config.onError,
319
+ useKey: config.useKey,
320
+ ...defaults
321
+ });
322
+ }
323
+ return {
324
+ // @ts-expect-error We simplified types here
325
+ query,
326
+ // @ts-expect-error We simplified types here
327
+ queryFromEndpoint,
328
+ // @ts-expect-error We simplified types here
329
+ infiniteQuery,
330
+ // @ts-expect-error We simplified types here
331
+ infiniteQueryFromEndpoint,
332
+ // @ts-expect-error We simplified types here
333
+ mutation
334
+ };
335
+ }
336
+ // Annotate the CommonJS export names for ESM import in node:
337
+ 0 && (module.exports = {
338
+ declareClient,
339
+ makeInfiniteQueryOptions,
340
+ makeMutation,
341
+ makeQueryOptions,
342
+ mutationKeyCreator,
343
+ queryKeyCreator
344
+ });
345
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../packages/react-query/src/index.mts","../../../../packages/react-query/src/utils/query-key-creator.mts","../../../../packages/react-query/src/utils/mutation-key.creator.mts","../../../../packages/react-query/src/make-infinite-query-options.mts","../../../../packages/react-query/src/make-mutation.mts","../../../../packages/react-query/src/make-query-options.mts","../../../../packages/react-query/src/declare-client.mts"],"sourcesContent":["export * from './types/index.mjs'\nexport * from './utils/mutation-key.creator.mjs'\nexport * from './utils/query-key-creator.mjs'\nexport * from './declare-client.mjs'\nexport * from './make-mutation.mjs'\nexport * from './make-infinite-query-options.mjs'\nexport * from './make-query-options.mjs'\nexport * from './types.mjs'\n","import type { AnyEndpointConfig, UrlHasParams, UrlParams } from '@navios/common'\nimport type { DataTag, InfiniteData } from '@tanstack/react-query'\nimport type { AnyZodObject, z } from 'zod'\n\nimport { bindUrlParams } from '@navios/common'\n\nimport type { BaseQueryParams } from '../types.mjs'\n\ntype Split<S extends string, D extends string> = string extends S\n ? string[]\n : S extends ''\n ? []\n : S extends `${infer T}${D}${infer U}`\n ? [T, ...Split<U, D>]\n : [S]\n\nexport type QueryKeyCreatorResult<\n QuerySchema = undefined,\n Url extends string = string,\n Result = unknown,\n IsInfinite extends boolean = false,\n HasParams extends UrlHasParams<Url> = UrlHasParams<Url>,\n> = {\n template: Split<Url, '/'>\n dataTag: (\n params: (HasParams extends true ? { urlParams: UrlParams<Url> } : {}) &\n (QuerySchema extends AnyZodObject\n ? { params: z.input<QuerySchema> }\n : {}),\n ) => DataTag<\n Split<Url, '/'>,\n IsInfinite extends true ? InfiniteData<Result> : Result,\n Error\n >\n filterKey: (\n params: HasParams extends true ? { urlParams: UrlParams<Url> } : {},\n ) => DataTag<\n Split<Url, '/'>,\n IsInfinite extends true ? InfiniteData<Result> : Result,\n Error\n >\n bindToUrl: (\n params: (HasParams extends true ? { urlParams: UrlParams<Url> } : {}) &\n (QuerySchema extends AnyZodObject\n ? { params: z.infer<QuerySchema> }\n : {}),\n ) => string\n}\n\nexport function queryKeyCreator<\n Config extends AnyEndpointConfig,\n Options extends BaseQueryParams<Config>,\n IsInfinite extends boolean,\n Url extends Config['url'] = Config['url'],\n HasParams extends UrlHasParams<Url> = UrlHasParams<Url>,\n>(\n config: Config,\n options: Options,\n isInfinite: IsInfinite,\n): QueryKeyCreatorResult<\n Config['querySchema'],\n Url,\n Options['processResponse'] extends (...args: any[]) => infer Result\n ? Result\n : never,\n IsInfinite,\n HasParams\n> {\n const url = config.url as Url\n const urlParts = url.split('/').filter(Boolean) as Split<Url, '/'>\n return {\n template: urlParts,\n // @ts-expect-error We have correct types in return type\n dataTag: (params) => {\n const queryParams =\n params && 'querySchema' in config && 'params' in params\n ? config.querySchema?.parse(params.params)\n : []\n return [\n ...(options.keyPrefix ?? []),\n ...urlParts.map((part) =>\n part.startsWith('$')\n ? // @ts-expect-error TS2339 We know that the urlParams are defined only if the url has params\n params.urlParams[part.slice(1)].toString()\n : part,\n ),\n ...(options.keySuffix ?? []),\n queryParams ?? [],\n ] as unknown as DataTag<\n Split<Url, '/'>,\n Options['processResponse'] extends (...args: any[]) => infer Result\n ? IsInfinite extends true\n ? InfiniteData<Result>\n : Result\n : never,\n Error\n >\n },\n // @ts-expect-error We have correct types in return type\n filterKey: (params) => {\n return [\n ...(options.keyPrefix ?? []),\n ...urlParts.map((part) =>\n part.startsWith('$')\n ? // @ts-expect-error TS2339 We know that the urlParams are defined only if the url has params\n params.urlParams[part.slice(1)].toString()\n : part,\n ),\n ...(options.keySuffix ?? []),\n ] as unknown as DataTag<\n Split<Url, '/'>,\n Options['processResponse'] extends (...args: any[]) => infer Result\n ? IsInfinite extends true\n ? InfiniteData<Result>\n : Result\n : never,\n Error\n >\n },\n\n bindToUrl: (params) => {\n return bindUrlParams<Url>(url, params ?? ({} as any))\n },\n }\n}\n","import type { AnyEndpointConfig, UrlHasParams, UrlParams } from '@navios/common'\nimport type { DataTag } from '@tanstack/react-query'\n\nimport type { BaseQueryParams } from '../types.mjs'\n\nimport { queryKeyCreator } from './query-key-creator.mjs'\n\n/**\n * Creates a mutation key for a given endpoint configuration and options.\n *\n * @param {config: Config } config - The endpoint object containing the configuration.\n * @param {Options} [options] - Optional query parameters with a default `processResponse` function that processes the response data.\n *\n * @returns {Object} An object containing the `mutationKey` function.\n *\n * The `mutationKey` function generates a mutation key based on the provided parameters:\n * - If the URL has parameters (`HasParams` is `true`), it expects an object with `urlParams`.\n * - The return type of the `mutationKey` function depends on the `processResponse` function in `options`.\n * If `processResponse` is defined, the return type is a `DataTag` containing the processed result and an error type.\n *\n * @example Example usage:\n * ```typescript\n * const createMutationKey = mutationKeyCreator(endpoint.config);\n * const mutationKey = createMutationKey({ urlParams: { id: 123 } });\n * ```\n *\n * @example Advanced usage:\n * ```ts\n * const createMutationKey = mutationKeyCreator(endpoint.config, {\n * processResponse: (data) => {\n * if (!data.success) {\n * throw new Error(data.message);\n * }\n * return data.data;\n * },\n * });\n * // We create a mutation that will be shared across the project for all passed userId\n * const mutationKey = createMutationKey({ urlParams: { projectId: 123, userId: 'wildcard' } });\n */\nexport function mutationKeyCreator<\n Config extends AnyEndpointConfig,\n Options extends BaseQueryParams<Config>,\n Url extends Config['url'] = Config['url'],\n HasParams extends UrlHasParams<Url> = UrlHasParams<Url>,\n>(\n config: Config,\n options: Options = {\n processResponse: (data) => data,\n } as Options,\n): (\n params: HasParams extends true ? { urlParams: UrlParams<Url> } : {},\n) => Options['processResponse'] extends (...args: any[]) => infer Result\n ? DataTag<[Config['url']], Result, Error>\n : never {\n const queryKey = queryKeyCreator(config, options, false)\n\n // @ts-expect-error We have correct types in return type\n return (params) => {\n return queryKey.filterKey(params)\n }\n}\n","import type {\n AbstractEndpoint,\n AnyEndpointConfig,\n UrlParams,\n} from '@navios/common'\nimport type {\n InfiniteData,\n QueryClient,\n UseInfiniteQueryOptions,\n UseSuspenseInfiniteQueryOptions,\n} from '@tanstack/react-query'\nimport type { z } from 'zod'\n\nimport {\n infiniteQueryOptions,\n useInfiniteQuery,\n useSuspenseInfiniteQuery,\n} from '@tanstack/react-query'\n\nimport type { InfiniteQueryOptions } from './types.mjs'\nimport type { ClientQueryArgs } from './types/index.mjs'\n\nimport { queryKeyCreator } from './utils/query-key-creator.mjs'\n\nexport function makeInfiniteQueryOptions<\n Config extends AnyEndpointConfig,\n Options extends InfiniteQueryOptions<Config>,\n BaseQuery extends Omit<\n UseInfiniteQueryOptions<ReturnType<Options['processResponse']>, Error, any>,\n | 'queryKey'\n | 'queryFn'\n | 'getNextPageParam'\n | 'initialPageParam'\n | 'placeholderData'\n | 'throwOnError'\n >,\n>(\n endpoint: AbstractEndpoint<Config>,\n options: Options,\n baseQuery: BaseQuery = {} as BaseQuery,\n) {\n const config = endpoint.config\n const queryKey = queryKeyCreator(config, options, true)\n\n const processResponse = options.processResponse\n const res = (\n params: ClientQueryArgs,\n ): Options['processResponse'] extends (...args: any[]) => infer Result\n ? UseSuspenseInfiniteQueryOptions<\n Result,\n Error,\n BaseQuery['select'] extends (...args: any[]) => infer T\n ? T\n : InfiniteData<Result>\n >\n : never => {\n // @ts-expect-error TS2322 We know that the processResponse is defined\n return infiniteQueryOptions({\n // @ts-expect-error TS2322 We know the type\n queryKey: queryKey.dataTag(params),\n queryFn: async ({ signal, pageParam }) => {\n let result\n try {\n result = await endpoint({\n signal,\n // @ts-expect-error TS2345 We bind the url params only if the url has params\n urlParams: params.urlParams as z.infer<UrlParams<Config['url']>>,\n params: {\n ...('params' in params ? params.params : {}),\n ...(pageParam as z.infer<Config['querySchema']>),\n },\n })\n } catch (err) {\n if (options.onFail) {\n options.onFail(err)\n }\n throw err\n }\n\n return processResponse(result)\n },\n getNextPageParam: options.getNextPageParam,\n initialPageParam:\n options.initialPageParam ??\n config.querySchema.parse('params' in params ? params.params : {}),\n ...baseQuery,\n })\n }\n res.queryKey = queryKey\n\n res.use = (params: ClientQueryArgs) => {\n return useInfiniteQuery(res(params))\n }\n\n res.useSuspense = (params: ClientQueryArgs) => {\n return useSuspenseInfiniteQuery(res(params))\n }\n\n res.invalidate = (queryClient: QueryClient, params: ClientQueryArgs) => {\n return queryClient.invalidateQueries({\n // @ts-expect-error We add additional function to the result\n queryKey: res.queryKey.dataTag(params),\n })\n }\n\n res.invalidateAll = (queryClient: QueryClient, params: ClientQueryArgs) => {\n return queryClient.invalidateQueries({\n // @ts-expect-error We add additional function to the result\n queryKey: res.queryKey.filterKey(params),\n exact: false,\n })\n }\n\n return res\n}\n","import type {\n AbstractEndpoint,\n AnyEndpointConfig,\n UrlHasParams,\n UrlParams,\n} from '@navios/common'\nimport type { UseMutationResult } from '@tanstack/react-query'\nimport type { z } from 'zod'\n\nimport {\n useIsMutating,\n useMutation,\n useQueryClient,\n} from '@tanstack/react-query'\n\nimport type { BaseMutationArgs, BaseMutationParams } from './types.mjs'\n\nimport { mutationKeyCreator } from './index.mjs'\n\nexport function makeMutation<\n Config extends AnyEndpointConfig,\n TData = unknown,\n TVariables extends BaseMutationArgs<Config> = BaseMutationArgs<Config>,\n TResponse = z.output<Config['responseSchema']>,\n TContext = unknown,\n UseKey extends boolean = false,\n>(\n endpoint: AbstractEndpoint<Config>,\n options: BaseMutationParams<\n Config,\n TData,\n TVariables,\n TResponse,\n TContext,\n UseKey\n >,\n) {\n const config = endpoint.config\n\n const mutationKey = mutationKeyCreator(config, options)\n const result = (\n keyParams: UseKey extends true\n ? UrlHasParams<Config['url']> extends true\n ? UrlParams<Config['url']>\n : never\n : never,\n ): UseMutationResult<TData, Error, BaseMutationArgs<Config>> => {\n const queryClient = useQueryClient()\n const {\n useKey,\n useContext,\n onError,\n onSuccess,\n keyPrefix,\n keySuffix,\n processResponse,\n ...rest\n } = options\n\n const context = useContext?.() as TContext\n\n // @ts-expect-error The types match\n return useMutation(\n {\n ...rest,\n mutationKey: useKey\n ? mutationKey({\n urlParams: keyParams,\n })\n : undefined,\n scope: useKey\n ? {\n id: JSON.stringify(\n mutationKey({\n urlParams: keyParams,\n }),\n ),\n }\n : undefined,\n async mutationFn(params: TVariables) {\n const response = await endpoint(params)\n\n return processResponse(response) as TData\n },\n onSuccess: onSuccess\n ? (data: TData, variables: TVariables) => {\n return onSuccess?.(queryClient, data, variables, context)\n }\n : undefined,\n onError: onError\n ? (err: Error, variables: TVariables) => {\n return onError?.(queryClient, err, variables, context)\n }\n : undefined,\n },\n queryClient,\n )\n }\n result.useIsMutating = (\n keyParams: UseKey extends true\n ? UrlHasParams<Config['url']> extends true\n ? UrlParams<Config['url']>\n : never\n : never,\n ): boolean => {\n if (!options.useKey) {\n throw new Error(\n 'useIsMutating can only be used when useKey is set to true',\n )\n }\n const isMutating = useIsMutating({\n mutationKey: mutationKey({\n urlParams: keyParams,\n }),\n })\n return isMutating > 0\n }\n result.mutationKey = mutationKey\n\n return result\n}\n","import type { AbstractEndpoint, AnyEndpointConfig } from '@navios/common'\nimport type {\n DataTag,\n QueryClient,\n UseQueryOptions,\n UseSuspenseQueryOptions,\n} from '@tanstack/react-query'\n\nimport {\n queryOptions,\n useInfiniteQuery,\n useSuspenseInfiniteQuery,\n} from '@tanstack/react-query'\n\nimport type { BaseQueryArgs, BaseQueryParams } from './types.mjs'\nimport type { ClientQueryArgs } from './types/index.mjs'\n\nimport { queryKeyCreator } from './utils/query-key-creator.mjs'\n\ntype Split<S extends string, D extends string> = string extends S\n ? string[]\n : S extends ''\n ? []\n : S extends `${infer T}${D}${infer U}`\n ? [T, ...Split<U, D>]\n : [S]\n\nexport function makeQueryOptions<\n Config extends AnyEndpointConfig,\n Options extends BaseQueryParams<Config>,\n BaseQuery extends Omit<\n UseQueryOptions<ReturnType<Options['processResponse']>, Error, any>,\n | 'queryKey'\n | 'queryFn'\n | 'getNextPageParam'\n | 'initialPageParam'\n | 'enabled'\n | 'throwOnError'\n | 'placeholderData'\n >,\n>(\n endpoint: AbstractEndpoint<Config>,\n options: Options,\n baseQuery: BaseQuery = {} as BaseQuery,\n) {\n const config = endpoint.config\n // Let's hack the url to be a string for now\n const queryKey = queryKeyCreator(config, options, false)\n const processResponse = options.processResponse\n\n const result = (\n params: BaseQueryArgs<Config>,\n ): Options['processResponse'] extends (...args: any[]) => infer Result\n ? UseSuspenseQueryOptions<\n Result,\n Error,\n BaseQuery['select'] extends (...args: any[]) => infer T ? T : Result,\n DataTag<Split<Config['url'], '/'>, Result, Error>\n >\n : never => {\n // @ts-expect-error TS2322 We know that the processResponse is defined\n return queryOptions({\n queryKey: queryKey.dataTag(params),\n queryFn: async ({ signal }) => {\n let result\n try {\n result = await endpoint({\n signal,\n ...params,\n })\n } catch (err) {\n if (options.onFail) {\n options.onFail(err)\n }\n throw err\n }\n\n return processResponse(result)\n },\n ...baseQuery,\n })\n }\n result.queryKey = queryKey\n result.use = (params: ClientQueryArgs) => {\n // @ts-expect-error We add additional function to the result\n return useInfiniteQuery(result(params))\n }\n\n result.useSuspense = (params: ClientQueryArgs) => {\n // @ts-expect-error We add additional function to the result\n return useSuspenseInfiniteQuery(result(params))\n }\n\n result.invalidate = (queryClient: QueryClient, params: ClientQueryArgs) => {\n return queryClient.invalidateQueries({\n // @ts-expect-error We add additional function to the result\n queryKey: result.queryKey.dataTag(params),\n })\n }\n\n result.invalidateAll = (\n queryClient: QueryClient,\n params: ClientQueryArgs,\n ) => {\n return queryClient.invalidateQueries({\n // @ts-expect-error We add additional function to the result\n queryKey: result.queryKey.filterKey(params),\n exact: false,\n })\n }\n\n return result\n}\n","import type {\n AbstractEndpoint,\n AnyEndpointConfig,\n HttpMethod,\n Util_FlatObject,\n} from '@navios/common'\nimport type { InfiniteData, QueryClient } from '@tanstack/react-query'\nimport type { AnyZodObject, z, ZodType } from 'zod'\n\nimport type { ClientOptions, ProcessResponseFunction } from './types.mjs'\nimport type { ClientInstance, ClientMutationArgs } from './types/index.mjs'\n\nimport { makeInfiniteQueryOptions } from './make-infinite-query-options.mjs'\nimport { makeMutation } from './make-mutation.mjs'\nimport { makeQueryOptions } from './make-query-options.mjs'\n\nexport interface ClientEndpoint<\n Method = HttpMethod,\n Url = string,\n QuerySchema = unknown,\n Response = ZodType,\n> {\n method: Method\n url: Url\n querySchema?: QuerySchema\n responseSchema: Response\n}\n\nexport interface ClientQueryConfig<\n Method = HttpMethod,\n Url = string,\n QuerySchema = AnyZodObject,\n Response extends ZodType = ZodType,\n Result = z.output<Response>,\n> extends ClientEndpoint<Method, Url, QuerySchema, Response> {\n processResponse?: (data: z.output<Response>) => Result\n}\n\nexport type ClientInfiniteQueryConfig<\n Method = HttpMethod,\n Url = string,\n QuerySchema extends AnyZodObject = AnyZodObject,\n Response extends ZodType = ZodType,\n PageResult = z.output<Response>,\n Result = InfiniteData<PageResult>,\n> = Required<ClientEndpoint<Method, Url, QuerySchema, Response>> & {\n processResponse?: (data: z.output<Response>) => PageResult\n select?: (data: InfiniteData<PageResult>) => Result\n getNextPageParam: (\n lastPage: PageResult,\n allPages: PageResult[],\n lastPageParam: z.infer<QuerySchema> | undefined,\n allPageParams: z.infer<QuerySchema>[] | undefined,\n ) => z.input<QuerySchema> | undefined\n getPreviousPageParam?: (\n firstPage: PageResult,\n allPages: PageResult[],\n lastPageParam: z.infer<QuerySchema> | undefined,\n allPageParams: z.infer<QuerySchema>[] | undefined,\n ) => z.input<QuerySchema>\n initialPageParam?: z.input<QuerySchema>\n}\n\nexport interface ClientMutationDataConfig<\n Method extends 'POST' | 'PUT' | 'PATCH' | 'DELETE' =\n | 'POST'\n | 'PUT'\n | 'PATCH'\n | 'DELETE',\n Url extends string = string,\n RequestSchema = Method extends 'DELETE' ? never : AnyZodObject,\n QuerySchema = unknown,\n Response extends ZodType = ZodType,\n ReqResult = z.output<Response>,\n Result = unknown,\n Context = unknown,\n UseKey extends boolean = false,\n> extends ClientEndpoint<Method, Url, QuerySchema, Response> {\n requestSchema?: RequestSchema\n processResponse: ProcessResponseFunction<Result, ReqResult>\n useContext?: () => Context\n onSuccess?: (\n queryClient: QueryClient,\n data: NoInfer<Result>,\n variables: Util_FlatObject<\n ClientMutationArgs<Url, RequestSchema, QuerySchema>\n >,\n context: Context,\n ) => void | Promise<void>\n onError?: (\n queryClient: QueryClient,\n error: Error,\n variables: Util_FlatObject<\n ClientMutationArgs<Url, RequestSchema, QuerySchema>\n >,\n context: Context,\n ) => void | Promise<void>\n useKey?: UseKey\n}\n\nexport function declareClient<Options extends ClientOptions>({\n api,\n defaults = {},\n}: Options): ClientInstance {\n function query(config: ClientQueryConfig) {\n const endpoint = api.declareEndpoint({\n // @ts-expect-error we accept only specific methods\n method: config.method,\n url: config.url,\n querySchema: config.querySchema,\n responseSchema: config.responseSchema,\n })\n\n return makeQueryOptions(endpoint, {\n ...defaults,\n processResponse: config.processResponse ?? ((data) => data),\n })\n }\n\n function queryFromEndpoint(\n endpoint: AbstractEndpoint<AnyEndpointConfig>,\n options?: {\n processResponse?: (\n data: z.output<AnyEndpointConfig['responseSchema']>,\n ) => unknown\n },\n ) {\n return makeQueryOptions(endpoint, {\n ...defaults,\n processResponse: options?.processResponse ?? ((data) => data),\n })\n }\n\n function infiniteQuery(config: ClientInfiniteQueryConfig) {\n const endpoint = api.declareEndpoint({\n // @ts-expect-error we accept only specific methods\n method: config.method,\n url: config.url,\n querySchema: config.querySchema,\n responseSchema: config.responseSchema,\n })\n return makeInfiniteQueryOptions(endpoint, {\n ...defaults,\n processResponse: config.processResponse ?? ((data) => data),\n getNextPageParam: config.getNextPageParam,\n getPreviousPageParam: config.getPreviousPageParam,\n initialPageParam: config.initialPageParam,\n })\n }\n\n function infiniteQueryFromEndpoint(\n endpoint: AbstractEndpoint<AnyEndpointConfig>,\n options: {\n processResponse?: (\n data: z.output<AnyEndpointConfig['responseSchema']>,\n ) => unknown\n getNextPageParam: (\n lastPage: z.infer<AnyEndpointConfig['responseSchema']>,\n allPages: z.infer<AnyEndpointConfig['responseSchema']>[],\n lastPageParam: z.infer<AnyEndpointConfig['querySchema']> | undefined,\n allPageParams: z.infer<AnyEndpointConfig['querySchema']>[] | undefined,\n ) => z.input<AnyEndpointConfig['querySchema']> | undefined\n getPreviousPageParam?: (\n firstPage: z.infer<AnyEndpointConfig['responseSchema']>,\n allPages: z.infer<AnyEndpointConfig['responseSchema']>[],\n lastPageParam: z.infer<AnyEndpointConfig['querySchema']> | undefined,\n allPageParams: z.infer<AnyEndpointConfig['querySchema']>[] | undefined,\n ) => z.input<AnyEndpointConfig['querySchema']>\n initialPageParam?: z.input<AnyEndpointConfig['querySchema']>\n },\n ) {\n return makeInfiniteQueryOptions(endpoint, {\n ...defaults,\n processResponse: options?.processResponse ?? ((data) => data),\n getNextPageParam: options.getNextPageParam,\n getPreviousPageParam: options?.getPreviousPageParam,\n initialPageParam: options?.initialPageParam,\n })\n }\n\n function mutation(config: ClientMutationDataConfig) {\n const endpoint = api.declareEndpoint({\n // @ts-expect-error We forgot about the DELETE method in original makeMutation\n method: config.method,\n url: config.url,\n querySchema: config.querySchema,\n requestSchema: config.requestSchema,\n responseSchema: config.responseSchema,\n })\n\n return makeMutation(endpoint, {\n processResponse: config.processResponse ?? ((data) => data),\n useContext: config.useContext,\n // @ts-expect-error We forgot about the DELETE method in original makeMutation\n onSuccess: config.onSuccess,\n // @ts-expect-error We forgot about the DELETE method in original makeMutation\n onError: config.onError,\n useKey: config.useKey,\n ...defaults,\n })\n }\n\n return {\n // @ts-expect-error We simplified types here\n query,\n // @ts-expect-error We simplified types here\n queryFromEndpoint,\n // @ts-expect-error We simplified types here\n infiniteQuery,\n // @ts-expect-error We simplified types here\n infiniteQueryFromEndpoint,\n // @ts-expect-error We simplified types here\n mutation,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,oBAA8B;AA6CvB,SAAS,gBAOd,QACA,SACA,YASA;AACA,QAAM,MAAM,OAAO;AACnB,QAAM,WAAW,IAAI,MAAM,GAAG,EAAE,OAAO,OAAO;AAC9C,SAAO;AAAA,IACL,UAAU;AAAA;AAAA,IAEV,SAAS,CAAC,WAAW;AAzEzB;AA0EM,YAAM,cACJ,UAAU,iBAAiB,UAAU,YAAY,UAC7C,YAAO,gBAAP,mBAAoB,MAAM,OAAO,UACjC,CAAC;AACP,aAAO;AAAA,QACL,GAAI,QAAQ,aAAa,CAAC;AAAA,QAC1B,GAAG,SAAS;AAAA,UAAI,CAAC,SACf,KAAK,WAAW,GAAG;AAAA;AAAA,YAEf,OAAO,UAAU,KAAK,MAAM,CAAC,CAAC,EAAE,SAAS;AAAA,cACzC;AAAA,QACN;AAAA,QACA,GAAI,QAAQ,aAAa,CAAC;AAAA,QAC1B,eAAe,CAAC;AAAA,MAClB;AAAA,IASF;AAAA;AAAA,IAEA,WAAW,CAAC,WAAW;AACrB,aAAO;AAAA,QACL,GAAI,QAAQ,aAAa,CAAC;AAAA,QAC1B,GAAG,SAAS;AAAA,UAAI,CAAC,SACf,KAAK,WAAW,GAAG;AAAA;AAAA,YAEf,OAAO,UAAU,KAAK,MAAM,CAAC,CAAC,EAAE,SAAS;AAAA,cACzC;AAAA,QACN;AAAA,QACA,GAAI,QAAQ,aAAa,CAAC;AAAA,MAC5B;AAAA,IASF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