@fecommunity/reactpress-toolkit 1.0.0-beta.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/LICENSE +21 -0
- package/demos/simple.ts +65 -0
- package/dist/api/Admin.d.ts +14 -0
- package/dist/api/Admin.js +32 -0
- package/dist/api/All.d.ts +14 -0
- package/dist/api/All.js +32 -0
- package/dist/api/Archives.d.ts +14 -0
- package/dist/api/Archives.js +32 -0
- package/dist/api/Article.d.ts +108 -0
- package/dist/api/Article.js +177 -0
- package/dist/api/Auth.d.ts +27 -0
- package/dist/api/Auth.js +56 -0
- package/dist/api/Book.d.ts +15 -0
- package/dist/api/Book.js +33 -0
- package/dist/api/Category.d.ts +44 -0
- package/dist/api/Category.js +81 -0
- package/dist/api/Chapter.d.ts +15 -0
- package/dist/api/Chapter.js +33 -0
- package/dist/api/Comment.d.ts +52 -0
- package/dist/api/Comment.js +93 -0
- package/dist/api/File.d.ts +36 -0
- package/dist/api/File.js +69 -0
- package/dist/api/Get.d.ts +14 -0
- package/dist/api/Get.js +32 -0
- package/dist/api/Github.d.ts +14 -0
- package/dist/api/Github.js +32 -0
- package/dist/api/Host.d.ts +14 -0
- package/dist/api/Host.js +32 -0
- package/dist/api/Id.d.ts +284 -0
- package/dist/api/Id.js +422 -0
- package/dist/api/Knowledge.d.ts +68 -0
- package/dist/api/Knowledge.js +118 -0
- package/dist/api/Login.d.ts +14 -0
- package/dist/api/Login.js +32 -0
- package/dist/api/Page.d.ts +52 -0
- package/dist/api/Page.js +93 -0
- package/dist/api/Password.d.ts +15 -0
- package/dist/api/Password.js +33 -0
- package/dist/api/Recommend.d.ts +14 -0
- package/dist/api/Recommend.js +32 -0
- package/dist/api/Register.d.ts +15 -0
- package/dist/api/Register.js +33 -0
- package/dist/api/Search.d.ts +27 -0
- package/dist/api/Search.js +56 -0
- package/dist/api/Setting.d.ts +20 -0
- package/dist/api/Setting.js +45 -0
- package/dist/api/Smtp.d.ts +28 -0
- package/dist/api/Smtp.js +57 -0
- package/dist/api/Tag.d.ts +52 -0
- package/dist/api/Tag.js +93 -0
- package/dist/api/Update.d.ts +15 -0
- package/dist/api/Update.js +33 -0
- package/dist/api/Upload.d.ts +15 -0
- package/dist/api/Upload.js +33 -0
- package/dist/api/Url.d.ts +14 -0
- package/dist/api/Url.js +32 -0
- package/dist/api/User.d.ts +36 -0
- package/dist/api/User.js +72 -0
- package/dist/api/View.d.ts +44 -0
- package/dist/api/View.js +81 -0
- package/dist/api/api-instance.d.ts +39 -0
- package/dist/api/api-instance.js +46 -0
- package/dist/api/http-client.d.ts +41 -0
- package/dist/api/http-client.js +94 -0
- package/dist/api/httpClient.d.ts +41 -0
- package/dist/api/httpClient.js +94 -0
- package/dist/api/index.d.ts +18 -0
- package/dist/api/index.js +43 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +46 -0
- package/dist/types/data-contracts.d.ts +177 -0
- package/dist/types/data-contracts.js +12 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +19 -0
- package/dist/utils/common.d.ts +23 -0
- package/dist/utils/common.js +78 -0
- package/dist/utils/http.d.ts +3 -0
- package/dist/utils/http.js +47 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +20 -0
- package/package.json +19 -0
- package/scripts/generate-api-types.js +571 -0
- package/scripts/generate-swagger.js +47 -0
- package/scripts/organize-api.js +136 -0
- package/src/api/Article.ts +186 -0
- package/src/api/Auth.ts +54 -0
- package/src/api/Category.ts +82 -0
- package/src/api/Comment.ts +95 -0
- package/src/api/File.ts +69 -0
- package/src/api/Knowledge.ts +122 -0
- package/src/api/Page.ts +95 -0
- package/src/api/Search.ts +54 -0
- package/src/api/Setting.ts +43 -0
- package/src/api/Smtp.ts +56 -0
- package/src/api/Tag.ts +95 -0
- package/src/api/User.ts +72 -0
- package/src/api/View.ts +82 -0
- package/src/api/api-instance.ts +69 -0
- package/src/api/httpClient.ts +140 -0
- package/src/api/index.ts +25 -0
- package/src/index.ts +18 -0
- package/src/types/data-contracts.ts +198 -0
- package/src/types/index.ts +4 -0
- package/src/utils/common.ts +108 -0
- package/src/utils/http.ts +52 -0
- package/src/utils/index.ts +5 -0
- package/test-final.js +56 -0
- package/test-import.js +34 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// API 实例化文件
|
|
3
|
+
// 自动生成,请勿手动修改
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.api = exports.createApiInstance = void 0;
|
|
6
|
+
const httpClient_1 = require("./httpClient");
|
|
7
|
+
const Article_1 = require("./Article");
|
|
8
|
+
const Auth_1 = require("./Auth");
|
|
9
|
+
const Category_1 = require("./Category");
|
|
10
|
+
const Comment_1 = require("./Comment");
|
|
11
|
+
const File_1 = require("./File");
|
|
12
|
+
const Knowledge_1 = require("./Knowledge");
|
|
13
|
+
const Page_1 = require("./Page");
|
|
14
|
+
const Search_1 = require("./Search");
|
|
15
|
+
const Setting_1 = require("./Setting");
|
|
16
|
+
const Smtp_1 = require("./Smtp");
|
|
17
|
+
const Tag_1 = require("./Tag");
|
|
18
|
+
const User_1 = require("./User");
|
|
19
|
+
const View_1 = require("./View");
|
|
20
|
+
/**
|
|
21
|
+
* 创建 API 实例
|
|
22
|
+
* @param config API 配置
|
|
23
|
+
* @returns API 实例对象
|
|
24
|
+
*/
|
|
25
|
+
function createApiInstance(config = {}) {
|
|
26
|
+
const httpClient = new httpClient_1.HttpClient(config);
|
|
27
|
+
return {
|
|
28
|
+
article: new Article_1.Article(config),
|
|
29
|
+
auth: new Auth_1.Auth(config),
|
|
30
|
+
category: new Category_1.Category(config),
|
|
31
|
+
comment: new Comment_1.Comment(config),
|
|
32
|
+
file: new File_1.File(config),
|
|
33
|
+
knowledge: new Knowledge_1.Knowledge(config),
|
|
34
|
+
page: new Page_1.Page(config),
|
|
35
|
+
search: new Search_1.Search(config),
|
|
36
|
+
setting: new Setting_1.Setting(config),
|
|
37
|
+
smtp: new Smtp_1.Smtp(config),
|
|
38
|
+
tag: new Tag_1.Tag(config),
|
|
39
|
+
user: new User_1.User(config),
|
|
40
|
+
view: new View_1.View(config),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.createApiInstance = createApiInstance;
|
|
44
|
+
// 默认 API 实例
|
|
45
|
+
exports.api = createApiInstance();
|
|
46
|
+
exports.default = exports.api;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from 'axios';
|
|
2
|
+
export declare type QueryParamsType = Record<string | number, any>;
|
|
3
|
+
export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'params' | 'url' | 'responseType'> {
|
|
4
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
5
|
+
secure?: boolean;
|
|
6
|
+
/** request path */
|
|
7
|
+
path: string;
|
|
8
|
+
/** content type of request body */
|
|
9
|
+
type?: ContentType;
|
|
10
|
+
/** query params */
|
|
11
|
+
query?: QueryParamsType;
|
|
12
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
13
|
+
format?: ResponseType;
|
|
14
|
+
/** request body */
|
|
15
|
+
body?: unknown;
|
|
16
|
+
}
|
|
17
|
+
export declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
18
|
+
export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, 'data' | 'cancelToken'> {
|
|
19
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
|
|
20
|
+
secure?: boolean;
|
|
21
|
+
format?: ResponseType;
|
|
22
|
+
}
|
|
23
|
+
export declare enum ContentType {
|
|
24
|
+
Json = "application/json",
|
|
25
|
+
FormData = "multipart/form-data",
|
|
26
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
27
|
+
Text = "text/plain"
|
|
28
|
+
}
|
|
29
|
+
export declare class HttpClient<SecurityDataType = unknown> {
|
|
30
|
+
instance: AxiosInstance;
|
|
31
|
+
private securityData;
|
|
32
|
+
private securityWorker?;
|
|
33
|
+
private secure?;
|
|
34
|
+
private format?;
|
|
35
|
+
constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig<SecurityDataType>);
|
|
36
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
37
|
+
protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
|
|
38
|
+
protected stringifyFormItem(formItem: unknown): string;
|
|
39
|
+
protected createFormData(input: Record<string, unknown>): FormData;
|
|
40
|
+
request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<AxiosResponse<T, any, {}>>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.HttpClient = exports.ContentType = void 0;
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
var ContentType;
|
|
19
|
+
(function (ContentType) {
|
|
20
|
+
ContentType["Json"] = "application/json";
|
|
21
|
+
ContentType["FormData"] = "multipart/form-data";
|
|
22
|
+
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
23
|
+
ContentType["Text"] = "text/plain";
|
|
24
|
+
})(ContentType = exports.ContentType || (exports.ContentType = {}));
|
|
25
|
+
class HttpClient {
|
|
26
|
+
constructor({ securityWorker, secure, format, ...axiosConfig } = {}) {
|
|
27
|
+
this.securityData = null;
|
|
28
|
+
this.setSecurityData = (data) => {
|
|
29
|
+
this.securityData = data;
|
|
30
|
+
};
|
|
31
|
+
this.request = async ({ secure, path, type, query, format, body, ...params }) => {
|
|
32
|
+
const secureParams = ((typeof secure === 'boolean' ? secure : this.secure) &&
|
|
33
|
+
this.securityWorker &&
|
|
34
|
+
(await this.securityWorker(this.securityData))) ||
|
|
35
|
+
{};
|
|
36
|
+
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
37
|
+
const responseFormat = format || this.format || undefined;
|
|
38
|
+
if (type === ContentType.FormData && body && body !== null && typeof body === 'object') {
|
|
39
|
+
body = this.createFormData(body);
|
|
40
|
+
}
|
|
41
|
+
if (type === ContentType.Text && body && body !== null && typeof body !== 'string') {
|
|
42
|
+
body = JSON.stringify(body);
|
|
43
|
+
}
|
|
44
|
+
return this.instance.request({
|
|
45
|
+
...requestParams,
|
|
46
|
+
headers: {
|
|
47
|
+
...(requestParams.headers || {}),
|
|
48
|
+
...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {}),
|
|
49
|
+
},
|
|
50
|
+
params: query,
|
|
51
|
+
responseType: responseFormat,
|
|
52
|
+
data: body,
|
|
53
|
+
url: path,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
this.instance = axios_1.default.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || 'http://localhost:3002' });
|
|
57
|
+
this.secure = secure;
|
|
58
|
+
this.format = format;
|
|
59
|
+
this.securityWorker = securityWorker;
|
|
60
|
+
}
|
|
61
|
+
mergeRequestParams(params1, params2) {
|
|
62
|
+
const method = params1.method || (params2 && params2.method);
|
|
63
|
+
return {
|
|
64
|
+
...this.instance.defaults,
|
|
65
|
+
...params1,
|
|
66
|
+
...(params2 || {}),
|
|
67
|
+
headers: {
|
|
68
|
+
...((method && this.instance.defaults.headers[method.toLowerCase()]) || {}),
|
|
69
|
+
...(params1.headers || {}),
|
|
70
|
+
...((params2 && params2.headers) || {}),
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
stringifyFormItem(formItem) {
|
|
75
|
+
if (typeof formItem === 'object' && formItem !== null) {
|
|
76
|
+
return JSON.stringify(formItem);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return `${formItem}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
createFormData(input) {
|
|
83
|
+
return Object.keys(input || {}).reduce((formData, key) => {
|
|
84
|
+
const property = input[key];
|
|
85
|
+
const propertyContent = property instanceof Array ? property : [property];
|
|
86
|
+
for (const formItem of propertyContent) {
|
|
87
|
+
const isFileType = formItem instanceof Blob || formItem instanceof File;
|
|
88
|
+
formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
|
|
89
|
+
}
|
|
90
|
+
return formData;
|
|
91
|
+
}, new FormData());
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.HttpClient = HttpClient;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from 'axios';
|
|
2
|
+
export declare type QueryParamsType = Record<string | number, any>;
|
|
3
|
+
export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'params' | 'url' | 'responseType'> {
|
|
4
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
5
|
+
secure?: boolean;
|
|
6
|
+
/** request path */
|
|
7
|
+
path: string;
|
|
8
|
+
/** content type of request body */
|
|
9
|
+
type?: ContentType;
|
|
10
|
+
/** query params */
|
|
11
|
+
query?: QueryParamsType;
|
|
12
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
13
|
+
format?: ResponseType;
|
|
14
|
+
/** request body */
|
|
15
|
+
body?: unknown;
|
|
16
|
+
}
|
|
17
|
+
export declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
|
|
18
|
+
export interface HttpClientConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, 'data' | 'cancelToken'> {
|
|
19
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
|
|
20
|
+
secure?: boolean;
|
|
21
|
+
format?: ResponseType;
|
|
22
|
+
}
|
|
23
|
+
export declare enum ContentType {
|
|
24
|
+
Json = "application/json",
|
|
25
|
+
FormData = "multipart/form-data",
|
|
26
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
27
|
+
Text = "text/plain"
|
|
28
|
+
}
|
|
29
|
+
export declare class HttpClient<SecurityDataType = unknown> {
|
|
30
|
+
instance: AxiosInstance;
|
|
31
|
+
private securityData;
|
|
32
|
+
securityWorker?: HttpClientConfig<SecurityDataType>['securityWorker'];
|
|
33
|
+
private secure?;
|
|
34
|
+
private format?;
|
|
35
|
+
constructor({ securityWorker, secure, format, ...axiosConfig }?: HttpClientConfig<SecurityDataType>);
|
|
36
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
37
|
+
protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
|
|
38
|
+
protected stringifyFormItem(formItem: unknown): string;
|
|
39
|
+
protected createFormData(input: Record<string, unknown>): FormData;
|
|
40
|
+
request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<AxiosResponse<T, any, {}>>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.HttpClient = exports.ContentType = void 0;
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
var ContentType;
|
|
19
|
+
(function (ContentType) {
|
|
20
|
+
ContentType["Json"] = "application/json";
|
|
21
|
+
ContentType["FormData"] = "multipart/form-data";
|
|
22
|
+
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
23
|
+
ContentType["Text"] = "text/plain";
|
|
24
|
+
})(ContentType = exports.ContentType || (exports.ContentType = {}));
|
|
25
|
+
class HttpClient {
|
|
26
|
+
constructor({ securityWorker, secure, format, ...axiosConfig } = {}) {
|
|
27
|
+
this.securityData = null;
|
|
28
|
+
this.setSecurityData = (data) => {
|
|
29
|
+
this.securityData = data;
|
|
30
|
+
};
|
|
31
|
+
this.request = async ({ secure, path, type, query, format, body, ...params }) => {
|
|
32
|
+
const secureParams = ((typeof secure === 'boolean' ? secure : this.secure) &&
|
|
33
|
+
this.securityWorker &&
|
|
34
|
+
(await this.securityWorker(this.securityData))) ||
|
|
35
|
+
{};
|
|
36
|
+
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
37
|
+
const responseFormat = format || this.format || undefined;
|
|
38
|
+
if (type === ContentType.FormData && body && body !== null && typeof body === 'object') {
|
|
39
|
+
body = this.createFormData(body);
|
|
40
|
+
}
|
|
41
|
+
if (type === ContentType.Text && body && body !== null && typeof body !== 'string') {
|
|
42
|
+
body = JSON.stringify(body);
|
|
43
|
+
}
|
|
44
|
+
return this.instance.request({
|
|
45
|
+
...requestParams,
|
|
46
|
+
headers: {
|
|
47
|
+
...(requestParams.headers || {}),
|
|
48
|
+
...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {}),
|
|
49
|
+
},
|
|
50
|
+
params: query,
|
|
51
|
+
responseType: responseFormat,
|
|
52
|
+
data: body,
|
|
53
|
+
url: path,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
this.instance = axios_1.default.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || 'http://localhost:3002' });
|
|
57
|
+
this.secure = secure;
|
|
58
|
+
this.format = format;
|
|
59
|
+
this.securityWorker = securityWorker;
|
|
60
|
+
}
|
|
61
|
+
mergeRequestParams(params1, params2) {
|
|
62
|
+
const method = params1.method || (params2 && params2.method);
|
|
63
|
+
return {
|
|
64
|
+
...this.instance.defaults,
|
|
65
|
+
...params1,
|
|
66
|
+
...(params2 || {}),
|
|
67
|
+
headers: {
|
|
68
|
+
...((method && this.instance.defaults.headers[method.toLowerCase()]) || {}),
|
|
69
|
+
...(params1.headers || {}),
|
|
70
|
+
...((params2 && params2.headers) || {}),
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
stringifyFormItem(formItem) {
|
|
75
|
+
if (typeof formItem === 'object' && formItem !== null) {
|
|
76
|
+
return JSON.stringify(formItem);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return `${formItem}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
createFormData(input) {
|
|
83
|
+
return Object.keys(input || {}).reduce((formData, key) => {
|
|
84
|
+
const property = input[key];
|
|
85
|
+
const propertyContent = property instanceof Array ? property : [property];
|
|
86
|
+
for (const formItem of propertyContent) {
|
|
87
|
+
const isFileType = formItem instanceof Blob || formItem instanceof File;
|
|
88
|
+
formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
|
|
89
|
+
}
|
|
90
|
+
return formData;
|
|
91
|
+
}, new FormData());
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.HttpClient = HttpClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './Article';
|
|
2
|
+
export * from './Auth';
|
|
3
|
+
export * from './Category';
|
|
4
|
+
export * from './Comment';
|
|
5
|
+
export * from './File';
|
|
6
|
+
export * from './Knowledge';
|
|
7
|
+
export * from './Page';
|
|
8
|
+
export * from './Search';
|
|
9
|
+
export * from './Setting';
|
|
10
|
+
export * from './Smtp';
|
|
11
|
+
export * from './Tag';
|
|
12
|
+
export * from './User';
|
|
13
|
+
export * from './View';
|
|
14
|
+
export * from './httpClient';
|
|
15
|
+
export { HttpClient } from './httpClient';
|
|
16
|
+
export type { HttpClientConfig } from './httpClient';
|
|
17
|
+
export * from './api-instance';
|
|
18
|
+
export { default as api } from './api-instance';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// API 客户端索引
|
|
3
|
+
// 自动生成,请勿手动修改
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.api = exports.HttpClient = void 0;
|
|
23
|
+
__exportStar(require("./Article"), exports);
|
|
24
|
+
__exportStar(require("./Auth"), exports);
|
|
25
|
+
__exportStar(require("./Category"), exports);
|
|
26
|
+
__exportStar(require("./Comment"), exports);
|
|
27
|
+
__exportStar(require("./File"), exports);
|
|
28
|
+
__exportStar(require("./Knowledge"), exports);
|
|
29
|
+
__exportStar(require("./Page"), exports);
|
|
30
|
+
__exportStar(require("./Search"), exports);
|
|
31
|
+
__exportStar(require("./Setting"), exports);
|
|
32
|
+
__exportStar(require("./Smtp"), exports);
|
|
33
|
+
__exportStar(require("./Tag"), exports);
|
|
34
|
+
__exportStar(require("./User"), exports);
|
|
35
|
+
__exportStar(require("./View"), exports);
|
|
36
|
+
__exportStar(require("./httpClient"), exports);
|
|
37
|
+
// 导出HttpClient类而不是默认导出
|
|
38
|
+
var httpClient_1 = require("./httpClient");
|
|
39
|
+
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return httpClient_1.HttpClient; } });
|
|
40
|
+
// API 实例化
|
|
41
|
+
__exportStar(require("./api-instance"), exports);
|
|
42
|
+
var api_instance_1 = require("./api-instance");
|
|
43
|
+
Object.defineProperty(exports, "api", { enumerable: true, get: function () { return __importDefault(api_instance_1).default; } });
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as api from './api';
|
|
2
|
+
import * as types from './types';
|
|
3
|
+
import * as utils from './utils';
|
|
4
|
+
import apiInstance from './api/api-instance';
|
|
5
|
+
export { api, types, utils };
|
|
6
|
+
export { apiInstance as default };
|
|
7
|
+
export * from './api';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export * from './utils';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Auto-generated API client
|
|
3
|
+
// Generated from Swagger/OpenAPI specification
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.default = exports.utils = exports.types = exports.api = void 0;
|
|
35
|
+
const api = __importStar(require("./api"));
|
|
36
|
+
exports.api = api;
|
|
37
|
+
const types = __importStar(require("./types"));
|
|
38
|
+
exports.types = types;
|
|
39
|
+
const utils = __importStar(require("./utils"));
|
|
40
|
+
exports.utils = utils;
|
|
41
|
+
const api_instance_1 = __importDefault(require("./api/api-instance"));
|
|
42
|
+
exports.default = api_instance_1.default;
|
|
43
|
+
// Also export individual items for backward compatibility
|
|
44
|
+
__exportStar(require("./api"), exports);
|
|
45
|
+
__exportStar(require("./types"), exports);
|
|
46
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
export interface IUser {
|
|
2
|
+
name: string;
|
|
3
|
+
password: string;
|
|
4
|
+
avatar: string;
|
|
5
|
+
email: string;
|
|
6
|
+
role: string;
|
|
7
|
+
status: string;
|
|
8
|
+
type: string;
|
|
9
|
+
/** @format date-time */
|
|
10
|
+
createAt: string;
|
|
11
|
+
/** @format date-time */
|
|
12
|
+
updateAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ISetting {
|
|
15
|
+
id: string;
|
|
16
|
+
i18n: string;
|
|
17
|
+
globalSetting: string;
|
|
18
|
+
systemUrl: string;
|
|
19
|
+
systemTitle: string;
|
|
20
|
+
systemSubTitle: string;
|
|
21
|
+
systemLogo: string;
|
|
22
|
+
systemBg: string;
|
|
23
|
+
systemFavicon: string;
|
|
24
|
+
systemNoticeInfo: string;
|
|
25
|
+
systemFooterInfo: string;
|
|
26
|
+
adminSystemUrl: string;
|
|
27
|
+
baiduAnalyticsId: string;
|
|
28
|
+
googleAnalyticsId: string;
|
|
29
|
+
seoKeyword: string;
|
|
30
|
+
seoDesc: string;
|
|
31
|
+
oss: string;
|
|
32
|
+
smtpHost: string;
|
|
33
|
+
smtpPort: string;
|
|
34
|
+
smtpUser: string;
|
|
35
|
+
smtpPass: string;
|
|
36
|
+
smtpFromUser: string;
|
|
37
|
+
/** @format date-time */
|
|
38
|
+
createAt: string;
|
|
39
|
+
/** @format date-time */
|
|
40
|
+
updateAt: string;
|
|
41
|
+
}
|
|
42
|
+
export interface I_SMTP {
|
|
43
|
+
id: string;
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
subject: string;
|
|
47
|
+
text: string;
|
|
48
|
+
html: string;
|
|
49
|
+
/** @format date-time */
|
|
50
|
+
createAt: string;
|
|
51
|
+
}
|
|
52
|
+
export interface IFile {
|
|
53
|
+
id: string;
|
|
54
|
+
originalname: string;
|
|
55
|
+
filename: string;
|
|
56
|
+
type: string;
|
|
57
|
+
size: number;
|
|
58
|
+
url: string;
|
|
59
|
+
/** @format date-time */
|
|
60
|
+
createAt: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ITag {
|
|
63
|
+
label: string;
|
|
64
|
+
value: string;
|
|
65
|
+
articles: string[];
|
|
66
|
+
/** @format date-time */
|
|
67
|
+
createAt: string;
|
|
68
|
+
/** @format date-time */
|
|
69
|
+
updateAt: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ICategory {
|
|
72
|
+
id: string;
|
|
73
|
+
label: string;
|
|
74
|
+
value: string;
|
|
75
|
+
articles: string[];
|
|
76
|
+
/** @format date-time */
|
|
77
|
+
createAt: string;
|
|
78
|
+
/** @format date-time */
|
|
79
|
+
updateAt: string;
|
|
80
|
+
}
|
|
81
|
+
export interface IArticle {
|
|
82
|
+
id: string;
|
|
83
|
+
title: string;
|
|
84
|
+
cover: string;
|
|
85
|
+
summary: string;
|
|
86
|
+
content: string;
|
|
87
|
+
html: string;
|
|
88
|
+
toc: string;
|
|
89
|
+
category: ICategory;
|
|
90
|
+
tags: string[];
|
|
91
|
+
status: string;
|
|
92
|
+
views: number;
|
|
93
|
+
likes: number;
|
|
94
|
+
isRecommended: boolean;
|
|
95
|
+
password: string;
|
|
96
|
+
needPassword: boolean;
|
|
97
|
+
isCommentable: boolean;
|
|
98
|
+
/** @format date-time */
|
|
99
|
+
publishAt: string;
|
|
100
|
+
/** @format date-time */
|
|
101
|
+
createAt: string;
|
|
102
|
+
/** @format date-time */
|
|
103
|
+
updateAt: string;
|
|
104
|
+
}
|
|
105
|
+
export interface IKnowledge {
|
|
106
|
+
id: string;
|
|
107
|
+
parentId: string;
|
|
108
|
+
order: number;
|
|
109
|
+
title: string;
|
|
110
|
+
cover: string;
|
|
111
|
+
summary: string;
|
|
112
|
+
content: string;
|
|
113
|
+
html: string;
|
|
114
|
+
toc: string;
|
|
115
|
+
status: string;
|
|
116
|
+
views: number;
|
|
117
|
+
likes: number;
|
|
118
|
+
isCommentable: boolean;
|
|
119
|
+
/** @format date-time */
|
|
120
|
+
publishAt: string;
|
|
121
|
+
/** @format date-time */
|
|
122
|
+
createAt: string;
|
|
123
|
+
/** @format date-time */
|
|
124
|
+
updateAt: string;
|
|
125
|
+
}
|
|
126
|
+
export interface IComment {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
email: string;
|
|
130
|
+
avatar: string;
|
|
131
|
+
content: string;
|
|
132
|
+
html: string;
|
|
133
|
+
pass: boolean;
|
|
134
|
+
userAgent: string;
|
|
135
|
+
hostId: string;
|
|
136
|
+
url: string;
|
|
137
|
+
parentCommentId: string;
|
|
138
|
+
replyUserName: string;
|
|
139
|
+
replyUserEmail: string;
|
|
140
|
+
/** @format date-time */
|
|
141
|
+
createAt: string;
|
|
142
|
+
/** @format date-time */
|
|
143
|
+
updateAt: string;
|
|
144
|
+
}
|
|
145
|
+
export interface IPage {
|
|
146
|
+
id: string;
|
|
147
|
+
cover: string;
|
|
148
|
+
name: string;
|
|
149
|
+
path: string;
|
|
150
|
+
order: number;
|
|
151
|
+
content: string;
|
|
152
|
+
html: string;
|
|
153
|
+
toc: string;
|
|
154
|
+
status: string;
|
|
155
|
+
/** @format date-time */
|
|
156
|
+
publishAt: string;
|
|
157
|
+
views: number;
|
|
158
|
+
/** @format date-time */
|
|
159
|
+
createAt: string;
|
|
160
|
+
/** @format date-time */
|
|
161
|
+
updateAt: string;
|
|
162
|
+
}
|
|
163
|
+
export interface IView {
|
|
164
|
+
ip: string;
|
|
165
|
+
userAgent: string;
|
|
166
|
+
url: string;
|
|
167
|
+
count: number;
|
|
168
|
+
address: string;
|
|
169
|
+
browser: string;
|
|
170
|
+
engine: string;
|
|
171
|
+
os: string;
|
|
172
|
+
device: string;
|
|
173
|
+
/** @format date-time */
|
|
174
|
+
createAt: string;
|
|
175
|
+
/** @format date-time */
|
|
176
|
+
updateAt: string;
|
|
177
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './data-contracts';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// 类型定义索引
|
|
3
|
+
// 自动生成,请勿手动修改
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
__exportStar(require("./data-contracts"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const formatDate: (date: Date, format?: string) => string;
|
|
2
|
+
export declare const deepClone: <T>(obj: T) => T;
|
|
3
|
+
export declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => (...args: Parameters<T>) => void;
|
|
4
|
+
export declare const throttle: <T extends (...args: any[]) => any>(func: T, limit: number) => (...args: Parameters<T>) => void;
|
|
5
|
+
export declare const isApiError: (error: any) => error is ApiError;
|
|
6
|
+
export interface ApiResponse<T = any> {
|
|
7
|
+
code: number;
|
|
8
|
+
message: string;
|
|
9
|
+
data: T;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
}
|
|
12
|
+
export interface PaginatedResponse<T = any> {
|
|
13
|
+
items: T[];
|
|
14
|
+
total: number;
|
|
15
|
+
page: number;
|
|
16
|
+
limit: number;
|
|
17
|
+
totalPages: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class ApiError extends Error {
|
|
20
|
+
code: number;
|
|
21
|
+
details?: any;
|
|
22
|
+
constructor(code: number, message: string, details?: any);
|
|
23
|
+
}
|