lemmy-js-client 1.0.0-rename-timestamp-to-at.2 → 1.0.0-rename-timestamp-to-at.4
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 +10 -2
- package/dist/http.js +19 -3
- package/dist/index.d.ts +0 -1
- package/package.json +2 -2
- package/dist/types/ResolveObjectResponse.d.ts +0 -13
- package/dist/types/ResolveObjectResponse.js +0 -2
package/dist/http.d.ts
CHANGED
@@ -140,7 +140,6 @@ import { CommunityIdQuery } from "./types/CommunityIdQuery";
|
|
140
140
|
import { AdminListUsersResponse } from "./types/AdminListUsersResponse";
|
141
141
|
import { ListLoginsResponse } from "./types/ListLoginsResponse";
|
142
142
|
import { ListPersonLikedResponse } from "./types/ListPersonLikedResponse";
|
143
|
-
import { ResolveObjectResponse } from "./types/ResolveObjectResponse";
|
144
143
|
type RequestOptions = Pick<RequestInit, "signal">;
|
145
144
|
/**
|
146
145
|
* Helps build lemmy HTTP requests.
|
@@ -239,7 +238,7 @@ export declare class LemmyHttp extends Controller {
|
|
239
238
|
/**
|
240
239
|
* @summary Fetch a non-local / federated object.
|
241
240
|
*/
|
242
|
-
resolveObject(form: ResolveObjectI, options?: RequestOptions): Promise<
|
241
|
+
resolveObject(form: ResolveObjectI, options?: RequestOptions): Promise<SearchResponse>;
|
243
242
|
/**
|
244
243
|
* @summary Create a new community.
|
245
244
|
*/
|
@@ -749,4 +748,13 @@ export declare class LemmyHttp extends Controller {
|
|
749
748
|
[key: string]: string;
|
750
749
|
}): void;
|
751
750
|
}
|
751
|
+
/**
|
752
|
+
* A Lemmy error type.
|
753
|
+
*
|
754
|
+
* The name is the i18n translatable error code.
|
755
|
+
* The msg is either an empty string, or extra non-translatable info.
|
756
|
+
*/
|
757
|
+
export declare class LemmyError extends Error {
|
758
|
+
constructor(name: string, msg?: string);
|
759
|
+
}
|
752
760
|
export {};
|
package/dist/http.js
CHANGED
@@ -21,7 +21,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
21
21
|
};
|
22
22
|
var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers, _LemmyHttp_fetchFunction, _LemmyHttp_buildFullUrl, _LemmyHttp_upload, _LemmyHttp_uploadWithQuery, _LemmyHttp_wrapper;
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
24
|
-
exports.LemmyHttp = void 0;
|
24
|
+
exports.LemmyError = exports.LemmyHttp = void 0;
|
25
25
|
const runtime_1 = require("@tsoa/runtime");
|
26
26
|
const other_types_1 = require("./other_types");
|
27
27
|
var HttpType;
|
@@ -978,10 +978,11 @@ _LemmyHttp_wrapper = async function _LemmyHttp_wrapper(type_, endpoint, form, op
|
|
978
978
|
json = await response.json();
|
979
979
|
}
|
980
980
|
catch {
|
981
|
-
throw new
|
981
|
+
throw new LemmyError(response.statusText);
|
982
982
|
}
|
983
983
|
if (!response.ok) {
|
984
|
-
|
984
|
+
let err = new LemmyError(json.error ?? response.statusText, json.message);
|
985
|
+
throw err;
|
985
986
|
}
|
986
987
|
else {
|
987
988
|
return json;
|
@@ -1998,3 +1999,18 @@ function createFormData(image) {
|
|
1998
1999
|
}
|
1999
2000
|
return formData;
|
2000
2001
|
}
|
2002
|
+
/**
|
2003
|
+
* A Lemmy error type.
|
2004
|
+
*
|
2005
|
+
* The name is the i18n translatable error code.
|
2006
|
+
* The msg is either an empty string, or extra non-translatable info.
|
2007
|
+
*/
|
2008
|
+
class LemmyError extends Error {
|
2009
|
+
constructor(name, msg) {
|
2010
|
+
super(msg ?? "");
|
2011
|
+
this.name = name;
|
2012
|
+
// Set the prototype explicitly.
|
2013
|
+
Object.setPrototypeOf(this, LemmyError.prototype);
|
2014
|
+
}
|
2015
|
+
}
|
2016
|
+
exports.LemmyError = LemmyError;
|
package/dist/index.d.ts
CHANGED
@@ -309,7 +309,6 @@ export { ResendVerificationEmail } from "./types/ResendVerificationEmail";
|
|
309
309
|
export { ResolveCommentReport } from "./types/ResolveCommentReport";
|
310
310
|
export { ResolveCommunityReport } from "./types/ResolveCommunityReport";
|
311
311
|
export { ResolveObject } from "./types/ResolveObject";
|
312
|
-
export { ResolveObjectResponse } from "./types/ResolveObjectResponse";
|
313
312
|
export { ResolvePostReport } from "./types/ResolvePostReport";
|
314
313
|
export { ResolvePrivateMessageReport } from "./types/ResolvePrivateMessageReport";
|
315
314
|
export { SaveComment } from "./types/SaveComment";
|
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": "1.0.0-rename-timestamp-to-at.
|
4
|
+
"version": "1.0.0-rename-timestamp-to-at.4",
|
5
5
|
"author": "Dessalines",
|
6
6
|
"license": "AGPL-3.0",
|
7
7
|
"main": "./dist/index.js",
|
@@ -43,7 +43,7 @@
|
|
43
43
|
"typescript": "^5.5.4",
|
44
44
|
"typescript-eslint": "^8.7.0"
|
45
45
|
},
|
46
|
-
"packageManager": "pnpm@10.
|
46
|
+
"packageManager": "pnpm@10.12.1",
|
47
47
|
"types": "./dist/index.d.ts",
|
48
48
|
"lint-staged": {
|
49
49
|
"*.{ts,tsx,js}": [
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import type { CommentView } from "./CommentView";
|
2
|
-
import type { CommunityView } from "./CommunityView";
|
3
|
-
import type { PersonView } from "./PersonView";
|
4
|
-
import type { PostView } from "./PostView";
|
5
|
-
/**
|
6
|
-
* The response of an apub object fetch.
|
7
|
-
*/
|
8
|
-
export type ResolveObjectResponse = {
|
9
|
-
comment?: CommentView;
|
10
|
-
post?: PostView;
|
11
|
-
community?: CommunityView;
|
12
|
-
person?: PersonView;
|
13
|
-
};
|