@readerseye2/cr_type 1.0.55 → 1.0.58

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,62 +1,146 @@
1
- /** 언어 코드 */
1
+ /** 언어 */
2
+ export type BookLanguage = 'ko' | 'en';
3
+ export declare const BookLanguageLabel: {
4
+ readonly ko: "한국어";
5
+ readonly en: "English";
6
+ };
7
+ /** @deprecated BookLanguage 사용 권장 */
2
8
  export declare enum BookLanguageCode {
3
9
  KO = "ko",
4
10
  EN = "en"
5
11
  }
6
- /** 레벨 범위 */
12
+ /** 권장 연령 범위 (5~19세) */
13
+ export declare const BOOK_AGE_MIN = 5;
14
+ export declare const BOOK_AGE_MAX = 19;
15
+ /** @deprecated BOOK_AGE_MIN/MAX 사용 권장 */
7
16
  export declare const BOOK_LEVEL_MIN = 5;
17
+ /** @deprecated BOOK_AGE_MIN/MAX 사용 권장 */
8
18
  export declare const BOOK_LEVEL_MAX = 19;
9
- /** 연령 등급 */
19
+ /** 길이 */
20
+ export type BookLength = 'short' | 'medium' | 'long';
21
+ export declare const BookLengthLabel: {
22
+ readonly short: "단편";
23
+ readonly medium: "중편";
24
+ readonly long: "장편";
25
+ };
26
+ /** 종류 (단순화) */
27
+ export type BookGenre = 'fiction' | 'non-fiction' | 'other';
28
+ export declare const BookGenreLabel: {
29
+ readonly fiction: "문학";
30
+ readonly 'non-fiction': "비문학";
31
+ readonly other: "기타";
32
+ };
33
+ /** @deprecated BookGenre type 사용 권장 */
34
+ export declare enum BookGenreEnum {
35
+ FICTION = "fiction",
36
+ NON_FICTION = "non-fiction",
37
+ FAIRY_TALE = "fairy-tale",
38
+ EDUCATIONAL = "educational",
39
+ SCIENCE = "science",
40
+ HISTORY = "history",
41
+ BIOGRAPHY = "biography",
42
+ POETRY = "poetry",
43
+ OTHER = "other"
44
+ }
45
+ /** 영어레벨 (영어책 전용) */
46
+ export type BookEnLevel = 'story' | 'readers' | 'early-chapter' | 'chapter' | 'novel';
47
+ export declare const BookEnLevelLabel: {
48
+ readonly story: "스토리";
49
+ readonly readers: "리더스";
50
+ readonly 'early-chapter': "얼리챕터";
51
+ readonly chapter: "챕터";
52
+ readonly novel: "노블";
53
+ };
54
+ /** 출판 연령등급 (플랫폼 정책용) */
55
+ export type PublishAgeRating = 'all' | '12' | '15' | '19';
56
+ export declare const PublishAgeRatingLabel: {
57
+ readonly all: "전체이용가";
58
+ readonly '12': "12세 이용가";
59
+ readonly '15': "15세 이용가";
60
+ readonly '19': "19세 이용가";
61
+ };
62
+ /** @deprecated PublishAgeRating 사용 권장 */
10
63
  export declare enum BookAgeGrade {
11
- ALL = "all",// 전체이용가
12
- AGE_7 = "7+",// 7세 이상
13
- AGE_12 = "12+",// 12세 이상
14
- AGE_15 = "15+",// 15세 이상
64
+ ALL = "all",
65
+ AGE_7 = "7+",
66
+ AGE_12 = "12+",
67
+ AGE_15 = "15+",
15
68
  AGE_19 = "19+"
16
69
  }
17
- /** 책 종류/장르 */
18
- export declare enum BookGenre {
19
- FICTION = "fiction",// 소설
20
- NON_FICTION = "non-fiction",// 비소설
21
- FAIRY_TALE = "fairy-tale",// 동화
22
- EDUCATIONAL = "educational",// 교육
23
- SCIENCE = "science",// 과학
24
- HISTORY = "history",// 역사
25
- BIOGRAPHY = "biography",// 전기
26
- POETRY = "poetry",// 시
27
- OTHER = "other"
28
- }
70
+ /** 생성 시 기본값 */
71
+ export declare const DEFAULT_BOOK_META: {
72
+ readonly title: "나의 책";
73
+ readonly language: BookLanguage;
74
+ readonly age: 5;
75
+ readonly length: BookLength;
76
+ readonly genre: BookGenre;
77
+ readonly quiz_retry_allowed: true;
78
+ };
29
79
  /** 어절 수 → 재생 분수 계산 (200 WPM 기준) */
