@seedcord/core 0.1.0-next.6 → 0.1.0-next.8
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/dist/HmrModuleHandler-3sNgKHdf.mjs +163 -0
- package/dist/HmrModuleHandler-3sNgKHdf.mjs.map +1 -0
- package/dist/HmrModuleHandler-CTBng7wV.cjs +170 -0
- package/dist/HmrModuleHandler-CTBng7wV.cjs.map +1 -0
- package/dist/Plugin-BZit5HUI.d.mts +555 -0
- package/dist/{Plugin-C2-VHrsX.cjs → Plugin-BlkhHNRm.cjs} +15 -34
- package/dist/Plugin-BlkhHNRm.cjs.map +1 -0
- package/dist/{Plugin-PcdPjAzc.mjs → Plugin-CDAV7P9l.mjs} +16 -29
- package/dist/Plugin-CDAV7P9l.mjs.map +1 -0
- package/dist/basic-1hebYVcN.d.mts +22 -0
- package/dist/contextMenuLeaves-f2rbyo83.d.mts +19 -0
- package/dist/{permissions-DSW_EZfN.cjs → cursor-BMkFAwO2.cjs} +308 -300
- package/dist/cursor-BMkFAwO2.cjs.map +1 -0
- package/dist/{permissions-RVCBhL2n.mjs → cursor-BvSH8tgw.mjs} +249 -247
- package/dist/cursor-BvSH8tgw.mjs.map +1 -0
- package/dist/{AutocompleteOptions-eKhIe6Qt.d.mts → cursor-D6nBjwaE.d.mts} +207 -116
- package/dist/hmr.index.cjs +2 -164
- package/dist/hmr.index.mjs +2 -162
- package/dist/index-Cr4-VV4u.d.mts +142 -0
- package/dist/index.cjs +362 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +239 -38
- package/dist/index.mjs +313 -26
- package/dist/index.mjs.map +1 -1
- package/dist/internal.index.cjs +278 -83
- package/dist/internal.index.cjs.map +1 -1
- package/dist/internal.index.d.mts +111 -42
- package/dist/internal.index.mjs +223 -43
- package/dist/internal.index.mjs.map +1 -1
- package/dist/node-internal.index.cjs +314 -76
- package/dist/node-internal.index.cjs.map +1 -1
- package/dist/node-internal.index.d.mts +123 -2164
- package/dist/node-internal.index.mjs +313 -77
- package/dist/node-internal.index.mjs.map +1 -1
- package/dist/{phases-BfpAG6w3.mjs → phases-BauKJOTT.mjs} +2 -2
- package/dist/phases-BauKJOTT.mjs.map +1 -0
- package/dist/{phases-C_BGNyVo.cjs → phases-DcuDHoQl.cjs} +2 -2
- package/dist/phases-DcuDHoQl.cjs.map +1 -0
- package/dist/plugin.index.cjs +1 -1
- package/dist/plugin.index.d.mts +2 -2
- package/dist/plugin.index.mjs +1 -1
- package/dist/publishDefault-CVlwYUS5.cjs +382 -0
- package/dist/publishDefault-CVlwYUS5.cjs.map +1 -0
- package/dist/publishDefault-CldnxcT2.mjs +287 -0
- package/dist/publishDefault-CldnxcT2.mjs.map +1 -0
- package/dist/slashRouteLeaves-BANDtPFm.mjs +23 -0
- package/dist/slashRouteLeaves-BANDtPFm.mjs.map +1 -0
- package/dist/slashRouteLeaves-nfxOAM7Q.cjs +28 -0
- package/dist/slashRouteLeaves-nfxOAM7Q.cjs.map +1 -0
- package/dist/subscribers-BSJoyKNN.cjs +517 -0
- package/dist/subscribers-BSJoyKNN.cjs.map +1 -0
- package/dist/subscribers-DuxdM2cS.mjs +480 -0
- package/dist/subscribers-DuxdM2cS.mjs.map +1 -0
- package/package.json +7 -6
- package/dist/Plugin-C2-VHrsX.cjs.map +0 -1
- package/dist/Plugin-CNyRKDHT.d.mts +0 -226
- package/dist/Plugin-PcdPjAzc.mjs.map +0 -1
- package/dist/hmr.index.cjs.map +0 -1
- package/dist/hmr.index.mjs.map +0 -1
- package/dist/is-never-Ddaba1Su.d.mts +0 -58
- package/dist/permissions-DSW_EZfN.cjs.map +0 -1
- package/dist/permissions-RVCBhL2n.mjs.map +0 -1
- package/dist/phases-BfpAG6w3.mjs.map +0 -1
- package/dist/phases-C_BGNyVo.cjs.map +0 -1
package/dist/internal.index.cjs
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_publishDefault = require('./publishDefault-CVlwYUS5.cjs');
|
|
4
|
+
const require_cursor = require('./cursor-BMkFAwO2.cjs');
|
|
4
5
|
const require_devChannel = require('./devChannel-CoCmAVDx.cjs');
|
|
6
|
+
const require_slashRouteLeaves = require('./slashRouteLeaves-nfxOAM7Q.cjs');
|
|
5
7
|
require("reflect-metadata");
|
|
6
|
-
let _seedcord_errors = require("@seedcord/errors");
|
|
7
|
-
let _seedcord_errors_internal = require("@seedcord/errors/internal");
|
|
8
|
-
let discord_api_types_v10 = require("discord-api-types/v10");
|
|
9
8
|
let _discordjs_builders = require("@discordjs/builders");
|
|
10
9
|
let _seedcord_logger = require("@seedcord/logger");
|
|
10
|
+
let _seedcord_errors = require("@seedcord/errors");
|
|
11
|
+
let _seedcord_errors_internal = require("@seedcord/errors/internal");
|
|
11
12
|
let _seedcord_utils = require("@seedcord/utils");
|
|
12
|
-
let envapt = require("envapt");
|
|
13
13
|
let chalk = require("chalk");
|
|
14
14
|
chalk = require_rolldown_runtime.__toESM(chalk, 1);
|
|
15
|
+
let envapt = require("envapt");
|
|
15
16
|
|
|
16
17
|
//#region src/gates/runGates.ts
|
|
17
18
|
function routeIdOf(handlerCtor) {
|
|
18
|
-
for (const [kind, key] of Object.entries(
|
|
19
|
+
for (const [kind, key] of Object.entries(require_publishDefault.InteractionRouteKeys)) {
|
|
19
20
|
const routes = Reflect.getMetadata(key, handlerCtor);
|
|
20
21
|
if (routes?.length) return `${kind}:${routes.join(",")}`;
|
|
21
22
|
}
|
|
@@ -24,7 +25,7 @@ function routeIdOf(handlerCtor) {
|
|
|
24
25
|
async function timedCheck(gate, ctx, observe) {
|
|
25
26
|
const start = performance.now();
|
|
26
27
|
try {
|
|
27
|
-
await
|
|
28
|
+
await require_cursor.runCheck(gate, ctx);
|
|
28
29
|
} finally {
|
|
29
30
|
observe(gate.name, performance.now() - start);
|
|
30
31
|
}
|
|
@@ -36,14 +37,14 @@ async function timedCheck(gate, ctx, observe) {
|
|
|
36
37
|
*/
|
|
37
38
|
async function runGates(gates, ctx, observe) {
|
|
38
39
|
try {
|
|
39
|
-
for (const gate of gates) await (observe ? timedCheck(gate, ctx, observe) :
|
|
40
|
-
await
|
|
40
|
+
for (const gate of gates) await (observe ? timedCheck(gate, ctx, observe) : require_cursor.runCheck(gate, ctx));
|
|
41
|
+
await require_cursor.runCommits(ctx);
|
|
41
42
|
} finally {
|
|
42
|
-
|
|
43
|
+
require_cursor.discardCommits(ctx);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
async function runHandlerGates(handlerCtor, ctx, routeId, observe) {
|
|
46
|
-
const gates = Reflect.getMetadata(
|
|
47
|
+
const gates = Reflect.getMetadata(require_publishDefault.GatedMetadataKey, handlerCtor);
|
|
47
48
|
if (!gates) return;
|
|
48
49
|
await runGates(gates, {
|
|
49
50
|
...ctx,
|
|
@@ -56,7 +57,7 @@ async function runHandlerGates(handlerCtor, ctx, routeId, observe) {
|
|
|
56
57
|
const SLOW_GATE_MS = 750;
|
|
57
58
|
let gateLogger;
|
|
58
59
|
function logger() {
|
|
59
|
-
gateLogger ??= new _seedcord_logger.Logger("Gates");
|
|
60
|
+
gateLogger ??= new _seedcord_logger.Logger("Gates", { channel: "gates" });
|
|
60
61
|
return gateLogger;
|
|
61
62
|
}
|
|
62
63
|
function slowGateMonitor() {
|
|
@@ -77,6 +78,13 @@ function slowGateMonitor() {
|
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/miscellaneous/emojiConfig.ts
|
|
83
|
+
/** Narrows a configured emoji value to the `[name, guildId]` form. @internal */
|
|
84
|
+
function isEmojiTuple(value) {
|
|
85
|
+
return Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "string";
|
|
86
|
+
}
|
|
87
|
+
|
|
80
88
|
//#endregion
|
|
81
89
|
//#region src/hmr/wrapHot.ts
|
|
82
90
|
/**
|
|
@@ -132,26 +140,10 @@ var HmrManager = class {
|
|
|
132
140
|
};
|
|
133
141
|
|
|
134
142
|
//#endregion
|
|
135
|
-
//#region src/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
function pageCursor(prefix) {
|
|
140
|
-
return new require_permissions.CustomId(prefix).int("page", 0, PAGE_MAX).int("slot", 0, SLOT_MAX);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region src/reply/flags.ts
|
|
145
|
-
/** IsComponentsV2 is unconditional, every framework reply is v2. */
|
|
146
|
-
function sendFlags(opts) {
|
|
147
|
-
let flags = discord_api_types_v10.MessageFlags.IsComponentsV2;
|
|
148
|
-
if (opts?.ephemeral ?? true) flags |= discord_api_types_v10.MessageFlags.Ephemeral;
|
|
149
|
-
if (opts?.silent) flags |= discord_api_types_v10.MessageFlags.SuppressNotifications;
|
|
150
|
-
return flags;
|
|
151
|
-
}
|
|
152
|
-
/** A deferral carries no content, so only Ephemeral applies. */
|
|
153
|
-
function deferFlags(opts) {
|
|
154
|
-
return opts?.ephemeral ?? true ? discord_api_types_v10.MessageFlags.Ephemeral : 0;
|
|
143
|
+
//#region src/stops/asError.ts
|
|
144
|
+
/** @internal */
|
|
145
|
+
function asError(caught) {
|
|
146
|
+
return Error.isError(caught) ? caught : new Error(String(caught), { cause: caught });
|
|
155
147
|
}
|
|
156
148
|
|
|
157
149
|
//#endregion
|
|
@@ -251,6 +243,60 @@ var AckTrace = class extends Error {
|
|
|
251
243
|
}
|
|
252
244
|
};
|
|
253
245
|
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/reply/responseReport.ts
|
|
248
|
+
/** @internal */
|
|
249
|
+
function publishResponse(telemetry, report) {
|
|
250
|
+
if (!telemetry) return;
|
|
251
|
+
telemetry.bus[require_publishDefault.PublishDefault]("responseAttempted", {
|
|
252
|
+
routeId: report.routeId,
|
|
253
|
+
interactionId: telemetry.interactionId,
|
|
254
|
+
method: report.method,
|
|
255
|
+
outcome: report.outcome,
|
|
256
|
+
durationMs: performance.now() - report.startedAt,
|
|
257
|
+
messageId: report.messageId,
|
|
258
|
+
...report.error && { error: report.error }
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Runs a write that returns no message and publishes whichever arm it takes.
|
|
263
|
+
*
|
|
264
|
+
* @internal
|
|
265
|
+
*/
|
|
266
|
+
async function reportedWrite(telemetry, routeId, method, write) {
|
|
267
|
+
const startedAt = performance.now();
|
|
268
|
+
const result = await attemptWrite(telemetry, routeId, method, startedAt, write);
|
|
269
|
+
publishResponse(telemetry, {
|
|
270
|
+
routeId,
|
|
271
|
+
method,
|
|
272
|
+
startedAt,
|
|
273
|
+
outcome: "sent",
|
|
274
|
+
messageId: null
|
|
275
|
+
});
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Runs a wire write and publishes the `failed` arm when it throws, since the caller's success report
|
|
280
|
+
* sits after the write and a throw skips it.
|
|
281
|
+
*
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
async function attemptWrite(telemetry, routeId, method, startedAt, write) {
|
|
285
|
+
try {
|
|
286
|
+
return await write();
|
|
287
|
+
} catch (caught) {
|
|
288
|
+
publishResponse(telemetry, {
|
|
289
|
+
routeId,
|
|
290
|
+
method,
|
|
291
|
+
startedAt,
|
|
292
|
+
outcome: "failed",
|
|
293
|
+
messageId: null,
|
|
294
|
+
error: asError(caught)
|
|
295
|
+
});
|
|
296
|
+
throw caught;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
254
300
|
//#endregion
|
|
255
301
|
//#region src/reply/translateSerialization.ts
|
|
256
302
|
const MAX_DEPTH = 8;
|
|
@@ -395,28 +441,49 @@ function serializeReply(response, routeId) {
|
|
|
395
441
|
*/
|
|
396
442
|
var BaseReplySender = class {
|
|
397
443
|
routeId;
|
|
444
|
+
telemetry;
|
|
398
445
|
state;
|
|
399
446
|
sent = /* @__PURE__ */ new Set();
|
|
400
447
|
ackedBy;
|
|
401
|
-
constructor(routeId, initialState = "unacked") {
|
|
448
|
+
constructor(routeId, initialState = "unacked", telemetry) {
|
|
402
449
|
this.routeId = routeId;
|
|
450
|
+
this.telemetry = telemetry;
|
|
403
451
|
this.state = initialState;
|
|
404
452
|
}
|
|
453
|
+
report(method, startedAt, outcome, messageId) {
|
|
454
|
+
publishResponse(this.telemetry, {
|
|
455
|
+
routeId: this.routeId,
|
|
456
|
+
method,
|
|
457
|
+
startedAt,
|
|
458
|
+
outcome,
|
|
459
|
+
messageId
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
async attempt(method, startedAt, write) {
|
|
463
|
+
return await attemptWrite(this.telemetry, this.routeId, method, startedAt, write);
|
|
464
|
+
}
|
|
405
465
|
async reply(response, opts) {
|
|
406
466
|
this.checkLegality("reply");
|
|
407
|
-
const
|
|
467
|
+
const startedAt = performance.now();
|
|
468
|
+
const created = await this.attempt("reply", startedAt, () => this.writeReply(response, opts));
|
|
408
469
|
this.transition("reply", "replied");
|
|
409
|
-
|
|
470
|
+
const message = this.remember(this.requireMessage(created, "reply"));
|
|
471
|
+
this.report("reply", startedAt, "sent", message.id);
|
|
472
|
+
return message;
|
|
410
473
|
}
|
|
411
474
|
async defer(opts) {
|
|
412
475
|
this.checkLegality("defer");
|
|
413
|
-
|
|
476
|
+
const startedAt = performance.now();
|
|
477
|
+
await this.attempt("defer", startedAt, () => this.writeDefer(opts));
|
|
414
478
|
this.transition("defer", "deferred-reply");
|
|
479
|
+
this.report("defer", startedAt, "sent", null);
|
|
415
480
|
}
|
|
416
481
|
async deferUpdate() {
|
|
417
482
|
this.checkLegality("deferUpdate");
|
|
418
|
-
|
|
483
|
+
const startedAt = performance.now();
|
|
484
|
+
await this.attempt("deferUpdate", startedAt, () => this.writeDeferUpdate());
|
|
419
485
|
this.transition("deferUpdate", "deferred-update");
|
|
486
|
+
this.report("deferUpdate", startedAt, "sent", null);
|
|
420
487
|
}
|
|
421
488
|
/**
|
|
422
489
|
* After a deferUpdate the state stays deferred-update, so the rewrite repeats. The returned message
|
|
@@ -425,31 +492,51 @@ var BaseReplySender = class {
|
|
|
425
492
|
*/
|
|
426
493
|
async update(response) {
|
|
427
494
|
this.checkLegality("update");
|
|
428
|
-
|
|
429
|
-
|
|
495
|
+
const startedAt = performance.now();
|
|
496
|
+
if (this.state === "deferred-update") {
|
|
497
|
+
const edited = await this.attempt("update", startedAt, () => this.editOriginal(response));
|
|
498
|
+
this.report("update", startedAt, "sent", edited.id);
|
|
499
|
+
return edited;
|
|
500
|
+
}
|
|
501
|
+
const created = await this.attempt("update", startedAt, () => this.writeUpdate(response));
|
|
430
502
|
this.transition("update", "replied");
|
|
431
|
-
|
|
503
|
+
const message = this.remember(this.requireMessage(created, "update"));
|
|
504
|
+
this.report("update", startedAt, "sent", message.id);
|
|
505
|
+
return message;
|
|
432
506
|
}
|
|
433
507
|
async followUp(response, opts) {
|
|
434
508
|
this.checkLegality("followUp");
|
|
435
|
-
const
|
|
436
|
-
|
|
509
|
+
const startedAt = performance.now();
|
|
510
|
+
const created = await this.attempt("followUp", startedAt, () => this.writeFollowUp(response, opts));
|
|
511
|
+
const message = this.remember(created);
|
|
512
|
+
this.report("followUp", startedAt, "sent", message.id);
|
|
513
|
+
return message;
|
|
437
514
|
}
|
|
438
515
|
async edit(targetOrResponse, maybeResponse) {
|
|
439
516
|
this.checkLegality("edit");
|
|
440
|
-
|
|
517
|
+
const startedAt = performance.now();
|
|
518
|
+
if (maybeResponse === void 0) {
|
|
519
|
+
const edited = await this.attempt("edit", startedAt, () => this.editOriginal(targetOrResponse));
|
|
520
|
+
this.report("edit", startedAt, "sent", edited.id);
|
|
521
|
+
return edited;
|
|
522
|
+
}
|
|
441
523
|
const target = targetOrResponse;
|
|
442
524
|
if (!this.sent.has(target.id)) throw new _seedcord_errors_internal.SeedcordError(_seedcord_errors.SeedcordErrorCode.ReplyForeignEditTarget, [
|
|
443
525
|
"edit",
|
|
444
526
|
target.id,
|
|
445
527
|
this.routeId
|
|
446
528
|
]);
|
|
447
|
-
|
|
529
|
+
const written = await this.attempt("edit", startedAt, () => this.writeEditTarget(target.id, maybeResponse));
|
|
530
|
+
const message = this.remember(written);
|
|
531
|
+
this.report("edit", startedAt, "sent", message.id);
|
|
532
|
+
return message;
|
|
448
533
|
}
|
|
449
534
|
async delete(target) {
|
|
450
535
|
this.checkLegality("delete");
|
|
536
|
+
const startedAt = performance.now();
|
|
451
537
|
if (target === void 0) {
|
|
452
|
-
await this.writeDeleteOriginal();
|
|
538
|
+
await this.attempt("delete", startedAt, () => this.writeDeleteOriginal());
|
|
539
|
+
this.report("delete", startedAt, "sent", null);
|
|
453
540
|
return;
|
|
454
541
|
}
|
|
455
542
|
if (!this.sent.has(target.id)) throw new _seedcord_errors_internal.SeedcordError(_seedcord_errors.SeedcordErrorCode.ReplyForeignEditTarget, [
|
|
@@ -457,8 +544,9 @@ var BaseReplySender = class {
|
|
|
457
544
|
target.id,
|
|
458
545
|
this.routeId
|
|
459
546
|
]);
|
|
460
|
-
await this.writeDeleteTarget(target.id);
|
|
547
|
+
await this.attempt("delete", startedAt, () => this.writeDeleteTarget(target.id));
|
|
461
548
|
this.sent.delete(target.id);
|
|
549
|
+
this.report("delete", startedAt, "sent", null);
|
|
462
550
|
}
|
|
463
551
|
/** Routes to the verb the current ack state permits. Every state has a route, so the illegal-ack throw is unreachable. */
|
|
464
552
|
async send(response, opts) {
|
|
@@ -478,8 +566,10 @@ var BaseReplySender = class {
|
|
|
478
566
|
const name = modal.constructor?.name;
|
|
479
567
|
throw translateSerializationError(error, !name || name === "Object" ? "modal" : name, 0, this.routeId);
|
|
480
568
|
}
|
|
481
|
-
|
|
569
|
+
const startedAt = performance.now();
|
|
570
|
+
await this.attempt("showModal", startedAt, () => this.writeModal(data));
|
|
482
571
|
this.transition("showModal", "replied");
|
|
572
|
+
this.report("showModal", startedAt, "sent", null);
|
|
483
573
|
}
|
|
484
574
|
serialize(response) {
|
|
485
575
|
return serializeReply(response, this.routeId);
|
|
@@ -507,55 +597,160 @@ var BaseReplySender = class {
|
|
|
507
597
|
guardModalSource() {}
|
|
508
598
|
};
|
|
509
599
|
|
|
600
|
+
//#endregion
|
|
601
|
+
//#region src/subscribers/FaultThrottle.ts
|
|
602
|
+
/**
|
|
603
|
+
* Drops duplicate fault reports inside a fixed window, so a recurring fault (a database outage on a
|
|
604
|
+
* hot path) reports once per window and never floods the webhook.
|
|
605
|
+
*
|
|
606
|
+
* @internal
|
|
607
|
+
*/
|
|
608
|
+
var FaultThrottle = class FaultThrottle {
|
|
609
|
+
windowMs;
|
|
610
|
+
now;
|
|
611
|
+
static perCore = /* @__PURE__ */ new WeakMap();
|
|
612
|
+
/**
|
|
613
|
+
* The throttle for one bot instance.
|
|
614
|
+
*
|
|
615
|
+
* @internal
|
|
616
|
+
*/
|
|
617
|
+
static for(core) {
|
|
618
|
+
let throttle = FaultThrottle.perCore.get(core);
|
|
619
|
+
if (!throttle) {
|
|
620
|
+
throttle = new FaultThrottle();
|
|
621
|
+
FaultThrottle.perCore.set(core, throttle);
|
|
622
|
+
}
|
|
623
|
+
return throttle;
|
|
624
|
+
}
|
|
625
|
+
lastReportedAt = /* @__PURE__ */ new Map();
|
|
626
|
+
constructor(windowMs = 6e4, now = () => Date.now()) {
|
|
627
|
+
this.windowMs = windowMs;
|
|
628
|
+
this.now = now;
|
|
629
|
+
}
|
|
630
|
+
/** Evicts the entry for this key if it has aged out. */
|
|
631
|
+
shouldReport(key) {
|
|
632
|
+
const last = this.lastReportedAt.get(key);
|
|
633
|
+
if (last === void 0) return true;
|
|
634
|
+
if (this.now() - last < this.windowMs) return false;
|
|
635
|
+
this.lastReportedAt.delete(key);
|
|
636
|
+
return true;
|
|
637
|
+
}
|
|
638
|
+
markReported(key) {
|
|
639
|
+
this.lastReportedAt.set(key, this.now());
|
|
640
|
+
}
|
|
641
|
+
clear() {
|
|
642
|
+
this.lastReportedAt.clear();
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/dispatch/dispatchReport.ts
|
|
648
|
+
/**
|
|
649
|
+
* Classifies a caught stop for `interactionDispatched` so a gate and a
|
|
650
|
+
* handler label the same stop identically.
|
|
651
|
+
*
|
|
652
|
+
* @internal
|
|
653
|
+
*/
|
|
654
|
+
function outcomeFor(caught) {
|
|
655
|
+
if (caught instanceof require_cursor.Silence) return "refused";
|
|
656
|
+
if (caught instanceof require_cursor.Notice) return caught.report ? "failed" : "refused";
|
|
657
|
+
return "failed";
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Discord's interaction creation to now, read from the snowflake. Called at dispatch entry, since
|
|
661
|
+
* a later read would count the handler run into the queue time as well.
|
|
662
|
+
*
|
|
663
|
+
* @internal
|
|
664
|
+
*/
|
|
665
|
+
function queuedMsFor(interactionId) {
|
|
666
|
+
try {
|
|
667
|
+
return Date.now() - (0, _seedcord_utils.timestampFromSnowflake)(interactionId);
|
|
668
|
+
} catch {
|
|
669
|
+
return 0;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Builds the `interactionDispatched` payload both transports publish, so the two clocks are read the
|
|
674
|
+
* same way on each.
|
|
675
|
+
*
|
|
676
|
+
* @internal
|
|
677
|
+
*/
|
|
678
|
+
function dispatchedPayload(report) {
|
|
679
|
+
return {
|
|
680
|
+
routeId: report.routeId,
|
|
681
|
+
interactionId: report.interactionId,
|
|
682
|
+
kind: report.kind,
|
|
683
|
+
outcome: report.outcome,
|
|
684
|
+
fallback: report.fallback,
|
|
685
|
+
durationMs: performance.now() - report.startedAt,
|
|
686
|
+
queuedMs: report.queuedMs
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
|
|
510
690
|
//#endregion
|
|
511
691
|
exports.AckTrace = AckTrace;
|
|
512
692
|
exports.BaseReplySender = BaseReplySender;
|
|
513
|
-
exports.
|
|
514
|
-
exports.
|
|
515
|
-
exports.
|
|
516
|
-
exports.
|
|
517
|
-
exports.
|
|
693
|
+
exports.CommandInjector = require_cursor.CommandInjector;
|
|
694
|
+
exports.CommandMetadataKey = require_publishDefault.CommandMetadataKey;
|
|
695
|
+
exports.ComponentDefsKey = require_cursor.ComponentDefsKey;
|
|
696
|
+
exports.EventMetadataKey = require_publishDefault.EventMetadataKey;
|
|
697
|
+
exports.FaultThrottle = FaultThrottle;
|
|
698
|
+
exports.GateNotice = require_cursor.GateNotice;
|
|
699
|
+
exports.GatedMetadataKey = require_publishDefault.GatedMetadataKey;
|
|
700
|
+
exports.HasDangerousPermissions = require_cursor.HasDangerousPermissions;
|
|
518
701
|
exports.HmrManager = HmrManager;
|
|
519
|
-
exports.InteractionMetadataKey =
|
|
520
|
-
exports.InteractionRouteKeys =
|
|
521
|
-
exports.InteractionRoutes =
|
|
522
|
-
exports.MiddlewareMetadataKey =
|
|
523
|
-
exports.MissingPermissions =
|
|
524
|
-
exports.MissingRole =
|
|
525
|
-
exports.NeedsAny =
|
|
526
|
-
exports.NotAllowed =
|
|
527
|
-
exports.NotInDm =
|
|
528
|
-
exports.NotInGuild =
|
|
529
|
-
exports.NotOwner =
|
|
530
|
-
exports.NoticeCard =
|
|
531
|
-
exports.OnCooldown =
|
|
532
|
-
exports.PAGE_MAX = PAGE_MAX;
|
|
533
|
-
exports.PermissionNames =
|
|
534
|
-
exports.
|
|
535
|
-
exports.
|
|
536
|
-
exports.
|
|
702
|
+
exports.InteractionMetadataKey = require_publishDefault.InteractionMetadataKey;
|
|
703
|
+
exports.InteractionRouteKeys = require_publishDefault.InteractionRouteKeys;
|
|
704
|
+
exports.InteractionRoutes = require_publishDefault.InteractionRoutes;
|
|
705
|
+
exports.MiddlewareMetadataKey = require_publishDefault.MiddlewareMetadataKey;
|
|
706
|
+
exports.MissingPermissions = require_cursor.MissingPermissions;
|
|
707
|
+
exports.MissingRole = require_cursor.MissingRole;
|
|
708
|
+
exports.NeedsAny = require_cursor.NeedsAny;
|
|
709
|
+
exports.NotAllowed = require_cursor.NotAllowed;
|
|
710
|
+
exports.NotInDm = require_cursor.NotInDm;
|
|
711
|
+
exports.NotInGuild = require_cursor.NotInGuild;
|
|
712
|
+
exports.NotOwner = require_cursor.NotOwner;
|
|
713
|
+
exports.NoticeCard = require_cursor.NoticeCard;
|
|
714
|
+
exports.OnCooldown = require_cursor.OnCooldown;
|
|
715
|
+
exports.PAGE_MAX = require_cursor.PAGE_MAX;
|
|
716
|
+
exports.PermissionNames = require_cursor.PermissionNames;
|
|
717
|
+
exports.PublishDefault = require_publishDefault.PublishDefault;
|
|
718
|
+
exports.SubscribeMetadataKey = require_publishDefault.SubscribeMetadataKey;
|
|
719
|
+
exports.WebhookUrlMetadataKey = require_publishDefault.WebhookUrlMetadataKey;
|
|
720
|
+
exports.accessorStore = require_cursor.accessorStore;
|
|
721
|
+
exports.areRoutes = require_cursor.areRoutes;
|
|
722
|
+
exports.asError = asError;
|
|
537
723
|
exports.checkAckLegality = checkAckLegality;
|
|
538
|
-
exports.
|
|
539
|
-
exports.
|
|
540
|
-
exports.
|
|
541
|
-
exports.
|
|
724
|
+
exports.clearStore = require_cursor.clearStore;
|
|
725
|
+
exports.contextMenuLeaves = require_publishDefault.contextMenuLeaves;
|
|
726
|
+
exports.contextMenuRouteOf = require_cursor.contextMenuRouteOf;
|
|
727
|
+
exports.decodeComponentRoute = require_cursor.decodeComponentRoute;
|
|
728
|
+
exports.decodeFor = require_cursor.decodeFor;
|
|
729
|
+
exports.deferFlags = require_publishDefault.deferFlags;
|
|
730
|
+
exports.dispatchedPayload = dispatchedPayload;
|
|
542
731
|
exports.getDevChannel = require_devChannel.getDevChannel;
|
|
543
|
-
exports.
|
|
544
|
-
exports.
|
|
545
|
-
exports.
|
|
546
|
-
exports.
|
|
732
|
+
exports.guardedAccessor = require_cursor.guardedAccessor;
|
|
733
|
+
exports.interactionRoutesOf = require_cursor.interactionRoutesOf;
|
|
734
|
+
exports.isEmojiTuple = isEmojiTuple;
|
|
735
|
+
exports.outcomeFor = outcomeFor;
|
|
736
|
+
exports.pageCursor = require_cursor.pageCursor;
|
|
737
|
+
exports.pickNotice = require_cursor.pickNotice;
|
|
738
|
+
exports.prefixOf = require_cursor.prefixOf;
|
|
739
|
+
exports.queuedMsFor = queuedMsFor;
|
|
740
|
+
exports.reportedWrite = reportedWrite;
|
|
547
741
|
exports.routeIdOf = routeIdOf;
|
|
548
742
|
exports.runGates = runGates;
|
|
549
743
|
exports.runHandlerGates = runHandlerGates;
|
|
550
|
-
exports.selectMenuRouteOf =
|
|
551
|
-
exports.sendFlags = sendFlags;
|
|
744
|
+
exports.selectMenuRouteOf = require_cursor.selectMenuRouteOf;
|
|
745
|
+
exports.sendFlags = require_publishDefault.sendFlags;
|
|
552
746
|
exports.sendTarget = sendTarget;
|
|
553
747
|
exports.serializeReply = serializeReply;
|
|
554
|
-
exports.setBotColor =
|
|
748
|
+
exports.setBotColor = require_publishDefault.setBotColor;
|
|
555
749
|
exports.setDevChannel = require_devChannel.setDevChannel;
|
|
750
|
+
exports.slashRouteLeaves = require_slashRouteLeaves.slashRouteLeaves;
|
|
556
751
|
exports.slowGateMonitor = slowGateMonitor;
|
|
557
|
-
exports.storeComponentRoute =
|
|
558
|
-
exports.storeInteractionRoute =
|
|
752
|
+
exports.storeComponentRoute = require_cursor.storeComponentRoute;
|
|
753
|
+
exports.storeInteractionRoute = require_cursor.storeInteractionRoute;
|
|
559
754
|
exports.translateSerializationError = translateSerializationError;
|
|
560
755
|
exports.wrapHot = wrapHot;
|
|
561
756
|
//# sourceMappingURL=internal.index.cjs.map
|