@napuketto/adapter 0.18.1 → 0.18.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 (35) hide show
  1. package/dist/core/index.d.mts +2 -2
  2. package/dist/core/index.mjs +1 -1
  3. package/dist/{core-4PwF_pJB.mjs → core-5cq8w_zB.mjs} +36 -2
  4. package/dist/core-5cq8w_zB.mjs.map +1 -0
  5. package/dist/{index-DAsCCf9S.d.mts → index-BFvhy1hU.d.mts} +2 -2
  6. package/dist/{index-DAsCCf9S.d.mts.map → index-BFvhy1hU.d.mts.map} +1 -1
  7. package/dist/{index-lKqnKSwo.d.mts → index-BHS4Wz74.d.mts} +2 -2
  8. package/dist/{index-lKqnKSwo.d.mts.map → index-BHS4Wz74.d.mts.map} +1 -1
  9. package/dist/{index-D9Nwf0_4.d.mts → index-BZfGz6FA.d.mts} +26 -3
  10. package/dist/index-BZfGz6FA.d.mts.map +1 -0
  11. package/dist/{index-CiitTshy.d.mts → index-BlRIp4xi.d.mts} +2 -2
  12. package/dist/{index-CiitTshy.d.mts.map → index-BlRIp4xi.d.mts.map} +1 -1
  13. package/dist/{index-CKH8uaU-.d.mts → index-oinf9f75.d.mts} +2 -2
  14. package/dist/{index-CKH8uaU-.d.mts.map → index-oinf9f75.d.mts.map} +1 -1
  15. package/dist/index.d.mts +5 -5
  16. package/dist/index.mjs +5 -5
  17. package/dist/kurobot/index.d.mts +1 -1
  18. package/dist/kurobot/index.mjs +1 -1
  19. package/dist/{kurobot-CG2qGU9G.mjs → kurobot-Bow0EtKl.mjs} +2 -2
  20. package/dist/{kurobot-CG2qGU9G.mjs.map → kurobot-Bow0EtKl.mjs.map} +1 -1
  21. package/dist/milky/index.d.mts +1 -1
  22. package/dist/milky/index.mjs +1 -1
  23. package/dist/{milky-DMmeotN9.mjs → milky-BW1_XOn6.mjs} +12 -24
  24. package/dist/{milky-DMmeotN9.mjs.map → milky-BW1_XOn6.mjs.map} +1 -1
  25. package/dist/onebot11/index.d.mts +1 -1
  26. package/dist/onebot11/index.mjs +1 -1
  27. package/dist/{onebot11-CAf9fBoJ.mjs → onebot11-Bypcd8J6.mjs} +12 -31
  28. package/dist/{onebot11-CAf9fBoJ.mjs.map → onebot11-Bypcd8J6.mjs.map} +1 -1
  29. package/dist/satori/index.d.mts +1 -1
  30. package/dist/satori/index.mjs +1 -1
  31. package/dist/{satori-D5lM6S3L.mjs → satori-9fwjhn6g.mjs} +4 -13
  32. package/dist/{satori-D5lM6S3L.mjs.map → satori-9fwjhn6g.mjs.map} +1 -1
  33. package/package.json +1 -1
  34. package/dist/core-4PwF_pJB.mjs.map +0 -1
  35. package/dist/index-D9Nwf0_4.d.mts.map +0 -1
@@ -2,5 +2,5 @@
2
2
  * Satori 协议适配器
3
3
  * 公共面:类型 + 动作注册表 + 配置 schema + 传输装配 + 适配器。
4
4
  */
