narou 1.0.0 → 1.1.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 (97) hide show
  1. package/dist/{chunk-QQYQ4GQF.js → chunk-4VC3246A.js} +3 -3
  2. package/dist/{chunk-GAEL5UWA.js → chunk-AZT2OXBZ.js} +3 -3
  3. package/dist/{chunk-GAEL5UWA.js.map → chunk-AZT2OXBZ.js.map} +1 -1
  4. package/dist/{chunk-6RIDVTFQ.js → chunk-CDOBNSCL.js} +12 -2
  5. package/dist/chunk-CDOBNSCL.js.map +1 -0
  6. package/dist/{chunk-DBCAWGIX.js → chunk-K22KVNAH.js} +2 -2
  7. package/dist/{chunk-JMTNQTNC.js → chunk-NVMUSXA5.js} +2 -3
  8. package/dist/{chunk-JMTNQTNC.js.map → chunk-NVMUSXA5.js.map} +1 -1
  9. package/dist/{chunk-OJGRUQEQ.js → chunk-P7QOZBII.js} +17 -3
  10. package/dist/chunk-P7QOZBII.js.map +1 -0
  11. package/dist/{chunk-NP5NZV5Q.js → chunk-SNPBEVCY.js} +7 -4
  12. package/dist/chunk-SNPBEVCY.js.map +1 -0
  13. package/dist/{chunk-YJQXIVFD.js → chunk-WYSPGQ3S.js} +2 -2
  14. package/dist/{chunk-TNDGN3EF.js → chunk-XVH2CU2Q.js} +1 -1
  15. package/dist/chunk-XVH2CU2Q.js.map +1 -0
  16. package/dist/index.browser.cjs +31 -9
  17. package/dist/index.browser.cjs.map +1 -1
  18. package/dist/index.browser.d.cts +4 -4
  19. package/dist/index.browser.d.ts +4 -4
  20. package/dist/index.browser.js +12 -13
  21. package/dist/index.browser.js.map +1 -1
  22. package/dist/index.cjs +42 -18
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.common.cjs +27 -2
  25. package/dist/index.common.cjs.map +1 -1
  26. package/dist/index.common.d.cts +2 -2
  27. package/dist/index.common.d.ts +2 -2
  28. package/dist/index.common.js +7 -5
  29. package/dist/index.d.cts +4 -4
  30. package/dist/index.d.ts +4 -4
  31. package/dist/index.js +16 -17
  32. package/dist/index.js.map +1 -1
  33. package/dist/{narou-CosGR0J9.d.cts → narou-CatW_TC9.d.cts} +6 -3
  34. package/dist/{narou-CutsOEgk.d.ts → narou-fH9osIoh.d.ts} +6 -3
  35. package/dist/narou-fetch.cjs +6 -4
  36. package/dist/narou-fetch.cjs.map +1 -1
  37. package/dist/narou-fetch.d.cts +4 -3
  38. package/dist/narou-fetch.d.ts +4 -3
  39. package/dist/narou-fetch.js +2 -2
  40. package/dist/narou-jsonp.cjs +1 -1
  41. package/dist/narou-jsonp.cjs.map +1 -1
  42. package/dist/narou-jsonp.d.cts +2 -2
  43. package/dist/narou-jsonp.d.ts +2 -2
  44. package/dist/narou-jsonp.js +2 -2
  45. package/dist/narou-ranking-results.d.cts +2 -2
  46. package/dist/narou-ranking-results.d.ts +2 -2
  47. package/dist/{narou-search-results-CvMcnYqe.d.ts → narou-search-results-D5yqPRZ7.d.ts} +28 -17
  48. package/dist/{narou-search-results-D_vbjc_I.d.cts → narou-search-results-DWCJWTC5.d.cts} +28 -17
  49. package/dist/narou-search-results.d.cts +1 -1
  50. package/dist/narou-search-results.d.ts +1 -1
  51. package/dist/narou.d.cts +2 -2
  52. package/dist/narou.d.ts +2 -2
  53. package/dist/params.cjs +12 -1
  54. package/dist/params.cjs.map +1 -1
  55. package/dist/params.d.cts +1 -1
  56. package/dist/params.d.ts +1 -1
  57. package/dist/params.js +3 -1
  58. package/dist/ranking-history.d.cts +1 -1
  59. package/dist/ranking-history.d.ts +1 -1
  60. package/dist/ranking.cjs +15 -1
  61. package/dist/ranking.cjs.map +1 -1
  62. package/dist/ranking.d.cts +3 -3
  63. package/dist/ranking.d.ts +3 -3
  64. package/dist/ranking.js +3 -3
  65. package/dist/search-builder-r18.cjs +15 -1
  66. package/dist/search-builder-r18.cjs.map +1 -1
  67. package/dist/search-builder-r18.d.cts +2 -2
  68. package/dist/search-builder-r18.d.ts +2 -2
  69. package/dist/search-builder-r18.js +3 -3
  70. package/dist/search-builder.cjs +15 -1
  71. package/dist/search-builder.cjs.map +1 -1
  72. package/dist/search-builder.d.cts +2 -2
  73. package/dist/search-builder.d.ts +2 -2
  74. package/dist/search-builder.js +2 -2
  75. package/dist/user-search.cjs.map +1 -1
  76. package/dist/user-search.d.cts +2 -2
  77. package/dist/user-search.d.ts +2 -2
  78. package/dist/user-search.js +3 -3
  79. package/dist/util/jsonp.cjs.map +1 -1
  80. package/dist/util/jsonp.js +1 -1
  81. package/dist/util/unzipp.cjs +1 -2
  82. package/dist/util/unzipp.cjs.map +1 -1
  83. package/dist/util/unzipp.js +1 -1
  84. package/package.json +30 -27
  85. package/pnpm-lock.yaml +2918 -0
  86. package/src/narou-fetch.ts +5 -2
  87. package/src/narou-jsonp.ts +1 -1
  88. package/src/params.ts +33 -17
  89. package/src/search-builder.ts +27 -6
  90. package/src/util/jsonp.ts +1 -1
  91. package/dist/chunk-6RIDVTFQ.js.map +0 -1
  92. package/dist/chunk-NP5NZV5Q.js.map +0 -1
  93. package/dist/chunk-OJGRUQEQ.js.map +0 -1
  94. package/dist/chunk-TNDGN3EF.js.map +0 -1
  95. /package/dist/{chunk-QQYQ4GQF.js.map → chunk-4VC3246A.js.map} +0 -0
  96. /package/dist/{chunk-DBCAWGIX.js.map → chunk-K22KVNAH.js.map} +0 -0
  97. /package/dist/{chunk-YJQXIVFD.js.map → chunk-WYSPGQ3S.js.map} +0 -0
@@ -38,8 +38,7 @@ async function unzipp(data) {
38
38
  throw decoder.decode(buffer);
39
39
  }
40
40
  } catch (e) {
41
- if (typeof e === "string")
42
- throw e;
41
+ if (typeof e === "string") throw e;
43
42
  throw decoder.decode(data);
44
43
  }
45
44
  }
