openapi-ts-request 1.3.0 → 1.3.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.
- package/dist/type.d.ts +5 -5
- package/dist/util.js +6 -6
- package/package.json +1 -1
package/dist/type.d.ts
CHANGED
|
@@ -84,25 +84,25 @@ export type ReadConfigOptions = MutuallyExclusiveWithFallback<{
|
|
|
84
84
|
fallbackName: string;
|
|
85
85
|
};
|
|
86
86
|
export interface APIFoxBody {
|
|
87
|
-
scope
|
|
87
|
+
scope?: {
|
|
88
88
|
type?: 'ALL' | 'SELECTED_TAGS';
|
|
89
89
|
includeTags?: string[];
|
|
90
90
|
excludeTags?: string[];
|
|
91
91
|
};
|
|
92
92
|
options?: {
|
|
93
|
-
includeApifoxExtensionProperties
|
|
94
|
-
addFoldersToTags
|
|
93
|
+
includeApifoxExtensionProperties?: boolean;
|
|
94
|
+
addFoldersToTags?: boolean;
|
|
95
95
|
};
|
|
96
96
|
oasVersion?: '2.0' | '3.0' | '3.1';
|
|
97
97
|
exportFormat?: 'JSON' | 'YAML';
|
|
98
98
|
environmentIds?: string[];
|
|
99
99
|
}
|
|
100
|
-
export interface GetSchemaByApifoxProps {
|
|
100
|
+
export interface GetSchemaByApifoxProps extends Pick<APIFoxBody, 'oasVersion' | 'exportFormat'>, Pick<APIFoxBody['options'], 'includeApifoxExtensionProperties' | 'addFoldersToTags'> {
|
|
101
101
|
projectId: string;
|
|
102
|
+
apifoxToken: string;
|
|
102
103
|
locale?: string;
|
|
103
104
|
apifoxVersion?: string;
|
|
104
105
|
includeTags?: (string | RegExp)[];
|
|
105
106
|
excludeTags?: string[];
|
|
106
|
-
apifoxToken: string;
|
|
107
107
|
}
|
|
108
108
|
export {};
|
package/dist/util.js
CHANGED
|
@@ -60,18 +60,18 @@ const getApifoxIncludeTags = (tags) => {
|
|
|
60
60
|
* @param params.apifoxVersion {string} apifox 版本 目前固定为 2024-03-28 可通过 https://api.apifox.com/v1/versions 获取最新版本
|
|
61
61
|
* @returns
|
|
62
62
|
*/
|
|
63
|
-
const getSchemaByApifox = (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ projectId, locale = 'zh-CN', apifoxVersion = '2024-03-28', includeTags, excludeTags = [], apifoxToken, }) {
|
|
63
|
+
const getSchemaByApifox = (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ projectId, locale = 'zh-CN', apifoxVersion = '2024-03-28', includeTags, excludeTags = [], apifoxToken, oasVersion = '3.0', exportFormat = 'JSON', includeApifoxExtensionProperties = false, addFoldersToTags = false, }) {
|
|
64
64
|
try {
|
|
65
65
|
const body = {
|
|
66
66
|
scope: {
|
|
67
67
|
excludeTags,
|
|
68
68
|
},
|
|
69
69
|
options: {
|
|
70
|
-
includeApifoxExtensionProperties
|
|
71
|
-
addFoldersToTags
|
|
70
|
+
includeApifoxExtensionProperties,
|
|
71
|
+
addFoldersToTags,
|
|
72
72
|
},
|
|
73
|
-
oasVersion
|
|
74
|
-
exportFormat
|
|
73
|
+
oasVersion,
|
|
74
|
+
exportFormat,
|
|
75
75
|
};
|
|
76
76
|
const tags = getApifoxIncludeTags(includeTags);
|
|
77
77
|
if (tags === '*') {
|
|
@@ -81,7 +81,7 @@ const getSchemaByApifox = (_a) => tslib_1.__awaiter(void 0, [_a], void 0, functi
|
|
|
81
81
|
body.scope.type = 'SELECTED_TAGS';
|
|
82
82
|
body.scope.includeTags = tags;
|
|
83
83
|
}
|
|
84
|
-
const res = yield axios_1.default.post(`https://api.apifox.com/v1/projects/${projectId}/export-openapi?locale=${locale}`,
|
|
84
|
+
const res = yield axios_1.default.post(`https://api.apifox.com/v1/projects/${projectId}/export-openapi?locale=${locale}`, body, {
|
|
85
85
|
headers: {
|
|
86
86
|
'X-Apifox-Api-Version': apifoxVersion,
|
|
87
87
|
Authorization: `Bearer ${apifoxToken}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-request",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
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",
|