5
- import { A as Message, B as SatoriActionDeps, C as Emoji, D as GuildRole, E as GuildMember, F as Order, G as SatoriToCanonicalDeps, H as SatoriActionError, I as HTTP_STATUS, J as renderElements, K as SatoriElement, L as satoriHttpStatusMap, M as BidiList, N as Direction, O as Login, P as List, R as SatoriConfig, S as ChannelType, T as Guild, U as SatoriApi, V as createSatoriActionRegistry, W as SatoriApiOptions, _ as MetaBody, a as parseContentToCanonical, b as Signal, c as canonicalToSatoriElements, d as NapukettoSatoriAdapter, f as SatoriAdapterOptions, g as IdentifyBody, h as Event, i as toEventSignal, j as User, k as LoginStatus, l as SatoriEventContent, m as Button, n as SatoriTransportSet, o as satoriToCanonicalElements, p as Argv, q as parseElements, r as assembleSatoriTransports, s as CanonicalToSatoriDeps, t as AssembleSatoriTransportsOptions, u as SatoriEventDeps, v as Opcode, w as Friend, x as Channel, y as ReadyBody, z as satoriConfigSchema } from "../index-DAsCCf9S.mjs";
5
+ import { A as Message, B as SatoriActionDeps, C as Emoji, D as GuildRole, E as GuildMember, F as Order, G as SatoriToCanonicalDeps, H as SatoriActionError, I as HTTP_STATUS, J as renderElements, K as SatoriElement, L as satoriHttpStatusMap, M as BidiList, N as Direction, O as Login, P as List, R as SatoriConfig, S as ChannelType, T as Guild, U as SatoriApi, V as createSatoriActionRegistry, W as SatoriApiOptions, _ as MetaBody, a as parseContentToCanonical, b as Signal, c as canonicalToSatoriElements, d as NapukettoSatoriAdapter, f as SatoriAdapterOptions, g as IdentifyBody, h as Event, i as toEventSignal, j as User, k as LoginStatus, l as SatoriEventContent, m as Button, n as SatoriTransportSet, o as satoriToCanonicalElements, p as Argv, q as parseElements, r as assembleSatoriTransports, s as CanonicalToSatoriDeps, t as AssembleSatoriTransportsOptions, u as SatoriEventDeps, v as Opcode, w as Friend, x as Channel, y as ReadyBody, z as satoriConfigSchema } from "../index-BFvhy1hU.mjs";
6
6
  export { type Argv, type AssembleSatoriTransportsOptions, type BidiList, type Button, type CanonicalToSatoriDeps, type Channel, type ChannelType, type Direction, type Emoji, type Event, type Friend, type Guild, type GuildMember, type GuildRole, HTTP_STATUS, type IdentifyBody, type List, type Login, type LoginStatus, type Message, type MetaBody, NapukettoSatoriAdapter, type Opcode, type Order, type ReadyBody, type SatoriActionDeps, SatoriActionError, type SatoriAdapterOptions, SatoriApi, type SatoriApiOptions, type SatoriConfig, type SatoriElement, type SatoriEventContent, type SatoriEventDeps, type SatoriToCanonicalDeps, type SatoriTransportSet, type Signal, type User, assembleSatoriTransports, canonicalToSatoriElements, createSatoriActionRegistry, parseContentToCanonical, parseElements, renderElements, satoriConfigSchema, satoriHttpStatusMap, satoriToCanonicalElements, toEventSignal };
@@ -1 +1 @@
1
- export { f as HTTP_STATUS, t as NapukettoSatoriAdapter, c as SatoriActionError, i as SatoriApi, n as assembleSatoriTransports, d as canonicalToSatoriElements, a as createSatoriActionRegistry, o as parseContentToCanonical, l as parseElements, u as renderElements, m as satoriConfigSchema, p as satoriHttpStatusMap, s as satoriToCanonicalElements, r as toEventSignal } from "../satori-D5lM6S3L.mjs";
1
+ export { f as HTTP_STATUS, t as NapukettoSatoriAdapter, c as SatoriActionError, i as SatoriApi, n as assembleSatoriTransports, d as canonicalToSatoriElements, a as createSatoriActionRegistry, o as parseContentToCanonical, l as parseElements, u as renderElements, m as satoriConfigSchema, p as satoriHttpStatusMap, s as satoriToCanonicalElements, r as toEventSignal } from "../satori-9fwjhn6g.mjs";
@@ -1,4 +1,4 @@
1
- import { a as resolveProtocolConfig, i as BaseProtocolAdapter, o as ActionRegistry, r as createServerSchema, s as runAction } from "./core-4PwF_pJB.mjs";
1
+ import { a as resolveProtocolConfig, i as BaseProtocolAdapter, l as ActionRegistry, r as createServerSchema, s as createTokenAuthorize, u as runAction } from "./core-5cq8w_zB.mjs";
2
2
  import { c as MS_TO_SEC, i as toUnixSeconds, p as toUinString, r as subscribeRawMessages } from "./raw-message-Cs4vDKUU.mjs";
