narou 1.0.0 → 1.2.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 (148) hide show
  1. package/README.md +7 -0
  2. package/dist/{chunk-RITMMCZE.js → chunk-3A5MHPWL.js} +1 -1
  3. package/dist/chunk-3A5MHPWL.js.map +1 -0
  4. package/dist/{chunk-6RIDVTFQ.js → chunk-5UDKQCPJ.js} +12 -2
  5. package/dist/chunk-5UDKQCPJ.js.map +1 -0
  6. package/dist/{chunk-UN3W2CT3.js → chunk-6BZWV4ZC.js} +6 -3
  7. package/dist/{chunk-UN3W2CT3.js.map → chunk-6BZWV4ZC.js.map} +1 -1
  8. package/dist/chunk-BQLSW236.js +117 -0
  9. package/dist/chunk-BQLSW236.js.map +1 -0
  10. package/dist/{chunk-DBCAWGIX.js → chunk-DEQICAN3.js} +2 -2
  11. package/dist/chunk-E2H3AJSQ.js +57 -0
  12. package/dist/chunk-E2H3AJSQ.js.map +1 -0
  13. package/dist/chunk-HOBLKBZ6.js +452 -0
  14. package/dist/chunk-HOBLKBZ6.js.map +1 -0
  15. package/dist/{chunk-TNDGN3EF.js → chunk-IPDEGCWU.js} +1 -1
  16. package/dist/chunk-IPDEGCWU.js.map +1 -0
  17. package/dist/{chunk-GAEL5UWA.js → chunk-LQLNWSWV.js} +4 -4
  18. package/dist/{chunk-GAEL5UWA.js.map → chunk-LQLNWSWV.js.map} +1 -1
  19. package/dist/{chunk-NP5NZV5Q.js → chunk-PLEM2AOH.js} +8 -5
  20. package/dist/chunk-PLEM2AOH.js.map +1 -0
  21. package/dist/chunk-RNHRR56W.js +25 -0
  22. package/dist/chunk-RNHRR56W.js.map +1 -0
  23. package/dist/{chunk-JMTNQTNC.js → chunk-VUZIISP2.js} +2 -3
  24. package/dist/chunk-VUZIISP2.js.map +1 -0
  25. package/dist/{chunk-XAUB42TO.js → chunk-VZVUANDN.js} +6 -4
  26. package/dist/chunk-VZVUANDN.js.map +1 -0
  27. package/dist/index.browser.cjs +245 -94
  28. package/dist/index.browser.cjs.map +1 -1
  29. package/dist/index.browser.d.cts +24 -9
  30. package/dist/index.browser.d.ts +24 -9
  31. package/dist/index.browser.js +16 -16
  32. package/dist/index.browser.js.map +1 -1
  33. package/dist/index.cjs +256 -103
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.common.cjs +241 -87
  36. package/dist/index.common.cjs.map +1 -1
  37. package/dist/index.common.d.cts +2 -2
  38. package/dist/index.common.d.ts +2 -2
  39. package/dist/index.common.js +11 -8
  40. package/dist/index.d.cts +15 -6
  41. package/dist/index.d.ts +15 -6
  42. package/dist/index.js +20 -20
  43. package/dist/index.js.map +1 -1
  44. package/dist/narou-DBa12V_l.d.ts +404 -0
  45. package/dist/narou-DCp4aGfA.d.cts +404 -0
  46. package/dist/narou-fetch.cjs +10 -5
  47. package/dist/narou-fetch.cjs.map +1 -1
  48. package/dist/narou-fetch.d.cts +4 -3
  49. package/dist/narou-fetch.d.ts +4 -3
  50. package/dist/narou-fetch.js +4 -4
  51. package/dist/narou-jsonp.cjs +5 -2
  52. package/dist/narou-jsonp.cjs.map +1 -1
  53. package/dist/narou-jsonp.d.cts +2 -2
  54. package/dist/narou-jsonp.d.ts +2 -2
  55. package/dist/narou-jsonp.js +4 -4
  56. package/dist/narou-ranking-results.d.cts +2 -2
  57. package/dist/narou-ranking-results.d.ts +2 -2
  58. package/dist/{narou-search-results-D_vbjc_I.d.cts → narou-search-results-C21hWrnL.d.cts} +30 -19
  59. package/dist/{narou-search-results-CvMcnYqe.d.ts → narou-search-results-DT0YdaBn.d.ts} +30 -19
  60. package/dist/narou-search-results.cjs.map +1 -1
  61. package/dist/narou-search-results.d.cts +1 -1
  62. package/dist/narou-search-results.d.ts +1 -1
  63. package/dist/narou-search-results.js +1 -1
  64. package/dist/narou.cjs +4 -1
  65. package/dist/narou.cjs.map +1 -1
  66. package/dist/narou.d.cts +2 -2
  67. package/dist/narou.d.ts +2 -2
  68. package/dist/narou.js +2 -2
  69. package/dist/params.cjs +12 -1
  70. package/dist/params.cjs.map +1 -1
  71. package/dist/params.d.cts +1 -1
  72. package/dist/params.d.ts +1 -1
  73. package/dist/params.js +3 -1
  74. package/dist/ranking-history.cjs +11 -3
  75. package/dist/ranking-history.cjs.map +1 -1
  76. package/dist/ranking-history.d.cts +12 -1
  77. package/dist/ranking-history.d.ts +12 -1
  78. package/dist/ranking-history.js +2 -1
  79. package/dist/ranking.cjs +201 -78
  80. package/dist/ranking.cjs.map +1 -1
  81. package/dist/ranking.d.cts +70 -9
  82. package/dist/ranking.d.ts +70 -9
  83. package/dist/ranking.js +4 -3
  84. package/dist/search-builder-r18.cjs +133 -60
  85. package/dist/search-builder-r18.cjs.map +1 -1
  86. package/dist/search-builder-r18.d.cts +19 -6
  87. package/dist/search-builder-r18.d.ts +19 -6
  88. package/dist/search-builder-r18.js +3 -3
  89. package/dist/search-builder.cjs +150 -70
  90. package/dist/search-builder.cjs.map +1 -1
  91. package/dist/search-builder.d.cts +2 -2
  92. package/dist/search-builder.d.ts +2 -2
  93. package/dist/search-builder.js +2 -2
  94. package/dist/user-search.cjs +37 -13
  95. package/dist/user-search.cjs.map +1 -1
  96. package/dist/user-search.d.cts +2 -2
  97. package/dist/user-search.d.ts +2 -2
  98. package/dist/user-search.js +3 -3
  99. package/dist/util/date.cjs +51 -0
  100. package/dist/util/date.cjs.map +1 -0
  101. package/dist/util/date.d.cts +21 -0
  102. package/dist/util/date.d.ts +21 -0
  103. package/dist/util/date.js +11 -0
  104. package/dist/util/date.js.map +1 -0
  105. package/dist/util/jsonp.cjs.map +1 -1
  106. package/dist/util/jsonp.d.cts +36 -0
  107. package/dist/util/jsonp.d.ts +36 -0
  108. package/dist/util/jsonp.js +1 -1
  109. package/dist/util/type.cjs.map +1 -1
  110. package/dist/util/type.d.cts +23 -0
  111. package/dist/util/type.d.ts +23 -0
  112. package/dist/util/unzipp.cjs +1 -2
  113. package/dist/util/unzipp.cjs.map +1 -1
  114. package/dist/util/unzipp.d.cts +9 -0
  115. package/dist/util/unzipp.d.ts +9 -0
  116. package/dist/util/unzipp.js +1 -1
  117. package/package.json +47 -46
  118. package/pnpm-lock.yaml +3041 -0
  119. package/src/index.browser.ts +21 -5
  120. package/src/index.ts +11 -2
  121. package/src/narou-fetch.ts +5 -2
  122. package/src/narou-jsonp.ts +1 -1
  123. package/src/narou-search-results.ts +2 -1
  124. package/src/narou.ts +4 -1
  125. package/src/params.ts +34 -18
  126. package/src/ranking-history.ts +13 -4
  127. package/src/ranking.ts +79 -15
  128. package/src/search-builder-r18.ts +17 -4
  129. package/src/search-builder.ts +203 -79
  130. package/src/util/date.ts +38 -0
  131. package/src/util/jsonp.ts +61 -6
  132. package/src/util/type.ts +23 -0
  133. package/src/util/unzipp.ts +9 -0
  134. package/dist/chunk-6RIDVTFQ.js.map +0 -1
  135. package/dist/chunk-JMTNQTNC.js.map +0 -1
  136. package/dist/chunk-NP5NZV5Q.js.map +0 -1
  137. package/dist/chunk-OJGRUQEQ.js +0 -372
  138. package/dist/chunk-OJGRUQEQ.js.map +0 -1
  139. package/dist/chunk-QQYQ4GQF.js +0 -83
  140. package/dist/chunk-QQYQ4GQF.js.map +0 -1
  141. package/dist/chunk-RITMMCZE.js.map +0 -1
  142. package/dist/chunk-TNDGN3EF.js.map +0 -1
  143. package/dist/chunk-XAUB42TO.js.map +0 -1
  144. package/dist/chunk-YJQXIVFD.js +0 -44
  145. package/dist/chunk-YJQXIVFD.js.map +0 -1
  146. package/dist/narou-CosGR0J9.d.cts +0 -298
  147. package/dist/narou-CutsOEgk.d.ts +0 -298
  148. /package/dist/{chunk-DBCAWGIX.js.map → chunk-DEQICAN3.js.map} +0 -0
