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.
- package/dist/{chunk-QQYQ4GQF.js → chunk-4VC3246A.js} +3 -3
- package/dist/{chunk-GAEL5UWA.js → chunk-AZT2OXBZ.js} +3 -3
- package/dist/{chunk-GAEL5UWA.js.map → chunk-AZT2OXBZ.js.map} +1 -1
- package/dist/{chunk-6RIDVTFQ.js → chunk-CDOBNSCL.js} +12 -2
- package/dist/chunk-CDOBNSCL.js.map +1 -0
- package/dist/{chunk-DBCAWGIX.js → chunk-K22KVNAH.js} +2 -2
- package/dist/{chunk-JMTNQTNC.js → chunk-NVMUSXA5.js} +2 -3
- package/dist/{chunk-JMTNQTNC.js.map → chunk-NVMUSXA5.js.map} +1 -1
- package/dist/{chunk-OJGRUQEQ.js → chunk-P7QOZBII.js} +17 -3
- package/dist/chunk-P7QOZBII.js.map +1 -0
- package/dist/{chunk-NP5NZV5Q.js → chunk-SNPBEVCY.js} +7 -4
- package/dist/chunk-SNPBEVCY.js.map +1 -0
- package/dist/{chunk-YJQXIVFD.js → chunk-WYSPGQ3S.js} +2 -2
- package/dist/{chunk-TNDGN3EF.js → chunk-XVH2CU2Q.js} +1 -1
- package/dist/chunk-XVH2CU2Q.js.map +1 -0
- package/dist/index.browser.cjs +31 -9
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +4 -4
- package/dist/index.browser.d.ts +4 -4
- package/dist/index.browser.js +12 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +42 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.common.cjs +27 -2
- package/dist/index.common.cjs.map +1 -1
- package/dist/index.common.d.cts +2 -2
- package/dist/index.common.d.ts +2 -2
- package/dist/index.common.js +7 -5
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +16 -17
- package/dist/index.js.map +1 -1
- package/dist/{narou-CosGR0J9.d.cts → narou-CatW_TC9.d.cts} +6 -3
- package/dist/{narou-CutsOEgk.d.ts → narou-fH9osIoh.d.ts} +6 -3
- package/dist/narou-fetch.cjs +6 -4
- package/dist/narou-fetch.cjs.map +1 -1
- package/dist/narou-fetch.d.cts +4 -3
- package/dist/narou-fetch.d.ts +4 -3
- package/dist/narou-fetch.js +2 -2
- package/dist/narou-jsonp.cjs +1 -1
- package/dist/narou-jsonp.cjs.map +1 -1
- package/dist/narou-jsonp.d.cts +2 -2
- package/dist/narou-jsonp.d.ts +2 -2
- package/dist/narou-jsonp.js +2 -2
- package/dist/narou-ranking-results.d.cts +2 -2
- package/dist/narou-ranking-results.d.ts +2 -2
- package/dist/{narou-search-results-CvMcnYqe.d.ts → narou-search-results-D5yqPRZ7.d.ts} +28 -17
- package/dist/{narou-search-results-D_vbjc_I.d.cts → narou-search-results-DWCJWTC5.d.cts} +28 -17
- package/dist/narou-search-results.d.cts +1 -1
- package/dist/narou-search-results.d.ts +1 -1
- package/dist/narou.d.cts +2 -2
- package/dist/narou.d.ts +2 -2
- package/dist/params.cjs +12 -1
- package/dist/params.cjs.map +1 -1
- package/dist/params.d.cts +1 -1
- package/dist/params.d.ts +1 -1
- package/dist/params.js +3 -1
- package/dist/ranking-history.d.cts +1 -1
- package/dist/ranking-history.d.ts +1 -1
- package/dist/ranking.cjs +15 -1
- package/dist/ranking.cjs.map +1 -1
- package/dist/ranking.d.cts +3 -3
- package/dist/ranking.d.ts +3 -3
- package/dist/ranking.js +3 -3
- package/dist/search-builder-r18.cjs +15 -1
- package/dist/search-builder-r18.cjs.map +1 -1
- package/dist/search-builder-r18.d.cts +2 -2
- package/dist/search-builder-r18.d.ts +2 -2
- package/dist/search-builder-r18.js +3 -3
- package/dist/search-builder.cjs +15 -1
- package/dist/search-builder.cjs.map +1 -1
- package/dist/search-builder.d.cts +2 -2
- package/dist/search-builder.d.ts +2 -2
- package/dist/search-builder.js +2 -2
- package/dist/user-search.cjs.map +1 -1
- package/dist/user-search.d.cts +2 -2
- package/dist/user-search.d.ts +2 -2
- package/dist/user-search.js +3 -3
- package/dist/util/jsonp.cjs.map +1 -1
- package/dist/util/jsonp.js +1 -1
- package/dist/util/unzipp.cjs +1 -2
- package/dist/util/unzipp.cjs.map +1 -1
- package/dist/util/unzipp.js +1 -1
- package/package.json +30 -27
- package/pnpm-lock.yaml +2918 -0
- package/src/narou-fetch.ts +5 -2
- package/src/narou-jsonp.ts +1 -1
- package/src/params.ts +33 -17
- package/src/search-builder.ts +27 -6
- package/src/util/jsonp.ts +1 -1
- package/dist/chunk-6RIDVTFQ.js.map +0 -1
- package/dist/chunk-NP5NZV5Q.js.map +0 -1
- package/dist/chunk-OJGRUQEQ.js.map +0 -1
- package/dist/chunk-TNDGN3EF.js.map +0 -1
- /package/dist/{chunk-QQYQ4GQF.js.map → chunk-4VC3246A.js.map} +0 -0
- /package/dist/{chunk-DBCAWGIX.js.map → chunk-K22KVNAH.js.map} +0 -0
- /package/dist/{chunk-YJQXIVFD.js.map → chunk-WYSPGQ3S.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SearchBuilder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P7QOZBII.js";
|
|
4
4
|
import {
|
|
5
5
|
Fields,
|
|
6
6
|
RankingType
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CDOBNSCL.js";
|
|
8
8
|
|
|
9
9
|
// src/ranking.ts
|
|
10
10
|
import { addDays, format } from "date-fns";
|
|
@@ -80,4 +80,4 @@ var RankingBuilder = class {
|
|
|
80
80
|
export {
|
|
81
81
|
RankingBuilder
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-4VC3246A.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
jsonp
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XVH2CU2Q.js";
|
|
4
4
|
import {
|
|
5
5
|
NarouNovel
|
|
6
6
|
} from "./chunk-UN3W2CT3.js";
|
|
@@ -12,7 +12,7 @@ var NarouNovelJsonp = class extends NarouNovel {
|
|
|
12
12
|
query.gzip = 0;
|
|
13
13
|
const url = new URL(endpoint);
|
|
14
14
|
Object.entries(query).forEach(([key, value]) => {
|
|
15
|
-
if (value) {
|
|
15
|
+
if (value !== void 0) {
|
|
16
16
|
url.searchParams.append(key, value.toString());
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -23,4 +23,4 @@ var NarouNovelJsonp = class extends NarouNovel {
|
|
|
23
23
|
export {
|
|
24
24
|
NarouNovelJsonp
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-AZT2OXBZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/narou-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"],"mappings":";;;;;;;;AAOA,IAAqB,kBAArB,cAA6C,WAAW;AAAA,EACtD,MAAgB,QACd,QACA,UACY;AACZ,UAAM,QAAQ,EAAE,GAAG,QAAQ,KAAK,QAAQ;AACxC,UAAM,OAAO;AAEb,UAAM,MAAM,IAAI,IAAI,QAAQ;AAE5B,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,UAAI,
|
|
1
|
+
{"version":3,"sources":["../src/narou-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"],"mappings":";;;;;;;;AAOA,IAAqB,kBAArB,cAA6C,WAAW;AAAA,EACtD,MAAgB,QACd,QACA,UACY;AACZ,UAAM,QAAQ,EAAE,GAAG,QAAQ,KAAK,QAAQ;AACxC,UAAM,OAAO;AAEb,UAAM,MAAM,IAAI,IAAI,QAAQ;AAE5B,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,UAAI,UAAU,QAAW;AACvB,YAAI,aAAa,OAAO,KAAK,MAAM,SAAS,CAAC;AAAA,MAC/C;AAAA,IACF,CAAC;AAED,WAAO,MAAM,MAAM,IAAI,SAAS,CAAC;AAAA,EACnC;AACF;","names":[]}
|
|
@@ -225,7 +225,9 @@ var Order = {
|
|
|
225
225
|
/** 四半期ポイントの高い順 */
|
|
226
226
|
QuarterPoint: "quarterpoint",
|
|
227
227
|
/** 年間ポイントの高い順 */
|
|
228
|
-
YearlyPoint: "yearlypoint"
|
|
228
|
+
YearlyPoint: "yearlypoint",
|
|
229
|
+
/** 初回掲載順 */
|
|
230
|
+
GeneralFirstUp: "generalfirstup"
|
|
229
231
|
};
|
|
230
232
|
var R18Site = {
|
|
231
233
|
/** ノクターンノベルズ(男性向け) */
|
|
@@ -360,6 +362,13 @@ var NovelTypeParam = {
|
|
|
360
362
|
/** 短編と完結済連載小説 */
|
|
361
363
|
ShortAndRensai: "ter"
|
|
362
364
|
};
|
|
365
|
+
var DateParam = {
|
|
366
|
+
ThisWeek: "thisweek",
|
|
367
|
+
LastWeek: "lastweek",
|
|
368
|
+
SevenDays: "sevenday",
|
|
369
|
+
ThisMonth: "thismonth",
|
|
370
|
+
LastMonth: "lastmonth"
|
|
371
|
+
};
|
|
363
372
|
var UserOrder = {
|
|
364
373
|
/** ユーザIDの新しい順 */
|
|
365
374
|
New: "new",
|
|
@@ -392,6 +401,7 @@ export {
|
|
|
392
401
|
BuntaiParam,
|
|
393
402
|
StopParam,
|
|
394
403
|
NovelTypeParam,
|
|
404
|
+
DateParam,
|
|
395
405
|
UserOrder
|
|
396
406
|
};
|
|
397
|
-
//# sourceMappingURL=chunk-
|
|
407
|
+
//# sourceMappingURL=chunk-CDOBNSCL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/params.ts"],"sourcesContent":["import type {\n NarouSearchResult,\n UserSearchResult,\n} from \"./narou-search-results.js\";\nimport type { Join } from \"./util/type.js\";\n\nexport const RankingType = {\n Daily: \"d\",\n Weekly: \"w\",\n Monthly: \"m\",\n Quarterly: \"q\",\n} as const;\nexport type RankingType = (typeof RankingType)[keyof typeof RankingType];\n\n/**\n * すべてのAPIで共通のクエリパラメータ\n */\nexport interface ParamsBase {\n /**\n * gzip圧縮してgzipファイルとして返します。\n * gzip圧縮レベルを1~5で指定できます。\n * 転送量上限を減らすためにも推奨\n */\n gzip?: GzipLevel;\n /**\n * 出力形式を指定\n * 本ライブラリはJSONとJSONPのみ対応\n */\n out?: \"json\" | \"jsonp\";\n}\n\n/**\n * 検索APIで共通のクエリパラメータ\n */\nexport interface ParamsBaseWithOrder<TOrder extends string> extends ParamsBase {\n /**\n * 出力する項目を個別に指定できます。未指定時は全項目出力されます。\n * 転送量軽減のため、このパラメータの使用が推奨されます。\n */\n of?: string;\n /**\n * 最大出力数を指定できます。指定しない場合は20件になります。\n */\n lim?: number;\n /**\t表示開始位置の指定です。 */\n st?: number;\n /** 出力順序を指定できます。 */\n order?: TOrder;\n}\n\n/**\n * メソッドにパラメータを指定する際のヘルパー。\n * @see https://dev.syosetu.com/man/api/\n * @see https://dev.syosetu.com/xman/atom/\n */\nexport interface SearchParams extends ParamsBaseWithOrder<Order> {\n word?: string;\n notword?: string;\n title?: BooleanNumber;\n ex?: BooleanNumber;\n keyword?: BooleanNumber;\n wname?: BooleanNumber;\n\n biggenre?: Join<BigGenre> | BigGenre;\n notbiggenre?: Join<BigGenre> | BigGenre;\n genre?: Join<Genre> | Genre;\n notgenre?: Join<Genre> | Genre;\n userid?: Join<number> | number;\n\n nocgenre?: Join<R18Site> | R18Site;\n notnocgenre?: Join<R18Site> | R18Site;\n xid?: Join<number> | number;\n\n isr15?: BooleanNumber;\n isbl?: BooleanNumber;\n isgl?: BooleanNumber;\n iszankoku?: BooleanNumber;\n istensei?: BooleanNumber;\n istenni?: BooleanNumber;\n istt?: BooleanNumber;\n\n notr15?: BooleanNumber;\n notbl?: BooleanNumber;\n notgl?: BooleanNumber;\n notzankoku?: BooleanNumber;\n nottensei?: BooleanNumber;\n nottenni?: BooleanNumber;\n\n minlen?: number;\n maxlen?: number;\n length?: number | Join<number | \"\">;\n\n kaiwaritu?: number | string;\n sasie?: number | string;\n\n mintime?: number;\n maxtime?: number;\n time?: number | string;\n\n ncode?: string | Join<string>;\n\n type?: NovelTypeParam;\n\n buntai?: BuntaiParam | Join<BuntaiParam>;\n\n stop?: StopParam;\n\n ispickup?: BooleanNumber;\n lastup?: string;\n lastupdate?: string;\n\n opt?: Join<OptionalFields>;\n}\n\nexport interface RankingParams extends ParamsBase {\n rtype: `${string}-${RankingType}`;\n}\n\nexport interface RankingHistoryParams extends ParamsBase {\n ncode: string;\n}\n\n/**\n * ユーザー検索パラメータ\n */\nexport interface UserSearchParams extends ParamsBaseWithOrder<UserOrder> {\n /** 単語を指定できます。半角または全角スペースで区切るとAND抽出になります。部分一致でHITします。検索の対象はユーザ名とユーザ名のフリガナです。 */\n word?: string;\n /** 含みたくない単語を指定できます。スペースで区切ることにより含ませない単語を増やせます。部分一致で除外されます。除外の対象はユーザ名とユーザ名のフリガナです。 */\n notword?: string;\n /** ユーザIDで抽出可能。 */\n userid?: number;\n /** 抽出するユーザのユーザ名のフリガナの頭文字を指定できます。頭文字はユーザ名のフリガナをひらがなに変換し、最初の1文字が「ぁ」~「ん」の場合に対象となります。 */\n name1st?: string;\n /** 抽出するユーザの小説投稿数の下限を指定できます。小説投稿件数が指定された数値以上のユーザを抽出します。 */\n minnovel?: number;\n /** 抽出するユーザの小説投稿数の上限を指定できます。小説投稿件数が指定された数値以下のユーザを抽出します。 */\n maxnovel?: number;\n /** 抽出するユーザのレビュー投稿数の下限を指定できます。レビュー投稿件数が指定された数値以上のユーザを抽出します。 */\n minreview?: number;\n /** 抽出するユーザのレビュー投稿数の上限を指定できます。レビュー投稿件数が指定された数値以下のユーザを抽出します。 */\n maxreview?: number;\n}\n\nexport const BooleanNumber = {\n True: 1,\n False: 0,\n} as const;\nexport type BooleanNumber = (typeof BooleanNumber)[keyof typeof BooleanNumber];\n\nexport type SearchResultFieldNames = keyof NarouSearchResult;\n\n/**\n * なろう小説APIのofパラメータに指定できる出力する項目\n * @see https://dev.syosetu.com/man/api/#output\n */\nexport const Fields = {\n /** 小説名 */\n title: \"t\",\n /** Nコード */\n ncode: \"n\",\n /** 作者のユーザID(数値) */\n userid: \"u\",\n /** 作者名 */\n writer: \"w\",\n /** 小説のあらすじ */\n story: \"s\",\n /** 大ジャンル */\n biggenre: \"bg\",\n /** ジャンル */\n genre: \"g\",\n /** キーワード */\n keyword: \"k\",\n /** 初回掲載日 */\n general_firstup: \"gf\",\n /** 最終掲載日 */\n general_lastup: \"gl\",\n /** 連載の場合は1、短編の場合は2 */\n noveltype: \"nt\",\n /** 短編小説と完結済小説は0となっています。連載中は1です。 */\n end: \"e\",\n /** 全掲載部分数 */\n general_all_no: \"ga\",\n /** 小説文字数 */\n length: \"l\",\n /** 読了時間(分単位) */\n time: \"ti\",\n /** 長期連載停止中 */\n isstop: \"i\",\n /** 登録必須キーワードに「R15」が含まれる場合は1、それ以外は0です。 */\n isr15: \"isr\",\n /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */\n isbl: \"ibl\",\n /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */\n isgl: \"igl\",\n /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */\n iszankoku: \"izk\",\n /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */\n istensei: \"its\",\n /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */\n istenni: \"iti\",\n /** 総合評価ポイント */\n global_point: \"gp\",\n /** 日間ポイント */\n daily_point: \"dp\",\n /** 週間ポイント */\n weekly_point: \"wp\",\n /** 月間ポイント */\n monthly_point: \"mp\",\n /** 四半期ポイント */\n quarter_point: \"qp\",\n /** 年間ポイント */\n yearly_point: \"yp\",\n /** ブックマーク数 */\n fav_novel_cnt: \"f\",\n /** 感想数 */\n impression_cnt: \"imp\",\n /** レビュー数 */\n review_cnt: \"r\",\n /** 評価ポイント */\n all_point: \"a\",\n /** 評価者数 */\n all_hyoka_cnt: \"ah\",\n /** 挿絵の数 */\n sasie_cnt: \"sa\",\n /** 会話率 */\n kaiwaritu: \"ka\",\n /** 小説の更新日時 */\n novelupdated_at: \"nu\",\n /**\n * 最終更新日時\n * システム用で小説更新時とは関係ありません\n */\n updated_at: \"ua\",\n} as const;\n\nexport type Fields = (typeof Fields)[keyof Omit<\n NarouSearchResult,\n \"novel_type\" | \"weekly_unique\" | \"nocgenre\"\n>];\n\n/**\n * なろうR18小説APIのofパラメータに指定できる出力する項目\n * @see https://dev.syosetu.com/xman/api/#output\n */\nexport const R18Fields = {\n /** 小説名 */\n title: \"t\",\n /** Nコード */\n ncode: \"n\",\n /** 作者のユーザID(数値) */\n userid: \"u\",\n /** 作者名 */\n writer: \"w\",\n /** 小説のあらすじ */\n story: \"s\",\n /** 掲載サイト */\n nocgenre: \"ng\",\n /** キーワード */\n keyword: \"k\",\n /** 初回掲載日 */\n general_firstup: \"gf\",\n /** 最終掲載日 */\n general_lastup: \"gl\",\n /** 連載の場合は1、短編の場合は2 */\n noveltype: \"nt\",\n /** 短編小説と完結済小説は0となっています。連載中は1です。 */\n end: \"e\",\n /** 全掲載部分数 */\n general_all_no: \"ga\",\n /** 小説文字数 */\n length: \"l\",\n /** 読了時間(分単位) */\n time: \"ti\",\n /** 長期連載停止中 */\n isstop: \"i\",\n /** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */\n isbl: \"ibl\",\n /** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */\n isgl: \"igl\",\n /** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */\n iszankoku: \"izk\",\n /** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */\n istensei: \"its\",\n /** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */\n istenni: \"iti\",\n /** 総合評価ポイント */\n global_point: \"gp\",\n /** 日間ポイント */\n daily_point: \"dp\",\n /** 週間ポイント */\n weekly_point: \"wp\",\n /** 月間ポイント */\n monthly_point: \"mp\",\n /** 四半期ポイント */\n quarter_point: \"qp\",\n /** 年間ポイント */\n yearly_point: \"yp\",\n /** R18ブックマーク数 */\n fav_novel_cnt: \"f\",\n /** 感想数 */\n impression_cnt: \"imp\",\n /** レビュー数 */\n review_cnt: \"r\",\n /** 評価ポイント */\n all_point: \"a\",\n /** 評価者数 */\n all_hyoka_cnt: \"ah\",\n /** 挿絵の数 */\n sasie_cnt: \"sa\",\n /** 会話率 */\n kaiwaritu: \"ka\",\n /** 小説の更新日時 */\n novelupdated_at: \"nu\",\n /**\n * 最終更新日時\n * システム用で小説更新時とは関係ありません\n */\n updated_at: \"ua\",\n} as const;\n\nexport type R18Fields = (typeof R18Fields)[keyof Omit<\n NarouSearchResult,\n \"novel_type\" | \"weekly_unique\" | \"biggenre\" | \"genre\" | \"isr15\"\n>];\n\n/**\n * オプション項目\n */\nexport const OptionalFields = {\n /**\n * 週間ユニークユーザ[項目名:weekly_unique]が追加されます。\n * 週間ユニークユーザは前週の日曜日から土曜日分のユニークの合計です。\n * 毎週火曜日早朝に更新されます。\n */\n weekly_unique: \"weekly\",\n} as const;\n\nexport type OptionalFields = (typeof OptionalFields)[keyof Pick<\n NarouSearchResult,\n \"weekly_unique\"\n>];\n\n/**\n * ユーザ検索APIのofパラメータに指定できる出力する項目\n * @see https://dev.syosetu.com/man/userapi/#output\n */\nexport const UserFields = {\n /** ユーザID */\n userid: \"u\",\n /** ユーザ名 */\n name: \"n\",\n /** ユーザ名のフリガナ */\n yomikata: \"y\",\n /** ユーザ名のフリガナの頭文字 */\n name1st: \"1\",\n /** 小説投稿数 */\n novel_cnt: \"nc\",\n /** レビュー投稿数 */\n review_cnt: \"rc\",\n /** 小説累計文字数 */\n novel_length: \"nl\",\n /** 総合評価ポイントの合計 */\n sum_global_point: \"sg\",\n} as const;\nexport type UserFields = (typeof UserFields)[keyof UserSearchResult];\n\n/**\n * 出力順序\n */\nexport const Order = {\n /** ブックマーク数の多い順 */\n FavoriteNovelCount: \"favnovelcnt\",\n /** レビュー数の多い順 */\n ReviewCount: \"favnovelcnt\",\n /** 総合ポイントの高い順 */\n HyokaDesc: \"hyoka\",\n /** 総合ポイントの低い順 */\n HyokaAsc: \"hyokaasc\",\n /** 感想の多い順 */\n ImpressionCount: \"impressioncnt\",\n /** 評価者数の多い順 */\n HyokaCountDesc: \"hyokacnt\",\n /** 評価者数の少ない順 */\n HyokaCountAsc: \"hyokacntasc\",\n /** 週間ユニークユーザの多い順 */\n Weekly: \"weekly\",\n /** 小説本文の文字数が多い順 */\n LengthDesc: \"lengthdesc\",\n /** 小説本文の文字数が少ない順 */\n LengthAsc: \"lengthasc\",\n /** Nコードが新しい順 */\n NCodeDesc: \"ncodedesc\",\n /** 新着更新順 */\n New: \"new\",\n /** 古い順 */\n Old: \"old\",\n /** 日間ポイントの高い順 */\n DailyPoint: \"dailypoint\",\n /** 週間ポイントの高い順 */\n WeeklyPoint: \"weeklypoint\",\n /** 月間ポイントの高い順 */\n MonthlyPoint: \"monthlypoint\",\n /** 四半期ポイントの高い順 */\n QuarterPoint: \"quarterpoint\",\n /** 年間ポイントの高い順 */\n YearlyPoint: \"yearlypoint\",\n /** 初回掲載順 */\n GeneralFirstUp: \"generalfirstup\",\n} as const;\n\nexport type Order = (typeof Order)[keyof typeof Order];\n\n/** R18掲載サイト */\nexport const R18Site = {\n /** ノクターンノベルズ(男性向け) */\n Nocturne: 1,\n /** ムーンライトノベルズ(女性向け) */\n MoonLight: 2,\n /** ムーンライトノベルズ(BL) */\n MoonLightBL: 3,\n /** ミッドナイトノベルズ(大人向け) */\n Midnight: 4,\n} as const;\n\nexport type R18Site = (typeof R18Site)[keyof typeof R18Site];\n\n/** R18掲載サイト表記ヘルパー */\nexport const R18SiteNotation: { readonly [K in R18Site]: string } = {\n [R18Site.Nocturne]: \"ノクターンノベルズ(男性向け)\",\n [R18Site.MoonLight]: \"ムーンライトノベルズ(女性向け)\",\n [R18Site.MoonLightBL]: \"ムーンライトノベルズ(BL)\",\n [R18Site.Midnight]: \"ミッドナイトノベルズ(大人向け)\",\n} as const;\n\n/** 大ジャンル */\nexport const BigGenre = {\n /** 恋愛 */\n Renai: 1,\n /** ファンタジー */\n Fantasy: 2,\n /** 文芸 */\n Bungei: 3,\n /** SF */\n Sf: 4,\n /** その他 */\n Sonota: 99,\n /** ノンジャンル */\n NonGenre: 98,\n} as const;\n\nexport type BigGenre = (typeof BigGenre)[keyof typeof BigGenre];\n\n/** 大ジャンル表記ヘルパー */\nexport const BigGenreNotation: { readonly [K in BigGenre]: string } = {\n [BigGenre.Renai]: \"恋愛\",\n [BigGenre.Fantasy]: \"ファンタジー\",\n [BigGenre.Bungei]: \"文芸\",\n [BigGenre.Sf]: \"SF\",\n [BigGenre.Sonota]: \"その他\",\n [BigGenre.NonGenre]: \"ノンジャンル\",\n} as const;\n\n/** ジャンル */\nexport const Genre = {\n /** 異世界〔恋愛〕*/\n RenaiIsekai: 101,\n /** 現実世界〔恋愛〕*/\n RenaiGenjitsusekai: 102,\n /** ハイファンタジー〔ファンタジー〕*/\n FantasyHigh: 201,\n /** ローファンタジー〔ファンタジー〕*/\n FantasyLow: 202,\n /** 純文学〔文芸〕*/\n BungeiJyunbungei: 301,\n /** ヒューマンドラマ〔文芸〕*/\n BungeiHumanDrama: 302,\n /** 歴史〔文芸〕*/\n BungeiHistory: 303,\n /** 推理〔文芸〕*/\n BungeiSuiri: 304,\n /** ホラー〔文芸〕*/\n BungeiHorror: 305,\n /** アクション〔文芸〕*/\n BungeiAction: 306,\n /** コメディー〔文芸〕*/\n BungeiComedy: 307,\n /** VRゲーム〔SF〕*/\n SfVrgame: 401,\n /** 宇宙〔SF〕*/\n SfSpace: 402,\n /** 空想科学〔SF〕*/\n SfKuusoukagaku: 403,\n /** パニック〔SF〕*/\n SfPanic: 404,\n /** 童話〔その他〕*/\n SonotaDouwa: 9901,\n /** 詩〔その他〕*/\n SonotaShi: 9902,\n /** エッセイ〔その他〕*/\n SonotaEssei: 9903,\n /** リプレイ〔その他〕*/\n SonotaReplay: 9904,\n /** その他〔その他〕 */\n SonotaSonota: 9999,\n /** ノンジャンル〔ノンジャンル〕*/\n NonGenre: 9801,\n} as const;\nexport type Genre = (typeof Genre)[keyof typeof Genre];\n\n/** ジャンル表記ヘルパー */\nexport const GenreNotation: { readonly [K in Genre]: string } = {\n [Genre.RenaiIsekai]: \"異世界〔恋愛〕\",\n [Genre.RenaiGenjitsusekai]: \"現実世界〔恋愛〕\",\n [Genre.FantasyHigh]: \"ハイファンタジー〔ファンタジー〕\",\n [Genre.FantasyLow]: \"ローファンタジー〔ファンタジー〕\",\n [Genre.BungeiJyunbungei]: \"純文学〔文芸〕\",\n [Genre.BungeiHumanDrama]: \"ヒューマンドラマ〔文芸〕\",\n [Genre.BungeiHistory]: \"歴史〔文芸〕\",\n [Genre.BungeiSuiri]: \"推理〔文芸〕\",\n [Genre.BungeiHorror]: \"ホラー〔文芸〕\",\n [Genre.BungeiAction]: \"アクション〔文芸〕\",\n [Genre.BungeiComedy]: \"コメディー〔文芸〕\",\n [Genre.SfVrgame]: \"VRゲーム〔SF〕\",\n [Genre.SfSpace]: \"宇宙〔SF〕\",\n [Genre.SfKuusoukagaku]: \"空想科学〔SF〕\",\n [Genre.SfPanic]: \"パニック〔SF〕\",\n [Genre.SonotaDouwa]: \"童話〔その他〕\",\n [Genre.SonotaShi]: \"詩〔その他〕\",\n [Genre.SonotaEssei]: \"エッセイ〔その他〕\",\n [Genre.SonotaReplay]: \"リプレイ〔その他〕\",\n [Genre.SonotaSonota]: \"その他〔その他〕\",\n [Genre.NonGenre]: \"ノンジャンル〔ノンジャンル〕\",\n} as const;\n\n/** 文体指定 */\nexport const BuntaiParam = {\n /** 字下げされておらず、連続改行が多い作品 */\n NoJisageKaigyouOoi: 1,\n /** 字下げされていないが、改行数は平均な作品 */\n NoJisageKaigyoHutsuu: 2,\n /** 字下げが適切だが、連続改行が多い作品 */\n JisageKaigyoOoi: 4,\n /** 字下げが適切でかつ改行数も平均な作品 */\n JisageKaigyoHutsuu: 6,\n} as const;\n\nexport type BuntaiParam = (typeof BuntaiParam)[keyof typeof BuntaiParam];\n\n/** 連載停止中指定 */\nexport const StopParam = {\n /** 長期連載停止中を除きます */\n NoStopping: 1,\n /** 長期連載停止中のみ取得します */\n Stopping: 2,\n} as const;\n\nexport type StopParam = (typeof StopParam)[keyof typeof StopParam];\n\n/** 小説タイプ指定 */\nexport const NovelTypeParam = {\n /** 短編 */\n Short: \"t\",\n /** 連載中 */\n RensaiNow: \"r\",\n /** 完結済連載小説 */\n RensaiEnd: \"er\",\n /** すべての連載小説(連載中および完結済) */\n Rensai: \"re\",\n /** 短編と完結済連載小説 */\n ShortAndRensai: \"ter\",\n} as const;\nexport type NovelTypeParam =\n (typeof NovelTypeParam)[keyof typeof NovelTypeParam];\n\n/** 日付指定パラメータ */\nexport const DateParam = {\n ThisWeek: \"thisweek\",\n LastWeek: \"lastweek\",\n SevenDays: \"sevenday\",\n ThisMonth: \"thismonth\",\n LastMonth: \"lastmonth\",\n};\nexport type DateParam = (typeof DateParam)[keyof typeof DateParam];\n\nexport const UserOrder = {\n /** ユーザIDの新しい順 */\n New: \"new\",\n /** 小説投稿数の多い順 */\n NovelCount: \"novelcnt\",\n /** レビュー投稿数の多い順 */\n ReviewCount: \"reviewcnt\",\n /** 小説累計文字数の多い順 */\n NovelLength: \"novellength\",\n /** 総合評価ポイントの合計の多い順 */\n SumGlobalPoint: \"sumglobalpoint\",\n /** ユーザIDの古い順 */\n Old: \"old\",\n} as const;\nexport type UserOrder = (typeof UserOrder)[keyof typeof UserOrder];\n\nexport type GzipLevel = 0 | 1 | 2 | 3 | 4 | 5;\n"],"mappings":";AAMO,IAAM,cAAc;AAAA,EACzB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AACb;AAqIO,IAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,OAAO;AACT;AASO,IAAM,SAAS;AAAA;AAAA,EAEpB,OAAO;AAAA;AAAA,EAEP,OAAO;AAAA;AAAA,EAEP,QAAQ;AAAA;AAAA,EAER,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA;AAAA,EAEP,UAAU;AAAA;AAAA,EAEV,OAAO;AAAA;AAAA,EAEP,SAAS;AAAA;AAAA,EAET,iBAAiB;AAAA;AAAA,EAEjB,gBAAgB;AAAA;AAAA,EAEhB,WAAW;AAAA;AAAA,EAEX,KAAK;AAAA;AAAA,EAEL,gBAAgB;AAAA;AAAA,EAEhB,QAAQ;AAAA;AAAA,EAER,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA;AAAA,EAEP,MAAM;AAAA;AAAA,EAE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uilderBase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P7QOZBII.js";
|
|
4
4
|
|
|
5
5
|
// src/user-search.ts
|
|
6
6
|
var UserSearchBuilder = class _UserSearchBuilder extends SearchBuilderBase {
|
|
@@ -91,4 +91,4 @@ var UserSearchBuilder = class _UserSearchBuilder extends SearchBuilderBase {
|
|
|
91
91
|
export {
|
|
92
92
|
UserSearchBuilder
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-K22KVNAH.js.map
|
|
@@ -12,8 +12,7 @@ async function unzipp(data) {
|
|
|
12
12
|
throw decoder.decode(buffer);
|
|
13
13
|
}
|
|
14
14
|
} catch (e) {
|
|
15
|
-
if (typeof e === "string")
|
|
16
|
-
throw e;
|
|
15
|
+
if (typeof e === "string") throw e;
|
|
17
16
|
throw decoder.decode(data);
|
|
18
17
|
}
|
|
19
18
|
}
|
|
@@ -21,4 +20,4 @@ async function unzipp(data) {
|
|
|
21
20
|
export {
|
|
22
21
|
unzipp
|
|
23
22
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-NVMUSXA5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/unzipp.ts"],"sourcesContent":["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"],"mappings":";AAAA,SAAS,cAAyB;AAClC,SAAS,iBAAiB;AAE1B,IAAM,cAAc,UAA6B,MAAM;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
|
|
1
|
+
{"version":3,"sources":["../src/util/unzipp.ts"],"sourcesContent":["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"],"mappings":";AAAA,SAAS,cAAyB;AAClC,SAAS,iBAAiB;AAE1B,IAAM,cAAc,UAA6B,MAAM;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,SAAU,OAAM;AACjC,UAAM,QAAQ,OAAO,IAAI;AAAA,EAC3B;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BooleanNumber,
|
|
3
3
|
StopParam
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CDOBNSCL.js";
|
|
5
5
|
|
|
6
6
|
// src/search-builder.ts
|
|
7
7
|
var SearchBuilderBase = class {
|
|
@@ -281,7 +281,7 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
|
|
|
281
281
|
date = x;
|
|
282
282
|
} else if (x instanceof Date && y instanceof Date) {
|
|
283
283
|
date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
|
|
284
|
-
|
|
284
|
+
y.getTime() / 1e3
|
|
285
285
|
)}`;
|
|
286
286
|
} else {
|
|
287
287
|
date = `${x}-${y}`;
|
|
@@ -289,6 +289,20 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
|
|
|
289
289
|
this.set({ lastup: date });
|
|
290
290
|
return this;
|
|
291
291
|
}
|
|
292
|
+
lastNovelUpdate(x, y) {
|
|
293
|
+
let date;
|
|
294
|
+
if (typeof x == "string") {
|
|
295
|
+
date = x;
|
|
296
|
+
} else if (x instanceof Date && y instanceof Date) {
|
|
297
|
+
date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
|
|
298
|
+
y.getTime() / 1e3
|
|
299
|
+
)}`;
|
|
300
|
+
} else {
|
|
301
|
+
date = `${x}-${y}`;
|
|
302
|
+
}
|
|
303
|
+
this.set({ lastupdate: date });
|
|
304
|
+
return this;
|
|
305
|
+
}
|
|
292
306
|
/**
|
|
293
307
|
* なろう小説APIへの検索リクエストを実行する
|
|
294
308
|
* @returns {Promise<NarouSearchResults>} 検索結果
|
|
@@ -369,4 +383,4 @@ export {
|
|
|
369
383
|
NovelSearchBuilderBase,
|
|
370
384
|
SearchBuilder
|
|
371
385
|
};
|
|
372
|
-
//# sourceMappingURL=chunk-
|
|
386
|
+
//# sourceMappingURL=chunk-P7QOZBII.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/search-builder.ts"],"sourcesContent":["import type NarouNovel from \"./narou.js\";\nimport type {\n NarouSearchResult,\n SearchResultFields,\n SearchResultOptionalFields,\n} from \"./narou-search-results.js\";\nimport type NarouSearchResults from \"./narou-search-results.js\";\nimport type {\n BigGenre,\n SearchResultFieldNames,\n Genre,\n SearchParams,\n Fields,\n Order,\n BuntaiParam,\n NovelTypeParam,\n GzipLevel,\n OptionalFields,\n ParamsBaseWithOrder,\n DateParam,\n} from \"./params.js\";\nimport { BooleanNumber, StopParam } from \"./params.js\";\nimport type { Join } from \"./util/type.js\";\n\nexport type DefaultSearchResultFields = keyof Omit<\n NarouSearchResult,\n \"weekly_unique\" | \"noveltype\" | \"nocgenre\" | \"xid\"\n>;\n\nexport abstract class SearchBuilderBase<\n TParams extends ParamsBaseWithOrder<TOrder>,\n TOrder extends string,\n> {\n /**\n * constructor\n * @private\n */\n constructor(\n protected params: TParams = {} as TParams,\n protected api: NarouNovel\n ) {}\n\n protected static distinct<T>(array: readonly T[]): T[] {\n return Array.from(new Set(array));\n }\n\n protected static array2string<T extends string | number>(\n n: T | readonly T[]\n ): Join<T> {\n if (Array.isArray(n)) {\n return this.distinct(n).join(\"-\") as Join<T>;\n } else {\n return n.toString() as Join<T>;\n }\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n limit(num: number): this {\n this.set({ lim: num } as TParams);\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n start(num: number): this {\n this.set({ st: num } as TParams);\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n page(no: number, count = 20): this {\n return this.limit(count).start(no * count);\n }\n\n /**\n * 出力順序を指定する。指定しない場合は新着順となります。\n * old\t古い順\n * @param {TOrder} order 出力順序\n * @return {SearchBuilder} this\n */\n order(order: TOrder): this {\n this.set({ order: order } as TParams);\n return this;\n }\n\n /**\n * gzip圧縮する。\n *\n * 転送量上限を減らすためにも推奨\n * @param {GzipLevel} level gzip圧縮レベル(1~5)\n * @return {SearchBuilder} this\n */\n gzip(level: GzipLevel): this {\n this.set({ gzip: level } as TParams);\n return this;\n }\n\n /**\n * クエリパラメータをセットする\n * @private\n * @return {SearchBuilder} this\n */\n protected set(obj: TParams): this {\n this.params = { ...this.params, ...obj };\n return this;\n }\n\n /**\n * クエリパラメータを削除する\n */\n protected unset(key: keyof TParams): this {\n delete this.params[key];\n return this;\n }\n}\n\nexport abstract class NovelSearchBuilderBase<\n T extends SearchResultFieldNames,\n> extends SearchBuilderBase<SearchParams, Order> {\n /**\n * a\n * @return {SearchBuilder} this\n */\n word(word: string): this {\n this.set({ word: word });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n notWord(word: string): this {\n this.set({ notword: word });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n byTitle(bool = true): this {\n this.set({ title: bool ? BooleanNumber.True : BooleanNumber.False });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n byOutline(bool = true): this {\n this.set({ ex: bool ? BooleanNumber.True : BooleanNumber.False });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n byKeyword(bool = true): this {\n this.set({ keyword: bool ? BooleanNumber.True : BooleanNumber.False });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n byAuthor(bool = true): this {\n this.set({ wname: bool ? BooleanNumber.True : BooleanNumber.False });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isBL(bool = true): this {\n if (bool) {\n this.set({ isbl: BooleanNumber.True });\n } else {\n this.set({ notbl: BooleanNumber.True });\n }\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isGL(bool = true): this {\n if (bool) {\n this.set({ isgl: BooleanNumber.True });\n } else {\n this.set({ notgl: BooleanNumber.True });\n }\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isZankoku(bool = true): this {\n if (bool) {\n this.set({ iszankoku: BooleanNumber.True });\n } else {\n this.set({ notzankoku: BooleanNumber.True });\n }\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isTensei(bool = true): this {\n if (bool) {\n this.set({ istensei: BooleanNumber.True });\n } else {\n this.set({ nottensei: BooleanNumber.True });\n }\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isTenni(bool = true): this {\n if (bool) {\n this.set({ istenni: BooleanNumber.True });\n } else {\n this.set({ nottenni: BooleanNumber.True });\n }\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isTT(): this {\n this.set({ istt: BooleanNumber.True });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n length(length: number | readonly number[]): this {\n this.set({ length: NovelSearchBuilderBase.array2string(length) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n kaiwaritu(num: number): this;\n kaiwaritu(min: number, max: number): this;\n\n kaiwaritu(min: number, max?: number): this {\n let n: number | string;\n if (max != null) {\n n = `${min}-${max}`;\n } else {\n n = min;\n }\n this.set({ kaiwaritu: n });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n sasie(num: number | readonly number[]): this {\n this.set({ sasie: NovelSearchBuilderBase.array2string(num) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n time(num: number | readonly number[]): this {\n this.set({ time: NovelSearchBuilderBase.array2string(num) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n ncode(ncodes: string | readonly string[]): this {\n this.set({ ncode: NovelSearchBuilderBase.array2string(ncodes) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n type(type: NovelTypeParam): this {\n this.set({ type });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n buntai(buntai: BuntaiParam | readonly BuntaiParam[]): this {\n this.set({ buntai: NovelSearchBuilderBase.array2string(buntai) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isStop(bool = true): this {\n this.set({ stop: bool ? StopParam.Stopping : StopParam.NoStopping });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isPickup(bool = true): this {\n this.set({ ispickup: bool ? BooleanNumber.True : BooleanNumber.False });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n lastUpdate(date: DateParam): this;\n lastUpdate(from: number, to: number): this;\n lastUpdate(from: Date, to: Date): this;\n\n lastUpdate(x: string | number | Date, y?: number | Date): this {\n let date: string;\n if (typeof x == \"string\") {\n date = x;\n } else if (x instanceof Date && y instanceof Date) {\n date = `${Math.floor(x.getTime() / 1000)}-${Math.floor(\n y.getTime() / 1000\n )}`;\n } else {\n date = `${x}-${y}`;\n }\n\n this.set({ lastup: date });\n return this;\n }\n\n lastNovelUpdate(date: DateParam): this;\n lastNovelUpdate(from: number, to: number): this;\n lastNovelUpdate(from: Date, to: Date): this;\n\n lastNovelUpdate(x: string | number | Date, y?: number | Date): this {\n let date: string;\n if (typeof x == \"string\") {\n date = x;\n } else if (x instanceof Date && y instanceof Date) {\n date = `${Math.floor(x.getTime() / 1000)}-${Math.floor(\n y.getTime() / 1000\n )}`;\n } else {\n date = `${x}-${y}`;\n }\n\n this.set({ lastupdate: date });\n return this;\n }\n\n /**\n * なろう小説APIへの検索リクエストを実行する\n * @returns {Promise<NarouSearchResults>} 検索結果\n */\n execute(): Promise<NarouSearchResults<NarouSearchResult, T>> {\n return this.api.executeNovel(this.params);\n }\n}\n\n/**\n * 検索ヘルパー\n * @class SearchBuilder\n */\nexport default class SearchBuilder<\n T extends keyof NarouSearchResult = DefaultSearchResultFields,\n TOpt extends keyof NarouSearchResult = never,\n> extends NovelSearchBuilderBase<T | TOpt> {\n /**\n *\n * @return {SearchBuilder} this\n */\n bigGenre(genre: BigGenre | readonly BigGenre[]): this {\n this.set({ biggenre: SearchBuilder.array2string(genre) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n notBigGenre(genre: BigGenre | readonly BigGenre[]): this {\n this.set({ notbiggenre: SearchBuilder.array2string(genre) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n genre(genre: Genre | readonly Genre[]): this {\n this.set({ genre: SearchBuilder.array2string(genre) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n notGenre(genre: Genre | readonly Genre[]): this {\n this.set({ notgenre: SearchBuilder.array2string(genre) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n userId(ids: number | readonly number[]): this {\n this.set({ userid: SearchBuilder.array2string(ids) });\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n isR15(bool = true): this {\n if (bool) {\n this.set({ isr15: 1 });\n } else {\n this.set({ notr15: 1 });\n }\n return this;\n }\n\n /**\n *\n * @return {SearchBuilder} this\n */\n fields<TFields extends Fields>(\n fields: TFields | readonly TFields[]\n ): SearchBuilder<SearchResultFields<TFields>, TOpt> {\n this.set({ of: SearchBuilder.array2string(fields) });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return this as any;\n }\n\n opt<TFields extends OptionalFields>(\n option: TFields | readonly TFields[]\n ): SearchBuilder<T, SearchResultOptionalFields<TFields>> {\n this.set({ opt: SearchBuilder.array2string(option) });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return this as any;\n }\n}\n"],"mappings":";;;;;;AA6BO,IAAe,oBAAf,MAGL;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,YACY,SAAkB,CAAC,GACnB,KACV;AAFU;AACA;AAAA,EACT;AAAA,EAEH,OAAiB,SAAY,OAA0B;AACrD,WAAO,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC;AAAA,EAClC;AAAA,EAEA,OAAiB,aACf,GACS;AACT,QAAI,MAAM,QAAQ,CAAC,GAAG;AACpB,aAAO,KAAK,SAAS,CAAC,EAAE,KAAK,GAAG;AAAA,IAClC,OAAO;AACL,aAAO,EAAE,SAAS;AAAA,IACpB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,KAAmB;AACvB,SAAK,IAAI,EAAE,KAAK,IAAI,CAAY;AAChC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,KAAmB;AACvB,SAAK,IAAI,EAAE,IAAI,IAAI,CAAY;AAC/B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KAAK,IAAY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,14 +20,17 @@ var NarouNovelFetch = class extends NarouNovel {
|
|
|
20
20
|
if (query.gzip === void 0) {
|
|
21
21
|
query.gzip = 5;
|
|
22
22
|
}
|
|
23
|
+
if (query.gzip === 0) {
|
|
24
|
+
delete query.gzip;
|
|
25
|
+
}
|
|
23
26
|
const url = new URL(endpoint);
|
|
24
27
|
Object.entries(query).forEach(([key, value]) => {
|
|
25
|
-
if (value) {
|
|
28
|
+
if (value !== void 0) {
|
|
26
29
|
url.searchParams.append(key, value.toString());
|
|
27
30
|
}
|
|
28
31
|
});
|
|
29
32
|
const res = await (this.fetch ?? fetch)(url);
|
|
30
|
-
if (query.gzip
|
|
33
|
+
if (!query.gzip) {
|
|
31
34
|
return await res.json();
|
|
32
35
|
}
|
|
33
36
|
const buffer = await res.arrayBuffer();
|
|
@@ -38,4 +41,4 @@ var NarouNovelFetch = class extends NarouNovel {
|
|
|
38
41
|
export {
|
|
39
42
|
NarouNovelFetch
|
|
40
43
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-SNPBEVCY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/narou-fetch.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"],"mappings":";;;;;;;;AASA,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,QAAI,MAAM,SAAS,GAAG;AACpB,aAAO,MAAM;AAAA,IACf;AACA,UAAM,MAAM,IAAI,IAAI,QAAQ;AAE5B,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,UAAI,UAAU,QAAW;AACvB,YAAI,aAAa,OAAO,KAAK,MAAM,SAAS,CAAC;AAAA,MAC/C;AAAA,IACF,CAAC;AAED,UAAM,MAAM,OAAO,KAAK,SAAS,OAAO,GAAG;AAE3C,QAAI,CAAC,MAAM,MAAM;AACf,aAAQ,MAAM,IAAI,KAAK;AAAA,IACzB;AAEA,UAAM,SAAS,MAAM,IAAI,YAAY;AACrC,WAAO,MAAM,OAAO,MAAM;AAAA,EAC5B;AACF;","names":["fetch"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NovelSearchBuilderBase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P7QOZBII.js";
|
|
4
4
|
|
|
5
5
|
// src/search-builder-r18.ts
|
|
6
6
|
var SearchBuilderR18 = class extends NovelSearchBuilderBase {
|
|
@@ -41,4 +41,4 @@ var SearchBuilderR18 = class extends NovelSearchBuilderBase {
|
|
|
41
41
|
export {
|
|
42
42
|
SearchBuilderR18
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-WYSPGQ3S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/util/jsonp.ts"],"sourcesContent":["/**\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":";AAKA,IAAI,QAAQ;AAiBZ,IAAM,OAAO,WAAY;AAAC;AAEnB,SAAS,MACd,KACA,EAAE,SAAS,QAAQ,QAAQ,YAAY,UAAU,KAAM,IAAiB,CAAC,GAC7D;AACZ,SAAO,IAAI,QAAQ,SAAU,SAAS,QAAQ;AAC5C,UAAM,cAAc,SAAS,qBAAqB,QAAQ,EAAE,KAAK,CAAC;AAClE,UAAM,SAAS,aAAa,cAAc,SAAS;AAEnD,UAAM,KAAiB,GAAG,MAAM,GAAG,OAAO;AAC1C,UAAM,UAAU,WAAY;AAE1B,UAAI,UAAU,OAAO,YAAY;AAC/B,eAAO,WAAW,YAAY,MAAM;AAAA,MACtC;AAEA,aAAO,EAAE,IAAI;AAEb,UAAI,OAAO;AACT,qBAAa,KAAK;AAAA,MACpB;AAAA,IACF;AAEA,UAAM,QACJ,UAAU,IACN,WAAW,MAAM;AACf,cAAQ;AACR,aAAO,IAAI,MAAM,SAAS,CAAC;AAAA,IAC7B,GAAG,OAAO,IACV;AAEN,UAAM,WAAW,CAAC,SAAY;AAC5B,cAAQ;AACR,cAAQ,IAAI;AAAA,IACd;AACA,WAAO,EAAE,IAAI;AAGb,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,UAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,WAAO,aAAa,IAAI,OAAO,EAAE;AACjC,WAAO,aAAa,OAAO,OAAO,SAAS,CAAC;AAC5C,WAAO,aAAa,QAAQ,WAAW;AAAA,EACzC,CAAC;AACH;","names":[]}
|
package/dist/index.browser.cjs
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_browser_exports, {
|
|
|
24
24
|
BigGenreNotation: () => BigGenreNotation,
|
|
25
25
|
BooleanNumber: () => BooleanNumber,
|
|
26
26
|
BuntaiParam: () => BuntaiParam,
|
|
27
|
+
DateParam: () => DateParam,
|
|
27
28
|
End: () => End,
|
|
28
29
|
Fields: () => Fields,
|
|
29
30
|
Genre: () => Genre,
|
|
@@ -194,7 +195,7 @@ var NarouNovelJsonp = class extends NarouNovel {
|
|
|
194
195
|
query.gzip = 0;
|
|
195
196
|
const url = new URL(endpoint);
|
|
196
197
|
Object.entries(query).forEach(([key, value]) => {
|
|
197
|
-
if (value) {
|
|
198
|
+
if (value !== void 0) {
|
|
198
199
|
url.searchParams.append(key, value.toString());
|
|
199
200
|
}
|
|
200
201
|
});
|
|
@@ -429,7 +430,9 @@ var Order = {
|
|
|
429
430
|
/** 四半期ポイントの高い順 */
|
|
430
431
|
QuarterPoint: "quarterpoint",
|
|
431
432
|
/** 年間ポイントの高い順 */
|
|
432
|
-
YearlyPoint: "yearlypoint"
|
|
433
|
+
YearlyPoint: "yearlypoint",
|
|
434
|
+
/** 初回掲載順 */
|
|
435
|
+
GeneralFirstUp: "generalfirstup"
|
|
433
436
|
};
|
|
434
437
|
var R18Site = {
|
|
435
438
|
/** ノクターンノベルズ(男性向け) */
|
|
@@ -564,6 +567,13 @@ var NovelTypeParam = {
|
|
|
564
567
|
/** 短編と完結済連載小説 */
|
|
565
568
|
ShortAndRensai: "ter"
|
|
566
569
|
};
|
|
570
|
+
var DateParam = {
|
|
571
|
+
ThisWeek: "thisweek",
|
|
572
|
+
LastWeek: "lastweek",
|
|
573
|
+
SevenDays: "sevenday",
|
|
574
|
+
ThisMonth: "thismonth",
|
|
575
|
+
LastMonth: "lastmonth"
|
|
576
|
+
};
|
|
567
577
|
var UserOrder = {
|
|
568
578
|
/** ユーザIDの新しい順 */
|
|
569
579
|
New: "new",
|
|
@@ -857,7 +867,7 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
|
|
|
857
867
|
date = x;
|
|
858
868
|
} else if (x instanceof Date && y instanceof Date) {
|
|
859
869
|
date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
|
|
860
|
-
|
|
870
|
+
y.getTime() / 1e3
|
|
861
871
|
)}`;
|
|
862
872
|
} else {
|
|
863
873
|
date = `${x}-${y}`;
|
|
@@ -865,6 +875,20 @@ var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilder
|
|
|
865
875
|
this.set({ lastup: date });
|
|
866
876
|
return this;
|
|
867
877
|
}
|
|
878
|
+
lastNovelUpdate(x, y) {
|
|
879
|
+
let date;
|
|
880
|
+
if (typeof x == "string") {
|
|
881
|
+
date = x;
|
|
882
|
+
} else if (x instanceof Date && y instanceof Date) {
|
|
883
|
+
date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
|
|
884
|
+
y.getTime() / 1e3
|
|
885
|
+
)}`;
|
|
886
|
+
} else {
|
|
887
|
+
date = `${x}-${y}`;
|
|
888
|
+
}
|
|
889
|
+
this.set({ lastupdate: date });
|
|
890
|
+
return this;
|
|
891
|
+
}
|
|
868
892
|
/**
|
|
869
893
|
* なろう小説APIへの検索リクエストを実行する
|
|
870
894
|
* @returns {Promise<NarouSearchResults>} 検索結果
|
|
@@ -1148,20 +1172,17 @@ var UserSearchBuilder = class _UserSearchBuilder extends SearchBuilderBase {
|
|
|
1148
1172
|
var narouNovelJsonp = new NarouNovelJsonp();
|
|
1149
1173
|
function search(word = "", api = narouNovelJsonp) {
|
|
1150
1174
|
const builder = new SearchBuilder({}, api);
|
|
1151
|
-
if (word != "")
|
|
1152
|
-
builder.word(word);
|
|
1175
|
+
if (word != "") builder.word(word);
|
|
1153
1176
|
return builder;
|
|
1154
1177
|
}
|
|
1155
1178
|
function searchR18(word = "", api = narouNovelJsonp) {
|
|
1156
1179
|
const builder = new SearchBuilderR18({}, api);
|
|
1157
|
-
if (word != "")
|
|
1158
|
-
builder.word(word);
|
|
1180
|
+
if (word != "") builder.word(word);
|
|
1159
1181
|
return builder;
|
|
1160
1182
|
}
|
|
1161
1183
|
function searchUser(word = "", api = narouNovelJsonp) {
|
|
1162
1184
|
const builder = new UserSearchBuilder({}, api);
|
|
1163
|
-
if (word != "")
|
|
1164
|
-
builder.word(word);
|
|
1185
|
+
if (word != "") builder.word(word);
|
|
1165
1186
|
return builder;
|
|
1166
1187
|
}
|
|
1167
1188
|
function ranking(api = narouNovelJsonp) {
|
|
@@ -1189,6 +1210,7 @@ var index_browser_default = {
|
|
|
1189
1210
|
BigGenreNotation,
|
|
1190
1211
|
BooleanNumber,
|
|
1191
1212
|
BuntaiParam,
|
|
1213
|
+
DateParam,
|
|
1192
1214
|
End,
|
|
1193
1215
|
Fields,
|
|
1194
1216
|
Genre,
|