narou 1.1.0 → 2.0.0

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.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -35
  3. package/dist/index.browser.cjs +87 -1230
  4. package/dist/index.browser.cjs.map +1 -1
  5. package/dist/index.browser.d.cts +31 -24
  6. package/dist/index.browser.d.mts +47 -0
  7. package/dist/index.browser.mjs +66 -0
  8. package/dist/index.browser.mjs.map +1 -0
  9. package/dist/index.cjs +147 -1281
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.common-8lS2K_1Y.mjs +1166 -0
  12. package/dist/index.common-8lS2K_1Y.mjs.map +1 -0
  13. package/dist/index.common-CYj0n0aU.cjs +1346 -0
  14. package/dist/index.common-CYj0n0aU.cjs.map +1 -0
  15. package/dist/index.d.cts +39 -23
  16. package/dist/index.d.mts +63 -0
  17. package/dist/index.mjs +128 -0
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/user-search-BY6FdEe7.d.cts +1394 -0
  20. package/dist/user-search-Besgk-Hx.d.mts +1394 -0
  21. package/package.json +34 -45
  22. package/pnpm-lock.yaml +2523 -2175
  23. package/src/index.browser.ts +21 -5
  24. package/src/index.ts +16 -3
  25. package/src/narou-fetch.ts +4 -3
  26. package/src/narou-jsonp.ts +4 -2
  27. package/src/narou-search-results.ts +2 -1
  28. package/src/narou.ts +53 -13
  29. package/src/params.ts +2 -2
  30. package/src/ranking-history.ts +13 -4
  31. package/src/ranking.ts +99 -26
  32. package/src/search-builder-r18.ts +23 -6
  33. package/src/search-builder.ts +183 -76
  34. package/src/user-search.ts +9 -2
  35. package/src/util/date.ts +38 -0
  36. package/src/util/jsonp.ts +61 -6
  37. package/src/util/type.ts +23 -0
  38. package/src/util/unzipp.ts +9 -0
  39. package/dist/chunk-4VC3246A.js +0 -83
  40. package/dist/chunk-4VC3246A.js.map +0 -1
  41. package/dist/chunk-4ZP5YNWI.js +0 -1
  42. package/dist/chunk-4ZP5YNWI.js.map +0 -1
  43. package/dist/chunk-AZT2OXBZ.js +0 -26
  44. package/dist/chunk-AZT2OXBZ.js.map +0 -1
  45. package/dist/chunk-CDOBNSCL.js +0 -407
  46. package/dist/chunk-CDOBNSCL.js.map +0 -1
  47. package/dist/chunk-K22KVNAH.js +0 -94
  48. package/dist/chunk-K22KVNAH.js.map +0 -1
  49. package/dist/chunk-NVMUSXA5.js +0 -23
  50. package/dist/chunk-NVMUSXA5.js.map +0 -1
  51. package/dist/chunk-P7QOZBII.js +0 -386
  52. package/dist/chunk-P7QOZBII.js.map +0 -1
  53. package/dist/chunk-RITMMCZE.js +0 -37
  54. package/dist/chunk-RITMMCZE.js.map +0 -1
  55. package/dist/chunk-SNPBEVCY.js +0 -44
  56. package/dist/chunk-SNPBEVCY.js.map +0 -1
  57. package/dist/chunk-UN3W2CT3.js +0 -72
  58. package/dist/chunk-UN3W2CT3.js.map +0 -1
  59. package/dist/chunk-WYSPGQ3S.js +0 -44
  60. package/dist/chunk-WYSPGQ3S.js.map +0 -1
  61. package/dist/chunk-XAUB42TO.js +0 -15
  62. package/dist/chunk-XAUB42TO.js.map +0 -1
  63. package/dist/chunk-XVH2CU2Q.js +0 -39
  64. package/dist/chunk-XVH2CU2Q.js.map +0 -1
  65. package/dist/index.browser.d.ts +0 -40
  66. package/dist/index.browser.js +0 -125
  67. package/dist/index.browser.js.map +0 -1
  68. package/dist/index.common.cjs +0 -1058
  69. package/dist/index.common.cjs.map +0 -1
  70. package/dist/index.common.d.cts +0 -6
  71. package/dist/index.common.d.ts +0 -6
  72. package/dist/index.common.js +0 -75
  73. package/dist/index.common.js.map +0 -1
  74. package/dist/index.d.ts +0 -47
  75. package/dist/index.js +0 -130
  76. package/dist/index.js.map +0 -1
  77. package/dist/narou-CatW_TC9.d.cts +0 -301
  78. package/dist/narou-fH9osIoh.d.ts +0 -301
  79. package/dist/narou-fetch.cjs +0 -161
  80. package/dist/narou-fetch.cjs.map +0 -1
  81. package/dist/narou-fetch.d.cts +0 -20
  82. package/dist/narou-fetch.d.ts +0 -20
  83. package/dist/narou-fetch.js +0 -10
  84. package/dist/narou-fetch.js.map +0 -1
  85. package/dist/narou-jsonp.cjs +0 -159
  86. package/dist/narou-jsonp.cjs.map +0 -1
  87. package/dist/narou-jsonp.d.cts +0 -13
  88. package/dist/narou-jsonp.d.ts +0 -13
  89. package/dist/narou-jsonp.js +0 -10
  90. package/dist/narou-jsonp.js.map +0 -1
  91. package/dist/narou-ranking-results.cjs +0 -19
  92. package/dist/narou-ranking-results.cjs.map +0 -1
  93. package/dist/narou-ranking-results.d.cts +0 -4
  94. package/dist/narou-ranking-results.d.ts +0 -4
  95. package/dist/narou-ranking-results.js +0 -1
  96. package/dist/narou-ranking-results.js.map +0 -1
  97. package/dist/narou-search-results-D5yqPRZ7.d.ts +0 -727
  98. package/dist/narou-search-results-DWCJWTC5.d.cts +0 -727
  99. package/dist/narou-search-results.cjs +0 -62
  100. package/dist/narou-search-results.cjs.map +0 -1
  101. package/dist/narou-search-results.d.cts +0 -2
  102. package/dist/narou-search-results.d.ts +0 -2
  103. package/dist/narou-search-results.js +0 -11
  104. package/dist/narou-search-results.js.map +0 -1
  105. package/dist/narou.cjs +0 -109
  106. package/dist/narou.cjs.map +0 -1
  107. package/dist/narou.d.cts +0 -4
  108. package/dist/narou.d.ts +0 -4
  109. package/dist/narou.js +0 -8
  110. package/dist/narou.js.map +0 -1
  111. package/dist/params.cjs +0 -448
  112. package/dist/params.cjs.map +0 -1
  113. package/dist/params.d.cts +0 -2
  114. package/dist/params.d.ts +0 -2
  115. package/dist/params.js +0 -41
  116. package/dist/params.js.map +0 -1
  117. package/dist/ranking-history.cjs +0 -39
  118. package/dist/ranking-history.cjs.map +0 -1
  119. package/dist/ranking-history.d.cts +0 -17
  120. package/dist/ranking-history.d.ts +0 -17
  121. package/dist/ranking-history.js +0 -7
  122. package/dist/ranking-history.js.map +0 -1
  123. package/dist/ranking.cjs +0 -674
  124. package/dist/ranking.cjs.map +0 -1
  125. package/dist/ranking.d.cts +0 -47
  126. package/dist/ranking.d.ts +0 -47
  127. package/dist/ranking.js +0 -9
  128. package/dist/ranking.js.map +0 -1
  129. package/dist/search-builder-r18.cjs +0 -488
  130. package/dist/search-builder-r18.cjs.map +0 -1
  131. package/dist/search-builder-r18.d.cts +0 -32
  132. package/dist/search-builder-r18.d.ts +0 -32
  133. package/dist/search-builder-r18.js +0 -9
  134. package/dist/search-builder-r18.js.map +0 -1
  135. package/dist/search-builder.cjs +0 -525
  136. package/dist/search-builder.cjs.map +0 -1
  137. package/dist/search-builder.d.cts +0 -4
  138. package/dist/search-builder.d.ts +0 -4
  139. package/dist/search-builder.js +0 -12
  140. package/dist/search-builder.js.map +0 -1
  141. package/dist/user-search.cjs +0 -301
  142. package/dist/user-search.cjs.map +0 -1
  143. package/dist/user-search.d.cts +0 -66
  144. package/dist/user-search.d.ts +0 -66
  145. package/dist/user-search.js +0 -9
  146. package/dist/user-search.js.map +0 -1
  147. package/dist/util/jsonp.cjs +0 -63
  148. package/dist/util/jsonp.cjs.map +0 -1
  149. package/dist/util/jsonp.d.cts +0 -13
  150. package/dist/util/jsonp.d.ts +0 -13
  151. package/dist/util/jsonp.js +0 -7
  152. package/dist/util/jsonp.js.map +0 -1
  153. package/dist/util/type.cjs +0 -19
  154. package/dist/util/type.cjs.map +0 -1
  155. package/dist/util/type.d.cts +0 -4
  156. package/dist/util/type.d.ts +0 -4
  157. package/dist/util/type.js +0 -1
  158. package/dist/util/type.js.map +0 -1
  159. package/dist/util/unzipp.cjs +0 -47
  160. package/dist/util/unzipp.cjs.map +0 -1
  161. package/dist/util/unzipp.d.cts +0 -3
  162. package/dist/util/unzipp.d.ts +0 -3
  163. package/dist/util/unzipp.js +0 -7
  164. package/dist/util/unzipp.js.map +0 -1
