mobx-tanstack-query-api 0.0.15 → 0.0.16
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 +3 -2
- package/codegen/index.d.ts.map +1 -1
- package/codegen/index.js +3 -1
- package/codegen/templates/new-request-info.tmpl.d.ts +3 -2
- package/codegen/templates/new-request-info.tmpl.d.ts.map +1 -1
- package/codegen/templates/new-request-info.tmpl.js +3 -4
- package/codegen/templates/request-info-per-file.tmpl.d.ts +3 -2
- package/codegen/templates/request-info-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/request-info-per-file.tmpl.js +2 -2
- package/package.json +1 -1
package/codegen/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AnyObject, KeyOfByValue } from 'yummies/utils/types';
|
|
|
3
3
|
export type CodegenProcess = Parameters<Exclude<Required<Extract<GenerateApiParamsFromSwagger, {
|
|
4
4
|
input: string;
|
|
5
5
|
}>['hooks']>, undefined>['onInit']>[1];
|
|
6
|
+
export type CodegenDataUtils = ReturnType<CodegenProcess['getRenderTemplateData']>['utils'];
|
|
6
7
|
export interface ImportFileParams {
|
|
7
8
|
path: string;
|
|
8
9
|
exportName: string;
|
|
@@ -16,12 +17,12 @@ export interface QueryApiParams {
|
|
|
16
17
|
queryClient: 'builtin' | ImportFileParams;
|
|
17
18
|
endpoint: 'builtin' | ImportFileParams;
|
|
18
19
|
httpClient: 'builtin' | ImportFileParams;
|
|
19
|
-
getEndpointMeta?: (route: ParsedRoute) => {
|
|
20
|
+
getEndpointMeta?: (route: ParsedRoute, utils: CodegenDataUtils) => {
|
|
20
21
|
typeName: string;
|
|
21
22
|
importTypePath: string;
|
|
22
23
|
tmplData: string;
|
|
23
24
|
};
|
|
24
|
-
getRequestMeta?: (route: ParsedRoute) => {
|
|
25
|
+
getRequestMeta?: (route: ParsedRoute, utils: CodegenDataUtils) => {
|
|
25
26
|
tmplData: string;
|
|
26
27
|
};
|
|
27
28
|
}
|
package/codegen/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,IAAI,4BAA4B,EACjD,WAAW,EAEZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAa9D,MAAM,MAAM,cAAc,GAAG,UAAU,CACrC,OAAO,CACL,QAAQ,CAAC,OAAO,CAAC,4BAA4B,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAC3E,SAAS,CACV,CAAC,QAAQ,CAAC,CACZ,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,uBAAuB,CAAC;IACpC,yBAAyB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAE7C,WAAW,EAAE,SAAS,GAAG,gBAAgB,CAAC;IAE1C,QAAQ,EAAE,SAAS,GAAG,gBAAgB,CAAC;IAEvC,UAAU,EAAE,SAAS,GAAG,gBAAgB,CAAC;IAEzC,eAAe,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,IAAI,4BAA4B,EACjD,WAAW,EAEZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAa9D,MAAM,MAAM,cAAc,GAA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,IAAI,CAC3B,4BAA4B,EAC5B,QAAQ,GAAG,oBAAoB,GAAG,iBAAiB,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAC/E,GAAG;IACF,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,GAAG,cAAc,CAAC;AAEnB,eAAO,MAAM,WAAW,gBAAuB,iBAAiB,kBAgO/D,CAAC"}
|
package/codegen/index.js
CHANGED
|
@@ -102,7 +102,8 @@ export const generateApi = async (inputParams) => {
|
|
|
102
102
|
},
|
|
103
103
|
},
|
|
104
104
|
});
|
|
105
|
-
const
|
|
105
|
+
const utils = codegenProcess.getRenderTemplateData().utils;
|
|
106
|
+
const { _ } = utils;
|
|
106
107
|
const codegenFs = codegenProcess.fileSystem;
|
|
107
108
|
codegenFs.cleanDir(output);
|
|
108
109
|
codegenFs.createDir(output);
|
|
@@ -119,6 +120,7 @@ export const generateApi = async (inputParams) => {
|
|
|
119
120
|
apiParams: inputParams,
|
|
120
121
|
codegenProcess,
|
|
121
122
|
importFileParams,
|
|
123
|
+
utils,
|
|
122
124
|
});
|
|
123
125
|
reservedDataContractNames.forEach((name) => {
|
|
124
126
|
reservedDataContractNamesMap.set(name, (reservedDataContractNamesMap.get(name) ?? 0) + 1);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { GenerateApiConfiguration, ParsedRoute } from 'swagger-typescript-api';
|
|
2
|
-
import type { AllImportFileParams, QueryApiParams } from '../index.js';
|
|
2
|
+
import type { AllImportFileParams, CodegenDataUtils, QueryApiParams } from '../index.js';
|
|
3
3
|
export interface NewRequestInfoTmplParams {
|
|
4
4
|
route: ParsedRoute;
|
|
5
5
|
configuration: GenerateApiConfiguration;
|
|
6
6
|
apiParams: QueryApiParams;
|
|
7
7
|
importFileParams: AllImportFileParams;
|
|
8
|
+
utils: CodegenDataUtils;
|
|
8
9
|
}
|
|
9
|
-
export declare const newRequestInfoTmpl: ({ route,
|
|
10
|
+
export declare const newRequestInfoTmpl: ({ route, apiParams, importFileParams, utils, }: NewRequestInfoTmplParams) => {
|
|
10
11
|
reservedDataContractNames: string[];
|
|
11
12
|
content: string;
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-request-info.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-request-info.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG/E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"new-request-info.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-request-info.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG/E,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,WAAW,CAAC;IACnB,aAAa,EAAE,wBAAwB,CAAC;IACxC,SAAS,EAAE,cAAc,CAAC;IAC1B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAiBD,eAAO,MAAM,kBAAkB,mDAK5B,wBAAwB;;;CAyN1B,CAAC"}
|
|
@@ -12,8 +12,7 @@ const responseContentKind = {
|
|
|
12
12
|
FORM_DATA: '"formData"',
|
|
13
13
|
BYTES: '"bytes"',
|
|
14
14
|
};
|
|
15
|
-
export const newRequestInfoTmpl = ({ route,
|
|
16
|
-
const { utils } = configuration;
|
|
15
|
+
export const newRequestInfoTmpl = ({ route, apiParams, importFileParams, utils, }) => {
|
|
17
16
|
const { _ } = utils;
|
|
18
17
|
const positiveResponseTypes = route.raw.responsesTypes?.filter((it) => +it.status >= 200 && +it.status < 300);
|
|
19
18
|
const { requestBodyInfo, responseBodyInfo } = route;
|
|
@@ -115,8 +114,8 @@ export const newRequestInfoTmpl = ({ route, configuration, apiParams, importFile
|
|
|
115
114
|
})
|
|
116
115
|
.join(', ')}
|
|
117
116
|
]`;
|
|
118
|
-
const requestInfoMeta = apiParams.getEndpointMeta?.(route);
|
|
119
|
-
const requestMeta = apiParams.getRequestMeta?.(route);
|
|
117
|
+
const requestInfoMeta = apiParams.getEndpointMeta?.(route, utils);
|
|
118
|
+
const requestMeta = apiParams.getRequestMeta?.(route, utils);
|
|
120
119
|
const resultPath = (apiParams.requestPathPrefix ?? '') +
|
|
121
120
|
path +
|
|
122
121
|
(apiParams.requestPathSuffix ?? '');
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ParsedRoute, GenerateApiConfiguration, GenerateApiOutput } from 'swagger-typescript-api';
|
|
2
|
-
import type { AllImportFileParams, CodegenProcess, QueryApiParams } from '../index.js';
|
|
2
|
+
import type { AllImportFileParams, CodegenDataUtils, CodegenProcess, QueryApiParams } from '../index.js';
|
|
3
3
|
export interface RequestInfoPerFileTmplParams extends GenerateApiOutput {
|
|
4
4
|
route: ParsedRoute;
|
|
5
5
|
configuration: GenerateApiConfiguration;
|
|
6
6
|
apiParams: QueryApiParams;
|
|
7
7
|
codegenProcess: CodegenProcess;
|
|
8
8
|
importFileParams: AllImportFileParams;
|
|
9
|
+
utils: CodegenDataUtils;
|
|
9
10
|
}
|
|
10
|
-
export declare const requestInfoPerFileTmpl: ({ route, configuration, apiParams, formatTSContent, importFileParams, }: RequestInfoPerFileTmplParams) => Promise<{
|
|
11
|
+
export declare const requestInfoPerFileTmpl: ({ route, configuration, apiParams, formatTSContent, importFileParams, utils, }: RequestInfoPerFileTmplParams) => Promise<{
|
|
11
12
|
reservedDataContractNames: string[];
|
|
12
13
|
content: string;
|
|
13
14
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-info-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/request-info-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAMrB,MAAM,WAAW,4BAA6B,SAAQ,iBAAiB;IACrE,KAAK,EAAE,WAAW,CAAC;IACnB,aAAa,EAAE,wBAAwB,CAAC;IACxC,SAAS,EAAE,cAAc,CAAC;IAC1B,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"request-info-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/request-info-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAMrB,MAAM,WAAW,4BAA6B,SAAQ,iBAAiB;IACrE,KAAK,EAAE,WAAW,CAAC;IACnB,aAAa,EAAE,wBAAwB,CAAC;IACxC,SAAS,EAAE,cAAc,CAAC;IAC1B,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,sBAAsB,mFAOhC,4BAA4B;;;EA8E9B,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { dataContractTmpl } from './data-contract.tmpl.js';
|
|
2
2
|
import { newRequestInfoTmpl } from './new-request-info.tmpl.js';
|
|
3
3
|
import { requestInfoJSDocTmpl } from './request-info-jsdoc.tmpl.js';
|
|
4
|
-
export const requestInfoPerFileTmpl = async ({ route, configuration, apiParams, formatTSContent, importFileParams, }) => {
|
|
5
|
-
const { utils } = configuration;
|
|
4
|
+
export const requestInfoPerFileTmpl = async ({ route, configuration, apiParams, formatTSContent, importFileParams, utils, }) => {
|
|
6
5
|
const { _ } = utils;
|
|
7
6
|
const { content: requestInfoInstanceContent, reservedDataContractNames } = newRequestInfoTmpl({
|
|
8
7
|
route,
|
|
9
8
|
configuration,
|
|
10
9
|
apiParams,
|
|
11
10
|
importFileParams,
|
|
11
|
+
utils,
|
|
12
12
|
});
|
|
13
13
|
const dataContactNames = new Set(Object.keys(configuration.config.swaggerSchema?.components?.schemas).map((schemaName) => utils.formatModelName(schemaName)));
|
|
14
14
|
const dataContractNamesInThisFile = [];
|