@buape/carbon 0.4.2 → 0.6.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/README.md +15 -3
- package/dist/package.json +22 -5
- package/dist/src/abstracts/BaseChannel.d.ts +22 -21
- package/dist/src/abstracts/BaseChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseChannel.js +37 -27
- package/dist/src/abstracts/BaseChannel.js.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +3 -2
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.js +3 -4
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.d.ts +12 -10
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.js +35 -22
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts +13 -9
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.js +25 -9
- package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -1
- package/dist/src/abstracts/BaseInteraction.d.ts +10 -24
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.js +21 -15
- package/dist/src/abstracts/BaseInteraction.js.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +14 -13
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.js +31 -16
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -1
- package/dist/src/abstracts/Plugin.d.ts +14 -0
- package/dist/src/abstracts/Plugin.d.ts.map +1 -0
- package/dist/src/abstracts/Plugin.js +4 -0
- package/dist/src/abstracts/Plugin.js.map +1 -0
- package/dist/src/adapters/bun/index.d.ts +16 -0
- package/dist/src/adapters/bun/index.d.ts.map +1 -0
- package/dist/src/adapters/bun/index.js +20 -0
- package/dist/src/adapters/bun/index.js.map +1 -0
- package/dist/src/adapters/cloudflare/index.d.ts +16 -0
- package/dist/src/adapters/cloudflare/index.d.ts.map +1 -0
- package/dist/src/adapters/cloudflare/index.js +17 -0
- package/dist/src/adapters/cloudflare/index.js.map +1 -0
- package/dist/src/adapters/next/index.d.ts +14 -0
- package/dist/src/adapters/next/index.d.ts.map +1 -0
- package/dist/src/adapters/next/index.js +17 -0
- package/dist/src/adapters/next/index.js.map +1 -0
- package/dist/src/adapters/node/index.d.ts +16 -0
- package/dist/src/adapters/node/index.d.ts.map +1 -0
- package/dist/src/adapters/node/index.js +20 -0
- package/dist/src/adapters/node/index.js.map +1 -0
- package/dist/src/adapters/shared.d.ts +10 -0
- package/dist/src/adapters/shared.d.ts.map +1 -0
- package/dist/src/adapters/shared.js +2 -0
- package/dist/src/adapters/shared.js.map +1 -0
- package/dist/src/classes/Button.d.ts +0 -4
- package/dist/src/classes/Button.d.ts.map +1 -1
- package/dist/src/classes/Button.js +6 -0
- package/dist/src/classes/Button.js.map +1 -1
- package/dist/src/classes/Client.d.ts +72 -59
- package/dist/src/classes/Client.d.ts.map +1 -1
- package/dist/src/classes/Client.js +125 -111
- package/dist/src/classes/Client.js.map +1 -1
- package/dist/src/classes/Embed.d.ts +2 -1
- package/dist/src/classes/Embed.d.ts.map +1 -1
- package/dist/src/classes/Embed.js +12 -10
- package/dist/src/classes/Embed.js.map +1 -1
- package/dist/src/createHandle.d.ts +20 -0
- package/dist/src/createHandle.d.ts.map +1 -0
- package/dist/src/createHandle.js +57 -0
- package/dist/src/createHandle.js.map +1 -0
- package/dist/src/factories/channelFactory.d.ts +1 -1
- package/dist/src/factories/channelFactory.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.d.ts +2 -3
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.js +2 -8
- package/dist/src/internals/AutocompleteInteraction.js.map +1 -1
- package/dist/src/internals/CommandHandler.d.ts.map +1 -1
- package/dist/src/internals/CommandHandler.js +4 -2
- package/dist/src/internals/CommandHandler.js.map +1 -1
- package/dist/src/internals/CommandInteraction.d.ts +3 -4
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -1
- package/dist/src/internals/CommandInteraction.js +6 -12
- package/dist/src/internals/CommandInteraction.js.map +1 -1
- package/dist/src/internals/ModalInteraction.d.ts +3 -2
- package/dist/src/internals/ModalInteraction.d.ts.map +1 -1
- package/dist/src/internals/ModalInteraction.js +3 -3
- package/dist/src/internals/ModalInteraction.js.map +1 -1
- package/dist/src/internals/OptionsHandler.d.ts +8 -12
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -1
- package/dist/src/internals/OptionsHandler.js +27 -9
- package/dist/src/internals/OptionsHandler.js.map +1 -1
- package/dist/src/plugins/linked-roles/LinkedRoles.d.ts +61 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.js +196 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.js.map +1 -0
- package/dist/src/plugins/linked-roles/index.d.ts +3 -0
- package/dist/src/plugins/linked-roles/index.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/index.js +3 -0
- package/dist/src/plugins/linked-roles/index.js.map +1 -0
- package/dist/src/plugins/linked-roles/types.d.ts +94 -0
- package/dist/src/plugins/linked-roles/types.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/types.js +39 -0
- package/dist/src/plugins/linked-roles/types.js.map +1 -0
- package/dist/src/structures/DmChannel.d.ts +7 -6
- package/dist/src/structures/DmChannel.d.ts.map +1 -1
- package/dist/src/structures/DmChannel.js +7 -6
- package/dist/src/structures/DmChannel.js.map +1 -1
- package/dist/src/structures/GroupDmChannel.d.ts +17 -19
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -1
- package/dist/src/structures/GroupDmChannel.js +48 -41
- package/dist/src/structures/GroupDmChannel.js.map +1 -1
- package/dist/src/structures/Guild.d.ts +29 -28
- package/dist/src/structures/Guild.d.ts.map +1 -1
- package/dist/src/structures/Guild.js +82 -57
- package/dist/src/structures/Guild.js.map +1 -1
- package/dist/src/structures/GuildAnnouncementChannel.d.ts +3 -4
- package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildAnnouncementChannel.js +1 -3
- package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -1
- package/dist/src/structures/GuildCategoryChannel.d.ts +3 -3
- package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildCategoryChannel.js +0 -1
- package/dist/src/structures/GuildCategoryChannel.js.map +1 -1
- package/dist/src/structures/GuildForumChannel.d.ts +4 -3
- package/dist/src/structures/GuildForumChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildForumChannel.js +4 -3
- package/dist/src/structures/GuildForumChannel.js.map +1 -1
- package/dist/src/structures/GuildMediaChannel.d.ts +3 -7
- package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildMediaChannel.js +1 -6
- package/dist/src/structures/GuildMediaChannel.js.map +1 -1
- package/dist/src/structures/GuildMember.d.ts +28 -26
- package/dist/src/structures/GuildMember.d.ts.map +1 -1
- package/dist/src/structures/GuildMember.js +95 -57
- package/dist/src/structures/GuildMember.js.map +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +12 -11
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.js +22 -13
- package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -1
- package/dist/src/structures/GuildTextChannel.d.ts +6 -6
- package/dist/src/structures/GuildTextChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildTextChannel.js +9 -7
- package/dist/src/structures/GuildTextChannel.js.map +1 -1
- package/dist/src/structures/GuildThreadChannel.d.ts +14 -13
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildThreadChannel.js +59 -28
- package/dist/src/structures/GuildThreadChannel.js.map +1 -1
- package/dist/src/structures/Message.d.ts +50 -41
- package/dist/src/structures/Message.d.ts.map +1 -1
- package/dist/src/structures/Message.js +163 -93
- package/dist/src/structures/Message.js.map +1 -1
- package/dist/src/structures/Role.d.ts +27 -25
- package/dist/src/structures/Role.d.ts.map +1 -1
- package/dist/src/structures/Role.js +100 -61
- package/dist/src/structures/Role.js.map +1 -1
- package/dist/src/structures/User.d.ts +34 -32
- package/dist/src/structures/User.d.ts.map +1 -1
- package/dist/src/structures/User.js +97 -64
- package/dist/src/structures/User.js.map +1 -1
- package/dist/src/types.d.ts +37 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +17 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +16 -5
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -6
|
@@ -3,26 +3,40 @@ import { GuildThreadChannel } from "../structures/GuildThreadChannel.js";
|
|
|
3
3
|
import { Message } from "../structures/Message.js";
|
|
4
4
|
import { BaseGuildChannel } from "./BaseGuildChannel.js";
|
|
5
5
|
export class BaseGuildTextChannel extends BaseGuildChannel {
|
|
6
|
+
/**
|
|
7
|
+
* The topic of the channel.
|
|
8
|
+
*/
|
|
9
|
+
get topic() {
|
|
10
|
+
if (!this.rawData)
|
|
11
|
+
return undefined;
|
|
12
|
+
return this.rawData.topic ?? null;
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* The ID of the last message sent in the channel.
|
|
8
16
|
*
|
|
9
17
|
* @remarks
|
|
10
18
|
* This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
|
|
11
19
|
*/
|
|
12
|
-
lastMessageId
|
|
20
|
+
get lastMessageId() {
|
|
21
|
+
if (!this.rawData)
|
|
22
|
+
return undefined;
|
|
23
|
+
return this.rawData.last_message_id ?? null;
|
|
24
|
+
}
|
|
13
25
|
/**
|
|
14
26
|
* The timestamp of the last pin in the channel.
|
|
15
27
|
*/
|
|
16
|
-
lastPinTimestamp
|
|
28
|
+
get lastPinTimestamp() {
|
|
29
|
+
if (!this.rawData)
|
|
30
|
+
return undefined;
|
|
31
|
+
return this.rawData.last_pin_timestamp ?? null;
|
|
32
|
+
}
|
|
17
33
|
/**
|
|
18
34
|
* The rate limit per user for the channel, in seconds.
|
|
19
35
|
*/
|
|
20
|
-
rateLimitPerUser
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
24
|
-
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
25
|
-
this.setMoreSpecificData(data);
|
|
36
|
+
get rateLimitPerUser() {
|
|
37
|
+
if (!this.rawData)
|
|
38
|
+
return undefined;
|
|
39
|
+
return this.rawData.rate_limit_per_user;
|
|
26
40
|
}
|
|
27
41
|
/**
|
|
28
42
|
* The last message sent in the channel.
|
|
@@ -33,11 +47,13 @@ export class BaseGuildTextChannel extends BaseGuildChannel {
|
|
|
33
47
|
*
|
|
34
48
|
*/
|
|
35
49
|
get lastMessage() {
|
|
50
|
+
if (!this.rawData)
|
|
51
|
+
return undefined;
|
|
36
52
|
if (!this.lastMessageId)
|
|
37
53
|
return null;
|
|
38
54
|
return new Message(this.client, {
|
|
39
55
|
id: this.lastMessageId,
|
|
40
|
-
|
|
56
|
+
channelId: this.id
|
|
41
57
|
});
|
|
42
58
|
}
|
|
43
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseGuildTextChannel.js","sourceRoot":"","sources":["../../../src/abstracts/BaseGuildTextChannel.ts"],"names":[],"mappings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OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,OAAO,IAAI,CAAA;QACpC,OAAO,IAAI,OAAO,CAAO,IAAI,CAAC,MAAM,EAAE;YACrC,EAAE,EAAE,IAAI,CAAC,aAAa;YACtB,SAAS,EAAE,IAAI,CAAC,EAAE;SAClB,CAAC,CAAA;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB;QACtB,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CACvC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAC3B,CAAgC,CAAA;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;IACpD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,IAAuC;QACxD,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YACpE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE;SACjB,CAAC,CAAqB,CAAA;QACvB,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACnD,CAAC;CACD"}
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { type APIInteraction, type InteractionType } from "discord-api-types/v10";
|
|
2
|
-
import { Base, type Client, Embed, Guild, Message, type Modal,
|
|
2
|
+
import { Base, type Client, Embed, Guild, Message, type Modal, User } from "../index.js";
|
|
3
3
|
import { GuildMember } from "../structures/GuildMember.js";
|
|
4
|
-
|
|
5
|
-
* The data to reply to an interaction
|
|
6
|
-
*/
|
|
7
|
-
export type InteractionReplyData = {
|
|
8
|
-
/**
|
|
9
|
-
* The content of the message
|
|
10
|
-
*/
|
|
11
|
-
content?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The embeds of the message
|
|
14
|
-
*/
|
|
15
|
-
embeds?: Embed[];
|
|
16
|
-
/**
|
|
17
|
-
* The components to send in the message, listed in rows
|
|
18
|
-
*/
|
|
19
|
-
components?: Row[];
|
|
20
|
-
};
|
|
4
|
+
import type { MessagePayload } from "../types.js";
|
|
21
5
|
/**
|
|
22
6
|
* Additional options for replying to an interaction
|
|
23
7
|
*/
|
|
@@ -77,22 +61,24 @@ export declare abstract class BaseInteraction<T extends APIInteraction> extends
|
|
|
77
61
|
constructor(client: Client, data: T, defaults: InteractionDefaults);
|
|
78
62
|
get embeds(): Embed[] | null;
|
|
79
63
|
get message(): Message | null;
|
|
80
|
-
get guild(): Guild | null;
|
|
64
|
+
get guild(): Guild<true> | null;
|
|
81
65
|
get user(): User | null;
|
|
82
|
-
get channel(): import("../index.js").DmChannel | import("../index.js").
|
|
83
|
-
get member(): GuildMember | null;
|
|
66
|
+
get channel(): import("../index.js").DmChannel<false> | import("../index.js").GroupDmChannel<false> | import("../index.js").GuildTextChannel<false> | import("../index.js").GuildVoiceChannel<false> | import("../index.js").GuildCategoryChannel<false> | import("../index.js").GuildAnnouncementChannel<false> | import("../index.js").GuildThreadChannel<import("discord-api-types/v10").ThreadChannelType, false> | import("../index.js").GuildStageChannel<false> | import("../index.js").GuildForumChannel<false> | import("../index.js").GuildMediaChannel | null;
|
|
67
|
+
get member(): GuildMember<false, true> | null;
|
|
84
68
|
/**
|
|
85
69
|
* Reply to an interaction.
|
|
86
70
|
* If the interaction is deferred, this will edit the original response.
|
|
87
71
|
* @param data The response data
|
|
88
72
|
*/
|
|
89
|
-
reply(data:
|
|
73
|
+
reply(data: MessagePayload, options?: InteractionReplyOptions): Promise<void>;
|
|
90
74
|
/**
|
|
91
75
|
* Defer the interaction response. This is used automatically by commands that are set to defer.
|
|
92
76
|
* If the interaction is already deferred, this will do nothing.
|
|
93
77
|
* @internal
|
|
94
78
|
*/
|
|
95
|
-
defer(
|
|
79
|
+
defer({ ephemeral }?: {
|
|
80
|
+
ephemeral?: boolean | undefined;
|
|
81
|
+
}): Promise<void>;
|
|
96
82
|
/**
|
|
97
83
|
* Show a modal to the user
|
|
98
84
|
* This can only be used if the interaction is not deferred
|
|
@@ -101,6 +87,6 @@ export declare abstract class BaseInteraction<T extends APIInteraction> extends
|
|
|
101
87
|
/**
|
|
102
88
|
* Send a followup message to the interaction
|
|
103
89
|
*/
|
|
104
|
-
followUp(reply:
|
|
90
|
+
followUp(reply: MessagePayload, options?: InteractionReplyOptions): Promise<void>;
|
|
105
91
|
}
|
|
106
92
|
//# sourceMappingURL=BaseInteraction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,cAAc,EAEnB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"BaseInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,cAAc,EAEnB,KAAK,eAAe,EAMpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,IAAI,EACJ,KAAK,MAAM,EACX,KAAK,EACL,KAAK,EACL,OAAO,EACP,KAAK,KAAK,EACV,IAAI,EAEJ,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACrC;;OAEG;IACH,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,MAAM,MAA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teractionResponseType, MessageFlags, Routes } from "discord-api-types/v10";
|
|
2
2
|
import { Base, Embed, Guild, Message, User, channelFactory } from "../index.js";
|
|
3
3
|
import { GuildMember } from "../structures/GuildMember.js";
|
|
4
|
+
import { serializePayload } from "../utils.js";
|
|
4
5
|
/**
|
|
5
6
|
* This is the base type interaction, all interaction types extend from this
|
|
6
7
|
*/
|
|
@@ -72,13 +73,11 @@ export class BaseInteraction extends Base {
|
|
|
72
73
|
* @param data The response data
|
|
73
74
|
*/
|
|
74
75
|
async reply(data, options = {}) {
|
|
76
|
+
const serialized = serializePayload(data);
|
|
75
77
|
if (this._deferred) {
|
|
76
78
|
await this.client.rest.patch(Routes.webhookMessage(this.client.options.clientId, this.rawData.token, "@original"), {
|
|
77
79
|
body: {
|
|
78
|
-
...
|
|
79
|
-
embeds: data.embeds?.map((embed) => embed.serialize()),
|
|
80
|
-
components: data.components?.map((row) => row.serialize()),
|
|
81
|
-
flags: options.ephemeral ? 64 : undefined
|
|
80
|
+
...serialized
|
|
82
81
|
},
|
|
83
82
|
files: options.files
|
|
84
83
|
});
|
|
@@ -88,10 +87,11 @@ export class BaseInteraction extends Base {
|
|
|
88
87
|
body: {
|
|
89
88
|
type: InteractionResponseType.ChannelMessageWithSource,
|
|
90
89
|
data: {
|
|
91
|
-
...
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
...serialized,
|
|
91
|
+
flags: options.ephemeral || this.defaultEphemeral
|
|
92
|
+
? MessageFlags.Ephemeral |
|
|
93
|
+
("flags" in serialized ? (serialized.flags ?? 0) : 0)
|
|
94
|
+
: undefined
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
files: options.files
|
|
@@ -103,14 +103,18 @@ export class BaseInteraction extends Base {
|
|
|
103
103
|
* If the interaction is already deferred, this will do nothing.
|
|
104
104
|
* @internal
|
|
105
105
|
*/
|
|
106
|
-
async defer() {
|
|
106
|
+
async defer({ ephemeral = false } = {}) {
|
|
107
107
|
if (this._deferred)
|
|
108
108
|
return;
|
|
109
109
|
this._deferred = true;
|
|
110
110
|
await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
|
|
111
111
|
body: {
|
|
112
112
|
type: InteractionResponseType.DeferredChannelMessageWithSource,
|
|
113
|
-
|
|
113
|
+
data: {
|
|
114
|
+
flags: ephemeral || this.defaultEphemeral
|
|
115
|
+
? MessageFlags.Ephemeral
|
|
116
|
+
: undefined
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
}
|
|
@@ -132,12 +136,14 @@ export class BaseInteraction extends Base {
|
|
|
132
136
|
* Send a followup message to the interaction
|
|
133
137
|
*/
|
|
134
138
|
async followUp(reply, options = {}) {
|
|
139
|
+
const serialized = serializePayload(reply);
|
|
135
140
|
await this.client.rest.post(Routes.webhook(this.client.options.clientId, this.rawData.token), {
|
|
136
141
|
body: {
|
|
137
|
-
...
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
...serialized,
|
|
143
|
+
flags: options.ephemeral
|
|
144
|
+
? MessageFlags.Ephemeral |
|
|
145
|
+
("flags" in serialized ? (serialized.flags ?? 0) : 0)
|
|
146
|
+
: undefined
|
|
141
147
|
},
|
|
142
148
|
files: options.files
|
|
143
149
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,uBAAuB,
|
|
1
|
+
{"version":3,"file":"BaseInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/BaseInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,uBAAuB,EAEvB,YAAY,EAIZ,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,IAAI,EAEJ,KAAK,EACL,KAAK,EACL,OAAO,EAEP,IAAI,EACJ,cAAc,EACd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,WAAW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
|
-
import type { APIGuildForumDefaultReactionEmoji, APIGuildForumTag,
|
|
1
|
+
import type { APIGuildForumDefaultReactionEmoji, APIGuildForumTag, APIThreadOnlyChannel, ChannelType, SortOrderType } from "discord-api-types/v10";
|
|
2
|
+
import type { MessagePayload } from "../types.js";
|
|
3
|
+
import type { IfPartial } from "../utils.js";
|
|
2
4
|
import { BaseGuildChannel } from "./BaseGuildChannel.js";
|
|
3
|
-
export declare abstract class GuildThreadOnlyChannel<Type extends ChannelType.GuildForum | ChannelType.GuildMedia> extends BaseGuildChannel<Type> {
|
|
5
|
+
export declare abstract class GuildThreadOnlyChannel<Type extends ChannelType.GuildForum | ChannelType.GuildMedia, IsPartial extends boolean = false> extends BaseGuildChannel<Type, IsPartial> {
|
|
6
|
+
rawData: APIThreadOnlyChannel<Type> | null;
|
|
4
7
|
/**
|
|
5
8
|
* The topic of the channel.
|
|
6
9
|
*/
|
|
7
|
-
topic
|
|
10
|
+
get topic(): IfPartial<IsPartial, string | null>;
|
|
8
11
|
/**
|
|
9
12
|
* The default auto archive duration of the channel.
|
|
10
13
|
*/
|
|
11
|
-
defaultAutoArchiveDuration
|
|
14
|
+
get defaultAutoArchiveDuration(): IfPartial<IsPartial, number | null>;
|
|
12
15
|
/**
|
|
13
|
-
* The
|
|
16
|
+
* The default thread rate limit per user for the channel.
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
get defaultThreadRateLimitPerUser(): IfPartial<IsPartial, number | null>;
|
|
16
19
|
/**
|
|
17
|
-
* The
|
|
20
|
+
* The available tags to set on posts in the channel.
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
get availableTags(): IfPartial<IsPartial, APIGuildForumTag[]>;
|
|
20
23
|
/**
|
|
21
24
|
* The default reaction emoji for the channel.
|
|
22
25
|
*/
|
|
23
|
-
defaultReactionEmoji
|
|
26
|
+
get defaultReactionEmoji(): IfPartial<IsPartial, APIGuildForumDefaultReactionEmoji | null>;
|
|
24
27
|
/**
|
|
25
28
|
* The default sort order for the channel, by latest activity or by creation date.
|
|
26
29
|
*/
|
|
27
|
-
defaultSortOrder
|
|
28
|
-
protected setSpecificData(data: APIThreadOnlyChannel<Type>): void;
|
|
29
|
-
protected abstract setMoreSpecificData(data: APIThreadOnlyChannel<Type>): void;
|
|
30
|
+
get defaultSortOrder(): IfPartial<IsPartial, SortOrderType | null>;
|
|
30
31
|
/**
|
|
31
32
|
* You cannot send a message directly to a forum or media channel, so this method throws an error.
|
|
32
33
|
* Use {@link GuildThreadChannel.send} instead, or the alias {@link GuildThreadOnlyChannel.sendToPost} instead, to send a message to the channel's posts.
|
|
@@ -37,6 +38,6 @@ export declare abstract class GuildThreadOnlyChannel<Type extends ChannelType.Gu
|
|
|
37
38
|
* @remarks
|
|
38
39
|
* This is an alias for {@link GuildThreadChannel.send} that will fetch the channel, but if you already have the channel, you can use {@link GuildThreadChannel.send} instead.
|
|
39
40
|
*/
|
|
40
|
-
sendToPost(message:
|
|
41
|
+
sendToPost(message: MessagePayload, postId: string): Promise<void>;
|
|
41
42
|
}
|
|
42
43
|
//# sourceMappingURL=GuildThreadOnlyChannel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuildThreadOnlyChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iCAAiC,EACjC,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"GuildThreadOnlyChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iCAAiC,EACjC,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,aAAa,EAEb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,8BAAsB,sBAAsB,CAC3C,IAAI,SAAS,WAAW,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,EAC5D,SAAS,SAAS,OAAO,GAAG,KAAK,CAChC,SAAQ,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC;IAClC,OAAO,EAAE,oBAAoB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAElD;;OAEG;IACH,IAAI,KAAK,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,CAG/C;IAED;;OAEG;IACH,IAAI,0BAA0B,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,CAGpE;IAED;;OAEG;IACH,IAAI,6BAA6B,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,CAGvE;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,SAAS,CAAC,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAG5D;IAED;;OAEG;IACH,IAAI,oBAAoB,IAAI,SAAS,CACpC,SAAS,EACT,iCAAiC,GAAG,IAAI,CACxC,CAGA;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,SAAS,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC,CAGjE;IAED;;;OAGG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAMpC;;;;OAIG;IACG,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOxE"}
|
|
@@ -4,35 +4,50 @@ export class GuildThreadOnlyChannel extends BaseGuildChannel {
|
|
|
4
4
|
/**
|
|
5
5
|
* The topic of the channel.
|
|
6
6
|
*/
|
|
7
|
-
topic
|
|
7
|
+
get topic() {
|
|
8
|
+
if (!this.rawData)
|
|
9
|
+
return undefined;
|
|
10
|
+
return this.rawData.topic ?? null;
|
|
11
|
+
}
|
|
8
12
|
/**
|
|
9
13
|
* The default auto archive duration of the channel.
|
|
10
14
|
*/
|
|
11
|
-
defaultAutoArchiveDuration
|
|
15
|
+
get defaultAutoArchiveDuration() {
|
|
16
|
+
if (!this.rawData)
|
|
17
|
+
return undefined;
|
|
18
|
+
return this.rawData.default_auto_archive_duration ?? null;
|
|
19
|
+
}
|
|
12
20
|
/**
|
|
13
|
-
* The
|
|
21
|
+
* The default thread rate limit per user for the channel.
|
|
14
22
|
*/
|
|
15
|
-
|
|
23
|
+
get defaultThreadRateLimitPerUser() {
|
|
24
|
+
if (!this.rawData)
|
|
25
|
+
return undefined;
|
|
26
|
+
return this.rawData.default_thread_rate_limit_per_user ?? null;
|
|
27
|
+
}
|
|
16
28
|
/**
|
|
17
|
-
* The
|
|
29
|
+
* The available tags to set on posts in the channel.
|
|
18
30
|
*/
|
|
19
|
-
|
|
31
|
+
get availableTags() {
|
|
32
|
+
if (!this.rawData)
|
|
33
|
+
return undefined;
|
|
34
|
+
return this.rawData.available_tags ?? [];
|
|
35
|
+
}
|
|
20
36
|
/**
|
|
21
37
|
* The default reaction emoji for the channel.
|
|
22
38
|
*/
|
|
23
|
-
defaultReactionEmoji
|
|
39
|
+
get defaultReactionEmoji() {
|
|
40
|
+
if (!this.rawData)
|
|
41
|
+
return undefined;
|
|
42
|
+
return this.rawData.default_reaction_emoji;
|
|
43
|
+
}
|
|
24
44
|
/**
|
|
25
45
|
* The default sort order for the channel, by latest activity or by creation date.
|
|
26
46
|
*/
|
|
27
|
-
defaultSortOrder
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
this.availableTags = data.available_tags;
|
|
32
|
-
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
|
|
33
|
-
this.defaultReactionEmoji = data.default_reaction_emoji;
|
|
34
|
-
this.defaultSortOrder = data.default_sort_order;
|
|
35
|
-
this.setMoreSpecificData(data);
|
|
47
|
+
get defaultSortOrder() {
|
|
48
|
+
if (!this.rawData)
|
|
49
|
+
return undefined;
|
|
50
|
+
return this.rawData.default_sort_order;
|
|
36
51
|
}
|
|
37
52
|
/**
|
|
38
53
|
* You cannot send a message directly to a forum or media channel, so this method throws an error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuildThreadOnlyChannel.js","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"GuildThreadOnlyChannel.js","sourceRoot":"","sources":["../../../src/abstracts/GuildThreadOnlyChannel.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAGxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,OAAgB,sBAGpB,SAAQ,gBAAiC;IAG1C;;OAEG;IACH,IAAI,KAAK;QACR,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,IAAI,0BAA0B;QAC7B,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,6BAA6B,IAAI,IAAI,CAAA;IAC1D,CAAC;IAED;;OAEG;IACH,IAAI,6BAA6B;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,IAAI,IAAI,CAAA;IAC/D,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAA;IACzC,CAAC;IAED;;OAEG;IACH,IAAI,oBAAoB;QAIvB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAA;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,gBAAgB;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAA;IACvC,CAAC;IAED;;;OAGG;IACM,KAAK,CAAC,IAAI;QAClB,MAAM,IAAI,KAAK,CACd,wMAAwM,CACxM,CAAA;IACF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,OAAuB,EAAE,MAAc;QACvD,MAAM,OAAO,GAAG,IAAI,kBAAkB,CACrC,IAAI,CAAC,MAAM,EACX,MAAM,CACN,CAAA;QACD,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC5B,CAAC;CACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare abstract class Plugin {
|
|
2
|
+
routes: Route[];
|
|
3
|
+
}
|
|
4
|
+
export interface Route {
|
|
5
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
6
|
+
path: `/${string}`;
|
|
7
|
+
handler(req: Request, ctx?: Context): Response | Promise<Response>;
|
|
8
|
+
protected?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface Context {
|
|
12
|
+
waitUntil?(promise: Promise<any>): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../../src/abstracts/Plugin.ts"],"names":[],"mappings":"AAAA,8BAAsB,MAAM;IAC3B,MAAM,EAAE,KAAK,EAAE,CAAK;CACpB;AAED,MAAM,WAAW,KAAK;IACrB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;IACnD,IAAI,EAAE,IAAI,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAClE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,OAAO;IAEvB,SAAS,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../../src/abstracts/Plugin.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,MAAM;IAC3B,MAAM,GAAY,EAAE,CAAA;CACpB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Bun from "bun";
|
|
2
|
+
import type { Handle } from "../../createHandle.js";
|
|
3
|
+
import type { ServerOptions } from "../shared.js";
|
|
4
|
+
export type Server = ReturnType<typeof Bun.serve>;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Bun server using the provided handle function and options
|
|
7
|
+
* @param handle The handle function created by {@link createHandle}
|
|
8
|
+
* @param options The server options including the port and hostname
|
|
9
|
+
* @returns The created server instance
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const server = createServer(handle, { ... })
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function createServer(handle: Handle, options: ServerOptions): Server;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/bun/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAA;AAEjD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAO3E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Bun from "bun";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Bun server using the provided handle function and options
|
|
4
|
+
* @param handle The handle function created by {@link createHandle}
|
|
5
|
+
* @param options The server options including the port and hostname
|
|
6
|
+
* @returns The created server instance
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const server = createServer(handle, { ... })
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export function createServer(handle, options) {
|
|
13
|
+
const fetch = handle(process.env);
|
|
14
|
+
return Bun.serve({
|
|
15
|
+
fetch: (req) => fetch(req, {}),
|
|
16
|
+
port: options.port,
|
|
17
|
+
hostname: options.hostname
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/bun/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAMrB;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,OAAsB;IAClE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACjC,OAAO,GAAG,CAAC,KAAK,CAAC;QAChB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC1B,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ExecutionContext } from "@cloudflare/workers-types";
|
|
2
|
+
import type { Handle } from "../../createHandle.js";
|
|
3
|
+
import type { PartialEnv } from "../shared.js";
|
|
4
|
+
export type Handler = (req: Request, env: PartialEnv, ctx: ExecutionContext) => Promise<Response>;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Cloudflare handler function using the provided handle and handler options
|
|
7
|
+
* @param handle - The handle function to process requests
|
|
8
|
+
* @returns The created handler function
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const handler = createHandler(handle, { ... })
|
|
12
|
+
* export default { fetch: handler }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function createHandler(handle: Handle): Handler;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/cloudflare/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,MAAM,OAAO,GAAG,CACrB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,gBAAgB,KACjB,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEtB;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKrD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a Cloudflare handler function using the provided handle and handler options
|
|
3
|
+
* @param handle - The handle function to process requests
|
|
4
|
+
* @returns The created handler function
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const handler = createHandler(handle, { ... })
|
|
8
|
+
* export default { fetch: handler }
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export function createHandler(handle) {
|
|
12
|
+
return (req, env, ctx) => {
|
|
13
|
+
const fetch = handle(env);
|
|
14
|
+
return fetch(req, ctx);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/cloudflare/index.ts"],"names":[],"mappings":"AAUA;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC3C,OAAO,CAAC,GAAY,EAAE,GAAe,EAAE,GAAqB,EAAE,EAAE;QAC/D,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACvB,CAAC,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Handle } from "../../createHandle.js";
|
|
2
|
+
export type Handler = (req: Request) => Promise<Response>;
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Next.js handler function using the provided handle and handler options
|
|
5
|
+
* @param handle - The handle function to process requests
|
|
6
|
+
* @returns The created handler function
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const handler = createHandler(handle, { ... })
|
|
10
|
+
* export { handler as GET, handler as POST }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function createHandler(handle: Handle): Handler;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/next/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEzD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKrD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a Next.js handler function using the provided handle and handler options
|
|
3
|
+
* @param handle - The handle function to process requests
|
|
4
|
+
* @returns The created handler function
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const handler = createHandler(handle, { ... })
|
|
8
|
+
* export { handler as GET, handler as POST }
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export function createHandler(handle) {
|
|
12
|
+
return (req) => {
|
|
13
|
+
const fetch = handle(process.env);
|
|
14
|
+
return fetch(req);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/next/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC3C,OAAO,CAAC,GAAY,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACjC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Hono from "@hono/node-server";
|
|
2
|
+
import type { Handle } from "../../createHandle.js";
|
|
3
|
+
import type { ServerOptions } from "../shared.js";
|
|
4
|
+
export type Server = ReturnType<typeof Hono.serve>;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Node.js server using the provided handle function and options
|
|
7
|
+
* @param handle The handle function created by {@link createHandle}
|
|
8
|
+
* @param options The server options including the port and hostname
|
|
9
|
+
* @returns The created server instance
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const server = createServer(handle, { ... })
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function createServer(handle: Handle, options: ServerOptions): Server;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;AAElD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAO3E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Hono from "@hono/node-server";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Node.js server using the provided handle function and options
|
|
4
|
+
* @param handle The handle function created by {@link createHandle}
|
|
5
|
+
* @param options The server options including the port and hostname
|
|
6
|
+
* @returns The created server instance
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const server = createServer(handle, { ... })
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export function createServer(handle, options) {
|
|
13
|
+
const fetch = handle(process.env);
|
|
14
|
+
return Hono.serve({
|
|
15
|
+
fetch: (req) => fetch(req, {}),
|
|
16
|
+
port: options.port,
|
|
17
|
+
hostname: options.hostname
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAA;AAMzC;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,OAAsB;IAClE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC;QACjB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC1B,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type PartialEnv = Record<string, string | undefined>;
|
|
2
|
+
export interface SharedOptions {
|
|
3
|
+
}
|
|
4
|
+
export interface ServerOptions extends SharedOptions {
|
|
5
|
+
port: number;
|
|
6
|
+
hostname?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HandlerOptions extends SharedOptions {
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=shared.d.ts.map
|