@fedify/relay 2.1.0-dev.405 → 2.1.0-dev.406

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.
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { exportSpki, getDocumentLoader, isRelayFollowerData } from "./types-BGfj4wnt.js";
6
+ import { exportSpki, getDocumentLoader, isRelayFollowerData } from "./types-Bt32Syh0.js";
7
7
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
8
8
  import { createRelay } from "@fedify/relay";
9
9
  import { Accept, Announce, Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { exportSpki, getDocumentLoader, isRelayFollowerData } from "./types-BGfj4wnt.js";
6
+ import { exportSpki, getDocumentLoader, isRelayFollowerData } from "./types-Bt32Syh0.js";
7
7
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
8
8
  import { createRelay } from "@fedify/relay";
9
9
  import { Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
package/dist/mod.d.cts CHANGED
@@ -5,68 +5,68 @@ import { AuthenticatedDocumentLoaderFactory, DocumentLoaderFactory } from "@fedi
5
5
  //#region src/types.d.ts
6
6
  declare const RELAY_SERVER_ACTOR = "relay";
7
7
  /**
8
- * Supported relay types.
9
- */
8
+ * Supported relay types.
9
+ */
10
10
  type RelayType = "mastodon" | "litepub";
11
11
  /**
12
- * Handler for subscription requests (Follow/Undo activities).
13
- */
12
+ * Handler for subscription requests (Follow/Undo activities).
13
+ */
14
14
  type SubscriptionRequestHandler = (ctx: Context<RelayOptions>, clientActor: Actor) => Promise<boolean>;
15
15
  /**
16
- * Configuration options for the ActivityPub relay.
17
- */
16
+ * Configuration options for the ActivityPub relay.
17
+ */
18
18
  interface RelayOptions {
19
19
  /**
20
- * Key-value store for persisting relay data such as follower information
21
- * and cryptographic keys.
22
- */
20
+ * Key-value store for persisting relay data such as follower information
21
+ * and cryptographic keys.
22
+ */
23
23
  kv: KvStore;
24
24
  /**
25
- * The origin URL where the relay is hosted.
26
- * Must be a full URL including the protocol (e.g., `"https://relay.example.com"`).
27
- */
25
+ * The origin URL where the relay is hosted.
26
+ * Must be a full URL including the protocol (e.g., `"https://relay.example.com"`).
27
+ */
28
28
  origin: string;
29
29
  /**
30
- * Display name for the relay actor.
31
- * Defaults to `"ActivityPub Relay"`.
32
- */
30
+ * Display name for the relay actor.
31
+ * Defaults to `"ActivityPub Relay"`.
32
+ */
33
33
  name?: string;
34
34
  /**
35
- * Factory function for creating a document loader to fetch remote
36
- * ActivityPub objects.
37
- */
35
+ * Factory function for creating a document loader to fetch remote
36
+ * ActivityPub objects.
37
+ */
38
38
  documentLoaderFactory?: DocumentLoaderFactory;
39
39
  /**
40
- * Factory function for creating an authenticated document loader
41
- * that signs HTTP requests when fetching remote objects.
42
- */
40
+ * Factory function for creating an authenticated document loader
41
+ * that signs HTTP requests when fetching remote objects.
42
+ */
43
43
  authenticatedDocumentLoaderFactory?: AuthenticatedDocumentLoaderFactory;
44
44
  /**
45
- * Message queue for background activity processing.
46
- * Recommended for production to handle activity forwarding asynchronously.
47
- */
45
+ * Message queue for background activity processing.
46
+ * Recommended for production to handle activity forwarding asynchronously.
47
+ */
48
48
  queue?: MessageQueue;
49
49
  /**
50
- * Handler function that determines whether to approve or reject
51
- * subscription requests from remote actors.
52
- * Return `true` to approve or `false` to reject.
53
- */
50
+ * Handler function that determines whether to approve or reject
51
+ * subscription requests from remote actors.
52
+ * Return `true` to approve or `false` to reject.
53
+ */
54
54
  subscriptionHandler: SubscriptionRequestHandler;
55
55
  }
56
56
  /**
57
- * Internal storage format for follower data in KV store.
58
- * Contains JSON-LD representation of the actor.
59
- * Exported for internal package use but not re-exported from mod.ts.
60
- *
61
- * @internal
62
- */
57
+ * Internal storage format for follower data in KV store.
58
+ * Contains JSON-LD representation of the actor.
59
+ * Exported for internal package use but not re-exported from mod.ts.
60
+ *
61
+ * @internal
62
+ */
63
63
 
64
64
  /**
65
- * A follower of the relay with validated Actor instance.
66
- * This is the public API type returned by follower query methods.
67
- *
68
- * @since 2.0.0
69
- */
65
+ * A follower of the relay with validated Actor instance.
66
+ * This is the public API type returned by follower query methods.
67
+ *
68
+ * @since 2.0.0
69
+ */
70
70
  interface RelayFollower {
71
71
  /** The actor ID (URL) of the follower. */
72
72
  readonly actorId: string;
@@ -76,76 +76,76 @@ interface RelayFollower {
76
76
  readonly state: "pending" | "accepted";
77
77
  }
78
78
  /**
79
- * Public interface for ActivityPub relay implementations.
80
- * Use {@link createRelay} to create a relay instance.
81
- *
82
- * @since 2.0.0
83
- */
79
+ * Public interface for ActivityPub relay implementations.
80
+ * Use {@link createRelay} to create a relay instance.
81
+ *
82
+ * @since 2.0.0
83
+ */
84
84
  interface Relay {
85
85
  /**
86
- * Handle incoming HTTP requests.
87
- *
88
- * @param request The incoming HTTP request
89
- * @returns The HTTP response
90
- */
86
+ * Handle incoming HTTP requests.
87
+ *
88
+ * @param request The incoming HTTP request
89
+ * @returns The HTTP response
90
+ */
91
91
  fetch(request: Request): Promise<Response>;
92
92
  /**
93
- * Lists all followers of the relay.
94
- *
95
- * @returns An async iterator of follower entries
96
- */
93
+ * Lists all followers of the relay.
94
+ *
95
+ * @returns An async iterator of follower entries
96
+ */
97
97
  listFollowers(): AsyncIterableIterator<RelayFollower>;
98
98
  /**
99
- * Gets a specific follower by actor ID.
100
- *
101
- * @param actorId The actor ID (URL) of the follower to retrieve
102
- * @returns The follower entry if found, null otherwise
103
- */
99
+ * Gets a specific follower by actor ID.
100
+ *
101
+ * @param actorId The actor ID (URL) of the follower to retrieve
102
+ * @returns The follower entry if found, null otherwise
103
+ */
104
104
  getFollower(actorId: string): Promise<RelayFollower | null>;
105
105
  /**
106
- * Gets the URI of the relay actor.
107
- *
108
- * @returns The URI of the relay actor
109
- */
106
+ * Gets the URI of the relay actor.
107
+ *
108
+ * @returns The URI of the relay actor
109
+ */
110
110
  getActorUri(): Promise<URL>;
111
111
  /**
112
- * Gets the shared inbox URI of the relay.
113
- *
114
- * @returns The shared inbox URI
115
- */
112
+ * Gets the shared inbox URI of the relay.
113
+ *
114
+ * @returns The shared inbox URI
115
+ */
116
116
  getSharedInboxUri(): Promise<URL>;
117
117
  }
118
118
  /**
119
- * Type predicate to check if a value is valid RelayFollowerData from KV store.
120
- * Validates the storage format (JSON-LD), not the deserialized Actor instance.
121
- *
122
- * @param value The value to check
123
- * @returns true if the value is a RelayFollowerData
124
- * @internal
125
- */
119
+ * Type predicate to check if a value is valid RelayFollowerData from KV store.
120
+ * Validates the storage format (JSON-LD), not the deserialized Actor instance.
121
+ *
122
+ * @param value The value to check
123
+ * @returns true if the value is a RelayFollowerData
124
+ * @internal
125
+ */
126
126
  //#endregion
127
127
  //#region src/factory.d.ts
128
128
  /**
129
- * Factory function to create a relay instance.
130
- *
131
- * @param type The type of relay to create ("mastodon" or "litepub")
132
- * @param options Configuration options for the relay
133
- * @returns A relay instance
134
- *
135
- * @example
136
- * ```ts
137
- * import { createRelay } from "@fedify/relay";
138
- * import { MemoryKvStore } from "@fedify/fedify";
139
- *
140
- * const relay = createRelay("mastodon", {
141
- * kv: new MemoryKvStore(),
142
- * origin: "https://relay.example.com",
143
- * subscriptionHandler: async (ctx, actor) => true,
144
- * });
145
- * ```
146
- *
147
- * @since 2.0.0
148
- */
129
+ * Factory function to create a relay instance.
130
+ *
131
+ * @param type The type of relay to create ("mastodon" or "litepub")
132
+ * @param options Configuration options for the relay
133
+ * @returns A relay instance
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * import { createRelay } from "@fedify/relay";
138
+ * import { MemoryKvStore } from "@fedify/fedify";
139
+ *
140
+ * const relay = createRelay("mastodon", {
141
+ * kv: new MemoryKvStore(),
142
+ * origin: "https://relay.example.com",
143
+ * subscriptionHandler: async (ctx, actor) => true,
144
+ * });
145
+ * ```
146
+ *
147
+ * @since 2.0.0
148
+ */
149
149
  declare function createRelay(type: RelayType, options: RelayOptions): Relay;
150
150
  //#endregion
151
151
  export { RELAY_SERVER_ACTOR, Relay, RelayFollower, RelayOptions, RelayType, SubscriptionRequestHandler, createRelay };
package/dist/mod.d.ts CHANGED
@@ -6,68 +6,68 @@ import { AuthenticatedDocumentLoaderFactory, DocumentLoaderFactory } from "@fedi
6
6
  //#region src/types.d.ts
7
7
  declare const RELAY_SERVER_ACTOR = "relay";
8
8
  /**
9
- * Supported relay types.
10
- */
9
+ * Supported relay types.
10
+ */
11
11
  type RelayType = "mastodon" | "litepub";
12
12
  /**
13
- * Handler for subscription requests (Follow/Undo activities).
14
- */
13
+ * Handler for subscription requests (Follow/Undo activities).
14
+ */
15
15
  type SubscriptionRequestHandler = (ctx: Context<RelayOptions>, clientActor: Actor) => Promise<boolean>;
16
16
  /**
17
- * Configuration options for the ActivityPub relay.
18
- */
17
+ * Configuration options for the ActivityPub relay.
18
+ */
19
19
  interface RelayOptions {
20
20
  /**
21
- * Key-value store for persisting relay data such as follower information
22
- * and cryptographic keys.
23
- */
21
+ * Key-value store for persisting relay data such as follower information
22
+ * and cryptographic keys.
23
+ */
24
24
  kv: KvStore;
25
25
  /**
26
- * The origin URL where the relay is hosted.
27
- * Must be a full URL including the protocol (e.g., `"https://relay.example.com"`).
28
- */
26
+ * The origin URL where the relay is hosted.
27
+ * Must be a full URL including the protocol (e.g., `"https://relay.example.com"`).
28
+ */
29
29
  origin: string;
30
30
  /**
31
- * Display name for the relay actor.
32
- * Defaults to `"ActivityPub Relay"`.
33
- */
31
+ * Display name for the relay actor.
32
+ * Defaults to `"ActivityPub Relay"`.
33
+ */
34
34
  name?: string;
35
35
  /**
36
- * Factory function for creating a document loader to fetch remote
37
- * ActivityPub objects.
38
- */
36
+ * Factory function for creating a document loader to fetch remote
37
+ * ActivityPub objects.
38
+ */
39
39
  documentLoaderFactory?: DocumentLoaderFactory;
40
40
  /**
41
- * Factory function for creating an authenticated document loader
42
- * that signs HTTP requests when fetching remote objects.
43
- */
41
+ * Factory function for creating an authenticated document loader
42
+ * that signs HTTP requests when fetching remote objects.
43
+ */
44
44
  authenticatedDocumentLoaderFactory?: AuthenticatedDocumentLoaderFactory;
45
45
  /**
46
- * Message queue for background activity processing.
47
- * Recommended for production to handle activity forwarding asynchronously.
48
- */
46
+ * Message queue for background activity processing.
47
+ * Recommended for production to handle activity forwarding asynchronously.
48
+ */
49
49
  queue?: MessageQueue;
50
50
  /**
51
- * Handler function that determines whether to approve or reject
52
- * subscription requests from remote actors.
53
- * Return `true` to approve or `false` to reject.
54
- */
51
+ * Handler function that determines whether to approve or reject
52
+ * subscription requests from remote actors.
53
+ * Return `true` to approve or `false` to reject.
54
+ */
55
55
  subscriptionHandler: SubscriptionRequestHandler;
56
56
  }
57
57
  /**
58
- * Internal storage format for follower data in KV store.
59
- * Contains JSON-LD representation of the actor.
60
- * Exported for internal package use but not re-exported from mod.ts.
61
- *
62
- * @internal
63
- */
58
+ * Internal storage format for follower data in KV store.
59
+ * Contains JSON-LD representation of the actor.
60
+ * Exported for internal package use but not re-exported from mod.ts.
61
+ *
62
+ * @internal
63
+ */
64
64
 
65
65
  /**
66
- * A follower of the relay with validated Actor instance.
67
- * This is the public API type returned by follower query methods.
68
- *
69
- * @since 2.0.0
70
- */
66
+ * A follower of the relay with validated Actor instance.
67
+ * This is the public API type returned by follower query methods.
68
+ *
69
+ * @since 2.0.0
70
+ */
71
71
  interface RelayFollower {
72
72
  /** The actor ID (URL) of the follower. */
73
73
  readonly actorId: string;
@@ -77,76 +77,76 @@ interface RelayFollower {
77
77
  readonly state: "pending" | "accepted";
78
78
  }
79
79
  /**
80
- * Public interface for ActivityPub relay implementations.
81
- * Use {@link createRelay} to create a relay instance.
82
- *
83
- * @since 2.0.0
84
- */
80
+ * Public interface for ActivityPub relay implementations.
81
+ * Use {@link createRelay} to create a relay instance.
82
+ *
83
+ * @since 2.0.0
84
+ */
85
85
  interface Relay {
86
86
  /**
87
- * Handle incoming HTTP requests.
88
- *
89
- * @param request The incoming HTTP request
90
- * @returns The HTTP response
91
- */
87
+ * Handle incoming HTTP requests.
88
+ *
89
+ * @param request The incoming HTTP request
90
+ * @returns The HTTP response
91
+ */
92
92
  fetch(request: Request): Promise<Response>;
93
93
  /**
94
- * Lists all followers of the relay.
95
- *
96
- * @returns An async iterator of follower entries
97
- */
94
+ * Lists all followers of the relay.
95
+ *
96
+ * @returns An async iterator of follower entries
97
+ */
98
98
  listFollowers(): AsyncIterableIterator<RelayFollower>;
99
99
  /**
100
- * Gets a specific follower by actor ID.
101
- *
102
- * @param actorId The actor ID (URL) of the follower to retrieve
103
- * @returns The follower entry if found, null otherwise
104
- */
100
+ * Gets a specific follower by actor ID.
101
+ *
102
+ * @param actorId The actor ID (URL) of the follower to retrieve
103
+ * @returns The follower entry if found, null otherwise
104
+ */
105
105
  getFollower(actorId: string): Promise<RelayFollower | null>;
106
106
  /**
107
- * Gets the URI of the relay actor.
108
- *
109
- * @returns The URI of the relay actor
110
- */
107
+ * Gets the URI of the relay actor.
108
+ *
109
+ * @returns The URI of the relay actor
110
+ */
111
111
  getActorUri(): Promise<URL>;
112
112
  /**
113
- * Gets the shared inbox URI of the relay.
114
- *
115
- * @returns The shared inbox URI
116
- */
113
+ * Gets the shared inbox URI of the relay.
114
+ *
115
+ * @returns The shared inbox URI
116
+ */
117
117
  getSharedInboxUri(): Promise<URL>;
118
118
  }
119
119
  /**
120
- * Type predicate to check if a value is valid RelayFollowerData from KV store.
121
- * Validates the storage format (JSON-LD), not the deserialized Actor instance.
122
- *
123
- * @param value The value to check
124
- * @returns true if the value is a RelayFollowerData
125
- * @internal
126
- */
120
+ * Type predicate to check if a value is valid RelayFollowerData from KV store.
121
+ * Validates the storage format (JSON-LD), not the deserialized Actor instance.
122
+ *
123
+ * @param value The value to check
124
+ * @returns true if the value is a RelayFollowerData
125
+ * @internal
126
+ */
127
127
  //#endregion
128
128
  //#region src/factory.d.ts
129
129
  /**
130
- * Factory function to create a relay instance.
131
- *
132
- * @param type The type of relay to create ("mastodon" or "litepub")
133
- * @param options Configuration options for the relay
134
- * @returns A relay instance
135
- *
136
- * @example
137
- * ```ts
138
- * import { createRelay } from "@fedify/relay";
139
- * import { MemoryKvStore } from "@fedify/fedify";
140
- *
141
- * const relay = createRelay("mastodon", {
142
- * kv: new MemoryKvStore(),
143
- * origin: "https://relay.example.com",
144
- * subscriptionHandler: async (ctx, actor) => true,
145
- * });
146
- * ```
147
- *
148
- * @since 2.0.0
149
- */
130
+ * Factory function to create a relay instance.
131
+ *
132
+ * @param type The type of relay to create ("mastodon" or "litepub")
133
+ * @param options Configuration options for the relay
134
+ * @returns A relay instance
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * import { createRelay } from "@fedify/relay";
139
+ * import { MemoryKvStore } from "@fedify/fedify";
140
+ *
141
+ * const relay = createRelay("mastodon", {
142
+ * kv: new MemoryKvStore(),
143
+ * origin: "https://relay.example.com",
144
+ * subscriptionHandler: async (ctx, actor) => true,
145
+ * });
146
+ * ```
147
+ *
148
+ * @since 2.0.0
149
+ */
150
150
  declare function createRelay(type: RelayType, options: RelayOptions): Relay;
151
151
  //#endregion
152
152
  export { RELAY_SERVER_ACTOR, Relay, RelayFollower, RelayOptions, RelayType, SubscriptionRequestHandler, createRelay };
@@ -27515,7 +27515,7 @@ const preloadedContexts = {
27515
27515
  };
27516
27516
  var contexts_default = preloadedContexts;
27517
27517
  var name = "@fedify/vocab-runtime";
27518
- var version = "2.1.0-dev.405+f4e278ae";
27518
+ var version = "2.1.0-dev.406+61a21e4e";
27519
27519
  var license = "MIT";
27520
27520
  var exports$1 = { ".": "./src/mod.ts" };
27521
27521
  var description = "Runtime library for @fedify/vocab";
@@ -28305,12 +28305,12 @@ var LanguageString = class extends String {
28305
28305
  super(value);
28306
28306
  this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
28307
28307
  }
28308
- [Symbol.for("Deno.customInspect")](inspect, options) {
28309
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
28310
- }
28311
- [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
28312
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
28313
- }
28308
+ };
28309
+ LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
28310
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
28311
+ };
28312
+ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
28313
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
28314
28314
  };
28315
28315
 
28316
28316
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/relay",
3
- "version": "2.1.0-dev.405+f4e278ae",
3
+ "version": "2.1.0-dev.406+61a21e4e",
4
4
  "description": "ActivityPub relay support for Fedify",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -50,14 +50,14 @@
50
50
  "dependencies": {
51
51
  "@js-temporal/polyfill": "^0.5.1",
52
52
  "@logtape/logtape": "^2.0.0",
53
- "@fedify/fedify": "^2.1.0-dev.405+f4e278ae",
54
- "@fedify/vocab": "2.1.0-dev.405+f4e278ae"
53
+ "@fedify/fedify": "^2.1.0-dev.406+61a21e4e",
54
+ "@fedify/vocab": "2.1.0-dev.406+61a21e4e"
55
55
  },
56
56
  "devDependencies": {
57
57
  "tsdown": "^0.12.9",
58
58
  "typescript": "^5.9.3",
59
59
  "urlpattern-polyfill": "^10.1.0",
60
- "@fedify/vocab-runtime": "^2.1.0-dev.405+f4e278ae"
60
+ "@fedify/vocab-runtime": "^2.1.0-dev.406+61a21e4e"
61
61
  },
62
62
  "scripts": {
63
63
  "build:self": "tsdown",