@fedify/fedify 2.0.1 → 2.0.2-dev.407
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/{builder-CqPrSnE5.js → builder-CmXCvILP.js} +3 -3
- package/dist/client-BxMZiQaD.d.ts +224 -0
- package/dist/client-C97KOq3x.d.cts +222 -0
- package/dist/compat/mod.d.cts +6 -6
- package/dist/compat/mod.d.ts +6 -6
- package/dist/compat/transformers.test.js +11 -11
- package/dist/context-Dy5ro7zD.d.ts +2515 -0
- package/dist/context-o4OhjMHe.d.cts +2513 -0
- package/dist/{deno-CIi8RNND.js → deno-r4zOZb6i.js} +1 -1
- package/dist/{docloader-CmrEfaGw.js → docloader-B3FBDYHA.js} +2 -2
- package/dist/federation/builder.test.js +3 -3
- package/dist/federation/handler.test.js +11 -11
- package/dist/federation/idempotency.test.js +11 -11
- package/dist/federation/inbox.test.js +2 -2
- package/dist/federation/middleware.test.js +11 -11
- package/dist/federation/mod.cjs +4 -4
- package/dist/federation/mod.d.cts +6 -6
- package/dist/federation/mod.d.ts +6 -6
- package/dist/federation/mod.js +4 -4
- package/dist/federation/send.test.js +5 -5
- package/dist/federation/webfinger.test.js +11 -11
- package/dist/{http-Dvox_xrq.js → http-B2qDw-ld.js} +2 -2
- package/dist/{http-BjroyS-9.cjs → http-BeDhqNdl.cjs} +1 -1
- package/dist/{http-CCsNu78I.js → http-Cu7-n4zt.js} +1 -1
- package/dist/http-Cz3MlXAZ.d.cts +244 -0
- package/dist/http-DkHdFfrc.d.ts +246 -0
- package/dist/{inbox-CiTdVhJQ.js → inbox-COVt7NM_.js} +1 -1
- package/dist/{key-C7JS89OH.js → key-D3c7zdQ4.js} +1 -1
- package/dist/kv-BL4nlICN.d.cts +110 -0
- package/dist/kv-DXEUEP6z.d.ts +113 -0
- package/dist/{kv-cache-BqFnozz0.cjs → kv-cache-BXA2Q9DI.cjs} +1 -1
- package/dist/{kv-cache-6b2ldIo-.js → kv-cache-CtV4175p.js} +1 -1
- package/dist/{ld-C8i1kViF.js → ld-B5-SoHWy.js} +2 -2
- package/dist/middleware-BDtfAFen.cjs +12 -0
- package/dist/{middleware-DqJ1cmZE.cjs → middleware-BjvalmrW.cjs} +4 -4
- package/dist/{middleware-CfL_Pd6a.js → middleware-CyrPv2j3.js} +4 -4
- package/dist/{middleware-B3GuN6Gj.js → middleware-D1v2KqML.js} +4 -4
- package/dist/{middleware-B4Bgz0MJ.js → middleware-Dp0_BtQF.js} +10 -10
- package/dist/{middleware-0fnsG0v7.js → middleware-DsPC0qJ_.js} +11 -11
- package/dist/mod-Bm_GwNTL.d.cts +80 -0
- package/dist/mod-CIR7gJW8.d.ts +64 -0
- package/dist/mod-CwZXZJ9d.d.ts +91 -0
- package/dist/mod-DPkRU3EK.d.cts +266 -0
- package/dist/mod-DQWhp0xs.d.ts +82 -0
- package/dist/mod-DUWcVv49.d.ts +268 -0
- package/dist/mod-DXsQakeS.d.cts +89 -0
- package/dist/mod-DwqZ5l67.d.cts +62 -0
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +9 -9
- package/dist/mod.d.ts +9 -9
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.js +11 -11
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/otel/mod.d.cts +145 -145
- package/dist/otel/mod.d.ts +145 -145
- package/dist/owner-1AbPBOOZ.d.cts +66 -0
- package/dist/{owner-BOSWh-ha.js → owner-KwXXBWZ3.js} +1 -1
- package/dist/owner-gd0Q9FuU.d.ts +68 -0
- package/dist/{proof-C8qvlfLD.cjs → proof-BcQ-0Eck.cjs} +1 -1
- package/dist/{proof-D61EYfPl.js → proof-DqYaOkxv.js} +1 -1
- package/dist/{proof-BeT_MFIx.js → proof-S-df7nOa.js} +2 -2
- package/dist/{send-D7lC06r9.js → send-BFqsdYMW.js} +2 -2
- package/dist/sig/http.test.js +3 -3
- package/dist/sig/key.test.js +2 -2
- package/dist/sig/ld.test.js +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.js +3 -3
- package/dist/sig/proof.test.js +3 -3
- package/dist/utils/docloader.test.js +4 -4
- package/dist/utils/mod.cjs +2 -2
- package/dist/utils/mod.d.cts +3 -3
- package/dist/utils/mod.d.ts +3 -3
- package/dist/utils/mod.js +2 -2
- package/package.json +6 -6
- package/dist/client-CwkOPN13.d.cts +0 -222
- package/dist/client-a7NwzhA2.d.ts +0 -224
- package/dist/context-BdNW_8a3.d.cts +0 -2554
- package/dist/context-C-GVKcJR.d.ts +0 -2556
- package/dist/http-CCEu-x1_.d.cts +0 -253
- package/dist/http-CODSJcKx.d.ts +0 -255
- package/dist/kv-g9jFc34-.d.cts +0 -110
- package/dist/kv-jg_8SMc1.d.ts +0 -113
- package/dist/middleware-DILzU8Ot.cjs +0 -12
- package/dist/mod-5PNty1K9.d.cts +0 -80
- package/dist/mod-BcpEGTWV.d.cts +0 -62
- package/dist/mod-COO7VMcm.d.cts +0 -266
- package/dist/mod-CevNbUol.d.ts +0 -91
- package/dist/mod-CtO31FCx.d.ts +0 -64
- package/dist/mod-Da9fNDyC.d.ts +0 -82
- package/dist/mod-ErTjUJs9.d.cts +0 -89
- package/dist/mod-q2IR8UiH.d.ts +0 -268
- package/dist/owner-9yZ5Ibsb.d.cts +0 -66
- package/dist/owner-DQYAbVmX.d.ts +0 -68
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
4
|
+
import { TracerProvider } from "@opentelemetry/api";
|
|
5
|
+
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/sig/key.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generates a key pair which is appropriate for Fedify.
|
|
11
|
+
* @param algorithm The algorithm to use. Currently only RSASSA-PKCS1-v1_5 and
|
|
12
|
+
* Ed25519 are supported.
|
|
13
|
+
* @returns The generated key pair.
|
|
14
|
+
* @throws {TypeError} If the algorithm is unsupported.
|
|
15
|
+
*/
|
|
16
|
+
declare function generateCryptoKeyPair(algorithm?: "RSASSA-PKCS1-v1_5" | "Ed25519"): Promise<CryptoKeyPair>;
|
|
17
|
+
/**
|
|
18
|
+
* Exports a key in JWK format.
|
|
19
|
+
* @param key The key to export. Either public or private key.
|
|
20
|
+
* @returns The exported key in JWK format. The key is suitable for
|
|
21
|
+
* serialization and storage.
|
|
22
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
23
|
+
*/
|
|
24
|
+
declare function exportJwk(key: CryptoKey): Promise<JsonWebKey>;
|
|
25
|
+
/**
|
|
26
|
+
* Imports a key from JWK format.
|
|
27
|
+
* @param jwk The key in JWK format.
|
|
28
|
+
* @param type Which type of key to import, either `"public"` or `"private"`.
|
|
29
|
+
* @returns The imported key.
|
|
30
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
31
|
+
*/
|
|
32
|
+
declare function importJwk(jwk: JsonWebKey, type: "public" | "private"): Promise<CryptoKey>;
|
|
33
|
+
/**
|
|
34
|
+
* Options for {@link fetchKey}.
|
|
35
|
+
* @since 1.3.0
|
|
36
|
+
*/
|
|
37
|
+
interface FetchKeyOptions {
|
|
38
|
+
/**
|
|
39
|
+
* The document loader for loading remote JSON-LD documents.
|
|
40
|
+
*/
|
|
41
|
+
documentLoader?: DocumentLoader;
|
|
42
|
+
/**
|
|
43
|
+
* The context loader for loading remote JSON-LD contexts.
|
|
44
|
+
*/
|
|
45
|
+
contextLoader?: DocumentLoader;
|
|
46
|
+
/**
|
|
47
|
+
* The key cache to use for caching public keys.
|
|
48
|
+
* @since 0.12.0
|
|
49
|
+
*/
|
|
50
|
+
keyCache?: KeyCache;
|
|
51
|
+
/**
|
|
52
|
+
* The OpenTelemetry tracer provider to use for tracing. If omitted,
|
|
53
|
+
* the global tracer provider is used.
|
|
54
|
+
* @since 1.3.0
|
|
55
|
+
*/
|
|
56
|
+
tracerProvider?: TracerProvider;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The result of {@link fetchKey}.
|
|
60
|
+
* @since 1.3.0
|
|
61
|
+
*/
|
|
62
|
+
interface FetchKeyResult<T extends CryptographicKey | Multikey> {
|
|
63
|
+
/**
|
|
64
|
+
* The fetched (or cached) key.
|
|
65
|
+
*/
|
|
66
|
+
readonly key: T & {
|
|
67
|
+
publicKey: CryptoKey;
|
|
68
|
+
} | null;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the key is fetched from the cache.
|
|
71
|
+
*/
|
|
72
|
+
readonly cached: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Fetches a {@link CryptographicKey} or {@link Multikey} from the given URL.
|
|
76
|
+
* If the given URL contains an {@link Actor} object, it tries to find
|
|
77
|
+
* the corresponding key in the `publicKey` or `assertionMethod` property.
|
|
78
|
+
* @template T The type of the key to fetch. Either {@link CryptographicKey}
|
|
79
|
+
* or {@link Multikey}.
|
|
80
|
+
* @param keyId The URL of the key.
|
|
81
|
+
* @param cls The class of the key to fetch. Either {@link CryptographicKey}
|
|
82
|
+
* or {@link Multikey}.
|
|
83
|
+
* @param options Options for fetching the key. See {@link FetchKeyOptions}.
|
|
84
|
+
* @returns The fetched key or `null` if the key is not found.
|
|
85
|
+
* @since 1.3.0
|
|
86
|
+
*/
|
|
87
|
+
declare function fetchKey<T extends CryptographicKey | Multikey>(keyId: URL | string, cls: (new (...args: any[]) => T) & {
|
|
88
|
+
fromJsonLd(jsonLd: unknown, options: {
|
|
89
|
+
documentLoader?: DocumentLoader;
|
|
90
|
+
contextLoader?: DocumentLoader;
|
|
91
|
+
tracerProvider?: TracerProvider;
|
|
92
|
+
}): Promise<T>;
|
|
93
|
+
}, options?: FetchKeyOptions): Promise<FetchKeyResult<T>>;
|
|
94
|
+
/**
|
|
95
|
+
* A cache for storing cryptographic keys.
|
|
96
|
+
* @since 0.12.0
|
|
97
|
+
*/
|
|
98
|
+
interface KeyCache {
|
|
99
|
+
/**
|
|
100
|
+
* Gets a key from the cache.
|
|
101
|
+
* @param keyId The key ID.
|
|
102
|
+
* @returns The key if found, `null` if the key is not available (e.g.,
|
|
103
|
+
* fetching the key was tried but failed), or `undefined`
|
|
104
|
+
* if the cache is not available.
|
|
105
|
+
*/
|
|
106
|
+
get(keyId: URL): Promise<CryptographicKey | Multikey | null | undefined>;
|
|
107
|
+
/**
|
|
108
|
+
* Sets a key to the cache.
|
|
109
|
+
*
|
|
110
|
+
* Note that this caches unavailable keys (i.e., `null`) as well,
|
|
111
|
+
* and it is recommended to make unavailable keys expire after a short period.
|
|
112
|
+
* @param keyId The key ID.
|
|
113
|
+
* @param key The key to cache. `null` means the key is not available
|
|
114
|
+
* (e.g., fetching the key was tried but failed).
|
|
115
|
+
*/
|
|
116
|
+
set(keyId: URL, key: CryptographicKey | Multikey | null): Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/sig/http.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* The standard to use for signing and verifying HTTP signatures.
|
|
122
|
+
* @since 1.6.0
|
|
123
|
+
*/
|
|
124
|
+
type HttpMessageSignaturesSpec = "draft-cavage-http-signatures-12" | "rfc9421";
|
|
125
|
+
/**
|
|
126
|
+
* Options for {@link signRequest}.
|
|
127
|
+
* @since 1.3.0
|
|
128
|
+
*/
|
|
129
|
+
interface SignRequestOptions {
|
|
130
|
+
/**
|
|
131
|
+
* The HTTP message signatures specification to use for signing.
|
|
132
|
+
* @default `"draft-cavage-http-signatures-12"`
|
|
133
|
+
* @since 1.6.0
|
|
134
|
+
*/
|
|
135
|
+
spec?: HttpMessageSignaturesSpec;
|
|
136
|
+
/**
|
|
137
|
+
* The current time. If not specified, the current time is used. This is
|
|
138
|
+
* useful for testing.
|
|
139
|
+
* @since 1.6.0
|
|
140
|
+
*/
|
|
141
|
+
currentTime?: Temporal.Instant;
|
|
142
|
+
/**
|
|
143
|
+
* The request body as ArrayBuffer. If provided, avoids cloning the request body.
|
|
144
|
+
* @since 1.7.7
|
|
145
|
+
*/
|
|
146
|
+
body?: ArrayBuffer | null;
|
|
147
|
+
/**
|
|
148
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
|
149
|
+
* is used.
|
|
150
|
+
*/
|
|
151
|
+
tracerProvider?: TracerProvider;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Signs a request using the given private key.
|
|
155
|
+
* @param request The request to sign.
|
|
156
|
+
* @param privateKey The private key to use for signing.
|
|
157
|
+
* @param keyId The key ID to use for the signature. It will be used by the
|
|
158
|
+
* verifier.
|
|
159
|
+
* @returns The signed request.
|
|
160
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
|
161
|
+
*/
|
|
162
|
+
declare function signRequest(request: Request, privateKey: CryptoKey, keyId: URL, options?: SignRequestOptions): Promise<Request>;
|
|
163
|
+
/**
|
|
164
|
+
* Options for {@link verifyRequest}.
|
|
165
|
+
*/
|
|
166
|
+
interface VerifyRequestOptions {
|
|
167
|
+
/**
|
|
168
|
+
* The document loader to use for fetching the public key.
|
|
169
|
+
*/
|
|
170
|
+
documentLoader?: DocumentLoader;
|
|
171
|
+
/**
|
|
172
|
+
* The context loader to use for JSON-LD context retrieval.
|
|
173
|
+
*/
|
|
174
|
+
contextLoader?: DocumentLoader;
|
|
175
|
+
/**
|
|
176
|
+
* The time window to allow for the request date. The actual time window is
|
|
177
|
+
* twice the value of this option, with the current time as the center.
|
|
178
|
+
* Or if it is `false`, no time check is performed.
|
|
179
|
+
*
|
|
180
|
+
* An hour by default.
|
|
181
|
+
*/
|
|
182
|
+
timeWindow?: Temporal.Duration | Temporal.DurationLike | false;
|
|
183
|
+
/**
|
|
184
|
+
* The current time. If not specified, the current time is used. This is
|
|
185
|
+
* useful for testing.
|
|
186
|
+
*/
|
|
187
|
+
currentTime?: Temporal.Instant;
|
|
188
|
+
/**
|
|
189
|
+
* The key cache to use for caching public keys.
|
|
190
|
+
* @since 0.12.0
|
|
191
|
+
*/
|
|
192
|
+
keyCache?: KeyCache;
|
|
193
|
+
/**
|
|
194
|
+
* The HTTP message signatures specification to use for verifying.
|
|
195
|
+
* @default `"draft-cavage-http-signatures-12"`
|
|
196
|
+
* @since 1.6.0
|
|
197
|
+
*/
|
|
198
|
+
spec?: HttpMessageSignaturesSpec;
|
|
199
|
+
/**
|
|
200
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
|
201
|
+
* is used.
|
|
202
|
+
* @since 1.3.0
|
|
203
|
+
*/
|
|
204
|
+
tracerProvider?: TracerProvider;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Verifies the signature of a request.
|
|
208
|
+
*
|
|
209
|
+
* Note that this function consumes the request body, so it should not be used
|
|
210
|
+
* if the request body is already consumed. Consuming the request body after
|
|
211
|
+
* calling this function is okay, since this function clones the request
|
|
212
|
+
* under the hood.
|
|
213
|
+
*
|
|
214
|
+
* @param request The request to verify.
|
|
215
|
+
* @param options Options for verifying the request.
|
|
216
|
+
* @returns The public key of the verified signature, or `null` if the signature
|
|
217
|
+
* could not be verified.
|
|
218
|
+
*/
|
|
219
|
+
declare function verifyRequest(request: Request, options?: VerifyRequestOptions): Promise<CryptographicKey | null>;
|
|
220
|
+
/**
|
|
221
|
+
* A spec determiner for HTTP Message Signatures.
|
|
222
|
+
* It determines the spec to use for signing requests.
|
|
223
|
+
* It is used for double-knocking
|
|
224
|
+
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
|
|
225
|
+
* @since 1.6.0
|
|
226
|
+
*/
|
|
227
|
+
interface HttpMessageSignaturesSpecDeterminer {
|
|
228
|
+
/**
|
|
229
|
+
* Determines the spec to use for signing requests.
|
|
230
|
+
* @param origin The origin of the URL to make the request to.
|
|
231
|
+
* @returns The spec to use for signing requests.
|
|
232
|
+
*/
|
|
233
|
+
determineSpec(origin: string): HttpMessageSignaturesSpec | Promise<HttpMessageSignaturesSpec>;
|
|
234
|
+
/**
|
|
235
|
+
* Remembers the successfully used spec for the given origin.
|
|
236
|
+
* @param origin The origin of the URL that was requested.
|
|
237
|
+
* @param spec The spec to remember.
|
|
238
|
+
*/
|
|
239
|
+
rememberSpec(origin: string, spec: HttpMessageSignaturesSpec): void | Promise<void>;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The options for double-knock requests.
|
|
243
|
+
* @since 1.6.0
|
|
244
|
+
*/
|
|
245
|
+
//#endregion
|
|
246
|
+
export { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default } from "./deno-
|
|
6
|
+
import { deno_default } from "./deno-r4zOZb6i.js";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { Activity, getTypeId } from "@fedify/vocab";
|
|
9
9
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default } from "./deno-
|
|
6
|
+
import { deno_default } from "./deno-r4zOZb6i.js";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
9
9
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//#region src/federation/kv.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A key for a key–value store. An array of one or more strings.
|
|
4
|
+
*
|
|
5
|
+
* @since 0.5.0
|
|
6
|
+
*/
|
|
7
|
+
type KvKey = readonly [string] | readonly [string, ...string[]];
|
|
8
|
+
/**
|
|
9
|
+
* Additional options for setting a value in a key–value store.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.5.0
|
|
12
|
+
*/
|
|
13
|
+
interface KvStoreSetOptions {
|
|
14
|
+
/**
|
|
15
|
+
* The time-to-live (TTL) for the value.
|
|
16
|
+
*/
|
|
17
|
+
ttl?: Temporal.Duration;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An entry returned by the {@link KvStore.list} method.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.10.0
|
|
23
|
+
*/
|
|
24
|
+
interface KvStoreListEntry {
|
|
25
|
+
/**
|
|
26
|
+
* The key of the entry.
|
|
27
|
+
*/
|
|
28
|
+
readonly key: KvKey;
|
|
29
|
+
/**
|
|
30
|
+
* The value of the entry.
|
|
31
|
+
*/
|
|
32
|
+
readonly value: unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An abstract interface for a key–value store.
|
|
36
|
+
*
|
|
37
|
+
* @since 0.5.0
|
|
38
|
+
*/
|
|
39
|
+
interface KvStore {
|
|
40
|
+
/**
|
|
41
|
+
* Gets the value for the given key.
|
|
42
|
+
* @param key The key to get the value for.
|
|
43
|
+
* @returns The value for the key, or `undefined` if the key does not exist.
|
|
44
|
+
* @template T The type of the value to get.
|
|
45
|
+
*/
|
|
46
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the value for the given key.
|
|
49
|
+
* @param key The key to set the value for.
|
|
50
|
+
* @param value The value to set.
|
|
51
|
+
* @param options Additional options for setting the value.
|
|
52
|
+
*/
|
|
53
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Deletes the value for the given key.
|
|
56
|
+
* @param key The key to delete.
|
|
57
|
+
*/
|
|
58
|
+
delete(key: KvKey): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Compare-and-swap (CAS) operation for the key–value store.
|
|
61
|
+
* @param key The key to perform the CAS operation on.
|
|
62
|
+
* @param expectedValue The expected value for the key.
|
|
63
|
+
* @param newValue The new value to set if the expected value matches.
|
|
64
|
+
* @param options Additional options for setting the value.
|
|
65
|
+
* @return `true` if the CAS operation was successful, `false` otherwise.
|
|
66
|
+
* @since 1.8.0
|
|
67
|
+
*/
|
|
68
|
+
cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Lists all entries in the store that match the given prefix.
|
|
71
|
+
* If no prefix is given, all entries are returned.
|
|
72
|
+
* @param prefix The prefix to filter keys by. If not specified, all entries
|
|
73
|
+
* are returned.
|
|
74
|
+
* @returns An async iterable of entries matching the prefix.
|
|
75
|
+
* @since 1.10.0
|
|
76
|
+
* @since 2.0.0 This method is now required instead of optional.
|
|
77
|
+
*/
|
|
78
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A key–value store that stores values in memory.
|
|
82
|
+
* Do not use this in production as it does not persist values.
|
|
83
|
+
*
|
|
84
|
+
* @since 0.5.0
|
|
85
|
+
*/
|
|
86
|
+
declare class MemoryKvStore implements KvStore {
|
|
87
|
+
#private;
|
|
88
|
+
/**
|
|
89
|
+
* {@inheritDoc KvStore.get}
|
|
90
|
+
*/
|
|
91
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc KvStore.set}
|
|
94
|
+
*/
|
|
95
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* {@inheritDoc KvStore.delete}
|
|
98
|
+
*/
|
|
99
|
+
delete(key: KvKey): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* {@inheritDoc KvStore.cas}
|
|
102
|
+
*/
|
|
103
|
+
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* {@inheritDoc KvStore.list}
|
|
106
|
+
*/
|
|
107
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
|
|
4
|
+
//#region src/federation/kv.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A key for a key–value store. An array of one or more strings.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.5.0
|
|
9
|
+
*/
|
|
10
|
+
type KvKey = readonly [string] | readonly [string, ...string[]];
|
|
11
|
+
/**
|
|
12
|
+
* Additional options for setting a value in a key–value store.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.5.0
|
|
15
|
+
*/
|
|
16
|
+
interface KvStoreSetOptions {
|
|
17
|
+
/**
|
|
18
|
+
* The time-to-live (TTL) for the value.
|
|
19
|
+
*/
|
|
20
|
+
ttl?: Temporal.Duration;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An entry returned by the {@link KvStore.list} method.
|
|
24
|
+
*
|
|
25
|
+
* @since 1.10.0
|
|
26
|
+
*/
|
|
27
|
+
interface KvStoreListEntry {
|
|
28
|
+
/**
|
|
29
|
+
* The key of the entry.
|
|
30
|
+
*/
|
|
31
|
+
readonly key: KvKey;
|
|
32
|
+
/**
|
|
33
|
+
* The value of the entry.
|
|
34
|
+
*/
|
|
35
|
+
readonly value: unknown;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An abstract interface for a key–value store.
|
|
39
|
+
*
|
|
40
|
+
* @since 0.5.0
|
|
41
|
+
*/
|
|
42
|
+
interface KvStore {
|
|
43
|
+
/**
|
|
44
|
+
* Gets the value for the given key.
|
|
45
|
+
* @param key The key to get the value for.
|
|
46
|
+
* @returns The value for the key, or `undefined` if the key does not exist.
|
|
47
|
+
* @template T The type of the value to get.
|
|
48
|
+
*/
|
|
49
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
50
|
+
/**
|
|
51
|
+
* Sets the value for the given key.
|
|
52
|
+
* @param key The key to set the value for.
|
|
53
|
+
* @param value The value to set.
|
|
54
|
+
* @param options Additional options for setting the value.
|
|
55
|
+
*/
|
|
56
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Deletes the value for the given key.
|
|
59
|
+
* @param key The key to delete.
|
|
60
|
+
*/
|
|
61
|
+
delete(key: KvKey): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Compare-and-swap (CAS) operation for the key–value store.
|
|
64
|
+
* @param key The key to perform the CAS operation on.
|
|
65
|
+
* @param expectedValue The expected value for the key.
|
|
66
|
+
* @param newValue The new value to set if the expected value matches.
|
|
67
|
+
* @param options Additional options for setting the value.
|
|
68
|
+
* @return `true` if the CAS operation was successful, `false` otherwise.
|
|
69
|
+
* @since 1.8.0
|
|
70
|
+
*/
|
|
71
|
+
cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Lists all entries in the store that match the given prefix.
|
|
74
|
+
* If no prefix is given, all entries are returned.
|
|
75
|
+
* @param prefix The prefix to filter keys by. If not specified, all entries
|
|
76
|
+
* are returned.
|
|
77
|
+
* @returns An async iterable of entries matching the prefix.
|
|
78
|
+
* @since 1.10.0
|
|
79
|
+
* @since 2.0.0 This method is now required instead of optional.
|
|
80
|
+
*/
|
|
81
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A key–value store that stores values in memory.
|
|
85
|
+
* Do not use this in production as it does not persist values.
|
|
86
|
+
*
|
|
87
|
+
* @since 0.5.0
|
|
88
|
+
*/
|
|
89
|
+
declare class MemoryKvStore implements KvStore {
|
|
90
|
+
#private;
|
|
91
|
+
/**
|
|
92
|
+
* {@inheritDoc KvStore.get}
|
|
93
|
+
*/
|
|
94
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* {@inheritDoc KvStore.set}
|
|
97
|
+
*/
|
|
98
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* {@inheritDoc KvStore.delete}
|
|
101
|
+
*/
|
|
102
|
+
delete(key: KvKey): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* {@inheritDoc KvStore.cas}
|
|
105
|
+
*/
|
|
106
|
+
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* {@inheritDoc KvStore.list}
|
|
109
|
+
*/
|
|
110
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-CGaQZ11T.cjs');
|
|
6
|
-
const require_http = require('./http-
|
|
6
|
+
const require_http = require('./http-BeDhqNdl.cjs');
|
|
7
7
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
8
8
|
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
|
9
9
|
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { doubleKnock, validateCryptoKey } from "./http-
|
|
5
|
+
import { doubleKnock, validateCryptoKey } from "./http-Cu7-n4zt.js";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { curry } from "es-toolkit";
|
|
8
8
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default } from "./deno-
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
|
6
|
+
import { deno_default } from "./deno-r4zOZb6i.js";
|
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-D3c7zdQ4.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
|
|
10
10
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
+
|
|
5
|
+
require('./transformers-3g8GZwkZ.cjs');
|
|
6
|
+
require('./http-BeDhqNdl.cjs');
|
|
7
|
+
const require_middleware = require('./middleware-BjvalmrW.cjs');
|
|
8
|
+
require('./proof-BcQ-0Eck.cjs');
|
|
9
|
+
require('./types-Cd_hszr_.cjs');
|
|
10
|
+
require('./kv-cache-BXA2Q9DI.cjs');
|
|
11
|
+
|
|
12
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-CGaQZ11T.cjs');
|
|
6
6
|
const require_transformers = require('./transformers-3g8GZwkZ.cjs');
|
|
7
|
-
const require_http = require('./http-
|
|
8
|
-
const require_proof = require('./proof-
|
|
7
|
+
const require_http = require('./http-BeDhqNdl.cjs');
|
|
8
|
+
const require_proof = require('./proof-BcQ-0Eck.cjs');
|
|
9
9
|
const require_types = require('./types-Cd_hszr_.cjs');
|
|
10
|
-
const require_kv_cache = require('./kv-cache-
|
|
10
|
+
const require_kv_cache = require('./kv-cache-BXA2Q9DI.cjs');
|
|
11
11
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
12
12
|
const __fedify_vocab = require_chunk.__toESM(require("@fedify/vocab"));
|
|
13
13
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
@@ -339,7 +339,7 @@ var FederationBuilderImpl = class {
|
|
|
339
339
|
this.collectionTypeIds = {};
|
|
340
340
|
}
|
|
341
341
|
async build(options) {
|
|
342
|
-
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-
|
|
342
|
+
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-BDtfAFen.cjs"));
|
|
343
343
|
const f = new FederationImpl$1(options);
|
|
344
344
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
345
345
|
f.router = this.router.clone();
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
5
|
import "./transformers-C3FLHUd6.js";
|
|
6
|
-
import "./http-
|
|
7
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-
|
|
8
|
-
import "./proof-
|
|
6
|
+
import "./http-Cu7-n4zt.js";
|
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-D1v2KqML.js";
|
|
8
|
+
import "./proof-DqYaOkxv.js";
|
|
9
9
|
import "./types-C93Ob9cU.js";
|
|
10
|
-
import "./kv-cache-
|
|
10
|
+
import "./kv-cache-CtV4175p.js";
|
|
11
11
|
|
|
12
12
|
export { FederationImpl };
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
5
|
import { getDefaultActivityTransformers } from "./transformers-C3FLHUd6.js";
|
|
6
|
-
import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-
|
|
7
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
|
6
|
+
import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-Cu7-n4zt.js";
|
|
7
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-DqYaOkxv.js";
|
|
8
8
|
import { getNodeInfo, nodeInfoToJson } from "./types-C93Ob9cU.js";
|
|
9
|
-
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-
|
|
9
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-CtV4175p.js";
|
|
10
10
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
12
12
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
@@ -338,7 +338,7 @@ var FederationBuilderImpl = class {
|
|
|
338
338
|
this.collectionTypeIds = {};
|
|
339
339
|
}
|
|
340
340
|
async build(options) {
|
|
341
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
|
341
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-CyrPv2j3.js");
|
|
342
342
|
const f = new FederationImpl$1(options);
|
|
343
343
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
344
344
|
f.router = this.router.clone();
|
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default } from "./deno-
|
|
6
|
+
import { deno_default } from "./deno-r4zOZb6i.js";
|
|
7
7
|
import { getNodeInfo } from "./client-Dg7OfUDA.js";
|
|
8
8
|
import { RouterError } from "./router-D9eI0s4b.js";
|
|
9
9
|
import { nodeInfoToJson } from "./types-CPz01LGH.js";
|
|
10
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
11
|
-
import { verifyRequest } from "./http-
|
|
12
|
-
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-
|
|
13
|
-
import { doesActorOwnKey, getKeyOwner } from "./owner-
|
|
14
|
-
import { signObject, verifyObject } from "./proof-
|
|
15
|
-
import { getAuthenticatedDocumentLoader } from "./docloader-
|
|
10
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-D3c7zdQ4.js";
|
|
11
|
+
import { verifyRequest } from "./http-B2qDw-ld.js";
|
|
12
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-B5-SoHWy.js";
|
|
13
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-KwXXBWZ3.js";
|
|
14
|
+
import { signObject, verifyObject } from "./proof-S-df7nOa.js";
|
|
15
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-B3FBDYHA.js";
|
|
16
16
|
import { kvCache } from "./kv-cache-B__dHl7g.js";
|
|
17
|
-
import { routeActivity } from "./inbox-
|
|
18
|
-
import { FederationBuilderImpl } from "./builder-
|
|
17
|
+
import { routeActivity } from "./inbox-COVt7NM_.js";
|
|
18
|
+
import { FederationBuilderImpl } from "./builder-CmXCvILP.js";
|
|
19
19
|
import { buildCollectionSynchronizationHeader } from "./collection-CcnIw1qY.js";
|
|
20
20
|
import { KvKeyCache } from "./keycache-DRxpZ5r9.js";
|
|
21
21
|
import { acceptsJsonLd } from "./negotiation-5NPJL6zp.js";
|
|
22
22
|
import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
|
|
23
|
-
import { SendActivityError, extractInboxes, sendActivity } from "./send-
|
|
23
|
+
import { SendActivityError, extractInboxes, sendActivity } from "./send-BFqsdYMW.js";
|
|
24
24
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
25
25
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
26
26
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "./deno-
|
|
7
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-
|
|
6
|
+
import "./deno-r4zOZb6i.js";
|
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-Dp0_BtQF.js";
|
|
8
8
|
import "./client-Dg7OfUDA.js";
|
|
9
9
|
import "./router-D9eI0s4b.js";
|
|
10
10
|
import "./types-CPz01LGH.js";
|
|
11
|
-
import "./key-
|
|
12
|
-
import "./http-
|
|
13
|
-
import "./ld-
|
|
14
|
-
import "./owner-
|
|
15
|
-
import "./proof-
|
|
16
|
-
import "./docloader-
|
|
11
|
+
import "./key-D3c7zdQ4.js";
|
|
12
|
+
import "./http-B2qDw-ld.js";
|
|
13
|
+
import "./ld-B5-SoHWy.js";
|
|
14
|
+
import "./owner-KwXXBWZ3.js";
|
|
15
|
+
import "./proof-S-df7nOa.js";
|
|
16
|
+
import "./docloader-B3FBDYHA.js";
|
|
17
17
|
import "./kv-cache-B__dHl7g.js";
|
|
18
|
-
import "./inbox-
|
|
19
|
-
import "./builder-
|
|
18
|
+
import "./inbox-COVt7NM_.js";
|
|
19
|
+
import "./builder-CmXCvILP.js";
|
|
20
20
|
import "./collection-CcnIw1qY.js";
|
|
21
21
|
import "./keycache-DRxpZ5r9.js";
|
|
22
22
|
import "./negotiation-5NPJL6zp.js";
|
|
23
23
|
import "./retry-D4GJ670a.js";
|
|
24
|
-
import "./send-
|
|
24
|
+
import "./send-BFqsdYMW.js";
|
|
25
25
|
|
|
26
26
|
export { FederationImpl };
|