@vibexnpm/talkx 4.0.0 → 5.1.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": "4.0.0",
3
+ "version": "5.1.0",
4
4
  "type": "module",
5
5
  "description": "TalkFlow SDK - Chat & WebRTC unified client",
6
6
  "main": "dist/talkflow-sdk.umd.js",
@@ -81,6 +81,9 @@ class TalkFlowClient extends EventEmitter {
81
81
  resumeOnVisibility: options.resumeOnVisibility !== false,
82
82
  // 갭 복구 (재연결/복귀 후 끊긴 구간 메시지 재조회). false 로 꺼야 하므로 !== false 로 보존.
83
83
  syncOnReconnect: options.syncOnReconnect !== false,
84
+ // 진행 중 AI 스트림 재개 (구독/재연결 시 서버 스냅샷으로 앞부분 이어받기). 갭 복구와 별개 축.
85
+ // ⚠️ 여기 담지 않으면 ChatClient 기본값 true 로 되살아나 롤백 스위치가 동작하지 않는다.
86
+ assistantStreamReplay: options.assistantStreamReplay !== false,
84
87
  rewindMillis: options.rewindMillis !== undefined
85
88
  ? options.rewindMillis
86
89
  : DefaultConfig.rewindMillis,
@@ -289,7 +292,15 @@ class TalkFlowClient extends EventEmitter {
289
292
  }
290
293
 
291
294
  /**
292
- * 사용자 정보 수정
295
+ * 사용자 정보 수정.
296
+ *
297
+ * 서버는 갱신된 프로필이 담긴 **새 JWT** 를 응답에 함께 실어 준다(`/auth` 와 같은 계약).
298
+ * 이걸 채택하지 않으면 옛 토큰의 name/profileUrl 클레임이 계속 나가, 서버가 그 클레임을 읽는
299
+ * 경로에서 낡은 값이 최대 7일(토큰 TTL) 동안 보인다.
300
+ *
301
+ * 같은 사용자의 토큰 교체라 `setToken` 은 재연결을 일으키지 않는다 — userId 가 바뀔 때만
302
+ * 재초기화하고, 여기서는 STOMP connectHeaders 만 갱신된다.
303
+ *
293
304
  * @param {Object} userData
294
305
  * @param {string} [userData.nickname] - 닉네임 (max 100자)
295
306
  * @param {string} [userData.profileImageUrl] - 프로필 이미지 URL (max 500자)
@@ -299,7 +310,20 @@ class TalkFlowClient extends EventEmitter {
299
310
  */
300
311
  async updateMyInfo(userData) {
301
312
  this._checkToken();
302
- return this.apiClient.put('/api/v1/users/update', userData);
313
+ const response = await this.apiClient.put('/api/v1/users/update', userData);
314
+
315
+ if (response?.data?.accessToken) {
316
+ // 토큰 교체 실패로 수정 자체를 실패시키지 않는다 — 서버 반영은 이미 끝났고,
317
+ // 옛 토큰도 유효(낡았을 뿐)하므로 여기서 throw 하면 호출자가 이미 적용된 수정을
318
+ // 다시 시도하게 된다. authenticate() 는 토큰이 없으면 아무것도 못 하므로 계약이 다르다.
319
+ try {
320
+ await this.setToken(response.data.accessToken);
321
+ } catch (error) {
322
+ this.logger.warn('Profile updated but token refresh failed; keeping the old token', error);
323
+ }
324
+ }
325
+
326
+ return response;
303
327
  }
304
328
 
305
329
  /**