lemmy-js-client 0.19.0-rc.14 → 0.19.0-rc.16
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +16 -21
- package/dist/http.js +13 -25
- package/dist/index.d.ts +4 -9
- package/dist/{types/others.d.ts → other_types.d.ts} +0 -8
- package/dist/types/ActivityId.d.ts +1 -0
- package/dist/types/CommentAggregates.d.ts +0 -1
- package/dist/types/CommentReplyView.d.ts +2 -0
- package/dist/types/CommentView.d.ts +2 -0
- package/dist/types/CommunityAggregates.d.ts +0 -1
- package/dist/types/CustomEmojiKeyword.d.ts +0 -1
- package/dist/types/FederatedInstances.d.ts +4 -4
- package/dist/types/ImageUpload.d.ts +0 -2
- package/dist/types/InstanceWithFederationState.d.ts +11 -0
- package/dist/types/LemmyErrorType.d.ts +6 -0
- package/dist/types/LocalSite.d.ts +1 -0
- package/dist/types/LocalSiteRateLimit.d.ts +0 -1
- package/dist/types/LocalUser.d.ts +1 -0
- package/dist/types/LoginToken.d.ts +0 -1
- package/dist/types/PersonAggregates.d.ts +0 -3
- package/dist/types/PersonMentionView.d.ts +2 -0
- package/dist/types/PersonView.d.ts +1 -0
- package/dist/types/PostAggregates.d.ts +0 -1
- package/dist/types/PostView.d.ts +2 -0
- package/dist/types/ReadableFederationState.d.ts +10 -0
- package/dist/types/ReadableFederationState.js +2 -0
- package/dist/types/SaveUserSettings.d.ts +1 -1
- package/dist/types/SiteAggregates.d.ts +0 -1
- package/package.json +12 -13
- package/dist/types/CommunityBlockId.d.ts +0 -1
- package/dist/types/DeleteAccountResponse.d.ts +0 -1
- package/dist/types/DeleteAccountResponse.js +0 -3
- package/dist/types/DeleteCustomEmojiResponse.d.ts +0 -5
- package/dist/types/ImageUploadId.d.ts +0 -1
- package/dist/types/ImageUploadId.js +0 -3
- package/dist/types/PasswordResetResponse.d.ts +0 -1
- package/dist/types/PasswordResetResponse.js +0 -3
- package/dist/types/PersonSortType.d.ts +0 -1
- package/dist/types/PersonSortType.js +0 -3
- package/dist/types/PurgeItemResponse.d.ts +0 -3
- package/dist/types/PurgeItemResponse.js +0 -3
- package/dist/types/VerifyEmailResponse.d.ts +0 -1
- package/dist/types/VerifyEmailResponse.js +0 -3
- package/dist/utils.d.ts +0 -0
- package/dist/utils.js +0 -0
- /package/dist/{types/others.js → other_types.js} +0 -0
- /package/dist/types/{CommunityBlockId.js → ActivityId.js} +0 -0
- /package/dist/types/{DeleteCustomEmojiResponse.js → InstanceWithFederationState.js} +0 -0
package/dist/http.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import fetch from "cross-fetch";
|
2
1
|
import { AddAdmin } from "./types/AddAdmin";
|
3
2
|
import { AddAdminResponse } from "./types/AddAdminResponse";
|
4
3
|
import { AddModToCommunity } from "./types/AddModToCommunity";
|
@@ -31,11 +30,9 @@ import { CreatePrivateMessageReport } from "./types/CreatePrivateMessageReport";
|
|
31
30
|
import { CreateSite } from "./types/CreateSite";
|
32
31
|
import { CustomEmojiResponse } from "./types/CustomEmojiResponse";
|
33
32
|
import { DeleteAccount } from "./types/DeleteAccount";
|
34
|
-
import { DeleteAccountResponse } from "./types/DeleteAccountResponse";
|
35
33
|
import { DeleteComment } from "./types/DeleteComment";
|
36
34
|
import { DeleteCommunity } from "./types/DeleteCommunity";
|
37
35
|
import { DeleteCustomEmoji } from "./types/DeleteCustomEmoji";
|
38
|
-
import { DeleteCustomEmojiResponse } from "./types/DeleteCustomEmojiResponse";
|
39
36
|
import { DeletePost } from "./types/DeletePost";
|
40
37
|
import { DeletePrivateMessage } from "./types/DeletePrivateMessage";
|
41
38
|
import { DistinguishComment } from "./types/DistinguishComment";
|
@@ -93,7 +90,6 @@ import { MarkPostAsRead } from "./types/MarkPostAsRead";
|
|
93
90
|
import { MarkPrivateMessageAsRead } from "./types/MarkPrivateMessageAsRead";
|
94
91
|
import { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
|
95
92
|
import { PasswordReset } from "./types/PasswordReset";
|
96
|
-
import { PasswordResetResponse } from "./types/PasswordResetResponse";
|
97
93
|
import { PersonMentionResponse } from "./types/PersonMentionResponse";
|
98
94
|
import { PostReportResponse } from "./types/PostReportResponse";
|
99
95
|
import { PostResponse } from "./types/PostResponse";
|
@@ -102,7 +98,6 @@ import { PrivateMessageResponse } from "./types/PrivateMessageResponse";
|
|
102
98
|
import { PrivateMessagesResponse } from "./types/PrivateMessagesResponse";
|
103
99
|
import { PurgeComment } from "./types/PurgeComment";
|
104
100
|
import { PurgeCommunity } from "./types/PurgeCommunity";
|
105
|
-
import { PurgeItemResponse } from "./types/PurgeItemResponse";
|
106
101
|
import { PurgePerson } from "./types/PurgePerson";
|
107
102
|
import { PurgePost } from "./types/PurgePost";
|
108
103
|
import { Register } from "./types/Register";
|
@@ -123,8 +118,7 @@ import { SearchResponse } from "./types/SearchResponse";
|
|
123
118
|
import { SiteResponse } from "./types/SiteResponse";
|
124
119
|
import { TransferCommunity } from "./types/TransferCommunity";
|
125
120
|
import { VerifyEmail } from "./types/VerifyEmail";
|
126
|
-
import {
|
127
|
-
import { DeleteImage, UploadImage, UploadImageResponse } from "./types/others";
|
121
|
+
import { DeleteImage, UploadImage, UploadImageResponse } from "./other_types";
|
128
122
|
import { HideCommunity } from "./types/HideCommunity";
|
129
123
|
import { BlockInstance } from "./types/BlockInstance";
|
130
124
|
import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
|
@@ -281,7 +275,7 @@ export declare class LemmyHttp {
|
|
281
275
|
*
|
282
276
|
* `HTTP.PUT /community/hide`
|
283
277
|
*/
|
284
|
-
hideCommunity(form: HideCommunity): Promise<
|
278
|
+
hideCommunity(form: HideCommunity): Promise<SuccessResponse>;
|
285
279
|
/**
|
286
280
|
* A moderator remove for a community.
|
287
281
|
*
|
@@ -341,7 +335,7 @@ export declare class LemmyHttp {
|
|
341
335
|
*
|
342
336
|
* `HTTP.POST /post/mark_as_read`
|
343
337
|
*/
|
344
|
-
markPostAsRead(form: MarkPostAsRead): Promise<
|
338
|
+
markPostAsRead(form: MarkPostAsRead): Promise<SuccessResponse>;
|
345
339
|
/**
|
346
340
|
* A moderator can lock a post ( IE disable new comments ).
|
347
341
|
*
|
@@ -534,6 +528,7 @@ export declare class LemmyHttp {
|
|
534
528
|
* `HTTP.POST /user/login`
|
535
529
|
*/
|
536
530
|
login(form: Login): Promise<LoginResponse>;
|
531
|
+
logout(): Promise<SuccessResponse>;
|
537
532
|
/**
|
538
533
|
* Get the details for a person.
|
539
534
|
*
|
@@ -587,19 +582,19 @@ export declare class LemmyHttp {
|
|
587
582
|
*
|
588
583
|
* `HTTP.POST /user/delete_account`
|
589
584
|
*/
|
590
|
-
deleteAccount(form: DeleteAccount): Promise<
|
585
|
+
deleteAccount(form: DeleteAccount): Promise<SuccessResponse>;
|
591
586
|
/**
|
592
587
|
* Reset your password.
|
593
588
|
*
|
594
589
|
* `HTTP.POST /user/password_reset`
|
595
590
|
*/
|
596
|
-
passwordReset(form: PasswordReset): Promise<
|
591
|
+
passwordReset(form: PasswordReset): Promise<SuccessResponse>;
|
597
592
|
/**
|
598
593
|
* Change your password from an email / token based reset.
|
599
594
|
*
|
600
595
|
* `HTTP.POST /user/password_change`
|
601
596
|
*/
|
602
|
-
passwordChangeAfterReset(form: PasswordChangeAfterReset): Promise<
|
597
|
+
passwordChangeAfterReset(form: PasswordChangeAfterReset): Promise<SuccessResponse>;
|
603
598
|
/**
|
604
599
|
* Mark all replies as read.
|
605
600
|
*
|
@@ -611,7 +606,7 @@ export declare class LemmyHttp {
|
|
611
606
|
*
|
612
607
|
* `HTTP.PUT /user/save_user_settings`
|
613
608
|
*/
|
614
|
-
saveUserSettings(form: SaveUserSettings): Promise<
|
609
|
+
saveUserSettings(form: SaveUserSettings): Promise<SuccessResponse>;
|
615
610
|
/**
|
616
611
|
* Change your user password.
|
617
612
|
*
|
@@ -635,7 +630,7 @@ export declare class LemmyHttp {
|
|
635
630
|
*
|
636
631
|
* `HTTP.POST /user/verify_email`
|
637
632
|
*/
|
638
|
-
verifyEmail(form: VerifyEmail): Promise<
|
633
|
+
verifyEmail(form: VerifyEmail): Promise<SuccessResponse>;
|
639
634
|
/**
|
640
635
|
* Add an admin to your site.
|
641
636
|
*
|
@@ -665,25 +660,25 @@ export declare class LemmyHttp {
|
|
665
660
|
*
|
666
661
|
* `HTTP.POST /admin/purge/person`
|
667
662
|
*/
|
668
|
-
purgePerson(form: PurgePerson): Promise<
|
663
|
+
purgePerson(form: PurgePerson): Promise<SuccessResponse>;
|
669
664
|
/**
|
670
665
|
* Purge / Delete a community from the database.
|
671
666
|
*
|
672
667
|
* `HTTP.POST /admin/purge/community`
|
673
668
|
*/
|
674
|
-
purgeCommunity(form: PurgeCommunity): Promise<
|
669
|
+
purgeCommunity(form: PurgeCommunity): Promise<SuccessResponse>;
|
675
670
|
/**
|
676
671
|
* Purge / Delete a post from the database.
|
677
672
|
*
|
678
673
|
* `HTTP.POST /admin/purge/post`
|
679
674
|
*/
|
680
|
-
purgePost(form: PurgePost): Promise<
|
675
|
+
purgePost(form: PurgePost): Promise<SuccessResponse>;
|
681
676
|
/**
|
682
677
|
* Purge / Delete a comment from the database.
|
683
678
|
*
|
684
679
|
* `HTTP.POST /admin/purge/comment`
|
685
680
|
*/
|
686
|
-
purgeComment(form: PurgeComment): Promise<
|
681
|
+
purgeComment(form: PurgeComment): Promise<SuccessResponse>;
|
687
682
|
/**
|
688
683
|
* Create a new custom emoji
|
689
684
|
*
|
@@ -701,7 +696,7 @@ export declare class LemmyHttp {
|
|
701
696
|
*
|
702
697
|
* `HTTP.Post /custom_emoji/delete`
|
703
698
|
*/
|
704
|
-
deleteCustomEmoji(form: DeleteCustomEmoji): Promise<
|
699
|
+
deleteCustomEmoji(form: DeleteCustomEmoji): Promise<SuccessResponse>;
|
705
700
|
/**
|
706
701
|
* Fetch federated instances.
|
707
702
|
*
|
@@ -717,11 +712,11 @@ export declare class LemmyHttp {
|
|
717
712
|
/**
|
718
713
|
* Upload an image to the server.
|
719
714
|
*/
|
720
|
-
uploadImage({ image
|
715
|
+
uploadImage({ image }: UploadImage): Promise<UploadImageResponse>;
|
721
716
|
/**
|
722
717
|
* Delete a pictrs image
|
723
718
|
*/
|
724
|
-
deleteImage({ token, filename
|
719
|
+
deleteImage({ token, filename }: DeleteImage): Promise<boolean>;
|
725
720
|
/**
|
726
721
|
* Set the headers (can be used to set the auth header)
|
727
722
|
*/
|
package/dist/http.js
CHANGED
@@ -25,9 +25,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
25
|
var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers, _LemmyHttp_pictrsUrl, _LemmyHttp_fetchFunction, _LemmyHttp_buildFullUrl, _LemmyHttp_wrapper;
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
27
27
|
exports.LemmyHttp = void 0;
|
28
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
29
28
|
const form_data_1 = __importDefault(require("form-data"));
|
30
|
-
const
|
29
|
+
const other_types_1 = require("./other_types");
|
31
30
|
var HttpType;
|
32
31
|
(function (HttpType) {
|
33
32
|
HttpType["Get"] = "GET";
|
@@ -48,8 +47,8 @@ class LemmyHttp {
|
|
48
47
|
_LemmyHttp_apiUrl.set(this, void 0);
|
49
48
|
_LemmyHttp_headers.set(this, {});
|
50
49
|
_LemmyHttp_pictrsUrl.set(this, void 0);
|
51
|
-
_LemmyHttp_fetchFunction.set(this,
|
52
|
-
__classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${
|
50
|
+
_LemmyHttp_fetchFunction.set(this, fetch);
|
51
|
+
__classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${other_types_1.VERSION}`, "f");
|
53
52
|
__classPrivateFieldSet(this, _LemmyHttp_pictrsUrl, `${baseUrl}/pictrs/image`, "f");
|
54
53
|
if (options === null || options === void 0 ? void 0 : options.headers) {
|
55
54
|
__classPrivateFieldSet(this, _LemmyHttp_headers, options.headers, "f");
|
@@ -569,6 +568,9 @@ class LemmyHttp {
|
|
569
568
|
login(form) {
|
570
569
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/login", form);
|
571
570
|
}
|
571
|
+
logout() {
|
572
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/logout", {});
|
573
|
+
}
|
572
574
|
/**
|
573
575
|
* Get the details for a person.
|
574
576
|
*
|
@@ -812,22 +814,15 @@ class LemmyHttp {
|
|
812
814
|
/**
|
813
815
|
* Upload an image to the server.
|
814
816
|
*/
|
815
|
-
uploadImage({ image
|
816
|
-
var _a, _b, _c, _d;
|
817
|
+
uploadImage({ image }) {
|
817
818
|
return __awaiter(this, void 0, void 0, function* () {
|
818
819
|
const formData = createFormData(image);
|
819
|
-
// If auth cookie not already set by browser, set it with passed in auth
|
820
|
-
const headers = {};
|
821
|
-
if (!((_b = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.cookie) === null || _b === void 0 ? void 0 : _b.includes("auth=")) &&
|
822
|
-
!((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
|
823
|
-
headers.Cookie = `auth=${auth}`;
|
824
|
-
}
|
825
820
|
let url = undefined;
|
826
821
|
let delete_url = undefined;
|
827
822
|
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f"), {
|
828
823
|
method: HttpType.Post,
|
829
824
|
body: formData,
|
830
|
-
headers:
|
825
|
+
headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
|
831
826
|
});
|
832
827
|
if (response.status === 413) {
|
833
828
|
return { msg: "too_large" };
|
@@ -845,21 +840,14 @@ class LemmyHttp {
|
|
845
840
|
/**
|
846
841
|
* Delete a pictrs image
|
847
842
|
*/
|
848
|
-
deleteImage({ token, filename
|
849
|
-
var _a, _b, _c, _d;
|
843
|
+
deleteImage({ token, filename }) {
|
850
844
|
return __awaiter(this, void 0, void 0, function* () {
|
851
|
-
// If auth cookie not already set by browser, set it with passed in auth
|
852
|
-
const headers = {};
|
853
|
-
if (!((_b = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.cookie) === null || _b === void 0 ? void 0 : _b.includes("auth=")) &&
|
854
|
-
!((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
|
855
|
-
headers.Cookie = `auth=${auth}`;
|
856
|
-
}
|
857
845
|
const deleteUrl = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${token}/${filename}`;
|
858
846
|
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, deleteUrl, {
|
859
847
|
method: HttpType.Get,
|
860
|
-
headers:
|
848
|
+
headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
|
861
849
|
});
|
862
|
-
return
|
850
|
+
return response.status == 204;
|
863
851
|
});
|
864
852
|
}
|
865
853
|
/**
|
@@ -895,10 +883,10 @@ _LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHtt
|
|
895
883
|
json = yield response.json();
|
896
884
|
}
|
897
885
|
catch (error) {
|
898
|
-
throw response.statusText;
|
886
|
+
throw new Error(response.statusText);
|
899
887
|
}
|
900
888
|
if (!response.ok) {
|
901
|
-
throw (_a = json["error"]) !== null && _a !== void 0 ? _a : response.statusText;
|
889
|
+
throw new Error((_a = json["error"]) !== null && _a !== void 0 ? _a : response.statusText);
|
902
890
|
}
|
903
891
|
else {
|
904
892
|
return json;
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export * from "./http";
|
2
|
+
export { ActivityId } from "./types/ActivityId";
|
2
3
|
export { AddAdmin } from "./types/AddAdmin";
|
3
4
|
export { AddAdminResponse } from "./types/AddAdminResponse";
|
4
5
|
export { AddModToCommunity } from "./types/AddModToCommunity";
|
@@ -41,7 +42,6 @@ export { CommentSortType } from "./types/CommentSortType";
|
|
41
42
|
export { CommentView } from "./types/CommentView";
|
42
43
|
export { Community } from "./types/Community";
|
43
44
|
export { CommunityAggregates } from "./types/CommunityAggregates";
|
44
|
-
export { CommunityBlockId } from "./types/CommunityBlockId";
|
45
45
|
export { CommunityBlockView } from "./types/CommunityBlockView";
|
46
46
|
export { CommunityFollowerView } from "./types/CommunityFollowerView";
|
47
47
|
export { CommunityId } from "./types/CommunityId";
|
@@ -65,11 +65,9 @@ export { CustomEmojiKeyword } from "./types/CustomEmojiKeyword";
|
|
65
65
|
export { CustomEmojiResponse } from "./types/CustomEmojiResponse";
|
66
66
|
export { CustomEmojiView } from "./types/CustomEmojiView";
|
67
67
|
export { DeleteAccount } from "./types/DeleteAccount";
|
68
|
-
export { DeleteAccountResponse } from "./types/DeleteAccountResponse";
|
69
68
|
export { DeleteComment } from "./types/DeleteComment";
|
70
69
|
export { DeleteCommunity } from "./types/DeleteCommunity";
|
71
70
|
export { DeleteCustomEmoji } from "./types/DeleteCustomEmoji";
|
72
|
-
export { DeleteCustomEmojiResponse } from "./types/DeleteCustomEmojiResponse";
|
73
71
|
export { DeletePost } from "./types/DeletePost";
|
74
72
|
export { DeletePrivateMessage } from "./types/DeletePrivateMessage";
|
75
73
|
export { DistinguishComment } from "./types/DistinguishComment";
|
@@ -112,10 +110,10 @@ export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
|
|
112
110
|
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
113
111
|
export { HideCommunity } from "./types/HideCommunity";
|
114
112
|
export { ImageUpload } from "./types/ImageUpload";
|
115
|
-
export { ImageUploadId } from "./types/ImageUploadId";
|
116
113
|
export { Instance } from "./types/Instance";
|
117
114
|
export { InstanceBlockView } from "./types/InstanceBlockView";
|
118
115
|
export { InstanceId } from "./types/InstanceId";
|
116
|
+
export { InstanceWithFederationState } from "./types/InstanceWithFederationState";
|
119
117
|
export { Language } from "./types/Language";
|
120
118
|
export { LanguageId } from "./types/LanguageId";
|
121
119
|
export { LemmyErrorType } from "./types/LemmyErrorType";
|
@@ -172,7 +170,6 @@ export { MyUserInfo } from "./types/MyUserInfo";
|
|
172
170
|
export { PaginationCursor } from "./types/PaginationCursor";
|
173
171
|
export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
|
174
172
|
export { PasswordReset } from "./types/PasswordReset";
|
175
|
-
export { PasswordResetResponse } from "./types/PasswordResetResponse";
|
176
173
|
export { Person } from "./types/Person";
|
177
174
|
export { PersonAggregates } from "./types/PersonAggregates";
|
178
175
|
export { PersonBlockId } from "./types/PersonBlockId";
|
@@ -182,7 +179,6 @@ export { PersonMention } from "./types/PersonMention";
|
|
182
179
|
export { PersonMentionId } from "./types/PersonMentionId";
|
183
180
|
export { PersonMentionResponse } from "./types/PersonMentionResponse";
|
184
181
|
export { PersonMentionView } from "./types/PersonMentionView";
|
185
|
-
export { PersonSortType } from "./types/PersonSortType";
|
186
182
|
export { PersonView } from "./types/PersonView";
|
187
183
|
export { Post } from "./types/Post";
|
188
184
|
export { PostAggregates } from "./types/PostAggregates";
|
@@ -206,9 +202,9 @@ export { PrivateMessageView } from "./types/PrivateMessageView";
|
|
206
202
|
export { PrivateMessagesResponse } from "./types/PrivateMessagesResponse";
|
207
203
|
export { PurgeComment } from "./types/PurgeComment";
|
208
204
|
export { PurgeCommunity } from "./types/PurgeCommunity";
|
209
|
-
export { PurgeItemResponse } from "./types/PurgeItemResponse";
|
210
205
|
export { PurgePerson } from "./types/PurgePerson";
|
211
206
|
export { PurgePost } from "./types/PurgePost";
|
207
|
+
export { ReadableFederationState } from "./types/ReadableFederationState";
|
212
208
|
export { Register } from "./types/Register";
|
213
209
|
export { RegistrationApplication } from "./types/RegistrationApplication";
|
214
210
|
export { RegistrationApplicationResponse } from "./types/RegistrationApplicationResponse";
|
@@ -242,5 +238,4 @@ export { TransferCommunity } from "./types/TransferCommunity";
|
|
242
238
|
export { UpdateTotp } from "./types/UpdateTotp";
|
243
239
|
export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
|
244
240
|
export { VerifyEmail } from "./types/VerifyEmail";
|
245
|
-
export {
|
246
|
-
export { UploadImage, UploadImageResponse, ImageFile, DeleteImage, } from "./types/others";
|
241
|
+
export { UploadImage, UploadImageResponse, ImageFile, DeleteImage, } from "./other_types";
|
@@ -2,10 +2,6 @@
|
|
2
2
|
export declare const VERSION = "v3";
|
3
3
|
export interface UploadImage {
|
4
4
|
image: File | Buffer;
|
5
|
-
/**
|
6
|
-
* Optional if cookie with jwt set is already present. Otherwise, auth is required.
|
7
|
-
*/
|
8
|
-
auth?: string;
|
9
5
|
}
|
10
6
|
export interface UploadImageResponse {
|
11
7
|
/**
|
@@ -23,8 +19,4 @@ export interface ImageFile {
|
|
23
19
|
export interface DeleteImage {
|
24
20
|
token: string;
|
25
21
|
filename: string;
|
26
|
-
/**
|
27
|
-
* Optional if cookie with jwt set is already present. Otherwise, auth is required.
|
28
|
-
*/
|
29
|
-
auth?: string;
|
30
22
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type ActivityId = number;
|
@@ -14,6 +14,8 @@ export interface CommentReplyView {
|
|
14
14
|
recipient: Person;
|
15
15
|
counts: CommentAggregates;
|
16
16
|
creator_banned_from_community: boolean;
|
17
|
+
creator_is_moderator: boolean;
|
18
|
+
creator_is_admin: boolean;
|
17
19
|
subscribed: SubscribedType;
|
18
20
|
saved: boolean;
|
19
21
|
creator_blocked: boolean;
|
@@ -11,6 +11,8 @@ export interface CommentView {
|
|
11
11
|
community: Community;
|
12
12
|
counts: CommentAggregates;
|
13
13
|
creator_banned_from_community: boolean;
|
14
|
+
creator_is_moderator: boolean;
|
15
|
+
creator_is_admin: boolean;
|
14
16
|
subscribed: SubscribedType;
|
15
17
|
saved: boolean;
|
16
18
|
creator_blocked: boolean;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type {
|
1
|
+
import type { InstanceWithFederationState } from "./InstanceWithFederationState";
|
2
2
|
export interface FederatedInstances {
|
3
|
-
linked: Array<
|
4
|
-
allowed: Array<
|
5
|
-
blocked: Array<
|
3
|
+
linked: Array<InstanceWithFederationState>;
|
4
|
+
allowed: Array<InstanceWithFederationState>;
|
5
|
+
blocked: Array<InstanceWithFederationState>;
|
6
6
|
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { InstanceId } from "./InstanceId";
|
2
|
+
import type { ReadableFederationState } from "./ReadableFederationState";
|
3
|
+
export interface InstanceWithFederationState {
|
4
|
+
id: InstanceId;
|
5
|
+
domain: string;
|
6
|
+
published: string;
|
7
|
+
updated?: string;
|
8
|
+
software?: string;
|
9
|
+
version?: string;
|
10
|
+
federation_state?: ReadableFederationState;
|
11
|
+
}
|
@@ -68,6 +68,10 @@ export type LemmyErrorType = {
|
|
68
68
|
error: "couldnt_find_person";
|
69
69
|
} | {
|
70
70
|
error: "person_is_blocked";
|
71
|
+
} | {
|
72
|
+
error: "community_is_blocked";
|
73
|
+
} | {
|
74
|
+
error: "instance_is_blocked";
|
71
75
|
} | {
|
72
76
|
error: "downvotes_are_disabled";
|
73
77
|
} | {
|
@@ -298,6 +302,8 @@ export type LemmyErrorType = {
|
|
298
302
|
error: "ban_expiration_in_past";
|
299
303
|
} | {
|
300
304
|
error: "invalid_unix_time";
|
305
|
+
} | {
|
306
|
+
error: "invalid_bot_action";
|
301
307
|
} | {
|
302
308
|
error: "unknown";
|
303
309
|
message: string;
|
@@ -14,6 +14,8 @@ export interface PersonMentionView {
|
|
14
14
|
recipient: Person;
|
15
15
|
counts: CommentAggregates;
|
16
16
|
creator_banned_from_community: boolean;
|
17
|
+
creator_is_moderator: boolean;
|
18
|
+
creator_is_admin: boolean;
|
17
19
|
subscribed: SubscribedType;
|
18
20
|
saved: boolean;
|
19
21
|
creator_blocked: boolean;
|
package/dist/types/PostView.d.ts
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { ActivityId } from "./ActivityId";
|
2
|
+
import type { InstanceId } from "./InstanceId";
|
3
|
+
export interface ReadableFederationState {
|
4
|
+
instance_id: InstanceId;
|
5
|
+
last_successful_id?: ActivityId;
|
6
|
+
last_successful_published_time?: string;
|
7
|
+
fail_count: number;
|
8
|
+
last_retry?: string;
|
9
|
+
next_retry?: string;
|
10
|
+
}
|
@@ -22,11 +22,11 @@ export interface SaveUserSettings {
|
|
22
22
|
bot_account?: boolean;
|
23
23
|
show_bot_accounts?: boolean;
|
24
24
|
show_read_posts?: boolean;
|
25
|
-
show_new_post_notifs?: boolean;
|
26
25
|
discussion_languages?: Array<LanguageId>;
|
27
26
|
open_links_in_new_tab?: boolean;
|
28
27
|
infinite_scroll_enabled?: boolean;
|
29
28
|
post_listing_mode?: PostListingMode;
|
30
29
|
enable_keyboard_navigation?: boolean;
|
31
30
|
enable_animated_images?: boolean;
|
31
|
+
collapse_bot_comments?: boolean;
|
32
32
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "lemmy-js-client",
|
3
|
-
"version": "0.19.0-rc.
|
3
|
+
"version": "0.19.0-rc.16",
|
4
4
|
"description": "A javascript / typescript client for Lemmy",
|
5
5
|
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
6
6
|
"license": "AGPL-3.0",
|
@@ -26,24 +26,23 @@
|
|
26
26
|
]
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"cross-fetch": "^3.1.5",
|
30
29
|
"form-data": "^4.0.0"
|
31
30
|
},
|
32
31
|
"devDependencies": {
|
33
|
-
"@types/node": "^20.
|
34
|
-
"@typescript-eslint/eslint-plugin": "^
|
35
|
-
"@typescript-eslint/parser": "^
|
36
|
-
"eslint": "^8.
|
37
|
-
"eslint-plugin-prettier": "^
|
32
|
+
"@types/node": "^20.10.0",
|
33
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
34
|
+
"@typescript-eslint/parser": "^6.13.1",
|
35
|
+
"eslint": "^8.54.0",
|
36
|
+
"eslint-plugin-prettier": "^5.0.1",
|
38
37
|
"husky": "^8.0.3",
|
39
|
-
"lint-staged": "^
|
40
|
-
"prettier": "^3.
|
38
|
+
"lint-staged": "^15.1.0",
|
39
|
+
"prettier": "^3.1.0",
|
41
40
|
"prettier-plugin-import-sort": "^0.0.7",
|
42
|
-
"prettier-plugin-organize-imports": "^3.2.
|
43
|
-
"prettier-plugin-packagejson": "^2.4.
|
44
|
-
"sortpack": "^2.3.
|
41
|
+
"prettier-plugin-organize-imports": "^3.2.4",
|
42
|
+
"prettier-plugin-packagejson": "^2.4.6",
|
43
|
+
"sortpack": "^2.3.5",
|
45
44
|
"typedoc": "^0.24.7",
|
46
|
-
"typescript": "^5.
|
45
|
+
"typescript": "^5.3.2"
|
47
46
|
},
|
48
47
|
"importSort": {
|
49
48
|
".js, .jsx, .ts, .tsx": {
|
@@ -1 +0,0 @@
|
|
1
|
-
export type CommunityBlockId = number;
|
@@ -1 +0,0 @@
|
|
1
|
-
export type DeleteAccountResponse = Record<string, never>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export type ImageUploadId = number;
|
@@ -1 +0,0 @@
|
|
1
|
-
export type PasswordResetResponse = Record<string, never>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export type PersonSortType = "New" | "Old" | "MostComments" | "CommentScore" | "PostScore" | "PostCount";
|
@@ -1 +0,0 @@
|
|
1
|
-
export type VerifyEmailResponse = Record<string, never>;
|
package/dist/utils.d.ts
DELETED
File without changes
|
package/dist/utils.js
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|