@readerseye2/cr_type 1.0.170 → 1.0.172

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.
@@ -5,3 +5,4 @@ export * from './socket-message.types';
5
5
  export * from './reading-section.types';
6
6
  export * from './connected-user.types';
7
7
  export * from './unified-session.types';
8
+ export * from './result-socket.types';
@@ -22,3 +22,4 @@ __exportStar(require("./socket-message.types"), exports);
22
22
  __exportStar(require("./reading-section.types"), exports);
23
23
  __exportStar(require("./connected-user.types"), exports);
24
24
  __exportStar(require("./unified-session.types"), exports);
25
+ __exportStar(require("./result-socket.types"), exports);
@@ -67,7 +67,3 @@ export interface SessionProgressPayload {
67
67
  export interface SessionEventPayload {
68
68
  events: ViewerEvent[];
69
69
  }
70
- /** 세션 구독 페이로드 */
71
- export interface SessionSubscribePayload {
72
- readingSessionId: string;
73
- }
@@ -0,0 +1,75 @@
1
+ import type { ViewerSnapshot } from './reading-section.types';
2
+ import type { ChunkRef, ChunkReadingScanSummary, UnifiedSessionManifest, UnifiedSegmentMeta, UnifiedChunkFile } from './unified-session.types';
3
+ /** /result 토큰 인증 세션 데이터 */
4
+ export interface ResultSessionData {
5
+ tokenType: 'live' | 'replay';
6
+ sessionId: string;
7
+ permissions: {
8
+ showGaze: boolean;
9
+ showChildName: boolean;
10
+ };
11
+ expiresAt: number;
12
+ }
13
+ /** CR_result → CR_ws */
14
+ export interface ResultToServerEvents {
15
+ /** 세션 구독 (Room 입장) */
16
+ 'session:subscribe': (data: {
17
+ sessionToken: string;
18
+ }) => void;
19
+ /** 세션 구독 해제 */
20
+ 'session:unsubscribe': () => void;
21
+ /** 과거 세션 manifest 조회 */
22
+ 'history:get-manifest': (data: {
23
+ shareToken: string;
24
+ }) => void;
25
+ /** 과거 세션 segment meta 조회 */
26
+ 'history:get-segment-meta': (data: {
27
+ shareToken: string;
28
+ segIdx: number;
29
+ }) => void;
30
+ /** 과거 세션 chunk 조회 */
31
+ 'history:get-chunks': (data: {
32
+ shareToken: string;
33
+ segIdx: number;
34
+ from: number;
35
+ to: number;
36
+ }) => void;
37
+ }
38
+ /** CR_ws → CR_result */
39
+ export interface ResultServerToClientEvents {
40
+ /** 구독 확인 + 초기 상태 */
41
+ 'session:subscribed': (data: {
42
+ sessionId: string;
43
+ snapshot: ViewerSnapshot | null;
44
+ segmentRanges: Array<{
45
+ start: number;
46
+ end: number;
47
+ }>;
48
+ chunkRefs: ChunkRef[];
49
+ readingScan?: ChunkReadingScanSummary;
50
+ }) => void;
51
+ /** 새 chunk 알림 (데이터는 S3에서 직접 fetch) */
52
+ 'chunk:notify': (data: {
53
+ segmentIndex: number;
54
+ chunkKey: string;
55
+ startTs: number;
56
+ endTs: number;
57
+ readingScan?: ChunkReadingScanSummary;
58
+ }) => void;
59
+ /** 세션 종료 알림 */
60
+ 'session:ended': (data: {
61
+ durationMs: number;
62
+ }) => void;
63
+ /** 에러 */
64
+ 'session:error': (data: {
65
+ message: string;
66
+ }) => void;
67
+ /** 과거 세션 응답 */
68
+ 'history:manifest': (data: UnifiedSessionManifest) => void;
69
+ 'history:segment-meta': (data: UnifiedSegmentMeta) => void;
70
+ 'history:chunks': (data: UnifiedChunkFile[]) => void;
71
+ /** 시청자 수 */
72
+ 'viewer:count': (data: {
73
+ count: number;
74
+ }) => void;
75
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import { ChatMessageReadRequest, ChatMessageRefreshRequest, MessageRequest } from "./socket-message.types";
2
- import { SessionProgressPayload, SessionEventPayload, SessionSubscribePayload } from "./reading-section.types";
2
+ import { SessionProgressPayload, SessionEventPayload } from "./reading-section.types";
3
3
  import { ViewerOpenPayload, ViewerClosePayload, GazeDataPayload, SessionHistoryListPayload, SessionHistoryGetPayload, SessionHistoryDeletePayload, UnifiedChunksGetPayload, UnifiedSegmentGetPayload } from "./unified-session.types";
4
4
  import { ReadingProgressReport } from "../book/child-reading-progress.type";
5
5
  export interface ClientToServerEvents {
@@ -16,10 +16,6 @@ export interface ClientToServerEvents {
16
16
  'session:event': (payload: SessionEventPayload) => void;
17
17
  /** 시선 데이터 전송 (~1초 간격) */
18
18
  'session:gaze': (payload: GazeDataPayload) => void;
19
- /** 세션 구독 (Parent가 자녀 세션 모니터링) */
20
- 'session:subscribe': (payload: SessionSubscribePayload) => void;
21
- /** 세션 구독 해제 */
22
- 'session:unsubscribe': (payload: SessionSubscribePayload) => void;
23
19
  /** 읽기 진행 보고 (5초 주기 자동저장) */
24
20
  'progress:reading-save': (payload: ReadingProgressReport) => void;
25
21
  /** 자녀 읽기 상태 구독 시작 */
@@ -45,10 +41,6 @@ export interface ReadingWatchAdminToServerEvents {
45
41
  export interface SessionAdminToServerEvents {
46
42
  /** 활성 세션 목록 조회 */
47
43
  'session:list': () => void;
48
- /** 세션 구독 (실시간 모니터링) */
49
- 'session:subscribe': (payload: SessionSubscribePayload) => void;
50
- /** 세션 구독 해제 */
51
- 'session:unsubscribe': (payload: SessionSubscribePayload) => void;
52
44
  /** 세션 이력 목록 조회 (S3) */
53
45
  'session:list-history': (payload: SessionHistoryListPayload) => void;
54
46
  /** 세션 이력 상세 조회 (S3) */
@@ -1,8 +1,6 @@
1
1
  import { MessageReadResponse, MessageResponse, NoticeMessageResult } from "./socket-message.types";
2
- import { ViewerSnapshot } from "./reading-section.types";
3
- import { ViewerEvent } from "./viewer-events.types";
4
2
  import { ConnectedUser, ConnectedUsersGrouped } from "./connected-user.types";
5
- import { UnifiedSessionInfo, SessionSegmentChangedPayload, SessionSubscribedPayload, UnifiedChunkFile, GazeDataPayload, SessionHistoryListResult, SessionHistoryGetResult, UnifiedChunksResult, UnifiedSegmentResult, SessionHistoryDeleteResult } from "./unified-session.types";
3
+ import { UnifiedSessionInfo, SessionSegmentChangedPayload, SessionHistoryListResult, SessionHistoryGetResult, UnifiedChunksResult, UnifiedSegmentResult, SessionHistoryDeleteResult } from "./unified-session.types";
6
4
  import { LiveReadingState } from "../book/child-reading-progress.type";
7
5
  export interface ServerToClientEvents {
8
6
  connect: () => void;
@@ -25,31 +23,6 @@ export interface ServerToClientEvents {
25
23
  readingSessionId: string;
26
24
  durationMs?: number;
27
25
  }) => void;
28
- /** 구독 성공 (Parent가 자녀 세션 구독 시) */
29
- 'session:subscribed': (payload: SessionSubscribedPayload) => void;
30
- /** 구독 중인 세션의 진행 상황 */
31
- 'session:progress': (payload: {
32
- readingSessionId: string;
33
- snapshot: ViewerSnapshot;
34
- }) => void;
35
- /** 구독 중인 세션의 이벤트 */
36
- 'session:events': (payload: {
37
- readingSessionId: string;
38
- events: ViewerEvent[];
39
- }) => void;
40
- /** 구독 중인 세션의 실시간 시선 데이터 (~1초 간격) */
41
- 'session:gaze': (payload: {
42
- readingSessionId: string;
43
- gazeData: GazeDataPayload;
44
- }) => void;
45
- /** 구독 중인 세션의 세그먼트 변경 (섹션 변경) */
46
- 'session:segment-changed': (payload: SessionSegmentChangedPayload) => void;
47
- /** 구독 중인 세션의 청크 (10초 간격) */
48
- 'session:chunk': (payload: {
49
- readingSessionId: string;
50
- segmentIndex: number;
51
- chunk: UnifiedChunkFile;
52
- }) => void;
53
26
  /** 세션 에러 */
54
27
  'session:error': (payload: {
55
28
  message: string;
@@ -79,31 +52,8 @@ export interface SessionServerToClientEvents {
79
52
  readingSessionId: string;
80
53
  durationMs?: number;
81
54
  }) => void;
82
- /** 구독 성공 */
83
- 'session:subscribed': (payload: SessionSubscribedPayload) => void;
84
- /** 구독 중인 세션 진행 상황 */
85
- 'session:progress': (payload: {
86
- readingSessionId: string;
87
- snapshot: ViewerSnapshot;
88
- }) => void;
89
- /** 구독 중인 세션 이벤트 */
90
- 'session:events': (payload: {
91
- readingSessionId: string;
92
- events: ViewerEvent[];
93
- }) => void;
94
- /** 구독 중인 세션 실시간 시선 데이터 (~1초 간격) */
95
- 'session:gaze': (payload: {
96
- readingSessionId: string;
97
- gazeData: GazeDataPayload;
98
- }) => void;
99
55
  /** 세그먼트 변경 (섹션 변경) */
100
56
  'session:segment-changed': (payload: SessionSegmentChangedPayload) => void;
101
- /** 실시간 청크 (10초 간격, 구독자에게) */
102
- 'session:chunk': (payload: {
103
- readingSessionId: string;
104
- segmentIndex: number;
105
- chunk: UnifiedChunkFile;
106
- }) => void;
107
57
  /** 에러 */
108
58
  'session:error': (payload: {
109
59
  message: string;
@@ -8,13 +8,6 @@ export interface ChunkRef {
8
8
  key: string;
9
9
  eventCount: number;
10
10
  }
11
- /** session:subscribed 응답 페이로드 */
12
- export interface SessionSubscribedPayload {
13
- readingSessionId: string;
14
- snapshot: ViewerSnapshot | null;
15
- /** 과거 chunk 참조 목록 (seek용 — 시간범위 + S3 키) */
16
- chunkRefs?: ChunkRef[];
17
- }
18
11
  /** 통합 세션 상태 */
19
12
  export type UnifiedSessionStatus = 'active' | 'ended';
20
13
  /** 통합 세그먼트 상태 */
@@ -38,6 +31,15 @@ export interface GazeBatch {
38
31
  * - snapshot: 청크 시작 시점의 뷰어 상태 (Seek 시 초기화용)
39
32
  * - gazeData: 시선 추적 배치 데이터 (활성 시에만)
40
33
  */
34
+ /** 5초 chunk 종료 시점의 읽기 분석 요약 */
35
+ export interface ChunkReadingScanSummary {
36
+ readRatio: number;
37
+ validReadGIs: number;
38
+ totalReadMs: number;
39
+ totalAwayMs: number;
40
+ avgFixationMs: number;
41
+ metrics?: Record<string, number>;
42
+ }
41
43
  export interface UnifiedChunkFile {
42
44
  startTimestamp: number;
43
45
  endTimestamp: number;
@@ -46,6 +48,8 @@ export interface UnifiedChunkFile {
46
48
  snapshot?: ViewerSnapshot;
47
49
  /** 시선 추적 데이터 배치 (~30FPS, 활성 시에만 포함) */
48
50
  gazeData?: GazeBatch[];
51
+ /** chunk 시점 읽기 분석 요약 (Phase 4) */
52
+ readingScanSummary?: ChunkReadingScanSummary;
49
53
  }
50
54
  /**
51
55
  * 통합 세그먼트 메타데이터
@@ -284,7 +288,6 @@ export interface ActiveUnifiedSession {
284
288
  currentSegment: ActiveUnifiedSegment | null;
285
289
  completedSegments: UnifiedSegmentSummary[];
286
290
  totalEvents: number;
287
- subscribers: Set<string>;
288
291
  chunkIntervalHandle: ReturnType<typeof setInterval> | null;
289
292
  }
290
293
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readerseye2/cr_type",
3
- "version": "1.0.170",
3
+ "version": "1.0.172",
4
4
  "description": "CheckReading shared TypeScript types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",