mobx-tanstack-query-api 0.21.0 → 0.22.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/codegen/index.cjs +123 -35
- package/codegen/index.d.cts +1 -0
- package/codegen/index.d.cts.map +1 -1
- package/codegen/index.d.ts +1 -0
- package/codegen/index.d.ts.map +1 -1
- package/codegen/index.js +109 -35
- package/codegen/types/generate-query-api-params.d.cts +11 -0
- package/codegen/types/generate-query-api-params.d.cts.map +1 -1
- package/codegen/types/generate-query-api-params.d.ts +11 -0
- package/codegen/types/generate-query-api-params.d.ts.map +1 -1
- package/package.json +1 -1
package/codegen/index.cjs
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
18
|
};
|
|
@@ -16,6 +30,7 @@ const index_ts_for_endpoint_per_file_tmpl_js_1 = require("./templates/index-ts-f
|
|
|
16
30
|
const meta_info_tmpl_js_1 = require("./templates/meta-info.tmpl.cjs");
|
|
17
31
|
const remove_unused_types_js_1 = require("./utils/remove-unused-types.cjs");
|
|
18
32
|
const unpack_filter_option_js_1 = require("./utils/unpack-filter-option.cjs");
|
|
33
|
+
__exportStar(require("./types/index.cjs"), exports);
|
|
19
34
|
const __filename = (0, node_url_1.fileURLToPath)(require("url").pathToFileURL(__filename));
|
|
20
35
|
const __dirname = node_path_1.default.dirname(__filename);
|
|
21
36
|
const __execdirname = process.cwd();
|
|
@@ -88,21 +103,24 @@ const generateApi = async (params) => {
|
|
|
88
103
|
...params.otherCodegenParams,
|
|
89
104
|
};
|
|
90
105
|
let codegenProcess;
|
|
91
|
-
const inputData = {};
|
|
92
106
|
if (!params.input) {
|
|
93
107
|
console.warn('[mobx-tanstack-query-api/codegen]', 'input is not specified', '\nprocess will be skipped');
|
|
94
108
|
return;
|
|
95
109
|
}
|
|
96
|
-
|
|
97
|
-
inputData
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
const inputToCodegenInput = (input) => {
|
|
111
|
+
const inputData = {};
|
|
112
|
+
if (typeof input === 'string') {
|
|
113
|
+
inputData.input = input;
|
|
114
|
+
inputData.url = input;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
inputData.spec = input;
|
|
118
|
+
}
|
|
119
|
+
return inputData;
|
|
120
|
+
};
|
|
103
121
|
const generated = await (0, swagger_typescript_api_1.generateApi)({
|
|
104
122
|
...swaggerTypescriptApiCodegenBaseParams,
|
|
105
|
-
...
|
|
123
|
+
...inputToCodegenInput(params.input),
|
|
106
124
|
hooks: {
|
|
107
125
|
onInit: (configuration, codeGenProcessFromInit) => {
|
|
108
126
|
codegenProcess = codeGenProcessFromInit;
|
|
@@ -141,6 +159,36 @@ const generateApi = async (params) => {
|
|
|
141
159
|
},
|
|
142
160
|
},
|
|
143
161
|
});
|
|
162
|
+
const generatedExtra = params.mixinInput
|
|
163
|
+
? await (0, swagger_typescript_api_1.generateApi)({
|
|
164
|
+
...swaggerTypescriptApiCodegenBaseParams,
|
|
165
|
+
...inputToCodegenInput(params.mixinInput),
|
|
166
|
+
hooks: {
|
|
167
|
+
onPrepareConfig: (config) => {
|
|
168
|
+
config.routes.combined?.forEach((routeInfo) => {
|
|
169
|
+
routeInfo.routes.sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
onFormatRouteName: (routeInfo, usageRouteName) => {
|
|
173
|
+
let formattedRouteName = usageRouteName;
|
|
174
|
+
if (params.addPathSegmentToRouteName === true ||
|
|
175
|
+
typeof params.addPathSegmentToRouteName === 'number') {
|
|
176
|
+
const pathSegmentForSuffix = typeof params.addPathSegmentToRouteName === 'number'
|
|
177
|
+
? params.addPathSegmentToRouteName
|
|
178
|
+
: 0;
|
|
179
|
+
const pathSegments = routeInfo.route.split('/').filter(Boolean);
|
|
180
|
+
const { _ } = codegenProcess.getRenderTemplateData()
|
|
181
|
+
.utils;
|
|
182
|
+
formattedRouteName = _.camelCase(`${pathSegments[pathSegmentForSuffix] || ''}_${formattedRouteName}`);
|
|
183
|
+
}
|
|
184
|
+
const endpointName = formattedRouteName;
|
|
185
|
+
return (params?.formatEndpointName?.(endpointName, routeInfo) ??
|
|
186
|
+
swaggerTypescriptApiCodegenBaseParams?.hooks?.onFormatRouteName?.(routeInfo, endpointName) ??
|
|
187
|
+
endpointName);
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
: null;
|
|
144
192
|
//#endregion
|
|
145
193
|
const utils = codegenProcess.getRenderTemplateData()
|
|
146
194
|
.utils;
|
|
@@ -166,6 +214,35 @@ const generateApi = async (params) => {
|
|
|
166
214
|
const codegenFs = codegenProcess.fileSystem;
|
|
167
215
|
codegenFs.cleanDir(params.output);
|
|
168
216
|
codegenFs.createDir(params.output);
|
|
217
|
+
if (generatedExtra) {
|
|
218
|
+
const allExtraOperationIdsSet = new Set([
|
|
219
|
+
...(generated.configuration.routes.outOfModule?.map((r) => r.raw.operationId) ?? []),
|
|
220
|
+
...(generated.configuration.routes.combined?.flatMap((r) => r.routes.map((r) => r.raw.operationId)) ?? []),
|
|
221
|
+
]);
|
|
222
|
+
const allExtraModelTypesSet = new Set([
|
|
223
|
+
...generated.configuration.modelTypes.map((m) => m.name),
|
|
224
|
+
]);
|
|
225
|
+
generated.configuration.routes.outOfModule =
|
|
226
|
+
generated.configuration.routes.outOfModule ?? [];
|
|
227
|
+
generated.configuration.routes.outOfModule = [
|
|
228
|
+
...generated.configuration.routes.outOfModule.filter((route) => !allExtraOperationIdsSet.has(route.raw.operationId)),
|
|
229
|
+
...generatedExtra.configuration.routes.outOfModule,
|
|
230
|
+
];
|
|
231
|
+
generated.configuration.routes.combined =
|
|
232
|
+
generated.configuration.routes.combined ?? [];
|
|
233
|
+
generated.configuration.routes.combined.forEach((group) => {
|
|
234
|
+
group.routes = [
|
|
235
|
+
...group.routes.filter((route) => !allExtraOperationIdsSet.has(route.raw.operationId)),
|
|
236
|
+
...(generatedExtra.configuration.routes.combined?.find((g) => g.moduleName === group.moduleName)?.routes ?? []),
|
|
237
|
+
];
|
|
238
|
+
});
|
|
239
|
+
const notExistedCombinedExtra = generatedExtra.configuration.routes.combined?.filter((group) => !generated.configuration.routes.combined?.some((g) => g.moduleName === group.moduleName));
|
|
240
|
+
generated.configuration.routes.combined.push(...(notExistedCombinedExtra ?? []));
|
|
241
|
+
generated.configuration.modelTypes = [
|
|
242
|
+
...generated.configuration.modelTypes.filter((it) => !allExtraModelTypesSet.has(it.name)),
|
|
243
|
+
...generatedExtra.configuration.modelTypes,
|
|
244
|
+
];
|
|
245
|
+
}
|
|
169
246
|
const allRoutes = Object.values(generated.configuration.routes)
|
|
170
247
|
.flat()
|
|
171
248
|
.flatMap((routeGroup) => 'routes' in routeGroup ? routeGroup.routes : routeGroup);
|
|
@@ -187,10 +264,12 @@ const generateApi = async (params) => {
|
|
|
187
264
|
route,
|
|
188
265
|
relativePathDataContracts: '../data-contracts',
|
|
189
266
|
groupName: null,
|
|
190
|
-
metaInfo:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
267
|
+
metaInfo: params.noMetaInfo
|
|
268
|
+
? null
|
|
269
|
+
: {
|
|
270
|
+
groupNames: [],
|
|
271
|
+
namespace,
|
|
272
|
+
},
|
|
194
273
|
});
|
|
195
274
|
if (Array.isArray(route.raw.tags)) {
|
|
196
275
|
route.raw.tags.forEach((tag) => {
|
|
@@ -230,10 +309,12 @@ const generateApi = async (params) => {
|
|
|
230
309
|
routes: allRoutes,
|
|
231
310
|
relativePathDataContracts: './data-contracts',
|
|
232
311
|
groupName: null,
|
|
233
|
-
metaInfo:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
312
|
+
metaInfo: params.noMetaInfo
|
|
313
|
+
? null
|
|
314
|
+
: {
|
|
315
|
+
namespace,
|
|
316
|
+
groupNames: [],
|
|
317
|
+
},
|
|
237
318
|
});
|
|
238
319
|
reservedDataContractNames.forEach((name) => {
|
|
239
320
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
@@ -304,10 +385,12 @@ const generateApi = async (params) => {
|
|
|
304
385
|
route,
|
|
305
386
|
relativePathDataContracts: '../../data-contracts',
|
|
306
387
|
groupName,
|
|
307
|
-
metaInfo:
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
388
|
+
metaInfo: params.noMetaInfo
|
|
389
|
+
? null
|
|
390
|
+
: {
|
|
391
|
+
namespace,
|
|
392
|
+
groupNames: [],
|
|
393
|
+
},
|
|
311
394
|
});
|
|
312
395
|
reservedDataContractNames.forEach((name) => {
|
|
313
396
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
@@ -339,10 +422,12 @@ const generateApi = async (params) => {
|
|
|
339
422
|
routes,
|
|
340
423
|
relativePathDataContracts: '../data-contracts',
|
|
341
424
|
groupName,
|
|
342
|
-
metaInfo:
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
425
|
+
metaInfo: params.noMetaInfo
|
|
426
|
+
? null
|
|
427
|
+
: {
|
|
428
|
+
namespace,
|
|
429
|
+
groupNames: [],
|
|
430
|
+
},
|
|
346
431
|
});
|
|
347
432
|
reservedDataContractNames.forEach((name) => {
|
|
348
433
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
@@ -400,7 +485,8 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
400
485
|
}
|
|
401
486
|
// #endregion
|
|
402
487
|
}
|
|
403
|
-
const metaInfo =
|
|
488
|
+
const metaInfo = !params.noMetaInfo &&
|
|
489
|
+
(namespace ?? (nonEmptyGroups.size > 0 || tagsSet.size > 0))
|
|
404
490
|
? {
|
|
405
491
|
namespace,
|
|
406
492
|
groupNames: [...nonEmptyGroups.values()],
|
|
@@ -420,15 +506,17 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
420
506
|
withPrefix: false,
|
|
421
507
|
content: dataContractsContent,
|
|
422
508
|
});
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
509
|
+
if (metaInfo) {
|
|
510
|
+
codegenFs.createFile({
|
|
511
|
+
path: paths.outputDir,
|
|
512
|
+
fileName: 'meta-info.ts',
|
|
513
|
+
withPrefix: false,
|
|
514
|
+
content: await (0, meta_info_tmpl_js_1.metaInfoTmpl)({
|
|
515
|
+
...baseTmplParams,
|
|
516
|
+
metaInfo,
|
|
517
|
+
}),
|
|
518
|
+
});
|
|
519
|
+
}
|
|
432
520
|
if (namespace) {
|
|
433
521
|
codegenFs.createFile({
|
|
434
522
|
path: paths.outputDir,
|
package/codegen/index.d.cts
CHANGED
package/codegen/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,0BAAyB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,0BAAyB;AAI1B,kCAAiC;AAOjC,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CAstBd,CAAC"}
|
package/codegen/index.d.ts
CHANGED
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,KAAK,EAIV,sBAAsB,EAEvB,yBAAyB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,yBAAyB;AAI1B,iCAAiC;AAOjC,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CAstBd,CAAC"}
|
package/codegen/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { indexTsForEndpointPerFileTmpl } from "./templates/index-ts-for-endpoint
|
|
|
10
10
|
import { metaInfoTmpl } from "./templates/meta-info.tmpl.js";
|
|
11
11
|
import { removeUnusedTypes } from "./utils/remove-unused-types.js";
|
|
12
12
|
import { unpackFilterOption } from "./utils/unpack-filter-option.js";
|
|
13
|
+
export * from "./types/index.js";
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
15
|
const __dirname = path.dirname(__filename);
|
|
15
16
|
const __execdirname = process.cwd();
|
|
@@ -82,21 +83,24 @@ export const generateApi = async (params) => {
|
|
|
82
83
|
...params.otherCodegenParams,
|
|
83
84
|
};
|
|
84
85
|
let codegenProcess;
|
|
85
|
-
const inputData = {};
|
|
86
86
|
if (!params.input) {
|
|
87
87
|
console.warn('[mobx-tanstack-query-api/codegen]', 'input is not specified', '\nprocess will be skipped');
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
inputData
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
const inputToCodegenInput = (input) => {
|
|
91
|
+
const inputData = {};
|
|
92
|
+
if (typeof input === 'string') {
|
|
93
|
+
inputData.input = input;
|
|
94
|
+
inputData.url = input;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
inputData.spec = input;
|
|
98
|
+
}
|
|
99
|
+
return inputData;
|
|
100
|
+
};
|
|
97
101
|
const generated = await generateApiFromSwagger({
|
|
98
102
|
...swaggerTypescriptApiCodegenBaseParams,
|
|
99
|
-
...
|
|
103
|
+
...inputToCodegenInput(params.input),
|
|
100
104
|
hooks: {
|
|
101
105
|
onInit: (configuration, codeGenProcessFromInit) => {
|
|
102
106
|
codegenProcess = codeGenProcessFromInit;
|
|
@@ -135,6 +139,36 @@ export const generateApi = async (params) => {
|
|
|
135
139
|
},
|
|
136
140
|
},
|
|
137
141
|
});
|
|
142
|
+
const generatedExtra = params.mixinInput
|
|
143
|
+
? await generateApiFromSwagger({
|
|
144
|
+
...swaggerTypescriptApiCodegenBaseParams,
|
|
145
|
+
...inputToCodegenInput(params.mixinInput),
|
|
146
|
+
hooks: {
|
|
147
|
+
onPrepareConfig: (config) => {
|
|
148
|
+
config.routes.combined?.forEach((routeInfo) => {
|
|
149
|
+
routeInfo.routes.sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
onFormatRouteName: (routeInfo, usageRouteName) => {
|
|
153
|
+
let formattedRouteName = usageRouteName;
|
|
154
|
+
if (params.addPathSegmentToRouteName === true ||
|
|
155
|
+
typeof params.addPathSegmentToRouteName === 'number') {
|
|
156
|
+
const pathSegmentForSuffix = typeof params.addPathSegmentToRouteName === 'number'
|
|
157
|
+
? params.addPathSegmentToRouteName
|
|
158
|
+
: 0;
|
|
159
|
+
const pathSegments = routeInfo.route.split('/').filter(Boolean);
|
|
160
|
+
const { _ } = codegenProcess.getRenderTemplateData()
|
|
161
|
+
.utils;
|
|
162
|
+
formattedRouteName = _.camelCase(`${pathSegments[pathSegmentForSuffix] || ''}_${formattedRouteName}`);
|
|
163
|
+
}
|
|
164
|
+
const endpointName = formattedRouteName;
|
|
165
|
+
return (params?.formatEndpointName?.(endpointName, routeInfo) ??
|
|
166
|
+
swaggerTypescriptApiCodegenBaseParams?.hooks?.onFormatRouteName?.(routeInfo, endpointName) ??
|
|
167
|
+
endpointName);
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
})
|
|
171
|
+
: null;
|
|
138
172
|
//#endregion
|
|
139
173
|
const utils = codegenProcess.getRenderTemplateData()
|
|
140
174
|
.utils;
|
|
@@ -160,6 +194,35 @@ export const generateApi = async (params) => {
|
|
|
160
194
|
const codegenFs = codegenProcess.fileSystem;
|
|
161
195
|
codegenFs.cleanDir(params.output);
|
|
162
196
|
codegenFs.createDir(params.output);
|
|
197
|
+
if (generatedExtra) {
|
|
198
|
+
const allExtraOperationIdsSet = new Set([
|
|
199
|
+
...(generated.configuration.routes.outOfModule?.map((r) => r.raw.operationId) ?? []),
|
|
200
|
+
...(generated.configuration.routes.combined?.flatMap((r) => r.routes.map((r) => r.raw.operationId)) ?? []),
|
|
201
|
+
]);
|
|
202
|
+
const allExtraModelTypesSet = new Set([
|
|
203
|
+
...generated.configuration.modelTypes.map((m) => m.name),
|
|
204
|
+
]);
|
|
205
|
+
generated.configuration.routes.outOfModule =
|
|
206
|
+
generated.configuration.routes.outOfModule ?? [];
|
|
207
|
+
generated.configuration.routes.outOfModule = [
|
|
208
|
+
...generated.configuration.routes.outOfModule.filter((route) => !allExtraOperationIdsSet.has(route.raw.operationId)),
|
|
209
|
+
...generatedExtra.configuration.routes.outOfModule,
|
|
210
|
+
];
|
|
211
|
+
generated.configuration.routes.combined =
|
|
212
|
+
generated.configuration.routes.combined ?? [];
|
|
213
|
+
generated.configuration.routes.combined.forEach((group) => {
|
|
214
|
+
group.routes = [
|
|
215
|
+
...group.routes.filter((route) => !allExtraOperationIdsSet.has(route.raw.operationId)),
|
|
216
|
+
...(generatedExtra.configuration.routes.combined?.find((g) => g.moduleName === group.moduleName)?.routes ?? []),
|
|
217
|
+
];
|
|
218
|
+
});
|
|
219
|
+
const notExistedCombinedExtra = generatedExtra.configuration.routes.combined?.filter((group) => !generated.configuration.routes.combined?.some((g) => g.moduleName === group.moduleName));
|
|
220
|
+
generated.configuration.routes.combined.push(...(notExistedCombinedExtra ?? []));
|
|
221
|
+
generated.configuration.modelTypes = [
|
|
222
|
+
...generated.configuration.modelTypes.filter((it) => !allExtraModelTypesSet.has(it.name)),
|
|
223
|
+
...generatedExtra.configuration.modelTypes,
|
|
224
|
+
];
|
|
225
|
+
}
|
|
163
226
|
const allRoutes = Object.values(generated.configuration.routes)
|
|
164
227
|
.flat()
|
|
165
228
|
.flatMap((routeGroup) => 'routes' in routeGroup ? routeGroup.routes : routeGroup);
|
|
@@ -181,10 +244,12 @@ export const generateApi = async (params) => {
|
|
|
181
244
|
route,
|
|
182
245
|
relativePathDataContracts: '../data-contracts',
|
|
183
246
|
groupName: null,
|
|
184
|
-
metaInfo:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
247
|
+
metaInfo: params.noMetaInfo
|
|
248
|
+
? null
|
|
249
|
+
: {
|
|
250
|
+
groupNames: [],
|
|
251
|
+
namespace,
|
|
252
|
+
},
|
|
188
253
|
});
|
|
189
254
|
if (Array.isArray(route.raw.tags)) {
|
|
190
255
|
route.raw.tags.forEach((tag) => {
|
|
@@ -224,10 +289,12 @@ export const generateApi = async (params) => {
|
|
|
224
289
|
routes: allRoutes,
|
|
225
290
|
relativePathDataContracts: './data-contracts',
|
|
226
291
|
groupName: null,
|
|
227
|
-
metaInfo:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
292
|
+
metaInfo: params.noMetaInfo
|
|
293
|
+
? null
|
|
294
|
+
: {
|
|
295
|
+
namespace,
|
|
296
|
+
groupNames: [],
|
|
297
|
+
},
|
|
231
298
|
});
|
|
232
299
|
reservedDataContractNames.forEach((name) => {
|
|
233
300
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
@@ -298,10 +365,12 @@ export const generateApi = async (params) => {
|
|
|
298
365
|
route,
|
|
299
366
|
relativePathDataContracts: '../../data-contracts',
|
|
300
367
|
groupName,
|
|
301
|
-
metaInfo:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
368
|
+
metaInfo: params.noMetaInfo
|
|
369
|
+
? null
|
|
370
|
+
: {
|
|
371
|
+
namespace,
|
|
372
|
+
groupNames: [],
|
|
373
|
+
},
|
|
305
374
|
});
|
|
306
375
|
reservedDataContractNames.forEach((name) => {
|
|
307
376
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
@@ -333,10 +402,12 @@ export const generateApi = async (params) => {
|
|
|
333
402
|
routes,
|
|
334
403
|
relativePathDataContracts: '../data-contracts',
|
|
335
404
|
groupName,
|
|
336
|
-
metaInfo:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
405
|
+
metaInfo: params.noMetaInfo
|
|
406
|
+
? null
|
|
407
|
+
: {
|
|
408
|
+
namespace,
|
|
409
|
+
groupNames: [],
|
|
410
|
+
},
|
|
340
411
|
});
|
|
341
412
|
reservedDataContractNames.forEach((name) => {
|
|
342
413
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
@@ -394,7 +465,8 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
394
465
|
}
|
|
395
466
|
// #endregion
|
|
396
467
|
}
|
|
397
|
-
const metaInfo =
|
|
468
|
+
const metaInfo = !params.noMetaInfo &&
|
|
469
|
+
(namespace ?? (nonEmptyGroups.size > 0 || tagsSet.size > 0))
|
|
398
470
|
? {
|
|
399
471
|
namespace,
|
|
400
472
|
groupNames: [...nonEmptyGroups.values()],
|
|
@@ -414,15 +486,17 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
414
486
|
withPrefix: false,
|
|
415
487
|
content: dataContractsContent,
|
|
416
488
|
});
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
489
|
+
if (metaInfo) {
|
|
490
|
+
codegenFs.createFile({
|
|
491
|
+
path: paths.outputDir,
|
|
492
|
+
fileName: 'meta-info.ts',
|
|
493
|
+
withPrefix: false,
|
|
494
|
+
content: await metaInfoTmpl({
|
|
495
|
+
...baseTmplParams,
|
|
496
|
+
metaInfo,
|
|
497
|
+
}),
|
|
498
|
+
});
|
|
499
|
+
}
|
|
426
500
|
if (namespace) {
|
|
427
501
|
codegenFs.createFile({
|
|
428
502
|
path: paths.outputDir,
|
|
@@ -16,6 +16,10 @@ export interface GenerateQueryApiParams {
|
|
|
16
16
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#input)
|
|
17
17
|
*/
|
|
18
18
|
input: string | AnyObject;
|
|
19
|
+
/**
|
|
20
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#mixininput)
|
|
21
|
+
*/
|
|
22
|
+
mixinInput?: string | AnyObject;
|
|
19
23
|
/**
|
|
20
24
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#requestpathprefix)
|
|
21
25
|
*/
|
|
@@ -143,7 +147,14 @@ export interface GenerateQueryApiParams {
|
|
|
143
147
|
groupEnumValue?: (group: string, namespace?: Maybe<string>) => string;
|
|
144
148
|
tagEnumValue?: (tag: string, namespace?: Maybe<string>) => string;
|
|
145
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#cleanoutput)
|
|
152
|
+
*/
|
|
146
153
|
cleanOutput?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#nometainfo)
|
|
156
|
+
*/
|
|
157
|
+
noMetaInfo?: boolean;
|
|
147
158
|
}
|
|
148
159
|
export {};
|
|
149
160
|
//# sourceMappingURL=generate-query-api-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,yCAAwC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,0CAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA2B;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAEhE,KAAK,qBAAqB,GAAG,YAAY,CAAC,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC;AAE/E,KAAK,kBAAkB,GAAG,YAAY,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[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B,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;QACtE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;KACnE,CAAC;IAEF;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -16,6 +16,10 @@ export interface GenerateQueryApiParams {
|
|
|
16
16
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#input)
|
|
17
17
|
*/
|
|
18
18
|
input: string | AnyObject;
|
|
19
|
+
/**
|
|
20
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#mixininput)
|
|
21
|
+
*/
|
|
22
|
+
mixinInput?: string | AnyObject;
|
|
19
23
|
/**
|
|
20
24
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#requestpathprefix)
|
|
21
25
|
*/
|
|
@@ -143,7 +147,14 @@ export interface GenerateQueryApiParams {
|
|
|
143
147
|
groupEnumValue?: (group: string, namespace?: Maybe<string>) => string;
|
|
144
148
|
tagEnumValue?: (tag: string, namespace?: Maybe<string>) => string;
|
|
145
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#cleanoutput)
|
|
152
|
+
*/
|
|
146
153
|
cleanOutput?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#nometainfo)
|
|
156
|
+
*/
|
|
157
|
+
noMetaInfo?: boolean;
|
|
147
158
|
}
|
|
148
159
|
export {};
|
|
149
160
|
//# sourceMappingURL=generate-query-api-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,wCAAwC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,yCAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAEhE,KAAK,qBAAqB,GAAG,YAAY,CAAC,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC;AAE/E,KAAK,kBAAkB,GAAG,YAAY,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,wCAAwC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,yCAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,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