lemmy-js-client 0.19.4-alpha.10 → 0.19.4-alpha.11

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 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";
@@ -133,8 +132,6 @@ import { ListPostLikesResponse } from "./types/ListPostLikesResponse";
133
132
  import { ListCommentLikes } from "./types/ListCommentLikes";
134
133
  import { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
135
134
  import { HidePost } from "./types/HidePost";
136
- import { ListMedia } from "./types/ListMedia";
137
- import { ListMediaResponse } from "./types/ListMediaResponse";
138
135
  /**
139
136
  * Helps build lemmy HTTP requests.
140
137
  */
@@ -208,18 +205,6 @@ export declare class LemmyHttp {
208
205
  * `HTTP.GET /user/validate_auth`
209
206
  */
210
207
  validateAuth(): Promise<SuccessResponse>;
211
- /**
212
- * List all the media for your user
213
- *
214
- * `HTTP.GET /user/list_media`
215
- */
216
- listMedia(form?: ListMedia): Promise<ListMediaResponse>;
217
- /**
218
- * List all the media known to your instance.
219
- *
220
- * `HTTP.GET /admin/list_all_media`
221
- */
222
- listAllMedia(form?: ListMedia): Promise<ListMediaResponse>;
223
208
  /**
224
209
  * Enable / Disable TOTP / two-factor authentication.
225
210
  *
package/dist/http.js CHANGED
@@ -19,14 +19,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
19
19
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
20
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
21
  };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
22
  var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers, _LemmyHttp_pictrsUrl, _LemmyHttp_fetchFunction, _LemmyHttp_buildFullUrl, _LemmyHttp_wrapper;
26
23
  Object.defineProperty(exports, "__esModule", { value: true });
27
24
  exports.LemmyHttp = void 0;
28
- const cross_fetch_1 = __importDefault(require("cross-fetch"));
29
- const form_data_1 = __importDefault(require("form-data"));
30
25
  const other_types_1 = require("./other_types");
31
26
  var HttpType;
32
27
  (function (HttpType) {
@@ -48,7 +43,7 @@ class LemmyHttp {
48
43
  _LemmyHttp_apiUrl.set(this, void 0);
49
44
  _LemmyHttp_headers.set(this, {});
50
45
  _LemmyHttp_pictrsUrl.set(this, void 0);
51
- _LemmyHttp_fetchFunction.set(this, cross_fetch_1.default);
46
+ _LemmyHttp_fetchFunction.set(this, fetch.bind(globalThis));
52
47
  __classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${other_types_1.VERSION}`, "f");
53
48
  __classPrivateFieldSet(this, _LemmyHttp_pictrsUrl, `${baseUrl}/pictrs/image`, "f");
54
49
  if (options === null || options === void 0 ? void 0 : options.headers) {
@@ -133,22 +128,6 @@ class LemmyHttp {
133
128
  validateAuth() {
134
129
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/validate_auth", {});
135
130
  }
136
- /**
137
- * List all the media for your user
138
- *
139
- * `HTTP.GET /user/list_media`
140
- */
141
- listMedia(form = {}) {
142
- return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/list_media", form);
143
- }
144
- /**
145
- * List all the media known to your instance.
146
- *
147
- * `HTTP.GET /admin/list_all_media`
148
- */
149
- listAllMedia(form = {}) {
150
- return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/admin/list_all_media", form);
151
- }
152
131
  /**
153
132
  * Enable / Disable TOTP / two-factor authentication.
154
133
  *
@@ -941,13 +920,13 @@ function encodeGetParams(p) {
941
920
  .join("&");
942
921
  }
943
922
  function createFormData(image) {
944
- let formData = new form_data_1.default();
945
- if (image.constructor.name === "File") {
923
+ let formData = new FormData();
924
+ if (image instanceof File) {
946
925
  formData.append("images[]", image);
947
926
  }
948
927
  else {
949
928
  // The filename doesn't affect the file type or file name that ends up in pictrs
950
- formData.append("images[]", image, { filename: "image.jpg" });
929
+ formData.append("images[]", new Blob([image], { type: "image/jpeg" }), "image.jpg");
951
930
  }
952
931
  return formData;
953
932
  }
package/dist/index.d.ts CHANGED
@@ -125,8 +125,6 @@ export { ListCommentReports } from "./types/ListCommentReports";
125
125
  export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
126
126
  export { ListCommunities } from "./types/ListCommunities";
127
127
  export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse";
128
- export { ListMedia } from "./types/ListMedia";
129
- export { ListMediaResponse } from "./types/ListMediaResponse";
130
128
  export { ListPostLikes } from "./types/ListPostLikes";
131
129
  export { ListPostLikesResponse } from "./types/ListPostLikesResponse";
132
130
  export { ListPostReports } from "./types/ListPostReports";
@@ -136,7 +134,6 @@ export { ListPrivateMessageReportsResponse } from "./types/ListPrivateMessageRep
136
134
  export { ListRegistrationApplications } from "./types/ListRegistrationApplications";
137
135
  export { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse";
138
136
  export { ListingType } from "./types/ListingType";
139
- export { LocalImage } from "./types/LocalImage";
140
137
  export { LocalSite } from "./types/LocalSite";
141
138
  export { LocalSiteId } from "./types/LocalSiteId";
142
139
  export { LocalSiteRateLimit } from "./types/LocalSiteRateLimit";
@@ -11,6 +11,7 @@ export interface CommentView {
11
11
  community: Community;
12
12
  counts: CommentAggregates;
13
13
  creator_banned_from_community: boolean;
14
+ banned_from_community: boolean;
14
15
  creator_is_moderator: boolean;
15
16
  creator_is_admin: boolean;
16
17
  subscribed: SubscribedType;
@@ -8,6 +8,7 @@ export interface PostView {
8
8
  creator: Person;
9
9
  community: Community;
10
10
  creator_banned_from_community: boolean;
11
+ banned_from_community: boolean;
11
12
  creator_is_moderator: boolean;
12
13
  creator_is_admin: boolean;
13
14
  counts: PostAggregates;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
3
  "description": "A javascript / typescript client for Lemmy",
4
- "version": "0.19.4-alpha.10",
4
+ "version": "0.19.4-alpha.11",
5
5
  "author": "Dessalines <tyhou13@gmx.com>",
6
6
  "license": "AGPL-3.0",
7
7
  "main": "./dist/index.js",
@@ -18,10 +18,7 @@
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/LemmyNet/lemmy-js-client.git"
20
20
  },
21
- "dependencies": {
22
- "cross-fetch": "^4.0.0",
23
- "form-data": "^4.0.0"
24
- },
21
+ "dependencies": {},
25
22
  "devDependencies": {
26
23
  "@types/node": "^20.11.19",
27
24
  "@typescript-eslint/eslint-plugin": "^7.0.1",
@@ -53,5 +50,6 @@
53
50
  "style": "module",
54
51
  "parser": "typescript"
55
52
  }
56
- }
53
+ },
54
+ "packageManager": "pnpm@8.15.5"
57
55
  }
@@ -1,4 +0,0 @@
1
- export interface ListMedia {
2
- page?: number;
3
- limit?: number;
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- import type { LocalImage } from "./LocalImage";
2
- export interface ListMediaResponse {
3
- images: Array<LocalImage>;
4
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import type { LocalUserId } from "./LocalUserId";
2
- export interface LocalImage {
3
- local_user_id?: LocalUserId;
4
- pictrs_alias: string;
5
- pictrs_delete_token: string;
6
- published: string;
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });