@rc-ex/ws 1.2.1 → 1.3.0
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/lib/esm/exceptions/ClosedException.d.ts +4 -0
- package/lib/esm/exceptions/ClosedException.js +7 -0
- package/lib/esm/exceptions/ClosedException.js.map +1 -0
- package/lib/esm/exceptions/ConnectionException.d.ts +7 -0
- package/lib/esm/exceptions/ConnectionException.js +13 -0
- package/lib/esm/exceptions/ConnectionException.js.map +1 -0
- package/lib/esm/exceptions/TimeoutException.d.ts +4 -0
- package/lib/esm/exceptions/TimeoutException.js +7 -0
- package/lib/esm/exceptions/TimeoutException.js.map +1 -0
- package/lib/esm/index.d.ts +44 -0
- package/lib/{index.js → esm/index.js} +62 -63
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/rest.d.ts +3 -0
- package/lib/{rest.js → esm/rest.js} +10 -17
- package/lib/esm/rest.js.map +1 -0
- package/lib/esm/subscription.d.ts +20 -0
- package/lib/{subscription.js → esm/subscription.js} +9 -9
- package/lib/esm/subscription.js.map +1 -0
- package/lib/esm/types.d.ts +61 -0
- package/lib/esm/types.js +2 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/utils.d.ts +8 -0
- package/lib/{utils.js → esm/utils.js} +5 -10
- package/lib/esm/utils.js.map +1 -0
- package/lib/exceptions/ClosedException.cjs +26 -0
- package/lib/exceptions/ClosedException.js.map +1 -1
- package/lib/exceptions/ConnectionException.cjs +35 -0
- package/lib/exceptions/ConnectionException.d.ts +1 -1
- package/lib/exceptions/ConnectionException.js.map +1 -1
- package/lib/exceptions/TimeoutException.cjs +26 -0
- package/lib/exceptions/TimeoutException.js.map +1 -1
- package/lib/index.cjs +515 -0
- package/lib/index.d.ts +5 -5
- package/lib/index.js.map +1 -1
- package/lib/rest.cjs +104 -0
- package/lib/rest.d.ts +2 -2
- package/lib/rest.js.map +1 -1
- package/lib/subscription.cjs +178 -0
- package/lib/subscription.d.ts +3 -3
- package/lib/subscription.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/utils.cjs +116 -0
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +10 -5
- package/src/exceptions/ConnectionException.ts +2 -2
- package/src/index.ts +15 -12
- package/src/rest.ts +4 -4
- package/src/subscription.ts +9 -5
- package/src/types.ts +1 -1
- package/src/utils.ts +3 -3
- package/tsconfig.json +0 -3
- package/lib/exceptions/ClosedException.js +0 -9
- package/lib/exceptions/ConnectionException.js +0 -16
- package/lib/exceptions/TimeoutException.js +0 -9
- /package/lib/{types.js → types.cjs} +0 -0
package/src/utils.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { MessageEvent } from "isomorphic-ws";
|
|
2
2
|
import type WS from "isomorphic-ws";
|
|
3
3
|
|
|
4
|
-
import type { WsgEvent, WsgMeta } from "./types";
|
|
5
|
-
import ClosedException from "./exceptions/ClosedException";
|
|
6
|
-
import TimeoutException from "./exceptions/TimeoutException";
|
|
4
|
+
import type { WsgEvent, WsgMeta } from "./types.js";
|
|
5
|
+
import ClosedException from "./exceptions/ClosedException.js";
|
|
6
|
+
import TimeoutException from "./exceptions/TimeoutException.js";
|
|
7
7
|
|
|
8
8
|
class Utils {
|
|
9
9
|
public static splitWsgData(wsgData: string): [WsgMeta, any] {
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class ClosedException extends Error {
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message !== null && message !== void 0 ? message : "WebSocket has been closed");
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
exports.default = ClosedException;
|
|
9
|
-
//# sourceMappingURL=ClosedException.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = __importDefault(require("../utils"));
|
|
7
|
-
class ConnectionException extends Error {
|
|
8
|
-
constructor(wsgEvent) {
|
|
9
|
-
const [, wsgError] = utils_1.default.splitWsgData(wsgEvent.data);
|
|
10
|
-
super(JSON.stringify(wsgError, null, 2));
|
|
11
|
-
this.wsgEvent = wsgEvent;
|
|
12
|
-
this.wsgError = wsgError;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.default = ConnectionException;
|
|
16
|
-
//# sourceMappingURL=ConnectionException.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class TimeoutException extends Error {
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message !== null && message !== void 0 ? message : "Failed to receive expected WebSocket message in time.");
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
exports.default = TimeoutException;
|
|
9
|
-
//# sourceMappingURL=TimeoutException.js.map
|
|
File without changes
|