@origen-ui/admin-cli 1.1.0 → 2.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 (175) hide show
  1. package/README.md +41 -9
  2. package/package.json +26 -2
  3. package/templates/current/clean/.node-version +1 -0
  4. package/templates/current/clean/CHANGELOG.md +125 -0
  5. package/templates/current/clean/README.md +2 -1
  6. package/templates/current/clean/component-catalog.json +58 -17
  7. package/templates/current/clean/e2e/admin-shell.spec.ts +6 -0
  8. package/templates/current/clean/e2e/demo-shell.spec.ts +94 -50
  9. package/templates/current/clean/package.json +39 -25
  10. package/templates/current/clean/playwright.config.ts +1 -0
  11. package/templates/current/clean/playwright.demo.config.ts +1 -1
  12. package/templates/current/clean/pnpm-workspace.yaml +18 -0
  13. package/templates/current/clean/scaffold.lock.json +2 -2
  14. package/templates/current/clean/scripts/check-admin-scaffold.mjs +5 -1
  15. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +7 -2
  16. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +7 -2
  17. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +7 -2
  18. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +11 -2
  19. package/templates/current/clean/scripts/clean-overlay/src/main.ts +23 -14
  20. package/templates/current/clean/scripts/clean-overlay/src/router/componentCache.ts +12 -0
  21. package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +2 -13
  22. package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +34 -4
  23. package/templates/current/clean/scripts/clean-overlay/src/router/paths.ts +21 -0
  24. package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +6 -6
  25. package/templates/current/clean/scripts/demo-api.ts +88 -12
  26. package/templates/current/clean/scripts/generate-api.ts +87 -3
  27. package/templates/current/clean/scripts/remove-examples.mjs +4 -4
  28. package/templates/current/clean/scripts/vite-build-policy.spec.ts +1 -0
  29. package/templates/current/clean/src/api/generated/data-contracts.ts +2 -5
  30. package/templates/current/clean/src/api/generated/http-client.ts +28 -26
  31. 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 +5 -8
  32. 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 +1 -4
  33. 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 +2 -5
  34. 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 +8 -10
  35. 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 +11 -12
  36. 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 +8 -10
  37. 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 +8 -10
  38. package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +3 -6
  39. package/templates/current/clean/src/app/errorMessage.spec.ts +76 -0
  40. package/templates/current/clean/src/app/errorMessage.ts +53 -0
  41. package/templates/current/clean/src/app/menu-host.spec.ts +77 -0
  42. package/templates/current/clean/src/app/menu.spec.ts +39 -0
  43. package/templates/current/clean/src/app/menu.ts +48 -12
  44. package/templates/current/clean/src/app/runtimeConfig.ts +1 -1
  45. package/templates/current/clean/src/demo-api.spec.ts +314 -3
  46. package/templates/current/clean/src/features/auth/pages/Login.vue +9 -2
  47. package/templates/current/clean/src/features/auth/store/auth.ts +6 -19
  48. package/templates/current/clean/src/features/errors/pages/Forbidden.vue +7 -2
  49. package/templates/current/clean/src/features/errors/pages/NotFound.vue +7 -2
  50. package/templates/current/clean/src/features/errors/pages/ServerError.vue +7 -2
  51. package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +11 -2
  52. package/templates/current/clean/src/features/system/access/api/admin-repository.ts +2 -6
  53. package/templates/current/clean/src/features/system/access/api/rbac.ts +19 -9
  54. package/templates/current/clean/src/features/system/access/composables/useAuthorizationPolling.spec.ts +134 -0
  55. package/templates/current/clean/src/features/system/access/composables/useAuthorizationPolling.ts +96 -0
  56. package/templates/current/clean/src/features/workspace/pages/Profile.vue +1 -1
  57. package/templates/current/clean/src/layouts/AdminLayout.vue +3 -0
  58. package/templates/current/clean/src/layouts/TopBar.vue +37 -6
  59. package/templates/current/clean/src/layouts/topBarMenuSearch.spec.ts +24 -1
  60. package/templates/current/clean/src/layouts/topBarMenuSearch.ts +10 -0
  61. package/templates/current/clean/src/locales/en-US.json +30 -3
  62. package/templates/current/clean/src/locales/en-US.runtime.ts +2 -0
  63. package/templates/current/clean/src/locales/index.ts +39 -26
  64. package/templates/current/clean/src/locales/zh-CN.json +30 -3
  65. package/templates/current/clean/src/locales/zh-CN.runtime.ts +2 -0
  66. package/templates/current/clean/src/locales/zh-TW.json +30 -3
  67. package/templates/current/clean/src/locales/zh-TW.runtime.ts +2 -0
  68. package/templates/current/clean/src/main.ts +23 -14
  69. package/templates/current/clean/src/router/bootstrap.ts +10 -16
  70. package/templates/current/clean/src/router/componentCache.ts +12 -0
  71. package/templates/current/clean/src/router/componentRegistry.ts +2 -13
  72. package/templates/current/clean/src/router/dynamicMenuRefresh.spec.ts +101 -0
  73. package/templates/current/clean/src/router/dynamicMenuRefresh.ts +24 -0
  74. package/templates/current/clean/src/router/dynamicRoutes.spec.ts +34 -4
  75. package/templates/current/clean/src/router/dynamicRoutes.ts +14 -3
  76. package/templates/current/clean/src/router/paths.spec.ts +50 -0
  77. package/templates/current/clean/src/router/paths.ts +21 -0
  78. package/templates/current/clean/src/router/queryEncryption.spec.ts +10 -1
  79. package/templates/current/clean/src/router/routeQuery.spec.ts +2 -1
  80. package/templates/current/clean/src/router/routeQuery.ts +4 -1
  81. package/templates/current/clean/src/router/staticRoutes.ts +6 -6
  82. package/templates/current/clean/src/templates/og-table.ts +2 -4
  83. package/templates/current/clean/tsconfig.json +0 -1
  84. package/templates/current/clean/vite.build-policy.ts +55 -8
  85. package/templates/current/clean/vite.config.ts +30 -0
  86. package/templates/current/examples/.node-version +1 -0
  87. package/templates/current/examples/CHANGELOG.md +125 -0
  88. package/templates/current/examples/README.md +2 -1
  89. package/templates/current/examples/component-catalog.json +58 -17
  90. package/templates/current/examples/e2e/admin-shell.spec.ts +6 -0
  91. package/templates/current/examples/e2e/demo-shell.spec.ts +94 -50
  92. package/templates/current/examples/package.json +39 -25
  93. package/templates/current/examples/playwright.config.ts +1 -0
  94. package/templates/current/examples/playwright.demo.config.ts +1 -1
  95. package/templates/current/examples/pnpm-workspace.yaml +18 -0
  96. package/templates/current/examples/scaffold.lock.json +2 -2
  97. package/templates/current/examples/scripts/check-admin-scaffold.mjs +5 -1
  98. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +7 -2
  99. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +7 -2
  100. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +7 -2
  101. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +11 -2
  102. package/templates/current/examples/scripts/clean-overlay/src/main.ts +23 -14
  103. package/templates/current/examples/scripts/clean-overlay/src/router/componentCache.ts +12 -0
  104. package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +2 -13
  105. package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +34 -4
  106. package/templates/current/examples/scripts/clean-overlay/src/router/paths.ts +21 -0
  107. package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +6 -6
  108. package/templates/current/examples/scripts/demo-api.ts +88 -12
  109. package/templates/current/examples/scripts/generate-api.ts +87 -3
  110. package/templates/current/examples/scripts/remove-examples.mjs +4 -4
  111. package/templates/current/examples/scripts/vite-build-policy.spec.ts +1 -0
  112. package/templates/current/examples/src/api/generated/data-contracts.ts +2 -5
  113. package/templates/current/examples/src/api/generated/http-client.ts +28 -26
  114. 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 +5 -8
  115. 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 +1 -4
  116. 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 +2 -5
  117. 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 +8 -10
  118. 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 +11 -12
  119. 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 +8 -10
  120. 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 +8 -10
  121. package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +3 -6
  122. package/templates/current/examples/src/app/errorMessage.spec.ts +76 -0
  123. package/templates/current/examples/src/app/errorMessage.ts +53 -0
  124. package/templates/current/examples/src/app/menu-host.spec.ts +77 -0
  125. package/templates/current/examples/src/app/menu.spec.ts +39 -0
  126. package/templates/current/examples/src/app/menu.ts +48 -12
  127. package/templates/current/examples/src/app/runtimeConfig.ts +1 -1
  128. package/templates/current/examples/src/demo-api.spec.ts +314 -3
  129. package/templates/current/examples/src/features/auth/pages/Login.vue +9 -2
  130. package/templates/current/examples/src/features/auth/store/auth.ts +6 -19
  131. package/templates/current/examples/src/features/errors/pages/Forbidden.vue +2 -1
  132. package/templates/current/examples/src/features/errors/pages/NotFound.vue +2 -1
  133. package/templates/current/examples/src/features/errors/pages/ServerError.vue +2 -1
  134. package/templates/current/examples/src/features/feature-composables.spec.ts +11 -1
  135. package/templates/current/examples/src/features/system/access/api/admin-repository.ts +2 -6
  136. package/templates/current/examples/src/features/system/access/api/rbac.ts +19 -9
  137. package/templates/current/examples/src/features/system/access/composables/useAuthorizationPolling.spec.ts +134 -0
  138. package/templates/current/examples/src/features/system/access/composables/useAuthorizationPolling.ts +96 -0
  139. package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +115 -28
  140. package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +162 -66
  141. package/templates/current/examples/src/features/system/menus/menuDraft.spec.ts +204 -0
  142. package/templates/current/examples/src/features/system/menus/menuDraft.ts +116 -0
  143. package/templates/current/examples/src/features/system/menus/menuTreePrecheck.spec.ts +268 -0
  144. package/templates/current/examples/src/features/system/menus/menuTreePrecheck.ts +317 -0
  145. package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +1 -0
  146. package/templates/current/examples/src/features/workspace/pages/Profile.vue +1 -1
  147. package/templates/current/examples/src/layouts/AdminLayout.vue +3 -0
  148. package/templates/current/examples/src/layouts/TopBar.vue +37 -6
  149. package/templates/current/examples/src/layouts/topBarMenuSearch.spec.ts +24 -1
  150. package/templates/current/examples/src/layouts/topBarMenuSearch.ts +10 -0
  151. package/templates/current/examples/src/locales/en-US.json +30 -3
  152. package/templates/current/examples/src/locales/en-US.runtime.ts +2 -0
  153. package/templates/current/examples/src/locales/index.ts +39 -26
  154. package/templates/current/examples/src/locales/zh-CN.json +30 -3
  155. package/templates/current/examples/src/locales/zh-CN.runtime.ts +2 -0
  156. package/templates/current/examples/src/locales/zh-TW.json +30 -3
  157. package/templates/current/examples/src/locales/zh-TW.runtime.ts +2 -0
  158. package/templates/current/examples/src/main.ts +24 -22
  159. package/templates/current/examples/src/router/bootstrap.ts +10 -16
  160. package/templates/current/examples/src/router/componentCache.ts +18 -0
  161. package/templates/current/examples/src/router/componentRegistry.ts +1 -18
  162. package/templates/current/examples/src/router/dynamicMenuRefresh.spec.ts +101 -0
  163. package/templates/current/examples/src/router/dynamicMenuRefresh.ts +24 -0
  164. package/templates/current/examples/src/router/dynamicRoutes.spec.ts +20 -2
  165. package/templates/current/examples/src/router/dynamicRoutes.ts +14 -3
  166. package/templates/current/examples/src/router/paths.spec.ts +50 -0
  167. package/templates/current/examples/src/router/paths.ts +21 -0
  168. package/templates/current/examples/src/router/queryEncryption.spec.ts +10 -1
  169. package/templates/current/examples/src/router/routeQuery.spec.ts +2 -1
  170. package/templates/current/examples/src/router/routeQuery.ts +4 -1
  171. package/templates/current/examples/src/router/staticRoutes.ts +3 -3
  172. package/templates/current/examples/src/templates/og-table.ts +2 -4
  173. package/templates/current/examples/tsconfig.json +0 -1
  174. package/templates/current/examples/vite.build-policy.ts +55 -8
  175. package/templates/current/examples/vite.config.ts +30 -0
