@napuketto/adapter 0.4.2 → 0.6.0

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.
@@ -0,0 +1,19 @@
1
+ //#region src/core/raw-message.ts
2
+ /** 逐条处理消息(自动规范化数组 + 过滤非对象项)。 */
3
+ function forEachRawMessage(msgs, handler) {
4
+ const list = Array.isArray(msgs) ? msgs : [msgs];
5
+ for (const msg of list) {
6
+ if (!msg || typeof msg !== "object") continue;
7
+ handler(msg);
8
+ }
9
+ }
10
+ /** 订阅 Msg/onRecvMsg(回调参数数组规范化为逐条;返回退订函数,各协议适配器共用)。 */
11
+ function subscribeRawMessages(channel, handler) {
12
+ return channel.on("Msg/onRecvMsg", (msgs) => {
13
+ forEachRawMessage(msgs, handler);
14
+ });
15
+ }
16
+ //#endregion
17
+ export { subscribeRawMessages as n, forEachRawMessage as t };
18
+
19
+ //# sourceMappingURL=raw-message-D_ecJy4C.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-message-D_ecJy4C.mjs","names":[],"sources":["../src/core/raw-message.ts"],"sourcesContent":["/**\n * RawMessage 数组规范化(OB11 / Satori 共用,2026-08-08 克隆合并)\n *\n * onRecvMsg 回调参数运行时实证为消息数组(2026-08-07),但兼容单条对象\n * 传入——统一规范化为数组并过滤无效项后逐条回调。\n */\nimport type { MsgEventChannel, RawMessage } from \"@napuketto/kernel\";\n\n/** 逐条处理消息(自动规范化数组 + 过滤非对象项)。 */\nexport function forEachRawMessage(msgs: unknown, handler: (msg: RawMessage) => void): void {\n const list = Array.isArray(msgs) ? msgs : [msgs];\n for (const msg of list) {\n if (!msg || typeof msg !== \"object\") {\n continue;\n }\n handler(msg as RawMessage);\n }\n}\n\n/** 订阅 Msg/onRecvMsg(回调参数数组规范化为逐条;返回退订函数,各协议适配器共用)。 */\nexport function subscribeRawMessages(\n channel: MsgEventChannel,\n handler: (msg: RawMessage) => void,\n): () => void {\n return channel.on(\"Msg/onRecvMsg\", (msgs) => {\n forEachRawMessage(msgs, handler);\n });\n}\n"],"mappings":";;AASA,SAAgB,kBAAkB,MAAe,SAA0C;CACvF,MAAM,OAAO,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI;CAC/C,KAAK,MAAM,OAAO,MAAM;EACpB,IAAI,CAAC,OAAO,OAAO,QAAQ,UACvB;EAEJ,QAAQ,GAAiB;CAC7B;AACJ;;AAGA,SAAgB,qBACZ,SACA,SACU;CACV,OAAO,QAAQ,GAAG,kBAAkB,SAAS;EACzC,kBAAkB,MAAM,OAAO;CACnC,CAAC;AACL"}
@@ -1,6 +1,7 @@
1
1
  import { o as ActionRegistry, r as BaseProtocolAdapter, t as ensureSilk } from "../core-DyXyDUcU.mjs";
2
- import { n as createHttpServerSchema, r as createWsServerSchema, t as collectGrayTipUids } from "../gray-tip-B80z9KR4.mjs";
3
- import { t as forEachRawMessage } from "../raw-message-6KdlG8kR.mjs";
2
+ import { n as createWsServerSchema, t as createHttpServerSchema } from "../transport-schema-CpPxyRK0.mjs";
3
+ import { t as collectGrayTipUids } from "../gray-tip-LwBee5mo.mjs";
4
+ import { t as forEachRawMessage } from "../raw-message-D_ecJy4C.mjs";
4
5
  import { ChatType, GrayTipSubType, NTGroupRequestOperateTypes, TipGroupElementType, isKernelError, kernelError, toCanonicalElements } from "@napuketto/kernel";
5
6
  import { mkdir, writeFile } from "node:fs/promises";
6
7
  import { transcodeVideo } from "@napuketto/media";