refactor(packages): rename @snowluma/bridge → @snowluma/protocol
The package previously named "bridge" houses the protocol-byte layer (OIDB cmds, msg-push decoders, highway uploaders, element-builder, event bus). The name "bridge" suggested transport/lifecycle, which it isn't — that role lives in core/hook and core/bridge/manager. Rename to match what's actually inside. This is a pure rename: zero logic changes, all 73 import sites updated mechanically and TS-verified. core/onebot dependencies key updated. ESLint override path adjusted for the moved oidb-services directory. Rename detection threshold: git log --find-renames=20% recommended when following history across this commit — content-replacement (@snowluma/bridge → @snowluma/protocol) dropped per-file similarity below git's default 50% on import-heavy files.
This commit is contained in:
238 files changed
+247
-284
No files matched your search
@@ -14,7 +14,7 @@ import type {
|
||||
} from '@snowluma/proto-defs/oidb-actions/media';
|
||||
|
||||
// Post-namespace migration: ExtrasApi forwards 6 OIDB cmds through
|
||||
// namespaces under @snowluma/bridge/oidb-services/extras. Tests assert
|
||||
// namespaces under @snowluma/protocol/oidb-services/extras. Tests assert
|
||||
// against bridge.sendRawPacket directly.
|
||||
import { ExtrasApi, AiVoiceChatType } from '../../src/bridge/apis/extras';
|
||||
import { mockBridge } from './_helpers';
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
|
||||
vi.mock('@snowluma/bridge/bridge-oidb', () => ({
|
||||
vi.mock('@snowluma/protocol/bridge-oidb', () => ({
|
||||
runOidb: vi.fn(async () => new Uint8Array()),
|
||||
makeOidbEnvelope: vi.fn((_oidbCmd, _subCmd, body) => ({ body })),
|
||||
encodeOidbEnv: vi.fn(() => new Uint8Array()),
|
||||
@@ -40,7 +40,7 @@ vi.mock('@snowluma/bridge/bridge-oidb', () => ({
|
||||
const { buildSendElemsMock } = vi.hoisted(() => ({
|
||||
buildSendElemsMock: vi.fn(async (_elements: unknown[], _ctx?: Record<string, unknown>) => []),
|
||||
}));
|
||||
vi.mock('@snowluma/bridge/element-builder', () => ({
|
||||
vi.mock('@snowluma/protocol/element-builder', () => ({
|
||||
buildSendElems: buildSendElemsMock,
|
||||
}));
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ import type { Elem } from '@snowluma/proto-defs/element';
|
||||
|
||||
// Mock highway uploads only — they're irrelevant for text-only nodes
|
||||
// but the import would otherwise pull in the native ffmpeg addon.
|
||||
vi.mock('@snowluma/bridge/highway/image-upload', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/image-upload', () => ({
|
||||
uploadImageMsgInfo: vi.fn(async () => new Uint8Array()),
|
||||
}));
|
||||
vi.mock('@snowluma/bridge/highway/ptt-upload', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/ptt-upload', () => ({
|
||||
uploadPttMsgInfo: vi.fn(async () => new Uint8Array()),
|
||||
}));
|
||||
vi.mock('@snowluma/bridge/highway/video-upload', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/video-upload', () => ({
|
||||
uploadVideoMsgInfo: vi.fn(async () => new Uint8Array()),
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
|
||||
vi.mock('@snowluma/bridge/bridge-oidb', () => ({
|
||||
vi.mock('@snowluma/protocol/bridge-oidb', () => ({
|
||||
runOidb: vi.fn(async () => new Uint8Array()),
|
||||
makeOidbEnvelope: vi.fn((_oidbCmd, _subCmd, body) => ({ body })),
|
||||
encodeOidbEnv: vi.fn(() => new Uint8Array()),
|
||||
@@ -10,7 +10,7 @@ vi.mock('@snowluma/bridge/bridge-oidb', () => ({
|
||||
// element-builder reaches into protoEncode with element-specific schemas
|
||||
// that we don't want to construct manually in tests; stub it to return
|
||||
// a benign placeholder.
|
||||
vi.mock('@snowluma/bridge/element-builder', () => ({
|
||||
vi.mock('@snowluma/protocol/element-builder', () => ({
|
||||
buildSendElems: vi.fn(async () => []),
|
||||
}));
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
} from '@snowluma/proto-defs/oidb-actions/base';
|
||||
|
||||
// Post-namespace migration: FriendApi is a thin facade over the
|
||||
// namespaces under @snowluma/bridge/oidb-services/friend. Tests assert
|
||||
// namespaces under @snowluma/protocol/oidb-services/friend. Tests assert
|
||||
// against the bridge mock's sendRawPacket directly — no need for
|
||||
// module-level bridge-oidb mocks anymore.
|
||||
import { FriendApi } from '../../src/bridge/apis/friend';
|
||||
|
||||
@@ -19,7 +19,7 @@ import type {
|
||||
} from '@snowluma/proto-defs/oidb-actions/base';
|
||||
|
||||
// Post-namespace migration: GroupAdminApi forwards through namespaces
|
||||
// under @snowluma/bridge/oidb-services/group-admin. Tests assert
|
||||
// under @snowluma/protocol/oidb-services/group-admin. Tests assert
|
||||
// against bridge.sendRawPacket directly — no module-level mocks.
|
||||
import { GroupAdminApi } from '../../src/bridge/apis/group-admin';
|
||||
import { mockBridge } from './_helpers';
|
||||
|
||||
@@ -15,19 +15,19 @@ import type {
|
||||
} from '@snowluma/proto-defs/oidb-actions/media';
|
||||
|
||||
// Post-namespace migration: GroupFileApi forwards single-OIDB methods
|
||||
// through namespaces under @snowluma/bridge/oidb-services/group-file.
|
||||
// through namespaces under @snowluma/protocol/oidb-services/group-file.
|
||||
// The multi-stage methods (`upload` / `uploadPrivate`) keep their
|
||||
// orchestration on the facade; we assert against bridge.sendRawPacket
|
||||
// directly. Highway calls (fetchHighwaySession / uploadHighwayHttp)
|
||||
// and the file-source loader are still module-mocked because the
|
||||
// facade owns those calls directly.
|
||||
|
||||
vi.mock('@snowluma/bridge/highway', () => ({
|
||||
vi.mock('@snowluma/protocol/highway', () => ({
|
||||
fetchHighwaySession: vi.fn(async () => ({})),
|
||||
uploadHighwayHttp: vi.fn(async () => undefined),
|
||||
}));
|
||||
|
||||
vi.mock('@snowluma/bridge/highway/utils', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/utils', () => ({
|
||||
loadBinarySource: vi.fn(async (_src: string, fallback: string) => ({
|
||||
bytes: new Uint8Array([1, 2, 3]),
|
||||
fileName: `${fallback}.bin`,
|
||||
@@ -37,7 +37,7 @@ vi.mock('@snowluma/bridge/highway/utils', () => ({
|
||||
FILE_UPLOAD_MAX_BYTES: 4 * 1024 * 1024 * 1024,
|
||||
}));
|
||||
|
||||
import * as highwayClient from '@snowluma/bridge/highway';
|
||||
import * as highwayClient from '@snowluma/protocol/highway';
|
||||
import { GroupFileApi } from '../../src/bridge/apis/group-file';
|
||||
import { mockBridge } from './_helpers';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
|
||||
vi.mock('@snowluma/bridge/bridge-oidb', () => ({
|
||||
vi.mock('@snowluma/protocol/bridge-oidb', () => ({
|
||||
runOidb: vi.fn(async () => new Uint8Array()),
|
||||
makeOidbEnvelope: vi.fn((_oidbCmd, _subCmd, body) => ({ body })),
|
||||
encodeOidbEnv: vi.fn(() => new Uint8Array()),
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
} from '@snowluma/proto-defs/oidb-actions/base';
|
||||
|
||||
// Post-namespace migration: MiscApi forwards 3 OIDB cmds through
|
||||
// @snowluma/bridge/oidb-services/misc namespaces. The non-OIDB
|
||||
// @snowluma/protocol/oidb-services/misc namespaces. The non-OIDB
|
||||
// `getMiniAppArk` (LightAppSvc) stays inline on the facade. Tests
|
||||
// hit bridge.sendRawPacket directly.
|
||||
import { MiscApi } from '../../src/bridge/apis/misc';
|
||||
|
||||
@@ -14,9 +14,9 @@ import type {
|
||||
// the module object is a no-op — proton has already inlined the call.
|
||||
// We mock `runOidb` (non-generic) to return real proton-encoded bytes
|
||||
// that the production-side codec actually decodes.
|
||||
vi.mock('@snowluma/bridge/bridge-oidb', async () => {
|
||||
const actual = await vi.importActual<typeof import('@snowluma/bridge/bridge-oidb')>(
|
||||
'@snowluma/bridge/bridge-oidb',
|
||||
vi.mock('@snowluma/protocol/bridge-oidb', async () => {
|
||||
const actual = await vi.importActual<typeof import('@snowluma/protocol/bridge-oidb')>(
|
||||
'@snowluma/protocol/bridge-oidb',
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
@@ -25,19 +25,19 @@ vi.mock('@snowluma/bridge/bridge-oidb', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@snowluma/bridge/highway', () => ({
|
||||
vi.mock('@snowluma/protocol/highway', () => ({
|
||||
fetchHighwaySession: vi.fn(async () => ({})),
|
||||
uploadHighwayHttp: vi.fn(async () => undefined),
|
||||
}));
|
||||
|
||||
vi.mock('@snowluma/bridge/highway/utils', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/utils', () => ({
|
||||
loadBinarySource: vi.fn(async () => ({ bytes: new Uint8Array([1, 2, 3]), fileName: 'avatar.bin' })),
|
||||
computeHashes: vi.fn(() => ({ md5: new Uint8Array(16), sha1: new Uint8Array(20) })),
|
||||
computeMd5: vi.fn(() => new Uint8Array(16)),
|
||||
}));
|
||||
|
||||
import * as oidb from '@snowluma/bridge/bridge-oidb';
|
||||
import * as highwayClient from '@snowluma/bridge/highway';
|
||||
import * as oidb from '@snowluma/protocol/bridge-oidb';
|
||||
import * as highwayClient from '@snowluma/protocol/highway';
|
||||
import { ProfileApi } from '../../src/bridge/apis/profile';
|
||||
import { mockBridge } from './_helpers';
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('apis/profile', () => {
|
||||
|
||||
it('setGroupAvatar rejects an empty file before hitting highway', async () => {
|
||||
const bridge = mockBridge();
|
||||
const { loadBinarySource } = await import('@snowluma/bridge/highway/utils');
|
||||
const { loadBinarySource } = await import('@snowluma/protocol/highway/utils');
|
||||
vi.mocked(loadBinarySource).mockResolvedValueOnce({
|
||||
bytes: new Uint8Array(0), fileName: 'empty.png',
|
||||
} as any);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { BridgeEventBus } from '@snowluma/bridge/event-bus';
|
||||
import type { FriendMessage, GroupMessage } from '@snowluma/bridge/events';
|
||||
import { BridgeEventBus } from '@snowluma/protocol/event-bus';
|
||||
import type { FriendMessage, GroupMessage } from '@snowluma/protocol/events';
|
||||
|
||||
function makeFriendMessage(): FriendMessage {
|
||||
return {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { Bridge } from '../src/bridge/bridge';
|
||||
import { IdentityService } from '@snowluma/bridge/identity-service';
|
||||
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/bridge/qq-info';
|
||||
import type { GroupMemberJoin, QQEventVariant } from '@snowluma/bridge/events';
|
||||
import { IdentityService } from '@snowluma/protocol/identity-service';
|
||||
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/protocol/qq-info';
|
||||
import type { GroupMemberJoin, QQEventVariant } from '@snowluma/protocol/events';
|
||||
import type { PacketInfo } from '@snowluma/common/protocol-types';
|
||||
|
||||
const SELF_UIN = '10001';
|
||||
|
||||
@@ -4,14 +4,14 @@ import type { SendPacketResult } from '@snowluma/common/packet-sender';
|
||||
import type { SendMessageRequest, SendMessageResponse } from '@snowluma/proto-defs/action';
|
||||
import type { FileExtra } from '@snowluma/proto-defs/message';
|
||||
|
||||
vi.mock('@snowluma/bridge/element-builder', () => ({
|
||||
vi.mock('@snowluma/protocol/element-builder', () => ({
|
||||
buildSendElems: vi.fn(async () => [{ text: { str: 'stub media elem' } }]),
|
||||
}));
|
||||
|
||||
describe('Bridge private media routing', () => {
|
||||
it('includes resolved uid in the final c2c send request for media messages', async () => {
|
||||
const { Bridge } = await import('../src/bridge/bridge');
|
||||
const { IdentityService } = await import('@snowluma/bridge/identity-service');
|
||||
const { IdentityService } = await import('@snowluma/protocol/identity-service');
|
||||
|
||||
class TestBridge extends Bridge {
|
||||
capturedBody: Uint8Array | null = null;
|
||||
@@ -60,7 +60,7 @@ describe('Bridge private media routing', () => {
|
||||
// implementation wrote c2c routing + richText.notOnlineFile +
|
||||
// c2cCmd=11 — the QQ-NT server rejected every c2c file send.
|
||||
const { Bridge } = await import('../src/bridge/bridge');
|
||||
const { IdentityService } = await import('@snowluma/bridge/identity-service');
|
||||
const { IdentityService } = await import('@snowluma/protocol/identity-service');
|
||||
|
||||
class TestBridge extends Bridge {
|
||||
capturedBody: Uint8Array | null = null;
|
||||
|
||||
@@ -17,17 +17,17 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { inflateSync } from 'zlib';
|
||||
|
||||
vi.mock('@snowluma/bridge/highway/image-upload', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/image-upload', () => ({
|
||||
uploadImageMsgInfo: vi.fn(async () => new Uint8Array([7, 8, 9])),
|
||||
}));
|
||||
vi.mock('@snowluma/bridge/highway/ptt-upload', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/ptt-upload', () => ({
|
||||
uploadPttMsgInfo: vi.fn(async () => new Uint8Array([4, 5, 6])),
|
||||
}));
|
||||
vi.mock('@snowluma/bridge/highway/video-upload', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/video-upload', () => ({
|
||||
uploadVideoMsgInfo: vi.fn(async () => new Uint8Array([1, 2, 3])),
|
||||
}));
|
||||
|
||||
import { buildSendElems } from '@snowluma/bridge/element-builder';
|
||||
import { buildSendElems } from '@snowluma/protocol/element-builder';
|
||||
|
||||
const fakeBridge = {} as any;
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
formatMessageSegments,
|
||||
formatReply,
|
||||
formatUser,
|
||||
} from '@snowluma/bridge/format';
|
||||
import type { QQEventVariant } from '@snowluma/bridge/events';
|
||||
} from '@snowluma/protocol/format';
|
||||
import type { QQEventVariant } from '@snowluma/protocol/events';
|
||||
|
||||
// ─── Test fakes (just the find* surface event-format uses) ───
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import os from 'os';
|
||||
import path from 'path';
|
||||
import { pathToFileURL } from 'url';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { loadBinarySource, resolveLocalFilePath } from '@snowluma/bridge/highway/utils';
|
||||
import { loadBinarySource, resolveLocalFilePath } from '@snowluma/protocol/highway/utils';
|
||||
|
||||
describe('highway source paths', () => {
|
||||
it('normalizes file URLs with an extra leading slash on POSIX', () => {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
|
||||
vi.mock('@snowluma/bridge/highway/pipeline', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/pipeline', () => ({
|
||||
runNtv2Upload: vi.fn(async () => ({ msgInfo: { msgInfoBody: [], extBizInfo: {} } })),
|
||||
finalizeMediaMsgInfo: vi.fn(() => new Uint8Array([0xCA, 0xFE])),
|
||||
hexToBytes: vi.fn((hex: string) => new Uint8Array(hex.length / 2)),
|
||||
}));
|
||||
|
||||
vi.mock('@snowluma/bridge/highway/utils', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/utils', () => ({
|
||||
loadBinarySource: vi.fn(async () => ({ bytes: new Uint8Array([1, 2, 3]), fileName: 'src.jpg' })),
|
||||
computeHashes: vi.fn(() => ({
|
||||
md5: new Uint8Array(16),
|
||||
@@ -22,9 +22,9 @@ vi.mock('@snowluma/bridge/highway/utils', () => ({
|
||||
detectImageFormat: vi.fn(() => ({ format: 1000, width: 800, height: 600 })),
|
||||
}));
|
||||
|
||||
import * as pipeline from '@snowluma/bridge/highway/pipeline';
|
||||
import { uploadImageMsgInfo } from '@snowluma/bridge/highway/image-upload';
|
||||
import { GROUP_IMAGE_CMD_ID, PRIVATE_IMAGE_CMD_ID } from '@snowluma/bridge/highway';
|
||||
import * as pipeline from '@snowluma/protocol/highway/pipeline';
|
||||
import { uploadImageMsgInfo } from '@snowluma/protocol/highway/image-upload';
|
||||
import { GROUP_IMAGE_CMD_ID, PRIVATE_IMAGE_CMD_ID } from '@snowluma/protocol/highway';
|
||||
|
||||
describe('image-upload', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
|
||||
vi.mock('@snowluma/bridge/highway', async () => {
|
||||
const real = await vi.importActual<typeof import('@snowluma/bridge/highway')>('@snowluma/bridge/highway');
|
||||
vi.mock('@snowluma/protocol/highway', async () => {
|
||||
const real = await vi.importActual<typeof import('@snowluma/protocol/highway')>('@snowluma/protocol/highway');
|
||||
return {
|
||||
...real,
|
||||
// Only the TCP/HTTP transport is mocked — we keep real
|
||||
@@ -40,8 +40,8 @@ vi.mock('@snowluma/bridge/highway', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
import * as highway from '@snowluma/bridge/highway';
|
||||
import { runNtv2Upload, type MediaSubFileUpload } from '@snowluma/bridge/highway/pipeline';
|
||||
import * as highway from '@snowluma/protocol/highway';
|
||||
import { runNtv2Upload, type MediaSubFileUpload } from '@snowluma/protocol/highway/pipeline';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
NTV2UploadRichMediaReq,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
|
||||
vi.mock('@snowluma/bridge/highway', () => ({
|
||||
vi.mock('@snowluma/protocol/highway', () => ({
|
||||
fetchHighwaySession: vi.fn(async () => ({ sessionId: 'fake-session' })),
|
||||
uploadHighwayHttp: vi.fn(async () => undefined),
|
||||
buildHighwayExtend: vi.fn(() => new Uint8Array([0xAA, 0xBB])),
|
||||
@@ -16,14 +16,14 @@ vi.mock('@snowluma/bridge/highway', () => ({
|
||||
GROUP_IMAGE_CMD_ID: 1004,
|
||||
}));
|
||||
|
||||
import * as highway from '@snowluma/bridge/highway';
|
||||
import * as highway from '@snowluma/protocol/highway';
|
||||
import {
|
||||
finalizeMediaMsgInfo,
|
||||
hexToBytes,
|
||||
makeClientRandomId,
|
||||
runNtv2Upload,
|
||||
type MediaSubFileUpload,
|
||||
} from '@snowluma/bridge/highway/pipeline';
|
||||
} from '@snowluma/protocol/highway/pipeline';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type { EncodableMediaMsgInfo, NTV2UploadRichMediaReq, NTV2UploadRichMediaResp } from '@snowluma/proto-defs/highway';
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
|
||||
vi.mock('@snowluma/bridge/highway/pipeline', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/pipeline', () => ({
|
||||
runNtv2Upload: vi.fn(async () => ({ msgInfo: { msgInfoBody: [], extBizInfo: {} } })),
|
||||
finalizeMediaMsgInfo: vi.fn(() => new Uint8Array([0xAA, 0xBB])),
|
||||
hexToBytes: vi.fn((hex: string) => new Uint8Array(hex.length / 2)),
|
||||
}));
|
||||
|
||||
import * as pipeline from '@snowluma/bridge/highway/pipeline';
|
||||
import { uploadPttMsgInfo, GROUP_PTT_CMD_ID, PRIVATE_PTT_CMD_ID } from '@snowluma/bridge/highway/ptt-upload';
|
||||
import * as pipeline from '@snowluma/protocol/highway/pipeline';
|
||||
import { uploadPttMsgInfo, GROUP_PTT_CMD_ID, PRIVATE_PTT_CMD_ID } from '@snowluma/protocol/highway/ptt-upload';
|
||||
|
||||
const FINGERPRINT = {
|
||||
noByteFallback: true,
|
||||
|
||||
@@ -11,20 +11,20 @@
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
|
||||
vi.mock('@snowluma/bridge/highway/pipeline', () => ({
|
||||
vi.mock('@snowluma/protocol/highway/pipeline', () => ({
|
||||
runNtv2Upload: vi.fn(async () => ({ msgInfo: { msgInfoBody: [], extBizInfo: {} } })),
|
||||
finalizeMediaMsgInfo: vi.fn(() => new Uint8Array([0x12, 0x34])),
|
||||
hexToBytes: vi.fn((hex: string) => new Uint8Array(hex.length / 2)),
|
||||
}));
|
||||
|
||||
import * as pipeline from '@snowluma/bridge/highway/pipeline';
|
||||
import * as pipeline from '@snowluma/protocol/highway/pipeline';
|
||||
import {
|
||||
uploadVideoMsgInfo,
|
||||
GROUP_VIDEO_CMD_ID,
|
||||
GROUP_VIDEO_THUMB_CMD_ID,
|
||||
PRIVATE_VIDEO_CMD_ID,
|
||||
PRIVATE_VIDEO_THUMB_CMD_ID,
|
||||
} from '@snowluma/bridge/highway/video-upload';
|
||||
} from '@snowluma/protocol/highway/video-upload';
|
||||
|
||||
const FINGERPRINT = {
|
||||
noByteFallback: true,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { IdentityService } from '@snowluma/bridge/identity-service';
|
||||
import type { GroupMemberInfo, QQGroupInfo, UserProfileInfo } from '@snowluma/bridge/qq-info';
|
||||
import { IdentityService } from '@snowluma/protocol/identity-service';
|
||||
import type { GroupMemberInfo, QQGroupInfo, UserProfileInfo } from '@snowluma/protocol/qq-info';
|
||||
|
||||
const SELF_UIN = '10001';
|
||||
const GROUP_ID = 123456789;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import { parseMsgPush, MSG_PUSH_CMD } from '@snowluma/bridge/msg-push';
|
||||
import { IdentityService } from '@snowluma/bridge/identity-service';
|
||||
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/bridge/qq-info';
|
||||
import { parseMsgPush, MSG_PUSH_CMD } from '@snowluma/protocol/msg-push';
|
||||
import { IdentityService } from '@snowluma/protocol/identity-service';
|
||||
import type { GroupMemberInfo, QQGroupInfo } from '@snowluma/protocol/qq-info';
|
||||
// Proton's call-site analyzer keys off the literal type identifier
|
||||
// printed in `protobuf_encode<X>` — it walks imports by *original*
|
||||
// name (not alias). If both `import { X } from 'proto/notify'` and
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
import type { PushMsg } from '@snowluma/proto-defs/message';
|
||||
import type {
|
||||
GroupMemberJoin, FriendAddEvent, QQEventVariant,
|
||||
} from '@snowluma/bridge/events';
|
||||
} from '@snowluma/protocol/events';
|
||||
|
||||
// Local alias for the event-side recall type — derived via Extract so
|
||||
// we avoid an `import { FriendRecall as X }` that collides with the
|
||||
|
||||
@@ -13,7 +13,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { protobuf_encode } from '@snowluma/proton';
|
||||
import { subscribeLogs, type LogEntry } from '@snowluma/common/logger';
|
||||
|
||||
vi.mock('@snowluma/bridge/highway', () => ({
|
||||
vi.mock('@snowluma/protocol/highway', () => ({
|
||||
fetchHighwaySession: vi.fn(async () => ({ sessionId: 'fake-session' })),
|
||||
uploadHighwayHttp: vi.fn(async () => undefined),
|
||||
buildHighwayExtend: vi.fn(() => new Uint8Array([0xAA, 0xBB])),
|
||||
@@ -24,12 +24,12 @@ vi.mock('@snowluma/bridge/highway', () => ({
|
||||
import {
|
||||
runNtv2Upload,
|
||||
type MediaSubFileUpload,
|
||||
} from '@snowluma/bridge/highway/pipeline';
|
||||
} from '@snowluma/protocol/highway/pipeline';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type { NTV2UploadRichMediaResp } from '@snowluma/proto-defs/highway';
|
||||
import { MsgPushRegistry } from '@snowluma/bridge/msg-push/registry';
|
||||
import type { MsgPushContext } from '@snowluma/bridge/msg-push/context';
|
||||
import { decodeEvent0x2DC } from '@snowluma/bridge/msg-push/decoders/event-0x2dc';
|
||||
import { MsgPushRegistry } from '@snowluma/protocol/msg-push/registry';
|
||||
import type { MsgPushContext } from '@snowluma/protocol/msg-push/context';
|
||||
import { decodeEvent0x2DC } from '@snowluma/protocol/msg-push/decoders/event-0x2dc';
|
||||
|
||||
function encodeOidbResponse(body: unknown): Buffer {
|
||||
return Buffer.from(protobuf_encode<OidbBase<NTV2UploadRichMediaResp>>({
|
||||
|
||||
Reference in new issue
Block a user