@vibexnpm/talkx 8.11.0 → 8.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibexnpm/talkx",
3
- "version": "8.11.0",
3
+ "version": "8.12.0",
4
4
  "type": "module",
5
5
  "description": "TalkFlow SDK - Chat & WebRTC unified client",
6
6
  "main": "dist/talkflow-sdk.umd.js",
@@ -1439,14 +1439,16 @@ class ChatClient extends EventEmitter {
1439
1439
  *
1440
1440
  * @param {Object} [params]
1441
1441
  * @param {string} [params.roomId] - 방 하나로 거르기. 생략하면 참여 중인 방 전부. 참여하지 않은 방이면 403
1442
+ * @param {'IMAGE'|'VIDEO'|'AUDIO'|'DOCUMENT'|'FILE'} [params.type] - 종류로 거르기 — 응답 category 와 같은 값
1443
+ * ({@code FILE} = 기타). 생략하면 전부, 그 밖의 값이면 400. 방·종류를 바꾸면 커서 없이 처음부터 부른다
1442
1444
  * @param {number} [params.size=50] - 페이지 크기 (1-100, 파일 수)
1443
1445
  * @param {string} [params.lastId] - 직전 응답의 lastId 를 그대로 — 불투명 값이라 만들어 쓰지 않는다
1444
1446
  * @param {number} [params.lastSortValue] - 직전 응답의 lastSortValue 를 그대로
1445
1447
  * @returns {Promise<Object>}
1446
1448
  */
1447
1449
  async getFiles(params = {}) {
1448
- const { roomId, size = 50, lastId, lastSortValue } = params;
1449
- return this.apiClient.get('/api/v1/files', { roomId, size, lastId, lastSortValue });
1450
+ const { roomId, type, size = 50, lastId, lastSortValue } = params;
1451
+ return this.apiClient.get('/api/v1/files', { roomId, type, size, lastId, lastSortValue });
1450
1452
  }
1451
1453
 
1452
1454
  /**
@@ -2,20 +2,20 @@
2
2
  * 파일함 타입 — docs/chat.md «파일함» 예제가 <b>실제로 컴파일되는지</b>.
3
3
  *
4
4
  * <p>jest 는 `.d.ts` 를 보지 않는다. 문서가 약속한 모양(반환은 envelope 째 · 한 줄 = 파일 하나 · 커서 두 칸은 직전 응답
5
- * 그대로 · 이름·방 이름은 비어 있을 수 있음 · 종류는 다섯 값)이 선언과 맞는지 여기서 tsc 로 고정한다.</p>
5
+ * 그대로 · 이름·방 이름은 비어 있을 수 있음 · 종류는 다섯 값이고 거를 때도 같은 값)이 선언과 맞는지 여기서 tsc 로 고정한다.</p>
6
6
  *
7
7
  * <p>실행: {@code npm run typecheck}</p>
8
8
  */
9
9
  import TalkFlowClient from '../index';
10
- import type { ChatFile, ChatFileListParams } from '../index';
10
+ import type { ChatFile, ChatFileCategory, ChatFileListParams } from '../index';
11
11
 
12
12
  declare const talkflow: TalkFlowClient;
13
13
  declare const roomId: string;
14
14
 
15
- // 1) 처음부터 끝까지 — 다음 페이지는 응답의 커서 두 칸을 그대로 넘긴다.
16
- async function loadAll(filterRoomId?: string): Promise<ChatFile[]> {
15
+ // 1) 처음부터 끝까지 — 다음 페이지는 응답의 커서 두 칸을 그대로 넘긴다. 종류 탭이면 type 을 함께 싣는다.
16
+ async function loadAll(filterRoomId?: string, tab?: ChatFileCategory): Promise<ChatFile[]> {
17
17
  const rows: ChatFile[] = [];
18
- let params: ChatFileListParams = { roomId: filterRoomId, size: 50 };
18
+ let params: ChatFileListParams = { roomId: filterRoomId, type: tab, size: 50 };
19
19
  for (;;) {
20
20
  const result = await talkflow.getFiles(params);
21
21
  rows.push(...result.data.content);
@@ -43,11 +43,12 @@ function describe(row: ChatFile): string {
43
43
  return `${who} · ${room} · ${row.file.fileName ?? link}`;
44
44
  }
45
45
 
46
- // 3) 방 목록 필터는 파일함에 없다 — 방 하나는 roomId 로 고른다.
47
- async function wrongFilter(): Promise<void> {
48
- // @ts-expect-error — type 은 방 목록(getRooms) 파라미터다.
46
+ // 3) 종류는 파일 종류 다섯 값뿐 — 방 종류(GROUP 등)는 파일함 type 이 아니다. 응답 category 를 그대로 다시 넣을 수 있다.
47
+ async function wrongFilter(row: ChatFile): Promise<void> {
48
+ // @ts-expect-error — GROUP 은 방 종류다(방 목록 getRooms 의 type).
49
49
  await talkflow.getFiles({ type: 'GROUP' });
50
- await talkflow.getFiles({ roomId });
50
+ await talkflow.getFiles({ roomId, type: 'FILE' });
51
+ await talkflow.getFiles({ type: row.category });
51
52
  }
52
53
 
53
54
  void [loadAll, describe, wrongFilter];
package/types/index.d.ts CHANGED
@@ -1290,10 +1290,18 @@ export interface ApiEnvelope<T> {
1290
1290
  message?: string;
1291
1291
  }
1292
1292
 
1293
+ /**
1294
+ * 파일 종류 — {@link ChatFile.category} 와 {@link ChatFileListParams.type} 이 같은 값을 쓴다.
1295
+ * {@code FILE} 은 «기타» — 이미지·동영상·음성·문서가 아닌 파일(zip 등).
1296
+ */
1297
+ export type ChatFileCategory = 'IMAGE' | 'VIDEO' | 'AUDIO' | 'DOCUMENT' | 'FILE';
1298
+
1293
1299
  /** {@link ChatClient.getFiles} 파라미터 — 파일함 한 페이지. */
1294
1300
  export interface ChatFileListParams {
1295
1301
  /** 방 하나로 거르기. 생략하면 내가 지금 참여 중인 방 전부. 참여하지 않은 방이면 403. */
1296
1302
  roomId?: string;
1303
+ /** 종류로 거르기 — 생략하면 전부. 방·종류를 바꾸면 커서({@code lastId}·{@code lastSortValue}) 없이 처음부터 부른다. */
1304
+ type?: ChatFileCategory;
1297
1305
  /** 페이지 크기(파일 수). 기본 50, max 100. */
1298
1306
  size?: number;
1299
1307
  /** 직전 응답의 {@code lastId} 그대로 — 불투명 값이라 만들어 쓰지 않는다. */
@@ -1326,7 +1334,7 @@ export interface ChatFile {
1326
1334
  /** 올린 시각(epoch millis). */
1327
1335
  uploadedAt: number;
1328
1336
  /** 종류 — 파일 MIME 기준, 채팅 첨부 분류와 같다. */
1329
- category: 'IMAGE' | 'VIDEO' | 'AUDIO' | 'DOCUMENT' | 'FILE';
1337
+ category: ChatFileCategory;
1330
1338
  /** 파일명({@code fileName})·다운로드 링크({@code fileUrl})·MIME({@code fileType})·크기·썸네일 — 채팅 메시지 첨부와 같은 모양. */
1331
1339
  file: FileMetaData;
1332
1340
  }