seyfert 0.1.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/LICENSE +190 -0
- package/README.md +57 -0
- package/lib/api/CDN.d.ts +220 -0
- package/lib/api/CDN.js +236 -0
- package/lib/api/REST.d.ts +127 -0
- package/lib/api/REST.js +424 -0
- package/lib/api/Router.d.ts +17 -0
- package/lib/api/Router.js +63 -0
- package/lib/api/Routes/applications.d.ts +46 -0
- package/lib/api/Routes/applications.js +2 -0
- package/lib/api/Routes/cdn.d.ts +66 -0
- package/lib/api/Routes/cdn.js +2 -0
- package/lib/api/Routes/channels.d.ts +109 -0
- package/lib/api/Routes/channels.js +2 -0
- package/lib/api/Routes/gateway.d.ts +11 -0
- package/lib/api/Routes/gateway.js +2 -0
- package/lib/api/Routes/guilds.d.ts +171 -0
- package/lib/api/Routes/guilds.js +2 -0
- package/lib/api/Routes/index.d.ts +13 -0
- package/lib/api/Routes/index.js +17 -0
- package/lib/api/Routes/interactions.d.ts +14 -0
- package/lib/api/Routes/interactions.js +2 -0
- package/lib/api/Routes/invites.d.ts +9 -0
- package/lib/api/Routes/invites.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +13 -0
- package/lib/api/Routes/stage-instances.js +2 -0
- package/lib/api/Routes/stickers.d.ts +11 -0
- package/lib/api/Routes/stickers.js +2 -0
- package/lib/api/Routes/users.d.ts +35 -0
- package/lib/api/Routes/users.js +2 -0
- package/lib/api/Routes/voice.d.ts +10 -0
- package/lib/api/Routes/voice.js +2 -0
- package/lib/api/Routes/webhooks.d.ts +29 -0
- package/lib/api/Routes/webhooks.js +2 -0
- package/lib/api/errors/DiscordAPIError.d.ts +51 -0
- package/lib/api/errors/DiscordAPIError.js +81 -0
- package/lib/api/errors/HTTPError.d.ts +20 -0
- package/lib/api/errors/HTTPError.js +28 -0
- package/lib/api/errors/RateLimitError.d.ts +19 -0
- package/lib/api/errors/RateLimitError.js +37 -0
- package/lib/api/handlers/BurstHandler.d.ts +51 -0
- package/lib/api/handlers/BurstHandler.js +124 -0
- package/lib/api/handlers/SequentialHandler.d.ts +81 -0
- package/lib/api/handlers/SequentialHandler.js +365 -0
- package/lib/api/handlers/Shared.d.ts +14 -0
- package/lib/api/handlers/Shared.js +125 -0
- package/lib/api/index.d.ts +5 -0
- package/lib/api/index.js +21 -0
- package/lib/api/interfaces/Handler.d.ts +21 -0
- package/lib/api/interfaces/Handler.js +2 -0
- package/lib/api/shared.d.ts +7 -0
- package/lib/api/shared.js +27 -0
- package/lib/api/utils/constants.d.ts +39 -0
- package/lib/api/utils/constants.js +50 -0
- package/lib/api/utils/types.d.ts +335 -0
- package/lib/api/utils/types.js +14 -0
- package/lib/api/utils/utils.d.ts +52 -0
- package/lib/api/utils/utils.js +159 -0
- package/lib/builders/ActionRow.d.ts +40 -0
- package/lib/builders/ActionRow.js +58 -0
- package/lib/builders/Attachment.d.ts +106 -0
- package/lib/builders/Attachment.js +196 -0
- package/lib/builders/Base.d.ts +10 -0
- package/lib/builders/Base.js +13 -0
- package/lib/builders/Button.d.ts +59 -0
- package/lib/builders/Button.js +94 -0
- package/lib/builders/MessageEmbed.d.ts +116 -0
- package/lib/builders/MessageEmbed.js +159 -0
- package/lib/builders/Modal.d.ts +111 -0
- package/lib/builders/Modal.js +162 -0
- package/lib/builders/SelectMenu.d.ts +201 -0
- package/lib/builders/SelectMenu.js +293 -0
- package/lib/builders/index.d.ts +12 -0
- package/lib/builders/index.js +54 -0
- package/lib/builders/types.d.ts +21 -0
- package/lib/builders/types.js +2 -0
- package/lib/cache/adapters/default.d.ts +24 -0
- package/lib/cache/adapters/default.js +118 -0
- package/lib/cache/adapters/index.d.ts +4 -0
- package/lib/cache/adapters/index.js +20 -0
- package/lib/cache/adapters/redis.d.ts +35 -0
- package/lib/cache/adapters/redis.js +180 -0
- package/lib/cache/adapters/types.d.ts +25 -0
- package/lib/cache/adapters/types.js +2 -0
- package/lib/cache/adapters/workeradapter.d.ts +24 -0
- package/lib/cache/adapters/workeradapter.js +76 -0
- package/lib/cache/index.d.ts +97 -0
- package/lib/cache/index.js +394 -0
- package/lib/cache/resources/channels.d.ts +7 -0
- package/lib/cache/resources/channels.js +20 -0
- package/lib/cache/resources/default/base.d.ts +25 -0
- package/lib/cache/resources/default/base.js +75 -0
- package/lib/cache/resources/default/guild-based.d.ts +33 -0
- package/lib/cache/resources/default/guild-based.js +91 -0
- package/lib/cache/resources/default/guild-related.d.ts +32 -0
- package/lib/cache/resources/default/guild-related.js +102 -0
- package/lib/cache/resources/emojis.d.ts +7 -0
- package/lib/cache/resources/emojis.js +17 -0
- package/lib/cache/resources/guilds.d.ts +10 -0
- package/lib/cache/resources/guilds.js +117 -0
- package/lib/cache/resources/members.d.ts +10 -0
- package/lib/cache/resources/members.js +41 -0
- package/lib/cache/resources/presence.d.ts +9 -0
- package/lib/cache/resources/presence.js +14 -0
- package/lib/cache/resources/roles.d.ts +7 -0
- package/lib/cache/resources/roles.js +17 -0
- package/lib/cache/resources/stage-instances.d.ts +5 -0
- package/lib/cache/resources/stage-instances.js +8 -0
- package/lib/cache/resources/stickers.d.ts +7 -0
- package/lib/cache/resources/stickers.js +17 -0
- package/lib/cache/resources/threads.d.ts +7 -0
- package/lib/cache/resources/threads.js +17 -0
- package/lib/cache/resources/users.d.ts +7 -0
- package/lib/cache/resources/users.js +17 -0
- package/lib/cache/resources/voice-states.d.ts +9 -0
- package/lib/cache/resources/voice-states.js +13 -0
- package/lib/client/base.d.ts +244 -0
- package/lib/client/base.js +178 -0
- package/lib/client/client.d.ts +32 -0
- package/lib/client/client.js +156 -0
- package/lib/client/httpclient.d.ts +21 -0
- package/lib/client/httpclient.js +143 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +19 -0
- package/lib/client/oninteraction.d.ts +4 -0
- package/lib/client/oninteraction.js +180 -0
- package/lib/client/workerclient.d.ts +28 -0
- package/lib/client/workerclient.js +213 -0
- package/lib/collection.d.ts +233 -0
- package/lib/collection.js +371 -0
- package/lib/commands/applications/chat.d.ts +139 -0
- package/lib/commands/applications/chat.js +173 -0
- package/lib/commands/applications/chatcontext.d.ts +28 -0
- package/lib/commands/applications/chatcontext.js +53 -0
- package/lib/commands/applications/menu.d.ts +39 -0
- package/lib/commands/applications/menu.js +87 -0
- package/lib/commands/applications/menucontext.d.ts +25 -0
- package/lib/commands/applications/menucontext.js +64 -0
- package/lib/commands/applications/options.d.ts +67 -0
- package/lib/commands/applications/options.js +44 -0
- package/lib/commands/applications/shared.d.ts +35 -0
- package/lib/commands/applications/shared.js +2 -0
- package/lib/commands/decorators.d.ts +107 -0
- package/lib/commands/decorators.js +85 -0
- package/lib/commands/handler.d.ts +15 -0
- package/lib/commands/handler.js +140 -0
- package/lib/commands/index.d.ts +8 -0
- package/lib/commands/index.js +24 -0
- package/lib/commands/optionresolver.d.ts +49 -0
- package/lib/commands/optionresolver.js +146 -0
- package/lib/common/bot/watcher.d.ts +53 -0
- package/lib/common/bot/watcher.js +104 -0
- package/lib/common/index.d.ts +13 -0
- package/lib/common/index.js +30 -0
- package/lib/common/it/colors.d.ts +274 -0
- package/lib/common/it/colors.js +453 -0
- package/lib/common/it/constants.d.ts +36 -0
- package/lib/common/it/constants.js +40 -0
- package/lib/common/it/logger.d.ts +114 -0
- package/lib/common/it/logger.js +189 -0
- package/lib/common/it/utils.d.ts +107 -0
- package/lib/common/it/utils.js +275 -0
- package/lib/common/shorters/base.d.ts +5 -0
- package/lib/common/shorters/base.js +10 -0
- package/lib/common/shorters/channels.d.ts +90 -0
- package/lib/common/shorters/channels.js +95 -0
- package/lib/common/shorters/guilds.d.ts +389 -0
- package/lib/common/shorters/guilds.js +350 -0
- package/lib/common/shorters/members.d.ts +115 -0
- package/lib/common/shorters/members.js +179 -0
- package/lib/common/shorters/messages.d.ts +27 -0
- package/lib/common/shorters/messages.js +117 -0
- package/lib/common/shorters/roles.d.ts +12 -0
- package/lib/common/shorters/roles.js +51 -0
- package/lib/common/shorters/templates.d.ts +12 -0
- package/lib/common/shorters/templates.js +29 -0
- package/lib/common/shorters/users.d.ts +11 -0
- package/lib/common/shorters/users.js +42 -0
- package/lib/common/shorters/webhook.d.ts +33 -0
- package/lib/common/shorters/webhook.js +69 -0
- package/lib/common/types/options.d.ts +10 -0
- package/lib/common/types/options.js +2 -0
- package/lib/common/types/resolvables.d.ts +10 -0
- package/lib/common/types/resolvables.js +2 -0
- package/lib/common/types/util.d.ts +90 -0
- package/lib/common/types/util.js +2 -0
- package/lib/common/types/write.d.ts +21 -0
- package/lib/common/types/write.js +2 -0
- package/lib/components/ActionRow.d.ts +10 -0
- package/lib/components/ActionRow.js +13 -0
- package/lib/components/ButtonComponent.d.ts +19 -0
- package/lib/components/ButtonComponent.js +34 -0
- package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
- package/lib/components/ChannelSelectMenuComponent.js +12 -0
- package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
- package/lib/components/MentionableSelectMenuComponent.js +7 -0
- package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
- package/lib/components/RoleSelectMenuComponent.js +7 -0
- package/lib/components/StringSelectMenuComponent.d.ts +6 -0
- package/lib/components/StringSelectMenuComponent.js +12 -0
- package/lib/components/TextInputComponent.d.ts +7 -0
- package/lib/components/TextInputComponent.js +14 -0
- package/lib/components/UserSelectMenuComponent.d.ts +4 -0
- package/lib/components/UserSelectMenuComponent.js +7 -0
- package/lib/components/command.d.ts +23 -0
- package/lib/components/command.js +15 -0
- package/lib/components/handler.d.ts +48 -0
- package/lib/components/handler.js +231 -0
- package/lib/components/index.d.ts +20 -0
- package/lib/components/index.js +55 -0
- package/lib/components/listener.d.ts +11 -0
- package/lib/components/listener.js +18 -0
- package/lib/events/event.d.ts +23 -0
- package/lib/events/event.js +2 -0
- package/lib/events/handler.d.ts +19 -0
- package/lib/events/handler.js +112 -0
- package/lib/events/hooks/application_command.d.ts +12 -0
- package/lib/events/hooks/application_command.js +8 -0
- package/lib/events/hooks/auto_moderation.d.ts +22 -0
- package/lib/events/hooks/auto_moderation.js +21 -0
- package/lib/events/hooks/channel.d.ts +11 -0
- package/lib/events/hooks/channel.js +24 -0
- package/lib/events/hooks/custom.d.ts +4 -0
- package/lib/events/hooks/custom.js +11 -0
- package/lib/events/hooks/dispatch.d.ts +5 -0
- package/lib/events/hooks/dispatch.js +12 -0
- package/lib/events/hooks/entitlement.d.ts +35 -0
- package/lib/events/hooks/entitlement.js +16 -0
- package/lib/events/hooks/guild.d.ts +228 -0
- package/lib/events/hooks/guild.js +101 -0
- package/lib/events/hooks/index.d.ts +23 -0
- package/lib/events/hooks/index.js +34 -0
- package/lib/events/hooks/integration.d.ts +94 -0
- package/lib/events/hooks/integration.js +27 -0
- package/lib/events/hooks/interactions.d.ts +4 -0
- package/lib/events/hooks/interactions.js +8 -0
- package/lib/events/hooks/invite.d.ts +21 -0
- package/lib/events/hooks/invite.js +12 -0
- package/lib/events/hooks/message.d.ts +69 -0
- package/lib/events/hooks/message.js +37 -0
- package/lib/events/hooks/presence.d.ts +27 -0
- package/lib/events/hooks/presence.js +8 -0
- package/lib/events/hooks/stage.d.ts +29 -0
- package/lib/events/hooks/stage.js +16 -0
- package/lib/events/hooks/thread.d.ts +198 -0
- package/lib/events/hooks/thread.js +29 -0
- package/lib/events/hooks/typing.d.ts +16 -0
- package/lib/events/hooks/typing.js +14 -0
- package/lib/events/hooks/user.d.ts +4 -0
- package/lib/events/hooks/user.js +8 -0
- package/lib/events/hooks/voice.d.ts +37 -0
- package/lib/events/hooks/voice.js +18 -0
- package/lib/events/hooks/webhook.d.ts +6 -0
- package/lib/events/hooks/webhook.js +8 -0
- package/lib/events/index.d.ts +2 -0
- package/lib/events/index.js +18 -0
- package/lib/index.d.ts +79 -0
- package/lib/index.js +104 -0
- package/lib/langs/handler.d.ts +11 -0
- package/lib/langs/handler.js +34 -0
- package/lib/langs/index.d.ts +2 -0
- package/lib/langs/index.js +18 -0
- package/lib/langs/router.d.ts +18 -0
- package/lib/langs/router.js +42 -0
- package/lib/structures/AnonymousGuild.d.ts +7 -0
- package/lib/structures/AnonymousGuild.js +11 -0
- package/lib/structures/AutoModerationRule.d.ts +22 -0
- package/lib/structures/AutoModerationRule.js +34 -0
- package/lib/structures/ClientUser.d.ts +25 -0
- package/lib/structures/ClientUser.js +52 -0
- package/lib/structures/Guild.d.ts +86 -0
- package/lib/structures/Guild.js +66 -0
- package/lib/structures/GuildEmoji.d.ts +29 -0
- package/lib/structures/GuildEmoji.js +47 -0
- package/lib/structures/GuildMember.d.ts +92 -0
- package/lib/structures/GuildMember.js +137 -0
- package/lib/structures/GuildPreview.d.ts +10 -0
- package/lib/structures/GuildPreview.js +14 -0
- package/lib/structures/GuildRole.d.ts +21 -0
- package/lib/structures/GuildRole.js +32 -0
- package/lib/structures/GuildTemplate.d.ts +23 -0
- package/lib/structures/GuildTemplate.js +36 -0
- package/lib/structures/Interaction.d.ts +152 -0
- package/lib/structures/Interaction.js +409 -0
- package/lib/structures/Message.d.ts +53 -0
- package/lib/structures/Message.js +123 -0
- package/lib/structures/Sticker.d.ts +27 -0
- package/lib/structures/Sticker.js +44 -0
- package/lib/structures/User.d.ts +20 -0
- package/lib/structures/User.js +37 -0
- package/lib/structures/Webhook.d.ts +42 -0
- package/lib/structures/Webhook.js +63 -0
- package/lib/structures/channels.d.ts +232 -0
- package/lib/structures/channels.js +366 -0
- package/lib/structures/extra/Base.d.ts +7 -0
- package/lib/structures/extra/Base.js +39 -0
- package/lib/structures/extra/BaseComponent.d.ts +9 -0
- package/lib/structures/extra/BaseComponent.js +12 -0
- package/lib/structures/extra/BaseGuild.d.ts +40 -0
- package/lib/structures/extra/BaseGuild.js +71 -0
- package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
- package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
- package/lib/structures/extra/BitField.d.ts +14 -0
- package/lib/structures/extra/BitField.js +56 -0
- package/lib/structures/extra/DiscordBase.d.ts +18 -0
- package/lib/structures/extra/DiscordBase.js +28 -0
- package/lib/structures/extra/Permissions.d.ts +54 -0
- package/lib/structures/extra/Permissions.js +9 -0
- package/lib/structures/extra/functions.d.ts +11 -0
- package/lib/structures/extra/functions.js +69 -0
- package/lib/structures/index.d.ts +15 -0
- package/lib/structures/index.js +31 -0
- package/lib/websocket/SharedTypes.d.ts +128 -0
- package/lib/websocket/SharedTypes.js +2 -0
- package/lib/websocket/constants/index.d.ts +26 -0
- package/lib/websocket/constants/index.js +31 -0
- package/lib/websocket/discord/basesocket.d.ts +12 -0
- package/lib/websocket/discord/basesocket.js +37 -0
- package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/events/memberUpdate.js +47 -0
- package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
- package/lib/websocket/discord/events/presenceUpdate.js +46 -0
- package/lib/websocket/discord/handlemessage.d.ts +0 -0
- package/lib/websocket/discord/handlemessage.js +1 -0
- package/lib/websocket/discord/index.d.ts +4 -0
- package/lib/websocket/discord/index.js +20 -0
- package/lib/websocket/discord/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/memberUpdate.js +47 -0
- package/lib/websocket/discord/shard.d.ts +46 -0
- package/lib/websocket/discord/shard.js +278 -0
- package/lib/websocket/discord/sharder.d.ts +25 -0
- package/lib/websocket/discord/sharder.js +153 -0
- package/lib/websocket/discord/shared.d.ts +99 -0
- package/lib/websocket/discord/shared.js +8 -0
- package/lib/websocket/discord/worker.d.ts +43 -0
- package/lib/websocket/discord/worker.js +2 -0
- package/lib/websocket/discord/workermanager.d.ts +69 -0
- package/lib/websocket/discord/workermanager.js +273 -0
- package/lib/websocket/index.d.ts +3 -0
- package/lib/websocket/index.js +19 -0
- package/lib/websocket/structures/index.d.ts +117 -0
- package/lib/websocket/structures/index.js +261 -0
- package/lib/websocket/structures/timeout.d.ts +20 -0
- package/lib/websocket/structures/timeout.js +75 -0
- package/package.json +70 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringSelectOption = exports.StringSelectMenu = exports.ChannelSelectMenu = exports.MentionableSelectMenu = exports.RoleSelectMenu = exports.UserSelectMenu = exports.SelectMenu = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const Base_1 = require("./Base");
|
|
6
|
+
/**
|
|
7
|
+
* Maps default values for Select Menus.
|
|
8
|
+
* @template T - The type of SelectMenuDefaultValueType.
|
|
9
|
+
* @param ids - The IDs of items to be mapped as default.
|
|
10
|
+
* @param type - The type of default values.
|
|
11
|
+
* @returns An array of default values.
|
|
12
|
+
*/
|
|
13
|
+
function mappedDefault(ids, type) {
|
|
14
|
+
return (0, common_1.fastMap)((0, common_1.fastFlat)(ids), id => ({ id, type }));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents a base class for building Select Menus.
|
|
18
|
+
* @template Select - The type of APISelectMenuComponent.
|
|
19
|
+
* @template Interaction - The type of interaction.
|
|
20
|
+
* @example
|
|
21
|
+
* const selectMenu = new SelectMenu<APIUserSelectComponent, UserSelectMenuInteraction>();
|
|
22
|
+
* selectMenu.setCustomId("user-select-menu");
|
|
23
|
+
* selectMenu.setPlaceholder("Select a user");
|
|
24
|
+
* selectMenu.run((interaction) => {
|
|
25
|
+
* // Handle select menu interaction
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
class SelectMenu extends Base_1.BaseComponentBuilder {
|
|
29
|
+
/** @internal */
|
|
30
|
+
__exec;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the custom ID for the select menu.
|
|
33
|
+
* @param id - The custom ID for the select menu.
|
|
34
|
+
* @returns The current SelectMenu instance.
|
|
35
|
+
*/
|
|
36
|
+
setCustomId(id) {
|
|
37
|
+
this.data.custom_id = id;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sets the placeholder text for the select menu.
|
|
42
|
+
* @param placeholder - The placeholder text.
|
|
43
|
+
* @returns The current SelectMenu instance.
|
|
44
|
+
*/
|
|
45
|
+
setPlaceholder(placeholder) {
|
|
46
|
+
this.data.placeholder = placeholder;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets the maximum and minimum number of selected values for the select menu.
|
|
51
|
+
* @param options - The maximum and minimum values.
|
|
52
|
+
* @returns The current SelectMenu instance.
|
|
53
|
+
*/
|
|
54
|
+
setValuesLength({ max, min }) {
|
|
55
|
+
this.data.max_values = max;
|
|
56
|
+
this.data.min_values = min;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets whether the select menu is disabled.
|
|
61
|
+
* [disabled=true] - Indicates whether the select menu is disabled.
|
|
62
|
+
* @returns The current SelectMenu instance.
|
|
63
|
+
*/
|
|
64
|
+
setDisabled(disabled = true) {
|
|
65
|
+
this.data.disabled = disabled;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Sets the callback function to be executed when the select menu is interacted with.
|
|
70
|
+
* func - The callback function.
|
|
71
|
+
* @returns The current SelectMenu instance.
|
|
72
|
+
*/
|
|
73
|
+
run(func) {
|
|
74
|
+
this.__exec = func;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.SelectMenu = SelectMenu;
|
|
79
|
+
/**
|
|
80
|
+
* Represents a Select Menu for selecting users.
|
|
81
|
+
* @example
|
|
82
|
+
* const userSelectMenu = new UserSelectMenu();
|
|
83
|
+
* userSelectMenu.setCustomId("user-select");
|
|
84
|
+
* userSelectMenu.addDefaultUsers("123456789", "987654321");
|
|
85
|
+
*/
|
|
86
|
+
class UserSelectMenu extends SelectMenu {
|
|
87
|
+
constructor(data = {}) {
|
|
88
|
+
super({ ...data, type: common_1.ComponentType.UserSelect });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Adds default selected users to the select menu.
|
|
92
|
+
* @param users - User IDs to be added as default.
|
|
93
|
+
* @returns The current UserSelectMenu instance.
|
|
94
|
+
*/
|
|
95
|
+
addDefaultUsers(...users) {
|
|
96
|
+
this.data.default_values = (this.data.default_values ?? []).concat(mappedDefault(users, common_1.SelectMenuDefaultValueType.User));
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sets the default selected users for the select menu.
|
|
101
|
+
* @param users - User IDs to be set as default.
|
|
102
|
+
* @returns The current UserSelectMenu instance.
|
|
103
|
+
*/
|
|
104
|
+
setDefaultUsers(...users) {
|
|
105
|
+
this.data.default_values = mappedDefault(users, common_1.SelectMenuDefaultValueType.User);
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.UserSelectMenu = UserSelectMenu;
|
|
110
|
+
/**
|
|
111
|
+
* Represents a Select Menu for selecting roles.
|
|
112
|
+
* @example
|
|
113
|
+
* const roleSelectMenu = new RoleSelectMenu();
|
|
114
|
+
* roleSelectMenu.setCustomId("role-select");
|
|
115
|
+
* roleSelectMenu.addDefaultRoles("123456789", "987654321");
|
|
116
|
+
*/
|
|
117
|
+
class RoleSelectMenu extends SelectMenu {
|
|
118
|
+
constructor(data = {}) {
|
|
119
|
+
super({ ...data, type: common_1.ComponentType.RoleSelect });
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Adds default selected roles to the select menu.
|
|
123
|
+
* @param roles - Role IDs to be added as default.
|
|
124
|
+
* @returns The current RoleSelectMenu instance.
|
|
125
|
+
*/
|
|
126
|
+
addDefaultRoles(...roles) {
|
|
127
|
+
this.data.default_values = (this.data.default_values ?? []).concat(mappedDefault(roles, common_1.SelectMenuDefaultValueType.Role));
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Sets the default selected roles for the select menu.
|
|
132
|
+
* @param roles - Role IDs to be set as default.
|
|
133
|
+
* @returns The current RoleSelectMenu instance.
|
|
134
|
+
*/
|
|
135
|
+
setDefaultRoles(...roles) {
|
|
136
|
+
this.data.default_values = mappedDefault(roles, common_1.SelectMenuDefaultValueType.Role);
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.RoleSelectMenu = RoleSelectMenu;
|
|
141
|
+
/**
|
|
142
|
+
* Represents a Select Menu for selecting mentionable entities.
|
|
143
|
+
* @example
|
|
144
|
+
* const mentionableSelectMenu = new MentionableSelectMenu();
|
|
145
|
+
* mentionableSelectMenu.setCustomId("mentionable-select");
|
|
146
|
+
*/
|
|
147
|
+
class MentionableSelectMenu extends SelectMenu {
|
|
148
|
+
constructor(data = {}) {
|
|
149
|
+
super({ ...data, type: common_1.ComponentType.MentionableSelect });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.MentionableSelectMenu = MentionableSelectMenu;
|
|
153
|
+
/**
|
|
154
|
+
* Represents a Select Menu for selecting channels.
|
|
155
|
+
* @example
|
|
156
|
+
* const channelSelectMenu = new ChannelSelectMenu();
|
|
157
|
+
* channelSelectMenu.setCustomId("channel-select");
|
|
158
|
+
* channelSelectMenu.addDefaultChannels("123456789", "987654321");
|
|
159
|
+
* channelSelectMenu.setChannelTypes([ChannelType.GuildText, ChannelType.GuildVoice]);
|
|
160
|
+
*/
|
|
161
|
+
class ChannelSelectMenu extends SelectMenu {
|
|
162
|
+
constructor(data = {}) {
|
|
163
|
+
super({ ...data, type: common_1.ComponentType.ChannelSelect });
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Adds default selected channels to the select menu.
|
|
167
|
+
* @param channels - Channel IDs to be added as default.
|
|
168
|
+
* @returns The current ChannelSelectMenu instance.
|
|
169
|
+
*/
|
|
170
|
+
addDefaultChannels(...channels) {
|
|
171
|
+
this.data.default_values = (this.data.default_values ?? []).concat(mappedDefault(channels, common_1.SelectMenuDefaultValueType.Channel));
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Sets the default selected channels for the select menu.
|
|
176
|
+
* @param channels - Channel IDs to be set as default.
|
|
177
|
+
* @returns The current ChannelSelectMenu instance.
|
|
178
|
+
*/
|
|
179
|
+
setDefaultChannels(...channels) {
|
|
180
|
+
this.data.default_values = mappedDefault(channels, common_1.SelectMenuDefaultValueType.Channel);
|
|
181
|
+
return this;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Sets the types of channels that can be selected in the menu.
|
|
185
|
+
* types - The types of channels.
|
|
186
|
+
* @returns The current ChannelSelectMenu instance.
|
|
187
|
+
*/
|
|
188
|
+
setChannelTypes(types) {
|
|
189
|
+
this.data.channel_types = types;
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.ChannelSelectMenu = ChannelSelectMenu;
|
|
194
|
+
/**
|
|
195
|
+
* Represents a Select Menu for selecting string options.
|
|
196
|
+
* @example
|
|
197
|
+
* const stringSelectMenu = new StringSelectMenu();
|
|
198
|
+
* stringSelectMenu.setCustomId("string-select");
|
|
199
|
+
* stringSelectMenu.addOption(new StringSelectOption().setLabel("Option 1").setValue("option_1"));
|
|
200
|
+
* stringSelectMenu.setOptions([
|
|
201
|
+
* { label: "Option 2", value: "option_2" },
|
|
202
|
+
* { label: "Option 3", value: "option_3" },
|
|
203
|
+
* ]);
|
|
204
|
+
*/
|
|
205
|
+
class StringSelectMenu extends SelectMenu {
|
|
206
|
+
constructor(data = {}) {
|
|
207
|
+
super({ ...data, type: common_1.ComponentType.StringSelect });
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Adds options to the string select menu.
|
|
211
|
+
* @param {...RestOrArray<APISelectMenuOption>} options - Options to be added.
|
|
212
|
+
* @returns The current StringSelectMenu instance.
|
|
213
|
+
*/
|
|
214
|
+
addOption(...options) {
|
|
215
|
+
this.data.options ??= [];
|
|
216
|
+
this.data.options = this.data.options.concat((0, common_1.fastFlat)(options));
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Sets the options for the string select menu.
|
|
221
|
+
* options - Options to be set.
|
|
222
|
+
* @returns The current StringSelectMenu instance.
|
|
223
|
+
*/
|
|
224
|
+
setOptions(options) {
|
|
225
|
+
this.data.options = options;
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
exports.StringSelectMenu = StringSelectMenu;
|
|
230
|
+
/**
|
|
231
|
+
* Represents an individual option for a string select menu.
|
|
232
|
+
* @example
|
|
233
|
+
* const option = new StringSelectOption().setLabel("Option 1").setValue("option_1");
|
|
234
|
+
*/
|
|
235
|
+
class StringSelectOption {
|
|
236
|
+
data;
|
|
237
|
+
constructor(data = {}) {
|
|
238
|
+
this.data = data;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Sets the label for the option.
|
|
242
|
+
* label - The label for the option.
|
|
243
|
+
* @returns The current StringSelectOption instance.
|
|
244
|
+
*/
|
|
245
|
+
setLabel(label) {
|
|
246
|
+
this.data.label = label;
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Sets the value for the option.
|
|
251
|
+
* value - The value for the option.
|
|
252
|
+
* @returns The current StringSelectOption instance.
|
|
253
|
+
*/
|
|
254
|
+
setValue(value) {
|
|
255
|
+
this.data.value = value;
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Sets the description for the option.
|
|
260
|
+
* description - The description for the option.
|
|
261
|
+
* @returns The current StringSelectOption instance.
|
|
262
|
+
*/
|
|
263
|
+
setDescription(description) {
|
|
264
|
+
this.data.description = description;
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Sets whether the option is the default.
|
|
269
|
+
* [Default=true] - Indicates whether the option is the default.
|
|
270
|
+
* @returns The current StringSelectOption instance.
|
|
271
|
+
*/
|
|
272
|
+
setDefault(Default = true) {
|
|
273
|
+
this.data.default = Default;
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Sets the emoji for the option.
|
|
278
|
+
* emoji - The emoji for the option.
|
|
279
|
+
* @returns The current StringSelectOption instance.
|
|
280
|
+
*/
|
|
281
|
+
setEmoji(emoji) {
|
|
282
|
+
this.data.emoji = emoji;
|
|
283
|
+
return this;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Converts the option to JSON format.
|
|
287
|
+
* @returns The option data in JSON format.
|
|
288
|
+
*/
|
|
289
|
+
toJSON() {
|
|
290
|
+
return { ...this.data };
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
exports.StringSelectOption = StringSelectOption;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type APIActionRowComponent, type APIActionRowComponentTypes } from '../common';
|
|
2
|
+
import { ActionRow } from './ActionRow';
|
|
3
|
+
import type { BuilderComponents } from './types';
|
|
4
|
+
export * from './ActionRow';
|
|
5
|
+
export * from './Attachment';
|
|
6
|
+
export * from './Base';
|
|
7
|
+
export * from './Button';
|
|
8
|
+
export * from './MessageEmbed';
|
|
9
|
+
export * from './Modal';
|
|
10
|
+
export * from './SelectMenu';
|
|
11
|
+
export * from './types';
|
|
12
|
+
export declare function fromComponent(data: BuilderComponents | APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes> | ActionRow<BuilderComponents>): BuilderComponents | ActionRow<BuilderComponents>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.fromComponent = void 0;
|
|
18
|
+
const common_1 = require("../common");
|
|
19
|
+
const ActionRow_1 = require("./ActionRow");
|
|
20
|
+
const Button_1 = require("./Button");
|
|
21
|
+
const Modal_1 = require("./Modal");
|
|
22
|
+
const SelectMenu_1 = require("./SelectMenu");
|
|
23
|
+
__exportStar(require("./ActionRow"), exports);
|
|
24
|
+
__exportStar(require("./Attachment"), exports);
|
|
25
|
+
__exportStar(require("./Base"), exports);
|
|
26
|
+
__exportStar(require("./Button"), exports);
|
|
27
|
+
__exportStar(require("./MessageEmbed"), exports);
|
|
28
|
+
__exportStar(require("./Modal"), exports);
|
|
29
|
+
__exportStar(require("./SelectMenu"), exports);
|
|
30
|
+
__exportStar(require("./types"), exports);
|
|
31
|
+
function fromComponent(data) {
|
|
32
|
+
if ('toJSON' in data) {
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
switch (data.type) {
|
|
36
|
+
case common_1.ComponentType.Button:
|
|
37
|
+
return new Button_1.Button(data);
|
|
38
|
+
case common_1.ComponentType.StringSelect:
|
|
39
|
+
return new SelectMenu_1.StringSelectMenu(data);
|
|
40
|
+
case common_1.ComponentType.TextInput:
|
|
41
|
+
return new Modal_1.TextInput(data);
|
|
42
|
+
case common_1.ComponentType.UserSelect:
|
|
43
|
+
return new SelectMenu_1.UserSelectMenu(data);
|
|
44
|
+
case common_1.ComponentType.RoleSelect:
|
|
45
|
+
return new SelectMenu_1.RoleSelectMenu(data);
|
|
46
|
+
case common_1.ComponentType.MentionableSelect:
|
|
47
|
+
return new SelectMenu_1.MentionableSelectMenu(data);
|
|
48
|
+
case common_1.ComponentType.ChannelSelect:
|
|
49
|
+
return new SelectMenu_1.ChannelSelectMenu(data);
|
|
50
|
+
case common_1.ComponentType.ActionRow:
|
|
51
|
+
return new ActionRow_1.ActionRow(data);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.fromComponent = fromComponent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentInteraction, ModalSubmitInteraction } from '../structures/Interaction';
|
|
2
|
+
import type { Button } from './Button';
|
|
3
|
+
import type { TextInput } from './Modal';
|
|
4
|
+
import type { BuilderSelectMenus } from './SelectMenu';
|
|
5
|
+
export type ComponentCallback<T = ComponentInteraction> = (interaction: T, stop: ComponentStopCallback, refresh: ComponentRefreshCallback) => any;
|
|
6
|
+
export type ComponentFilterCallback<T = ComponentInteraction> = (interaction: T) => any;
|
|
7
|
+
export type ComponentStopCallback = (reason?: string, refresh?: ComponentRefreshCallback) => any;
|
|
8
|
+
export type ComponentRefreshCallback = () => any;
|
|
9
|
+
export type ModalSubmitCallback<T = ModalSubmitInteraction> = (interaction: T) => any;
|
|
10
|
+
export type ButtonLink = Omit<Button, 'setCustomId'>;
|
|
11
|
+
export type ButtonID = Omit<Button, 'setURL'>;
|
|
12
|
+
export type MessageBuilderComponents = FixedComponents<Button> | BuilderSelectMenus;
|
|
13
|
+
export type ModalBuilderComponents = TextInput;
|
|
14
|
+
export type BuilderComponents = MessageBuilderComponents | TextInput;
|
|
15
|
+
export type FixedComponents<T = Button> = T extends Button ? ButtonLink | ButtonID : T;
|
|
16
|
+
export interface ListenerOptions {
|
|
17
|
+
timeout?: number;
|
|
18
|
+
idle?: number;
|
|
19
|
+
filter?: ComponentFilterCallback;
|
|
20
|
+
onStop?: ComponentStopCallback;
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Adapter } from './types';
|
|
2
|
+
export declare class MemoryAdapter implements Adapter {
|
|
3
|
+
readonly storage: Map<string, string>;
|
|
4
|
+
readonly relationships: Map<string, string[]>;
|
|
5
|
+
scan(query: string, keys?: false): any[];
|
|
6
|
+
scan(query: string, keys: true): string[];
|
|
7
|
+
get(keys: string): any;
|
|
8
|
+
get(keys: string[]): any[];
|
|
9
|
+
set(keys: string, data: any): void;
|
|
10
|
+
set(keys: [string, any][]): void;
|
|
11
|
+
patch(updateOnly: boolean, keys: string, data: any): void;
|
|
12
|
+
patch(updateOnly: boolean, keys: [string, any][]): void;
|
|
13
|
+
values(to: string): any[];
|
|
14
|
+
keys(to: string): string[];
|
|
15
|
+
count(to: string): number;
|
|
16
|
+
remove(keys: string): void;
|
|
17
|
+
remove(keys: string[]): void;
|
|
18
|
+
contains(to: string, keys: string): boolean;
|
|
19
|
+
getToRelationship(to: string): string[];
|
|
20
|
+
bulkAddToRelationShip(data: Record<string, string[]>): void;
|
|
21
|
+
addToRelationship(to: string, keys: string | string[]): void;
|
|
22
|
+
removeToRelationship(to: string, keys: string | string[]): void;
|
|
23
|
+
removeRelationship(to: string | string[]): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemoryAdapter = void 0;
|
|
4
|
+
class MemoryAdapter {
|
|
5
|
+
storage = new Map();
|
|
6
|
+
relationships = new Map();
|
|
7
|
+
scan(query, keys = false) {
|
|
8
|
+
const values = [];
|
|
9
|
+
const sq = query.split('.');
|
|
10
|
+
for (const [key, value] of this.storage.entries()) {
|
|
11
|
+
if (key.split('.').every((value, i) => (sq[i] === '*' ? !!value : sq[i] === value))) {
|
|
12
|
+
values.push(keys ? key : JSON.parse(value));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return values;
|
|
16
|
+
}
|
|
17
|
+
get(keys) {
|
|
18
|
+
if (!Array.isArray(keys)) {
|
|
19
|
+
const data = this.storage.get(keys);
|
|
20
|
+
return data ? JSON.parse(data) : null;
|
|
21
|
+
}
|
|
22
|
+
return keys
|
|
23
|
+
.map(x => {
|
|
24
|
+
const data = this.storage.get(x);
|
|
25
|
+
return data ? JSON.parse(data) : null;
|
|
26
|
+
})
|
|
27
|
+
.filter(x => x);
|
|
28
|
+
}
|
|
29
|
+
set(keys, data) {
|
|
30
|
+
if (Array.isArray(keys)) {
|
|
31
|
+
for (const [key, value] of keys) {
|
|
32
|
+
this.storage.set(key, JSON.stringify(value));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.storage.set(keys, JSON.stringify(data));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
patch(updateOnly, keys, data) {
|
|
40
|
+
if (Array.isArray(keys)) {
|
|
41
|
+
for (const [key, value] of keys) {
|
|
42
|
+
const oldData = this.get(key);
|
|
43
|
+
if (updateOnly && !oldData) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
this.storage.set(key, JSON.stringify({ ...(oldData ?? {}), ...value }));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const oldData = this.get(keys);
|
|
51
|
+
if (updateOnly && !oldData) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.storage.set(keys, JSON.stringify({ ...(oldData ?? {}), ...data }));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
values(to) {
|
|
58
|
+
const array = [];
|
|
59
|
+
const data = this.keys(to);
|
|
60
|
+
for (const key of data) {
|
|
61
|
+
const content = this.get(key);
|
|
62
|
+
if (content) {
|
|
63
|
+
array.push(content);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return array;
|
|
67
|
+
}
|
|
68
|
+
keys(to) {
|
|
69
|
+
return this.getToRelationship(to).map(id => `${to}.${id}`);
|
|
70
|
+
}
|
|
71
|
+
count(to) {
|
|
72
|
+
return this.getToRelationship(to).length;
|
|
73
|
+
}
|
|
74
|
+
remove(keys) {
|
|
75
|
+
for (const i of Array.isArray(keys) ? keys : [keys]) {
|
|
76
|
+
this.storage.delete(i);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
contains(to, keys) {
|
|
80
|
+
return this.getToRelationship(to).includes(keys);
|
|
81
|
+
}
|
|
82
|
+
getToRelationship(to) {
|
|
83
|
+
return this.relationships.get(to) || [];
|
|
84
|
+
}
|
|
85
|
+
bulkAddToRelationShip(data) {
|
|
86
|
+
for (const i in data) {
|
|
87
|
+
this.addToRelationship(i, data[i]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
addToRelationship(to, keys) {
|
|
91
|
+
if (!this.relationships.has(to)) {
|
|
92
|
+
this.relationships.set(to, []);
|
|
93
|
+
}
|
|
94
|
+
const data = this.getToRelationship(to);
|
|
95
|
+
for (const key of Array.isArray(keys) ? keys : [keys]) {
|
|
96
|
+
if (!data.includes(key)) {
|
|
97
|
+
data.push(key);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
removeToRelationship(to, keys) {
|
|
102
|
+
const data = this.getToRelationship(to);
|
|
103
|
+
if (data) {
|
|
104
|
+
for (const key of Array.isArray(keys) ? keys : [keys]) {
|
|
105
|
+
const idx = data.indexOf(key);
|
|
106
|
+
if (idx !== -1) {
|
|
107
|
+
data.splice(idx, 1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
removeRelationship(to) {
|
|
113
|
+
for (const i of Array.isArray(to) ? to : [to]) {
|
|
114
|
+
this.relationships.delete(i);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.MemoryAdapter = MemoryAdapter;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./default"), exports);
|
|
18
|
+
__exportStar(require("./redis"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./workeradapter"), exports);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RedisOptions } from 'ioredis';
|
|
2
|
+
import { Redis } from 'ioredis';
|
|
3
|
+
import type { Adapter } from './types';
|
|
4
|
+
interface RedisAdapterOptions {
|
|
5
|
+
namespace?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class RedisAdapter implements Adapter {
|
|
8
|
+
client: Redis;
|
|
9
|
+
namespace: string;
|
|
10
|
+
constructor(data: ({
|
|
11
|
+
client: Redis;
|
|
12
|
+
} | {
|
|
13
|
+
redisOptions: RedisOptions;
|
|
14
|
+
}) & RedisAdapterOptions);
|
|
15
|
+
scan(query: string, returnKeys?: false): Promise<any[]>;
|
|
16
|
+
scan(query: string, returnKeys: true): Promise<string[]>;
|
|
17
|
+
get(keys: string[]): Promise<any[]>;
|
|
18
|
+
get(keys: string): Promise<any>;
|
|
19
|
+
set(id: [string, any][]): Promise<void>;
|
|
20
|
+
set(id: string, data: any): Promise<void>;
|
|
21
|
+
patch(updateOnly: boolean, id: [string, any][]): Promise<void>;
|
|
22
|
+
patch(updateOnly: boolean, id: string, data: any): Promise<void>;
|
|
23
|
+
values(to: string): Promise<any[]>;
|
|
24
|
+
keys(to: string): Promise<string[]>;
|
|
25
|
+
count(to: string): Promise<number>;
|
|
26
|
+
remove(keys: string | string[]): Promise<void>;
|
|
27
|
+
contains(to: string, keys: string): Promise<boolean>;
|
|
28
|
+
getToRelationship(to: string): Promise<string[]>;
|
|
29
|
+
bulkAddToRelationShip(data: Record<string, string[]>): Promise<void>;
|
|
30
|
+
addToRelationship(to: string, keys: string | string[]): Promise<void>;
|
|
31
|
+
removeToRelationship(to: string, keys: string | string[]): Promise<void>;
|
|
32
|
+
removeRelationship(to: string | string[]): Promise<void>;
|
|
33
|
+
protected buildKey(key: string): string;
|
|
34
|
+
}
|
|
35
|
+
export {};
|