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.
Files changed (227) hide show
  1. package/lib/{app → application}/define-children.js +2 -1
  2. package/lib/{app → application/format}/message-api.d.ts +2 -2
  3. package/lib/{app → application/format}/message-api.js +12 -4
  4. package/lib/{app → application/format}/message-format-old.d.ts +1 -1
  5. package/lib/{app → application/format}/message-format.d.ts +1 -2
  6. package/lib/{app → application/format}/message-format.js +0 -2
  7. package/lib/{app/hook-use → application/hooks}/announce.js +4 -3
  8. package/lib/{app/hook-use → application/hooks}/channel.js +4 -3
  9. package/lib/{app/hook-use → application/hooks}/client.d.ts +1 -1
  10. package/lib/{app/hook-use → application/hooks}/client.js +4 -11
  11. package/lib/{app/hook-use → application/hooks}/common.d.ts +7 -7
  12. package/lib/{app/hook-use → application/hooks}/common.js +9 -8
  13. package/lib/{app/hook-use → application/hooks}/event.js +1 -1
  14. package/lib/{app/hook-use → application/hooks}/guild.js +4 -3
  15. package/lib/{app/hook-use → application/hooks}/history.js +4 -3
  16. package/lib/{app/hook-use → application/hooks}/me.js +12 -7
  17. package/lib/{app/hook-use → application/hooks}/media.d.ts +3 -3
  18. package/lib/{app/hook-use → application/hooks}/media.js +4 -3
  19. package/lib/{app/hook-use → application/hooks}/member.js +4 -3
  20. package/lib/{app/hook-use → application/hooks}/mention.js +4 -3
  21. package/lib/{app/hook-use → application/hooks}/message.js +6 -5
  22. package/lib/{app/hook-use → application/hooks}/permission.js +4 -3
  23. package/lib/{app/hook-use → application/hooks}/reaction.js +4 -3
  24. package/lib/{app/hook-use → application/hooks}/request.js +12 -7
  25. package/lib/{app/hook-use → application/hooks}/role.js +4 -3
  26. package/lib/{app/hook-use → application/hooks}/subscribe.js +4 -4
  27. package/lib/{app/hook-use → application/hooks}/user.js +12 -7
  28. package/lib/application/index.d.ts +12 -0
  29. package/lib/application/index.js +32 -0
  30. package/lib/{app → application}/router/dsl.d.ts +1 -1
  31. package/lib/{app → application}/router/dsl.js +11 -7
  32. package/lib/{cbp → application/runtime/cbp}/connects/client.d.ts +1 -1
  33. package/lib/{cbp → application/runtime/cbp}/connects/client.js +11 -20
  34. package/lib/application/runtime/cbp/index.d.ts +3 -0
  35. package/lib/application/runtime/cbp/index.js +3 -0
  36. package/lib/application/runtime/cbp/processor/actions.d.ts +3 -0
  37. package/lib/{cbp → application/runtime/cbp}/processor/actions.js +12 -4
  38. package/lib/application/runtime/cbp/processor/api.d.ts +3 -0
  39. package/lib/{cbp → application/runtime/cbp}/processor/api.js +12 -4
  40. package/lib/application/runtime/cbp/processor/request-registry.d.ts +8 -0
  41. package/lib/application/runtime/cbp/processor/request-registry.js +6 -0
  42. package/lib/application/runtime/client-runtime.d.ts +1 -0
  43. package/lib/application/runtime/client-runtime.js +95 -0
  44. package/lib/{app → application/runtime}/event-error.d.ts +1 -1
  45. package/lib/{app → application/runtime}/event-error.js +1 -1
  46. package/lib/{app → application/runtime}/event-group.d.ts +1 -1
  47. package/lib/{app → application/runtime}/event-middleware.d.ts +1 -1
  48. package/lib/{app → application/runtime}/event-middleware.js +1 -1
  49. package/lib/{app → application/runtime}/event-processor-callHandler.d.ts +1 -1
  50. package/lib/{app → application/runtime}/event-processor-callHandler.js +8 -1
  51. package/lib/{app → application/runtime}/event-processor-cycle.d.ts +1 -1
  52. package/lib/{app → application/runtime}/event-processor-cycleFiles.d.ts +1 -1
  53. package/lib/{app → application/runtime}/event-processor-cycleFiles.js +2 -2
  54. package/lib/{app → application/runtime}/event-processor-cycleRoute.d.ts +1 -1
  55. package/lib/{app → application/runtime}/event-processor-cycleRoute.js +9 -2
  56. package/lib/{app → application/runtime}/event-processor-event.d.ts +1 -1
  57. package/lib/{app → application/runtime}/event-processor-middleware.d.ts +1 -1
  58. package/lib/{app → application/runtime}/event-processor-subscribe.d.ts +1 -1
  59. package/lib/{app → application/runtime}/event-processor-subscribe.js +9 -2
  60. package/lib/{app → application/runtime}/event-processor.d.ts +1 -1
  61. package/lib/{app → application/runtime}/event-processor.js +4 -3
  62. package/lib/{app → application/runtime}/event-response.d.ts +1 -1
  63. package/lib/{app → application/runtime}/event-utils.d.ts +1 -1
  64. package/lib/{app → application/runtime}/event-utils.js +2 -2
  65. package/lib/{app → application/runtime}/hook-event-context.d.ts +2 -2
  66. package/lib/{app → application/runtime}/hook-event-context.js +2 -2
  67. package/lib/application/runtime/http/index.d.ts +4 -0
  68. package/lib/application/runtime/http/index.js +4 -0
  69. package/lib/{server → application/runtime/http}/routers/hello.html.js +1 -1
  70. package/lib/{server → application/runtime/http}/routers/middleware.js +1 -2
  71. package/lib/{server → application/runtime/http}/routers/router.js +11 -4
  72. package/lib/{server → application/runtime/http}/routers/utils.d.ts +1 -1
  73. package/lib/{server → application/runtime/http}/routers/utils.js +6 -6
  74. package/lib/{server/main.js → application/runtime/http-server.js} +2 -6
  75. package/lib/{app → application/runtime}/lifecycle-callbacks.d.ts +1 -1
  76. package/lib/{app → application/runtime}/lifecycle-callbacks.js +2 -7
  77. package/lib/{app/load_modules → application/runtime/load-modules}/load.js +2 -2
  78. package/lib/{app/load_modules → application/runtime/load-modules}/loadChild.js +3 -3
  79. package/lib/{app → application/runtime}/schedule-store.d.ts +1 -1
  80. package/lib/{app → application/runtime}/schedule-store.js +1 -1
  81. package/lib/{app → application/runtime}/store.d.ts +14 -19
  82. package/lib/{app → application/runtime}/store.js +8 -103
  83. package/lib/application/schedule.d.ts +17 -0
  84. package/lib/{app/api → application}/schedule.js +1 -1
  85. package/lib/client.d.ts +1 -1
  86. package/lib/client.js +1 -117
  87. package/lib/common/cbp/constants.d.ts +11 -0
  88. package/lib/common/cbp/constants.js +13 -0
  89. package/lib/{cbp/connects/connect.js → common/cbp/heartbeat.js} +3 -6
  90. package/lib/{cbp → common/cbp}/normalize.d.ts +2 -2
  91. package/lib/{cbp → common/cbp}/normalize.js +1 -5
  92. package/lib/common/cbp/runtime.d.ts +2 -0
  93. package/lib/common/cbp/runtime.js +10 -0
  94. package/lib/{cbp → common/cbp}/typings.d.ts +2 -2
  95. package/lib/{cbp/connects/base.js → common/cbp/ws-connector.js} +7 -9
  96. package/lib/{core → common}/config.d.ts +2 -2
  97. package/lib/{core → common}/config.js +5 -4
  98. package/lib/common/identity.d.ts +11 -0
  99. package/lib/common/identity.js +34 -0
  100. package/lib/common/index.d.ts +15 -0
  101. package/lib/common/index.js +14 -0
  102. package/lib/common/logger.d.ts +6 -0
  103. package/lib/common/logger.js +99 -0
  104. package/lib/common/result.d.ts +7 -0
  105. package/lib/common/result.js +19 -0
  106. package/lib/{core → common}/utils.d.ts +3 -18
  107. package/lib/{core → common}/utils.js +6 -49
  108. package/lib/{core → common}/variable.js +1 -1
  109. package/lib/core/cbp/index.d.ts +1 -0
  110. package/lib/core/cbp/index.js +1 -0
  111. package/lib/core/cbp/processor/config.d.ts +8 -0
  112. package/lib/core/cbp/processor/config.js +29 -0
  113. package/lib/{cbp → core/cbp}/routers/hello.html.js +1 -1
  114. package/lib/{cbp → core/cbp}/server/main.js +10 -4
  115. package/lib/{cbp → core/cbp}/server/testone.d.ts +1 -1
  116. package/lib/{cbp → core/cbp}/server/testone.js +8 -2
  117. package/lib/core/index.d.ts +1 -3
  118. package/lib/core/index.js +1 -3
  119. package/lib/core/process/index.d.ts +3 -0
  120. package/lib/{process → core/process}/index.js +0 -1
  121. package/lib/{process → core/process}/ipc-bridge.js +6 -1
  122. package/lib/{process → core/process}/module.js +13 -4
  123. package/lib/{process → core/process}/platform.js +12 -3
  124. package/lib/core/start.d.ts +2 -0
  125. package/lib/core/start.js +76 -0
  126. package/lib/global.d.ts +4 -3
  127. package/lib/index.d.ts +5 -4
  128. package/lib/index.js +9 -54
  129. package/lib/main.d.ts +1 -2
  130. package/lib/main.js +1 -76
  131. package/lib/{cbp/connects/platform.d.ts → platform/cbp-platform.d.ts} +2 -2
  132. package/lib/{cbp/connects/platform.js → platform/cbp-platform.js} +8 -8
  133. package/lib/{app → platform}/define-platform.js +2 -0
  134. package/lib/platform/event-value.d.ts +7 -0
  135. package/lib/platform/event-value.js +5 -0
  136. package/lib/platform/index.d.ts +5 -0
  137. package/lib/platform/index.js +5 -0
  138. package/lib/types/client/index.d.ts +1 -1
  139. package/lib/types/event/index.d.ts +1 -1
  140. package/lib/types/subscribe/index.d.ts +1 -1
  141. package/package.json +22 -1
  142. package/lib/app/api/schedule.d.ts +0 -17
  143. package/lib/app/index.d.ts +0 -25
  144. package/lib/app/index.js +0 -47
  145. package/lib/cbp/index.d.ts +0 -3
  146. package/lib/cbp/index.js +0 -3
  147. package/lib/cbp/processor/actions.d.ts +0 -3
  148. package/lib/cbp/processor/api.d.ts +0 -3
  149. package/lib/cbp/processor/config.d.ts +0 -33
  150. package/lib/cbp/processor/config.js +0 -56
  151. package/lib/process/index.d.ts +0 -4
  152. /package/lib/{app → application}/define-children.d.ts +0 -0
  153. /package/lib/{app → application}/define-middleware.d.ts +0 -0
  154. /package/lib/{app → application}/define-middleware.js +0 -0
  155. /package/lib/{app → application}/define-response.d.ts +0 -0
  156. /package/lib/{app → application}/define-response.js +0 -0
  157. /package/lib/{app → application}/define-router.d.ts +0 -0
  158. /package/lib/{app → application}/define-router.js +0 -0
  159. /package/lib/{app → application}/expose.d.ts +0 -0
  160. /package/lib/{app → application}/expose.js +0 -0
  161. /package/lib/{app → application/format}/message-format-old.js +0 -0
  162. /package/lib/{app/hook-use → application/hooks}/announce.d.ts +0 -0
  163. /package/lib/{app/hook-use → application/hooks}/channel.d.ts +0 -0
  164. /package/lib/{app/hook-use → application/hooks}/event.d.ts +0 -0
  165. /package/lib/{app/hook-use → application/hooks}/guild.d.ts +0 -0
  166. /package/lib/{app/hook-use → application/hooks}/history.d.ts +0 -0
  167. /package/lib/{app/hook-use → application/hooks}/index.d.ts +0 -0
  168. /package/lib/{app/hook-use → application/hooks}/index.js +0 -0
  169. /package/lib/{app/hook-use → application/hooks}/me.d.ts +0 -0
  170. /package/lib/{app/hook-use → application/hooks}/member.d.ts +0 -0
  171. /package/lib/{app/hook-use → application/hooks}/mention.d.ts +0 -0
  172. /package/lib/{app/hook-use → application/hooks}/message.d.ts +0 -0
  173. /package/lib/{app/hook-use → application/hooks}/permission.d.ts +0 -0
  174. /package/lib/{app/hook-use → application/hooks}/reaction.d.ts +0 -0
  175. /package/lib/{app/hook-use → application/hooks}/request.d.ts +0 -0
  176. /package/lib/{app/hook-use → application/hooks}/role.d.ts +0 -0
  177. /package/lib/{app/hook-use → application/hooks}/route.d.ts +0 -0
  178. /package/lib/{app/hook-use → application/hooks}/route.js +0 -0
  179. /package/lib/{app/hook-use → application/hooks}/subscribe.d.ts +0 -0
  180. /package/lib/{app/hook-use → application/hooks}/user.d.ts +0 -0
  181. /package/lib/{app → application}/router/fallback.d.ts +0 -0
  182. /package/lib/{app → application}/router/fallback.js +0 -0
  183. /package/lib/{app → application}/router/main.d.ts +0 -0
  184. /package/lib/{app → application}/router/main.js +0 -0
  185. /package/lib/{app → application}/router/parser.d.ts +0 -0
  186. /package/lib/{app → application}/router/parser.js +0 -0
  187. /package/lib/{app → application}/router/types.d.ts +0 -0
  188. /package/lib/{app → application}/router/types.js +0 -0
  189. /package/lib/{app → application}/router/validator.d.ts +0 -0
  190. /package/lib/{app → application}/router/validator.js +0 -0
  191. /package/lib/{cbp → application/runtime/cbp}/processor/transport.d.ts +0 -0
  192. /package/lib/{cbp → application/runtime/cbp}/processor/transport.js +0 -0
  193. /package/lib/{app → application/runtime}/event-group.js +0 -0
  194. /package/lib/{app → application/runtime}/event-processor-cycle.js +0 -0
  195. /package/lib/{app → application/runtime}/event-processor-event.js +0 -0
  196. /package/lib/{app → application/runtime}/event-processor-middleware.js +0 -0
  197. /package/lib/{app → application/runtime}/event-response.js +0 -0
  198. /package/lib/{cbp → application/runtime/http}/routers/hello.html.d.ts +0 -0
  199. /package/lib/{server → application/runtime/http}/routers/middleware.d.ts +0 -0
  200. /package/lib/{cbp → application/runtime/http}/routers/router.d.ts +0 -0
  201. /package/lib/{server/main.d.ts → application/runtime/http-server.d.ts} +0 -0
  202. /package/lib/{app/load_modules → application/runtime/load-modules}/index.d.ts +0 -0
  203. /package/lib/{app/load_modules → application/runtime/load-modules}/index.js +0 -0
  204. /package/lib/{app/load_modules → application/runtime/load-modules}/load.d.ts +0 -0
  205. /package/lib/{app/load_modules → application/runtime/load-modules}/loadChild.d.ts +0 -0
  206. /package/lib/{app/config.d.ts → application/runtime/subscribe-status.d.ts} +0 -0
  207. /package/lib/{app/config.js → application/runtime/subscribe-status.js} +0 -0
  208. /package/lib/{app → common}/SinglyLinkedList.d.ts +0 -0
  209. /package/lib/{app → common}/SinglyLinkedList.js +0 -0
  210. /package/lib/{cbp/connects/connect.d.ts → common/cbp/heartbeat.d.ts} +0 -0
  211. /package/lib/{cbp → common/cbp}/typings.js +0 -0
  212. /package/lib/{cbp/connects/base.d.ts → common/cbp/ws-connector.d.ts} +0 -0
  213. /package/lib/{process → common}/direct-channel.d.ts +0 -0
  214. /package/lib/{process → common}/direct-channel.js +0 -0
  215. /package/lib/{core → common}/react.d.ts +0 -0
  216. /package/lib/{core → common}/react.js +0 -0
  217. /package/lib/{core → common}/variable.d.ts +0 -0
  218. /package/lib/{server → core/cbp}/routers/hello.html.d.ts +0 -0
  219. /package/lib/{server → core/cbp}/routers/router.d.ts +0 -0
  220. /package/lib/{cbp → core/cbp}/routers/router.js +0 -0
  221. /package/lib/{cbp → core/cbp}/server/main.d.ts +0 -0
  222. /package/lib/{process → core/process}/ipc-bridge.d.ts +0 -0
  223. /package/lib/{process → core/process}/module.d.ts +0 -0
  224. /package/lib/{process → core/process}/platform.d.ts +0 -0
  225. /package/lib/{app → platform}/define-platform.d.ts +0 -0
  226. /package/lib/{app → platform}/event-format.d.ts +0 -0
  227. /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 { sanitizeForSerialization } from '../../core/utils.js';