@@ -1,3 +1,4 @@
1
+ import { readdir, readFile, writeFile } from 'node:fs/promises'
1
2
  import path from 'node:path'
2
3
  import { fileURLToPath } from 'node:url'
3
4
  // 使用 swagger-typescript-api 从 OpenAPI 规范生成 API 客户端
@@ -6,10 +7,11 @@ import { generateApi } from 'swagger-typescript-api'
6
7
  /* eslint-disable node/prefer-global/process */
7
8
 
8
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url))
10
+ const outputDirectory = path.resolve(__dirname, '../src/api/generated')
9
11
 
10
12
  generateApi({
11
13
  name: 'Api.ts',
12
- output: path.resolve(__dirname, '../src/api/generated'),
14
+ output: outputDirectory,
13
15
  input: path.resolve(__dirname, '../openapi.json'),
14
16
  modular: true,
15
17
  moduleNameFirstTag: true,
@@ -18,10 +20,92 @@ generateApi({
18
20
  singleHttpClient: true,
19
21
  cleanOutput: true,
20
22
  })
23
+ .then(() => normalizeGeneratedApi(outputDirectory))
21
24
  .then(() => {
22
25
  process.stdout.write('API client generated successfully!\n')
23
26
  })
24
- .catch((e) => {
25
- console.error('Failed to generate API client:', e)
27
+ .catch((error) => {
28
+ console.error('Failed to generate API client:', error)
26
29
  process.exit(1)
27
30
  })
31
+
32
+ async function normalizeGeneratedApi(directory: string) {
33
+ for (const entry of await readdir(directory, { withFileTypes: true })) {
34
+ if (!entry.isFile() || !entry.name.endsWith('.ts')) continue
35
+ const filePath = path.join(directory, entry.name)
36
+ const source = await readFile(filePath, 'utf8')
37
+ const normalized = normalizeGeneratedSource(source, entry.name)
38
+ if (normalized !== source) await writeFile(filePath, normalized, 'utf8')
39
+ }
40
+ }
41
+
42
+ function normalizeGeneratedSource(source: string, fileName: string) {
43
+ let normalized = source
44
+ .replace(/^\/\* eslint-disable \*\/\r?\n/u, '')
45
+ .replace(/^\/\* tslint:disable \*\/\r?\n/u, '')
46
+ .replace(/^\/\/ @ts-nocheck\r?\n/u, '')
47
+ .replace(/\bany\b/gu, 'unknown')
48
+
49
+ if (fileName === 'http-client.ts') normalized = normalizeHttpClient(normalized)
50
+ return normalized
51
+ }
52
+
53
+ function normalizeHttpClient(source: string) {
54
+ let normalized = source.replace(
55
+ ' return value.map((v: unknown) => this.encodeQueryParam(key, v)).join("&");',
56
+ ' if (!Array.isArray(value)) return "";\n return value.map((v) => this.encodeQueryParam(key, v)).join("&");',
57
+ )
58
+
59
+ const formatterStart = normalized.indexOf(' private contentFormatters:')
60
+ const formatterEnd = normalized.indexOf('\n\n protected mergeRequestParams', formatterStart)
61
+ if (formatterStart < 0 || formatterEnd < 0)
62
+ throw new Error('Generated HTTP client formatters changed unexpectedly.')
63
+
64
+ const formatter = ` private contentFormatters: Record<ContentType, (input: unknown) => BodyInit | null> = {
65
+ [ContentType.Json]: (input: unknown) =>
66
+ input === null || typeof input === "undefined"
67
+ ? null
68
+ : JSON.stringify(input) ?? null,
69
+ [ContentType.JsonApi]: (input: unknown) =>
70
+ input === null || typeof input === "undefined"
71
+ ? null
72
+ : JSON.stringify(input) ?? null,
73
+ [ContentType.Text]: (input: unknown) =>
74
+ typeof input === "string" ? input : JSON.stringify(input) ?? null,
75
+ [ContentType.FormData]: (input: unknown) => {
76
+ if (input instanceof FormData) {
77
+ return input;
78
+ }
79
+
80
+ const record = isRecord(input) ? input : {};
81
+ return Object.keys(record).reduce((formData, key) => {
82
+ const property = record[key];
83
+ formData.append(
84
+ key,
85
+ property instanceof Blob
86
+ ? property
87
+ : typeof property === "object" && property !== null
88
+ ? JSON.stringify(property) ?? ""
89
+ : String(property),
90
+ );
91
+ return formData;
92
+ }, new FormData());
93
+ },
94
+ [ContentType.UrlEncoded]: (input: unknown) =>
95
+ this.toQueryString(isRecord(input) ? input : {}),
96
+ };`
97
+ normalized = `${normalized.slice(0, formatterStart)}${formatter}${normalized.slice(formatterEnd)}`
98
+
99
+ const classMarker = 'export class HttpClient<SecurityDataType = unknown> {'
100
+ if (!normalized.includes('function isRecord(value: unknown): value is Record<string, unknown>')) {
101
+ normalized = normalized.replace(
102
+ classMarker,
103
+ `function isRecord(value: unknown): value is Record<string, unknown> {
104
+ return typeof value === "object" && value !== null;
105
+ }
106
+
107
+ ${classMarker}`,
108
+ )
109
+ }
110
+ return normalized
111
+ }
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync } from 'node:fs'
3
3
  import { cp, rm } from 'node:fs/promises'
4
- import { dirname, resolve } from 'node:path'
4
+ import { resolve } from 'node:path'
5
5
  import process from 'node:process'
6
- import { fileURLToPath } from 'node:url'
6
+ import { REPOSITORY_ROOT } from '../../lib/repository-root.mjs'
7
7
 
8
8
  const args = new Set(process.argv.slice(2))
9
9
  const rootIndex = process.argv.indexOf('--root')
10
10
  const root = rootIndex >= 0 ? resolve(process.argv[rootIndex + 1] || '.') : process.cwd()
11
11
  const dryRun = args.has('--dry-run')
12
12
  const overlayIndex = process.argv.indexOf('--overlay')
13
+ const repositoryRoot = REPOSITORY_ROOT
13
14
  const repositoryOverlay = resolve(
14
- dirname(fileURLToPath(import.meta.url)),
15
- '..',
15
+ repositoryRoot,
16
16
  'apps',
17
17
  'admin',
18
18
  'scaffold',
@@ -23,6 +23,7 @@ describe('admin build chunk policy', () => {
23
23
  'vendor-vue-i18n',
24
24
  'vendor-vueuse',
25
25
  'vendor-positioning',
26
+ 'vendor-async-validator',
26
27
  'vendor-table-suite',
27
28
  'vendor-initial',
28
29
  ]),
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -11,7 +8,7 @@
11
8
  */
12
9
 
13
10
  export interface LoginCredentials {
14
- /** 用户�?*/
11
+ /** 用户名 */
15
12
  username: string;
16
13
  /** 密码 */
17
14
  password: string;
@@ -27,7 +24,7 @@ export interface LoginResponse {
27
24
  permissions?: string[];
28
25
  /** 角色ID列表 */
29
26
  roleIds?: string[];
30
- /** 授权版本�?*/
27
+ /** 授权版本号 */
31
28
  authorizationRevision?: number;
32
29
  }
33
30
 
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -10,7 +7,7 @@
10
7
  * ---------------------------------------------------------------
11
8
  */
12
9
 
13
- export type QueryParamsType = Record<string | number, any>;
10
+ export type QueryParamsType = Record<string | number, unknown>;
14
11
  export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
15
12
 
16
13
  export interface FullRequestParams extends Omit<RequestInit, "body"> {
@@ -62,6 +59,10 @@ export enum ContentType {
62
59
  Text = "text/plain",
63
60
  }
64
61
 
62
+ function isRecord(value: unknown): value is Record<string, unknown> {
63
+ return typeof value === "object" && value !== null;
64
+ }
65
+
65
66
  export class HttpClient<SecurityDataType = unknown> {
66
67
  public baseUrl: string = "/api";
67
68
  private securityData: SecurityDataType | null = null;
@@ -85,7 +86,7 @@ export class HttpClient<SecurityDataType = unknown> {
85
86
  this.securityData = data;
86
87
  };
87
88
 
88
- protected encodeQueryParam(key: string, value: any) {
89
+ protected encodeQueryParam(key: string, value: unknown) {
89
90
  const encodedKey = encodeURIComponent(key);
90
91
  return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
91
92
  }
@@ -96,7 +97,8 @@ export class HttpClient<SecurityDataType = unknown> {
96
97
 
97
98
  protected addArrayQueryParam(query: QueryParamsType, key: string) {
98
99
  const value = query[key];
99
- return value.map((v: any) => this.encodeQueryParam(key, v)).join("&");
100
+ if (!Array.isArray(value)) return "";
101
+ return value.map((v) => this.encodeQueryParam(key, v)).join("&");
100
102
  }
101
103
 
102
104
  protected toQueryString(rawQuery?: QueryParamsType): string {
@@ -118,38 +120,38 @@ export class HttpClient<SecurityDataType = unknown> {
118
120
  return queryString ? `?${queryString}` : "";
119
121
  }
120
122
 
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) => {
123
+ private contentFormatters: Record<ContentType, (input: unknown) => BodyInit | null> = {
124
+ [ContentType.Json]: (input: unknown) =>
125
+ input === null || typeof input === "undefined"
126
+ ? null
127
+ : JSON.stringify(input) ?? null,
128
+ [ContentType.JsonApi]: (input: unknown) =>
129
+ input === null || typeof input === "undefined"
130
+ ? null
131
+ : JSON.stringify(input) ?? null,
132
+ [ContentType.Text]: (input: unknown) =>
133
+ typeof input === "string" ? input : JSON.stringify(input) ?? null,
134
+ [ContentType.FormData]: (input: unknown) => {
135
135
  if (input instanceof FormData) {
136
136
  return input;
137
137
  }
138
138
 
139
- return Object.keys(input || {}).reduce((formData, key) => {
140
- const property = input[key];
139
+ const record = isRecord(input) ? input : {};
140
+ return Object.keys(record).reduce((formData, key) => {
141
+ const property = record[key];
141
142
  formData.append(
142
143
  key,
143
144
  property instanceof Blob
144
145
  ? property
145
146
  : typeof property === "object" && property !== null
146
- ? JSON.stringify(property)
147
- : `${property}`,
147
+ ? JSON.stringify(property) ?? ""
148
+ : String(property),
148
149
  );
149
150
  return formData;
150
151
  }, new FormData());
151
152
  },
152
- [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
153
+ [ContentType.UrlEncoded]: (input: unknown) =>
154
+ this.toQueryString(isRecord(input) ? input : {}),
153
155
  };
154
156
 
155
157
  protected mergeRequestParams(
@@ -193,7 +195,7 @@ export class HttpClient<SecurityDataType = unknown> {
193
195
  }
194
196
  };
195
197
 
196
- public request = async <T = any, E = any>({
198
+ public request = async <T = unknown, E = unknown>({
197
199
  body,
198
200
  secure,
199
201
  path,
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -47,7 +44,7 @@ export class 系统管理内容文章<SecurityDataType = unknown> {
47
44
  },
48
45
  params: RequestParams = {},
49
46
  ) =>
50
- this.http.request<PageResultContentArticle, any>({
47
+ this.http.request<PageResultContentArticle, unknown>({
51
48
  path: `/system/content-articles`,
52
49
  method: "GET",
53
50
  query: query,
@@ -69,7 +66,7 @@ export class 系统管理内容文章<SecurityDataType = unknown> {
69
66
  data: ContentArticleDraft,
70
67
  params: RequestParams = {},
71
68
  ) =>
72
- this.http.request<ContentArticle, any>({
69
+ this.http.request<ContentArticle, unknown>({
73
70
  path: `/system/content-articles`,
74
71
  method: "POST",
75
72
  body: data,
@@ -94,7 +91,7 @@ export class 系统管理内容文章<SecurityDataType = unknown> {
94
91
  },
95
92
  params: RequestParams = {},
96
93
  ) =>
97
- this.http.request<void, any>({
94
+ this.http.request<void, unknown>({
98
95
  path: `/system/content-articles`,
99
96
  method: "DELETE",
100
97
  body: data,
@@ -113,7 +110,7 @@ export class 系统管理内容文章<SecurityDataType = unknown> {
113
110
  * @response `200` `ContentArticle` 成功
114
111
  */
115
112
  contentArticlesDetail = (id: string, params: RequestParams = {}) =>
116
- this.http.request<ContentArticle, any>({
113
+ this.http.request<ContentArticle, unknown>({
117
114
  path: `/system/content-articles/${id}`,
118
115
  method: "GET",
119
116
  secure: true,
@@ -135,7 +132,7 @@ export class 系统管理内容文章<SecurityDataType = unknown> {
135
132
  data: ContentArticleDraft,
136
133
  params: RequestParams = {},
137
134
  ) =>
138
- this.http.request<ContentArticle, any>({
135
+ this.http.request<ContentArticle, unknown>({
139
136
  path: `/system/content-articles/${id}`,
140
137
  method: "PUT",
141
138
  body: data,
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -42,7 +39,7 @@ export class 系统管理审计<SecurityDataType = unknown> {
42
39
  },
43
40
  params: RequestParams = {},
44
41
  ) =>
45
- this.http.request<PageResultRbacAuditEvent, any>({
42
+ this.http.request<PageResultRbacAuditEvent, unknown>({
46
43
  path: `/system/audit`,
47
44
  method: "GET",
48
45
  query: query,
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -37,7 +34,7 @@ export class 系统管理文件上传<SecurityDataType = unknown> {
37
34
  },
38
35
  params: RequestParams = {},
39
36
  ) =>
40
- this.http.request<UploadResponse, any>({
37
+ this.http.request<UploadResponse, unknown>({
41
38
  path: `/system/uploads`,
42
39
  method: "POST",
43
40
  body: data,
@@ -57,7 +54,7 @@ export class 系统管理文件上传<SecurityDataType = unknown> {
57
54
  * @response `204` `void` 删除成功
58
55
  */
59
56
  uploadsDelete = (id: string, params: RequestParams = {}) =>
60
- this.http.request<void, any>({
57
+ this.http.request<void, unknown>({
61
58
  path: `/system/uploads/${id}`,
62
59
  method: "DELETE",
63
60
  secure: true,
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -50,7 +47,7 @@ export class 系统管理用户<SecurityDataType = unknown> {
50
47
  },
51
48
  params: RequestParams = {},
52
49
  ) =>
53
- this.http.request<PageResultAdminUser, any>({
50
+ this.http.request<PageResultAdminUser, unknown>({
54
51
  path: `/system/users`,
55
52
  method: "GET",
56
53
  query: query,
@@ -69,7 +66,7 @@ export class 系统管理用户<SecurityDataType = unknown> {
69
66
  * @response `200` `AdminUser` 创建成功
70
67
  */
71
68
  usersCreate = (data: AdminUserDraft, params: RequestParams = {}) =>
72
- this.http.request<AdminUser, any>({
69
+ this.http.request<AdminUser, unknown>({
73
70
  path: `/system/users`,
74
71
  method: "POST",
75
72
  body: data,
@@ -94,7 +91,7 @@ export class 系统管理用户<SecurityDataType = unknown> {
94
91
  },
95
92
  params: RequestParams = {},
96
93
  ) =>
97
- this.http.request<void, any>({
94
+ this.http.request<void, unknown>({
98
95
  path: `/system/users`,
99
96
  method: "DELETE",
100
97
  body: data,
@@ -113,7 +110,7 @@ export class 系统管理用户<SecurityDataType = unknown> {
113
110
  * @response `200` `AdminUser` 成功
114
111
  */
115
112
  usersDetail = (id: string, params: RequestParams = {}) =>
116
- this.http.request<AdminUser, any>({
113
+ this.http.request<AdminUser, unknown>({
117
114
  path: `/system/users/${id}`,
118
115
  method: "GET",
119
116
  secure: true,
@@ -135,7 +132,7 @@ export class 系统管理用户<SecurityDataType = unknown> {
135
132
  data: AdminUserDraft,
136
133
  params: RequestParams = {},
137
134
  ) =>
138
- this.http.request<AdminUser, any>({
135
+ this.http.request<AdminUser, unknown>({
139
136
  path: `/system/users/${id}`,
140
137
  method: "PUT",
141
138
  body: data,
@@ -149,7 +146,8 @@ export class 系统管理用户<SecurityDataType = unknown> {
149
146
  *
150
147
  * @tags 系统管理-用户
151
148
  * @name UsersStatusPartialUpdate
152
- * @summary 批量更新用户状�? * @request PATCH:/system/users/status
149
+ * @summary 批量更新用户状态
150
+ * @request PATCH:/system/users/status
153
151
  * @secure
154
152
  * @response `204` `void` 更新成功
155
153
  */
@@ -160,7 +158,7 @@ export class 系统管理用户<SecurityDataType = unknown> {
160
158
  },
161
159
  params: RequestParams = {},
162
160
  ) =>
163
- this.http.request<void, any>({
161
+ this.http.request<void, unknown>({
164
162
  path: `/system/users/status`,
165
163
  method: "PATCH",
166
164
  body: data,
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -30,12 +27,13 @@ export class 系统管理菜单<SecurityDataType = unknown> {
30
27
  *
31
28
  * @tags 系统管理-菜单
32
29
  * @name MenusTreeList
33
- * @summary 获取菜单�? * @request GET:/system/menus/tree
30
+ * @summary 获取菜单树
31
+ * @request GET:/system/menus/tree
34
32
  * @secure
35
33
  * @response `200` `(BackendMenuNode)[]` 成功
36
34
  */
37
35
  menusTreeList = (params: RequestParams = {}) =>
38
- this.http.request<BackendMenuNode[], any>({
36
+ this.http.request<BackendMenuNode[], unknown>({
39
37
  path: `/system/menus/tree`,
40
38
  method: "GET",
41
39
  secure: true,
@@ -64,7 +62,7 @@ export class 系统管理菜单<SecurityDataType = unknown> {
64
62
  },
65
63
  params: RequestParams = {},
66
64
  ) =>
67
- this.http.request<PageResultRbacMenu, any>({
65
+ this.http.request<PageResultRbacMenu, unknown>({
68
66
  path: `/system/menus`,
69
67
  method: "GET",
70
68
  query: query,
@@ -83,7 +81,7 @@ export class 系统管理菜单<SecurityDataType = unknown> {
83
81
  * @response `200` `RbacMenu` 创建成功
84
82
  */
85
83
  menusCreate = (data: RbacMenuDraft, params: RequestParams = {}) =>
86
- this.http.request<RbacMenu, any>({
84
+ this.http.request<RbacMenu, unknown>({
87
85
  path: `/system/menus`,
88
86
  method: "POST",
89
87
  body: data,
@@ -108,7 +106,7 @@ export class 系统管理菜单<SecurityDataType = unknown> {
108
106
  },
109
107
  params: RequestParams = {},
110
108
  ) =>
111
- this.http.request<void, any>({
109
+ this.http.request<void, unknown>({
112
110
  path: `/system/menus`,
113
111
  method: "DELETE",
114
112
  body: data,
@@ -127,7 +125,7 @@ export class 系统管理菜单<SecurityDataType = unknown> {
127
125
  * @response `200` `RbacMenu` 成功
128
126
  */
129
127
  menusDetail = (id: string, params: RequestParams = {}) =>
130
- this.http.request<RbacMenu, any>({
128
+ this.http.request<RbacMenu, unknown>({
131
129
  path: `/system/menus/${id}`,
132
130
  method: "GET",
133
131
  secure: true,
@@ -145,7 +143,7 @@ export class 系统管理菜单<SecurityDataType = unknown> {
145
143
  * @response `200` `RbacMenu` 更新成功
146
144
  */
147
145
  menusUpdate = (id: string, data: RbacMenuDraft, params: RequestParams = {}) =>
148
- this.http.request<RbacMenu, any>({
146
+ this.http.request<RbacMenu, unknown>({
149
147
  path: `/system/menus/${id}`,
150
148
  method: "PUT",
151
149
  body: data,
@@ -159,7 +157,8 @@ export class 系统管理菜单<SecurityDataType = unknown> {
159
157
  *
160
158
  * @tags 系统管理-菜单
161
159
  * @name MenusStatusPartialUpdate
162
- * @summary 批量更新菜单状�? * @request PATCH:/system/menus/status
160
+ * @summary 批量更新菜单状态
161
+ * @request PATCH:/system/menus/status
163
162
  * @secure
164
163
  * @response `204` `void` 更新成功
165
164
  */
@@ -170,7 +169,7 @@ export class 系统管理菜单<SecurityDataType = unknown> {
170
169
  },
171
170
  params: RequestParams = {},
172
171
  ) =>
173
- this.http.request<void, any>({
172
+ this.http.request<void, unknown>({
174
173
  path: `/system/menus/status`,
175
174
  method: "PATCH",
176
175
  body: data,
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -48,7 +45,7 @@ export class 系统管理角色<SecurityDataType = unknown> {
48
45
  },
49
46
  params: RequestParams = {},
50
47
  ) =>
51
- this.http.request<PageResultAdminRole, any>({
48
+ this.http.request<PageResultAdminRole, unknown>({
52
49
  path: `/system/roles`,
53
50
  method: "GET",
54
51
  query: query,
@@ -67,7 +64,7 @@ export class 系统管理角色<SecurityDataType = unknown> {
67
64
  * @response `200` `AdminRole` 创建成功
68
65
  */
69
66
  rolesCreate = (data: AdminRoleDraft, params: RequestParams = {}) =>
70
- this.http.request<AdminRole, any>({
67
+ this.http.request<AdminRole, unknown>({
71
68
  path: `/system/roles`,
72
69
  method: "POST",
73
70
  body: data,
@@ -92,7 +89,7 @@ export class 系统管理角色<SecurityDataType = unknown> {
92
89
  },
93
90
  params: RequestParams = {},
94
91
  ) =>
95
- this.http.request<void, any>({
92
+ this.http.request<void, unknown>({
96
93
  path: `/system/roles`,
97
94
  method: "DELETE",
98
95
  body: data,
@@ -111,7 +108,7 @@ export class 系统管理角色<SecurityDataType = unknown> {
111
108
  * @response `200` `AdminRole` 成功
112
109
  */
113
110
  rolesDetail = (id: string, params: RequestParams = {}) =>
114
- this.http.request<AdminRole, any>({
111
+ this.http.request<AdminRole, unknown>({
115
112
  path: `/system/roles/${id}`,
116
113
  method: "GET",
117
114
  secure: true,
@@ -133,7 +130,7 @@ export class 系统管理角色<SecurityDataType = unknown> {
133
130
  data: AdminRoleDraft,
134
131
  params: RequestParams = {},
135
132
  ) =>
136
- this.http.request<AdminRole, any>({
133
+ this.http.request<AdminRole, unknown>({
137
134
  path: `/system/roles/${id}`,
138
135
  method: "PUT",
139
136
  body: data,
@@ -147,7 +144,8 @@ export class 系统管理角色<SecurityDataType = unknown> {
147
144
  *
148
145
  * @tags 系统管理-角色
149
146
  * @name RolesStatusPartialUpdate
150
- * @summary 批量更新角色状�? * @request PATCH:/system/roles/status
147
+ * @summary 批量更新角色状态
148
+ * @request PATCH:/system/roles/status
151
149
  * @secure
152
150
  * @response `204` `void` 更新成功
153
151
  */
@@ -158,7 +156,7 @@ export class 系统管理角色<SecurityDataType = unknown> {
158
156
  },
159
157
  params: RequestParams = {},
160
158
  ) =>
161
- this.http.request<void, any>({
159
+ this.http.request<void, unknown>({
162
160
  path: `/system/roles/status`,
163
161
  method: "PATCH",
164
162
  body: data,
@@ -1,6 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
1
  /*
5
2
  * ---------------------------------------------------------------
6
3
  * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -48,7 +45,7 @@ export class 系统管理订单草稿<SecurityDataType = unknown> {
48
45
  },
49
46
  params: RequestParams = {},
50
47
  ) =>
51
- this.http.request<PageResultOrderDraft, any>({
48
+ this.http.request<PageResultOrderDraft, unknown>({
52
49
  path: `/system/order-drafts`,
53
50
  method: "GET",
54
51
  query: query,
@@ -67,7 +64,7 @@ export class 系统管理订单草稿<SecurityDataType = unknown> {
67
64
  * @response `200` `OrderDraft` 创建成功
68
65
  */
69
66
  orderDraftsCreate = (data: OrderDraftDraft, params: RequestParams = {}) =>
70
- this.http.request<OrderDraft, any>({
67
+ this.http.request<OrderDraft, unknown>({
71
68
  path: `/system/order-drafts`,
72
69
  method: "POST",
73
70
  body: data,
@@ -92,7 +89,7 @@ export class 系统管理订单草稿<SecurityDataType = unknown> {
92
89
  },
93
90
  params: RequestParams = {},
94
91
  ) =>
95
- this.http.request<void, any>({
92
+ this.http.request<void, unknown>({
96
93
  path: `/system/order-drafts`,
97
94
  method: "DELETE",
98
95
  body: data,
@@ -111,7 +108,7 @@ export class 系统管理订单草稿<SecurityDataType = unknown> {
111
108
  * @response `200` `OrderDraft` 成功
112
109
  */
113
110
  orderDraftsDetail = (id: string, params: RequestParams = {}) =>
114
- this.http.request<OrderDraft, any>({
111
+ this.http.request<OrderDraft, unknown>({
115
112
  path: `/system/order-drafts/${id}`,
116
113
  method: "GET",
117
114
  secure: true,
@@ -133,7 +130,7 @@ export class 系统管理订单草稿<SecurityDataType = unknown> {
133
130
  data: OrderDraftDraft,
134
131
  params: RequestParams = {},
135
132
  ) =>
136
- this.http.request<OrderDraft, any>({
133
+ this.http.request<OrderDraft, unknown>({
137
134
  path: `/system/order-drafts/${id}`,
138
135
  method: "PUT",
139
136
  body: data,
@@ -147,7 +144,8 @@ export class 系统管理订单草稿<SecurityDataType = unknown> {
147
144
  *
148
145
  * @tags 系统管理-订单草稿
149
146
  * @name OrderDraftsStatusPartialUpdate
150
- * @summary 更新订单草稿状�? * @request PATCH:/system/order-drafts/{id}/status
147
+ * @summary 更新订单草稿状态
148
+ * @request PATCH:/system/order-drafts/{id}/status
151
149
  * @secure
152
150
  * @response `200` `OrderDraft` 更新成功
153
151
  */
@@ -158,7 +156,7 @@ export class 系统管理订单草稿<SecurityDataType = unknown> {
158
156
  },
159
157
  params: RequestParams = {},
160
158
  ) =>
161
- this.http.request<OrderDraft, any>({
159
+ this.http.request<OrderDraft, unknown>({
162
160
  path: `/system/order-drafts/${id}/status`,
163
161
  method: "PATCH",
164
162
  body: data,