@@ -24,6 +24,7 @@ __export(index_browser_exports, {
24
24
  BigGenreNotation: () => BigGenreNotation,
25
25
  BooleanNumber: () => BooleanNumber,
26
26
  BuntaiParam: () => BuntaiParam,
27
+ DateParam: () => DateParam,
27
28
  End: () => End,
28
29
  Fields: () => Fields,
29
30
  Genre: () => Genre,
@@ -148,7 +149,10 @@ var NarouNovel = class {
148
149
  * @see https://dev.syosetu.com/man/userapi/
149
150
  */
150
151
  async executeUserSearch(params) {
151
- return await this.execute(params, "https://api.syosetu.com/userapi/api/");
152
+ return new NarouSearchResults(
153
+ await this.execute(params, "https://api.syosetu.com/userapi/api/"),
154
+ params
155
+ );
152
156
  }
153
157
  };
154
158
 
@@ -194,7 +198,7 @@ var NarouNovelJsonp = class extends NarouNovel {
194
198
  query.gzip = 0;
195
199
  const url = new URL(endpoint);
196
200
  Object.entries(query).forEach(([key, value]) => {
197
- if (value) {
201
+ if (value !== void 0) {
198
202
  url.searchParams.append(key, value.toString());
199
203
  }
200
204
  });
@@ -429,7 +433,9 @@ var Order = {
429
433
  /** 四半期ポイントの高い順 */
430
434
  QuarterPoint: "quarterpoint",
431
435
  /** 年間ポイントの高い順 */
432
- YearlyPoint: "yearlypoint"
436
+ YearlyPoint: "yearlypoint",
437
+ /** 初回掲載順 */
438
+ GeneralFirstUp: "generalfirstup"
433
439
  };
434
440
  var R18Site = {
435
441
  /** ノクターンノベルズ(男性向け) */
@@ -564,6 +570,13 @@ var NovelTypeParam = {
564
570
  /** 短編と完結済連載小説 */
565
571
  ShortAndRensai: "ter"
566
572
  };
573
+ var DateParam = {
574
+ ThisWeek: "thisweek",
575
+ LastWeek: "lastweek",
576
+ SevenDays: "sevenday",
577
+ ThisMonth: "thismonth",
578
+ LastMonth: "lastmonth"
579
+ };
567
580
  var UserOrder = {
568
581
  /** ユーザIDの新しい順 */
569
582
  New: "new",
@@ -584,14 +597,30 @@ var SearchBuilderBase = class {
584
597
  /**
585
598
  * constructor
586
599
  * @private
600
+ * @param params クエリパラメータ
601
+ * @param api NarouNovel インスタンス
587
602
  */
588
603
  constructor(params = {}, api) {
589
604
  this.params = params;
590
605
  this.api = api;
591
606
  }
607
+ /**
608
+ * 配列から重複を除去する
609
+ * @protected
610
+ * @static
611
+ * @param array 配列
612
+ * @returns 重複を除去した配列
613
+ */
592
614
  static distinct(array) {
593
615
  return Array.from(new Set(array));
594
616
  }
617
+ /**
618
+ * 配列をハイフン区切りの文字列に変換する
619
+ * @protected
620
+ * @static
621
+ * @param n 文字列または数値の配列、あるいは単一の文字列または数値
622
+ * @returns ハイフン区切りの文字列
623
+ */
595
624
  static array2string(n) {
596
625
  if (Array.isArray(n)) {
597
626
  return this.distinct(n).join("-");
@@ -600,44 +629,48 @@ var SearchBuilderBase = class {
600
629
  }
601
630
  }
602
631
  /**
603
- *
604
- * @return {SearchBuilder} this
632
+ * 取得件数を指定する (lim)
633
+ * @param num 取得件数 (1-500)
634
+ * @return {this}
605
635
  */
606
636
  limit(num) {
607
637
  this.set({ lim: num });
608
638
  return this;
609
639
  }
610
640
  /**
611
- *
612
- * @return {SearchBuilder} this
641
+ * 取得開始位置を指定する (st)
642
+ * @param num 取得開始位置 (1-)
643
+ * @return {this}
613
644
  */
614
645
  start(num) {
615
646
  this.set({ st: num });
616
647
  return this;
617
648
  }
618
649
  /**
619
- *
620
- * @return {SearchBuilder} this
650
+ * ページ番号と1ページあたりの件数で取得範囲を指定する
651
+ * @param no ページ番号 (0-)
652
+ * @param count 1ページあたりの件数 (デフォルト: 20)
653
+ * @return {this}
621
654
  */
622
655
  page(no, count2 = 20) {
623
656
  return this.limit(count2).start(no * count2);
624
657
  }
625
658
  /**
626
- * 出力順序を指定する。指定しない場合は新着順となります。
627
- * old 古い順
659
+ * 出力順序を指定する (order)
660
+ * 指定しない場合は新着順となります。
628
661
  * @param {TOrder} order 出力順序
629
- * @return {SearchBuilder} this
662
+ * @return {this}
630
663
  */
631
664
  order(order) {
632
665
  this.set({ order });
633
666
  return this;
634
667
  }
635
668
  /**
636
- * gzip圧縮する。
669
+ * gzip圧縮レベルを指定する (gzip)
637
670
  *
638
671
  * 転送量上限を減らすためにも推奨
639
672
  * @param {GzipLevel} level gzip圧縮レベル(1~5)
640
- * @return {SearchBuilder} this
673
+ * @return {this}
641
674
  */
642
675
  gzip(level) {
643
676
  this.set({ gzip: level });
@@ -645,8 +678,9 @@ var SearchBuilderBase = class {
645
678
  }
646
679
  /**
647
680
  * クエリパラメータをセットする
648
- * @private
649
- * @return {SearchBuilder} this
681
+ * @protected
682
+ * @param obj セットするパラメータ
683
+ * @return {this}
650
684
  */
651
685
  set(obj) {
652
686
  this.params = { ...this.params, ...obj };
@@ -654,6 +688,9 @@ var SearchBuilderBase = class {
654
688
  }
655
689
  /**
656
690
  * クエリパラメータを削除する
691
+ * @protected
692
+ * @param key 削除するパラメータのキー
693
+ * @returns {this}
657
694
  */
658
695
  unset(key) {
659
696
  delete this.params[key];
@@ -662,56 +699,65 @@ var SearchBuilderBase = class {
662
699
  };
663
700
  var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilderBase {
664
701
  /**
665
- * a
666
- * @return {SearchBuilder} this
702
+ * 検索語を指定します (word)。
703
+ * 半角または全角スペースで区切るとAND抽出になります。部分一致でHITします。
704
+ * @param word 検索語
705
+ * @return {this}
667
706
  */
668
707
  word(word) {
669
708
  this.set({ word });
670
709
  return this;
671
710
  }
672
711
  /**
673
- *
674
- * @return {SearchBuilder} this
712
+ * 除外したい単語を指定します (notword)。
713
+ * スペースで区切ることにより除外する単語を増やせます。部分一致で除外されます。
714
+ * @param word 除外語
715
+ * @return {this}
675
716
  */
676
717
  notWord(word) {
677
718
  this.set({ notword: word });
678
719
  return this;
679
720
  }
680
721
  /**
681
- *
682
- * @return {SearchBuilder} this
722
+ * 検索対象を作品名に限定するかどうかを指定します (title)。
723
+ * @param bool trueの場合、作品名を検索対象とする (デフォルト: true)
724
+ * @return {this}
683
725
  */
684
726
  byTitle(bool = true) {
685
727
  this.set({ title: bool ? BooleanNumber.True : BooleanNumber.False });
686
728
  return this;
687
729
  }
688
730
  /**
689
- *
690
- * @return {SearchBuilder} this
731
+ * 検索対象をあらすじに限定するかどうかを指定します (ex)。
732
+ * @param bool trueの場合、あらすじを検索対象とする (デフォルト: true)
733
+ * @return {this}
691
734
  */
692
735
  byOutline(bool = true) {
693
736
  this.set({ ex: bool ? BooleanNumber.True : BooleanNumber.False });
694
737
  return this;
695
738
  }
696
739
  /**
697
- *
698
- * @return {SearchBuilder} this
740
+ * 検索対象をキーワードに限定するかどうかを指定します (keyword)。
741
+ * @param bool trueの場合、キーワードを検索対象とする (デフォルト: true)
742
+ * @return {this}
699
743
  */
700
744
  byKeyword(bool = true) {
701
745
  this.set({ keyword: bool ? BooleanNumber.True : BooleanNumber.False });
702
746
  return this;
703
747
  }
704
748
  /**
705
- *
706
- * @return {SearchBuilder} this
749
+ * 検索対象を作者名に限定するかどうかを指定します (wname)。
750
+ * @param bool trueの場合、作者名を検索対象とする (デフォルト: true)
751
+ * @return {this}
707
752
  */
708
753
  byAuthor(bool = true) {
709
754
  this.set({ wname: bool ? BooleanNumber.True : BooleanNumber.False });
710
755
  return this;
711
756
  }
712
757
  /**
713
- *
714
- * @return {SearchBuilder} this
758
+ * ボーイズラブ作品を抽出または除外します (isbl/notbl)。
759
+ * @param bool trueの場合、ボーイズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
760
+ * @return {this}
715
761
  */
716
762
  isBL(bool = true) {
717
763
  if (bool) {
@@ -722,8 +768,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
722
768
  return this;
723
769
  }
724
770
  /**
725
- *
726
- * @return {SearchBuilder} this
771
+ * ガールズラブ作品を抽出または除外します (isgl/notgl)。
772
+ * @param bool trueの場合、ガールズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
773
+ * @return {this}
727
774
  */
728
775
  isGL(bool = true) {
729
776
  if (bool) {
@@ -734,8 +781,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
734
781
  return this;
735
782
  }
736
783
  /**
737
- *
738
- * @return {SearchBuilder} this
784
+ * 残酷な描写あり作品を抽出または除外します (iszankoku/notzankoku)。
785
+ * @param bool trueの場合、残酷な描写あり作品を抽出する (デフォルト: true)。falseの場合、除外する。
786
+ * @return {this}
739
787
  */
740
788
  isZankoku(bool = true) {
741
789
  if (bool) {
@@ -746,8 +794,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
746
794
  return this;
747
795
  }
748
796
  /**
749
- *
750
- * @return {SearchBuilder} this
797
+ * 異世界転生作品を抽出または除外します (istensei/nottensei)。
798
+ * @param bool trueの場合、異世界転生作品を抽出する (デフォルト: true)。falseの場合、除外する。
799
+ * @return {this}
751
800
  */
752
801
  isTensei(bool = true) {
753
802
  if (bool) {
@@ -758,8 +807,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
758
807
  return this;
759
808
  }
760
809
  /**
761
- *
762
- * @return {SearchBuilder} this
810
+ * 異世界転移作品を抽出または除外します (istenni/nottenni)。
811
+ * @param bool trueの場合、異世界転移作品を抽出する (デフォルト: true)。falseの場合、除外する。
812
+ * @return {this}
763
813
  */
764
814
  isTenni(bool = true) {
765
815
  if (bool) {
@@ -770,16 +820,18 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
770
820
  return this;
771
821
  }
772
822
  /**
773
- *
774
- * @return {SearchBuilder} this
823
+ * 異世界転生または異世界転移作品を抽出します (istt)。
824
+ * @return {this}
775
825
  */
776
826
  isTT() {
777
827
  this.set({ istt: BooleanNumber.True });
778
828
  return this;
779
829
  }
780
830
  /**
781
- *
782
- * @return {SearchBuilder} this
831
+ * 抽出する作品の文字数を指定します (length)。
832
+ * 範囲指定する場合は、最小文字数と最大文字数をハイフン(-)記号で区切ってください。
833
+ * @param length 文字数、または[最小文字数, 最大文字数]
834
+ * @return {this}
783
835
  */
784
836
  length(length) {
785
837
  this.set({ length: _NovelSearchBuilderBase.array2string(length) });
@@ -796,59 +848,66 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
796
848
  return this;
797
849
  }
798
850
  /**
799
- *
800
- * @return {SearchBuilder} this
851
+ * 抽出する作品の挿絵数を指定します (sasie)。
852
+ * @param num 挿絵数、または[最小挿絵数, 最大挿絵数]
853
+ * @return {this}
801
854
  */
802
855
  sasie(num) {
803
856
  this.set({ sasie: _NovelSearchBuilderBase.array2string(num) });
804
857
  return this;
805
858
  }
806
859
  /**
807
- *
808
- * @return {SearchBuilder} this
860
+ * 抽出する作品の予想読了時間を分単位で指定します (time)。
861
+ * @param num 読了時間(分)、または[最小読了時間, 最大読了時間]
862
+ * @return {this}
809
863
  */
810
864
  time(num) {
811
865
  this.set({ time: _NovelSearchBuilderBase.array2string(num) });
812
866
  return this;
813
867
  }
814
868
  /**
815
- *
816
- * @return {SearchBuilder} this
869
+ * Nコードを指定して取得します (ncode)。
870
+ * @param ncodes Nコード、またはNコードの配列
871
+ * @return {this}
817
872
  */
818
873
  ncode(ncodes) {
819
874
  this.set({ ncode: _NovelSearchBuilderBase.array2string(ncodes) });
820
875
  return this;
821
876
  }
822
877
  /**
823
- *
824
- * @return {SearchBuilder} this
878
+ * 抽出する小説タイプを指定します (type)。
879
+ * @param type 小説タイプ (t: 短編, r: 連載中, er: 完結済連載小説, ter: 短編と完結済連載小説, re: 連載中と完結済連載小説)
880
+ * @return {this}
825
881
  */
826
882
  type(type) {
827
883
  this.set({ type });
828
884
  return this;
829
885
  }
830
886
  /**
831
- *
832
- * @return {SearchBuilder} this
887
+ * 抽出する作品の文体を指定します (buntai)。
888
+ * 複数指定する場合はハイフン(-)で区切ってください。
889
+ * @param buntai 文体コード、または文体コードの配列
890
+ * @return {this}
833
891
  */
834
892
  buntai(buntai) {
835
893
  this.set({ buntai: _NovelSearchBuilderBase.array2string(buntai) });
836
894
  return this;
837
895
  }
838
896
  /**
839
- *
840
- * @return {SearchBuilder} this
897
+ * 連載停止中作品に関する指定をします (stop)。
898
+ * @param bool trueの場合、長期連載停止中のみ取得する (デフォルト: true)。falseの場合、長期連載停止中を除外する。
899
+ * @return {this}
841
900
  */
842
901
  isStop(bool = true) {
843
902
  this.set({ stop: bool ? StopParam.Stopping : StopParam.NoStopping });
844
903
  return this;
845
904
  }
846
905
  /**
847
- *
848
- * @return {SearchBuilder} this
906
+ * ピックアップ作品のみを取得します (ispickup)。
907
+ * @return {this}
849
908
  */
850
- isPickup(bool = true) {
851
- this.set({ ispickup: bool ? BooleanNumber.True : BooleanNumber.False });
909
+ isPickup() {
910
+ this.set({ ispickup: BooleanNumber.True });
852
911
  return this;
853
912
  }
854
913
  lastUpdate(x, y) {
@@ -857,7 +916,7 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
857
916
  date = x;
858
917
  } else if (x instanceof Date && y instanceof Date) {
859
918
  date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
860
- x.getTime() / 1e3
919
+ y.getTime() / 1e3
861
920
  )}`;
862
921
  } else {
863
922
  date = `${x}-${y}`;
@@ -865,6 +924,20 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
865
924
  this.set({ lastup: date });
866
925
  return this;
867
926
  }
927
+ lastNovelUpdate(x, y) {
928
+ let date;
929
+ if (typeof x == "string") {
930
+ date = x;
931
+ } else if (x instanceof Date && y instanceof Date) {
932
+ date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
933
+ y.getTime() / 1e3
934
+ )}`;
935
+ } else {
936
+ date = `${x}-${y}`;
937
+ }
938
+ this.set({ lastupdate: date });
939
+ return this;
940
+ }
868
941
  /**
869
942
  * なろう小説APIへの検索リクエストを実行する
870
943
  * @returns {Promise<NarouSearchResults>} 検索結果
@@ -875,48 +948,59 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
875
948
  };
876
949
  var SearchBuilder = class _SearchBuilder extends NovelSearchBuilderBase {
877
950
  /**
878
- *
879
- * @return {SearchBuilder} this
951
+ * 大ジャンルを指定して取得します (biggenre)。
952
+ * 複数指定する場合はハイフン(-)で区切ってください。
953
+ * @param genre 大ジャンルコード、または大ジャンルコードの配列
954
+ * @return {this}
880
955
  */
881
956
  bigGenre(genre) {
882
957
  this.set({ biggenre: _SearchBuilder.array2string(genre) });
883
958
  return this;
884
959
  }
885
960
  /**
886
- *
887
- * @return {SearchBuilder} this
961
+ * 除外したい大ジャンルを指定します (notbiggenre)。
962
+ * 複数指定する場合はハイフン(-)で区切ってください。
963
+ * @param genre 除外する大ジャンルコード、または大ジャンルコードの配列
964
+ * @return {this}
888
965
  */
889
966
  notBigGenre(genre) {
890
967
  this.set({ notbiggenre: _SearchBuilder.array2string(genre) });
891
968
  return this;
892
969
  }
893
970
  /**
894
- *
895
- * @return {SearchBuilder} this
971
+ * ジャンルを指定して取得します (genre)。
972
+ * 複数指定する場合はハイフン(-)で区切ってください。
973
+ * @param genre ジャンルコード、またはジャンルコードの配列
974
+ * @return {this}
896
975
  */
897
976
  genre(genre) {
898
977
  this.set({ genre: _SearchBuilder.array2string(genre) });
899
978
  return this;
900
979
  }
901
980
  /**
902
- *
903
- * @return {SearchBuilder} this
981
+ * 除外したいジャンルを指定します (notgenre)。
982
+ * 複数指定する場合はハイフン(-)で区切ってください。
983
+ * @param genre 除外するジャンルコード、またはジャンルコードの配列
984
+ * @return {this}
904
985
  */
905
986
  notGenre(genre) {
906
987
  this.set({ notgenre: _SearchBuilder.array2string(genre) });
907
988
  return this;
908
989
  }
909
990
  /**
910
- *
911
- * @return {SearchBuilder} this
991
+ * ユーザIDを指定して取得します (userid)。
992
+ * 複数指定する場合はハイフン(-)で区切ってください。
993
+ * @param ids ユーザID、またはユーザIDの配列
994
+ * @return {this}
912
995
  */
913
996
  userId(ids) {
914
997
  this.set({ userid: _SearchBuilder.array2string(ids) });
915
998
  return this;
916
999
  }
917
1000
  /**
918
- *
919
- * @return {SearchBuilder} this
1001
+ * R15作品を抽出または除外します (isr15/notr15)。
1002
+ * @param bool trueの場合、R15作品を抽出する (デフォルト: true)。falseの場合、除外する。
1003
+ * @return {this}
920
1004
  */
921
1005
  isR15(bool = true) {
922
1006
  if (bool) {
@@ -927,13 +1011,22 @@ var SearchBuilder = class _SearchBuilder extends NovelSearchBuilderBase {
927
1011
  return this;
928
1012
  }
929
1013
  /**
930
- *
931
- * @return {SearchBuilder} this
1014
+ * 出力する項目を個別に指定します (of)。
1015
+ * 未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
1016
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
1017
+ * @param fields 出力するフィールド名、またはフィールド名の配列
1018
+ * @return {SearchBuilder<SearchResultFields<TFields>, TOpt>} 型が更新されたビルダー
932
1019
  */
933
1020
  fields(fields) {
934
1021
  this.set({ of: _SearchBuilder.array2string(fields) });
935
1022
  return this;
936
1023
  }
1024
+ /**
1025
+ * 出力オプション項目を指定します (opt)。
1026
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
1027
+ * @param option 出力するオプションフィールド名、またはオプションフィールド名の配列
1028
+ * @return {SearchBuilder<T, SearchResultOptionalFields<TFields>>} 型が更新されたビルダー
1029
+ */
937
1030
  opt(option) {
938
1031
  this.set({ opt: _SearchBuilder.array2string(option) });
939
1032
  return this;
@@ -950,50 +1043,99 @@ var SearchBuilderR18 = class extends NovelSearchBuilderBase {
950
1043
  execute() {
951
1044
  return this.api.executeNovel18(this.params);
952
1045
  }
1046
+ /**
1047
+ * 抽出するR18サイトを指定します (nocgenre)。
1048
+ * @param sites R18サイトコード、またはR18サイトコードの配列 (1: ノクターンノベルズ, 2: ムーンライトノベルズ(男性向け), 3: ムーンライトノベルズ(BL), 4: ミッドナイトノベルズ)
1049
+ * @return {this}
1050
+ */
953
1051
  r18Site(sites) {
954
1052
  this.set({ nocgenre: NovelSearchBuilderBase.array2string(sites) });
955
1053
  return this;
956
1054
  }
957
1055
  /**
958
- *
959
- * @return {SearchBuilder} this
1056
+ * X-IDを指定して取得します (xid)。
1057
+ * @param ids X-ID、またはX-IDの配列
1058
+ * @return {this}
960
1059
  */
961
1060
  xid(ids) {
962
1061
  this.set({ xid: NovelSearchBuilderBase.array2string(ids) });
963
1062
  return this;
964
1063
  }
965
1064
  /**
966
- *
967
- * @return {SearchBuilder} this
1065
+ * 出力する項目を個別に指定します (of)。
1066
+ * 未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
1067
+ * @param fields 出力するR18フィールド名、またはR18フィールド名の配列
1068
+ * @return {SearchBuilderR18<SearchResultR18Fields<R18Fields>>} 型が更新されたビルダー
968
1069
  */
969
1070
  fields(fields) {
970
1071
  this.set({ of: NovelSearchBuilderBase.array2string(fields) });
971
1072
  return this;
972
1073
  }
1074
+ /**
1075
+ * 出力オプション項目を指定します (opt)。
1076
+ * @param option 出力するオプションフィールド名、またはオプションフィールド名の配列
1077
+ * @return {SearchBuilderR18<T, SearchResultOptionalFields<TFields>>} 型が更新されたビルダー
1078
+ */
973
1079
  opt(option) {
974
1080
  this.set({ opt: NovelSearchBuilderBase.array2string(option) });
975
1081
  return this;
976
1082
  }
977
1083
  };
978
1084
 
1085
+ // src/util/date.ts
1086
+ function parseDate(dateStr) {
1087
+ const year = parseInt(dateStr.substring(0, 4), 10);
1088
+ const month = parseInt(dateStr.substring(4, 6), 10) - 1;
1089
+ const day = parseInt(dateStr.substring(6, 8), 10);
1090
+ return new Date(year, month, day, 0, 0, 0, 0);
1091
+ }
1092
+ function formatDate(date) {
1093
+ const year = date.getFullYear();
1094
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1095
+ const day = String(date.getDate()).padStart(2, "0");
1096
+ return `${year}${month}${day}`;
1097
+ }
1098
+ function addDays(date, days) {
1099
+ const result = new Date(date);
1100
+ result.setDate(result.getDate() + days);
1101
+ return result;
1102
+ }
1103
+
979
1104
  // src/ranking.ts
980
- var import_date_fns = require("date-fns");
981
- var dateFormat = "yyyyMMdd";
982
1105
  var RankingBuilder = class {
983
1106
  /**
984
1107
  * constructor
1108
+ * @param params - 初期クエリパラメータ
1109
+ * @param api - API実行クラスのインスタンス
985
1110
  * @private
986
1111
  */
987
1112
  constructor(params = {}, api) {
988
1113
  this.params = params;
989
1114
  this.api = api;
990
- this.date$ = (0, import_date_fns.addDays)(Date.now(), -1);
1115
+ this.date$ = addDays(/* @__PURE__ */ new Date(), -1);
991
1116
  this.type$ = RankingType.Daily;
992
1117
  }
1118
+ /**
1119
+ * ランキング集計対象の日付を指定します。
1120
+ *
1121
+ * - 日間: 任意の日付
1122
+ * - 週間: 火曜日の日付
1123
+ * - 月間・四半期: 1日の日付
1124
+ *
1125
+ * @param date 集計対象の日付
1126
+ * @returns {RankingBuilder} this
1127
+ * @see https://dev.syosetu.com/man/rankapi/
1128
+ */
993
1129
  date(date) {
994
1130
  this.date$ = date;
995
1131
  return this;
996
1132
  }
1133
+ /**
1134
+ * ランキング種別を指定します。
1135
+ * @param type ランキング種別
1136
+ * @returns {RankingBuilder} this
1137
+ * @see https://dev.syosetu.com/man/rankapi/
1138
+ */
997
1139
  type(type) {
998
1140
  this.type$ = type;
999
1141
  return this;
@@ -1010,23 +1152,36 @@ var RankingBuilder = class {
1010
1152
  return this;
1011
1153
  }
1012
1154
  /**
1013
- * クエリパラメータをセットする
1155
+ * クエリパラメータを内部的にセットします。
1156
+ * @param obj - セットするパラメータオブジェクト
1157
+ * @returns {RankingBuilder} this
1014
1158
  * @private
1015
- * @return {RankingBuilder} this
1016
1159
  */
1017
1160
  set(obj) {
1018
1161
  Object.assign(this.params, obj);
1019
1162
  return this;
1020
1163
  }
1021
1164
  /**
1022
- * なろう小説APIへのリクエストを実行する
1023
- * @returns ランキング
1165
+ * 設定されたパラメータに基づき、なろう小説ランキングAPIへのリクエストを実行します。
1166
+ *
1167
+ * 返される結果には、Nコード、ポイント、順位が含まれます。
1168
+ * @returns {Promise<NarouRankingResult[]>} ランキング結果の配列
1169
+ * @see https://dev.syosetu.com/man/rankapi/#output
1024
1170
  */
1025
1171
  execute() {
1026
- const date = (0, import_date_fns.format)(this.date$, dateFormat);
1172
+ const date = formatDate(this.date$);
1027
1173
  this.set({ rtype: `${date}-${this.type$}` });
1028
1174
  return this.api.executeRanking(this.params);
1029
1175
  }
1176
+ /**
1177
+ * ランキングAPIを実行し、取得したNコードを元になろう小説APIで詳細情報を取得して結合します。
1178
+ *
1179
+ * @template TFields - 取得する小説情報のフィールド型
1180
+ * @template TOpt - オプショナルな取得フィールドの型
1181
+ * @param fields - 取得するフィールドの配列 (省略時はデフォルトフィールド)
1182
+ * @param opt - オプショナルな取得フィールド (`weekly` など)
1183
+ * @returns {Promise<RankingResult<SearchResultFields<TFields>>[]>} 詳細情報を含むランキング結果の配列
1184
+ */
1030
1185
  async executeWithFields(fields = [], opt) {
1031
1186
  const ranking2 = await this.execute();
1032
1187
  const fields$ = Array.isArray(fields) ? fields.length == 0 ? [] : [...fields, Fields.ncode] : [fields, Fields.ncode];
@@ -1048,12 +1203,10 @@ var RankingBuilder = class {
1048
1203
  };
1049
1204
 
1050
1205
  // src/ranking-history.ts
1051
- var import_date_fns2 = require("date-fns");
1052
- var dateFormat2 = "yyyyMMdd";
1053
1206
  function formatRankingHistory(rankin) {
1054
1207
  const { rtype, pt, rank } = rankin;
1055
1208
  const [_date, _type] = rtype.split("-");
1056
- const date = (0, import_date_fns2.parse)(_date, dateFormat2, /* @__PURE__ */ new Date());
1209
+ const date = parseDate(_date);
1057
1210
  const type = _type;
1058
1211
  return { type, date, pt, rank };
1059
1212
  }
@@ -1148,20 +1301,17 @@ var UserSearchBuilder = class _UserSearchBuilder extends SearchBuilderBase {
1148
1301
  var narouNovelJsonp = new NarouNovelJsonp();
1149
1302
  function search(word = "", api = narouNovelJsonp) {
1150
1303
  const builder = new SearchBuilder({}, api);
1151
- if (word != "")
1152
- builder.word(word);
1304
+ if (word != "") builder.word(word);
1153
1305
  return builder;
1154
1306
  }
1155
1307
  function searchR18(word = "", api = narouNovelJsonp) {
1156
1308
  const builder = new SearchBuilderR18({}, api);
1157
- if (word != "")
1158
- builder.word(word);
1309
+ if (word != "") builder.word(word);
1159
1310
  return builder;
1160
1311
  }
1161
1312
  function searchUser(word = "", api = narouNovelJsonp) {
1162
1313
  const builder = new UserSearchBuilder({}, api);
1163
- if (word != "")
1164
- builder.word(word);
1314
+ if (word != "") builder.word(word);
1165
1315
  return builder;
1166
1316
  }
1167
1317
  function ranking(api = narouNovelJsonp) {
@@ -1189,6 +1339,7 @@ var index_browser_default = {
1189
1339
  BigGenreNotation,
1190
1340
  BooleanNumber,
1191
1341
  BuntaiParam,
1342
+ DateParam,
1192
1343
  End,
1193
1344
  Fields,
1194
1345
  Genre,