@origen-ui/admin-cli 1.0.2 → 1.1.0
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/package.json +3 -3
- package/templates/current/clean/CHANGELOG.md +53 -0
- package/templates/current/clean/component-catalog.json +9 -9
- package/templates/current/clean/package.json +41 -41
- package/templates/current/clean/scaffold.lock.json +2 -2
- package/templates/current/clean/scripts/vite-build-policy.spec.ts +71 -0
- package/templates/current/clean/src/App.vue +10 -3
- package/templates/current/clean/src/api/client.ts +90 -10
- package/templates/current/clean/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/clean/src/api/generated/http-client.ts +266 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
- package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/clean/src/app/adminLocale.ts +90 -0
- package/templates/current/clean/src/app/createAdminUi.spec.ts +65 -9
- package/templates/current/clean/src/app/createAdminUi.ts +14 -29
- package/templates/current/clean/src/app/embedded-token.spec.ts +40 -0
- package/templates/current/clean/src/app/embedded.spec.ts +135 -0
- package/templates/current/clean/src/app/embedded.ts +255 -0
- package/templates/current/clean/src/app/localeFormat.ts +52 -0
- package/templates/current/clean/src/app/menu.spec.ts +26 -0
- package/templates/current/clean/src/app/menu.ts +4 -0
- package/templates/current/clean/src/app/menuTypes.ts +1 -0
- package/templates/current/clean/src/app/origenUiLocale.spec.ts +6 -5
- package/templates/current/clean/src/app/origenUiLocale.ts +3 -58
- package/templates/current/clean/src/app/permission.spec.ts +26 -0
- package/templates/current/clean/src/app/runtimeConfig.ts +8 -7
- package/templates/current/clean/src/env.d.ts +18 -0
- package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +21 -17
- package/templates/current/clean/src/features/appearance/store/theme.ts +2 -1
- package/templates/current/clean/src/features/auth/pages/Login.vue +15 -11
- package/templates/current/clean/src/features/auth/store/auth.ts +13 -3
- package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +5 -2
- package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +7 -10
- package/templates/current/clean/src/features/security/devtoolsProtection.ts +2 -1
- package/templates/current/clean/src/features/system/access/api/admin-repository.spec.ts +14 -0
- package/templates/current/clean/src/features/system/access/api/admin-repository.ts +38 -15
- package/templates/current/clean/src/features/system/access/api/rbac.ts +37 -27
- package/templates/current/clean/src/features/workspace/pages/Empty.vue +4 -1
- package/templates/current/clean/src/features/workspace/pages/Profile.vue +13 -11
- package/templates/current/clean/src/layouts/AdminLayout.vue +3 -1
- package/templates/current/clean/src/layouts/TopBar.vue +26 -8
- package/templates/current/clean/src/locales/en-US.json +490 -0
- package/templates/current/clean/src/locales/en-US.runtime.ts +20 -0
- package/templates/current/clean/src/locales/index.ts +129 -45
- package/templates/current/clean/src/locales/messages-types.ts +62 -0
- package/templates/current/clean/src/locales/messages.spec.ts +113 -6
- package/templates/current/clean/src/locales/vue-i18n.d.ts +5 -0
- package/templates/current/clean/src/locales/zh-CN.json +490 -0
- package/templates/current/clean/src/locales/zh-CN.runtime.ts +20 -0
- package/templates/current/clean/src/locales/zh-TW.json +490 -0
- package/templates/current/clean/src/locales/zh-TW.runtime.ts +20 -0
- package/templates/current/clean/src/router/bootstrap.ts +22 -7
- package/templates/current/clean/src/router/dynamicRoutes.ts +5 -1
- package/templates/current/clean/src/router/queryEncryption.spec.ts +30 -4
- package/templates/current/clean/src/router/queryEncryption.ts +48 -44
- package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +2 -1
- package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +2 -1
- package/templates/current/clean/src/templates/og-table.ts +81 -37
- package/templates/current/clean/src/templates/templates.spec.ts +19 -0
- package/templates/current/clean/vite.build-policy.ts +114 -289
- package/templates/current/clean/vite.config.ts +4 -5
- package/templates/current/examples/CHANGELOG.md +53 -0
- package/templates/current/examples/component-catalog.json +9 -9
- package/templates/current/examples/package.json +41 -41
- package/templates/current/examples/scaffold.lock.json +2 -2
- package/templates/current/examples/scripts/vite-build-policy.spec.ts +71 -0
- package/templates/current/examples/src/App.vue +10 -3
- package/templates/current/examples/src/api/client.ts +90 -10
- package/templates/current/examples/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/examples/src/api/generated/http-client.ts +266 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
- package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/examples/src/app/adminLocale.ts +90 -0
- package/templates/current/examples/src/app/createAdminUi.spec.ts +65 -9
- package/templates/current/examples/src/app/createAdminUi.ts +14 -29
- package/templates/current/examples/src/app/embedded-token.spec.ts +40 -0
- package/templates/current/examples/src/app/embedded.spec.ts +135 -0
- package/templates/current/examples/src/app/embedded.ts +255 -0
- package/templates/current/examples/src/app/localeFormat.ts +52 -0
- package/templates/current/examples/src/app/menu.spec.ts +26 -0
- package/templates/current/examples/src/app/menu.ts +4 -0
- package/templates/current/examples/src/app/menuTypes.ts +1 -0
- package/templates/current/examples/src/app/origenUiLocale.spec.ts +6 -5
- package/templates/current/examples/src/app/origenUiLocale.ts +3 -58
- package/templates/current/examples/src/app/permission.spec.ts +26 -0
- package/templates/current/examples/src/app/runtimeConfig.ts +8 -7
- package/templates/current/examples/src/env.d.ts +18 -0
- package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +21 -17
- package/templates/current/examples/src/features/appearance/store/theme.ts +2 -1
- package/templates/current/examples/src/features/auth/pages/Login.vue +15 -11
- package/templates/current/examples/src/features/auth/store/auth.ts +13 -3
- package/templates/current/examples/src/features/errors/pages/Forbidden.vue +6 -2
- package/templates/current/examples/src/features/errors/pages/NotFound.vue +6 -2
- package/templates/current/examples/src/features/errors/pages/ServerError.vue +6 -2
- package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +9 -1
- package/templates/current/examples/src/features/feature-composables.spec.ts +36 -9
- package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +5 -2
- package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +7 -10
- package/templates/current/examples/src/features/security/devtoolsProtection.ts +2 -1
- package/templates/current/examples/src/features/system/access/api/admin-repository.spec.ts +14 -0
- package/templates/current/examples/src/features/system/access/api/admin-repository.ts +38 -15
- package/templates/current/examples/src/features/system/access/api/rbac.ts +37 -27
- package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +43 -38
- package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +33 -30
- package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +81 -69
- package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +3 -1
- package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +18 -15
- package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +49 -53
- package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +3 -1
- package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +22 -19
- package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +59 -64
- package/templates/current/examples/src/features/system/users/pages/UserList.vue +3 -1
- package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +9 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +54 -26
- package/templates/current/examples/src/features/workspace/pages/Empty.vue +4 -1
- package/templates/current/examples/src/features/workspace/pages/Profile.vue +13 -11
- package/templates/current/examples/src/layouts/AdminLayout.vue +3 -1
- package/templates/current/examples/src/layouts/TopBar.vue +26 -8
- package/templates/current/examples/src/locales/en-US.json +490 -0
- package/templates/current/examples/src/locales/en-US.runtime.ts +20 -0
- package/templates/current/examples/src/locales/index.ts +129 -45
- package/templates/current/examples/src/locales/messages-types.ts +62 -0
- package/templates/current/examples/src/locales/messages.spec.ts +113 -6
- package/templates/current/examples/src/locales/vue-i18n.d.ts +5 -0
- package/templates/current/examples/src/locales/zh-CN.json +490 -0
- package/templates/current/examples/src/locales/zh-CN.runtime.ts +20 -0
- package/templates/current/examples/src/locales/zh-TW.json +490 -0
- package/templates/current/examples/src/locales/zh-TW.runtime.ts +20 -0
- package/templates/current/examples/src/main.ts +31 -5
- package/templates/current/examples/src/router/bootstrap.ts +22 -7
- package/templates/current/examples/src/router/dynamicRoutes.spec.ts +17 -0
- package/templates/current/examples/src/router/dynamicRoutes.ts +5 -1
- package/templates/current/examples/src/router/queryEncryption.spec.ts +30 -4
- package/templates/current/examples/src/router/queryEncryption.ts +48 -44
- package/templates/current/examples/src/router/staticRoutes.ts +1 -1
- package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +2 -1
- package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +2 -1
- package/templates/current/examples/src/templates/og-table.ts +81 -37
- package/templates/current/examples/src/templates/templates.spec.ts +19 -0
- package/templates/current/examples/vite.build-policy.ts +114 -289
- package/templates/current/examples/vite.config.ts +4 -5
- package/templates/current/clean/scripts/check-admin-bundle.mjs +0 -214
- package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +0 -38
- package/templates/current/clean/src/locales/en-US.ts +0 -55
- package/templates/current/clean/src/locales/zh-CN.ts +0 -55
- package/templates/current/clean/src/locales/zh-TW.ts +0 -44
- package/templates/current/examples/scripts/check-admin-bundle.mjs +0 -214
- package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +0 -38
- package/templates/current/examples/src/locales/en-US.ts +0 -55
- package/templates/current/examples/src/locales/zh-CN.ts +0 -55
- package/templates/current/examples/src/locales/zh-TW.ts +0 -44
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
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
|
+
|
|
13
|
+
export type QueryParamsType = Record<string | number, any>;
|
|
14
|
+
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
|
|
15
|
+
|
|
16
|
+
export interface FullRequestParams extends Omit<RequestInit, "body"> {
|
|
17
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
18
|
+
secure?: boolean;
|
|
19
|
+
/** request path */
|
|
20
|
+
path: string;
|
|
21
|
+
/** content type of request body */
|
|
22
|
+
type?: ContentType;
|
|
23
|
+
/** query params */
|
|
24
|
+
query?: QueryParamsType;
|
|
25
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
26
|
+
format?: ResponseFormat;
|
|
27
|
+
/** request body */
|
|
28
|
+
body?: unknown;
|
|
29
|
+
/** base url */
|
|
30
|
+
baseUrl?: string;
|
|
31
|
+
/** request cancellation token */
|
|
32
|
+
cancelToken?: CancelToken;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type RequestParams = Omit<
|
|
36
|
+
FullRequestParams,
|
|
37
|
+
"body" | "method" | "query" | "path"
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
export interface ApiConfig<SecurityDataType = unknown> {
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
|
|
43
|
+
securityWorker?: (
|
|
44
|
+
securityData: SecurityDataType | null,
|
|
45
|
+
) => Promise<RequestParams | void> | RequestParams | void;
|
|
46
|
+
customFetch?: typeof fetch;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface HttpResponse<D extends unknown, E extends unknown = unknown>
|
|
50
|
+
extends Response {
|
|
51
|
+
data: D;
|
|
52
|
+
error: E;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type CancelToken = Symbol | string | number;
|
|
56
|
+
|
|
57
|
+
export enum ContentType {
|
|
58
|
+
Json = "application/json",
|
|
59
|
+
JsonApi = "application/vnd.api+json",
|
|
60
|
+
FormData = "multipart/form-data",
|
|
61
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
62
|
+
Text = "text/plain",
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export class HttpClient<SecurityDataType = unknown> {
|
|
66
|
+
public baseUrl: string = "/api";
|
|
67
|
+
private securityData: SecurityDataType | null = null;
|
|
68
|
+
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
|
|
69
|
+
private abortControllers = new Map<CancelToken, AbortController>();
|
|
70
|
+
private customFetch = (...fetchParams: Parameters<typeof fetch>) =>
|
|
71
|
+
fetch(...fetchParams);
|
|
72
|
+
|
|
73
|
+
private baseApiParams: RequestParams = {
|
|
74
|
+
credentials: "same-origin",
|
|
75
|
+
headers: {},
|
|
76
|
+
redirect: "follow",
|
|
77
|
+
referrerPolicy: "no-referrer",
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
|
|
81
|
+
Object.assign(this, apiConfig);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public setSecurityData = (data: SecurityDataType | null) => {
|
|
85
|
+
this.securityData = data;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
protected encodeQueryParam(key: string, value: any) {
|
|
89
|
+
const encodedKey = encodeURIComponent(key);
|
|
90
|
+
return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
protected addQueryParam(query: QueryParamsType, key: string) {
|
|
94
|
+
return this.encodeQueryParam(key, query[key]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string) {
|
|
98
|
+
const value = query[key];
|
|
99
|
+
return value.map((v: any) => this.encodeQueryParam(key, v)).join("&");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
protected toQueryString(rawQuery?: QueryParamsType): string {
|
|
103
|
+
const query = rawQuery || {};
|
|
104
|
+
const keys = Object.keys(query).filter(
|
|
105
|
+
(key) => "undefined" !== typeof query[key],
|
|
106
|
+
);
|
|
107
|
+
return keys
|
|
108
|
+
.map((key) =>
|
|
109
|
+
Array.isArray(query[key])
|
|
110
|
+
? this.addArrayQueryParam(query, key)
|
|
111
|
+
: this.addQueryParam(query, key),
|
|
112
|
+
)
|
|
113
|
+
.join("&");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
protected addQueryParams(rawQuery?: QueryParamsType): string {
|
|
117
|
+
const queryString = this.toQueryString(rawQuery);
|
|
118
|
+
return queryString ? `?${queryString}` : "";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private contentFormatters: Record<ContentType, (input: any) => any> = {
|
|
122
|
+
[ContentType.Json]: (input: any) =>
|
|
123
|
+
input !== null && (typeof input === "object" || typeof input === "string")
|
|
124
|
+
? JSON.stringify(input)
|
|
125
|
+
: input,
|
|
126
|
+
[ContentType.JsonApi]: (input: any) =>
|
|
127
|
+
input !== null && (typeof input === "object" || typeof input === "string")
|
|
128
|
+
? JSON.stringify(input)
|
|
129
|
+
: input,
|
|
130
|
+
[ContentType.Text]: (input: any) =>
|
|
131
|
+
input !== null && typeof input !== "string"
|
|
132
|
+
? JSON.stringify(input)
|
|
133
|
+
: input,
|
|
134
|
+
[ContentType.FormData]: (input: any) => {
|
|
135
|
+
if (input instanceof FormData) {
|
|
136
|
+
return input;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return Object.keys(input || {}).reduce((formData, key) => {
|
|
140
|
+
const property = input[key];
|
|
141
|
+
formData.append(
|
|
142
|
+
key,
|
|
143
|
+
property instanceof Blob
|
|
144
|
+
? property
|
|
145
|
+
: typeof property === "object" && property !== null
|
|
146
|
+
? JSON.stringify(property)
|
|
147
|
+
: `${property}`,
|
|
148
|
+
);
|
|
149
|
+
return formData;
|
|
150
|
+
}, new FormData());
|
|
151
|
+
},
|
|
152
|
+
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
protected mergeRequestParams(
|
|
156
|
+
params1: RequestParams,
|
|
157
|
+
params2?: RequestParams,
|
|
158
|
+
): RequestParams {
|
|
159
|
+
return {
|
|
160
|
+
...this.baseApiParams,
|
|
161
|
+
...params1,
|
|
162
|
+
...(params2 || {}),
|
|
163
|
+
headers: {
|
|
164
|
+
...(this.baseApiParams.headers || {}),
|
|
165
|
+
...(params1.headers || {}),
|
|
166
|
+
...((params2 && params2.headers) || {}),
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
protected createAbortSignal = (
|
|
172
|
+
cancelToken: CancelToken,
|
|
173
|
+
): AbortSignal | undefined => {
|
|
174
|
+
if (this.abortControllers.has(cancelToken)) {
|
|
175
|
+
const abortController = this.abortControllers.get(cancelToken);
|
|
176
|
+
if (abortController) {
|
|
177
|
+
return abortController.signal;
|
|
178
|
+
}
|
|
179
|
+
return void 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const abortController = new AbortController();
|
|
183
|
+
this.abortControllers.set(cancelToken, abortController);
|
|
184
|
+
return abortController.signal;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
public abortRequest = (cancelToken: CancelToken) => {
|
|
188
|
+
const abortController = this.abortControllers.get(cancelToken);
|
|
189
|
+
|
|
190
|
+
if (abortController) {
|
|
191
|
+
abortController.abort();
|
|
192
|
+
this.abortControllers.delete(cancelToken);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
public request = async <T = any, E = any>({
|
|
197
|
+
body,
|
|
198
|
+
secure,
|
|
199
|
+
path,
|
|
200
|
+
type,
|
|
201
|
+
query,
|
|
202
|
+
format,
|
|
203
|
+
baseUrl,
|
|
204
|
+
cancelToken,
|
|
205
|
+
...params
|
|
206
|
+
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
|
|
207
|
+
const secureParams =
|
|
208
|
+
((typeof secure === "boolean" ? secure : this.baseApiParams.secure) &&
|
|
209
|
+
this.securityWorker &&
|
|
210
|
+
(await this.securityWorker(this.securityData))) ||
|
|
211
|
+
{};
|
|
212
|
+
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
213
|
+
const queryString = query && this.toQueryString(query);
|
|
214
|
+
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
215
|
+
const responseFormat = format || requestParams.format;
|
|
216
|
+
|
|
217
|
+
return this.customFetch(
|
|
218
|
+
`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`,
|
|
219
|
+
{
|
|
220
|
+
...requestParams,
|
|
221
|
+
headers: {
|
|
222
|
+
...(requestParams.headers || {}),
|
|
223
|
+
...(type && type !== ContentType.FormData
|
|
224
|
+
? { "Content-Type": type }
|
|
225
|
+
: {}),
|
|
226
|
+
},
|
|
227
|
+
signal:
|
|
228
|
+
(cancelToken
|
|
229
|
+
? this.createAbortSignal(cancelToken)
|
|
230
|
+
: requestParams.signal) || null,
|
|
231
|
+
body:
|
|
232
|
+
typeof body === "undefined" || body === null
|
|
233
|
+
? null
|
|
234
|
+
: payloadFormatter(body),
|
|
235
|
+
},
|
|
236
|
+
).then(async (response) => {
|
|
237
|
+
const r = response as HttpResponse<T, E>;
|
|
238
|
+
r.data = null as unknown as T;
|
|
239
|
+
r.error = null as unknown as E;
|
|
240
|
+
|
|
241
|
+
const responseToParse = responseFormat ? response.clone() : response;
|
|
242
|
+
const data = !responseFormat
|
|
243
|
+
? r
|
|
244
|
+
: await responseToParse[responseFormat]()
|
|
245
|
+
.then((data) => {
|
|
246
|
+
if (r.ok) {
|
|
247
|
+
r.data = data;
|
|
248
|
+
} else {
|
|
249
|
+
r.error = data;
|
|
250
|
+
}
|
|
251
|
+
return r;
|
|
252
|
+
})
|
|
253
|
+
.catch((e) => {
|
|
254
|
+
r.error = e;
|
|
255
|
+
return r;
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
if (cancelToken) {
|
|
259
|
+
this.abortControllers.delete(cancelToken);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!response.ok) throw data;
|
|
263
|
+
return data;
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
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
|
+
|
|
13
|
+
import {
|
|
14
|
+
ContentArticle,
|
|
15
|
+
ContentArticleDraft,
|
|
16
|
+
PageResultContentArticle,
|
|
17
|
+
} from "./data-contracts";
|
|
18
|
+
import { ContentType, HttpClient, RequestParams } from "./http-client";
|
|
19
|
+
|
|
20
|
+
export class 系统管理内容文章<SecurityDataType = unknown> {
|
|
21
|
+
http: HttpClient<SecurityDataType>;
|
|
22
|
+
|
|
23
|
+
constructor(http: HttpClient<SecurityDataType>) {
|
|
24
|
+
this.http = http;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* No description
|
|
29
|
+
*
|
|
30
|
+
* @tags 系统管理-内容文章
|
|
31
|
+
* @name ContentArticlesList
|
|
32
|
+
* @summary 获取内容文章列表
|
|
33
|
+
* @request GET:/system/content-articles
|
|
34
|
+
* @secure
|
|
35
|
+
* @response `200` `PageResultContentArticle` 成功
|
|
36
|
+
*/
|
|
37
|
+
contentArticlesList = (
|
|
38
|
+
query?: {
|
|
39
|
+
/** @default 1 */
|
|
40
|
+
page?: number;
|
|
41
|
+
/** @default 20 */
|
|
42
|
+
pageSize?: number;
|
|
43
|
+
keyword?: string;
|
|
44
|
+
status?: "draft" | "published";
|
|
45
|
+
sortBy?: string;
|
|
46
|
+
sortOrder?: "asc" | "desc";
|
|
47
|
+
},
|
|
48
|
+
params: RequestParams = {},
|
|
49
|
+
) =>
|
|
50
|
+
this.http.request<PageResultContentArticle, any>({
|
|
51
|
+
path: `/system/content-articles`,
|
|
52
|
+
method: "GET",
|
|
53
|
+
query: query,
|
|
54
|
+
secure: true,
|
|
55
|
+
format: "json",
|
|
56
|
+
...params,
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* No description
|
|
60
|
+
*
|
|
61
|
+
* @tags 系统管理-内容文章
|
|
62
|
+
* @name ContentArticlesCreate
|
|
63
|
+
* @summary 创建内容文章
|
|
64
|
+
* @request POST:/system/content-articles
|
|
65
|
+
* @secure
|
|
66
|
+
* @response `200` `ContentArticle` 创建成功
|
|
67
|
+
*/
|
|
68
|
+
contentArticlesCreate = (
|
|
69
|
+
data: ContentArticleDraft,
|
|
70
|
+
params: RequestParams = {},
|
|
71
|
+
) =>
|
|
72
|
+
this.http.request<ContentArticle, any>({
|
|
73
|
+
path: `/system/content-articles`,
|
|
74
|
+
method: "POST",
|
|
75
|
+
body: data,
|
|
76
|
+
secure: true,
|
|
77
|
+
type: ContentType.Json,
|
|
78
|
+
format: "json",
|
|
79
|
+
...params,
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* No description
|
|
83
|
+
*
|
|
84
|
+
* @tags 系统管理-内容文章
|
|
85
|
+
* @name ContentArticlesDelete
|
|
86
|
+
* @summary 删除内容文章
|
|
87
|
+
* @request DELETE:/system/content-articles
|
|
88
|
+
* @secure
|
|
89
|
+
* @response `204` `void` 删除成功
|
|
90
|
+
*/
|
|
91
|
+
contentArticlesDelete = (
|
|
92
|
+
data: {
|
|
93
|
+
ids: string[];
|
|
94
|
+
},
|
|
95
|
+
params: RequestParams = {},
|
|
96
|
+
) =>
|
|
97
|
+
this.http.request<void, any>({
|
|
98
|
+
path: `/system/content-articles`,
|
|
99
|
+
method: "DELETE",
|
|
100
|
+
body: data,
|
|
101
|
+
secure: true,
|
|
102
|
+
type: ContentType.Json,
|
|
103
|
+
...params,
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* No description
|
|
107
|
+
*
|
|
108
|
+
* @tags 系统管理-内容文章
|
|
109
|
+
* @name ContentArticlesDetail
|
|
110
|
+
* @summary 获取内容文章详情
|
|
111
|
+
* @request GET:/system/content-articles/{id}
|
|
112
|
+
* @secure
|
|
113
|
+
* @response `200` `ContentArticle` 成功
|
|
114
|
+
*/
|
|
115
|
+
contentArticlesDetail = (id: string, params: RequestParams = {}) =>
|
|
116
|
+
this.http.request<ContentArticle, any>({
|
|
117
|
+
path: `/system/content-articles/${id}`,
|
|
118
|
+
method: "GET",
|
|
119
|
+
secure: true,
|
|
120
|
+
format: "json",
|
|
121
|
+
...params,
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* No description
|
|
125
|
+
*
|
|
126
|
+
* @tags 系统管理-内容文章
|
|
127
|
+
* @name ContentArticlesUpdate
|
|
128
|
+
* @summary 更新内容文章
|
|
129
|
+
* @request PUT:/system/content-articles/{id}
|
|
130
|
+
* @secure
|
|
131
|
+
* @response `200` `ContentArticle` 更新成功
|
|
132
|
+
*/
|
|
133
|
+
contentArticlesUpdate = (
|
|
134
|
+
id: string,
|
|
135
|
+
data: ContentArticleDraft,
|
|
136
|
+
params: RequestParams = {},
|
|
137
|
+
) =>
|
|
138
|
+
this.http.request<ContentArticle, any>({
|
|
139
|
+
path: `/system/content-articles/${id}`,
|
|
140
|
+
method: "PUT",
|
|
141
|
+
body: data,
|
|
142
|
+
secure: true,
|
|
143
|
+
type: ContentType.Json,
|
|
144
|
+
format: "json",
|
|
145
|
+
...params,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
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
|
+
|
|
13
|
+
import { PageResultRbacAuditEvent } from "./data-contracts";
|
|
14
|
+
import { HttpClient, RequestParams } from "./http-client";
|
|
15
|
+
|
|
16
|
+
export class 系统管理审计<SecurityDataType = unknown> {
|
|
17
|
+
http: HttpClient<SecurityDataType>;
|
|
18
|
+
|
|
19
|
+
constructor(http: HttpClient<SecurityDataType>) {
|
|
20
|
+
this.http = http;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* No description
|
|
25
|
+
*
|
|
26
|
+
* @tags 系统管理-审计
|
|
27
|
+
* @name AuditList
|
|
28
|
+
* @summary 获取审计日志列表
|
|
29
|
+
* @request GET:/system/audit
|
|
30
|
+
* @secure
|
|
31
|
+
* @response `200` `PageResultRbacAuditEvent` 成功
|
|
32
|
+
*/
|
|
33
|
+
auditList = (
|
|
34
|
+
query?: {
|
|
35
|
+
/** @default 1 */
|
|
36
|
+
page?: number;
|
|
37
|
+
/** @default 20 */
|
|
38
|
+
pageSize?: number;
|
|
39
|
+
keyword?: string;
|
|
40
|
+
action?: string;
|
|
41
|
+
targetType?: "user" | "role" | "menu" | "authorization";
|
|
42
|
+
},
|
|
43
|
+
params: RequestParams = {},
|
|
44
|
+
) =>
|
|
45
|
+
this.http.request<PageResultRbacAuditEvent, any>({
|
|
46
|
+
path: `/system/audit`,
|
|
47
|
+
method: "GET",
|
|
48
|
+
query: query,
|
|
49
|
+
secure: true,
|
|
50
|
+
format: "json",
|
|
51
|
+
...params,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
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
|
+
|
|
13
|
+
import { UploadResponse } from "./data-contracts";
|
|
14
|
+
import { ContentType, HttpClient, RequestParams } from "./http-client";
|
|
15
|
+
|
|
16
|
+
export class 系统管理文件上传<SecurityDataType = unknown> {
|
|
17
|
+
http: HttpClient<SecurityDataType>;
|
|
18
|
+
|
|
19
|
+
constructor(http: HttpClient<SecurityDataType>) {
|
|
20
|
+
this.http = http;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* No description
|
|
25
|
+
*
|
|
26
|
+
* @tags 系统管理-文件上传
|
|
27
|
+
* @name UploadsCreate
|
|
28
|
+
* @summary 上传文件
|
|
29
|
+
* @request POST:/system/uploads
|
|
30
|
+
* @secure
|
|
31
|
+
* @response `200` `UploadResponse` 上传成功
|
|
32
|
+
*/
|
|
33
|
+
uploadsCreate = (
|
|
34
|
+
data: {
|
|
35
|
+
/** @format binary */
|
|
36
|
+
file: File;
|
|
37
|
+
},
|
|
38
|
+
params: RequestParams = {},
|
|
39
|
+
) =>
|
|
40
|
+
this.http.request<UploadResponse, any>({
|
|
41
|
+
path: `/system/uploads`,
|
|
42
|
+
method: "POST",
|
|
43
|
+
body: data,
|
|
44
|
+
secure: true,
|
|
45
|
+
type: ContentType.FormData,
|
|
46
|
+
format: "json",
|
|
47
|
+
...params,
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* No description
|
|
51
|
+
*
|
|
52
|
+
* @tags 系统管理-文件上传
|
|
53
|
+
* @name UploadsDelete
|
|
54
|
+
* @summary 删除文件
|
|
55
|
+
* @request DELETE:/system/uploads/{id}
|
|
56
|
+
* @secure
|
|
57
|
+
* @response `204` `void` 删除成功
|
|
58
|
+
*/
|
|
59
|
+
uploadsDelete = (id: string, params: RequestParams = {}) =>
|
|
60
|
+
this.http.request<void, any>({
|
|
61
|
+
path: `/system/uploads/${id}`,
|
|
62
|
+
method: "DELETE",
|
|
63
|
+
secure: true,
|
|
64
|
+
...params,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
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
|
+
|
|
13
|
+
import {
|
|
14
|
+
AdminUser,
|
|
15
|
+
AdminUserDraft,
|
|
16
|
+
PageResultAdminUser,
|
|
17
|
+
} from "./data-contracts";
|
|
18
|
+
import { ContentType, HttpClient, RequestParams } from "./http-client";
|
|
19
|
+
|
|
20
|
+
export class 系统管理用户<SecurityDataType = unknown> {
|
|
21
|
+
http: HttpClient<SecurityDataType>;
|
|
22
|
+
|
|
23
|
+
constructor(http: HttpClient<SecurityDataType>) {
|
|
24
|
+
this.http = http;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* No description
|
|
29
|
+
*
|
|
30
|
+
* @tags 系统管理-用户
|
|
31
|
+
* @name UsersList
|
|
32
|
+
* @summary 获取用户列表
|
|
33
|
+
* @request GET:/system/users
|
|
34
|
+
* @secure
|
|
35
|
+
* @response `200` `PageResultAdminUser` 成功
|
|
36
|
+
*/
|
|
37
|
+
usersList = (
|
|
38
|
+
query?: {
|
|
39
|
+
/** @default 1 */
|
|
40
|
+
page?: number;
|
|
41
|
+
/** @default 20 */
|
|
42
|
+
pageSize?: number;
|
|
43
|
+
keyword?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
department?: string;
|
|
46
|
+
roleId?: string;
|
|
47
|
+
status?: "active" | "suspended";
|
|
48
|
+
sortBy?: string;
|
|
49
|
+
sortOrder?: "asc" | "desc";
|
|
50
|
+
},
|
|
51
|
+
params: RequestParams = {},
|
|
52
|
+
) =>
|
|
53
|
+
this.http.request<PageResultAdminUser, any>({
|
|
54
|
+
path: `/system/users`,
|
|
55
|
+
method: "GET",
|
|
56
|
+
query: query,
|
|
57
|
+
secure: true,
|
|
58
|
+
format: "json",
|
|
59
|
+
...params,
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* No description
|
|
63
|
+
*
|
|
64
|
+
* @tags 系统管理-用户
|
|
65
|
+
* @name UsersCreate
|
|
66
|
+
* @summary 创建用户
|
|
67
|
+
* @request POST:/system/users
|
|
68
|
+
* @secure
|
|
69
|
+
* @response `200` `AdminUser` 创建成功
|
|
70
|
+
*/
|
|
71
|
+
usersCreate = (data: AdminUserDraft, params: RequestParams = {}) =>
|
|
72
|
+
this.http.request<AdminUser, any>({
|
|
73
|
+
path: `/system/users`,
|
|
74
|
+
method: "POST",
|
|
75
|
+
body: data,
|
|
76
|
+
secure: true,
|
|
77
|
+
type: ContentType.Json,
|
|
78
|
+
format: "json",
|
|
79
|
+
...params,
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* No description
|
|
83
|
+
*
|
|
84
|
+
* @tags 系统管理-用户
|
|
85
|
+
* @name UsersDelete
|
|
86
|
+
* @summary 删除用户
|
|
87
|
+
* @request DELETE:/system/users
|
|
88
|
+
* @secure
|
|
89
|
+
* @response `204` `void` 删除成功
|
|
90
|
+
*/
|
|
91
|
+
usersDelete = (
|
|
92
|
+
data: {
|
|
93
|
+
ids: string[];
|
|
94
|
+
},
|
|
95
|
+
params: RequestParams = {},
|
|
96
|
+
) =>
|
|
97
|
+
this.http.request<void, any>({
|
|
98
|
+
path: `/system/users`,
|
|
99
|
+
method: "DELETE",
|
|
100
|
+
body: data,
|
|
101
|
+
secure: true,
|
|
102
|
+
type: ContentType.Json,
|
|
103
|
+
...params,
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* No description
|
|
107
|
+
*
|
|
108
|
+
* @tags 系统管理-用户
|
|
109
|
+
* @name UsersDetail
|
|
110
|
+
* @summary 获取用户详情
|
|
111
|
+
* @request GET:/system/users/{id}
|
|
112
|
+
* @secure
|
|
113
|
+
* @response `200` `AdminUser` 成功
|
|
114
|
+
*/
|
|
115
|
+
usersDetail = (id: string, params: RequestParams = {}) =>
|
|
116
|
+
this.http.request<AdminUser, any>({
|
|
117
|
+
path: `/system/users/${id}`,
|
|
118
|
+
method: "GET",
|
|
119
|
+
secure: true,
|
|
120
|
+
format: "json",
|
|
121
|
+
...params,
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* No description
|
|
125
|
+
*
|
|
126
|
+
* @tags 系统管理-用户
|
|
127
|
+
* @name UsersUpdate
|
|
128
|
+
* @summary 更新用户
|
|
129
|
+
* @request PUT:/system/users/{id}
|
|
130
|
+
* @secure
|
|
131
|
+
* @response `200` `AdminUser` 更新成功
|
|
132
|
+
*/
|
|
133
|
+
usersUpdate = (
|
|
134
|
+
id: string,
|
|
135
|
+
data: AdminUserDraft,
|
|
136
|
+
params: RequestParams = {},
|
|
137
|
+
) =>
|
|
138
|
+
this.http.request<AdminUser, any>({
|
|
139
|
+
path: `/system/users/${id}`,
|
|
140
|
+
method: "PUT",
|
|
141
|
+
body: data,
|
|
142
|
+
secure: true,
|
|
143
|
+
type: ContentType.Json,
|
|
144
|
+
format: "json",
|
|
145
|
+
...params,
|
|
146
|
+
});
|
|
147
|
+
/**
|
|
148
|
+
* No description
|
|
149
|
+
*
|
|
150
|
+
* @tags 系统管理-用户
|
|
151
|
+
* @name UsersStatusPartialUpdate
|
|
152
|
+
* @summary 批量更新用户状�? * @request PATCH:/system/users/status
|
|
153
|
+
* @secure
|
|
154
|
+
* @response `204` `void` 更新成功
|
|
155
|
+
*/
|
|
156
|
+
usersStatusPartialUpdate = (
|
|
157
|
+
data: {
|
|
158
|
+
ids: string[];
|
|
159
|
+
status: "active" | "suspended";
|
|
160
|
+
},
|
|
161
|
+
params: RequestParams = {},
|
|
162
|
+
) =>
|
|
163
|
+
this.http.request<void, any>({
|
|
164
|
+
path: `/system/users/status`,
|
|
165
|
+
method: "PATCH",
|
|
166
|
+
body: data,
|
|
167
|
+
secure: true,
|
|
168
|
+
type: ContentType.Json,
|
|
169
|
+
...params,
|
|
170
|
+
});
|
|
171
|
+
}
|