@fedify/botkit 0.3.0-dev.109 → 0.3.0-dev.112
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/bot-impl.d.ts +3 -2
- package/dist/bot-impl.d.ts.map +1 -1
- package/dist/bot-impl.js +80 -2
- package/dist/bot-impl.js.map +1 -1
- package/dist/bot-impl.test.js +247 -1
- package/dist/bot-impl.test.js.map +1 -1
- package/dist/bot.d.ts +16 -2
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +6 -0
- package/dist/bot.js.map +1 -1
- package/dist/components/Message.d.ts +2 -2
- package/dist/deno.js +10 -3
- package/dist/deno.js.map +1 -1
- package/dist/events.d.ts +13 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/mod.d.ts +4 -3
- package/dist/mod.js +1 -1
- package/dist/pages.d.ts +2 -2
- package/dist/poll.d.ts +60 -0
- package/dist/poll.d.ts.map +1 -0
- package/dist/poll.js +4 -0
- package/dist/repository.d.ts +6 -0
- package/dist/repository.d.ts.map +1 -1
- package/dist/repository.js +1 -0
- package/dist/repository.js.map +1 -1
- package/dist/session-impl.d.ts +5 -3
- package/dist/session-impl.d.ts.map +1 -1
- package/dist/session-impl.js +20 -1
- package/dist/session-impl.js.map +1 -1
- package/dist/session-impl.test.d.ts.map +1 -1
- package/dist/session-impl.test.js +160 -1
- package/dist/session-impl.test.js.map +1 -1
- package/dist/session.d.ts +44 -3
- package/dist/session.d.ts.map +1 -1
- package/package.json +18 -2
package/dist/bot.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
|
|
2
2
|
Date.prototype.toTemporalInstant = toTemporalInstant;
|
|
3
3
|
import { Text } from "./text.js";
|
|
4
|
-
import { Repository } from "./repository.js";
|
|
5
4
|
import { Session } from "./session.js";
|
|
6
5
|
import { CustomEmoji, DeferredCustomEmoji } from "./emoji.js";
|
|
7
|
-
import { AcceptEventHandler, FollowEventHandler, LikeEventHandler, MentionEventHandler, MessageEventHandler, QuoteEventHandler, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, SharedMessageEventHandler, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler } from "./events.js";
|
|
6
|
+
import { AcceptEventHandler, FollowEventHandler, LikeEventHandler, MentionEventHandler, MessageEventHandler, QuoteEventHandler, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, SharedMessageEventHandler, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler, VoteEventHandler } from "./events.js";
|
|
7
|
+
import { Repository } from "./repository.js";
|
|
8
8
|
import { Context, Federation, KvStore, MessageQueue } from "@fedify/fedify/federation";
|
|
9
9
|
import { Application, Application as Application$1, Image, Image as Image$1, Service, Service as Service$1 } from "@fedify/fedify/vocab";
|
|
10
10
|
import { SemVer, Software, Software as Software$1, parseSemVer } from "@fedify/fedify/nodeinfo";
|
|
@@ -116,6 +116,20 @@ interface Bot<TContextData> {
|
|
|
116
116
|
* @since 0.2.0
|
|
117
117
|
*/
|
|
118
118
|
onUnreact?: UndoneReactionEventHandler<TContextData>;
|
|
119
|
+
/**
|
|
120
|
+
* An event handler for a vote in a poll. This event is only triggered when
|
|
121
|
+
* the bot is the author of the poll, and the vote is made by another actor.
|
|
122
|
+
* If the poll allows multiple selections, this event is triggered multiple
|
|
123
|
+
* times, once for each option selected by the actor.
|
|
124
|
+
*
|
|
125
|
+
* Note that this event can be triggered even if the voter vote an option
|
|
126
|
+
* multiple times or multiple options for a poll that disallows multiple
|
|
127
|
+
* selections. You should validate the vote in the event handler by storing
|
|
128
|
+
* the votes in a persistent store, and checking if the vote is valid.
|
|
129
|
+
* (This behavior can subject to change in the future.)
|
|
130
|
+
* @since 0.3.0
|
|
131
|
+
*/
|
|
132
|
+
onVote?: VoteEventHandler<TContextData>;
|
|
119
133
|
}
|
|
120
134
|
/**
|
|
121
135
|
* A specialized {@link Bot} tpe that doesn't require context data.
|
package/dist/bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.d.ts","names":[],"sources":["../src/bot.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"bot.d.ts","names":[],"sources":["../src/bot.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;UAsDiB;EAAA;;;;EAKgB,SAgBZ,UAAA,EAhBE,UAgBF,CAhBa,YAgBb,CAAA;EAAG;;;EAEZ,SAOkB,UAAA,EAAA,MAAA;EAAY;;;;;;;;EAwBJ,UAAE,CAAA,MAAA,EAAA,MAAA,GAjCnB,GAiCmB,EAAA,WAAA,EAhCvB,YAgCuB,CAAA,EA/BnC,OA+BmC,CA/B3B,YA+B2B,CAAA;EAAW;;;;;EACC,UAAtC,CAAA,OAAA,EAzBQ,OAyBR,CAzBgB,YAyBhB,CAAA,CAAA,EAzBgC,OAyBhC,CAzBwC,YAyBxC,CAAA;EAAM;;;;;;;EAeiB,KAKC,CAAA,OAAA,EApCrB,OAoCqB,EAAA,WAAA,EApCC,YAoCD,CAAA,EApCgB,OAoChB,CApCwB,QAoCxB,CAAA;EAAY;;;;;;;;;;;;EAiCV,eAA7B,CAAA,mBAAA,MAAA,CAAA,CAAA,MAAA,EAtDC,QAsDD,CAtDU,MAsDV,CAtDiB,UAsDjB,EAtD6B,WAsD7B,CAAA,CAAA,CAAA,EArDN,QAqDM,CArDG,MAqDH,CArDU,UAqDV,EArDsB,mBAqDtB,CArD0C,YAqD1C,CAAA,CAAA,CAAA;EAAgB;;;EAWkB,QAAjC,CAAA,EA3DC,kBA2DD,CA3DoB,YA2DpB,CAAA;EAAoB;;;EAqBQ,UAA7B,CAAA,EA3EI,oBA2EJ,CA3EyB,YA2EzB,CAAA;EAAgB;AAM3B;;EAAwC,cAUnB,CAAA,EAtFF,kBAsFE,CAtFiB,YAsFjB,CAAA;EAAG;;;EASqB,cAQf,CAAA,EAlGX,kBAkGW,CAlGQ,YAkGR,CAAA;EAAG;;;EAQU,SAAhB,CAAA,EArGb,mBAqGa,CArGO,YAqGP,CAAA;EAAO;AAnCiB;AAyCnD;EAAiC,OAAA,CAAA,EAtGrB,iBAsGqB,CAtGH,YAsGG,CAAA;EAAA;;;;EAgCR,OAKP,CAAA,EArIN,iBAqIM,CArIY,YAqIZ,CAAA;EAAG;;;;EAYuD,SAArC,CAAA,EA3IzB,mBA2IyB,CA3IL,YA2IK,CAAA;EAAI;;;;EA8BZ,eAMT,CAAA,EAzKF,yBAyKE,CAzKwB,YAyKxB,CAAA;EAAQ;AAeC;AAM/B;EAwCgB,MAAA,CAAA,EAjOL,gBAiOc,CAjOG,YAiOH,CAAA;EAAA;;;EACE,QACxB,CAAA,EA9NU,kBA8NV,CA9N6B,YA8N7B,CAAA;EAAY;;;AAA4C;YAxN/C,qBAAqB;;;;;cAMnB,2BAA2B;;;;;;;;;;;;;;WAe9B,iBAAiB;;;;;UAMX,sBAAA,SAA+B;;;;;;;;;8BAU3B,yBAEhB;;;;;;sBAOiB,gBAAgB;;;;;;;8BAQR,MAAM;;;;;;;iBAQnB,UAAU,QAAQ;;;;;UAMlB;;;;;;;;;;;;;;;0BAgBS,mBAAiB;;;;;;;;;;;;;qBAgBtB,cAAc;;;;kBAKjB,MAAM;;;;;mBAML,MAAM;;;;;wBAMD,eAAe,yBAAyB;;;;;;;;;;;;;;;eAiBjD;;;;;wBAMS;;;;;;mBAOL;;;;;sBAMG;;;;;;;;;;;;;mBAeH;;;;;UAMF,YAAA;;;;;;;;;;;;;;;;;;iBAwCD,wCACL,iBAAiB,gBACzB,4BAA4B,yBAAyB,IAAI"}
|
package/dist/bot.js
CHANGED
package/dist/bot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.js","names":["options: CreateBotOptions<TContextData>","b?","emojis: Readonly<Record<TEmojiName, CustomEmoji>>"],"sources":["../src/bot.ts"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\nimport type {\n Context,\n Federation,\n KvStore,\n MessageQueue,\n} from \"@fedify/fedify/federation\";\nimport type { Software } from \"@fedify/fedify/nodeinfo\";\nimport type { Application, Image, Service } from \"@fedify/fedify/vocab\";\nimport { BotImpl } from \"./bot-impl.ts\";\nimport type { CustomEmoji, DeferredCustomEmoji } from \"./emoji.ts\";\nimport type {\n AcceptEventHandler,\n FollowEventHandler,\n LikeEventHandler,\n MentionEventHandler,\n MessageEventHandler,\n QuoteEventHandler,\n ReactionEventHandler,\n RejectEventHandler,\n ReplyEventHandler,\n SharedMessageEventHandler,\n UndoneReactionEventHandler,\n UnfollowEventHandler,\n UnlikeEventHandler,\n} from \"./events.ts\";\nimport type { Repository } from \"./repository.ts\";\nimport type { Session } from \"./session.ts\";\nimport type { Text } from \"./text.ts\";\nexport {\n parseSemVer,\n type SemVer,\n type Software,\n} from \"@fedify/fedify/nodeinfo\";\nexport { Application, Image, Service } from \"@fedify/fedify/vocab\";\n\n/**\n * A bot that can interact with the ActivityPub network.\n */\nexport interface Bot<TContextData> {\n /**\n * An internal Fedify federation instance. Normally you don't need to access\n * this directly.\n */\n readonly federation: Federation<TContextData>;\n\n /**\n * The internal identifier for the bot actor. It is used for the actor URI.\n */\n readonly identifier: string;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: TContextData,\n ): Session<TContextData>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<TContextData>): Session<TContextData>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @param contextData The context data to pass to the federation.\n * @returns The response to the request.\n */\n fetch(request: Request, contextData: TContextData): Promise<Response>;\n\n /**\n * Defines custom emojis for the bot. The custom emojis are used for\n * rendering the bot's profile and posts. The custom emojis are defined\n * by their names, and the names are used as the keys of the emojis.\n * @param emojis The custom emojis to define. The keys are the names of\n * the emojis, and the values are the custom emoji definitions.\n * @returns The defined emojis. The keys are the names of the emojis, and\n * the values are the emoji objects, which are used for passing\n * to the {@link customEmoji} function.\n * @throws {TypeError} If any emoji name is invalid or duplicate.\n * @since 0.2.0\n */\n addCustomEmojis<TEmojiName extends string>(\n emojis: Readonly<Record<TEmojiName, CustomEmoji>>,\n ): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>;\n\n /**\n * An event handler for a follow request to the bot.\n */\n onFollow?: FollowEventHandler<TContextData>;\n\n /**\n * An event handler for an unfollow event from the bot.\n */\n onUnfollow?: UnfollowEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is accepted.\n */\n onAcceptFollow?: AcceptEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is rejected.\n */\n onRejectFollow?: RejectEventHandler<TContextData>;\n\n /**\n * An event handler for a message mentioned to the bot.\n */\n onMention?: MentionEventHandler<TContextData>;\n\n /**\n * An event handler for a reply to the bot.\n */\n onReply?: ReplyEventHandler<TContextData>;\n\n /**\n * An event handler for a quote of the bot's message.\n * @since 0.2.0\n */\n onQuote?: QuoteEventHandler<TContextData>;\n\n /**\n * An event handler for a message shown to the bot's timeline. To listen\n * to this event, your bot needs to follow others first.\n */\n onMessage?: MessageEventHandler<TContextData>;\n\n /**\n * An event handler for a message shared to the bot. To listen to this event,\n * your bot needs to follow others first.\n */\n onSharedMessage?: SharedMessageEventHandler<TContextData>;\n\n /**\n * An event handler for a like of a message.\n */\n onLike?: LikeEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of a like of a message.\n */\n onUnlike?: UnlikeEventHandler<TContextData>;\n\n /**\n * An event handler for an emoji reaction to a message.\n * @since 0.2.0\n */\n onReact?: ReactionEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of an emoji reaction to a message.\n * @since 0.2.0\n */\n onUnreact?: UndoneReactionEventHandler<TContextData>;\n}\n\n/**\n * A specialized {@link Bot} tpe that doesn't require context data.\n */\nexport interface BotWithVoidContextData extends Bot<void> {\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: void,\n ): Session<void>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<void>): Session<void>;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n */\n getSession(origin: string | URL): Session<void>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @returns The response to the request.\n */\n fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Options for creating a bot.\n */\nexport interface CreateBotOptions<TContextData> {\n /**\n * The internal identifier of the bot. Since it is used for the actor URI,\n * it *should not* be changed after the bot is federated.\n *\n * If omitted, `\"bot\"` will be used.\n * @default `\"bot\"`\n */\n readonly identifier?: string;\n\n /**\n * The type of the bot actor. It should be either `Service` or `Application`.\n *\n * If omitted, `Service` will be used.\n * @default `Service`\n */\n readonly class?: typeof Service | typeof Application;\n\n /**\n * The username of the bot. It will be a part of the fediverse handle.\n * It can be changed after the bot is federated.\n */\n readonly username: string;\n\n /**\n * The display name of the bot. It can be changed after the bot is federated.\n */\n readonly name?: string;\n\n /**\n * The description of the bot. It can be changed after the bot is federated.\n */\n readonly summary?: Text<\"block\", TContextData>;\n\n /**\n * The avatar URL of the bot. It can be changed after the bot is federated.\n */\n readonly icon?: URL | Image;\n\n /**\n * The header image URL of the bot. It can be changed after the bot is\n * federated.\n */\n readonly image?: URL | Image;\n\n /**\n * The custom properties of the bot. It can be changed after the bot is\n * federated.\n */\n readonly properties?: Record<string, Text<\"block\" | \"inline\", TContextData>>;\n\n /**\n * How to handle incoming follow requests. Note that this behavior can be\n * overridden by manually invoking {@link FollowRequest.accept} or\n * {@link FollowRequest.reject} in the {@link Bot.onFollow} event handler.\n *\n * - `\"accept\"` (default): Automatically accept all incoming follow requests.\n * - `\"reject\"`: Automatically reject all incoming follow requests.\n * - `\"manual\"`: Require manual handling of incoming follow requests.\n * @default `\"accept\"`\n */\n readonly followerPolicy?: \"accept\" | \"reject\" | \"manual\";\n\n /**\n * The underlying key-value store to use for storing data.\n */\n readonly kv: KvStore;\n\n /**\n * The underlying repository to use for storing data. If omitted,\n * {@link KvRepository} will be used.\n */\n readonly repository?: Repository;\n\n /**\n * The underlying message queue to use for handling incoming and outgoing\n * activities. If omitted, incoming activities are processed immediately,\n * and outgoing activities are sent immediately.\n */\n readonly queue?: MessageQueue;\n\n /**\n * The software information of the bot. If omitted, the NodeInfo protocol\n * will be unimplemented.\n */\n readonly software?: Software;\n\n /**\n * Whether to trust `X-Forwarded-*` headers. If your bot application is\n * behind an L7 reverse proxy, turn it on.\n *\n * Turned off by default.\n * @default `false`\n */\n readonly behindProxy?: boolean;\n\n /**\n * The options for the web pages of the bot. If omitted, the default options\n * will be used.\n */\n readonly pages?: PagesOptions;\n}\n\n/**\n * Options for the web pages of the bot.\n */\nexport interface PagesOptions {\n /**\n * The color of the theme. It will be used for the theme color of the web\n * pages. The default color is `\"green\"`.\n * @default `\"green\"`\n */\n readonly color?:\n | \"amber\"\n | \"azure\"\n | \"blue\"\n | \"cyan\"\n | \"fuchsia\"\n | \"green\"\n | \"grey\"\n | \"indigo\"\n | \"jade\"\n | \"lime\"\n | \"orange\"\n | \"pink\"\n | \"pumpkin\"\n | \"purple\"\n | \"red\"\n | \"sand\"\n | \"slate\"\n | \"violet\"\n | \"yellow\"\n | \"zinc\";\n\n /**\n * The CSS code for the bot. It will be used for the custom CSS of the web\n * pages.\n */\n readonly css?: string;\n}\n\n/**\n * Creates a {@link Bot} instance.\n * @param options The options for creating the bot.\n * @returns The created bot instance.\n */\nexport function createBot<TContextData = void>(\n options: CreateBotOptions<TContextData>,\n): TContextData extends void ? BotWithVoidContextData : Bot<TContextData> {\n const bot = new BotImpl<TContextData>(options);\n // Since `deno serve` does not recognize a class instance having fetch(),\n // we wrap a BotImpl instance with a plain object.\n // See also https://github.com/denoland/deno/issues/24062\n const wrapper = {\n impl: bot,\n get federation() {\n return bot.federation;\n },\n get identifier() {\n return bot.identifier;\n },\n getSession(a, b?) {\n // @ts-ignore: BotImpl.getSession() implements Bot.getSession()\n return bot.getSession(a, b);\n },\n fetch(request, contextData) {\n return bot.fetch(request, contextData);\n },\n addCustomEmojis<TEmojiName extends string>(\n emojis: Readonly<Record<TEmojiName, CustomEmoji>>,\n ): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>> {\n return bot.addCustomEmojis(emojis);\n },\n get onFollow() {\n return bot.onFollow;\n },\n set onFollow(value) {\n bot.onFollow = value;\n },\n get onUnfollow() {\n return bot.onUnfollow;\n },\n set onUnfollow(value) {\n bot.onUnfollow = value;\n },\n get onAcceptFollow() {\n return bot.onAcceptFollow;\n },\n set onAcceptFollow(value) {\n bot.onAcceptFollow = value;\n },\n get onRejectFollow() {\n return bot.onRejectFollow;\n },\n set onRejectFollow(value) {\n bot.onRejectFollow = value;\n },\n get onMention() {\n return bot.onMention;\n },\n set onMention(value) {\n bot.onMention = value;\n },\n get onReply() {\n return bot.onReply;\n },\n set onReply(value) {\n bot.onReply = value;\n },\n get onQuote() {\n return bot.onQuote;\n },\n set onQuote(value) {\n bot.onQuote = value;\n },\n get onMessage() {\n return bot.onMessage;\n },\n set onMessage(value) {\n bot.onMessage = value;\n },\n get onSharedMessage() {\n return bot.onSharedMessage;\n },\n set onSharedMessage(value) {\n bot.onSharedMessage = value;\n },\n get onLike() {\n return bot.onLike;\n },\n set onLike(value) {\n bot.onLike = value;\n },\n get onUnlike() {\n return bot.onUnlike;\n },\n set onUnlike(value) {\n bot.onUnlike = value;\n },\n get onReact() {\n return bot.onReact;\n },\n set onReact(value) {\n bot.onReact = value;\n },\n get onUnreact() {\n return bot.onUnreact;\n },\n set onUnreact(value) {\n bot.onUnreact = value;\n },\n } satisfies Bot<TContextData> & { impl: BotImpl<TContextData> };\n // @ts-ignore: the wrapper implements BotWithVoidContextData\n return wrapper;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmXA,SAAgB,UACdA,SACwE;CACxE,MAAM,MAAM,IAAI,QAAsB;CAItC,MAAM,UAAU;EACd,MAAM;EACN,IAAI,aAAa;AACf,UAAO,IAAI;EACZ;EACD,IAAI,aAAa;AACf,UAAO,IAAI;EACZ;EACD,WAAW,GAAGC,GAAI;AAEhB,UAAO,IAAI,WAAW,GAAG,EAAE;EAC5B;EACD,MAAM,SAAS,aAAa;AAC1B,UAAO,IAAI,MAAM,SAAS,YAAY;EACvC;EACD,gBACEC,QACiE;AACjE,UAAO,IAAI,gBAAgB,OAAO;EACnC;EACD,IAAI,WAAW;AACb,UAAO,IAAI;EACZ;EACD,IAAI,SAAS,OAAO;AAClB,OAAI,WAAW;EAChB;EACD,IAAI,aAAa;AACf,UAAO,IAAI;EACZ;EACD,IAAI,WAAW,OAAO;AACpB,OAAI,aAAa;EAClB;EACD,IAAI,iBAAiB;AACnB,UAAO,IAAI;EACZ;EACD,IAAI,eAAe,OAAO;AACxB,OAAI,iBAAiB;EACtB;EACD,IAAI,iBAAiB;AACnB,UAAO,IAAI;EACZ;EACD,IAAI,eAAe,OAAO;AACxB,OAAI,iBAAiB;EACtB;EACD,IAAI,YAAY;AACd,UAAO,IAAI;EACZ;EACD,IAAI,UAAU,OAAO;AACnB,OAAI,YAAY;EACjB;EACD,IAAI,UAAU;AACZ,UAAO,IAAI;EACZ;EACD,IAAI,QAAQ,OAAO;AACjB,OAAI,UAAU;EACf;EACD,IAAI,UAAU;AACZ,UAAO,IAAI;EACZ;EACD,IAAI,QAAQ,OAAO;AACjB,OAAI,UAAU;EACf;EACD,IAAI,YAAY;AACd,UAAO,IAAI;EACZ;EACD,IAAI,UAAU,OAAO;AACnB,OAAI,YAAY;EACjB;EACD,IAAI,kBAAkB;AACpB,UAAO,IAAI;EACZ;EACD,IAAI,gBAAgB,OAAO;AACzB,OAAI,kBAAkB;EACvB;EACD,IAAI,SAAS;AACX,UAAO,IAAI;EACZ;EACD,IAAI,OAAO,OAAO;AAChB,OAAI,SAAS;EACd;EACD,IAAI,WAAW;AACb,UAAO,IAAI;EACZ;EACD,IAAI,SAAS,OAAO;AAClB,OAAI,WAAW;EAChB;EACD,IAAI,UAAU;AACZ,UAAO,IAAI;EACZ;EACD,IAAI,QAAQ,OAAO;AACjB,OAAI,UAAU;EACf;EACD,IAAI,YAAY;AACd,UAAO,IAAI;EACZ;EACD,IAAI,UAAU,OAAO;AACnB,OAAI,YAAY;EACjB;CACF;AAED,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"bot.js","names":["options: CreateBotOptions<TContextData>","b?","emojis: Readonly<Record<TEmojiName, CustomEmoji>>"],"sources":["../src/bot.ts"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\nimport type {\n Context,\n Federation,\n KvStore,\n MessageQueue,\n} from \"@fedify/fedify/federation\";\nimport type { Software } from \"@fedify/fedify/nodeinfo\";\nimport type { Application, Image, Service } from \"@fedify/fedify/vocab\";\nimport { BotImpl } from \"./bot-impl.ts\";\nimport type { CustomEmoji, DeferredCustomEmoji } from \"./emoji.ts\";\nimport type {\n AcceptEventHandler,\n FollowEventHandler,\n LikeEventHandler,\n MentionEventHandler,\n MessageEventHandler,\n QuoteEventHandler,\n ReactionEventHandler,\n RejectEventHandler,\n ReplyEventHandler,\n SharedMessageEventHandler,\n UndoneReactionEventHandler,\n UnfollowEventHandler,\n UnlikeEventHandler,\n VoteEventHandler,\n} from \"./events.ts\";\nimport type { Repository } from \"./repository.ts\";\nimport type { Session } from \"./session.ts\";\nimport type { Text } from \"./text.ts\";\nexport {\n parseSemVer,\n type SemVer,\n type Software,\n} from \"@fedify/fedify/nodeinfo\";\nexport { Application, Image, Service } from \"@fedify/fedify/vocab\";\n\n/**\n * A bot that can interact with the ActivityPub network.\n */\nexport interface Bot<TContextData> {\n /**\n * An internal Fedify federation instance. Normally you don't need to access\n * this directly.\n */\n readonly federation: Federation<TContextData>;\n\n /**\n * The internal identifier for the bot actor. It is used for the actor URI.\n */\n readonly identifier: string;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: TContextData,\n ): Session<TContextData>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<TContextData>): Session<TContextData>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @param contextData The context data to pass to the federation.\n * @returns The response to the request.\n */\n fetch(request: Request, contextData: TContextData): Promise<Response>;\n\n /**\n * Defines custom emojis for the bot. The custom emojis are used for\n * rendering the bot's profile and posts. The custom emojis are defined\n * by their names, and the names are used as the keys of the emojis.\n * @param emojis The custom emojis to define. The keys are the names of\n * the emojis, and the values are the custom emoji definitions.\n * @returns The defined emojis. The keys are the names of the emojis, and\n * the values are the emoji objects, which are used for passing\n * to the {@link customEmoji} function.\n * @throws {TypeError} If any emoji name is invalid or duplicate.\n * @since 0.2.0\n */\n addCustomEmojis<TEmojiName extends string>(\n emojis: Readonly<Record<TEmojiName, CustomEmoji>>,\n ): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>;\n\n /**\n * An event handler for a follow request to the bot.\n */\n onFollow?: FollowEventHandler<TContextData>;\n\n /**\n * An event handler for an unfollow event from the bot.\n */\n onUnfollow?: UnfollowEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is accepted.\n */\n onAcceptFollow?: AcceptEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is rejected.\n */\n onRejectFollow?: RejectEventHandler<TContextData>;\n\n /**\n * An event handler for a message mentioned to the bot.\n */\n onMention?: MentionEventHandler<TContextData>;\n\n /**\n * An event handler for a reply to the bot.\n */\n onReply?: ReplyEventHandler<TContextData>;\n\n /**\n * An event handler for a quote of the bot's message.\n * @since 0.2.0\n */\n onQuote?: QuoteEventHandler<TContextData>;\n\n /**\n * An event handler for a message shown to the bot's timeline. To listen\n * to this event, your bot needs to follow others first.\n */\n onMessage?: MessageEventHandler<TContextData>;\n\n /**\n * An event handler for a message shared to the bot. To listen to this event,\n * your bot needs to follow others first.\n */\n onSharedMessage?: SharedMessageEventHandler<TContextData>;\n\n /**\n * An event handler for a like of a message.\n */\n onLike?: LikeEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of a like of a message.\n */\n onUnlike?: UnlikeEventHandler<TContextData>;\n\n /**\n * An event handler for an emoji reaction to a message.\n * @since 0.2.0\n */\n onReact?: ReactionEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of an emoji reaction to a message.\n * @since 0.2.0\n */\n onUnreact?: UndoneReactionEventHandler<TContextData>;\n\n /**\n * An event handler for a vote in a poll. This event is only triggered when\n * the bot is the author of the poll, and the vote is made by another actor.\n * If the poll allows multiple selections, this event is triggered multiple\n * times, once for each option selected by the actor.\n *\n * Note that this event can be triggered even if the voter vote an option\n * multiple times or multiple options for a poll that disallows multiple\n * selections. You should validate the vote in the event handler by storing\n * the votes in a persistent store, and checking if the vote is valid.\n * (This behavior can subject to change in the future.)\n * @since 0.3.0\n */\n onVote?: VoteEventHandler<TContextData>;\n}\n\n/**\n * A specialized {@link Bot} tpe that doesn't require context data.\n */\nexport interface BotWithVoidContextData extends Bot<void> {\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: void,\n ): Session<void>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<void>): Session<void>;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n */\n getSession(origin: string | URL): Session<void>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @returns The response to the request.\n */\n fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Options for creating a bot.\n */\nexport interface CreateBotOptions<TContextData> {\n /**\n * The internal identifier of the bot. Since it is used for the actor URI,\n * it *should not* be changed after the bot is federated.\n *\n * If omitted, `\"bot\"` will be used.\n * @default `\"bot\"`\n */\n readonly identifier?: string;\n\n /**\n * The type of the bot actor. It should be either `Service` or `Application`.\n *\n * If omitted, `Service` will be used.\n * @default `Service`\n */\n readonly class?: typeof Service | typeof Application;\n\n /**\n * The username of the bot. It will be a part of the fediverse handle.\n * It can be changed after the bot is federated.\n */\n readonly username: string;\n\n /**\n * The display name of the bot. It can be changed after the bot is federated.\n */\n readonly name?: string;\n\n /**\n * The description of the bot. It can be changed after the bot is federated.\n */\n readonly summary?: Text<\"block\", TContextData>;\n\n /**\n * The avatar URL of the bot. It can be changed after the bot is federated.\n */\n readonly icon?: URL | Image;\n\n /**\n * The header image URL of the bot. It can be changed after the bot is\n * federated.\n */\n readonly image?: URL | Image;\n\n /**\n * The custom properties of the bot. It can be changed after the bot is\n * federated.\n */\n readonly properties?: Record<string, Text<\"block\" | \"inline\", TContextData>>;\n\n /**\n * How to handle incoming follow requests. Note that this behavior can be\n * overridden by manually invoking {@link FollowRequest.accept} or\n * {@link FollowRequest.reject} in the {@link Bot.onFollow} event handler.\n *\n * - `\"accept\"` (default): Automatically accept all incoming follow requests.\n * - `\"reject\"`: Automatically reject all incoming follow requests.\n * - `\"manual\"`: Require manual handling of incoming follow requests.\n * @default `\"accept\"`\n */\n readonly followerPolicy?: \"accept\" | \"reject\" | \"manual\";\n\n /**\n * The underlying key-value store to use for storing data.\n */\n readonly kv: KvStore;\n\n /**\n * The underlying repository to use for storing data. If omitted,\n * {@link KvRepository} will be used.\n */\n readonly repository?: Repository;\n\n /**\n * The underlying message queue to use for handling incoming and outgoing\n * activities. If omitted, incoming activities are processed immediately,\n * and outgoing activities are sent immediately.\n */\n readonly queue?: MessageQueue;\n\n /**\n * The software information of the bot. If omitted, the NodeInfo protocol\n * will be unimplemented.\n */\n readonly software?: Software;\n\n /**\n * Whether to trust `X-Forwarded-*` headers. If your bot application is\n * behind an L7 reverse proxy, turn it on.\n *\n * Turned off by default.\n * @default `false`\n */\n readonly behindProxy?: boolean;\n\n /**\n * The options for the web pages of the bot. If omitted, the default options\n * will be used.\n */\n readonly pages?: PagesOptions;\n}\n\n/**\n * Options for the web pages of the bot.\n */\nexport interface PagesOptions {\n /**\n * The color of the theme. It will be used for the theme color of the web\n * pages. The default color is `\"green\"`.\n * @default `\"green\"`\n */\n readonly color?:\n | \"amber\"\n | \"azure\"\n | \"blue\"\n | \"cyan\"\n | \"fuchsia\"\n | \"green\"\n | \"grey\"\n | \"indigo\"\n | \"jade\"\n | \"lime\"\n | \"orange\"\n | \"pink\"\n | \"pumpkin\"\n | \"purple\"\n | \"red\"\n | \"sand\"\n | \"slate\"\n | \"violet\"\n | \"yellow\"\n | \"zinc\";\n\n /**\n * The CSS code for the bot. It will be used for the custom CSS of the web\n * pages.\n */\n readonly css?: string;\n}\n\n/**\n * Creates a {@link Bot} instance.\n * @param options The options for creating the bot.\n * @returns The created bot instance.\n */\nexport function createBot<TContextData = void>(\n options: CreateBotOptions<TContextData>,\n): TContextData extends void ? BotWithVoidContextData : Bot<TContextData> {\n const bot = new BotImpl<TContextData>(options);\n // Since `deno serve` does not recognize a class instance having fetch(),\n // we wrap a BotImpl instance with a plain object.\n // See also https://github.com/denoland/deno/issues/24062\n const wrapper = {\n impl: bot,\n get federation() {\n return bot.federation;\n },\n get identifier() {\n return bot.identifier;\n },\n getSession(a, b?) {\n // @ts-ignore: BotImpl.getSession() implements Bot.getSession()\n return bot.getSession(a, b);\n },\n fetch(request, contextData) {\n return bot.fetch(request, contextData);\n },\n addCustomEmojis<TEmojiName extends string>(\n emojis: Readonly<Record<TEmojiName, CustomEmoji>>,\n ): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>> {\n return bot.addCustomEmojis(emojis);\n },\n get onFollow() {\n return bot.onFollow;\n },\n set onFollow(value) {\n bot.onFollow = value;\n },\n get onUnfollow() {\n return bot.onUnfollow;\n },\n set onUnfollow(value) {\n bot.onUnfollow = value;\n },\n get onAcceptFollow() {\n return bot.onAcceptFollow;\n },\n set onAcceptFollow(value) {\n bot.onAcceptFollow = value;\n },\n get onRejectFollow() {\n return bot.onRejectFollow;\n },\n set onRejectFollow(value) {\n bot.onRejectFollow = value;\n },\n get onMention() {\n return bot.onMention;\n },\n set onMention(value) {\n bot.onMention = value;\n },\n get onReply() {\n return bot.onReply;\n },\n set onReply(value) {\n bot.onReply = value;\n },\n get onQuote() {\n return bot.onQuote;\n },\n set onQuote(value) {\n bot.onQuote = value;\n },\n get onMessage() {\n return bot.onMessage;\n },\n set onMessage(value) {\n bot.onMessage = value;\n },\n get onSharedMessage() {\n return bot.onSharedMessage;\n },\n set onSharedMessage(value) {\n bot.onSharedMessage = value;\n },\n get onLike() {\n return bot.onLike;\n },\n set onLike(value) {\n bot.onLike = value;\n },\n get onUnlike() {\n return bot.onUnlike;\n },\n set onUnlike(value) {\n bot.onUnlike = value;\n },\n get onReact() {\n return bot.onReact;\n },\n set onReact(value) {\n bot.onReact = value;\n },\n get onUnreact() {\n return bot.onUnreact;\n },\n set onUnreact(value) {\n bot.onUnreact = value;\n },\n get onVote() {\n return bot.onVote;\n },\n set onVote(value) {\n bot.onVote = value;\n },\n } satisfies Bot<TContextData> & { impl: BotImpl<TContextData> };\n // @ts-ignore: the wrapper implements BotWithVoidContextData\n return wrapper;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmYA,SAAgB,UACdA,SACwE;CACxE,MAAM,MAAM,IAAI,QAAsB;CAItC,MAAM,UAAU;EACd,MAAM;EACN,IAAI,aAAa;AACf,UAAO,IAAI;EACZ;EACD,IAAI,aAAa;AACf,UAAO,IAAI;EACZ;EACD,WAAW,GAAGC,GAAI;AAEhB,UAAO,IAAI,WAAW,GAAG,EAAE;EAC5B;EACD,MAAM,SAAS,aAAa;AAC1B,UAAO,IAAI,MAAM,SAAS,YAA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ACX,UAAO,IAAI;EACZ;EACD,IAAI,OAAO,OAAO;AAChB,OAAI,SAAS;EACd;CACF;AAED,QAAO;AACR"}
|
|
@@ -2,7 +2,7 @@ import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
|
|
|
2
2
|
Date.prototype.toTemporalInstant = toTemporalInstant;
|
|
3
3
|
import { MessageClass } from "../message.js";
|
|
4
4
|
import { Session } from "../session.js";
|
|
5
|
-
import * as
|
|
5
|
+
import * as hono_utils_html1 from "hono/utils/html";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Message.d.ts
|
|
8
8
|
interface MessageProps {
|
|
@@ -12,7 +12,7 @@ interface MessageProps {
|
|
|
12
12
|
declare function Message({
|
|
13
13
|
session,
|
|
14
14
|
message
|
|
15
|
-
}: MessageProps): Promise<
|
|
15
|
+
}: MessageProps): Promise<hono_utils_html1.HtmlEscapedString>;
|
|
16
16
|
declare function renderCustomEmojis(html: string, emojis: Record<string, string>): string;
|
|
17
17
|
//# sourceMappingURL=Message.d.ts.map
|
|
18
18
|
|
package/dist/deno.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
//#region deno.json
|
|
6
6
|
var name = "@fedify/botkit";
|
|
7
|
-
var version = "0.3.0-dev.
|
|
7
|
+
var version = "0.3.0-dev.112+8f983226";
|
|
8
8
|
var license = "AGPL-3.0-only";
|
|
9
9
|
var unstable = ["kv", "temporal"];
|
|
10
10
|
var exports = {
|
|
@@ -14,12 +14,14 @@ var exports = {
|
|
|
14
14
|
"./events": "./src/events.ts",
|
|
15
15
|
"./follow": "./src/follow.ts",
|
|
16
16
|
"./message": "./src/message.ts",
|
|
17
|
+
"./poll": "./src/poll.ts",
|
|
17
18
|
"./reaction": "./src/reaction.ts",
|
|
19
|
+
"./repository": "./src/repository.ts",
|
|
18
20
|
"./session": "./src/session.ts",
|
|
19
21
|
"./text": "./src/text.ts"
|
|
20
22
|
};
|
|
21
23
|
var imports = {
|
|
22
|
-
"@fedify/fedify": "jsr:@fedify/fedify@^1.
|
|
24
|
+
"@fedify/fedify": "jsr:@fedify/fedify@^1.7.1",
|
|
23
25
|
"@fedify/markdown-it-hashtag": "jsr:@fedify/markdown-it-hashtag@^0.3.0",
|
|
24
26
|
"@fedify/markdown-it-mention": "jsr:@fedify/markdown-it-mention@^0.3.0",
|
|
25
27
|
"@logtape/logtape": "jsr:@logtape/logtape@^1.0.0",
|
|
@@ -50,7 +52,12 @@ var fmt = { "exclude": [
|
|
|
50
52
|
var tasks = {
|
|
51
53
|
"check": "deno check src/ && deno lint && deno fmt --check && deno publish --dry-run --allow-dirty && deno run scripts/check_versions.ts",
|
|
52
54
|
"test": "deno test --allow-env=NODE_V8_COVERAGE,JEST_WORKER_ID --allow-net=hollo.social --parallel",
|
|
53
|
-
"test
|
|
55
|
+
"test:node": "pnpm install && pnpm test",
|
|
56
|
+
"test-all": { "dependencies": [
|
|
57
|
+
"check",
|
|
58
|
+
"test",
|
|
59
|
+
"test:node"
|
|
60
|
+
] },
|
|
54
61
|
"coverage": "deno task test --coverage --clean && deno coverage --html",
|
|
55
62
|
"hooks:install": "deno run --allow-read=deno.json,.git/hooks/ --allow-write=.git/hooks/ jsr:@hongminhee/deno-task-hooks",
|
|
56
63
|
"hooks:pre-commit": "deno task check"
|
package/dist/deno.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deno.js","names":[],"sources":["../deno.json"],"sourcesContent":["{\n \"name\": \"@fedify/botkit\",\n \"version\": \"0.3.0-dev.
|
|
1
|
+
{"version":3,"file":"deno.js","names":[],"sources":["../deno.json"],"sourcesContent":["{\n \"name\": \"@fedify/botkit\",\n \"version\": \"0.3.0-dev.112+8f983226\",\n \"license\": \"AGPL-3.0-only\",\n \"unstable\": [\n \"kv\",\n \"temporal\"\n ],\n \"exports\": {\n \".\": \"./src/mod.ts\",\n \"./bot\": \"./src/bot.ts\",\n \"./emoji\": \"./src/emoji.ts\",\n \"./events\": \"./src/events.ts\",\n \"./follow\": \"./src/follow.ts\",\n \"./message\": \"./src/message.ts\",\n \"./poll\": \"./src/poll.ts\",\n \"./reaction\": \"./src/reaction.ts\",\n \"./repository\": \"./src/repository.ts\",\n \"./session\": \"./src/session.ts\",\n \"./text\": \"./src/text.ts\"\n },\n \"imports\": {\n \"@fedify/fedify\": \"jsr:@fedify/fedify@^1.7.1\",\n \"@fedify/markdown-it-hashtag\": \"jsr:@fedify/markdown-it-hashtag@^0.3.0\",\n \"@fedify/markdown-it-mention\": \"jsr:@fedify/markdown-it-mention@^0.3.0\",\n \"@logtape/logtape\": \"jsr:@logtape/logtape@^1.0.0\",\n \"@phensley/language-tag\": \"npm:@phensley/language-tag@^1.12.2\",\n \"hono\": \"jsr:@hono/hono@^4.8.2\",\n \"html-entities\": \"npm:html-entities@^2.6.0\",\n \"markdown-it\": \"npm:markdown-it@^14.1.0\",\n \"mime-db\": \"npm:mime-db@^1.54.0\",\n \"tsdown\": \"npm:tsdown@^0.12.8\",\n \"uuid\": \"npm:uuid@^11.1.0\",\n \"x-forwarded-fetch\": \"jsr:@hongminhee/x-forwarded-fetch@^0.2.0\",\n \"xss\": \"npm:xss@^1.0.15\"\n },\n \"nodeModulesDir\": \"none\",\n \"exclude\": [\n \".github\",\n \".vscode\",\n \"dist\",\n \"docs\",\n \"src/css\"\n ],\n \"fmt\": {\n \"exclude\": [\n \"*.md\",\n \"*.yaml\",\n \"*.yml\",\n \"src/static/*.ts\"\n ]\n },\n \"tasks\": {\n \"check\": \"deno check src/ && deno lint && deno fmt --check && deno publish --dry-run --allow-dirty && deno run scripts/check_versions.ts\",\n \"test\": \"deno test --allow-env=NODE_V8_COVERAGE,JEST_WORKER_ID --allow-net=hollo.social --parallel\",\n \"test:node\": \"pnpm install && pnpm test\",\n \"test-all\": {\n \"dependencies\": [\n \"check\",\n \"test\",\n \"test:node\"\n ]\n },\n \"coverage\": \"deno task test --coverage --clean && deno coverage --html\",\n \"hooks:install\": \"deno run --allow-read=deno.json,.git/hooks/ --allow-write=.git/hooks/ jsr:@hongminhee/deno-task-hooks\",\n \"hooks:pre-commit\": \"deno task check\"\n }\n}\n"],"mappings":";;;;;WACU;cACG;cACA;eACC,CACV,MACA,UACD;cACU;CACT,KAAK;CACL,SAAS;CACT,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,aAAa;CACb,UAAU;CACV,cAAc;CACd,gBAAgB;CAChB,aAAa;CACb,UAAU;AACX;cACU;CACT,kBAAkB;CAClB,+BAA+B;CAC/B,+BAA+B;CAC/B,oBAAoB;CACpB,0BAA0B;CAC1B,QAAQ;CACR,iBAAiB;CACjB,eAAe;CACf,WAAW;CACX,UAAU;CACV,QAAQ;CACR,qBAAqB;CACrB,OAAO;AACR;qBACiB;cACP;CACT;CACA;CACA;CACA;CACA;AACD;UACM,EACL,WAAW;CACT;CACA;CACA;CACA;AACD,EACF;YACQ;CACP,SAAS;CACT,QAAQ;CACR,aAAa;CACb,YAAY,EACV,gBAAgB;EACd;EACA;EACA;CACD,EACF;CACD,YAAY;CACZ,iBAAiB;CACjB,oBAAoB;AACrB;mBAlEH;;;;;;;;;;;AAmEC"}
|
package/dist/events.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
|
|
|
2
2
|
Date.prototype.toTemporalInstant = toTemporalInstant;
|
|
3
3
|
import { Like, Reaction } from "./reaction.js";
|
|
4
4
|
import { Message, MessageClass, SharedMessage } from "./message.js";
|
|
5
|
+
import { Vote } from "./poll.js";
|
|
5
6
|
import { Session } from "./session.js";
|
|
6
7
|
import { FollowRequest } from "./follow.js";
|
|
7
8
|
import { Actor } from "@fedify/fedify/vocab";
|
|
@@ -103,8 +104,19 @@ type ReactionEventHandler<TContextData> = (session: Session<TContextData>, react
|
|
|
103
104
|
* @since 0.2.0
|
|
104
105
|
*/
|
|
105
106
|
type UndoneReactionEventHandler<TContextData> = (session: Session<TContextData>, reaction: Reaction<TContextData>) => void | Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* An event handler for a vote in a poll. This event is only triggered when
|
|
109
|
+
* the bot is the author of the poll, and the vote is made by another actor.
|
|
110
|
+
* Note that if the poll allows multiple selections, this event is triggered
|
|
111
|
+
* multiple times, once for each option selected by the actor.
|
|
112
|
+
* @typeParam TContextData The type of the context data.
|
|
113
|
+
* @param session The session of the bot.
|
|
114
|
+
* @param vote The vote made by another actor in the poll.
|
|
115
|
+
* @since 0.3.0
|
|
116
|
+
*/
|
|
117
|
+
type VoteEventHandler<TContextData> = (session: Session<TContextData>, vote: Vote<TContextData>) => void | Promise<void>;
|
|
106
118
|
//# sourceMappingURL=events.d.ts.map
|
|
107
119
|
|
|
108
120
|
//#endregion
|
|
109
|
-
export { AcceptEventHandler, FollowEventHandler, LikeEventHandler, MentionEventHandler, MessageEventHandler, QuoteEventHandler, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, SharedMessageEventHandler, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler };
|
|
121
|
+
export { AcceptEventHandler, FollowEventHandler, LikeEventHandler, MentionEventHandler, MessageEventHandler, QuoteEventHandler, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, SharedMessageEventHandler, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler, VoteEventHandler };
|
|
110
122
|
//# sourceMappingURL=events.d.ts.map
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;AA4BY,KAAA,kBAAkB,CAAA,YAAA,CAAA,GAAA,CAAA,OAAA,EACnB,OADmB,CACX,YADW,CAAA,EAAA,aAAA,EAEb,aAFa,EAAA,GAAA,IAAA,GAGlB,OAHkB,CAAA,IAAA,CAAA;;;;;;AAGX;AAQP,KAAA,oBAA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A,GAiBC,OAjBD,CAAA,IAAA,CAAA"}
|
package/dist/mod.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ Date.prototype.toTemporalInstant = toTemporalInstant;
|
|
|
3
3
|
import { AuthorizedLike, AuthorizedReaction, EmojiReact, Like, RawLike, Reaction } from "./reaction.js";
|
|
4
4
|
import { Text, customEmoji, em, hashtag, link, mention, plainText, strong, text } from "./text.js";
|
|
5
5
|
import { Actor, Article, Audio, AuthorizedMessage, AuthorizedSharedMessage, ChatMessage, Document, Hashtag, LanguageTag, Message, MessageClass, MessageShareOptions, MessageVisibility, Note, Question, SharedMessage, Video, isActor, parseLanguageTag } from "./message.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Poll, Vote } from "./poll.js";
|
|
7
7
|
import { Session, SessionGetOutboxOptions, SessionPublishOptions, SessionPublishOptionsWithClass } from "./session.js";
|
|
8
8
|
import { CustomEmoji, DeferredCustomEmoji, Emoji, emoji, isEmoji } from "./emoji.js";
|
|
9
9
|
import { FollowRequest } from "./follow.js";
|
|
10
|
-
import { AcceptEventHandler, FollowEventHandler, LikeEventHandler, MentionEventHandler, MessageEventHandler, QuoteEventHandler, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, SharedMessageEventHandler, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler } from "./events.js";
|
|
10
|
+
import { AcceptEventHandler, FollowEventHandler, LikeEventHandler, MentionEventHandler, MessageEventHandler, QuoteEventHandler, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, SharedMessageEventHandler, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler, VoteEventHandler } from "./events.js";
|
|
11
|
+
import { Announce, Create, KvRepository, MemoryCachedRepository, MemoryRepository, Repository } from "./repository.js";
|
|
11
12
|
import { Application, Bot, BotWithVoidContextData, CreateBotOptions, Image, PagesOptions, SemVer, Service, Software, createBot, parseSemVer } from "./bot.js";
|
|
12
13
|
import { InProcessMessageQueue, InProcessMessageQueueOptions, MemoryKvStore, ParallelMessageQueue } from "@fedify/fedify/federation";
|
|
13
|
-
export { AcceptEventHandler, Actor, Announce, Application, Article, Audio, AuthorizedLike, AuthorizedMessage, AuthorizedReaction, AuthorizedSharedMessage, Bot, BotWithVoidContextData, ChatMessage, Create, CreateBotOptions, CustomEmoji, DeferredCustomEmoji, Document, Emoji, EmojiReact, FollowEventHandler, FollowRequest, Hashtag, Image, InProcessMessageQueue, InProcessMessageQueueOptions, KvRepository, LanguageTag, Like, LikeEventHandler, MemoryCachedRepository, MemoryKvStore, MemoryRepository, MentionEventHandler, Message, MessageClass, MessageEventHandler, MessageShareOptions, MessageVisibility, Note, PagesOptions, ParallelMessageQueue, Question, QuoteEventHandler, RawLike, Reaction, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, Repository, SemVer, Service, Session, SessionGetOutboxOptions, SessionPublishOptions, SessionPublishOptionsWithClass, SharedMessage, SharedMessageEventHandler, Software, Text, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler, Video, createBot, customEmoji, em, emoji, hashtag, isActor, isEmoji, link, mention, parseLanguageTag, parseSemVer, plainText, strong, text };
|
|
14
|
+
export { AcceptEventHandler, Actor, Announce, Application, Article, Audio, AuthorizedLike, AuthorizedMessage, AuthorizedReaction, AuthorizedSharedMessage, Bot, BotWithVoidContextData, ChatMessage, Create, CreateBotOptions, CustomEmoji, DeferredCustomEmoji, Document, Emoji, EmojiReact, FollowEventHandler, FollowRequest, Hashtag, Image, InProcessMessageQueue, InProcessMessageQueueOptions, KvRepository, LanguageTag, Like, LikeEventHandler, MemoryCachedRepository, MemoryKvStore, MemoryRepository, MentionEventHandler, Message, MessageClass, MessageEventHandler, MessageShareOptions, MessageVisibility, Note, PagesOptions, ParallelMessageQueue, Poll, Question, QuoteEventHandler, RawLike, Reaction, ReactionEventHandler, RejectEventHandler, ReplyEventHandler, Repository, SemVer, Service, Session, SessionGetOutboxOptions, SessionPublishOptions, SessionPublishOptionsWithClass, SharedMessage, SharedMessageEventHandler, Software, Text, UndoneReactionEventHandler, UnfollowEventHandler, UnlikeEventHandler, Video, Vote, VoteEventHandler, createBot, customEmoji, em, emoji, hashtag, isActor, isEmoji, link, mention, parseLanguageTag, parseSemVer, plainText, strong, text };
|
package/dist/mod.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { emoji, isEmoji } from "./emoji.js";
|
|
6
6
|
import { Announce, Create, KvRepository, MemoryCachedRepository, MemoryRepository } from "./repository.js";
|
|
7
|
+
import { Article, Audio, ChatMessage, Document, Hashtag, LanguageTag, Note, Question, Video, isActor, parseLanguageTag } from "./message.js";
|
|
7
8
|
import { Application, Image, Service, createBot, parseSemVer } from "./bot.js";
|
|
8
9
|
import { customEmoji, em, hashtag, link, mention, plainText, strong, text } from "./text.js";
|
|
9
|
-
import { Article, Audio, ChatMessage, Document, Hashtag, LanguageTag, Note, Question, Video, isActor, parseLanguageTag } from "./message.js";
|
|
10
10
|
import { EmojiReact, RawLike } from "./reaction.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "@fedify/fedify/federation";
|
|
12
12
|
|
package/dist/pages.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
|
|
|
2
2
|
Date.prototype.toTemporalInstant = toTemporalInstant;
|
|
3
3
|
import { BotImpl } from "./bot-impl.js";
|
|
4
4
|
import { Hono } from "hono";
|
|
5
|
-
import * as
|
|
5
|
+
import * as hono_types0 from "hono/types";
|
|
6
6
|
|
|
7
7
|
//#region src/pages.d.ts
|
|
8
8
|
interface Bindings {
|
|
@@ -12,7 +12,7 @@ interface Bindings {
|
|
|
12
12
|
interface Env {
|
|
13
13
|
readonly Bindings: Bindings;
|
|
14
14
|
}
|
|
15
|
-
declare const app: Hono<Env,
|
|
15
|
+
declare const app: Hono<Env, hono_types0.BlankSchema, "/">;
|
|
16
16
|
//# sourceMappingURL=pages.d.ts.map
|
|
17
17
|
|
|
18
18
|
//#endregion
|
package/dist/poll.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
|
|
2
|
+
Date.prototype.toTemporalInstant = toTemporalInstant;
|
|
3
|
+
import { Message } from "./message.js";
|
|
4
|
+
import { Actor, Note, Question } from "@fedify/fedify/vocab";
|
|
5
|
+
|
|
6
|
+
//#region src/poll.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* An interface representing a poll.
|
|
9
|
+
* @since 0.3.0
|
|
10
|
+
*/
|
|
11
|
+
interface Poll {
|
|
12
|
+
/**
|
|
13
|
+
* Whether the poll allows multiple selections.
|
|
14
|
+
*/
|
|
15
|
+
readonly multiple: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The options of the poll. Each option is a string. **Every option must be
|
|
18
|
+
* unique, and must not be empty.**
|
|
19
|
+
*/
|
|
20
|
+
readonly options: readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* The time when the poll ends.
|
|
23
|
+
*/
|
|
24
|
+
readonly endTime: Temporal.Instant;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* An interface representing a vote in a poll. Note that if the poll allows
|
|
28
|
+
* multiple selections, the options are represented as multiple {@link Vote}
|
|
29
|
+
* objects, each with a single option.
|
|
30
|
+
* @typeParam TContextData The type of the context data.
|
|
31
|
+
* @since 0.3.0
|
|
32
|
+
*/
|
|
33
|
+
interface Vote<TContextData> {
|
|
34
|
+
/**
|
|
35
|
+
* The underlying raw note object.
|
|
36
|
+
*/
|
|
37
|
+
readonly raw: Note;
|
|
38
|
+
/**
|
|
39
|
+
* The actor who voted.
|
|
40
|
+
*/
|
|
41
|
+
readonly actor: Actor;
|
|
42
|
+
/**
|
|
43
|
+
* The question to which the poll belongs.
|
|
44
|
+
*/
|
|
45
|
+
readonly message: Message<Question, TContextData>;
|
|
46
|
+
/**
|
|
47
|
+
* The poll to which the vote belongs.
|
|
48
|
+
*/
|
|
49
|
+
readonly poll: Poll;
|
|
50
|
+
/**
|
|
51
|
+
* The options selected by the actor. Note that this is a string even
|
|
52
|
+
* if the poll allows multiple selections. If the poll allows multiple
|
|
53
|
+
* selections, the options are represented as multiple {@link Vote} objects.
|
|
54
|
+
*/
|
|
55
|
+
readonly option: string;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=poll.d.ts.map
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Poll, Vote };
|
|
60
|
+
//# sourceMappingURL=poll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll.d.ts","names":[],"sources":["../src/poll.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAsBiB,IAAA;;AAAjB;AAyBA;EAAqB,SAAA,QAAA,EAAA,OAAA;EAAA;;;;EAc6B,SAA9B,OAAA,EAAA,SAAA,MAAA,EAAA;EAAO;AAKN;;oBA7BD,QAAA,CAAS;;;;;;;;;UAUZ;;;;gBAID;;;;kBAKE;;;;oBAKE,QAAQ,UAAU;;;;iBAKrB"}
|
package/dist/poll.js
ADDED
package/dist/repository.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ import { Actor, Announce, Announce as Announce$1, Create, Create as Create$1, Fo
|
|
|
6
6
|
//#region src/repository.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* A UUID (universally unique identifier).
|
|
9
|
+
* @since 0.3.0
|
|
9
10
|
*/
|
|
10
11
|
type Uuid = ReturnType<typeof crypto.randomUUID>;
|
|
11
12
|
/**
|
|
12
13
|
* A repository for storing bot data.
|
|
14
|
+
* @since 0.3.0
|
|
13
15
|
*/
|
|
14
16
|
interface Repository {
|
|
15
17
|
/**
|
|
@@ -142,6 +144,7 @@ interface Repository {
|
|
|
142
144
|
}
|
|
143
145
|
/**
|
|
144
146
|
* Options for getting messages from the repository.
|
|
147
|
+
* @since 0.3.0
|
|
145
148
|
*/
|
|
146
149
|
interface RepositoryGetMessagesOptions {
|
|
147
150
|
/**
|
|
@@ -167,6 +170,7 @@ interface RepositoryGetMessagesOptions {
|
|
|
167
170
|
}
|
|
168
171
|
/**
|
|
169
172
|
* Options for getting followers from the repository.
|
|
173
|
+
* @since 0.3.0
|
|
170
174
|
*/
|
|
171
175
|
interface RepositoryGetFollowersOptions {
|
|
172
176
|
/**
|
|
@@ -181,6 +185,7 @@ interface RepositoryGetFollowersOptions {
|
|
|
181
185
|
}
|
|
182
186
|
/**
|
|
183
187
|
* The prefixes for key-value store keys used by the bot.
|
|
188
|
+
* @since 0.3.0
|
|
184
189
|
*/
|
|
185
190
|
interface KvStoreRepositoryPrefixes {
|
|
186
191
|
/**
|
|
@@ -286,6 +291,7 @@ declare class MemoryRepository implements Repository {
|
|
|
286
291
|
* Note: List operations like `getMessages` and `getFollowers`, and count
|
|
287
292
|
* operations like `countMessages` and `countFollowers` are not cached and
|
|
288
293
|
* always delegate to the underlying repository.
|
|
294
|
+
* @since 0.3.0
|
|
289
295
|
*/
|
|
290
296
|
declare class MemoryCachedRepository implements Repository {
|
|
291
297
|
private underlying;
|
package/dist/repository.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","names":[],"sources":["../src/repository.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repository.d.ts","names":[],"sources":["../src/repository.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAiCY,KAAA,IAAA,GAAO,UAAH,CAAA,OAAqB,MAAA,CAAO,UAA5B,CAAA;;;;AAAa;AAMZ,UAAA,UAAA,CAAU;EAAA;;;;EAYW,WAArB,CAAA,QAAA,EAPO,aAOP,EAAA,CAAA,EAPyB,OAOzB,CAAA,IAAA,CAAA;EAAO;;;;;EAuBZ,WAEI,EAAA,EAzBC,OAyBD,CAzBS,aAyBT,EAAA,GAAA,SAAA,CAAA;EAAM;;;;;EAC4C,UAAzB,CAAA,EAAA,EAnBxB,IAmBwB,EAAA,QAAA,EAnBR,QAmBQ,GAnBC,UAmB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EA5JQ,gBA4JR;EAAO,WAtKE,CAAA,QAAA,EAejB,aAfiB,EAAA,CAAA,EAeC,OAfD,CAAA,IAAA,CAAA;EAAU,WAAA,CAAA,CAAA,EAoBlC,OApBkC,CAoB1B,aApB0B,EAAA,GAAA,SAAA,CAAA;iBA6BlC,gBAAgB,WAAS,aAAW;oBAMnD,0BAEQ,WAAS,eAChB,WAAS,yBAAuB,QAAQ,WAAS,0BACrD;oBAgBqB,OAAO,QAAQ,WAAS;wBAUpC,+BACT,cAAc,WAAS;iBAIL,OAAO,QAAQ,WAAS;mBAY5B;wBAIW,eAAe,QAAQ;2BAMvC,iBACE,MACX,QAAQ;0BAWmB,MAAM;yBAab,gCAAgC,cAAc;oBAOnD;oBAIM,cAAc,SAAS;uBAKpB,OAAO,QAAQ;oBAQlB,OAAO,QAAQ;0BAWT,aAAa,SAAS;6BAKnB,MAAM,QAAQ;0BAQjB,MAAM,QAAQ"}
|
package/dist/repository.js
CHANGED
|
@@ -364,6 +364,7 @@ var MemoryRepository = class {
|
|
|
364
364
|
* Note: List operations like `getMessages` and `getFollowers`, and count
|
|
365
365
|
* operations like `countMessages` and `countFollowers` are not cached and
|
|
366
366
|
* always delegate to the underlying repository.
|
|
367
|
+
* @since 0.3.0
|
|
367
368
|
*/
|
|
368
369
|
var MemoryCachedRepository = class {
|
|
369
370
|
underlying;
|