@book000/pixivts
Advanced tools
Comparing version 0.9.1 to 0.10.0
@@ -19,4 +19,6 @@ export * from './types/endpoints/v2/illust/bookmark/add'; | ||
export * from './types/pixiv-user'; | ||
export * from './checks'; | ||
export * from './options'; | ||
export { default as Pixiv } from './pixiv'; | ||
export * from './utils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -39,5 +39,7 @@ "use strict"; | ||
__exportStar(require("./types/pixiv-user"), exports); | ||
__exportStar(require("./checks"), exports); | ||
__exportStar(require("./options"), exports); | ||
var pixiv_1 = require("./pixiv"); | ||
Object.defineProperty(exports, "Pixiv", { enumerable: true, get: function () { return __importDefault(pixiv_1).default; } }); | ||
__exportStar(require("./utils"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -13,2 +13,3 @@ import { GetV1IllustDetailRequest } from './types/endpoints/v1/illust/detail'; | ||
import { GetV1UserDetailRequest } from './types/endpoints/v1/user/detail'; | ||
import { BaseSimpleCheck, CheckFunctions } from './checks'; | ||
/** | ||
@@ -27,2 +28,5 @@ * 検索対象 | ||
} | ||
export declare class SearchTargetCheck extends BaseSimpleCheck<SearchTarget> { | ||
checks(): CheckFunctions<SearchTarget>; | ||
} | ||
/** | ||
@@ -39,2 +43,5 @@ * ソート | ||
} | ||
export declare class SearchSortCheck extends BaseSimpleCheck<SearchSort> { | ||
checks(): CheckFunctions<SearchSort>; | ||
} | ||
/** | ||
@@ -51,2 +58,5 @@ * 対象期間 | ||
} | ||
export declare class SearchIllustDurationCheck extends BaseSimpleCheck<SearchIllustDuration> { | ||
checks(): CheckFunctions<SearchIllustDuration>; | ||
} | ||
/** | ||
@@ -61,2 +71,5 @@ * OSフィルタ | ||
} | ||
export declare class FilterCheck extends BaseSimpleCheck<Filter> { | ||
checks(): CheckFunctions<Filter>; | ||
} | ||
/** | ||
@@ -71,10 +84,12 @@ * ブックマーク公開範囲 | ||
} | ||
export declare class BookmarkRestrictCheck extends BaseSimpleCheck<BookmarkRestrict> { | ||
checks(): CheckFunctions<BookmarkRestrict>; | ||
} | ||
/** | ||
* オブジェクトの一部を必須にする | ||
* オブジェクトの一部を必須にし、それ以外はオプショナルにする | ||
* | ||
* @see https://mongolyy.hatenablog.com/entry/2022/03/10/001139 | ||
* @see https://qiita.com/yuu_1st/items/71c4fc9cc95a72fa4df9 | ||
*/ | ||
type SomeRequired<T, K extends keyof T> = T & { | ||
[P in K]-?: T[P]; | ||
}; | ||
type SomeRequired<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>; | ||
/** | ||
@@ -81,0 +96,0 @@ * オブジェクトの特定プロパティを上書きする |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BookmarkRestrict = exports.Filter = exports.SearchIllustDuration = exports.SearchSort = exports.SearchTarget = void 0; | ||
exports.BookmarkRestrictCheck = exports.BookmarkRestrict = exports.FilterCheck = exports.Filter = exports.SearchIllustDurationCheck = exports.SearchIllustDuration = exports.SearchSortCheck = exports.SearchSort = exports.SearchTargetCheck = exports.SearchTarget = void 0; | ||
const checks_1 = require("./checks"); | ||
/** | ||
@@ -18,2 +19,16 @@ * 検索対象 | ||
})(SearchTarget = exports.SearchTarget || (exports.SearchTarget = {})); | ||
class SearchTargetCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
main: (data) => typeof data === 'string' && | ||
[ | ||
SearchTarget.PARTIAL_MATCH_FOR_TAGS, | ||
SearchTarget.EXACT_MATCH_FOR_TAGS, | ||
SearchTarget.TITLE_AND_CAPTION, | ||
SearchTarget.KEYWORD, | ||
].includes(data), | ||
}; | ||
} | ||
} | ||
exports.SearchTargetCheck = SearchTargetCheck; | ||
/** | ||
@@ -31,2 +46,15 @@ * ソート | ||
})(SearchSort = exports.SearchSort || (exports.SearchSort = {})); | ||
class SearchSortCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
main: (data) => typeof data === 'string' && | ||
[ | ||
SearchSort.DATE_DESC, | ||
SearchSort.DATE_ASC, | ||
SearchSort.POPULAR_DESC, | ||
].includes(data), | ||
}; | ||
} | ||
} | ||
exports.SearchSortCheck = SearchSortCheck; | ||
/** | ||
@@ -44,2 +72,15 @@ * 対象期間 | ||
})(SearchIllustDuration = exports.SearchIllustDuration || (exports.SearchIllustDuration = {})); | ||
class SearchIllustDurationCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
main: (data) => typeof data === 'string' && | ||
[ | ||
SearchIllustDuration.WITHIN_LAST_DAY, | ||
SearchIllustDuration.WITHIN_LAST_WEEK, | ||
SearchIllustDuration.WITHIN_LAST_MONTH, | ||
].includes(data), | ||
}; | ||
} | ||
} | ||
exports.SearchIllustDurationCheck = SearchIllustDurationCheck; | ||
/** | ||
@@ -55,2 +96,11 @@ * OSフィルタ | ||
})(Filter = exports.Filter || (exports.Filter = {})); | ||
class FilterCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
main: (data) => typeof data === 'string' && | ||
[Filter.FOR_IOS, Filter.FOR_ANDROID].includes(data), | ||
}; | ||
} | ||
} | ||
exports.FilterCheck = FilterCheck; | ||
/** | ||
@@ -66,2 +116,11 @@ * ブックマーク公開範囲 | ||
})(BookmarkRestrict = exports.BookmarkRestrict || (exports.BookmarkRestrict = {})); | ||
class BookmarkRestrictCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
main: (data) => typeof data === 'string' && | ||
[BookmarkRestrict.PUBLIC, BookmarkRestrict.PRIVATE].includes(data), | ||
}; | ||
} | ||
} | ||
exports.BookmarkRestrictCheck = BookmarkRestrictCheck; | ||
//# sourceMappingURL=options.js.map |
@@ -69,3 +69,3 @@ /// <reference types="node" /> | ||
*/ | ||
recommendedIllust(options?: RecommendedIllustOptions): Promise<AxiosResponse<GetV1IllustRecommendedResponse, any>>; | ||
illustRecommended(options?: RecommendedIllustOptions): Promise<AxiosResponse<GetV1IllustRecommendedResponse, any>>; | ||
/** | ||
@@ -113,3 +113,3 @@ * イラストをブックマークする。 | ||
*/ | ||
recommendedNovel(options?: RecommendedNovelOptions): Promise<AxiosResponse<GetV1NovelRecommendedResponse, any>>; | ||
novelRecommended(options?: RecommendedNovelOptions): Promise<AxiosResponse<GetV1NovelRecommendedResponse, any>>; | ||
/** | ||
@@ -116,0 +116,0 @@ * 小説シリーズの詳細情報を取得する。 |
@@ -139,3 +139,3 @@ "use strict"; | ||
*/ | ||
async recommendedIllust(options = {}) { | ||
async illustRecommended(options = {}) { | ||
const parameters = { | ||
@@ -265,3 +265,3 @@ ...this.convertSnakeToCamel(options), | ||
*/ | ||
async recommendedNovel(options = {}) { | ||
async novelRecommended(options = {}) { | ||
const parameters = { | ||
@@ -268,0 +268,0 @@ ...this.convertSnakeToCamel(options), |
@@ -0,1 +1,2 @@ | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
import { PixivIllustItem } from '../../../pixiv-illust'; | ||
@@ -20,2 +21,6 @@ /** | ||
} | ||
export declare class GetV1IllustDetailCheck extends BaseMultipleCheck<GetV1IllustDetailRequest, GetV1IllustDetailResponse> { | ||
requestChecks(): CheckFunctions<GetV1IllustDetailRequest>; | ||
responseChecks(): CheckFunctions<GetV1IllustDetailResponse>; | ||
} | ||
//# sourceMappingURL=detail.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1IllustDetailCheck = void 0; | ||
const checks_1 = require("../../../../checks"); | ||
const pixiv_illust_1 = require("../../../pixiv-illust"); | ||
class GetV1IllustDetailCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
illust_id: (data) => typeof data.illust_id === 'number', | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
illust: (data) => typeof data.illust === 'object' && | ||
new pixiv_illust_1.PixivIllustItemCheck().throwIfFailed(data.illust), | ||
}; | ||
} | ||
} | ||
exports.GetV1IllustDetailCheck = GetV1IllustDetailCheck; | ||
//# sourceMappingURL=detail.js.map |
import { PixivIllustItem } from '../../../pixiv-illust'; | ||
import { Filter } from '../../../../options'; | ||
import { PrivacyPolicy } from '../../../pixiv-common'; | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
/** | ||
@@ -40,3 +41,3 @@ * GET /v1/illust/recommended のリクエスト | ||
*/ | ||
offset?: string; | ||
offset?: number; | ||
/** | ||
@@ -73,3 +74,3 @@ * プライバシーポリシーを含めるか (?) | ||
*/ | ||
privacy_policy?: PrivacyPolicy[]; | ||
privacy_policy?: PrivacyPolicy; | ||
/** | ||
@@ -82,2 +83,6 @@ * 次回のリクエストに使用する URL。 | ||
} | ||
export declare class GetV1IllustRecommendedCheck extends BaseMultipleCheck<GetV1IllustRecommendedRequest, GetV1IllustRecommendedResponse> { | ||
requestChecks(): CheckFunctions<GetV1IllustRecommendedRequest>; | ||
responseChecks(): CheckFunctions<GetV1IllustRecommendedResponse>; | ||
} | ||
//# sourceMappingURL=recommended.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1IllustRecommendedCheck = void 0; | ||
const pixiv_illust_1 = require("../../../pixiv-illust"); | ||
const options_1 = require("../../../../options"); | ||
const pixiv_common_1 = require("../../../pixiv-common"); | ||
const checks_1 = require("../../../../checks"); | ||
class GetV1IllustRecommendedCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
filter: (data) => new options_1.FilterCheck().throwIfFailed(data.filter), | ||
include_ranking_illusts: (data) => typeof data.include_ranking_illusts === 'boolean', | ||
min_bookmark_id_for_recent_illust: (data) => data.min_bookmark_id_for_recent_illust === undefined || | ||
typeof data.min_bookmark_id_for_recent_illust === 'number', | ||
max_bookmark_id_for_recommend: (data) => data.max_bookmark_id_for_recommend === undefined || | ||
typeof data.max_bookmark_id_for_recommend === 'number', | ||
offset: (data) => data.offset === undefined || typeof data.offset === 'number', | ||
include_privacy_policy: (data) => typeof data.include_privacy_policy === 'boolean', | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
illusts: (data) => Array.isArray(data.illusts) && | ||
data.illusts.length > 0 && | ||
data.illusts.every((illust) => new pixiv_illust_1.PixivIllustItemCheck().throwIfFailed(illust)), | ||
ranking_illusts: (data) => Array.isArray(data.ranking_illusts) && | ||
data.ranking_illusts.length > 0 && | ||
data.ranking_illusts.every((illust) => new pixiv_illust_1.PixivIllustItemCheck().throwIfFailed(illust)), | ||
contest_exists: (data) => typeof data.contest_exists === 'boolean', | ||
privacy_policy: (data) => data.privacy_policy === undefined || | ||
new pixiv_common_1.PrivacyPolicyCheck().throwIfFailed(data.privacy_policy), | ||
next_url: (data) => typeof data.next_url === 'string', | ||
}; | ||
} | ||
} | ||
exports.GetV1IllustRecommendedCheck = GetV1IllustRecommendedCheck; | ||
//# sourceMappingURL=recommended.js.map |
import { PixivIllustItem } from '../../../pixiv-illust'; | ||
import { IllustSeriesDetail } from '../../../pixiv-illust-series'; | ||
import { Filter } from '../../../../options'; | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
/** | ||
@@ -11,3 +12,3 @@ * GET /v1/illust/series のリクエスト | ||
*/ | ||
illust_series_id: string; | ||
illust_series_id: number; | ||
/** | ||
@@ -41,2 +42,6 @@ * OSフィルタ | ||
} | ||
export declare class GetV1IllustSeriesCheck extends BaseMultipleCheck<GetV1IllustSeriesRequest, GetV1IllustSeriesResponse> { | ||
requestChecks(): CheckFunctions<GetV1IllustSeriesRequest>; | ||
responseChecks(): CheckFunctions<GetV1IllustSeriesResponse>; | ||
} | ||
//# sourceMappingURL=series.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1IllustSeriesCheck = void 0; | ||
const pixiv_illust_1 = require("../../../pixiv-illust"); | ||
const pixiv_illust_series_1 = require("../../../pixiv-illust-series"); | ||
const options_1 = require("../../../../options"); | ||
const checks_1 = require("../../../../checks"); | ||
class GetV1IllustSeriesCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
illust_series_id: (data) => typeof data.illust_series_id === 'number' && data.illust_series_id > 0, | ||
filter: (data) => new options_1.FilterCheck().throwIfFailed(data.filter), | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
illust_series_detail: (data) => typeof data.illust_series_detail === 'object' && | ||
new pixiv_illust_series_1.IllustSeriesDetailCheck().throwIfFailed(data.illust_series_detail), | ||
illust_series_first_illust: (data) => typeof data.illust_series_first_illust === 'object' && | ||
new pixiv_illust_1.PixivIllustItemCheck().throwIfFailed(data.illust_series_first_illust), | ||
illusts: (data) => Array.isArray(data.illusts) && | ||
data.illusts.length > 0 && | ||
data.illusts.every((illust) => new pixiv_illust_1.PixivIllustItemCheck().throwIfFailed(illust)), | ||
next_url: (data) => typeof data.next_url === 'string' || data.next_url === null, | ||
}; | ||
} | ||
} | ||
exports.GetV1IllustSeriesCheck = GetV1IllustSeriesCheck; | ||
//# sourceMappingURL=series.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
import { PrivacyPolicy } from '../../../pixiv-common'; | ||
@@ -59,3 +60,3 @@ import { PixivNovelItem } from '../../../pixiv-novel'; | ||
*/ | ||
privacy_policy?: PrivacyPolicy[]; | ||
privacy_policy?: PrivacyPolicy; | ||
/** | ||
@@ -68,2 +69,6 @@ * 次回のリクエストに使用する URL。 | ||
} | ||
export declare class GetV1NovelRecommendedCheck extends BaseMultipleCheck<GetV1NovelRecommendedRequest, GetV1NovelRecommendedResponse> { | ||
requestChecks(): CheckFunctions<GetV1NovelRecommendedRequest>; | ||
responseChecks(): CheckFunctions<GetV1NovelRecommendedResponse>; | ||
} | ||
//# sourceMappingURL=recommended.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1NovelRecommendedCheck = void 0; | ||
const checks_1 = require("../../../../checks"); | ||
const pixiv_common_1 = require("../../../pixiv-common"); | ||
const pixiv_novel_1 = require("../../../pixiv-novel"); | ||
class GetV1NovelRecommendedCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
include_ranking_novels: (data) => typeof data.include_ranking_novels === 'boolean', | ||
already_recommended: (data) => data.already_recommended === undefined || | ||
typeof data.already_recommended === 'string', | ||
max_bookmark_id_for_recommend: (data) => data.max_bookmark_id_for_recommend === undefined || | ||
typeof data.max_bookmark_id_for_recommend === 'number', | ||
offset: (data) => data.offset === undefined || typeof data.offset === 'number', | ||
include_privacy_policy: (data) => typeof data.include_privacy_policy === 'boolean', | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
novels: (data) => Array.isArray(data.novels) && | ||
data.novels.every((novel) => new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(novel)), | ||
ranking_novels: (data) => Array.isArray(data.ranking_novels) && | ||
data.ranking_novels.every((novel) => new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(novel)), | ||
privacy_policy: (data) => data.privacy_policy === undefined || | ||
new pixiv_common_1.PrivacyPolicyCheck().throwIfFailed(data.privacy_policy), | ||
next_url: (data) => typeof data.next_url === 'string', | ||
}; | ||
} | ||
} | ||
exports.GetV1NovelRecommendedCheck = GetV1NovelRecommendedCheck; | ||
//# sourceMappingURL=recommended.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
import { PixivNovelSeriesItem } from '../../../pixiv-novel-series'; | ||
@@ -16,7 +17,12 @@ /** | ||
/** | ||
* 不明 | ||
* 小説のマーカー情報。無い場合は空オブジェクト | ||
* | ||
* @beta | ||
*/ | ||
novel_marker: Record<string, never>; | ||
novel_marker: { | ||
/** | ||
* マーカーが付いているページ番号 | ||
*/ | ||
page: number; | ||
} | Record<string, never>; | ||
/** | ||
@@ -35,2 +41,6 @@ * 小説の本文 | ||
} | ||
export declare class GetV1NovelTextCheck extends BaseMultipleCheck<GetV1NovelTextRequest, GetV1NovelTextResponse> { | ||
requestChecks(): CheckFunctions<GetV1NovelTextRequest>; | ||
responseChecks(): CheckFunctions<GetV1NovelTextResponse>; | ||
} | ||
//# sourceMappingURL=text.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1NovelTextCheck = void 0; | ||
const checks_1 = require("../../../../checks"); | ||
const pixiv_novel_series_1 = require("../../../pixiv-novel-series"); | ||
const utils_1 = require("../../../../utils"); | ||
class GetV1NovelTextCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
novel_id: (data) => typeof data.novel_id === 'number' && data.novel_id > 0, | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
novel_marker: (data) => typeof data.novel_marker === 'object' && | ||
((0, utils_1.isEmptyObject)(data.novel_marker) || | ||
typeof data.novel_marker.page === 'number'), | ||
novel_text: (data) => typeof data.novel_text === 'string', | ||
series_prev: (data) => typeof data.series_prev === 'object' && | ||
((0, utils_1.isEmptyObject)(data.series_prev) || | ||
new pixiv_novel_series_1.PixivNovelSeriesItemCheck().throwIfFailed(data.series_prev)), | ||
series_next: (data) => typeof data.series_next === 'object' && | ||
((0, utils_1.isEmptyObject)(data.series_next) || | ||
new pixiv_novel_series_1.PixivNovelSeriesItemCheck().throwIfFailed(data.series_next)), | ||
}; | ||
} | ||
} | ||
exports.GetV1NovelTextCheck = GetV1NovelTextCheck; | ||
//# sourceMappingURL=text.js.map |
import { PixivIllustItem } from '../../../pixiv-illust'; | ||
import { Filter, SearchSort, SearchTarget } from '../../../../options'; | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
/** | ||
@@ -85,2 +86,6 @@ * GET /v1/search/illust のリクエスト | ||
} | ||
export declare class GetV1SearchIllustCheck extends BaseMultipleCheck<GetV1SearchIllustRequest, GetV1SearchIllustResponse> { | ||
requestChecks(): CheckFunctions<GetV1SearchIllustRequest>; | ||
responseChecks(): CheckFunctions<GetV1SearchIllustResponse>; | ||
} | ||
//# sourceMappingURL=illust.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1SearchIllustCheck = void 0; | ||
const pixiv_illust_1 = require("../../../pixiv-illust"); | ||
const options_1 = require("../../../../options"); | ||
const checks_1 = require("../../../../checks"); | ||
class GetV1SearchIllustCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
word: (data) => typeof data.word === 'string' && data.word.length > 0, | ||
search_target: (data) => new options_1.SearchTargetCheck().throwIfFailed(data.search_target), | ||
sort: (data) => new options_1.SearchSortCheck().throwIfFailed(data.sort), | ||
start_date: (data) => data.start_date === undefined || | ||
(typeof data.start_date === 'string' && data.start_date.length > 0), | ||
end_date: (data) => data.end_date === undefined || | ||
(typeof data.end_date === 'string' && data.end_date.length > 0), | ||
filter: (data) => data.filter === undefined || | ||
new options_1.FilterCheck().throwIfFailed(data.filter), | ||
offset: (data) => data.offset === undefined || typeof data.offset === 'number', | ||
merge_plain_keyword_results: (data) => typeof data.merge_plain_keyword_results === 'boolean', | ||
include_translated_tag_results: (data) => typeof data.include_translated_tag_results === 'boolean', | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
illusts: (data) => Array.isArray(data.illusts) && | ||
data.illusts.every((illust) => new pixiv_illust_1.PixivIllustItemCheck().throwIfFailed(illust)), | ||
next_url: (data) => data.next_url === null || | ||
(typeof data.next_url === 'string' && data.next_url.length > 0), | ||
search_span_limit: (data) => typeof data.search_span_limit === 'number', | ||
}; | ||
} | ||
} | ||
exports.GetV1SearchIllustCheck = GetV1SearchIllustCheck; | ||
//# sourceMappingURL=illust.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
import { Filter, SearchSort, SearchTarget } from '../../../../options'; | ||
@@ -85,2 +86,6 @@ import { PixivNovelItem } from '../../../pixiv-novel'; | ||
} | ||
export declare class GetV1SearchNovelCheck extends BaseMultipleCheck<GetV1SearchNovelRequest, GetV1SearchNovelResponse> { | ||
requestChecks(): CheckFunctions<GetV1SearchNovelRequest>; | ||
responseChecks(): CheckFunctions<GetV1SearchNovelResponse>; | ||
} | ||
//# sourceMappingURL=novel.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1SearchNovelCheck = void 0; | ||
const checks_1 = require("../../../../checks"); | ||
const options_1 = require("../../../../options"); | ||
const pixiv_novel_1 = require("../../../pixiv-novel"); | ||
class GetV1SearchNovelCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
word: (data) => typeof data.word === 'string' && data.word.length > 0, | ||
search_target: (data) => new options_1.SearchTargetCheck().throwIfFailed(data.search_target), | ||
sort: (data) => new options_1.SearchSortCheck().throwIfFailed(data.sort), | ||
start_date: (data) => data.start_date === undefined || | ||
(typeof data.start_date === 'string' && data.start_date.length > 0), | ||
end_date: (data) => data.end_date === undefined || | ||
(typeof data.end_date === 'string' && data.end_date.length > 0), | ||
filter: (data) => data.filter === undefined || | ||
new options_1.FilterCheck().throwIfFailed(data.filter), | ||
offset: (data) => data.offset === undefined || typeof data.offset === 'number', | ||
merge_plain_keyword_results: (data) => typeof data.merge_plain_keyword_results === 'boolean', | ||
include_translated_tag_results: (data) => typeof data.include_translated_tag_results === 'boolean', | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
novels: (data) => Array.isArray(data.novels) && | ||
data.novels.every((novel) => new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(novel)), | ||
next_url: (data) => data.next_url === null || | ||
(typeof data.next_url === 'string' && data.next_url.length > 0), | ||
search_span_limit: (data) => typeof data.search_span_limit === 'number', | ||
}; | ||
} | ||
} | ||
exports.GetV1SearchNovelCheck = GetV1SearchNovelCheck; | ||
//# sourceMappingURL=novel.js.map |
import { PixivUserItem, PixivUserProfile, PixivUserProfilePublicity, PixivUserProfileWorkspace } from '../../../pixiv-user'; | ||
import { Filter } from '../../../../options'; | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
/** | ||
@@ -39,2 +40,6 @@ * GET /v1/user/detail のリクエスト | ||
} | ||
export declare class GetV1UserDetailCheck extends BaseMultipleCheck<GetV1UserDetailRequest, GetV1UserDetailResponse> { | ||
requestChecks(): CheckFunctions<GetV1UserDetailRequest>; | ||
responseChecks(): CheckFunctions<GetV1UserDetailResponse>; | ||
} | ||
//# sourceMappingURL=detail.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV1UserDetailCheck = void 0; | ||
const pixiv_user_1 = require("../../../pixiv-user"); | ||
const options_1 = require("../../../../options"); | ||
const checks_1 = require("../../../../checks"); | ||
class GetV1UserDetailCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
user_id: (data) => typeof data.user_id === 'number', | ||
filter: (data) => data.filter === undefined || | ||
(typeof data.filter === 'string' && | ||
new options_1.FilterCheck().throwIfFailed(data.filter)), | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
user: (data) => new pixiv_user_1.PixivUserItemCheck().throwIfFailed(data.user), | ||
profile: (data) => new pixiv_user_1.PixivUserProfileCheck().throwIfFailed(data.profile), | ||
profile_publicity: (data) => new pixiv_user_1.PixivUserProfilePublicityCheck().throwIfFailed(data.profile_publicity), | ||
workspace: (data) => new pixiv_user_1.PixivUserProfileWorkspaceCheck().throwIfFailed(data.workspace), | ||
}; | ||
} | ||
} | ||
exports.GetV1UserDetailCheck = GetV1UserDetailCheck; | ||
//# sourceMappingURL=detail.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
import { PixivNovelItem } from '../../../pixiv-novel'; | ||
@@ -20,2 +21,6 @@ /** | ||
} | ||
export declare class GetV2NovelDetailCheck extends BaseMultipleCheck<GetV2NovelDetailRequest, GetV2NovelDetailResponse> { | ||
requestChecks(): CheckFunctions<GetV2NovelDetailRequest>; | ||
responseChecks(): CheckFunctions<GetV2NovelDetailResponse>; | ||
} | ||
//# sourceMappingURL=detail.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV2NovelDetailCheck = void 0; | ||
const checks_1 = require("../../../../checks"); | ||
const pixiv_novel_1 = require("../../../pixiv-novel"); | ||
class GetV2NovelDetailCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
novel_id: (data) => typeof data.novel_id === 'number' && data.novel_id > 0, | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
novel: (data) => typeof data.novel === 'object' && | ||
new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(data.novel), | ||
}; | ||
} | ||
} | ||
exports.GetV2NovelDetailCheck = GetV2NovelDetailCheck; | ||
//# sourceMappingURL=detail.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseMultipleCheck, CheckFunctions } from '../../../../checks'; | ||
import { PixivNovelItem } from '../../../pixiv-novel'; | ||
@@ -12,3 +13,3 @@ import { NovelSeriesDetail } from '../../../pixiv-novel-series'; | ||
/** | ||
* ? | ||
* 小説のオフセット?1リクエストにつき30個ずつ取得できるっぽい | ||
* | ||
@@ -18,3 +19,3 @@ * @default undefined | ||
*/ | ||
last_order?: string; | ||
last_order?: number; | ||
} | ||
@@ -46,2 +47,6 @@ /** | ||
} | ||
export declare class GetV2NovelSeriesCheck extends BaseMultipleCheck<GetV2NovelSeriesRequest, GetV2NovelSeriesResponse> { | ||
requestChecks(): CheckFunctions<GetV2NovelSeriesRequest>; | ||
responseChecks(): CheckFunctions<GetV2NovelSeriesResponse>; | ||
} | ||
//# sourceMappingURL=series.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GetV2NovelSeriesCheck = void 0; | ||
const checks_1 = require("../../../../checks"); | ||
const pixiv_novel_1 = require("../../../pixiv-novel"); | ||
const pixiv_novel_series_1 = require("../../../pixiv-novel-series"); | ||
class GetV2NovelSeriesCheck extends checks_1.BaseMultipleCheck { | ||
requestChecks() { | ||
return { | ||
series_id: (data) => typeof data.series_id === 'number', | ||
last_order: (data) => typeof data.last_order === 'number', | ||
}; | ||
} | ||
responseChecks() { | ||
return { | ||
novel_series_detail: (data) => typeof data.novel_series_detail === 'object' && | ||
new pixiv_novel_series_1.NovelSeriesDetailCheck().throwIfFailed(data.novel_series_detail), | ||
novel_series_first_novel: (data) => typeof data.novel_series_first_novel === 'object' && | ||
new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(data.novel_series_first_novel), | ||
novel_series_latest_novel: (data) => typeof data.novel_series_latest_novel === 'object' && | ||
new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(data.novel_series_latest_novel), | ||
novels: (data) => Array.isArray(data.novels) && | ||
data.novels.every((novel) => new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(novel)), | ||
next_url: (data) => typeof data.next_url === 'string' || data.next_url === null, | ||
}; | ||
} | ||
} | ||
exports.GetV2NovelSeriesCheck = GetV2NovelSeriesCheck; | ||
//# sourceMappingURL=series.js.map |
@@ -17,3 +17,3 @@ interface Error { | ||
*/ | ||
user_message_details: unknown; | ||
user_message_details?: unknown; | ||
} | ||
@@ -20,0 +20,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { BaseSimpleCheck, CheckFunctions } from '../checks'; | ||
/** | ||
@@ -22,2 +23,5 @@ * 作品の画像URL群 | ||
} | ||
export declare class ImageUrlsCheck extends BaseSimpleCheck<ImageUrls> { | ||
checks(): CheckFunctions<ImageUrls>; | ||
} | ||
/** | ||
@@ -47,2 +51,5 @@ * プロフィール画像URL群 | ||
} | ||
export declare class PixivUserCheck extends BaseSimpleCheck<PixivUser> { | ||
checks(): CheckFunctions<PixivUser>; | ||
} | ||
/** | ||
@@ -55,6 +62,9 @@ * タグ情報 | ||
/** 翻訳済みタグ名 */ | ||
translated_name: null | string; | ||
translated_name: string | null; | ||
/** 投稿者によって追加されたタグかどうか */ | ||
added_by_uploaded_user?: boolean; | ||
} | ||
export declare class TagCheck extends BaseSimpleCheck<Tag> { | ||
checks(): CheckFunctions<Tag>; | ||
} | ||
/** | ||
@@ -69,2 +79,5 @@ * シリーズ情報 | ||
} | ||
export declare class SeriesCheck extends BaseSimpleCheck<Series> { | ||
checks(): CheckFunctions<Series>; | ||
} | ||
export interface PrivacyPolicy { | ||
@@ -84,2 +97,5 @@ /** | ||
} | ||
export declare class PrivacyPolicyCheck extends BaseSimpleCheck<PrivacyPolicy> { | ||
checks(): CheckFunctions<PrivacyPolicy>; | ||
} | ||
//# sourceMappingURL=pixiv-common.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PrivacyPolicyCheck = exports.SeriesCheck = exports.TagCheck = exports.PixivUserCheck = exports.ImageUrlsCheck = void 0; | ||
// @ts-ignore because tsdoc | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const checks_1 = require("../checks"); | ||
class ImageUrlsCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
square_medium: (data) => typeof data.square_medium === 'string', | ||
medium: (data) => typeof data.medium === 'string', | ||
large: (data) => typeof data.large === 'string', | ||
original: (data) => data.original === undefined || typeof data.original === 'string', | ||
}; | ||
} | ||
} | ||
exports.ImageUrlsCheck = ImageUrlsCheck; | ||
class PixivUserCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
id: (data) => typeof data.id === 'number', | ||
name: (data) => typeof data.name === 'string', | ||
account: (data) => typeof data.account === 'string', | ||
profile_image_urls: (data) => typeof data.profile_image_urls === 'object' && | ||
data.profile_image_urls.medium !== undefined, | ||
is_followed: (data) => typeof data.is_followed === 'boolean', | ||
is_access_blocking_user: (data) => data.is_access_blocking_user === undefined || | ||
typeof data.is_access_blocking_user === 'boolean', | ||
}; | ||
} | ||
} | ||
exports.PixivUserCheck = PixivUserCheck; | ||
class TagCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
name: (data) => typeof data.name === 'string', | ||
translated_name: (data) => typeof data.translated_name === 'string' || | ||
data.translated_name === null, | ||
added_by_uploaded_user: (data) => data.added_by_uploaded_user === undefined || | ||
typeof data.added_by_uploaded_user === 'boolean', | ||
}; | ||
} | ||
} | ||
exports.TagCheck = TagCheck; | ||
class SeriesCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
id: (data) => typeof data.id === 'number', | ||
title: (data) => typeof data.title === 'string', | ||
}; | ||
} | ||
} | ||
exports.SeriesCheck = SeriesCheck; | ||
class PrivacyPolicyCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
version: (data) => data.version === undefined || typeof data.version === 'string', | ||
message: (data) => data.message === undefined || typeof data.message === 'string', | ||
url: (data) => data.url === undefined || typeof data.url === 'string', | ||
}; | ||
} | ||
} | ||
exports.PrivacyPolicyCheck = PrivacyPolicyCheck; | ||
//# sourceMappingURL=pixiv-common.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseSimpleCheck, CheckFunctions } from '../checks'; | ||
import { PixivUser } from './pixiv-common'; | ||
@@ -52,2 +53,5 @@ /** | ||
} | ||
export declare class IllustSeriesDetailCheck extends BaseSimpleCheck<IllustSeriesDetail> { | ||
checks(): CheckFunctions<IllustSeriesDetail>; | ||
} | ||
//# sourceMappingURL=pixiv-illust-series.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IllustSeriesDetailCheck = void 0; | ||
const checks_1 = require("../checks"); | ||
const pixiv_common_1 = require("./pixiv-common"); | ||
class IllustSeriesDetailCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
id: (data) => typeof data.id === 'number' && data.id > 0, | ||
title: (data) => typeof data.title === 'string' && data.title.length > 0, | ||
caption: (data) => typeof data.caption === 'string', | ||
cover_image_urls: (data) => typeof data.cover_image_urls === 'object' && | ||
typeof data.cover_image_urls.medium === 'string' && | ||
data.cover_image_urls.medium.length > 0, | ||
series_work_count: (data) => typeof data.series_work_count === 'number' && | ||
data.series_work_count > 0, | ||
create_date: (data) => typeof data.create_date === 'string', | ||
width: (data) => typeof data.width === 'number' && data.width > 0, | ||
height: (data) => typeof data.height === 'number' && data.height > 0, | ||
user: (data) => new pixiv_common_1.PixivUserCheck().throwIfFailed(data.user), | ||
watchlist_added: (data) => typeof data.watchlist_added === 'boolean', | ||
}; | ||
} | ||
} | ||
exports.IllustSeriesDetailCheck = IllustSeriesDetailCheck; | ||
//# sourceMappingURL=pixiv-illust-series.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseSimpleCheck, CheckFunctions } from '../checks'; | ||
import { ImageUrls, PixivUser, Tag, Series } from './pixiv-common'; | ||
@@ -136,3 +137,3 @@ /** 単一イラスト詳細情報 */ | ||
*/ | ||
total_comments: number; | ||
total_comments?: number; | ||
/** | ||
@@ -164,2 +165,5 @@ * AI使用フラグ | ||
} | ||
export declare class PixivIllustItemCheck extends BaseSimpleCheck<PixivIllustItem> { | ||
checks(): CheckFunctions<PixivIllustItem>; | ||
} | ||
//# sourceMappingURL=pixiv-illust.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PixivIllustItemCheck = void 0; | ||
const utils_1 = require("../utils"); | ||
const checks_1 = require("../checks"); | ||
const pixiv_common_1 = require("./pixiv-common"); | ||
class PixivIllustItemCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
id: (data) => typeof data.id === 'number', | ||
title: (data) => typeof data.title === 'string', | ||
type: (data) => typeof data.type === 'string' && | ||
['illust', 'manga', 'ugoira'].includes(data.type), | ||
image_urls: (data) => typeof data.image_urls === 'object' && | ||
new pixiv_common_1.ImageUrlsCheck().throwIfFailed(data.image_urls), | ||
caption: (data) => typeof data.caption === 'string', | ||
restrict: (data) => typeof data.restrict === 'number', | ||
user: (data) => typeof data.user === 'object' && | ||
new pixiv_common_1.PixivUserCheck().throwIfFailed(data.user), | ||
tags: (data) => typeof data.tags === 'object' && | ||
Array.isArray(data.tags) && | ||
data.tags.every((tag) => new pixiv_common_1.TagCheck().throwIfFailed(tag)), | ||
tools: (data) => typeof data.tools === 'object' && | ||
Array.isArray(data.tools) && | ||
data.tools.every((tool) => typeof tool === 'string') && | ||
data.tools.length <= 3, | ||
create_date: (data) => typeof data.create_date === 'string', | ||
page_count: (data) => typeof data.page_count === 'number', | ||
width: (data) => typeof data.width === 'number', | ||
height: (data) => typeof data.height === 'number', | ||
sanity_level: (data) => typeof data.sanity_level === 'number', | ||
meta_single_page: (data) => typeof data.meta_single_page === 'object' && | ||
((0, utils_1.isEmptyObject)(data.meta_single_page) || | ||
data.meta_single_page.original_image_url !== undefined), | ||
meta_pages: (data) => typeof data.meta_pages === 'object' && | ||
Array.isArray(data.meta_pages) && | ||
data.meta_pages.every((metaPage) => typeof metaPage.image_urls === 'object' && | ||
new pixiv_common_1.ImageUrlsCheck().throwIfFailed(metaPage.image_urls)), | ||
total_view: (data) => typeof data.total_view === 'number', | ||
total_bookmarks: (data) => typeof data.total_bookmarks === 'number', | ||
is_bookmarked: (data) => typeof data.is_bookmarked === 'boolean', | ||
visible: (data) => typeof data.visible === 'boolean', | ||
is_muted: (data) => typeof data.is_muted === 'boolean', | ||
total_comments: (data) => data.total_comments === undefined || | ||
typeof data.total_comments === 'number', | ||
illust_ai_type: (data) => typeof data.illust_ai_type === 'number', | ||
illust_book_style: (data) => typeof data.illust_book_style === 'number', | ||
}; | ||
} | ||
} | ||
exports.PixivIllustItemCheck = PixivIllustItemCheck; | ||
//# sourceMappingURL=pixiv-illust.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseSimpleCheck, CheckFunctions } from '../checks'; | ||
import { PixivUser } from './pixiv-common'; | ||
@@ -52,2 +53,5 @@ import { PixivNovelItem } from './pixiv-novel'; | ||
} | ||
export declare class NovelSeriesDetailCheck extends BaseSimpleCheck<NovelSeriesDetail> { | ||
checks(): CheckFunctions<NovelSeriesDetail>; | ||
} | ||
/** | ||
@@ -78,2 +82,5 @@ * pixiv 小説シリーズアイテム | ||
} | ||
export declare class PixivNovelSeriesItemCheck extends BaseSimpleCheck<PixivNovelSeriesItem> { | ||
checks(): CheckFunctions<PixivNovelSeriesItem>; | ||
} | ||
//# sourceMappingURL=pixiv-novel-series.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PixivNovelSeriesItemCheck = exports.NovelSeriesDetailCheck = void 0; | ||
const checks_1 = require("../checks"); | ||
const pixiv_novel_1 = require("./pixiv-novel"); | ||
class NovelSeriesDetailCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
id: (data) => typeof data.id === 'number', | ||
title: (data) => typeof data.title === 'string', | ||
caption: (data) => typeof data.caption === 'string', | ||
is_original: (data) => typeof data.is_original === 'boolean', | ||
is_concluded: (data) => typeof data.is_concluded === 'boolean', | ||
content_count: (data) => typeof data.content_count === 'number', | ||
total_character_count: (data) => typeof data.total_character_count === 'number', | ||
user: (data) => typeof data.user === 'object', | ||
display_text: (data) => typeof data.display_text === 'string', | ||
novel_ai_type: (data) => typeof data.novel_ai_type === 'number', | ||
watchlist_added: (data) => typeof data.watchlist_added === 'boolean', | ||
}; | ||
} | ||
} | ||
exports.NovelSeriesDetailCheck = NovelSeriesDetailCheck; | ||
class PixivNovelSeriesItemCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
novel_series_detail: (data) => typeof data.novel_series_detail === 'object' && | ||
new NovelSeriesDetailCheck().throwIfFailed(data.novel_series_detail), | ||
novel_series_first_novel: (data) => typeof data.novel_series_first_novel === 'object' && | ||
new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(data.novel_series_first_novel), | ||
novel_series_latest_novel: (data) => typeof data.novel_series_latest_novel === 'object' && | ||
new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(data.novel_series_latest_novel), | ||
novels: (data) => Array.isArray(data.novels) && | ||
data.novels.every((novel) => typeof novel === 'object' && | ||
new pixiv_novel_1.PixivNovelItemCheck().throwIfFailed(novel)), | ||
next_url: (data) => typeof data.next_url === 'string' || data.next_url === null, | ||
}; | ||
} | ||
} | ||
exports.PixivNovelSeriesItemCheck = PixivNovelSeriesItemCheck; | ||
//# sourceMappingURL=pixiv-novel-series.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseSimpleCheck, CheckFunctions } from '../checks'; | ||
import { ImageUrls, Tag, PixivUser, Series } from './pixiv-common'; | ||
@@ -67,5 +68,5 @@ /** | ||
* | ||
* 小説の場合、シリーズに属していない場合空配列が入っている。 | ||
* 小説の場合、シリーズに属していない場合空オブジェクトが入っている。 | ||
*/ | ||
series: Series | unknown[]; | ||
series: Series | Record<string, never>; | ||
/** | ||
@@ -119,2 +120,5 @@ * ブックマークしているかどうか | ||
} | ||
export declare class PixivNovelItemCheck extends BaseSimpleCheck<PixivNovelItem> { | ||
checks(): CheckFunctions<PixivNovelItem>; | ||
} | ||
//# sourceMappingURL=pixiv-novel.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PixivNovelItemCheck = void 0; | ||
const utils_1 = require("../utils"); | ||
const checks_1 = require("../checks"); | ||
const pixiv_common_1 = require("./pixiv-common"); | ||
class PixivNovelItemCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
id: (data) => typeof data.id === 'number', | ||
title: (data) => typeof data.title === 'string', | ||
caption: (data) => typeof data.caption === 'string', | ||
restrict: (data) => typeof data.restrict === 'number', | ||
x_restrict: (data) => typeof data.x_restrict === 'number', | ||
is_original: (data) => typeof data.is_original === 'boolean', | ||
image_urls: (data) => typeof data.image_urls === 'object' && | ||
new pixiv_common_1.ImageUrlsCheck().throwIfFailed(data.image_urls), | ||
create_date: (data) => typeof data.create_date === 'string', | ||
tags: (data) => typeof data.tags === 'object' && | ||
Array.isArray(data.tags) && | ||
data.tags.every((tag) => new pixiv_common_1.TagCheck().throwIfFailed(tag)), | ||
page_count: (data) => typeof data.page_count === 'number', | ||
text_length: (data) => typeof data.text_length === 'number', | ||
user: (data) => typeof data.user === 'object' && | ||
new pixiv_common_1.PixivUserCheck().throwIfFailed(data.user), | ||
series: (data) => typeof data.series === 'object' && | ||
((0, utils_1.isEmptyObject)(data.series) || | ||
new pixiv_common_1.SeriesCheck().throwIfFailed(data.series)), | ||
is_bookmarked: (data) => typeof data.is_bookmarked === 'boolean', | ||
total_bookmarks: (data) => typeof data.total_bookmarks === 'number', | ||
total_view: (data) => typeof data.total_view === 'number', | ||
visible: (data) => typeof data.visible === 'boolean', | ||
total_comments: (data) => typeof data.total_comments === 'number', | ||
is_muted: (data) => typeof data.is_muted === 'boolean', | ||
is_mypixiv_only: (data) => typeof data.is_mypixiv_only === 'boolean', | ||
is_x_restricted: (data) => typeof data.is_x_restricted === 'boolean', | ||
novel_ai_type: (data) => typeof data.novel_ai_type === 'number', | ||
}; | ||
} | ||
} | ||
exports.PixivNovelItemCheck = PixivNovelItemCheck; | ||
//# sourceMappingURL=pixiv-novel.js.map |
@@ -0,1 +1,2 @@ | ||
import { BaseSimpleCheck, CheckFunctions } from '../checks'; | ||
import { PixivUser } from './pixiv-common'; | ||
@@ -13,2 +14,5 @@ /** | ||
}; | ||
export declare class PixivUserItemCheck extends BaseSimpleCheck<PixivUserItem> { | ||
checks(): CheckFunctions<PixivUserItem>; | ||
} | ||
type Gender = 'male' | 'female' | 'unknown'; | ||
@@ -20,3 +24,3 @@ /** | ||
/** ウェブサイト */ | ||
webpage: string; | ||
webpage: string | null; | ||
/** 性別 */ | ||
@@ -120,2 +124,5 @@ gender: Gender; | ||
} | ||
export declare class PixivUserProfileCheck extends BaseSimpleCheck<PixivUserProfile> { | ||
checks(): CheckFunctions<PixivUserProfile>; | ||
} | ||
type Publicity = 'public' | 'private' | 'mypixiv'; | ||
@@ -142,2 +149,5 @@ /** | ||
} | ||
export declare class PixivUserProfilePublicityCheck extends BaseSimpleCheck<PixivUserProfilePublicity> { | ||
checks(): CheckFunctions<PixivUserProfilePublicity>; | ||
} | ||
/** | ||
@@ -174,3 +184,6 @@ * pixiv ユーザー作業環境情報 | ||
} | ||
export declare class PixivUserProfileWorkspaceCheck extends BaseSimpleCheck<PixivUserProfileWorkspace> { | ||
checks(): CheckFunctions<PixivUserProfileWorkspace>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=pixiv-user.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PixivUserProfileWorkspaceCheck = exports.PixivUserProfilePublicityCheck = exports.PixivUserProfileCheck = exports.PixivUserItemCheck = void 0; | ||
const checks_1 = require("../checks"); | ||
const pixiv_common_1 = require("./pixiv-common"); | ||
class PixivUserItemCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
pixivUser: (data) => new pixiv_common_1.PixivUserCheck().throwIfFailed(data), | ||
comment: (data) => typeof data.comment === 'string', | ||
}; | ||
} | ||
} | ||
exports.PixivUserItemCheck = PixivUserItemCheck; | ||
class PixivUserProfileCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
webpage: (data) => typeof data.webpage === 'string' || data.webpage === null, | ||
gender: (data) => typeof data.gender === 'string' && | ||
['male', 'female', 'unknown'].includes(data.gender), | ||
birth: (data) => typeof data.birth === 'string' && | ||
/^\d{4}-\d{2}-\d{2}$/.test(data.birth), | ||
birth_day: (data) => typeof data.birth_day === 'string' && | ||
/^\d{2}-\d{2}$/.test(data.birth_day), | ||
birth_year: (data) => typeof data.birth_year === 'number' && | ||
data.birth_year >= 1000 && | ||
data.birth_year <= 9999, | ||
region: (data) => typeof data.region === 'string', | ||
address_id: (data) => typeof data.address_id === 'number' && | ||
(data.address_id === 0 || | ||
(data.address_id >= 1 && data.address_id <= 48)), | ||
country_code: (data) => typeof data.country_code === 'string' && | ||
(data.country_code === '' || /^[A-Z]{2}$/.test(data.country_code)), | ||
job: (data) => typeof data.job === 'string', | ||
job_id: (data) => typeof data.job_id === 'number' && | ||
(data.job_id === 0 || (data.job_id >= 1 && data.job_id <= 23)), | ||
total_follow_users: (data) => typeof data.total_follow_users === 'number' && | ||
data.total_follow_users >= 0, | ||
total_mypixiv_users: (data) => typeof data.total_mypixiv_users === 'number' && | ||
data.total_mypixiv_users >= 0, | ||
total_illusts: (data) => typeof data.total_illusts === 'number' && data.total_illusts >= 0, | ||
total_manga: (data) => typeof data.total_manga === 'number' && data.total_manga >= 0, | ||
total_novels: (data) => typeof data.total_novels === 'number' && data.total_novels >= 0, | ||
total_illust_bookmarks_public: (data) => typeof data.total_illust_bookmarks_public === 'number' && | ||
data.total_illust_bookmarks_public >= 0, | ||
total_illust_series: (data) => typeof data.total_illust_series === 'number' && | ||
data.total_illust_series >= 0, | ||
total_novel_series: (data) => typeof data.total_novel_series === 'number' && | ||
data.total_novel_series >= 0, | ||
background_image_url: (data) => typeof data.background_image_url === 'string', | ||
twitter_account: (data) => typeof data.twitter_account === 'string', | ||
twitter_url: (data) => typeof data.twitter_url === 'string', | ||
pawoo_url: (data) => typeof data.pawoo_url === 'string', | ||
is_premium: (data) => typeof data.is_premium === 'boolean', | ||
is_using_custom_profile_image: (data) => typeof data.is_using_custom_profile_image === 'boolean', | ||
}; | ||
} | ||
} | ||
exports.PixivUserProfileCheck = PixivUserProfileCheck; | ||
class PixivUserProfilePublicityCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
gender: (data) => ['public', 'private', 'mypixiv'].includes(data.gender), | ||
region: (data) => ['public', 'private', 'mypixiv'].includes(data.region), | ||
birth_day: (data) => ['public', 'private', 'mypixiv'].includes(data.birth_day), | ||
birth_year: (data) => ['public', 'private', 'mypixiv'].includes(data.birth_year), | ||
job: (data) => ['public', 'private', 'mypixiv'].includes(data.job), | ||
pawoo: (data) => typeof data.pawoo === 'boolean', | ||
}; | ||
} | ||
} | ||
exports.PixivUserProfilePublicityCheck = PixivUserProfilePublicityCheck; | ||
class PixivUserProfileWorkspaceCheck extends checks_1.BaseSimpleCheck { | ||
checks() { | ||
return { | ||
pc: (data) => typeof data.pc === 'string', | ||
monitor: (data) => typeof data.monitor === 'string', | ||
tool: (data) => typeof data.tool === 'string', | ||
scanner: (data) => typeof data.scanner === 'string', | ||
tablet: (data) => typeof data.tablet === 'string', | ||
mouse: (data) => typeof data.mouse === 'string', | ||
printer: (data) => typeof data.printer === 'string', | ||
desktop: (data) => typeof data.desktop === 'string', | ||
music: (data) => typeof data.music === 'string', | ||
desk: (data) => typeof data.desk === 'string', | ||
chair: (data) => typeof data.chair === 'string', | ||
comment: (data) => typeof data.comment === 'string', | ||
workspace_image_url: (data) => typeof data.workspace_image_url === 'string' || | ||
data.workspace_image_url === null, | ||
}; | ||
} | ||
} | ||
exports.PixivUserProfileWorkspaceCheck = PixivUserProfileWorkspaceCheck; | ||
//# sourceMappingURL=pixiv-user.js.map |
{ | ||
"name": "@book000/pixivts", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"description": "pixiv Unofficial API Library for TypeScript", | ||
@@ -34,2 +34,3 @@ "homepage": "https://www.npmjs.com/package/@book000/pixivts", | ||
"fix:prettier": "prettier --write src", | ||
"test": "jest", | ||
"lint": "run-p -c lint:prettier lint:eslint lint:tsc", | ||
@@ -48,2 +49,3 @@ "lint:eslint": "eslint . --ext ts,tsx", | ||
"devDependencies": { | ||
"@types/jest": "29.5.1", | ||
"@types/node": "18.16.3", | ||
@@ -61,4 +63,6 @@ "@types/qs": "6.9.7", | ||
"eslint-plugin-unicorn": "46.0.0", | ||
"jest": "29.5.0", | ||
"prettier": "2.8.8", | ||
"snake-camel-types": "1.0.1", | ||
"ts-jest": "29.1.0", | ||
"ts-node": "10.9.1", | ||
@@ -69,3 +73,20 @@ "ts-node-dev": "2.0.0", | ||
"yarn-run-all": "3.1.1" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js" | ||
], | ||
"transform": { | ||
".+\\.ts$": [ | ||
"ts-jest", | ||
{ | ||
"tsconfig": "tsconfig.json" | ||
} | ||
] | ||
}, | ||
"testMatch": [ | ||
"**/*.test.ts" | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
272367
105
3169
22
2