mobx-tanstack-query-api 0.0.107 → 0.0.109
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/codegen/index.d.ts +40 -0
- package/codegen/index.d.ts.map +1 -1
- package/codegen/index.js +160 -74
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts +18 -0
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts.map +1 -0
- package/codegen/templates/all-endpoints-per-file.tmpl.js +92 -0
- package/package.json +7 -2
- package/runtime/endpoint-infinite-query.d.ts +6 -9
- package/runtime/endpoint-infinite-query.d.ts.map +1 -1
- package/runtime/endpoint-infinite-query.js +1 -1
- package/runtime/endpoint-infinite-query.types.d.ts +12 -8
- package/runtime/endpoint-infinite-query.types.d.ts.map +1 -1
- package/runtime/endpoint-query.d.ts +1 -1
- package/runtime/endpoint-query.d.ts.map +1 -1
- package/runtime/endpoint.d.ts +1 -1
package/codegen/index.d.ts
CHANGED
|
@@ -31,6 +31,46 @@ export interface GenerateQueryApiParams {
|
|
|
31
31
|
*/
|
|
32
32
|
formatEndpointName?: (endpointName: string, endpointData: AnyObject) => Maybe<string>;
|
|
33
33
|
formatExportGroupName?: (groupName: string, utils: CodegenDataUtils) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Various generation output types
|
|
36
|
+
*
|
|
37
|
+
* `one-endpoint-per-file`
|
|
38
|
+
* @example
|
|
39
|
+
* ```
|
|
40
|
+
* outputdir
|
|
41
|
+
* groupname
|
|
42
|
+
* index.ts
|
|
43
|
+
* endpoints
|
|
44
|
+
* index.ts
|
|
45
|
+
* get-endpoint-1.ts
|
|
46
|
+
* get-endpoint-n.ts
|
|
47
|
+
* ```
|
|
48
|
+
* @example
|
|
49
|
+
* ```
|
|
50
|
+
* outputdir
|
|
51
|
+
* index.ts
|
|
52
|
+
* endpoints
|
|
53
|
+
* index.ts
|
|
54
|
+
* get-endpoint-1.ts
|
|
55
|
+
* get-endpoint-n.ts
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* `endpoints-per-file`
|
|
59
|
+
* @example
|
|
60
|
+
* ```
|
|
61
|
+
* outputdir
|
|
62
|
+
* groupname
|
|
63
|
+
* index.ts
|
|
64
|
+
* endpoints.ts
|
|
65
|
+
* ```
|
|
66
|
+
* @example
|
|
67
|
+
* ```
|
|
68
|
+
* outputdir
|
|
69
|
+
* index.ts
|
|
70
|
+
* endpoints.ts
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
outputType?: 'one-endpoint-per-file' | 'endpoints-per-file';
|
|
34
74
|
/**
|
|
35
75
|
* Group endpoints and collect it into object
|
|
36
76
|
*/
|
package/codegen/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAYrE,OAAO,EAEL,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AAOxC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,EAAE,YAAY,CAAC;IAChB,qBAAqB,EAAE,CAAC,aAAa,EAAE,SAAS,KAAK,MAAM,CAAC;IAC5D,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAChD,CAAC;AAEF,KAAK,iBAAiB,GAAG,CAAC,QAAQ,EAAE,SAAS,KAAK,OAAO,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,S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E,gBAAgB,CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KACxD,OAAO,CAAC,IAAI,CA8mBd,CAAC"}
|
package/codegen/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { generateApi as generateApiFromSwagger } from 'swagger-typescript-api';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { allEndpointPerFileTmpl } from './templates/all-endpoints-per-file.tmpl.js';
|
|
4
5
|
import { allExportsTmpl } from './templates/all-exports.tmpl.js';
|
|
5
6
|
import { LINTERS_IGNORE } from './templates/constants.js';
|
|
6
7
|
import { dataContractsFileTmpl } from './templates/data-contracts-file.tmpl.js';
|
|
@@ -150,16 +151,16 @@ export const generateApi = async (params) => {
|
|
|
150
151
|
const allRoutes = Object.values(generated.configuration.routes)
|
|
151
152
|
.flat()
|
|
152
153
|
.flatMap((routeGroup) => 'routes' in routeGroup ? routeGroup.routes : routeGroup);
|
|
153
|
-
let
|
|
154
|
+
let filterEndpoint;
|
|
154
155
|
if (params.filterEndpoints) {
|
|
155
156
|
if (typeof params.filterEndpoints === 'function') {
|
|
156
|
-
|
|
157
|
+
filterEndpoint = params.filterEndpoints;
|
|
157
158
|
}
|
|
158
159
|
else {
|
|
159
160
|
const regexps = Array.isArray(params.filterEndpoints)
|
|
160
161
|
? params.filterEndpoints
|
|
161
162
|
: [params.filterEndpoints];
|
|
162
|
-
|
|
163
|
+
filterEndpoint = (route) => regexps.some((regexpOrString) => {
|
|
163
164
|
if (!route.raw) {
|
|
164
165
|
return false;
|
|
165
166
|
}
|
|
@@ -171,63 +172,103 @@ export const generateApi = async (params) => {
|
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
else {
|
|
174
|
-
|
|
175
|
+
filterEndpoint = () => true;
|
|
175
176
|
}
|
|
176
177
|
const reservedDataContractNamesMap = new Map();
|
|
177
|
-
const
|
|
178
|
+
const collectedExportFilesFromIndexFile = [];
|
|
178
179
|
const groupsMap = new Map();
|
|
179
180
|
const nonEmptyGroups = new Set();
|
|
180
181
|
const tagsSet = new Set();
|
|
181
182
|
if (params.groupBy == null) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
collectedExportFilesFromIndexFile.push('endpoints');
|
|
184
|
+
if (params.outputType === 'one-endpoint-per-file') {
|
|
185
|
+
// #region кодогенерация 1 эндпоинт - 1 файл без группировки
|
|
186
|
+
codegenFs.createDir(path.resolve(params.output, 'endpoints'));
|
|
187
|
+
const fileNamesWithRequestInfo = [];
|
|
188
|
+
for await (const route of allRoutes) {
|
|
189
|
+
const { content: requestInfoPerFileContent, reservedDataContractNames, } = await endpointPerFileTmpl({
|
|
190
|
+
...generated,
|
|
191
|
+
route,
|
|
192
|
+
apiParams: params,
|
|
193
|
+
codegenProcess,
|
|
194
|
+
importFileParams,
|
|
195
|
+
utils,
|
|
196
|
+
relativePathDataContracts: '../data-contracts',
|
|
197
|
+
groupName: null,
|
|
198
|
+
metaInfo: {
|
|
199
|
+
groupNames: [],
|
|
200
|
+
namespace,
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
if (Array.isArray(route.raw.tags)) {
|
|
204
|
+
route.raw.tags.forEach((tag) => tagsSet.add(tag));
|
|
205
|
+
}
|
|
206
|
+
reservedDataContractNames.forEach((name) => {
|
|
207
|
+
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
208
|
+
});
|
|
209
|
+
if (!filterEndpoint(route)) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
const fileName = `${_.kebabCase(route.routeName.usage)}.ts`;
|
|
213
|
+
fileNamesWithRequestInfo.push(fileName);
|
|
214
|
+
codegenFs.createFile({
|
|
215
|
+
path: path.resolve(params.output, 'endpoints'),
|
|
216
|
+
fileName,
|
|
217
|
+
withPrefix: false,
|
|
218
|
+
content: requestInfoPerFileContent,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
codegenFs.createFile({
|
|
222
|
+
path: path.resolve(params.output, 'endpoints'),
|
|
223
|
+
fileName: 'index.ts',
|
|
224
|
+
withPrefix: false,
|
|
225
|
+
content: await indexTsForEndpointPerFileTmpl({
|
|
226
|
+
...generated,
|
|
227
|
+
apiParams: params,
|
|
228
|
+
codegenProcess,
|
|
229
|
+
generatedRequestFileNames: fileNamesWithRequestInfo,
|
|
230
|
+
}),
|
|
231
|
+
});
|
|
232
|
+
// #endregion
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
// #region кодогенерация несколько эндпоинтов в 1 файле без группировки
|
|
236
|
+
const { content: requestInfoPerFileContent, reservedDataContractNames } = await allEndpointPerFileTmpl({
|
|
188
237
|
...generated,
|
|
189
|
-
|
|
238
|
+
routes: allRoutes,
|
|
190
239
|
apiParams: params,
|
|
191
240
|
codegenProcess,
|
|
192
241
|
importFileParams,
|
|
193
242
|
utils,
|
|
194
|
-
relativePathDataContracts: '
|
|
243
|
+
relativePathDataContracts: './data-contracts',
|
|
195
244
|
groupName: null,
|
|
196
245
|
metaInfo: {
|
|
197
|
-
groupNames: [],
|
|
198
246
|
namespace,
|
|
247
|
+
groupNames: [],
|
|
199
248
|
},
|
|
200
249
|
});
|
|
201
|
-
if (Array.isArray(route.raw.tags)) {
|
|
202
|
-
route.raw.tags.forEach((tag) => tagsSet.add(tag));
|
|
203
|
-
}
|
|
204
250
|
reservedDataContractNames.forEach((name) => {
|
|
205
251
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
206
252
|
});
|
|
207
|
-
|
|
208
|
-
|
|
253
|
+
const filteredRoutes = allRoutes.filter(filterEndpoint);
|
|
254
|
+
const hasFilteredRoutes = filteredRoutes.length > 0;
|
|
255
|
+
if (hasFilteredRoutes) {
|
|
256
|
+
filteredRoutes.forEach((route) => {
|
|
257
|
+
if (Array.isArray(route.raw.tags)) {
|
|
258
|
+
route.raw.tags.forEach((tag) => tagsSet.add(tag));
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
const fileName = 'endpoints.ts';
|
|
262
|
+
collectedExportFilesFromIndexFile.push('endpoints');
|
|
263
|
+
codegenFs.createFile({
|
|
264
|
+
path: params.output,
|
|
265
|
+
fileName,
|
|
266
|
+
withPrefix: false,
|
|
267
|
+
content: requestInfoPerFileContent,
|
|
268
|
+
});
|
|
209
269
|
}
|
|
210
|
-
|
|
211
|
-
fileNamesWithRequestInfo.push(fileName);
|
|
212
|
-
codegenFs.createFile({
|
|
213
|
-
path: path.resolve(params.output, 'endpoints'),
|
|
214
|
-
fileName,
|
|
215
|
-
withPrefix: false,
|
|
216
|
-
content: requestInfoPerFileContent,
|
|
217
|
-
});
|
|
270
|
+
// #endregion
|
|
218
271
|
}
|
|
219
|
-
codegenFs.createFile({
|
|
220
|
-
path: path.resolve(params.output, 'endpoints'),
|
|
221
|
-
fileName: 'index.ts',
|
|
222
|
-
withPrefix: false,
|
|
223
|
-
content: await indexTsForEndpointPerFileTmpl({
|
|
224
|
-
...generated,
|
|
225
|
-
apiParams: params,
|
|
226
|
-
codegenProcess,
|
|
227
|
-
generatedRequestFileNames: fileNamesWithRequestInfo,
|
|
228
|
-
}),
|
|
229
|
-
});
|
|
230
|
-
// #endregion
|
|
231
272
|
}
|
|
232
273
|
else {
|
|
233
274
|
// #region кодогенерация с группировкой
|
|
@@ -260,18 +301,58 @@ export const generateApi = async (params) => {
|
|
|
260
301
|
continue;
|
|
261
302
|
}
|
|
262
303
|
const fileNamesWithRequestInfo = [];
|
|
263
|
-
|
|
264
|
-
codegenFs.createDir(
|
|
304
|
+
const groupDirectory = path.resolve(params.output, _.kebabCase(groupName));
|
|
305
|
+
codegenFs.createDir(groupDirectory);
|
|
265
306
|
let hasFilteredRoutes = false;
|
|
266
|
-
|
|
267
|
-
|
|
307
|
+
if (params.outputType === 'one-endpoint-per-file') {
|
|
308
|
+
// #region Генерация одного эндпоинта на 1 файл
|
|
309
|
+
codegenFs.createDir(path.resolve(groupDirectory, 'endpoints'));
|
|
310
|
+
for await (const route of routes) {
|
|
311
|
+
const { content: requestInfoPerFileContent, reservedDataContractNames, } = await endpointPerFileTmpl({
|
|
312
|
+
...generated,
|
|
313
|
+
route,
|
|
314
|
+
apiParams: params,
|
|
315
|
+
codegenProcess,
|
|
316
|
+
importFileParams,
|
|
317
|
+
utils,
|
|
318
|
+
relativePathDataContracts: '../../data-contracts',
|
|
319
|
+
groupName,
|
|
320
|
+
metaInfo: {
|
|
321
|
+
namespace,
|
|
322
|
+
groupNames: [],
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
reservedDataContractNames.forEach((name) => {
|
|
326
|
+
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
327
|
+
});
|
|
328
|
+
if (!filterEndpoint(route)) {
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
hasFilteredRoutes = true;
|
|
332
|
+
if (Array.isArray(route.raw.tags)) {
|
|
333
|
+
route.raw.tags.forEach((tag) => tagsSet.add(tag));
|
|
334
|
+
}
|
|
335
|
+
const fileName = `${_.kebabCase(route.routeName.usage)}.ts`;
|
|
336
|
+
fileNamesWithRequestInfo.push(fileName);
|
|
337
|
+
codegenFs.createFile({
|
|
338
|
+
path: path.resolve(params.output, _.kebabCase(groupName), 'endpoints'),
|
|
339
|
+
fileName,
|
|
340
|
+
withPrefix: false,
|
|
341
|
+
content: requestInfoPerFileContent,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
// #endregion
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
// #region Генерация нескольких эндпоинтов на 1 файл
|
|
348
|
+
const { content: requestInfoPerFileContent, reservedDataContractNames, } = await allEndpointPerFileTmpl({
|
|
268
349
|
...generated,
|
|
269
|
-
|
|
350
|
+
routes,
|
|
270
351
|
apiParams: params,
|
|
271
352
|
codegenProcess,
|
|
272
353
|
importFileParams,
|
|
273
354
|
utils,
|
|
274
|
-
relativePathDataContracts: '
|
|
355
|
+
relativePathDataContracts: '../data-contracts',
|
|
275
356
|
groupName,
|
|
276
357
|
metaInfo: {
|
|
277
358
|
namespace,
|
|
@@ -281,21 +362,24 @@ export const generateApi = async (params) => {
|
|
|
281
362
|
reservedDataContractNames.forEach((name) => {
|
|
282
363
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
283
364
|
});
|
|
284
|
-
|
|
285
|
-
|
|
365
|
+
const filteredRoutes = routes.filter(filterEndpoint);
|
|
366
|
+
hasFilteredRoutes = filteredRoutes.length > 0;
|
|
367
|
+
if (hasFilteredRoutes) {
|
|
368
|
+
filteredRoutes.forEach((route) => {
|
|
369
|
+
if (Array.isArray(route.raw.tags)) {
|
|
370
|
+
route.raw.tags.forEach((tag) => tagsSet.add(tag));
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
const fileName = 'endpoints.ts';
|
|
374
|
+
fileNamesWithRequestInfo.push(fileName);
|
|
375
|
+
codegenFs.createFile({
|
|
376
|
+
path: groupDirectory,
|
|
377
|
+
fileName,
|
|
378
|
+
withPrefix: false,
|
|
379
|
+
content: requestInfoPerFileContent,
|
|
380
|
+
});
|
|
286
381
|
}
|
|
287
|
-
|
|
288
|
-
if (Array.isArray(route.raw.tags)) {
|
|
289
|
-
route.raw.tags.forEach((tag) => tagsSet.add(tag));
|
|
290
|
-
}
|
|
291
|
-
const fileName = `${_.kebabCase(route.routeName.usage)}.ts`;
|
|
292
|
-
fileNamesWithRequestInfo.push(fileName);
|
|
293
|
-
codegenFs.createFile({
|
|
294
|
-
path: path.resolve(params.output, _.kebabCase(groupName), 'endpoints'),
|
|
295
|
-
fileName,
|
|
296
|
-
withPrefix: false,
|
|
297
|
-
content: requestInfoPerFileContent,
|
|
298
|
-
});
|
|
382
|
+
// #endregion
|
|
299
383
|
}
|
|
300
384
|
if (hasFilteredRoutes) {
|
|
301
385
|
nonEmptyGroups.add(groupName);
|
|
@@ -303,25 +387,27 @@ export const generateApi = async (params) => {
|
|
|
303
387
|
? params.formatExportGroupName(_.camelCase(groupName), utils)
|
|
304
388
|
: _.camelCase(groupName);
|
|
305
389
|
codegenFs.createFile({
|
|
306
|
-
path:
|
|
390
|
+
path: groupDirectory,
|
|
307
391
|
fileName: 'index.ts',
|
|
308
392
|
withPrefix: false,
|
|
309
393
|
content: `${LINTERS_IGNORE}
|
|
310
394
|
export * as ${exportGroupName} from './endpoints';
|
|
311
395
|
`,
|
|
312
396
|
});
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
397
|
+
if (params.outputType === 'one-endpoint-per-file') {
|
|
398
|
+
codegenFs.createFile({
|
|
399
|
+
path: path.resolve(groupDirectory, 'endpoints'),
|
|
400
|
+
fileName: 'index.ts',
|
|
401
|
+
withPrefix: false,
|
|
402
|
+
content: await indexTsForEndpointPerFileTmpl({
|
|
403
|
+
...generated,
|
|
404
|
+
apiParams: params,
|
|
405
|
+
codegenProcess,
|
|
406
|
+
generatedRequestFileNames: fileNamesWithRequestInfo,
|
|
407
|
+
}),
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
collectedExportFilesFromIndexFile.push(_.kebabCase(groupName));
|
|
325
411
|
}
|
|
326
412
|
else {
|
|
327
413
|
codegenFs.removeDir(path.resolve(params.output, _.kebabCase(groupName)));
|
|
@@ -369,7 +455,7 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
369
455
|
withPrefix: false,
|
|
370
456
|
content: await allExportsTmpl({
|
|
371
457
|
...generated,
|
|
372
|
-
collectedExportFiles,
|
|
458
|
+
collectedExportFiles: collectedExportFilesFromIndexFile,
|
|
373
459
|
metaInfo,
|
|
374
460
|
utils,
|
|
375
461
|
}),
|
|
@@ -390,7 +476,7 @@ export * as ${namespace} from './__exports';
|
|
|
390
476
|
withPrefix: false,
|
|
391
477
|
content: await allExportsTmpl({
|
|
392
478
|
...generated,
|
|
393
|
-
collectedExportFiles,
|
|
479
|
+
collectedExportFiles: collectedExportFilesFromIndexFile,
|
|
394
480
|
metaInfo,
|
|
395
481
|
utils,
|
|
396
482
|
}),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnyObject, Maybe } from 'yummies/utils/types';
|
|
2
|
+
import type { AllImportFileParams, CodegenDataUtils, CodegenProcess, GenerateQueryApiParams, MetaInfo } from '../index.js';
|
|
3
|
+
export interface AllEndpointPerFileTmplParams extends AnyObject {
|
|
4
|
+
routes: AnyObject[];
|
|
5
|
+
configuration: AnyObject;
|
|
6
|
+
apiParams: GenerateQueryApiParams;
|
|
7
|
+
codegenProcess: CodegenProcess;
|
|
8
|
+
importFileParams: AllImportFileParams;
|
|
9
|
+
utils: CodegenDataUtils;
|
|
10
|
+
relativePathDataContracts: string;
|
|
11
|
+
groupName: Maybe<string>;
|
|
12
|
+
metaInfo: Maybe<MetaInfo>;
|
|
13
|
+
}
|
|
14
|
+
export declare const allEndpointPerFileTmpl: ({ routes, configuration, apiParams, formatTSContent, importFileParams, utils, relativePathDataContracts, groupName, metaInfo, }: AllEndpointPerFileTmplParams) => Promise<{
|
|
15
|
+
reservedDataContractNames: string[];
|
|
16
|
+
content: any;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=all-endpoints-per-file.tmpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACT,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,4BAA6B,SAAQ,SAAS;IAC7D,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,GAAU,iIAU1C,4BAA4B;;;EA+H9B,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { LINTERS_IGNORE } from './constants.js';
|
|
2
|
+
import { dataContractTmpl } from './data-contract.tmpl.js';
|
|
3
|
+
import { endpointJSDocTmpl } from './endpoint-jsdoc.tmpl.js';
|
|
4
|
+
import { newEndpointTmpl } from './new-endpoint.tmpl.js';
|
|
5
|
+
export const allEndpointPerFileTmpl = async ({ routes, configuration, apiParams, formatTSContent, importFileParams, utils, relativePathDataContracts, groupName, metaInfo, }) => {
|
|
6
|
+
const { _ } = utils;
|
|
7
|
+
const dataContractNamesInThisFile = [];
|
|
8
|
+
const newEndpointTemplates = routes.map((route) => {
|
|
9
|
+
const newEndpointTemplateData = newEndpointTmpl({
|
|
10
|
+
route,
|
|
11
|
+
configuration,
|
|
12
|
+
apiParams,
|
|
13
|
+
importFileParams,
|
|
14
|
+
utils,
|
|
15
|
+
groupName,
|
|
16
|
+
metaInfo,
|
|
17
|
+
});
|
|
18
|
+
const { reservedDataContractNames } = newEndpointTemplateData;
|
|
19
|
+
const dataContactNames = new Set(Object.keys(configuration.config.swaggerSchema?.components?.schemas).map((schemaName) => utils.formatModelName(schemaName)));
|
|
20
|
+
reservedDataContractNames.forEach((reservedDataContractName) => {
|
|
21
|
+
if (!dataContactNames.has(reservedDataContractName)) {
|
|
22
|
+
dataContractNamesInThisFile.push(reservedDataContractName);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return { ...newEndpointTemplateData, route };
|
|
26
|
+
});
|
|
27
|
+
let metaInfoImport = '';
|
|
28
|
+
if (metaInfo) {
|
|
29
|
+
metaInfoImport = `import { ${[groupName && 'Group', metaInfo?.namespace && 'namespace', 'Tag'].filter(Boolean).join(',')} } from "${groupName ? '../' : './'}meta-info";`;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
reservedDataContractNames: dataContractNamesInThisFile,
|
|
33
|
+
content: await formatTSContent(`${LINTERS_IGNORE}
|
|
34
|
+
import {
|
|
35
|
+
RequestParams,
|
|
36
|
+
HttpResponse,
|
|
37
|
+
HttpMultistatusResponse,
|
|
38
|
+
} from "${apiParams.libImports?.['mobx-tanstack-query-api'] ?? 'mobx-tanstack-query-api'}";
|
|
39
|
+
import { ${importFileParams.endpoint.exportName} } from "${importFileParams.endpoint.path}";
|
|
40
|
+
import { ${importFileParams.httpClient.exportName} } from "${importFileParams.httpClient.path}";
|
|
41
|
+
import { ${importFileParams.queryClient.exportName} } from "${importFileParams.queryClient.path}";
|
|
42
|
+
${metaInfoImport}
|
|
43
|
+
|
|
44
|
+
${configuration.modelTypes.length > 0
|
|
45
|
+
? `
|
|
46
|
+
import { ${configuration.modelTypes
|
|
47
|
+
.map((it) => it.name)
|
|
48
|
+
.filter((it) => !dataContractNamesInThisFile.includes(it))} } from "${relativePathDataContracts}";
|
|
49
|
+
`
|
|
50
|
+
: ''}
|
|
51
|
+
|
|
52
|
+
${(await Promise.all(dataContractNamesInThisFile.map(async (dataContractName) => {
|
|
53
|
+
const modelType = configuration.modelTypes.find((modelType) => modelType.name === dataContractName);
|
|
54
|
+
if (!modelType) {
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
const contractType = await dataContractTmpl({
|
|
58
|
+
configuration,
|
|
59
|
+
contract: modelType,
|
|
60
|
+
addExportKeyword: true,
|
|
61
|
+
});
|
|
62
|
+
return contractType;
|
|
63
|
+
})))
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.join('\n\n')}
|
|
66
|
+
|
|
67
|
+
${(await Promise.all(newEndpointTemplates.map(async ({ content: requestInfoInstanceContent, localModelTypes, route, }) => {
|
|
68
|
+
return `
|
|
69
|
+
${(await Promise.all(localModelTypes.map(async (modelType) => {
|
|
70
|
+
const contractType = await dataContractTmpl({
|
|
71
|
+
configuration,
|
|
72
|
+
contract: modelType,
|
|
73
|
+
addExportKeyword: true,
|
|
74
|
+
});
|
|
75
|
+
return contractType;
|
|
76
|
+
})))
|
|
77
|
+
.filter(Boolean)
|
|
78
|
+
.join('\n\n')}
|
|
79
|
+
|
|
80
|
+
${endpointJSDocTmpl({
|
|
81
|
+
route,
|
|
82
|
+
configuration,
|
|
83
|
+
apiParams,
|
|
84
|
+
})}
|
|
85
|
+
export const ${_.camelCase(route.routeName.usage)} = ${requestInfoInstanceContent}
|
|
86
|
+
`;
|
|
87
|
+
})))
|
|
88
|
+
.filter(Boolean)
|
|
89
|
+
.join('\n\n')}
|
|
90
|
+
`),
|
|
91
|
+
};
|
|
92
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-tanstack-query-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.109",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "js2me",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/lodash": "^4.17.16",
|
|
24
24
|
"@types/lodash-es": "^4.17.12",
|
|
25
25
|
"http-status-code-types": "^0.0.2",
|
|
26
|
-
"mobx-tanstack-query": "^
|
|
26
|
+
"mobx-tanstack-query": "^6.0.0",
|
|
27
27
|
"swagger-typescript-api": "13.2.7",
|
|
28
28
|
"ts-morph": "^26.0.0",
|
|
29
29
|
"yummies": "^4.0.0"
|
|
@@ -68,6 +68,11 @@
|
|
|
68
68
|
"default": "./codegen/index.js",
|
|
69
69
|
"types": "./codegen/index.d.ts"
|
|
70
70
|
},
|
|
71
|
+
"./codegen/templates/all-endpoints-per-file.tmpl": {
|
|
72
|
+
"import": "./codegen/templates/all-endpoints-per-file.tmpl.js",
|
|
73
|
+
"default": "./codegen/templates/all-endpoints-per-file.tmpl.js",
|
|
74
|
+
"types": "./codegen/templates/all-endpoints-per-file.tmpl.d.ts"
|
|
75
|
+
},
|
|
71
76
|
"./codegen/templates/all-exports.tmpl": {
|
|
72
77
|
"import": "./codegen/templates/all-exports.tmpl.js",
|
|
73
78
|
"default": "./codegen/templates/all-exports.tmpl.js",
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { DefaultError, InfiniteData, QueryObserverResult } from '@tanstack/query-core';
|
|
2
|
-
import { InfiniteQuery
|
|
2
|
+
import { InfiniteQuery } from 'mobx-tanstack-query';
|
|
3
3
|
import { MaybeFalsy } from 'yummies/utils/types';
|
|
4
|
-
import { EndpointInfiniteQueryFlattenOptions, EndpointInfiniteQueryOptions } from './endpoint-infinite-query.types.js';
|
|
4
|
+
import { EndpointInfiniteQueryFlattenOptions, EndpointInfiniteQueryOptions, EndpointInfiniteQueryUpdateOptionsAllVariants } from './endpoint-infinite-query.types.js';
|
|
5
5
|
import { EndpointQueryClient } from './endpoint-query-client.js';
|
|
6
|
-
import { ExcludedQueryKeys } from './endpoint-query.types.js';
|
|
7
6
|
import { AnyEndpoint } from './endpoint.types.js';
|
|
8
|
-
export declare class EndpointInfiniteQuery<TEndpoint extends AnyEndpoint,
|
|
7
|
+
export declare class EndpointInfiniteQuery<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> extends InfiniteQuery<TQueryFnData, TError, TPageParam, TData, any[]> {
|
|
9
8
|
private endpoint;
|
|
10
9
|
response: TEndpoint['__response'] | null;
|
|
11
10
|
params: TEndpoint['__params'] | null;
|
|
12
11
|
private uniqKey?;
|
|
13
|
-
constructor(endpoint: AnyEndpoint, queryClient: EndpointQueryClient, queryOptionsInput: EndpointInfiniteQueryOptions<TEndpoint,
|
|
14
|
-
update({ params, ...options }:
|
|
15
|
-
|
|
16
|
-
}): void;
|
|
17
|
-
start(params: MaybeFalsy<TEndpoint['__params']>): Promise<QueryObserverResult<InfiniteData<TData, TPageParam>, TError>>;
|
|
12
|
+
constructor(endpoint: AnyEndpoint, queryClient: EndpointQueryClient, queryOptionsInput: EndpointInfiniteQueryOptions<TEndpoint, TQueryFnData, TError, TPageParam, TData> | (() => EndpointInfiniteQueryFlattenOptions<TEndpoint, TQueryFnData, TError, TPageParam, TData>));
|
|
13
|
+
update({ params, ...options }: EndpointInfiniteQueryUpdateOptionsAllVariants<TEndpoint, TQueryFnData, TError, TPageParam, TData>): void;
|
|
14
|
+
start(params: MaybeFalsy<TEndpoint['__params']>): Promise<QueryObserverResult<TData, TError>>;
|
|
18
15
|
}
|
|
19
16
|
//# sourceMappingURL=endpoint-infinite-query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-infinite-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,
|
|
1
|
+
{"version":3,"file":"endpoint-infinite-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAS,UAAU,EAAE,MAAM,qBAAqB,CA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
|
import { makeObservable, observable, runInAction } from 'mobx';
|
|
2
|
-
import { InfiniteQuery
|
|
2
|
+
import { InfiniteQuery } from 'mobx-tanstack-query';
|
|
3
3
|
import { buildOptionsFromParams, getParamsFromContext, } from './endpoint-query.js';
|
|
4
4
|
export class EndpointInfiniteQuery extends InfiniteQuery {
|
|
5
5
|
endpoint;
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import { DefaultError,
|
|
2
|
-
import { InfiniteQueryConfig } from 'mobx-tanstack-query';
|
|
3
|
-
import {
|
|
1
|
+
import { DefaultError, InfiniteData } from '@tanstack/query-core';
|
|
2
|
+
import { InfiniteQueryConfig, InfiniteQueryDynamicOptions, InfiniteQueryOptions, InfiniteQueryUpdateOptions } from 'mobx-tanstack-query';
|
|
3
|
+
import { AnyObject, MaybeFalsy } from 'yummies/utils/types';
|
|
4
4
|
import { EndpointQueryUniqKey, ExcludedQueryKeys } from './endpoint-query.types.js';
|
|
5
5
|
import { AnyEndpoint } from './endpoint.types.js';
|
|
6
|
-
type ShortInfiniteQueryConfig<TQueryFnData, TError = DefaultError,
|
|
6
|
+
type ShortInfiniteQueryConfig<TQueryFnData, TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = Omit<InfiniteQueryConfig<TQueryFnData, TError, TPageParam, TData, any[]>, ExcludedQueryKeys> & {
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
};
|
|
9
|
-
export type EndpointInfiniteQueryFlattenOptions<TEndpoint extends AnyEndpoint,
|
|
9
|
+
export type EndpointInfiniteQueryFlattenOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = ShortInfiniteQueryConfig<NoInfer<TQueryFnData>, TError, TPageParam, TData> & {
|
|
10
10
|
uniqKey?: EndpointQueryUniqKey;
|
|
11
11
|
params?: MaybeFalsy<TEndpoint['__params']>;
|
|
12
12
|
/**
|
|
13
13
|
* Transform response to QueryFnData
|
|
14
14
|
*/
|
|
15
|
-
transform?: (response: TEndpoint['__response']) =>
|
|
15
|
+
transform?: (response: TEndpoint['__response']) => TQueryFnData | Promise<TQueryFnData>;
|
|
16
16
|
};
|
|
17
|
-
export type EndpointInfiniteQueryOptions<TEndpoint extends AnyEndpoint,
|
|
17
|
+
export type EndpointInfiniteQueryOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = ShortInfiniteQueryConfig<NoInfer<TQueryFnData>, TError, TPageParam, TData> & {
|
|
18
18
|
uniqKey?: EndpointQueryUniqKey;
|
|
19
19
|
params?: () => MaybeFalsy<TEndpoint['__params']>;
|
|
20
20
|
/**
|
|
21
21
|
* Transform response to QueryFnData
|
|
22
22
|
*/
|
|
23
|
-
transform?: (response: TEndpoint['__response']) =>
|
|
23
|
+
transform?: (response: TEndpoint['__response']) => TQueryFnData | Promise<TQueryFnData>;
|
|
24
24
|
};
|
|
25
|
+
type EnhanceUpdatOptionVariant<TEndpoint extends AnyEndpoint, TVariant extends AnyObject> = Omit<TVariant, ExcludedQueryKeys> & {
|
|
26
|
+
params?: MaybeFalsy<TEndpoint['__params']>;
|
|
27
|
+
};
|
|
28
|
+
export type EndpointInfiniteQueryUpdateOptionsAllVariants<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = EnhanceUpdatOptionVariant<TEndpoint, Partial<InfiniteQueryOptions<TQueryFnData, TError, TPageParam, TData, any[]>>> | EnhanceUpdatOptionVariant<TEndpoint, InfiniteQueryUpdateOptions<TQueryFnData, TError, TPageParam, TData, any[]>> | EnhanceUpdatOptionVariant<TEndpoint, InfiniteQueryDynamicOptions<TQueryFnData, TError, TPageParam, TData, any[]>>;
|
|
25
29
|
export {};
|
|
26
30
|
//# sourceMappingURL=endpoint-infinite-query.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-infinite-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-infinite-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,KAAK,wBAAwB,CAC3B,YAAY,EACZ,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,IAC5C,IAAI,CACN,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EACnE,iBAAiB,CAClB,GAAG;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mCAAmC,CAC7C,SAAS,SAAS,WAAW,EAC7B,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAC9C,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,IAC5C,wBAAwB,CAC1B,OAAO,CAAC,YAAY,CAAC,EACrB,MAAM,EACN,UAAU,EACV,KAAK,C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,EAAE,UAAU,CAAC,IAE5C,yBAAyB,CACvB,SAAS,EACT,OAAO,CACL,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CACrE,CACF,GACD,yBAAyB,CACvB,SAAS,EACT,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAC3E,GACD,yBAAyB,CACvB,SAAS,EACT,2BAA2B,CACzB,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,EACL,GAAG,EAAE,CACN,CACF,CAAC"}
|
|
@@ -18,6 +18,6 @@ export declare class EndpointQuery<TEndpoint extends AnyEndpoint, TQueryFnData =
|
|
|
18
18
|
export declare const getParamsFromContext: (ctx: QueryFunctionContext<any, any>) => AnyEndpoint["__params"];
|
|
19
19
|
export declare const buildOptionsFromParams: (endpoint: AnyEndpoint, params: MaybeFalsy<AnyObject>, uniqKey: Maybe<EndpointQueryUniqKey>) => {
|
|
20
20
|
enabled: boolean;
|
|
21
|
-
queryKey: any;
|
|
21
|
+
queryKey: any[];
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=endpoint-query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,2BA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,CAAC,MAAM,2BAA2B,CAChC,SAAS,EACT,YAAY,EACZ,MAAM,EACN,KAAK,EACL,UAAU,CACX,CAAC;IAgGR,MAAM,CAAC,EACL,MAAM,EACN,GAAG,OAAO,EACX,EAAE,IAAI,CACL,6BAA6B,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,EACtE,iBAAiB,CAClB,GAAG;QACF,MAAM,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;KAC5C;IAOK,KAAK,CACT,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,GACxC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAK/C;AAED,eAAO,MAAM,oBAAoB,GAAI,KAAK,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,KAChC,WAAW,CAAC,UAAU,CAC7D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,UAAU,WAAW,EACrB,QAAQ,UAAU,CAAC,SAAS,CAAC,EAC7B,SAAS,KAAK,CAAC,oBAAoB,CAAC,KACnC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,GAAG,EAAE,CAAA;CAerC,CAAC"}
|
package/runtime/endpoint.d.ts
CHANGED
|
@@ -57,6 +57,6 @@ export declare class Endpoint<TResponse extends HttpResponse<any, any>, TParams
|
|
|
57
57
|
]): void;
|
|
58
58
|
toMutation<TData = TResponse['data'], TMutationMeta extends AnyObject | void = void, TContext = unknown>(options: EndpointMutationOptions<this, TData, TParams, TMutationMeta, TContext>): EndpointMutation<this, TData, TParams, TMutationMeta, TContext>;
|
|
59
59
|
toQuery<TQueryFnData = TResponse['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData>(options: EndpointQueryOptions<this, TQueryFnData, TError, TData, TQueryData> | (() => EndpointQueryFlattenOptions<this, TQueryFnData, TError, TData, TQueryData>)): EndpointQuery<this, TQueryFnData, TError, TData, TQueryData>;
|
|
60
|
-
toInfiniteQuery<TData = TResponse['data'], TError = DefaultError, TPageParam = unknown>(options: EndpointInfiniteQueryOptions<this, TData, TError, TPageParam> | (() => EndpointInfiniteQueryFlattenOptions<this, TData, TError, TPageParam>)): EndpointInfiniteQuery<this, TData, TError, TPageParam
|
|
60
|
+
toInfiniteQuery<TData = TResponse['data'], TError = DefaultError, TPageParam = unknown>(options: EndpointInfiniteQueryOptions<this, TData, TError, TPageParam> | (() => EndpointInfiniteQueryFlattenOptions<this, TData, TError, TPageParam>)): EndpointInfiniteQuery<this, TData, TError, TPageParam, import("@tanstack/query-core").InfiniteData<TData, TPageParam>>;
|
|
61
61
|
}
|
|
62
62
|
//# sourceMappingURL=endpoint.d.ts.map
|