@@ -142,14 +141,17 @@ var NarouNovelFetch = class extends NarouNovel {
142
141
  if (query.gzip === void 0) {
143
142
  query.gzip = 5;
144
143
  }
144
+ if (query.gzip === 0) {
145
+ delete query.gzip;
146
+ }
145
147
  const url = new URL(endpoint);
146
148
  Object.entries(query).forEach(([key, value]) => {
147
- if (value) {
149
+ if (value !== void 0) {
148
150
  url.searchParams.append(key, value.toString());
149
151
  }
150
152
  });
151
153
  const res = await (this.fetch ?? fetch)(url);
152
- if (query.gzip === 0) {
154
+ if (!query.gzip) {
153
155
  return await res.json();
154
156
  }
155
157
  const buffer = await res.arrayBuffer();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/narou-fetch.ts","../src/util/unzipp.ts","../src/narou-search-results.ts","../src/narou.ts"],"sourcesContent":["import { unzipp } from \"./util/unzipp.js\";\nimport NarouNovel from \"./narou.js\";\nimport type { NarouParams } from \"./narou.js\";\n\ntype Fetch = typeof fetch;\n\n/**\n * なろう小説APIへのリクエストを実行する\n */\nexport default class NarouNovelFetch extends NarouNovel {\n /**\n * コンストラクタ\n * @param fetch fetch関数(デフォルトはネイティブのfetch)\n */\n constructor(private fetch?: Fetch) {\n super();\n }\n\n protected async execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T> {\n const query = { ...params, out: \"json\" };\n\n if (query.gzip === undefined) {\n query.gzip = 5;\n }\n const url = new URL(endpoint);\n\n Object.entries(query).forEach(([key, value]) => {\n if (value) {\n url.searchParams.append(key, value.toString());\n }\n });\n\n const res = await (this.fetch ?? fetch)(url);\n\n if (query.gzip === 0) {\n return (await res.json()) as T;\n }\n\n const buffer = await res.arrayBuffer();\n return await unzipp(buffer);\n }\n}\n","import { gunzip, InputType } from \"zlib\";\nimport { promisify } from \"util\";\n\nconst gunzipAsync = promisify<InputType, Buffer>(gunzip);\n\nconst decoder = new TextDecoder()\nexport async function unzipp(data: ArrayBuffer) {\n try {\n const buffer = await gunzipAsync(data);\n try {\n return JSON.parse(decoder.decode(buffer));\n } catch {\n throw decoder.decode(buffer);\n }\n } catch (e) {\n if (typeof e === \"string\") throw e;\n throw decoder.decode(data);\n }\n}\n","import type {\n BooleanNumber as BooleanNumber,\n Genre,\n R18Site,\n SearchParams,\n Fields,\n BigGenre,\n R18Fields,\n OptionalFields,\n UserFields,\n} from \"./params.js\";\n\n/**\n * なろう小説API検索結果\n */\nexport default class NarouSearchResults<T, TKey extends keyof T> {\n /**\n * 検索結果数\n */\n allcount: number;\n /**\n * 結果表示上限数\n */\n limit: number;\n /**\n * 結果表示開始数\n */\n start: number;\n /**\n * 結果表示の現在ページ(=start/limit)\n */\n page: number;\n /**\n * 今回取得できた検索結果の数\n */\n length: number;\n /**\n * 検索結果\n */\n values: readonly Pick<T, TKey>[];\n\n /**\n * @constractor\n * @private\n */\n constructor(\n [header, ...result]: [{ allcount: number }, ...Pick<T, TKey>[]],\n params: SearchParams\n ) {\n const count = header.allcount;\n const limit = params.lim ?? 20;\n const start = params.st ?? 0;\n\n this.allcount = count;\n this.limit = limit;\n this.start = start;\n this.page = start / limit;\n this.length = result.length;\n this.values = result;\n }\n}\n\n/**\n * 小説情報\n * @see https://dev.syosetu.com/man/api/#output\n * @see https://dev.syosetu.com/xman/api/#output\n */\nexport interface NarouSearchResult {\n /** 小説名 */\n title: string;\n /** Nコード */\n ncode: string;\n /** 作者のユーザID(数値) */\n userid: number;\n /** 作者名 */\n writer: string;\n /** 小説のあらすじ */\n story: string;\n /** 掲載サイト */\n nocgenre: R18Site;\n /** 大ジャンル */\n biggenre: BigGenre;\n /** ジャンル */\n genre: Genre;\n /** キーワード */\n keyword: string;\n /** 初回掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_firstup: string;\n /** 最終掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_lastup: string;\n /** 連載の場合は1、短編の場合は2 */\n novel_type: NovelType;\n /** 連載の場合は1、短編の場合は2 */\n noveltype: NovelType;\n /** 短編小説と完結済小説は0となっています。連載中は1です。 */\n end: End;\n /** 全掲載話数です。短編の場合は1です。 */\n general_all_no: number;\n /** 小説文字数です。スペースや改行は文字数としてカウントしません。 */\n length: number;\n /** 読了時間(分単位)です。読了時間は小説文字数÷500を切り上げした数値です。 */\n time: number;\n /** 長期連載中は1、それ以外は0です。 */\n isstop: BooleanNumber;\n /** 登録必須キーワードに「R15」が含まれる場合は1、それ以外は0です。 */\n isr15: BooleanNumber;\n /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */\n isbl: BooleanNumber;\n /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */\n isgl: BooleanNumber;\n /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */\n iszankoku: BooleanNumber;\n /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */\n istensei: BooleanNumber;\n /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */\n istenni: BooleanNumber;\n /** 総合得点(=(ブックマーク数×2)+評価点) */\n global_point: number;\n /**\n * 日間ポイント\n * ランキング集計時点から過去24時間以内で新たに登録されたブックマークや評価が対象\n */\n daily_point: number;\n /**\n * 週間ポイント\n * ランキング集計時点から過去7日以内で新たに登録されたブックマークや評価が対象\n */\n weekly_point: number;\n /**\n * 月間ポイント\n * ランキング集計時点から過去30日以内で新たに登録されたブックマークや評価が対象\n */\n monthly_point: number;\n /**\n * 四半期ポイント\n * ランキング集計時点から過去90日以内で新たに登録されたブックマークや評価が対象\n */\n quarter_point: number;\n /**\n * 年間ポイント\n * ランキング集計時点から過去365日以内で新たに登録されたブックマークや評価が対象\n */\n yearly_point: number;\n /** ブックマーク数 */\n fav_novel_cnt: number;\n /** 感想数 */\n impression_cnt: number;\n /** レビュー数 */\n review_cnt: number;\n /** 評価ポイント */\n all_point: number;\n /** 評価者数 */\n all_hyoka_cnt: number;\n /** 挿絵の数 */\n sasie_cnt: number;\n /**\n * 会話率\n * @see https://dev.syosetu.com/man/kaiwa/\n */\n kaiwaritu: number;\n /**\n * 小説の更新日時\n */\n novelupdated_at: string;\n /**\n * 最終更新日時\n * システム用で小説更新時とは関係ありません\n */\n updated_at: string;\n /** 週間ユニークユーザー数 */\n weekly_unique: number;\n}\n\n/**\n * ユーザ情報\n * @see https://dev.syosetu.com/man/userapi/#output\n */\nexport interface UserSearchResult {\n /** ユーザID */\n userid: number;\n /** ユーザ名 */\n name: string;\n /** ユーザ名のフリガナ */\n yomikata: string;\n /**\n * ユーザ名のフリガナの頭文字\n * ひらがな以外の場合はnullまたは空文字となります。\n */\n name1st: string;\n /** 小説投稿数 */\n novel_cnt: number;\n /** レビュー投稿数 */\n review_cnt: number;\n /**\n * 小説累計文字数\n * スペースや改行は文字数としてカウントしません。\n */\n novel_length: number;\n /**\n * 総合評価ポイントの合計\n * 投稿済小説でそれぞれ獲得した総合評価ポイントの合計です。\n */\n sum_global_point: number;\n}\n\n/**\n * noveltype/novel_typeの値ヘルパー\n */\nexport const NovelType = {\n /** 連載 */\n Rensai: 1,\n /** 短編 */\n Tanpen: 2,\n} as const;\nexport type NovelType = typeof NovelType[keyof typeof NovelType];\n\n/**\n * endの値ヘルパー\n */\nexport const End = {\n /** 短編小説と完結済小説 */\n KanketsuOrTanpen: 0,\n /** 連載中 */\n Rensai: 1,\n} as const;\nexport type End = typeof End[keyof typeof End];\n\nexport type SearchResultFields<T extends Fields> = {\n [K in keyof typeof Fields]: typeof Fields[K] extends T ? K : never;\n}[keyof typeof Fields];\n\nexport type SearchResultOptionalFields<T extends OptionalFields> = {\n [K in keyof typeof OptionalFields]: typeof OptionalFields[K] extends T\n ? K\n : never;\n}[keyof typeof OptionalFields];\n\nexport type SearchResultR18Fields<T extends R18Fields> = {\n [K in keyof typeof R18Fields]: typeof R18Fields[K] extends T ? K : never;\n}[keyof typeof R18Fields];\n\nexport type UserSearchResultFields<T extends UserFields> = {\n [K in keyof typeof UserFields]: typeof UserFields[K] extends T ? K : never;\n}[keyof typeof UserFields];\n\nexport type PickedNarouSearchResult<T extends keyof NarouSearchResult> = Pick<\n NarouSearchResult,\n T\n>;\n","import type { NarouRankingResult } from \"./narou-ranking-results.js\";\nimport NarouSearchResults from \"./narou-search-results.js\";\nimport type {\n NarouSearchResult,\n UserSearchResult,\n} from \"./narou-search-results.js\";\nimport type {\n RankingHistoryParams,\n RankingParams,\n SearchParams,\n UserSearchParams,\n} from \"./params.js\";\nimport type { RankingHistoryRawResult } from \"./ranking-history.js\";\n\n/**\n * なろう小説APIへのリクエストパラメータ\n */\nexport type NarouParams =\n | SearchParams\n | RankingParams\n | RankingHistoryParams\n | UserSearchParams;\n\n/**\n * なろう小説APIへのリクエストを実行する\n * @class NarouNovel\n * @private\n */\nexport default abstract class NarouNovel {\n /**\n * なろうAPIへのAPIリクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 実行結果\n */\n protected abstract execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T>;\n\n /**\n * APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 検索結果\n */\n protected async executeSearch<T extends keyof NarouSearchResult>(\n params: SearchParams,\n endpoint = \"https://api.syosetu.com/novelapi/api/\"\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return new NarouSearchResults(await this.execute(params, endpoint), params);\n }\n\n /**\n * 小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/api/\n */\n async executeNovel<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novelapi/api/\"\n );\n }\n\n /**\n * R18小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/xman/api/\n */\n async executeNovel18<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novel18api/api/\"\n );\n }\n\n /**\n * ランキングAPIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング結果\n * @see https://dev.syosetu.com/man/rankapi/\n */\n async executeRanking(params: RankingParams): Promise<NarouRankingResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankget/\");\n }\n\n /**\n * 殿堂入りAPiへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング履歴結果\n * @see https://dev.syosetu.com/man/rankinapi/\n */\n async executeRankingHistory(\n params: RankingHistoryParams\n ): Promise<RankingHistoryRawResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankin/\");\n }\n\n /**\n * ユーザー検索APIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/userapi/\n */\n async executeUserSearch<T extends keyof UserSearchResult>(\n params: UserSearchParams\n ): Promise<NarouSearchResults<UserSearchResult, T>> {\n return await this.execute(params, \"https://api.syosetu.com/userapi/api/\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAkC;AAClC,kBAA0B;AAE1B,IAAM,kBAAc,uBAA6B,kBAAM;AAEvD,IAAM,UAAU,IAAI,YAAY;AAChC,eAAsB,OAAO,MAAmB;AAC9C,MAAI;AACF,UAAM,SAAS,MAAM,YAAY,IAAI;AACrC,QAAI;AACF,aAAO,KAAK,MAAM,QAAQ,OAAO,MAAM,CAAC;AAAA,IAC1C,QAAQ;AACN,YAAM,QAAQ,OAAO,MAAM;AAAA,IAC7B;AAAA,EACF,SAAS,GAAG;AACV,QAAI,OAAO,MAAM;AAAU,YAAM;AACjC,UAAM,QAAQ,OAAO,IAAI;AAAA,EAC3B;AACF;;;ACHA,IAAqB,qBAArB,MAAiE;AAAA;AAAA;AAAA;AAAA;AAAA,EA8B/D,YACE,CAAC,QAAQ,GAAG,MAAM,GAClB,QACA;AACA,UAAM,QAAQ,OAAO;AACrB,UAAM,QAAQ,OAAO,OAAO;AAC5B,UAAM,QAAQ,OAAO,MAAM;AAE3B,SAAK,WAAW;AAChB,SAAK,QAAQ;AACb,SAAK,QAAQ;AACb,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,OAAO;AACrB,SAAK,SAAS;AAAA,EAChB;AACF;;;AChCA,IAA8B,aAA9B,MAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBvC,MAAgB,cACd,QACA,WAAW,yCACwC;AACnD,WAAO,IAAI,mBAAmB,MAAM,KAAK,QAAQ,QAAQ,QAAQ,GAAG,MAAM;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,aACJ,QACmD;AACnD,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,eACJ,QACmD;AACnD,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,eAAe,QAAsD;AACzE,WAAO,MAAM,KAAK,QAAQ,QAAQ,uCAAuC;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,sBACJ,QACoC;AACpC,WAAO,MAAM,KAAK,QAAQ,QAAQ,sCAAsC;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,kBACJ,QACkD;AAClD,WAAO,MAAM,KAAK,QAAQ,QAAQ,sCAAsC;AAAA,EAC1E;AACF;;;AH3GA,IAAqB,kBAArB,cAA6C,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtD,YAAoBA,QAAe;AACjC,UAAM;AADY,iBAAAA;AAAA,EAEpB;AAAA,EAEA,MAAgB,QACd,QACA,UACY;AACZ,UAAM,QAAQ,EAAE,GAAG,QAAQ,KAAK,OAAO;AAEvC,QAAI,MAAM,SAAS,QAAW;AAC5B,YAAM,OAAO;AAAA,IACf;AACA,UAAM,MAAM,IAAI,IAAI,QAAQ;AAE5B,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,UAAI,OAAO;AACT,YAAI,aAAa,OAAO,KAAK,MAAM,SAAS,CAAC;AAAA,MAC/C;AAAA,IACF,CAAC;AAED,UAAM,MAAM,OAAO,KAAK,SAAS,OAAO,GAAG;AAE3C,QAAI,MAAM,SAAS,GAAG;AACpB,aAAQ,MAAM,IAAI,KAAK;AAAA,IACzB;AAEA,UAAM,SAAS,MAAM,IAAI,YAAY;AACrC,WAAO,MAAM,OAAO,MAAM;AAAA,EAC5B;AACF;","names":["fetch"]}
1
+ {"version":3,"sources":["../src/narou-fetch.ts","../src/util/unzipp.ts","../src/narou-search-results.ts","../src/narou.ts"],"sourcesContent":["import { unzipp } from \"./util/unzipp.js\";\nimport NarouNovel from \"./narou.js\";\nimport type { NarouParams } from \"./narou.js\";\n\ntype Fetch = typeof fetch;\n\n/**\n * なろう小説APIへのリクエストを実行する\n */\nexport default class NarouNovelFetch extends NarouNovel {\n /**\n * コンストラクタ\n * @param fetch fetch関数(デフォルトはネイティブのfetch)\n */\n constructor(private fetch?: Fetch) {\n super();\n }\n\n protected async execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T> {\n const query = { ...params, out: \"json\" };\n\n if (query.gzip === undefined) {\n query.gzip = 5;\n }\n if (query.gzip === 0) {\n delete query.gzip;\n }\n const url = new URL(endpoint);\n\n Object.entries(query).forEach(([key, value]) => {\n if (value !== undefined) {\n url.searchParams.append(key, value.toString());\n }\n });\n\n const res = await (this.fetch ?? fetch)(url);\n\n if (!query.gzip) {\n return (await res.json()) as T;\n }\n\n const buffer = await res.arrayBuffer();\n return await unzipp(buffer);\n }\n}\n","import { gunzip, InputType } from \"zlib\";\nimport { promisify } from \"util\";\n\nconst gunzipAsync = promisify<InputType, Buffer>(gunzip);\n\nconst decoder = new TextDecoder()\nexport async function unzipp(data: ArrayBuffer) {\n try {\n const buffer = await gunzipAsync(data);\n try {\n return JSON.parse(decoder.decode(buffer));\n } catch {\n throw decoder.decode(buffer);\n }\n } catch (e) {\n if (typeof e === \"string\") throw e;\n throw decoder.decode(data);\n }\n}\n","import type {\n BooleanNumber as BooleanNumber,\n Genre,\n R18Site,\n SearchParams,\n Fields,\n BigGenre,\n R18Fields,\n OptionalFields,\n UserFields,\n} from \"./params.js\";\n\n/**\n * なろう小説API検索結果\n */\nexport default class NarouSearchResults<T, TKey extends keyof T> {\n /**\n * 検索結果数\n */\n allcount: number;\n /**\n * 結果表示上限数\n */\n limit: number;\n /**\n * 結果表示開始数\n */\n start: number;\n /**\n * 結果表示の現在ページ(=start/limit)\n */\n page: number;\n /**\n * 今回取得できた検索結果の数\n */\n length: number;\n /**\n * 検索結果\n */\n values: readonly Pick<T, TKey>[];\n\n /**\n * @constractor\n * @private\n */\n constructor(\n [header, ...result]: [{ allcount: number }, ...Pick<T, TKey>[]],\n params: SearchParams\n ) {\n const count = header.allcount;\n const limit = params.lim ?? 20;\n const start = params.st ?? 0;\n\n this.allcount = count;\n this.limit = limit;\n this.start = start;\n this.page = start / limit;\n this.length = result.length;\n this.values = result;\n }\n}\n\n/**\n * 小説情報\n * @see https://dev.syosetu.com/man/api/#output\n * @see https://dev.syosetu.com/xman/api/#output\n */\nexport interface NarouSearchResult {\n /** 小説名 */\n title: string;\n /** Nコード */\n ncode: string;\n /** 作者のユーザID(数値) */\n userid: number;\n /** 作者名 */\n writer: string;\n /** 小説のあらすじ */\n story: string;\n /** 掲載サイト */\n nocgenre: R18Site;\n /** 大ジャンル */\n biggenre: BigGenre;\n /** ジャンル */\n genre: Genre;\n /** キーワード */\n keyword: string;\n /** 初回掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_firstup: string;\n /** 最終掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_lastup: string;\n /** 連載の場合は1、短編の場合は2 */\n novel_type: NovelType;\n /** 連載の場合は1、短編の場合は2 */\n noveltype: NovelType;\n /** 短編小説と完結済小説は0となっています。連載中は1です。 */\n end: End;\n /** 全掲載話数です。短編の場合は1です。 */\n general_all_no: number;\n /** 小説文字数です。スペースや改行は文字数としてカウントしません。 */\n length: number;\n /** 読了時間(分単位)です。読了時間は小説文字数÷500を切り上げした数値です。 */\n time: number;\n /** 長期連載中は1、それ以外は0です。 */\n isstop: BooleanNumber;\n /** 登録必須キーワードに「R15」が含まれる場合は1、それ以外は0です。 */\n isr15: BooleanNumber;\n /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */\n isbl: BooleanNumber;\n /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */\n isgl: BooleanNumber;\n /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */\n iszankoku: BooleanNumber;\n /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */\n istensei: BooleanNumber;\n /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */\n istenni: BooleanNumber;\n /** 総合得点(=(ブックマーク数×2)+評価点) */\n global_point: number;\n /**\n * 日間ポイント\n * ランキング集計時点から過去24時間以内で新たに登録されたブックマークや評価が対象\n */\n daily_point: number;\n /**\n * 週間ポイント\n * ランキング集計時点から過去7日以内で新たに登録されたブックマークや評価が対象\n */\n weekly_point: number;\n /**\n * 月間ポイント\n * ランキング集計時点から過去30日以内で新たに登録されたブックマークや評価が対象\n */\n monthly_point: number;\n /**\n * 四半期ポイント\n * ランキング集計時点から過去90日以内で新たに登録されたブックマークや評価が対象\n */\n quarter_point: number;\n /**\n * 年間ポイント\n * ランキング集計時点から過去365日以内で新たに登録されたブックマークや評価が対象\n */\n yearly_point: number;\n /** ブックマーク数 */\n fav_novel_cnt: number;\n /** 感想数 */\n impression_cnt: number;\n /** レビュー数 */\n review_cnt: number;\n /** 評価ポイント */\n all_point: number;\n /** 評価者数 */\n all_hyoka_cnt: number;\n /** 挿絵の数 */\n sasie_cnt: number;\n /**\n * 会話率\n * @see https://dev.syosetu.com/man/kaiwa/\n */\n kaiwaritu: number;\n /**\n * 小説の更新日時\n */\n novelupdated_at: string;\n /**\n * 最終更新日時\n * システム用で小説更新時とは関係ありません\n */\n updated_at: string;\n /** 週間ユニークユーザー数 */\n weekly_unique: number;\n}\n\n/**\n * ユーザ情報\n * @see https://dev.syosetu.com/man/userapi/#output\n */\nexport interface UserSearchResult {\n /** ユーザID */\n userid: number;\n /** ユーザ名 */\n name: string;\n /** ユーザ名のフリガナ */\n yomikata: string;\n /**\n * ユーザ名のフリガナの頭文字\n * ひらがな以外の場合はnullまたは空文字となります。\n */\n name1st: string;\n /** 小説投稿数 */\n novel_cnt: number;\n /** レビュー投稿数 */\n review_cnt: number;\n /**\n * 小説累計文字数\n * スペースや改行は文字数としてカウントしません。\n */\n novel_length: number;\n /**\n * 総合評価ポイントの合計\n * 投稿済小説でそれぞれ獲得した総合評価ポイントの合計です。\n */\n sum_global_point: number;\n}\n\n/**\n * noveltype/novel_typeの値ヘルパー\n */\nexport const NovelType = {\n /** 連載 */\n Rensai: 1,\n /** 短編 */\n Tanpen: 2,\n} as const;\nexport type NovelType = typeof NovelType[keyof typeof NovelType];\n\n/**\n * endの値ヘルパー\n */\nexport const End = {\n /** 短編小説と完結済小説 */\n KanketsuOrTanpen: 0,\n /** 連載中 */\n Rensai: 1,\n} as const;\nexport type End = typeof End[keyof typeof End];\n\nexport type SearchResultFields<T extends Fields> = {\n [K in keyof typeof Fields]: typeof Fields[K] extends T ? K : never;\n}[keyof typeof Fields];\n\nexport type SearchResultOptionalFields<T extends OptionalFields> = {\n [K in keyof typeof OptionalFields]: typeof OptionalFields[K] extends T\n ? K\n : never;\n}[keyof typeof OptionalFields];\n\nexport type SearchResultR18Fields<T extends R18Fields> = {\n [K in keyof typeof R18Fields]: typeof R18Fields[K] extends T ? K : never;\n}[keyof typeof R18Fields];\n\nexport type UserSearchResultFields<T extends UserFields> = {\n [K in keyof typeof UserFields]: typeof UserFields[K] extends T ? K : never;\n}[keyof typeof UserFields];\n\nexport type PickedNarouSearchResult<T extends keyof NarouSearchResult> = Pick<\n NarouSearchResult,\n T\n>;\n","import type { NarouRankingResult } from \"./narou-ranking-results.js\";\nimport NarouSearchResults from \"./narou-search-results.js\";\nimport type {\n NarouSearchResult,\n UserSearchResult,\n} from \"./narou-search-results.js\";\nimport type {\n RankingHistoryParams,\n RankingParams,\n SearchParams,\n UserSearchParams,\n} from \"./params.js\";\nimport type { RankingHistoryRawResult } from \"./ranking-history.js\";\n\n/**\n * なろう小説APIへのリクエストパラメータ\n */\nexport type NarouParams =\n | SearchParams\n | RankingParams\n | RankingHistoryParams\n | UserSearchParams;\n\n/**\n * なろう小説APIへのリクエストを実行する\n * @class NarouNovel\n * @private\n */\nexport default abstract class NarouNovel {\n /**\n * なろうAPIへのAPIリクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 実行結果\n */\n protected abstract execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T>;\n\n /**\n * APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 検索結果\n */\n protected async executeSearch<T extends keyof NarouSearchResult>(\n params: SearchParams,\n endpoint = \"https://api.syosetu.com/novelapi/api/\"\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return new NarouSearchResults(await this.execute(params, endpoint), params);\n }\n\n /**\n * 小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/api/\n */\n async executeNovel<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novelapi/api/\"\n );\n }\n\n /**\n * R18小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/xman/api/\n */\n async executeNovel18<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novel18api/api/\"\n );\n }\n\n /**\n * ランキングAPIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング結果\n * @see https://dev.syosetu.com/man/rankapi/\n */\n async executeRanking(params: RankingParams): Promise<NarouRankingResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankget/\");\n }\n\n /**\n * 殿堂入りAPiへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング履歴結果\n * @see https://dev.syosetu.com/man/rankinapi/\n */\n async executeRankingHistory(\n params: RankingHistoryParams\n ): Promise<RankingHistoryRawResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankin/\");\n }\n\n /**\n * ユーザー検索APIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/userapi/\n */\n async executeUserSearch<T extends keyof UserSearchResult>(\n params: UserSearchParams\n ): Promise<NarouSearchResults<UserSearchResult, T>> {\n return await this.execute(params, \"https://api.syosetu.com/userapi/api/\");\n }\n}\n"],"mappings":"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","names":["fetch"]}
@@ -1,8 +1,9 @@
1
- import { N as NarouNovel, a as NarouParams } from './narou-CosGR0J9.cjs';
2
- import './narou-search-results-D_vbjc_I.cjs';
1
+ import { N as NarouNovel, a as NarouParams } from './narou-CatW_TC9.cjs';
2
+ import './narou-search-results-DWCJWTC5.cjs';
3
3
  import './util/type.cjs';
4
4
  import './ranking-history.cjs';
5
5
 
6
+ type Fetch = typeof fetch;
6
7
  /**
7
8
  * なろう小説APIへのリクエストを実行する
8
9
  */
@@ -12,7 +13,7 @@ declare class NarouNovelFetch extends NarouNovel {
12
13
  * コンストラクタ
13
14
  * @param fetch fetch関数(デフォルトはネイティブのfetch)
14
15
  */
15
- constructor(fetch?: typeof globalThis.fetch | undefined);
16
+ constructor(fetch?: Fetch | undefined);
16
17
  protected execute<T>(params: NarouParams, endpoint: string): Promise<T>;
17
18
  }
18
19
 
@@ -1,8 +1,9 @@
1
- import { N as NarouNovel, a as NarouParams } from './narou-CutsOEgk.js';
2
- import './narou-search-results-CvMcnYqe.js';
1
+ import { N as NarouNovel, a as NarouParams } from './narou-fH9osIoh.js';
2
+ import './narou-search-results-D5yqPRZ7.js';
3
3
  import './util/type.js';
4
4
  import './ranking-history.js';
5
5
 
6
+ type Fetch = typeof fetch;
6
7
  /**
7
8
  * なろう小説APIへのリクエストを実行する
8
9
  */
@@ -12,7 +13,7 @@ declare class NarouNovelFetch extends NarouNovel {
12
13
  * コンストラクタ
13
14
  * @param fetch fetch関数(デフォルトはネイティブのfetch)
14
15
  */
15
- constructor(fetch?: typeof globalThis.fetch | undefined);
16
+ constructor(fetch?: Fetch | undefined);
16
17
  protected execute<T>(params: NarouParams, endpoint: string): Promise<T>;
17
18
  }
18
19
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NarouNovelFetch
3
- } from "./chunk-NP5NZV5Q.js";
4
- import "./chunk-JMTNQTNC.js";
3
+ } from "./chunk-SNPBEVCY.js";
4
+ import "./chunk-NVMUSXA5.js";
5
5
  import "./chunk-UN3W2CT3.js";
