@readerseye2/cr_type 1.0.51 → 1.0.53

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.
@@ -0,0 +1,214 @@
1
+ export type SectionId = string;
2
+ export type InlineRun = {
3
+ text: string;
4
+ bold?: boolean;
5
+ italic?: boolean;
6
+ underline?: boolean;
7
+ split?: boolean;
8
+ splitIndex?: number;
9
+ audioChunkIndex?: number;
10
+ audioTimeMs?: number;
11
+ audioStart?: number;
12
+ audioEnd?: number;
13
+ audioValue?: string;
14
+ };
15
+ export type ListMeta = {
16
+ kind: 'ordered' | 'bullet';
17
+ level: number;
18
+ numId?: number;
19
+ format?: string;
20
+ glyph?: string;
21
+ };
22
+ export type ParagraphBlock = {
23
+ id: string;
24
+ type: 'paragraph';
25
+ runs: InlineRun[];
26
+ list?: ListMeta;
27
+ textAlign?: 'left' | 'right' | 'center' | 'justify';
28
+ };
29
+ export type ImageBlock = {
30
+ id: string;
31
+ type: 'image';
32
+ src: string;
33
+ alt?: string;
34
+ width?: number;
35
+ height?: number;
36
+ assetKey?: string;
37
+ cdnUrl?: string;
38
+ };
39
+ export type Block = ParagraphBlock | ImageBlock;
40
+ export interface AudioMark {
41
+ time: number;
42
+ start: number;
43
+ end: number;
44
+ value: string;
45
+ }
46
+ export interface AudioClipMeta {
47
+ provider: string;
48
+ TTS_engine: string;
49
+ language: string;
50
+ speaker: string;
51
+ durationMs: number;
52
+ wordCount: number;
53
+ wpm: number;
54
+ }
55
+ type SectionAudioBase = {
56
+ chunkIndex: number;
57
+ marks?: AudioMark[];
58
+ contentType: string;
59
+ sizeBytes?: number;
60
+ meta: AudioClipMeta;
61
+ };
62
+ export type SavedSectionAudio = SectionAudioBase & {
63
+ kind: 'saved';
64
+ cdnUrl: string;
65
+ };
66
+ export type TempSectionAudio = SectionAudioBase & {
67
+ kind: 'temp';
68
+ blobUrl: string;
69
+ };
70
+ export type SectionAudio = SavedSectionAudio | TempSectionAudio;
71
+ export type SectionImage = {
72
+ kind: 'saved';
73
+ index: number;
74
+ cdnUrl: string;
75
+ alt?: string;
76
+ width?: number;
77
+ height?: number;
78
+ assetKey?: string;
79
+ } | {
80
+ kind: 'temp';
81
+ index: number;
82
+ blobUrl: string;
83
+ alt?: string;
84
+ width?: number;
85
+ height?: number;
86
+ assetKey?: string;
87
+ };
88
+ export type SectionQuiz = {
89
+ qid: string;
90
+ kind: 'saved';
91
+ index: number;
92
+ cdnUrl: string;
93
+ question: string;
94
+ options: string[];
95
+ answers: string[];
96
+ score: number;
97
+ limit_sec: number;
98
+ } | {
99
+ qid: string;
100
+ kind: 'temp';
101
+ index: number;
102
+ blobUrl: string;
103
+ question: string;
104
+ options: string[];
105
+ answers: string[];
106
+ score: number;
107
+ limit_sec: number;
108
+ };
109
+ export type SectionAST = {
110
+ title: string;
111
+ blocks: Block[];
112
+ isAddedSplit?: boolean;
113
+ isAddedAudio?: boolean;
114
+ };
115
+ export type SectionData = {
116
+ section_id: SectionId;
117
+ ast: SectionAST;
118
+ images?: SectionImage[];
119
+ audios?: SectionAudio[];
120
+ quiz?: SectionQuiz[];
121
+ };
122
+ /** 드래프트 책 메타 정보 (cr.erd.json CR.draft_book 테이블 기준)
123
+ * - user_idx는 백엔드 세션에서 확인하므로 프론트에서 전송하지 않음
124
+ * - isdeleted는 백엔드 내부용이므로 프론트에 노출하지 않음
125
+ */
126
+ export interface DraftMeta {
127
+ /** PK */
128
+ draft_book_idx: number;
129
+ /** 책 제목 (default: 'untitled') */
130
+ draft_book_title: string;
131
+ /** 언어 코드 */
132
+ draft_book_language: 'ko' | 'en';
133
+ /** 난이도 레벨 (default: 5) */
134
+ draft_book_level: number;
135
+ /** 표지 이미지 URL (nullable) */
136
+ draft_book_cover_url: string | null;
137
+ /** 원작자 */
138
+ draft_book_author: string | null;
139
+ /** 연령 등급 */
140
+ draft_book_age_grade: string | null;
141
+ /** 책 종류/장르 */
142
+ draft_book_genre: string | null;
143
+ /** 태그 배열 */
144
+ draft_book_tags: string[] | null;
145
+ /** 설명 */
146
+ draft_book_description: string | null;
147
+ /** 원출판일 (YYYY-MM-DD) */
148
+ draft_book_original_publish_date: string | null;
149
+ /** 원출판사 */
150
+ draft_book_original_publisher: string | null;
151
+ /** 판 */
152
+ draft_book_edition: string | null;
153
+ /** ISBN */
154
+ draft_book_isbn: string | null;
155
+ /** 총 어절 수 (자동 계산) */
156
+ draft_book_word_count: number | null;
157
+ /** QUIZ 다시풀기 허용 여부 */
158
+ draft_book_quiz_retry_allowed: boolean;
159
+ /** 생성일 (ISO) */
160
+ draft_book_create_date: string;
161
+ /** 수정일 (ISO) */
162
+ draft_book_update_date: string;
163
+ }
164
+ import { SectionSummary } from '../book/book.type';
165
+ export type DraftSummary = {
166
+ sectionOrder: SectionId[];
167
+ sections?: SectionSummary[];
168
+ };
169
+ export type BookDraftDTO = {
170
+ meta: DraftMeta;
171
+ summary: DraftSummary;
172
+ content: SectionData[];
173
+ };
174
+ export type SectionMap = Record<SectionId, SectionData>;
175
+ export type RuntimeTemp = {
176
+ /** 오디오 blobUrl (런타임 전용): sectionId -> clipIndex -> blobUrl */
177
+ audioBlobUrlBySection: Record<SectionId, Record<number, string>>;
178
+ /** 이미지 blobUrl (런타임 전용): sectionId -> imageIndex -> blobUrl */
179
+ imageBlobUrlBySection: Record<SectionId, Record<number, string>>;
180
+ };
181
+ export type SaveStatus = 'unsaved' | 'saving' | 'saved' | 'error';
182
+ export type SectionSaveState = {
183
+ status: SaveStatus;
184
+ savedAt?: string;
185
+ errorMessage?: string;
186
+ };
187
+ export type DraftSaveState = {
188
+ /** 메타 저장 상태 */
189
+ meta: SaveStatus;
190
+ /** 섹션 순서 저장 상태 */
191
+ order: SaveStatus;
192
+ /** 섹션별 저장 상태 */
193
+ sections: Record<SectionId, SectionSaveState>;
194
+ /** 저장 진행률 */
195
+ progress?: {
196
+ current: number;
197
+ total: number;
198
+ jobId?: string;
199
+ };
200
+ };
201
+ export interface MakeBookState {
202
+ meta: DraftMeta | null;
203
+ /** 정규화된 섹션 맵 */
204
+ sectionsById: SectionMap;
205
+ /** 섹션 순서(목차) */
206
+ sectionOrder: SectionId[];
207
+ /** 리스트 캐시(선택) */
208
+ sectionSummaries?: SectionSummary[];
209
+ /** 런타임 전용(blobUrl 등) */
210
+ temp: RuntimeTemp;
211
+ /** 저장 상태 (클라이언트 전용) */
212
+ saveState: DraftSaveState;
213
+ }
214
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './ast.types';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ast.types"), exports);
@@ -39,6 +39,7 @@ export interface BookShort {
39
39
  genre: string;
40
40
  wordCount?: number;
41
41
  soundMinutes?: number;
42
+ rating?: number;
42
43
  }
