@qlover/create-app 0.11.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +3 -3
  4. package/dist/templates/next-app/eslint.config.mjs +76 -1
  5. package/dist/templates/next-app/next.config.ts +4 -3
  6. package/dist/templates/next-app/package.json +15 -11
  7. package/dist/templates/next-app/src/app/[locale]/login/LoginForm.tsx +2 -3
  8. package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +6 -4
  9. package/dist/templates/next-app/src/base/cases/RequestEncryptPlugin.ts +14 -10
  10. package/dist/templates/next-app/src/base/cases/StringEncryptor.ts +2 -2
  11. package/dist/templates/next-app/src/base/port/I18nServiceInterface.ts +1 -4
  12. package/dist/templates/next-app/src/base/services/I18nService.ts +6 -2
  13. package/dist/templates/next-app/src/base/services/adminApi/AdminApiRequester.ts +11 -7
  14. package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +11 -10
  15. package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +16 -12
  16. package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +19 -19
  17. package/dist/templates/next-app/src/base/services/appApi/AppApiRequester.ts +26 -21
  18. package/dist/templates/next-app/src/base/services/appApi/AppUserApi.ts +15 -6
  19. package/dist/templates/next-app/src/base/services/appApi/AppUserApiBootstrap.ts +12 -14
  20. package/dist/templates/next-app/src/core/bootstraps/BootstrapServer.ts +34 -17
  21. package/dist/templates/next-app/src/server/NextApiServer.ts +10 -4
  22. package/dist/templates/next-app/src/server/PasswordEncrypt.ts +2 -2
  23. package/dist/templates/next-app/src/server/controllers/UserController.ts +2 -2
  24. package/dist/templates/next-app/src/server/port/ServerInterface.ts +2 -2
  25. package/dist/templates/next-app/src/server/services/AdminAuthPlugin.ts +6 -7
  26. package/dist/templates/next-app/src/server/services/UserService.ts +2 -2
  27. package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +11 -47
  28. package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +3 -2
  29. package/dist/templates/react-app/__tests__/__mocks__/createMockGlobals.ts +6 -1
  30. package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +21 -61
  31. package/dist/templates/react-app/__tests__/src/base/cases/RequestLogger.test.ts +29 -51
  32. package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +8 -26
  33. package/dist/templates/react-app/__tests__/src/main.test.tsx +2 -2
  34. package/dist/templates/react-app/config/IOCIdentifier.ts +1 -1
  35. package/dist/templates/react-app/docs/en/test-guide.md +5 -5
  36. package/dist/templates/react-app/docs/zh/test-guide.md +5 -5
  37. package/dist/templates/react-app/eslint.config.mjs +79 -7
  38. package/dist/templates/react-app/package.json +4 -3
  39. package/dist/templates/react-app/src/base/apis/AiApi.ts +20 -12
  40. package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +14 -5
  41. package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +29 -13
  42. package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +35 -34
  43. package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +23 -17
  44. package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +11 -5
  45. package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +19 -6
  46. package/dist/templates/react-app/src/base/cases/RequestLogger.ts +11 -11
  47. package/dist/templates/react-app/src/base/services/BaseLayoutService.ts +11 -5
  48. package/dist/templates/react-app/src/base/services/I18nService.ts +3 -0
  49. package/dist/templates/react-app/src/base/services/IdentifierService.ts +24 -0
  50. package/dist/templates/react-app/src/base/services/UserBootstrap.ts +9 -7
  51. package/dist/templates/react-app/src/base/services/UserService.ts +4 -5
  52. package/dist/templates/react-app/src/core/clientIoc/ClientIOCRegister.ts +6 -7
  53. package/dist/templates/react-app/src/main.tsx +1 -1
  54. package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +5 -5
  55. package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +3 -1
  56. package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +6 -2
  57. package/dist/templates/react-app/src/pages/base/MessagePage.tsx +34 -3
  58. package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +13 -7
  59. package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +6 -1
  60. package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +26 -11
  61. package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +7 -1
  62. package/dist/templates/react-app/src/uikit/components/chatMessage/FocusBar.tsx +3 -1
  63. package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +16 -7
  64. package/dist/templates/react-app/src/vite-env.d.ts +1 -1
  65. package/dist/templates/react-app/tsconfig.e2e.json +5 -2
  66. package/dist/templates/react-app/tsconfig.json +7 -0
  67. package/dist/templates/react-app/tsconfig.node.json +4 -2
  68. package/dist/templates/react-app/tsconfig.test.json +4 -1
  69. package/package.json +4 -3
  70. package/dist/templates/react-app/src/base/cases/AppError.ts +0 -10
  71. package/dist/templates/react-app/src/base/port/ProcesserExecutorInterface.ts +0 -20
  72. package/dist/templates/react-app/src/base/services/UserGatewayPlugin.ts +0 -20
