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,4 +1,5 @@
1
1
  import type NarouNovel from "./narou.js";
2
+ import type { ExecuteOptions } from "./narou.js";
2
3
  import type {
3
4
  NarouSearchResult,
4
5
  SearchResultFields,
@@ -34,16 +35,32 @@ export abstract class SearchBuilderBase<
34
35
  /**
35
36
  * constructor
36
37
  * @private
38
+ * @param params クエリパラメータ
39
+ * @param api NarouNovel インスタンス
37
40
  */
38
41
  constructor(
39
42
  protected params: TParams = {} as TParams,
40
43
  protected api: NarouNovel
41
- ) {}
44
+ ) { }
42
45
 
46
+ /**
47
+ * 配列から重複を除去する
48
+ * @protected
49
+ * @static
50
+ * @param array 配列
51
+ * @returns 重複を除去した配列
52
+ */
43
53
  protected static distinct<T>(array: readonly T[]): T[] {
44
54
  return Array.from(new Set(array));
45
55
  }
46
56
 
57
+ /**
58
+ * 配列をハイフン区切りの文字列に変換する
59
+ * @protected
60
+ * @static
61
+ * @param n 文字列または数値の配列、あるいは単一の文字列または数値
62
+ * @returns ハイフン区切りの文字列
63
+ */
47
64
  protected static array2string<T extends string | number>(
48
65
  n: T | readonly T[]
49
66
  ): Join<T> {
@@ -55,8 +72,9 @@ export abstract class SearchBuilderBase<
55
72
  }
56
73
 
57
74
  /**
58
- *
59
- * @return {SearchBuilder} this
75
+ * 取得件数を指定する (lim)
76
+ * @param num 取得件数 (1-500)
77
+ * @return {this}
60
78
  */
61
79
  limit(num: number): this {
62
80
  this.set({ lim: num } as TParams);
@@ -64,8 +82,9 @@ export abstract class SearchBuilderBase<
64
82
  }
65
83
 
66
84
  /**
67
- *
68
- * @return {SearchBuilder} this
85
+ * 取得開始位置を指定する (st)
86
+ * @param num 取得開始位置 (1-)
87
+ * @return {this}
69
88
  */
70
89
  start(num: number): this {
71
90
  this.set({ st: num } as TParams);
@@ -73,18 +92,20 @@ export abstract class SearchBuilderBase<
73
92
  }
74
93
 
75
94
  /**
76
- *
77
- * @return {SearchBuilder} this
95
+ * ページ番号と1ページあたりの件数で取得範囲を指定する
96
+ * @param no ページ番号 (0-)
97
+ * @param count 1ページあたりの件数 (デフォルト: 20)
98
+ * @return {this}
78
99
  */
79
100
  page(no: number, count = 20): this {
80
101
  return this.limit(count).start(no * count);
81
102
  }
82
103
 
83
104
  /**
84
- * 出力順序を指定する。指定しない場合は新着順となります。
85
- * old 古い順
105
+ * 出力順序を指定する (order)
106
+ * 指定しない場合は新着順となります。
86
107
  * @param {TOrder} order 出力順序
87
- * @return {SearchBuilder} this
108
+ * @return {this}
88
109
  */
89
110
  order(order: TOrder): this {
90
111
  this.set({ order: order } as TParams);
@@ -92,11 +113,11 @@ export abstract class SearchBuilderBase<
92
113
  }
93
114
 
94
115
  /**
95
- * gzip圧縮する。
116
+ * gzip圧縮レベルを指定する (gzip)
96
117
  *
97
118
  * 転送量上限を減らすためにも推奨
98
119
  * @param {GzipLevel} level gzip圧縮レベル(1~5)
99
- * @return {SearchBuilder} this
120
+ * @return {this}
100
121
  */
