Unverified Commit e865d6e4 authored by Hong Minhee's avatar Hong Minhee
Browse files

Merge remote-tracking branch 'express/main'

parents 649de509 70f76044
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -379,17 +379,21 @@ jobs:
          - [`npm:@fedify/fedify@${{ steps.versioning.outputs.short_version }}`][2]
          - [`jsr:@fedify/amqp@${{ steps.versioning.outputs.version }}`][3]
          - [`npm:@fedify/amqp@${{ steps.versioning.outputs.short_version }}`][4]
          - [`jsr:@fedify/postgres@${{ steps.versioning.outputs.version }}`][5]
          - [`npm:@fedify/postgres@${{ steps.versioning.outputs.short_version }}`][6]
          - [`jsr:@fedify/cli@${{ steps.versioning.outputs.version }}`][7]
          - [`jsr:@fedify/express@${{ steps.versioning.outputs.version }}`][5]
          - [`npm:@fedify/express@${{ steps.versioning.outputs.short_version }}`][6]
          - [`jsr:@fedify/postgres@${{ steps.versioning.outputs.version }}`][7]
          - [`npm:@fedify/postgres@${{ steps.versioning.outputs.short_version }}`][8]
          - [`jsr:@fedify/cli@${{ steps.versioning.outputs.version }}`][9]

          [1]: https://jsr.io/@fedify/fedify@${{ steps.versioning.outputs.version }}
          [2]: https://www.npmjs.com/package/@fedify/fedify/v/${{ steps.versioning.outputs.short_version }}
          [3]: https://jsr.io/@fedify/amqp@${{ steps.versioning.outputs.version }}
          [4]: https://www.npmjs.com/package/@fedify/amqp/v/${{ steps.versioning.outputs.short_version }}
          [5]: https://jsr.io/@fedify/postgres@${{ steps.versioning.outputs.version }}
          [6]: https://www.npmjs.com/package/@fedify/postgres/v/${{ steps.versioning.outputs.short_version }}
          [7]: https://jsr.io/@fedify/cli@${{ steps.versioning.outputs.version }}
          [5]: https://jsr.io/@fedify/express@${{ steps.versioning.outputs.version }}
          [6]: https://www.npmjs.com/package/@fedify/express/v/${{ steps.versioning.outputs.short_version }}
          [7]: https://jsr.io/@fedify/postgres@${{ steps.versioning.outputs.version }}
          [8]: https://www.npmjs.com/package/@fedify/postgres/v/${{ steps.versioning.outputs.short_version }}
          [9]: https://jsr.io/@fedify/cli@${{ steps.versioning.outputs.version }}
        pr-number: ${{ github.event.pull_request.number }}
        comment-tag: publish

+26 −9
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
    "./fedify",
    "./cli",
    "./amqp",
    "./express",
    "./postgres",
    "./examples/blog",
    "./examples/cloudflare-workers",
@@ -35,19 +36,35 @@
  "nodeModulesDir": "none",
  "tasks": {
    "codegen": "deno task -f @fedify/cli codegen",
    "check": {
      "command": "deno task -f @fedify/fedify check && deno task -f @fedify/cli check && deno task -f @fedify/blog check && deno task -f @fedify/hono-sample check",
    "check-versions": "deno run --allow-read --allow-write scripts/check_versions.ts",
    "check-all": {
      "command": "deno task --recursive check",
      "dependencies": [
        "check-versions"
        "check-versions",
        "codegen"
      ]
    },
    "test": {
      "command": "deno test --check --doc --allow-all --unstable-kv --trace-leaks --parallel",
      "dependencies": [
        "codegen"
      ]
    },
    "test:node": {
      "command": "pnpm run --recursive --filter '!{docs}' test",
      "dependencies": [
        "codegen"
      ]
    },
    "test:bun": {
      "command": "pnpm run --recursive --filter '!{docs}' test:bun",
      "dependencies": [
        "codegen"
      ]
    },
    "check-versions": "deno run --allow-read --allow-write scripts/check_versions.ts",
    "test": "deno test --check --doc --allow-all --unstable-kv --trace-leaks --parallel",
    "test:node": "pnpm run --recursive --filter '!{docs}' test",
    "test:bun": "pnpm run --recursive --filter '!{docs}' test:bun",
    "test-all": {
      "dependencies": [
        "check",
        "check-all",
        "test",
        "test:node",
        "test:bun"
@@ -58,7 +75,7 @@
    "hooks:install": "deno run --allow-read=deno.json,.git/hooks/ --allow-write=.git/hooks/ jsr:@hongminhee/deno-task-hooks",
    "hooks:pre-commit": {
      "dependencies": [
        "check"
        "check-all"
      ]
    }
  }
+2 −1
Original line number Diff line number Diff line
@@ -76,7 +76,8 @@ Express
The [@fedify/express] package provides a middleware to integrate Fedify with
Express:

~~~~ typescript
~~~~ typescript twoslash
// @noErrors: 2345
import express from "express";
import { integrateFederation } from "@fedify/express";
import { createFederation } from "@fedify/fedify";
+4 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
    "@cloudflare/workers-types": "catalog:",
    "@deno/kv": "^0.8.4",
    "@fedify/amqp": "workspace:",
    "@fedify/express": "workspace:",
    "@fedify/fedify": "workspace:",
    "@fedify/postgres": "workspace:",
    "@fedify/redis": "^0.4.0",
@@ -19,9 +20,11 @@
    "@types/amqplib": "catalog:",
    "@types/better-sqlite3": "^7.6.12",
    "@types/bun": "^1.1.14",
    "@types/node": "^22.15.21",
    "@types/express": "catalog:",
    "@types/node": "catalog:",
    "amqplib": "catalog:",
    "dayjs": "^1.11.13",
    "express": "catalog:",
    "hono": "^4.6.14",
    "ioredis": "^5.4.2",
    "markdown-it-abbr": "^2.0.0",
+23 −0
Original line number Diff line number Diff line
import { MemoryKvStore, Note, Person, createFederation } from "@fedify/fedify";

export const federation = createFederation<void>({
  kv: new MemoryKvStore(),
});

federation.setActorDispatcher("/users/{handle}", async (ctx, handle) => {
  return new Person({
    id: ctx.getActorUri(handle),
    preferredUsername: handle,
  });
});

federation.setObjectDispatcher(
  Note,
  "/users/{handle}/{id}",
  async (ctx, values) => {
    return new Note({
      id: ctx.getObjectUri(Note, values),
      name: values.id,
    });
  },
);
Loading