narou 1.2.0 → 2.0.1

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 (166) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -37
  3. package/dist/index.browser.cjs +90 -1360
  4. package/dist/index.browser.cjs.map +1 -1
  5. package/dist/index.browser.d.cts +14 -20
  6. package/dist/index.browser.d.mts +49 -0
  7. package/dist/index.browser.mjs +68 -0
  8. package/dist/index.browser.mjs.map +1 -0
  9. package/dist/index.cjs +147 -1410
  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 +28 -21
  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 +28 -37
  22. package/pnpm-lock.yaml +1325 -1100
  23. package/src/index.browser.ts +5 -1
  24. package/src/index.ts +5 -1
  25. package/src/narou-fetch.ts +4 -3
  26. package/src/narou-jsonp.ts +4 -2
  27. package/src/narou.ts +50 -13
  28. package/src/params.ts +1 -1
  29. package/src/ranking.ts +20 -11
  30. package/src/search-builder-r18.ts +6 -2
  31. package/src/search-builder.ts +7 -3
  32. package/src/user-search.ts +9 -2
  33. package/dist/chunk-3A5MHPWL.js +0 -37
  34. package/dist/chunk-3A5MHPWL.js.map +0 -1
  35. package/dist/chunk-4ZP5YNWI.js +0 -1
  36. package/dist/chunk-4ZP5YNWI.js.map +0 -1
  37. package/dist/chunk-5UDKQCPJ.js +0 -407
  38. package/dist/chunk-5UDKQCPJ.js.map +0 -1
  39. package/dist/chunk-6BZWV4ZC.js +0 -75
  40. package/dist/chunk-6BZWV4ZC.js.map +0 -1
  41. package/dist/chunk-BQLSW236.js +0 -117
  42. package/dist/chunk-BQLSW236.js.map +0 -1
  43. package/dist/chunk-DEQICAN3.js +0 -94
  44. package/dist/chunk-DEQICAN3.js.map +0 -1
  45. package/dist/chunk-E2H3AJSQ.js +0 -57
  46. package/dist/chunk-E2H3AJSQ.js.map +0 -1
  47. package/dist/chunk-HOBLKBZ6.js +0 -452
  48. package/dist/chunk-HOBLKBZ6.js.map +0 -1
  49. package/dist/chunk-IPDEGCWU.js +0 -39
  50. package/dist/chunk-IPDEGCWU.js.map +0 -1
  51. package/dist/chunk-LQLNWSWV.js +0 -26
  52. package/dist/chunk-LQLNWSWV.js.map +0 -1
  53. package/dist/chunk-PLEM2AOH.js +0 -44
  54. package/dist/chunk-PLEM2AOH.js.map +0 -1
  55. package/dist/chunk-RNHRR56W.js +0 -25
  56. package/dist/chunk-RNHRR56W.js.map +0 -1
  57. package/dist/chunk-VUZIISP2.js +0 -23
  58. package/dist/chunk-VUZIISP2.js.map +0 -1
  59. package/dist/chunk-VZVUANDN.js +0 -17
  60. package/dist/chunk-VZVUANDN.js.map +0 -1
  61. package/dist/index.browser.d.ts +0 -55
  62. package/dist/index.browser.js +0 -126
  63. package/dist/index.browser.js.map +0 -1
  64. package/dist/index.common.cjs +0 -1187
  65. package/dist/index.common.cjs.map +0 -1
  66. package/dist/index.common.d.cts +0 -6
  67. package/dist/index.common.d.ts +0 -6
  68. package/dist/index.common.js +0 -76
  69. package/dist/index.common.js.map +0 -1
  70. package/dist/index.d.ts +0 -56
  71. package/dist/index.js +0 -131
  72. package/dist/index.js.map +0 -1
  73. package/dist/narou-DBa12V_l.d.ts +0 -404
  74. package/dist/narou-DCp4aGfA.d.cts +0 -404
  75. package/dist/narou-fetch.cjs +0 -164
  76. package/dist/narou-fetch.cjs.map +0 -1
  77. package/dist/narou-fetch.d.cts +0 -20
  78. package/dist/narou-fetch.d.ts +0 -20
  79. package/dist/narou-fetch.js +0 -10
  80. package/dist/narou-fetch.js.map +0 -1
  81. package/dist/narou-jsonp.cjs +0 -162
  82. package/dist/narou-jsonp.cjs.map +0 -1
  83. package/dist/narou-jsonp.d.cts +0 -13
  84. package/dist/narou-jsonp.d.ts +0 -13
  85. package/dist/narou-jsonp.js +0 -10
  86. package/dist/narou-jsonp.js.map +0 -1
  87. package/dist/narou-ranking-results.cjs +0 -19
  88. package/dist/narou-ranking-results.cjs.map +0 -1
  89. package/dist/narou-ranking-results.d.cts +0 -4
  90. package/dist/narou-ranking-results.d.ts +0 -4
  91. package/dist/narou-ranking-results.js +0 -1
  92. package/dist/narou-ranking-results.js.map +0 -1
  93. package/dist/narou-search-results-C21hWrnL.d.cts +0 -727
  94. package/dist/narou-search-results-DT0YdaBn.d.ts +0 -727
  95. package/dist/narou-search-results.cjs +0 -62
  96. package/dist/narou-search-results.cjs.map +0 -1
  97. package/dist/narou-search-results.d.cts +0 -2
  98. package/dist/narou-search-results.d.ts +0 -2
  99. package/dist/narou-search-results.js +0 -11
  100. package/dist/narou-search-results.js.map +0 -1
  101. package/dist/narou.cjs +0 -112
  102. package/dist/narou.cjs.map +0 -1
  103. package/dist/narou.d.cts +0 -4
  104. package/dist/narou.d.ts +0 -4
  105. package/dist/narou.js +0 -8
  106. package/dist/narou.js.map +0 -1
  107. package/dist/params.cjs +0 -448
  108. package/dist/params.cjs.map +0 -1
  109. package/dist/params.d.cts +0 -2
  110. package/dist/params.d.ts +0 -2
  111. package/dist/params.js +0 -41
  112. package/dist/params.js.map +0 -1
  113. package/dist/ranking-history.cjs +0 -47
  114. package/dist/ranking-history.cjs.map +0 -1
  115. package/dist/ranking-history.d.cts +0 -28
  116. package/dist/ranking-history.d.ts +0 -28
  117. package/dist/ranking-history.js +0 -8
  118. package/dist/ranking-history.js.map +0 -1
  119. package/dist/ranking.cjs +0 -783
  120. package/dist/ranking.cjs.map +0 -1
  121. package/dist/ranking.d.cts +0 -108
  122. package/dist/ranking.d.ts +0 -108
  123. package/dist/ranking.js +0 -10
  124. package/dist/ranking.js.map +0 -1
  125. package/dist/search-builder-r18.cjs +0 -547
  126. package/dist/search-builder-r18.cjs.map +0 -1
  127. package/dist/search-builder-r18.d.cts +0 -45
  128. package/dist/search-builder-r18.d.ts +0 -45
  129. package/dist/search-builder-r18.js +0 -9
  130. package/dist/search-builder-r18.js.map +0 -1
  131. package/dist/search-builder.cjs +0 -591
  132. package/dist/search-builder.cjs.map +0 -1
  133. package/dist/search-builder.d.cts +0 -4
  134. package/dist/search-builder.d.ts +0 -4
  135. package/dist/search-builder.js +0 -12
  136. package/dist/search-builder.js.map +0 -1
  137. package/dist/user-search.cjs +0 -325
  138. package/dist/user-search.cjs.map +0 -1
  139. package/dist/user-search.d.cts +0 -66
  140. package/dist/user-search.d.ts +0 -66
  141. package/dist/user-search.js +0 -9
  142. package/dist/user-search.js.map +0 -1
  143. package/dist/util/date.cjs +0 -51
  144. package/dist/util/date.cjs.map +0 -1
  145. package/dist/util/date.d.cts +0 -21
  146. package/dist/util/date.d.ts +0 -21
  147. package/dist/util/date.js +0 -11
  148. package/dist/util/date.js.map +0 -1
  149. package/dist/util/jsonp.cjs +0 -63
  150. package/dist/util/jsonp.cjs.map +0 -1
  151. package/dist/util/jsonp.d.cts +0 -49
  152. package/dist/util/jsonp.d.ts +0 -49
  153. package/dist/util/jsonp.js +0 -7
  154. package/dist/util/jsonp.js.map +0 -1
  155. package/dist/util/type.cjs +0 -19
  156. package/dist/util/type.cjs.map +0 -1
  157. package/dist/util/type.d.cts +0 -27
  158. package/dist/util/type.d.ts +0 -27
  159. package/dist/util/type.js +0 -1
  160. package/dist/util/type.js.map +0 -1
  161. package/dist/util/unzipp.cjs +0 -47
  162. package/dist/util/unzipp.cjs.map +0 -1
  163. package/dist/util/unzipp.d.cts +0 -12
  164. package/dist/util/unzipp.d.ts +0 -12
  165. package/dist/util/unzipp.js +0 -7
  166. package/dist/util/unzipp.js.map +0 -1
