docs(federation): 📝 Update SDK documentation

This commit is contained in:
Jesse Wierzbinski 2025-04-08 21:54:55 +02:00
parent f79b0bc999
commit 45e5460975
No known key found for this signature in database
67 changed files with 332 additions and 65 deletions

View file

@ -1,10 +1,10 @@
import { User } from "@versia/kit/db";
import * as VersiaEntities from "@versia/sdk/entities";
import { Queue } from "bullmq";
import { Worker } from "bullmq";
import chalk from "chalk";
import { config } from "~/config.ts";
import type { JSONObject } from "~/packages/federation/types";
import * as VersiaEntities from "~/packages/sdk/entities";
import type { JSONObject } from "~/packages/sdk/types";
import { connection } from "~/utils/redis.ts";
export enum DeliveryJobType {
@ -40,7 +40,9 @@ export const getDeliveryWorker = (): Worker<
if (!sender) {
throw new Error(
`Could not resolve sender ID ${chalk.gray(senderId)}`,
`Could not resolve sender ID ${chalk.gray(
senderId,
)}`,
);
}
@ -48,12 +50,16 @@ export const getDeliveryWorker = (): Worker<
if (!recipient) {
throw new Error(
`Could not resolve recipient ID ${chalk.gray(recipientId)}`,
`Could not resolve recipient ID ${chalk.gray(
recipientId,
)}`,
);
}
await job.log(
`Federating entity [${entity.id}] from @${sender.getAcct()} to @${recipient.getAcct()}`,
`Federating entity [${
entity.id
}] from @${sender.getAcct()} to @${recipient.getAcct()}`,
);
const type = entity.type;

View file

@ -4,7 +4,7 @@ import { Queue } from "bullmq";
import { Worker } from "bullmq";
import type { SocketAddress } from "bun";
import { config } from "~/config.ts";
import type { JSONObject } from "~/packages/federation/types.ts";
import type { JSONObject } from "~/packages/sdk/types.ts";
import { connection } from "~/utils/redis.ts";
import { ApiError } from "../errors/api-error.ts";
import { InboxProcessor } from "../inbox/processor.ts";
@ -182,7 +182,9 @@ export const getInboxWorker = (): Worker<InboxJobData, void, InboxJobType> =>
);
await remoteInstance.sendMessage(
`Failed processing entity [${data.uri}] delivered to inbox. Returned error:\n\n${JSON.stringify(
`Failed processing entity [${
data.uri
}] delivered to inbox. Returned error:\n\n${JSON.stringify(
e.message,
null,
4,