6
6
  import "./chunk-RITMMCZE.js";
7
7
  export {
@@ -149,7 +149,7 @@ var NarouNovelJsonp = class extends NarouNovel {
149
149
  query.gzip = 0;
150
150
  const url = new URL(endpoint);
151
151
  Object.entries(query).forEach(([key, value]) => {
152
- if (value) {
152
+ if (value !== void 0) {
153
153
  url.searchParams.append(key, value.toString());
154
154
  }
155
155
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/narou-jsonp.ts","../src/narou-search-results.ts","../src/narou.ts","../src/util/jsonp.ts"],"sourcesContent":["import NarouNovel from \"./narou.js\";\nimport type { NarouParams } from \"./narou.js\";\nimport { jsonp } from \"./util/jsonp.js\";\n\n/**\n * なろう小説APIへのリクエストを実行する\n */\nexport default class NarouNovelJsonp extends NarouNovel {\n protected async execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T> {\n const query = { ...params, out: \"jsonp\" };\n query.gzip = 0;\n\n const url = new URL(endpoint);\n\n Object.entries(query).forEach(([key, value]) => {\n if (value) {\n url.searchParams.append(key, value.toString());\n }\n });\n\n return await jsonp(url.toString());\n }\n}\n","import type {\n BooleanNumber as BooleanNumber,\n Genre,\n R18Site,\n SearchParams,\n Fields,\n BigGenre,\n R18Fields,\n OptionalFields,\n UserFields,\n} from \"./params.js\";\n\n/**\n * なろう小説API検索結果\n */\nexport default class NarouSearchResults<T, TKey extends keyof T> {\n /**\n * 検索結果数\n */\n allcount: number;\n /**\n * 結果表示上限数\n */\n limit: number;\n /**\n * 結果表示開始数\n */\n start: number;\n /**\n * 結果表示の現在ページ(=start/limit)\n */\n page: number;\n /**\n * 今回取得できた検索結果の数\n */\n length: number;\n /**\n * 検索結果\n */\n values: readonly Pick<T, TKey>[];\n\n /**\n * @constractor\n * @private\n */\n constructor(\n [header, ...result]: [{ allcount: number }, ...Pick<T, TKey>[]],\n params: SearchParams\n ) {\n const count = header.allcount;\n const limit = params.lim ?? 20;\n const start = params.st ?? 0;\n\n this.allcount = count;\n this.limit = limit;\n this.start = start;\n this.page = start / limit;\n this.length = result.length;\n this.values = result;\n }\n}\n\n/**\n * 小説情報\n * @see https://dev.syosetu.com/man/api/#output\n * @see https://dev.syosetu.com/xman/api/#output\n */\nexport interface NarouSearchResult {\n /** 小説名 */\n title: string;\n /** Nコード */\n ncode: string;\n /** 作者のユーザID(数値) */\n userid: number;\n /** 作者名 */\n writer: string;\n /** 小説のあらすじ */\n story: string;\n /** 掲載サイト */\n nocgenre: R18Site;\n /** 大ジャンル */\n biggenre: BigGenre;\n /** ジャンル */\n genre: Genre;\n /** キーワード */\n keyword: string;\n /** 初回掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_firstup: string;\n /** 最終掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_lastup: string;\n /** 連載の場合は1、短編の場合は2 */\n novel_type: NovelType;\n /** 連載の場合は1、短編の場合は2 */\n noveltype: NovelType;\n /** 短編小説と完結済小説は0となっています。連載中は1です。 */\n end: End;\n /** 全掲載話数です。短編の場合は1です。 */\n general_all_no: number;\n /** 小説文字数です。スペースや改行は文字数としてカウントしません。 */\n length: number;\n /** 読了時間(分単位)です。読了時間は小説文字数÷500を切り上げした数値です。 */\n time: number;\n /** 長期連載中は1、それ以外は0です。 */\n isstop: BooleanNumber;\n /** 登録必須キーワードに「R15」が含まれる場合は1、それ以外は0です。 */\n isr15: BooleanNumber;\n /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */\n isbl: BooleanNumber;\n /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */\n isgl: BooleanNumber;\n /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */\n iszankoku: BooleanNumber;\n /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */\n istensei: BooleanNumber;\n /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */\n istenni: BooleanNumber;\n /** 総合得点(=(ブックマーク数×2)+評価点) */\n global_point: number;\n /**\n * 日間ポイント\n * ランキング集計時点から過去24時間以内で新たに登録されたブックマークや評価が対象\n */\n daily_point: number;\n /**\n * 週間ポイント\n * ランキング集計時点から過去7日以内で新たに登録されたブックマークや評価が対象\n */\n weekly_point: number;\n /**\n * 月間ポイント\n * ランキング集計時点から過去30日以内で新たに登録されたブックマークや評価が対象\n */\n monthly_point: number;\n /**\n * 四半期ポイント\n * ランキング集計時点から過去90日以内で新たに登録されたブックマークや評価が対象\n */\n quarter_point: number;\n /**\n * 年間ポイント\n * ランキング集計時点から過去365日以内で新たに登録されたブックマークや評価が対象\n */\n yearly_point: number;\n /** ブックマーク数 */\n fav_novel_cnt: number;\n /** 感想数 */\n impression_cnt: number;\n /** レビュー数 */\n review_cnt: number;\n /** 評価ポイント */\n all_point: number;\n /** 評価者数 */\n all_hyoka_cnt: number;\n /** 挿絵の数 */\n sasie_cnt: number;\n /**\n * 会話率\n * @see https://dev.syosetu.com/man/kaiwa/\n */\n kaiwaritu: number;\n /**\n * 小説の更新日時\n */\n novelupdated_at: string;\n /**\n * 最終更新日時\n * システム用で小説更新時とは関係ありません\n */\n updated_at: string;\n /** 週間ユニークユーザー数 */\n weekly_unique: number;\n}\n\n/**\n * ユーザ情報\n * @see https://dev.syosetu.com/man/userapi/#output\n */\nexport interface UserSearchResult {\n /** ユーザID */\n userid: number;\n /** ユーザ名 */\n name: string;\n /** ユーザ名のフリガナ */\n yomikata: string;\n /**\n * ユーザ名のフリガナの頭文字\n * ひらがな以外の場合はnullまたは空文字となります。\n */\n name1st: string;\n /** 小説投稿数 */\n novel_cnt: number;\n /** レビュー投稿数 */\n review_cnt: number;\n /**\n * 小説累計文字数\n * スペースや改行は文字数としてカウントしません。\n */\n novel_length: number;\n /**\n * 総合評価ポイントの合計\n * 投稿済小説でそれぞれ獲得した総合評価ポイントの合計です。\n */\n sum_global_point: number;\n}\n\n/**\n * noveltype/novel_typeの値ヘルパー\n */\nexport const NovelType = {\n /** 連載 */\n Rensai: 1,\n /** 短編 */\n Tanpen: 2,\n} as const;\nexport type NovelType = typeof NovelType[keyof typeof NovelType];\n\n/**\n * endの値ヘルパー\n */\nexport const End = {\n /** 短編小説と完結済小説 */\n KanketsuOrTanpen: 0,\n /** 連載中 */\n Rensai: 1,\n} as const;\nexport type End = typeof End[keyof typeof End];\n\nexport type SearchResultFields<T extends Fields> = {\n [K in keyof typeof Fields]: typeof Fields[K] extends T ? K : never;\n}[keyof typeof Fields];\n\nexport type SearchResultOptionalFields<T extends OptionalFields> = {\n [K in keyof typeof OptionalFields]: typeof OptionalFields[K] extends T\n ? K\n : never;\n}[keyof typeof OptionalFields];\n\nexport type SearchResultR18Fields<T extends R18Fields> = {\n [K in keyof typeof R18Fields]: typeof R18Fields[K] extends T ? K : never;\n}[keyof typeof R18Fields];\n\nexport type UserSearchResultFields<T extends UserFields> = {\n [K in keyof typeof UserFields]: typeof UserFields[K] extends T ? K : never;\n}[keyof typeof UserFields];\n\nexport type PickedNarouSearchResult<T extends keyof NarouSearchResult> = Pick<\n NarouSearchResult,\n T\n>;\n","import type { NarouRankingResult } from \"./narou-ranking-results.js\";\nimport NarouSearchResults from \"./narou-search-results.js\";\nimport type {\n NarouSearchResult,\n UserSearchResult,\n} from \"./narou-search-results.js\";\nimport type {\n RankingHistoryParams,\n RankingParams,\n SearchParams,\n UserSearchParams,\n} from \"./params.js\";\nimport type { RankingHistoryRawResult } from \"./ranking-history.js\";\n\n/**\n * なろう小説APIへのリクエストパラメータ\n */\nexport type NarouParams =\n | SearchParams\n | RankingParams\n | RankingHistoryParams\n | UserSearchParams;\n\n/**\n * なろう小説APIへのリクエストを実行する\n * @class NarouNovel\n * @private\n */\nexport default abstract class NarouNovel {\n /**\n * なろうAPIへのAPIリクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 実行結果\n */\n protected abstract execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T>;\n\n /**\n * APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 検索結果\n */\n protected async executeSearch<T extends keyof NarouSearchResult>(\n params: SearchParams,\n endpoint = \"https://api.syosetu.com/novelapi/api/\"\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return new NarouSearchResults(await this.execute(params, endpoint), params);\n }\n\n /**\n * 小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/api/\n */\n async executeNovel<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novelapi/api/\"\n );\n }\n\n /**\n * R18小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/xman/api/\n */\n async executeNovel18<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novel18api/api/\"\n );\n }\n\n /**\n * ランキングAPIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング結果\n * @see https://dev.syosetu.com/man/rankapi/\n */\n async executeRanking(params: RankingParams): Promise<NarouRankingResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankget/\");\n }\n\n /**\n * 殿堂入りAPiへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング履歴結果\n * @see https://dev.syosetu.com/man/rankinapi/\n */\n async executeRankingHistory(\n params: RankingHistoryParams\n ): Promise<RankingHistoryRawResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankin/\");\n }\n\n /**\n * ユーザー検索APIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/userapi/\n */\n async executeUserSearch<T extends keyof UserSearchResult>(\n params: UserSearchParams\n ): Promise<NarouSearchResults<UserSearchResult, T>> {\n return await this.execute(params, \"https://api.syosetu.com/userapi/api/\");\n }\n}\n","/**\n * MIT license\n */\n\n// Callback index.\nlet count = 0;\n\ntype CallbackId<Prefix extends string = string> = `${Prefix}${number}`;\n\ndeclare global {\n interface Window {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: CallbackId]: (data: any) => void;\n }\n}\nexport type JsonpOption = {\n prefix?: string;\n param?: string;\n timeout?: number;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = function () {};\n\nexport function jsonp<T>(\n url: string,\n { prefix = \"__jp\", param = \"callback\", timeout = 15000 }: JsonpOption = {}\n): Promise<T> {\n return new Promise(function (resolve, reject) {\n const targetChild = document.getElementsByTagName(\"script\").item(0);\n const target = targetChild?.parentNode ?? document.head;\n\n const id: CallbackId = `${prefix}${count++}`;\n const cleanup = function () {\n // Remove the script tag.\n if (script && script.parentNode) {\n script.parentNode.removeChild(script);\n }\n\n window[id] = noop;\n\n if (timer) {\n clearTimeout(timer);\n }\n };\n\n const timer =\n timeout > 0\n ? setTimeout(() => {\n cleanup();\n reject(new Error(\"Timeout\"));\n }, timeout)\n : undefined;\n\n const callback = (data: T) => {\n cleanup();\n resolve(data);\n };\n window[id] = callback;\n\n // Create script.\n const script = document.createElement(\"script\");\n const urlObj = new URL(url);\n urlObj.searchParams.set(param, id);\n script.setAttribute(\"src\", urlObj.toString());\n target.insertBefore(script, targetChild);\n });\n}\n"],"mappings":"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","names":["count"]}
1
+ {"version":3,"sources":["../src/narou-jsonp.ts","../src/narou-search-results.ts","../src/narou.ts","../src/util/jsonp.ts"],"sourcesContent":["import NarouNovel from \"./narou.js\";\nimport type { NarouParams } from \"./narou.js\";\nimport { jsonp } from \"./util/jsonp.js\";\n\n/**\n * なろう小説APIへのリクエストを実行する\n */\nexport default class NarouNovelJsonp extends NarouNovel {\n protected async execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T> {\n const query = { ...params, out: \"jsonp\" };\n query.gzip = 0;\n\n const url = new URL(endpoint);\n\n Object.entries(query).forEach(([key, value]) => {\n if (value !== undefined) {\n url.searchParams.append(key, value.toString());\n }\n });\n\n return await jsonp(url.toString());\n }\n}\n","import type {\n BooleanNumber as BooleanNumber,\n Genre,\n R18Site,\n SearchParams,\n Fields,\n BigGenre,\n R18Fields,\n OptionalFields,\n UserFields,\n} from \"./params.js\";\n\n/**\n * なろう小説API検索結果\n */\nexport default class NarouSearchResults<T, TKey extends keyof T> {\n /**\n * 検索結果数\n */\n allcount: number;\n /**\n * 結果表示上限数\n */\n limit: number;\n /**\n * 結果表示開始数\n */\n start: number;\n /**\n * 結果表示の現在ページ(=start/limit)\n */\n page: number;\n /**\n * 今回取得できた検索結果の数\n */\n length: number;\n /**\n * 検索結果\n */\n values: readonly Pick<T, TKey>[];\n\n /**\n * @constractor\n * @private\n */\n constructor(\n [header, ...result]: [{ allcount: number }, ...Pick<T, TKey>[]],\n params: SearchParams\n ) {\n const count = header.allcount;\n const limit = params.lim ?? 20;\n const start = params.st ?? 0;\n\n this.allcount = count;\n this.limit = limit;\n this.start = start;\n this.page = start / limit;\n this.length = result.length;\n this.values = result;\n }\n}\n\n/**\n * 小説情報\n * @see https://dev.syosetu.com/man/api/#output\n * @see https://dev.syosetu.com/xman/api/#output\n */\nexport interface NarouSearchResult {\n /** 小説名 */\n title: string;\n /** Nコード */\n ncode: string;\n /** 作者のユーザID(数値) */\n userid: number;\n /** 作者名 */\n writer: string;\n /** 小説のあらすじ */\n story: string;\n /** 掲載サイト */\n nocgenre: R18Site;\n /** 大ジャンル */\n biggenre: BigGenre;\n /** ジャンル */\n genre: Genre;\n /** キーワード */\n keyword: string;\n /** 初回掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_firstup: string;\n /** 最終掲載日 YYYY-MM-DD HH:MM:SSの形式 */\n general_lastup: string;\n /** 連載の場合は1、短編の場合は2 */\n novel_type: NovelType;\n /** 連載の場合は1、短編の場合は2 */\n noveltype: NovelType;\n /** 短編小説と完結済小説は0となっています。連載中は1です。 */\n end: End;\n /** 全掲載話数です。短編の場合は1です。 */\n general_all_no: number;\n /** 小説文字数です。スペースや改行は文字数としてカウントしません。 */\n length: number;\n /** 読了時間(分単位)です。読了時間は小説文字数÷500を切り上げした数値です。 */\n time: number;\n /** 長期連載中は1、それ以外は0です。 */\n isstop: BooleanNumber;\n /** 登録必須キーワードに「R15」が含まれる場合は1、それ以外は0です。 */\n isr15: BooleanNumber;\n /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */\n isbl: BooleanNumber;\n /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */\n isgl: BooleanNumber;\n /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */\n iszankoku: BooleanNumber;\n /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */\n istensei: BooleanNumber;\n /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */\n istenni: BooleanNumber;\n /** 総合得点(=(ブックマーク数×2)+評価点) */\n global_point: number;\n /**\n * 日間ポイント\n * ランキング集計時点から過去24時間以内で新たに登録されたブックマークや評価が対象\n */\n daily_point: number;\n /**\n * 週間ポイント\n * ランキング集計時点から過去7日以内で新たに登録されたブックマークや評価が対象\n */\n weekly_point: number;\n /**\n * 月間ポイント\n * ランキング集計時点から過去30日以内で新たに登録されたブックマークや評価が対象\n */\n monthly_point: number;\n /**\n * 四半期ポイント\n * ランキング集計時点から過去90日以内で新たに登録されたブックマークや評価が対象\n */\n quarter_point: number;\n /**\n * 年間ポイント\n * ランキング集計時点から過去365日以内で新たに登録されたブックマークや評価が対象\n */\n yearly_point: number;\n /** ブックマーク数 */\n fav_novel_cnt: number;\n /** 感想数 */\n impression_cnt: number;\n /** レビュー数 */\n review_cnt: number;\n /** 評価ポイント */\n all_point: number;\n /** 評価者数 */\n all_hyoka_cnt: number;\n /** 挿絵の数 */\n sasie_cnt: number;\n /**\n * 会話率\n * @see https://dev.syosetu.com/man/kaiwa/\n */\n kaiwaritu: number;\n /**\n * 小説の更新日時\n */\n novelupdated_at: string;\n /**\n * 最終更新日時\n * システム用で小説更新時とは関係ありません\n */\n updated_at: string;\n /** 週間ユニークユーザー数 */\n weekly_unique: number;\n}\n\n/**\n * ユーザ情報\n * @see https://dev.syosetu.com/man/userapi/#output\n */\nexport interface UserSearchResult {\n /** ユーザID */\n userid: number;\n /** ユーザ名 */\n name: string;\n /** ユーザ名のフリガナ */\n yomikata: string;\n /**\n * ユーザ名のフリガナの頭文字\n * ひらがな以外の場合はnullまたは空文字となります。\n */\n name1st: string;\n /** 小説投稿数 */\n novel_cnt: number;\n /** レビュー投稿数 */\n review_cnt: number;\n /**\n * 小説累計文字数\n * スペースや改行は文字数としてカウントしません。\n */\n novel_length: number;\n /**\n * 総合評価ポイントの合計\n * 投稿済小説でそれぞれ獲得した総合評価ポイントの合計です。\n */\n sum_global_point: number;\n}\n\n/**\n * noveltype/novel_typeの値ヘルパー\n */\nexport const NovelType = {\n /** 連載 */\n Rensai: 1,\n /** 短編 */\n Tanpen: 2,\n} as const;\nexport type NovelType = typeof NovelType[keyof typeof NovelType];\n\n/**\n * endの値ヘルパー\n */\nexport const End = {\n /** 短編小説と完結済小説 */\n KanketsuOrTanpen: 0,\n /** 連載中 */\n Rensai: 1,\n} as const;\nexport type End = typeof End[keyof typeof End];\n\nexport type SearchResultFields<T extends Fields> = {\n [K in keyof typeof Fields]: typeof Fields[K] extends T ? K : never;\n}[keyof typeof Fields];\n\nexport type SearchResultOptionalFields<T extends OptionalFields> = {\n [K in keyof typeof OptionalFields]: typeof OptionalFields[K] extends T\n ? K\n : never;\n}[keyof typeof OptionalFields];\n\nexport type SearchResultR18Fields<T extends R18Fields> = {\n [K in keyof typeof R18Fields]: typeof R18Fields[K] extends T ? K : never;\n}[keyof typeof R18Fields];\n\nexport type UserSearchResultFields<T extends UserFields> = {\n [K in keyof typeof UserFields]: typeof UserFields[K] extends T ? K : never;\n}[keyof typeof UserFields];\n\nexport type PickedNarouSearchResult<T extends keyof NarouSearchResult> = Pick<\n NarouSearchResult,\n T\n>;\n","import type { NarouRankingResult } from \"./narou-ranking-results.js\";\nimport NarouSearchResults from \"./narou-search-results.js\";\nimport type {\n NarouSearchResult,\n UserSearchResult,\n} from \"./narou-search-results.js\";\nimport type {\n RankingHistoryParams,\n RankingParams,\n SearchParams,\n UserSearchParams,\n} from \"./params.js\";\nimport type { RankingHistoryRawResult } from \"./ranking-history.js\";\n\n/**\n * なろう小説APIへのリクエストパラメータ\n */\nexport type NarouParams =\n | SearchParams\n | RankingParams\n | RankingHistoryParams\n | UserSearchParams;\n\n/**\n * なろう小説APIへのリクエストを実行する\n * @class NarouNovel\n * @private\n */\nexport default abstract class NarouNovel {\n /**\n * なろうAPIへのAPIリクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 実行結果\n */\n protected abstract execute<T>(\n params: NarouParams,\n endpoint: string\n ): Promise<T>;\n\n /**\n * APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @param endpoint APIエンドポイント\n * @returns 検索結果\n */\n protected async executeSearch<T extends keyof NarouSearchResult>(\n params: SearchParams,\n endpoint = \"https://api.syosetu.com/novelapi/api/\"\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return new NarouSearchResults(await this.execute(params, endpoint), params);\n }\n\n /**\n * 小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/api/\n */\n async executeNovel<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novelapi/api/\"\n );\n }\n\n /**\n * R18小説APIへの検索リクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/xman/api/\n */\n async executeNovel18<T extends keyof NarouSearchResult>(\n params: SearchParams\n ): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return await this.executeSearch(\n params,\n \"https://api.syosetu.com/novel18api/api/\"\n );\n }\n\n /**\n * ランキングAPIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング結果\n * @see https://dev.syosetu.com/man/rankapi/\n */\n async executeRanking(params: RankingParams): Promise<NarouRankingResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankget/\");\n }\n\n /**\n * 殿堂入りAPiへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns ランキング履歴結果\n * @see https://dev.syosetu.com/man/rankinapi/\n */\n async executeRankingHistory(\n params: RankingHistoryParams\n ): Promise<RankingHistoryRawResult[]> {\n return await this.execute(params, \"https://api.syosetu.com/rank/rankin/\");\n }\n\n /**\n * ユーザー検索APIへのリクエストを実行する\n * @param params クエリパラメータ\n * @returns 検索結果\n * @see https://dev.syosetu.com/man/userapi/\n */\n async executeUserSearch<T extends keyof UserSearchResult>(\n params: UserSearchParams\n ): Promise<NarouSearchResults<UserSearchResult, T>> {\n return await this.execute(params, \"https://api.syosetu.com/userapi/api/\");\n }\n}\n","/**\n * MIT license\n */\n\n// Callback index.\nlet count = 0;\n\ntype CallbackId<Prefix extends string = string> = `${Prefix}${number}`;\n\ndeclare global {\n interface Window {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: CallbackId]: (data: any) => void;\n }\n}\nexport type JsonpOption = {\n prefix?: string;\n param?: string;\n timeout?: number;\n};\n\n \nconst noop = function () {};\n\nexport function jsonp<T>(\n url: string,\n { prefix = \"__jp\", param = \"callback\", timeout = 15000 }: JsonpOption = {}\n): Promise<T> {\n return new Promise(function (resolve, reject) {\n const targetChild = document.getElementsByTagName(\"script\").item(0);\n const target = targetChild?.parentNode ?? document.head;\n\n const id: CallbackId = `${prefix}${count++}`;\n const cleanup = function () {\n // Remove the script tag.\n if (script && script.parentNode) {\n script.parentNode.removeChild(script);\n }\n\n window[id] = noop;\n\n if (timer) {\n clearTimeout(timer);\n }\n };\n\n const timer =\n timeout > 0\n ? setTimeout(() => {\n cleanup();\n reject(new Error(\"Timeout\"));\n }, timeout)\n : undefined;\n\n const callback = (data: T) => {\n cleanup();\n resolve(data);\n };\n window[id] = callback;\n\n // Create script.\n const script = document.createElement(\"script\");\n const urlObj = new URL(url);\n urlObj.searchParams.set(param, id);\n script.setAttribute(\"src\", urlObj.toString());\n target.insertBefore(script, targetChild);\n });\n}\n"],"mappings":"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","names":["count"]}
@@ -1,5 +1,5 @@
1
- import { N as NarouNovel, a as NarouParams } from './narou-CosGR0J9.cjs';
2
- import './narou-search-results-D_vbjc_I.cjs';
1
+ import { N as NarouNovel, a as NarouParams } from './narou-CatW_TC9.cjs';
2
+ import './narou-search-results-DWCJWTC5.cjs';
3
3
  import './util/type.cjs';
4
4
  import './ranking-history.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
- import { N as NarouNovel, a as NarouParams } from './narou-CutsOEgk.js';
2
- import './narou-search-results-CvMcnYqe.js';
1
+ import { N as NarouNovel, a as NarouParams } from './narou-fH9osIoh.js';
2
+ import './narou-search-results-D5yqPRZ7.js';
3
3
  import './util/type.js';
4
4
  import './ranking-history.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NarouNovelJsonp
3
- } from "./chunk-GAEL5UWA.js";
4
- import "./chunk-TNDGN3EF.js";
3
+ } from "./chunk-AZT2OXBZ.js";
4
+ import "./chunk-XVH2CU2Q.js";
5
5
  import "./chunk-UN3W2CT3.js";
6
6
  import "./chunk-RITMMCZE.js";
7
7
  export {
@@ -1,4 +1,4 @@
1
- import './narou-search-results-D_vbjc_I.cjs';
2
- export { b as NarouRankingResult, R as RankingResult } from './narou-CosGR0J9.cjs';
1
+ import './narou-search-results-DWCJWTC5.cjs';
2
+ export { b as NarouRankingResult, R as RankingResult } from './narou-CatW_TC9.cjs';
3
3
  import './util/type.cjs';
4
4
  import './ranking-history.cjs';
@@ -1,4 +1,4 @@
1
- import './narou-search-results-CvMcnYqe.js';
2
- export { b as NarouRankingResult, R as RankingResult } from './narou-CutsOEgk.js';
1
+ import './narou-search-results-D5yqPRZ7.js';
2
+ export { b as NarouRankingResult, R as RankingResult } from './narou-fH9osIoh.js';
3
3
  import './util/type.js';
4
4
  import './ranking-history.js';
@@ -6,7 +6,7 @@ declare const RankingType: {
6
6
  readonly Monthly: "m";
7
7
  readonly Quarterly: "q";
8
8
  };
9
- type RankingType = typeof RankingType[keyof typeof RankingType];
9
+ type RankingType = (typeof RankingType)[keyof typeof RankingType];
10
10
  /**
11
11
  * すべてのAPIで共通のクエリパラメータ
12
12
  */
@@ -74,10 +74,9 @@ interface SearchParams extends ParamsBaseWithOrder<Order> {
74
74
  notzankoku?: BooleanNumber;
75
75
  nottensei?: BooleanNumber;
76
76
  nottenni?: BooleanNumber;
77
- nottt?: BooleanNumber;
78
77
  minlen?: number;
79
78
  maxlen?: number;
80
- length?: number | Join<number>;
79
+ length?: number | Join<number | "">;
81
80
  kaiwaritu?: number | string;
82
81
  sasie?: number | string;
83
82
  mintime?: number;
@@ -89,6 +88,7 @@ interface SearchParams extends ParamsBaseWithOrder<Order> {
89
88
  stop?: StopParam;
90
89
  ispickup?: BooleanNumber;
91
90
  lastup?: string;
91
+ lastupdate?: string;
92
92
  opt?: Join<OptionalFields>;
93
93
  }
94
94
  interface RankingParams extends ParamsBase {
@@ -122,7 +122,7 @@ declare const BooleanNumber: {
122
122
  readonly True: 1;
123
123
  readonly False: 0;
124
124
  };
125
- type BooleanNumber = typeof BooleanNumber[keyof typeof BooleanNumber];
125
+ type BooleanNumber = (typeof BooleanNumber)[keyof typeof BooleanNumber];
126
126
  type SearchResultFieldNames = keyof NarouSearchResult;
127
127
  /**
128
128
  * なろう小説APIのofパラメータに指定できる出力する項目
@@ -207,7 +207,7 @@ declare const Fields: {
207
207
  */
208
208
  readonly updated_at: "ua";
209
209
  };
210
- type Fields = typeof Fields[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "nocgenre">];
210
+ type Fields = (typeof Fields)[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "nocgenre">];
211
211
  /**
212
212
  * なろうR18小説APIのofパラメータに指定できる出力する項目
213
213
  * @see https://dev.syosetu.com/xman/api/#output
@@ -287,7 +287,7 @@ declare const R18Fields: {
287
287
  */
288
288
  readonly updated_at: "ua";
289
289
  };
290
- type R18Fields = typeof R18Fields[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "biggenre" | "genre" | "isr15">];
290
+ type R18Fields = (typeof R18Fields)[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "biggenre" | "genre" | "isr15">];
291
291
  /**
292
292
  * オプション項目
293
293
  */
@@ -299,7 +299,7 @@ declare const OptionalFields: {
299
299
  */
300
300
  readonly weekly_unique: "weekly";
301
301
  };
302
- type OptionalFields = typeof OptionalFields[keyof Pick<NarouSearchResult, "weekly_unique">];
302
+ type OptionalFields = (typeof OptionalFields)[keyof Pick<NarouSearchResult, "weekly_unique">];
303
303
  /**
304
304
  * ユーザ検索APIのofパラメータに指定できる出力する項目
305
305
  * @see https://dev.syosetu.com/man/userapi/#output
@@ -322,7 +322,7 @@ declare const UserFields: {
322
322
  /** 総合評価ポイントの合計 */
323
323
  readonly sum_global_point: "sg";
324
324
  };
325
- type UserFields = typeof UserFields[keyof UserSearchResult];
325
+ type UserFields = (typeof UserFields)[keyof UserSearchResult];
326
326
  /**
327
327
  * 出力順序
328
328
  */
@@ -363,8 +363,10 @@ declare const Order: {
363
363
  readonly QuarterPoint: "quarterpoint";
364
364
  /** 年間ポイントの高い順 */
365
365
  readonly YearlyPoint: "yearlypoint";
366
+ /** 初回掲載順 */
367
+ readonly GeneralFirstUp: "generalfirstup";
366
368
  };
367
- type Order = typeof Order[keyof typeof Order];
369
+ type Order = (typeof Order)[keyof typeof Order];
368
370
  /** R18掲載サイト */
369
371
  declare const R18Site: {
370
372
  /** ノクターンノベルズ(男性向け) */
@@ -376,7 +378,7 @@ declare const R18Site: {
376
378
  /** ミッドナイトノベルズ(大人向け) */
377
379
  readonly Midnight: 4;
378
380
  };
379
- type R18Site = typeof R18Site[keyof typeof R18Site];
381
+ type R18Site = (typeof R18Site)[keyof typeof R18Site];
380
382
  /** R18掲載サイト表記ヘルパー */
381
383
  declare const R18SiteNotation: {
382
384
  readonly [K in R18Site]: string;
@@ -396,7 +398,7 @@ declare const BigGenre: {
396
398
  /** ノンジャンル */
397
399
  readonly NonGenre: 98;
398
400
  };
399
- type BigGenre = typeof BigGenre[keyof typeof BigGenre];
401
+ type BigGenre = (typeof BigGenre)[keyof typeof BigGenre];
400
402
  /** 大ジャンル表記ヘルパー */
401
403
  declare const BigGenreNotation: {
402
404
  readonly [K in BigGenre]: string;
@@ -446,7 +448,7 @@ declare const Genre: {
446
448
  /** ノンジャンル〔ノンジャンル〕*/
447
449
  readonly NonGenre: 9801;
448
450
  };
449
- type Genre = typeof Genre[keyof typeof Genre];
451
+ type Genre = (typeof Genre)[keyof typeof Genre];
450
452
  /** ジャンル表記ヘルパー */
451
453
  declare const GenreNotation: {
452
454
  readonly [K in Genre]: string;
@@ -462,7 +464,7 @@ declare const BuntaiParam: {
462
464
  /** 字下げが適切でかつ改行数も平均な作品 */
463
465
  readonly JisageKaigyoHutsuu: 6;
464
466
  };
465
- type BuntaiParam = typeof BuntaiParam[keyof typeof BuntaiParam];
467
+ type BuntaiParam = (typeof BuntaiParam)[keyof typeof BuntaiParam];
466
468
  /** 連載停止中指定 */
467
469
  declare const StopParam: {
468
470
  /** 長期連載停止中を除きます */
@@ -470,7 +472,7 @@ declare const StopParam: {
470
472
  /** 長期連載停止中のみ取得します */
471
473
  readonly Stopping: 2;
472
474
  };
473
- type StopParam = typeof StopParam[keyof typeof StopParam];
475
+ type StopParam = (typeof StopParam)[keyof typeof StopParam];
474
476
  /** 小説タイプ指定 */
475
477
  declare const NovelTypeParam: {
476
478
  /** 短編 */
@@ -484,7 +486,16 @@ declare const NovelTypeParam: {
484
486
  /** 短編と完結済連載小説 */
485
487
  readonly ShortAndRensai: "ter";
486
488
  };
487
- type NovelTypeParam = typeof NovelTypeParam[keyof typeof NovelTypeParam];
489
+ type NovelTypeParam = (typeof NovelTypeParam)[keyof typeof NovelTypeParam];
490
+ /** 日付指定パラメータ */
491
+ declare const DateParam: {
492
+ ThisWeek: string;
493
+ LastWeek: string;
494
+ SevenDays: string;
495
+ ThisMonth: string;
496
+ LastMonth: string;
497
+ };
498
+ type DateParam = (typeof DateParam)[keyof typeof DateParam];
488
499
  declare const UserOrder: {
489
500
  /** ユーザIDの新しい順 */
490
501
  readonly New: "new";
@@ -499,7 +510,7 @@ declare const UserOrder: {
499
510
  /** ユーザIDの古い順 */
500
511
  readonly Old: "old";
501
512
  };
502
- type UserOrder = typeof UserOrder[keyof typeof UserOrder];
513
+ type UserOrder = (typeof UserOrder)[keyof typeof UserOrder];
503
514
  type GzipLevel = 0 | 1 | 2 | 3 | 4 | 5;
504
515
 
505
516
  /**
@@ -713,4 +724,4 @@ type UserSearchResultFields<T extends UserFields> = {
713
724
  }[keyof typeof UserFields];
714
725
  type PickedNarouSearchResult<T extends keyof NarouSearchResult> = Pick<NarouSearchResult, T>;
715
726
 
716
- export { BooleanNumber as B, End as E, Fields as F, Genre as G, NarouSearchResults as N, OptionalFields as O, type ParamsBase as P, RankingType as R, type SearchParams as S, type UserSearchParams as U, type ParamsBaseWithOrder as a, type RankingParams as b, type RankingHistoryParams as c, type SearchResultFieldNames as d, R18Fields as e, UserFields as f, Order as g, R18Site as h, R18SiteNotation as i, BigGenre as j, BigGenreNotation as k, GenreNotation as l, BuntaiParam as m, StopParam as n, NovelTypeParam as o, UserOrder as p, type GzipLevel as q, type NarouSearchResult as r, type UserSearchResult as s, NovelType as t, type SearchResultFields as u, type SearchResultOptionalFields as v, type SearchResultR18Fields as w, type UserSearchResultFields as x, type PickedNarouSearchResult as y };
727
+ export { BooleanNumber as B, DateParam as D, End as E, Fields as F, Genre as G, NarouSearchResults as N, OptionalFields as O, type ParamsBase as P, RankingType as R, type SearchParams as S, type UserSearchParams as U, type ParamsBaseWithOrder as a, type RankingParams as b, type RankingHistoryParams as c, type SearchResultFieldNames as d, R18Fields as e, UserFields as f, Order as g, R18Site as h, R18SiteNotation as i, BigGenre as j, BigGenreNotation as k, GenreNotation as l, BuntaiParam as m, StopParam as n, NovelTypeParam as o, UserOrder as p, type GzipLevel as q, type NarouSearchResult as r, type UserSearchResult as s, NovelType as t, type SearchResultFields as u, type SearchResultOptionalFields as v, type SearchResultR18Fields as w, type UserSearchResultFields as x, type PickedNarouSearchResult as y };
@@ -6,7 +6,7 @@ declare const RankingType: {
6
6
  readonly Monthly: "m";
7
7
  readonly Quarterly: "q";
8
8
  };
9
- type RankingType = typeof RankingType[keyof typeof RankingType];
9
+ type RankingType = (typeof RankingType)[keyof typeof RankingType];
10
10
  /**
11
11
  * すべてのAPIで共通のクエリパラメータ
12
12
  */
@@ -74,10 +74,9 @@ interface SearchParams extends ParamsBaseWithOrder<Order> {
74
74
  notzankoku?: BooleanNumber;
75
75
  nottensei?: BooleanNumber;
76
76
  nottenni?: BooleanNumber;
77
- nottt?: BooleanNumber;
78
77
  minlen?: number;
79
78
  maxlen?: number;
80
- length?: number | Join<number>;
79
+ length?: number | Join<number | "">;
81
80
  kaiwaritu?: number | string;
82
81
  sasie?: number | string;
83
82
  mintime?: number;
@@ -89,6 +88,7 @@ interface SearchParams extends ParamsBaseWithOrder<Order> {
89
88
  stop?: StopParam;
90
89
  ispickup?: BooleanNumber;
91
90
  lastup?: string;
91
+ lastupdate?: string;
92
92
  opt?: Join<OptionalFields>;
93
93
  }
94
94
  interface RankingParams extends ParamsBase {
@@ -122,7 +122,7 @@ declare const BooleanNumber: {
122
122
  readonly True: 1;
123
123
  readonly False: 0;
124
124
  };
125
- type BooleanNumber = typeof BooleanNumber[keyof typeof BooleanNumber];
125
+ type BooleanNumber = (typeof BooleanNumber)[keyof typeof BooleanNumber];
126
126
  type SearchResultFieldNames = keyof NarouSearchResult;
127
127
  /**
128
128
  * なろう小説APIのofパラメータに指定できる出力する項目
@@ -207,7 +207,7 @@ declare const Fields: {
207
207
  */
208
208
  readonly updated_at: "ua";
209
209
  };
210
- type Fields = typeof Fields[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "nocgenre">];
210
+ type Fields = (typeof Fields)[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "nocgenre">];
211
211
  /**
212
212
  * なろうR18小説APIのofパラメータに指定できる出力する項目
213
213
  * @see https://dev.syosetu.com/xman/api/#output
@@ -287,7 +287,7 @@ declare const R18Fields: {
287
287
  */
288
288
  readonly updated_at: "ua";
289
289
  };
290
- type R18Fields = typeof R18Fields[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "biggenre" | "genre" | "isr15">];
290
+ type R18Fields = (typeof R18Fields)[keyof Omit<NarouSearchResult, "novel_type" | "weekly_unique" | "biggenre" | "genre" | "isr15">];
291
291
  /**
292
292
  * オプション項目
293
293
  */
@@ -299,7 +299,7 @@ declare const OptionalFields: {
299
299
  */
300
300
  readonly weekly_unique: "weekly";
301
301
  };
302
- type OptionalFields = typeof OptionalFields[keyof Pick<NarouSearchResult, "weekly_unique">];
302
+ type OptionalFields = (typeof OptionalFields)[keyof Pick<NarouSearchResult, "weekly_unique">];
303
303
  /**
304
304
  * ユーザ検索APIのofパラメータに指定できる出力する項目
305
305
  * @see https://dev.syosetu.com/man/userapi/#output
@@ -322,7 +322,7 @@ declare const UserFields: {
322
322
  /** 総合評価ポイントの合計 */
323
323
  readonly sum_global_point: "sg";
324
324
  };
325
- type UserFields = typeof UserFields[keyof UserSearchResult];
325
+ type UserFields = (typeof UserFields)[keyof UserSearchResult];
326
326
  /**
327
327
  * 出力順序
328
328
  */
@@ -363,8 +363,10 @@ declare const Order: {
363
363
  readonly QuarterPoint: "quarterpoint";
364
364
  /** 年間ポイントの高い順 */
365
365
  readonly YearlyPoint: "yearlypoint";
366
+ /** 初回掲載順 */
367
+ readonly GeneralFirstUp: "generalfirstup";
366
368
  };
367
- type Order = typeof Order[keyof typeof Order];
369
+ type Order = (typeof Order)[keyof typeof Order];
368
370
  /** R18掲載サイト */
369
371
  declare const R18Site: {
370
372
  /** ノクターンノベルズ(男性向け) */
@@ -376,7 +378,7 @@ declare const R18Site: {
376
378
  /** ミッドナイトノベルズ(大人向け) */
377
379
  readonly Midnight: 4;
378
380
  };
379
- type R18Site = typeof R18Site[keyof typeof R18Site];
381
+ type R18Site = (typeof R18Site)[keyof typeof R18Site];
380
382
  /** R18掲載サイト表記ヘルパー */
381
383
  declare const R18SiteNotation: {
382
384
  readonly [K in R18Site]: string;
@@ -396,7 +398,7 @@ declare const BigGenre: {
396
398
  /** ノンジャンル */
397
399
  readonly NonGenre: 98;
398
400
  };
399
- type BigGenre = typeof BigGenre[keyof typeof BigGenre];
401
+ type BigGenre = (typeof BigGenre)[keyof typeof BigGenre];
400
402
  /** 大ジャンル表記ヘルパー */
401
403
  declare const BigGenreNotation: {
402
404
  readonly [K in BigGenre]: string;
@@ -446,7 +448,7 @@ declare const Genre: {
446
448
  /** ノンジャンル〔ノンジャンル〕*/
447
449
  readonly NonGenre: 9801;
448
450
  };
449
- type Genre = typeof Genre[keyof typeof Genre];
451
+ type Genre = (typeof Genre)[keyof typeof Genre];
450
452
  /** ジャンル表記ヘルパー */
451
453
  declare const GenreNotation: {
452
454
  readonly [K in Genre]: string;
@@ -462,7 +464,7 @@ declare const BuntaiParam: {
462
464
  /** 字下げが適切でかつ改行数も平均な作品 */
463
465
  readonly JisageKaigyoHutsuu: 6;
464
466
  };
465
- type BuntaiParam = typeof BuntaiParam[keyof typeof BuntaiParam];
467
+ type BuntaiParam = (typeof BuntaiParam)[keyof typeof BuntaiParam];
466
468
  /** 連載停止中指定 */
467
469
  declare const StopParam: {
468
470
  /** 長期連載停止中を除きます */
@@ -470,7 +472,7 @@ declare const StopParam: {
470
472
  /** 長期連載停止中のみ取得します */
471
473
  readonly Stopping: 2;
472
474
  };
473
- type StopParam = typeof StopParam[keyof typeof StopParam];
475
+ type StopParam = (typeof StopParam)[keyof typeof StopParam];
474
476
  /** 小説タイプ指定 */
475
477
  declare const NovelTypeParam: {
476
478
  /** 短編 */
@@ -484,7 +486,16 @@ declare const NovelTypeParam: {
484
486
  /** 短編と完結済連載小説 */
485
487
  readonly ShortAndRensai: "ter";
486
488
  };
487
- type NovelTypeParam = typeof NovelTypeParam[keyof typeof NovelTypeParam];
489
+ type NovelTypeParam = (typeof NovelTypeParam)[keyof typeof NovelTypeParam];
490
+ /** 日付指定パラメータ */
491
+ declare const DateParam: {
492
+ ThisWeek: string;
493
+ LastWeek: string;
494
+ SevenDays: string;
495
+ ThisMonth: string;
496
+ LastMonth: string;
497
+ };
498
+ type DateParam = (typeof DateParam)[keyof typeof DateParam];
488
499
  declare const UserOrder: {
489
500
  /** ユーザIDの新しい順 */
490
501
  readonly New: "new";
@@ -499,7 +510,7 @@ declare const UserOrder: {
499
510
  /** ユーザIDの古い順 */
500
511
  readonly Old: "old";
501
512
  };
502
- type UserOrder = typeof UserOrder[keyof typeof UserOrder];
513
+ type UserOrder = (typeof UserOrder)[keyof typeof UserOrder];
503
514
  type GzipLevel = 0 | 1 | 2 | 3 | 4 | 5;
504
515
 
505
516
  /**
@@ -713,4 +724,4 @@ type UserSearchResultFields<T extends UserFields> = {
713
724
  }[keyof typeof UserFields];
714
725
  type PickedNarouSearchResult<T extends keyof NarouSearchResult> = Pick<NarouSearchResult, T>;
715
726
 
716
- export { BooleanNumber as B, End as E, Fields as F, Genre as G, NarouSearchResults as N, OptionalFields as O, type ParamsBase as P, RankingType as R, type SearchParams as S, type UserSearchParams as U, type ParamsBaseWithOrder as a, type RankingParams as b, type RankingHistoryParams as c, type SearchResultFieldNames as d, R18Fields as e, UserFields as f, Order as g, R18Site as h, R18SiteNotation as i, BigGenre as j, BigGenreNotation as k, GenreNotation as l, BuntaiParam as m, StopParam as n, NovelTypeParam as o, UserOrder as p, type GzipLevel as q, type NarouSearchResult as r, type UserSearchResult as s, NovelType as t, type SearchResultFields as u, type SearchResultOptionalFields as v, type SearchResultR18Fields as w, type UserSearchResultFields as x, type PickedNarouSearchResult as y };
727
+ export { BooleanNumber as B, DateParam as D, End as E, Fields as F, Genre as G, NarouSearchResults as N, OptionalFields as O, type ParamsBase as P, RankingType as R, type SearchParams as S, type UserSearchParams as U, type ParamsBaseWithOrder as a, type RankingParams as b, type RankingHistoryParams as c, type SearchResultFieldNames as d, R18Fields as e, UserFields as f, Order as g, R18Site as h, R18SiteNotation as i, BigGenre as j, BigGenreNotation as k, GenreNotation as l, BuntaiParam as m, StopParam as n, NovelTypeParam as o, UserOrder as p, type GzipLevel as q, type NarouSearchResult as r, type UserSearchResult as s, NovelType as t, type SearchResultFields as u, type SearchResultOptionalFields as v, type SearchResultR18Fields as w, type UserSearchResultFields as x, type PickedNarouSearchResult as y };
@@ -1,2 +1,2 @@
1
- export { E as End, r as NarouSearchResult, t as NovelType, y as PickedNarouSearchResult, u as SearchResultFields, v as SearchResultOptionalFields, w as SearchResultR18Fields, s as UserSearchResult, x as UserSearchResultFields, N as default } from './narou-search-results-D_vbjc_I.cjs';
1
+ export { E as End, r as NarouSearchResult, t as NovelType, y as PickedNarouSearchResult, u as SearchResultFields, v as SearchResultOptionalFields, w as SearchResultR18Fields, s as UserSearchResult, x as UserSearchResultFields, N as default } from './narou-search-results-DWCJWTC5.cjs';
2
2
  import './util/type.cjs';
@@ -1,2 +1,2 @@
1
- export { E as End, r as NarouSearchResult, t as NovelType, y as PickedNarouSearchResult, u as SearchResultFields, v as SearchResultOptionalFields, w as SearchResultR18Fields, s as UserSearchResult, x as UserSearchResultFields, N as default } from './narou-search-results-CvMcnYqe.js';
1
+ export { E as End, r as NarouSearchResult, t as NovelType, y as PickedNarouSearchResult, u as SearchResultFields, v as SearchResultOptionalFields, w as SearchResultR18Fields, s as UserSearchResult, x as UserSearchResultFields, N as default } from './narou-search-results-D5yqPRZ7.js';
2
2
  import './util/type.js';