lemmy-js-client 0.17.0-rc.25 → 0.17.0-rc.28
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +3 -0
- package/dist/websocket.d.ts +0 -3
- package/dist/websocket.js +4 -18
- package/package.json +1 -1
package/dist/utils.d.ts
CHANGED
@@ -3,4 +3,7 @@ import { Option } from "@sniptt/monads";
|
|
3
3
|
* Converts an option to an undefined. Necessary for API requests.
|
4
4
|
*/
|
5
5
|
export declare function toUndefined<T>(opt: Option<T>): T;
|
6
|
+
/**
|
7
|
+
* Converts a null value to an option.
|
8
|
+
*/
|
6
9
|
export declare function toOption<T>(val: T): Option<T>;
|
package/dist/utils.js
CHANGED
package/dist/websocket.d.ts
CHANGED
@@ -332,9 +332,6 @@ export declare class LemmyWebsocket {
|
|
332
332
|
*/
|
333
333
|
blockCommunity(form: BlockCommunity): string;
|
334
334
|
}
|
335
|
-
/**
|
336
|
-
* A websocket JSON response that includes the errors.
|
337
|
-
*/
|
338
335
|
export declare function wsUserOp(msg: any): UserOperation;
|
339
336
|
/**
|
340
337
|
* Converts a websocket string response to a usable result
|
package/dist/websocket.js
CHANGED
@@ -487,24 +487,9 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
487
487
|
}());
|
488
488
|
exports.LemmyWebsocket = LemmyWebsocket;
|
489
489
|
function wrapper(op, data) {
|
490
|
-
var send = { op: others_1.UserOperation[op], data: data };
|
491
|
-
|
492
|
-
return JSON.stringify(send);
|
490
|
+
var send = (0, class_transformer_1.serialize)({ op: others_1.UserOperation[op], data: data });
|
491
|
+
return send;
|
493
492
|
}
|
494
|
-
/**
|
495
|
-
* A websocket JSON response that includes the errors.
|
496
|
-
*/
|
497
|
-
// interface WebSocketJsonResponse {
|
498
|
-
// op?: string;
|
499
|
-
// /**
|
500
|
-
// * This contains the data for a websocket response.
|
501
|
-
// *
|
502
|
-
// * The correct response type if given is in [[LemmyHttp]].
|
503
|
-
// */
|
504
|
-
// data?: ResponseType;
|
505
|
-
// error?: string;
|
506
|
-
// reconnect?: boolean;
|
507
|
-
// }
|
508
493
|
function wsUserOp(msg) {
|
509
494
|
var opStr = msg.op;
|
510
495
|
return others_1.UserOperation[opStr];
|
@@ -514,6 +499,7 @@ exports.wsUserOp = wsUserOp;
|
|
514
499
|
* Converts a websocket string response to a usable result
|
515
500
|
*/
|
516
501
|
function wsJsonToRes(msg, responseClass) {
|
517
|
-
|
502
|
+
// Have to deserialize the response again into the correct class
|
503
|
+
return (0, class_transformer_1.deserialize)(responseClass, (0, class_transformer_1.serialize)(msg.data));
|
518
504
|
}
|
519
505
|
exports.wsJsonToRes = wsJsonToRes;
|
package/package.json
CHANGED