@@ -3,8 +3,10 @@ import { chatMessageI18n } from '@config/i18n/chatMessageI18n';
3
3
  import {
4
4
  ChatMessageStore,
5
5
  ChatSenderStrategy,
6
+ MessageSenderExecutor,
6
7
  SendFailureStrategy
7
8
  } from '@qlover/corekit-bridge';
9
+ import { Aborter, AborterPlugin } from '@qlover/fe-corekit';
8
10
  import { useState } from 'react';
9
11
  import { logger } from '@/core/globals';
10
12
  import { ChatMessageBridge } from '@/uikit/components/chatMessage/ChatMessageBridge';
@@ -12,19 +14,48 @@ import { ChatRoot } from '@/uikit/components/chatMessage/ChatRoot';
12
14
  import { MessageApi } from '@/uikit/components/chatMessage/MessageApi';
13
15
  import { MessageBaseList } from '@/uikit/components/MessageBaseList';
14
16
  import { useI18nInterface } from '@/uikit/hooks/useI18nInterface';
17
+ import { useIOC } from '@/uikit/hooks/useIOC';
18
+ import type { ChatMessage, MessageSenderOptions } from '@qlover/corekit-bridge';
19
+ import type { AborterConfig } from '@qlover/fe-corekit';
20
+
21
+ // TODO: message sender getconfig type not match, need to fix
22
+ function toAborterConfig<T>(
23
+ parameters: unknown | MessageSenderOptions<ChatMessage<T>>
24
+ ): any {
25
+ const options = parameters as MessageSenderOptions<ChatMessage<T>>;
26
+ return {
27
+ abortId: options.currentMessage.id,
28
+ onAborted: options.gatewayOptions?.onAborted,
29
+ abortTimeout: options.gatewayOptions?.timeout,
30
+ signal: options.gatewayOptions?.signal
31
+ } as AborterConfig;
32
+ }
15
33
 
