@readerseye2/cr_type 1.0.59 → 1.0.60
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/socket/index.d.ts
CHANGED
package/dist/socket/index.js
CHANGED
|
@@ -18,3 +18,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
__exportStar(require("./socket-clientToServerEvents.type"), exports);
|
|
19
19
|
__exportStar(require("./socket-serverToClientEvents.type"), exports);
|
|
20
20
|
__exportStar(require("./socket-message.types"), exports);
|
|
21
|
+
__exportStar(require("./reading-session.types"), exports);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** 뷰어 스냅샷 (초기 상태) */
|
|
2
|
+
export interface ViewerSnapshot {
|
|
3
|
+
viewMode: 'scroll' | 'page';
|
|
4
|
+
globalRunIndex: number;
|
|
5
|
+
pageIndex?: number;
|
|
6
|
+
scrollPosition?: number;
|
|
7
|
+
totalItems: number;
|
|
8
|
+
}
|
|
9
|
+
/** 뷰어 이벤트 */
|
|
10
|
+
export interface ViewerEvent {
|
|
11
|
+
type: 'page_change' | 'scroll' | 'overlay_toggle' | 'range_select' | 'quiz_answer' | 'gi_change';
|
|
12
|
+
timestamp: number;
|
|
13
|
+
data: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
/** 읽기 세션 정보 */
|
|
16
|
+
export interface ReadingSessionInfo {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
userId: number;
|
|
19
|
+
userType: 'parent' | 'child';
|
|
20
|
+
userName?: string;
|
|
21
|
+
bookIdx: number;
|
|
22
|
+
bookTitle?: string;
|
|
23
|
+
sectionId: string;
|
|
24
|
+
sectionTitle?: string;
|
|
25
|
+
startedAt: string;
|
|
26
|
+
snapshot: ViewerSnapshot;
|
|
27
|
+
lastEventAt?: string;
|
|
28
|
+
}
|
|
29
|
+
/** 세션 시작 페이로드 */
|
|
30
|
+
export interface SessionStartPayload {
|
|
31
|
+
bookIdx: number;
|
|
32
|
+
sectionId: string;
|
|
33
|
+
snapshot: ViewerSnapshot;
|
|
34
|
+
}
|
|
35
|
+
/** 이벤트 배치 전송 페이로드 */
|
|
36
|
+
export interface SessionEventPayload {
|
|
37
|
+
events: ViewerEvent[];
|
|
38
|
+
}
|
|
39
|
+
/** 세션 구독 페이로드 */
|
|
40
|
+
export interface SessionSubscribePayload {
|
|
41
|
+
sessionId: string;
|
|
42
|
+
}
|
|
43
|
+
/** Client → Server: 읽기 세션 이벤트 (Client용 - 세션 생성/종료/이벤트 전송) */
|
|
44
|
+
export interface ReadingClientToServerEvents {
|
|
45
|
+
'reading:session:start': (payload: SessionStartPayload) => void;
|
|
46
|
+
'reading:session:end': () => void;
|
|
47
|
+
'reading:session:event': (payload: SessionEventPayload) => void;
|
|
48
|
+
}
|
|
49
|
+
/** Admin → Server: 읽기 세션 이벤트 (Admin용 - 세션 목록 조회/구독) */
|
|
50
|
+
export interface ReadingAdminToServerEvents {
|
|
51
|
+
'reading:session:list': () => void;
|
|
52
|
+
'reading:session:subscribe': (payload: SessionSubscribePayload) => void;
|
|
53
|
+
'reading:session:unsubscribe': (payload: SessionSubscribePayload) => void;
|
|
54
|
+
}
|
|
55
|
+
/** Server → Admin: 읽기 세션 이벤트 */
|
|
56
|
+
export interface ReadingServerToAdminEvents {
|
|
57
|
+
'reading:session:list': (payload: {
|
|
58
|
+
sessions: ReadingSessionInfo[];
|
|
59
|
+
}) => void;
|
|
60
|
+
'reading:session:started': (payload: {
|
|
61
|
+
session: ReadingSessionInfo;
|
|
62
|
+
}) => void;
|
|
63
|
+
'reading:session:ended': (payload: {
|
|
64
|
+
sessionId: string;
|
|
65
|
+
}) => void;
|
|
66
|
+
'reading:session:subscribed': (payload: {
|
|
67
|
+
sessionId: string;
|
|
68
|
+
snapshot: ViewerSnapshot | null;
|
|
69
|
+
}) => void;
|
|
70
|
+
'reading:session:events': (payload: {
|
|
71
|
+
sessionId: string;
|
|
72
|
+
events: ViewerEvent[];
|
|
73
|
+
}) => void;
|
|
74
|
+
'reading:session:error': (payload: {
|
|
75
|
+
message: string;
|
|
76
|
+
}) => void;
|
|
77
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MessageReadResponse, MessageResponse, NoticeMessageResult } from "./socket-message.types";
|
|
2
|
+
import { ReadingSessionInfo, ViewerEvent, ViewerSnapshot } from "./reading-session.types";
|
|
2
3
|
export interface ServerToClientEvents {
|
|
3
4
|
connect: () => void;
|
|
4
5
|
disconnect: () => void;
|
|
@@ -15,5 +16,28 @@ export interface ServerToClientEvents {
|
|
|
15
16
|
export interface NoticeToClientEvents {
|
|
16
17
|
'notice-message:result': (payload: NoticeMessageResult) => void;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
/** 읽기 세션 모니터링 이벤트 (Admin에게 전송) */
|
|
20
|
+
export interface ReadingServerToClientEvents {
|
|
21
|
+
'reading:session:list': (payload: {
|
|
22
|
+
sessions: ReadingSessionInfo[];
|
|
23
|
+
}) => void;
|
|
24
|
+
'reading:session:started': (payload: {
|
|
25
|
+
session: ReadingSessionInfo;
|
|
26
|
+
}) => void;
|
|
27
|
+
'reading:session:ended': (payload: {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
'reading:session:subscribed': (payload: {
|
|
31
|
+
sessionId: string;
|
|
32
|
+
snapshot: ViewerSnapshot | null;
|
|
33
|
+
}) => void;
|
|
34
|
+
'reading:session:events': (payload: {
|
|
35
|
+
sessionId: string;
|
|
36
|
+
events: ViewerEvent[];
|
|
37
|
+
}) => void;
|
|
38
|
+
'reading:session:error': (payload: {
|
|
39
|
+
message: string;
|
|
40
|
+
}) => void;
|
|
41
|
+
}
|
|
42
|
+
export interface AdminServerToClientEvents extends ServerToClientEvents, NoticeToClientEvents, ReadingServerToClientEvents {
|
|
19
43
|
}
|
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.60",
|
|
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
|
+
}
|