@readerseye2/cr_type 1.0.60 → 1.0.65

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.
@@ -1,4 +1,4 @@
1
1
  export * from './socket-clientToServerEvents.type';
2
2
  export * from './socket-serverToClientEvents.type';
3
3
  export * from './socket-message.types';
4
- export * from './reading-session.types';
4
+ export * from './reading-section.types';
@@ -18,4 +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);
21
+ __exportStar(require("./reading-section.types"), exports);
@@ -0,0 +1,114 @@
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 ViewerConfig {
17
+ fontSize?: number;
18
+ lineHeight?: number;
19
+ theme?: 'light' | 'dark' | 'sepia';
20
+ viewMode?: 'scroll' | 'page';
21
+ }
22
+ /** 읽기 진행 상황 */
23
+ export interface ReadingProgress {
24
+ currentPage?: number;
25
+ totalPages?: number;
26
+ percentage?: number;
27
+ }
28
+ /** 책/섹션 메타데이터 */
29
+ export interface SessionMeta {
30
+ bookTitle?: string;
31
+ sectionTitle?: string;
32
+ sectionOrder?: number;
33
+ totalSections?: number;
34
+ }
35
+ /** 세션 통계 */
36
+ export interface SessionStats {
37
+ pagesRead?: number;
38
+ scrollDistance?: number;
39
+ interactionCount?: number;
40
+ }
41
+ /** 섹션 읽기 시작 페이로드 */
42
+ export interface SessionStartPayload {
43
+ bookIdx: number;
44
+ sectionId: string;
45
+ snapshot: ViewerSnapshot;
46
+ viewerConfig?: ViewerConfig;
47
+ meta?: SessionMeta;
48
+ }
49
+ /** 섹션 읽기 종료 페이로드 */
50
+ export interface SessionEndPayload {
51
+ durationMs?: number;
52
+ finalSnapshot?: ViewerSnapshot;
53
+ stats?: SessionStats;
54
+ }
55
+ /** 진행 상황 업데이트 페이로드 */
56
+ export interface SessionProgressPayload {
57
+ snapshot: ViewerSnapshot;
58
+ progress?: ReadingProgress;
59
+ }
60
+ /** 이벤트 배치 전송 페이로드 */
61
+ export interface SessionEventPayload {
62
+ events: ViewerEvent[];
63
+ }
64
+ /** 세션 구독 페이로드 (Admin용) */
65
+ export interface SessionSubscribePayload {
66
+ sessionId: string;
67
+ }
68
+ /** 읽기 세션 정보 (서버 응답) */
69
+ export interface ReadingSessionInfo {
70
+ sessionId: string;
71
+ userId: number;
72
+ userType: 'parent' | 'child';
73
+ userName?: string;
74
+ bookIdx: number;
75
+ bookTitle?: string;
76
+ sectionId: string;
77
+ sectionTitle?: string;
78
+ sectionOrder?: number;
79
+ totalSections?: number;
80
+ startedAt: string;
81
+ snapshot: ViewerSnapshot;
82
+ viewerConfig?: ViewerConfig;
83
+ lastEventAt?: string;
84
+ }
85
+ /** 세션 시작 응답 */
86
+ export interface SessionStartedResponse {
87
+ session: ReadingSessionInfo;
88
+ }
89
+ /** 세션 종료 응답 */
90
+ export interface SessionEndedResponse {
91
+ sessionId: string;
92
+ durationMs?: number;
93
+ stats?: SessionStats;
94
+ }
95
+ /** 세션 진행 상황 응답 */
96
+ export interface SessionProgressResponse {
97
+ sessionId: string;
98
+ snapshot: ViewerSnapshot;
99
+ progress?: ReadingProgress;
100
+ }
101
+ /** 세션 이벤트 응답 */
102
+ export interface SessionEventsResponse {
103
+ sessionId: string;
104
+ events: ViewerEvent[];
105
+ }
106
+ /** 세션 목록 응답 */
107
+ export interface SessionListResponse {
108
+ sessions: ReadingSessionInfo[];
109
+ }
110
+ /** 세션 구독 성공 응답 */
111
+ export interface SessionSubscribedResponse {
112
+ sessionId: string;
113
+ snapshot: ViewerSnapshot;
114
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // src/socket/reading-section.types.ts
3
+ // 읽기 섹션 모니터링용 데이터 타입 정의
4
+ // 이벤트 인터페이스는 socket-clientToServerEvents.type.ts, socket-serverToClientEvents.type.ts 참조
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- /** 뷰어 스냅샷 (초기 상태) */
1
+ /** 뷰어 스냅샷 (현재 상태) */
2
2
  export interface ViewerSnapshot {
3
3
  viewMode: 'scroll' | 'page';
4
4
  globalRunIndex: number;
@@ -12,7 +12,60 @@ export interface ViewerEvent {
12
12
  timestamp: number;
13
13
  data: Record<string, unknown>;
14
14
  }
15
- /** 읽기 세션 정보 */
15
+ /** 뷰어 초기 설정 */
16
+ export interface ViewerConfig {
17
+ fontSize?: number;
18
+ lineHeight?: number;
19
+ theme?: 'light' | 'dark' | 'sepia';
20
+ viewMode?: 'scroll' | 'page';
21
+ }
22
+ /** 읽기 진행 상황 */
23
+ export interface ReadingProgress {
24
+ currentPage?: number;
25
+ totalPages?: number;
26
+ percentage?: number;
27
+ }
28
+ /** 책/섹션 메타데이터 */
29
+ export interface SessionMeta {
30
+ bookTitle?: string;
31
+ sectionTitle?: string;
32
+ sectionOrder?: number;
33
+ totalSections?: number;
34
+ }
35
+ /** 세션 통계 */
36
+ export interface SessionStats {
37
+ pagesRead?: number;
38
+ scrollDistance?: number;
39
+ interactionCount?: number;
40
+ }
41
+ /** 세션 시작 페이로드 */
42
+ export interface SessionStartPayload {
43
+ bookIdx: number;
44
+ sectionId: string;
45
+ snapshot: ViewerSnapshot;
46
+ viewerConfig?: ViewerConfig;
47
+ meta?: SessionMeta;
48
+ }
49
+ /** 세션 종료 페이로드 */
50
+ export interface SessionEndPayload {
51
+ durationMs?: number;
52
+ finalSnapshot?: ViewerSnapshot;
53
+ stats?: SessionStats;
54
+ }
55
+ /** 진행 상황 업데이트 페이로드 */
56
+ export interface SessionProgressPayload {
57
+ snapshot: ViewerSnapshot;
58
+ progress?: ReadingProgress;
59
+ }
60
+ /** 이벤트 배치 전송 페이로드 */
61
+ export interface SessionEventPayload {
62
+ events: ViewerEvent[];
63
+ }
64
+ /** 세션 구독 페이로드 */
65
+ export interface SessionSubscribePayload {
66
+ sessionId: string;
67
+ }
68
+ /** 읽기 세션 정보 (서버 응답) */
16
69
  export interface ReadingSessionInfo {
17
70
  sessionId: string;
18
71
  userId: number;
@@ -22,56 +75,40 @@ export interface ReadingSessionInfo {
22
75
  bookTitle?: string;
23
76
  sectionId: string;
24
77
  sectionTitle?: string;
78
+ sectionOrder?: number;
79
+ totalSections?: number;
25
80
  startedAt: string;
26
81
  snapshot: ViewerSnapshot;
82
+ viewerConfig?: ViewerConfig;
27
83
  lastEventAt?: string;
28
84
  }
29
- /** 세션 시작 페이로드 */
30
- export interface SessionStartPayload {
31
- bookIdx: number;
32
- sectionId: string;
85
+ /** 세션 시작 응답 */
86
+ export interface SessionStartedResponse {
87
+ session: ReadingSessionInfo;
88
+ }
89
+ /** 세션 종료 응답 */
90
+ export interface SessionEndedResponse {
91
+ sessionId: string;
92
+ durationMs?: number;
93
+ stats?: SessionStats;
94
+ }
95
+ /** 세션 진행 상황 응답 */
96
+ export interface SessionProgressResponse {
97
+ sessionId: string;
33
98
  snapshot: ViewerSnapshot;
99
+ progress?: ReadingProgress;
34
100
  }
35
- /** 이벤트 배치 전송 페이로드 */
36
- export interface SessionEventPayload {
101
+ /** 세션 이벤트 응답 */
102
+ export interface SessionEventsResponse {
103
+ sessionId: string;
37
104
  events: ViewerEvent[];
38
105
  }
39
- /** 세션 구독 페이로드 */
40
- export interface SessionSubscribePayload {
41
- sessionId: string;
106
+ /** 세션 목록 응답 */
107
+ export interface SessionListResponse {
108
+ sessions: ReadingSessionInfo[];
42
109
  }
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;
110
+ /** 세션 구독 성공 응답 */
111
+ export interface SessionSubscribedResponse {
112
+ sessionId: string;
113
+ snapshot: ViewerSnapshot;
77
114
  }
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
2
  // src/socket/reading-session.types.ts
3
+ // 읽기 세션 모니터링용 데이터 타입 정의
4
+ // 이벤트 인터페이스는 socket-clientToServerEvents.type.ts, socket-serverToClientEvents.type.ts 참조
3
5
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +1,22 @@
1
1
  import { ChatMessageReadRequest, ChatMessageRefreshRequest, MessageRequest } from "./socket-message.types";
2
+ import { SessionStartPayload, SessionEndPayload, SessionProgressPayload, SessionEventPayload, SessionSubscribePayload } from "./reading-section.types";
2
3
  export interface ClientToServerEvents {
3
4
  'chat-message:send': (msg: MessageRequest) => void;
4
5
  'chat-message:refresh': (msg: ChatMessageRefreshRequest) => void;
5
6
  'chat-message:read': (payload: ChatMessageReadRequest) => void;
7
+ 'reading-section:start': (payload: SessionStartPayload) => void;
8
+ 'reading-section:end': (payload: SessionEndPayload) => void;
9
+ 'reading-section:progress': (payload: SessionProgressPayload) => void;
10
+ 'reading-section:event': (payload: SessionEventPayload) => void;
6
11
  }
7
12
  export interface NoticeToServerEvents {
8
13
  'notice-message:send': (msg: MessageRequest) => void;
9
14
  }
10
- export interface AdminClientToServerEvents extends ClientToServerEvents, NoticeToServerEvents {
15
+ /** 읽기 섹션 관리 이벤트 (Admin용 - 활성 세션 목록 조회/구독) */
16
+ export interface ReadingAdminToServerEvents {
17
+ 'reading-section:list': () => void;
18
+ 'reading-section:subscribe': (payload: SessionSubscribePayload) => void;
19
+ 'reading-section:unsubscribe': (payload: SessionSubscribePayload) => void;
20
+ }
21
+ export interface AdminClientToServerEvents extends ClientToServerEvents, NoticeToServerEvents, ReadingAdminToServerEvents {
11
22
  }
@@ -1,5 +1,5 @@
1
1
  import { MessageReadResponse, MessageResponse, NoticeMessageResult } from "./socket-message.types";
2
- import { ReadingSessionInfo, ViewerEvent, ViewerSnapshot } from "./reading-session.types";
2
+ import { ReadingSessionInfo, ViewerEvent, ViewerSnapshot } from "./reading-section.types";
3
3
  export interface ServerToClientEvents {
4
4
  connect: () => void;
5
5
  disconnect: () => void;
@@ -12,30 +12,30 @@ export interface ServerToClientEvents {
12
12
  }) => void;
13
13
  'chat-message:read-peer': (payload: MessageReadResponse) => void;
14
14
  'chat-message:read-self': (payload: MessageReadResponse) => void;
15
+ 'reading-section:started': (payload: {
16
+ session: ReadingSessionInfo;
17
+ }) => void;
18
+ 'reading-section:ended': (payload: {
19
+ sessionId: string;
20
+ }) => void;
15
21
  }
16
22
  export interface NoticeToClientEvents {
17
23
  'notice-message:result': (payload: NoticeMessageResult) => void;
18
24
  }
19
- /** 읽기 세션 모니터링 이벤트 (Admin에게 전송) */
25
+ /** 읽기 섹션 모니터링 이벤트 (Admin에게 전송) */
20
26
  export interface ReadingServerToClientEvents {
21
- 'reading:session:list': (payload: {
27
+ 'reading-section:list': (payload: {
22
28
  sessions: ReadingSessionInfo[];
23
29
  }) => 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: {
30
+ 'reading-section:subscribed': (payload: {
31
31
  sessionId: string;
32
32
  snapshot: ViewerSnapshot | null;
33
33
  }) => void;
34
- 'reading:session:events': (payload: {
34
+ 'reading-section:events': (payload: {
35
35
  sessionId: string;
36
36
  events: ViewerEvent[];
37
37
  }) => void;
38
- 'reading:session:error': (payload: {
38
+ 'reading-section:error': (payload: {
39
39
  message: string;
40
40
  }) => void;
41
41
  }
package/package.json CHANGED
@@ -1,27 +1,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
- }
1
+ {
2
+ "name": "@readerseye2/cr_type",
3
+ "version": "1.0.65",
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
+ }