alemonjs 2.1.83 → 2.1.84
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 → application}/define-children.js +2 -1
- package/lib/{app → application/format}/message-api.d.ts +2 -2
- package/lib/{app → application/format}/message-api.js +12 -4
- package/lib/{app → application/format}/message-format-old.d.ts +1 -1
- package/lib/{app → application/format}/message-format.d.ts +1 -2
- package/lib/{app → application/format}/message-format.js +0 -2
- package/lib/{app/hook-use → application/hooks}/announce.js +4 -3
- package/lib/{app/hook-use → application/hooks}/channel.js +4 -3
- package/lib/{app/hook-use → application/hooks}/client.d.ts +1 -1
- package/lib/{app/hook-use → application/hooks}/client.js +4 -11
- package/lib/{app/hook-use → application/hooks}/common.d.ts +7 -7
- package/lib/{app/hook-use → application/hooks}/common.js +9 -8
- package/lib/{app/hook-use → application/hooks}/event.js +1 -1
- package/lib/{app/hook-use → application/hooks}/guild.js +4 -3
- package/lib/{app/hook-use → application/hooks}/history.js +4 -3
- package/lib/{app/hook-use → application/hooks}/me.js +12 -7
- package/lib/{app/hook-use → application/hooks}/media.d.ts +3 -3
- package/lib/{app/hook-use → application/hooks}/media.js +4 -3
- package/lib/{app/hook-use → application/hooks}/member.js +4 -3
- package/lib/{app/hook-use → application/hooks}/mention.js +4 -3
- package/lib/{app/hook-use → application/hooks}/message.js +6 -5
- package/lib/{app/hook-use → application/hooks}/permission.js +4 -3
- package/lib/{app/hook-use → application/hooks}/reaction.js +4 -3
- package/lib/{app/hook-use → application/hooks}/request.js +12 -7
- package/lib/{app/hook-use → application/hooks}/role.js +4 -3
- package/lib/{app/hook-use → application/hooks}/subscribe.js +4 -4
- package/lib/{app/hook-use → application/hooks}/user.js +12 -7
- package/lib/application/index.d.ts +29 -0
- package/lib/application/index.js +58 -0
- package/lib/{app → application}/router/dsl.d.ts +1 -1
- package/lib/{app → application}/router/dsl.js +13 -9
- package/lib/{cbp → application/runtime/cbp}/connects/client.d.ts +1 -1
- package/lib/{cbp → application/runtime/cbp}/connects/client.js +43 -50
- package/lib/application/runtime/cbp/index.d.ts +3 -0
- package/lib/application/runtime/cbp/index.js +3 -0
- package/lib/application/runtime/cbp/processor/actions.d.ts +3 -0
- package/lib/application/runtime/cbp/processor/actions.js +58 -0
- package/lib/application/runtime/cbp/processor/api.d.ts +3 -0
- package/lib/application/runtime/cbp/processor/api.js +58 -0
- package/lib/application/runtime/cbp/processor/request-registry.d.ts +8 -0
- package/lib/application/runtime/cbp/processor/request-registry.js +6 -0
- package/lib/application/runtime/client-runtime.d.ts +1 -0
- package/lib/application/runtime/client-runtime.js +95 -0
- package/lib/{app → application/runtime}/event-error.d.ts +1 -1
- package/lib/{app → application/runtime}/event-error.js +1 -1
- package/lib/{app → application/runtime}/event-group.d.ts +1 -1
- package/lib/{app → application/runtime}/event-middleware.d.ts +1 -1
- package/lib/{app → application/runtime}/event-middleware.js +1 -1
- package/lib/{app → application/runtime}/event-processor-callHandler.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor-callHandler.js +8 -1
- package/lib/{app → application/runtime}/event-processor-cycle.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor-cycleFiles.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor-cycleFiles.js +2 -2
- package/lib/{app → application/runtime}/event-processor-cycleRoute.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor-cycleRoute.js +9 -2
- package/lib/{app → application/runtime}/event-processor-event.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor-middleware.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor-subscribe.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor-subscribe.js +9 -2
- package/lib/{app → application/runtime}/event-processor.d.ts +1 -1
- package/lib/{app → application/runtime}/event-processor.js +4 -3
- package/lib/{app → application/runtime}/event-response.d.ts +1 -1
- package/lib/{app → application/runtime}/event-utils.d.ts +1 -1
- package/lib/{app → application/runtime}/event-utils.js +2 -2
- package/lib/{app → application/runtime}/hook-event-context.d.ts +2 -2
- package/lib/{app → application/runtime}/hook-event-context.js +2 -2
- package/lib/application/runtime/http/index.d.ts +4 -0
- package/lib/application/runtime/http/index.js +4 -0
- package/lib/application/runtime/http/routers/hello.html.d.ts +4 -0
- package/lib/application/runtime/http/routers/hello.html.js +376 -0
- package/lib/{server → application/runtime/http}/routers/router.js +131 -54
- package/lib/{server → application/runtime/http}/routers/utils.d.ts +1 -1
- package/lib/{server → application/runtime/http}/routers/utils.js +7 -7
- package/lib/{server/main.js → application/runtime/http-server.js} +2 -6
- package/lib/{app → application/runtime}/lifecycle-callbacks.d.ts +1 -1
- package/lib/{app → application/runtime}/lifecycle-callbacks.js +2 -7
- package/lib/{app/load_modules → application/runtime/load-modules}/load.js +2 -2
- package/lib/{app/load_modules → application/runtime/load-modules}/loadChild.js +14 -5
- package/lib/{app → application/runtime}/schedule-store.d.ts +1 -1
- package/lib/{app → application/runtime}/schedule-store.js +1 -1
- package/lib/{app → application/runtime}/store.d.ts +14 -19
- package/lib/{app → application/runtime}/store.js +8 -103
- package/lib/application/schedule.d.ts +17 -0
- package/lib/{app/api → application}/schedule.js +1 -1
- package/lib/client.d.ts +1 -1
- package/lib/client.js +1 -117
- package/lib/common/cbp/constants.d.ts +11 -0
- package/lib/common/cbp/constants.js +13 -0
- package/lib/{cbp/connects/connect.js → common/cbp/heartbeat.js} +3 -6
- package/lib/common/cbp/normalize.d.ts +16 -0
- package/lib/common/cbp/normalize.js +324 -0
- package/lib/common/cbp/runtime.d.ts +2 -0
- package/lib/common/cbp/runtime.js +10 -0
- package/lib/common/cbp/typings.d.ts +159 -0
- package/lib/{cbp/connects/base.js → common/cbp/ws-connector.js} +7 -9
- package/lib/{core → common}/config.d.ts +2 -2
- package/lib/{core → common}/config.js +5 -4
- package/lib/common/identity.d.ts +11 -0
- package/lib/common/identity.js +34 -0
- package/lib/common/index.d.ts +15 -0
- package/lib/common/index.js +14 -0
- package/lib/common/logger.d.ts +6 -0
- package/lib/common/logger.js +99 -0
- package/lib/common/result.d.ts +7 -0
- package/lib/common/result.js +19 -0
- package/lib/{core → common}/utils.d.ts +3 -18
- package/lib/{core → common}/utils.js +6 -49
- package/lib/{core → common}/variable.js +1 -1
- package/lib/core/cbp/index.d.ts +1 -0
- package/lib/core/cbp/index.js +1 -0
- package/lib/core/cbp/processor/config.d.ts +8 -0
- package/lib/core/cbp/processor/config.js +29 -0
- package/lib/{cbp → core/cbp}/routers/hello.html.js +1 -1
- package/lib/{cbp → core/cbp}/server/main.js +57 -35
- package/lib/{cbp → core/cbp}/server/testone.d.ts +1 -1
- package/lib/{cbp → core/cbp}/server/testone.js +8 -2
- package/lib/core/index.d.ts +1 -3
- package/lib/core/index.js +1 -3
- package/lib/core/process/index.d.ts +3 -0
- package/lib/{process → core/process}/index.js +0 -1
- package/lib/{process → core/process}/ipc-bridge.js +16 -2
- package/lib/{process → core/process}/module.js +13 -4
- package/lib/{process → core/process}/platform.js +12 -3
- package/lib/core/start.d.ts +2 -0
- package/lib/core/start.js +76 -0
- package/lib/global.d.ts +4 -3
- package/lib/index.d.ts +10 -2
- package/lib/index.js +74 -54
- package/lib/main.d.ts +1 -2
- package/lib/main.js +1 -76
- package/lib/{cbp/connects/platform.d.ts → platform/cbp-platform.d.ts} +2 -2
- package/lib/{cbp/connects/platform.js → platform/cbp-platform.js} +52 -75
- package/lib/{app → platform}/define-platform.js +2 -0
- package/lib/platform/event-value.d.ts +7 -0
- package/lib/platform/event-value.js +5 -0
- package/lib/platform/index.d.ts +5 -0
- package/lib/platform/index.js +5 -0
- package/lib/types/actions.d.ts +20 -1
- package/lib/types/apis.d.ts +2 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/cycle/index.d.ts +1 -1
- package/lib/types/event/index.d.ts +1 -1
- package/lib/types/subscribe/index.d.ts +1 -1
- package/package.json +22 -1
- package/lib/app/api/schedule.d.ts +0 -17
- package/lib/app/index.d.ts +0 -25
- package/lib/app/index.js +0 -47
- package/lib/cbp/index.d.ts +0 -3
- package/lib/cbp/index.js +0 -3
- package/lib/cbp/processor/actions.d.ts +0 -3
- package/lib/cbp/processor/actions.js +0 -48
- package/lib/cbp/processor/api.d.ts +0 -3
- package/lib/cbp/processor/api.js +0 -48
- package/lib/cbp/processor/config.d.ts +0 -29
- package/lib/cbp/processor/config.js +0 -52
- package/lib/cbp/typings.d.ts +0 -20
- package/lib/process/index.d.ts +0 -4
- package/lib/server/routers/hello.html.d.ts +0 -2
- package/lib/server/routers/hello.html.js +0 -31
- /package/lib/{app → application}/define-children.d.ts +0 -0
- /package/lib/{app → application}/define-middleware.d.ts +0 -0
- /package/lib/{app → application}/define-middleware.js +0 -0
- /package/lib/{app → application}/define-response.d.ts +0 -0
- /package/lib/{app → application}/define-response.js +0 -0
- /package/lib/{app → application}/define-router.d.ts +0 -0
- /package/lib/{app → application}/define-router.js +0 -0
- /package/lib/{app → application}/expose.d.ts +0 -0
- /package/lib/{app → application}/expose.js +0 -0
- /package/lib/{app → application/format}/message-format-old.js +0 -0
- /package/lib/{app/hook-use → application/hooks}/announce.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/channel.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/event.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/guild.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/history.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/index.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/index.js +0 -0
- /package/lib/{app/hook-use → application/hooks}/me.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/member.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/mention.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/message.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/permission.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/reaction.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/request.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/role.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/route.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/route.js +0 -0
- /package/lib/{app/hook-use → application/hooks}/subscribe.d.ts +0 -0
- /package/lib/{app/hook-use → application/hooks}/user.d.ts +0 -0
- /package/lib/{app → application}/router/fallback.d.ts +0 -0
- /package/lib/{app → application}/router/fallback.js +0 -0
- /package/lib/{app → application}/router/main.d.ts +0 -0
- /package/lib/{app → application}/router/main.js +0 -0
- /package/lib/{app → application}/router/parser.d.ts +0 -0
- /package/lib/{app → application}/router/parser.js +0 -0
- /package/lib/{app → application}/router/types.d.ts +0 -0
- /package/lib/{app → application}/router/types.js +0 -0
- /package/lib/{app → application}/router/validator.d.ts +0 -0
- /package/lib/{app → application}/router/validator.js +0 -0
- /package/lib/{cbp → application/runtime/cbp}/processor/transport.d.ts +0 -0
- /package/lib/{cbp → application/runtime/cbp}/processor/transport.js +0 -0
- /package/lib/{app → application/runtime}/event-group.js +0 -0
- /package/lib/{app → application/runtime}/event-processor-cycle.js +0 -0
- /package/lib/{app → application/runtime}/event-processor-event.js +0 -0
- /package/lib/{app → application/runtime}/event-processor-middleware.js +0 -0
- /package/lib/{app → application/runtime}/event-response.js +0 -0
- /package/lib/{server → application/runtime/http}/routers/middleware.d.ts +0 -0
- /package/lib/{server → application/runtime/http}/routers/middleware.js +0 -0
- /package/lib/{cbp → application/runtime/http}/routers/router.d.ts +0 -0
- /package/lib/{server/main.d.ts → application/runtime/http-server.d.ts} +0 -0
- /package/lib/{app/load_modules → application/runtime/load-modules}/index.d.ts +0 -0
- /package/lib/{app/load_modules → application/runtime/load-modules}/index.js +0 -0
- /package/lib/{app/load_modules → application/runtime/load-modules}/load.d.ts +0 -0
- /package/lib/{app/load_modules → application/runtime/load-modules}/loadChild.d.ts +0 -0
- /package/lib/{app/config.d.ts → application/runtime/subscribe-status.d.ts} +0 -0
- /package/lib/{app/config.js → application/runtime/subscribe-status.js} +0 -0
- /package/lib/{app → common}/SinglyLinkedList.d.ts +0 -0
- /package/lib/{app → common}/SinglyLinkedList.js +0 -0
- /package/lib/{cbp/connects/connect.d.ts → common/cbp/heartbeat.d.ts} +0 -0
- /package/lib/{cbp → common/cbp}/typings.js +0 -0
- /package/lib/{cbp/connects/base.d.ts → common/cbp/ws-connector.d.ts} +0 -0
- /package/lib/{process → common}/direct-channel.d.ts +0 -0
- /package/lib/{process → common}/direct-channel.js +0 -0
- /package/lib/{core → common}/react.d.ts +0 -0
- /package/lib/{core → common}/react.js +0 -0
- /package/lib/{core → common}/variable.d.ts +0 -0
- /package/lib/{cbp → core/cbp}/routers/hello.html.d.ts +0 -0
- /package/lib/{server → core/cbp}/routers/router.d.ts +0 -0
- /package/lib/{cbp → core/cbp}/routers/router.js +0 -0
- /package/lib/{cbp → core/cbp}/server/main.d.ts +0 -0
- /package/lib/{process → core/process}/ipc-bridge.d.ts +0 -0
- /package/lib/{process → core/process}/module.d.ts +0 -0
- /package/lib/{process → core/process}/platform.d.ts +0 -0
- /package/lib/{app → platform}/define-platform.d.ts +0 -0
- /package/lib/{app → platform}/event-format.d.ts +0 -0
- /package/lib/{app → platform}/event-format.js +0 -0
package/lib/types/actions.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { DataEnums } from './message';
|
|
2
2
|
import { PaginationParams } from './standard';
|
|
3
|
+
export type MessageActionName = 'message.send' | 'message.send.channel' | 'message.send.user' | 'message.delete' | 'message.edit' | 'message.pin' | 'message.unpin' | 'message.forward.user' | 'message.forward.channel' | 'message.get' | 'message.intent';
|
|
4
|
+
export type MentionActionName = 'mention.get';
|
|
5
|
+
export type ReactionActionName = 'reaction.add' | 'reaction.remove' | 'reaction.list';
|
|
6
|
+
export type FileActionName = 'file.send.channel' | 'file.send.user';
|
|
7
|
+
export type MemberActionName = 'member.info' | 'member.list' | 'member.kick' | 'member.ban' | 'member.unban' | 'member.mute' | 'member.admin' | 'member.card' | 'member.title' | 'member.search';
|
|
8
|
+
export type GuildActionName = 'guild.info' | 'guild.list' | 'guild.update' | 'guild.leave' | 'guild.mute';
|
|
9
|
+
export type ChannelActionName = 'channel.info' | 'channel.list' | 'channel.create' | 'channel.update' | 'channel.delete' | 'channel.announce';
|
|
10
|
+
export type RoleActionName = 'role.list' | 'role.create' | 'role.update' | 'role.delete' | 'role.assign' | 'role.remove';
|
|
11
|
+
export type MeActionName = 'me.info' | 'me.guilds' | 'me.threads' | 'me.friends';
|
|
12
|
+
export type RequestActionName = 'request.friend' | 'request.guild';
|
|
13
|
+
export type UserActionName = 'user.info';
|
|
14
|
+
export type MediaActionName = 'media.upload' | 'media.send.channel' | 'media.send.user';
|
|
15
|
+
export type HistoryActionName = 'history.list';
|
|
16
|
+
export type PermissionActionName = 'permission.get' | 'permission.set';
|
|
17
|
+
export type StandardActionName = MessageActionName | MentionActionName | ReactionActionName | FileActionName | MemberActionName | GuildActionName | ChannelActionName | RoleActionName | MeActionName | RequestActionName | UserActionName | MediaActionName | HistoryActionName | PermissionActionName;
|
|
3
18
|
export type ActionMessageSend = {
|
|
4
19
|
action: 'message.send';
|
|
5
20
|
payload: {
|
|
@@ -293,6 +308,10 @@ export type ActionMessageGet = {
|
|
|
293
308
|
MessageId: string;
|
|
294
309
|
};
|
|
295
310
|
};
|
|
311
|
+
export type ActionMessageIntent = {
|
|
312
|
+
action: 'message.intent';
|
|
313
|
+
payload: object;
|
|
314
|
+
};
|
|
296
315
|
export type ActionGuildUpdate = {
|
|
297
316
|
action: 'guild.update';
|
|
298
317
|
payload: {
|
|
@@ -488,7 +507,7 @@ type base = {
|
|
|
488
507
|
actionId?: string;
|
|
489
508
|
DeviceId?: string;
|
|
490
509
|
};
|
|
491
|
-
export type Actions = (ActionMessageSend | ActionMessageSendChannel | ActionMessageSendUser | ActionMessageDelete | ActionMessageEdit | ActionMessagePin | ActionMessageUnpin | ActionMentionGet | ActionReactionAdd | ActionReactionRemove | ActionFileSendChannel | ActionFileSendUser | ActionMessageForwardUser | ActionMessageForwardChannel | ActionMemberInfo | ActionMemberList | ActionMemberKick | ActionMemberBan | ActionMemberUnban | ActionGuildInfo | ActionGuildList | ActionChannelInfo | ActionChannelList | ActionChannelCreate | ActionChannelUpdate | ActionChannelDelete | ActionRoleList | ActionRoleCreate | ActionRoleUpdate | ActionRoleDelete | ActionRoleAssign | ActionRoleRemove | ActionMeInfo | ActionMeGuilds | ActionMeThreads | ActionMeFriends | ActionMessageGet | ActionGuildUpdate | ActionGuildLeave | ActionGuildMute | ActionMemberMute | ActionMemberAdmin | ActionMemberCard | ActionMemberTitle | ActionRequestFriend | ActionRequestGuild | ActionUserInfo | ActionMediaUpload | ActionMediaSendChannel | ActionMediaSendUser | ActionHistoryList | ActionPermissionGet | ActionPermissionSet | ActionReactionList | ActionMemberSearch | ActionChannelAnnounce | {
|
|
510
|
+
export type Actions = (ActionMessageSend | ActionMessageSendChannel | ActionMessageSendUser | ActionMessageDelete | ActionMessageEdit | ActionMessagePin | ActionMessageUnpin | ActionMentionGet | ActionReactionAdd | ActionReactionRemove | ActionFileSendChannel | ActionFileSendUser | ActionMessageForwardUser | ActionMessageForwardChannel | ActionMessageIntent | ActionMemberInfo | ActionMemberList | ActionMemberKick | ActionMemberBan | ActionMemberUnban | ActionGuildInfo | ActionGuildList | ActionChannelInfo | ActionChannelList | ActionChannelCreate | ActionChannelUpdate | ActionChannelDelete | ActionRoleList | ActionRoleCreate | ActionRoleUpdate | ActionRoleDelete | ActionRoleAssign | ActionRoleRemove | ActionMeInfo | ActionMeGuilds | ActionMeThreads | ActionMeFriends | ActionMessageGet | ActionGuildUpdate | ActionGuildLeave | ActionGuildMute | ActionMemberMute | ActionMemberAdmin | ActionMemberCard | ActionMemberTitle | ActionRequestFriend | ActionRequestGuild | ActionUserInfo | ActionMediaUpload | ActionMediaSendChannel | ActionMediaSendUser | ActionHistoryList | ActionPermissionGet | ActionPermissionSet | ActionReactionList | ActionMemberSearch | ActionChannelAnnounce | {
|
|
492
511
|
action: string;
|
|
493
512
|
payload: object;
|
|
494
513
|
}) & base;
|
package/lib/types/apis.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ChildrenCycle, Next } from '../cycle';
|
|
|
2
2
|
import { ClientAPI } from '../client';
|
|
3
3
|
import { EventKeys, Events } from './map';
|
|
4
4
|
import { DataEnums } from '../message';
|
|
5
|
-
import { Expose } from '../../
|
|
5
|
+
import { Expose } from '../../application/expose';
|
|
6
6
|
import type KoaRouter from 'koa-router';
|
|
7
7
|
export type Current<T extends EventKeys> = (event: Events[T], next: Next) => Promise<boolean | void | undefined> | boolean | void | undefined;
|
|
8
8
|
export type OnResponseValue<C, T extends EventKeys> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alemonjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.84",
|
|
4
4
|
"description": "bot script",
|
|
5
5
|
"author": "lemonade",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,26 @@
|
|
|
22
22
|
"types": "./lib/utils.d.ts",
|
|
23
23
|
"require": "./lib/utils.js"
|
|
24
24
|
},
|
|
25
|
+
"./platform": {
|
|
26
|
+
"import": "./lib/platform/index.js",
|
|
27
|
+
"types": "./lib/platform/index.d.ts",
|
|
28
|
+
"require": "./lib/platform/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./common": {
|
|
31
|
+
"import": "./lib/common/index.js",
|
|
32
|
+
"types": "./lib/common/index.d.ts",
|
|
33
|
+
"require": "./lib/common/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./core": {
|
|
36
|
+
"import": "./lib/core/index.js",
|
|
37
|
+
"types": "./lib/core/index.d.ts",
|
|
38
|
+
"require": "./lib/core/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./application": {
|
|
41
|
+
"import": "./lib/application/index.js",
|
|
42
|
+
"types": "./lib/application/index.d.ts",
|
|
43
|
+
"require": "./lib/application/index.js"
|
|
44
|
+
},
|
|
25
45
|
"./env": {
|
|
26
46
|
"types": "./lib/global.d.ts"
|
|
27
47
|
}
|
|
@@ -57,6 +77,7 @@
|
|
|
57
77
|
"@types/uuid": "^10.0.0"
|
|
58
78
|
},
|
|
59
79
|
"bin": {
|
|
80
|
+
"alemonjs": "./bin/alemonjs.js",
|
|
60
81
|
"alemonc": "./bin/alemonc.js"
|
|
61
82
|
},
|
|
62
83
|
"keywords": [
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ScheduleCallback, CronExpression } from '../../types/schedule';
|
|
2
|
-
export declare const setInterval: (callback: ScheduleCallback, ms: number) => string;
|
|
3
|
-
export declare const setTimeout: (callback: ScheduleCallback, ms: number) => string;
|
|
4
|
-
export declare const setCron: (expression: CronExpression, callback: ScheduleCallback) => string;
|
|
5
|
-
export declare const clearInterval: (id: import("../..").ScheduleId) => boolean;
|
|
6
|
-
export declare const clearTimeout: (id: import("../..").ScheduleId) => boolean;
|
|
7
|
-
export declare const pauseSchedule: (id: import("../..").ScheduleId) => boolean;
|
|
8
|
-
export declare const resumeSchedule: (id: import("../..").ScheduleId) => boolean;
|
|
9
|
-
export declare const listSchedule: (appName?: string) => Array<{
|
|
10
|
-
id: import("../..").ScheduleId;
|
|
11
|
-
type: import("../..").ScheduleItem["type"];
|
|
12
|
-
status: import("../..").ScheduleStatus;
|
|
13
|
-
ms?: number;
|
|
14
|
-
cron?: string;
|
|
15
|
-
appName?: string;
|
|
16
|
-
createdAt: number;
|
|
17
|
-
}>;
|
package/lib/app/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * from './store.js';
|
|
2
|
-
export * from './expose.js';
|
|
3
|
-
export * from './load_modules/index.js';
|
|
4
|
-
export * from './define-children.js';
|
|
5
|
-
export * from './define-platform.js';
|
|
6
|
-
export * from './define-response.js';
|
|
7
|
-
export * from './define-middleware.js';
|
|
8
|
-
export * from './define-router.js';
|
|
9
|
-
export * from './event-format.js';
|
|
10
|
-
export * from './event-group.js';
|
|
11
|
-
export * from './event-middleware';
|
|
12
|
-
export * from './event-processor';
|
|
13
|
-
export * from './event-response.js';
|
|
14
|
-
export * from './event-processor-cycle.js';
|
|
15
|
-
export * from './event-processor-event.js';
|
|
16
|
-
export * from './event-processor-middleware.js';
|
|
17
|
-
export * from './event-processor-subscribe.js';
|
|
18
|
-
export * from './hook-use/index.js';
|
|
19
|
-
export * from './api/schedule.js';
|
|
20
|
-
export * from './hook-event-context.js';
|
|
21
|
-
export * from './schedule-store.js';
|
|
22
|
-
export * from './event-utils.js';
|
|
23
|
-
export * from './message-api.js';
|
|
24
|
-
export * from './message-format.js';
|
|
25
|
-
export * from './router/main.js';
|
package/lib/app/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export { ChildrenApp, Core, Logger, Middleware, MiddlewareRouter, MiddlewareTree, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, ResponseTree, State, StateSubscribe, SubscribeList, bumpStoreVersion, clearRuntimeAppKoaRouters, core, disposeAllRuntimeApps, disposeRuntimeApp, getChildrenApp, getRuntimeApp, getRuntimeAppKoaRouters, getSubscribeList, hasRuntimeAppCapability, listChildrenApps, listRuntimeAppKoaRouters, listRuntimeApps, logger, registerRuntimeApp, setRuntimeAppKoaRouters, toRuntimeAppSnapshot, updateRuntimeAppCapabilities, updateRuntimeAppStatus } from './store.js';
|
|
2
|
-
export { Expose, clearAllExpose, disposeExpose, registerExpose } from './expose.js';
|
|
3
|
-
export { loadModels, run } from './load_modules/load.js';
|
|
4
|
-
export { loadChildren, loadChildrenFile } from './load_modules/loadChild.js';
|
|
5
|
-
export { defineChildren } from './define-children.js';
|
|
6
|
-
export { definePlatform } from './define-platform.js';
|
|
7
|
-
export { defineResponse } from './define-response.js';
|
|
8
|
-
export { defineMiddleware } from './define-middleware.js';
|
|
9
|
-
export { defineRouter, lazy, runHandler } from './define-router.js';
|
|
10
|
-
export { FormatEvent, wrapEvent } from './event-format.js';
|
|
11
|
-
export { onGroup } from './event-group.js';
|
|
12
|
-
export { OnMiddleware, onMiddleware } from './event-middleware.js';
|
|
13
|
-
export { OnProcessor, onProcessor } from './event-processor.js';
|
|
14
|
-
export { OnResponse, onResponse } from './event-response.js';
|
|
15
|
-
export { expendCycle } from './event-processor-cycle.js';
|
|
16
|
-
export { expendEvent } from './event-processor-event.js';
|
|
17
|
-
export { expendMiddleware } from './event-processor-middleware.js';
|
|
18
|
-
export { expendSubscribe, expendSubscribeCreate, expendSubscribeMount, expendSubscribeUnmount } from './event-processor-subscribe.js';
|
|
19
|
-
export { useAnnounce } from './hook-use/announce.js';
|
|
20
|
-
export { useChannel } from './hook-use/channel.js';
|
|
21
|
-
export { useClient } from './hook-use/client.js';
|
|
22
|
-
export { useGuild } from './hook-use/guild.js';
|
|
23
|
-
export { useHistory } from './hook-use/history.js';
|
|
24
|
-
export { useMedia } from './hook-use/media.js';
|
|
25
|
-
export { useMe } from './hook-use/me.js';
|
|
26
|
-
export { useMember } from './hook-use/member.js';
|
|
27
|
-
export { useMention } from './hook-use/mention.js';
|
|
28
|
-
export { useMessage, useSend, useSends } from './hook-use/message.js';
|
|
29
|
-
export { usePermission } from './hook-use/permission.js';
|
|
30
|
-
export { useReaction } from './hook-use/reaction.js';
|
|
31
|
-
export { useRequest } from './hook-use/request.js';
|
|
32
|
-
export { useRole } from './hook-use/role.js';
|
|
33
|
-
export { useRoute } from './hook-use/route.js';
|
|
34
|
-
export { useUser } from './hook-use/user.js';
|
|
35
|
-
export { useObserver, useSubscribe } from './hook-use/subscribe.js';
|
|
36
|
-
export { createEvent, useEvent } from './hook-use/event.js';
|
|
37
|
-
export { clearInterval, clearTimeout, listSchedule, pauseSchedule, resumeSchedule, setCron, setInterval, setTimeout } from './api/schedule.js';
|
|
38
|
-
export { finishCurrentTrace, getCurrentAppName, getCurrentEvent, getCurrentNext, getCurrentPhase, markEventSendAttempt, markEventSendFailure, markEventSendSuccess, recordEventSendResults, withEventContext, withProcessorTrace } from './hook-event-context.js';
|
|
39
|
-
export { registerAppDir, scheduleCancel, scheduleCancelAll, scheduleCancelByApp, scheduleCron, scheduleInterval, scheduleList, schedulePause, scheduleResume, scheduleTimeout, unregisterAppDir } from './schedule-store.js';
|
|
40
|
-
export { createEventValue, createSelects, onSelects, onState, unChildren, unState, useState } from './event-utils.js';
|
|
41
|
-
export { MessageDirect, createDataFormat, format, getMessageIntent, sendToChannel, sendToUser } from './message-api.js';
|
|
42
|
-
export { Format, FormatButtonGroup, FormatMarkDown, FormatSelect } from './message-format.js';
|
|
43
|
-
export { Router } from './router/dsl.js';
|
|
44
|
-
export { checkFallbackHint } from './router/fallback.js';
|
|
45
|
-
export { normalizeRoutePath, parseMessageText } from './router/parser.js';
|
|
46
|
-
export { validateRouteArgs } from './router/validator.js';
|
|
47
|
-
export { Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Markdown, MarkdownOriginal, Mention, Text, Video } from './message-format-old.js';
|
package/lib/cbp/index.d.ts
DELETED
package/lib/cbp/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as flattedJSON from 'flatted';
|
|
2
|
-
import { ResultCode } from '../../core/variable.js';
|
|
3
|
-
import 'fs';
|
|
4
|
-
import 'path';
|
|
5
|
-
import 'yaml';
|
|
6
|
-
import { sanitizeForSerialization, createResult } from '../../core/utils.js';
|
|
7
|
-
import { generateUniqueId, deviceId, actionResolves, actionTimeouts, timeoutTime } from './config.js';
|
|
8
|
-
import { getDirectSend } from './transport.js';
|
|
9
|
-
|
|
10
|
-
const setupActionResolve = (actionId, resolve) => {
|
|
11
|
-
actionResolves.set(actionId, resolve);
|
|
12
|
-
const timeout = setTimeout(() => {
|
|
13
|
-
if (!actionResolves.has(actionId) || !actionTimeouts.has(actionId)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
actionResolves.delete(actionId);
|
|
17
|
-
actionTimeouts.delete(actionId);
|
|
18
|
-
resolve([createResult(ResultCode.Fail, '行为超时', null)]);
|
|
19
|
-
}, timeoutTime);
|
|
20
|
-
actionTimeouts.set(actionId, timeout);
|
|
21
|
-
};
|
|
22
|
-
const sendAction = (data) => {
|
|
23
|
-
const actionId = generateUniqueId();
|
|
24
|
-
return new Promise(resolve => {
|
|
25
|
-
data.actionId = actionId;
|
|
26
|
-
data.DeviceId = deviceId;
|
|
27
|
-
const safeData = sanitizeForSerialization(data);
|
|
28
|
-
const directSend = getDirectSend();
|
|
29
|
-
if (directSend) {
|
|
30
|
-
directSend(safeData);
|
|
31
|
-
setupActionResolve(actionId, resolve);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (process.env.__ALEMON_IPC === '1' && typeof process.send === 'function') {
|
|
35
|
-
process.send({ type: 'ipc:data', data: safeData });
|
|
36
|
-
setupActionResolve(actionId, resolve);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (!global.chatbotClient?.send) {
|
|
40
|
-
resolve([createResult(ResultCode.Fail, 'Chatbot client is not available', null)]);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
global.chatbotClient?.send(flattedJSON.stringify(safeData));
|
|
44
|
-
setupActionResolve(actionId, resolve);
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export { sendAction };
|
package/lib/cbp/processor/api.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ResultCode } from '../../core/variable.js';
|
|
2
|
-
import 'fs';
|
|
3
|
-
import 'path';
|
|
4
|
-
import 'yaml';
|
|
5
|
-
import { sanitizeForSerialization, createResult } from '../../core/utils.js';
|
|
6
|
-
import { generateUniqueId, deviceId, apiResolves, apiTimeouts, timeoutTime } from './config.js';
|
|
7
|
-
import * as flattedJSON from 'flatted';
|
|
8
|
-
import { getDirectSend } from './transport.js';
|
|
9
|
-
|
|
10
|
-
const setupApiResolve = (apiId, resolve) => {
|
|
11
|
-
apiResolves.set(apiId, resolve);
|
|
12
|
-
const timeout = setTimeout(() => {
|
|
13
|
-
if (!apiResolves.has(apiId) || !apiTimeouts.has(apiId)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
apiResolves.delete(apiId);
|
|
17
|
-
apiTimeouts.delete(apiId);
|
|
18
|
-
resolve([createResult(ResultCode.Fail, '接口超时', null)]);
|
|
19
|
-
}, timeoutTime);
|
|
20
|
-
apiTimeouts.set(apiId, timeout);
|
|
21
|
-
};
|
|
22
|
-
const sendAPI = (data) => {
|
|
23
|
-
const ApiId = generateUniqueId();
|
|
24
|
-
return new Promise(resolve => {
|
|
25
|
-
data.apiId = ApiId;
|
|
26
|
-
data.DeviceId = deviceId;
|
|
27
|
-
const safeData = sanitizeForSerialization(data);
|
|
28
|
-
const directSend = getDirectSend();
|
|
29
|
-
if (directSend) {
|
|
30
|
-
directSend(safeData);
|
|
31
|
-
setupApiResolve(ApiId, resolve);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (process.env.__ALEMON_IPC === '1' && typeof process.send === 'function') {
|
|
35
|
-
process.send({ type: 'ipc:data', data: safeData });
|
|
36
|
-
setupApiResolve(ApiId, resolve);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (!global.chatbotClient?.send) {
|
|
40
|
-
resolve([createResult(ResultCode.Fail, 'Chatbot client is not available', null)]);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
global.chatbotClient?.send(flattedJSON.stringify(safeData));
|
|
44
|
-
setupApiResolve(ApiId, resolve);
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export { sendAPI };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { WebSocket } from 'ws';
|
|
2
|
-
import { Result } from '../../core';
|
|
3
|
-
export declare const childrenClient: Map<string, WebSocket>;
|
|
4
|
-
export declare const platformClient: Map<string, WebSocket>;
|
|
5
|
-
export declare const fullClient: Map<string, WebSocket>;
|
|
6
|
-
export declare const deviceId: `${string}-${string}-${string}-${string}-${string}`;
|
|
7
|
-
export declare const USER_AGENT_HEADER = "user-agent";
|
|
8
|
-
export declare const USER_AGENT_HEADER_VALUE_MAP: {
|
|
9
|
-
platform: string;
|
|
10
|
-
client: string;
|
|
11
|
-
testone: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const DEVICE_ID_HEADER = "x-device-id";
|
|
14
|
-
export declare const FULL_RECEIVE_HEADER = "x-full-receive";
|
|
15
|
-
type actionResolvesValue = Result[] | PromiseLike<Result[]>;
|
|
16
|
-
type actionResolvesValueFunc = (value: actionResolvesValue) => void;
|
|
17
|
-
export declare const actionResolves: Map<string, actionResolvesValueFunc>;
|
|
18
|
-
export declare const apiResolves: Map<string, actionResolvesValueFunc>;
|
|
19
|
-
export declare const actionTimeouts: Map<string, NodeJS.Timeout>;
|
|
20
|
-
export declare const apiTimeouts: Map<string, NodeJS.Timeout>;
|
|
21
|
-
export declare const childrenBind: Map<string, string>;
|
|
22
|
-
export declare const clientBindCount: Map<string, number>;
|
|
23
|
-
export declare const bindChannelToClient: (channelId: string, clientId: string) => void;
|
|
24
|
-
export declare const unbindClient: (clientId: string) => void;
|
|
25
|
-
export declare const generateUniqueId: () => string;
|
|
26
|
-
export declare const timeoutTime: number;
|
|
27
|
-
export declare const reconnectInterval: number;
|
|
28
|
-
export declare const HEARTBEAT_INTERVAL: number;
|
|
29
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
|
|
3
|
-
const childrenClient = new Map();
|
|
4
|
-
const platformClient = new Map();
|
|
5
|
-
const fullClient = new Map();
|
|
6
|
-
const deviceId = randomUUID();
|
|
7
|
-
const USER_AGENT_HEADER = 'user-agent';
|
|
8
|
-
const USER_AGENT_HEADER_VALUE_MAP = {
|
|
9
|
-
platform: 'platform',
|
|
10
|
-
client: 'client',
|
|
11
|
-
testone: 'testone'
|
|
12
|
-
};
|
|
13
|
-
const DEVICE_ID_HEADER = 'x-device-id';
|
|
14
|
-
const FULL_RECEIVE_HEADER = 'x-full-receive';
|
|
15
|
-
const actionResolves = new Map();
|
|
16
|
-
const apiResolves = new Map();
|
|
17
|
-
const actionTimeouts = new Map();
|
|
18
|
-
const apiTimeouts = new Map();
|
|
19
|
-
const childrenBind = new Map();
|
|
20
|
-
const clientBindCount = new Map();
|
|
21
|
-
const bindChannelToClient = (channelId, clientId) => {
|
|
22
|
-
const oldClientId = childrenBind.get(channelId);
|
|
23
|
-
if (oldClientId && oldClientId !== clientId) {
|
|
24
|
-
const oldCount = clientBindCount.get(oldClientId) ?? 0;
|
|
25
|
-
if (oldCount > 1) {
|
|
26
|
-
clientBindCount.set(oldClientId, oldCount - 1);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
clientBindCount.delete(oldClientId);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
childrenBind.set(channelId, clientId);
|
|
33
|
-
clientBindCount.set(clientId, (clientBindCount.get(clientId) ?? 0) + 1);
|
|
34
|
-
};
|
|
35
|
-
const unbindClient = (clientId) => {
|
|
36
|
-
for (const [channelId, boundClientId] of childrenBind.entries()) {
|
|
37
|
-
if (boundClientId === clientId) {
|
|
38
|
-
childrenBind.delete(channelId);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
clientBindCount.delete(clientId);
|
|
42
|
-
};
|
|
43
|
-
let _idCounter = 0;
|
|
44
|
-
const _idPrefix = process.pid.toString(36) + Date.now().toString(36);
|
|
45
|
-
const generateUniqueId = () => {
|
|
46
|
-
return _idPrefix + (++_idCounter).toString(36);
|
|
47
|
-
};
|
|
48
|
-
const timeoutTime = 1000 * 60 * 3;
|
|
49
|
-
const reconnectInterval = 1000 * 6;
|
|
50
|
-
const HEARTBEAT_INTERVAL = 1000 * 18;
|
|
51
|
-
|
|
52
|
-
export { DEVICE_ID_HEADER, FULL_RECEIVE_HEADER, HEARTBEAT_INTERVAL, USER_AGENT_HEADER, USER_AGENT_HEADER_VALUE_MAP, actionResolves, actionTimeouts, apiResolves, apiTimeouts, bindChannelToClient, childrenBind, childrenClient, clientBindCount, deviceId, fullClient, generateUniqueId, platformClient, reconnectInterval, timeoutTime, unbindClient };
|
package/lib/cbp/typings.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { EventKeys, Apis, Actions } from '../types';
|
|
2
|
-
import type { Result } from '../core';
|
|
3
|
-
export type ParsedMessage = {
|
|
4
|
-
apiId?: string;
|
|
5
|
-
actionId?: string;
|
|
6
|
-
testID?: string;
|
|
7
|
-
ChannelId?: string;
|
|
8
|
-
GuildId?: string;
|
|
9
|
-
name?: EventKeys;
|
|
10
|
-
DeviceId?: string;
|
|
11
|
-
activeId?: string;
|
|
12
|
-
payload?: any;
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
export type CBPClientOptions = {
|
|
16
|
-
open?: () => void;
|
|
17
|
-
isFullReceive?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export type ActionReplyFunc = (data: Actions, consume: (payload: Result[]) => void) => void;
|
|
20
|
-
export type ApiReplyFunc = (data: Apis, consume: (payload: Result[]) => void) => void;
|
package/lib/process/index.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Component, Head, Title, Style, Body, H1, P, A, Div, Html } from '../../core/react.js';
|
|
2
|
-
|
|
3
|
-
class App extends Component {
|
|
4
|
-
render() {
|
|
5
|
-
const style = `
|
|
6
|
-
body {
|
|
7
|
-
width: 35em;
|
|
8
|
-
margin: 0 auto;
|
|
9
|
-
font-family: Tahoma, Verdana, Arial, sans-serif;
|
|
10
|
-
background-color: #f8f8f8;
|
|
11
|
-
color: #333;
|
|
12
|
-
}
|
|
13
|
-
h1 {
|
|
14
|
-
color: #0099cc;
|
|
15
|
-
margin-top: 2em;
|
|
16
|
-
}
|
|
17
|
-
.footer {
|
|
18
|
-
margin-top: 3em;
|
|
19
|
-
font-size: 0.9em;
|
|
20
|
-
color: #888;
|
|
21
|
-
}
|
|
22
|
-
a { color: #0099cc; }
|
|
23
|
-
`;
|
|
24
|
-
const head = Head(null, Title('欢迎使用 ALemonJS!'), Style(style));
|
|
25
|
-
const body = Body(null, H1('ALemonJS 启动成功!'), P(null, '已成功通过 ', A({ href: 'https://alemonjs.com', target: '_blank' }, 'ALemonJS 框架'), ' 启动。'), P(null, '如果想访问主应用,请访问, ', A({ href: '/app', target: '_blank' }, '/app'), '(对应根目录index.html)'), P(null, '如果想访问其他应用,请访问 ', A({ href: '/apps/[package-name]', target: '_blank' }, '/apps/[package-name]'), '。(对应/packages/[package-name]/index.html)'), Div({ className: 'footer' }, '— 感谢选择 ALemonJS。'));
|
|
26
|
-
return Html(null, head, body);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
var hello = App.renderToHtml();
|
|
30
|
-
|
|
31
|
-
export { hello as default };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|