e621 3.2.0 → 3.2.2
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/README.md +18 -2
- package/dist/browser/e621.js +177 -113
- package/dist/browser/e621.js.map +3 -3
- package/dist/lib/client.d.ts +18 -2
- package/dist/lib/client.js +9 -2
- package/dist/lib/generated/schemas.d.ts +7 -2
- package/dist/lib/generated/schemas.js +17 -10
- package/dist/lib/generated/types.d.ts +53 -57
- package/dist/lib/index.d.ts +4 -3
- package/dist/lib/index.js +2 -2
- package/dist/lib/models/Base.browser.d.ts +4 -3
- package/dist/lib/models/Base.browser.js +1 -1
- package/dist/lib/models/Base.d.ts +4 -3
- package/dist/lib/models/Base.js +1 -1
- package/dist/lib/models/BasicPost.d.ts +2 -1
- package/dist/lib/models/BasicPost.js +1 -1
- package/dist/lib/models/ExtendedPost.d.ts +2 -1
- package/dist/lib/models/ExtendedPost.js +1 -1
- package/dist/lib/models/Post.d.ts +2 -1
- package/dist/lib/models/Post.js +1 -1
- package/dist/lib/models/ThumbnailPost.d.ts +2 -1
- package/dist/lib/models/ThumbnailPost.js +1 -1
- package/dist/lib/models/posts/Actions.d.ts +11 -11
- package/dist/lib/models/posts/Actions.js +1 -1
- package/dist/lib/modules/Base.d.ts +4 -3
- package/dist/lib/modules/Base.js +6 -3
- package/dist/lib/modules/Favorites.d.ts +8 -3
- package/dist/lib/modules/Favorites.js +12 -4
- package/dist/lib/modules/IqdbQueries.d.ts +11 -6
- package/dist/lib/modules/IqdbQueries.js +12 -4
- package/dist/lib/modules/Popular.d.ts +8 -3
- package/dist/lib/modules/Popular.js +12 -4
- package/dist/lib/modules/Posts.d.ts +27 -18
- package/dist/lib/modules/Posts.js +46 -22
- package/dist/lib/modules/Uploads.d.ts +3 -3
- package/dist/lib/modules/Uploads.js +1 -1
- package/dist/lib/modules/index.d.ts +8 -7
- package/dist/lib/modules/index.js +72 -69
- package/dist/lib/modules/posts/Format.d.ts +15 -5
- package/dist/lib/modules/posts/Format.js +1 -1
- package/dist/lib/standalone.d.ts +8 -2
- package/dist/lib/standalone.js +10 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -37,6 +37,21 @@ const e621 = new E621({
|
|
|
37
37
|
// e.g. use e621.posts.METHOD(), e621.users.METHOD()
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### Default Post Format
|
|
41
|
+
|
|
42
|
+
Post-returning methods (`posts.get()`, `posts.search()`, `favorites.search()`, `popular.get()`, `iqdbQueries.get()`/`.post()`, and convenience methods on returned post models like `post.update()`) accept per-call `v2`/`mode` options and default to the legacy format when omitted. Set `defaultPostFormat` once to change that default everywhere instead of repeating the same options on every call:
|
|
43
|
+
```typescript
|
|
44
|
+
const e621 = new E621({
|
|
45
|
+
defaultPostFormat: { v2: true, mode: "extended" }
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const post = await e621.posts.get(123); // ExtendedPost, typed accurately - no cast needed
|
|
49
|
+
await post?.update({ tags: "foo" }); // also resolves to ExtendedPost
|
|
50
|
+
|
|
51
|
+
// a per-call option still overrides the default for that one call
|
|
52
|
+
const legacy = await e621.posts.get(123, { v2: false });
|
|
53
|
+
```
|
|
54
|
+
|
|
40
55
|
## Browser Usage
|
|
41
56
|
|
|
42
57
|
A pre-bundled, browser-only build (no Node built-ins) is published at `e621/browser`, for use with a plain `<script type="module">` or a CDN like jsDelivr/unpkg:
|
|
@@ -62,7 +77,7 @@ import Favorites from "e621/modules/Favorites";
|
|
|
62
77
|
import { createE621Client, createStandalone } from "e621/standalone";
|
|
63
78
|
|
|
64
79
|
// same Options as `new E621()`, handles auth headers/user agent/etc. for you
|
|
65
|
-
const client
|
|
80
|
+
const client = createE621Client({ authUser: "", authKey: "" });
|
|
66
81
|
|
|
67
82
|
// only the modules listed here (and their own dependencies) end up in your bundle;
|
|
68
83
|
// property names are each module's own `moduleKey` (matching `new E621()`'s naming, e.g. `posts`, `favorites`)
|
|
@@ -83,7 +98,8 @@ npm test
|
|
|
83
98
|
- `test/treeshaking.test.ts` - bundles a standalone client with esbuild and asserts unrelated modules are excluded and the result is meaningfully smaller than `new E621()`.
|
|
84
99
|
- `test/standalone.test.ts` / `test/client.test.ts` - verify `createE621Client`/`createStandalone` wiring and the full `E621` client's module surface (no network calls).
|
|
85
100
|
- `test/browser.test.ts` - loads the browser bundle in a real headless Chromium (via [Playwright](https://playwright.dev)) and checks it works with no Node built-ins.
|
|
86
|
-
- `test/
|
|
101
|
+
- `test/openapi.test.ts` - scans `lib/` for every `@OperationID(...)`/`@Schema(...)` and asserts the value actually exists in the OpenAPI spec (these aren't validated at runtime anymore - see the note in `lib/util.ts` - so this plus the build-time check in `scripts/replace-openapi.ts` are what catch a typo'd one).
|
|
102
|
+
- `test/defaultPostFormat.test.ts` - mocks `fetch` to verify `defaultPostFormat` actually reaches the outgoing request's query params, that the returned model matches, that a per-call option overrides it, and that it's picked up by model convenience methods too.
|
|
87
103
|
|
|
88
104
|
CI (`.github/workflows/test.yml`) runs the same on every push/PR, and gates releases (`publish.yml`) on it passing.
|
|
89
105
|
|
package/dist/browser/e621.js
CHANGED
|
@@ -787,7 +787,7 @@ var createClient = (config = {}) => {
|
|
|
787
787
|
};
|
|
788
788
|
|
|
789
789
|
// dist/lib/version.js
|
|
790
|
-
var VERSION = "3.2.
|
|
790
|
+
var VERSION = "3.2.2";
|
|
791
791
|
|
|
792
792
|
// dist/lib/client.js
|
|
793
793
|
function createE621Client(options) {
|
|
@@ -797,12 +797,13 @@ function createE621Client(options) {
|
|
|
797
797
|
baseURL: options?.baseURL ?? "https://e621.net",
|
|
798
798
|
requestTimeout: options?.requestTimeout ?? 30,
|
|
799
799
|
statusCheckURL: options?.statusCheckURL ?? "https://status.e621.church/json",
|
|
800
|
-
userAgent: options?.userAgent ?? `E621/${VERSION} (https://github.com/DonovanDMC/E621${options?.authUser ? `; "${options.authUser}"` : ""})
|
|
800
|
+
userAgent: options?.userAgent ?? `E621/${VERSION} (https://github.com/DonovanDMC/E621${options?.authUser ? `; "${options.authUser}"` : ""})`,
|
|
801
|
+
userAgentInQuery: options?.userAgentInQuery ?? "window" in globalThis
|
|
801
802
|
};
|
|
802
803
|
let config;
|
|
803
804
|
const commonConfig = {
|
|
804
805
|
baseUrl: resolved.baseURL,
|
|
805
|
-
headers: {
|
|
806
|
+
headers: resolved.userAgentInQuery ? void 0 : {
|
|
806
807
|
"User-Agent": resolved.userAgent
|
|
807
808
|
},
|
|
808
809
|
fetch: async (input, init) => {
|
|
@@ -824,6 +825,12 @@ function createE621Client(options) {
|
|
|
824
825
|
init.headers = headers;
|
|
825
826
|
}
|
|
826
827
|
}
|
|
828
|
+
if (resolved.userAgentInQuery && input instanceof Request) {
|
|
829
|
+
const requestURL = new URL(input.url);
|
|
830
|
+
requestURL.searchParams.set("_client", resolved.userAgent);
|
|
831
|
+
input = new Request(requestURL, input);
|
|
832
|
+
url = requestURL.toString();
|
|
833
|
+
}
|
|
827
834
|
Debug(`request:${method}`, `-> ${url}`);
|
|
828
835
|
const res = await fetch(input, init);
|
|
829
836
|
Debug(`response:${method}`, `<- ${url} ${res.status} ${res.statusText}`);
|
|
@@ -3202,10 +3209,11 @@ var Base2 = class {
|
|
|
3202
3209
|
throw new UnexpectedResponseError(res.request, res.response, res.error);
|
|
3203
3210
|
} else {
|
|
3204
3211
|
if (klass) {
|
|
3212
|
+
const e621 = this.e621;
|
|
3205
3213
|
if (Array.isArray(res.data))
|
|
3206
|
-
return res.data.map((item) => new klass(
|
|
3214
|
+
return res.data.map((item) => new klass(e621, item));
|
|
3207
3215
|
else
|
|
3208
|
-
return new klass(
|
|
3216
|
+
return new klass(e621, res.data);
|
|
3209
3217
|
} else
|
|
3210
3218
|
return res.data;
|
|
3211
3219
|
}
|
|
@@ -5643,6 +5651,12 @@ function wrapPosts(e621, data, v2, mode) {
|
|
|
5643
5651
|
var _a2;
|
|
5644
5652
|
var Favorites = class extends Base2 {
|
|
5645
5653
|
static moduleKey = "favorites";
|
|
5654
|
+
defaultFormat;
|
|
5655
|
+
/** @param defaultFormat - The v2/mode format to fall back to when `search()` is called without explicit v2/mode options. */
|
|
5656
|
+
constructor(e621, client2, defaultFormat = {}) {
|
|
5657
|
+
super(e621, client2);
|
|
5658
|
+
this.defaultFormat = defaultFormat;
|
|
5659
|
+
}
|
|
5646
5660
|
/**
|
|
5647
5661
|
*
|
|
5648
5662
|
* @requiresApiKeyAuth
|
|
@@ -5678,13 +5692,15 @@ var Favorites = class extends Base2 {
|
|
|
5678
5692
|
* @see {@link https://e621.wiki/#operations-Favorites-favorites\#index Documentation} for more details.
|
|
5679
5693
|
*/
|
|
5680
5694
|
async search(options) {
|
|
5695
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
5696
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
5681
5697
|
return favorites_index({
|
|
5682
5698
|
client: this.client,
|
|
5683
|
-
query: options
|
|
5699
|
+
query: { ...options, v2, mode }
|
|
5684
5700
|
}).then((res) => {
|
|
5685
5701
|
const data = this._handleResponse(res, 200, true);
|
|
5686
|
-
const raw =
|
|
5687
|
-
return wrapPosts(this.e621, raw,
|
|
5702
|
+
const raw = v2 ? data : data.posts;
|
|
5703
|
+
return wrapPosts(this.e621, raw, v2, mode);
|
|
5688
5704
|
});
|
|
5689
5705
|
}
|
|
5690
5706
|
};
|
|
@@ -6664,6 +6680,12 @@ var _a3;
|
|
|
6664
6680
|
var _b2;
|
|
6665
6681
|
var IqdbQueries = class extends Base2 {
|
|
6666
6682
|
static moduleKey = "iqdb";
|
|
6683
|
+
defaultFormat;
|
|
6684
|
+
/** @param defaultFormat - The v2 format to fall back to when `get()`/`post()` are called without an explicit `v2` option. `mode` is ignored - IQDB only ever returns the basic v2 format. */
|
|
6685
|
+
constructor(e621, client2, defaultFormat = {}) {
|
|
6686
|
+
super(e621, client2);
|
|
6687
|
+
this.defaultFormat = defaultFormat;
|
|
6688
|
+
}
|
|
6667
6689
|
/**
|
|
6668
6690
|
*
|
|
6669
6691
|
* @operationId {@link https://e621.wiki/#operations-IQDB-iqdb_queries\#show iqdb_queries#show}
|
|
@@ -6671,14 +6693,15 @@ var IqdbQueries = class extends Base2 {
|
|
|
6671
6693
|
* @see {@link https://e621.wiki/#operations-IQDB-iqdb_queries\#show Documentation} for more details.
|
|
6672
6694
|
*/
|
|
6673
6695
|
async get(options) {
|
|
6696
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
6674
6697
|
return iqdbQueries_show({
|
|
6675
6698
|
client: this.client,
|
|
6676
|
-
query: prefixKeys(options, "search", ["v2"])
|
|
6699
|
+
query: { ...prefixKeys(options, "search", ["v2"]) ?? {}, v2 }
|
|
6677
6700
|
}).then((res) => {
|
|
6678
6701
|
const data = this._handleResponse(res, 200, true);
|
|
6679
6702
|
return data.map((d) => ({
|
|
6680
6703
|
hash: d.hash,
|
|
6681
|
-
post:
|
|
6704
|
+
post: v2 ? new BasicPost_default(this.e621, d.post) : new IqdbPost_default(this.e621, d.post.posts),
|
|
6682
6705
|
post_id: d.post_id,
|
|
6683
6706
|
score: d.score
|
|
6684
6707
|
}));
|
|
@@ -6691,7 +6714,8 @@ var IqdbQueries = class extends Base2 {
|
|
|
6691
6714
|
* @see {@link https://e621.wiki/#operations-IQDB-iqdb_queries\#show_post Documentation} for more details.
|
|
6692
6715
|
*/
|
|
6693
6716
|
async post(options) {
|
|
6694
|
-
const { v2, ...body } = options;
|
|
6717
|
+
const { v2: rawV2, ...body } = options ?? {};
|
|
6718
|
+
const v2 = rawV2 ?? this.defaultFormat.v2;
|
|
6695
6719
|
return iqdbQueries_showPost({
|
|
6696
6720
|
client: this.client,
|
|
6697
6721
|
query: { v2 },
|
|
@@ -7624,6 +7648,16 @@ var _f;
|
|
|
7624
7648
|
var _g;
|
|
7625
7649
|
var Posts = class extends Base2 {
|
|
7626
7650
|
static moduleKey = "posts";
|
|
7651
|
+
defaultFormat;
|
|
7652
|
+
/**
|
|
7653
|
+
* @param defaultFormat - The v2/mode format to fall back to for any method here (or any convenience
|
|
7654
|
+
* method on a returned post model) called without explicit v2/mode options. Defaults to the legacy
|
|
7655
|
+
* format, matching `new E621()`'s behavior when {@link Options.defaultPostFormat} isn't set.
|
|
7656
|
+
*/
|
|
7657
|
+
constructor(e621, client2, defaultFormat = {}) {
|
|
7658
|
+
super(e621, client2);
|
|
7659
|
+
this.defaultFormat = defaultFormat;
|
|
7660
|
+
}
|
|
7627
7661
|
/**
|
|
7628
7662
|
*
|
|
7629
7663
|
* You must be Janitor+.
|
|
@@ -7716,16 +7750,18 @@ var Posts = class extends Base2 {
|
|
|
7716
7750
|
* @see {@link https://e621.wiki/#operations-Posts-posts\#show Documentation} for more details.
|
|
7717
7751
|
*/
|
|
7718
7752
|
async get(id, options) {
|
|
7753
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
7754
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
7719
7755
|
return posts_show({
|
|
7720
7756
|
client: this.client,
|
|
7721
7757
|
path: { id },
|
|
7722
|
-
query: options
|
|
7758
|
+
query: { ...options, v2, mode }
|
|
7723
7759
|
}).then((res) => {
|
|
7724
7760
|
const data = this._handleResponse(res, 200, false);
|
|
7725
7761
|
if (data === null)
|
|
7726
7762
|
return null;
|
|
7727
|
-
const raw =
|
|
7728
|
-
return wrapPost(this.e621, raw,
|
|
7763
|
+
const raw = v2 ? data : data.post;
|
|
7764
|
+
return wrapPost(this.e621, raw, v2, mode);
|
|
7729
7765
|
});
|
|
7730
7766
|
}
|
|
7731
7767
|
/**
|
|
@@ -7739,14 +7775,16 @@ var Posts = class extends Base2 {
|
|
|
7739
7775
|
* @see {@link https://e621.wiki/#operations-Posts-posts\#mark_as_translated Documentation} for more details.
|
|
7740
7776
|
*/
|
|
7741
7777
|
async markTranslated(id, options) {
|
|
7778
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
7779
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
7742
7780
|
return posts_markAsTranslated({
|
|
7743
7781
|
client: this.client,
|
|
7744
7782
|
path: { id },
|
|
7745
|
-
query: options
|
|
7783
|
+
query: { ...options, v2, mode }
|
|
7746
7784
|
}).then((res) => {
|
|
7747
7785
|
const data = this._handleResponse(res, 200, true);
|
|
7748
|
-
const raw =
|
|
7749
|
-
return wrapPost(this.e621, raw,
|
|
7786
|
+
const raw = v2 ? data : data.post;
|
|
7787
|
+
return wrapPost(this.e621, raw, v2, mode);
|
|
7750
7788
|
});
|
|
7751
7789
|
}
|
|
7752
7790
|
/**
|
|
@@ -7789,13 +7827,15 @@ var Posts = class extends Base2 {
|
|
|
7789
7827
|
* @see {@link https://e621.wiki/#operations-Posts-posts\#random Documentation} for more details.
|
|
7790
7828
|
*/
|
|
7791
7829
|
async random(options) {
|
|
7830
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
7831
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
7792
7832
|
return posts_random({
|
|
7793
7833
|
client: this.client,
|
|
7794
|
-
query: options
|
|
7834
|
+
query: { ...options, v2, mode }
|
|
7795
7835
|
}).then((res) => {
|
|
7796
7836
|
const data = this._handleResponse(res, 200, true);
|
|
7797
|
-
const raw =
|
|
7798
|
-
return wrapPost(this.e621, raw,
|
|
7837
|
+
const raw = v2 ? data : data.post;
|
|
7838
|
+
return wrapPost(this.e621, raw, v2, mode);
|
|
7799
7839
|
});
|
|
7800
7840
|
}
|
|
7801
7841
|
/**
|
|
@@ -7905,17 +7945,19 @@ var Posts = class extends Base2 {
|
|
|
7905
7945
|
* @see {@link https://e621.wiki/#operations-Posts-posts\#index Documentation} for more details.
|
|
7906
7946
|
*/
|
|
7907
7947
|
async search(options) {
|
|
7948
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
7949
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
7908
7950
|
return posts_index({
|
|
7909
7951
|
client: this.client,
|
|
7910
|
-
query: options
|
|
7952
|
+
query: { ...options, v2, mode }
|
|
7911
7953
|
}).then((res) => {
|
|
7912
7954
|
const data = this._handleResponse(res, 200, true);
|
|
7913
7955
|
if (options?.md5) {
|
|
7914
|
-
const raw2 =
|
|
7915
|
-
return wrapPost(this.e621, raw2,
|
|
7956
|
+
const raw2 = v2 ? data : data.post;
|
|
7957
|
+
return wrapPost(this.e621, raw2, v2, mode);
|
|
7916
7958
|
}
|
|
7917
|
-
const raw =
|
|
7918
|
-
return wrapPosts(this.e621, raw,
|
|
7959
|
+
const raw = v2 ? data : data.posts;
|
|
7960
|
+
return wrapPosts(this.e621, raw, v2, mode);
|
|
7919
7961
|
});
|
|
7920
7962
|
}
|
|
7921
7963
|
/**
|
|
@@ -7925,14 +7967,16 @@ var Posts = class extends Base2 {
|
|
|
7925
7967
|
* @see {@link https://e621.wiki/#operations-Posts-posts\#show_seq Documentation} for more details.
|
|
7926
7968
|
*/
|
|
7927
7969
|
async sequence(id, options) {
|
|
7970
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
7971
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
7928
7972
|
return posts_showSeq({
|
|
7929
7973
|
client: this.client,
|
|
7930
7974
|
path: { id },
|
|
7931
|
-
query: options
|
|
7975
|
+
query: { ...options, v2, mode }
|
|
7932
7976
|
}).then((res) => {
|
|
7933
7977
|
const data = this._handleResponse(res, 200, true);
|
|
7934
|
-
const raw =
|
|
7935
|
-
return wrapPost(this.e621, raw,
|
|
7978
|
+
const raw = v2 ? data : data.post;
|
|
7979
|
+
return wrapPost(this.e621, raw, v2, mode);
|
|
7936
7980
|
});
|
|
7937
7981
|
}
|
|
7938
7982
|
/**
|
|
@@ -7965,7 +8009,9 @@ var Posts = class extends Base2 {
|
|
|
7965
8009
|
* @see {@link https://e621.wiki/#operations-Posts-posts\#update Documentation} for more details.
|
|
7966
8010
|
*/
|
|
7967
8011
|
async update(id, options) {
|
|
7968
|
-
const { v2, mode, ...body } = options ?? {};
|
|
8012
|
+
const { v2: rawV2, mode: rawMode, ...body } = options ?? {};
|
|
8013
|
+
const v2 = rawV2 ?? this.defaultFormat.v2;
|
|
8014
|
+
const mode = rawMode ?? this.defaultFormat.mode;
|
|
7969
8015
|
return posts_update({
|
|
7970
8016
|
client: this.client,
|
|
7971
8017
|
path: { id },
|
|
@@ -7988,14 +8034,16 @@ var Posts = class extends Base2 {
|
|
|
7988
8034
|
* @see {@link https://e621.wiki/#operations-Posts-posts\#update_iqdb Documentation} for more details.
|
|
7989
8035
|
*/
|
|
7990
8036
|
async updateIqdb(id, options) {
|
|
8037
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
8038
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
7991
8039
|
return posts_updateIqdb({
|
|
7992
8040
|
client: this.client,
|
|
7993
8041
|
path: { id },
|
|
7994
|
-
query: options
|
|
8042
|
+
query: { ...options, v2, mode }
|
|
7995
8043
|
}).then((res) => {
|
|
7996
8044
|
const data = this._handleResponse(res, 200, true);
|
|
7997
|
-
const raw =
|
|
7998
|
-
return wrapPost(this.e621, raw,
|
|
8045
|
+
const raw = v2 ? data : data.post;
|
|
8046
|
+
return wrapPost(this.e621, raw, v2, mode);
|
|
7999
8047
|
});
|
|
8000
8048
|
}
|
|
8001
8049
|
};
|
|
@@ -11217,6 +11265,12 @@ __decorate([
|
|
|
11217
11265
|
var _a5;
|
|
11218
11266
|
var Popular = class extends Base2 {
|
|
11219
11267
|
static moduleKey = "popular";
|
|
11268
|
+
defaultFormat;
|
|
11269
|
+
/** @param defaultFormat - The v2/mode format to fall back to when `get()` is called without explicit v2/mode options. */
|
|
11270
|
+
constructor(e621, client2, defaultFormat = {}) {
|
|
11271
|
+
super(e621, client2);
|
|
11272
|
+
this.defaultFormat = defaultFormat;
|
|
11273
|
+
}
|
|
11220
11274
|
/**
|
|
11221
11275
|
*
|
|
11222
11276
|
* @operationId {@link https://e621.wiki/#operations-Popular-popular\#index popular#index}
|
|
@@ -11224,13 +11278,15 @@ var Popular = class extends Base2 {
|
|
|
11224
11278
|
* @see {@link https://e621.wiki/#operations-Popular-popular\#index Documentation} for more details.
|
|
11225
11279
|
*/
|
|
11226
11280
|
async get(options) {
|
|
11281
|
+
const v2 = options?.v2 ?? this.defaultFormat.v2;
|
|
11282
|
+
const mode = options?.mode ?? this.defaultFormat.mode;
|
|
11227
11283
|
return popular_index({
|
|
11228
11284
|
client: this.client,
|
|
11229
|
-
query: options
|
|
11285
|
+
query: { ...options, v2, mode }
|
|
11230
11286
|
}).then((res) => {
|
|
11231
11287
|
const data = this._handleResponse(res, 200, true);
|
|
11232
|
-
const raw =
|
|
11233
|
-
return wrapPosts(this.e621, raw,
|
|
11288
|
+
const raw = v2 ? data : data.posts;
|
|
11289
|
+
return wrapPosts(this.e621, raw, v2, mode);
|
|
11234
11290
|
});
|
|
11235
11291
|
}
|
|
11236
11292
|
};
|
|
@@ -13503,76 +13559,77 @@ __decorate([
|
|
|
13503
13559
|
], StaffWikiVersions.prototype, "search", null);
|
|
13504
13560
|
|
|
13505
13561
|
// dist/lib/modules/index.js
|
|
13506
|
-
function apply(e621, client2) {
|
|
13562
|
+
function apply(e621, client2, defaultPostFormat = {}) {
|
|
13563
|
+
const baseE621 = e621;
|
|
13507
13564
|
const modules = {
|
|
13508
|
-
appeals: new Appeals(
|
|
13509
|
-
artistUrls: new ArtistUrls(
|
|
13510
|
-
artistVersions: new ArtistVersions(
|
|
13511
|
-
artists: new Artists(
|
|
13512
|
-
avoidPostingVersions: new AvoidPostingVersions(
|
|
13513
|
-
avoidPostings: new AvoidPostings(
|
|
13514
|
-
bans: new Bans(
|
|
13515
|
-
blips: new Blips(
|
|
13516
|
-
bulkUpdateRequests: new BulkUpdateRequests(
|
|
13517
|
-
commentVotes: new CommentVotes(
|
|
13518
|
-
comments: new Comments(
|
|
13519
|
-
dbExports: new DBExports(
|
|
13520
|
-
dmails: new DMails(
|
|
13521
|
-
dtext: new DText(
|
|
13522
|
-
editHistories: new EditHistories(
|
|
13523
|
-
emailBlacklists: new EmailBlacklists(
|
|
13524
|
-
favorites: new Favorites(e621, client2),
|
|
13525
|
-
forumPosts: new ForumPosts(
|
|
13526
|
-
forumPostVotes: new ForumPostVotes(
|
|
13527
|
-
forumTopics: new ForumTopics(
|
|
13528
|
-
health: new Health(
|
|
13529
|
-
helpPages: new HelpPages(
|
|
13530
|
-
ipBans: new IpBans(
|
|
13531
|
-
iqdb: new IqdbQueries(e621, client2),
|
|
13532
|
-
mascots: new Mascots(
|
|
13533
|
-
modActions: new ModActions(
|
|
13534
|
-
newsUpdates: new NewsUpdates(
|
|
13535
|
-
notes: new Notes(
|
|
13536
|
-
noteVersions: new NoteVersions(
|
|
13537
|
-
pools: new Pools(
|
|
13538
|
-
popular: new Popular(e621, client2),
|
|
13539
|
-
postApprovals: new PostApprovals(
|
|
13540
|
-
postDisapprovals: new PostDisapprovals(
|
|
13541
|
-
postEvents: new PostEvents(
|
|
13542
|
-
postFlags: new PostFlags(
|
|
13543
|
-
postReplacements: new PostReplacements(
|
|
13544
|
-
poolVersions: new PoolVersions(
|
|
13545
|
-
postSets: new PostSets(
|
|
13546
|
-
postVersions: new PostVersions(
|
|
13547
|
-
postVotes: new PostVotes(
|
|
13548
|
-
posts: new Posts(e621, client2),
|
|
13549
|
-
relatedTags: new RelatedTags(
|
|
13550
|
-
searchTrendBlacklists: new SearchTrendBlacklists(
|
|
13551
|
-
searchTrends: new SearchTrends(
|
|
13552
|
-
staffAutomodDMails: new StaffAutomodDMails(
|
|
13553
|
-
staffDmails: new StaffDMails(
|
|
13554
|
-
staffExceptionLogs: new StaffExceptionLogs(
|
|
13555
|
-
staffFiles: new StaffFiles(
|
|
13556
|
-
staffNotes: new StaffNotes(
|
|
13557
|
-
staffUserCleanups: new StaffUserCleanups(
|
|
13558
|
-
staffUsers: new StaffUsers(
|
|
13559
|
-
staffVoteTrends: new StaffVoteTrends(
|
|
13560
|
-
staffWikis: new StaffWikis(
|
|
13561
|
-
staffWikiVersions: new StaffWikiVersions(
|
|
13562
|
-
tagAliases: new TagAliases(
|
|
13563
|
-
tagCorrections: new TagCorrections(
|
|
13564
|
-
tagImplications: new TagImplications(
|
|
13565
|
-
tagTypeVersions: new TagTypeVersions(
|
|
13566
|
-
tags: new Tags(
|
|
13567
|
-
takedowns: new Takedowns(
|
|
13568
|
-
tickets: new Tickets(
|
|
13565
|
+
appeals: new Appeals(baseE621, client2),
|
|
13566
|
+
artistUrls: new ArtistUrls(baseE621, client2),
|
|
13567
|
+
artistVersions: new ArtistVersions(baseE621, client2),
|
|
13568
|
+
artists: new Artists(baseE621, client2),
|
|
13569
|
+
avoidPostingVersions: new AvoidPostingVersions(baseE621, client2),
|
|
13570
|
+
avoidPostings: new AvoidPostings(baseE621, client2),
|
|
13571
|
+
bans: new Bans(baseE621, client2),
|
|
13572
|
+
blips: new Blips(baseE621, client2),
|
|
13573
|
+
bulkUpdateRequests: new BulkUpdateRequests(baseE621, client2),
|
|
13574
|
+
commentVotes: new CommentVotes(baseE621, client2),
|
|
13575
|
+
comments: new Comments(baseE621, client2),
|
|
13576
|
+
dbExports: new DBExports(baseE621, client2),
|
|
13577
|
+
dmails: new DMails(baseE621, client2),
|
|
13578
|
+
dtext: new DText(baseE621, client2),
|
|
13579
|
+
editHistories: new EditHistories(baseE621, client2),
|
|
13580
|
+
emailBlacklists: new EmailBlacklists(baseE621, client2),
|
|
13581
|
+
favorites: new Favorites(e621, client2, defaultPostFormat),
|
|
13582
|
+
forumPosts: new ForumPosts(baseE621, client2),
|
|
13583
|
+
forumPostVotes: new ForumPostVotes(baseE621, client2),
|
|
13584
|
+
forumTopics: new ForumTopics(baseE621, client2),
|
|
13585
|
+
health: new Health(baseE621, client2),
|
|
13586
|
+
helpPages: new HelpPages(baseE621, client2),
|
|
13587
|
+
ipBans: new IpBans(baseE621, client2),
|
|
13588
|
+
iqdb: new IqdbQueries(e621, client2, defaultPostFormat),
|
|
13589
|
+
mascots: new Mascots(baseE621, client2),
|
|
13590
|
+
modActions: new ModActions(baseE621, client2),
|
|
13591
|
+
newsUpdates: new NewsUpdates(baseE621, client2),
|
|
13592
|
+
notes: new Notes(baseE621, client2),
|
|
13593
|
+
noteVersions: new NoteVersions(baseE621, client2),
|
|
13594
|
+
pools: new Pools(baseE621, client2),
|
|
13595
|
+
popular: new Popular(e621, client2, defaultPostFormat),
|
|
13596
|
+
postApprovals: new PostApprovals(baseE621, client2),
|
|
13597
|
+
postDisapprovals: new PostDisapprovals(baseE621, client2),
|
|
13598
|
+
postEvents: new PostEvents(baseE621, client2),
|
|
13599
|
+
postFlags: new PostFlags(baseE621, client2),
|
|
13600
|
+
postReplacements: new PostReplacements(baseE621, client2),
|
|
13601
|
+
poolVersions: new PoolVersions(baseE621, client2),
|
|
13602
|
+
postSets: new PostSets(baseE621, client2),
|
|
13603
|
+
postVersions: new PostVersions(baseE621, client2),
|
|
13604
|
+
postVotes: new PostVotes(baseE621, client2),
|
|
13605
|
+
posts: new Posts(e621, client2, defaultPostFormat),
|
|
13606
|
+
relatedTags: new RelatedTags(baseE621, client2),
|
|
13607
|
+
searchTrendBlacklists: new SearchTrendBlacklists(baseE621, client2),
|
|
13608
|
+
searchTrends: new SearchTrends(baseE621, client2),
|
|
13609
|
+
staffAutomodDMails: new StaffAutomodDMails(baseE621, client2),
|
|
13610
|
+
staffDmails: new StaffDMails(baseE621, client2),
|
|
13611
|
+
staffExceptionLogs: new StaffExceptionLogs(baseE621, client2),
|
|
13612
|
+
staffFiles: new StaffFiles(baseE621, client2),
|
|
13613
|
+
staffNotes: new StaffNotes(baseE621, client2),
|
|
13614
|
+
staffUserCleanups: new StaffUserCleanups(baseE621, client2),
|
|
13615
|
+
staffUsers: new StaffUsers(baseE621, client2),
|
|
13616
|
+
staffVoteTrends: new StaffVoteTrends(baseE621, client2),
|
|
13617
|
+
staffWikis: new StaffWikis(baseE621, client2),
|
|
13618
|
+
staffWikiVersions: new StaffWikiVersions(baseE621, client2),
|
|
13619
|
+
tagAliases: new TagAliases(baseE621, client2),
|
|
13620
|
+
tagCorrections: new TagCorrections(baseE621, client2),
|
|
13621
|
+
tagImplications: new TagImplications(baseE621, client2),
|
|
13622
|
+
tagTypeVersions: new TagTypeVersions(baseE621, client2),
|
|
13623
|
+
tags: new Tags(baseE621, client2),
|
|
13624
|
+
takedowns: new Takedowns(baseE621, client2),
|
|
13625
|
+
tickets: new Tickets(baseE621, client2),
|
|
13569
13626
|
uploads: new Uploads(e621, client2),
|
|
13570
|
-
uploadWhitelists: new UploadWhitelists(
|
|
13571
|
-
users: new Users(
|
|
13572
|
-
userFeedbacks: new UserFeedbacks(
|
|
13573
|
-
userNameChangeRequests: new UserNameChangeRequests(
|
|
13574
|
-
wikiPages: new WikiPages(
|
|
13575
|
-
wikiPageVersions: new WikiPageVersions(
|
|
13627
|
+
uploadWhitelists: new UploadWhitelists(baseE621, client2),
|
|
13628
|
+
users: new Users(baseE621, client2),
|
|
13629
|
+
userFeedbacks: new UserFeedbacks(baseE621, client2),
|
|
13630
|
+
userNameChangeRequests: new UserNameChangeRequests(baseE621, client2),
|
|
13631
|
+
wikiPages: new WikiPages(baseE621, client2),
|
|
13632
|
+
wikiPageVersions: new WikiPageVersions(baseE621, client2)
|
|
13576
13633
|
};
|
|
13577
13634
|
Object.assign(e621, modules);
|
|
13578
13635
|
}
|
|
@@ -14024,15 +14081,22 @@ var FeedbackCategoriesSchema = {
|
|
|
14024
14081
|
]
|
|
14025
14082
|
};
|
|
14026
14083
|
var TagRequestStatusesSchema = {
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
|
|
14035
|
-
|
|
14084
|
+
oneOf: [
|
|
14085
|
+
{
|
|
14086
|
+
type: "string",
|
|
14087
|
+
enum: [
|
|
14088
|
+
"active",
|
|
14089
|
+
"deleted",
|
|
14090
|
+
"processing",
|
|
14091
|
+
"queued",
|
|
14092
|
+
"retired",
|
|
14093
|
+
"pending"
|
|
14094
|
+
]
|
|
14095
|
+
},
|
|
14096
|
+
{
|
|
14097
|
+
type: "string",
|
|
14098
|
+
pattern: "^error: .*$"
|
|
14099
|
+
}
|
|
14036
14100
|
]
|
|
14037
14101
|
};
|
|
14038
14102
|
var WarningTypesSchema = {
|
|
@@ -19209,7 +19273,7 @@ var E621 = class {
|
|
|
19209
19273
|
const { client: client2, options: resolved } = createE621Client(options);
|
|
19210
19274
|
this.client = client2;
|
|
19211
19275
|
this.options = resolved;
|
|
19212
|
-
apply(this, this.client);
|
|
19276
|
+
apply(this, this.client, options?.defaultPostFormat ?? {});
|
|
19213
19277
|
}
|
|
19214
19278
|
};
|
|
19215
19279
|
var index_default = E621;
|