@origen-ui/admin-cli 1.0.0 → 1.0.2

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.
Files changed (30) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +3 -0
  3. package/bin/og-admin.mjs +9 -1
  4. package/package.json +3 -2
  5. package/templates/current/clean/CHANGELOG.md +39 -0
  6. package/templates/current/clean/package.json +15 -15
  7. package/templates/current/clean/scaffold.lock.json +2 -2
  8. package/templates/current/examples/CHANGELOG.md +39 -0
  9. package/templates/current/examples/package.json +15 -15
  10. package/templates/current/examples/scaffold.lock.json +2 -2
  11. package/templates/current/clean/src/api/generated/data-contracts.ts +0 -268
  12. package/templates/current/clean/src/api/generated/http-client.ts +0 -266
  13. 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 +0 -147
  14. 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 +0 -53
  15. 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 +0 -66
  16. 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 +0 -171
  17. 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 +0 -181
  18. 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 +0 -169
  19. 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 +0 -170
  20. package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +0 -98
  21. package/templates/current/examples/src/api/generated/data-contracts.ts +0 -268
  22. package/templates/current/examples/src/api/generated/http-client.ts +0 -266
  23. 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 +0 -147
  24. 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 +0 -53
  25. 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 +0 -66
  26. 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 +0 -171
  27. 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 +0 -181
  28. 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 +0 -169
  29. 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 +0 -170
  30. package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +0 -98