9
- import { createWSConnector } from './base.js';
10
- import { createDirectClient } from '../../process/direct-channel.js';
11
- import { createEventEnvelope, normalizeInboundMessage, isNormalizedApiRequest, toLegacyApiData, createApiResponseEnvelope, isNormalizedActionRequest, toLegacyActionData, createActionResponseEnvelope } from '../normalize.js';
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
- const client = {
228
+ return {
228
229
  send,
229
230
  onactions,
230
231
  onapis
231
232
  };
232
- return client;
233
233
  };
234
234
 
235
235
  export { cbpPlatform };
@@ -1,3 +1,5 @@
1
+ import { logger } from '../common/logger.js';
2
+
1
3
  const definePlatform = (options) => {
2
4
  const platformName = options.name || process.env.platform || 'unknown';
3
5
  const mainProcess = () => {
@@ -0,0 +1,7 @@
1
+ type BaseMap = {
2
+ [key: string]: unknown;
3
+ };
4
+ export declare const createEventValue: <T extends keyof R, R extends BaseMap>(event: {
5
+ value: R[T];
6
+ }) => R[T];
7
+ export {};
@@ -0,0 +1,5 @@
1
+ const createEventValue = (event) => {
2
+ return event.value;
3
+ };
4
+
5
+ export { createEventValue };
@@ -0,0 +1,5 @@
1
+ export * from '../types/index.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';
@@ -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';
@@ -1,4 +1,4 @@
1
- import { Result } from '../../core/utils';
1
+ import { Result } from '../../common/result';
2
2
  import { User } from '../event/base/user';
3
3
  import { EventKeys, Events } from '../event/map';
4
4
  import { DataEnums } from '../message';
@@ -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 '../../app/expose';
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> = {
@@ -1,4 +1,4 @@
1
- import { SinglyLinkedList } from '../../app/SinglyLinkedList';
1
+ import { SinglyLinkedList } from '../../common/SinglyLinkedList';
2
2
  import { EventCycleEnum } from '../cycle';
3
3
  import { EventKeys } from '../event/map';
4
4
  export type SubscribeValue = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.1.83-alpha.1",
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
- }>;
@@ -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';
@@ -1,3 +0,0 @@
1
- export { cbpClient } from './connects/client.js';
2
- export { cbpPlatform } from './connects/platform.js';
3
- export { cbpServer } from './server/main.js';
package/lib/cbp/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { cbpClient } from './connects/client.js';
2
- export { cbpPlatform } from './connects/platform.js';
3
- export { cbpServer } from './server/main.js';
@@ -1,3 +0,0 @@
1
- import { Result } from '../../core';
2
- import type { Actions } from '../../types';
3
- export declare const sendAction: (data: Actions) => Promise<Result[]>;
@@ -1,3 +0,0 @@
1
- import { Result } from '../../core';
2
- import type { Apis } from '../../types';
3
- export declare const sendAPI: (data: Apis) => Promise<Result[]>;
@@ -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 };
@@ -1,4 +0,0 @@
1
- export * from './module';
2
- export * from './platform';
3
- export * from './ipc-bridge';
4
- export * from './direct-channel';
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