alemonjs 2.1.83-alpha.1 → 2.1.83-alpha.2
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 +12 -0
- package/lib/application/index.js +32 -0
- package/lib/{app → application}/router/dsl.d.ts +1 -1
- package/lib/{app → application}/router/dsl.js +11 -7
- package/lib/{cbp → application/runtime/cbp}/connects/client.d.ts +1 -1
- package/lib/{cbp → application/runtime/cbp}/connects/client.js +11 -20
- 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/{cbp → application/runtime/cbp}/processor/actions.js +12 -4
- package/lib/application/runtime/cbp/processor/api.d.ts +3 -0
- package/lib/{cbp → application/runtime/cbp}/processor/api.js +12 -4
- 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/{server → application/runtime/http}/routers/hello.html.js +1 -1
- package/lib/{server → application/runtime/http}/routers/middleware.js +1 -2
- package/lib/{server → application/runtime/http}/routers/router.js +11 -4
- package/lib/{server → application/runtime/http}/routers/utils.d.ts +1 -1
- package/lib/{server → application/runtime/http}/routers/utils.js +6 -6
- 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 +3 -3
- 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/{cbp → common/cbp}/normalize.d.ts +2 -2
- package/lib/{cbp → common/cbp}/normalize.js +1 -5
- package/lib/common/cbp/runtime.d.ts +2 -0
- package/lib/common/cbp/runtime.js +10 -0
- package/lib/{cbp → common/cbp}/typings.d.ts +2 -2
- 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 +10 -4
- 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 +6 -1
- 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 +5 -4
- package/lib/index.js +9 -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} +8 -8
- 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/client/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/api.d.ts +0 -3
- package/lib/cbp/processor/config.d.ts +0 -33
- package/lib/cbp/processor/config.js +0 -56
- package/lib/process/index.d.ts +0 -4
- /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/{cbp → application/runtime/http}/routers/hello.html.d.ts +0 -0
- /package/lib/{server → application/runtime/http}/routers/middleware.d.ts +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/{server → 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
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as flattedJSON from 'flatted';
|
|
2
2
|
import { WebSocket } from 'ws';
|
|
3
|
-
import { deviceId } from '../processor/config.js';
|
|
4
|
-
import { ResultCode } from '../../core/variable.js';
|
|
5
3
|
import 'fs';
|
|
6
4
|
import 'path';
|
|
7
5
|
import 'yaml';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import '../common/logger.js';
|
|
7
|
+
import { ResultCode } from '../common/variable.js';
|
|
8
|
+
import { sanitizeForSerialization } from '../common/utils.js';
|
|
9
|
+
import { createDirectClient } from '../common/direct-channel.js';
|
|
10
|
+
import { deviceId } from '../common/cbp/runtime.js';
|
|
11
|
+
import { createWSConnector } from '../common/cbp/ws-connector.js';
|
|
12
|
+
import { createEventEnvelope, normalizeInboundMessage, isNormalizedApiRequest, toLegacyApiData, isNormalizedActionRequest, toLegacyActionData, createApiResponseEnvelope, createActionResponseEnvelope } from '../common/cbp/normalize.js';
|
|
12
13
|
|
|
13
14
|
const dispatchLegacyActionHandlers = (actionReplys, replyAction, input) => {
|
|
14
15
|
const normalized = normalizeInboundMessage(input);
|
|
@@ -224,12 +225,11 @@ const cbpPlatform = (url, options = {
|
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
});
|
|
227
|
-
|
|
228
|
+
return {
|
|
228
229
|
send,
|
|
229
230
|
onactions,
|
|
230
231
|
onapis
|
|
231
232
|
};
|
|
232
|
-
return client;
|
|
233
233
|
};
|
|
234
234
|
|
|
235
235
|
export { cbpPlatform };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ActionsEventEnum } from '../types/event/actions.js';
|
|
2
|
+
export { definePlatform } from './define-platform.js';
|
|
3
|
+
export { cbpPlatform } from './cbp-platform.js';
|
|
4
|
+
export { FormatEvent, wrapEvent } from './event-format.js';
|
|
5
|
+
export { createEventValue } from './event-value.js';
|
|
@@ -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.83-alpha.
|
|
3
|
+
"version": "2.1.83-alpha.2",
|
|
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,33 +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 RequestReplyValue = Result[] | PromiseLike<Result[]>;
|
|
16
|
-
type RequestReplyResolve = (value: RequestReplyValue) => void;
|
|
17
|
-
export declare const actionRequestResolves: Map<string, RequestReplyResolve>;
|
|
18
|
-
export declare const apiRequestResolves: Map<string, RequestReplyResolve>;
|
|
19
|
-
export declare const actionRequestTimeouts: Map<string, NodeJS.Timeout>;
|
|
20
|
-
export declare const apiRequestTimeouts: Map<string, NodeJS.Timeout>;
|
|
21
|
-
export declare const actionResolves: Map<string, RequestReplyResolve>;
|
|
22
|
-
export declare const apiResolves: Map<string, RequestReplyResolve>;
|
|
23
|
-
export declare const actionTimeouts: Map<string, NodeJS.Timeout>;
|
|
24
|
-
export declare const apiTimeouts: Map<string, NodeJS.Timeout>;
|
|
25
|
-
export declare const childrenBind: Map<string, string>;
|
|
26
|
-
export declare const clientBindCount: Map<string, number>;
|
|
27
|
-
export declare const bindChannelToClient: (channelId: string, clientId: string) => void;
|
|
28
|
-
export declare const unbindClient: (clientId: string) => void;
|
|
29
|
-
export declare const generateUniqueId: () => string;
|
|
30
|
-
export declare const timeoutTime: number;
|
|
31
|
-
export declare const reconnectInterval: number;
|
|
32
|
-
export declare const HEARTBEAT_INTERVAL: number;
|
|
33
|
-
export {};
|
|
@@ -1,56 +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 actionRequestResolves = new Map();
|
|
16
|
-
const apiRequestResolves = new Map();
|
|
17
|
-
const actionRequestTimeouts = new Map();
|
|
18
|
-
const apiRequestTimeouts = new Map();
|
|
19
|
-
const actionResolves = actionRequestResolves;
|
|
20
|
-
const apiResolves = apiRequestResolves;
|
|
21
|
-
const actionTimeouts = actionRequestTimeouts;
|
|
22
|
-
const apiTimeouts = apiRequestTimeouts;
|
|
23
|
-
const childrenBind = new Map();
|
|
24
|
-
const clientBindCount = new Map();
|
|
25
|
-
const bindChannelToClient = (channelId, clientId) => {
|
|
26
|
-
const oldClientId = childrenBind.get(channelId);
|
|
27
|
-
if (oldClientId && oldClientId !== clientId) {
|
|
28
|
-
const oldCount = clientBindCount.get(oldClientId) ?? 0;
|
|
29
|
-
if (oldCount > 1) {
|
|
30
|
-
clientBindCount.set(oldClientId, oldCount - 1);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
clientBindCount.delete(oldClientId);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
childrenBind.set(channelId, clientId);
|
|
37
|
-
clientBindCount.set(clientId, (clientBindCount.get(clientId) ?? 0) + 1);
|
|
38
|
-
};
|
|
39
|
-
const unbindClient = (clientId) => {
|
|
40
|
-
for (const [channelId, boundClientId] of childrenBind.entries()) {
|
|
41
|
-
if (boundClientId === clientId) {
|
|
42
|
-
childrenBind.delete(channelId);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
clientBindCount.delete(clientId);
|
|
46
|
-
};
|
|
47
|
-
let _idCounter = 0;
|
|
48
|
-
const _idPrefix = process.pid.toString(36) + Date.now().toString(36);
|
|
49
|
-
const generateUniqueId = () => {
|
|
50
|
-
return _idPrefix + (++_idCounter).toString(36);
|
|
51
|
-
};
|
|
52
|
-
const timeoutTime = 1000 * 60 * 3;
|
|
53
|
-
const reconnectInterval = 1000 * 6;
|
|
54
|
-
const HEARTBEAT_INTERVAL = 1000 * 18;
|
|
55
|
-
|
|
56
|
-
export { DEVICE_ID_HEADER, FULL_RECEIVE_HEADER, HEARTBEAT_INTERVAL, USER_AGENT_HEADER, USER_AGENT_HEADER_VALUE_MAP, actionRequestResolves, actionRequestTimeouts, actionResolves, actionTimeouts, apiRequestResolves, apiRequestTimeouts, apiResolves, apiTimeouts, bindChannelToClient, childrenBind, childrenClient, clientBindCount, deviceId, fullClient, generateUniqueId, platformClient, reconnectInterval, timeoutTime, unbindClient };
|
package/lib/process/index.d.ts
DELETED
|
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
|
|
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
|