@@ -1,1058 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.common.ts
21
- var index_common_exports = {};
22
- __export(index_common_exports, {
23
- BigGenre: () => BigGenre,
24
- BigGenreNotation: () => BigGenreNotation,
25
- BooleanNumber: () => BooleanNumber,
26
- BuntaiParam: () => BuntaiParam,
27
- DateParam: () => DateParam,
28
- End: () => End,
29
- Fields: () => Fields,
30
- Genre: () => Genre,
31
- GenreNotation: () => GenreNotation,
32
- NarouNovel: () => NarouNovel,
33
- NarouSearchResults: () => NarouSearchResults,
34
- NovelSearchBuilderBase: () => NovelSearchBuilderBase,
35
- NovelType: () => NovelType,
36
- NovelTypeParam: () => NovelTypeParam,
37
- OptionalFields: () => OptionalFields,
38
- Order: () => Order,
39
- R18Fields: () => R18Fields,
40
- R18Site: () => R18Site,
41
- R18SiteNotation: () => R18SiteNotation,
42
- RankingBuilder: () => RankingBuilder,
43
- RankingType: () => RankingType,
44
- SearchBuilder: () => SearchBuilder,
45
- SearchBuilderBase: () => SearchBuilderBase,
46
- SearchBuilderR18: () => SearchBuilderR18,
47
- StopParam: () => StopParam,
48
- UserFields: () => UserFields,
49
- UserOrder: () => UserOrder,
50
- formatRankingHistory: () => formatRankingHistory
51
- });
52
- module.exports = __toCommonJS(index_common_exports);
53
-
54
- // src/narou-search-results.ts
55
- var NarouSearchResults = class {
56
- /**
57
- * @constractor
58
- * @private
59
- */
60
- constructor([header, ...result], params) {
61
- const count = header.allcount;
62
- const limit = params.lim ?? 20;
63
- const start = params.st ?? 0;
64
- this.allcount = count;
65
- this.limit = limit;
66
- this.start = start;
67
- this.page = start / limit;
68
- this.length = result.length;
69
- this.values = result;
70
- }
71
- };
72
- var NovelType = {
73
- /** 連載 */
74
- Rensai: 1,
75
- /** 短編 */
76
- Tanpen: 2
77
- };
78
- var End = {
79
- /** 短編小説と完結済小説 */
80
- KanketsuOrTanpen: 0,
81
- /** 連載中 */
82
- Rensai: 1
83
- };
84
-
85
- // src/narou.ts
86
- var NarouNovel = class {
87
- /**
88
- * APIへの検索リクエストを実行する
89
- * @param params クエリパラメータ
90
- * @param endpoint APIエンドポイント
91
- * @returns 検索結果
92
- */
93
- async executeSearch(params, endpoint = "https://api.syosetu.com/novelapi/api/") {
94
- return new NarouSearchResults(await this.execute(params, endpoint), params);
95
- }
96
- /**
97
- * 小説APIへの検索リクエストを実行する
98
- * @param params クエリパラメータ
99
- * @returns 検索結果
100
- * @see https://dev.syosetu.com/man/api/
101
- */
102
- async executeNovel(params) {
103
- return await this.executeSearch(
104
- params,
105
- "https://api.syosetu.com/novelapi/api/"
106
- );
107
- }
108
- /**
109
- * R18小説APIへの検索リクエストを実行する
110
- * @param params クエリパラメータ
111
- * @returns 検索結果
112
- * @see https://dev.syosetu.com/xman/api/
113
- */
114
- async executeNovel18(params) {
115
- return await this.executeSearch(
116
- params,
117
- "https://api.syosetu.com/novel18api/api/"
118
- );
119
- }
120
- /**
121
- * ランキングAPIへのリクエストを実行する
122
- * @param params クエリパラメータ
123
- * @returns ランキング結果
124
- * @see https://dev.syosetu.com/man/rankapi/
125
- */
126
- async executeRanking(params) {
127
- return await this.execute(params, "https://api.syosetu.com/rank/rankget/");
128
- }
129
- /**
130
- * 殿堂入りAPiへのリクエストを実行する
131
- * @param params クエリパラメータ
132
- * @returns ランキング履歴結果
133
- * @see https://dev.syosetu.com/man/rankinapi/
134
- */
135
- async executeRankingHistory(params) {
136
- return await this.execute(params, "https://api.syosetu.com/rank/rankin/");
137
- }
138
- /**
139
- * ユーザー検索APIへのリクエストを実行する
140
- * @param params クエリパラメータ
141
- * @returns 検索結果
142
- * @see https://dev.syosetu.com/man/userapi/
143
- */
144
- async executeUserSearch(params) {
145
- return await this.execute(params, "https://api.syosetu.com/userapi/api/");
146
- }
147
- };
148
-
149
- // src/params.ts
150
- var RankingType = {
151
- Daily: "d",
152
- Weekly: "w",
153
- Monthly: "m",
154
- Quarterly: "q"
155
- };
156
- var BooleanNumber = {
157
- True: 1,
158
- False: 0
159
- };
160
- var Fields = {
161
- /** 小説名 */
162
- title: "t",
163
- /** Nコード */
164
- ncode: "n",
165
- /** 作者のユーザID(数値) */
166
- userid: "u",
167
- /** 作者名 */
168
- writer: "w",
169
- /** 小説のあらすじ */
170
- story: "s",
171
- /** 大ジャンル */
172
- biggenre: "bg",
173
- /** ジャンル */
174
- genre: "g",
175
- /** キーワード */
176
- keyword: "k",
177
- /** 初回掲載日 */
178
- general_firstup: "gf",
179
- /** 最終掲載日 */
180
- general_lastup: "gl",
181
- /** 連載の場合は1、短編の場合は2 */
182
- noveltype: "nt",
183
- /** 短編小説と完結済小説は0となっています。連載中は1です。 */
184
- end: "e",
185
- /** 全掲載部分数 */
186
- general_all_no: "ga",
187
- /** 小説文字数 */
188
- length: "l",
189
- /** 読了時間(分単位) */
190
- time: "ti",
191
- /** 長期連載停止中 */
192
- isstop: "i",
193
- /** 登録必須キーワードに「R15」が含まれる場合は1、それ以外は0です。 */
194
- isr15: "isr",
195
- /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */
196
- isbl: "ibl",
197
- /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */
198
- isgl: "igl",
199
- /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */
200
- iszankoku: "izk",
201
- /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */
202
- istensei: "its",
203
- /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */
204
- istenni: "iti",
205
- /** 総合評価ポイント */
206
- global_point: "gp",
207
- /** 日間ポイント */
208
- daily_point: "dp",
209
- /** 週間ポイント */
210
- weekly_point: "wp",
211
- /** 月間ポイント */
212
- monthly_point: "mp",
213
- /** 四半期ポイント */
214
- quarter_point: "qp",
215
- /** 年間ポイント */
216
- yearly_point: "yp",
217
- /** ブックマーク数 */
218
- fav_novel_cnt: "f",
219
- /** 感想数 */
220
- impression_cnt: "imp",
221
- /** レビュー数 */
222
- review_cnt: "r",
223
- /** 評価ポイント */
224
- all_point: "a",
225
- /** 評価者数 */
226
- all_hyoka_cnt: "ah",
227
- /** 挿絵の数 */
228
- sasie_cnt: "sa",
229
- /** 会話率 */
230
- kaiwaritu: "ka",
231
- /** 小説の更新日時 */
232
- novelupdated_at: "nu",
233
- /**
234
- * 最終更新日時
235
- * システム用で小説更新時とは関係ありません
236
- */
237
- updated_at: "ua"
238
- };
239
- var R18Fields = {
240
- /** 小説名 */
241
- title: "t",
242
- /** Nコード */
243
- ncode: "n",
244
- /** 作者のユーザID(数値) */
245
- userid: "u",
246
- /** 作者名 */
247
- writer: "w",
248
- /** 小説のあらすじ */
249
- story: "s",
250
- /** 掲載サイト */
251
- nocgenre: "ng",
252
- /** キーワード */
253
- keyword: "k",
254
- /** 初回掲載日 */
255
- general_firstup: "gf",
256
- /** 最終掲載日 */
257
- general_lastup: "gl",
258
- /** 連載の場合は1、短編の場合は2 */
259
- noveltype: "nt",
260
- /** 短編小説と完結済小説は0となっています。連載中は1です。 */
261
- end: "e",
262
- /** 全掲載部分数 */
263
- general_all_no: "ga",
264
- /** 小説文字数 */
265
- length: "l",
266
- /** 読了時間(分単位) */
267
- time: "ti",
268
- /** 長期連載停止中 */
269
- isstop: "i",
270
- /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */
271
- isbl: "ibl",
272
- /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */
273
- isgl: "igl",
274
- /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */
275
- iszankoku: "izk",
276
- /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */
277
- istensei: "its",
278
- /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */
279
- istenni: "iti",
280
- /** 総合評価ポイント */
281
- global_point: "gp",
282
- /** 日間ポイント */
283
- daily_point: "dp",
284
- /** 週間ポイント */
285
- weekly_point: "wp",
286
- /** 月間ポイント */
287
- monthly_point: "mp",
288
- /** 四半期ポイント */
289
- quarter_point: "qp",
290
- /** 年間ポイント */
291
- yearly_point: "yp",
292
- /** R18ブックマーク数 */
293
- fav_novel_cnt: "f",
294
- /** 感想数 */
295
- impression_cnt: "imp",
296
- /** レビュー数 */
297
- review_cnt: "r",
298
- /** 評価ポイント */
299
- all_point: "a",
300
- /** 評価者数 */
301
- all_hyoka_cnt: "ah",
302
- /** 挿絵の数 */
303
- sasie_cnt: "sa",
304
- /** 会話率 */
305
- kaiwaritu: "ka",
306
- /** 小説の更新日時 */
307
- novelupdated_at: "nu",
308
- /**
309
- * 最終更新日時
310
- * システム用で小説更新時とは関係ありません
311
- */
312
- updated_at: "ua"
313
- };
314
- var OptionalFields = {
315
- /**
316
- * 週間ユニークユーザ[項目名:weekly_unique]が追加されます。
317
- * 週間ユニークユーザは前週の日曜日から土曜日分のユニークの合計です。
318
- * 毎週火曜日早朝に更新されます。
319
- */
320
- weekly_unique: "weekly"
321
- };
322
- var UserFields = {
323
- /** ユーザID */
324
- userid: "u",
325
- /** ユーザ名 */
326
- name: "n",
327
- /** ユーザ名のフリガナ */
328
- yomikata: "y",
329
- /** ユーザ名のフリガナの頭文字 */
330
- name1st: "1",
331
- /** 小説投稿数 */
332
- novel_cnt: "nc",
333
- /** レビュー投稿数 */
334
- review_cnt: "rc",
335
- /** 小説累計文字数 */
336
- novel_length: "nl",
337
- /** 総合評価ポイントの合計 */
338
- sum_global_point: "sg"
339
- };
340
- var Order = {
341
- /** ブックマーク数の多い順 */
342
- FavoriteNovelCount: "favnovelcnt",
343
- /** レビュー数の多い順 */
344
- ReviewCount: "favnovelcnt",
345
- /** 総合ポイントの高い順 */
346
- HyokaDesc: "hyoka",
347
- /** 総合ポイントの低い順 */
348
- HyokaAsc: "hyokaasc",
349
- /** 感想の多い順 */
350
- ImpressionCount: "impressioncnt",
351
- /** 評価者数の多い順 */
352
- HyokaCountDesc: "hyokacnt",
353
- /** 評価者数の少ない順 */
354
- HyokaCountAsc: "hyokacntasc",
355
- /** 週間ユニークユーザの多い順 */
356
- Weekly: "weekly",
357
- /** 小説本文の文字数が多い順 */
358
- LengthDesc: "lengthdesc",
359
- /** 小説本文の文字数が少ない順 */
360
- LengthAsc: "lengthasc",
361
- /** Nコードが新しい順 */
362
- NCodeDesc: "ncodedesc",
363
- /** 新着更新順 */
364
- New: "new",
365
- /** 古い順 */
366
- Old: "old",
367
- /** 日間ポイントの高い順 */
368
- DailyPoint: "dailypoint",
369
- /** 週間ポイントの高い順 */
370
- WeeklyPoint: "weeklypoint",
371
- /** 月間ポイントの高い順 */
372
- MonthlyPoint: "monthlypoint",
373
- /** 四半期ポイントの高い順 */
374
- QuarterPoint: "quarterpoint",
375
- /** 年間ポイントの高い順 */
376
- YearlyPoint: "yearlypoint",
377
- /** 初回掲載順 */
378
- GeneralFirstUp: "generalfirstup"
379
- };
380
- var R18Site = {
381
- /** ノクターンノベルズ(男性向け) */
382
- Nocturne: 1,
383
- /** ムーンライトノベルズ(女性向け) */
384
- MoonLight: 2,
385
- /** ムーンライトノベルズ(BL) */
386
- MoonLightBL: 3,
387
- /** ミッドナイトノベルズ(大人向け) */
388
- Midnight: 4
389
- };
390
- var R18SiteNotation = {
391
- [R18Site.Nocturne]: "\u30CE\u30AF\u30BF\u30FC\u30F3\u30CE\u30D9\u30EB\u30BA(\u7537\u6027\u5411\u3051)",
392
- [R18Site.MoonLight]: "\u30E0\u30FC\u30F3\u30E9\u30A4\u30C8\u30CE\u30D9\u30EB\u30BA(\u5973\u6027\u5411\u3051)",
393
- [R18Site.MoonLightBL]: "\u30E0\u30FC\u30F3\u30E9\u30A4\u30C8\u30CE\u30D9\u30EB\u30BA(BL)",
394
- [R18Site.Midnight]: "\u30DF\u30C3\u30C9\u30CA\u30A4\u30C8\u30CE\u30D9\u30EB\u30BA(\u5927\u4EBA\u5411\u3051)"
395
- };
396
- var BigGenre = {
397
- /** 恋愛 */
398
- Renai: 1,
399
- /** ファンタジー */
400
- Fantasy: 2,
401
- /** 文芸 */
402
- Bungei: 3,
403
- /** SF */
404
- Sf: 4,
405
- /** その他 */
406
- Sonota: 99,
407
- /** ノンジャンル */
408
- NonGenre: 98
409
- };
410
- var BigGenreNotation = {
411
- [BigGenre.Renai]: "\u604B\u611B",
412
- [BigGenre.Fantasy]: "\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC",
413
- [BigGenre.Bungei]: "\u6587\u82B8",
414
- [BigGenre.Sf]: "SF",
415
- [BigGenre.Sonota]: "\u305D\u306E\u4ED6",
416
- [BigGenre.NonGenre]: "\u30CE\u30F3\u30B8\u30E3\u30F3\u30EB"
417
- };
418
- var Genre = {
419
- /** 異世界〔恋愛〕*/
420
- RenaiIsekai: 101,
421
- /** 現実世界〔恋愛〕*/
422
- RenaiGenjitsusekai: 102,
423
- /** ハイファンタジー〔ファンタジー〕*/
424
- FantasyHigh: 201,
425
- /** ローファンタジー〔ファンタジー〕*/
426
- FantasyLow: 202,
427
- /** 純文学〔文芸〕*/
428
- BungeiJyunbungei: 301,
429
- /** ヒューマンドラマ〔文芸〕*/
430
- BungeiHumanDrama: 302,
431
- /** 歴史〔文芸〕*/
432
- BungeiHistory: 303,
433
- /** 推理〔文芸〕*/
434
- BungeiSuiri: 304,
435
- /** ホラー〔文芸〕*/
436
- BungeiHorror: 305,
437
- /** アクション〔文芸〕*/
438
- BungeiAction: 306,
439
- /** コメディー〔文芸〕*/
440
- BungeiComedy: 307,
441
- /** VRゲーム〔SF〕*/
442
- SfVrgame: 401,
443
- /** 宇宙〔SF〕*/
444
- SfSpace: 402,
445
- /** 空想科学〔SF〕*/
446
- SfKuusoukagaku: 403,
447
- /** パニック〔SF〕*/
448
- SfPanic: 404,
449
- /** 童話〔その他〕*/
450
- SonotaDouwa: 9901,
451
- /** 詩〔その他〕*/
452
- SonotaShi: 9902,
453
- /** エッセイ〔その他〕*/
454
- SonotaEssei: 9903,
455
- /** リプレイ〔その他〕*/
456
- SonotaReplay: 9904,
457
- /** その他〔その他〕 */
458
- SonotaSonota: 9999,
459
- /** ノンジャンル〔ノンジャンル〕*/
460
- NonGenre: 9801
461
- };
462
- var GenreNotation = {
463
- [Genre.RenaiIsekai]: "\u7570\u4E16\u754C\u3014\u604B\u611B\u3015",
464
- [Genre.RenaiGenjitsusekai]: "\u73FE\u5B9F\u4E16\u754C\u3014\u604B\u611B\u3015",
465
- [Genre.FantasyHigh]: "\u30CF\u30A4\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3014\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3015",
466
- [Genre.FantasyLow]: "\u30ED\u30FC\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3014\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3015",
467
- [Genre.BungeiJyunbungei]: "\u7D14\u6587\u5B66\u3014\u6587\u82B8\u3015",
468
- [Genre.BungeiHumanDrama]: "\u30D2\u30E5\u30FC\u30DE\u30F3\u30C9\u30E9\u30DE\u3014\u6587\u82B8\u3015",
469
- [Genre.BungeiHistory]: "\u6B74\u53F2\u3014\u6587\u82B8\u3015",
470
- [Genre.BungeiSuiri]: "\u63A8\u7406\u3014\u6587\u82B8\u3015",
471
- [Genre.BungeiHorror]: "\u30DB\u30E9\u30FC\u3014\u6587\u82B8\u3015",
472
- [Genre.BungeiAction]: "\u30A2\u30AF\u30B7\u30E7\u30F3\u3014\u6587\u82B8\u3015",
473
- [Genre.BungeiComedy]: "\u30B3\u30E1\u30C7\u30A3\u30FC\u3014\u6587\u82B8\u3015",
474
- [Genre.SfVrgame]: "VR\u30B2\u30FC\u30E0\u3014SF\u3015",
475
- [Genre.SfSpace]: "\u5B87\u5B99\u3014SF\u3015",
476
- [Genre.SfKuusoukagaku]: "\u7A7A\u60F3\u79D1\u5B66\u3014SF\u3015",
477
- [Genre.SfPanic]: "\u30D1\u30CB\u30C3\u30AF\u3014SF\u3015",
478
- [Genre.SonotaDouwa]: "\u7AE5\u8A71\u3014\u305D\u306E\u4ED6\u3015",
479
- [Genre.SonotaShi]: "\u8A69\u3014\u305D\u306E\u4ED6\u3015",
480
- [Genre.SonotaEssei]: "\u30A8\u30C3\u30BB\u30A4\u3014\u305D\u306E\u4ED6\u3015",
481
- [Genre.SonotaReplay]: "\u30EA\u30D7\u30EC\u30A4\u3014\u305D\u306E\u4ED6\u3015",
482
- [Genre.SonotaSonota]: "\u305D\u306E\u4ED6\u3014\u305D\u306E\u4ED6\u3015",
483
- [Genre.NonGenre]: "\u30CE\u30F3\u30B8\u30E3\u30F3\u30EB\u3014\u30CE\u30F3\u30B8\u30E3\u30F3\u30EB\u3015"
484
- };
485
- var BuntaiParam = {
486
- /** 字下げされておらず、連続改行が多い作品 */
487
- NoJisageKaigyouOoi: 1,
488
- /** 字下げされていないが、改行数は平均な作品 */
489
- NoJisageKaigyoHutsuu: 2,
490
- /** 字下げが適切だが、連続改行が多い作品 */
491
- JisageKaigyoOoi: 4,
492
- /** 字下げが適切でかつ改行数も平均な作品 */
493
- JisageKaigyoHutsuu: 6
494
- };
495
- var StopParam = {
496
- /** 長期連載停止中を除きます */
497
- NoStopping: 1,
498
- /** 長期連載停止中のみ取得します */
499
- Stopping: 2
500
- };
501
- var NovelTypeParam = {
502
- /** 短編 */
503
- Short: "t",
504
- /** 連載中 */
505
- RensaiNow: "r",
506
- /** 完結済連載小説 */
507
- RensaiEnd: "er",
508
- /** すべての連載小説(連載中および完結済) */
509
- Rensai: "re",
510
- /** 短編と完結済連載小説 */
511
- ShortAndRensai: "ter"
512
- };
513
- var DateParam = {
514
- ThisWeek: "thisweek",
515
- LastWeek: "lastweek",
516
- SevenDays: "sevenday",
517
- ThisMonth: "thismonth",
518
- LastMonth: "lastmonth"
519
- };
520
- var UserOrder = {
521
- /** ユーザIDの新しい順 */
522
- New: "new",
523
- /** 小説投稿数の多い順 */
524
- NovelCount: "novelcnt",
525
- /** レビュー投稿数の多い順 */
526
- ReviewCount: "reviewcnt",
527
- /** 小説累計文字数の多い順 */
528
- NovelLength: "novellength",
529
- /** 総合評価ポイントの合計の多い順 */
530
- SumGlobalPoint: "sumglobalpoint",
531
- /** ユーザIDの古い順 */
532
- Old: "old"
533
- };
534
-
535
- // src/search-builder.ts
536
- var SearchBuilderBase = class {
537
- /**
538
- * constructor
539
- * @private
540
- */
541
- constructor(params = {}, api) {
542
- this.params = params;
543
- this.api = api;
544
- }
545
- static distinct(array) {
546
- return Array.from(new Set(array));
547
- }
548
- static array2string(n) {
549
- if (Array.isArray(n)) {
550
- return this.distinct(n).join("-");
551
- } else {
552
- return n.toString();
553
- }
554
- }
555
- /**
556
- *
557
- * @return {SearchBuilder} this
558
- */
559
- limit(num) {
560
- this.set({ lim: num });
561
- return this;
562
- }
563
- /**
564
- *
565
- * @return {SearchBuilder} this
566
- */
567
- start(num) {
568
- this.set({ st: num });
569
- return this;
570
- }
571
- /**
572
- *
573
- * @return {SearchBuilder} this
574
- */
575
- page(no, count = 20) {
576
- return this.limit(count).start(no * count);
577
- }
578
- /**
579
- * 出力順序を指定する。指定しない場合は新着順となります。
580
- * old 古い順
581
- * @param {TOrder} order 出力順序
582
- * @return {SearchBuilder} this
583
- */
584
- order(order) {
585
- this.set({ order });
586
- return this;
587
- }
588
- /**
589
- * gzip圧縮する。
590
- *
591
- * 転送量上限を減らすためにも推奨
592
- * @param {GzipLevel} level gzip圧縮レベル(1~5)
593
- * @return {SearchBuilder} this
594
- */
595
- gzip(level) {
596
- this.set({ gzip: level });
597
- return this;
598
- }
599
- /**
600
- * クエリパラメータをセットする
601
- * @private
602
- * @return {SearchBuilder} this
603
- */
604
- set(obj) {
605
- this.params = { ...this.params, ...obj };
606
- return this;
607
- }
608
- /**
609
- * クエリパラメータを削除する
610
- */
611
- unset(key) {
612
- delete this.params[key];
613
- return this;
614
- }
615
- };
616
- var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilderBase {
617
- /**
618
- * a
619
- * @return {SearchBuilder} this
620
- */
621
- word(word) {
622
- this.set({ word });
623
- return this;
624
- }
625
- /**
626
- *
627
- * @return {SearchBuilder} this
628
- */
629
- notWord(word) {
630
- this.set({ notword: word });
631
- return this;
632
- }
633
- /**
634
- *
635
- * @return {SearchBuilder} this
636
- */
637
- byTitle(bool = true) {
638
- this.set({ title: bool ? BooleanNumber.True : BooleanNumber.False });
639
- return this;
640
- }
641
- /**
642
- *
643
- * @return {SearchBuilder} this
644
- */
645
- byOutline(bool = true) {
646
- this.set({ ex: bool ? BooleanNumber.True : BooleanNumber.False });
647
- return this;
648
- }
649
- /**
650
- *
651
- * @return {SearchBuilder} this
652
- */
653
- byKeyword(bool = true) {
654
- this.set({ keyword: bool ? BooleanNumber.True : BooleanNumber.False });
655
- return this;
656
- }
657
- /**
658
- *
659
- * @return {SearchBuilder} this
660
- */
661
- byAuthor(bool = true) {
662
- this.set({ wname: bool ? BooleanNumber.True : BooleanNumber.False });
663
- return this;
664
- }
665
- /**
666
- *
667
- * @return {SearchBuilder} this
668
- */
669
- isBL(bool = true) {
670
- if (bool) {
671
- this.set({ isbl: BooleanNumber.True });
672
- } else {
673
- this.set({ notbl: BooleanNumber.True });
674
- }
675
- return this;
676
- }
677
- /**
678
- *
679
- * @return {SearchBuilder} this
680
- */
681
- isGL(bool = true) {
682
- if (bool) {
683
- this.set({ isgl: BooleanNumber.True });
684
- } else {
685
- this.set({ notgl: BooleanNumber.True });
686
- }
687
- return this;
688
- }
689
- /**
690
- *
691
- * @return {SearchBuilder} this
692
- */
693
- isZankoku(bool = true) {
694
- if (bool) {
695
- this.set({ iszankoku: BooleanNumber.True });
696
- } else {
697
- this.set({ notzankoku: BooleanNumber.True });
698
- }
699
- return this;
700
- }
701
- /**
702
- *
703
- * @return {SearchBuilder} this
704
- */
705
- isTensei(bool = true) {
706
- if (bool) {
707
- this.set({ istensei: BooleanNumber.True });
708
- } else {
709
- this.set({ nottensei: BooleanNumber.True });
710
- }
711
- return this;
712
- }
713
- /**
714
- *
715
- * @return {SearchBuilder} this
716
- */
717
- isTenni(bool = true) {
718
- if (bool) {
719
- this.set({ istenni: BooleanNumber.True });
720
- } else {
721
- this.set({ nottenni: BooleanNumber.True });
722
- }
723
- return this;
724
- }
725
- /**
726
- *
727
- * @return {SearchBuilder} this
728
- */
729
- isTT() {
730
- this.set({ istt: BooleanNumber.True });
731
- return this;
732
- }
733
- /**
734
- *
735
- * @return {SearchBuilder} this
736
- */
737
- length(length) {
738
- this.set({ length: _NovelSearchBuilderBase.array2string(length) });
739
- return this;
740
- }
741
- kaiwaritu(min, max) {
742
- let n;
743
- if (max != null) {
744
- n = `${min}-${max}`;
745
- } else {
746
- n = min;
747
- }
748
- this.set({ kaiwaritu: n });
749
- return this;
750
- }
751
- /**
752
- *
753
- * @return {SearchBuilder} this
754
- */
755
- sasie(num) {
756
- this.set({ sasie: _NovelSearchBuilderBase.array2string(num) });
757
- return this;
758
- }
759
- /**
760
- *
761
- * @return {SearchBuilder} this
762
- */
763
- time(num) {
764
- this.set({ time: _NovelSearchBuilderBase.array2string(num) });
765
- return this;
766
- }
767
- /**
768
- *
769
- * @return {SearchBuilder} this
770
- */
771
- ncode(ncodes) {
772
- this.set({ ncode: _NovelSearchBuilderBase.array2string(ncodes) });
773
- return this;
774
- }
775
- /**
776
- *
777
- * @return {SearchBuilder} this
778
- */
779
- type(type) {
780
- this.set({ type });
781
- return this;
782
- }
783
- /**
784
- *
785
- * @return {SearchBuilder} this
786
- */
787
- buntai(buntai) {
788
- this.set({ buntai: _NovelSearchBuilderBase.array2string(buntai) });
789
- return this;
790
- }
791
- /**
792
- *
793
- * @return {SearchBuilder} this
794
- */
795
- isStop(bool = true) {
796
- this.set({ stop: bool ? StopParam.Stopping : StopParam.NoStopping });
797
- return this;
798
- }
799
- /**
800
- *
801
- * @return {SearchBuilder} this
802
- */
803
- isPickup(bool = true) {
804
- this.set({ ispickup: bool ? BooleanNumber.True : BooleanNumber.False });
805
- return this;
806
- }
807
- lastUpdate(x, y) {
808
- let date;
809
- if (typeof x == "string") {
810
- date = x;
811
- } else if (x instanceof Date && y instanceof Date) {
812
- date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
813
- y.getTime() / 1e3
814
- )}`;
815
- } else {
816
- date = `${x}-${y}`;
817
- }
818
- this.set({ lastup: date });
819
- return this;
820
- }
821
- lastNovelUpdate(x, y) {
822
- let date;
823
- if (typeof x == "string") {
824
- date = x;
825
- } else if (x instanceof Date && y instanceof Date) {
826
- date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
827
- y.getTime() / 1e3
828
- )}`;
829
- } else {
830
- date = `${x}-${y}`;
831
- }
832
- this.set({ lastupdate: date });
833
- return this;
834
- }
835
- /**
836
- * なろう小説APIへの検索リクエストを実行する
837
- * @returns {Promise<NarouSearchResults>} 検索結果
838
- */
839
- execute() {
840
- return this.api.executeNovel(this.params);
841
- }
842
- };
843
- var SearchBuilder = class _SearchBuilder extends NovelSearchBuilderBase {
844
- /**
845
- *
846
- * @return {SearchBuilder} this
847
- */
848
- bigGenre(genre) {
849
- this.set({ biggenre: _SearchBuilder.array2string(genre) });
850
- return this;
851
- }
852
- /**
853
- *
854
- * @return {SearchBuilder} this
855
- */
856
- notBigGenre(genre) {
857
- this.set({ notbiggenre: _SearchBuilder.array2string(genre) });
858
- return this;
859
- }
860
- /**
861
- *
862
- * @return {SearchBuilder} this
863
- */
864
- genre(genre) {
865
- this.set({ genre: _SearchBuilder.array2string(genre) });
866
- return this;
867
- }
868
- /**
869
- *
870
- * @return {SearchBuilder} this
871
- */
872
- notGenre(genre) {
873
- this.set({ notgenre: _SearchBuilder.array2string(genre) });
874
- return this;
875
- }
876
- /**
877
- *
878
- * @return {SearchBuilder} this
879
- */
880
- userId(ids) {
881
- this.set({ userid: _SearchBuilder.array2string(ids) });
882
- return this;
883
- }
884
- /**
885
- *
886
- * @return {SearchBuilder} this
887
- */
888
- isR15(bool = true) {
889
- if (bool) {
890
- this.set({ isr15: 1 });
891
- } else {
892
- this.set({ notr15: 1 });
893
- }
894
- return this;
895
- }
896
- /**
897
- *
898
- * @return {SearchBuilder} this
899
- */
900
- fields(fields) {
901
- this.set({ of: _SearchBuilder.array2string(fields) });
902
- return this;
903
- }
904
- opt(option) {
905
- this.set({ opt: _SearchBuilder.array2string(option) });
906
- return this;
907
- }
908
- };
909
-
910
- // src/search-builder-r18.ts
911
- var SearchBuilderR18 = class extends NovelSearchBuilderBase {
912
- /**
913
- * なろう小説APIへの検索リクエストを実行する
914
- * @override
915
- * @returns {Promise<NarouSearchResults>} 検索結果
916
- */
917
- execute() {
918
- return this.api.executeNovel18(this.params);
919
- }
920
- r18Site(sites) {
921
- this.set({ nocgenre: NovelSearchBuilderBase.array2string(sites) });
922
- return this;
923
- }
924
- /**
925
- *
926
- * @return {SearchBuilder} this
927
- */
928
- xid(ids) {
929
- this.set({ xid: NovelSearchBuilderBase.array2string(ids) });
930
- return this;
931
- }
932
- /**
933
- *
934
- * @return {SearchBuilder} this
935
- */
936
- fields(fields) {
937
- this.set({ of: NovelSearchBuilderBase.array2string(fields) });
938
- return this;
939
- }
940
- opt(option) {
941
- this.set({ opt: NovelSearchBuilderBase.array2string(option) });
942
- return this;
943
- }
944
- };
945
-
946
- // src/ranking.ts
947
- var import_date_fns = require("date-fns");
948
- var dateFormat = "yyyyMMdd";
949
- var RankingBuilder = class {
950
- /**
951
- * constructor
952
- * @private
953
- */
954
- constructor(params = {}, api) {
955
- this.params = params;
956
- this.api = api;
957
- this.date$ = (0, import_date_fns.addDays)(Date.now(), -1);
958
- this.type$ = RankingType.Daily;
959
- }
960
- date(date) {
961
- this.date$ = date;
962
- return this;
963
- }
964
- type(type) {
965
- this.type$ = type;
966
- return this;
967
- }
968
- /**
969
- * gzip圧縮する。
970
- *
971
- * 転送量上限を減らすためにも推奨
972
- * @param {GzipLevel} level gzip圧縮レベル(1~5)
973
- * @return {RankingBuilder} this
974
- */
975
- gzip(level) {
976
- this.set({ gzip: level });
977
- return this;
978
- }
979
- /**
980
- * クエリパラメータをセットする
981
- * @private
982
- * @return {RankingBuilder} this
983
- */
984
- set(obj) {
985
- Object.assign(this.params, obj);
986
- return this;
987
- }
988
- /**
989
- * なろう小説APIへのリクエストを実行する
990
- * @returns ランキング
991
- */
992
- execute() {
993
- const date = (0, import_date_fns.format)(this.date$, dateFormat);
994
- this.set({ rtype: `${date}-${this.type$}` });
995
- return this.api.executeRanking(this.params);
996
- }
997
- async executeWithFields(fields = [], opt) {
998
- const ranking = await this.execute();
999
- const fields$ = Array.isArray(fields) ? fields.length == 0 ? [] : [...fields, Fields.ncode] : [fields, Fields.ncode];
1000
- const rankingNcodes = ranking.map(({ ncode }) => ncode);
1001
- const builder = new SearchBuilder({}, this.api);
1002
- builder.fields(fields$);
1003
- if (opt) {
1004
- builder.opt(opt);
1005
- }
1006
- builder.ncode(rankingNcodes);
1007
- builder.limit(ranking.length);
1008
- const result = await builder.execute();
1009
- return ranking.map((r) => ({
1010
- ...r,
1011
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1012
- ...result.values.find((novel) => novel.ncode == r.ncode)
1013
- }));
1014
- }
1015
- };
1016
-
1017
- // src/ranking-history.ts
1018
- var import_date_fns2 = require("date-fns");
1019
- var dateFormat2 = "yyyyMMdd";
1020
- function formatRankingHistory(rankin) {
1021
- const { rtype, pt, rank } = rankin;
1022
- const [_date, _type] = rtype.split("-");
1023
- const date = (0, import_date_fns2.parse)(_date, dateFormat2, /* @__PURE__ */ new Date());
1024
- const type = _type;
1025
- return { type, date, pt, rank };
1026
- }
1027
- // Annotate the CommonJS export names for ESM import in node:
1028
- 0 && (module.exports = {
1029
- BigGenre,
1030
- BigGenreNotation,
1031
- BooleanNumber,
1032
- BuntaiParam,
1033
- DateParam,
1034
- End,
1035
- Fields,
1036
- Genre,
1037
- GenreNotation,
1038
- NarouNovel,
1039
- NarouSearchResults,
1040
- NovelSearchBuilderBase,
1041
- NovelType,
1042
- NovelTypeParam,
1043
- OptionalFields,
1044
- Order,
1045
- R18Fields,
1046
- R18Site,
1047
- R18SiteNotation,
1048
- RankingBuilder,
1049
- RankingType,
1050
- SearchBuilder,
1051
- SearchBuilderBase,
1052
- SearchBuilderR18,
1053
- StopParam,
1054
- UserFields,
1055
- UserOrder,
1056
- formatRankingHistory
1057
- });
1058
- //# sourceMappingURL=index.common.cjs.map