@fedify/relay 2.2.0-pr.695.16 → 2.2.0-pr.695.23

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.
@@ -1,11 +1,10 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as isRelayFollowerData } from "./types-BcFcxptW.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-CepXNn7F.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";
9
8
  import { ok, strictEqual } from "node:assert";
10
9
  import test, { describe } from "node:test";
11
10
  //#region src/litepub.test.ts
@@ -1,11 +1,10 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as isRelayFollowerData } from "./types-BcFcxptW.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-CepXNn7F.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";
9
8
  import { ok, strictEqual } from "node:assert";
10
9
  import test, { describe } from "node:test";
11
10
  //#region src/mastodon.test.ts
package/dist/mod.d.cts CHANGED
@@ -1,7 +1,123 @@
1
1
  import { Context, KvStore, MessageQueue } from "@fedify/fedify";
2
2
  import { Actor } from "@fedify/vocab";
3
- import { AuthenticatedDocumentLoaderFactory, DocumentLoaderFactory } from "@fedify/vocab-runtime";
4
-
3
+ //#region ../vocab-runtime/dist/mod.d.ts
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
5
121
  //#region src/types.d.ts
6
122
  declare const RELAY_SERVER_ACTOR = "relay";
7
123
  /**
package/dist/mod.d.ts CHANGED
@@ -1,8 +1,124 @@
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
- import { AuthenticatedDocumentLoaderFactory, DocumentLoaderFactory } from "@fedify/vocab-runtime";
5
-
4
+ //#region ../vocab-runtime/dist/mod.d.ts
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
6
122
  //#region src/types.d.ts
7
123
  declare const RELAY_SERVER_ACTOR = "relay";
8
124
  /**