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_common_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,
@@ -141,7 +142,10 @@ var NarouNovel = class {
141
142
  * @see https://dev.syosetu.com/man/userapi/
142
143
  */
143
144
  async executeUserSearch(params) {
144
- return await this.execute(params, "https://api.syosetu.com/userapi/api/");
145
+ return new NarouSearchResults(
146
+ await this.execute(params, "https://api.syosetu.com/userapi/api/"),
147
+ params
148
+ );
145
149
  }
146
150
  };
147
151
 
@@ -372,7 +376,9 @@ var Order = {
372
376
  /** 四半期ポイントの高い順 */
373
377
  QuarterPoint: "quarterpoint",
374
378
  /** 年間ポイントの高い順 */
375
- YearlyPoint: "yearlypoint"
379
+ YearlyPoint: "yearlypoint",
380
+ /** 初回掲載順 */
381
+ GeneralFirstUp: "generalfirstup"
376
382
  };
377
383
  var R18Site = {
378
384
  /** ノクターンノベルズ(男性向け) */
@@ -507,6 +513,13 @@ var NovelTypeParam = {
507
513
  /** 短編と完結済連載小説 */
508
514
  ShortAndRensai: "ter"
509
515
  };
516
+ var DateParam = {
517
+ ThisWeek: "thisweek",
518
+ LastWeek: "lastweek",
519
+ SevenDays: "sevenday",
520
+ ThisMonth: "thismonth",
521
+ LastMonth: "lastmonth"
522
+ };
510
523
  var UserOrder = {
511
524
  /** ユーザIDの新しい順 */
512
525
  New: "new",
@@ -527,14 +540,30 @@ var SearchBuilderBase = class {
527
540
  /**
528
541
  * constructor
529
542
  * @private
543
+ * @param params クエリパラメータ
544
+ * @param api NarouNovel インスタンス
530
545
  */
531
546
  constructor(params = {}, api) {
532
547
  this.params = params;
533
548
  this.api = api;
534
549
  }
550
+ /**
551
+ * 配列から重複を除去する
552
+ * @protected
553
+ * @static
554
+ * @param array 配列
555
+ * @returns 重複を除去した配列
556
+ */
535
557
  static distinct(array) {
536
558
  return Array.from(new Set(array));
537
559
  }
560
+ /**
561
+ * 配列をハイフン区切りの文字列に変換する
562
+ * @protected
563
+ * @static
564
+ * @param n 文字列または数値の配列、あるいは単一の文字列または数値
565
+ * @returns ハイフン区切りの文字列
566
+ */
538
567
  static array2string(n) {
539
568
  if (Array.isArray(n)) {
540
569
  return this.distinct(n).join("-");
@@ -543,44 +572,48 @@ var SearchBuilderBase = class {
543
572
  }
544
573
  }
545
574
  /**
546
- *
547
- * @return {SearchBuilder} this
575
+ * 取得件数を指定する (lim)
576
+ * @param num 取得件数 (1-500)
577
+ * @return {this}
548
578
  */
549
579
  limit(num) {
550
580
  this.set({ lim: num });
551
581
  return this;
552
582
  }
553
583
  /**
554
- *
555
- * @return {SearchBuilder} this
584
+ * 取得開始位置を指定する (st)
585
+ * @param num 取得開始位置 (1-)
586
+ * @return {this}
556
587
  */
557
588
  start(num) {
558
589
  this.set({ st: num });
559
590
  return this;
560
591
  }
561
592
  /**
562
- *
563
- * @return {SearchBuilder} this
593
+ * ページ番号と1ページあたりの件数で取得範囲を指定する
594
+ * @param no ページ番号 (0-)
595
+ * @param count 1ページあたりの件数 (デフォルト: 20)
596
+ * @return {this}
564
597
  */
565
598
  page(no, count = 20) {
566
599
  return this.limit(count).start(no * count);
567
600
  }
568
601
  /**
569
- * 出力順序を指定する。指定しない場合は新着順となります。
570
- * old 古い順
602
+ * 出力順序を指定する (order)
603
+ * 指定しない場合は新着順となります。
571
604
  * @param {TOrder} order 出力順序
572
- * @return {SearchBuilder} this
605
+ * @return {this}
573
606
  */
574
607
  order(order) {
575
608
  this.set({ order });
576
609
  return this;
577
610
  }
578
611
  /**
579
- * gzip圧縮する。
612
+ * gzip圧縮レベルを指定する (gzip)
580
613
  *
581
614
  * 転送量上限を減らすためにも推奨
582
615
  * @param {GzipLevel} level gzip圧縮レベル(1~5)
583
- * @return {SearchBuilder} this
616
+ * @return {this}
584
617
  */
585
618
  gzip(level) {
586
619
  this.set({ gzip: level });
@@ -588,8 +621,9 @@ var SearchBuilderBase = class {
588
621
  }
589
622
  /**
590
623
  * クエリパラメータをセットする
591
- * @private
592
- * @return {SearchBuilder} this
624
+ * @protected
625
+ * @param obj セットするパラメータ
626
+ * @return {this}
593
627
  */
594
628
  set(obj) {
595
629
  this.params = { ...this.params, ...obj };
@@ -597,6 +631,9 @@ var SearchBuilderBase = class {
597
631
  }
598
632
  /**
599
633
  * クエリパラメータを削除する
634
+ * @protected
635
+ * @param key 削除するパラメータのキー
636
+ * @returns {this}
600
637
  */
601
638
  unset(key) {
602
639
  delete this.params[key];
@@ -605,56 +642,65 @@ var SearchBuilderBase = class {
605
642
  };
606
643
  var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilderBase {
607
644
  /**
608
- * a
609
- * @return {SearchBuilder} this
645
+ * 検索語を指定します (word)。
646
+ * 半角または全角スペースで区切るとAND抽出になります。部分一致でHITします。
647
+ * @param word 検索語
648
+ * @return {this}
610
649
  */
611
650
  word(word) {
612
651
  this.set({ word });
613
652
  return this;
614
653
  }
615
654
  /**
616
- *
617
- * @return {SearchBuilder} this
655
+ * 除外したい単語を指定します (notword)。
656
+ * スペースで区切ることにより除外する単語を増やせます。部分一致で除外されます。
657
+ * @param word 除外語
658
+ * @return {this}
618
659
  */
619
660
  notWord(word) {
620
661
  this.set({ notword: word });
621
662
  return this;
622
663
  }
623
664
  /**
624
- *
625
- * @return {SearchBuilder} this
665
+ * 検索対象を作品名に限定するかどうかを指定します (title)。
666
+ * @param bool trueの場合、作品名を検索対象とする (デフォルト: true)
667
+ * @return {this}
626
668
  */
627
669
  byTitle(bool = true) {
628
670
  this.set({ title: bool ? BooleanNumber.True : BooleanNumber.False });
629
671
  return this;
630
672
  }
631
673
  /**
632
- *
633
- * @return {SearchBuilder} this
674
+ * 検索対象をあらすじに限定するかどうかを指定します (ex)。
675
+ * @param bool trueの場合、あらすじを検索対象とする (デフォルト: true)
676
+ * @return {this}
634
677
  */
635
678
  byOutline(bool = true) {
636
679
  this.set({ ex: bool ? BooleanNumber.True : BooleanNumber.False });
637
680
  return this;
638
681
  }
639
682
  /**
640
- *
641
- * @return {SearchBuilder} this
683
+ * 検索対象をキーワードに限定するかどうかを指定します (keyword)。
684
+ * @param bool trueの場合、キーワードを検索対象とする (デフォルト: true)
685
+ * @return {this}
642
686
  */
643
687
  byKeyword(bool = true) {
644
688
  this.set({ keyword: bool ? BooleanNumber.True : BooleanNumber.False });
645
689
  return this;
646
690
  }
647
691
  /**
648
- *
649
- * @return {SearchBuilder} this
692
+ * 検索対象を作者名に限定するかどうかを指定します (wname)。
693
+ * @param bool trueの場合、作者名を検索対象とする (デフォルト: true)
694
+ * @return {this}
650
695
  */
651
696
  byAuthor(bool = true) {
652
697
  this.set({ wname: bool ? BooleanNumber.True : BooleanNumber.False });
653
698
  return this;
654
699
  }
655
700
  /**
656
- *
657
- * @return {SearchBuilder} this
701
+ * ボーイズラブ作品を抽出または除外します (isbl/notbl)。
702
+ * @param bool trueの場合、ボーイズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
703
+ * @return {this}
658
704
  */
659
705
  isBL(bool = true) {
660
706
  if (bool) {
@@ -665,8 +711,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
665
711
  return this;
666
712
  }
667
713
  /**
668
- *
669
- * @return {SearchBuilder} this
714
+ * ガールズラブ作品を抽出または除外します (isgl/notgl)。
715
+ * @param bool trueの場合、ガールズラブ作品を抽出する (デフォルト: true)。falseの場合、除外する。
716
+ * @return {this}
670
717
  */
671
718
  isGL(bool = true) {
672
719
  if (bool) {
@@ -677,8 +724,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
677
724
  return this;
678
725
  }
679
726
  /**
680
- *
681
- * @return {SearchBuilder} this
727
+ * 残酷な描写あり作品を抽出または除外します (iszankoku/notzankoku)。
728
+ * @param bool trueの場合、残酷な描写あり作品を抽出する (デフォルト: true)。falseの場合、除外する。
729
+ * @return {this}
682
730
  */
683
731
  isZankoku(bool = true) {
684
732
  if (bool) {
@@ -689,8 +737,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
689
737
  return this;
690
738
  }
691
739
  /**
692
- *
693
- * @return {SearchBuilder} this
740
+ * 異世界転生作品を抽出または除外します (istensei/nottensei)。
741
+ * @param bool trueの場合、異世界転生作品を抽出する (デフォルト: true)。falseの場合、除外する。
742
+ * @return {this}
694
743
  */
695
744
  isTensei(bool = true) {
696
745
  if (bool) {
@@ -701,8 +750,9 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
701
750
  return this;
702
751
  }
703
752
  /**
704
- *
705
- * @return {SearchBuilder} this
753
+ * 異世界転移作品を抽出または除外します (istenni/nottenni)。
754
+ * @param bool trueの場合、異世界転移作品を抽出する (デフォルト: true)。falseの場合、除外する。
755
+ * @return {this}
706
756
  */
707
757
  isTenni(bool = true) {
708
758
  if (bool) {
@@ -713,16 +763,18 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
713
763
  return this;
714
764
  }
715
765
  /**
716
- *
717
- * @return {SearchBuilder} this
766
+ * 異世界転生または異世界転移作品を抽出します (istt)。
767
+ * @return {this}
718
768
  */
719
769
  isTT() {
720
770
  this.set({ istt: BooleanNumber.True });
721
771
  return this;
722
772
  }
723
773
  /**
724
- *
725
- * @return {SearchBuilder} this
774
+ * 抽出する作品の文字数を指定します (length)。
775
+ * 範囲指定する場合は、最小文字数と最大文字数をハイフン(-)記号で区切ってください。
776
+ * @param length 文字数、または[最小文字数, 最大文字数]
777
+ * @return {this}
726
778
  */
727
779
  length(length) {
728
780
  this.set({ length: _NovelSearchBuilderBase.array2string(length) });
@@ -739,59 +791,66 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
739
791
  return this;
740
792
  }
741
793
  /**
742
- *
743
- * @return {SearchBuilder} this
794
+ * 抽出する作品の挿絵数を指定します (sasie)。
795
+ * @param num 挿絵数、または[最小挿絵数, 最大挿絵数]
796
+ * @return {this}
744
797
  */
745
798
  sasie(num) {
746
799
  this.set({ sasie: _NovelSearchBuilderBase.array2string(num) });
747
800
  return this;
748
801
  }
749
802
  /**
750
- *
751
- * @return {SearchBuilder} this
803
+ * 抽出する作品の予想読了時間を分単位で指定します (time)。
804
+ * @param num 読了時間(分)、または[最小読了時間, 最大読了時間]
805
+ * @return {this}
752
806
  */
753
807
  time(num) {
754
808
  this.set({ time: _NovelSearchBuilderBase.array2string(num) });
755
809
  return this;
756
810
  }
757
811
  /**
758
- *
759
- * @return {SearchBuilder} this
812
+ * Nコードを指定して取得します (ncode)。
813
+ * @param ncodes Nコード、またはNコードの配列
814
+ * @return {this}
760
815
  */
761
816
  ncode(ncodes) {
762
817
  this.set({ ncode: _NovelSearchBuilderBase.array2string(ncodes) });
763
818
  return this;
764
819
  }
765
820
  /**
766
- *
767
- * @return {SearchBuilder} this
821
+ * 抽出する小説タイプを指定します (type)。
822
+ * @param type 小説タイプ (t: 短編, r: 連載中, er: 完結済連載小説, ter: 短編と完結済連載小説, re: 連載中と完結済連載小説)
823
+ * @return {this}
768
824
  */
769
825
  type(type) {
770
826
  this.set({ type });
771
827
  return this;
772
828
  }
773
829
  /**
774
- *
775
- * @return {SearchBuilder} this
830
+ * 抽出する作品の文体を指定します (buntai)。
831
+ * 複数指定する場合はハイフン(-)で区切ってください。
832
+ * @param buntai 文体コード、または文体コードの配列
833
+ * @return {this}
776
834
  */
777
835
  buntai(buntai) {
778
836
  this.set({ buntai: _NovelSearchBuilderBase.array2string(buntai) });
779
837
  return this;
780
838
  }
781
839
  /**
782
- *
783
- * @return {SearchBuilder} this
840
+ * 連載停止中作品に関する指定をします (stop)。
841
+ * @param bool trueの場合、長期連載停止中のみ取得する (デフォルト: true)。falseの場合、長期連載停止中を除外する。
842
+ * @return {this}
784
843
  */
785
844
  isStop(bool = true) {
786
845
  this.set({ stop: bool ? StopParam.Stopping : StopParam.NoStopping });
787
846
  return this;
788
847
  }
789
848
  /**
790
- *
791
- * @return {SearchBuilder} this
849
+ * ピックアップ作品のみを取得します (ispickup)。
850
+ * @return {this}
792
851
  */
793
- isPickup(bool = true) {
794
- this.set({ ispickup: bool ? BooleanNumber.True : BooleanNumber.False });
852
+ isPickup() {
853
+ this.set({ ispickup: BooleanNumber.True });
795
854
  return this;
796
855
  }
797
856
  lastUpdate(x, y) {
@@ -800,7 +859,7 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
800
859
  date = x;
801
860
  } else if (x instanceof Date && y instanceof Date) {
802
861
  date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
803
- x.getTime() / 1e3
862
+ y.getTime() / 1e3
804
863
  )}`;
805
864
  } else {
806
865
  date = `${x}-${y}`;
@@ -808,6 +867,20 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
808
867
  this.set({ lastup: date });
809
868
  return this;
810
869
  }
870
+ lastNovelUpdate(x, y) {
871
+ let date;
872
+ if (typeof x == "string") {
873
+ date = x;
874
+ } else if (x instanceof Date && y instanceof Date) {
875
+ date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
876
+ y.getTime() / 1e3
877
+ )}`;
878
+ } else {
879
+ date = `${x}-${y}`;
880
+ }
881
+ this.set({ lastupdate: date });
882
+ return this;
883
+ }
811
884
  /**
812
885
  * なろう小説APIへの検索リクエストを実行する
813
886
  * @returns {Promise<NarouSearchResults>} 検索結果
@@ -818,48 +891,59 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
818
891
  };
819
892
  var SearchBuilder = class _SearchBuilder extends NovelSearchBuilderBase {
820
893
  /**
821
- *
822
- * @return {SearchBuilder} this
894
+ * 大ジャンルを指定して取得します (biggenre)。
895
+ * 複数指定する場合はハイフン(-)で区切ってください。
896
+ * @param genre 大ジャンルコード、または大ジャンルコードの配列
897
+ * @return {this}
823
898
  */
824
899
  bigGenre(genre) {
825
900
  this.set({ biggenre: _SearchBuilder.array2string(genre) });
826
901
  return this;
827
902
  }
828
903
  /**
829
- *
830
- * @return {SearchBuilder} this
904
+ * 除外したい大ジャンルを指定します (notbiggenre)。
905
+ * 複数指定する場合はハイフン(-)で区切ってください。
906
+ * @param genre 除外する大ジャンルコード、または大ジャンルコードの配列
907
+ * @return {this}
831
908
  */
832
909
  notBigGenre(genre) {
833
910
  this.set({ notbiggenre: _SearchBuilder.array2string(genre) });
834
911
  return this;
835
912
  }
836
913
  /**
837
- *
838
- * @return {SearchBuilder} this
914
+ * ジャンルを指定して取得します (genre)。
915
+ * 複数指定する場合はハイフン(-)で区切ってください。
916
+ * @param genre ジャンルコード、またはジャンルコードの配列
917
+ * @return {this}
839
918
  */
840
919
  genre(genre) {
841
920
  this.set({ genre: _SearchBuilder.array2string(genre) });
842
921
  return this;
843
922
  }
844
923
  /**
845
- *
846
- * @return {SearchBuilder} this
924
+ * 除外したいジャンルを指定します (notgenre)。
925
+ * 複数指定する場合はハイフン(-)で区切ってください。
926
+ * @param genre 除外するジャンルコード、またはジャンルコードの配列
927
+ * @return {this}
847
928
  */
848
929
  notGenre(genre) {
849
930
  this.set({ notgenre: _SearchBuilder.array2string(genre) });
850
931
  return this;
851
932
  }
852
933
  /**
853
- *
854
- * @return {SearchBuilder} this
934
+ * ユーザIDを指定して取得します (userid)。
935
+ * 複数指定する場合はハイフン(-)で区切ってください。
936
+ * @param ids ユーザID、またはユーザIDの配列
937
+ * @return {this}
855
938
  */
856
939
  userId(ids) {
857
940
  this.set({ userid: _SearchBuilder.array2string(ids) });
858
941
  return this;
859
942
  }
860
943
  /**
861
- *
862
- * @return {SearchBuilder} this
944
+ * R15作品を抽出または除外します (isr15/notr15)。
945
+ * @param bool trueの場合、R15作品を抽出する (デフォルト: true)。falseの場合、除外する。
946
+ * @return {this}
863
947
  */
864
948
  isR15(bool = true) {
865
949
  if (bool) {
@@ -870,13 +954,22 @@ var SearchBuilder = class _SearchBuilder extends NovelSearchBuilderBase {
870
954
  return this;
871
955
  }
872
956
  /**
873
- *
874
- * @return {SearchBuilder} this
957
+ * 出力する項目を個別に指定します (of)。
958
+ * 未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
959
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
960
+ * @param fields 出力するフィールド名、またはフィールド名の配列
961
+ * @return {SearchBuilder<SearchResultFields<TFields>, TOpt>} 型が更新されたビルダー
875
962
  */
876
963
  fields(fields) {
877
964
  this.set({ of: _SearchBuilder.array2string(fields) });
878
965
  return this;
879
966
  }
967
+ /**
968
+ * 出力オプション項目を指定します (opt)。
969
+ * 複数項目を出力する場合はハイフン(-)記号で区切ってください。
970
+ * @param option 出力するオプションフィールド名、またはオプションフィールド名の配列
971
+ * @return {SearchBuilder<T, SearchResultOptionalFields<TFields>>} 型が更新されたビルダー
972
+ */
880
973
  opt(option) {
881
974
  this.set({ opt: _SearchBuilder.array2string(option) });
882
975
  return this;
@@ -893,50 +986,99 @@ var SearchBuilderR18 = class extends NovelSearchBuilderBase {
893
986
  execute() {
894
987
  return this.api.executeNovel18(this.params);
895
988
  }
989
+ /**
990
+ * 抽出するR18サイトを指定します (nocgenre)。
991
+ * @param sites R18サイトコード、またはR18サイトコードの配列 (1: ノクターンノベルズ, 2: ムーンライトノベルズ(男性向け), 3: ムーンライトノベルズ(BL), 4: ミッドナイトノベルズ)
992
+ * @return {this}
993
+ */
896
994
  r18Site(sites) {
897
995
  this.set({ nocgenre: NovelSearchBuilderBase.array2string(sites) });
898
996
  return this;
899
997
  }
900
998
  /**
901
- *
902
- * @return {SearchBuilder} this
999
+ * X-IDを指定して取得します (xid)。
1000
+ * @param ids X-ID、またはX-IDの配列
1001
+ * @return {this}
903
1002
  */
904
1003
  xid(ids) {
905
1004
  this.set({ xid: NovelSearchBuilderBase.array2string(ids) });
906
1005
  return this;
907
1006
  }
908
1007
  /**
909
- *
910
- * @return {SearchBuilder} this
1008
+ * 出力する項目を個別に指定します (of)。
1009
+ * 未指定時は全項目出力されます。転送量軽減のため、このパラメータの使用が推奨されます。
1010
+ * @param fields 出力するR18フィールド名、またはR18フィールド名の配列
1011
+ * @return {SearchBuilderR18<SearchResultR18Fields<R18Fields>>} 型が更新されたビルダー
911
1012
  */
912
1013
  fields(fields) {
913
1014
  this.set({ of: NovelSearchBuilderBase.array2string(fields) });
914
1015
  return this;
915
1016
  }
1017
+ /**
1018
+ * 出力オプション項目を指定します (opt)。
1019
+ * @param option 出力するオプションフィールド名、またはオプションフィールド名の配列
1020
+ * @return {SearchBuilderR18<T, SearchResultOptionalFields<TFields>>} 型が更新されたビルダー
1021
+ */
916
1022
  opt(option) {
917
1023
  this.set({ opt: NovelSearchBuilderBase.array2string(option) });
918
1024
  return this;
919
1025
  }
920
1026
  };
921
1027
 
1028
+ // src/util/date.ts
1029
+ function parseDate(dateStr) {
1030
+ const year = parseInt(dateStr.substring(0, 4), 10);
1031
+ const month = parseInt(dateStr.substring(4, 6), 10) - 1;
1032
+ const day = parseInt(dateStr.substring(6, 8), 10);
1033
+ return new Date(year, month, day, 0, 0, 0, 0);
1034
+ }
1035
+ function formatDate(date) {
1036
+ const year = date.getFullYear();
1037
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1038
+ const day = String(date.getDate()).padStart(2, "0");
1039
+ return `${year}${month}${day}`;
1040
+ }
1041
+ function addDays(date, days) {
1042
+ const result = new Date(date);
1043
+ result.setDate(result.getDate() + days);
1044
+ return result;
1045
+ }
1046
+
922
1047
  // src/ranking.ts
923
- var import_date_fns = require("date-fns");
924
- var dateFormat = "yyyyMMdd";
925
1048
  var RankingBuilder = class {
926
1049
  /**
927
1050
  * constructor
1051
+ * @param params - 初期クエリパラメータ
1052
+ * @param api - API実行クラスのインスタンス
928
1053
  * @private
929
1054
  */
930
1055
  constructor(params = {}, api) {
931
1056
  this.params = params;
932
1057
  this.api = api;
933
- this.date$ = (0, import_date_fns.addDays)(Date.now(), -1);
1058
+ this.date$ = addDays(/* @__PURE__ */ new Date(), -1);
934
1059
  this.type$ = RankingType.Daily;
935
1060
  }
1061
+ /**
1062
+ * ランキング集計対象の日付を指定します。
1063
+ *
1064
+ * - 日間: 任意の日付
1065
+ * - 週間: 火曜日の日付
1066
+ * - 月間・四半期: 1日の日付
1067
+ *
1068
+ * @param date 集計対象の日付
1069
+ * @returns {RankingBuilder} this
1070
+ * @see https://dev.syosetu.com/man/rankapi/
1071
+ */
936
1072
  date(date) {
937
1073
  this.date$ = date;
938
1074
  return this;
939
1075
  }
1076
+ /**
1077
+ * ランキング種別を指定します。
1078
+ * @param type ランキング種別
1079
+ * @returns {RankingBuilder} this
1080
+ * @see https://dev.syosetu.com/man/rankapi/
1081
+ */
940
1082
  type(type) {
941
1083
  this.type$ = type;
942
1084
  return this;
@@ -953,23 +1095,36 @@ var RankingBuilder = class {
953
1095
  return this;
954
1096
  }
955
1097
  /**
956
- * クエリパラメータをセットする
1098
+ * クエリパラメータを内部的にセットします。
1099
+ * @param obj - セットするパラメータオブジェクト
1100
+ * @returns {RankingBuilder} this
957
1101
  * @private
958
- * @return {RankingBuilder} this
959
1102
  */
960
1103
  set(obj) {
961
1104
  Object.assign(this.params, obj);
962
1105
  return this;
963
1106
  }
964
1107
  /**
965
- * なろう小説APIへのリクエストを実行する
966
- * @returns ランキング
1108
+ * 設定されたパラメータに基づき、なろう小説ランキングAPIへのリクエストを実行します。
1109
+ *
1110
+ * 返される結果には、Nコード、ポイント、順位が含まれます。
1111
+ * @returns {Promise<NarouRankingResult[]>} ランキング結果の配列
1112
+ * @see https://dev.syosetu.com/man/rankapi/#output
967
1113
  */
968
1114
  execute() {
969
- const date = (0, import_date_fns.format)(this.date$, dateFormat);
1115
+ const date = formatDate(this.date$);
970
1116
  this.set({ rtype: `${date}-${this.type$}` });
971
1117
  return this.api.executeRanking(this.params);
972
1118
  }
1119
+ /**
1120
+ * ランキングAPIを実行し、取得したNコードを元になろう小説APIで詳細情報を取得して結合します。
1121
+ *
1122
+ * @template TFields - 取得する小説情報のフィールド型
1123
+ * @template TOpt - オプショナルな取得フィールドの型
1124
+ * @param fields - 取得するフィールドの配列 (省略時はデフォルトフィールド)
1125
+ * @param opt - オプショナルな取得フィールド (`weekly` など)
1126
+ * @returns {Promise<RankingResult<SearchResultFields<TFields>>[]>} 詳細情報を含むランキング結果の配列
1127
+ */
973
1128
  async executeWithFields(fields = [], opt) {
974
1129
  const ranking = await this.execute();
975
1130
  const fields$ = Array.isArray(fields) ? fields.length == 0 ? [] : [...fields, Fields.ncode] : [fields, Fields.ncode];
@@ -991,12 +1146,10 @@ var RankingBuilder = class {
991
1146
  };
992
1147
 
993
1148
  // src/ranking-history.ts
994
- var import_date_fns2 = require("date-fns");
995
- var dateFormat2 = "yyyyMMdd";
996
1149
  function formatRankingHistory(rankin) {
997
1150
  const { rtype, pt, rank } = rankin;
998
1151
  const [_date, _type] = rtype.split("-");
999
- const date = (0, import_date_fns2.parse)(_date, dateFormat2, /* @__PURE__ */ new Date());
1152
+ const date = parseDate(_date);
1000
1153
  const type = _type;
1001
1154
  return { type, date, pt, rank };
1002
1155
  }
@@ -1006,6 +1159,7 @@ function formatRankingHistory(rankin) {
1006
1159
  BigGenreNotation,
1007
1160
  BooleanNumber,
1008
1161
  BuntaiParam,
1162
+ DateParam,
1009
1163
  End,
1010
1164
  Fields,
1011
1165
  Genre,