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

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";
@@ -211,7 +210,7 @@ export declare class LemmyHttp {
211
210
  /**
212
211
  * List all the media for your user
213
212
  *
214
- * `HTTP.GET /user/list_media`
213
+ * `HTTP.GET /account/list_media`
215
214
  */
216
215
  listMedia(form?: ListMedia): Promise<ListMediaResponse>;
217
216
  /**
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) {
@@ -136,10 +131,10 @@ class LemmyHttp {
136
131
  /**
137
132
  * List all the media for your user
138
133
  *
139
- * `HTTP.GET /user/list_media`
134
+ * `HTTP.GET /account/list_media`
140
135
  */
141
136
  listMedia(form = {}) {
142
- return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/list_media", form);
137
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/account/list_media", form);
143
138
  }
144
139
  /**
145
140
  * List all the media known to your instance.
@@ -941,13 +936,13 @@ function encodeGetParams(p) {
941
936
  .join("&");
942
937
  }
943
938
  function createFormData(image) {
944
- let formData = new form_data_1.default();
945
- if (image.constructor.name === "File") {
939
+ let formData = new FormData();
940
+ if (image instanceof File) {
946
941
  formData.append("images[]", image);
947
942
  }
948
943
  else {
949
944
  // The filename doesn't affect the file type or file name that ends up in pictrs
950
- formData.append("images[]", image, { filename: "image.jpg" });
945
+ formData.append("images[]", new Blob([image], { type: "image/jpeg" }), "image.jpg");
951
946
  }
952
947
  return formData;
953
948
  }
@@ -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.12",
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
  }