alemonjs 2.1.83-alpha.4 → 2.1.83-alpha.6
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.
|
@@ -2,7 +2,7 @@ export * from '../types/index.js';
|
|
|
2
2
|
export { defineChildren } from './define-children.js';
|
|
3
3
|
export { defineResponse } from './define-response.js';
|
|
4
4
|
export { defineMiddleware } from './define-middleware.js';
|
|
5
|
-
export { defineRouter } from './define-router.js';
|
|
5
|
+
export { defineRouter, lazy, runHandler } from './define-router.js';
|
|
6
6
|
export * from './expose.js';
|
|
7
7
|
export * from './hooks/index.js';
|
|
8
8
|
export * from './schedule.js';
|
|
@@ -10,7 +10,20 @@ export * from './format/message-api.js';
|
|
|
10
10
|
export * from './format/message-format.js';
|
|
11
11
|
export * from './format/message-format-old.js';
|
|
12
12
|
export * from './router/main.js';
|
|
13
|
+
export { validateRouteArgsForCommand } from './router/validator.js';
|
|
13
14
|
export * from './runtime/event-response.js';
|
|
14
15
|
export * from './runtime/event-middleware.js';
|
|
15
16
|
export { createSelects, onSelects, onState, unChildren, unState, useState } from './runtime/event-utils.js';
|
|
16
17
|
export { onGroup } from './runtime/event-group.js';
|
|
18
|
+
export { Core, Response, ResponseMiddleware, MiddlewareTree, ResponseTree, ResponseRouter, MiddlewareRouter, Middleware, SubscribeList, StateSubscribe, State, ChildrenApp, registerRuntimeApp, updateRuntimeAppStatus, updateRuntimeAppCapabilities, setRuntimeAppKoaRouters, getRuntimeAppKoaRouters, clearRuntimeAppKoaRouters, listRuntimeAppKoaRouters, getRuntimeApp, toRuntimeAppSnapshot, listRuntimeApps, disposeRuntimeApp, disposeAllRuntimeApps, hasRuntimeAppCapability, bumpStoreVersion, getSubscribeList, getChildrenApp, listChildrenApps, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, core } from './runtime/store.js';
|
|
19
|
+
export type { RuntimeAppStatus, RuntimeAppCapability, RuntimeAppError, RuntimeAppRecord } from './runtime/store.js';
|
|
20
|
+
export { loadChildren, loadChildrenFile } from './runtime/load-modules/loadChild.js';
|
|
21
|
+
export { run, loadModels } from './runtime/load-modules/load.js';
|
|
22
|
+
export { onProcessor, OnProcessor } from './runtime/event-processor.js';
|
|
23
|
+
export { expendCycle } from './runtime/event-processor-cycle.js';
|
|
24
|
+
export { expendEvent } from './runtime/event-processor-event.js';
|
|
25
|
+
export { expendMiddleware } from './runtime/event-processor-middleware.js';
|
|
26
|
+
export { expendSubscribe, expendSubscribeCreate, expendSubscribeMount, expendSubscribeUnmount } from './runtime/event-processor-subscribe.js';
|
|
27
|
+
export { withEventContext, withProcessorTrace, getCurrentEvent, getCurrentNext, getCurrentAppName, getCurrentPhase, finishCurrentTrace, markEventSendAttempt, markEventSendSuccess, markEventSendFailure, recordEventSendResults } from './runtime/hook-event-context.js';
|
|
28
|
+
export { registerAppDir, unregisterAppDir, scheduleInterval, scheduleTimeout, scheduleCron, schedulePause, scheduleResume, scheduleCancel, scheduleCancelByApp, scheduleCancelAll, scheduleList } from './runtime/schedule-store.js';
|
|
29
|
+
export { cbpClient } from './runtime/cbp/index.js';
|
package/lib/application/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { ActionsEventEnum } from '../types/event/actions.js';
|
|
|
2
2
|
export { defineChildren } from './define-children.js';
|
|
3
3
|
export { defineResponse } from './define-response.js';
|
|
4
4
|
export { defineMiddleware } from './define-middleware.js';
|
|
5
|
-
export { defineRouter } from './define-router.js';
|
|
5
|
+
export { defineRouter, lazy, runHandler } from './define-router.js';
|
|
6
6
|
export { Expose, clearAllExpose, disposeExpose, registerExpose } from './expose.js';
|
|
7
7
|
export { useAnnounce } from './hooks/announce.js';
|
|
8
8
|
export { useChannel } from './hooks/channel.js';
|
|
@@ -29,8 +29,30 @@ export { Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Ma
|
|
|
29
29
|
export { Router } from './router/dsl.js';
|
|
30
30
|
export { checkFallbackHint } from './router/fallback.js';
|
|
31
31
|
export { normalizeRoutePath, parseMessageText } from './router/parser.js';
|
|
32
|
-
export { validateRouteArgs } from './router/validator.js';
|
|
32
|
+
export { validateRouteArgs, validateRouteArgsForCommand } from './router/validator.js';
|
|
33
33
|
export { OnResponse, onResponse } from './runtime/event-response.js';
|
|
34
34
|
export { OnMiddleware, onMiddleware } from './runtime/event-middleware.js';
|
|
35
35
|
export { createSelects, onSelects, onState, unChildren, unState, useState } from './runtime/event-utils.js';
|
|
36
36
|
export { onGroup } from './runtime/event-group.js';
|
|
37
|
+
export { ChildrenApp, Core, 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, registerRuntimeApp, setRuntimeAppKoaRouters, toRuntimeAppSnapshot, updateRuntimeAppCapabilities, updateRuntimeAppStatus } from './runtime/store.js';
|
|
38
|
+
export { loadChildren, loadChildrenFile } from './runtime/load-modules/loadChild.js';
|
|
39
|
+
export { loadModels, run } from './runtime/load-modules/load.js';
|
|
40
|
+
export { OnProcessor, onProcessor } from './runtime/event-processor.js';
|
|
41
|
+
export { expendCycle } from './runtime/event-processor-cycle.js';
|
|
42
|
+
export { expendEvent } from './runtime/event-processor-event.js';
|
|
43
|
+
export { expendMiddleware } from './runtime/event-processor-middleware.js';
|
|
44
|
+
export { expendSubscribe, expendSubscribeCreate, expendSubscribeMount, expendSubscribeUnmount } from './runtime/event-processor-subscribe.js';
|
|
45
|
+
export { finishCurrentTrace, getCurrentAppName, getCurrentEvent, getCurrentNext, getCurrentPhase, markEventSendAttempt, markEventSendFailure, markEventSendSuccess, recordEventSendResults, withEventContext, withProcessorTrace } from './runtime/hook-event-context.js';
|
|
46
|
+
export { registerAppDir, scheduleCancel, scheduleCancelAll, scheduleCancelByApp, scheduleCron, scheduleInterval, scheduleList, schedulePause, scheduleResume, scheduleTimeout, unregisterAppDir } from './runtime/schedule-store.js';
|
|
47
|
+
export { cbpClient } from './runtime/cbp/connects/client.js';
|
|
48
|
+
import 'flatted';
|
|
49
|
+
import 'fs';
|
|
50
|
+
import 'path';
|
|
51
|
+
import 'yaml';
|
|
52
|
+
import '../common/logger.js';
|
|
53
|
+
import '../common/utils.js';
|
|
54
|
+
import 'net';
|
|
55
|
+
import 'v8';
|
|
56
|
+
import 'os';
|
|
57
|
+
import '../common/cbp/runtime.js';
|
|
58
|
+
import 'ws';
|
|
@@ -115,9 +115,24 @@ const dispatchRegisteredKoaRouters = async (ctx) => {
|
|
|
115
115
|
try {
|
|
116
116
|
const matchedContext = ctx;
|
|
117
117
|
const beforeMatched = Array.isArray(matchedContext.matched) ? matchedContext.matched.length : 0;
|
|
118
|
-
|
|
118
|
+
const beforeStatus = ctx.status;
|
|
119
|
+
const beforeBody = ctx.body;
|
|
120
|
+
const beforeMatchedRoute = ctx._matchedRoute;
|
|
121
|
+
const beforeRouterPath = ctx.routerPath;
|
|
122
|
+
let fallthrough = false;
|
|
123
|
+
await koaRouter.routes()(ctx, async () => {
|
|
124
|
+
fallthrough = true;
|
|
125
|
+
});
|
|
119
126
|
const afterMatched = Array.isArray(matchedContext.matched) ? matchedContext.matched.length : 0;
|
|
120
|
-
|
|
127
|
+
const afterMatchedRoute = ctx._matchedRoute;
|
|
128
|
+
const afterRouterPath = ctx.routerPath;
|
|
129
|
+
const handled = afterMatched > beforeMatched
|
|
130
|
+
|| afterMatchedRoute !== beforeMatchedRoute
|
|
131
|
+
|| afterRouterPath !== beforeRouterPath
|
|
132
|
+
|| ctx.status !== beforeStatus
|
|
133
|
+
|| ctx.body !== beforeBody
|
|
134
|
+
|| !fallthrough;
|
|
135
|
+
if (!handled) {
|
|
121
136
|
continue;
|
|
122
137
|
}
|
|
123
138
|
await koaRouter.allowedMethods()(ctx, async () => { });
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from './common/index.js';
|
|
|
4
4
|
export * from './core/index.js';
|
|
5
5
|
export * from './platform/index.js';
|
|
6
6
|
export * from './application/index.js';
|
|
7
|
+
export { cbpServer } from './core/cbp/index.js';
|
|
8
|
+
export { Result } from './common/variable.js';
|
|
7
9
|
export { start } from './main.js';
|
|
8
10
|
export * from './main.js';
|
|
9
11
|
export * as common from './common/index.js';
|
package/lib/index.js
CHANGED
|
@@ -7,20 +7,24 @@ import * as index$3 from './platform/index.js';
|
|
|
7
7
|
export { index$3 as platform };
|
|
8
8
|
import * as index from './application/index.js';
|
|
9
9
|
export { index as application };
|
|
10
|
+
export { cbpServer } from './core/cbp/server/main.js';
|
|
11
|
+
export { EventMessageText, Fail, FailAuth, FailInternal, FailParams, Ok, Result, ResultCode, Warn, defaultLogin, defaultPlatformCommonPrefix, defaultPlatformPrefix, defaultPort, filePrefixCommon, fileSuffixMiddleware, fileSuffixResponse, processorMaxMapSize, processorRepeatedClearSize, processorRepeatedClearTimeMax, processorRepeatedClearTimeMin, processorRepeatedEventTime, processorRepeatedUserTime } from './common/variable.js';
|
|
10
12
|
export { start } from './core/start.js';
|
|
11
13
|
export { A, Body, Component, DOCTYPE, Div, H1, Head, Html, P, Style, Title, createElement, renderToString } from './common/react.js';
|
|
12
14
|
export { Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Markdown, MarkdownOriginal, Mention, Text, Video } from './application/format/message-format-old.js';
|
|
15
|
+
export { ChildrenApp, Core, Middleware, MiddlewareRouter, MiddlewareTree, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, ResponseTree, State, StateSubscribe, SubscribeList, bumpStoreVersion, clearRuntimeAppKoaRouters, disposeAllRuntimeApps, disposeRuntimeApp, getChildrenApp, getRuntimeApp, getRuntimeAppKoaRouters, getSubscribeList, hasRuntimeAppCapability, listChildrenApps, listRuntimeAppKoaRouters, listRuntimeApps, registerRuntimeApp, setRuntimeAppKoaRouters, toRuntimeAppSnapshot, updateRuntimeAppCapabilities, updateRuntimeAppStatus } from './application/runtime/store.js';
|
|
13
16
|
export { DEVICE_ID_HEADER, FULL_RECEIVE_HEADER, HEARTBEAT_INTERVAL, USER_AGENT_HEADER, USER_AGENT_HEADER_VALUE_MAP, reconnectInterval, timeoutTime } from './common/cbp/constants.js';
|
|
14
|
-
export { EventMessageText, Fail, FailAuth, FailInternal, FailParams, Ok, ResultCode, Warn, defaultLogin, defaultPlatformCommonPrefix, defaultPlatformPrefix, defaultPort, filePrefixCommon, fileSuffixMiddleware, fileSuffixResponse, processorMaxMapSize, processorRepeatedClearSize, processorRepeatedClearTimeMax, processorRepeatedClearTimeMin, processorRepeatedEventTime, processorRepeatedUserTime } from './common/variable.js';
|
|
15
17
|
export { Expose, clearAllExpose, disposeExpose, registerExpose } from './application/expose.js';
|
|
16
18
|
export { Format, FormatButtonGroup, FormatMarkDown, FormatSelect } from './application/format/message-format.js';
|
|
17
19
|
export { FormatEvent, wrapEvent } from './platform/event-format.js';
|
|
18
20
|
export { Logger, logger } from './common/logger.js';
|
|
19
21
|
export { MessageDirect, createDataFormat, format, getMessageIntent, sendToChannel, sendToUser } from './application/format/message-api.js';
|
|
20
22
|
export { OnMiddleware, onMiddleware } from './application/runtime/event-middleware.js';
|
|
23
|
+
export { OnProcessor, onProcessor } from './application/runtime/event-processor.js';
|
|
21
24
|
export { OnResponse, onResponse } from './application/runtime/event-response.js';
|
|
22
25
|
export { Router } from './application/router/dsl.js';
|
|
23
26
|
export { SinglyLinkedList } from './common/SinglyLinkedList.js';
|
|
27
|
+
export { cbpClient } from './application/runtime/cbp/connects/client.js';
|
|
24
28
|
export { cbpPlatform } from './platform/cbp-platform.js';
|
|
25
29
|
export { checkFallbackHint } from './application/router/fallback.js';
|
|
26
30
|
export { clearInterval, clearTimeout, listSchedule, pauseSchedule, resumeSchedule, setCron, setInterval, setTimeout } from './application/schedule.js';
|
|
@@ -37,11 +41,19 @@ export { defineChildren } from './application/define-children.js';
|
|
|
37
41
|
export { defineMiddleware } from './application/define-middleware.js';
|
|
38
42
|
export { definePlatform } from './platform/define-platform.js';
|
|
39
43
|
export { defineResponse } from './application/define-response.js';
|
|
40
|
-
export { defineRouter } from './application/define-router.js';
|
|
44
|
+
export { defineRouter, lazy, runHandler } from './application/define-router.js';
|
|
41
45
|
export { deviceId, generateUniqueId } from './common/cbp/runtime.js';
|
|
46
|
+
export { expendCycle } from './application/runtime/event-processor-cycle.js';
|
|
47
|
+
export { expendEvent } from './application/runtime/event-processor-event.js';
|
|
48
|
+
export { expendMiddleware } from './application/runtime/event-processor-middleware.js';
|
|
49
|
+
export { expendSubscribe, expendSubscribeCreate, expendSubscribeMount, expendSubscribeUnmount } from './application/runtime/event-processor-subscribe.js';
|
|
50
|
+
export { finishCurrentTrace, getCurrentAppName, getCurrentEvent, getCurrentNext, getCurrentPhase, markEventSendAttempt, markEventSendFailure, markEventSendSuccess, recordEventSendResults, withEventContext, withProcessorTrace } from './application/runtime/hook-event-context.js';
|
|
42
51
|
export { getConfig, getConfigValue, onWatchConfigValue } from './common/config.js';
|
|
52
|
+
export { loadChildren, loadChildrenFile } from './application/runtime/load-modules/loadChild.js';
|
|
53
|
+
export { loadModels, run } from './application/runtime/load-modules/load.js';
|
|
43
54
|
export { normalizeRoutePath, parseMessageText } from './application/router/parser.js';
|
|
44
55
|
export { onGroup } from './application/runtime/event-group.js';
|
|
56
|
+
export { registerAppDir, scheduleCancel, scheduleCancelAll, scheduleCancelByApp, scheduleCron, scheduleInterval, scheduleList, schedulePause, scheduleResume, scheduleTimeout, unregisterAppDir } from './application/runtime/schedule-store.js';
|
|
45
57
|
export { useAnnounce } from './application/hooks/announce.js';
|
|
46
58
|
export { useChannel } from './application/hooks/channel.js';
|
|
47
59
|
export { useClient } from './application/hooks/client.js';
|
|
@@ -60,4 +72,4 @@ export { useRequest } from './application/hooks/request.js';
|
|
|
60
72
|
export { useRole } from './application/hooks/role.js';
|
|
61
73
|
export { useRoute } from './application/hooks/route.js';
|
|
62
74
|
export { useUser } from './application/hooks/user.js';
|
|
63
|
-
export { validateRouteArgs } from './application/router/validator.js';
|
|
75
|
+
export { validateRouteArgs, validateRouteArgsForCommand } from './application/router/validator.js';
|