16
34
  export default function MessagePage() {
17
35
  const tt = useI18nInterface(chatMessageI18n);
18
36
  const messagesStore = useFactory(ChatMessageStore<string>);
19
37
  const messageApi = useFactory(MessageApi, messagesStore);
38
+ const aborter = useIOC(Aborter);
20
39
 
21
40
  const [bridge] = useState(() => {
22
- return new ChatMessageBridge<string>(messagesStore, {
41
+ const messageBridge = new ChatMessageBridge<string>(messagesStore, {
23
42
  gateway: messageApi,
24
43
  logger: logger,
44
+ aborter: aborter,
25
45
  senderName: 'ChatSender',
26
- gatewayOptions: { stream: true }
27
- }).use(new ChatSenderStrategy(SendFailureStrategy.KEEP_FAILED, logger));
46
+ gatewayOptions: { stream: true },
47
+ executor: new MessageSenderExecutor()
48
+ });
49
+ return messageBridge
50
+ .use(
51
+ new AborterPlugin<
52
+ AborterConfig & MessageSenderOptions<ChatMessage<string>>
53
+ >({
54
+ aborter: aborter,
55
+ getConfig: toAborterConfig
56
+ })
57
+ )
58
+ .use(new ChatSenderStrategy(SendFailureStrategy.KEEP_FAILED, logger));
28
59
  });
29
60
 
30
61
  return (
@@ -1,9 +1,4 @@
1
1
  import { RequestState } from '@qlover/corekit-bridge';
2
- import {
3
- ExecutorPlugin,
4
- RequestAdapterResponse,
5
- RequestAdapterFetchConfig
6
- } from '@qlover/fe-corekit';
7
2
  import { inject, injectable } from 'inversify';
8
3
  import cloneDeep from 'lodash/cloneDeep';
9
4
  import { FeApi } from '@/base/apis/feApi/FeApi';
@@ -11,12 +6,20 @@ import {
11
6
  ExecutorPageBridgeInterface,
12
7
  ExecutorPageStateInterface
13
8
  } from '@/base/port/ExecutorPageBridgeInterface';
9
+ import type {
10
+ RequestAdapterResponse,
11
+ RequestAdapterFetchConfig,
12
+ LifecyclePluginInterface,
13
+ ExecutorContextInterface
14
+ } from '@qlover/fe-corekit';
14
15
 
15
16
  class ExecutorPageBridgeState implements ExecutorPageStateInterface {
16
17
  public helloState = new RequestState();
17
18
  }
18
19
 
19
- const TestPlugin: ExecutorPlugin<RequestAdapterFetchConfig> = {
20
+ const TestPlugin: LifecyclePluginInterface<
21
+ ExecutorContextInterface<RequestAdapterFetchConfig, unknown>
22
+ > = {
20
23
  pluginName: 'test',
21
24
  async onSuccess({ parameters, returnValue }) {
22
25
  if (
@@ -38,7 +41,10 @@ export class ExecutorPageBridge extends ExecutorPageBridgeInterface {
38
41
  // FIXME: not cloneDeep, create a new instance
39
42
  this.feApi = cloneDeep(feApi);
40
43
 
41
- this.feApi.usePlugin(TestPlugin);
44
+ this.feApi.use({
45
+ pluginName: 'test',
46
+ onSuccess: TestPlugin.onSuccess
47
+ });
42
48
  }
43
49
 
44
50
  public override onTestPlugins = async () => {
@@ -15,6 +15,7 @@ export function LogoutButton() {
15
15
  const { t } = useAppTranslation();
16
16
  const dialogHandler = useIOC(IOCIdentifier.DialogHandler);
17
17
  const userService = useIOC(IOCIdentifier.UserServiceInterface);
18
+ const routeService = useIOC(IOCIdentifier.RouteServiceInterface);
18
19
  const breakpoint = useBreakpoint();
19
20
  const tTitle = t(AUTH_LOGOUT_DIALOG_TITLE);
20
21
  const tContent = t(AUTH_LOGOUT_DIALOG_CONTENT);
@@ -29,7 +30,11 @@ export function LogoutButton() {
29
30
  'data-testid': 'LogoutButton-CancelButton'
30
31
  },
31
32
  content: tContent,
32
- onOk: () => userService.logout()
33
+ onOk: async () => {
34
+ await userService.logout();
35
+ routeService.reset();
36
+ routeService.gotoLogin();
37
+ }
33
38
  });
34
39
  }, [tTitle, tContent]);
35
40
 
@@ -3,6 +3,7 @@ import { messageBaseListI18n } from '@config/i18n/messageBaseListI18n';
3
3
  import { I } from '@config/IOCIdentifier';
4
4
  import {
5
5
  MessageSender,
6
+ MessageSenderExecutor,
6
7
  MessagesStore,
7
8
  MessageStatus,
8
9
  SenderStrategyPlugin,
@@ -15,7 +16,9 @@ import { useCallback, useMemo, useState } from 'react';
15
16
  import { useI18nInterface } from '../hooks/useI18nInterface';
16
17
  import { useIOC } from '../hooks/useIOC';
17
18
  import type {
19
+ GatewayOptions,
18
20
  MessageGetwayInterface,
21
+ MessageInterface,
19
22
  MessagesStateInterface,
20
23
  MessageStoreMsg
21
24
  } from '@qlover/corekit-bridge';
@@ -32,37 +35,46 @@ class MessageBaseApi implements MessageGetwayInterface {
32
35
  /**
33
36
  * @override
34
37
  */
35
- public async sendMessage<M extends MessageStoreMsg<string>>(
36
- message: M
37
- ): Promise<unknown> {
38
+ public async sendMessage<M extends MessageInterface<unknown>>(
39
+ message: M,
40
+ options?: GatewayOptions<M>
41
+ ): Promise<unknown | M> {
38
42
  const times = random(200, 1000);
39
43
 
40
44
  await ThreadUtil.sleep(times);
41
45
 
42
- const messageContent = message.content ?? '';
46
+ const messageContent = (message as any).content ?? '';
43
47
  if (messageContent.includes('Failed') || messageContent.includes('error')) {
44
- throw new Error('Failed to send message');
48
+ const error = new Error('Failed to send message');
49
+ await options?.onError?.(error);
50
+ throw error;
45
51
  }
46
52
 
47
53
  if (times % 5 === 0) {
48
- throw new Error(`Network error(${times})`);
54
+ const error = new Error(`Network error(${times})`);
55
+ await options?.onError?.(error);
56
+ throw error;
49
57
  }
50
58
 
51
59
  // Return object response to demonstrate formatting
52
- return {
60
+ const result = {
53
61
  status: 'success',
54
62
  timestamp: new Date().toISOString(),
55
63
  delay: `${times}ms`,
56
- echo: message.content,
64
+ echo: messageContent,
57
65
  data: {
58
66
  message: 'Message received successfully',
59
67
  processed: true,
60
68
  metadata: {
61
- length: message.content?.length || 0,
69
+ length: messageContent?.length || 0,
62
70
  type: 'text'
63
71
  }
64
72
  }
65
73
  };
74
+
75
+ options?.onComplete?.(message);
76
+
77
+ return result;
66
78
  }
67
79
  }
68
80
 
@@ -79,7 +91,8 @@ export function MessageBaseList() {
79
91
  const [messagesSender] = useState(() =>
80
92
  new MessageSender<MessageBaseMsg>(messagesStore, {
81
93
  gateway: messageBaseApi,
82
- logger
94
+ logger,
95
+ executor: new MessageSenderExecutor()
83
96
  }).use(new SenderStrategyPlugin(SendFailureStrategy.KEEP_FAILED))
84
97
  );
85
98
 
@@ -220,7 +233,9 @@ export function MessageBaseList() {
220
233
  <Input
221
234
  value={inputValue}
222
235
  onPressEnter={onSend}
223
- onChange={(e) => setInputValue(e.target.value)}
236
+ onChange={(e) =>
237
+ setInputValue((e.target as HTMLInputElement).value)
238
+ }
224
239
  placeholder={tt.inputPlaceholder}
225
240
  size="large"
226
241
  className="flex-1"
@@ -22,7 +22,7 @@ export class ChatMessageBridge<
22
22
 
23
23
  constructor(
24
24
  protected readonly messages: ChatMessageStore<T>,
25
- config?: MessageSenderConfig
25
+ config?: MessageSenderConfig<ChatMessage<T>>
26
26
  ) {
27
27
  this.messageSender = new MessageSender(messages, config);
28
28
  }
@@ -99,10 +99,16 @@ export class ChatMessageBridge<
99
99
  return this.messages.getFirstDraftMessage();
100
100
  }
101
101
 
102
+ /**
103
+ * @override
104
+ */
102
105
  public setRef(ref: unknown): void {
103
106
  this.ref = ref as TextAreaRef;
104
107
  }
105
108
 
109
+ /**
110
+ * @override
111
+ */
106
112
  public focus(): void {
107
113
  requestAnimationFrame(() => {
108
114
  this.ref?.focus();
@@ -80,7 +80,9 @@ export function FocusBar({ bridge, tt }: FocusBarProps) {
80
80
  autoFocus
81
81
  value={inputText}
82
82
  onKeyDown={handleKeyDown}
83
- onChange={(e) => bridge.onChangeContent(e.target.value)}
83
+ onChange={(e) =>
84
+ bridge.onChangeContent((e.target as HTMLTextAreaElement).value)
85
+ }
84
86
  placeholder={tt.inputPlaceholder}
85
87
  autoSize={{ minRows: 2, maxRows: 6 }}
86
88
  className="resize-none"
@@ -8,7 +8,8 @@ import type {
8
8
  MessageStoreMsg,
9
9
  ChatMessageStore,
10
10
  MessageGetwayInterface,
11
- GatewayOptions
11
+ GatewayOptions,
12
+ MessageInterface
12
13
  } from '@qlover/corekit-bridge';
13
14
 
14
15
  export class MessageApi implements MessageGetwayInterface {
@@ -24,11 +25,13 @@ export class MessageApi implements MessageGetwayInterface {
24
25
 
25
26
  * @override
26
27
  */
27
- public async sendMessage<M extends MessageStoreMsg<string>>(
28
+ public async sendMessage<M extends MessageInterface<unknown>>(
28
29
  message: M,
29
30
  options?: GatewayOptions<M>
30
- ): Promise<M> {
31
- const messageContent = message.content ?? '';
31
+ ): Promise<unknown | M> {
32
+ // Type assertion: we expect MessageStoreMsg<string> in this implementation
33
+ const storeMessage = message as unknown as MessageStoreMsg<string>;
34
+ const messageContent = storeMessage.content ?? '';
32
35
 
33
36
  // Check if error simulation is needed
34
37
  if (messageContent.includes('Failed') || messageContent.includes('error')) {
@@ -40,13 +43,19 @@ export class MessageApi implements MessageGetwayInterface {
40
43
  // Determine which mode to use
41
44
  if (options?.stream === true) {
42
45
  // Streaming mode: progressive output
43
- return this.sendStreamMode(message, options);
46
+ return this.sendStreamMode(
47
+ storeMessage,
48
+ options as GatewayOptions<MessageStoreMsg<string>>
49
+ ) as Promise<unknown | M>;
44
50
  } else if (options) {
45
51
  // Interruptible normal mode: one-time return, but supports stop
46
- return this.sendInterruptibleMode(message, options);
52
+ return this.sendInterruptibleMode(
53
+ storeMessage,
54
+ options as GatewayOptions<MessageStoreMsg<string>>
55
+ ) as Promise<unknown | M>;
47
56
  } else {
48
57
  // Fast normal mode: non-interruptible
49
- return this.sendNormalMode(message);
58
+ return this.sendNormalMode(storeMessage) as Promise<unknown | M>;
50
59
  }
51
60
  }
52
61
 
@@ -1 +1 @@
1
- // / <reference types="vite/client" />
1
+ /// <reference types="vite/client" />
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "module": "ESNext",
5
5
  "moduleResolution": "bundler",
6
- "lib": ["ES2023"],
6
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
7
7
  "types": ["node", "@playwright/test"],
8
8
  "noEmit": true,
9
9
  "skipLibCheck": true,
@@ -11,11 +11,14 @@
11
11
  "resolveJsonModule": true,
12
12
  "isolatedModules": true,
13
13
  "esModuleInterop": true,
14
+ "experimentalDecorators": true,
15
+ "emitDecoratorMetadata": true,
14
16
  "baseUrl": ".",
15
17
  "paths": {
18
+ "@/*": ["./src/*"],
16
19
  "@config/*": ["./config/*"]
17
20
  }
18
21
  },
19
- "include": ["e2e/**/*.ts", "playwright.config.ts"],
22
+ "include": ["src", "config", "e2e/**/*.ts", "playwright.config.ts"],
20
23
  "exclude": ["node_modules", "dist"]
21
24
  }
@@ -2,7 +2,14 @@
2
2
  "files": [],
3
3
  "compilerOptions": {
4
4
  "baseUrl": ".",
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
9
+ "experimentalDecorators": true,
10
+ "emitDecoratorMetadata": true,
5
11
  "paths": {
12
+ "@/*": ["./src/*"],
6
13
  "@config/*": ["./config/*"]
7
14
  }
8
15
  },
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
4
  "target": "ES2022",
5
- "lib": ["ES2023"],
5
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
6
6
  "module": "ESNext",
7
7
  "skipLibCheck": true,
8
8
 
@@ -18,7 +18,9 @@
18
18
  "noUnusedLocals": true,
19
19
  "noUnusedParameters": true,
20
20
  "noFallthroughCasesInSwitch": true,
21
- "noUncheckedSideEffectImports": true
21
+ "noUncheckedSideEffectImports": true,
22
+ "experimentalDecorators": true,
23
+ "emitDecoratorMetadata": true
22
24
  },
23
25
  "include": ["vite.config.ts", "makes"],
24
26
  "exclude": ["node_modules", "dist"]
@@ -2,7 +2,10 @@
2
2
  "extends": "./tsconfig.app.json",
3
3
  "compilerOptions": {
4
4
  "jsx": "react-jsx",
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
5
6
  "types": ["vitest/globals", "vite/client"],
7
+ "experimentalDecorators": true,
8
+ "emitDecoratorMetadata": true,
6
9
  "paths": {
7
10
  "@/*": ["./src/*"],
8
11
  "@config/*": ["./config/*"],
@@ -10,6 +13,6 @@
10
13
  "@__mocks__/*": ["./__tests__/__mocks__/*"]
11
14
  }
12
15
  },
13
- "include": ["__tests__/**/*"],
16
+ "include": ["src", "config", "__tests__/**/*"],
14
17
  "exclude": ["node_modules", "dist"]
15
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlover/create-app",
3
- "version": "0.11.0",
3
+ "version": "1.0.0",
4
4
  "description": "Create a new app with a single command",
5
5
  "private": false,
6
6
  "type": "module",
@@ -33,16 +33,17 @@
33
33
  "ignore": "^7.0.3",
34
34
  "lodash": "^4.17.21",
35
35
  "ora": "^8.1.1",
36
- "@qlover/logger": "0.3.3"
36
+ "@qlover/logger": "1.0.0"
37
37
  },
38
38
  "dependencies": {
39
39
  "commander": "^13.1.0",
40
40
  "inquirer": "^12.3.2",
41
- "@qlover/scripts-context": "1.2.3"
41
+ "@qlover/scripts-context": "2.0.0"
42
42
  },
43
43
  "scripts": {
44
44
  "lint": "eslint src --fix",
45
45
  "build": "tsup",
46
+ "type-check": "tsc --noEmit",
46
47
  "create:app": "node ./dist/index.js"
47
48
  }
48
49
  }
@@ -1,10 +0,0 @@
1
- import { ExecutorError } from '@qlover/fe-corekit';
2
-
3
- export class AppError extends ExecutorError {
4
- constructor(
5
- public readonly id: string,
6
- public readonly source?: string | Error
7
- ) {
8
- super(id, source);
9
- }
10
- }
@@ -1,20 +0,0 @@
1
- import type { ExecutorPlugin } from '@qlover/fe-corekit';
2
-
3
- export interface ProcesserExecutorInterface extends ExecutorPlugin {
4
- /**
5
- * 使用插件
6
- *
7
- * @param plugin - 插件
8
- */
9
- use(plugin: ExecutorPlugin): this;
10
-
11
- /**
12
- * 处理函数
13
- */
14
- handler(): Promise<{ success: boolean }>;
15
-
16
- /**
17
- * 启动
18
- */
19
- starup(): Promise<unknown>;
20
- }
@@ -1,20 +0,0 @@
1
- import type { UserInfo, UserCredential } from '@/base/apis/userApi/UserApiType';
2
- import type { RouteServiceInterface } from '../port/RouteServiceInterface';
3
- import type { UserServicePluginInterface } from '@qlover/corekit-bridge';
4
-
5
- export class UserGatewayPlugin implements UserServicePluginInterface<
6
- UserInfo,
7
- UserCredential
8
- > {
9
- public readonly pluginName = 'UserGatewayPlugin';
10
-
11
- constructor(protected routerService: RouteServiceInterface) {}
12
-
13
- /**
14
- * @override
15
- */
16
- public onLogoutSuccess(): void {
17
- this.routerService.reset();
18
- this.routerService.gotoLogin();
19
- }
20
- }