lemmy-js-client 0.19.0-alpha.15 → 0.19.0-alpha.17
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/http.d.ts +2 -2
- package/dist/http.js +4 -18
- package/dist/index.d.ts +3 -2
- package/dist/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 +1 -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/InstanceWithFederationState.js +2 -0
- package/dist/types/LemmyErrorType.d.ts +4 -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 -1
- package/dist/types/PersonMentionView.d.ts +1 -0
- package/dist/types/PostAggregates.d.ts +0 -1
- package/dist/types/ReadableFederationState.d.ts +10 -0
- package/dist/types/ReadableFederationState.js +2 -0
- package/dist/types/SaveUserSettings.d.ts +1 -0
- package/dist/types/SiteAggregates.d.ts +0 -1
- package/package.json +1 -1
- package/dist/types/CommunityBlockId.d.ts +0 -1
- package/dist/types/ImageUploadId.d.ts +0 -1
- package/dist/types/ImageUploadId.js +0 -3
- /package/dist/types/{CommunityBlockId.js → ActivityId.js} +0 -0
package/dist/http.d.ts
CHANGED
@@ -713,11 +713,11 @@ export declare class LemmyHttp {
|
|
713
713
|
/**
|
714
714
|
* Upload an image to the server.
|
715
715
|
*/
|
716
|
-
uploadImage({ image
|
716
|
+
uploadImage({ image }: UploadImage): Promise<UploadImageResponse>;
|
717
717
|
/**
|
718
718
|
* Delete a pictrs image
|
719
719
|
*/
|
720
|
-
deleteImage({ token, filename
|
720
|
+
deleteImage({ token, filename }: DeleteImage): Promise<any>;
|
721
721
|
/**
|
722
722
|
* Set the headers (can be used to set the auth header)
|
723
723
|
*/
|
package/dist/http.js
CHANGED
@@ -815,22 +815,15 @@ class LemmyHttp {
|
|
815
815
|
/**
|
816
816
|
* Upload an image to the server.
|
817
817
|
*/
|
818
|
-
uploadImage({ image
|
819
|
-
var _a, _b, _c, _d;
|
818
|
+
uploadImage({ image }) {
|
820
819
|
return __awaiter(this, void 0, void 0, function* () {
|
821
820
|
const formData = createFormData(image);
|
822
|
-
// If auth cookie not already set by browser, set it with passed in auth
|
823
|
-
const headers = {};
|
824
|
-
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=")) &&
|
825
|
-
!((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
|
826
|
-
headers.Cookie = `auth=${auth}`;
|
827
|
-
}
|
828
821
|
let url = undefined;
|
829
822
|
let delete_url = undefined;
|
830
823
|
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f"), {
|
831
824
|
method: HttpType.Post,
|
832
825
|
body: formData,
|
833
|
-
headers:
|
826
|
+
headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
|
834
827
|
});
|
835
828
|
if (response.status === 413) {
|
836
829
|
return { msg: "too_large" };
|
@@ -848,19 +841,12 @@ class LemmyHttp {
|
|
848
841
|
/**
|
849
842
|
* Delete a pictrs image
|
850
843
|
*/
|
851
|
-
deleteImage({ token, filename
|
852
|
-
var _a, _b, _c, _d;
|
844
|
+
deleteImage({ token, filename }) {
|
853
845
|
return __awaiter(this, void 0, void 0, function* () {
|
854
|
-
// If auth cookie not already set by browser, set it with passed in auth
|
855
|
-
const headers = {};
|
856
|
-
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=")) &&
|
857
|
-
!((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
|
858
|
-
headers.Cookie = `auth=${auth}`;
|
859
|
-
}
|
860
846
|
const deleteUrl = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${token}/${filename}`;
|
861
847
|
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, deleteUrl, {
|
862
848
|
method: HttpType.Get,
|
863
|
-
headers:
|
849
|
+
headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
|
864
850
|
});
|
865
851
|
return yield response.json();
|
866
852
|
});
|
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";
|
@@ -110,10 +110,10 @@ export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
|
|
110
110
|
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
111
111
|
export { HideCommunity } from "./types/HideCommunity";
|
112
112
|
export { ImageUpload } from "./types/ImageUpload";
|
113
|
-
export { ImageUploadId } from "./types/ImageUploadId";
|
114
113
|
export { Instance } from "./types/Instance";
|
115
114
|
export { InstanceBlockView } from "./types/InstanceBlockView";
|
116
115
|
export { InstanceId } from "./types/InstanceId";
|
116
|
+
export { InstanceWithFederationState } from "./types/InstanceWithFederationState";
|
117
117
|
export { Language } from "./types/Language";
|
118
118
|
export { LanguageId } from "./types/LanguageId";
|
119
119
|
export { LemmyErrorType } from "./types/LemmyErrorType";
|
@@ -204,6 +204,7 @@ export { PurgeComment } from "./types/PurgeComment";
|
|
204
204
|
export { PurgeCommunity } from "./types/PurgeCommunity";
|
205
205
|
export { PurgePerson } from "./types/PurgePerson";
|
206
206
|
export { PurgePost } from "./types/PurgePost";
|
207
|
+
export { ReadableFederationState } from "./types/ReadableFederationState";
|
207
208
|
export { Register } from "./types/Register";
|
208
209
|
export { RegistrationApplication } from "./types/RegistrationApplication";
|
209
210
|
export { RegistrationApplicationResponse } from "./types/RegistrationApplicationResponse";
|
package/dist/other_types.d.ts
CHANGED
@@ -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;
|
@@ -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
|
+
}
|
@@ -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
|
+
}
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export type CommunityBlockId = number;
|
@@ -1 +0,0 @@
|
|
1
|
-
export type ImageUploadId = number;
|
File without changes
|