3
3
  import { a as logEventFailure, c as downloadBufferToFile, l as ensureSilk, t as collectGrayTipUids } from "./gray-tip-DmZmdtjP.mjs";
4
4
  import { ChatType, GrayTipSubType, NTGroupRequestOperateTypes, TipGroupElementType, isRecord, kernelError, toCanonicalElements } from "@napuketto/kernel";
@@ -1518,8 +1518,6 @@ function toMember(uid, nick, remark, uidToUinMap) {
1518
1518
  const WS_EVENTS_PATH = "/v1/events";
1519
1519
  /** HTTP RPC 版本前缀。 */
1520
1520
  const V1_PREFIX = "/v1/";
1521
- /** Authorization 头前缀。 */
1522
- const BEARER_PREFIX = "Bearer ";
1523
1521
  /** resource.method 路径模式(resource 与 method 均为字母开头的小写标识符,可含连字符/数字)。 */
1524
1522
  const ACTION_PATH_RE = /^([a-z][a-z0-9-]*)(?:\.[a-z][a-z0-9-]*)+$/i;
1525
1523
  /** 按配置装配 Satori 传输。 */
@@ -1529,10 +1527,11 @@ function assembleSatoriTransports(opts) {
1529
1527
  for (const item of config.httpServers) {
1530
1528
  if (!item.enabled) continue;
1531
1529
  const token = item.token ?? config.token;
1530
+ const authorize = createTokenAuthorize(token);
1532
1531
  const server = new HttpServer({
1533
1532
  host: item.host,
1534
1533
  port: item.port,
1535
- ...token !== void 0 && token !== "" ? { authorize: makeBearerAuthorize(token) } : {}
1534
+ ...authorize !== void 0 ? { authorize } : {}
1536
1535
  });
1537
1536
  server.onPathRequest = (ctx, req, respond) => {
1538
1537
  handleHttpRequest(ctx, req, respond, registry, login);
@@ -1561,14 +1560,6 @@ function assembleSatoriTransports(opts) {
1561
1560
  }
1562
1561
  };
1563
1562
  }
1564
- /** Bearer token 鉴权钩子。 */
1565
- function makeBearerAuthorize(token) {
1566
- return (ctx) => {
1567
- const auth = ctx.headers["authorization"] ?? ctx.headers["Authorization"];
1568
- if (auth?.startsWith(BEARER_PREFIX)) return auth.slice(7) === token;
1569
- return false;
1570
- };
1571
- }
1572
1563
  /** 解析路径:/v1/{resource}.{method} → 动作名;不匹配返回 null。 */
1573
1564
  function parseActionPath(path) {
1574
1565
  if (!path.startsWith(V1_PREFIX)) return null;
@@ -1776,4 +1767,4 @@ function pickEventResources(content) {
1776
1767
  }
1777
1768
  export { createSatoriActionRegistry as a, SatoriActionError as c, canonicalToSatoriElements as d, HTTP_STATUS as f, SatoriApi as i, parseElements as l, satoriConfigSchema as m, assembleSatoriTransports as n, parseContentToCanonical as o, satoriHttpStatusMap as p, toEventSignal as r, satoriToCanonicalElements as s, NapukettoSatoriAdapter as t, renderElements as u };
1778
1769
 
1779
- //# sourceMappingURL=satori-D5lM6S3L.mjs.map
1770
+ //# sourceMappingURL=satori-9fwjhn6g.mjs.map