swgto-ts 3.0.0 → 3.0.1
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.
|
@@ -461,15 +461,13 @@ ${queryLine}${bodyLine} ...config,
|
|
|
461
461
|
}`;
|
|
462
462
|
}
|
|
463
463
|
function generateTsRequestFile(operation, httpClientPath, typeImportPath, mergeParams = false) {
|
|
464
|
-
const importTypes = [
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
"RequestConfig"
|
|
468
|
-
].filter((value, index, array) => Boolean(value) && array.indexOf(value) === index);
|
|
464
|
+
const importTypes = [...operation.requestImportTypes, operation.responseTypeName, "RequestConfig"].filter(
|
|
465
|
+
(value, index, array) => Boolean(value) && array.indexOf(value) === index
|
|
466
|
+
);
|
|
469
467
|
const importLine = importTypes.length ? `import type { ${importTypes.join(", ")} } from ${JSON.stringify(typeImportPath)};
|
|
470
468
|
` : "";
|
|
471
469
|
const buildUrlHelper = operation.pathParams.length ? `
|
|
472
|
-
function buildUrl(path?: Record<string,
|
|
470
|
+
function buildUrl(path?: Record<string, any>): string {
|
|
473
471
|
return ${JSON.stringify(operation.requestPath)}.replace(/\\{([^}]+)\\}/g, (_, key) => String(path?.[key] ?? ''));
|
|
474
472
|
}
|
|
475
473
|
` : "";
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED