@qlover/create-app 0.10.2 → 0.10.5

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 (138) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +22 -3
  3. package/dist/configs/_common/.github/workflows/general-check.yml +1 -1
  4. package/dist/configs/_common/.github/workflows/release.yml +2 -2
  5. package/dist/index.cjs +4 -4
  6. package/dist/index.js +4 -4
  7. package/dist/templates/next-app/eslint.config.mjs +5 -1
  8. package/dist/templates/next-app/package.json +4 -2
  9. package/dist/templates/next-app/src/base/cases/AdminPageManager.ts +3 -3
  10. package/dist/templates/next-app/src/base/cases/AppConfig.ts +14 -13
  11. package/dist/templates/next-app/src/base/cases/Datetime.ts +3 -3
  12. package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +8 -2
  13. package/dist/templates/next-app/src/base/cases/DialogHandler.ts +30 -4
  14. package/dist/templates/next-app/src/base/cases/InversifyContainer.ts +16 -4
  15. package/dist/templates/next-app/src/base/cases/NavigateBridge.ts +8 -2
  16. package/dist/templates/next-app/src/base/cases/RequestEncryptPlugin.ts +8 -2
  17. package/dist/templates/next-app/src/base/cases/ResourceState.ts +3 -3
  18. package/dist/templates/next-app/src/base/cases/RouterService.ts +24 -6
  19. package/dist/templates/next-app/src/base/cases/StringEncryptor.ts +14 -2
  20. package/dist/templates/next-app/src/base/cases/TranslateI18nInterface.ts +1 -1
  21. package/dist/templates/next-app/src/base/cases/UserServiceApi.ts +20 -5
  22. package/dist/templates/next-app/src/base/cases/ZodColumnBuilder.ts +31 -8
  23. package/dist/templates/next-app/src/base/port/AdminLayoutInterface.ts +4 -1
  24. package/dist/templates/next-app/src/base/port/I18nServiceInterface.ts +27 -7
  25. package/dist/templates/next-app/src/base/services/AdminPageEvent.ts +1 -1
  26. package/dist/templates/next-app/src/base/services/AdminPageScheduler.ts +3 -3
  27. package/dist/templates/next-app/src/base/services/I18nService.ts +20 -10
  28. package/dist/templates/next-app/src/base/services/ResourceService.ts +32 -11
  29. package/dist/templates/next-app/src/base/services/UserService.ts +12 -3
  30. package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +9 -6
  31. package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +20 -5
  32. package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +21 -4
  33. package/dist/templates/next-app/src/base/services/appApi/AppUserApi.ts +12 -3
  34. package/dist/templates/next-app/src/base/services/appApi/AppUserApiBootstrap.ts +10 -2
  35. package/dist/templates/next-app/src/core/bootstraps/BootstrapClient.ts +2 -2
  36. package/dist/templates/next-app/src/core/bootstraps/BootstrapServer.ts +25 -7
  37. package/dist/templates/next-app/src/core/bootstraps/BootstrapsRegistry.ts +6 -3
  38. package/dist/templates/next-app/src/core/clientIoc/ClientIOC.ts +11 -2
  39. package/dist/templates/next-app/src/core/clientIoc/ClientIOCRegister.ts +5 -0
  40. package/dist/templates/next-app/src/core/serverIoc/ServerIOC.ts +13 -4
  41. package/dist/templates/next-app/src/core/serverIoc/ServerIOCRegister.ts +8 -1
  42. package/dist/templates/next-app/src/pages/_app.tsx +1 -1
  43. package/dist/templates/next-app/src/server/AppErrorApi.ts +1 -1
  44. package/dist/templates/next-app/src/server/AppPageRouteParams.ts +13 -0
  45. package/dist/templates/next-app/src/server/AppSuccessApi.ts +1 -1
  46. package/dist/templates/next-app/src/server/NextApiServer.ts +11 -2
  47. package/dist/templates/next-app/src/server/PagesRouteParams.ts +11 -1
  48. package/dist/templates/next-app/src/server/PasswordEncrypt.ts +8 -2
  49. package/dist/templates/next-app/src/server/ServerAuth.ts +20 -5
  50. package/dist/templates/next-app/src/server/SupabaseBridge.ts +48 -8
  51. package/dist/templates/next-app/src/server/UserCredentialToken.ts +8 -2
  52. package/dist/templates/next-app/src/server/controllers/AdminLocalesController.ts +16 -4
  53. package/dist/templates/next-app/src/server/controllers/AdminUserController.ts +4 -1
  54. package/dist/templates/next-app/src/server/controllers/LocalesController.ts +4 -1
  55. package/dist/templates/next-app/src/server/controllers/UserController.ts +12 -3
  56. package/dist/templates/next-app/src/server/repositorys/LocalesRepository.ts +23 -7
  57. package/dist/templates/next-app/src/server/repositorys/UserRepository.ts +15 -6
  58. package/dist/templates/next-app/src/server/services/AIService.ts +3 -1
  59. package/dist/templates/next-app/src/server/services/AdminAuthPlugin.ts +5 -2
  60. package/dist/templates/next-app/src/server/services/ApiLocaleService.ts +5 -5
  61. package/dist/templates/next-app/src/server/services/ApiUserService.ts +1 -1
  62. package/dist/templates/next-app/src/server/services/UserService.ts +12 -3
  63. package/dist/templates/next-app/src/server/validators/LocalesValidator.ts +20 -5
  64. package/dist/templates/next-app/src/server/validators/LoginValidator.ts +16 -4
  65. package/dist/templates/next-app/src/server/validators/PaginationValidator.ts +8 -2
  66. package/dist/templates/next-app/src/uikit/components/IOCProvider.tsx +1 -1
  67. package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportEvent.ts +7 -1
  68. package/dist/templates/react-app/__tests__/__mocks__/BootstrapTest.ts +3 -1
  69. package/dist/templates/react-app/__tests__/__mocks__/MockAppConfig.ts +19 -19
  70. package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +8 -8
  71. package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +9 -9
  72. package/dist/templates/react-app/__tests__/__mocks__/components/TestBootstrapsProvider.tsx +1 -1
  73. package/dist/templates/react-app/__tests__/__mocks__/i18nextHttpBackend.ts +5 -5
  74. package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOC.ts +9 -5
  75. package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOCRegister.ts +8 -4
  76. package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +4 -4
  77. package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +5 -5
  78. package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +3 -3
  79. package/dist/templates/react-app/__tests__/src/uikit/components/chatMessage/ChatRoot.test.tsx +1 -1
  80. package/dist/templates/react-app/docs/en/components/chat-message-component.md +35 -29
  81. package/dist/templates/react-app/docs/en/components/chat-message-refactor.md +18 -5
  82. package/dist/templates/react-app/docs/en/components/message-base-list-component.md +11 -12
  83. package/dist/templates/react-app/docs/en/request.md +1 -3
  84. package/dist/templates/react-app/docs/zh/components/chat-message-component.md +35 -29
  85. package/dist/templates/react-app/docs/zh/components/chat-message-refactor.md +18 -5
  86. package/dist/templates/react-app/docs/zh/components/message-base-list-component.md +11 -12
  87. package/dist/templates/react-app/docs/zh/request.md +1 -3
  88. package/dist/templates/react-app/eslint.config.mjs +10 -5
  89. package/dist/templates/react-app/src/App.tsx +1 -1
  90. package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +2 -2
  91. package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +14 -11
  92. package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +10 -16
  93. package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +12 -10
  94. package/dist/templates/react-app/src/base/cases/AppConfig.ts +19 -19
  95. package/dist/templates/react-app/src/base/cases/DialogHandler.ts +28 -5
  96. package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +5 -2
  97. package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +16 -4
  98. package/dist/templates/react-app/src/base/cases/PublicAssetsPath.ts +1 -1
  99. package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +6 -3
  100. package/dist/templates/react-app/src/base/cases/RequestLogger.ts +17 -8
  101. package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +4 -6
  102. package/dist/templates/react-app/src/base/cases/ResourceState.ts +3 -3
  103. package/dist/templates/react-app/src/base/cases/RouterLoader.ts +3 -3
  104. package/dist/templates/react-app/src/base/cases/TranslateI18nInterface.ts +1 -1
  105. package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +2 -2
  106. package/dist/templates/react-app/src/base/port/IOCInterface.ts +4 -2
  107. package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +5 -5
  108. package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +7 -7
  109. package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +8 -8
  110. package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +4 -2
  111. package/dist/templates/react-app/src/base/services/BaseLayoutService.ts +3 -3
  112. package/dist/templates/react-app/src/base/services/I18nService.ts +24 -13
  113. package/dist/templates/react-app/src/base/services/IdentifierService.ts +21 -26
  114. package/dist/templates/react-app/src/base/services/RouteService.ts +8 -8
  115. package/dist/templates/react-app/src/base/services/UserBootstrap.ts +2 -2
  116. package/dist/templates/react-app/src/base/services/UserGatewayPlugin.ts +9 -5
  117. package/dist/templates/react-app/src/base/services/UserService.ts +10 -4
  118. package/dist/templates/react-app/src/core/bootstraps/BootstrapClient.ts +3 -1
  119. package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +5 -2
  120. package/dist/templates/react-app/src/core/clientIoc/ClientIOC.ts +11 -4
  121. package/dist/templates/react-app/src/core/clientIoc/ClientIOCRegister.ts +5 -4
  122. package/dist/templates/react-app/src/pages/base/Layout.tsx +1 -1
  123. package/dist/templates/react-app/src/styles/css/antd-themes/_common/_default.css +0 -44
  124. package/dist/templates/react-app/src/styles/css/antd-themes/_common/dark.css +0 -44
  125. package/dist/templates/react-app/src/styles/css/antd-themes/_common/pink.css +0 -44
  126. package/dist/templates/react-app/src/styles/css/index.css +1 -1
  127. package/dist/templates/react-app/src/styles/css/scrollbar.css +34 -0
  128. package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +2 -2
  129. package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +4 -4
  130. package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +8 -2
  131. package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +6 -6
  132. package/dist/templates/react-app/src/uikit/components/AppRouterProvider.tsx +1 -1
  133. package/dist/templates/react-app/src/uikit/components/BootstrapsProvider.tsx +1 -3
  134. package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +4 -1
  135. package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +39 -16
  136. package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +4 -2
  137. package/package.json +3 -3
  138. package/dist/templates/react-app/makes/eslint-utils.mjs +0 -195
