diff --git a/__tests__/unit/im/ImClient.test.ts b/__tests__/unit/im/ImClient.test.ts index b69e75c..0afda40 100644 --- a/__tests__/unit/im/ImClient.test.ts +++ b/__tests__/unit/im/ImClient.test.ts @@ -148,7 +148,7 @@ describe('im/ImClient', () => { const body = JSON.parse(sendFrame?.body || '{}') expect(body.content).toBe('hello') expect(body.toId).toBe('user_b') - expect(body.appId).toBe('ak_demo_chat') + expect(body.appKey).toBe('ak_demo_chat') }) it('should return FAILED when WebSocket is not open', () => { @@ -174,7 +174,7 @@ describe('im/ImClient', () => { const ws = MockWebSocket.instances[0] const payload = JSON.stringify({ id: 'msg_1', - appId: 'ak_demo_chat', + appKey: 'ak_demo_chat', fromUserId: 'user_b', toId: 'user_a', chatType: 'SINGLE', @@ -208,7 +208,7 @@ describe('im/ImClient', () => { const ws = MockWebSocket.instances[0] const payload = JSON.stringify({ id: 'msg_1', - appId: 'ak_demo_chat', + appKey: 'ak_demo_chat', fromUserId: 'user_b', toId: 'user_a', chatType: 'SINGLE', @@ -238,7 +238,7 @@ describe('im/ImClient', () => { const ws = MockWebSocket.instances[0] const payload = JSON.stringify({ id: 'msg_1', - appId: 'ak_demo_chat', + appKey: 'ak_demo_chat', fromUserId: 'user_b', toId: 'user_a', chatType: 'SINGLE', diff --git a/__tests__/unit/im/useIm.test.ts b/__tests__/unit/im/useIm.test.ts index bfa82f7..e9a4ccd 100644 --- a/__tests__/unit/im/useIm.test.ts +++ b/__tests__/unit/im/useIm.test.ts @@ -130,7 +130,7 @@ describe('im/useIm', () => { const ws = MockWebSocket.instances[0] emitStompMessage(ws, { id: msg.id, - appId: 'ak_demo_chat', + appKey: 'ak_demo_chat', fromUserId: 'user_b', toId: 'user_a', chatType: 'SINGLE', @@ -163,7 +163,7 @@ describe('im/useIm', () => { const ws = MockWebSocket.instances[0] emitStompMessage(ws, { id: msg.id, - appId: 'ak_demo_chat', + appKey: 'ak_demo_chat', fromUserId: 'user_b', toId: 'user_a', chatType: 'SINGLE', diff --git a/package.json b/package.json index 2330668..36d2bb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xuqm/vue3-sdk", - "version": "0.1.0", + "version": "0.2.0", "description": "XuqmGroup Vue3 SDK — IM & platform integration for web", "private": false, "publishConfig": { @@ -16,7 +16,9 @@ "require": "./dist/index.cjs.js" } }, - "files": ["dist"], + "files": [ + "dist" + ], "scripts": { "dev": "vite build --watch", "build": "tsc --emitDeclarationOnly && vite build", diff --git a/src/im/ImClient.ts b/src/im/ImClient.ts index 6fdd89a..dea1008 100644 --- a/src/im/ImClient.ts +++ b/src/im/ImClient.ts @@ -161,7 +161,7 @@ export class ImClient { const messageId = params.messageId ?? this.generateMessageId() const outgoing: ImMessage = { id: messageId, - appId: config.appKey, + appKey: config.appKey, fromUserId: userId, fromId: userId, toId: params.toId, @@ -178,7 +178,7 @@ export class ImClient { } const payload: Record = { - appId: config.appKey, + appKey: config.appKey, messageId, toId: params.toId, chatType: params.chatType, @@ -208,7 +208,7 @@ export class ImClient { buildStompFrame( 'SEND', { destination: '/app/chat.revoke', 'content-type': 'application/json' }, - JSON.stringify({ appId: config.appKey, messageId: msgId }) + JSON.stringify({ appKey: config.appKey, messageId: msgId }) ) ) } @@ -224,7 +224,7 @@ export class ImClient { buildStompFrame( 'SEND', { destination: '/app/chat.sync', 'content-type': 'application/json' }, - JSON.stringify({ appId: config.appKey }) + JSON.stringify({ appKey: config.appKey }) ) ) } diff --git a/src/im/api.ts b/src/im/api.ts index 88b7c61..0b2d3ec 100644 --- a/src/im/api.ts +++ b/src/im/api.ts @@ -19,7 +19,7 @@ import type { function appQuery(extra?: Record) { return { - appId: getConfig().appKey, + appKey: getConfig().appKey, ...extra, } } diff --git a/src/types/index.ts b/src/types/index.ts index cd77efb..e4605ed 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -28,7 +28,7 @@ export type MsgStatus = 'SENDING' | 'SENT' | 'DELIVERED' | 'READ' | 'FAILED' | ' export interface ImMessage { id: string - appId: string + appKey: string fromUserId: string fromId?: string toId: string @@ -78,7 +78,7 @@ export interface HistoryQuery { export interface UserProfile { id?: string - appId?: string + appKey?: string userId: string nickname?: string | null avatar?: string | null @@ -89,7 +89,7 @@ export interface UserProfile { export interface ImGroup { id: string - appId?: string + appKey?: string name: string groupType?: string creatorId: string @@ -109,7 +109,7 @@ export interface ConversationGroupItem { export interface FriendRequest { id: string - appId?: string + appKey?: string fromUserId: string toUserId: string remark?: string | null @@ -120,7 +120,7 @@ export interface FriendRequest { export interface GroupJoinRequest { id: string - appId?: string + appKey?: string groupId: string requesterId: string remark?: string | null @@ -131,7 +131,7 @@ export interface GroupJoinRequest { export interface BlacklistEntry { id: string - appId: string + appKey: string userId: string blockedUserId: string createdAt: string | number