alemonjs 2.1.0-alpha.40 → 2.1.0-alpha.42

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 (78) hide show
  1. package/lib/adapter.js +114 -0
  2. package/lib/app/define-chidren.d.ts +1 -2
  3. package/lib/app/define-chidren.js +1 -1
  4. package/lib/app/event-group.d.ts +1 -2
  5. package/lib/app/event-middleware.d.ts +1 -2
  6. package/lib/app/event-middleware.js +1 -1
  7. package/lib/app/event-processor-cycle.d.ts +1 -2
  8. package/lib/app/event-processor-cycle.js +12 -6
  9. package/lib/app/event-processor-event.d.ts +2 -3
  10. package/lib/app/event-processor-middleware.d.ts +2 -3
  11. package/lib/app/event-processor-subscribe.d.ts +2 -3
  12. package/lib/app/event-processor.d.ts +1 -2
  13. package/lib/app/event-response.d.ts +1 -2
  14. package/lib/app/hook-use-api.d.ts +3 -4
  15. package/lib/app/hook-use-api.js +1 -1
  16. package/lib/app/hook-use-state.js +1 -1
  17. package/lib/app/hook-use-subscribe.d.ts +3 -4
  18. package/lib/app/hook-use-subscribe.js +1 -1
  19. package/lib/app/load.js +5 -6
  20. package/lib/app/message-api.d.ts +2 -2
  21. package/lib/app/message-api.js +1 -1
  22. package/lib/app/message-format.d.ts +7 -8
  23. package/lib/app/store.d.ts +6 -6
  24. package/lib/cbp/actions.js +1 -1
  25. package/lib/cbp/api.js +1 -1
  26. package/lib/cbp/client.js +1 -1
  27. package/lib/cbp/connect.js +1 -1
  28. package/lib/cbp/platform.d.ts +1 -2
  29. package/lib/cbp/platform.js +3 -3
  30. package/lib/cbp/server.js +1 -1
  31. package/lib/cbp/testone.js +1 -1
  32. package/lib/cbp/typings.d.ts +2 -3
  33. package/lib/core/config.d.ts +1 -2
  34. package/lib/core/config.js +1 -2
  35. package/lib/core/utils.d.ts +1 -1
  36. package/lib/core/utils.js +2 -3
  37. package/lib/core/variable.d.ts +16 -0
  38. package/lib/core/variable.js +19 -6
  39. package/lib/global.d.ts +5 -5
  40. package/lib/index.d.ts +29 -29
  41. package/lib/index.js +3 -3
  42. package/lib/main.js +14 -28
  43. package/lib/types/actions.d.ts +93 -0
  44. package/lib/types/apis.d.ts +18 -0
  45. package/lib/types/client/index.d.ts +66 -0
  46. package/lib/types/cycle/index.d.ts +42 -0
  47. package/lib/types/event/actions.d.ts +37 -0
  48. package/lib/types/event/actions.js +72 -0
  49. package/lib/types/event/base/expansion.d.ts +5 -0
  50. package/lib/types/event/base/guild.d.ts +18 -0
  51. package/lib/types/event/base/message.d.ts +28 -0
  52. package/lib/types/event/base/platform.d.ts +16 -0
  53. package/lib/types/event/base/user.d.ts +34 -0
  54. package/lib/types/event/channal/index.d.ts +13 -0
  55. package/lib/types/event/guild/index.d.ts +13 -0
  56. package/lib/types/event/index.d.ts +94 -0
  57. package/lib/types/event/interaction/index.d.ts +14 -0
  58. package/lib/types/event/map.d.ts +36 -0
  59. package/lib/types/event/member/index.d.ts +14 -0
  60. package/lib/types/event/message/message.d.ts +23 -0
  61. package/lib/types/event/message/private.message.d.ts +16 -0
  62. package/lib/types/event/request/index.d.ts +13 -0
  63. package/lib/types/logger/index.d.ts +49 -0
  64. package/lib/types/message/ark.d.ts +46 -0
  65. package/lib/types/message/button.d.ts +32 -0
  66. package/lib/types/message/image.d.ts +23 -0
  67. package/lib/types/message/index.d.ts +16 -0
  68. package/lib/types/message/link.d.ts +12 -0
  69. package/lib/types/message/markdown.d.ts +91 -0
  70. package/lib/types/message/mention.d.ts +16 -0
  71. package/lib/types/message/text.d.ts +12 -0
  72. package/lib/types/package/index.d.ts +12 -0
  73. package/lib/types/state/index.d.ts +5 -0
  74. package/lib/types/store/res.d.ts +75 -0
  75. package/lib/types/subscribe/index.d.ts +30 -0
  76. package/lib/utils.d.ts +0 -1
  77. package/lib/utils.js +3 -8
  78. package/package.json +1 -1
