alemonjs 2.1.41 → 2.1.43
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.
- package/lib/app/define/define-children.d.ts +8 -0
- package/lib/app/define/define-children.js +25 -0
- package/lib/app/define/define-middleware.d.ts +2 -0
- package/lib/app/define/define-middleware.js +8 -0
- package/lib/app/define/define-platform.d.ts +13 -0
- package/lib/app/define/define-platform.js +40 -0
- package/lib/app/define/define-response.d.ts +2 -0
- package/lib/app/define/define-response.js +8 -0
- package/lib/app/define/define-router.d.ts +17 -0
- package/lib/app/define/define-router.js +34 -0
- package/lib/app/event/event-group.d.ts +9 -0
- package/lib/app/event/event-group.js +29 -0
- package/lib/app/event/event-middleware.d.ts +23 -0
- package/lib/app/event/event-middleware.js +44 -0
- package/lib/app/event/event-response.d.ts +16 -0
- package/lib/app/event/event-response.js +23 -0
- package/lib/app/event/event-selects.d.ts +13 -0
- package/lib/app/event/event-selects.js +15 -0
- package/lib/app/event-processor/event-processor-callHandler.d.ts +1 -0
- package/lib/app/event-processor/event-processor-callHandler.js +43 -0
- package/lib/app/event-processor/event-processor-cycle.d.ts +14 -0
- package/lib/app/event-processor/event-processor-cycle.js +97 -0
- package/lib/app/event-processor/event-processor-cycleFiles.d.ts +11 -0
- package/lib/app/event-processor/event-processor-cycleFiles.js +147 -0
- package/lib/app/event-processor/event-processor-cycleRoute.d.ts +10 -0
- package/lib/app/event-processor/event-processor-cycleRoute.js +133 -0
- package/lib/app/event-processor/event-processor-event.d.ts +24 -0
- package/lib/app/event-processor/event-processor-event.js +41 -0
- package/lib/app/event-processor/event-processor-middleware.d.ts +14 -0
- package/lib/app/event-processor/event-processor-middleware.js +31 -0
- package/lib/app/event-processor/event-processor-subscribe.d.ts +35 -0
- package/lib/app/event-processor/event-processor-subscribe.js +115 -0
- package/lib/app/event-processor/event-processor.d.ts +17 -0
- package/lib/app/event-processor/event-processor.js +207 -0
- package/lib/app/hook-use/hook-use-api.d.ts +6 -0
- package/lib/app/hook-use/hook-use-api.js +22 -0
- package/lib/app/hook-use/hook-use-channel.d.ts +8 -0
- package/lib/app/hook-use/hook-use-channel.js +33 -0
- package/lib/app/hook-use/hook-use-client.d.ts +7 -0
- package/lib/app/hook-use/hook-use-client.js +27 -0
- package/lib/app/hook-use/hook-use-me.d.ts +8 -0
- package/lib/app/hook-use/hook-use-me.js +45 -0
- package/lib/app/hook-use/hook-use-menber.d.ts +8 -0
- package/lib/app/hook-use/hook-use-menber.js +59 -0
- package/lib/app/hook-use/hook-use-mention.d.ts +23 -0
- package/lib/app/hook-use/hook-use-mention.js +105 -0
- package/lib/app/hook-use/hook-use-message.d.ts +29 -0
- package/lib/app/hook-use/hook-use-message.js +88 -0
- package/lib/app/hook-use/hook-use-state.d.ts +30 -0
- package/lib/app/hook-use/hook-use-state.js +101 -0
- package/lib/app/hook-use/hook-use-subscribe.d.ts +46 -0
- package/lib/app/hook-use/hook-use-subscribe.js +143 -0
- package/lib/app/hook-use-api.d.ts +1 -3
- package/lib/app/hook-use-api.js +3 -3
- package/lib/app/index.js +1 -1
- package/lib/app/message/message-api.d.ts +69 -0
- package/lib/app/message/message-api.js +105 -0
- package/lib/app/message/message-format-old.d.ts +143 -0
- package/lib/app/message/message-format-old.js +359 -0
- package/lib/app/message/message-format.d.ts +215 -0
- package/lib/app/message/message-format.js +382 -0
- package/lib/app/message-api.d.ts +13 -0
- package/lib/app/message-api.js +45 -1
- package/lib/app/message-format.old.d.ts +50 -0
- package/lib/app/message-format.old.js +217 -0
- package/lib/cbp/connects/platform.js +3 -3
- package/lib/cbp/processor/actions.js +5 -4
- package/lib/cbp/processor/api.js +5 -4
- package/lib/cbp/processor/handle.d.ts +3 -0
- package/lib/cbp/processor/handle.js +32 -0
- package/lib/core/index.js +1 -1
- package/lib/core/utils.d.ts +1 -0
- package/lib/core/utils.js +5 -1
- package/lib/index.js +2 -2
- package/lib/jsx/index.d.ts +105 -0
- package/lib/jsx/index.js +211 -0
- package/lib/jsx/jsx-dev-runtime.d.ts +2 -0
- package/lib/jsx/jsx-dev-runtime.js +1 -0
- package/lib/jsx/jsx-runtime.d.ts +18 -0
- package/lib/jsx/jsx-runtime.js +24 -0
- package/lib/process/client.js +109 -0
- package/lib/process/direct-channel.js +3 -1
- package/lib/process/ipc-bridge.js +10 -4
- package/lib/store/SinglyLinkedList.d.ts +22 -0
- package/lib/store/SinglyLinkedList.js +97 -0
- package/lib/store/store.d.ts +127 -0
- package/lib/store/store.js +443 -0
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
const Text = (val, options) => {
|
|
2
|
+
return {
|
|
3
|
+
type: 'Text',
|
|
4
|
+
value: val,
|
|
5
|
+
options
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
const Link = (val, options) => {
|
|
9
|
+
return {
|
|
10
|
+
type: 'Text',
|
|
11
|
+
value: val,
|
|
12
|
+
options
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const ImageURL = (val) => {
|
|
16
|
+
return {
|
|
17
|
+
type: 'ImageURL',
|
|
18
|
+
value: val
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const ImageFile = (val) => {
|
|
22
|
+
return {
|
|
23
|
+
type: 'ImageFile',
|
|
24
|
+
value: val
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const Image = (val) => {
|
|
28
|
+
return {
|
|
29
|
+
type: 'Image',
|
|
30
|
+
value: val.toString('base64')
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
Image.url = ImageURL;
|
|
34
|
+
Image.file = ImageFile;
|
|
35
|
+
const Mention = (UserId, options) => {
|
|
36
|
+
return {
|
|
37
|
+
type: 'Mention',
|
|
38
|
+
value: UserId,
|
|
39
|
+
options: options ?? {
|
|
40
|
+
belong: 'user'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const BT = (title, data, options) => {
|
|
45
|
+
return {
|
|
46
|
+
type: 'Button',
|
|
47
|
+
value: title,
|
|
48
|
+
options: {
|
|
49
|
+
data,
|
|
50
|
+
...options
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
BT.group = function Group(...rows) {
|
|
55
|
+
return {
|
|
56
|
+
type: 'BT.group',
|
|
57
|
+
value: rows
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
BT.template = function Template(templateId) {
|
|
61
|
+
return {
|
|
62
|
+
type: 'ButtonTemplate',
|
|
63
|
+
value: templateId
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
BT.row = function Row(...buttons) {
|
|
67
|
+
return {
|
|
68
|
+
type: 'BT.row',
|
|
69
|
+
value: buttons
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const Ark = {
|
|
73
|
+
list: (...values) => {
|
|
74
|
+
return {
|
|
75
|
+
type: 'Ark.list',
|
|
76
|
+
value: values
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
listTip: (options) => {
|
|
80
|
+
return {
|
|
81
|
+
type: 'Ark.listTip',
|
|
82
|
+
value: options
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
listContent: (...values) => {
|
|
86
|
+
return {
|
|
87
|
+
type: 'Ark.listContent',
|
|
88
|
+
value: values
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
listItem: (value) => {
|
|
92
|
+
return {
|
|
93
|
+
type: 'Ark.listItem',
|
|
94
|
+
value: value
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
Card: (value) => {
|
|
98
|
+
return {
|
|
99
|
+
type: 'Ark.Card',
|
|
100
|
+
value: value
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
BigCard: (value) => {
|
|
104
|
+
return {
|
|
105
|
+
type: 'Ark.BigCard',
|
|
106
|
+
value
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const MD = (...values) => {
|
|
111
|
+
return {
|
|
112
|
+
type: 'Markdown',
|
|
113
|
+
value: values
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
MD.template = (templateId, params) => {
|
|
117
|
+
return {
|
|
118
|
+
type: 'MarkdownTemplate',
|
|
119
|
+
value: templateId,
|
|
120
|
+
options: {
|
|
121
|
+
params
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
MD.text = (text) => {
|
|
126
|
+
return {
|
|
127
|
+
type: 'MD.text',
|
|
128
|
+
value: text
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
MD.title = (text) => {
|
|
132
|
+
return {
|
|
133
|
+
type: 'MD.title',
|
|
134
|
+
value: text
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
MD.subtitle = (text) => {
|
|
138
|
+
return {
|
|
139
|
+
type: 'MD.subtitle',
|
|
140
|
+
value: text
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
MD.bold = (text) => {
|
|
144
|
+
return {
|
|
145
|
+
type: 'MD.bold',
|
|
146
|
+
value: text
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
MD.italic = (text) => {
|
|
150
|
+
return {
|
|
151
|
+
type: 'MD.italic',
|
|
152
|
+
value: text
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
MD.italicStar = (text) => {
|
|
156
|
+
return {
|
|
157
|
+
type: 'MD.italicStar',
|
|
158
|
+
value: text
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
MD.strikethrough = (text) => {
|
|
162
|
+
return {
|
|
163
|
+
type: 'MD.strikethrough',
|
|
164
|
+
value: text
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
MD.link = (text, url) => {
|
|
168
|
+
return {
|
|
169
|
+
type: 'MD.link',
|
|
170
|
+
value: { text, url }
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
MD.image = (url, options) => {
|
|
174
|
+
return {
|
|
175
|
+
type: 'MD.image',
|
|
176
|
+
value: url,
|
|
177
|
+
options
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
MD.list = (...items) => {
|
|
181
|
+
return {
|
|
182
|
+
type: 'MD.list',
|
|
183
|
+
value: items
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
MD.listItem = (indexOrText, text) => {
|
|
187
|
+
return {
|
|
188
|
+
type: 'MD.listItem',
|
|
189
|
+
value: typeof indexOrText === 'number' ? { index: indexOrText, text } : indexOrText
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
MD.blockquote = (text) => {
|
|
193
|
+
return {
|
|
194
|
+
type: 'MD.blockquote',
|
|
195
|
+
value: text
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
MD.divider = () => {
|
|
199
|
+
return {
|
|
200
|
+
type: 'MD.divider'
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
MD.newline = (value = false) => {
|
|
204
|
+
return {
|
|
205
|
+
type: 'MD.newline',
|
|
206
|
+
value: value
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
MD.code = (value, options) => {
|
|
210
|
+
return {
|
|
211
|
+
type: 'MD.code',
|
|
212
|
+
value: value,
|
|
213
|
+
options: options
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export { Ark, BT, Image, ImageFile, ImageURL, Link, MD, Mention, Text };
|
|
@@ -5,7 +5,7 @@ import { ResultCode } from '../../core/variable.js';
|
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'path';
|
|
7
7
|
import 'yaml';
|
|
8
|
-
import '../../core/utils.js';
|
|
8
|
+
import { sanitizeForSerialization } from '../../core/utils.js';
|
|
9
9
|
import { createWSConnector } from './base.js';
|
|
10
10
|
import { createDirectClient } from '../../process/direct-channel.js';
|
|
11
11
|
|
|
@@ -88,7 +88,7 @@ const cbpPlatformIPC = (open, existingActionReplys, existingApiReplys) => {
|
|
|
88
88
|
if (typeof process.send === 'function') {
|
|
89
89
|
data.DeviceId = deviceId;
|
|
90
90
|
data.CreateAt = Date.now();
|
|
91
|
-
process.send({ type: 'ipc:data', data });
|
|
91
|
+
process.send({ type: 'ipc:data', data: sanitizeForSerialization(data) });
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
const replyAction = (data, payload) => {
|
|
@@ -188,7 +188,7 @@ const cbpPlatform = (url, options = {
|
|
|
188
188
|
if (global.chatbotPlatform && global.chatbotPlatform.readyState === WebSocket.OPEN) {
|
|
189
189
|
data.DeviceId = deviceId;
|
|
190
190
|
data.CreateAt = Date.now();
|
|
191
|
-
global.chatbotPlatform.send(flattedJSON.stringify(data));
|
|
191
|
+
global.chatbotPlatform.send(flattedJSON.stringify(sanitizeForSerialization(data)));
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
194
|
const actionReplys = [];
|
|
@@ -3,7 +3,7 @@ import { ResultCode } from '../../core/variable.js';
|
|
|
3
3
|
import 'fs';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'yaml';
|
|
6
|
-
import { createResult } from '../../core/utils.js';
|
|
6
|
+
import { sanitizeForSerialization, createResult } from '../../core/utils.js';
|
|
7
7
|
import { generateUniqueId, deviceId, actionResolves, actionTimeouts, timeoutTime } from './config.js';
|
|
8
8
|
import { getDirectSend } from './transport.js';
|
|
9
9
|
|
|
@@ -24,14 +24,15 @@ const sendAction = (data) => {
|
|
|
24
24
|
return new Promise(resolve => {
|
|
25
25
|
data.actionId = actionId;
|
|
26
26
|
data.DeviceId = deviceId;
|
|
27
|
+
const safeData = sanitizeForSerialization(data);
|
|
27
28
|
const directSend = getDirectSend();
|
|
28
29
|
if (directSend) {
|
|
29
|
-
directSend(
|
|
30
|
+
directSend(safeData);
|
|
30
31
|
setupActionResolve(actionId, resolve);
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
if (process.env.__ALEMON_IPC === '1' && typeof process.send === 'function') {
|
|
34
|
-
process.send({ type: 'ipc:data', data });
|
|
35
|
+
process.send({ type: 'ipc:data', data: safeData });
|
|
35
36
|
setupActionResolve(actionId, resolve);
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
@@ -39,7 +40,7 @@ const sendAction = (data) => {
|
|
|
39
40
|
resolve([createResult(ResultCode.Fail, 'Chatbot client is not available', null)]);
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
|
-
global.chatbotClient?.send(flattedJSON.stringify(
|
|
43
|
+
global.chatbotClient?.send(flattedJSON.stringify(safeData));
|
|
43
44
|
setupActionResolve(actionId, resolve);
|
|
44
45
|
});
|
|
45
46
|
};
|
package/lib/cbp/processor/api.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ResultCode } from '../../core/variable.js';
|
|
|
2
2
|
import 'fs';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'yaml';
|
|
5
|
-
import { createResult } from '../../core/utils.js';
|
|
5
|
+
import { sanitizeForSerialization, createResult } from '../../core/utils.js';
|
|
6
6
|
import { generateUniqueId, deviceId, apiResolves, apiTimeouts, timeoutTime } from './config.js';
|
|
7
7
|
import * as flattedJSON from 'flatted';
|
|
8
8
|
import { getDirectSend } from './transport.js';
|
|
@@ -24,14 +24,15 @@ const sendAPI = (data) => {
|
|
|
24
24
|
return new Promise(resolve => {
|
|
25
25
|
data.apiId = ApiId;
|
|
26
26
|
data.DeviceId = deviceId;
|
|
27
|
+
const safeData = sanitizeForSerialization(data);
|
|
27
28
|
const directSend = getDirectSend();
|
|
28
29
|
if (directSend) {
|
|
29
|
-
directSend(
|
|
30
|
+
directSend(safeData);
|
|
30
31
|
setupApiResolve(ApiId, resolve);
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
if (process.env.__ALEMON_IPC === '1' && typeof process.send === 'function') {
|
|
34
|
-
process.send({ type: 'ipc:data', data });
|
|
35
|
+
process.send({ type: 'ipc:data', data: safeData });
|
|
35
36
|
setupApiResolve(ApiId, resolve);
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
@@ -39,7 +40,7 @@ const sendAPI = (data) => {
|
|
|
39
40
|
resolve([createResult(ResultCode.Fail, 'Chatbot client is not available', null)]);
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
|
-
global.chatbotClient?.send(flattedJSON.stringify(
|
|
43
|
+
global.chatbotClient?.send(flattedJSON.stringify(safeData));
|
|
43
44
|
setupApiResolve(ApiId, resolve);
|
|
44
45
|
});
|
|
45
46
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ResultCode } from '../../core/variable.js';
|
|
2
|
+
import 'fs';
|
|
3
|
+
import 'path';
|
|
4
|
+
import 'yaml';
|
|
5
|
+
import { createResult } from '../../core/utils.js';
|
|
6
|
+
import { generateUniqueId, deviceId, apiResolves, apiTimeouts, timeoutTime } from './config.js';
|
|
7
|
+
import * as flattedJSON from 'flatted';
|
|
8
|
+
|
|
9
|
+
const sendAPI = (data) => {
|
|
10
|
+
const ApiId = generateUniqueId();
|
|
11
|
+
return new Promise(resolve => {
|
|
12
|
+
if (!global.chatbotClient?.send) {
|
|
13
|
+
resolve([createResult(ResultCode.Fail, 'Chatbot client is not available', null)]);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
data.apiId = ApiId;
|
|
17
|
+
data.DeviceId = deviceId;
|
|
18
|
+
global.chatbotClient?.send(flattedJSON.stringify(data));
|
|
19
|
+
apiResolves.set(ApiId, resolve);
|
|
20
|
+
const timeout = setTimeout(() => {
|
|
21
|
+
if (!apiResolves.has(ApiId) || !apiTimeouts.has(ApiId)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
apiResolves.delete(ApiId);
|
|
25
|
+
apiTimeouts.delete(ApiId);
|
|
26
|
+
resolve([createResult(ResultCode.Fail, '接口超时', null)]);
|
|
27
|
+
}, timeoutTime);
|
|
28
|
+
apiTimeouts.set(ApiId, timeout);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { sendAPI };
|
package/lib/core/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ResultCode } from './variable.js';
|
|
2
2
|
export { getConfig, getConfigValue, onWatchConfigValue } from './config.js';
|
|
3
|
-
export { createEventName, createHash, createResult, fastHash, getCachedRegExp, getInputExportPath, getRecursiveDirFiles, showErrorModule, stringToNumber, useUserHashKey } from './utils.js';
|
|
3
|
+
export { createEventName, createHash, createResult, fastHash, getCachedRegExp, getInputExportPath, getRecursiveDirFiles, sanitizeForSerialization, showErrorModule, stringToNumber, useUserHashKey } from './utils.js';
|
package/lib/core/utils.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const getRecursiveDirFiles: (dir: string, condition?: (func: Dire
|
|
|
17
17
|
name: string;
|
|
18
18
|
}[];
|
|
19
19
|
export declare const showErrorModule: (e: Error) => void;
|
|
20
|
+
export declare const sanitizeForSerialization: (data: any) => any;
|
|
20
21
|
export declare const getInputExportPath: (input?: string) => any;
|
|
21
22
|
export type Result<T = any> = {
|
|
22
23
|
code: ResultCode;
|
package/lib/core/utils.js
CHANGED
|
@@ -96,6 +96,10 @@ const showErrorModule = (e) => {
|
|
|
96
96
|
data: e
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
+
const sanitizeForSerialization = (data) => {
|
|
100
|
+
const flatted = require('flatted');
|
|
101
|
+
return flatted.parse(flatted.stringify(data));
|
|
102
|
+
};
|
|
99
103
|
const createExports = (packageJson) => {
|
|
100
104
|
if (packageJson?.exports) {
|
|
101
105
|
if (typeof packageJson.exports === 'string') {
|
|
@@ -131,4 +135,4 @@ const createResult = (code, message, data) => {
|
|
|
131
135
|
};
|
|
132
136
|
};
|
|
133
137
|
|
|
134
|
-
export { createEventName, createHash, createResult, fastHash, getCachedRegExp, getInputExportPath, getRecursiveDirFiles, showErrorModule, stringToNumber, useUserHashKey };
|
|
138
|
+
export { createEventName, createHash, createResult, fastHash, getCachedRegExp, getInputExportPath, getRecursiveDirFiles, sanitizeForSerialization, showErrorModule, stringToNumber, useUserHashKey };
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ActionsEventEnum } from './types/event/actions.js';
|
|
2
2
|
export { ResultCode } from './core/variable.js';
|
|
3
3
|
export { getConfig, getConfigValue, onWatchConfigValue } from './core/config.js';
|
|
4
|
-
export { createEventName, createHash, createResult, fastHash, getCachedRegExp, getInputExportPath, getRecursiveDirFiles, showErrorModule, stringToNumber, useUserHashKey } from './core/utils.js';
|
|
4
|
+
export { createEventName, createHash, createResult, fastHash, getCachedRegExp, getInputExportPath, getRecursiveDirFiles, sanitizeForSerialization, showErrorModule, stringToNumber, useUserHashKey } from './core/utils.js';
|
|
5
5
|
export { cbpClient } from './cbp/connects/client.js';
|
|
6
6
|
export { cbpPlatform } from './cbp/connects/platform.js';
|
|
7
7
|
export { cbpServer } from './cbp/server/main.js';
|
|
@@ -24,7 +24,7 @@ export { expendSubscribe, expendSubscribeCreate, expendSubscribeMount, expendSub
|
|
|
24
24
|
export { createSelects, onSelects, unChildren, useChannel, useClient, useMe, useMember, useMention, useMessage, useSend, useSends } from './app/hook-use-api.js';
|
|
25
25
|
export { onState, unState, useState } from './app/hook-use-state.js';
|
|
26
26
|
export { useObserver, useSubscribe } from './app/hook-use-subscribe.js';
|
|
27
|
-
export { createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './app/message-api.js';
|
|
27
|
+
export { MessageDirect, createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './app/message-api.js';
|
|
28
28
|
export { Format, FormatButtonGroup, FormatMarkDown, createEvent } from './app/message-format.js';
|
|
29
29
|
export { start } from './main.js';
|
|
30
30
|
export { Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Markdown, MarkdownOriginal, Mention, Text, Video } from './app/message-format-old.js';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { DataText, DataLink, DataImage, DataImageURL, DataImageFile, DataMention, DataButton, ButtonRow, DataButtonGroup, DataMarkDown, DataMarkdownTitle, DataMarkdownSubtitle, DataMarkdownText, DataMarkdownBold, DataMarkdownCode } from '../types/index.js';
|
|
2
|
+
export interface FormatProps {
|
|
3
|
+
name?: string;
|
|
4
|
+
children?: any;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface TextProps {
|
|
8
|
+
children?: any;
|
|
9
|
+
style?: DataText['options']['style'];
|
|
10
|
+
}
|
|
11
|
+
export interface LinkProps {
|
|
12
|
+
children?: any;
|
|
13
|
+
link: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ImageProps {
|
|
16
|
+
children?: Buffer;
|
|
17
|
+
}
|
|
18
|
+
export interface ImageURLProps {
|
|
19
|
+
children?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ImageFileProps {
|
|
22
|
+
children?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface MentionProps {
|
|
25
|
+
children?: string;
|
|
26
|
+
belong?: 'user' | 'guild' | 'channel' | 'everyone';
|
|
27
|
+
payload?: any;
|
|
28
|
+
}
|
|
29
|
+
export interface ButtonProps {
|
|
30
|
+
children?: any;
|
|
31
|
+
data?: DataButton['options']['data'];
|
|
32
|
+
command?: string;
|
|
33
|
+
toolTip?: string;
|
|
34
|
+
autoEnter?: boolean;
|
|
35
|
+
showList?: boolean;
|
|
36
|
+
type?: 'command' | 'link' | 'call';
|
|
37
|
+
}
|
|
38
|
+
export interface RowProps {
|
|
39
|
+
children?: any;
|
|
40
|
+
}
|
|
41
|
+
export interface ButtonGroupProps {
|
|
42
|
+
children?: any;
|
|
43
|
+
}
|
|
44
|
+
export interface MarkdownProps {
|
|
45
|
+
children?: any;
|
|
46
|
+
}
|
|
47
|
+
export interface MarkdownTitleProps {
|
|
48
|
+
children?: any;
|
|
49
|
+
}
|
|
50
|
+
export interface MarkdownSubtitleProps {
|
|
51
|
+
children?: any;
|
|
52
|
+
}
|
|
53
|
+
export interface MarkdownTextProps {
|
|
54
|
+
children?: any;
|
|
55
|
+
}
|
|
56
|
+
export interface MarkdownBoldProps {
|
|
57
|
+
children?: any;
|
|
58
|
+
}
|
|
59
|
+
export interface MarkdownCodeProps {
|
|
60
|
+
children?: any;
|
|
61
|
+
language?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface CustomProps {
|
|
64
|
+
name: string;
|
|
65
|
+
children?: any;
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
}
|
|
68
|
+
declare function FormatComponent(props: FormatProps): any;
|
|
69
|
+
declare namespace FormatComponent {
|
|
70
|
+
var Text: typeof FormatText;
|
|
71
|
+
var Link: typeof FormatLink;
|
|
72
|
+
var Image: typeof FormatImage;
|
|
73
|
+
var ImageURL: typeof FormatImageURL;
|
|
74
|
+
var ImageFile: typeof FormatImageFile;
|
|
75
|
+
var Mention: typeof FormatMention;
|
|
76
|
+
var Button: typeof FormatButton;
|
|
77
|
+
var Row: typeof FormatRow;
|
|
78
|
+
var ButtonGroup: typeof FormatButtonGroup;
|
|
79
|
+
var Markdown: typeof FormatMarkdown;
|
|
80
|
+
var Custom: typeof FormatCustomComponent;
|
|
81
|
+
}
|
|
82
|
+
declare function FormatText(props: TextProps): DataText;
|
|
83
|
+
declare function FormatLink(props: LinkProps): DataLink;
|
|
84
|
+
declare function FormatImage(props: ImageProps): DataImage;
|
|
85
|
+
declare function FormatImageURL(props: ImageURLProps): DataImageURL;
|
|
86
|
+
declare function FormatImageFile(props: ImageFileProps): DataImageFile;
|
|
87
|
+
declare function FormatMention(props: MentionProps): DataMention;
|
|
88
|
+
declare function FormatButton(props: ButtonProps): DataButton;
|
|
89
|
+
declare function FormatRow(props: RowProps): ButtonRow;
|
|
90
|
+
declare function FormatButtonGroup(props: ButtonGroupProps): DataButtonGroup;
|
|
91
|
+
declare function FormatMarkdownTitle(props: MarkdownTitleProps): DataMarkdownTitle;
|
|
92
|
+
declare function FormatMarkdownSubtitle(props: MarkdownSubtitleProps): DataMarkdownSubtitle;
|
|
93
|
+
declare function FormatMarkdownText(props: MarkdownTextProps): DataMarkdownText;
|
|
94
|
+
declare function FormatMarkdownBold(props: MarkdownBoldProps): DataMarkdownBold;
|
|
95
|
+
declare function FormatMarkdownCode(props: MarkdownCodeProps): DataMarkdownCode;
|
|
96
|
+
declare function FormatMarkdown(props: MarkdownProps): DataMarkDown;
|
|
97
|
+
declare namespace FormatMarkdown {
|
|
98
|
+
var Title: typeof FormatMarkdownTitle;
|
|
99
|
+
var Subtitle: typeof FormatMarkdownSubtitle;
|
|
100
|
+
var Text: typeof FormatMarkdownText;
|
|
101
|
+
var Bold: typeof FormatMarkdownBold;
|
|
102
|
+
var Code: typeof FormatMarkdownCode;
|
|
103
|
+
}
|
|
104
|
+
declare function FormatCustomComponent(props: CustomProps): any;
|
|
105
|
+
export { FormatComponent as Component, FormatCustomComponent as Custom };
|