dfx 0.18.1 → 0.18.2
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/Cache/gateway.d.ts +15 -15
- package/Cache/gateway.js +26 -34
- package/Cache/gateway.js.map +1 -1
- package/Cache/index.d.ts +10 -10
- package/Cache/index.js.map +1 -1
- package/Cache/prelude.d.ts +13 -13
- package/Cache/prelude.js +18 -16
- package/Cache/prelude.js.map +1 -1
- package/DiscordGateway/DiscordWS/index.d.ts +1 -1
- package/DiscordGateway/Shard/index.d.ts +1 -1
- package/DiscordGateway/Sharder/index.d.ts +14 -6
- package/DiscordGateway/Sharder/index.js +48 -47
- package/DiscordGateway/Sharder/index.js.map +1 -1
- package/DiscordGateway/index.d.ts +3 -11
- package/DiscordGateway/index.js +3 -7
- package/DiscordGateway/index.js.map +1 -1
- package/DiscordREST/index.d.ts +4 -4
- package/DiscordREST/index.js +61 -61
- package/DiscordREST/index.js.map +1 -1
- package/DiscordREST/types.d.ts +1 -2
- package/Http/index.d.ts +14 -7
- package/Http/index.js +17 -10
- package/Http/index.js.map +1 -1
- package/Interactions/gateway.d.ts +1 -1
- package/Interactions/gateway.js +7 -7
- package/Interactions/gateway.js.map +1 -1
- package/Interactions/index.d.ts +4 -2
- package/Interactions/index.js +17 -10
- package/Interactions/index.js.map +1 -1
- package/gateway.d.ts +6 -5
- package/gateway.js +10 -5
- package/gateway.js.map +1 -1
- package/global.d.ts +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/webhooks.d.ts +3 -3
- package/webhooks.js +4 -3
- package/webhooks.js.map +1 -1
package/Cache/gateway.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
2
2
|
import { Discord } from "dfx";
|
|
3
3
|
import { ParentCacheOp, CacheOp } from "./index.js";
|
|
4
|
-
export interface OpsSourceOpts<
|
|
4
|
+
export interface OpsSourceOpts<E, A> {
|
|
5
5
|
id: (a: A) => string;
|
|
6
|
-
fromParent: EffectSource<
|
|
7
|
-
create: EffectSource<
|
|
8
|
-
update: EffectSource<
|
|
9
|
-
remove: EffectSource<
|
|
10
|
-
parentRemove: EffectSource<
|
|
6
|
+
fromParent: EffectSource<never, E, [parentId: string, resources: A[]]>;
|
|
7
|
+
create: EffectSource<never, E, [parentId: string, resource: A]>;
|
|
8
|
+
update: EffectSource<never, E, [parentId: string, resource: A]>;
|
|
9
|
+
remove: EffectSource<never, E, [parentId: string, id: string]>;
|
|
10
|
+
parentRemove: EffectSource<never, E, string>;
|
|
11
11
|
}
|
|
12
|
-
export declare const source: <R, E, T>({ id, fromParent, create, update, remove, parentRemove, }: OpsSourceOpts<
|
|
13
|
-
export interface NonParentOpsSourceOpts<
|
|
12
|
+
export declare const source: <R, E, T>({ id, fromParent, create, update, remove, parentRemove, }: OpsSourceOpts<E, T>) => import("callbag-effect-ts/Source").EffectSource<never, E, ParentCacheOp<T>>;
|
|
13
|
+
export interface NonParentOpsSourceOpts<E, A> {
|
|
14
14
|
id: (a: A) => string;
|
|
15
|
-
create: EffectSource<
|
|
16
|
-
update: EffectSource<
|
|
17
|
-
remove: EffectSource<
|
|
15
|
+
create: EffectSource<never, E, A>;
|
|
16
|
+
update: EffectSource<never, E, A>;
|
|
17
|
+
remove: EffectSource<never, E, string>;
|
|
18
18
|
}
|
|
19
|
-
export declare const nonParentSource: <R, E, T>({ id, create, update, remove, }: NonParentOpsSourceOpts<
|
|
20
|
-
export declare const guilds: import("
|
|
21
|
-
export declare const channels: import("
|
|
22
|
-
export declare const roles: import("
|
|
19
|
+
export declare const nonParentSource: <R, E, T>({ id, create, update, remove, }: NonParentOpsSourceOpts<E, T>) => import("callbag-effect-ts/Source").EffectSource<never, E, CacheOp<T>>;
|
|
20
|
+
export declare const guilds: import("../global.js").Effect<import("../DiscordGateway/index.js").DiscordGateway, never, import("callbag-effect-ts/Source").EffectSource<never, never, CacheOp<import("../types.js").Guild>>>;
|
|
21
|
+
export declare const channels: import("../global.js").Effect<import("../DiscordGateway/index.js").DiscordGateway, never, import("callbag-effect-ts/Source").EffectSource<never, never, ParentCacheOp<import("../types.js").Channel>>>;
|
|
22
|
+
export declare const roles: import("../global.js").Effect<import("../DiscordGateway/index.js").DiscordGateway, never, import("callbag-effect-ts/Source").EffectSource<never, never, ParentCacheOp<import("../types.js").Role>>>;
|
package/Cache/gateway.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as tsplus_module_2 from "callbag-effect-ts/Source/chain";
|
|
|
3
3
|
import * as tsplus_module_3 from "callbag-effect-ts/Source/map";
|
|
4
4
|
import * as tsplus_module_4 from "callbag-effect-ts/Source/merge";
|
|
5
5
|
import * as tsplus_module_5 from "dfx/gateway";
|
|
6
|
+
import * as tsplus_module_6 from "@effect/io/Effect";
|
|
6
7
|
export const source = ({ id, fromParent, create, update, remove, parentRemove, }) => {
|
|
7
8
|
const fromParentOps = tsplus_module_2.chain(([parentId, a]) => tsplus_module_1.fromIterable(a.map((resource) => ({
|
|
8
9
|
op: "create",
|
|
@@ -51,7 +52,7 @@ export const nonParentSource = ({ id, create, update, remove, }) => {
|
|
|
51
52
|
return tsplus_module_4.merge(removeOps)(tsplus_module_4.merge(updateOps)(createOps));
|
|
52
53
|
};
|
|
53
54
|
// Guilds
|
|
54
|
-
export const guilds = nonParentSource({
|
|
55
|
+
export const guilds = tsplus_module_6.map(gateway => nonParentSource({
|
|
55
56
|
id: (g) => g.id,
|
|
56
57
|
create: tsplus_module_3.map((g) => ({
|
|
57
58
|
...g,
|
|
@@ -59,41 +60,32 @@ export const guilds = nonParentSource({
|
|
|
59
60
|
roles: [],
|
|
60
61
|
emojis: [],
|
|
61
62
|
members: [],
|
|
62
|
-
}))(
|
|
63
|
-
update:
|
|
64
|
-
remove: tsplus_module_3.map((a) => a.id)(
|
|
65
|
-
});
|
|
63
|
+
}))(gateway.fromDispatch("GUILD_CREATE")),
|
|
64
|
+
update: gateway.fromDispatch("GUILD_UPDATE"),
|
|
65
|
+
remove: tsplus_module_3.map((a) => a.id)(gateway.fromDispatch("GUILD_DELETE")),
|
|
66
|
+
}))(tsplus_module_6.service(tsplus_module_5.Gateway.DiscordGateway));
|
|
66
67
|
// Channels
|
|
67
|
-
export const channels = source({
|
|
68
|
+
export const channels = tsplus_module_6.map(gateway => source({
|
|
68
69
|
id: (a) => a.id,
|
|
69
|
-
fromParent: tsplus_module_3.map((g) => [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
])(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
a.id,
|
|
78
|
-
])(tsplus_module_5.Gateway.fromDispatch("CHANNEL_DELETE")),
|
|
79
|
-
parentRemove: tsplus_module_3.map((g) => g.id)(tsplus_module_5.Gateway.fromDispatch("GUILD_DELETE")),
|
|
80
|
-
});
|
|
70
|
+
fromParent: tsplus_module_3.map((g) => [g.id, g.channels])(gateway
|
|
71
|
+
.fromDispatch("GUILD_CREATE")),
|
|
72
|
+
create: tsplus_module_3.map((c) => [c.guild_id, c])(gateway.fromDispatch("CHANNEL_CREATE")),
|
|
73
|
+
update: tsplus_module_3.map((c) => [c.guild_id, c])(gateway.fromDispatch("CHANNEL_UPDATE")),
|
|
74
|
+
remove: tsplus_module_3.map((a) => [a.guild_id, a.id])(gateway
|
|
75
|
+
.fromDispatch("CHANNEL_DELETE")),
|
|
76
|
+
parentRemove: tsplus_module_3.map((g) => g.id)(gateway.fromDispatch("GUILD_DELETE")),
|
|
77
|
+
}))(tsplus_module_6.service(tsplus_module_5.Gateway.DiscordGateway));
|
|
81
78
|
// Roles
|
|
82
|
-
export const roles = source({
|
|
79
|
+
export const roles = tsplus_module_6.map(gateway => source({
|
|
83
80
|
id: (a) => a.id,
|
|
84
|
-
fromParent: tsplus_module_3.map((g) => [g.id, g.roles])(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
a.guild_id,
|
|
95
|
-
a.role_id,
|
|
96
|
-
])(tsplus_module_5.Gateway.fromDispatch("GUILD_ROLE_DELETE")),
|
|
97
|
-
parentRemove: tsplus_module_3.map((g) => g.id)(tsplus_module_5.Gateway.fromDispatch("GUILD_DELETE")),
|
|
98
|
-
});
|
|
81
|
+
fromParent: tsplus_module_3.map((g) => [g.id, g.roles])(gateway
|
|
82
|
+
.fromDispatch("GUILD_CREATE")),
|
|
83
|
+
create: tsplus_module_3.map((r) => [r.guild_id, r.role])(gateway
|
|
84
|
+
.fromDispatch("GUILD_ROLE_CREATE")),
|
|
85
|
+
update: tsplus_module_3.map((r) => [r.guild_id, r.role])(gateway
|
|
86
|
+
.fromDispatch("GUILD_ROLE_UPDATE")),
|
|
87
|
+
remove: tsplus_module_3.map((a) => [a.guild_id, a.role_id])(gateway
|
|
88
|
+
.fromDispatch("GUILD_ROLE_DELETE")),
|
|
89
|
+
parentRemove: tsplus_module_3.map((g) => g.id)(gateway.fromDispatch("GUILD_DELETE")),
|
|
90
|
+
}))(tsplus_module_6.service(tsplus_module_5.Gateway.DiscordGateway));
|
|
99
91
|
//# sourceMappingURL=gateway.js.map
|
package/Cache/gateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/Cache/gateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/Cache/gateway.ts"],"names":[],"mappings":";;;;;;AAWA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAU,EAC9B,EAAE,EACF,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,EACN,YAAY,GACQ,EAAE,EAAE;IACxB,MAAM,aAAa,GAAG,sBAAiB,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CACvD,6BACE,CAAC,CAAC,GAAG,C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AE,oBAED,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,EAF1B,OAAO;SACZ,YAAY,CAAC,mBAAmB,CAAC,CACD;IACnC,MAAM,EAAE,oBAED,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,EAF1B,OAAO;SACZ,YAAY,CAAC,mBAAmB,CAAC,CACD;IACnC,MAAM,EAAE,oBAED,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,EAF7B,OAAO;SACZ,YAAY,CAAC,mBAAmB,CAAC,CACE;IACtC,YAAY,EAAE,oBAAyC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAApD,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,CAAiB;CACpE,CAAC,EAhBgB,wBAAe,gBAAA,OAAO,CAAC,cAAc,CAAC,CAiBxD,CAAA"}
|
package/Cache/index.d.ts
CHANGED
|
@@ -34,15 +34,15 @@ export type CacheOp<T> = {
|
|
|
34
34
|
op: "delete";
|
|
35
35
|
resourceId: string;
|
|
36
36
|
};
|
|
37
|
-
export declare const makeParent: <
|
|
37
|
+
export declare const makeParent: <RMakeDriver, RPMiss, EOps, EMakeDriver, EDriver, EMiss, EPMiss, A>({ driver: makeDriver, ops, onMiss, onParentMiss, }: {
|
|
38
38
|
driver: import("../global.js").Effect<RMakeDriver, EMakeDriver, ParentCacheDriver<EDriver, A>>;
|
|
39
|
-
ops?: import("callbag-effect-ts/Source").EffectSource<
|
|
40
|
-
onMiss: (parentId: string, id: string) => import("../global.js").Effect<
|
|
39
|
+
ops?: import("callbag-effect-ts/Source").EffectSource<never, EOps, ParentCacheOp<A>> | undefined;
|
|
40
|
+
onMiss: (parentId: string, id: string) => import("../global.js").Effect<never, EMiss, A>;
|
|
41
41
|
onParentMiss: (parentId: string) => import("../global.js").Effect<RPMiss, EPMiss, [id: string, resource: A][]>;
|
|
42
42
|
}) => import("../global.js").Effect<RMakeDriver, EMakeDriver, {
|
|
43
|
-
get: (parentId: string, id: string) => import("../global.js").Effect<
|
|
43
|
+
get: (parentId: string, id: string) => import("../global.js").Effect<never, EDriver | EMiss, A>;
|
|
44
44
|
getForParent: (parentId: string) => import("../global.js").Effect<RPMiss, EDriver | EPMiss, ReadonlyMap<string, A>>;
|
|
45
|
-
run: import("../global.js").Effect<
|
|
45
|
+
run: import("../global.js").Effect<never, EOps | EDriver, void>;
|
|
46
46
|
size: import("../global.js").Effect<never, EDriver, number>;
|
|
47
47
|
sizeForParent: (parentId: string) => import("../global.js").Effect<never, EDriver, number>;
|
|
48
48
|
set: (parentId: string, resourceId: string, resource: A) => import("../global.js").Effect<never, EDriver, void>;
|
|
@@ -50,13 +50,13 @@ export declare const makeParent: <ROps, RMakeDriver, RMiss, RPMiss, EOps, EMakeD
|
|
|
50
50
|
parentDelete: (parentId: string) => import("../global.js").Effect<never, EDriver, void>;
|
|
51
51
|
refreshTTL: (parentId: string, resourceId: string) => import("../global.js").Effect<never, EDriver, void>;
|
|
52
52
|
}>;
|
|
53
|
-
export declare const make: <
|
|
53
|
+
export declare const make: <RMakeDriver, EOps, EMakeDriver, EDriver, EMiss, A>({ driver: makeDriver, ops, onMiss, }: {
|
|
54
54
|
driver: import("../global.js").Effect<RMakeDriver, EMakeDriver, CacheDriver<EDriver, A>>;
|
|
55
|
-
ops?: import("callbag-effect-ts/Source").EffectSource<
|
|
56
|
-
onMiss: (id: string) => import("../global.js").Effect<
|
|
55
|
+
ops?: import("callbag-effect-ts/Source").EffectSource<never, EOps, CacheOp<A>> | undefined;
|
|
56
|
+
onMiss: (id: string) => import("../global.js").Effect<never, EMiss, A>;
|
|
57
57
|
}) => import("../global.js").Effect<RMakeDriver, EMakeDriver, {
|
|
58
|
-
get: (id: string) => import("../global.js").Effect<
|
|
59
|
-
run: import("../global.js").Effect<
|
|
58
|
+
get: (id: string) => import("../global.js").Effect<never, EDriver | EMiss, A>;
|
|
59
|
+
run: import("../global.js").Effect<never, EOps | EDriver, void>;
|
|
60
60
|
size: import("../global.js").Effect<never, EDriver, number>;
|
|
61
61
|
set: (resourceId: string, resource: A) => import("../global.js").Effect<never, EDriver, void>;
|
|
62
62
|
delete: (resourceId: string) => import("../global.js").Effect<never, EDriver, void>;
|
package/Cache/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Cache/index.ts"],"names":[],"mappings":";;;;AAEA,cAAc,aAAa,CAAA;AAC3B,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,gBAAgB,IAAI,kBAAkB,GACvC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,MAAM,IAAI,eAAe,EACzB,gBAAgB,IAAI,qBAAqB,GAC1C,MAAM,gBAAgB,CAAA;AAavB,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Cache/index.ts"],"names":[],"mappings":";;;;AAEA,cAAc,aAAa,CAAA;AAC3B,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,gBAAgB,IAAI,kBAAkB,GACvC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,MAAM,IAAI,eAAe,EACzB,gBAAgB,IAAI,qBAAqB,GAC1C,MAAM,gBAAgB,CAAA;AAavB,MAAM,CAAC,MAAM,UAAU,GAAG,CASxB,EACA,MAAM,EAAE,UAAU,EAClB,GAAG,wBAAqB,EACxB,MAAM,EACN,YAAY,GAQb,EAAE,EAAE,qBAEK,MAAM;IAEZ,MAAM,IAAI,4BAAG,oBAAQ,CAAC,EAAE,EAAgC,EAAE;QACxD,QAAQ,EAAE,CAAC,EAAE,EAAE;YACb,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE,CA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AAG,CAAoD,EACtE,MAAM,EAAE,UAAU,EAClB,GAAG,wBAAqB,EACxB,MAAM,GAKP,EAAE,EAAE,qBAEK,MAAM;IAEZ,MAAM,IAAI,4BAAG,oBAAQ,CAAC,EAAE,EAAgC,EAAE;QACxD,QAAQ,EAAE,CAAC,EAAE,EAAE;YACb,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAA;YAE/C,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAA;SACtC;IACH,CAAC,EATY,GAAG,CASd,CAAS,CAAA;IAEX,OAAO;QACL,GAAG,MAAM;QACT,GAAG,EAAE,CAAC,EAAU,EAAE,EAAE,CAClB,iCAEoB,GAAG,EAAE,CAAC,oBAAe,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAvC,MAAM,CAAC,EAAE,CAAC,CAA8B,EAFlE,MAAM;aACH,GAAG,CAAC,EAAE,CAAC,CACyD;QACrE,GAAG,yBAAE,uBAAY,MAAM,CAAC,GAAG,EAAtB,IAAI,CAAmB,CAAO;KACpC,CAAA;GApBgB,UAAU,CAqB3B,CAAA;AAEJ,MAAM,OAAO,cAAc;IAEJ;IAA4B;IADxC,IAAI,GAAG,gBAAgB,CAAA;IAChC,YAAqB,SAAiB,EAAW,EAAU;QAAtC,cAAS,GAAT,SAAS,CAAQ;QAAW,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;CAChE"}
|
package/Cache/prelude.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Discord } from "dfx";
|
|
2
2
|
import { Effect } from "@effect/io/Effect";
|
|
3
3
|
import { Cache } from "dfx";
|
|
4
|
-
export declare const guilds: <RM, EM, E>(driver: Effect<RM, EM, Cache.CacheDriver<E, import("../types.js").Guild>>) => Effect<RM, EM, {
|
|
5
|
-
get: (id: string) => Effect<
|
|
6
|
-
run: Effect<
|
|
4
|
+
export declare const guilds: <RM, EM, E>(driver: Effect<RM, EM, Cache.CacheDriver<E, import("../types.js").Guild>>) => Effect<import("dfx").DiscordREST | import("../DiscordGateway/index.js").DiscordGateway, never, Effect<RM, EM, {
|
|
5
|
+
get: (id: string) => Effect<never, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError | E, import("../types.js").Guild>;
|
|
6
|
+
run: Effect<never, E, void>;
|
|
7
7
|
size: Effect<never, E, number>;
|
|
8
8
|
set: (resourceId: string, resource: import("../types.js").Guild) => Effect<never, E, void>;
|
|
9
9
|
delete: (resourceId: string) => Effect<never, E, void>;
|
|
10
10
|
refreshTTL: (resourceId: string) => Effect<never, E, void>;
|
|
11
|
-
}
|
|
12
|
-
export declare const channels: <RM, EM, E>(driver: Effect<RM, EM, Cache.ParentCacheDriver<E, import("../types.js").Channel>>) => Effect<RM, EM, {
|
|
13
|
-
get: (parentId: string, id: string) => Effect<
|
|
14
|
-
getForParent: (parentId: string) => Effect<
|
|
15
|
-
run: Effect<
|
|
11
|
+
}>>;
|
|
12
|
+
export declare const channels: <RM, EM, E>(driver: Effect<RM, EM, Cache.ParentCacheDriver<E, import("../types.js").Channel>>) => Effect<import("dfx").DiscordREST | import("../DiscordGateway/index.js").DiscordGateway, never, Effect<RM, EM, {
|
|
13
|
+
get: (parentId: string, id: string) => Effect<never, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError | E, import("../types.js").Channel>;
|
|
14
|
+
getForParent: (parentId: string) => Effect<never, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError | E, ReadonlyMap<string, import("../types.js").Channel>>;
|
|
15
|
+
run: Effect<never, E, void>;
|
|
16
16
|
size: Effect<never, E, number>;
|
|
17
17
|
sizeForParent: (parentId: string) => Effect<never, E, number>;
|
|
18
18
|
set: (parentId: string, resourceId: string, resource: import("../types.js").Channel) => Effect<never, E, void>;
|
|
19
19
|
delete: (parentId: string, resourceId: string) => Effect<never, E, void>;
|
|
20
20
|
parentDelete: (parentId: string) => Effect<never, E, void>;
|
|
21
21
|
refreshTTL: (parentId: string, resourceId: string) => Effect<never, E, void>;
|
|
22
|
-
}
|
|
23
|
-
export declare const roles: <RM, EM, E>(driver: Effect<RM, EM, Cache.ParentCacheDriver<E, import("../types.js").Role>>) => Effect<RM, EM, {
|
|
22
|
+
}>>;
|
|
23
|
+
export declare const roles: <RM, EM, E>(driver: Effect<RM, EM, Cache.ParentCacheDriver<E, import("../types.js").Role>>) => Effect<import("dfx").DiscordREST | import("../DiscordGateway/index.js").DiscordGateway, never, Effect<RM, EM, {
|
|
24
24
|
get: (parentId: string, id: string) => Effect<never, Cache.CacheMissError | E, import("../types.js").Role>;
|
|
25
|
-
getForParent: (parentId: string) => Effect<
|
|
26
|
-
run: Effect<
|
|
25
|
+
getForParent: (parentId: string) => Effect<never, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError | E, ReadonlyMap<string, import("../types.js").Role>>;
|
|
26
|
+
run: Effect<never, E, void>;
|
|
27
27
|
size: Effect<never, E, number>;
|
|
28
28
|
sizeForParent: (parentId: string) => Effect<never, E, number>;
|
|
29
29
|
set: (parentId: string, resourceId: string, resource: import("../types.js").Role) => Effect<never, E, void>;
|
|
30
30
|
delete: (parentId: string, resourceId: string) => Effect<never, E, void>;
|
|
31
31
|
parentDelete: (parentId: string) => Effect<never, E, void>;
|
|
32
32
|
refreshTTL: (parentId: string, resourceId: string) => Effect<never, E, void>;
|
|
33
|
-
}
|
|
33
|
+
}>>;
|
package/Cache/prelude.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "
|
|
2
|
-
import * as tsplus_module_2 from "
|
|
1
|
+
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
|
+
import * as tsplus_module_2 from "dfx";
|
|
3
3
|
import { Cache } from "dfx";
|
|
4
4
|
import { CacheOps } from "dfx/gateway";
|
|
5
|
-
export const guilds = (driver) => Cache.make({
|
|
5
|
+
export const guilds = (driver) => tsplus_module_1.flatMap(ops => tsplus_module_1.map(rest => Cache.make({
|
|
6
6
|
driver,
|
|
7
|
-
ops
|
|
8
|
-
onMiss: (id) =>
|
|
9
|
-
});
|
|
10
|
-
export const channels = (driver) => Cache.makeParent({
|
|
7
|
+
ops,
|
|
8
|
+
onMiss: (id) => tsplus_module_1.flatMap((r) => r.json)(rest.routes.getGuild(id)),
|
|
9
|
+
}))(tsplus_module_1.service(tsplus_module_2.DiscordREST)))(CacheOps.guilds);
|
|
10
|
+
export const channels = (driver) => tsplus_module_1.flatMap(ops => tsplus_module_1.map(({ routes: rest }) => Cache.makeParent({
|
|
11
11
|
driver,
|
|
12
|
-
ops
|
|
13
|
-
onMiss: (id) =>
|
|
14
|
-
onParentMiss: (guildId) =>
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
ops,
|
|
13
|
+
onMiss: (id) => tsplus_module_1.flatMap((r) => r.json)(rest.getChannel(id)),
|
|
14
|
+
onParentMiss: (guildId) => tsplus_module_1.map((a) => a.map((a) => [a.id, a]))(tsplus_module_1.flatMap((r) => r.json)(rest
|
|
15
|
+
.getGuildChannels(guildId))),
|
|
16
|
+
}))(tsplus_module_1.service(tsplus_module_2.DiscordREST)))(CacheOps.channels);
|
|
17
|
+
export const roles = (driver) => tsplus_module_1.flatMap(ops => tsplus_module_1.map(({ routes: rest }) => Cache.makeParent({
|
|
17
18
|
driver,
|
|
18
|
-
ops
|
|
19
|
-
onMiss: (id) =>
|
|
20
|
-
onParentMiss: (guildId) =>
|
|
21
|
-
|
|
19
|
+
ops,
|
|
20
|
+
onMiss: (id) => tsplus_module_1.fail(new Cache.CacheMissError("RolesCache", id)),
|
|
21
|
+
onParentMiss: (guildId) => tsplus_module_1.map((a) => a.map((a) => [a.id, a]))(tsplus_module_1.flatMap((r) => r.json)(rest
|
|
22
|
+
.getGuildRoles(guildId))),
|
|
23
|
+
}))(tsplus_module_1.service(tsplus_module_2.DiscordREST)))(CacheOps.roles);
|
|
22
24
|
//# sourceMappingURL=prelude.js.map
|
package/Cache/prelude.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prelude.js","sourceRoot":"","sources":["../../src/Cache/prelude.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAA2D,EAC3D,EAAE,
|
|
1
|
+
{"version":3,"file":"prelude.js","sourceRoot":"","sources":["../../src/Cache/prelude.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAA2D,EAC3D,EAAE,yBAEM,GAAG,wBACH,IAAI,IAEH,KAAK,CAAC,IAAI,CAAC;IAChB,MAAM;IACN,GAAG;IACH,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,wBAAiC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAA9C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAuB;CAChE,CAAC,EANa,wCAAe,WAAW,CAAC,GAD5B,QAAQ,CAAC,MAAM,CAQ7B,CAAA;AAEJ,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,MAAmE,EACnE,EAAE,yBAEM,GAAG,yBACH,EAAE,MAAM,EAAE,IAAI,EAAE,KAEf,KAAK,CAAC,UAAU,CAAC;IACtB,MAAM;IACN,GAAG;IACH,MAAM,EAAE,CAAC,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
|
|
19
19
|
export declare const DiscordWSCodec: import("../../global.js").Tag<DiscordWSCodec>;
|
|
20
20
|
export declare const LiveJsonDiscordWSCodec: import("../../global.js").Layer<never, never, DiscordWSCodec>;
|
|
21
|
-
export declare const make: ({ url, version, outbound, }: OpenOpts) => import("../../global.js").Effect<import("../../Log/index.js").Log
|
|
21
|
+
export declare const make: ({ url, version, outbound, }: OpenOpts) => import("../../global.js").Effect<DiscordWSCodec | import("../../Log/index.js").Log, never, {
|
|
22
22
|
source: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
23
23
|
setUrl: (url: string) => import("../../global.js").Effect<never, never, void>;
|
|
24
24
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DiscordWS } from "dfx/gateway";
|
|
2
2
|
import { Discord } from "dfx";
|
|
3
|
-
export declare const make: (shard: [id: number, count: number]) => import("../../global.js").Effect<import("
|
|
3
|
+
export declare const make: (shard: [id: number, count: number]) => import("../../global.js").Effect<import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | import("../../DiscordConfig/index.js").DiscordConfig | import("../../RateLimit/index.js").RateLimiter, never, {
|
|
4
4
|
run: import("../../global.js").Effect<never, never, void>;
|
|
5
5
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
6
6
|
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { Effect } from "@effect/io/Effect";
|
|
2
2
|
import { Maybe, Discord } from "dfx";
|
|
3
3
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
4
|
+
import { Success } from "dfx/utils/effect";
|
|
4
5
|
import { ShardStore } from "../ShardStore/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
declare const make: import("../../global.js").Effect<import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | ShardStore | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").DiscordREST | import("../../RateLimit/index.js").RateLimiter, never, {
|
|
7
|
+
shards: import("callbag-effect-ts/Source").EffectSource<never, never, {
|
|
8
|
+
run: import("../../global.js").Effect<never, never, void>;
|
|
9
|
+
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
10
|
+
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
|
|
11
|
+
send: (p: import("../../types.js").GatewayPayload<any>) => import("../../global.js").Effect<never, never, boolean>;
|
|
12
|
+
reconnect: import("../../global.js").Effect<never, never, boolean>;
|
|
13
|
+
}>;
|
|
11
14
|
}>;
|
|
15
|
+
export interface Sharder extends Success<typeof make> {
|
|
16
|
+
}
|
|
17
|
+
export declare const Sharder: import("../../global.js").Tag<Sharder>;
|
|
18
|
+
export declare const LiveSharder: import("../../global.js").Layer<import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | ShardStore | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").DiscordREST | import("../../RateLimit/index.js").RateLimiter, never, Sharder>;
|
|
19
|
+
export {};
|
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "callbag-effect-ts/Source/fromEffect";
|
|
2
|
-
import * as tsplus_module_2 from "callbag-effect-ts/Source/
|
|
3
|
-
import * as tsplus_module_3 from "callbag-effect-ts/Source/
|
|
4
|
-
import * as tsplus_module_4 from "
|
|
5
|
-
import * as tsplus_module_5 from "@
|
|
6
|
-
import * as tsplus_module_6 from "
|
|
7
|
-
import * as tsplus_module_7 from "
|
|
8
|
-
import * as tsplus_module_8 from "callbag-effect-ts/Source/
|
|
9
|
-
import * as tsplus_module_9 from "
|
|
10
|
-
import * as tsplus_module_10 from "callbag-effect-ts/Source/
|
|
11
|
-
import * as tsplus_module_11 from "callbag-effect-ts/Source/
|
|
12
|
-
import * as tsplus_module_12 from "callbag-effect-ts/Source/
|
|
13
|
-
import * as tsplus_module_13 from "
|
|
14
|
-
import * as tsplus_module_14 from "
|
|
15
|
-
import * as tsplus_module_15 from "callbag-effect-ts/Source/
|
|
16
|
-
import * as tsplus_module_16 from "callbag-effect-ts/Source/
|
|
17
|
-
import * as tsplus_module_17 from "
|
|
2
|
+
import * as tsplus_module_2 from "callbag-effect-ts/Source/drain";
|
|
3
|
+
import * as tsplus_module_3 from "callbag-effect-ts/Source/of";
|
|
4
|
+
import * as tsplus_module_4 from "callbag-effect-ts/Source/merge";
|
|
5
|
+
import * as tsplus_module_5 from "@effect/io/Effect";
|
|
6
|
+
import * as tsplus_module_6 from "dfx/gateway";
|
|
7
|
+
import * as tsplus_module_7 from "callbag-effect-ts/Source/tap";
|
|
8
|
+
import * as tsplus_module_8 from "callbag-effect-ts/Source/mapEffect";
|
|
9
|
+
import * as tsplus_module_9 from "callbag-effect-ts/Source/map";
|
|
10
|
+
import * as tsplus_module_10 from "callbag-effect-ts/Source/groupBy";
|
|
11
|
+
import * as tsplus_module_11 from "callbag-effect-ts/Source/chainPar";
|
|
12
|
+
import * as tsplus_module_12 from "callbag-effect-ts/Source/share";
|
|
13
|
+
import * as tsplus_module_13 from "@fp-ts/data/Duration";
|
|
14
|
+
import * as tsplus_module_14 from "@fp-ts/data/Option";
|
|
15
|
+
import * as tsplus_module_15 from "callbag-effect-ts/Source/empty";
|
|
16
|
+
import * as tsplus_module_16 from "callbag-effect-ts/Source/resource";
|
|
17
|
+
import * as tsplus_module_17 from "dfx";
|
|
18
|
+
import * as tsplus_module_18 from "@fp-ts/data/Context";
|
|
18
19
|
import { millis } from "@fp-ts/data/Duration";
|
|
19
20
|
import { overridePull } from "callbag-effect-ts/Source";
|
|
20
21
|
import { ShardStore } from "../ShardStore/index.js";
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
tsplus_module_5.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
tsplus_module_5.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
id
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
|
|
22
|
+
const make = tsplus_module_5.flatMap(store => tsplus_module_5.flatMap(({ routes: rest }) => tsplus_module_5.flatMap(({ gateway: config }) => tsplus_module_5.flatMap(limiter => {
|
|
23
|
+
const configs = (totalCount) => {
|
|
24
|
+
const claimId = (sharderCount) => tsplus_module_5.flatMap((a) => tsplus_module_14.match(() => tsplus_module_5.delay(tsplus_module_13.minutes(3))(tsplus_module_5.succeed([
|
|
25
|
+
tsplus_module_14.some(sharderCount),
|
|
26
|
+
tsplus_module_15.empty,
|
|
27
|
+
])), (id) => tsplus_module_5.succeed([
|
|
28
|
+
tsplus_module_14.some(sharderCount + 1),
|
|
29
|
+
tsplus_module_3.of(id),
|
|
30
|
+
]))(a))(store
|
|
31
|
+
.claimId({
|
|
32
|
+
totalCount,
|
|
33
|
+
sharderCount,
|
|
34
|
+
}));
|
|
35
|
+
return tsplus_module_9.map((id) => ({
|
|
36
|
+
id,
|
|
37
|
+
totalCount,
|
|
38
|
+
}))(tsplus_module_16.resource(0, (sharderCount) => tsplus_module_1.fromEffect(claimId(sharderCount))));
|
|
39
|
+
};
|
|
40
|
+
return tsplus_module_5.flatMap(gateway => {
|
|
41
|
+
const [source, pull] = overridePull(configs(config.shardCount ?? gateway.shards), gateway.session_start_limit.max_concurrency);
|
|
42
|
+
return tsplus_module_5.map(shards => ({ shards }))(tsplus_module_12.share(tsplus_module_11.chainPar((shard) => tsplus_module_4.merge(tsplus_module_2.drain(tsplus_module_1.fromEffect(shard.run)))(tsplus_module_3.of(shard)))(tsplus_module_7.tap(() => tsplus_module_5.sync(pull))(tsplus_module_11.chainPar(([shardConfig, key]) => tsplus_module_8.mapEffect((c) => tsplus_module_6.Shard.make([c.id, c.totalCount]))(tsplus_module_7.tap(() => limiter.maybeWait(`dfx.sharder.${key}`, millis(config.identifyRateLimit[0]), config.identifyRateLimit[1]))(shardConfig)))(tsplus_module_10.groupBy((c) => c.id % c.concurrency)(tsplus_module_9.map((config) => ({
|
|
43
|
+
...config,
|
|
44
|
+
url: gateway.url,
|
|
45
|
+
concurrency: gateway.session_start_limit.max_concurrency,
|
|
46
|
+
}))(source)))))));
|
|
47
|
+
})(tsplus_module_5.catchAll(() => tsplus_module_5.succeed({
|
|
47
48
|
url: "wss://gateway.discord.gg/",
|
|
48
49
|
shards: 1,
|
|
49
50
|
session_start_limit: {
|
|
@@ -52,9 +53,9 @@ const spawnEffect = tsplus_module_7.map(({ gateway, config, configs, limiter })
|
|
|
52
53
|
reset_after: 0,
|
|
53
54
|
max_concurrency: 1,
|
|
54
55
|
},
|
|
55
|
-
}))(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export const
|
|
56
|
+
}))(tsplus_module_5.flatMap((r) => r.json)(rest
|
|
57
|
+
.getGatewayBot())));
|
|
58
|
+
})(tsplus_module_5.service(tsplus_module_17.RateLimit.RateLimiter)))(tsplus_module_5.service(tsplus_module_17.Config.DiscordConfig)))(tsplus_module_5.service(tsplus_module_17.DiscordREST)))(tsplus_module_5.service(ShardStore));
|
|
59
|
+
export const Sharder = tsplus_module_18.Tag();
|
|
60
|
+
export const LiveSharder = tsplus_module_5.toLayer(Sharder)(make);
|
|
60
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Sharder/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Discord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AA,SAAS,CAAC,WAAW,CAAC,GADzB,wBAAe,iBAAA,MAAM,CAAC,aAAa,CAAC,GADvC,yCAAe,WAAW,CAAC,GADtC,wBAAe,UAAU,CAAC,CA2F1C,CAAA;AAGF,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAA,GAAG,EAAW,CAAA;AACrC,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAa,OAAO,EAApB,IAAI,CAAiB,CAAA"}
|
|
@@ -2,14 +2,8 @@ import { EffectSource } from "callbag-effect-ts/Source";
|
|
|
2
2
|
import { Discord } from "dfx";
|
|
3
3
|
import { Effect } from "@effect/io/Effect";
|
|
4
4
|
import { Success } from "dfx/utils/effect";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
run: import("../global.js").Effect<never, never, void>;
|
|
8
|
-
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<any>>;
|
|
9
|
-
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<import("../types.js").ReceiveEvent>>;
|
|
10
|
-
send: (p: import("../types.js").GatewayPayload<any>) => import("../global.js").Effect<never, never, boolean>;
|
|
11
|
-
reconnect: import("../global.js").Effect<never, never, boolean>;
|
|
12
|
-
}>;
|
|
5
|
+
import { Sharder } from "./Sharder/index.js";
|
|
6
|
+
export declare const make: import("../global.js").Effect<Sharder, never, {
|
|
13
7
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<any>>;
|
|
14
8
|
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<import("../types.js").ReceiveEvent>>;
|
|
15
9
|
fromDispatch: <K extends keyof import("../types.js").ReceiveEvents>(event: K) => import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").ReceiveEvents[K]>;
|
|
@@ -18,6 +12,4 @@ export declare const make: import("../global.js").Effect<import("../Log/index.js
|
|
|
18
12
|
export interface DiscordGateway extends Success<typeof make> {
|
|
19
13
|
}
|
|
20
14
|
export declare const DiscordGateway: import("../global.js").Tag<DiscordGateway>;
|
|
21
|
-
export declare const LiveDiscordGateway: import("../global.js").Layer<
|
|
22
|
-
export declare const fromDispatch: <K extends keyof import("../types.js").ReceiveEvents>(event: K) => import("callbag-effect-ts/Source").EffectSource<DiscordGateway, never, import("../types.js").ReceiveEvents[K]>;
|
|
23
|
-
export declare const handleDispatch: <K extends keyof import("../types.js").ReceiveEvents, R1, E1, A>(event: K, handle: (event: import("../types.js").ReceiveEvents[K]) => import("../global.js").Effect<R1, E1, A>) => import("../global.js").Effect<DiscordGateway | R1, E1, void>;
|
|
15
|
+
export declare const LiveDiscordGateway: import("../global.js").Layer<Sharder, never, DiscordGateway>;
|
package/DiscordGateway/index.js
CHANGED
|
@@ -7,23 +7,19 @@ import * as tsplus_module_6 from "callbag-effect-ts/Source/share";
|
|
|
7
7
|
import * as tsplus_module_7 from "@effect/io/Effect";
|
|
8
8
|
import * as tsplus_module_8 from "@fp-ts/data/Context";
|
|
9
9
|
import * as tsplus_module_9 from "@effect/io/Layer";
|
|
10
|
-
import
|
|
11
|
-
import { spawn } from "./Sharder/index.js";
|
|
10
|
+
import { Sharder } from "./Sharder/index.js";
|
|
12
11
|
const fromDispatchFactory = (source) => (event) => tsplus_module_2.map((p) => p.d)(tsplus_module_1.filter((p) => p.t === event)(source));
|
|
13
12
|
const handleDispatchFactory = (source) => (event, handle) => tsplus_module_5.runDrain(tsplus_module_4.chainPar((a) => tsplus_module_3.fromEffect(handle(a.d)))(tsplus_module_1.filter((p) => p.t === event)(source)));
|
|
14
|
-
export const make = tsplus_module_7.flatMap(
|
|
13
|
+
export const make = tsplus_module_7.flatMap(sharder => tsplus_module_7.flatMap(raw => tsplus_module_7.map(dispatch => {
|
|
15
14
|
const fromDispatch = fromDispatchFactory(dispatch);
|
|
16
15
|
const handleDispatch = handleDispatchFactory(dispatch);
|
|
17
16
|
return {
|
|
18
|
-
shards,
|
|
19
17
|
raw,
|
|
20
18
|
dispatch,
|
|
21
19
|
fromDispatch,
|
|
22
20
|
handleDispatch,
|
|
23
21
|
};
|
|
24
|
-
})(tsplus_module_6.share(tsplus_module_4.chainPar((s) => s.dispatch)(shards))))(tsplus_module_6.share(tsplus_module_4.chainPar((s) => s.raw)(shards))))(
|
|
22
|
+
})(tsplus_module_6.share(tsplus_module_4.chainPar((s) => s.dispatch)(sharder.shards))))(tsplus_module_6.share(tsplus_module_4.chainPar((s) => s.raw)(sharder.shards))))(tsplus_module_7.service(Sharder));
|
|
25
23
|
export const DiscordGateway = tsplus_module_8.Tag();
|
|
26
24
|
export const LiveDiscordGateway = tsplus_module_9.fromEffect(DiscordGateway)(make);
|
|
27
|
-
export const fromDispatch = (event) => tsplus_module_10.unwrap(tsplus_module_7.serviceWith(DiscordGateway)((a) => a.fromDispatch(event)));
|
|
28
|
-
export const handleDispatch = (event, handle) => tsplus_module_7.serviceWithEffect(DiscordGateway)((a) => a.handleDispatch(event, handle));
|
|
29
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordGateway/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordGateway/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,MAAM,mBAAmB,GACvB,CACE,MAAwE,EACxE,EAAE,CACJ,CACE,KAAQ,EACsC,EAAE,CAChD,oBAAwC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAS,EAA1D,uBAAc,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAlC,MAAM,CAA6B,CAAwB,CAAA;AAE/D,MAAM,qBAAqB,GACzB,CACE,MAAwE,EACxE,EAAE,CACJ,CACE,KAAQ,EACR,MAA8D,EAChC,EAAE,0BAChC,yBAEY,CAAC,CAAC,EAAE,EAAE,CAAC,2BAAwB,MAAM,CAAC,CAAC,CAAC,CAAQ,CAAC,CAAC,EAF9D,uBACU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAD9B,MAAM,CACyB,CACgC,CAAS,CAAA;AAE5E,MAAM,CAAC,MAAM,IAAI,2BACT,OAAO,4BACP,GAAG,wBACH,QAAQ;IACd,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IAClD,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAA;IAEtD,OAAO;QACL,GAAG;QACH,QAAQ;QACR,YAAY;QACZ,cAAc;KACf,CAAA;yBATkB,yBAAwB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAzC,OAAO,CAAC,MAAM,CAA4B,0BAD/C,yBAAwB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAApC,OAAO,CAAC,MAAM,CAAuB,IADjC,wBAAe,OAAO,CAAC,CAYzC,CAAA;AAGF,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAA,GAAG,EAAkB,CAAA;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAAiB,cAAc,CAAC,CAAC,IAAI,CAAC,CAAA"}
|
package/DiscordREST/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RateLimit, Http } from "dfx";
|
|
1
|
+
import { RateLimit, Http, Discord } from "dfx";
|
|
2
2
|
import { Effect } from "@effect/io/Effect";
|
|
3
3
|
import { Success } from "dfx/utils/effect";
|
|
4
4
|
import { ResponseWithData } from "./types.js";
|
|
5
|
-
declare const make: import("../global.js").Effect<import("../Log/index.js").Log | import("../
|
|
5
|
+
declare const make: import("../global.js").Effect<import("../Log/index.js").Log | import("../DiscordConfig/index.js").DiscordConfig | import("../Http/index.js").Http | import("../RateLimit/index.js").RateLimitStore | import("../RateLimit/index.js").RateLimiter, never, {
|
|
6
6
|
request: <A = unknown>(path: string, init?: RequestInit) => import("../global.js").Effect<never, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError, ResponseWithData<A>>;
|
|
7
|
+
routes: import("../types.js").Endpoints<RequestInit>;
|
|
7
8
|
}>;
|
|
8
9
|
export interface DiscordREST extends Success<typeof make> {
|
|
9
10
|
}
|
|
10
11
|
export declare const DiscordREST: import("../global.js").Tag<DiscordREST>;
|
|
11
|
-
export declare const LiveDiscordREST: import("../global.js").Layer<import("../Log/index.js").Log | import("../
|
|
12
|
-
export declare const rest: import("../types.js").Endpoints<RequestInit>;
|
|
12
|
+
export declare const LiveDiscordREST: import("../global.js").Layer<import("../Log/index.js").Log | import("../DiscordConfig/index.js").DiscordConfig | import("../Http/index.js").Http | import("../RateLimit/index.js").RateLimitStore | import("../RateLimit/index.js").RateLimiter, never, DiscordREST>;
|
|
13
13
|
export {};
|