@@ -0,0 +1,1346 @@
1
+
2
+ //#region src/narou-search-results.ts
3
+ /**
4
+ * なろう小説API検索結果
5
+ */
6
+ var NarouSearchResults = class {
7
+ /**
8
+ * @constractor
9
+ * @private
10
+ */
11
+ constructor([header, ...result], params) {
12
+ const count$1 = header.allcount;
13
+ const limit = params.lim ?? 20;
14
+ const start = params.st ?? 0;
15
+ this.allcount = count$1;
16
+ this.limit = limit;
17
+ this.start = start;
18
+ this.page = start / limit;
19
+ this.length = result.length;
20
+ this.values = result;
21
+ }
22
+ };
23
+ /**
24
+ * noveltype/novel_typeの値ヘルパー
25
+ */
26
+ const NovelType = {
27
+ Rensai: 1,
28
+ Tanpen: 2
29
+ };
30
+ /**
31
+ * endの値ヘルパー
32
+ */
33
+ const End = {
34
+ KanketsuOrTanpen: 0,
35
+ Rensai: 1
36
+ };
37
+
38
+ //#endregion
39
+ //#region src/narou.ts
40
+ /**
41
+ * なろう小説APIへのリクエストを実行する
42
+ * @class NarouNovel
43
+ * @private
44
+ */
45
+ var NarouNovel = class {
46
+ /**
47
+ * APIへの検索リクエストを実行する
48
+ * @param params クエリパラメータ
49
+ * @param endpoint APIエンドポイント
50
+ * @returns 検索結果
51
+ */
52
+ async executeSearch(params, endpoint = "https://api.syosetu.com/novelapi/api/", options) {
53
+ return new NarouSearchResults(await this.execute(params, endpoint, options), params);
54
+ }
55
+ /**
56
+ * 小説APIへの検索リクエストを実行する
57
+ * @param params クエリパラメータ
58
+ * @returns 検索結果
59
+ * @see https://dev.syosetu.com/man/api/
60
+ */
61
+ async executeNovel(params, options) {
62
+ return await this.executeSearch(params, "https://api.syosetu.com/novelapi/api/", options);
63
+ }
64
+ /**
65
+ * R18小説APIへの検索リクエストを実行する
66
+ * @param params クエリパラメータ
67
+ * @returns 検索結果
68
+ * @see https://dev.syosetu.com/xman/api/
69
+ */
70
+ async executeNovel18(params, options) {
71
+ return await this.executeSearch(params, "https://api.syosetu.com/novel18api/api/", options);
72
+ }
73
+ /**
74
+ * ランキングAPIへのリクエストを実行する
75
+ * @param params クエリパラメータ
76
+ * @returns ランキング結果
77
+ * @see https://dev.syosetu.com/man/rankapi/
78
+ */
79
+ async executeRanking(params, options) {
80
+ return await this.execute(params, "https://api.syosetu.com/rank/rankget/", options);
81
+ }
82
+ /**
83
+ * 殿堂入りAPiへのリクエストを実行する
84
+ * @param params クエリパラメータ
85
+ * @param options 実行オプション
86
+ * @returns ランキング履歴結果
87
+ * @see https://dev.syosetu.com/man/rankinapi/
88
+ */
89
+ async executeRankingHistory(params, options) {
90
+ return await this.execute(params, "https://api.syosetu.com/rank/rankin/", options);
91
+ }
92
+ /**
93
+ * ユーザー検索APIへのリクエストを実行する
94
+ * @param params クエリパラメータ
95
+ * @returns 検索結果
96
+ * @see https://dev.syosetu.com/man/userapi/
97
+ */
98
+ async executeUserSearch(params, options) {
99
+ return new NarouSearchResults(await this.execute(params, "https://api.syosetu.com/userapi/api/", options), params);
100
+ }
101
+ };
102
+
103
+ //#endregion
104
+ //#region src/util/jsonp.ts
105
+ /**
106
+ * MIT license
107
+ */
108
+ let count = 0;
109
+ const noop = function() {};
110
+ /**
111
+ * JSONPリクエストを実行してデータを取得します。
112
+ *
113
+ * @param url - リクエスト先のURL
114
+ * @param options - JSONP呼び出しのオプション設定
115
+ * @returns JSONPリクエストの結果をPromiseで返します
116
+ * @throws {Error} タイムアウトが発生した場合、"Timeout"メッセージのエラーをスローします
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * // 基本的な使用方法
121
+ * const data = await jsonp<ResponseType>('https://example.com/api');
122
+ *
123
+ * // オプション指定
124
+ * const data = await jsonp<ResponseType>('https://example.com/api', {
125
+ * prefix: 'customPrefix',
126
+ * param: 'callbackParam',
127
+ * timeout: 10000
128
+ * });
129
+ * ```
130
+ */
131
+ function jsonp(url, { prefix = "__jp", param = "callback", timeout = 15e3 } = {}) {
132
+ return new Promise(function(resolve, reject) {
133
+ const targetChild = document.getElementsByTagName("script").item(0);
134
+ const target = targetChild?.parentNode ?? document.head;
135
+ const id = `${prefix}${count++}`;
136
+ const cleanup = function() {
137
+ if (script && script.parentNode) script.parentNode.removeChild(script);
138
+ window[id] = noop;
139
+ if (timer) clearTimeout(timer);
140
+ };
141
+ const timer = timeout > 0 ? setTimeout(() => {
142
+ cleanup();
143
+ reject(/* @__PURE__ */ new Error("Timeout"));
144
+ }, timeout) : void 0;
145
+ const callback = (data) => {
146
+ cleanup();
147
+ resolve(data);
148
+ };
149
+ window[id] = callback;
150
+ const script = document.createElement("script");
151
+ const urlObj = new URL(url);
152
+ urlObj.searchParams.set(param, id);
153
+ script.setAttribute("src", urlObj.toString());
154
+ target.insertBefore(script, targetChild);
155
+ });
156
+ }
157
+
158
+ //#endregion
159
+ //#region src/narou-jsonp.ts
160
+ /**
161
+ * なろう小説APIへのリクエストを実行する
162
+ */
163
+ var NarouNovelJsonp = class extends NarouNovel {
164
+ async execute(params, endpoint, _options) {
165
+ const query = {
166
+ ...params,
167
+ out: "jsonp"
168
+ };
169
+ query.gzip = 0;
170
+ const url = new URL(endpoint);
171
+ Object.entries(query).forEach(([key, value]) => {
172
+ if (value !== void 0) url.searchParams.append(key, value.toString());
173
+ });
174
+ return await jsonp(url.toString());
175
+ }
176
+ };
177
+
178
+ //#endregion
179
+ //#region src/params.ts
180
+ const RankingType = {
181
+ Daily: "d",
182
+ Weekly: "w",
183
+ Monthly: "m",
184
+ Quarterly: "q"
185
+ };
186
+ const BooleanNumber = {
187
+ True: 1,
188
+ False: 0
189
+ };
190
+ /**
191
+ * なろう小説APIのofパラメータに指定できる出力する項目
192
+ * @see https://dev.syosetu.com/man/api/#output
193
+ */
194
+ const Fields = {
195
+ title: "t",
196
+ ncode: "n",
197
+ userid: "u",
198
+ writer: "w",
199
+ story: "s",
200
+ biggenre: "bg",
201
+ genre: "g",
202
+ keyword: "k",
203
+ general_firstup: "gf",
204
+ general_lastup: "gl",
205
+ noveltype: "nt",
206
+ end: "e",
207
+ general_all_no: "ga",
208
+ length: "l",
209
+ time: "ti",
210
+ isstop: "i",
211
+ isr15: "isr",
212
+ isbl: "ibl",
213
+ isgl: "igl",
214
+ iszankoku: "izk",
215
+ istensei: "its",
216
+ istenni: "iti",
217
+ global_point: "gp",
218
+ daily_point: "dp",
219
+ weekly_point: "wp",
220
+ monthly_point: "mp",
221
+ quarter_point: "qp",
222
+ yearly_point: "yp",
223
+ fav_novel_cnt: "f",
224
+ impression_cnt: "imp",
225
+ review_cnt: "r",
226
+ all_point: "a",
227
+ all_hyoka_cnt: "ah",
228
+ sasie_cnt: "sa",
229
+ kaiwaritu: "ka",
230
+ novelupdated_at: "nu",
231
+ updated_at: "ua"
232
+ };
233
+ /**
234
+ * なろうR18小説APIのofパラメータに指定できる出力する項目
235
+ * @see https://dev.syosetu.com/xman/api/#output
236
+ */
237
+ const R18Fields = {
238
+ title: "t",
239
+ ncode: "n",
240
+ userid: "u",
241
+ writer: "w",
242
+ story: "s",
243
+ nocgenre: "ng",
244
+ keyword: "k",
245
+ general_firstup: "gf",
246
+ general_lastup: "gl",
247
+ noveltype: "nt",
248
+ end: "e",
249
+ general_all_no: "ga",
250
+ length: "l",
251
+ time: "ti",
252
+ isstop: "i",
253
+ isbl: "ibl",
254
+ isgl: "igl",
255
+ iszankoku: "izk",
256
+ istensei: "its",
257
+ istenni: "iti",
258
+ global_point: "gp",
259
+ daily_point: "dp",
260
+ weekly_point: "wp",
261
+ monthly_point: "mp",
262
+ quarter_point: "qp",
263
+ yearly_point: "yp",
264
+ fav_novel_cnt: "f",
265
+ impression_cnt: "imp",
266
+ review_cnt: "r",
267
+ all_point: "a",
268
+ all_hyoka_cnt: "ah",
269
+ sasie_cnt: "sa",
270
+ kaiwaritu: "ka",
271
+ novelupdated_at: "nu",
272
+ updated_at: "ua"
273
+ };
274
+ /**
275
+ * オプション項目
276
+ */
277
+ const OptionalFields = { weekly_unique: "weekly" };
278
+ /**
279
+ * ユーザ検索APIのofパラメータに指定できる出力する項目
280
+ * @see https://dev.syosetu.com/man/userapi/#output
281
+ */
282
+ const UserFields = {
283
+ userid: "u",
284
+ name: "n",
285
+ yomikata: "y",
286
+ name1st: "1",
287
+ novel_cnt: "nc",
288
+ review_cnt: "rc",
289
+ novel_length: "nl",
290
+ sum_global_point: "sg"
291
+ };
292
+ /**
293
+ * 出力順序
294
+ */
295
+ const Order = {
296
+ FavoriteNovelCount: "favnovelcnt",
297
+ ReviewCount: "reviewcnt",
298
+ HyokaDesc: "hyoka",
299
+ HyokaAsc: "hyokaasc",
300
+ ImpressionCount: "impressioncnt",
301
+ HyokaCountDesc: "hyokacnt",
302
+ HyokaCountAsc: "hyokacntasc",
303
+ Weekly: "weekly",
304
+ LengthDesc: "lengthdesc",
305
+ LengthAsc: "lengthasc",
306
+ NCodeDesc: "ncodedesc",
307
+ New: "new",
308
+ Old: "old",
309
+ DailyPoint: "dailypoint",
310
+ WeeklyPoint: "weeklypoint",
311
+ MonthlyPoint: "monthlypoint",
312
+ QuarterPoint: "quarterpoint",
313
+ YearlyPoint: "yearlypoint",
314
+ GeneralFirstUp: "generalfirstup"
315
+ };
316
+ /** R18掲載サイト */
317
+ const R18Site = {
318
+ Nocturne: 1,
319
+ MoonLight: 2,
320
+ MoonLightBL: 3,
321
+ Midnight: 4
322
+ };
323
+ /** R18掲載サイト表記ヘルパー */
324
+ const R18SiteNotation = {
325
+ [R18Site.Nocturne]: "ノクターンノベルズ(男性向け)",
326
+ [R18Site.MoonLight]: "ムーンライトノベルズ(女性向け)",
327
+ [R18Site.MoonLightBL]: "ムーンライトノベルズ(BL)",
328
+ [R18Site.Midnight]: "ミッドナイトノベルズ(大人向け)"
329
+ };
330
+ /** 大ジャンル */
331
+ const BigGenre = {
332
+ Renai: 1,
333
+ Fantasy: 2,
334
+ Bungei: 3,
335
+ Sf: 4,
336
+ Sonota: 99,
337
+ NonGenre: 98
338
+ };
339
+ /** 大ジャンル表記ヘルパー */
340
+ const BigGenreNotation = {
341
+ [BigGenre.Renai]: "恋愛",
342
+ [BigGenre.Fantasy]: "ファンタジー",
343
+ [BigGenre.Bungei]: "文芸",
344
+ [BigGenre.Sf]: "SF",
345
+ [BigGenre.Sonota]: "その他",
346
+ [BigGenre.NonGenre]: "ノンジャンル"
347
+ };
348
+ /** ジャンル */
349
+ const Genre = {
350
+ RenaiIsekai: 101,
351
+ RenaiGenjitsusekai: 102,
352
+ FantasyHigh: 201,
353
+ FantasyLow: 202,
354
+ BungeiJyunbungei: 301,
355
+ BungeiHumanDrama: 302,
356
+ BungeiHistory: 303,
357
+ BungeiSuiri: 304,
358
+ BungeiHorror: 305,
359
+ BungeiAction: 306,
360
+ BungeiComedy: 307,
361
+ SfVrgame: 401,
362
+ SfSpace: 402,
363
+ SfKuusoukagaku: 403,
364
+ SfPanic: 404,
365
+ SonotaDouwa: 9901,
366
+ SonotaShi: 9902,
367
+ SonotaEssei: 9903,
368
+ SonotaReplay: 9904,
369
+ SonotaSonota: 9999,
370
+ NonGenre: 9801
371
+ };
372
+ /** ジャンル表記ヘルパー */
373
+ const GenreNotation = {
374
+ [Genre.RenaiIsekai]: "異世界〔恋愛〕",
375
+ [Genre.RenaiGenjitsusekai]: "現実世界〔恋愛〕",
376
+ [Genre.FantasyHigh]: "ハイファンタジー〔ファンタジー〕",
377
+ [Genre.FantasyLow]: "ローファンタジー〔ファンタジー〕",
378
+ [Genre.BungeiJyunbungei]: "純文学〔文芸〕",
379
+ [Genre.BungeiHumanDrama]: "ヒューマンドラマ〔文芸〕",
380
+ [Genre.BungeiHistory]: "歴史〔文芸〕",
381
+ [Genre.BungeiSuiri]: "推理〔文芸〕",
382
+ [Genre.BungeiHorror]: "ホラー〔文芸〕",
383
+ [Genre.BungeiAction]: "アクション〔文芸〕",
384
+ [Genre.BungeiComedy]: "コメディー〔文芸〕",
385
+ [Genre.SfVrgame]: "VRゲーム〔SF〕",
386
+ [Genre.SfSpace]: "宇宙〔SF〕",
387
+ [Genre.SfKuusoukagaku]: "空想科学〔SF〕",
388
+ [Genre.SfPanic]: "パニック〔SF〕",
389
+ [Genre.SonotaDouwa]: "童話〔その他〕",
390
+ [Genre.SonotaShi]: "詩〔その他〕",
391
+ [Genre.SonotaEssei]: "エッセイ〔その他〕",
392
+ [Genre.SonotaReplay]: "リプレイ〔その他〕",
393
+ [Genre.SonotaSonota]: "その他〔その他〕",
394
+ [Genre.NonGenre]: "ノンジャンル〔ノンジャンル〕"
395
+ };
396
+ /** 文体指定 */
397
+ const BuntaiParam = {
398
+ NoJisageKaigyouOoi: 1,
399
+ NoJisageKaigyoHutsuu: 2,
400
+ JisageKaigyoOoi: 4,
401
+ JisageKaigyoHutsuu: 6
402
+ };
403
+ /** 連載停止中指定 */
404
+ const StopParam = {
405
+ NoStopping: 1,
406
+ Stopping: 2
407
+ };
408
+ /** 小説タイプ指定 */
409
+ const NovelTypeParam = {
410
+ Short: "t",
411
+ RensaiNow: "r",
412
+ RensaiEnd: "er",
413
+ Rensai: "re",
414
+ ShortAndRensai: "ter"
415
+ };
416
+ /** 日付指定パラメータ */
417
+ const DateParam = {
418
+ ThisWeek: "thisweek",
419
+ LastWeek: "lastweek",
420
+ SevenDays: "sevenday",
421
+ ThisMonth: "thismonth",
422
+ LastMonth: "lastmonth"
423
+ };
424
+ const UserOrder = {
425
+ New: "new",
426
+ NovelCount: "novelcnt",
427
+ ReviewCount: "reviewcnt",
428
+ NovelLength: "novellength",
429
+ SumGlobalPoint: "sumglobalpoint",
430
+ Old: "old"
431
+ };
432
+
433
+ //#endregion
434
+ //#region src/search-builder.ts
435
+ var SearchBuilderBase = class {
436
+ /**
437
+ * constructor
438
+ * @private
439
+ * @param params クエリパラメータ
440
+ * @param api NarouNovel インスタンス
441
+ */
442
+ constructor(params = {}, api) {
443
+ this.params = params;
444
+ this.api = api;
445
+ }
446
+ /**
447
+ * 配列から重複を除去する
448
+ * @protected
449
+ * @static
450
+ * @param array 配列
451
+ * @returns 重複を除去した配列
452
+ */
453
+ static distinct(array) {
454
+ return Array.from(new Set(array));
455
+ }
456
+ /**
457
+ * 配列をハイフン区切りの文字列に変換する
458
+ * @protected
459
+ * @static
460
+ * @param n 文字列または数値の配列、あるいは単一の文字列または数値
461
+ * @returns ハイフン区切りの文字列
462
+ */
463
+ static array2string(n) {
464
+ if (Array.isArray(n)) return this.distinct(n).join("-");
465
+ else return n.toString();
466
+ }
467
+ /**
468
+ * 取得件数を指定する (lim)
469
+ * @param num 取得件数 (1-500)
470
+ * @return {this}
471
+ */
472
+ limit(num) {
473
+ this.set({ lim: num });
474
+ return this;
475
+ }
476
+ /**
477
+ * 取得開始位置を指定する (st)
478
+ * @param num 取得開始位置 (1-)
479
+ * @return {this}
480
+ */
481
+ start(num) {
482
+ this.set({ st: num });
483
+ return this;
484
+ }
485
+ /**
486
+ * ページ番号と1ページあたりの件数で取得範囲を指定する
487
+ * @param no ページ番号 (0-)
488
+ * @param count 1ページあたりの件数 (デフォルト: 20)
489
+ * @return {this}
490
+ */
491
+ page(no, count$1 = 20) {
492
+ return this.limit(count$1).start(no * count$1);
493
+ }
494
+ /**
495
+ * 出力順序を指定する (order)
496
+ * 指定しない場合は新着順となります。
497
+ * @param {TOrder} order 出力順序
498
+ * @return {this}
499
+ */
500
+ order(order) {
501
+ this.set({ order });
502
+ return this;
503
+ }
504
+ /**
505
+ * gzip圧縮レベルを指定する (gzip)
506
+ *
507
+ * 転送量上限を減らすためにも推奨
508
+ * @param {GzipLevel} level gzip圧縮レベル(1~5)
509
+ * @return {this}
510
+ */
511
+ gzip(level) {
512
+ this.set({ gzip: level });
513
+ return this;
514
+ }
515
+ /**
516
+ * クエリパラメータをセットする
517
+ * @protected
518
+ * @param obj セットするパラメータ
519
+ * @return {this}
520
+ */
521
+ set(obj) {
522
+ this.params = {
523
+ ...this.params,
524
+ ...obj
525
+ };
526
+ return this;
527
+ }
528
+ /**
529
+ * クエリパラメータを削除する
530
+ * @protected
531
+ * @param key 削除するパラメータのキー
532
+ * @returns {this}
533
+ */
534
+ unset(key) {
535
+ delete this.params[key];
536
+ return this;
537
+ }
538
+ };
539
+ var NovelSearchBuilderBase = class NovelSearchBuilderBase extends SearchBuilderBase {
540
+ /**
541
+ * 検索語を指定します (word)。
542
+ * 半角または全角スペースで区切るとAND抽出になります。部分一致でHITします。
543
+ * @param word 検索語
544
+ * @return {this}
545
+ */
546
+ word(word) {
547
+ this.set({ word });
548
+ return this;
549
+ }
550
+ /**
551
+ * 除外したい単語を指定します (notword)。
552
+ * スペースで区切ることにより除外する単語を増やせます。部分一致で除外されます。
553
+ * @param word 除外語
554
+ * @return {this}
555
+ */
556
+ notWord(word) {
557
+ this.set({ notword: word });
558
+ return this;
559
+ }
560
+ /**
561
+ * 検索対象を作品名に限定するかどうかを指定します (title)。
562
+ * @param bool trueの場合、作品名を検索対象とする (デフォルト: true)
563
+ * @return {this}
564
+ */
565
+ byTitle(bool = true) {
566
+ this.set({ title: bool ? BooleanNumber.True : BooleanNumber.False });
567
+ return this;
568
+ }
569
+ /**
570
+ * 検索対象をあらすじに限定するかどうかを指定します (ex)。
571
+ * @param bool trueの場合、あらすじを検索対象とする (デフォルト: true)
572
+ * @return {this}
573
+ */
574
+ byOutline(bool = true) {
575
+ this.set({ ex: bool ? BooleanNumber.True : BooleanNumber.False });
576
+ return this;
577
+ }
578
+ /**
579
+ * 検索対象をキーワードに限定するかどうかを指定します (keyword)。
580
+ * @param bool trueの場合、キーワードを検索対象とする (デフォルト: true)
581
+ * @return {this}
582
+ */
583
+ byKeyword(bool = true) {
584
+ this.set({ keyword: bool ? BooleanNumber.True : BooleanNumber.False });
585
+ return this;
586
+ }
587
+ /**
588
+ * 検索対象を作者名に限定するかどうかを指定します (wname)。
589
+ * @param bool trueの場合、作者名を検索対象とする (デフォルト: true)
590
+ * @return {this}
591
+ */
592
+ byAuthor(bool = true) {
593
+ this.set({ wname: bool ? BooleanNumber.True : BooleanNumber.False });
594
+ return this;
595
+ }
596
+ /**
597
+ * ボーイズラブ作品を抽出または除外します (isbl/notbl)。
598
+ * @param bool trueの場合、ボーイズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
599
+ * @return {this}
600
+ */
601
+ isBL(bool = true) {
602
+ if (bool) this.set({ isbl: BooleanNumber.True });
603
+ else this.set({ notbl: BooleanNumber.True });
604
+ return this;
605
+ }
606
+ /**
607
+ * ガールズラブ作品を抽出または除外します (isgl/notgl)。
608
+ * @param bool trueの場合、ガールズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
609
+ * @return {this}
610
+ */
611
+ isGL(bool = true) {
612
+ if (bool) this.set({ isgl: BooleanNumber.True });
613
+ else this.set({ notgl: BooleanNumber.True });
614
+ return this;
615
+ }
616
+ /**
617
+ * 残酷な描写あり作品を抽出または除外します (iszankoku/notzankoku)。
618
+ * @param bool trueの場合、残酷な描写あり作品を抽出する (デフォルト: true)。falseの場合、除外する。
619
+ * @return {this}
620
+ */
621
+ isZankoku(bool = true) {
622
+ if (bool) this.set({ iszankoku: BooleanNumber.True });
623
+ else this.set({ notzankoku: BooleanNumber.True });
624
+ return this;
625
+ }
626
+ /**
627
+ * 異世界転生作品を抽出または除外します (istensei/nottensei)。
628
+ * @param bool trueの場合、異世界転生作品を抽出する (デフォルト: true)。falseの場合、除外する。
629
+ * @return {this}
630
+ */
631
+ isTensei(bool = true) {
632
+ if (bool) this.set({ istensei: BooleanNumber.True });
633
+ else this.set({ nottensei: BooleanNumber.True });
634
+ return this;
635
+ }
636
+ /**
637
+ * 異世界転移作品を抽出または除外します (istenni/nottenni)。
638
+ * @param bool trueの場合、異世界転移作品を抽出する (デフォルト: true)。falseの場合、除外する。
639
+ * @return {this}
640
+ */
641
+ isTenni(bool = true) {
642
+ if (bool) this.set({ istenni: BooleanNumber.True });
643
+ else this.set({ nottenni: BooleanNumber.True });
644
+ return this;
645
+ }
646
+ /**
647
+ * 異世界転生または異世界転移作品を抽出します (istt)。
648
+ * @return {this}
649
+ */
650
+ isTT() {
651
+ this.set({ istt: BooleanNumber.True });
652
+ return this;
653
+ }
654
+ /**
655
+ * 抽出する作品の文字数を指定します (length)。
656
+ * 範囲指定する場合は、最小文字数と最大文字数をハイフン(-)記号で区切ってください。
657
+ * @param length 文字数、または[最小文字数, 最大文字数]
658
+ * @return {this}
659
+ */
660
+ length(length) {
661
+ this.set({ length: NovelSearchBuilderBase.array2string(length) });
662
+ return this;
663
+ }
664
+ kaiwaritu(min, max) {
665
+ let n;
666
+ if (max != null) n = `${min}-${max}`;
667
+ else n = min;
668
+ this.set({ kaiwaritu: n });
669
+ return this;
670
+ }
671
+ /**
672
+ * 抽出する作品の挿絵数を指定します (sasie)。
673
+ * @param num 挿絵数、または[最小挿絵数, 最大挿絵数]
674
+ * @return {this}
675
+ */
676
+ sasie(num) {
677
+ this.set({ sasie: NovelSearchBuilderBase.array2string(num) });
678
+ return this;
679
+ }
680
+ /**
681
+ * 抽出する作品の予想読了時間を分単位で指定します (time)。
682
+ * @param num 読了時間(分)、または[最小読了時間, 最大読了時間]
683
+ * @return {this}
684
+ */
685
+ time(num) {
686
+ this.set({ time: NovelSearchBuilderBase.array2string(num) });
687
+ return this;
688
+ }
689
+ /**
690
+ * Nコードを指定して取得します (ncode)。
691
+ * @param ncodes Nコード、またはNコードの配列
692
+ * @return {this}
693
+ */
694
+ ncode(ncodes) {
695
+ this.set({ ncode: NovelSearchBuilderBase.array2string(ncodes) });
696
+ return this;
697
+ }
698
+ /**
699
+ * 抽出する小説タイプを指定します (type)。
700
+ * @param type 小説タイプ (t: 短編, r: 連載中, er: 完結済連載小説, ter: 短編と完結済連載小説, re: 連載中と完結済連載小説)
701
+ * @return {this}
702
+ */
703
+ type(type) {
704
+ this.set({ type });
705
+ return this;
706
+ }
707
+ /**
708
+ * 抽出する作品の文体を指定します (buntai)。
709
+ * 複数指定する場合はハイフン(-)で区切ってください。
710
+ * @param buntai 文体コード、または文体コードの配列
711
+ * @return {this}
712
+ */
713
+ buntai(buntai) {
714
+ this.set({ buntai: NovelSearchBuilderBase.array2string(buntai) });
715
+ return this;
716
+ }
717
+ /**
718
+ * 連載停止中作品に関する指定をします (stop)。
719
+ * @param bool trueの場合、長期連載停止中のみ取得する (デフォルト: true)。falseの場合、長期連載停止中を除外する。
720
+ * @return {this}
721
+ */
722
+ isStop(bool = true) {
723
+ this.set({ stop: bool ? StopParam.Stopping : StopParam.NoStopping });
724
+ return this;
725
+ }
726
+ /**
727
+ * ピックアップ作品のみを取得します (ispickup)。
728
+ * @return {this}
729
+ */
730
+ isPickup() {
731
+ this.set({ ispickup: BooleanNumber.True });
732
+ return this;
733
+ }
734
+ lastUpdate(x, y) {
735
+ let date;
736
+ if (typeof x == "string") date = x;
737
+ else if (x instanceof Date && y instanceof Date) date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(y.getTime() / 1e3)}`;
738
+ else date = `${x}-${y}`;
739
+ this.set({ lastup: date });
740
+ return this;
741
+ }
742
+ lastNovelUpdate(x, y) {
743
+ let date;
744
+ if (typeof x == "string") date = x;
745
+ else if (x instanceof Date && y instanceof Date) date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(y.getTime() / 1e3)}`;
746
+ else date = `${x}-${y}`;
747
+ this.set({ lastupdate: date });
748
+ return this;
749
+ }
750
+ /**
751
+ * なろう小説APIへの検索リクエストを実行する
752
+ * @param options 実行オプション
753
+ * @returns {Promise<NarouSearchResults>} 検索結果
754
+ */
755
+ execute(options) {
756
+ return this.api.executeNovel(this.params, options);
757
+ }
758
+ };
759
+ /**
760
+ * 検索ヘルパー
761
+ * @class SearchBuilder
762
+ */
763
+ var SearchBuilder = class SearchBuilder extends NovelSearchBuilderBase {
764
+ /**
765
+ * 大ジャンルを指定して取得します (biggenre)。
766
+ * 複数指定する場合はハイフン(-)で区切ってください。
767
+ * @param genre 大ジャンルコード、または大ジャンルコードの配列
768
+ * @return {this}
769
+ */
770
+ bigGenre(genre) {
771
+ this.set({ biggenre: SearchBuilder.array2string(genre) });
772
+ return this;
773
+ }
774
+ /**
775
+ * 除外したい大ジャンルを指定します (notbiggenre)。
776
+ * 複数指定する場合はハイフン(-)で区切ってください。
777
+ * @param genre 除外する大ジャンルコード、または大ジャンルコードの配列
778
+ * @return {this}
779
+ */
780
+ notBigGenre(genre) {
781
+ this.set({ notbiggenre: SearchBuilder.array2string(genre) });
782
+ return this;
783
+ }
784
+ /**
785
+ * ジャンルを指定して取得します (genre)。
786
+ * 複数指定する場合はハイフン(-)で区切ってください。
787
+ * @param genre ジャンルコード、またはジャンルコードの配列
788
+ * @return {this}
789
+ */
790
+ genre(genre) {
791
+ this.set({ genre: SearchBuilder.array2string(genre) });
792
+ return this;
793
+ }
794
+ /**
795
+ * 除外したいジャンルを指定します (notgenre)。
796
+ * 複数指定する場合はハイフン(-)で区切ってください。
797
+ * @param genre 除外するジャンルコード、またはジャンルコードの配列
798
+ * @return {this}
799
+ */
800
+ notGenre(genre) {
801
+ this.set({ notgenre: SearchBuilder.array2string(genre) });
802
+ return this;
803
+ }
804
+ /**
805
+ * ユーザIDを指定して取得します (userid)。
806
+ * 複数指定する場合はハイフン(-)で区切ってください。
807
+ * @param ids ユーザID、またはユーザIDの配列
808
+ * @return {this}
809
+ */
810
+ userId(ids) {
811
+ this.set({ userid: SearchBuilder.array2string(ids) });
812
+ return this;
813
+ }
814
+ /**
815
+ * R15作品を抽出または除外します (isr15/notr15)。
816
+ * @param bool trueの場合、R15作品を抽出する (デフォルト: true)。falseの場合、除外する。
817
+ * @return {this}
818
+ */
819
+ isR15(bool = true) {
820
+ if (bool) this.set({ isr15: 1 });
821
+ else this.set({ notr15: 1 });
822
+ return this;
823
+ }
824
+ /**
825
+ * 出力する項目を個別に指定します (of)。
826
+ * 未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
827
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
828
+ * @param fields 出力するフィールド名、またはフィールド名の配列
829
+ * @return {SearchBuilder<SearchResultFields<TFields>, TOpt>} 型が更新されたビルダー
830
+ */
831
+ fields(fields) {
832
+ this.set({ of: SearchBuilder.array2string(fields) });
833
+ return this;
834
+ }
835
+ /**
836
+ * 出力オプション項目を指定します (opt)。
837
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
838
+ * @param option 出力するオプションフィールド名、またはオプションフィールド名の配列
839
+ * @return {SearchBuilder<T, SearchResultOptionalFields<TFields>>} 型が更新されたビルダー
840
+ */
841
+ opt(option) {
842
+ this.set({ opt: SearchBuilder.array2string(option) });
843
+ return this;
844
+ }
845
+ };
846
+
847
+ //#endregion
848
+ //#region src/util/date.ts
849
+ /**
850
+ * 文字列の日付(yyyyMMdd形式)をDateオブジェクトに変換する
851
+ * @param dateStr yyyyMMdd形式の日付文字列
852
+ * @returns Dateオブジェクト
853
+ */
854
+ function parseDate(dateStr) {
855
+ const year = parseInt(dateStr.substring(0, 4), 10);
856
+ const month = parseInt(dateStr.substring(4, 6), 10) - 1;
857
+ const day = parseInt(dateStr.substring(6, 8), 10);
858
+ return new Date(year, month, day, 0, 0, 0, 0);
859
+ }
860
+ /**
861
+ * 日付をyyyyMMdd形式の文字列に変換する
862
+ * @param date 日付
863
+ * @returns yyyyMMdd形式の文字列
864
+ */
865
+ function formatDate(date) {
866
+ return `${date.getFullYear()}${String(date.getMonth() + 1).padStart(2, "0")}${String(date.getDate()).padStart(2, "0")}`;
867
+ }
868
+ /**
869
+ * 指定された日数を加算した新しい日付を返す
870
+ * @param date 元の日付
871
+ * @param days 加算する日数
872
+ * @returns 新しい日付
873
+ */
874
+ function addDays(date, days) {
875
+ const result = new Date(date);
876
+ result.setDate(result.getDate() + days);
877
+ return result;
878
+ }
879
+
880
+ //#endregion
881
+ //#region src/ranking.ts
882
+ /**
883
+ * なろう小説ランキングAPIのヘルパークラス。
884
+ *
885
+ * ランキング種別や日付を指定してランキングデータを取得します。
886
+ * また、取得したランキングデータに含まれるNコードを元に、
887
+ * なろう小説APIを利用して詳細な小説情報を取得することも可能です。
888
+ *
889
+ * @class RankingBuilder
890
+ * @see https://dev.syosetu.com/man/rankapi/ なろう小説ランキングAPI仕様
891
+ */
892
+ var RankingBuilder = class {
893
+ /**
894
+ * constructor
895
+ * @param params - 初期クエリパラメータ
896
+ * @param api - API実行クラスのインスタンス
897
+ * @private
898
+ */
899
+ constructor(params = {}, api) {
900
+ this.params = params;
901
+ this.api = api;
902
+ /**
903
+ * クエリパラメータ
904
+ * @protected
905
+ */
906
+ this.date$ = addDays(/* @__PURE__ */ new Date(), -1);
907
+ this.type$ = RankingType.Daily;
908
+ }
909
+ /**
910
+ * ランキング集計対象の日付を指定します。
911
+ *
912
+ * - 日間: 任意の日付
913
+ * - 週間: 火曜日の日付
914
+ * - 月間・四半期: 1日の日付
915
+ *
916
+ * @param date 集計対象の日付
917
+ * @returns {RankingBuilder} this
918
+ * @see https://dev.syosetu.com/man/rankapi/
919
+ */
920
+ date(date) {
921
+ this.date$ = date;
922
+ return this;
923
+ }
924
+ /**
925
+ * ランキング種別を指定します。
926
+ * @param type ランキング種別
927
+ * @returns {RankingBuilder} this
928
+ * @see https://dev.syosetu.com/man/rankapi/
929
+ */
930
+ type(type) {
931
+ this.type$ = type;
932
+ return this;
933
+ }
934
+ /**
935
+ * gzip圧縮する。
936
+ *
937
+ * 転送量上限を減らすためにも推奨
938
+ * @param {GzipLevel} level gzip圧縮レベル(1~5)
939
+ * @return {RankingBuilder} this
940
+ */
941
+ gzip(level) {
942
+ this.set({ gzip: level });
943
+ return this;
944
+ }
945
+ /**
946
+ * クエリパラメータを内部的にセットします。
947
+ * @param obj - セットするパラメータオブジェクト
948
+ * @returns {RankingBuilder} this
949
+ * @private
950
+ */
951
+ set(obj) {
952
+ Object.assign(this.params, obj);
953
+ return this;
954
+ }
955
+ /**
956
+ * 設定されたパラメータに基づき、なろう小説ランキングAPIへのリクエストを実行します。
957
+ *
958
+ * 返される結果には、Nコード、ポイント、順位が含まれます。
959
+ * @param options 実行オプション
960
+ * @returns {Promise<NarouRankingResult[]>} ランキング結果の配列
961
+ * @see https://dev.syosetu.com/man/rankapi/#output
962
+ */
963
+ execute(options) {
964
+ const date = formatDate(this.date$);
965
+ this.set({ rtype: `${date}-${this.type$}` });
966
+ return this.api.executeRanking(this.params, options);
967
+ }
968
+ /**
969
+ * ランキングAPIを実行し、取得したNコードを元になろう小説APIで詳細情報を取得して結合します。
970
+ *
971
+ * @template TFields - 取得する小説情報のフィールド型
972
+ * @template TOpt - オプショナルな取得フィールドの型
973
+ * @param fields - 取得するフィールドの配列 (省略時はデフォルトフィールド)
974
+ * @param opt - オプショナルな取得フィールド (`weekly` など)
975
+ * @returns {Promise<RankingResult<SearchResultFields<TFields>>[]>} 詳細情報を含むランキング結果の配列
976
+ */
977
+ async executeWithFields(fields = [], opt, options) {
978
+ const ranking = await this.execute(options);
979
+ const fields$ = Array.isArray(fields) ? fields.length == 0 ? [] : [...fields, Fields.ncode] : [fields, Fields.ncode];
980
+ const rankingNcodes = ranking.map(({ ncode }) => ncode);
981
+ const builder = new SearchBuilder({}, this.api);
982
+ builder.fields(fields$);
983
+ if (opt) builder.opt(opt);
984
+ builder.ncode(rankingNcodes);
985
+ builder.limit(ranking.length);
986
+ const result = await builder.execute(options);
987
+ return ranking.map((r) => ({
988
+ ...r,
989
+ ...result.values.find((novel) => novel.ncode == r.ncode)
990
+ }));
991
+ }
992
+ };
993
+
994
+ //#endregion
995
+ //#region src/ranking-history.ts
996
+ /**
997
+ * 生のランキング履歴エントリを構造化された形式にフォーマットします。
998
+ *
999
+ * @param rankin - フォーマットする生のランキング履歴データ
1000
+ * @returns 日付とタイプが解析されたフォーマット済みランキング履歴
1001
+ *
1002
+ * @example
1003
+ * const rawData = { rtype: "20230101-daily", pt: 500, rank: 10 };
1004
+ * const formattedData = formatRankingHistory(rawData);
1005
+ * // 返り値: { type: "daily", date: [Dateオブジェクト], pt: 500, rank: 10 }
1006
+ */
1007
+ function formatRankingHistory(rankin) {
1008
+ const { rtype, pt, rank } = rankin;
1009
+ const [_date, _type] = rtype.split("-");
1010
+ return {
1011
+ type: _type,
1012
+ date: parseDate(_date),
1013
+ pt,
1014
+ rank
1015
+ };
1016
+ }
1017
+
1018
+ //#endregion
1019
+ //#region src/search-builder-r18.ts
1020
+ /**
1021
+ * 18禁API検索ヘルパー
1022
+ * @class SearchBuilderR18
1023
+ */
1024
+ var SearchBuilderR18 = class extends NovelSearchBuilderBase {
1025
+ /**
1026
+ * なろう小説APIへの検索リクエストを実行する
1027
+ * @override
1028
+ * @param options 実行オプション
1029
+ * @returns {Promise<NarouSearchResults>} 検索結果
1030
+ */
1031
+ execute(options) {
1032
+ return this.api.executeNovel18(this.params, options);
1033
+ }
1034
+ /**
1035
+ * 抽出するR18サイトを指定します (nocgenre)。
1036
+ * @param sites R18サイトコード、またはR18サイトコードの配列 (1: ノクターンノベルズ, 2: ムーンライトノベルズ(男性向け), 3: ムーンライトノベルズ(BL), 4: ミッドナイトノベルズ)
1037
+ * @return {this}
1038
+ */
1039
+ r18Site(sites) {
1040
+ this.set({ nocgenre: NovelSearchBuilderBase.array2string(sites) });
1041
+ return this;
1042
+ }
1043
+ /**
1044
+ * X-IDを指定して取得します (xid)。
1045
+ * @param ids X-ID、またはX-IDの配列
1046
+ * @return {this}
1047
+ */
1048
+ xid(ids) {
1049
+ this.set({ xid: NovelSearchBuilderBase.array2string(ids) });
1050
+ return this;
1051
+ }
1052
+ /**
1053
+ * 出力する項目を個別に指定します (of)。
1054
+ * 未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
1055
+ * @param fields 出力するR18フィールド名、またはR18フィールド名の配列
1056
+ * @return {SearchBuilderR18<SearchResultR18Fields<R18Fields>>} 型が更新されたビルダー
1057
+ */
1058
+ fields(fields) {
1059
+ this.set({ of: NovelSearchBuilderBase.array2string(fields) });
1060
+ return this;
1061
+ }
1062
+ /**
1063
+ * 出力オプション項目を指定します (opt)。
1064
+ * @param option 出力するオプションフィールド名、またはオプションフィールド名の配列
1065
+ * @return {SearchBuilderR18<T, SearchResultOptionalFields<TFields>>} 型が更新されたビルダー
1066
+ */
1067
+ opt(option) {
1068
+ this.set({ opt: NovelSearchBuilderBase.array2string(option) });
1069
+ return this;
1070
+ }
1071
+ };
1072
+
1073
+ //#endregion
1074
+ //#region src/user-search.ts
1075
+ /**
1076
+ * なろうユーザ検索API
1077
+ * @class UserSearch
1078
+ */
1079
+ var UserSearchBuilder = class UserSearchBuilder extends SearchBuilderBase {
1080
+ /**
1081
+ * 単語を指定できます。
1082
+ * 半角または全角スペースで区切るとAND抽出になります。
1083
+ * 部分一致でHITします。検索の対象はユーザ名とユーザ名のフリガナです。
1084
+ */
1085
+ word(word) {
1086
+ this.set({ word });
1087
+ return this;
1088
+ }
1089
+ /**
1090
+ * 含みたくない単語を指定できます。
1091
+ * スペースで区切ることにより含ませない単語を増やせます。部分一致で除外されます。
1092
+ * 除外の対象はユーザ名とユーザ名のフリガナです。
1093
+ */
1094
+ notWord(notword) {
1095
+ this.set({ notword });
1096
+ return this;
1097
+ }
1098
+ /**
1099
+ * ユーザIDで抽出可能。
1100
+ */
1101
+ userId(userid) {
1102
+ this.set({ userid });
1103
+ return this;
1104
+ }
1105
+ /**
1106
+ * 抽出するユーザのユーザ名のフリガナの頭文字を指定できます。
1107
+ * 頭文字はユーザ名のフリガナをひらがなに変換し、最初の1文字が「ぁ」~「ん」の場合に対象となります。
1108
+ * 「ぱ」や「ば」等の半濁音や濁音は清音として扱われます。
1109
+ * 漢字や英数字が頭文字のユーザは対象外です。
1110
+ */
1111
+ name1st(name1st) {
1112
+ this.set({ name1st });
1113
+ return this;
1114
+ }
1115
+ /**
1116
+ * 抽出するユーザの小説投稿数の下限を指定できます。
1117
+ * 小説投稿件数が指定された数値以上のユーザを抽出します。
1118
+ */
1119
+ minNovel(minnovel) {
1120
+ this.set({ minnovel });
1121
+ return this;
1122
+ }
1123
+ /**
1124
+ * 抽出するユーザの小説投稿数の上限を指定できます。
1125
+ * 小説投稿件数が指定された数値以下のユーザを抽出します。
1126
+ */
1127
+ maxNovel(maxnovel) {
1128
+ this.set({ maxnovel });
1129
+ return this;
1130
+ }
1131
+ /**
1132
+ * 抽出するユーザのレビュー投稿数の下限を指定できます。
1133
+ * レビュー投稿件数が指定された数値以上のユーザを抽出します。
1134
+ */
1135
+ minReview(minreview) {
1136
+ this.set({ minreview });
1137
+ return this;
1138
+ }
1139
+ /**
1140
+ * 抽出するユーザのレビュー投稿数の上限を指定できます。
1141
+ * レビュー投稿件数が指定された数値以下のユーザを抽出します。
1142
+ */
1143
+ maxReview(maxreview) {
1144
+ this.set({ maxreview });
1145
+ return this;
1146
+ }
1147
+ /**
1148
+ * 出力する項目を個別に指定できます。未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
1149
+ * @return {SearchBuilder} this
1150
+ */
1151
+ fields(fields) {
1152
+ this.set({ of: UserSearchBuilder.array2string(fields) });
1153
+ return this;
1154
+ }
1155
+ /**
1156
+ * なろう小説APIへのリクエストを実行する
1157
+ * @param options 実行オプション
1158
+ * @returns ランキング
1159
+ */
1160
+ execute(options) {
1161
+ return this.api.executeUserSearch(this.params, options);
1162
+ }
1163
+ };
1164
+
1165
+ //#endregion
1166
+ Object.defineProperty(exports, 'BigGenre', {
1167
+ enumerable: true,
1168
+ get: function () {
1169
+ return BigGenre;
1170
+ }
1171
+ });
1172
+ Object.defineProperty(exports, 'BigGenreNotation', {
1173
+ enumerable: true,
1174
+ get: function () {
1175
+ return BigGenreNotation;
1176
+ }
1177
+ });
1178
+ Object.defineProperty(exports, 'BooleanNumber', {
1179
+ enumerable: true,
1180
+ get: function () {
1181
+ return BooleanNumber;
1182
+ }
1183
+ });
1184
+ Object.defineProperty(exports, 'BuntaiParam', {
1185
+ enumerable: true,
1186
+ get: function () {
1187
+ return BuntaiParam;
1188
+ }
1189
+ });
1190
+ Object.defineProperty(exports, 'DateParam', {
1191
+ enumerable: true,
1192
+ get: function () {
1193
+ return DateParam;
1194
+ }
1195
+ });
1196
+ Object.defineProperty(exports, 'End', {
1197
+ enumerable: true,
1198
+ get: function () {
1199
+ return End;
1200
+ }
1201
+ });
1202
+ Object.defineProperty(exports, 'Fields', {
1203
+ enumerable: true,
1204
+ get: function () {
1205
+ return Fields;
1206
+ }
1207
+ });
1208
+ Object.defineProperty(exports, 'Genre', {
1209
+ enumerable: true,
1210
+ get: function () {
1211
+ return Genre;
1212
+ }
1213
+ });
1214
+ Object.defineProperty(exports, 'GenreNotation', {
1215
+ enumerable: true,
1216
+ get: function () {
1217
+ return GenreNotation;
1218
+ }
1219
+ });
1220
+ Object.defineProperty(exports, 'NarouNovel', {
1221
+ enumerable: true,
1222
+ get: function () {
1223
+ return NarouNovel;
1224
+ }
1225
+ });
1226
+ Object.defineProperty(exports, 'NarouNovelJsonp', {
1227
+ enumerable: true,
1228
+ get: function () {
1229
+ return NarouNovelJsonp;
1230
+ }
1231
+ });
1232
+ Object.defineProperty(exports, 'NarouSearchResults', {
1233
+ enumerable: true,
1234
+ get: function () {
1235
+ return NarouSearchResults;
1236
+ }
1237
+ });
1238
+ Object.defineProperty(exports, 'NovelSearchBuilderBase', {
1239
+ enumerable: true,
1240
+ get: function () {
1241
+ return NovelSearchBuilderBase;
1242
+ }
1243
+ });
1244
+ Object.defineProperty(exports, 'NovelType', {
1245
+ enumerable: true,
1246
+ get: function () {
1247
+ return NovelType;
1248
+ }
1249
+ });
1250
+ Object.defineProperty(exports, 'NovelTypeParam', {
1251
+ enumerable: true,
1252
+ get: function () {
1253
+ return NovelTypeParam;
1254
+ }
1255
+ });
1256
+ Object.defineProperty(exports, 'OptionalFields', {
1257
+ enumerable: true,
1258
+ get: function () {
1259
+ return OptionalFields;
1260
+ }
1261
+ });
1262
+ Object.defineProperty(exports, 'Order', {
1263
+ enumerable: true,
1264
+ get: function () {
1265
+ return Order;
1266
+ }
1267
+ });
1268
+ Object.defineProperty(exports, 'R18Fields', {
1269
+ enumerable: true,
1270
+ get: function () {
1271
+ return R18Fields;
1272
+ }
1273
+ });
1274
+ Object.defineProperty(exports, 'R18Site', {
1275
+ enumerable: true,
1276
+ get: function () {
1277
+ return R18Site;
1278
+ }
1279
+ });
1280
+ Object.defineProperty(exports, 'R18SiteNotation', {
1281
+ enumerable: true,
1282
+ get: function () {
1283
+ return R18SiteNotation;
1284
+ }
1285
+ });
1286
+ Object.defineProperty(exports, 'RankingBuilder', {
1287
+ enumerable: true,
1288
+ get: function () {
1289
+ return RankingBuilder;
1290
+ }
1291
+ });
1292
+ Object.defineProperty(exports, 'RankingType', {
1293
+ enumerable: true,
1294
+ get: function () {
1295
+ return RankingType;
1296
+ }
1297
+ });
1298
+ Object.defineProperty(exports, 'SearchBuilder', {
1299
+ enumerable: true,
1300
+ get: function () {
1301
+ return SearchBuilder;
1302
+ }
1303
+ });
1304
+ Object.defineProperty(exports, 'SearchBuilderBase', {
1305
+ enumerable: true,
1306
+ get: function () {
1307
+ return SearchBuilderBase;
1308
+ }
1309
+ });
1310
+ Object.defineProperty(exports, 'SearchBuilderR18', {
1311
+ enumerable: true,
1312
+ get: function () {
1313
+ return SearchBuilderR18;
1314
+ }
1315
+ });
1316
+ Object.defineProperty(exports, 'StopParam', {
1317
+ enumerable: true,
1318
+ get: function () {
1319
+ return StopParam;
1320
+ }
1321
+ });
1322
+ Object.defineProperty(exports, 'UserFields', {
1323
+ enumerable: true,
1324
+ get: function () {
1325
+ return UserFields;
1326
+ }
1327
+ });
1328
+ Object.defineProperty(exports, 'UserOrder', {
1329
+ enumerable: true,
1330
+ get: function () {
1331
+ return UserOrder;
1332
+ }
1333
+ });
1334
+ Object.defineProperty(exports, 'UserSearchBuilder', {
1335
+ enumerable: true,
1336
+ get: function () {
1337
+ return UserSearchBuilder;
1338
+ }
1339
+ });
1340
+ Object.defineProperty(exports, 'formatRankingHistory', {
1341
+ enumerable: true,
1342
+ get: function () {
1343
+ return formatRankingHistory;
1344
+ }
1345
+ });
1346
+ //# sourceMappingURL=index.common-CYj0n0aU.cjs.map