@fedify/relay 2.2.0-dev.787 → 2.2.0-pr.695.16
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/dist/litepub.test.js +2 -1
- package/dist/mastodon.test.js +2 -1
- package/dist/mod.d.cts +2 -118
- package/dist/mod.d.ts +2 -118
- package/dist/types-BcFcxptW.js +19 -0
- package/package.json +4 -4
- package/dist/types-yRiwtYfN.js +0 -26349
package/dist/litepub.test.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as isRelayFollowerData } from "./types-BcFcxptW.js";
|
|
5
5
|
import { MemoryKvStore, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { Accept, Announce, Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
|
|
8
|
+
import { exportSpki, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
8
9
|
import { ok, strictEqual } from "node:assert";
|
|
9
10
|
import test, { describe } from "node:test";
|
|
10
11
|
//#region src/litepub.test.ts
|
package/dist/mastodon.test.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as isRelayFollowerData } from "./types-BcFcxptW.js";
|
|
5
5
|
import { MemoryKvStore, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
|
|
8
|
+
import { exportSpki, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
8
9
|
import { ok, strictEqual } from "node:assert";
|
|
9
10
|
import test, { describe } from "node:test";
|
|
10
11
|
//#region src/mastodon.test.ts
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,123 +1,7 @@
|
|
|
1
1
|
import { Context, KvStore, MessageQueue } from "@fedify/fedify";
|
|
2
2
|
import { Actor } from "@fedify/vocab";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Options for making `User-Agent` string.
|
|
6
|
-
* @see {@link getUserAgent}
|
|
7
|
-
* @since 1.3.0
|
|
8
|
-
*/
|
|
9
|
-
interface GetUserAgentOptions {
|
|
10
|
-
/**
|
|
11
|
-
* An optional software name and version, e.g., `"Hollo/1.0.0"`.
|
|
12
|
-
*/
|
|
13
|
-
software?: string | null;
|
|
14
|
-
/**
|
|
15
|
-
* An optional URL to append to the user agent string.
|
|
16
|
-
* Usually the URL of the ActivityPub instance.
|
|
17
|
-
*/
|
|
18
|
-
url?: string | URL | null;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Gets the user agent string for the given application and URL.
|
|
22
|
-
* @param options The options for making the user agent string.
|
|
23
|
-
* @returns The user agent string.
|
|
24
|
-
* @since 1.3.0
|
|
25
|
-
*/
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/docloader.d.ts
|
|
28
|
-
/**
|
|
29
|
-
* A remote JSON-LD document and its context fetched by
|
|
30
|
-
* a {@link DocumentLoader}.
|
|
31
|
-
*/
|
|
32
|
-
interface RemoteDocument {
|
|
33
|
-
/**
|
|
34
|
-
* The URL of the context document.
|
|
35
|
-
*/
|
|
36
|
-
contextUrl: string | null;
|
|
37
|
-
/**
|
|
38
|
-
* The fetched JSON-LD document.
|
|
39
|
-
*/
|
|
40
|
-
document: unknown;
|
|
41
|
-
/**
|
|
42
|
-
* The URL of the fetched document.
|
|
43
|
-
*/
|
|
44
|
-
documentUrl: string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Options for {@link DocumentLoader}.
|
|
48
|
-
* @since 1.8.0
|
|
49
|
-
*/
|
|
50
|
-
interface DocumentLoaderOptions {
|
|
51
|
-
/**
|
|
52
|
-
* An `AbortSignal` for cancellation.
|
|
53
|
-
* @since 1.8.0
|
|
54
|
-
*/
|
|
55
|
-
signal?: AbortSignal;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* A JSON-LD document loader that fetches documents from the Web.
|
|
59
|
-
* @param url The URL of the document to load.
|
|
60
|
-
* @param options The options for the document loader.
|
|
61
|
-
* @returns The loaded remote document.
|
|
62
|
-
*/
|
|
63
|
-
type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
|
|
64
|
-
/**
|
|
65
|
-
* A factory function that creates a {@link DocumentLoader} with options.
|
|
66
|
-
* @param options The options for the document loader.
|
|
67
|
-
* @returns The document loader.
|
|
68
|
-
* @since 1.4.0
|
|
69
|
-
*/
|
|
70
|
-
type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
71
|
-
/**
|
|
72
|
-
* Options for {@link DocumentLoaderFactory}.
|
|
73
|
-
* @see {@link DocumentLoaderFactory}
|
|
74
|
-
* @see {@link AuthenticatedDocumentLoaderFactory}
|
|
75
|
-
* @since 1.4.0
|
|
76
|
-
*/
|
|
77
|
-
interface DocumentLoaderFactoryOptions {
|
|
78
|
-
/**
|
|
79
|
-
* Whether to allow fetching private network addresses.
|
|
80
|
-
* Turned off by default.
|
|
81
|
-
* @default `false``
|
|
82
|
-
*/
|
|
83
|
-
allowPrivateAddress?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Options for making `User-Agent` string.
|
|
86
|
-
* If a string is given, it is used as the `User-Agent` header value.
|
|
87
|
-
* If an object is given, it is passed to {@link getUserAgent} function.
|
|
88
|
-
*/
|
|
89
|
-
userAgent?: GetUserAgentOptions | string;
|
|
90
|
-
/**
|
|
91
|
-
* The maximum number of redirections to follow.
|
|
92
|
-
* @default `20`
|
|
93
|
-
* @since 2.2.0
|
|
94
|
-
*/
|
|
95
|
-
maxRedirection?: number;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* A factory function that creates an authenticated {@link DocumentLoader} for
|
|
99
|
-
* a given identity. This is used for fetching documents that require
|
|
100
|
-
* authentication.
|
|
101
|
-
* @param identity The identity to create the document loader for.
|
|
102
|
-
* The actor's key pair.
|
|
103
|
-
* @param options The options for the document loader.
|
|
104
|
-
* @returns The authenticated document loader.
|
|
105
|
-
* @since 0.4.0
|
|
106
|
-
*/
|
|
107
|
-
type AuthenticatedDocumentLoaderFactory = (identity: {
|
|
108
|
-
keyId: URL;
|
|
109
|
-
privateKey: CryptoKey;
|
|
110
|
-
}, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
111
|
-
/**
|
|
112
|
-
* Gets a {@link RemoteDocument} from the given response.
|
|
113
|
-
* @param url The URL of the document to load.
|
|
114
|
-
* @param response The response to get the document from.
|
|
115
|
-
* @param fetch The function to fetch the document.
|
|
116
|
-
* @returns The loaded remote document.
|
|
117
|
-
* @throws {FetchError} If the response is not OK.
|
|
118
|
-
* @internal
|
|
119
|
-
*/
|
|
120
|
-
//#endregion
|
|
3
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoaderFactory } from "@fedify/vocab-runtime";
|
|
4
|
+
|
|
121
5
|
//#region src/types.d.ts
|
|
122
6
|
declare const RELAY_SERVER_ACTOR = "relay";
|
|
123
7
|
/**
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,124 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { Context, KvStore, MessageQueue } from "@fedify/fedify";
|
|
3
3
|
import { Actor } from "@fedify/vocab";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Options for making `User-Agent` string.
|
|
7
|
-
* @see {@link getUserAgent}
|
|
8
|
-
* @since 1.3.0
|
|
9
|
-
*/
|
|
10
|
-
interface GetUserAgentOptions {
|
|
11
|
-
/**
|
|
12
|
-
* An optional software name and version, e.g., `"Hollo/1.0.0"`.
|
|
13
|
-
*/
|
|
14
|
-
software?: string | null;
|
|
15
|
-
/**
|
|
16
|
-
* An optional URL to append to the user agent string.
|
|
17
|
-
* Usually the URL of the ActivityPub instance.
|
|
18
|
-
*/
|
|
19
|
-
url?: string | URL | null;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Gets the user agent string for the given application and URL.
|
|
23
|
-
* @param options The options for making the user agent string.
|
|
24
|
-
* @returns The user agent string.
|
|
25
|
-
* @since 1.3.0
|
|
26
|
-
*/
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/docloader.d.ts
|
|
29
|
-
/**
|
|
30
|
-
* A remote JSON-LD document and its context fetched by
|
|
31
|
-
* a {@link DocumentLoader}.
|
|
32
|
-
*/
|
|
33
|
-
interface RemoteDocument {
|
|
34
|
-
/**
|
|
35
|
-
* The URL of the context document.
|
|
36
|
-
*/
|
|
37
|
-
contextUrl: string | null;
|
|
38
|
-
/**
|
|
39
|
-
* The fetched JSON-LD document.
|
|
40
|
-
*/
|
|
41
|
-
document: unknown;
|
|
42
|
-
/**
|
|
43
|
-
* The URL of the fetched document.
|
|
44
|
-
*/
|
|
45
|
-
documentUrl: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Options for {@link DocumentLoader}.
|
|
49
|
-
* @since 1.8.0
|
|
50
|
-
*/
|
|
51
|
-
interface DocumentLoaderOptions {
|
|
52
|
-
/**
|
|
53
|
-
* An `AbortSignal` for cancellation.
|
|
54
|
-
* @since 1.8.0
|
|
55
|
-
*/
|
|
56
|
-
signal?: AbortSignal;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* A JSON-LD document loader that fetches documents from the Web.
|
|
60
|
-
* @param url The URL of the document to load.
|
|
61
|
-
* @param options The options for the document loader.
|
|
62
|
-
* @returns The loaded remote document.
|
|
63
|
-
*/
|
|
64
|
-
type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
|
|
65
|
-
/**
|
|
66
|
-
* A factory function that creates a {@link DocumentLoader} with options.
|
|
67
|
-
* @param options The options for the document loader.
|
|
68
|
-
* @returns The document loader.
|
|
69
|
-
* @since 1.4.0
|
|
70
|
-
*/
|
|
71
|
-
type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
72
|
-
/**
|
|
73
|
-
* Options for {@link DocumentLoaderFactory}.
|
|
74
|
-
* @see {@link DocumentLoaderFactory}
|
|
75
|
-
* @see {@link AuthenticatedDocumentLoaderFactory}
|
|
76
|
-
* @since 1.4.0
|
|
77
|
-
*/
|
|
78
|
-
interface DocumentLoaderFactoryOptions {
|
|
79
|
-
/**
|
|
80
|
-
* Whether to allow fetching private network addresses.
|
|
81
|
-
* Turned off by default.
|
|
82
|
-
* @default `false``
|
|
83
|
-
*/
|
|
84
|
-
allowPrivateAddress?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Options for making `User-Agent` string.
|
|
87
|
-
* If a string is given, it is used as the `User-Agent` header value.
|
|
88
|
-
* If an object is given, it is passed to {@link getUserAgent} function.
|
|
89
|
-
*/
|
|
90
|
-
userAgent?: GetUserAgentOptions | string;
|
|
91
|
-
/**
|
|
92
|
-
* The maximum number of redirections to follow.
|
|
93
|
-
* @default `20`
|
|
94
|
-
* @since 2.2.0
|
|
95
|
-
*/
|
|
96
|
-
maxRedirection?: number;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* A factory function that creates an authenticated {@link DocumentLoader} for
|
|
100
|
-
* a given identity. This is used for fetching documents that require
|
|
101
|
-
* authentication.
|
|
102
|
-
* @param identity The identity to create the document loader for.
|
|
103
|
-
* The actor's key pair.
|
|
104
|
-
* @param options The options for the document loader.
|
|
105
|
-
* @returns The authenticated document loader.
|
|
106
|
-
* @since 0.4.0
|
|
107
|
-
*/
|
|
108
|
-
type AuthenticatedDocumentLoaderFactory = (identity: {
|
|
109
|
-
keyId: URL;
|
|
110
|
-
privateKey: CryptoKey;
|
|
111
|
-
}, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
112
|
-
/**
|
|
113
|
-
* Gets a {@link RemoteDocument} from the given response.
|
|
114
|
-
* @param url The URL of the document to load.
|
|
115
|
-
* @param response The response to get the document from.
|
|
116
|
-
* @param fetch The function to fetch the document.
|
|
117
|
-
* @returns The loaded remote document.
|
|
118
|
-
* @throws {FetchError} If the response is not OK.
|
|
119
|
-
* @internal
|
|
120
|
-
*/
|
|
121
|
-
//#endregion
|
|
4
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoaderFactory } from "@fedify/vocab-runtime";
|
|
5
|
+
|
|
122
6
|
//#region src/types.d.ts
|
|
123
7
|
declare const RELAY_SERVER_ACTOR = "relay";
|
|
124
8
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
//#region src/types.ts
|
|
5
|
+
/**
|
|
6
|
+
* Type predicate to check if a value is valid RelayFollowerData from KV store.
|
|
7
|
+
* Validates the storage format (JSON-LD), not the deserialized Actor instance.
|
|
8
|
+
*
|
|
9
|
+
* @param value The value to check
|
|
10
|
+
* @returns true if the value is a RelayFollowerData
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
function isRelayFollowerData(value) {
|
|
14
|
+
if (!value || typeof value !== "object") return false;
|
|
15
|
+
const obj = value;
|
|
16
|
+
return "actor" in obj && "state" in obj && typeof obj.state === "string" && (obj.state === "pending" || obj.state === "accepted");
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { isRelayFollowerData as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/relay",
|
|
3
|
-
"version": "2.2.0-
|
|
3
|
+
"version": "2.2.0-pr.695.16+7a782334",
|
|
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.5",
|
|
53
|
-
"@fedify/fedify": "^2.2.0-
|
|
54
|
-
"@fedify/vocab": "2.2.0-
|
|
53
|
+
"@fedify/fedify": "^2.2.0-pr.695.16+7a782334",
|
|
54
|
+
"@fedify/vocab": "2.2.0-pr.695.16+7a782334"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"tsdown": "^0.21.6",
|
|
58
58
|
"typescript": "^5.9.2",
|
|
59
59
|
"urlpattern-polyfill": "^10.1.0",
|
|
60
|
-
"@fedify/vocab-runtime": "^2.2.0-
|
|
60
|
+
"@fedify/vocab-runtime": "^2.2.0-pr.695.16+7a782334"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build:self": "tsdown",
|