30
80
  export declare const calcSoundMinutes: (wordCount: number) => number;
31
- /** 기본 정보 (리스트용) */
32
- export interface BookShort {
33
- id: string;
81
+ /** 언어 옵션 (UI Select용) */
82
+ export declare const getLanguageOptions: () => {
83
+ value: BookLanguage;
84
+ label: "한국어" | "English";
85
+ }[];
86
+ /** 길이 옵션 (UI Select용) */
87
+ export declare const getLengthOptions: () => {
88
+ value: BookLength;
89
+ label: "단편" | "중편" | "장편";
90
+ }[];
91
+ /** 장르 옵션 (UI Select용) */
92
+ export declare const getGenreOptions: () => {
93
+ value: BookGenre;
94
+ label: "문학" | "비문학" | "기타";
95
+ }[];
96
+ /** 영어레벨 옵션 (UI Select용) */
97
+ export declare const getEnLevelOptions: () => {
98
+ value: BookEnLevel;
99
+ label: "스토리" | "리더스" | "얼리챕터" | "챕터" | "노블";
100
+ }[];
101
+ /** 출판 연령등급 옵션 (UI Select용) */
102
+ export declare const getAgeRatingOptions: () => {
103
+ value: PublishAgeRating;
104
+ label: "전체이용가" | "12세 이용가" | "15세 이용가" | "19세 이용가";
105
+ }[];
106
+ /** 권장 연령 옵션 (5~19세) */
107
+ export declare const getAgeOptions: () => {
108
+ value: number;
109
+ label: string;
110
+ }[];
111
+ /** Draft 책 메타 (MongoDB) */
112
+ export interface DraftBookMeta {
113
+ draft_book_idx: number;
34
114
  title: string;
35
- author: string;
36
- coverUrl: string;
37
- language: BookLanguageCode;
38
- level: number;
39
- genre: string;
40
- wordCount?: number;
41
- soundMinutes?: number;
42
- rating?: number;
43
- }
44
- /** 책 상세 정보 */
45
- export interface BookDetail extends BookShort {
46
- description?: string;
115
+ language: BookLanguage;
116
+ age: number;
117
+ length: BookLength;
118
+ genre?: BookGenre;
119
+ quiz_retry_allowed?: boolean;
120
+ series?: string;
121
+ cover_url?: string;
122
+ en_level?: BookEnLevel;
47
123
  tags?: string[];
48
- ageGrade?: BookAgeGrade;
124
+ description?: string;
125
+ original_author?: string;
126
+ original_publish_date?: string;
127
+ original_publisher?: string;
49
128
  isbn?: string;
50
- originalPublisher?: string;
51
- originalPublishDate?: string;
52
- edition?: string;
53
- quizRetryAllowed?: boolean;
54
- toc?: string[];
55
- rating?: number;
56
- publishedAtText?: string;
57
- priceText?: string;
58
- sections?: SectionSummary[];
59
- sectionOrder?: string[];
129
+ updated_at: string;
130
+ }
131
+ /** 출판된 책 메타 (MongoDB) */
132
+ export interface BookMeta extends DraftBookMeta {
133
+ book_idx: number;
134
+ source_draft_book_idx: number;
135
+ creator_idx: number;
136
+ creator_name?: string;
137
+ price_point: number;
138
+ age_rating: PublishAgeRating;
139
+ free_section_arr?: number[];
140
+ word_count?: number;
141
+ sound_minutes?: number;
142
+ section_count?: number;
143
+ published_at: string;
60
144
  }
61
145
  /** 오디오 메타 정보 (TTS 설정) */
62
146
  export type AudioMeta = {
@@ -82,6 +166,36 @@ export interface SectionSummary {
82
166
  updatedAt?: string;
83
167
  audioMeta?: AudioMeta;
84
168
  }
169
+ /** 책 기본 정보 (리스트용) - Legacy */
170
+ export interface BookShort {
171
+ id: string;
172
+ title: string;
173
+ author: string;
174
+ coverUrl: string;
175
+ language: BookLanguageCode;
176
+ level: number;
177
+ genre: string;
178
+ wordCount?: number;
179
+ soundMinutes?: number;
180
+ rating?: number;
181
+ }
182
+ /** 책 상세 정보 - Legacy */
183
+ export interface BookDetail extends BookShort {
184
+ description?: string;
185
+ tags?: string[];
186
+ ageGrade?: BookAgeGrade;
187
+ isbn?: string;
188
+ originalPublisher?: string;
189
+ originalPublishDate?: string;
190
+ edition?: string;
191
+ quizRetryAllowed?: boolean;
192
+ toc?: string[];
193
+ rating?: number;
194
+ publishedAtText?: string;
195
+ priceText?: string;
196
+ sections?: SectionSummary[];
197
+ sectionOrder?: string[];
198
+ }
85
199
  /** 섹션 요약 - API 응답용 */
86
200
  export interface SectionSummaryResponse {
87
201
  section_id: string;
@@ -97,7 +211,7 @@ export interface SectionSummaryResponse {
97
211
  is_added_quiz?: boolean;
98
212
  updated_at?: string;
99
213
  }
100
- /** Draft 책 정보 - API 응답용 */
214
+ /** Draft 책 정보 - API 응답용 (Legacy) */
101
215
  export interface DraftBookResponse {
102
216
  draft_book_idx: number;
103
217
  draft_book_title: string;
@@ -1,17 +1,61 @@
1
1
  "use strict";
2
- // ========== Enums ==========
2
+ // ========== 기본 타입 ==========
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.calcSoundMinutes = exports.BookGenre = exports.BookAgeGrade = exports.BOOK_LEVEL_MAX = exports.BOOK_LEVEL_MIN = exports.BookLanguageCode = void 0;
5
- /** 언어 코드 */
4
+ exports.getAgeOptions = exports.getAgeRatingOptions = exports.getEnLevelOptions = exports.getGenreOptions = exports.getLengthOptions = exports.getLanguageOptions = exports.calcSoundMinutes = exports.DEFAULT_BOOK_META = exports.BookAgeGrade = exports.PublishAgeRatingLabel = exports.BookEnLevelLabel = exports.BookGenreEnum = exports.BookGenreLabel = exports.BookLengthLabel = exports.BOOK_LEVEL_MAX = exports.BOOK_LEVEL_MIN = exports.BOOK_AGE_MAX = exports.BOOK_AGE_MIN = exports.BookLanguageCode = exports.BookLanguageLabel = void 0;
5
+ exports.BookLanguageLabel = {
6
+ ko: '한국어',
7
+ en: 'English',
8
+ };
9
+ /** @deprecated BookLanguage 사용 권장 */
6
10
  var BookLanguageCode;
7
11
  (function (BookLanguageCode) {
8
12
  BookLanguageCode["KO"] = "ko";
9
13
  BookLanguageCode["EN"] = "en";
10
14
  })(BookLanguageCode || (exports.BookLanguageCode = BookLanguageCode = {}));
11
- /** 레벨 범위 */
15
+ /** 권장 연령 범위 (5~19세) */
16
+ exports.BOOK_AGE_MIN = 5;
17
+ exports.BOOK_AGE_MAX = 19;
18
+ /** @deprecated BOOK_AGE_MIN/MAX 사용 권장 */
12
19
  exports.BOOK_LEVEL_MIN = 5;
20
+ /** @deprecated BOOK_AGE_MIN/MAX 사용 권장 */
13
21
  exports.BOOK_LEVEL_MAX = 19;
14
- /** 연령 등급 */
22
+ exports.BookLengthLabel = {
23
+ short: '단편',
24
+ medium: '중편',
25
+ long: '장편',
26
+ };
27
+ exports.BookGenreLabel = {
28
+ fiction: '문학',
29
+ 'non-fiction': '비문학',
30
+ other: '기타',
31
+ };
32
+ /** @deprecated BookGenre type 사용 권장 */
33
+ var BookGenreEnum;
34
+ (function (BookGenreEnum) {
35
+ BookGenreEnum["FICTION"] = "fiction";
36
+ BookGenreEnum["NON_FICTION"] = "non-fiction";
37
+ BookGenreEnum["FAIRY_TALE"] = "fairy-tale";
38
+ BookGenreEnum["EDUCATIONAL"] = "educational";
39
+ BookGenreEnum["SCIENCE"] = "science";
40
+ BookGenreEnum["HISTORY"] = "history";
41
+ BookGenreEnum["BIOGRAPHY"] = "biography";
42
+ BookGenreEnum["POETRY"] = "poetry";
43
+ BookGenreEnum["OTHER"] = "other";
44
+ })(BookGenreEnum || (exports.BookGenreEnum = BookGenreEnum = {}));
45
+ exports.BookEnLevelLabel = {
46
+ story: '스토리',
47
+ readers: '리더스',
48
+ 'early-chapter': '얼리챕터',
49
+ chapter: '챕터',
50
+ novel: '노블',
51
+ };
52
+ exports.PublishAgeRatingLabel = {
53
+ all: '전체이용가',
54
+ '12': '12세 이용가',
55
+ '15': '15세 이용가',
56
+ '19': '19세 이용가',
57
+ };
58
+ /** @deprecated PublishAgeRating 사용 권장 */
15
59
  var BookAgeGrade;
16
60
  (function (BookAgeGrade) {
17
61
  BookAgeGrade["ALL"] = "all";
@@ -20,20 +64,38 @@ var BookAgeGrade;
20
64
  BookAgeGrade["AGE_15"] = "15+";
21
65
  BookAgeGrade["AGE_19"] = "19+";
22
66
  })(BookAgeGrade || (exports.BookAgeGrade = BookAgeGrade = {}));
23
- /** 종류/장르 */
24
- var BookGenre;
25
- (function (BookGenre) {
26
- BookGenre["FICTION"] = "fiction";
27
- BookGenre["NON_FICTION"] = "non-fiction";
28
- BookGenre["FAIRY_TALE"] = "fairy-tale";
29
- BookGenre["EDUCATIONAL"] = "educational";
30
- BookGenre["SCIENCE"] = "science";
31
- BookGenre["HISTORY"] = "history";
32
- BookGenre["BIOGRAPHY"] = "biography";
33
- BookGenre["POETRY"] = "poetry";
34
- BookGenre["OTHER"] = "other";
35
- })(BookGenre || (exports.BookGenre = BookGenre = {}));
67
+ // ========== 기본값 ==========
68
+ /** 새 책 생성 시 기본값 */
69
+ exports.DEFAULT_BOOK_META = {
70
+ title: '나의 책',
71
+ language: 'en',
72
+ age: 5,
73
+ length: 'short',
74
+ genre: 'fiction',
75
+ quiz_retry_allowed: true,
76
+ };
36
77
  // ========== 헬퍼 함수 ==========
37
78
  /** 어절 수 → 재생 분수 계산 (200 WPM 기준) */
38
79
  const calcSoundMinutes = (wordCount) => Math.ceil(wordCount / 200);
39
80
  exports.calcSoundMinutes = calcSoundMinutes;
81
+ /** 언어 옵션 (UI Select용) */
82
+ const getLanguageOptions = () => Object.entries(exports.BookLanguageLabel).map(([value, label]) => ({ value: value, label }));
83
+ exports.getLanguageOptions = getLanguageOptions;
84
+ /** 길이 옵션 (UI Select용) */
85
+ const getLengthOptions = () => Object.entries(exports.BookLengthLabel).map(([value, label]) => ({ value: value, label }));
86
+ exports.getLengthOptions = getLengthOptions;
87
+ /** 장르 옵션 (UI Select용) */
88
+ const getGenreOptions = () => Object.entries(exports.BookGenreLabel).map(([value, label]) => ({ value: value, label }));
89
+ exports.getGenreOptions = getGenreOptions;
90
+ /** 영어레벨 옵션 (UI Select용) */
91
+ const getEnLevelOptions = () => Object.entries(exports.BookEnLevelLabel).map(([value, label]) => ({ value: value, label }));
92
+ exports.getEnLevelOptions = getEnLevelOptions;
93
+ /** 출판 연령등급 옵션 (UI Select용) */
94
+ const getAgeRatingOptions = () => Object.entries(exports.PublishAgeRatingLabel).map(([value, label]) => ({ value: value, label }));
95
+ exports.getAgeRatingOptions = getAgeRatingOptions;
96
+ /** 권장 연령 옵션 (5~19세) */
97
+ const getAgeOptions = () => Array.from({ length: exports.BOOK_AGE_MAX - exports.BOOK_AGE_MIN + 1 }, (_, i) => ({
98
+ value: exports.BOOK_AGE_MIN + i,
99
+ label: `만 ${exports.BOOK_AGE_MIN + i}세`,
100
+ }));
101
+ exports.getAgeOptions = getAgeOptions;
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
- {
2
- "name": "@readerseye2/cr_type",
3
- "version": "1.0.55",
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.58",
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
+ }