@@ -0,0 +1,94 @@
1
+ import { Next, ChildrenCycle } from '../cycle/index.js';
2
+ import { ClientAPI } from '../client/index.js';
3
+ import { EventKeys, Events } from './map.js';
4
+ import { DataEnums } from '../message/index.js';
5
+
6
+ /**
7
+ * 当前结果
8
+ */
9
+ type CurrentResult = {
10
+ allowGrouping?: boolean;
11
+ data?: DataEnums[];
12
+ [key: string]: any;
13
+ };
14
+ type CurrentResultValue = void | CurrentResult['allowGrouping'] | CurrentResult | CurrentResult['data'];
15
+ /**
16
+ * 当前事件
17
+ */
18
+ type Current<T extends EventKeys> = (event: Events[T], next: Next) => CurrentResultValue;
19
+ type OnResponseValue<C, T extends EventKeys> = {
20
+ current: C;
21
+ select: T | T[];
22
+ };
23
+ /**
24
+ * 定义一个响应
25
+ */
26
+ type OnResponseFunc = <T extends EventKeys, C extends Current<T> | Current<T>[]>(callback: C, select: T | T[]) => OnResponseValue<C, T>;
27
+ type OnResponseReversalFunc = <T extends EventKeys, C extends Current<T> | Current<T>[]>(select: T | T[], callback: C) => OnResponseValue<C, T>;
28
+ /**
29
+ * 废弃
30
+ * @deprecated
31
+ */
32
+ type OnResponseReversalFuncBack = <T extends EventKeys, C extends Current<T> | Current<T>[]>(callback: C, select: T | T[]) => OnResponseValue<C, T>;
33
+ /**
34
+ * 定义一个中间件
35
+ */
36
+ type OnMiddlewareFunc = <T extends EventKeys, C extends Current<T> | Current<T>[]>(callback: C, select: T | T[]) => OnMiddlewareValue<C, T>;
37
+ /**
38
+ *
39
+ */
40
+ type OnMiddlewareReversalFunc = <T extends EventKeys, C extends Current<T> | Current<T>[]>(select: T | T[], callback: C) => OnMiddlewareValue<C, T>;
41
+ /**
42
+ * 废弃
43
+ * @deprecated
44
+ */
45
+ type OnMiddlewareReversalFuncBack = <C extends Current<T> | Current<T>[], T extends EventKeys>(callback: C, select: T | T[]) => OnMiddlewareValue<C, T>;
46
+ /**
47
+ *
48
+ */
49
+ type OnMiddlewareValue<C, T extends EventKeys> = {
50
+ current: C;
51
+ select: T | T[];
52
+ };
53
+ /**
54
+ *
55
+ */
56
+ type DefineChildrenCallback = (() => Promise<ChildrenCycle> | ChildrenCycle) | ChildrenCycle;
57
+ /**
58
+ * 定义子模块
59
+ */
60
+ type DefineChildrenValue = {
61
+ _name: 'app';
62
+ callback: DefineChildrenCallback;
63
+ };
64
+ /**
65
+ *
66
+ */
67
+ type DefineChildrenFunc = (callback: (() => ChildrenCycle) | ChildrenCycle) => DefineChildrenValue;
68
+ /**
69
+ * 函数
70
+ */
71
+ type DefinePlatformCallback = (() => Promise<ClientAPI> | ClientAPI) | ClientAPI;
72
+ /**
73
+ * 返回值
74
+ */
75
+ type DefinePlatformValue = {
76
+ _name: 'platform';
77
+ callback: DefinePlatformCallback;
78
+ };
79
+ /**
80
+ * 定义一个平台
81
+ */
82
+ type DefinePlatformFunc = (callback: DefinePlatformCallback) => DefinePlatformValue;
83
+ /**
84
+ * 定义选择器
85
+ */
86
+ type OnSelectsFunc = <T extends EventKeys[] | EventKeys>(values: T) => T;
87
+ /**
88
+ * 定义数据格式
89
+ */
90
+ type OnDataFormatFunc = (...data: DataEnums[]) => DataEnums[];
91
+ type OnGroupItem<C = any, T extends EventKeys = EventKeys> = OnResponseValue<C, T> | OnMiddlewareValue<C, T>;
92
+ type OnGroupFunc = <C, T extends EventKeys, TFirst extends OnGroupItem<C, T>>(...calls: [TFirst, ...Array<TFirst>]) => TFirst;
93
+
94
+ export type { Current, CurrentResult, CurrentResultValue, DefineChildrenCallback, DefineChildrenFunc, DefineChildrenValue, DefinePlatformCallback, DefinePlatformFunc, DefinePlatformValue, OnDataFormatFunc, OnGroupFunc, OnGroupItem, OnMiddlewareFunc, OnMiddlewareReversalFunc, OnMiddlewareReversalFuncBack, OnMiddlewareValue, OnResponseFunc, OnResponseReversalFunc, OnResponseReversalFuncBack, OnResponseValue, OnSelectsFunc };
@@ -0,0 +1,14 @@
1
+ import { Guild, Channel } from '../base/guild.js';
2
+ import { MessageText, MessageOpen, Message } from '../base/message.js';
3
+ import { User } from '../base/user.js';
4
+ import { platform } from '../base/platform.js';
5
+ import { Expansion } from '../base/expansion.js';
6
+
7
+ type PrivateEventInteractionCreate = MessageText & MessageOpen & platform & Message & User & {
8
+ name: 'private.interaction.create';
9
+ } & Expansion;
10
+ type PublicEventInteractionCreate = MessageText & MessageOpen & platform & Guild & Channel & Message & User & {
11
+ name: 'interaction.create';
12
+ } & Expansion;
13
+
14
+ export type { PrivateEventInteractionCreate, PublicEventInteractionCreate };
@@ -0,0 +1,36 @@
1
+ import { PublicEventChannalCreate, PublicEventChannalDelete } from './channal/index.js';
2
+ import { PublicEventGuildJoin, PublicEventGuildExit } from './guild/index.js';
3
+ import { PublicEventInteractionCreate, PrivateEventInteractionCreate } from './interaction/index.js';
4
+ import { PublicEventMemberAdd, PublicEventMemberRemove } from './member/index.js';
5
+ import { PublicEventMessageUpdate, PublicEventMessageDelete, PublicEventMessageReactionAdd, PublicEventMessageReactionRemove, PublicEventMessageCreate } from './message/message.js';
6
+ import { PrivateEventMessageUpdate, PrivateEventMessageDelete, PrivateEventMessageCreate } from './message/private.message.js';
7
+ import { PrivateEventRequestFriendAdd, PrivateEventRequestGuildAdd } from './request/index.js';
8
+
9
+ type EventsMessageCreate = {
10
+ 'message.create': PublicEventMessageCreate;
11
+ 'private.message.create': PrivateEventMessageCreate;
12
+ 'interaction.create': PublicEventInteractionCreate;
13
+ 'private.interaction.create': PrivateEventInteractionCreate;
14
+ };
15
+ type EventsMessageCreateKeys = keyof EventsMessageCreate;
16
+ type EventsMessageCreateEnum = Events[EventsMessageCreateKeys];
17
+ type Events = {
18
+ 'message.update': PublicEventMessageUpdate;
19
+ 'message.delete': PublicEventMessageDelete;
20
+ 'message.reaction.add': PublicEventMessageReactionAdd;
21
+ 'message.reaction.remove': PublicEventMessageReactionRemove;
22
+ 'channal.create': PublicEventChannalCreate;
23
+ 'channal.delete': PublicEventChannalDelete;
24
+ 'guild.join': PublicEventGuildJoin;
25
+ 'guild.exit': PublicEventGuildExit;
26
+ 'member.add': PublicEventMemberAdd;
27
+ 'member.remove': PublicEventMemberRemove;
28
+ 'private.message.update': PrivateEventMessageUpdate;
29
+ 'private.message.delete': PrivateEventMessageDelete;
30
+ 'private.friend.add': PrivateEventRequestFriendAdd;
31
+ 'private.guild.add': PrivateEventRequestGuildAdd;
32
+ } & EventsMessageCreate;
33
+ type EventKeys = keyof Events;
34
+ type EventsEnum = Events[EventKeys];
35
+
36
+ export type { EventKeys, Events, EventsEnum, EventsMessageCreate, EventsMessageCreateEnum, EventsMessageCreateKeys };
@@ -0,0 +1,14 @@
1
+ import { Guild, Channel } from '../base/guild.js';
2
+ import { Message } from '../base/message.js';
3
+ import { User } from '../base/user.js';
4
+ import { platform } from '../base/platform.js';
5
+ import { Expansion } from '../base/expansion.js';
6
+
7
+ type PublicEventMemberAdd = platform & Guild & Channel & Message & User & {
8
+ naem: 'member.add';
9
+ } & Expansion;
10
+ type PublicEventMemberRemove = platform & Guild & Channel & Message & User & {
11
+ name: 'member.remove';
12
+ } & Expansion;
13
+
14
+ export type { PublicEventMemberAdd, PublicEventMemberRemove };
@@ -0,0 +1,23 @@
1
+ import { Guild, Channel } from '../base/guild.js';
2
+ import { Message, MessageText, MessageOpen } from '../base/message.js';
3
+ import { User } from '../base/user.js';
4
+ import { platform } from '../base/platform.js';
5
+ import { Expansion } from '../base/expansion.js';
6
+
7
+ type PublicEventMessageCreate = MessageText & MessageOpen & platform & Guild & Channel & Message & User & {
8
+ name: 'message.create';
9
+ } & Expansion;
10
+ type PublicEventMessageUpdate = platform & Guild & Channel & Message & User & {
11
+ name: 'message.update';
12
+ } & Expansion;
13
+ type PublicEventMessageDelete = platform & Guild & Channel & Message & {
14
+ name: 'message.delete';
15
+ } & Expansion;
16
+ type PublicEventMessageReactionAdd = platform & Guild & Channel & Message & {
17
+ name: 'message.reaction.add';
18
+ } & Expansion;
19
+ type PublicEventMessageReactionRemove = platform & Guild & Channel & Message & {
20
+ name: 'message.reaction.remove';
21
+ } & Expansion;
22
+
23
+ export type { PublicEventMessageCreate, PublicEventMessageDelete, PublicEventMessageReactionAdd, PublicEventMessageReactionRemove, PublicEventMessageUpdate };
@@ -0,0 +1,16 @@
1
+ import { Expansion } from '../base/expansion.js';
2
+ import { Message, MessageText, MessageOpen } from '../base/message.js';
3
+ import { platform } from '../base/platform.js';
4
+ import { User } from '../base/user.js';
5
+
6
+ type PrivateEventMessageCreate = MessageText & MessageOpen & platform & Message & User & {
7
+ name: 'private.message.create';
8
+ } & Expansion;
9
+ type PrivateEventMessageUpdate = platform & Message & User & {
10
+ name: 'private.message.update';
11
+ } & Expansion;
12
+ type PrivateEventMessageDelete = platform & Message & {
13
+ name: 'private.message.delete';
14
+ } & Expansion;
15
+
16
+ export type { PrivateEventMessageCreate, PrivateEventMessageDelete, PrivateEventMessageUpdate };
@@ -0,0 +1,13 @@
1
+ import { Expansion } from '../base/expansion.js';
2
+ import { Message } from '../base/message.js';
3
+ import { platform } from '../base/platform.js';
4
+ import { User } from '../base/user.js';
5
+
6
+ type PrivateEventRequestFriendAdd = platform & Message & User & {
7
+ name: 'private.request.friend.add';
8
+ } & Expansion;
9
+ type PrivateEventRequestGuildAdd = platform & Message & User & {
10
+ name: 'private.request.guild.add';
11
+ } & Expansion;
12
+
13
+ export type { PrivateEventRequestFriendAdd, PrivateEventRequestGuildAdd };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Logger interface
3
+ */
4
+ type LoggerUtils = {
5
+ /**
6
+ * trace
7
+ * @param args
8
+ * @returns
9
+ */
10
+ trace: (...args: any[]) => void;
11
+ /**
12
+ * debug
13
+ * @param args
14
+ * @returns
15
+ */
16
+ debug: (...args: any[]) => void;
17
+ /**
18
+ * info
19
+ * @param args
20
+ * @returns
21
+ */
22
+ info: (...args: any[]) => void;
23
+ /**
24
+ * warn
25
+ * @param args
26
+ * @returns
27
+ */
28
+ warn: (...args: any[]) => void;
29
+ /**
30
+ * error
31
+ * @param args
32
+ * @returns
33
+ */
34
+ error: (...args: any[]) => void;
35
+ /**
36
+ * fatal
37
+ * @param args
38
+ * @returns
39
+ */
40
+ fatal: (...args: any[]) => void;
41
+ /**
42
+ * mark
43
+ * @param args
44
+ * @returns
45
+ */
46
+ mark: (...args: any[]) => void;
47
+ };
48
+
49
+ export type { LoggerUtils };
@@ -0,0 +1,46 @@
1
+ type DataArkListTip = {
2
+ type: 'Ark.listTip';
3
+ value: {
4
+ desc: string;
5
+ prompt: string;
6
+ };
7
+ };
8
+ type DataArkListItem = {
9
+ type: 'Ark.listItem';
10
+ value: string | {
11
+ title: string;
12
+ link: string;
13
+ };
14
+ };
15
+ type DataArkListContent = {
16
+ type: 'Ark.listContent';
17
+ value: DataArkListItem[];
18
+ };
19
+ type DataArkList = {
20
+ type: 'Ark.list';
21
+ value: [DataArkListTip, DataArkListContent];
22
+ };
23
+ type DataArkCard = {
24
+ type: 'Ark.Card';
25
+ value: {
26
+ title: string;
27
+ cover: string;
28
+ link: string;
29
+ subtitle: string;
30
+ decs: string;
31
+ prompt: string;
32
+ metadecs: string;
33
+ };
34
+ };
35
+ type DataArkBigCard = {
36
+ type: 'Ark.BigCard';
37
+ value: {
38
+ title: string;
39
+ subtitle: string;
40
+ cover: string;
41
+ link: string;
42
+ prompt: string;
43
+ };
44
+ };
45
+
46
+ export type { DataArkBigCard, DataArkCard, DataArkList, DataArkListContent, DataArkListItem, DataArkListTip };
@@ -0,0 +1,32 @@
1
+ type DataButton = {
2
+ type: 'Button';
3
+ value: string | {
4
+ title: string;
5
+ label: string;
6
+ };
7
+ options?: {
8
+ toolTip?: string;
9
+ autoEnter?: boolean;
10
+ showList?: boolean;
11
+ data?: string | {
12
+ click: string;
13
+ confirm: string;
14
+ cancel: string;
15
+ };
16
+ type?: 'command' | 'link' | 'call';
17
+ };
18
+ };
19
+ type ButtonRow = {
20
+ type: 'BT.row';
21
+ value: DataButton[];
22
+ };
23
+ type DataButtonGroup = {
24
+ type: 'BT.group';
25
+ value: ButtonRow[];
26
+ };
27
+ type DataButtonTemplate = {
28
+ type: 'ButtonTemplate';
29
+ value: string;
30
+ };
31
+
32
+ export type { ButtonRow, DataButton, DataButtonGroup, DataButtonTemplate };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 图片数据
3
+ */
4
+ type DataImage = {
5
+ type: 'Image';
6
+ value: string;
7
+ };
8
+ /**
9
+ * 图片链接
10
+ */
11
+ type DataImageURL = {
12
+ type: 'ImageURL';
13
+ value: string;
14
+ };
15
+ /**
16
+ * 图片文件
17
+ */
18
+ type DataImageFile = {
19
+ type: 'ImageFile';
20
+ value: string;
21
+ };
22
+
23
+ export type { DataImage, DataImageFile, DataImageURL };
@@ -0,0 +1,16 @@
1
+ import { DataButtonGroup, DataButtonTemplate } from './button.js';
2
+ export { ButtonRow, DataButton } from './button.js';
3
+ import { DataArkList, DataArkCard, DataArkBigCard } from './ark.js';
4
+ export { DataArkListContent, DataArkListItem, DataArkListTip } from './ark.js';
5
+ import { DataMarkDown, DataMarkdownTemplate } from './markdown.js';
6
+ export { DataMarkdownBlockquote, DataMarkdownBold, DataMarkdownCode, DataMarkdownDivider, DataMarkdownImage, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownLink, DataMarkdownList, DataMarkdownListItem, DataMarkdownNewline, DataMarkdownStrikethrough, DataMarkdownSubtitle, DataMarkdownText, DataMarkdownTitle } from './markdown.js';
7
+ import { DataImage, DataImageURL, DataImageFile } from './image.js';
8
+ import { DataText } from './text.js';
9
+ import { DataMention } from './mention.js';
10
+ import { DataLink } from './link.js';
11
+
12
+ type DataEnums = DataText | DataLink | DataImage | DataImageURL | DataImageFile | DataMention | DataButtonGroup | DataButtonTemplate | DataArkList | DataArkCard | DataArkBigCard | DataMarkDown | DataMarkdownTemplate;
13
+ type MessageDataFormat = DataEnums[];
14
+
15
+ export { DataArkBigCard, DataArkCard, DataArkList, DataButtonGroup, DataButtonTemplate, DataImage, DataImageFile, DataImageURL, DataLink, DataMarkDown, DataMarkdownTemplate, DataMention, DataText };
16
+ export type { DataEnums, MessageDataFormat };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 文本数据
3
+ */
4
+ type DataLink = {
5
+ type: 'Link';
6
+ value: string;
7
+ options?: {
8
+ link: string;
9
+ };
10
+ };
11
+
12
+ export type { DataLink };
@@ -0,0 +1,91 @@
1
+ /**
2
+ *
3
+ */
4
+ type DataMarkdownTemplate = {
5
+ type: 'MarkdownTemplate';
6
+ value: string;
7
+ options: {
8
+ params: {
9
+ [key: string]: string;
10
+ };
11
+ };
12
+ };
13
+ type DataMarkdownText = {
14
+ type: 'MD.text';
15
+ value: string;
16
+ };
17
+ type DataMarkdownTitle = {
18
+ type: 'MD.title';
19
+ value: string;
20
+ };
21
+ type DataMarkdownSubtitle = {
22
+ type: 'MD.subtitle';
23
+ value: string;
24
+ };
25
+ type DataMarkdownBold = {
26
+ type: 'MD.bold';
27
+ value: string;
28
+ };
29
+ type DataMarkdownItalic = {
30
+ type: 'MD.italic';
31
+ value: string;
32
+ };
33
+ type DataMarkdownItalicStar = {
34
+ type: 'MD.italicStar';
35
+ value: string;
36
+ };
37
+ type DataMarkdownStrikethrough = {
38
+ type: 'MD.strikethrough';
39
+ value: string;
40
+ };
41
+ type DataMarkdownLink = {
42
+ type: 'MD.link';
43
+ value: {
44
+ text: string;
45
+ url: string;
46
+ };
47
+ };
48
+ type DataMarkdownImage = {
49
+ type: 'MD.image';
50
+ value: string;
51
+ options?: {
52
+ width?: number;
53
+ height?: number;
54
+ };
55
+ };
56
+ type DataMarkdownListItem = {
57
+ type: 'MD.listItem';
58
+ value: string | {
59
+ index: number;
60
+ text?: string;
61
+ };
62
+ };
63
+ type DataMarkdownList = {
64
+ type: 'MD.list';
65
+ value: DataMarkdownListItem[];
66
+ };
67
+ type DataMarkdownBlockquote = {
68
+ type: 'MD.blockquote';
69
+ value: string;
70
+ };
71
+ type DataMarkdownDivider = {
72
+ type: 'MD.divider';
73
+ };
74
+ type DataMarkdownNewline = {
75
+ type: 'MD.newline';
76
+ value: boolean;
77
+ };
78
+ type DataMarkdownCode = {
79
+ type: 'MD.code';
80
+ value: string;
81
+ options?: {
82
+ language?: string;
83
+ };
84
+ };
85
+ type DataMarkDownBalue = DataMarkdownText | DataMarkdownTitle | DataMarkdownSubtitle | DataMarkdownBold | DataMarkdownItalic | DataMarkdownItalicStar | DataMarkdownStrikethrough | DataMarkdownLink | DataMarkdownImage | DataMarkdownList | DataMarkdownBlockquote | DataMarkdownDivider | DataMarkdownNewline | DataMarkdownCode;
86
+ type DataMarkDown = {
87
+ type: 'Markdown';
88
+ value: DataMarkDownBalue[];
89
+ };
90
+
91
+ export type { DataMarkDown, DataMarkdownBlockquote, DataMarkdownBold, DataMarkdownCode, DataMarkdownDivider, DataMarkdownImage, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownLink, DataMarkdownList, DataMarkdownListItem, DataMarkdownNewline, DataMarkdownStrikethrough, DataMarkdownSubtitle, DataMarkdownTemplate, DataMarkdownText, DataMarkdownTitle };
@@ -0,0 +1,16 @@
1
+ import { User } from '../event/base/user.js';
2
+ import { Guild, Channel } from '../event/base/guild.js';
3
+
4
+ /**
5
+ * 提及数据
6
+ */
7
+ type DataMention = {
8
+ type: 'Mention';
9
+ value?: string;
10
+ options?: {
11
+ belong?: 'user' | 'guild' | 'channel' | 'everyone';
12
+ payload?: User | Guild | Channel | 'everyone';
13
+ };
14
+ };
15
+
16
+ export type { DataMention };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 文本数据
3
+ */
4
+ type DataText = {
5
+ type: 'Text';
6
+ value: string;
7
+ options?: {
8
+ style?: 'none' | 'bold' | 'block' | 'strikethrough' | 'boldItalic' | 'italic';
9
+ };
10
+ };
11
+
12
+ export type { DataText };
@@ -0,0 +1,12 @@
1
+ type Package = {
2
+ [key: string]: any;
3
+ name: string | null;
4
+ version: string | null;
5
+ description: string | null;
6
+ author: string | null;
7
+ license: string | null;
8
+ type: string | null;
9
+ private: boolean | null;
10
+ };
11
+
12
+ export type { Package };
@@ -0,0 +1,5 @@
1
+ interface ResponseState {
2
+ [key: string]: boolean;
3
+ }
4
+
5
+ export type { ResponseState };
@@ -0,0 +1,75 @@
1
+ import { ChildrenCycle } from '../cycle/index.js';
2
+ import { EventKeys } from '../event/map.js';
3
+
4
+ type StoreResponseItem = {
5
+ /**
6
+ * 来源
7
+ */
8
+ input: string;
9
+ /**
10
+ * 目录
11
+ */
12
+ dir: string;
13
+ /**
14
+ * 文件路径
15
+ */
16
+ path: string;
17
+ /**
18
+ * 文件名
19
+ */
20
+ name: string;
21
+ /**
22
+ * 节点
23
+ */
24
+ appName: string;
25
+ /**
26
+ *
27
+ */
28
+ stateKey?: string;
29
+ /**
30
+ *
31
+ */
32
+ value?: {
33
+ /**
34
+ * 事件
35
+ */
36
+ select: string;
37
+ } | null;
38
+ };
39
+ type StoreMiddlewareItem = {
40
+ /**
41
+ * 来源
42
+ */
43
+ input: string;
44
+ dir: string;
45
+ path: string;
46
+ name: string;
47
+ appName: string;
48
+ stateKey?: string;
49
+ value?: {
50
+ select: string;
51
+ } | null;
52
+ };
53
+ /**
54
+ *
55
+ */
56
+ type StoreMiddleware = {
57
+ [key in EventKeys]: StoreResponseItem[];
58
+ };
59
+ /**
60
+ *
61
+ */
62
+ type StoreResponse = {
63
+ [key in EventKeys]: StoreMiddlewareItem[];
64
+ };
65
+ /**
66
+ *
67
+ */
68
+ type StoreChildrenApp = {
69
+ name: string;
70
+ middleware: StoreMiddlewareItem[];
71
+ response: StoreResponseItem[];
72
+ cycle: ChildrenCycle;
73
+ };
74
+
75
+ export type { StoreChildrenApp, StoreMiddleware, StoreMiddlewareItem, StoreResponse, StoreResponseItem };
@@ -0,0 +1,30 @@
1
+ import { SinglyLinkedList } from '../../datastructure/SinglyLinkedList.js';
2
+ import { EventCycleEnum } from '../cycle/index.js';
3
+ import { EventKeys } from '../event/map.js';
4
+
5
+ /**
6
+ * subscribe
7
+ */
8
+ type SubscribeValue = {
9
+ choose: EventCycleEnum;
10
+ selects: EventKeys[];
11
+ keys: {
12
+ [key: string]: string | number | boolean;
13
+ };
14
+ current: Function;
15
+ id: string;
16
+ };
17
+ type SubscribeMap = Map<string, SinglyLinkedList<SubscribeValue>>;
18
+ type SubscribeKeysMap = {
19
+ create: SubscribeMap;
20
+ mount: SubscribeMap;
21
+ unmount: SubscribeMap;
22
+ };
23
+ /**
24
+ * state subscribe
25
+ */
26
+ interface StateSubscribeMap {
27
+ [key: string]: Array<(value: boolean) => void>;
28
+ }
29
+
30
+ export type { StateSubscribeMap, SubscribeKeysMap, SubscribeMap, SubscribeValue };
package/lib/utils.d.ts CHANGED
@@ -70,7 +70,6 @@ declare const getPublicIP: (options?: Options & {
70
70
  * 正则表达式工具类
71
71
  */
72
72
  declare class Regular extends RegExp {
73
- constructor(pattern: string, flags?: string);
74
73
  static or(...regs: RegExp[]): Regular;
75
74
  static and(...regs: RegExp[]): Regular;
76
75
  or(...regs: RegExp[]): Regular;