@helyx/module-reactionroles 1.0.1
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/CHANGELOG.md +18 -0
- package/LICENSE +725 -0
- package/README.md +53 -0
- package/dist/builder.d.ts +38 -0
- package/dist/builder.js +206 -0
- package/dist/constants.d.ts +22 -0
- package/dist/constants.js +22 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1618 -0
- package/dist/panel-service.d.ts +86 -0
- package/dist/panel-service.js +961 -0
- package/dist/records.d.ts +288 -0
- package/dist/records.js +623 -0
- package/manifest.json +310 -0
- package/migrations/0001_reactionroles_foundation.sql +108 -0
- package/migrations/0002_cleanup_retry_order.sql +6 -0
- package/migrations/0003_persistent_reactions.sql +37 -0
- package/package.json +55 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ManagedResourceContext, ManagedResourceDetail, ManagedResourcePage, ManagedResourceValue, MessageResponse, ServiceAccess } from "@helyx/sdk";
|
|
2
|
+
import { type PanelDraft } from "./builder.js";
|
|
3
|
+
import { ReactionRolePanelRepository, type StoredPanel } from "./records.js";
|
|
4
|
+
export interface PanelMutationContext {
|
|
5
|
+
guildId: string;
|
|
6
|
+
actorUserId: string;
|
|
7
|
+
source: "dashboard" | "discord";
|
|
8
|
+
services: ServiceAccess;
|
|
9
|
+
correlationId?: string;
|
|
10
|
+
sendToChannel(channelId: string, response: MessageResponse): Promise<{
|
|
11
|
+
messageId: string;
|
|
12
|
+
}>;
|
|
13
|
+
deleteChannelMessage(channelId: string, messageId: string): Promise<void>;
|
|
14
|
+
editChannelMessage(channelId: string, messageId: string, response: MessageResponse): Promise<void>;
|
|
15
|
+
addChannelMessageReaction(channelId: string, messageId: string, emojiIdentifier: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare class PanelSnapshotCache {
|
|
18
|
+
#private;
|
|
19
|
+
get(guildId: string, messageId: string): StoredPanel | null;
|
|
20
|
+
getFresh(guildId: string, messageId: string): StoredPanel | null;
|
|
21
|
+
negativeHit(guildId: string, messageId: string): boolean;
|
|
22
|
+
markMissing(guildId: string, messageId: string): void;
|
|
23
|
+
load(guildId: string, messageId: string, operation: () => Promise<StoredPanel | null>): Promise<StoredPanel | null>;
|
|
24
|
+
put(panel: StoredPanel): void;
|
|
25
|
+
remove(panel: Pick<StoredPanel, "guildId" | "messageId">): void;
|
|
26
|
+
suspend(panel: Pick<StoredPanel, "guildId" | "messageId">): (replacement?: StoredPanel | null) => void;
|
|
27
|
+
clear(): void;
|
|
28
|
+
size(): number;
|
|
29
|
+
saturated(): boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare class ReactionRolePanelService {
|
|
32
|
+
private readonly cache;
|
|
33
|
+
constructor(cache: PanelSnapshotCache);
|
|
34
|
+
repository(services: ServiceAccess): ReactionRolePanelRepository;
|
|
35
|
+
warm(services: ServiceAccess): Promise<number>;
|
|
36
|
+
recoverMessageCleanup(services: ServiceAccess): Promise<{
|
|
37
|
+
completed: number;
|
|
38
|
+
failed: number;
|
|
39
|
+
abandoned: number;
|
|
40
|
+
}>;
|
|
41
|
+
getCached(guildId: string, messageId: string): StoredPanel | null;
|
|
42
|
+
resolveActive(guildId: string, messageId: string, services: ServiceAccess): Promise<StoredPanel | null>;
|
|
43
|
+
list(context: ManagedResourceContext, input: {
|
|
44
|
+
cursor?: string;
|
|
45
|
+
limit: number;
|
|
46
|
+
}): Promise<ManagedResourcePage>;
|
|
47
|
+
read(context: ManagedResourceContext, resourceId: string): Promise<ManagedResourceDetail | null>;
|
|
48
|
+
preview(context: ManagedResourceContext, value: Readonly<Record<string, ManagedResourceValue>>): Promise<MessageResponse>;
|
|
49
|
+
create(context: PanelMutationContext, draftInput: PanelDraft): Promise<StoredPanel>;
|
|
50
|
+
update(context: PanelMutationContext, input: {
|
|
51
|
+
resourceId: string;
|
|
52
|
+
expectedRevision: number;
|
|
53
|
+
draft: PanelDraft;
|
|
54
|
+
replacementAction?: "repair" | "repost";
|
|
55
|
+
}): Promise<StoredPanel>;
|
|
56
|
+
delete(context: PanelMutationContext, panelId: string, expectedRevision: number): Promise<boolean>;
|
|
57
|
+
repair(context: PanelMutationContext, panelId: string, expectedRevision: number, repost: boolean): Promise<StoredPanel>;
|
|
58
|
+
markMessageMissing(input: {
|
|
59
|
+
guildId: string;
|
|
60
|
+
messageId: string;
|
|
61
|
+
services: ServiceAccess;
|
|
62
|
+
}): Promise<void>;
|
|
63
|
+
markNeedsAttention(panel: StoredPanel, services: ServiceAccess): Promise<boolean>;
|
|
64
|
+
handleChannelLifecycle(input: {
|
|
65
|
+
guildId: string;
|
|
66
|
+
channelId: string;
|
|
67
|
+
deleted: boolean;
|
|
68
|
+
services: ServiceAccess;
|
|
69
|
+
}): Promise<number>;
|
|
70
|
+
handleRoleLifecycle(input: {
|
|
71
|
+
guildId: string;
|
|
72
|
+
roleId: string;
|
|
73
|
+
deleted: boolean;
|
|
74
|
+
services: ServiceAccess;
|
|
75
|
+
}): Promise<number>;
|
|
76
|
+
handleEmojiLifecycle(input: {
|
|
77
|
+
guildId: string;
|
|
78
|
+
emojiId: string;
|
|
79
|
+
deleted: boolean;
|
|
80
|
+
services: ServiceAccess;
|
|
81
|
+
}): Promise<number>;
|
|
82
|
+
audit(context: PanelMutationContext, action: string, panel: StoredPanel, result?: "success" | "cleanup_pending"): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
export declare function managedContext(context: ManagedResourceContext): PanelMutationContext;
|
|
85
|
+
export declare function parseManagedDraft(value: Readonly<Record<string, ManagedResourceValue>>): PanelDraft;
|
|
86
|
+
export declare function toDetail(panel: StoredPanel): ManagedResourceDetail;
|