@@ -9,7 +9,7 @@ import type { useTranslations } from 'next-intl';
9
9
  type TranslationFunction = ReturnType<typeof useTranslations>;
10
10
 
11
11
  export class I18nService extends I18nServiceInterface {
12
- readonly pluginName = 'I18nService';
12
+ public readonly pluginName = 'I18nService';
13
13
  protected pathname: string = '';
14
14
  protected translator: TranslationFunction | null = null;
15
15
 
@@ -17,20 +17,28 @@ export class I18nService extends I18nServiceInterface {
17
17
  super(() => new I18nServiceState(i18nConfig.fallbackLng));
18
18
  }
19
19
 
20
- setPathname(pathname: string): void {
20
+ /**
21
+ * @override
22
+ */
23
+ public setPathname(pathname: string): void {
21
24
  this.pathname = pathname;
22
25
  }
23
26
 
24
- setTranslator(translator: TranslationFunction): void {
27
+ /**
28
+ * @override
29
+ */
30
+ public setTranslator(translator: TranslationFunction): void {
25
31
  this.translator = translator;
26
32
  }
27
33
 
28
34
  /**
29
35
  * @override
30
36
  */
31
- async onBefore(): Promise<void> {}
37
+ public async onBefore(): Promise<void> {}
32
38
 
33
- override async changeLanguage(language: I18nServiceLocale): Promise<void> {
39
+ public override async changeLanguage(
40
+ language: I18nServiceLocale
41
+ ): Promise<void> {
34
42
  try {
35
43
  this.changeLoading(true);
36
44
 
@@ -46,23 +54,25 @@ export class I18nService extends I18nServiceInterface {
46
54
  }
47
55
  }
48
56
 
49
- override changeLoading(loading: boolean): void {
57
+ public override changeLoading(loading: boolean): void {
50
58
  this.emit({ ...this.state, loading });
51
59
  }
52
60
 
53
- override async getCurrentLanguage(): Promise<I18nServiceLocale> {
61
+ public override async getCurrentLanguage(): Promise<I18nServiceLocale> {
54
62
  return this.state.language;
55
63
  }
56
64
 
57
- override isValidLanguage(language: string): language is I18nServiceLocale {
65
+ public override isValidLanguage(
66
+ language: string
67
+ ): language is I18nServiceLocale {
58
68
  return i18nConfig.supportedLngs.includes(language as I18nServiceLocale);
59
69
  }
60
70
 
61
- override getSupportedLanguages(): I18nServiceLocale[] {
71
+ public override getSupportedLanguages(): I18nServiceLocale[] {
62
72
  return [...i18nConfig.supportedLngs];
63
73
  }
64
74
 
65
- override t(
75
+ public override t(
66
76
  key: string,
67
77
  params?: Record<string, string | number | Date>
68
78
  ): string {
@@ -14,7 +14,7 @@ export class ResourceService<
14
14
  Store extends ResourceStore<ResourceStateInterface> =
15
15
  ResourceStore<ResourceStateInterface>
16
16
  > implements ResourceServiceInterface<T> {
17
- readonly unionKey: string = 'id';
17
+ public readonly unionKey: string = 'id';
18
18
 
19
19
  constructor(
20
20
  readonly serviceName: string,
@@ -22,14 +22,17 @@ export class ResourceService<
22
22
  readonly resourceApi: ResourceInterface<T>
23
23
  ) {}
24
24
 
25
- getStore(): Store {
25
+ /**
26
+ * @override
27
+ */
28
+ public getStore(): Store {
26
29
  return this.store;
27
30
  }
28
31
 
29
32
  /**
30
33
  * @override
31
34
  */
32
- async created(): Promise<unknown> {
35
+ public async created(): Promise<unknown> {
33
36
  this.store.changeInitState(new RequestState(true));
34
37
 
35
38
  try {
@@ -47,16 +50,19 @@ export class ResourceService<
47
50
  /**
48
51
  * @override
49
52
  */
50
- destroyed(): void {
53
+ public destroyed(): void {
51
54
  this.store.reset();
52
55
  }
53
56
 
54
57
  /**
55
58
  * @override
56
59
  */
57
- updated(): void {}
60
+ public updated(): void {}
58
61
 
59
- async search(
62
+ /**
63
+ * @override
64
+ */
65
+ public async search(
60
66
  params: Partial<ResourceQuery>
61
67
  ): Promise<PaginationInterface<T>> {
62
68
  this.store.changeListState(
@@ -84,11 +90,17 @@ export class ResourceService<
84
90
  return this.store.state.listState.result! as PaginationInterface<T>;
85
91
  }
86
92
 
87
- refresh(): Promise<unknown> {
93
+ /**
94
+ * @override
95
+ */
96
+ public refresh(): Promise<unknown> {
88
97
  return this.search(this.store.state.searchParams);
89
98
  }
90
99
 
91
- async update(data: Partial<T>): Promise<unknown> {
100
+ /**
101
+ * @override
102
+ */
103
+ public async update(data: Partial<T>): Promise<unknown> {
92
104
  const result = await this.resourceApi.update(data);
93
105
 
94
106
  // 更新本地列表数据
@@ -109,13 +121,22 @@ export class ResourceService<
109
121
  return result;
110
122
  }
111
123
 
112
- create(data: T): Promise<unknown> {
124
+ /**
125
+ * @override
126
+ */
127
+ public create(data: T): Promise<unknown> {
113
128
  return this.resourceApi.create(data);
114
129
  }
115
- remove(data: T): Promise<unknown> {
130
+ /**
131
+ * @override
132
+ */
133
+ public remove(data: T): Promise<unknown> {
116
134
  return this.resourceApi.remove(data);
117
135
  }
118
- export(data: T): Promise<unknown> {
136
+ /**
137
+ * @override
138
+ */
139
+ public export(data: T): Promise<unknown> {
119
140
  return this.resourceApi.export(data);
120
141
  }
121
142
  }
@@ -30,15 +30,24 @@ export class UserService
30
30
  });
31
31
  }
32
32
 
33
- getToken(): string {
33
+ /**
34
+ * @override
35
+ */
36
+ public getToken(): string {
34
37
  return this.store.getCredential()?.credential_token ?? '';
35
38
  }
36
39
 
37
- isUserInfo(value: unknown): value is UserSchema {
40
+ /**
41
+ * @override
42
+ */
43
+ public isUserInfo(value: unknown): value is UserSchema {
38
44
  return userSchema.safeParse(value).success;
39
45
  }
40
46
 
41
- isUserCredential(value: unknown): value is UserCredential {
47
+ /**
48
+ * @override
49
+ */
50
+ public isUserCredential(value: unknown): value is UserCredential {
42
51
  return (
43
52
  isObject(value) &&
44
53
  'credential_token' in value &&
@@ -30,7 +30,7 @@ export class AdminLocalesApi implements ResourceInterface<LocalesSchema> {
30
30
  /**
31
31
  * @override
32
32
  */
33
- create(data: LocalesSchema): Promise<unknown> {
33
+ public create(data: LocalesSchema): Promise<unknown> {
34
34
  return this.client.request<AdminLocalesListTransaction>({
35
35
  url: '/admin/locales/create',
36
36
  method: 'POST',
@@ -41,7 +41,7 @@ export class AdminLocalesApi implements ResourceInterface<LocalesSchema> {
41
41
  /**
42
42
  * @override
43
43
  */
44
- remove(data: Partial<LocalesSchema>): Promise<unknown> {
44
+ public remove(data: Partial<LocalesSchema>): Promise<unknown> {
45
45
  return this.client.request<AdminLocalesListTransaction>({
46
46
  url: '/admin/locales',
47
47
  method: 'DELETE',
@@ -52,7 +52,7 @@ export class AdminLocalesApi implements ResourceInterface<LocalesSchema> {
52
52
  /**
53
53
  * @override
54
54
  */
55
- search(
55
+ public search(
56
56
  params: ResourceQuery
57
57
  ): Promise<AdminLocalesListTransaction['response']> {
58
58
  return this.client.request<AdminLocalesListTransaction>({
@@ -65,7 +65,7 @@ export class AdminLocalesApi implements ResourceInterface<LocalesSchema> {
65
65
  /**
66
66
  * @override
67
67
  */
68
- export(data: LocalesSchema): Promise<unknown> {
68
+ public export(data: LocalesSchema): Promise<unknown> {
69
69
  return this.client.request<AdminLocalesListTransaction>({
70
70
  url: '/admin/locales',
71
71
  method: 'GET',
@@ -76,7 +76,7 @@ export class AdminLocalesApi implements ResourceInterface<LocalesSchema> {
76
76
  /**
77
77
  * @override
78
78
  */
79
- update(
79
+ public update(
80
80
  data: Partial<LocalesSchema>
81
81
  ): Promise<AdminLocalesUpdateTransaction['response']> {
82
82
  return this.client.request<AdminLocalesUpdateTransaction>({
@@ -86,7 +86,10 @@ export class AdminLocalesApi implements ResourceInterface<LocalesSchema> {
86
86
  });
87
87
  }
88
88
 
89
- import(data: {
89
+ /**
90
+ * @override
91
+ */
92
+ public import(data: {
90
93
  [key in LocaleType]?: File;
91
94
  }): Promise<unknown> {
92
95
  const formdata = new FormData();
@@ -21,7 +21,10 @@ export class AdminUserApi implements ResourceInterface<UserSchema> {
21
21
  protected client: RequestTransaction<AppApiConfig>
22
22
  ) {}
23
23
 
24
- async search(
24
+ /**
25
+ * @override
26
+ */
27
+ public async search(
25
28
  params: AdminUserListTransaction['request']
26
29
  ): Promise<AdminUserListTransaction['response']> {
27
30
  const response = await this.client.request<AdminUserListTransaction>({
@@ -33,7 +36,10 @@ export class AdminUserApi implements ResourceInterface<UserSchema> {
33
36
  return response;
34
37
  }
35
38
 
36
- create(data: UserSchema): Promise<unknown> {
39
+ /**
40
+ * @override
41
+ */
42
+ public create(data: UserSchema): Promise<unknown> {
37
43
  return this.client.request<AdminUserListTransaction>({
38
44
  url: '/admin/users',
39
45
  method: 'POST',
@@ -41,7 +47,10 @@ export class AdminUserApi implements ResourceInterface<UserSchema> {
41
47
  });
42
48
  }
43
49
 
44
- remove(data: UserSchema): Promise<unknown> {
50
+ /**
51
+ * @override
52
+ */
53
+ public remove(data: UserSchema): Promise<unknown> {
45
54
  return this.client.request<AdminUserListTransaction>({
46
55
  url: '/admin/users',
47
56
  method: 'DELETE',
@@ -49,7 +58,10 @@ export class AdminUserApi implements ResourceInterface<UserSchema> {
49
58
  });
50
59
  }
51
60
 
52
- update(data: UserSchema): Promise<unknown> {
61
+ /**
62
+ * @override
63
+ */
64
+ public update(data: UserSchema): Promise<unknown> {
53
65
  return this.client.request<AdminUserListTransaction>({
54
66
  url: '/admin/users',
55
67
  method: 'PUT',
@@ -57,7 +69,10 @@ export class AdminUserApi implements ResourceInterface<UserSchema> {
57
69
  });
58
70
  }
59
71
 
60
- export(data: UserSchema): Promise<unknown> {
72
+ /**
73
+ * @override
74
+ */
75
+ public export(data: UserSchema): Promise<unknown> {
61
76
  return this.client.request<AdminUserListTransaction>({
62
77
  url: '/admin/users',
63
78
  method: 'GET',
@@ -9,11 +9,14 @@ import type { AppApiConfig } from './AppApiRequester';
9
9
  import type { LoggerInterface } from '@qlover/logger';
10
10
 
11
11
  export class AppApiPlugin implements ExecutorPlugin {
12
- readonly pluginName = 'AppApiPlugin';
12
+ public readonly pluginName = 'AppApiPlugin';
13
13
 
14
14
  constructor(protected logger: LoggerInterface) {}
15
15
 
16
- isAppApiErrorInterface(value: unknown): value is AppApiErrorInterface {
16
+ /**
17
+ * @override
18
+ */
19
+ public isAppApiErrorInterface(value: unknown): value is AppApiErrorInterface {
17
20
  return (
18
21
  typeof value === 'object' &&
19
22
  value !== null &&
@@ -24,7 +27,12 @@ export class AppApiPlugin implements ExecutorPlugin {
24
27
  );
25
28
  }
26
29
 
27
- onSuccess(context: ExecutorContext<AppApiConfig>): void | Promise<void> {
30
+ /**
31
+ * @override
32
+ */
33
+ public onSuccess(
34
+ context: ExecutorContext<AppApiConfig>
35
+ ): void | Promise<void> {
28
36
  const response = context.returnValue;
29
37
  const { parameters } = context;
30
38
 
@@ -40,7 +48,10 @@ export class AppApiPlugin implements ExecutorPlugin {
40
48
  }
41
49
  }
42
50
 
43
- async onError(
51
+ /**
52
+ * @override
53
+ */
54
+ public async onError(
44
55
  context: ExecutorContext<AppApiConfig>
45
56
  ): Promise<ExecutorError | void> {
46
57
  const { error, parameters } = context;
@@ -66,6 +77,9 @@ export class AppApiPlugin implements ExecutorPlugin {
66
77
  }
67
78
  }
68
79
 
80
+ /**
81
+ * @override
82
+ */
69
83
  protected async getResponseJson(response: Response): Promise<unknown> {
70
84
  try {
71
85
  return await response.json();
@@ -74,6 +88,9 @@ export class AppApiPlugin implements ExecutorPlugin {
74
88
  }
75
89
  }
76
90
 
91
+ /**
92
+ * @override
93
+ */
77
94
  protected loggerError(config: AppApiConfig, error: unknown): void {
78
95
  this.logger.error(
79
96
  `%c[AppApi ${config.method} ${config.url}]%c - ${new Date().toLocaleString()}`,
@@ -23,7 +23,10 @@ export class AppUserApi implements AppUserApiInterface {
23
23
  protected client: RequestTransaction<AppApiConfig>
24
24
  ) {}
25
25
 
26
- async login(
26
+ /**
27
+ * @override
28
+ */
29
+ public async login(
27
30
  params: UserApiLoginTransaction['data']
28
31
  ): Promise<UserApiLoginTransaction['response']> {
29
32
  const response = await this.client.request<UserApiLoginTransaction>({
@@ -36,7 +39,10 @@ export class AppUserApi implements AppUserApiInterface {
36
39
  return response;
37
40
  }
38
41
 
39
- async register(
42
+ /**
43
+ * @override
44
+ */
45
+ public async register(
40
46
  params: UserApiRegisterTransaction['data']
41
47
  ): Promise<UserApiRegisterTransaction['response']> {
42
48
  const response = await this.client.request<UserApiRegisterTransaction>({
@@ -49,7 +55,10 @@ export class AppUserApi implements AppUserApiInterface {
49
55
  return response;
50
56
  }
51
57
 
52
- async logout(
58
+ /**
59
+ * @override
60
+ */
61
+ public async logout(
53
62
  _params?: unknown
54
63
  ): Promise<UserApiLogoutTransaction['response']> {
55
64
  return await this.client.request<UserApiLogoutTransaction>({
@@ -14,11 +14,16 @@ import type {
14
14
  import type { ExecutorContext, SerializerIneterface } from '@qlover/fe-corekit';
15
15
 
16
16
  export class AppUserApiBootstrap implements BootstrapExecutorPlugin {
17
- readonly pluginName = 'AppUserApiBootstrap';
17
+ public readonly pluginName = 'AppUserApiBootstrap';
18
18
 
19
19
  constructor(protected serializer: SerializerIneterface) {}
20
20
 
21
- onBefore({ parameters: { ioc } }: BootstrapContext): void | Promise<void> {
21
+ /**
22
+ * @override
23
+ */
24
+ public onBefore({
25
+ parameters: { ioc }
26
+ }: BootstrapContext): void | Promise<void> {
22
27
  const appUserApi = ioc.get<AppApiRequester>(AppApiRequester);
23
28
 
24
29
  appUserApi.usePlugin(new FetchURLPlugin());
@@ -32,6 +37,9 @@ export class AppUserApiBootstrap implements BootstrapExecutorPlugin {
32
37
  appUserApi.usePlugin(ioc.get(DialogErrorPlugin));
33
38
  }
34
39
 
40
+ /**
41
+ * @override
42
+ */
35
43
  protected requestDataSerializer(
36
44
  data: unknown,
37
45
  context: ExecutorContext<AppApiConfig>
@@ -30,8 +30,8 @@ export type BootstrapAppArgs = {
30
30
  };
31
31
 
32
32
  export class BootstrapClient {
33
- static lastTime = 0;
34
- static async main(args: BootstrapAppArgs): Promise<BootstrapAppArgs> {
33
+ public static lastTime = 0;
34
+ public static async main(args: BootstrapAppArgs): Promise<BootstrapAppArgs> {
35
35
  const { logger, appConfig } = globals;
36
36
 
37
37
  if (BootstrapClient.lastTime) {
@@ -28,7 +28,7 @@ export class BootstrapServer implements ServerInterface {
28
28
  IOCIdentifierMapServer,
29
29
  IOCContainerInterface
30
30
  >;
31
- readonly logger: LoggerInterface;
31
+ public readonly logger: LoggerInterface;
32
32
 
33
33
  constructor() {
34
34
  const serverIOC = ServerIOC.create();
@@ -40,12 +40,27 @@ export class BootstrapServer implements ServerInterface {
40
40
  this.logger = logger;
41
41
  }
42
42
 
43
- getIOC(): IOCFunctionInterface<IOCIdentifierMapServer, IOCContainerInterface>;
44
- getIOC<T extends keyof IOCIdentifierMapServer>(
43
+ /**
44
+ * @override
45
+ */
46
+ public getIOC(): IOCFunctionInterface<
47
+ IOCIdentifierMapServer,
48
+ IOCContainerInterface
49
+ >;
50
+ /**
51
+ * @override
52
+ */
53
+ public getIOC<T extends keyof IOCIdentifierMapServer>(
45
54
  identifier: T
46
55
  ): IOCIdentifierMapServer[T];
47
- getIOC<T>(serviceIdentifier: ServiceIdentifier<T>): T;
48
- getIOC<T extends keyof IOCIdentifierMapServer>(
56
+ /**
57
+ * @override
58
+ */
59
+ public getIOC<T>(serviceIdentifier: ServiceIdentifier<T>): T;
60
+ /**
61
+ * @override
62
+ */
63
+ public getIOC<T extends keyof IOCIdentifierMapServer>(
49
64
  identifier?: T
50
65
  ):
51
66
  | IOCFunctionInterface<IOCIdentifierMapServer, IOCContainerInterface>
@@ -59,7 +74,7 @@ export class BootstrapServer implements ServerInterface {
59
74
  /**
60
75
  * @override
61
76
  */
62
- use(
77
+ public use(
63
78
  plugin:
64
79
  | BootstrapExecutorPlugin
65
80
  | BootstrapExecutorPlugin[]
@@ -78,7 +93,10 @@ export class BootstrapServer implements ServerInterface {
78
93
  return this;
79
94
  }
80
95
 
81
- execNoError<Result>(
96
+ /**
97
+ * @override
98
+ */
99
+ public execNoError<Result>(
82
100
  task?: PromiseTask<Result, BootstrapServerContextValue>
83
101
  ): Promise<Result | ExecutorError> {
84
102
  const context = {
@@ -14,15 +14,18 @@ import type {
14
14
  export class BootstrapsRegistry {
15
15
  constructor(protected args: BootstrapAppArgs) {}
16
16
 
17
- get IOC(): IOCFunctionInterface<IOCIdentifierMap, IOCContainerInterface> {
17
+ public get IOC(): IOCFunctionInterface<
18
+ IOCIdentifierMap,
19
+ IOCContainerInterface
20
+ > {
18
21
  return this.args.IOC;
19
22
  }
20
23
 
21
- get appConfig(): EnvConfigInterface {
24
+ public get appConfig(): EnvConfigInterface {
22
25
  return this.IOC(IOCIdentifier.AppConfig);
23
26
  }
24
27
 
25
- register(): BootstrapExecutorPlugin[] {
28
+ public register(): BootstrapExecutorPlugin[] {
26
29
  const IOC = this.IOC;
27
30
 
28
31
  const i18nService = IOC(IOCIdentifier.I18nServiceInterface);
@@ -30,7 +30,13 @@ export class ClientIOC implements IOCInterface<
30
30
  >
31
31
  ) {}
32
32
 
33
- create(): IOCFunctionInterface<IOCIdentifierMap, IOCContainerInterface> {
33
+ /**
34
+ * @override
35
+ */
36
+ public create(): IOCFunctionInterface<
37
+ IOCIdentifierMap,
38
+ IOCContainerInterface
39
+ > {
34
40
  if (this.ioc) {
35
41
  return this.ioc;
36
42
  }
@@ -40,7 +46,10 @@ export class ClientIOC implements IOCInterface<
40
46
  return this.ioc;
41
47
  }
42
48
 
43
- register(options: IocRegisterOptions): void {
49
+ /**
50
+ * @override
51
+ */
52
+ public register(options: IocRegisterOptions): void {
44
53
  if (this.registers > 0) {
45
54
  return;
46
55
  }
@@ -23,6 +23,7 @@ export class ClientIOCRegister implements IOCRegisterInterface<
23
23
  *
24
24
  * 一般用于注册全局
25
25
  *
26
+ * @override
26
27
  * @param ioc - IOC container
27
28
  */
28
29
  protected registerGlobals(ioc: IOCContainerInterface): void {
@@ -47,6 +48,7 @@ export class ClientIOCRegister implements IOCRegisterInterface<
47
48
  * - 国际化服务
48
49
  * - 主题服务
49
50
  *
51
+ * @override
50
52
  * @param ioc
51
53
  */
52
54
  protected registerImplement(ioc: IOCContainerInterface): void {
@@ -68,6 +70,9 @@ export class ClientIOCRegister implements IOCRegisterInterface<
68
70
  // ioc.bind(I.RequestPageBridgeInterface, ioc.get(RequestPageBridge));
69
71
  }
70
72
 
73
+ /**
74
+ * @override
75
+ */
71
76
  protected registerCommon(_ioc: IOCContainerInterface): void {
72
77
  // const { appConfig } = this.options;
73
78
  // const logger = ioc.get(I.Logger);
@@ -16,7 +16,7 @@ export class ServerIOC implements IOCInterface<
16
16
  IOCIdentifierMapServer,
17
17
  IOCContainerInterface
18
18
  > {
19
- static instance: ServerIOC | null = null;
19
+ public static instance: ServerIOC | null = null;
20
20
 
21
21
  protected registers = 0;
22
22
 
@@ -25,7 +25,10 @@ export class ServerIOC implements IOCInterface<
25
25
  IOCContainerInterface
26
26
  > | null = null;
27
27
 
28
- static create(): ServerIOC {
28
+ /**
29
+ * @override
30
+ */
31
+ public static create(): ServerIOC {
29
32
  if (this.instance) {
30
33
  return this.instance;
31
34
  }
@@ -35,7 +38,10 @@ export class ServerIOC implements IOCInterface<
35
38
  return this.instance;
36
39
  }
37
40
 
38
- create(): IOCFunctionInterface<
41
+ /**
42
+ * @override
43
+ */
44
+ public create(): IOCFunctionInterface<
39
45
  IOCIdentifierMapServer,
40
46
  IOCContainerInterface
41
47
  > {
@@ -53,7 +59,10 @@ export class ServerIOC implements IOCInterface<
53
59
  return this.ioc;
54
60
  }
55
61
 
56
- register(options: IocRegisterOptions): void {
62
+ /**
63
+ * @override
64
+ */
65
+ public register(options: IocRegisterOptions): void {
57
66
  if (this.registers > 0) {
58
67
  console.debug('ServerIOC: ioc already registered');
59
68
  return;
@@ -19,6 +19,7 @@ export class ServerIOCRegister implements IOCRegisterInterface<
19
19
  *
20
20
  * 一般用于注册全局
21
21
  *
22
+ * @override
22
23
  * @param ioc - IOC container
23
24
  */
24
25
  protected registerGlobals(ioc: IOCContainerInterface): void {
@@ -45,16 +46,22 @@ export class ServerIOCRegister implements IOCRegisterInterface<
45
46
  );
46
47
  }
47
48
 
49
+ /**
50
+ * @override
51
+ */
48
52
  protected registerImplement(ioc: IOCContainerInterface): void {
49
53
  ioc.bind(I.DBBridgeInterface, ioc.get(SupabaseBridge));
50
54
  }
51
55
 
56
+ /**
57
+ * @override
58
+ */
52
59
  protected registerCommon(_ioc: IOCContainerInterface): void {}
53
60
 
54
61
  /**
55
62
  * @override
56
63
  */
57
- register(
64
+ public register(
58
65
  ioc: IOCContainerInterface,
59
66
  _manager: IOCManagerInterface<IOCContainerInterface>
60
67
  ): void {
@@ -35,7 +35,7 @@ function App({ Component, pageProps, router }: PagesRouterProps) {
35
35
  const locale = (router.query.locale as string) || i18nConfig.fallbackLng;
36
36
 
37
37
  return (
38
- <IOCProvider data-testid="IOCProvider">
38
+ <IOCProvider>
39
39
  <NextIntlClientProvider locale={locale} messages={pageProps.messages}>
40
40
  <BootstrapsProvider>
41
41
  <ClientRootProvider themeConfig={themeConfig}>
@@ -1,7 +1,7 @@
1
1
  import type { AppApiErrorInterface } from '@/base/port/AppApiInterface';
2
2
 
3
3
  export class AppErrorApi implements AppApiErrorInterface {
4
- readonly success = false;
4
+ public readonly success = false;
5
5
 
6
6
  constructor(
7
7
  public readonly id: string,