dfx 0.17.8 → 0.17.9
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/DiscordGateway/DiscordWS/index.d.ts +2 -3
- package/DiscordGateway/DiscordWS/index.js +1 -3
- package/DiscordGateway/DiscordWS/index.js.map +1 -1
- package/DiscordGateway/WS/index.d.ts +1 -6
- package/DiscordGateway/WS/index.js +16 -23
- package/DiscordGateway/WS/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
/// <reference types="ws" />
|
|
3
2
|
import { Discord } from "dfx";
|
|
4
3
|
import { WS } from "dfx/gateway";
|
|
@@ -14,8 +13,8 @@ export interface OpenOpts {
|
|
|
14
13
|
}
|
|
15
14
|
export interface DiscordWSCodec {
|
|
16
15
|
type: "json" | "etf";
|
|
17
|
-
encode: (p: Discord.GatewayPayload) => string
|
|
18
|
-
decode: (p: WebSocket.
|
|
16
|
+
encode: (p: Discord.GatewayPayload) => string;
|
|
17
|
+
decode: (p: WebSocket.Data) => Discord.GatewayPayload;
|
|
19
18
|
}
|
|
20
19
|
export declare const DiscordWSCodec: import("../../global.js").Tag<DiscordWSCodec>;
|
|
21
20
|
export declare const LiveJsonDiscordWSCodec: import("../../global.js").Layer<never, never, DiscordWSCodec>;
|
|
@@ -21,8 +21,6 @@ export const make = ({ url = "wss://gateway.discord.gg/", version = 10, outbound
|
|
|
21
21
|
return tsplus_module_9.flatMap(ws => tsplus_module_9.map(log => {
|
|
22
22
|
const source = tsplus_module_7.map(encoding.decode)(tsplus_module_6.retry(tsplus_module_4.exponential(tsplus_module_3.seconds(0.5)))(tsplus_module_5.tapError((e) => log.info("DiscordWS", "ERROR", e))(ws)));
|
|
23
23
|
return { source, setUrl };
|
|
24
|
-
})(tsplus_module_9.service(tsplus_module_8.Log.Log)))(tsplus_module_10.WS.make(urlRef, take
|
|
25
|
-
perMessageDeflate: false,
|
|
26
|
-
}));
|
|
24
|
+
})(tsplus_module_9.service(tsplus_module_8.Log.Log)))(tsplus_module_10.WS.make(urlRef, take));
|
|
27
25
|
})(tsplus_module_11.make(`${url}?v=${version}&encoding=${encoding.type}`)))(tsplus_module_9.service(DiscordWSCodec));
|
|
28
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAgBA,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAA,GAAG,EAAkB,CAAA;AACnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAc,cAAc,CAAC,CAAC;IAClE,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,GAAG,GAAG,2BAA2B,EACjC,OAAO,GAAG,EAAE,EACZ,QAAQ,GACC,EAAE,EAAE,yBAEL,QAAQ,4BACR,MAAM;IACZ,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7B,qBAAW,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,EAA1D,MAAM,CAAqD,CAAA;IAC7D,MAAM,IAAI,GAAG,oBAAa,CAAC,CAAC,EAAE,EAAE,CAC9B,CAAC,KAAK,iBAAA,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EADhC,QAAQ,CAEpB,CAAA;mCACK,EAAE,
|
|
1
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,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;OAVX,wBAAe,gBAAA,GAAG,CAAC,GAAG,CAAC,GAFxB,iBAAA,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;GANjB,sBAAS,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,CAAC,GADvD,wBAAe,cAAc,CAAC,CAoBjD,CAAA"}
|
|
@@ -18,9 +18,4 @@ export declare class WebSocketCloseError {
|
|
|
18
18
|
readonly _tag = "WebSocketCloseError";
|
|
19
19
|
constructor(code: number, reason: string);
|
|
20
20
|
}
|
|
21
|
-
export declare
|
|
22
|
-
readonly reason: Error;
|
|
23
|
-
readonly _tag = "WebSocketWriteError";
|
|
24
|
-
constructor(reason: Error);
|
|
25
|
-
}
|
|
26
|
-
export declare const make: (url: Ref<string>, takeOutbound: Effect<never, never, Message>, options?: WebSocket.ClientOptions) => import("../../global.js").Effect<import("../../Log/index.js").Log, never, import("callbag-effect-ts/Source").EffectSource<never, WebSocketError | WebSocketCloseError | WebSocketWriteError, WebSocket.RawData>>;
|
|
21
|
+
export declare const make: (url: Ref<string>, takeOutbound: Effect<never, never, Message>) => import("../../global.js").Effect<import("../../Log/index.js").Log, never, import("callbag-effect-ts/Source").EffectSource<never, WebSocketError | WebSocketCloseError, WebSocket.Data>>;
|
|
@@ -12,9 +12,8 @@ import * as tsplus_module_11 from "callbag-effect-ts/Source/unwrapScope";
|
|
|
12
12
|
import * as tsplus_module_12 from "callbag-effect-ts/Source/retry";
|
|
13
13
|
import WebSocket from "isomorphic-ws";
|
|
14
14
|
export const Reconnect = Symbol();
|
|
15
|
-
const socket = (urlRef
|
|
15
|
+
const socket = (urlRef) => tsplus_module_1.acquireRelease(tsplus_module_1.map(url => new WebSocket(url))(tsplus_module_2.get(urlRef)), (ws) => tsplus_module_1.sync(() => {
|
|
16
16
|
ws.close();
|
|
17
|
-
ws.removeAllListeners();
|
|
18
17
|
}));
|
|
19
18
|
export class WebSocketError {
|
|
20
19
|
reason;
|
|
@@ -33,47 +32,41 @@ export class WebSocketCloseError {
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
const recv = (ws) => tsplus_module_3.async((emit) => {
|
|
36
|
-
ws.
|
|
37
|
-
emit.data(message);
|
|
35
|
+
ws.addEventListener("message", (message) => {
|
|
36
|
+
emit.data(message.data);
|
|
38
37
|
});
|
|
39
|
-
ws.
|
|
38
|
+
ws.addEventListener("error", (cause) => {
|
|
40
39
|
emit.fail(new WebSocketError(cause));
|
|
41
40
|
});
|
|
42
|
-
ws.
|
|
43
|
-
emit.fail(new WebSocketCloseError(code, reason
|
|
41
|
+
ws.addEventListener("close", (e) => {
|
|
42
|
+
emit.fail(new WebSocketCloseError(e.code, e.reason));
|
|
44
43
|
});
|
|
44
|
+
return () => {
|
|
45
|
+
;
|
|
46
|
+
ws.removeAllListeners?.();
|
|
47
|
+
};
|
|
45
48
|
});
|
|
46
|
-
export class WebSocketWriteError {
|
|
47
|
-
reason;
|
|
48
|
-
_tag = "WebSocketWriteError";
|
|
49
|
-
constructor(reason) {
|
|
50
|
-
this.reason = reason;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
49
|
const send = (ws, take) => tsplus_module_1.map(log => tsplus_module_7.drain(tsplus_module_6.tap((data) => tsplus_module_1.async((resume) => {
|
|
54
50
|
if (data === Reconnect) {
|
|
55
51
|
ws.close(1012, "reconnecting");
|
|
56
52
|
resume(tsplus_module_1.fail(new WebSocketCloseError(1012, "reconnecting")));
|
|
57
53
|
}
|
|
58
54
|
else {
|
|
59
|
-
ws.send(data
|
|
60
|
-
|
|
61
|
-
? tsplus_module_1.fail(new WebSocketWriteError(err))
|
|
62
|
-
: tsplus_module_1.unit());
|
|
63
|
-
});
|
|
55
|
+
ws.send(data);
|
|
56
|
+
resume(tsplus_module_1.unit());
|
|
64
57
|
}
|
|
65
58
|
}))(tsplus_module_6.tap((p) => log.debug("WS", "send", p))(tsplus_module_5.unwrap(tsplus_module_1.map(() => tsplus_module_4.repeatEffectOption(take))(tsplus_module_1.async((resume) => {
|
|
66
59
|
if (ws.readyState & ws.OPEN) {
|
|
67
60
|
resume(tsplus_module_1.unit());
|
|
68
61
|
}
|
|
69
62
|
else {
|
|
70
|
-
ws.
|
|
63
|
+
ws.addEventListener("open", () => {
|
|
71
64
|
resume(tsplus_module_1.unit());
|
|
72
|
-
});
|
|
65
|
+
}, { once: true });
|
|
73
66
|
}
|
|
74
67
|
})))))))(tsplus_module_1.service(tsplus_module_8.Log.Log));
|
|
75
|
-
export const make = (url, takeOutbound
|
|
68
|
+
export const make = (url, takeOutbound) => tsplus_module_1.map(log => {
|
|
76
69
|
const withLog = tsplus_module_1.provideService(tsplus_module_8.Log.Log)(log);
|
|
77
|
-
return tsplus_module_12.retry(tsplus_module_9.recurWhile((e) => e._tag === "WebSocketCloseError" && e.code === 1012))(tsplus_module_11.unwrapScope(tsplus_module_1.flatMap(ws => tsplus_module_1.map(sendEffect => tsplus_module_10.merge(sendEffect)(recv(ws)))(withLog(send(ws, takeOutbound))))(socket(url
|
|
70
|
+
return tsplus_module_12.retry(tsplus_module_9.recurWhile((e) => e._tag === "WebSocketCloseError" && e.code === 1012))(tsplus_module_11.unwrapScope(tsplus_module_1.flatMap(ws => tsplus_module_1.map(sendEffect => tsplus_module_10.merge(sendEffect)(recv(ws)))(withLog(send(ws, takeOutbound))))(socket(url))));
|
|
78
71
|
})(tsplus_module_1.service(tsplus_module_8.Log.Log));
|
|
79
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/WS/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,EAAE,CAAA;AAIjC,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAE,
|
|
1
|
+
{"version":3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AAEJ,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,GAAgB,EAChB,YAA2C,EAC3C,EAAE,qBAEM,GAAG;IACT,MAAM,OAAO,GAAG,+BAAsB,gBAAA,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;IAEnD,OAAO,uBAKL,2BACE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,qBAAqB,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAC3D,uDANK,EAAE,wBACF,UAAU,IACT,uBAAe,UAAU,EAAzB,IAAI,CAAC,EAAE,CAAC,CAAkB,EADZ,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,GADvC,MAAM,CAAC,GAAG,CAAC,GAOzB,CAAA;GAXa,wBAAe,gBAAA,GAAG,CAAC,GAAG,CAAC,CAYrC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@fp-ts/data": "^0.0.20"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c21408ac8ba6dc63654a112fd5ce5f85471fbfbd"
|
|
53
53
|
}
|