@@ -1,268 +0,0 @@
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 interface LoginCredentials {
14
- /** 用户�?*/
15
- username: string;
16
- /** 密码 */
17
- password: string;
18
- }
19
-
20
- export interface LoginResponse {
21
- /** 访问令牌 */
22
- token?: string;
23
- /** 刷新令牌 */
24
- refreshToken?: string;
25
- user?: AdminUser;
26
- /** 权限列表 */
27
- permissions?: string[];
28
- /** 角色ID列表 */
29
- roleIds?: string[];
30
- /** 授权版本�?*/
31
- authorizationRevision?: number;
32
- }
33
-
34
- export interface ProfileResponse {
35
- user?: AdminUser;
36
- permissions?: string[];
37
- roleIds?: string[];
38
- authorizationRevision?: number;
39
- }
40
-
41
- export interface AdminUser {
42
- id?: string;
43
- username?: string;
44
- name?: string;
45
- email?: string;
46
- department?: string;
47
- roleIds?: string[];
48
- roleNames?: string[];
49
- status?: "active" | "suspended";
50
- /** @format date-time */
51
- lastActiveAt?: string;
52
- /** @format date-time */
53
- createdAt?: string;
54
- /** @format date-time */
55
- updatedAt?: string;
56
- }
57
-
58
- export interface AdminUserDraft {
59
- username?: string;
60
- name: string;
61
- email?: string;
62
- department?: string;
63
- roleIds?: string[];
64
- status?: "active" | "suspended";
65
- password?: string;
66
- }
67
-
68
- export interface AdminRole {
69
- id?: string;
70
- name?: string;
71
- code?: string;
72
- description?: string;
73
- permissions?: string[];
74
- status?: "active" | "suspended";
75
- memberCount?: number;
76
- /** @format date-time */
77
- createdAt?: string;
78
- /** @format date-time */
79
- updatedAt?: string;
80
- }
81
-
82
- export interface AdminRoleDraft {
83
- name: string;
84
- code: string;
85
- description?: string;
86
- permissions?: string[];
87
- status?: "active" | "suspended";
88
- }
89
-
90
- export interface RbacMenu {
91
- id?: string;
92
- parentId?: string;
93
- kind?: "directory" | "page" | "button";
94
- code?: string;
95
- title?: string;
96
- path?: string;
97
- componentKey?: string;
98
- icon?: string;
99
- permission?: string;
100
- order?: number;
101
- status?: "active" | "suspended";
102
- visible?: boolean;
103
- cache?: boolean;
104
- tabHidden?: boolean;
105
- redirect?: string;
106
- children?: RbacMenu[];
107
- /** @format date-time */
108
- createdAt?: string;
109
- /** @format date-time */
110
- updatedAt?: string;
111
- }
112
-
113
- export interface RbacMenuDraft {
114
- parentId?: string;
115
- kind?: "directory" | "page" | "button";
116
- code?: string;
117
- title?: string;
118
- path?: string;
119
- componentKey?: string;
120
- icon?: string;
121
- permission?: string;
122
- order?: number;
123
- status?: "active" | "suspended";
124
- visible?: boolean;
125
- cache?: boolean;
126
- tabHidden?: boolean;
127
- redirect?: string;
128
- }
129
-
130
- export interface BackendMenuNode {
131
- code?: string;
132
- path?: string;
133
- title?: string;
134
- componentKey?: string;
135
- icon?: string;
136
- permissions?: string[];
137
- parentPath?: string;
138
- menu?: boolean;
139
- hidden?: boolean;
140
- order?: number;
141
- cache?: boolean;
142
- tabHidden?: boolean;
143
- redirect?: string;
144
- children?: BackendMenuNode[];
145
- }
146
-
147
- export interface RbacAuditEvent {
148
- id?: string;
149
- /** @format date-time */
150
- at?: string;
151
- actorId?: string;
152
- actorName?: string;
153
- action?: string;
154
- targetType?: "user" | "role" | "menu" | "authorization";
155
- targetId?: string;
156
- targetName?: string;
157
- detail?: string;
158
- }
159
-
160
- export interface OrderDraft {
161
- id?: string;
162
- orderNo?: string;
163
- customer?: string;
164
- status?: "draft" | "submitted";
165
- note?: string;
166
- lines?: OrderDraftLine[];
167
- totalAmount?: number;
168
- /** @format date-time */
169
- createdAt?: string;
170
- /** @format date-time */
171
- updatedAt?: string;
172
- }
173
-
174
- export interface OrderDraftDraft {
175
- customer?: string;
176
- status?: "draft" | "submitted";
177
- note?: string;
178
- lines?: OrderDraftLine[];
179
- }
180
-
181
- export interface OrderDraftLine {
182
- id?: string;
183
- sku?: string;
184
- name?: string;
185
- quantity?: number;
186
- unitPrice?: number;
187
- }
188
-
189
- export interface ContentArticle {
190
- id?: string;
191
- title?: string;
192
- summary?: string;
193
- status?: "draft" | "published";
194
- contentHtml?: string;
195
- coverUrl?: string;
196
- attachments?: ContentArticleAttachment[];
197
- /** @format date-time */
198
- createdAt?: string;
199
- /** @format date-time */
200
- updatedAt?: string;
201
- }
202
-
203
- export interface ContentArticleDraft {
204
- title?: string;
205
- summary?: string;
206
- status?: "draft" | "published";
207
- contentHtml?: string;
208
- coverUrl?: string;
209
- attachments?: ContentArticleAttachment[];
210
- }
211
-
212
- export interface ContentArticleAttachment {
213
- id?: string;
214
- name?: string;
215
- url?: string;
216
- type?: string;
217
- size?: number;
218
- }
219
-
220
- export interface UploadResponse {
221
- id?: string;
222
- name?: string;
223
- url?: string;
224
- type?: string;
225
- size?: number;
226
- }
227
-
228
- export interface PageResultAdminUser {
229
- list?: AdminUser[];
230
- total?: number;
231
- page?: number;
232
- pageSize?: number;
233
- }
234
-
235
- export interface PageResultAdminRole {
236
- list?: AdminRole[];
237
- total?: number;
238
- page?: number;
239
- pageSize?: number;
240
- }
241
-
242
- export interface PageResultRbacMenu {
243
- list?: RbacMenu[];
244
- total?: number;
245
- page?: number;
246
- pageSize?: number;
247
- }
248
-
249
- export interface PageResultRbacAuditEvent {
250
- list?: RbacAuditEvent[];
251
- total?: number;
252
- page?: number;
253
- pageSize?: number;
254
- }
255
-
256
- export interface PageResultOrderDraft {
257
- list?: OrderDraft[];
258
- total?: number;
259
- page?: number;
260
- pageSize?: number;
261
- }
262
-
263
- export interface PageResultContentArticle {
264
- list?: ContentArticle[];
265
- total?: number;
266
- page?: number;
267
- pageSize?: number;
268
- }
@@ -1,266 +0,0 @@
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
- }
@@ -1,147 +0,0 @@
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
- }