101
122
  gzip(level: GzipLevel): this {
102
123
  this.set({ gzip: level } as TParams);
@@ -105,8 +126,9 @@ export abstract class SearchBuilderBase<
105
126
 
106
127
  /**
107
128
  * クエリパラメータをセットする
108
- * @private
109
- * @return {SearchBuilder} this
129
+ * @protected
130
+ * @param obj セットするパラメータ
131
+ * @return {this}
110
132
  */
111
133
  protected set(obj: TParams): this {
112
134
  this.params = { ...this.params, ...obj };
@@ -115,6 +137,9 @@ export abstract class SearchBuilderBase<
115
137
 
116
138
  /**
117
139
  * クエリパラメータを削除する
140
+ * @protected
141
+ * @param key 削除するパラメータのキー
142
+ * @returns {this}
118
143
  */
119
144
  protected unset(key: keyof TParams): this {
120
145
  delete this.params[key];
@@ -126,8 +151,10 @@ export abstract class NovelSearchBuilderBase<
126
151
  T extends SearchResultFieldNames,
127
152
  > extends SearchBuilderBase<SearchParams, Order> {
128
153
  /**
129
- * a
130
- * @return {SearchBuilder} this
154
+ * 検索語を指定します (word)。
155
+ * 半角または全角スペースで区切るとAND抽出になります。部分一致でHITします。
156
+ * @param word 検索語
157
+ * @return {this}
131
158
  */
132
159
  word(word: string): this {
133
160
  this.set({ word: word });
@@ -135,8 +162,10 @@ export abstract class NovelSearchBuilderBase<
135
162
  }
136
163
 
137
164
  /**
138
- *
139
- * @return {SearchBuilder} this
165
+ * 除外したい単語を指定します (notword)。
166
+ * スペースで区切ることにより除外する単語を増やせます。部分一致で除外されます。
167
+ * @param word 除外語
168
+ * @return {this}
140
169
  */
141
170
  notWord(word: string): this {
142
171
  this.set({ notword: word });
@@ -144,8 +173,9 @@ export abstract class NovelSearchBuilderBase<
144
173
  }
145
174
 
146
175
  /**
147
- *
148
- * @return {SearchBuilder} this
176
+ * 検索対象を作品名に限定するかどうかを指定します (title)。
177
+ * @param bool trueの場合、作品名を検索対象とする (デフォルト: true)
178
+ * @return {this}
149
179
  */
150
180
  byTitle(bool = true): this {
151
181
  this.set({ title: bool ? BooleanNumber.True : BooleanNumber.False });
@@ -153,8 +183,9 @@ export abstract class NovelSearchBuilderBase<
153
183
  }
154
184
 
155
185
  /**
156
- *
157
- * @return {SearchBuilder} this
186
+ * 検索対象をあらすじに限定するかどうかを指定します (ex)。
187
+ * @param bool trueの場合、あらすじを検索対象とする (デフォルト: true)
188
+ * @return {this}
158
189
  */
159
190
  byOutline(bool = true): this {
160
191
  this.set({ ex: bool ? BooleanNumber.True : BooleanNumber.False });
@@ -162,8 +193,9 @@ export abstract class NovelSearchBuilderBase<
162
193
  }
163
194
 
164
195
  /**
165
- *
166
- * @return {SearchBuilder} this
196
+ * 検索対象をキーワードに限定するかどうかを指定します (keyword)。
197
+ * @param bool trueの場合、キーワードを検索対象とする (デフォルト: true)
198
+ * @return {this}
167
199
  */
168
200
  byKeyword(bool = true): this {
169
201
  this.set({ keyword: bool ? BooleanNumber.True : BooleanNumber.False });
@@ -171,8 +203,9 @@ export abstract class NovelSearchBuilderBase<
171
203
  }
172
204
 
173
205
  /**
174
- *
175
- * @return {SearchBuilder} this
206
+ * 検索対象を作者名に限定するかどうかを指定します (wname)。
207
+ * @param bool trueの場合、作者名を検索対象とする (デフォルト: true)
208
+ * @return {this}
176
209
  */
177
210
  byAuthor(bool = true): this {
178
211
  this.set({ wname: bool ? BooleanNumber.True : BooleanNumber.False });
@@ -180,8 +213,9 @@ export abstract class NovelSearchBuilderBase<
180
213
  }
181
214
 
182
215
  /**
183
- *
184
- * @return {SearchBuilder} this
216
+ * ボーイズラブ作品を抽出または除外します (isbl/notbl)。
217
+ * @param bool trueの場合、ボーイズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
218
+ * @return {this}
185
219
  */
186
220
  isBL(bool = true): this {
187
221
  if (bool) {
@@ -193,8 +227,9 @@ export abstract class NovelSearchBuilderBase<
193
227
  }
194
228
 
195
229
  /**
196
- *
197
- * @return {SearchBuilder} this
230
+ * ガールズラブ作品を抽出または除外します (isgl/notgl)。
231
+ * @param bool trueの場合、ガールズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
232
+ * @return {this}
198
233
  */
199
234
  isGL(bool = true): this {
200
235
  if (bool) {
@@ -206,8 +241,9 @@ export abstract class NovelSearchBuilderBase<
206
241
  }
207
242
 
208
243
  /**
209
- *
210
- * @return {SearchBuilder} this
244
+ * 残酷な描写あり作品を抽出または除外します (iszankoku/notzankoku)。
245
+ * @param bool trueの場合、残酷な描写あり作品を抽出する (デフォルト: true)。falseの場合、除外する。
246
+ * @return {this}
211
247
  */
212
248
  isZankoku(bool = true): this {
213
249
  if (bool) {
@@ -219,8 +255,9 @@ export abstract class NovelSearchBuilderBase<
219
255
  }
220
256
 
221
257
  /**
222
- *
223
- * @return {SearchBuilder} this
258
+ * 異世界転生作品を抽出または除外します (istensei/nottensei)。
259
+ * @param bool trueの場合、異世界転生作品を抽出する (デフォルト: true)。falseの場合、除外する。
260
+ * @return {this}
224
261
  */
225
262
  isTensei(bool = true): this {
226
263
  if (bool) {
@@ -232,8 +269,9 @@ export abstract class NovelSearchBuilderBase<
232
269
  }
233
270
 
234
271
  /**
235
- *
236
- * @return {SearchBuilder} this
272
+ * 異世界転移作品を抽出または除外します (istenni/nottenni)。
273
+ * @param bool trueの場合、異世界転移作品を抽出する (デフォルト: true)。falseの場合、除外する。
274
+ * @return {this}
237
275
  */
238
276
  isTenni(bool = true): this {
239
277
  if (bool) {
@@ -245,8 +283,8 @@ export abstract class NovelSearchBuilderBase<
245
283
  }
246
284
 
247
285
  /**
248
- *
249
- * @return {SearchBuilder} this
286
+ * 異世界転生または異世界転移作品を抽出します (istt)。
287
+ * @return {this}
250
288
  */
251
289
  isTT(): this {
252
290
  this.set({ istt: BooleanNumber.True });
@@ -254,8 +292,10 @@ export abstract class NovelSearchBuilderBase<
254
292
  }
255
293
 
256
294
  /**
257
- *
258
- * @return {SearchBuilder} this
295
+ * 抽出する作品の文字数を指定します (length)。
296
+ * 範囲指定する場合は、最小文字数と最大文字数をハイフン(-)記号で区切ってください。
297
+ * @param length 文字数、または[最小文字数, 最大文字数]
298
+ * @return {this}
259
299
  */
260
300
  length(length: number | readonly number[]): this {
261
301
  this.set({ length: NovelSearchBuilderBase.array2string(length) });
@@ -263,10 +303,17 @@ export abstract class NovelSearchBuilderBase<
263
303
  }
264
304
 
265
305
  /**
266
- *
267
- * @return {SearchBuilder} this
306
+ * 抽出する作品の会話率を%単位で指定します (kaiwaritu)。
307
+ * @param num 会話率(%)
308
+ * @return {this}
268
309
  */
269
310
  kaiwaritu(num: number): this;
311
+ /**
312
+ * 抽出する作品の会話率を%単位で範囲指定します (kaiwaritu)。
313
+ * @param min 最低会話率(%)
314
+ * @param max 最高会話率(%)
315
+ * @return {this}
316
+ */
270
317
  kaiwaritu(min: number, max: number): this;
271
318
 
272
319
  kaiwaritu(min: number, max?: number): this {
@@ -281,8 +328,9 @@ export abstract class NovelSearchBuilderBase<
281
328
  }
282
329
 
283
330
  /**
284
- *
285
- * @return {SearchBuilder} this
331
+ * 抽出する作品の挿絵数を指定します (sasie)。
332
+ * @param num 挿絵数、または[最小挿絵数, 最大挿絵数]
333
+ * @return {this}
286
334
  */
287
335
  sasie(num: number | readonly number[]): this {
288
336
  this.set({ sasie: NovelSearchBuilderBase.array2string(num) });
@@ -290,8 +338,9 @@ export abstract class NovelSearchBuilderBase<
290
338
  }
291
339
 
292
340
  /**
293
- *
294
- * @return {SearchBuilder} this
341
+ * 抽出する作品の予想読了時間を分単位で指定します (time)。
342
+ * @param num 読了時間(分)、または[最小読了時間, 最大読了時間]
343
+ * @return {this}
295
344
  */
296
345
  time(num: number | readonly number[]): this {
297
346
  this.set({ time: NovelSearchBuilderBase.array2string(num) });
@@ -299,8 +348,9 @@ export abstract class NovelSearchBuilderBase<
299
348
  }
300
349
 
301
350
  /**
302
- *
303
- * @return {SearchBuilder} this
351
+ * Nコードを指定して取得します (ncode)。
352
+ * @param ncodes Nコード、またはNコードの配列
353
+ * @return {this}
304
354
  */
305
355
  ncode(ncodes: string | readonly string[]): this {
306
356
  this.set({ ncode: NovelSearchBuilderBase.array2string(ncodes) });
@@ -308,8 +358,9 @@ export abstract class NovelSearchBuilderBase<
308
358
  }
309
359
 
310
360
  /**
311
- *
312
- * @return {SearchBuilder} this
361
+ * 抽出する小説タイプを指定します (type)。
362
+ * @param type 小説タイプ (t: 短編, r: 連載中, er: 完結済連載小説, ter: 短編と完結済連載小説, re: 連載中と完結済連載小説)
363
+ * @return {this}
313
364
  */
314
365
  type(type: NovelTypeParam): this {
315
366
  this.set({ type });
@@ -317,8 +368,10 @@ export abstract class NovelSearchBuilderBase<
317
368
  }
318
369
 
319
370
  /**
320
- *
321
- * @return {SearchBuilder} this
371
+ * 抽出する作品の文体を指定します (buntai)。
372
+ * 複数指定する場合はハイフン(-)で区切ってください。
373
+ * @param buntai 文体コード、または文体コードの配列
374
+ * @return {this}
322
375
  */
323
376
  buntai(buntai: BuntaiParam | readonly BuntaiParam[]): this {
324
377
  this.set({ buntai: NovelSearchBuilderBase.array2string(buntai) });
@@ -326,8 +379,9 @@ export abstract class NovelSearchBuilderBase<
326
379
  }
327
380
 
328
381
  /**
329
- *
330
- * @return {SearchBuilder} this
382
+ * 連載停止中作品に関する指定をします (stop)。
383
+ * @param bool trueの場合、長期連載停止中のみ取得する (デフォルト: true)。falseの場合、長期連載停止中を除外する。
384
+ * @return {this}
331
385
  */
332
386
  isStop(bool = true): this {
333
387
  this.set({ stop: bool ? StopParam.Stopping : StopParam.NoStopping });
@@ -335,20 +389,33 @@ export abstract class NovelSearchBuilderBase<
335
389
  }
336
390
 
337
391
  /**
338
- *
339
- * @return {SearchBuilder} this
392
+ * ピックアップ作品のみを取得します (ispickup)。
393
+ * @return {this}
340
394
  */
341
- isPickup(bool = true): this {
342
- this.set({ ispickup: bool ? BooleanNumber.True : BooleanNumber.False });
395
+ isPickup(): this {
396
+ this.set({ ispickup: BooleanNumber.True });
343
397
  return this;
344
398
  }
345
399
 
346
400
  /**
347
- *
348
- * @return {SearchBuilder} this
401
+ * 最終更新日時を指定します (lastup)。
402
+ * @param date 最終更新日時 (YYYYMMDDhhmmss形式またはUNIXタイムスタンプ)
403
+ * @return {this}
349
404
  */
350
405
  lastUpdate(date: DateParam): this;
406
+ /**
407
+ * 最終更新日時の範囲を指定します (lastup)。
408
+ * @param from 開始日時 (UNIXタイムスタンプ)
409
+ * @param to 終了日時 (UNIXタイムスタンプ)
410
+ * @return {this}
411
+ */
351
412
  lastUpdate(from: number, to: number): this;
413
+ /**
414
+ * 最終更新日時の範囲を指定します (lastup)。
415
+ * @param from 開始日時 (Dateオブジェクト)
416
+ * @param to 終了日時 (Dateオブジェクト)
417
+ * @return {this}
418
+ */
352
419
  lastUpdate(from: Date, to: Date): this;
353
420
 
354
421
  lastUpdate(x: string | number | Date, y?: number | Date): this {
@@ -367,8 +434,25 @@ export abstract class NovelSearchBuilderBase<
367
434
  return this;
368
435
  }
369
436
 
437
+ /**
438
+ * 作品の更新日時を指定します (lastupdate)。
439
+ * @param date 作品の更新日時 (YYYYMMDDhhmmss形式またはUNIXタイムスタンプ)
440
+ * @return {this}
441
+ */
370
442
  lastNovelUpdate(date: DateParam): this;
443
+ /**
444
+ * 作品の更新日時の範囲を指定します (lastupdate)。
445
+ * @param from 開始日時 (UNIXタイムスタンプ)
446
+ * @param to 終了日時 (UNIXタイムスタンプ)
447
+ * @return {this}
448
+ */
371
449
  lastNovelUpdate(from: number, to: number): this;
450
+ /**
451
+ * 作品の更新日時の範囲を指定します (lastupdate)。
452
+ * @param from 開始日時 (Dateオブジェクト)
453
+ * @param to 終了日時 (Dateオブジェクト)
454
+ * @return {this}
455
+ */
372
456
  lastNovelUpdate(from: Date, to: Date): this;
373
457
 
374
458
  lastNovelUpdate(x: string | number | Date, y?: number | Date): this {
@@ -389,10 +473,13 @@ export abstract class NovelSearchBuilderBase<
389
473
 
390
474
  /**
391
475
  * なろう小説APIへの検索リクエストを実行する
476
+ * @param options 実行オプション
392
477
  * @returns {Promise<NarouSearchResults>} 検索結果
393
478
  */
394
- execute(): Promise<NarouSearchResults<NarouSearchResult, T>> {
395
- return this.api.executeNovel(this.params);
479
+ execute(
480
+ options?: ExecuteOptions
481
+ ): Promise<NarouSearchResults<NarouSearchResult, T>> {
482
+ return this.api.executeNovel(this.params, options);
396
483
  }
397
484
  }
398
485
 
@@ -405,8 +492,10 @@ export default class SearchBuilder<
405
492
  TOpt extends keyof NarouSearchResult = never,
406
493
  > extends NovelSearchBuilderBase<T | TOpt> {
407
494
  /**
408
- *
409
- * @return {SearchBuilder} this
495
+ * 大ジャンルを指定して取得します (biggenre)。
496
+ * 複数指定する場合はハイフン(-)で区切ってください。
497
+ * @param genre 大ジャンルコード、または大ジャンルコードの配列
498
+ * @return {this}
410
499
  */
411
500
  bigGenre(genre: BigGenre | readonly BigGenre[]): this {
412
501
  this.set({ biggenre: SearchBuilder.array2string(genre) });
@@ -414,8 +503,10 @@ export default class SearchBuilder<
414
503
  }
415
504
 
416
505
  /**
417
- *
418
- * @return {SearchBuilder} this
506
+ * 除外したい大ジャンルを指定します (notbiggenre)。
507
+ * 複数指定する場合はハイフン(-)で区切ってください。
508
+ * @param genre 除外する大ジャンルコード、または大ジャンルコードの配列
509
+ * @return {this}
419
510
  */
420
511
  notBigGenre(genre: BigGenre | readonly BigGenre[]): this {
421
512
  this.set({ notbiggenre: SearchBuilder.array2string(genre) });
@@ -423,8 +514,10 @@ export default class SearchBuilder<
423
514
  }
424
515
 
425
516
  /**
426
- *
427
- * @return {SearchBuilder} this
517
+ * ジャンルを指定して取得します (genre)。
518
+ * 複数指定する場合はハイフン(-)で区切ってください。
519
+ * @param genre ジャンルコード、またはジャンルコードの配列
520
+ * @return {this}
428
521
  */
429
522
  genre(genre: Genre | readonly Genre[]): this {
430
523
  this.set({ genre: SearchBuilder.array2string(genre) });
@@ -432,8 +525,10 @@ export default class SearchBuilder<
432
525
  }
433
526
 
434
527
  /**
435
- *
436
- * @return {SearchBuilder} this
528
+ * 除外したいジャンルを指定します (notgenre)。
529
+ * 複数指定する場合はハイフン(-)で区切ってください。
530
+ * @param genre 除外するジャンルコード、またはジャンルコードの配列
531
+ * @return {this}
437
532
  */
438
533
  notGenre(genre: Genre | readonly Genre[]): this {
439
534
  this.set({ notgenre: SearchBuilder.array2string(genre) });
@@ -441,8 +536,10 @@ export default class SearchBuilder<
441
536
  }
442
537
 
443
538
  /**
444
- *
445
- * @return {SearchBuilder} this
539
+ * ユーザIDを指定して取得します (userid)。
540
+ * 複数指定する場合はハイフン(-)で区切ってください。
541
+ * @param ids ユーザID、またはユーザIDの配列
542
+ * @return {this}
446
543
  */
447
544
  userId(ids: number | readonly number[]): this {
448
545
  this.set({ userid: SearchBuilder.array2string(ids) });
@@ -450,8 +547,9 @@ export default class SearchBuilder<
450
547
  }
451
548
 
452
549
  /**
453
- *
454
- * @return {SearchBuilder} this
550
+ * R15作品を抽出または除外します (isr15/notr15)。
551
+ * @param bool trueの場合、R15作品を抽出する (デフォルト: true)。falseの場合、除外する。
552
+ * @return {this}
455
553
  */
456
554
  isR15(bool = true): this {
457
555
  if (bool) {
@@ -463,8 +561,11 @@ export default class SearchBuilder<
463
561
  }
464
562
 
465
563
  /**
466
- *
467
- * @return {SearchBuilder} this
564
+ * 出力する項目を個別に指定します (of)。
565
+ * 未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
566
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
567
+ * @param fields 出力するフィールド名、またはフィールド名の配列
568
+ * @return {SearchBuilder<SearchResultFields<TFields>, TOpt>} 型が更新されたビルダー
468
569
  */
469
570
  fields<TFields extends Fields>(
470
571
  fields: TFields | readonly TFields[]
@@ -474,6 +575,12 @@ export default class SearchBuilder<
474
575
  return this as any;
475
576
  }
476
577
 
578
+ /**
579
+ * 出力オプション項目を指定します (opt)。
580
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
581
+ * @param option 出力するオプションフィールド名、またはオプションフィールド名の配列
582
+ * @return {SearchBuilder<T, SearchResultOptionalFields<TFields>>} 型が更新されたビルダー
583
+ */
477
584
  opt<TFields extends OptionalFields>(
478
585
  option: TFields | readonly TFields[]
479
586
  ): SearchBuilder<T, SearchResultOptionalFields<TFields>> {
@@ -5,6 +5,7 @@ import type {
5
5
  } from "./narou-search-results.js";
6
6
  import type { UserFields, UserOrder, UserSearchParams } from "./params.js";
7
7
  import { SearchBuilderBase } from "./search-builder.js";
8
+ import type { ExecuteOptions } from "./narou.js";
8
9
 
9
10
  /**
10
11
  * なろうユーザ検索API
@@ -102,9 +103,15 @@ export default class UserSearchBuilder<
102
103
 
103
104
  /**
104
105
  * なろう小説APIへのリクエストを実行する
106
+ * @param options 実行オプション
105
107
  * @returns ランキング
106
108
  */
107
- execute(): Promise<NarouSearchResults<UserSearchResult, TField>> {
108
- return this.api.executeUserSearch(this.params as UserSearchParams);
109
+ execute(
110
+ options?: ExecuteOptions
111
+ ): Promise<NarouSearchResults<UserSearchResult, TField>> {
112
+ return this.api.executeUserSearch(
113
+ this.params as UserSearchParams,
114
+ options
115
+ );
109
116
  }
110
117
  }
@@ -0,0 +1,38 @@
1
+ // 日付関連のユーティリティ関数
2
+
3
+ /**
4
+ * 文字列の日付(yyyyMMdd形式)をDateオブジェクトに変換する
5
+ * @param dateStr yyyyMMdd形式の日付文字列
6
+ * @returns Dateオブジェクト
7
+ */
8
+ export function parseDate(dateStr: string): Date {
9
+ const year = parseInt(dateStr.substring(0, 4), 10);
10
+ const month = parseInt(dateStr.substring(4, 6), 10) - 1; // JavaScriptの月は0から始まる
11
+ const day = parseInt(dateStr.substring(6, 8), 10);
12
+
13
+ return new Date(year, month, day, 0, 0, 0, 0);
14
+ }
15
+
16
+ /**
17
+ * 日付をyyyyMMdd形式の文字列に変換する
18
+ * @param date 日付
19
+ * @returns yyyyMMdd形式の文字列
20
+ */
21
+ export function formatDate(date: Date): string {
22
+ const year = date.getFullYear();
23
+ const month = String(date.getMonth() + 1).padStart(2, '0');
24
+ const day = String(date.getDate()).padStart(2, '0');
25
+ return `${year}${month}${day}`;
26
+ }
27
+
28
+ /**
29
+ * 指定された日数を加算した新しい日付を返す
30
+ * @param date 元の日付
31
+ * @param days 加算する日数
32
+ * @returns 新しい日付
33
+ */
34
+ export function addDays(date: Date, days: number): Date {
35
+ const result = new Date(date);
36
+ result.setDate(result.getDate() + days);
37
+ return result;
38
+ }