mobx-tanstack-query-api 0.20.0 → 0.21.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/cli/utils/define-config.d.cts +1 -1
- package/cli/utils/define-config.d.cts.map +1 -1
- package/cli/utils/define-config.d.ts +1 -1
- package/cli/utils/define-config.d.ts.map +1 -1
- package/codegen/index.cjs +28 -43
- package/codegen/index.d.cts +1 -165
- package/codegen/index.d.cts.map +1 -1
- package/codegen/index.d.ts +1 -165
- package/codegen/index.d.ts.map +1 -1
- package/codegen/index.js +29 -44
- package/codegen/templates/all-endpoints-per-file.tmpl.cjs +8 -13
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts +5 -10
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts.map +1 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts +5 -10
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.js +8 -13
- package/codegen/templates/all-exports.tmpl.d.cts +2 -4
- package/codegen/templates/all-exports.tmpl.d.cts.map +1 -1
- package/codegen/templates/all-exports.tmpl.d.ts +2 -4
- package/codegen/templates/all-exports.tmpl.d.ts.map +1 -1
- package/codegen/templates/data-contract.tmpl.d.cts +2 -2
- package/codegen/templates/data-contract.tmpl.d.cts.map +1 -1
- package/codegen/templates/data-contract.tmpl.d.ts +2 -2
- package/codegen/templates/data-contract.tmpl.d.ts.map +1 -1
- package/codegen/templates/data-contracts-file.tmpl.cjs +5 -5
- package/codegen/templates/data-contracts-file.tmpl.d.cts +3 -7
- package/codegen/templates/data-contracts-file.tmpl.d.cts.map +1 -1
- package/codegen/templates/data-contracts-file.tmpl.d.ts +3 -7
- package/codegen/templates/data-contracts-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/data-contracts-file.tmpl.js +5 -5
- package/codegen/templates/endpoint-jsdoc.tmpl.cjs +2 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts +3 -5
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts.map +1 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts +3 -5
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts.map +1 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.js +2 -1
- package/codegen/templates/endpoint-per-file.tmpl.cjs +8 -11
- package/codegen/templates/endpoint-per-file.tmpl.d.cts +4 -9
- package/codegen/templates/endpoint-per-file.tmpl.d.cts.map +1 -1
- package/codegen/templates/endpoint-per-file.tmpl.d.ts +4 -9
- package/codegen/templates/endpoint-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/endpoint-per-file.tmpl.js +8 -11
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts +2 -6
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts.map +1 -1
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts +2 -6
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/meta-info.tmpl.d.cts +2 -5
- package/codegen/templates/meta-info.tmpl.d.cts.map +1 -1
- package/codegen/templates/meta-info.tmpl.d.ts +2 -5
- package/codegen/templates/meta-info.tmpl.d.ts.map +1 -1
- package/codegen/templates/new-endpoint.tmpl.cjs +5 -5
- package/codegen/templates/new-endpoint.tmpl.d.cts +4 -7
- package/codegen/templates/new-endpoint.tmpl.d.cts.map +1 -1
- package/codegen/templates/new-endpoint.tmpl.d.ts +4 -7
- package/codegen/templates/new-endpoint.tmpl.d.ts.map +1 -1
- package/codegen/templates/new-endpoint.tmpl.js +5 -5
- package/codegen/types/all-import-file-params.cjs +2 -0
- package/codegen/types/all-import-file-params.d.cts +5 -0
- package/codegen/types/all-import-file-params.d.cts.map +1 -0
- package/codegen/types/all-import-file-params.d.ts +5 -0
- package/codegen/types/all-import-file-params.d.ts.map +1 -0
- package/codegen/types/all-import-file-params.js +1 -0
- package/codegen/types/base-tmpl-params.cjs +2 -0
- package/codegen/types/base-tmpl-params.d.cts +14 -0
- package/codegen/types/base-tmpl-params.d.cts.map +1 -0
- package/codegen/types/base-tmpl-params.d.ts +14 -0
- package/codegen/types/base-tmpl-params.d.ts.map +1 -0
- package/codegen/types/base-tmpl-params.js +1 -0
- package/codegen/types/codegen-data-utils.cjs +2 -0
- package/codegen/types/codegen-data-utils.d.cts +8 -0
- package/codegen/types/codegen-data-utils.d.cts.map +1 -0
- package/codegen/types/codegen-data-utils.d.ts +8 -0
- package/codegen/types/codegen-data-utils.d.ts.map +1 -0
- package/codegen/types/codegen-data-utils.js +1 -0
- package/codegen/types/endpoint-data.cjs +2 -0
- package/codegen/types/endpoint-data.d.cts +3 -0
- package/codegen/types/endpoint-data.d.cts.map +1 -0
- package/codegen/types/endpoint-data.d.ts +3 -0
- package/codegen/types/endpoint-data.d.ts.map +1 -0
- package/codegen/types/endpoint-data.js +1 -0
- package/codegen/types/generate-query-api-params.cjs +2 -0
- package/codegen/types/generate-query-api-params.d.cts +149 -0
- package/codegen/types/generate-query-api-params.d.cts.map +1 -0
- package/codegen/types/generate-query-api-params.d.ts +149 -0
- package/codegen/types/generate-query-api-params.d.ts.map +1 -0
- package/codegen/types/generate-query-api-params.js +1 -0
- package/codegen/types/import-file-params.cjs +2 -0
- package/codegen/types/import-file-params.d.cts +5 -0
- package/codegen/types/import-file-params.d.cts.map +1 -0
- package/codegen/types/import-file-params.d.ts +5 -0
- package/codegen/types/import-file-params.d.ts.map +1 -0
- package/codegen/types/import-file-params.js +1 -0
- package/codegen/types/index.cjs +23 -0
- package/codegen/types/index.d.cts +8 -0
- package/codegen/types/index.d.cts.map +1 -0
- package/codegen/types/index.d.ts +8 -0
- package/codegen/types/index.d.ts.map +1 -0
- package/codegen/types/index.js +7 -0
- package/codegen/types/meta-info.cjs +2 -0
- package/codegen/types/meta-info.d.cts +6 -0
- package/codegen/types/meta-info.d.cts.map +1 -0
- package/codegen/types/meta-info.d.ts +6 -0
- package/codegen/types/meta-info.d.ts.map +1 -0
- package/codegen/types/meta-info.js +1 -0
- package/codegen/utils/remove-unused-types.d.cts +1 -1
- package/codegen/utils/remove-unused-types.d.cts.map +1 -1
- package/codegen/utils/remove-unused-types.d.ts +1 -1
- package/codegen/utils/remove-unused-types.d.ts.map +1 -1
- package/codegen/utils/remove-unused-types.js +1 -1
- package/codegen/utils/unpack-filter-option.d.cts +1 -1
- package/codegen/utils/unpack-filter-option.d.cts.map +1 -1
- package/codegen/utils/unpack-filter-option.d.ts +1 -1
- package/codegen/utils/unpack-filter-option.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Maybe } from 'yummies/utils/types';
|
|
2
|
-
import type { GenerateQueryApiParams } from "../../codegen/index.cjs";
|
|
2
|
+
import type { GenerateQueryApiParams } from "../../codegen/types/index.cjs";
|
|
3
3
|
export declare const defineConfig: (...configs: Maybe<GenerateQueryApiParams | GenerateQueryApiParams[]>[]) => GenerateQueryApiParams[];
|
|
4
4
|
//# sourceMappingURL=define-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sCAAqC;AAE3E,eAAO,MAAM,YAAY,GACvB,GAAG,SAAS,KAAK,CAAC,sBAAsB,GAAG,sBAAsB,EAAE,CAAC,EAAE,KACrE,sBAAsB,EAIxB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Maybe } from 'yummies/utils/types';
|
|
2
|
-
import type { GenerateQueryApiParams } from "../../codegen/index.js";
|
|
2
|
+
import type { GenerateQueryApiParams } from "../../codegen/types/index.js";
|
|
3
3
|
export declare const defineConfig: (...configs: Maybe<GenerateQueryApiParams | GenerateQueryApiParams[]>[]) => GenerateQueryApiParams[];
|
|
4
4
|
//# sourceMappingURL=define-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,qCAAqC;AAE3E,eAAO,MAAM,YAAY,GACvB,GAAG,SAAS,KAAK,CAAC,sBAAsB,GAAG,sBAAsB,EAAE,CAAC,EAAE,KACrE,sBAAsB,EAIxB,CAAC"}
|
package/codegen/index.cjs
CHANGED
|
@@ -21,7 +21,9 @@ const __dirname = node_path_1.default.dirname(__filename);
|
|
|
21
21
|
const __execdirname = process.cwd();
|
|
22
22
|
const generateApi = async (params) => {
|
|
23
23
|
if (Array.isArray(params)) {
|
|
24
|
-
await
|
|
24
|
+
for await (const param of params) {
|
|
25
|
+
await (0, exports.generateApi)(param);
|
|
26
|
+
}
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
27
29
|
const tsconfigPath = params.tsconfigPath
|
|
@@ -56,9 +58,9 @@ const generateApi = async (params) => {
|
|
|
56
58
|
outputDir: node_path_1.default.resolve(process.cwd(), params.output),
|
|
57
59
|
};
|
|
58
60
|
//#region swagger-typescript-api
|
|
59
|
-
const
|
|
61
|
+
const swaggerTypescriptApiCodegenBaseParams = {
|
|
60
62
|
httpClientType: 'fetch',
|
|
61
|
-
cleanOutput: true,
|
|
63
|
+
cleanOutput: params.cleanOutput ?? true,
|
|
62
64
|
modular: true,
|
|
63
65
|
patch: true,
|
|
64
66
|
typeSuffix: 'DC',
|
|
@@ -99,7 +101,7 @@ const generateApi = async (params) => {
|
|
|
99
101
|
inputData.spec = params.input;
|
|
100
102
|
}
|
|
101
103
|
const generated = await (0, swagger_typescript_api_1.generateApi)({
|
|
102
|
-
...
|
|
104
|
+
...swaggerTypescriptApiCodegenBaseParams,
|
|
103
105
|
...inputData,
|
|
104
106
|
hooks: {
|
|
105
107
|
onInit: (configuration, codeGenProcessFromInit) => {
|
|
@@ -112,13 +114,13 @@ const generateApi = async (params) => {
|
|
|
112
114
|
configuration.swaggerSchema.components.schemas =
|
|
113
115
|
// @ts-expect-error
|
|
114
116
|
configuration.swaggerSchema.components.schemas || {};
|
|
115
|
-
return
|
|
117
|
+
return swaggerTypescriptApiCodegenBaseParams?.hooks?.onInit?.(configuration, codeGenProcessFromInit);
|
|
116
118
|
},
|
|
117
119
|
onPrepareConfig: (config) => {
|
|
118
120
|
config.routes.combined?.forEach((routeInfo) => {
|
|
119
121
|
routeInfo.routes.sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
|
|
120
122
|
});
|
|
121
|
-
return
|
|
123
|
+
return swaggerTypescriptApiCodegenBaseParams?.hooks?.onPrepareConfig?.(config);
|
|
122
124
|
},
|
|
123
125
|
onFormatRouteName: (routeInfo, usageRouteName) => {
|
|
124
126
|
let formattedRouteName = usageRouteName;
|
|
@@ -134,7 +136,7 @@ const generateApi = async (params) => {
|
|
|
134
136
|
}
|
|
135
137
|
const endpointName = formattedRouteName;
|
|
136
138
|
return (params?.formatEndpointName?.(endpointName, routeInfo) ??
|
|
137
|
-
|
|
139
|
+
swaggerTypescriptApiCodegenBaseParams?.hooks?.onFormatRouteName?.(routeInfo, endpointName) ??
|
|
138
140
|
endpointName);
|
|
139
141
|
},
|
|
140
142
|
},
|
|
@@ -142,6 +144,15 @@ const generateApi = async (params) => {
|
|
|
142
144
|
//#endregion
|
|
143
145
|
const utils = codegenProcess.getRenderTemplateData()
|
|
144
146
|
.utils;
|
|
147
|
+
const baseTmplParams = {
|
|
148
|
+
...generated,
|
|
149
|
+
codegenParams: params,
|
|
150
|
+
configuration: generated.configuration,
|
|
151
|
+
formatTSContent: generated.formatTSContent,
|
|
152
|
+
codegenProcess,
|
|
153
|
+
importFileParams,
|
|
154
|
+
utils,
|
|
155
|
+
};
|
|
145
156
|
const { _ } = utils;
|
|
146
157
|
let namespace = null;
|
|
147
158
|
if (params.namespace) {
|
|
@@ -172,12 +183,8 @@ const generateApi = async (params) => {
|
|
|
172
183
|
const fileNamesWithRequestInfo = [];
|
|
173
184
|
for await (const route of allRoutes) {
|
|
174
185
|
const { content: requestInfoPerFileContent, reservedDataContractNames, } = await (0, endpoint_per_file_tmpl_js_1.endpointPerFileTmpl)({
|
|
175
|
-
...
|
|
186
|
+
...baseTmplParams,
|
|
176
187
|
route,
|
|
177
|
-
apiParams: params,
|
|
178
|
-
codegenProcess,
|
|
179
|
-
importFileParams,
|
|
180
|
-
utils,
|
|
181
188
|
relativePathDataContracts: '../data-contracts',
|
|
182
189
|
groupName: null,
|
|
183
190
|
metaInfo: {
|
|
@@ -210,9 +217,7 @@ const generateApi = async (params) => {
|
|
|
210
217
|
fileName: 'index.ts',
|
|
211
218
|
withPrefix: false,
|
|
212
219
|
content: await (0, index_ts_for_endpoint_per_file_tmpl_js_1.indexTsForEndpointPerFileTmpl)({
|
|
213
|
-
...
|
|
214
|
-
apiParams: params,
|
|
215
|
-
codegenProcess,
|
|
220
|
+
...baseTmplParams,
|
|
216
221
|
generatedRequestFileNames: fileNamesWithRequestInfo,
|
|
217
222
|
}),
|
|
218
223
|
});
|
|
@@ -221,12 +226,8 @@ const generateApi = async (params) => {
|
|
|
221
226
|
else {
|
|
222
227
|
// #region кодогенерация несколько эндпоинтов в 1 файле без группировки
|
|
223
228
|
const { content: requestInfoPerFileContent, reservedDataContractNames } = await (0, all_endpoints_per_file_tmpl_js_1.allEndpointPerFileTmpl)({
|
|
224
|
-
...
|
|
229
|
+
...baseTmplParams,
|
|
225
230
|
routes: allRoutes,
|
|
226
|
-
apiParams: params,
|
|
227
|
-
codegenProcess,
|
|
228
|
-
importFileParams,
|
|
229
|
-
utils,
|
|
230
231
|
relativePathDataContracts: './data-contracts',
|
|
231
232
|
groupName: null,
|
|
232
233
|
metaInfo: {
|
|
@@ -299,12 +300,8 @@ const generateApi = async (params) => {
|
|
|
299
300
|
codegenFs.createDir(node_path_1.default.resolve(groupDirectory, 'endpoints'));
|
|
300
301
|
for await (const route of routes) {
|
|
301
302
|
const { content: requestInfoPerFileContent, reservedDataContractNames, } = await (0, endpoint_per_file_tmpl_js_1.endpointPerFileTmpl)({
|
|
302
|
-
...
|
|
303
|
+
...baseTmplParams,
|
|
303
304
|
route,
|
|
304
|
-
apiParams: params,
|
|
305
|
-
codegenProcess,
|
|
306
|
-
importFileParams,
|
|
307
|
-
utils,
|
|
308
305
|
relativePathDataContracts: '../../data-contracts',
|
|
309
306
|
groupName,
|
|
310
307
|
metaInfo: {
|
|
@@ -338,12 +335,8 @@ const generateApi = async (params) => {
|
|
|
338
335
|
else {
|
|
339
336
|
// #region Генерация нескольких эндпоинтов на 1 файл
|
|
340
337
|
const { content: requestInfoPerFileContent, reservedDataContractNames, } = await (0, all_endpoints_per_file_tmpl_js_1.allEndpointPerFileTmpl)({
|
|
341
|
-
...
|
|
338
|
+
...baseTmplParams,
|
|
342
339
|
routes,
|
|
343
|
-
apiParams: params,
|
|
344
|
-
codegenProcess,
|
|
345
|
-
importFileParams,
|
|
346
|
-
utils,
|
|
347
340
|
relativePathDataContracts: '../data-contracts',
|
|
348
341
|
groupName,
|
|
349
342
|
metaInfo: {
|
|
@@ -394,9 +387,7 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
394
387
|
fileName: 'index.ts',
|
|
395
388
|
withPrefix: false,
|
|
396
389
|
content: await (0, index_ts_for_endpoint_per_file_tmpl_js_1.indexTsForEndpointPerFileTmpl)({
|
|
397
|
-
...
|
|
398
|
-
apiParams: params,
|
|
399
|
-
codegenProcess,
|
|
390
|
+
...baseTmplParams,
|
|
400
391
|
generatedRequestFileNames: fileNamesWithRequestInfo,
|
|
401
392
|
}),
|
|
402
393
|
});
|
|
@@ -420,9 +411,7 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
420
411
|
.filter(([_, count]) => count === 1)
|
|
421
412
|
.map(([name]) => name);
|
|
422
413
|
const dataContractsContent = await (0, data_contracts_file_tmpl_js_1.dataContractsFileTmpl)({
|
|
423
|
-
...
|
|
424
|
-
apiParams: params,
|
|
425
|
-
codegenProcess,
|
|
414
|
+
...baseTmplParams,
|
|
426
415
|
excludedDataContractNames,
|
|
427
416
|
});
|
|
428
417
|
codegenFs.createFile({
|
|
@@ -436,10 +425,8 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
436
425
|
fileName: 'meta-info.ts',
|
|
437
426
|
withPrefix: false,
|
|
438
427
|
content: await (0, meta_info_tmpl_js_1.metaInfoTmpl)({
|
|
439
|
-
...
|
|
428
|
+
...baseTmplParams,
|
|
440
429
|
metaInfo,
|
|
441
|
-
utils,
|
|
442
|
-
codegenParams: params,
|
|
443
430
|
}),
|
|
444
431
|
});
|
|
445
432
|
if (namespace) {
|
|
@@ -448,10 +435,9 @@ export * as ${exportGroupName} from './endpoints';
|
|
|
448
435
|
fileName: '__exports.ts',
|
|
449
436
|
withPrefix: false,
|
|
450
437
|
content: await (0, all_exports_tmpl_js_1.allExportsTmpl)({
|
|
451
|
-
...
|
|
438
|
+
...baseTmplParams,
|
|
452
439
|
collectedExportFiles: collectedExportFilesFromIndexFile,
|
|
453
440
|
metaInfo,
|
|
454
|
-
utils,
|
|
455
441
|
}),
|
|
456
442
|
});
|
|
457
443
|
codegenFs.createFile({
|
|
@@ -469,10 +455,9 @@ export * as ${namespace} from './__exports';
|
|
|
469
455
|
fileName: 'index.ts',
|
|
470
456
|
withPrefix: false,
|
|
471
457
|
content: await (0, all_exports_tmpl_js_1.allExportsTmpl)({
|
|
472
|
-
...
|
|
458
|
+
...baseTmplParams,
|
|
473
459
|
collectedExportFiles: collectedExportFilesFromIndexFile,
|
|
474
460
|
metaInfo,
|
|
475
|
-
utils,
|
|
476
461
|
}),
|
|
477
462
|
});
|
|
478
463
|
}
|
package/codegen/index.d.cts
CHANGED
|
@@ -1,167 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type ParsedRoute, type RawRouteInfo } from 'swagger-typescript-api';
|
|
3
|
-
import type { RequestInit } from 'undici-types';
|
|
4
|
-
import type { AnyObject, KeyOfByValue, Maybe } from 'yummies/utils/types';
|
|
5
|
-
import { type RemoveUnusedTypesParams } from "./utils/remove-unused-types.cjs";
|
|
6
|
-
export type CodegenDataUtils = {
|
|
7
|
-
_: LoDashStatic;
|
|
8
|
-
getInlineParseContent: (requestParams: AnyObject) => string;
|
|
9
|
-
formatModelName: (modelName: string) => string;
|
|
10
|
-
};
|
|
11
|
-
export type EndpointData = ParsedRoute;
|
|
12
|
-
export type FilterOption<T extends (...args: any[]) => boolean> = T | string | RegExp | (RegExp | string)[];
|
|
13
|
-
type FilterEndpointsOption = FilterOption<(endpoint: EndpointData) => boolean>;
|
|
14
|
-
type FilterGroupsOption = FilterOption<(groupName: string) => boolean>;
|
|
15
|
-
export type CodegenProcess = AnyObject;
|
|
16
|
-
export interface ImportFileParams {
|
|
17
|
-
path: string;
|
|
18
|
-
exportName: string;
|
|
19
|
-
}
|
|
20
|
-
export interface MetaInfo {
|
|
21
|
-
namespace: string | null;
|
|
22
|
-
groupNames: string[];
|
|
23
|
-
tags?: string[];
|
|
24
|
-
}
|
|
25
|
-
export interface GenerateQueryApiParams {
|
|
26
|
-
/**
|
|
27
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#output)
|
|
28
|
-
*/
|
|
29
|
-
output: string;
|
|
30
|
-
/**
|
|
31
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#input)
|
|
32
|
-
*/
|
|
33
|
-
input: string | AnyObject;
|
|
34
|
-
/**
|
|
35
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#requestpathprefix)
|
|
36
|
-
*/
|
|
37
|
-
requestPathPrefix?: string;
|
|
38
|
-
/**
|
|
39
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#requestpathsuffix)
|
|
40
|
-
*/
|
|
41
|
-
requestPathSuffix?: string;
|
|
42
|
-
/**
|
|
43
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#removeunusedtypes)
|
|
44
|
-
*/
|
|
45
|
-
removeUnusedTypes?: true | {
|
|
46
|
-
keepTypes?: RemoveUnusedTypesParams['keepTypes'];
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#formatendpointname)
|
|
50
|
-
*/
|
|
51
|
-
formatEndpointName?: (endpointName: string, endpointData: RawRouteInfo) => Maybe<string>;
|
|
52
|
-
/**
|
|
53
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#formatexportgroupname)
|
|
54
|
-
*/
|
|
55
|
-
formatExportGroupName?: (groupName: string, utils: CodegenDataUtils) => string;
|
|
56
|
-
/**
|
|
57
|
-
* Various generation output types
|
|
58
|
-
*
|
|
59
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#outputtype)
|
|
60
|
-
*
|
|
61
|
-
* `one-endpoint-per-file`
|
|
62
|
-
* @example
|
|
63
|
-
* ```
|
|
64
|
-
* outputdir
|
|
65
|
-
* groupname
|
|
66
|
-
* index.ts
|
|
67
|
-
* endpoints
|
|
68
|
-
* index.ts
|
|
69
|
-
* get-endpoint-1.ts
|
|
70
|
-
* get-endpoint-n.ts
|
|
71
|
-
* ```
|
|
72
|
-
* @example
|
|
73
|
-
* ```
|
|
74
|
-
* outputdir
|
|
75
|
-
* index.ts
|
|
76
|
-
* endpoints
|
|
77
|
-
* index.ts
|
|
78
|
-
* get-endpoint-1.ts
|
|
79
|
-
* get-endpoint-n.ts
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* `endpoints-per-file`
|
|
83
|
-
* @example
|
|
84
|
-
* ```
|
|
85
|
-
* outputdir
|
|
86
|
-
* groupname
|
|
87
|
-
* index.ts
|
|
88
|
-
* endpoints.ts
|
|
89
|
-
* ```
|
|
90
|
-
* @example
|
|
91
|
-
* ```
|
|
92
|
-
* outputdir
|
|
93
|
-
* index.ts
|
|
94
|
-
* endpoints.ts
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
outputType?: 'one-endpoint-per-file' | 'endpoints-per-file';
|
|
98
|
-
/**
|
|
99
|
-
* Group endpoints and collect it into object
|
|
100
|
-
*
|
|
101
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#groupby)
|
|
102
|
-
*/
|
|
103
|
-
groupBy?: ((endpoint: EndpointData) => string) | `path-segment` | `path-segment-${number}` | `tag` | `tag-${number}`;
|
|
104
|
-
/**
|
|
105
|
-
* Collect all exports into single namespace
|
|
106
|
-
*
|
|
107
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#namespace)
|
|
108
|
-
*/
|
|
109
|
-
namespace?: string | ((utils: AnyObject) => string);
|
|
110
|
-
/**
|
|
111
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#addpathsegmenttoroutename)
|
|
112
|
-
*/
|
|
113
|
-
addPathSegmentToRouteName?: boolean | number;
|
|
114
|
-
/**
|
|
115
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#queryclient)
|
|
116
|
-
*/
|
|
117
|
-
queryClient?: 'builtin' | ImportFileParams;
|
|
118
|
-
/**
|
|
119
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#endpoint)
|
|
120
|
-
*/
|
|
121
|
-
endpoint?: 'builtin' | ImportFileParams;
|
|
122
|
-
/**
|
|
123
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#httpclient)
|
|
124
|
-
*/
|
|
125
|
-
httpClient?: 'builtin' | ImportFileParams;
|
|
126
|
-
/**
|
|
127
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#getendpointmeta)
|
|
128
|
-
*/
|
|
129
|
-
getEndpointMeta?: (route: AnyObject, utils: AnyObject) => {
|
|
130
|
-
typeName?: string;
|
|
131
|
-
typeNameImportPath?: string;
|
|
132
|
-
tmplData: string;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#getrequestmeta)
|
|
136
|
-
*/
|
|
137
|
-
getRequestMeta?: (route: AnyObject, utils: AnyObject) => {
|
|
138
|
-
tmplData: string;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Additional parameters used to fetch your OpenAPI schema
|
|
142
|
-
*
|
|
143
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#fetchschemarequestoptions)
|
|
144
|
-
*/
|
|
145
|
-
fetchSchemaRequestOptions?: RequestInit;
|
|
146
|
-
otherCodegenParams?: AnyObject;
|
|
147
|
-
/**
|
|
148
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filterendpoints)
|
|
149
|
-
*/
|
|
150
|
-
filterEndpoints?: FilterEndpointsOption;
|
|
151
|
-
/**
|
|
152
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filtergroups)
|
|
153
|
-
*/
|
|
154
|
-
filterGroups?: FilterGroupsOption;
|
|
155
|
-
libImports?: {
|
|
156
|
-
'mobx-tanstack-query-api'?: string;
|
|
157
|
-
};
|
|
158
|
-
tsconfigPath?: string;
|
|
159
|
-
transforms?: {
|
|
160
|
-
groupEnumValue?: (group: string, namespace?: Maybe<string>) => string;
|
|
161
|
-
tagEnumValue?: (tag: string, namespace?: Maybe<string>) => string;
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
export type AllImportFileParams = Record<KeyOfByValue<Required<GenerateQueryApiParams>, 'builtin' | ImportFileParams>, ImportFileParams>;
|
|
1
|
+
import type { GenerateQueryApiParams } from "./types/index.cjs";
|
|
165
2
|
export declare const generateApi: (params: GenerateQueryApiParams | GenerateQueryApiParams[]) => Promise<void>;
|
|
166
|
-
export {};
|
|
167
3
|
//# sourceMappingURL=index.d.ts.map
|
package/codegen/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,0BAAyB;AAS1B,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CA8lBd,CAAC"}
|
package/codegen/index.d.ts
CHANGED
|
@@ -1,167 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type ParsedRoute, type RawRouteInfo } from 'swagger-typescript-api';
|
|
3
|
-
import type { RequestInit } from 'undici-types';
|
|
4
|
-
import type { AnyObject, KeyOfByValue, Maybe } from 'yummies/utils/types';
|
|
5
|
-
import { type RemoveUnusedTypesParams } from "./utils/remove-unused-types.js";
|
|
6
|
-
export type CodegenDataUtils = {
|
|
7
|
-
_: LoDashStatic;
|
|
8
|
-
getInlineParseContent: (requestParams: AnyObject) => string;
|
|
9
|
-
formatModelName: (modelName: string) => string;
|
|
10
|
-
};
|
|
11
|
-
export type EndpointData = ParsedRoute;
|
|
12
|
-
export type FilterOption<T extends (...args: any[]) => boolean> = T | string | RegExp | (RegExp | string)[];
|
|
13
|
-
type FilterEndpointsOption = FilterOption<(endpoint: EndpointData) => boolean>;
|
|
14
|
-
type FilterGroupsOption = FilterOption<(groupName: string) => boolean>;
|
|
15
|
-
export type CodegenProcess = AnyObject;
|
|
16
|
-
export interface ImportFileParams {
|
|
17
|
-
path: string;
|
|
18
|
-
exportName: string;
|
|
19
|
-
}
|
|
20
|
-
export interface MetaInfo {
|
|
21
|
-
namespace: string | null;
|
|
22
|
-
groupNames: string[];
|
|
23
|
-
tags?: string[];
|
|
24
|
-
}
|
|
25
|
-
export interface GenerateQueryApiParams {
|
|
26
|
-
/**
|
|
27
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#output)
|
|
28
|
-
*/
|
|
29
|
-
output: string;
|
|
30
|
-
/**
|
|
31
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#input)
|
|
32
|
-
*/
|
|
33
|
-
input: string | AnyObject;
|
|
34
|
-
/**
|
|
35
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#requestpathprefix)
|
|
36
|
-
*/
|
|
37
|
-
requestPathPrefix?: string;
|
|
38
|
-
/**
|
|
39
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#requestpathsuffix)
|
|
40
|
-
*/
|
|
41
|
-
requestPathSuffix?: string;
|
|
42
|
-
/**
|
|
43
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#removeunusedtypes)
|
|
44
|
-
*/
|
|
45
|
-
removeUnusedTypes?: true | {
|
|
46
|
-
keepTypes?: RemoveUnusedTypesParams['keepTypes'];
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#formatendpointname)
|
|
50
|
-
*/
|
|
51
|
-
formatEndpointName?: (endpointName: string, endpointData: RawRouteInfo) => Maybe<string>;
|
|
52
|
-
/**
|
|
53
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#formatexportgroupname)
|
|
54
|
-
*/
|
|
55
|
-
formatExportGroupName?: (groupName: string, utils: CodegenDataUtils) => string;
|
|
56
|
-
/**
|
|
57
|
-
* Various generation output types
|
|
58
|
-
*
|
|
59
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#outputtype)
|
|
60
|
-
*
|
|
61
|
-
* `one-endpoint-per-file`
|
|
62
|
-
* @example
|
|
63
|
-
* ```
|
|
64
|
-
* outputdir
|
|
65
|
-
* groupname
|
|
66
|
-
* index.ts
|
|
67
|
-
* endpoints
|
|
68
|
-
* index.ts
|
|
69
|
-
* get-endpoint-1.ts
|
|
70
|
-
* get-endpoint-n.ts
|
|
71
|
-
* ```
|
|
72
|
-
* @example
|
|
73
|
-
* ```
|
|
74
|
-
* outputdir
|
|
75
|
-
* index.ts
|
|
76
|
-
* endpoints
|
|
77
|
-
* index.ts
|
|
78
|
-
* get-endpoint-1.ts
|
|
79
|
-
* get-endpoint-n.ts
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* `endpoints-per-file`
|
|
83
|
-
* @example
|
|
84
|
-
* ```
|
|
85
|
-
* outputdir
|
|
86
|
-
* groupname
|
|
87
|
-
* index.ts
|
|
88
|
-
* endpoints.ts
|
|
89
|
-
* ```
|
|
90
|
-
* @example
|
|
91
|
-
* ```
|
|
92
|
-
* outputdir
|
|
93
|
-
* index.ts
|
|
94
|
-
* endpoints.ts
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
outputType?: 'one-endpoint-per-file' | 'endpoints-per-file';
|
|
98
|
-
/**
|
|
99
|
-
* Group endpoints and collect it into object
|
|
100
|
-
*
|
|
101
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#groupby)
|
|
102
|
-
*/
|
|
103
|
-
groupBy?: ((endpoint: EndpointData) => string) | `path-segment` | `path-segment-${number}` | `tag` | `tag-${number}`;
|
|
104
|
-
/**
|
|
105
|
-
* Collect all exports into single namespace
|
|
106
|
-
*
|
|
107
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#namespace)
|
|
108
|
-
*/
|
|
109
|
-
namespace?: string | ((utils: AnyObject) => string);
|
|
110
|
-
/**
|
|
111
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#addpathsegmenttoroutename)
|
|
112
|
-
*/
|
|
113
|
-
addPathSegmentToRouteName?: boolean | number;
|
|
114
|
-
/**
|
|
115
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#queryclient)
|
|
116
|
-
*/
|
|
117
|
-
queryClient?: 'builtin' | ImportFileParams;
|
|
118
|
-
/**
|
|
119
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#endpoint)
|
|
120
|
-
*/
|
|
121
|
-
endpoint?: 'builtin' | ImportFileParams;
|
|
122
|
-
/**
|
|
123
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#httpclient)
|
|
124
|
-
*/
|
|
125
|
-
httpClient?: 'builtin' | ImportFileParams;
|
|
126
|
-
/**
|
|
127
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#getendpointmeta)
|
|
128
|
-
*/
|
|
129
|
-
getEndpointMeta?: (route: AnyObject, utils: AnyObject) => {
|
|
130
|
-
typeName?: string;
|
|
131
|
-
typeNameImportPath?: string;
|
|
132
|
-
tmplData: string;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#getrequestmeta)
|
|
136
|
-
*/
|
|
137
|
-
getRequestMeta?: (route: AnyObject, utils: AnyObject) => {
|
|
138
|
-
tmplData: string;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Additional parameters used to fetch your OpenAPI schema
|
|
142
|
-
*
|
|
143
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#fetchschemarequestoptions)
|
|
144
|
-
*/
|
|
145
|
-
fetchSchemaRequestOptions?: RequestInit;
|
|
146
|
-
otherCodegenParams?: AnyObject;
|
|
147
|
-
/**
|
|
148
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filterendpoints)
|
|
149
|
-
*/
|
|
150
|
-
filterEndpoints?: FilterEndpointsOption;
|
|
151
|
-
/**
|
|
152
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filtergroups)
|
|
153
|
-
*/
|
|
154
|
-
filterGroups?: FilterGroupsOption;
|
|
155
|
-
libImports?: {
|
|
156
|
-
'mobx-tanstack-query-api'?: string;
|
|
157
|
-
};
|
|
158
|
-
tsconfigPath?: string;
|
|
159
|
-
transforms?: {
|
|
160
|
-
groupEnumValue?: (group: string, namespace?: Maybe<string>) => string;
|
|
161
|
-
tagEnumValue?: (tag: string, namespace?: Maybe<string>) => string;
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
export type AllImportFileParams = Record<KeyOfByValue<Required<GenerateQueryApiParams>, 'builtin' | ImportFileParams>, ImportFileParams>;
|
|
1
|
+
import type { GenerateQueryApiParams } from "./types/index.js";
|
|
165
2
|
export declare const generateApi: (params: GenerateQueryApiParams | GenerateQueryApiParams[]) => Promise<void>;
|
|
166
|
-
export {};
|
|
167
3
|
//# sourceMappingURL=index.d.ts.map
|
package/codegen/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,yBAAyB;AAS1B,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CA8lBd,CAAC"}
|