@book000/pixivts 0.64.1-beta.3 → 0.64.1-beta.30
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/index.cjs +17 -33
- package/dist/index.d.cts +0 -34
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +0 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -33
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/result.ts
|
|
2
2
|
var OkResultImpl = class OkResultImpl {
|
|
3
3
|
value;
|
|
4
4
|
isOk = true;
|
|
@@ -155,8 +155,7 @@ var ResultAsync = class ResultAsync {
|
|
|
155
155
|
return r.isOk ? r.value : fallback;
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
|
|
159
|
-
//#region src/errors.ts
|
|
158
|
+
// src/errors.ts
|
|
160
159
|
/**
|
|
161
160
|
* An `Error` subclass that wraps a `PixivError` for use in thrown contexts
|
|
162
161
|
* (e.g. async generators that must throw proper `Error` objects).
|
|
@@ -223,8 +222,7 @@ function parseError(message, body, cause) {
|
|
|
223
222
|
cause
|
|
224
223
|
};
|
|
225
224
|
}
|
|
226
|
-
|
|
227
|
-
//#region src/paginated.ts
|
|
225
|
+
// src/paginated.ts
|
|
228
226
|
/**
|
|
229
227
|
* A `ResultAsync<TPage, PixivError>` with additional `.pages()` / `.items()`
|
|
230
228
|
* async generators for consuming paginated pixiv list responses.
|
|
@@ -302,8 +300,7 @@ var PaginatedResultAsync = class PaginatedResultAsync extends ResultAsync {
|
|
|
302
300
|
function failedPaginated(error, http, getItems) {
|
|
303
301
|
return new PaginatedResultAsync(Promise.resolve(err(error)), http, getItems);
|
|
304
302
|
}
|
|
305
|
-
|
|
306
|
-
//#region src/params.ts
|
|
303
|
+
// src/params.ts
|
|
307
304
|
/**
|
|
308
305
|
* Parameter building utilities.
|
|
309
306
|
*
|
|
@@ -447,8 +444,7 @@ function parseNextUrl(url) {
|
|
|
447
444
|
if (lastOrder !== void 0) result.lastOrder = lastOrder;
|
|
448
445
|
return result;
|
|
449
446
|
}
|
|
450
|
-
|
|
451
|
-
//#region src/options.ts
|
|
447
|
+
// src/options.ts
|
|
452
448
|
/**
|
|
453
449
|
* Public option constants for @book000/pixivts.
|
|
454
450
|
*
|
|
@@ -578,8 +574,7 @@ const UserIllustType = {
|
|
|
578
574
|
ILLUST: "illust",
|
|
579
575
|
MANGA: "manga"
|
|
580
576
|
};
|
|
581
|
-
|
|
582
|
-
//#region src/auth.ts
|
|
577
|
+
// src/auth.ts
|
|
583
578
|
const T = Array.from({ length: 64 }, (_, i) => Math.floor(Math.abs(Math.sin(i + 1)) * 2 ** 32));
|
|
584
579
|
const S = [
|
|
585
580
|
7,
|
|
@@ -809,8 +804,7 @@ var AuthManager = class AuthManager {
|
|
|
809
804
|
return manager;
|
|
810
805
|
}
|
|
811
806
|
};
|
|
812
|
-
|
|
813
|
-
//#region src/http.ts
|
|
807
|
+
// src/http.ts
|
|
814
808
|
const DEFAULT_RETRY = {
|
|
815
809
|
maxRetries: 3,
|
|
816
810
|
waitMs: 1e4
|
|
@@ -897,7 +891,7 @@ var HttpClient = class {
|
|
|
897
891
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
|
|
898
892
|
Referer: "https://www.pixiv.net/"
|
|
899
893
|
} }), networkError).andThen((response) => {
|
|
900
|
-
return response.ok ?
|
|
894
|
+
return ResultAsync.fromResult(response.ok ? ok(response) : err(apiError(response.status, null)));
|
|
901
895
|
});
|
|
902
896
|
}
|
|
903
897
|
/**
|
|
@@ -1002,8 +996,7 @@ var HttpClient = class {
|
|
|
1002
996
|
return err(rateLimitError(lastRetryAfterMs));
|
|
1003
997
|
}
|
|
1004
998
|
};
|
|
1005
|
-
|
|
1006
|
-
//#region src/resources/illusts.ts
|
|
999
|
+
// src/resources/illusts.ts
|
|
1007
1000
|
/** Methods for the illust API namespace. */
|
|
1008
1001
|
var IllustResource = class {
|
|
1009
1002
|
#http;
|
|
@@ -1255,8 +1248,7 @@ var IllustResource = class {
|
|
|
1255
1248
|
return this.#http.get("/v1/trending-tags/illust", buildParams({ filter: params.filter ?? "for_ios" }));
|
|
1256
1249
|
}
|
|
1257
1250
|
};
|
|
1258
|
-
|
|
1259
|
-
//#region src/webview-novel.ts
|
|
1251
|
+
// src/webview-novel.ts
|
|
1260
1252
|
/**
|
|
1261
1253
|
* Parses the structured novel data embedded in the WebView HTML page
|
|
1262
1254
|
* (GET /webview/v2/novel).
|
|
@@ -1293,8 +1285,7 @@ function parseWebviewNovel(html) {
|
|
|
1293
1285
|
const camelized = camelizeKeys(parsed);
|
|
1294
1286
|
return isWebviewNovelShape(camelized) ? ok(camelized) : err(parseError("Embedded novel JSON does not match the expected WebviewNovel shape", html));
|
|
1295
1287
|
}
|
|
1296
|
-
|
|
1297
|
-
//#region src/resources/novels.ts
|
|
1288
|
+
// src/resources/novels.ts
|
|
1298
1289
|
/**
|
|
1299
1290
|
* Formats a view timestamp as ISO 8601 with milliseconds and the local UTC
|
|
1300
1291
|
* offset of that instant. Strings are returned unchanged.
|
|
@@ -1596,8 +1587,7 @@ var NovelResource = class {
|
|
|
1596
1587
|
})), this.#http, (page) => page.novels);
|
|
1597
1588
|
}
|
|
1598
1589
|
};
|
|
1599
|
-
|
|
1600
|
-
//#region src/resources/users.ts
|
|
1590
|
+
// src/resources/users.ts
|
|
1601
1591
|
/** Methods for the user bookmarks sub-namespace. */
|
|
1602
1592
|
var UserBookmarksResource = class {
|
|
1603
1593
|
#http;
|
|
@@ -1939,8 +1929,7 @@ var UserResource = class {
|
|
|
1939
1929
|
return this.#http.get("/v1/notification/has-unread-notifications");
|
|
1940
1930
|
}
|
|
1941
1931
|
};
|
|
1942
|
-
|
|
1943
|
-
//#region src/resources/manga.ts
|
|
1932
|
+
// src/resources/manga.ts
|
|
1944
1933
|
/** Methods for the manga API namespace. */
|
|
1945
1934
|
var MangaResource = class {
|
|
1946
1935
|
#http;
|
|
@@ -1971,8 +1960,7 @@ var MangaResource = class {
|
|
|
1971
1960
|
return PaginatedResultAsync.fromResultAsync(this.#http.get("/v1/watchlist/manga"), this.#http, (page) => page.series);
|
|
1972
1961
|
}
|
|
1973
1962
|
};
|
|
1974
|
-
|
|
1975
|
-
//#region src/resources/ugoira.ts
|
|
1963
|
+
// src/resources/ugoira.ts
|
|
1976
1964
|
/** Methods for the ugoira API namespace. */
|
|
1977
1965
|
var UgoiraResource = class {
|
|
1978
1966
|
#http;
|
|
@@ -1989,8 +1977,7 @@ var UgoiraResource = class {
|
|
|
1989
1977
|
return this.#http.get("/v1/ugoira/metadata", buildParams({ illustId: params.illustId }));
|
|
1990
1978
|
}
|
|
1991
1979
|
};
|
|
1992
|
-
|
|
1993
|
-
//#region src/resources/spotlight.ts
|
|
1980
|
+
// src/resources/spotlight.ts
|
|
1994
1981
|
/** Methods for the pixivision spotlight API namespace. */
|
|
1995
1982
|
var SpotlightResource = class {
|
|
1996
1983
|
#http;
|
|
@@ -2011,8 +1998,7 @@ var SpotlightResource = class {
|
|
|
2011
1998
|
})), this.#http, (page) => page.spotlightArticles);
|
|
2012
1999
|
}
|
|
2013
2000
|
};
|
|
2014
|
-
|
|
2015
|
-
//#region src/resources/images.ts
|
|
2001
|
+
// src/resources/images.ts
|
|
2016
2002
|
/** Methods for fetching pixiv images. */
|
|
2017
2003
|
var ImageResource = class {
|
|
2018
2004
|
#http;
|
|
@@ -2031,8 +2017,7 @@ var ImageResource = class {
|
|
|
2031
2017
|
return this.#http.fetchImage(imageUrl);
|
|
2032
2018
|
}
|
|
2033
2019
|
};
|
|
2034
|
-
|
|
2035
|
-
//#region src/client.ts
|
|
2020
|
+
// src/client.ts
|
|
2036
2021
|
/**
|
|
2037
2022
|
* PixivClient — main entry point for the @book000/pixivts library.
|
|
2038
2023
|
*
|
|
@@ -2130,7 +2115,6 @@ var PixivClient = class PixivClient {
|
|
|
2130
2115
|
return new PixivClient(auth, http);
|
|
2131
2116
|
}
|
|
2132
2117
|
};
|
|
2133
|
-
//#endregion
|
|
2134
2118
|
export { BookmarkRestrict, FollowRestrict, NovelRankingMode, OSFilter, PaginatedResultAsync, PixivClient, PixivFetchError, RankingMode, ResultAsync, SearchDuration, SearchSort, SearchTarget, UserIllustType, apiError, authFailedError, err, failedPaginated, networkError, ok, parseError, parseNextUrl, rateLimitError };
|
|
2135
2119
|
|
|
2136
2120
|
//# sourceMappingURL=index.js.map
|