@readerseye2/cr_type 1.0.184 → 1.0.186
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/dist/book/book-api.type.d.ts +15 -15
- package/dist/book/book-api.type.js +2 -2
- package/dist/book/book-log.type.d.ts +14 -14
- package/dist/book/book-log.type.js +2 -2
- package/dist/book/book.const.d.ts +274 -274
- package/dist/book/book.const.js +119 -119
- package/dist/book/legacy.book.type.d.ts +164 -164
- package/dist/book/legacy.book.type.js +41 -41
- package/dist/socket/socket-clientToServerEvents.type.d.ts +24 -8
- package/dist/socket/socket-serverToClientEvents.type.d.ts +33 -6
- package/dist/socket/unified-session.types.d.ts +46 -0
- package/dist/socket/webrtc.types.d.ts +13 -13
- package/dist/socket/webrtc.types.js +2 -2
- package/package.json +27 -27
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChatMessageReadRequest, ChatMessageRefreshRequest, MessageRequest } from "./socket-message.types";
|
|
2
2
|
import { SessionDataPayload } from "./reading-section.types";
|
|
3
|
-
import { ViewerOpenPayload, ViewerClosePayload, SessionHistoryListPayload, SessionHistoryGetPayload, SessionHistoryDeletePayload, UnifiedChunksGetPayload, UnifiedSegmentGetPayload } from "./unified-session.types";
|
|
3
|
+
import { ViewerOpenPayload, ViewerClosePayload, SessionHistoryListPayload, SessionHistoryGetPayload, SessionHistoryDeletePayload, UnifiedChunksGetPayload, UnifiedSegmentGetPayload, LiveBatchPayload } from "./unified-session.types";
|
|
4
4
|
import { ReadingProgressReport } from "../book/child-reading-progress.type";
|
|
5
5
|
export interface ClientToServerEvents {
|
|
6
6
|
'chat-message:send': (msg: MessageRequest) => void;
|
|
@@ -10,7 +10,7 @@ export interface ClientToServerEvents {
|
|
|
10
10
|
'session:open': (payload: ViewerOpenPayload) => void;
|
|
11
11
|
/** 뷰어 닫힘 (세션 종료) */
|
|
12
12
|
'session:close': (payload: ViewerClosePayload) => void;
|
|
13
|
-
/**
|
|
13
|
+
/** 10초 통합 데이터 (events + gaze + snapshot) */
|
|
14
14
|
'session:data': (payload: SessionDataPayload) => void;
|
|
15
15
|
/** 자녀 세션 live 구독 (부모) */
|
|
16
16
|
'live:subscribe': (payload: {
|
|
@@ -20,6 +20,12 @@ export interface ClientToServerEvents {
|
|
|
20
20
|
'live:unsubscribe': (payload: {
|
|
21
21
|
readingSessionId: string;
|
|
22
22
|
}) => void;
|
|
23
|
+
/** 라이브 batch 전송 (CR_app → server, 100ms 주기) */
|
|
24
|
+
'live:batch': (payload: LiveBatchPayload) => void;
|
|
25
|
+
/** 라이브 mid-join 초기 상태 요청 (watcher → server) */
|
|
26
|
+
'live:request-initial': (payload: {
|
|
27
|
+
readingSessionId: string;
|
|
28
|
+
}) => void;
|
|
23
29
|
/** 읽기 진행 보고 (5초 주기 자동저장) */
|
|
24
30
|
'progress:reading-save': (payload: ReadingProgressReport) => void;
|
|
25
31
|
/** 자녀 읽기 상태 구독 시작 */
|
|
@@ -36,19 +42,29 @@ export interface ClientToServerEvents {
|
|
|
36
42
|
targetChildSocketId: string;
|
|
37
43
|
sdp: string;
|
|
38
44
|
}) => void;
|
|
39
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* 자녀→부모 answer.
|
|
47
|
+
* targetParentSocketId: 부모 계정 단말 단위로 1:1 라우팅하기 위해 사용.
|
|
48
|
+
* 같은 parent_idx의 다른 단말로는 전송되지 않는다.
|
|
49
|
+
*/
|
|
40
50
|
'webrtc:answer': (payload: {
|
|
41
|
-
|
|
51
|
+
targetParentSocketId: string;
|
|
42
52
|
sdp: string;
|
|
43
53
|
}) => void;
|
|
44
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* ICE candidate 교환 (양방향).
|
|
56
|
+
* targetSocketId: 발신자가 부모면 자녀 socket, 자녀면 부모 socket을 지정.
|
|
57
|
+
*/
|
|
45
58
|
'webrtc:ice-candidate': (payload: {
|
|
46
|
-
|
|
59
|
+
targetSocketId: string;
|
|
47
60
|
candidate: string;
|
|
48
61
|
}) => void;
|
|
49
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* 연결 종료 (양방향).
|
|
64
|
+
* targetSocketId: 1:1 hangup 대상 socket.
|
|
65
|
+
*/
|
|
50
66
|
'webrtc:hangup': (payload: {
|
|
51
|
-
|
|
67
|
+
targetSocketId: string;
|
|
52
68
|
}) => void;
|
|
53
69
|
/**
|
|
54
70
|
* WebRTC 진단 정보 (부모→서버, 단방향)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MessageReadResponse, MessageResponse, NoticeMessageResult } from "./socket-message.types";
|
|
2
2
|
import { ConnectedUser, ConnectedUsersGrouped } from "./connected-user.types";
|
|
3
|
-
import { UnifiedSessionInfo, SessionSegmentChangedPayload, SessionHistoryListResult, SessionHistoryGetResult, UnifiedChunksResult, UnifiedSegmentResult, SessionHistoryDeleteResult } from "./unified-session.types";
|
|
3
|
+
import { UnifiedSessionInfo, SessionSegmentChangedPayload, SessionHistoryListResult, SessionHistoryGetResult, UnifiedChunksResult, UnifiedSegmentResult, SessionHistoryDeleteResult, LiveBatchPayload, LiveInitialPayload, LiveChunkRolledPayload, LiveEmitToggle } from "./unified-session.types";
|
|
4
4
|
import { LiveReadingState } from "../book/child-reading-progress.type";
|
|
5
5
|
/** WebRTC ICE 서버 설정 (STUN/TURN) */
|
|
6
6
|
export interface IceServerConfig {
|
|
@@ -33,7 +33,7 @@ export interface ServerToClientEvents {
|
|
|
33
33
|
'session:error': (payload: {
|
|
34
34
|
message: string;
|
|
35
35
|
}) => void;
|
|
36
|
-
/** 새 chunk 저장 알림 (
|
|
36
|
+
/** 새 chunk 저장 알림 (10초마다) — 데이터는 기존 API로 fetch */
|
|
37
37
|
'live:chunk-notify': (payload: {
|
|
38
38
|
readingSessionId: string;
|
|
39
39
|
segmentIndex: number;
|
|
@@ -46,6 +46,16 @@ export interface ServerToClientEvents {
|
|
|
46
46
|
readingSessionId: string;
|
|
47
47
|
durationMs: number;
|
|
48
48
|
}) => void;
|
|
49
|
+
/** 라이브 batch fanout (server → watchers in live:${id} room) */
|
|
50
|
+
'live:batch': (payload: LiveBatchPayload) => void;
|
|
51
|
+
/** 라이브 mid-join 초기 상태 응답 (server → 단일 watcher) */
|
|
52
|
+
'live:initial': (payload: LiveInitialPayload) => void;
|
|
53
|
+
/** chunk 경계 anchor 갱신 (server → watchers) */
|
|
54
|
+
'live:chunk-rolled': (payload: LiveChunkRolledPayload) => void;
|
|
55
|
+
/** 시청자 1명 이상 → publisher emit 시작 (Phase 7) */
|
|
56
|
+
'live:start-emit': (payload: LiveEmitToggle) => void;
|
|
57
|
+
/** 시청자 0명 → publisher emit 정지 (Phase 7) */
|
|
58
|
+
'live:stop-emit': (payload: LiveEmitToggle) => void;
|
|
49
59
|
/** 자녀(같은 family room)가 소켓에 연결됨 */
|
|
50
60
|
'user:connected': (payload: {
|
|
51
61
|
user: ConnectedUser;
|
|
@@ -62,29 +72,46 @@ export interface ServerToClientEvents {
|
|
|
62
72
|
'reading:child-offline': (payload: {
|
|
63
73
|
testeeIdx: number;
|
|
64
74
|
}) => void;
|
|
65
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* 부모의 offer 수신 (자녀 측) — iceServers 포함.
|
|
77
|
+
* fromParentSocketId: 자녀가 어느 부모 단말이 보낸 offer인지 식별.
|
|
78
|
+
* 같은 parent_idx의 단말 2대가 동시에 같은 자녀에 offer를 보내면 두 PC가 공존해야 한다.
|
|
79
|
+
*/
|
|
66
80
|
'webrtc:offer': (payload: {
|
|
67
81
|
fromParentIdx: number;
|
|
82
|
+
fromParentSocketId: string;
|
|
68
83
|
sdp: string;
|
|
69
84
|
iceServers?: IceServerConfig[];
|
|
70
85
|
}) => void;
|
|
71
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* 자녀의 answer 수신 (부모 측).
|
|
88
|
+
* fromSocketId: 어느 자녀 단말이 보낸 answer인지 식별.
|
|
89
|
+
*/
|
|
72
90
|
'webrtc:answer': (payload: {
|
|
73
91
|
fromChildIdx: number;
|
|
92
|
+
fromSocketId: string;
|
|
74
93
|
sdp: string;
|
|
75
94
|
}) => void;
|
|
76
95
|
/** TURN credential 포함 ICE 서버 설정 (부모 측, offer 직후 수신) */
|
|
77
96
|
'webrtc:ice-servers': (payload: {
|
|
78
97
|
iceServers: IceServerConfig[];
|
|
79
98
|
}) => void;
|
|
80
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* ICE candidate 수신 (양방향).
|
|
101
|
+
* fromSocketId: 발신자 socketId — 수신측이 어느 PC에 매핑할지 결정하는 키.
|
|
102
|
+
*/
|
|
81
103
|
'webrtc:ice-candidate': (payload: {
|
|
82
104
|
fromIdx: number;
|
|
105
|
+
fromSocketId: string;
|
|
83
106
|
candidate: string;
|
|
84
107
|
}) => void;
|
|
85
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* 연결 종료 수신 (양방향).
|
|
110
|
+
* fromSocketId: 발신자 socketId.
|
|
111
|
+
*/
|
|
86
112
|
'webrtc:hangup': (payload: {
|
|
87
113
|
fromIdx: number;
|
|
114
|
+
fromSocketId: string;
|
|
88
115
|
}) => void;
|
|
89
116
|
}
|
|
90
117
|
export interface NoticeToClientEvents {
|
|
@@ -308,3 +308,49 @@ export interface ActiveUnifiedSegment {
|
|
|
308
308
|
totalEvents: number;
|
|
309
309
|
totalGazeSamples: number;
|
|
310
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* 라이브 batch 페이로드 (CR_app → server → watchers).
|
|
313
|
+
* - events 있으면 reliable emit, gaze만이면 volatile emit
|
|
314
|
+
* - gazeSamples: flat [x, y, t, x, y, t, ...] (저장과 동일 포맷)
|
|
315
|
+
*/
|
|
316
|
+
export interface LiveBatchPayload {
|
|
317
|
+
readingSessionId: string;
|
|
318
|
+
/** flat [x, y, t, ...]. 100ms 동안 누적된 gaze samples */
|
|
319
|
+
gazeSamples?: number[];
|
|
320
|
+
/** 100ms 동안 발생한 viewer events */
|
|
321
|
+
events?: ViewerEvent[];
|
|
322
|
+
/** publisher 측 batch 종료 timestamp */
|
|
323
|
+
clientTs: number;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Watcher mid-join 응답 (server → 단일 watcher).
|
|
327
|
+
* chunkStartSnapshot은 anchor, bufferedEvents/bufferedGaze는 chunk 시작~now 누적.
|
|
328
|
+
*/
|
|
329
|
+
export interface LiveInitialPayload {
|
|
330
|
+
readingSessionId: string;
|
|
331
|
+
segmentIndex: number;
|
|
332
|
+
chunkStartTs: number;
|
|
333
|
+
chunkStartSnapshot: ViewerSnapshot;
|
|
334
|
+
/** chunk 시작 ~ 현재 누적 events */
|
|
335
|
+
bufferedEvents: ViewerEvent[];
|
|
336
|
+
/** chunk 시작 ~ 현재 누적 gaze */
|
|
337
|
+
bufferedGaze: GazeBatch[];
|
|
338
|
+
/** 서버 응답 시각 (clock sync용) */
|
|
339
|
+
serverTs: number;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Chunk 경계에서 새 anchor 통지 (server → watchers).
|
|
343
|
+
* watcher는 이 신호로 currentChunkStartTs 갱신 + snapshot 재적용.
|
|
344
|
+
*/
|
|
345
|
+
export interface LiveChunkRolledPayload {
|
|
346
|
+
readingSessionId: string;
|
|
347
|
+
segmentIndex: number;
|
|
348
|
+
newChunkStartTs: number;
|
|
349
|
+
newChunkStartSnapshot: ViewerSnapshot;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Publisher → emit on/off 신호 (시청자 0명 최적화, Phase 7).
|
|
353
|
+
*/
|
|
354
|
+
export interface LiveEmitToggle {
|
|
355
|
+
readingSessionId: string;
|
|
356
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/** WebRTC 얼굴보기 — 자녀 디바이스 식별용 플랫폼 라벨 */
|
|
2
|
-
export type ChildDevicePlatform = 'windows' | 'macos' | 'android' | 'ios' | 'linux' | 'unknown';
|
|
3
|
-
/**
|
|
4
|
-
* WebRTC 얼굴보기 디바이스 선택 모달용 자녀 디바이스 정보.
|
|
5
|
-
* 같은 자녀 계정으로 여러 단말에 로그인 중일 때, 부모가 어느 단말 영상을 볼지 선택.
|
|
6
|
-
*/
|
|
7
|
-
export interface ChildDeviceInfo {
|
|
8
|
-
socketId: string;
|
|
9
|
-
platform: ChildDevicePlatform;
|
|
10
|
-
userAgent: string | null;
|
|
11
|
-
/** ISO 시각 — 해당 socket이 connect한 시점 */
|
|
12
|
-
connectedAt: string;
|
|
13
|
-
}
|
|
1
|
+
/** WebRTC 얼굴보기 — 자녀 디바이스 식별용 플랫폼 라벨 */
|
|
2
|
+
export type ChildDevicePlatform = 'windows' | 'macos' | 'android' | 'ios' | 'linux' | 'unknown';
|
|
3
|
+
/**
|
|
4
|
+
* WebRTC 얼굴보기 디바이스 선택 모달용 자녀 디바이스 정보.
|
|
5
|
+
* 같은 자녀 계정으로 여러 단말에 로그인 중일 때, 부모가 어느 단말 영상을 볼지 선택.
|
|
6
|
+
*/
|
|
7
|
+
export interface ChildDeviceInfo {
|
|
8
|
+
socketId: string;
|
|
9
|
+
platform: ChildDevicePlatform;
|
|
10
|
+
userAgent: string | null;
|
|
11
|
+
/** ISO 시각 — 해당 socket이 connect한 시점 */
|
|
12
|
+
connectedAt: string;
|
|
13
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@readerseye2/cr_type",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "CheckReading shared TypeScript types",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"deploy_npm": "npm version patch && npm publish --access public",
|
|
12
|
-
"build": "tsc --project tsconfig.json",
|
|
13
|
-
"prepare": "npm run build"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "https://github.com/bnri/CR_type.git"
|
|
18
|
-
},
|
|
19
|
-
"author": "guripong",
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"access": "public"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"typescript": "^5.8.3"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@readerseye2/cr_type",
|
|
3
|
+
"version": "1.0.186",
|
|
4
|
+
"description": "CheckReading shared TypeScript types",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"deploy_npm": "npm version patch && npm publish --access public",
|
|
12
|
+
"build": "tsc --project tsconfig.json",
|
|
13
|
+
"prepare": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/bnri/CR_type.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "guripong",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.8.3"
|
|
26
|
+
}
|
|
27
|
+
}
|