@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-impl.test.js","names":["bot: BotImpl<void>","origin: URL | string"],"sources":["../src/session-impl.test.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 Context, MemoryKvStore } from \"@fedify/fedify/federation\";\nimport {\n type Activity,\n Create,\n Follow,\n Note,\n Person,\n PUBLIC_COLLECTION,\n type Recipient,\n Undo,\n} from \"@fedify/fedify/vocab\";\nimport assert from \"node:assert\";\nimport { describe, test } from \"node:test\";\nimport { BotImpl } from \"./bot-impl.ts\";\nimport { createMessage } from \"./message-impl.ts\";\nimport { MemoryRepository, type Uuid } from \"./repository.ts\";\nimport { SessionImpl } from \"./session-impl.ts\";\nimport { mention, text } from \"./text.ts\";\n\ntest(\"SessionImpl.follow()\", async (t) => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n await t.test(\"follow\", async () => {\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/john\"),\n preferredUsername: \"john\",\n });\n await session.follow(actor);\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, [actor]);\n assert.ok(activity instanceof Follow);\n const parsed = ctx.parseUri(activity.id);\n assert.deepStrictEqual(parsed?.type, \"object\");\n assert.ok(parsed?.type === \"object\");\n assert.deepStrictEqual(parsed.class, Follow);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.objectId, actor.id);\n assert.deepStrictEqual(activity.toIds, [actor.id]);\n const follow = await repository.getSentFollow(parsed.values.id as Uuid);\n assert.ok(follow != null);\n assert.deepStrictEqual(\n await follow.toJsonLd({ format: \"compact\" }),\n await activity.toJsonLd({ format: \"compact\" }),\n );\n });\n\n await t.test(\"follow again\", async () => {\n ctx.sentActivities = [];\n await repository.addFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n new Follow({\n id: new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n object: new URL(\"https://example.com/ap/actor/alice\"),\n }),\n );\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/alice\"),\n preferredUsername: \"alice\",\n });\n await session.follow(actor);\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n\n await t.test(\"follow bot itself\", async () => {\n ctx.sentActivities = [];\n await assert.rejects(\n () => session.follow(session.actorId.href),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.follow(session.actorId),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.follow(session.actorHandle),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n const actor = await session.getActor();\n await assert.rejects(\n () => session.follow(actor),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n});\n\ntest(\"SessionImpl.unfollow()\", async (t) => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n await t.test(\"unfollow\", async () => {\n await repository.addFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n new Follow({\n id: new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n object: new URL(\"https://example.com/ap/actor/alice\"),\n }),\n );\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/alice\"),\n preferredUsername: \"alice\",\n });\n await session.unfollow(actor);\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, [actor]);\n assert.ok(activity instanceof Undo);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Follow);\n assert.deepStrictEqual(\n object.id,\n new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n );\n assert.deepStrictEqual(object.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(\n await repository.getFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n ),\n undefined,\n );\n });\n\n await t.test(\"unfollow again\", async () => {\n ctx.sentActivities = [];\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/alice\"),\n preferredUsername: \"alice\",\n });\n await session.unfollow(actor);\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n\n await t.test(\"unfollow bot itself\", async () => {\n ctx.sentActivities = [];\n await assert.rejects(\n () => session.unfollow(session.actorId.href),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.unfollow(session.actorId),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.unfollow(session.actorHandle),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n const actor = await session.getActor();\n await assert.rejects(\n () => session.unfollow(actor),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n});\n\ndescribe(\"SessionImpl.follows()\", () => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n test(\"when it follows\", async () => {\n const followeeId = new URL(\"https://example.com/ap/actor/alice\");\n const followee = new Person({\n id: followeeId,\n preferredUsername: \"alice\",\n });\n await repository.addFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n new Follow({\n id: new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n object: followee,\n }),\n );\n assert.ok(await session.follows(followeeId.href));\n assert.ok(await session.follows(followeeId));\n assert.ok(await session.follows(followee));\n });\n\n test(\"when it does not follow\", async () => {\n const actorId = new URL(\"https://example.com/ap/actor/john\");\n const actor = new Person({\n id: actorId,\n preferredUsername: \"john\",\n });\n assert.deepStrictEqual(await session.follows(actorId.href), false);\n assert.deepStrictEqual(await session.follows(actorId), false);\n assert.deepStrictEqual(await session.follows(actor), false);\n });\n\n test(\"bot itself\", async () => {\n assert.deepStrictEqual(await session.follows(session.actorId.href), false);\n assert.deepStrictEqual(await session.follows(session.actorId), false);\n assert.deepStrictEqual(\n await session.follows(await session.getActor()),\n false,\n );\n assert.deepStrictEqual(await session.follows(session.actorHandle), false);\n });\n});\n\ntest(\"SessionImpl.publish()\", async (t) => {\n const kv = new MemoryKvStore();\n const bot = new BotImpl<void>({ kv, username: \"bot\" });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n await t.test(\"public\", async () => {\n ctx.sentActivities = [];\n const publicMsg = await session.publish(text`Hello, world!`);\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(activity.ccIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(object.ccIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(object.content, \"<p>Hello, world!</p>\");\n assert.deepStrictEqual(object.tagIds, []);\n assert.deepStrictEqual(publicMsg.id, object.id);\n assert.deepStrictEqual(publicMsg.text, \"Hello, world!\");\n assert.deepStrictEqual(publicMsg.html, \"<p>Hello, world!</p>\");\n assert.deepStrictEqual(publicMsg.visibility, \"public\");\n assert.deepStrictEqual(publicMsg.mentions, []);\n });\n\n await t.test(\"unlisted\", async () => {\n ctx.sentActivities = [];\n const unlistedMsg = await session.publish(text`Hello!`, {\n visibility: \"unlisted\",\n });\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n assert.deepStrictEqual(activity.ccIds, [PUBLIC_COLLECTION]);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(object.ccIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(object.content, \"<p>Hello!</p>\");\n assert.deepStrictEqual(object.tagIds, []);\n assert.deepStrictEqual(unlistedMsg.id, object.id);\n assert.deepStrictEqual(unlistedMsg.text, \"Hello!\");\n assert.deepStrictEqual(unlistedMsg.html, \"<p>Hello!</p>\");\n assert.deepStrictEqual(unlistedMsg.visibility, \"unlisted\");\n assert.deepStrictEqual(unlistedMsg.mentions, []);\n });\n\n await t.test(\"followers\", async () => {\n ctx.sentActivities = [];\n const followersMsg = await session.publish(text`Hi!`, {\n visibility: \"followers\",\n });\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n assert.deepStrictEqual(activity.ccIds, []);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(object.ccIds, []);\n assert.deepStrictEqual(object.content, \"<p>Hi!</p>\");\n assert.deepStrictEqual(object.tagIds, []);\n assert.deepStrictEqual(followersMsg.id, object.id);\n assert.deepStrictEqual(followersMsg.text, \"Hi!\");\n assert.deepStrictEqual(followersMsg.html, \"<p>Hi!</p>\");\n assert.deepStrictEqual(followersMsg.visibility, \"followers\");\n assert.deepStrictEqual(followersMsg.mentions, []);\n });\n\n await t.test(\"direct\", async () => {\n const mentioned = new Person({\n id: new URL(\"https://example.com/ap/actor/john\"),\n preferredUsername: \"john\",\n });\n ctx.sentActivities = [];\n const directMsg = await session.publish(\n text`Hey ${mention(mentioned)}!`,\n { visibility: \"direct\" },\n );\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, [mentioned]);\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [mentioned.id]);\n assert.deepStrictEqual(activity.ccIds, []);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [mentioned.id]);\n assert.deepStrictEqual(object.ccIds, []);\n assert.deepStrictEqual(\n object.content,\n '<p>Hey <a href=\"https://example.com/ap/actor/john\" translate=\"no\" ' +\n 'class=\"h-card u-url mention\" target=\"_blank\">@<span>john@example.com' +\n \"</span></a>!</p>\",\n );\n const tags = await Array.fromAsync(object.getTags());\n assert.deepStrictEqual(tags.length, 1);\n assert.deepStrictEqual(directMsg.id, object.id);\n assert.deepStrictEqual(directMsg.text, \"Hey @john@example.com!\");\n assert.deepStrictEqual(directMsg.html, object.content);\n assert.deepStrictEqual(directMsg.visibility, \"direct\");\n // assert.deepStrictEqual(directMsg.mentions, [mentioned]); // FIXME\n });\n\n await t.test(\"quote\", async () => {\n const originalAuthor = new Person({\n id: new URL(\"https://example.com/ap/actor/john\"),\n preferredUsername: \"john\",\n });\n const originalPost = new Note({\n id: new URL(\n \"https://example.com/ap/note/c1c792ce-a0be-4685-b396-e59e5ef8c788\",\n ),\n content: \"<p>Hello, world!</p>\",\n attribution: originalAuthor,\n to: new URL(\"https://example.com/ap/actor/john/followers\"),\n cc: PUBLIC_COLLECTION,\n });\n const originalMsg = await createMessage<Note, void>(\n originalPost,\n session,\n {},\n );\n ctx.sentActivities = [];\n const quote = await session.publish(text`Check this out!`, {\n quoteTarget: originalMsg,\n });\n assert.deepStrictEqual(ctx.sentActivities.length, 2);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(activity.ccIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n const object = await activity.getObject(ctx);\n const { recipients: recipients2, activity: activity2 } =\n ctx.sentActivities[1];\n assert.deepStrictEqual(recipients2, [originalAuthor]);\n assert.ok(activity2 instanceof Create);\n assert.deepStrictEqual(activity2.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity2.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(activity2.ccIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(object.ccIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(\n object.content,\n `<p>Check this out!</p>\n\n<p class=\"quote-inline\"><br>RE: <a href=\"${originalMsg.id.href}\">${originalMsg.id.href}</a></p>`,\n );\n assert.deepStrictEqual(object.quoteUrl, originalMsg.id);\n assert.deepStrictEqual(quote.id, object.id);\n assert.deepStrictEqual(\n quote.text,\n `Check this out!\\n\\nRE: ${originalMsg.id.href}`,\n );\n assert.deepStrictEqual(\n quote.html,\n `<p>Check this out!</p>\n\n<p><br>RE: <a href=\"${originalMsg.id.href}\">${originalMsg.id.href}</a></p>`,\n );\n assert.deepStrictEqual(quote.visibility, \"public\");\n assert.deepStrictEqual(quote.quoteTarget?.id, originalMsg.id);\n });\n});\n\ntest(\"SessionImpl.getOutbox()\", async (t) => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n const messageA = new Create({\n id: new URL(\n \"https://example.com/ap/create/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-01T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-01T00:00:00Z\"),\n });\n const messageB = new Create({\n id: new URL(\n \"https://example.com/ap/create/0194244f-d800-7873-8993-ef71ccd47306\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n });\n const messageC = new Create({\n id: new URL(\n \"https://example.com/ap/create/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n });\n const messageD = new Create({\n id: new URL(\n \"https://example.com/ap/create/01942e9c-9000-7480-a553-7a6ce737ce14\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-04T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-04T00:00:00Z\"),\n });\n await repository.addMessage(\"01941f29-7c00-7fe8-ab0a-7b593990a3c0\", messageA);\n await repository.addMessage(\"0194244f-d800-7873-8993-ef71ccd47306\", messageB);\n await repository.addMessage(\"01942976-3400-7f34-872e-2cbf0f9eeac4\", messageC);\n await repository.addMessage(\"01942e9c-9000-7480-a553-7a6ce737ce14\", messageD);\n\n await t.test(\"default\", async () => {\n const outbox = session.getOutbox({ order: \"oldest\" });\n const messages = await Array.fromAsync(outbox);\n assert.deepStrictEqual(messages.length, 4);\n\n assert.deepStrictEqual(\n messages[0].id.href,\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n );\n assert.deepStrictEqual(\n messages[0].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[0].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[0].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[0].published,\n Temporal.Instant.from(\"2025-01-01T00:00:00Z\"),\n );\n\n assert.deepStrictEqual(\n messages[1].id.href,\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n );\n assert.deepStrictEqual(\n messages[1].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[1].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[1].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[1].published,\n Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n );\n\n assert.deepStrictEqual(\n messages[2].id.href,\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n );\n assert.deepStrictEqual(\n messages[2].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[2].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[2].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[2].published,\n Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n );\n\n assert.deepStrictEqual(\n messages[3].id.href,\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n );\n assert.deepStrictEqual(\n messages[3].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[3].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[3].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[3].published,\n Temporal.Instant.from(\"2025-01-04T00:00:00Z\"),\n );\n });\n\n await t.test(\"order: 'oldest'\", async () => {\n const outbox = session.getOutbox({ order: \"oldest\" });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n ]);\n });\n\n await t.test(\"order: 'newest'\", async () => {\n const outbox = session.getOutbox({ order: \"newest\" });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ]);\n });\n\n await t.test(\"since\", async () => {\n const outbox = session.getOutbox({\n since: Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n ]);\n });\n\n await t.test(\"until\", async () => {\n const outbox = session.getOutbox({\n until: Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ]);\n });\n});\n\nexport interface SentActivity {\n recipients: \"followers\" | Recipient[];\n activity: Activity;\n}\n\nexport interface MockContext extends Context<void> {\n sentActivities: SentActivity[];\n}\n\nexport function createMockContext(\n bot: BotImpl<void>,\n origin: URL | string,\n): MockContext {\n const ctx = bot.federation.createContext(\n new URL(origin),\n undefined,\n ) as MockContext;\n ctx.sentActivities = [];\n ctx.sendActivity = (_, recipients, activity) => {\n ctx.sentActivities.push({\n recipients: recipients === \"followers\"\n ? \"followers\"\n : Array.isArray(recipients)\n ? recipients\n : [recipients],\n activity,\n });\n return Promise.resolve();\n };\n return ctx;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,KAAK,wBAAwB,OAAO,MAAM;CACxC,MAAM,aAAa,IAAI;CACvB,MAAM,MAAM,IAAI,QAAc;EAC5B,IAAI,IAAI;EACR;EACA,UAAU;CACX;CACD,MAAM,MAAM,kBAAkB,KAAK,sBAAsB;CACzD,MAAM,UAAU,IAAI,YAAY,KAAK;AAErC,OAAM,EAAE,KAAK,UAAU,YAAY;EACjC,MAAM,QAAQ,IAAI,OAAO;GACvB,IAAI,IAAI,IAAI;GACZ,mBAAmB;EACpB;AACD,QAAM,QAAQ,OAAO,MAAM;AAC3B,SAAO,gBAAgB,IAAI,eAAe,QA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ACrD,SAAO,gBAAgB,YAAY,CACjC,oEACA,kEACD,EAAC;CACH,EAAC;AACH,EAAC;AAWF,SAAgB,kBACdA,KACAC,QACa;CACb,MAAM,MAAM,IAAI,WAAW,cACzB,IAAI,IAAI,gBAET;AACD,KAAI,iBAAiB,CAAE;AACvB,KAAI,eAAe,CAAC,GAAG,YAAY,aAAa;AAC9C,MAAI,eAAe,KAAK;GACtB,YAAY,eAAe,cACvB,cACA,MAAM,QAAQ,WAAW,GACzB,aACA,CAAC,UAAW;GAChB;EACD,EAAC;AACF,SAAO,QAAQ,SAAS;CACzB;AACD,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"session-impl.test.js","names":["bot: BotImpl<void>","origin: URL | string"],"sources":["../src/session-impl.test.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 Context, MemoryKvStore } from \"@fedify/fedify/federation\";\nimport {\n type Activity,\n Create,\n Follow,\n Note,\n Person,\n PUBLIC_COLLECTION,\n Question,\n type Recipient,\n Undo,\n} from \"@fedify/fedify/vocab\";\nimport assert from \"node:assert\";\nimport { describe, test } from \"node:test\";\nimport { BotImpl } from \"./bot-impl.ts\";\nimport { createMessage } from \"./message-impl.ts\";\nimport { MemoryRepository, type Uuid } from \"./repository.ts\";\nimport { SessionImpl } from \"./session-impl.ts\";\nimport { mention, text } from \"./text.ts\";\n\ntest(\"SessionImpl.follow()\", async (t) => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n await t.test(\"follow\", async () => {\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/john\"),\n preferredUsername: \"john\",\n });\n await session.follow(actor);\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, [actor]);\n assert.ok(activity instanceof Follow);\n const parsed = ctx.parseUri(activity.id);\n assert.deepStrictEqual(parsed?.type, \"object\");\n assert.ok(parsed?.type === \"object\");\n assert.deepStrictEqual(parsed.class, Follow);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.objectId, actor.id);\n assert.deepStrictEqual(activity.toIds, [actor.id]);\n const follow = await repository.getSentFollow(parsed.values.id as Uuid);\n assert.ok(follow != null);\n assert.deepStrictEqual(\n await follow.toJsonLd({ format: \"compact\" }),\n await activity.toJsonLd({ format: \"compact\" }),\n );\n });\n\n await t.test(\"follow again\", async () => {\n ctx.sentActivities = [];\n await repository.addFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n new Follow({\n id: new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n object: new URL(\"https://example.com/ap/actor/alice\"),\n }),\n );\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/alice\"),\n preferredUsername: \"alice\",\n });\n await session.follow(actor);\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n\n await t.test(\"follow bot itself\", async () => {\n ctx.sentActivities = [];\n await assert.rejects(\n () => session.follow(session.actorId.href),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.follow(session.actorId),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.follow(session.actorHandle),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n const actor = await session.getActor();\n await assert.rejects(\n () => session.follow(actor),\n TypeError,\n \"The bot cannot follow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n});\n\ntest(\"SessionImpl.unfollow()\", async (t) => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n await t.test(\"unfollow\", async () => {\n await repository.addFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n new Follow({\n id: new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n object: new URL(\"https://example.com/ap/actor/alice\"),\n }),\n );\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/alice\"),\n preferredUsername: \"alice\",\n });\n await session.unfollow(actor);\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, [actor]);\n assert.ok(activity instanceof Undo);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Follow);\n assert.deepStrictEqual(\n object.id,\n new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n );\n assert.deepStrictEqual(object.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(\n await repository.getFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n ),\n undefined,\n );\n });\n\n await t.test(\"unfollow again\", async () => {\n ctx.sentActivities = [];\n const actor = new Person({\n id: new URL(\"https://example.com/ap/actor/alice\"),\n preferredUsername: \"alice\",\n });\n await session.unfollow(actor);\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n\n await t.test(\"unfollow bot itself\", async () => {\n ctx.sentActivities = [];\n await assert.rejects(\n () => session.unfollow(session.actorId.href),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.unfollow(session.actorId),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n await assert.rejects(\n () => session.unfollow(session.actorHandle),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n\n const actor = await session.getActor();\n await assert.rejects(\n () => session.unfollow(actor),\n TypeError,\n \"The bot cannot unfollow itself.\",\n );\n assert.deepStrictEqual(ctx.sentActivities, []);\n });\n});\n\ndescribe(\"SessionImpl.follows()\", () => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n test(\"when it follows\", async () => {\n const followeeId = new URL(\"https://example.com/ap/actor/alice\");\n const followee = new Person({\n id: followeeId,\n preferredUsername: \"alice\",\n });\n await repository.addFollowee(\n new URL(\"https://example.com/ap/actor/alice\"),\n new Follow({\n id: new URL(\n \"https://example.com/ap/follow/4114eadb-2596-408f-ad99-06f467c9ace0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n object: followee,\n }),\n );\n assert.ok(await session.follows(followeeId.href));\n assert.ok(await session.follows(followeeId));\n assert.ok(await session.follows(followee));\n });\n\n test(\"when it does not follow\", async () => {\n const actorId = new URL(\"https://example.com/ap/actor/john\");\n const actor = new Person({\n id: actorId,\n preferredUsername: \"john\",\n });\n assert.deepStrictEqual(await session.follows(actorId.href), false);\n assert.deepStrictEqual(await session.follows(actorId), false);\n assert.deepStrictEqual(await session.follows(actor), false);\n });\n\n test(\"bot itself\", async () => {\n assert.deepStrictEqual(await session.follows(session.actorId.href), false);\n assert.deepStrictEqual(await session.follows(session.actorId), false);\n assert.deepStrictEqual(\n await session.follows(await session.getActor()),\n false,\n );\n assert.deepStrictEqual(await session.follows(session.actorHandle), false);\n });\n});\n\ntest(\"SessionImpl.publish()\", async (t) => {\n const kv = new MemoryKvStore();\n const bot = new BotImpl<void>({ kv, username: \"bot\" });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n await t.test(\"public\", async () => {\n ctx.sentActivities = [];\n const publicMsg = await session.publish(text`Hello, world!`);\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(activity.ccIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(object.ccIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(object.content, \"<p>Hello, world!</p>\");\n assert.deepStrictEqual(object.tagIds, []);\n assert.deepStrictEqual(publicMsg.id, object.id);\n assert.deepStrictEqual(publicMsg.text, \"Hello, world!\");\n assert.deepStrictEqual(publicMsg.html, \"<p>Hello, world!</p>\");\n assert.deepStrictEqual(publicMsg.visibility, \"public\");\n assert.deepStrictEqual(publicMsg.mentions, []);\n });\n\n await t.test(\"unlisted\", async () => {\n ctx.sentActivities = [];\n const unlistedMsg = await session.publish(text`Hello!`, {\n visibility: \"unlisted\",\n });\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n assert.deepStrictEqual(activity.ccIds, [PUBLIC_COLLECTION]);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(object.ccIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(object.content, \"<p>Hello!</p>\");\n assert.deepStrictEqual(object.tagIds, []);\n assert.deepStrictEqual(unlistedMsg.id, object.id);\n assert.deepStrictEqual(unlistedMsg.text, \"Hello!\");\n assert.deepStrictEqual(unlistedMsg.html, \"<p>Hello!</p>\");\n assert.deepStrictEqual(unlistedMsg.visibility, \"unlisted\");\n assert.deepStrictEqual(unlistedMsg.mentions, []);\n });\n\n await t.test(\"followers\", async () => {\n ctx.sentActivities = [];\n const followersMsg = await session.publish(text`Hi!`, {\n visibility: \"followers\",\n });\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n assert.deepStrictEqual(activity.ccIds, []);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(object.ccIds, []);\n assert.deepStrictEqual(object.content, \"<p>Hi!</p>\");\n assert.deepStrictEqual(object.tagIds, []);\n assert.deepStrictEqual(followersMsg.id, object.id);\n assert.deepStrictEqual(followersMsg.text, \"Hi!\");\n assert.deepStrictEqual(followersMsg.html, \"<p>Hi!</p>\");\n assert.deepStrictEqual(followersMsg.visibility, \"followers\");\n assert.deepStrictEqual(followersMsg.mentions, []);\n });\n\n await t.test(\"direct\", async () => {\n const mentioned = new Person({\n id: new URL(\"https://example.com/ap/actor/john\"),\n preferredUsername: \"john\",\n });\n ctx.sentActivities = [];\n const directMsg = await session.publish(\n text`Hey ${mention(mentioned)}!`,\n { visibility: \"direct\" },\n );\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, [mentioned]);\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [mentioned.id]);\n assert.deepStrictEqual(activity.ccIds, []);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [mentioned.id]);\n assert.deepStrictEqual(object.ccIds, []);\n assert.deepStrictEqual(\n object.content,\n '<p>Hey <a href=\"https://example.com/ap/actor/john\" translate=\"no\" ' +\n 'class=\"h-card u-url mention\" target=\"_blank\">@<span>john@example.com' +\n \"</span></a>!</p>\",\n );\n const tags = await Array.fromAsync(object.getTags());\n assert.deepStrictEqual(tags.length, 1);\n assert.deepStrictEqual(directMsg.id, object.id);\n assert.deepStrictEqual(directMsg.text, \"Hey @john@example.com!\");\n assert.deepStrictEqual(directMsg.html, object.content);\n assert.deepStrictEqual(directMsg.visibility, \"direct\");\n // assert.deepStrictEqual(directMsg.mentions, [mentioned]); // FIXME\n });\n\n await t.test(\"quote\", async () => {\n const originalAuthor = new Person({\n id: new URL(\"https://example.com/ap/actor/john\"),\n preferredUsername: \"john\",\n });\n const originalPost = new Note({\n id: new URL(\n \"https://example.com/ap/note/c1c792ce-a0be-4685-b396-e59e5ef8c788\",\n ),\n content: \"<p>Hello, world!</p>\",\n attribution: originalAuthor,\n to: new URL(\"https://example.com/ap/actor/john/followers\"),\n cc: PUBLIC_COLLECTION,\n });\n const originalMsg = await createMessage<Note, void>(\n originalPost,\n session,\n {},\n );\n ctx.sentActivities = [];\n const quote = await session.publish(text`Check this out!`, {\n quoteTarget: originalMsg,\n });\n assert.deepStrictEqual(ctx.sentActivities.length, 2);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(activity.ccIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n const object = await activity.getObject(ctx);\n const { recipients: recipients2, activity: activity2 } =\n ctx.sentActivities[1];\n assert.deepStrictEqual(recipients2, [originalAuthor]);\n assert.ok(activity2 instanceof Create);\n assert.deepStrictEqual(activity2.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity2.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(activity2.ccIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n assert.ok(object instanceof Note);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(object.ccIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(\n object.content,\n `<p>Check this out!</p>\n\n<p class=\"quote-inline\"><br>RE: <a href=\"${originalMsg.id.href}\">${originalMsg.id.href}</a></p>`,\n );\n assert.deepStrictEqual(object.quoteUrl, originalMsg.id);\n assert.deepStrictEqual(quote.id, object.id);\n assert.deepStrictEqual(\n quote.text,\n `Check this out!\\n\\nRE: ${originalMsg.id.href}`,\n );\n assert.deepStrictEqual(\n quote.html,\n `<p>Check this out!</p>\n\n<p><br>RE: <a href=\"${originalMsg.id.href}\">${originalMsg.id.href}</a></p>`,\n );\n assert.deepStrictEqual(quote.visibility, \"public\");\n assert.deepStrictEqual(quote.quoteTarget?.id, originalMsg.id);\n });\n\n await t.test(\"poll single choice\", async () => {\n ctx.sentActivities = [];\n const endTime = Temporal.Now.instant().add({ hours: 24 });\n const poll = await session.publish(text`What's your favorite color?`, {\n class: Question,\n poll: {\n multiple: false,\n options: [\"Red\", \"Blue\", \"Green\"],\n endTime,\n },\n });\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n assert.deepStrictEqual(activity.actorId, ctx.getActorUri(bot.identifier));\n assert.deepStrictEqual(activity.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(activity.ccIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Question);\n assert.deepStrictEqual(\n object.attributionId,\n ctx.getActorUri(bot.identifier),\n );\n assert.deepStrictEqual(object.toIds, [PUBLIC_COLLECTION]);\n assert.deepStrictEqual(object.ccIds, [ctx.getFollowersUri(bot.identifier)]);\n assert.deepStrictEqual(\n object.content,\n \"<p>What's your favorite color?</p>\",\n );\n assert.deepStrictEqual(object.endTime, endTime);\n assert.deepStrictEqual(object.voters, 0);\n assert.deepStrictEqual(object.inclusiveOptionIds, []);\n\n const exclusiveOptions = await Array.fromAsync(\n object.getExclusiveOptions(ctx),\n );\n assert.deepStrictEqual(exclusiveOptions.length, 3);\n assert.ok(exclusiveOptions[0] instanceof Note);\n assert.deepStrictEqual(exclusiveOptions[0].name?.toString(), \"Red\");\n assert.ok(exclusiveOptions[1] instanceof Note);\n assert.deepStrictEqual(exclusiveOptions[1].name?.toString(), \"Blue\");\n assert.ok(exclusiveOptions[2] instanceof Note);\n assert.deepStrictEqual(exclusiveOptions[2].name?.toString(), \"Green\");\n\n for (const option of exclusiveOptions) {\n const replies = await option.getReplies(ctx);\n assert.deepStrictEqual(replies?.totalItems, 0);\n }\n\n assert.deepStrictEqual(poll.id, object.id);\n assert.deepStrictEqual(poll.text, \"What's your favorite color?\");\n assert.deepStrictEqual(\n poll.html,\n \"<p>What's your favorite color?</p>\",\n );\n assert.deepStrictEqual(poll.visibility, \"public\");\n });\n\n await t.test(\"poll multiple choice\", async () => {\n ctx.sentActivities = [];\n const endTime = Temporal.Now.instant().add({ hours: 24 * 7 });\n const poll = await session.publish(\n text`Which programming languages do you know?`,\n {\n class: Question,\n poll: {\n multiple: true,\n options: [\"JavaScript\", \"TypeScript\", \"Python\", \"Rust\"],\n endTime,\n },\n visibility: \"unlisted\",\n },\n );\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, \"followers\");\n assert.ok(activity instanceof Create);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Question);\n assert.deepStrictEqual(object.endTime, endTime);\n assert.deepStrictEqual(object.voters, 0);\n assert.deepStrictEqual(object.exclusiveOptionIds, []);\n\n const inclusiveOptions = await Array.fromAsync(\n object.getInclusiveOptions(ctx),\n );\n assert.deepStrictEqual(inclusiveOptions.length, 4);\n assert.ok(inclusiveOptions[0] instanceof Note);\n assert.deepStrictEqual(inclusiveOptions[0].name?.toString(), \"JavaScript\");\n assert.ok(inclusiveOptions[1] instanceof Note);\n assert.deepStrictEqual(inclusiveOptions[1].name?.toString(), \"TypeScript\");\n assert.ok(inclusiveOptions[2] instanceof Note);\n assert.deepStrictEqual(inclusiveOptions[2].name?.toString(), \"Python\");\n assert.ok(inclusiveOptions[3] instanceof Note);\n assert.deepStrictEqual(inclusiveOptions[3].name?.toString(), \"Rust\");\n\n assert.deepStrictEqual(poll.visibility, \"unlisted\");\n assert.deepStrictEqual(activity.toIds, [\n ctx.getFollowersUri(bot.identifier),\n ]);\n assert.deepStrictEqual(activity.ccIds, [PUBLIC_COLLECTION]);\n });\n\n await t.test(\"poll with direct visibility\", async () => {\n const mentioned = new Person({\n id: new URL(\"https://example.com/ap/actor/alice\"),\n preferredUsername: \"alice\",\n });\n ctx.sentActivities = [];\n const endTime = Temporal.Now.instant().add({ hours: 12 });\n const poll = await session.publish(\n text`Hey ${mention(mentioned)}, what do you think?`,\n {\n class: Question,\n poll: {\n multiple: false,\n options: [\"Good\", \"Bad\", \"Neutral\"],\n endTime,\n },\n visibility: \"direct\",\n },\n );\n assert.deepStrictEqual(ctx.sentActivities.length, 1);\n const { recipients, activity } = ctx.sentActivities[0];\n assert.deepStrictEqual(recipients, [mentioned]);\n assert.ok(activity instanceof Create);\n const object = await activity.getObject(ctx);\n assert.ok(object instanceof Question);\n assert.deepStrictEqual(object.toIds, [mentioned.id]);\n assert.deepStrictEqual(object.ccIds, []);\n assert.deepStrictEqual(poll.visibility, \"direct\");\n });\n\n await t.test(\"poll end-to-end workflow\", async () => {\n // Create fresh repository and session for isolation\n const freshRepository = new MemoryRepository();\n const freshBot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository: freshRepository,\n username: \"testbot\",\n });\n const freshCtx = createMockContext(freshBot, \"https://example.com\");\n const freshSession = new SessionImpl(freshBot, freshCtx);\n\n const endTime = Temporal.Now.instant().add({ hours: 1 });\n\n // 1. Create a poll\n const poll = await freshSession.publish(\n text`What should we have for lunch?`,\n {\n class: Question,\n poll: {\n multiple: false,\n options: [\"Pizza\", \"Burgers\", \"Salad\"],\n endTime,\n },\n },\n );\n\n // Verify poll was created correctly\n assert.deepStrictEqual(freshCtx.sentActivities.length, 1);\n const { activity: createActivity } = freshCtx.sentActivities[0];\n assert.ok(createActivity instanceof Create);\n const pollObject = await createActivity.getObject(freshCtx);\n assert.ok(pollObject instanceof Question);\n assert.deepStrictEqual(pollObject.endTime, endTime);\n\n // Get poll options\n const options = await Array.fromAsync(\n pollObject.getExclusiveOptions(freshCtx),\n );\n assert.deepStrictEqual(options.length, 3);\n assert.deepStrictEqual(options[0].name?.toString(), \"Pizza\");\n assert.deepStrictEqual(options[1].name?.toString(), \"Burgers\");\n assert.deepStrictEqual(options[2].name?.toString(), \"Salad\");\n\n // 2. Verify poll is accessible via getOutbox\n const outbox = freshSession.getOutbox({ order: \"newest\" });\n const messages = await Array.fromAsync(outbox);\n assert.deepStrictEqual(messages.length, 1);\n assert.deepStrictEqual(messages[0].id, poll.id);\n assert.deepStrictEqual(messages[0].text, \"What should we have for lunch?\");\n\n // 3. Verify poll structure\n assert.deepStrictEqual(poll.visibility, \"public\");\n assert.deepStrictEqual(poll.mentions, []);\n });\n});\n\ntest(\"SessionImpl.getOutbox()\", async (t) => {\n const repository = new MemoryRepository();\n const bot = new BotImpl<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const ctx = createMockContext(bot, \"https://example.com\");\n const session = new SessionImpl(bot, ctx);\n\n const messageA = new Create({\n id: new URL(\n \"https://example.com/ap/create/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-01T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-01T00:00:00Z\"),\n });\n const messageB = new Create({\n id: new URL(\n \"https://example.com/ap/create/0194244f-d800-7873-8993-ef71ccd47306\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n });\n const messageC = new Create({\n id: new URL(\n \"https://example.com/ap/create/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n });\n const messageD = new Create({\n id: new URL(\n \"https://example.com/ap/create/01942e9c-9000-7480-a553-7a6ce737ce14\",\n ),\n actor: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n object: new Note({\n id: new URL(\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n ),\n attribution: new URL(\"https://example.com/ap/actor/bot\"),\n to: new URL(\"https://example.com/ap/actor/bot/followers\"),\n cc: PUBLIC_COLLECTION,\n content: \"Hello, world!\",\n published: Temporal.Instant.from(\"2025-01-04T00:00:00Z\"),\n }),\n published: Temporal.Instant.from(\"2025-01-04T00:00:00Z\"),\n });\n await repository.addMessage(\"01941f29-7c00-7fe8-ab0a-7b593990a3c0\", messageA);\n await repository.addMessage(\"0194244f-d800-7873-8993-ef71ccd47306\", messageB);\n await repository.addMessage(\"01942976-3400-7f34-872e-2cbf0f9eeac4\", messageC);\n await repository.addMessage(\"01942e9c-9000-7480-a553-7a6ce737ce14\", messageD);\n\n await t.test(\"default\", async () => {\n const outbox = session.getOutbox({ order: \"oldest\" });\n const messages = await Array.fromAsync(outbox);\n assert.deepStrictEqual(messages.length, 4);\n\n assert.deepStrictEqual(\n messages[0].id.href,\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n );\n assert.deepStrictEqual(\n messages[0].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[0].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[0].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[0].published,\n Temporal.Instant.from(\"2025-01-01T00:00:00Z\"),\n );\n\n assert.deepStrictEqual(\n messages[1].id.href,\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n );\n assert.deepStrictEqual(\n messages[1].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[1].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[1].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[1].published,\n Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n );\n\n assert.deepStrictEqual(\n messages[2].id.href,\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n );\n assert.deepStrictEqual(\n messages[2].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[2].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[2].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[2].published,\n Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n );\n\n assert.deepStrictEqual(\n messages[3].id.href,\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n );\n assert.deepStrictEqual(\n messages[3].actor.id?.href,\n \"https://example.com/ap/actor/bot\",\n );\n assert.deepStrictEqual(messages[3].visibility, \"unlisted\");\n assert.deepStrictEqual(messages[3].text, \"Hello, world!\");\n assert.deepStrictEqual(\n messages[3].published,\n Temporal.Instant.from(\"2025-01-04T00:00:00Z\"),\n );\n });\n\n await t.test(\"order: 'oldest'\", async () => {\n const outbox = session.getOutbox({ order: \"oldest\" });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n ]);\n });\n\n await t.test(\"order: 'newest'\", async () => {\n const outbox = session.getOutbox({ order: \"newest\" });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ]);\n });\n\n await t.test(\"since\", async () => {\n const outbox = session.getOutbox({\n since: Temporal.Instant.from(\"2025-01-03T00:00:00Z\"),\n });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/01942e9c-9000-7480-a553-7a6ce737ce14\",\n \"https://example.com/ap/note/01942976-3400-7f34-872e-2cbf0f9eeac4\",\n ]);\n });\n\n await t.test(\"until\", async () => {\n const outbox = session.getOutbox({\n until: Temporal.Instant.from(\"2025-01-02T00:00:00Z\"),\n });\n const messages = await Array.fromAsync(outbox);\n const messageIds = messages.map((msg) => msg.id.href);\n assert.deepStrictEqual(messageIds, [\n \"https://example.com/ap/note/0194244f-d800-7873-8993-ef71ccd47306\",\n \"https://example.com/ap/note/01941f29-7c00-7fe8-ab0a-7b593990a3c0\",\n ]);\n });\n});\n\nexport interface SentActivity {\n recipients: \"followers\" | Recipient[];\n activity: Activity;\n}\n\nexport interface MockContext extends Context<void> {\n sentActivities: SentActivity[];\n}\n\nexport function createMockContext(\n bot: BotImpl<void>,\n origin: URL | string,\n): MockContext {\n const ctx = bot.federation.createContext(\n new URL(origin),\n undefined,\n ) as MockContext;\n ctx.sentActivities = [];\n ctx.sendActivity = (_, recipients, activity) => {\n ctx.sentActivities.push({\n recipients: recipients === \"followers\"\n ? \"followers\"\n : Array.isArray(recipients)\n ? recipients\n : [recipients],\n activity,\n });\n return Promise.resolve();\n };\n return ctx;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,KAAK,wBAAwB,OAAO,MAAM;CACxC,MAAM,aAAa,IAAI;CACvB,MAAM,MAAM,IAAI,QAAc;EAC5B,IAAI,IAAI;EACR;EACA,UAAU;CACX;CACD,MAAM,MAAM,kBAAkB,KAAK,sBAAsB;CACzD,MAAM,UAAU,IAAI,YAAY,KAAK;AAErC,OAAM,EAAE,KAAK,UAAU,YAAY;EACjC,MAAM,QAAQ,IAAI,OAAO;GACvB,IAAI,IAAI,IAAI;GACZ,mBAAmB;EACpB;AACD,QAAM,QAAQ,OAAO,MAAM;AAC3B,SAAO,gBAAgB,IAAI,eAAe,QAAQ,EAAE;EACpD,MAAM,EAAE,YAAY,UAAU,GAAG,IAAI,eAAe;AACpD,SAAO,gBAAgB,YAAY,CAAC,KAAM,EAAC;AAC3C,SAAO,GAAG,oBAAoB,OAAO;EACrC,MAAM,SAAS,IAAI,SAAS,SAAS,GAAG;AACxC,SAAO,gBAAgB,QAAQ,MAAM,SAAS;AAC9C,SAAO,GAAG,QAAQ,SAAS,SAAS;AACpC,SAAO,gBAAgB,OAAO,OAAO,OAAO;AAC5C,SAAO,gBAAgB,SAAS,SAAS,IAAI,Y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WF,SAAgB,kBACdA,KACAC,QACa;CACb,MAAM,MAAM,IAAI,WAAW,cACzB,IAAI,IAAI,gBAET;AACD,KAAI,iBAAiB,CAAE;AACvB,KAAI,eAAe,CAAC,GAAG,YAAY,aAAa;AAC9C,MAAI,eAAe,KAAK;GACtB,YAAY,eAAe,cACvB,cACA,MAAM,QAAQ,WAAW,GACzB,aACA,CAAC,UAAW;GAChB;EACD,EAAC;AACF,SAAO,QAAQ,SAAS;CACzB;AACD,QAAO;AACR"}
|
package/dist/session.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
|
|
|
2
2
|
Date.prototype.toTemporalInstant = toTemporalInstant;
|
|
3
3
|
import { Text } from "./text.js";
|
|
4
4
|
import { AuthorizedMessage, Message, MessageClass, MessageVisibility } from "./message.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Poll } from "./poll.js";
|
|
6
6
|
import { Bot } from "./bot.js";
|
|
7
7
|
import { Actor, Article, ChatMessage, Context, Document, Note, Question } from "@fedify/fedify";
|
|
8
8
|
import { LanguageTag } from "@phensley/language-tag";
|
|
@@ -87,6 +87,14 @@ interface Session<TContextData> {
|
|
|
87
87
|
* @returns The published message.
|
|
88
88
|
*/
|
|
89
89
|
publish<T extends MessageClass>(content: Text<"block", TContextData>, options: SessionPublishOptionsWithClass<T, TContextData>): Promise<AuthorizedMessage<T, TContextData>>;
|
|
90
|
+
/**
|
|
91
|
+
* Publishes a question attributed to the bot with a poll.
|
|
92
|
+
* @param content The content of the question.
|
|
93
|
+
* @param options The options for publishing the question.
|
|
94
|
+
* @returns The published question.
|
|
95
|
+
* @since 0.3.0
|
|
96
|
+
*/
|
|
97
|
+
publish(content: Text<"block", TContextData>, options: SessionPublishOptionsWithQuestion<TContextData>): Promise<AuthorizedMessage<Question, TContextData>>;
|
|
90
98
|
/**
|
|
91
99
|
* Gets messages from the bot's outbox.
|
|
92
100
|
* @param options The options for getting messages.
|
|
@@ -129,11 +137,44 @@ interface SessionPublishOptionsWithClass<T extends MessageClass, TContextData> e
|
|
|
129
137
|
*/
|
|
130
138
|
readonly class: T extends Article ? typeof Article : T extends ChatMessage ? typeof ChatMessage : T extends Note ? typeof Note : T extends Question ? typeof Question : never;
|
|
131
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Options for publishing a question with a poll.
|
|
142
|
+
* @typeParam TContextData The type of the context data.
|
|
143
|
+
* @since 0.3.0
|
|
144
|
+
*/
|
|
145
|
+
interface SessionPublishOptionsWithQuestion<TContextData> extends SessionPublishOptionsWithClass<Question, TContextData> {
|
|
146
|
+
/**
|
|
147
|
+
* The poll to attach to the question.
|
|
148
|
+
* @since 0.3.0
|
|
149
|
+
*/
|
|
150
|
+
readonly poll: Poll;
|
|
151
|
+
}
|
|
132
152
|
/**
|
|
133
153
|
* Options for getting messages from the bot's outbox.
|
|
134
154
|
*/
|
|
135
|
-
interface SessionGetOutboxOptions
|
|
155
|
+
interface SessionGetOutboxOptions {
|
|
156
|
+
/**
|
|
157
|
+
* The order of the messages. If omitted, `"newest"` will be used.
|
|
158
|
+
* @default `"newest"`
|
|
159
|
+
*/
|
|
160
|
+
readonly order?: "oldest" | "newest";
|
|
161
|
+
/**
|
|
162
|
+
* The timestamp to get messages created at or before this time.
|
|
163
|
+
* If omitted, no limit will be applied.
|
|
164
|
+
*/
|
|
165
|
+
readonly until?: Temporal.Instant;
|
|
166
|
+
/**
|
|
167
|
+
* The timestamp to get messages created at or after this time.
|
|
168
|
+
* If omitted, no limit will be applied.
|
|
169
|
+
*/
|
|
170
|
+
readonly since?: Temporal.Instant;
|
|
171
|
+
/**
|
|
172
|
+
* The maximum number of messages to get. If omitted, no limit will be
|
|
173
|
+
* applied.
|
|
174
|
+
*/
|
|
175
|
+
readonly limit?: number;
|
|
176
|
+
}
|
|
136
177
|
//# sourceMappingURL=session.d.ts.map
|
|
137
178
|
//#endregion
|
|
138
|
-
export { Session, SessionGetOutboxOptions, SessionPublishOptions, SessionPublishOptionsWithClass };
|
|
179
|
+
export { Session, SessionGetOutboxOptions, SessionPublishOptions, SessionPublishOptionsWithClass, SessionPublishOptionsWithQuestion };
|
|
139
180
|
//# sourceMappingURL=session.d.ts.map
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","names":[],"sources":["../src/session.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;UAsCiB;;;AAAjB;EAAwB,SAAA,GAAA,EAIR,GAJQ,CAIJ,YAJI,CAAA;EAAA;;;EASgB,SAApB,OAAA,EAAA,OAAA,CAAQ,YAAR,CAAA;EAAO;;;EAgBN,SAgBL,OAAA,EA3BI,GA2BJ;EAAK;;;EAeE,SAAG,WAAA,EAAA,IAAA,MAAA,IAAA,MAAA,EAAA;EAAG;;;;EAWkB,QASpB,EAAA,EAnDb,OAmDa,CAnDL,KAmDK,CAAA;EAAY;;;;;;;;;;;;;;EAcP,MAAE,CAAA,KAAA,EAjDlB,KAiDkB,GAjDV,GAiDU,GAAA,MAAA,CAAA,EAjDK,OAiDL,CAAA,IAAA,CAAA;EAAY
|
|
1
|
+
{"version":3,"file":"session.d.ts","names":[],"sources":["../src/session.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;UAsCiB;;;AAAjB;EAAwB,SAAA,GAAA,EAIR,GAJQ,CAIJ,YAJI,CAAA;EAAA;;;EASgB,SAApB,OAAA,EAAA,OAAA,CAAQ,YAAR,CAAA;EAAO;;;EAgBN,SAgBL,OAAA,EA3BI,GA2BJ;EAAK;;;EAeE,SAAG,WAAA,EAAA,IAAA,MAAA,IAAA,MAAA,EAAA;EAAG;;;;EAWkB,QASpB,EAAA,EAnDb,OAmDa,CAnDL,KAmDK,CAAA;EAAY;;;;;;;;;;;;;;EAcP,MAAE,CAAA,KAAA,EAjDlB,KAiDkB,GAjDV,GAiDU,GAAA,MAAA,CAAA,EAjDK,OAiDL,CAAA,IAAA,CAAA;EAAY;;;;;;;;;;;;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yCACL,oCAEF,sBAAsB;;;;kBAId,UAAU,iBAAiB,UACvC,UAAU,qBAAqB,cAC/B,UAAU,cAAc,OACxB,UAAU,kBAAkB;;;;;;;UASjB,wDACP,+BAA+B,UAAU;;;;;iBAKlC;;;;;UAMA,uBAAA;;;;;;;;;;mBAWE,QAAA,CAAS;;;;;mBAMT,QAAA,CAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/botkit",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.112+8f983226",
|
|
4
4
|
"description": "A framework for creating ActivityPub bots",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"author": {
|
|
@@ -78,6 +78,14 @@
|
|
|
78
78
|
"import": "./dist/message.js",
|
|
79
79
|
"require": "./dist/message.cjs"
|
|
80
80
|
},
|
|
81
|
+
"./poll": {
|
|
82
|
+
"types": {
|
|
83
|
+
"import": "./dist/poll.d.ts",
|
|
84
|
+
"require": "./dist/poll.d.cts"
|
|
85
|
+
},
|
|
86
|
+
"import": "./dist/poll.js",
|
|
87
|
+
"require": "./dist/poll.cjs"
|
|
88
|
+
},
|
|
81
89
|
"./reaction": {
|
|
82
90
|
"types": {
|
|
83
91
|
"import": "./dist/reaction.d.ts",
|
|
@@ -86,6 +94,14 @@
|
|
|
86
94
|
"import": "./dist/reaction.js",
|
|
87
95
|
"require": "./dist/reaction.cjs"
|
|
88
96
|
},
|
|
97
|
+
"./repository": {
|
|
98
|
+
"types": {
|
|
99
|
+
"import": "./dist/repository.d.ts",
|
|
100
|
+
"require": "./dist/repository.d.cts"
|
|
101
|
+
},
|
|
102
|
+
"import": "./dist/repository.js",
|
|
103
|
+
"require": "./dist/repository.cjs"
|
|
104
|
+
},
|
|
89
105
|
"./session": {
|
|
90
106
|
"types": {
|
|
91
107
|
"import": "./dist/session.d.ts",
|
|
@@ -112,7 +128,7 @@
|
|
|
112
128
|
"README.md"
|
|
113
129
|
],
|
|
114
130
|
"dependencies": {
|
|
115
|
-
"@fedify/fedify": "^1.
|
|
131
|
+
"@fedify/fedify": "^1.7.1",
|
|
116
132
|
"@fedify/markdown-it-hashtag": "^0.3.0",
|
|
117
133
|
"@fedify/markdown-it-mention": "^0.3.0",
|
|
118
134
|
"@js-temporal/polyfill": "^0.5.1",
|