43
44
  /** 책 상세 정보 */
44
45
  export interface BookDetail extends BookShort {
@@ -57,6 +58,14 @@ export interface BookDetail extends BookShort {
57
58
  sections?: SectionSummary[];
58
59
  sectionOrder?: string[];
59
60
  }
61
+ /** 오디오 메타 정보 (TTS 설정) */
62
+ export type AudioMeta = {
63
+ provider: 'AWS' | 'GCP';
64
+ language?: 'en-US' | 'ko-KR';
65
+ engine?: 'neural' | 'standard' | 'long-form';
66
+ voiceName?: string;
67
+ voiceGender?: 'Male' | 'Female';
68
+ };
60
69
  /** 섹션 요약 정보 */
61
70
  export interface SectionSummary {
62
71
  sectionId: string;
@@ -71,6 +80,7 @@ export interface SectionSummary {
71
80
  isAddedAudio?: boolean;
72
81
  isAddedQuiz?: boolean;
73
82
  updatedAt?: string;
83
+ audioMeta?: AudioMeta;
74
84
  }
75
85
  /** 섹션 요약 - API 응답용 */
76
86
  export interface SectionSummaryResponse {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './session/session.type';
2
2
  export * from './socket';
3
3
  export * from './book';
4
+ export * from './ast';
package/dist/index.js CHANGED
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // src/index.ts
18
18
  __exportStar(require("./session/session.type"), exports);
19
19
  __exportStar(require("./socket"), exports); // socket 전체 export
20
- __exportStar(require("./book"), exports); // ✅ 추가
20
+ __exportStar(require("./book"), exports);
21
+ __exportStar(require("./ast"), exports); // AST 타입 (SectionData, Block 등)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readerseye2/cr_type",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "CheckReading shared TypeScript types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",