@fedify/relay 2.5.0-dev.2446 → 2.5.0-dev.2492

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/README.md CHANGED
@@ -107,11 +107,14 @@ Usage
107
107
 
108
108
  ### Creating a relay
109
109
 
110
- Here's a simple example of creating a relay server using the factory function.
110
+ Here's a simple example of creating a relay server on Node.js using the
111
+ factory function. Install `@hono/node-server` alongside `@fedify/relay` to
112
+ serve the relay.
111
113
 
112
114
  ~~~~ typescript
113
115
  import { createRelay } from "@fedify/relay";
114
116
  import { MemoryKvStore } from "@fedify/fedify";
117
+ import { serve } from "@hono/node-server";
115
118
 
116
119
  // Create a Mastodon-style relay
117
120
  const relay = createRelay("mastodon", {
@@ -130,7 +133,7 @@ const relay = createRelay("mastodon", {
130
133
  });
131
134
 
132
135
  // Serve the relay
133
- Deno.serve((request) => relay.fetch(request));
136
+ serve({ fetch: (request) => relay.fetch(request), port: 8000 });
134
137
  ~~~~
135
138
 
136
139
  You can also create a LitePub-style relay by changing the type.
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-pLwXiYyI.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-DteRgDCy.js";
5
5
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { deepStrictEqual, ok, strictEqual } from "node:assert";
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-pLwXiYyI.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-DteRgDCy.js";
5
5
  import { MemoryKvStore, signJsonLd, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { deepStrictEqual, ok, strictEqual } from "node:assert";
package/dist/mod.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Context, KvStore, MessageQueue } from "@fedify/fedify";
3
3
  import { Actor } from "@fedify/vocab";
4
- //#region ../vocab-runtime/dist/docloader-BBnBpbsG.d.ts
4
+ //#region ../vocab-runtime/dist/docloader-DD6binpN.d.ts
5
5
  /**
6
6
  * Options for making `User-Agent` string.
7
7
  * @see {@link getUserAgent}
@@ -142,7 +142,9 @@ type AuthenticatedDocumentLoaderFactory = (identity: {
142
142
  * Gets a {@link RemoteDocument} from the given response.
143
143
  * @param url The URL of the document to load.
144
144
  * @param response The response to get the document from.
145
- * @param fetch The function to fetch the document.
145
+ * @param fetch The function to fetch the document. It is called with the URL
146
+ * of an alternate document, if any, after the response body has
147
+ * been either read or its cancellation has been started.
146
148
  * @param options The options for loading the document.
147
149
  * @returns The loaded remote document.
148
150
  * @throws {FetchError} If the response is not OK.
package/dist/mod.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Context, KvStore, MessageQueue } from "@fedify/fedify";
3
3
  import { Actor } from "@fedify/vocab";
4
- //#region ../vocab-runtime/dist/docloader-BBnBpbsG.d.ts
4
+ //#region ../vocab-runtime/dist/docloader-DD6binpN.d.ts
5
5
  /**
6
6
  * Options for making `User-Agent` string.
7
7
  * @see {@link getUserAgent}
@@ -142,7 +142,9 @@ type AuthenticatedDocumentLoaderFactory = (identity: {
142
142
  * Gets a {@link RemoteDocument} from the given response.
143
143
  * @param url The URL of the document to load.
144
144
  * @param response The response to get the document from.
145
- * @param fetch The function to fetch the document.
145
+ * @param fetch The function to fetch the document. It is called with the URL
146
+ * of an alternate document, if any, after the response body has
147
+ * been either read or its cancellation has been started.
146
148
  * @param options The options for loading the document.
147
149
  * @returns The loaded remote document.
148
150
  * @throws {FetchError} If the response is not OK.
@@ -0,0 +1,29 @@
1
+ import "temporal-polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { createRequire } from "node:module";
5
+ //#region \0rolldown/runtime.js
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
28
+ //#endregion
29
+ export { __require as n, __toESM as r, __commonJSMin as t };