dfx 0.77.3 → 0.78.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/Cache/prelude.d.ts +3 -3
- package/DiscordConfig.d.ts +5 -7
- package/DiscordConfig.d.ts.map +1 -1
- package/DiscordConfig.js +1 -3
- package/DiscordConfig.js.map +1 -1
- package/DiscordGateway/DiscordWS.d.ts +12 -11
- package/DiscordGateway/DiscordWS.d.ts.map +1 -1
- package/DiscordGateway/DiscordWS.js +8 -5
- package/DiscordGateway/DiscordWS.js.map +1 -1
- package/DiscordGateway/Messaging.d.ts +28 -0
- package/DiscordGateway/Messaging.d.ts.map +1 -0
- package/DiscordGateway/Messaging.js +41 -0
- package/DiscordGateway/Messaging.js.map +1 -0
- package/DiscordGateway/Shard.d.ts +14 -11
- package/DiscordGateway/Shard.d.ts.map +1 -1
- package/DiscordGateway/Shard.js +20 -17
- package/DiscordGateway/Shard.js.map +1 -1
- package/DiscordGateway/ShardStore.d.ts +5 -2
- package/DiscordGateway/ShardStore.d.ts.map +1 -1
- package/DiscordGateway/ShardStore.js +1 -1
- package/DiscordGateway/ShardStore.js.map +1 -1
- package/DiscordGateway/Sharder.d.ts +9 -18
- package/DiscordGateway/Sharder.d.ts.map +1 -1
- package/DiscordGateway/Sharder.js +36 -45
- package/DiscordGateway/Sharder.js.map +1 -1
- package/DiscordGateway/WS.d.ts +14 -10
- package/DiscordGateway/WS.d.ts.map +1 -1
- package/DiscordGateway/WS.js +31 -21
- package/DiscordGateway/WS.js.map +1 -1
- package/DiscordGateway.d.ts +10 -7
- package/DiscordGateway.d.ts.map +1 -1
- package/DiscordGateway.js +13 -31
- package/DiscordGateway.js.map +1 -1
- package/DiscordREST.d.ts +6 -4
- package/DiscordREST.d.ts.map +1 -1
- package/DiscordREST.js +7 -6
- package/DiscordREST.js.map +1 -1
- package/Interactions/context.d.ts +35 -17
- package/Interactions/context.d.ts.map +1 -1
- package/Interactions/context.js +6 -6
- package/Interactions/context.js.map +1 -1
- package/Interactions/definitions.d.ts +11 -11
- package/Interactions/definitions.d.ts.map +1 -1
- package/Interactions/definitions.js.map +1 -1
- package/Interactions/gateway.d.ts +7 -6
- package/Interactions/gateway.d.ts.map +1 -1
- package/Interactions/gateway.js +1 -1
- package/Interactions/gateway.js.map +1 -1
- package/Interactions/handlers.d.ts +2 -1
- package/Interactions/handlers.d.ts.map +1 -1
- package/Interactions/webhook.d.ts +5 -6
- package/Interactions/webhook.d.ts.map +1 -1
- package/Interactions/webhook.js +1 -1
- package/Interactions/webhook.js.map +1 -1
- package/RateLimit/memory.d.ts +2 -2
- package/RateLimit/memory.d.ts.map +1 -1
- package/RateLimit/memory.js.map +1 -1
- package/RateLimit.d.ts +10 -9
- package/RateLimit.d.ts.map +1 -1
- package/RateLimit.js +4 -5
- package/RateLimit.js.map +1 -1
- package/gateway.d.ts +2 -2
- package/gateway.d.ts.map +1 -1
- package/gateway.js +1 -2
- package/gateway.js.map +1 -1
- package/index.d.ts +1 -2
- package/index.d.ts.map +1 -1
- package/index.js +1 -3
- package/index.js.map +1 -1
- package/mjs/DiscordConfig.mjs +1 -3
- package/mjs/DiscordConfig.mjs.map +1 -1
- package/mjs/DiscordGateway/DiscordWS.mjs +8 -5
- package/mjs/DiscordGateway/DiscordWS.mjs.map +1 -1
- package/mjs/DiscordGateway/Messaging.mjs +33 -0
- package/mjs/DiscordGateway/Messaging.mjs.map +1 -0
- package/mjs/DiscordGateway/Shard.mjs +20 -17
- package/mjs/DiscordGateway/Shard.mjs.map +1 -1
- package/mjs/DiscordGateway/ShardStore.mjs +1 -1
- package/mjs/DiscordGateway/ShardStore.mjs.map +1 -1
- package/mjs/DiscordGateway/Sharder.mjs +35 -44
- package/mjs/DiscordGateway/Sharder.mjs.map +1 -1
- package/mjs/DiscordGateway/WS.mjs +32 -22
- package/mjs/DiscordGateway/WS.mjs.map +1 -1
- package/mjs/DiscordGateway.mjs +12 -30
- package/mjs/DiscordGateway.mjs.map +1 -1
- package/mjs/DiscordREST.mjs +7 -6
- package/mjs/DiscordREST.mjs.map +1 -1
- package/mjs/Interactions/context.mjs +6 -6
- package/mjs/Interactions/context.mjs.map +1 -1
- package/mjs/Interactions/definitions.mjs.map +1 -1
- package/mjs/Interactions/gateway.mjs +1 -1
- package/mjs/Interactions/gateway.mjs.map +1 -1
- package/mjs/Interactions/webhook.mjs +1 -1
- package/mjs/Interactions/webhook.mjs.map +1 -1
- package/mjs/RateLimit/memory.mjs.map +1 -1
- package/mjs/RateLimit.mjs +4 -5
- package/mjs/RateLimit.mjs.map +1 -1
- package/mjs/gateway.mjs +1 -2
- package/mjs/gateway.mjs.map +1 -1
- package/mjs/index.mjs +1 -2
- package/mjs/index.mjs.map +1 -1
- package/mjs/version.mjs +1 -1
- package/mjs/webhooks.mjs +1 -2
- package/mjs/webhooks.mjs.map +1 -1
- package/package.json +2 -2
- package/src/DiscordConfig.ts +7 -9
- package/src/DiscordGateway/DiscordWS.ts +23 -13
- package/src/DiscordGateway/Messaging.ts +72 -0
- package/src/DiscordGateway/Shard.ts +51 -33
- package/src/DiscordGateway/ShardStore.ts +8 -3
- package/src/DiscordGateway/Sharder.ts +72 -97
- package/src/DiscordGateway/WS.ts +64 -32
- package/src/DiscordGateway.ts +22 -71
- package/src/DiscordREST.ts +40 -27
- package/src/Interactions/context.ts +47 -10
- package/src/Interactions/definitions.ts +22 -20
- package/src/Interactions/gateway.ts +14 -6
- package/src/Interactions/handlers.ts +1 -1
- package/src/Interactions/webhook.ts +18 -4
- package/src/RateLimit/memory.ts +2 -2
- package/src/RateLimit.ts +17 -8
- package/src/gateway.ts +0 -2
- package/src/index.ts +0 -2
- package/src/version.ts +1 -1
- package/src/webhooks.ts +1 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/webhooks.d.ts +1 -2
- package/webhooks.d.ts.map +1 -1
- package/webhooks.js +1 -2
- package/webhooks.js.map +1 -1
- package/src/Log.ts +0 -24
|
@@ -11,7 +11,10 @@ import * as Layer from "effect/Layer"
|
|
|
11
11
|
import type * as D from "dfx/Interactions/definitions"
|
|
12
12
|
import type { DefinitionNotFound } from "dfx/Interactions/handlers"
|
|
13
13
|
import { handlers } from "dfx/Interactions/handlers"
|
|
14
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
DiscordInteraction,
|
|
16
|
+
InteractionBuilder,
|
|
17
|
+
} from "dfx/Interactions/index"
|
|
15
18
|
import { Interaction } from "dfx/Interactions/index"
|
|
16
19
|
import type * as Discord from "dfx/types"
|
|
17
20
|
import * as Verify from "discord-verify"
|
|
@@ -68,8 +71,12 @@ const makeConfig = ({
|
|
|
68
71
|
algorithm: Verify.PlatformAlgorithm[algorithm],
|
|
69
72
|
})
|
|
70
73
|
|
|
71
|
-
export interface WebhookConfig
|
|
72
|
-
|
|
74
|
+
export interface WebhookConfig {
|
|
75
|
+
readonly _: unique symbol
|
|
76
|
+
}
|
|
77
|
+
export const WebhookConfig = Tag<WebhookConfig, ReturnType<typeof makeConfig>>(
|
|
78
|
+
"dfx/Interactions/WebhookConfig",
|
|
79
|
+
)
|
|
73
80
|
|
|
74
81
|
export const layer = (opts: MakeConfigOpts) =>
|
|
75
82
|
Layer.succeed(WebhookConfig, makeConfig(opts))
|
|
@@ -112,7 +119,14 @@ const run = <R, E>(
|
|
|
112
119
|
) => Effect.Effect<R, E, Discord.InteractionResponse>,
|
|
113
120
|
) => {
|
|
114
121
|
const handler = handlers(definitions, handleResponse)
|
|
115
|
-
return (
|
|
122
|
+
return (
|
|
123
|
+
headers: Headers,
|
|
124
|
+
body: string,
|
|
125
|
+
): Effect.Effect<
|
|
126
|
+
WebhookConfig | Exclude<R, DiscordInteraction>,
|
|
127
|
+
BadWebhookSignature | WebhookParseError | E | DefinitionNotFound,
|
|
128
|
+
Discord.InteractionResponse
|
|
129
|
+
> =>
|
|
116
130
|
Effect.flatMap(fromHeadersAndBody(headers, body), interaction =>
|
|
117
131
|
Effect.provideService(
|
|
118
132
|
handler[interaction.type](interaction),
|
package/src/RateLimit/memory.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as Option from "effect/Option"
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
|
-
import type { BucketDetails,
|
|
3
|
+
import type { BucketDetails, RateLimitStoreService } from "dfx/RateLimit"
|
|
4
4
|
|
|
5
5
|
interface Counter {
|
|
6
6
|
count: number
|
|
7
7
|
expires: number
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const make = ():
|
|
10
|
+
export const make = (): RateLimitStoreService => {
|
|
11
11
|
const buckets = new Map<string, BucketDetails>()
|
|
12
12
|
const routes = new Map<string, string>()
|
|
13
13
|
const counters = new Map<string, Counter>()
|
package/src/RateLimit.ts
CHANGED
|
@@ -3,7 +3,6 @@ import * as Duration from "effect/Duration"
|
|
|
3
3
|
import type * as Option from "effect/Option"
|
|
4
4
|
import * as Effect from "effect/Effect"
|
|
5
5
|
import * as Layer from "effect/Layer"
|
|
6
|
-
import { Log } from "dfx/Log"
|
|
7
6
|
import * as Memory from "dfx/RateLimit/memory"
|
|
8
7
|
import { delayFrom } from "dfx/RateLimit/utils"
|
|
9
8
|
|
|
@@ -13,7 +12,7 @@ export type BucketDetails = {
|
|
|
13
12
|
limit: number
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export interface
|
|
15
|
+
export interface RateLimitStoreService {
|
|
17
16
|
readonly hasBucket: (
|
|
18
17
|
bucketKey: string,
|
|
19
18
|
) => Effect.Effect<never, never, boolean>
|
|
@@ -40,12 +39,17 @@ export interface RateLimitStore {
|
|
|
40
39
|
readonly removeCounter: (key: string) => Effect.Effect<never, never, void>
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
export
|
|
42
|
+
export interface RateLimitStore {
|
|
43
|
+
readonly _: unique symbol
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const RateLimitStore = Tag<RateLimitStore, RateLimitStoreService>(
|
|
47
|
+
"dfx/RateLimit/RateLimitStore",
|
|
48
|
+
)
|
|
44
49
|
export const MemoryRateLimitStoreLive = Layer.sync(RateLimitStore, Memory.make)
|
|
45
50
|
|
|
46
51
|
const makeLimiter = Effect.gen(function* (_) {
|
|
47
52
|
const store = yield* _(RateLimitStore)
|
|
48
|
-
const log = yield* _(Log)
|
|
49
53
|
|
|
50
54
|
const maybeWait = (
|
|
51
55
|
key: string,
|
|
@@ -58,7 +62,8 @@ const makeLimiter = Effect.gen(function* (_) {
|
|
|
58
62
|
return store.incrementCounter(key, windowMs, limit).pipe(
|
|
59
63
|
Effect.map(([count, ttl]) => delayFrom(windowMs, limit, count, ttl)),
|
|
60
64
|
Effect.tap(d =>
|
|
61
|
-
|
|
65
|
+
Effect.annotateLogs(Effect.logTrace("maybeWait"), {
|
|
66
|
+
service: "RateLimit",
|
|
62
67
|
key,
|
|
63
68
|
window: Duration.toMillis(window),
|
|
64
69
|
windowMs,
|
|
@@ -76,7 +81,11 @@ const makeLimiter = Effect.gen(function* (_) {
|
|
|
76
81
|
return { maybeWait }
|
|
77
82
|
})
|
|
78
83
|
|
|
79
|
-
export interface RateLimiter
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
export interface RateLimiter {
|
|
85
|
+
readonly _: unique symbol
|
|
86
|
+
}
|
|
87
|
+
export const RateLimiter = Tag<
|
|
88
|
+
RateLimiter,
|
|
89
|
+
Effect.Effect.Success<typeof makeLimiter>
|
|
90
|
+
>("dfx/RateLimit/RateLimiter")
|
|
82
91
|
export const RateLimiterLive = Layer.effect(RateLimiter, makeLimiter)
|
package/src/gateway.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { MemoryShardStoreLive } from "dfx/DiscordGateway/ShardStore"
|
|
|
9
9
|
import * as WS from "dfx/DiscordGateway/WS"
|
|
10
10
|
import { DiscordRESTLive } from "dfx/DiscordREST"
|
|
11
11
|
import { InteractionsRegistryLive } from "dfx/Interactions/gateway"
|
|
12
|
-
import { LogLive } from "dfx/Log"
|
|
13
12
|
import { MemoryRateLimitStoreLive, RateLimiterLive } from "dfx/RateLimit"
|
|
14
13
|
import * as Layer from "effect/Layer"
|
|
15
14
|
|
|
@@ -33,7 +32,6 @@ export const DiscordLive = Layer.mergeAll(
|
|
|
33
32
|
Layer.provide(JsonDiscordWSCodecLive),
|
|
34
33
|
Layer.provide(MemoryRateLimitStoreLive),
|
|
35
34
|
Layer.provide(MemoryShardStoreLive),
|
|
36
|
-
Layer.provideMerge(LogLive),
|
|
37
35
|
)
|
|
38
36
|
|
|
39
37
|
export const DiscordIxLive = InteractionsRegistryLive.pipe(
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,6 @@ import * as Members from "dfx/Helpers/members"
|
|
|
7
7
|
import * as Perms from "dfx/Helpers/permissions"
|
|
8
8
|
import * as UI from "dfx/Helpers/ui"
|
|
9
9
|
import * as Ix from "dfx/Interactions/index"
|
|
10
|
-
import * as Log from "dfx/Log"
|
|
11
10
|
import * as Discord from "dfx/types"
|
|
12
11
|
|
|
13
12
|
export { DiscordREST, DiscordRESTLive } from "dfx/DiscordREST"
|
|
@@ -28,7 +27,6 @@ export {
|
|
|
28
27
|
Intents,
|
|
29
28
|
Ix,
|
|
30
29
|
IxHelpers,
|
|
31
|
-
Log,
|
|
32
30
|
Members,
|
|
33
31
|
Perms,
|
|
34
32
|
UI,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "0.
|
|
1
|
+
export const LIB_VERSION = "0.78.0";
|
package/src/webhooks.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DiscordRESTLive } from "dfx/DiscordREST"
|
|
2
|
-
import * as Log from "dfx/Log"
|
|
3
2
|
import {
|
|
4
3
|
MemoryRateLimitStoreLive as MemoryRateLimitStoreLive,
|
|
5
4
|
RateLimiterLive as RateLimiterLive,
|
|
@@ -19,4 +18,4 @@ export {
|
|
|
19
18
|
export const DiscordLive = Layer.mergeAll(
|
|
20
19
|
DiscordRESTLive,
|
|
21
20
|
RateLimiterLive,
|
|
22
|
-
).pipe(Layer.provide(MemoryRateLimitStoreLive)
|
|
21
|
+
).pipe(Layer.provide(MemoryRateLimitStoreLive))
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "0.
|
|
1
|
+
export declare const LIB_VERSION = "0.78.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/webhooks.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import * as Log from "dfx/Log";
|
|
2
1
|
import * as Layer from "effect/Layer";
|
|
3
2
|
export { BadWebhookSignature, WebhookConfig, WebhookParseError, makeHandler, makeSimpleHandler, layer as webhookLayer, layerConfig as webhookLayerConfig, } from "dfx/Interactions/webhook";
|
|
4
|
-
export declare const DiscordLive: Layer.Layer<import("./DiscordConfig").DiscordConfig, never,
|
|
3
|
+
export declare const DiscordLive: Layer.Layer<import("./DiscordConfig").DiscordConfig, never, import("dfx/RateLimit").RateLimiter | import("dfx/DiscordREST").DiscordREST>;
|
|
5
4
|
//# sourceMappingURL=webhooks.d.ts.map
|
package/webhooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["./src/webhooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["./src/webhooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,KAAK,IAAI,YAAY,EACrB,WAAW,IAAI,kBAAkB,GAClC,MAAM,0BAA0B,CAAA;AAEjC,eAAO,MAAM,WAAW,0IAGuB,CAAA"}
|
package/webhooks.js
CHANGED
|
@@ -47,11 +47,10 @@ Object.defineProperty(exports, "webhookLayerConfig", {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
var _DiscordREST = /*#__PURE__*/require("dfx/DiscordREST");
|
|
50
|
-
var Log = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("dfx/Log"));
|
|
51
50
|
var _RateLimit = /*#__PURE__*/require("dfx/RateLimit");
|
|
52
51
|
var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Layer"));
|
|
53
52
|
var _webhook = /*#__PURE__*/require("dfx/Interactions/webhook");
|
|
54
53
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
55
54
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
56
|
-
const DiscordLive = exports.DiscordLive = /*#__PURE__*/Layer.mergeAll(_DiscordREST.DiscordRESTLive, _RateLimit.RateLimiterLive).pipe( /*#__PURE__*/Layer.provide(_RateLimit.MemoryRateLimitStoreLive)
|
|
55
|
+
const DiscordLive = exports.DiscordLive = /*#__PURE__*/Layer.mergeAll(_DiscordREST.DiscordRESTLive, _RateLimit.RateLimiterLive).pipe( /*#__PURE__*/Layer.provide(_RateLimit.MemoryRateLimitStoreLive));
|
|
57
56
|
//# sourceMappingURL=webhooks.js.map
|
package/webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","names":["_DiscordREST","require","
|
|
1
|
+
{"version":3,"file":"webhooks.js","names":["_DiscordREST","require","_RateLimit","Layer","_interopRequireWildcard","_webhook","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","DiscordLive","exports","mergeAll","DiscordRESTLive","RateLimiterLive","pipe","provide","MemoryRateLimitStoreLive"],"sources":["./src/webhooks.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,gBAAAC,OAAA;AACA,IAAAC,UAAA,gBAAAD,OAAA;AAIA,IAAAE,KAAA,gBAAAC,uBAAA,eAAAH,OAAA;AAEA,IAAAI,QAAA,gBAAAJ,OAAA;AAQiC,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAE1B,MAAMY,WAAW,GAAAC,OAAA,CAAAD,WAAA,gBAAGxB,KAAK,CAAC0B,QAAQ,CACvCC,4BAAe,EACfC,0BAAe,CAChB,CAACC,IAAI,eAAC7B,KAAK,CAAC8B,OAAO,CAACC,mCAAwB,CAAC,CAAC"}
|
package/src/Log.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DiscordConfig } from "dfx/DiscordConfig"
|
|
2
|
-
import { Tag } from "effect/Context"
|
|
3
|
-
import * as Effect from "effect/Effect"
|
|
4
|
-
import * as Layer from "effect/Layer"
|
|
5
|
-
|
|
6
|
-
const make = (debug = false) => ({
|
|
7
|
-
info: (...args: Array<any>) =>
|
|
8
|
-
Effect.sync(() => {
|
|
9
|
-
console.error("INFO", ...args)
|
|
10
|
-
}),
|
|
11
|
-
debug: (...args: Array<any>) =>
|
|
12
|
-
debug
|
|
13
|
-
? Effect.sync(() => {
|
|
14
|
-
console.error("DEBUG", ...args)
|
|
15
|
-
})
|
|
16
|
-
: Effect.unit,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export interface Log extends ReturnType<typeof make> {}
|
|
20
|
-
export const Log = Tag<Log>()
|
|
21
|
-
export const LogLive = Layer.effect(
|
|
22
|
-
Log,
|
|
23
|
-
Effect.map(DiscordConfig, config => make(config.debug)),
|
|
24
|
-
)
|