openapi-ts-request 1.12.5 → 1.12.6
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/dist/util.js +9 -1
- package/package.json +1 -1
package/dist/util.js
CHANGED
|
@@ -254,7 +254,15 @@ function translateChineseModuleNodeToEnglish(openAPI) {
|
|
|
254
254
|
});
|
|
255
255
|
});
|
|
256
256
|
resolve(translateMap);
|
|
257
|
-
|
|
257
|
+
// 在写入前再次读取缓存,合并多个任务的翻译结果
|
|
258
|
+
const existingContent = readFileSafelySync(process.cwd() + '/openapi-ts-request.cache.json');
|
|
259
|
+
let existingCache = {};
|
|
260
|
+
if (existingContent !== null && isJSONString(existingContent)) {
|
|
261
|
+
existingCache = JSON.parse(existingContent);
|
|
262
|
+
}
|
|
263
|
+
// 合并现有缓存和新的翻译结果(新结果优先)
|
|
264
|
+
const mergedCache = Object.assign(Object.assign({}, existingCache), translateMap);
|
|
265
|
+
void writeFileAsync(process.cwd() + '/openapi-ts-request.cache.json', JSON.stringify(mergedCache, null, 2));
|
|
258
266
|
})
|
|
259
267
|
.catch(() => {
|
|
260
268
|
reject(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-request",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.6",
|
|
4
4
|
"description": "Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0",
|