mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
docs(federation): 📝 Update SDK documentation
This commit is contained in:
parent
f79b0bc999
commit
45e5460975
67 changed files with 332 additions and 65 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue