Commit 778b393c authored by Grant's avatar Grant
Browse files

update fedify to ^2.3.1

Assisted-by: deepseek:v4-flash
parent 8d9663e8
Loading
Loading
Loading
Loading
Loading
+0 −1740

File deleted.

Preview size limit exceeded, changes collapsed.

+5 −3
Original line number Diff line number Diff line
@@ -6,9 +6,11 @@
  "private": true,
  "type": "module",
  "dependencies": {
    "@fedify/express": "^0.2.1",
    "@fedify/fedify": "patch:@fedify/fedify@npm%3A1.10.0#~/.yarn/patches/@fedify-fedify-npm-1.10.0-eb96e7364a.patch",
    "@fedify/redis": "^1.10.10",
    "@fedify/express": "^2.3.1",
    "@fedify/fedify": "^2.3.1",
    "@fedify/redis": "^2.3.1",
    "@fedify/vocab": "^2.3.1",
    "@fedify/webfinger": "^2.3.1",
    "@js-temporal/polyfill": "^0.5.1",
    "@logtape/logtape": "^0.9.2",
    "@prisma/client": "^5.22.0",
+1 −1
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ describe.for(
      ]);

      // Reply using the real received object
      const { Note, Mention } = await import("@fedify/fedify");
      const { Note, Mention } = await import("@fedify/vocab");
      replyContent = `Reply to real message ${sessionId}`;
      const replyNote = new Note({
        to: capturedActor,
+7 −5
Original line number Diff line number Diff line
import {
  ChatMessage,
  Create,
  createFederation,
  Endpoints,
  exportJwk,
  Follow,
  generateCryptoKeyPair,
  importJwk,
} from "@fedify/fedify";
import {
  ChatMessage,
  Create,
  Endpoints,
  Follow,
  isActor,
  lookupObject,
  Note,
  Reject,
  Service,
} from "@fedify/fedify";
} from "@fedify/vocab";
import { RedisKvStore, RedisMessageQueue } from "@fedify/redis";
import { Redis } from "ioredis";
import { FedifyTransformers } from "./transformers.js";
+12 −26
Original line number Diff line number Diff line
import { Context, ConstructorWithTypeId } from "@fedify/fedify";
import {
  Actor,
  ChatMessage,
  ConstructorWithTypeId,
  Context,
  Create,
  Delete,
  isActor,
  lookupObject,
  LookupObjectOptions,
  lookupWebFinger,
  Mention,
  Note,
  Object,
  Tombstone,
} from "@fedify/fedify";
import * as fedify from "@fedify/fedify";
} from "@fedify/vocab";
import { lookupWebFinger } from "@fedify/webfinger";
import * as vocab from "@fedify/vocab";
import { federation, USER_IDENTIFIER } from "./federation.js";
import { Temporal } from "@js-temporal/polyfill";
import { AuthSession } from "../models/AuthSession.js";
import { IProfile } from "../lib/instance/userMeta.js";
import { _staticType, getSafeURL } from "../lib/utils.js";
import {
@@ -29,13 +22,6 @@ import {
import { hash } from "node:crypto";
import { SentAP } from "../models/SentAP.redis.js";

type BuildObjectOpts = {
  id: string;
  one_time_code: string;
  createdAt: Date;
  target: Actor;
};

/**
 * @internal -- See apub/utils.ts
 */
@@ -142,8 +128,8 @@ export class APubLive implements IAPubUtils {
    const apub = this.get();
    const ts = Date.now();
    const outbox = [
      await message.build(fedify.Note),
      await message.build(fedify.ChatMessage),
      await message.build(vocab.Note),
      await message.build(vocab.ChatMessage),
    ].map((obj) => apub.prepareObject(obj, ts));

    return await Promise.allSettled(
@@ -180,7 +166,7 @@ export class APubLive implements IAPubUtils {
    );
  }

  static async reply<T extends fedify.Object>(replyTo: T, reply: T) {
  static async reply<T extends vocab.Object>(replyTo: T, reply: T) {
    const apub = this.get();
    const recipients = await apub.getRecipients(reply);

@@ -243,7 +229,7 @@ export class APubLive implements IAPubUtils {
    );
  }

  private async getRecipients(object: fedify.Object) {
  private async getRecipients(object: vocab.Object) {
    const docLoader = await this.ctx.getDocumentLoader({
      identifier: USER_IDENTIFIER,
    });
@@ -254,21 +240,21 @@ export class APubLive implements IAPubUtils {
    );
    const recipients = recipientsLoader
      .filter((l) => l.status === "fulfilled")
      .filter((l): l is { value: fedify.Object; status: "fulfilled" } =>
      .filter((l): l is { value: vocab.Object; status: "fulfilled" } =>
        Boolean(l.value),
      )
      .map((l) => l.value)
      .filter((l) => fedify.isActor(l));
      .filter((l) => vocab.isActor(l));

    return recipients;
  }

  private prepareObject<TObject extends fedify.Object>(
  private prepareObject<TObject extends vocab.Object>(
    object: TObject,
    timestamp: number,
  ): TObject {
    // the class that instansiates this object
    const BoundingObject = object.constructor as typeof fedify.Object;
    const BoundingObject = object.constructor as typeof vocab.Object;

    const objectId = hash(
      "sha256",
Loading