@fedify/fedify 1.9.0-pr.431.1597 → 1.9.0-pr.439.1643
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/{actor-CfaqWvJb.cjs → actor-CfhHedxU.cjs} +197 -197
- package/dist/{actor-Detmisdi.js → actor-DpI0W-Tn.js} +197 -197
- package/dist/{actor-Dw7av4Zk.js → actor-KPC8KYj6.js} +1 -1
- package/dist/{authdocloader-5UJ5Gme-.js → authdocloader-BQJG9N7v.js} +3 -3
- package/dist/{authdocloader-ZlLoXSxM.js → authdocloader-CVxE9WGt.js} +3 -3
- package/dist/{authdocloader-BVYv0Ct8.cjs → authdocloader-DfDexBrY.cjs} +3 -3
- package/dist/{builder-BbKfqPmR.js → builder-BP4aD50M.js} +4 -4
- package/dist/{client-DgRjF0ha.js → client-Bui9Gh4q.js} +1 -1
- package/dist/compat/transformers.test.js +16 -16
- package/dist/{docloader-BKf9RWX4.js → docloader-BxvWvC64.js} +185 -5
- package/dist/{docloader-eqgyMp7h.cjs → docloader-CSlrTULv.cjs} +185 -5
- package/dist/{esm-B_ZjJ1sB.js → esm-c7PrxCw-.js} +1 -1
- package/dist/federation/builder.test.js +5 -5
- package/dist/federation/collection.test.js +3 -3
- package/dist/federation/handler.test.js +17 -17
- package/dist/federation/inbox.test.js +4 -4
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +4 -3
- package/dist/federation/middleware.test.js +18 -18
- package/dist/federation/mod.cjs +10 -10
- package/dist/federation/mod.js +10 -10
- package/dist/federation/mq.test.js +3 -3
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +3 -3
- package/dist/federation/send.test.js +10 -10
- package/dist/{http-CwlUFNG4.js → http-BF9qsaeq.js} +3 -3
- package/dist/{http-C5XLveZw.js → http-Dv1yjtnP.js} +2 -2
- package/dist/{http-_vjuGcXn.cjs → http-Dy617oJi.cjs} +3 -3
- package/dist/{inbox-sVXiVBbT.js → inbox-Cu7OAGkC.js} +1 -1
- package/dist/{key-lpATOAE4.js → key-BA23EOog.js} +3 -3
- package/dist/{key-Jrnr66vx.js → key-BLHsstcf.js} +2 -2
- package/dist/{key-CsQ7J8-m.js → key-BzOUXfsg.js} +4 -4
- package/dist/key-CK98kF20.cjs +10 -0
- package/dist/{key-19P2dWvf.cjs → key-CULAE72e.cjs} +2 -2
- package/dist/{key-BCWvPOkD.js → key-CmfU4Nff.js} +2 -2
- package/dist/{keycache-ogQInQck.js → keycache-aLCenYcC.js} +1 -1
- package/dist/{keys-DcGsKtHW.js → keys-D46Dm6Zd.js} +1 -1
- package/dist/{ld-BSE4jnyK.js → ld-bQVyNVI4.js} +2 -2
- package/dist/{lookup-DdxOle8f.js → lookup-BV-RYejn.js} +1 -1
- package/dist/{lookup-D96ipStp.cjs → lookup-BtS7imxC.cjs} +1 -1
- package/dist/{lookup-D_-F1hLw.js → lookup-DWilfXOH.js} +1 -1
- package/dist/{middleware-T_y4Bnvw.js → middleware-Bc82l2LP.js} +24 -24
- package/dist/{middleware-B2DFqtJ-.cjs → middleware-BvYquIU2.cjs} +24 -24
- package/dist/middleware-C-XUMaxL.cjs +17 -0
- package/dist/{middleware-CuTcPjfP.js → middleware-C6ec_xpL.js} +27 -27
- package/dist/middleware-CJGpew1U.js +26 -0
- package/dist/middleware-QSwuLhGe.js +17 -0
- package/dist/mod.cjs +10 -10
- package/dist/mod.js +10 -10
- package/dist/nodeinfo/client.test.js +5 -5
- package/dist/nodeinfo/handler.test.js +16 -16
- package/dist/nodeinfo/mod.cjs +2 -2
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +3 -3
- package/dist/nodeinfo/types.test.js +3 -3
- package/dist/{owner-DJtc8evi.js → owner-IdDD30Rl.js} +2 -2
- package/dist/{proof-BuPk23Er.js → proof-Bacq4fFb.js} +3 -3
- package/dist/{proof-CRHppbRk.cjs → proof-Cdt-JryO.cjs} +3 -3
- package/dist/{proof-9OMp0o4n.js → proof-DqejZTy7.js} +2 -2
- package/dist/runtime/authdocloader.test.js +9 -9
- package/dist/runtime/docloader.test.js +4 -4
- package/dist/runtime/key.test.js +5 -5
- package/dist/runtime/langstr.test.js +3 -3
- package/dist/runtime/link.test.d.ts +3 -0
- package/dist/runtime/link.test.js +61 -0
- package/dist/runtime/mod.cjs +6 -6
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +3 -3
- package/dist/runtime/url.test.js +3 -3
- package/dist/{send-cXerEJm9.js → send-CtMRP7jp.js} +2 -2
- package/dist/sig/http.test.js +8 -8
- package/dist/sig/key.test.js +6 -6
- package/dist/sig/ld.test.js +7 -7
- package/dist/sig/mod.cjs +6 -6
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +7 -7
- package/dist/sig/proof.test.js +7 -7
- package/dist/testing/docloader.test.js +3 -3
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-BX6IA3LR.js → testing-DqxPhgD4.js} +2 -2
- package/dist/{type-DF9yoIpt.js → type-tt9Ec12R.js} +381 -201
- package/dist/{types-DcKQIzdO.cjs → types-C50PioTN.cjs} +1 -1
- package/dist/{types-Q17QxOOC.js → types-DIhanZoH.js} +1 -1
- package/dist/vocab/actor.test.js +5 -5
- package/dist/vocab/lookup.test.js +4 -4
- package/dist/vocab/mod.cjs +4 -4
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +40 -5
- package/dist/{vocab-BUc_4ZsW.js → vocab-C85duzv5.js} +3 -3
- package/dist/{vocab-Du8FV6H1.cjs → vocab-VVJBvA2F.cjs} +3 -3
- package/dist/webfinger/handler.test.js +16 -16
- package/dist/webfinger/lookup.test.js +4 -4
- package/dist/webfinger/mod.cjs +2 -2
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +3 -3
- package/package.json +1 -2
- package/dist/key-Dt7qJaQT.cjs +0 -10
- package/dist/middleware-B0f850Ei.cjs +0 -17
- package/dist/middleware-COHAbwGs.js +0 -17
- package/dist/middleware-Dt7C7qpw.js +0 -26
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Application, Group, Organization, Person, Service, deno_default, getTypeId, lookupWebFinger } from "./type-
|
6
|
+
import { Application, Group, Organization, Person, Service, deno_default, getTypeId, lookupWebFinger } from "./type-tt9Ec12R.js";
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
8
8
|
import { domainToASCII, domainToUnicode } from "node:url";
|
9
9
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-
|
6
|
-
import { validateCryptoKey } from "./key-
|
7
|
-
import { doubleKnock } from "./http-
|
5
|
+
import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-BxvWvC64.js";
|
6
|
+
import { validateCryptoKey } from "./key-CmfU4Nff.js";
|
7
|
+
import { doubleKnock } from "./http-BF9qsaeq.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
|
10
10
|
//#region src/runtime/authdocloader.ts
|
@@ -3,9 +3,9 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-
|
7
|
-
import { validateCryptoKey } from "./key-
|
8
|
-
import { doubleKnock } from "./http-
|
6
|
+
import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-tt9Ec12R.js";
|
7
|
+
import { validateCryptoKey } from "./key-BLHsstcf.js";
|
8
|
+
import { doubleKnock } from "./http-Dv1yjtnP.js";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
|
11
11
|
//#region src/runtime/authdocloader.ts
|
@@ -3,9 +3,9 @@
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
|
-
const require_docloader = require('./docloader-
|
7
|
-
const require_key = require('./key-
|
8
|
-
const require_http = require('./http-
|
6
|
+
const require_docloader = require('./docloader-CSlrTULv.cjs');
|
7
|
+
const require_key = require('./key-CULAE72e.cjs');
|
8
|
+
const require_http = require('./http-Dy617oJi.cjs');
|
9
9
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
10
10
|
|
11
11
|
//#region src/runtime/authdocloader.ts
|
@@ -3,9 +3,9 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default, getTypeId } from "./type-
|
7
|
-
import { Router, RouterError } from "./lookup-
|
8
|
-
import { InboxListenerSet } from "./inbox-
|
6
|
+
import { deno_default, getTypeId } from "./type-tt9Ec12R.js";
|
7
|
+
import { Router, RouterError } from "./lookup-BV-RYejn.js";
|
8
|
+
import { InboxListenerSet } from "./inbox-Cu7OAGkC.js";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
11
11
|
|
@@ -42,7 +42,7 @@ var FederationBuilderImpl = class {
|
|
42
42
|
this.collectionTypeIds = {};
|
43
43
|
}
|
44
44
|
async build(options) {
|
45
|
-
const { FederationImpl } = await import("./middleware-
|
45
|
+
const { FederationImpl } = await import("./middleware-CJGpew1U.js");
|
46
46
|
const f = new FederationImpl(options);
|
47
47
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
48
48
|
f.router = this.router.clone();
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { getUserAgent } from "./type-
|
6
|
+
import { getUserAgent } from "./type-tt9Ec12R.js";
|
7
7
|
import { parseSemVer } from "./semver-dArNLkR9.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
|
@@ -3,30 +3,30 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Follow, Person } from "../type-
|
6
|
+
import { Follow, Person } from "../type-tt9Ec12R.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
|
-
import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-
|
11
|
+
import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-C6ec_xpL.js";
|
12
12
|
import "../semver-dArNLkR9.js";
|
13
|
-
import "../client-
|
14
|
-
import "../lookup-
|
13
|
+
import "../client-Bui9Gh4q.js";
|
14
|
+
import "../lookup-BV-RYejn.js";
|
15
15
|
import "../types-BIgY6c-l.js";
|
16
|
-
import "../actor-
|
17
|
-
import "../key-
|
18
|
-
import "../http-
|
19
|
-
import "../authdocloader-
|
20
|
-
import "../ld-
|
21
|
-
import "../owner-
|
22
|
-
import "../proof-
|
23
|
-
import "../inbox-
|
24
|
-
import "../builder-
|
16
|
+
import "../actor-KPC8KYj6.js";
|
17
|
+
import "../key-BLHsstcf.js";
|
18
|
+
import "../http-Dv1yjtnP.js";
|
19
|
+
import "../authdocloader-CVxE9WGt.js";
|
20
|
+
import "../ld-bQVyNVI4.js";
|
21
|
+
import "../owner-IdDD30Rl.js";
|
22
|
+
import "../proof-DqejZTy7.js";
|
23
|
+
import "../inbox-Cu7OAGkC.js";
|
24
|
+
import "../builder-BP4aD50M.js";
|
25
25
|
import "../collection-CSzG2j1P.js";
|
26
|
-
import "../keycache-
|
26
|
+
import "../keycache-aLCenYcC.js";
|
27
27
|
import "../retry-D4GJ670a.js";
|
28
|
-
import "../send-
|
29
|
-
import { test } from "../testing-
|
28
|
+
import "../send-CtMRP7jp.js";
|
29
|
+
import { test } from "../testing-DqxPhgD4.js";
|
30
30
|
|
31
31
|
//#region src/compat/transformers.test.ts
|
32
32
|
const federation = new FederationImpl({ kv: new MemoryKvStore() });
|
@@ -3,14 +3,13 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
6
|
-
import { HTTPHeaderLink } from "@hugoalh/http-header-link";
|
7
6
|
import process from "node:process";
|
8
7
|
import { lookup } from "node:dns/promises";
|
9
8
|
import { isIP } from "node:net";
|
10
9
|
|
11
10
|
//#region deno.json
|
12
11
|
var name = "@fedify/fedify";
|
13
|
-
var version = "1.9.0-pr.
|
12
|
+
var version = "1.9.0-pr.439.1643+fd55a982";
|
14
13
|
var license = "MIT";
|
15
14
|
var exports = {
|
16
15
|
".": "./src/mod.ts",
|
@@ -30,7 +29,6 @@ var exports = {
|
|
30
29
|
};
|
31
30
|
var imports = {
|
32
31
|
"@cfworker/json-schema": "npm:@cfworker/json-schema@^4.1.1",
|
33
|
-
"@hugoalh/http-header-link": "jsr:@hugoalh/http-header-link@^1.0.2",
|
34
32
|
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
35
33
|
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
|
36
34
|
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
@@ -4278,6 +4276,188 @@ const preloadedContexts = {
|
|
4278
4276
|
};
|
4279
4277
|
var contexts_default = preloadedContexts;
|
4280
4278
|
|
4279
|
+
//#endregion
|
4280
|
+
//#region src/runtime/link.ts
|
4281
|
+
const parametersNeedLowerCase = ["rel", "type"];
|
4282
|
+
const regexpLinkWhitespace = /[\n\r\s\t]/;
|
4283
|
+
function validateURI(uri) {
|
4284
|
+
if (uri.includes("\n") || regexpLinkWhitespace.test(uri)) throw new SyntaxError(`\`${uri}\` is not a valid URI!`);
|
4285
|
+
}
|
4286
|
+
function* parseLinkFromString(input) {
|
4287
|
+
const inputFmt = input.replaceAll("\xA0", "").replaceAll("", "");
|
4288
|
+
for (let cursor = 0; cursor < inputFmt.length; cursor += 1) {
|
4289
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4290
|
+
if (inputFmt.charAt(cursor) !== "<") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`<\`!`);
|
4291
|
+
cursor += 1;
|
4292
|
+
const cursorEndUri = inputFmt.indexOf(">", cursor);
|
4293
|
+
if (cursorEndUri === -1) throw new SyntaxError(`Missing end of URI delimiter character \`>\` after position ${cursor}!`);
|
4294
|
+
if (cursorEndUri === cursor) throw new SyntaxError(`Missing URI at position ${cursor}!`);
|
4295
|
+
const uriSlice = inputFmt.slice(cursor, cursorEndUri);
|
4296
|
+
validateURI(uriSlice);
|
4297
|
+
const uri = decodeURI(uriSlice);
|
4298
|
+
const parameters = {};
|
4299
|
+
cursor = cursorEndUri + 1;
|
4300
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4301
|
+
if (cursor === inputFmt.length || inputFmt.charAt(cursor) === ",") {
|
4302
|
+
yield [uri, parameters];
|
4303
|
+
continue;
|
4304
|
+
}
|
4305
|
+
if (inputFmt.charAt(cursor) !== ";") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`;\`!`);
|
4306
|
+
cursor += 1;
|
4307
|
+
while (cursor < inputFmt.length) {
|
4308
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4309
|
+
const parameterKey = inputFmt.slice(cursor).match(/^[\w-]+\*?/)?.[0].toLowerCase();
|
4310
|
+
if (typeof parameterKey === "undefined") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect a valid parameter key!`);
|
4311
|
+
cursor += parameterKey.length;
|
4312
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4313
|
+
if (cursor === inputFmt.length || inputFmt.charAt(cursor) === ",") {
|
4314
|
+
parameters[parameterKey] = "";
|
4315
|
+
break;
|
4316
|
+
}
|
4317
|
+
if (inputFmt.charAt(cursor) === ";") {
|
4318
|
+
parameters[parameterKey] = "";
|
4319
|
+
cursor += 1;
|
4320
|
+
continue;
|
4321
|
+
}
|
4322
|
+
if (inputFmt.charAt(cursor) !== "=") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`=\`!`);
|
4323
|
+
cursor += 1;
|
4324
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4325
|
+
let parameterValue = "";
|
4326
|
+
if (inputFmt.charAt(cursor) === "\"") {
|
4327
|
+
cursor += 1;
|
4328
|
+
while (cursor < inputFmt.length) {
|
4329
|
+
if (inputFmt.charAt(cursor) === "\"") {
|
4330
|
+
cursor += 1;
|
4331
|
+
break;
|
4332
|
+
}
|
4333
|
+
if (inputFmt.charAt(cursor) === "\\") cursor += 1;
|
4334
|
+
parameterValue += inputFmt.charAt(cursor);
|
4335
|
+
cursor += 1;
|
4336
|
+
}
|
4337
|
+
} else {
|
4338
|
+
const cursorDiffParameterValue = inputFmt.slice(cursor).search(/[\s;,]/);
|
4339
|
+
if (cursorDiffParameterValue === -1) {
|
4340
|
+
parameterValue += inputFmt.slice(cursor);
|
4341
|
+
cursor += parameterValue.length;
|
4342
|
+
} else {
|
4343
|
+
parameterValue += inputFmt.slice(cursor, cursorDiffParameterValue);
|
4344
|
+
cursor += cursorDiffParameterValue;
|
4345
|
+
}
|
4346
|
+
}
|
4347
|
+
parameters[parameterKey] = parametersNeedLowerCase.includes(parameterKey) ? parameterValue.toLowerCase() : parameterValue;
|
4348
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4349
|
+
if (cursor === inputFmt.length || inputFmt.charAt(cursor) === ",") break;
|
4350
|
+
if (inputFmt.charAt(cursor) === ";") {
|
4351
|
+
cursor += 1;
|
4352
|
+
continue;
|
4353
|
+
}
|
4354
|
+
throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`,\`, character \`;\`, or end of the string!`);
|
4355
|
+
}
|
4356
|
+
yield [uri, parameters];
|
4357
|
+
}
|
4358
|
+
}
|
4359
|
+
/**
|
4360
|
+
* Handle the HTTP header `Link` according to the specification RFC 8288.
|
4361
|
+
*/
|
4362
|
+
var HttpHeaderLink = class HttpHeaderLink {
|
4363
|
+
get [Symbol.toStringTag]() {
|
4364
|
+
return "HTTPHeaderLink";
|
4365
|
+
}
|
4366
|
+
#entries = [];
|
4367
|
+
/**
|
4368
|
+
* Handle the HTTP header `Link` according to the specification RFC 8288.
|
4369
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4370
|
+
*/
|
4371
|
+
constructor(...inputs) {
|
4372
|
+
if (inputs.length > 0) this.add(...inputs);
|
4373
|
+
}
|
4374
|
+
/**
|
4375
|
+
* Add entries.
|
4376
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4377
|
+
* @returns {this}
|
4378
|
+
*/
|
4379
|
+
add(...inputs) {
|
4380
|
+
for (const input of inputs) if (input instanceof HttpHeaderLink) this.#entries.push(...structuredClone(input.#entries));
|
4381
|
+
else if (Array.isArray(input)) this.#entries.push(...input.map(([uri, parameters]) => {
|
4382
|
+
validateURI(uri);
|
4383
|
+
Object.entries(parameters).forEach(([key, value]) => {
|
4384
|
+
if (key !== key.toLowerCase() || !/^[\w-]+\*?$/.test(key)) throw new SyntaxError(`\`${key}\` is not a valid parameter key!`);
|
4385
|
+
if (parametersNeedLowerCase.includes(key) && value !== value.toLowerCase()) throw new SyntaxError(`\`${value}\` is not a valid parameter value!`);
|
4386
|
+
});
|
4387
|
+
return [uri, structuredClone(parameters)];
|
4388
|
+
}));
|
4389
|
+
else for (const entry of parseLinkFromString((input instanceof Headers || input instanceof Response ? (input instanceof Headers ? input : input.headers).get("Link") : input) ?? "")) this.#entries.push(entry);
|
4390
|
+
return this;
|
4391
|
+
}
|
4392
|
+
/**
|
4393
|
+
* Return all of the entries.
|
4394
|
+
* @returns {HttpHeaderLinkEntry[]} Entries.
|
4395
|
+
*/
|
4396
|
+
entries() {
|
4397
|
+
return structuredClone(this.#entries);
|
4398
|
+
}
|
4399
|
+
/**
|
4400
|
+
* Get entries by parameter.
|
4401
|
+
* @param {string} key Key of the parameter.
|
4402
|
+
* @param {string} value Value of the parameter.
|
4403
|
+
* @returns {HttpHeaderLinkEntry[]} Entries which match the parameter.
|
4404
|
+
*/
|
4405
|
+
getByParameter(key, value) {
|
4406
|
+
if (key !== key.toLowerCase()) throw new SyntaxError(`\`${key}\` is not a valid parameter key!`);
|
4407
|
+
if (key === "rel") return this.getByRel(value);
|
4408
|
+
return structuredClone(this.#entries.filter((entry) => {
|
4409
|
+
return entry[1][key] === value;
|
4410
|
+
}));
|
4411
|
+
}
|
4412
|
+
/**
|
4413
|
+
* Get entries by parameter `rel`.
|
4414
|
+
* @param {string} value Value of the parameter `rel`.
|
4415
|
+
* @returns {HttpHeaderLinkEntry[]} Entries which match the parameter.
|
4416
|
+
*/
|
4417
|
+
getByRel(value) {
|
4418
|
+
if (value !== value.toLowerCase()) throw new SyntaxError(`\`${value}\` is not a valid parameter \`rel\` value!`);
|
4419
|
+
return structuredClone(this.#entries.filter((entity) => {
|
4420
|
+
return entity[1].rel?.toLowerCase() === value;
|
4421
|
+
}));
|
4422
|
+
}
|
4423
|
+
/**
|
4424
|
+
* Whether have entries that match parameter.
|
4425
|
+
* @param {string} key Key of the parameter.
|
4426
|
+
* @param {string} value Value of the parameter.
|
4427
|
+
* @returns {boolean} Determine result.
|
4428
|
+
*/
|
4429
|
+
hasParameter(key, value) {
|
4430
|
+
return this.getByParameter(key, value).length > 0;
|
4431
|
+
}
|
4432
|
+
/**
|
4433
|
+
* Stringify entries.
|
4434
|
+
* @returns {string} Stringified entries.
|
4435
|
+
*/
|
4436
|
+
toString() {
|
4437
|
+
return this.#entries.map(([uri, parameters]) => {
|
4438
|
+
return [`<${encodeURI(uri)}>`, ...Object.entries(parameters).map(([key, value]) => {
|
4439
|
+
return value.length > 0 ? `${key}="${value.replaceAll("\"", "\\\"")}"` : key;
|
4440
|
+
})].join("; ");
|
4441
|
+
}).join(", ");
|
4442
|
+
}
|
4443
|
+
/**
|
4444
|
+
* Parse the HTTP header `Link` according to the specification RFC 8288.
|
4445
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4446
|
+
* @returns {HttpHeaderLink}
|
4447
|
+
*/
|
4448
|
+
static parse(...inputs) {
|
4449
|
+
return new this(...inputs);
|
4450
|
+
}
|
4451
|
+
/**
|
4452
|
+
* Stringify as the HTTP header `Link` according to the specification RFC 8288.
|
4453
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4454
|
+
* @returns {string}
|
4455
|
+
*/
|
4456
|
+
static stringify(...inputs) {
|
4457
|
+
return new this(...inputs).toString();
|
4458
|
+
}
|
4459
|
+
};
|
4460
|
+
|
4281
4461
|
//#endregion
|
4282
4462
|
//#region src/runtime/url.ts
|
4283
4463
|
var UrlError = class extends Error {
|
@@ -4419,9 +4599,9 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
4419
4599
|
if (linkHeader != null) {
|
4420
4600
|
let link;
|
4421
4601
|
try {
|
4422
|
-
link = new
|
4602
|
+
link = new HttpHeaderLink(linkHeader);
|
4423
4603
|
} catch (e) {
|
4424
|
-
if (e instanceof SyntaxError) link = new
|
4604
|
+
if (e instanceof SyntaxError) link = new HttpHeaderLink();
|
4425
4605
|
else throw e;
|
4426
4606
|
}
|
4427
4607
|
if (jsonLd) {
|
@@ -4,14 +4,13 @@
|
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
6
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
7
|
-
const __hugoalh_http_header_link = require_chunk.__toESM(require("@hugoalh/http-header-link"));
|
8
7
|
const node_process = require_chunk.__toESM(require("node:process"));
|
9
8
|
const node_dns_promises = require_chunk.__toESM(require("node:dns/promises"));
|
10
9
|
const node_net = require_chunk.__toESM(require("node:net"));
|
11
10
|
|
12
11
|
//#region deno.json
|
13
12
|
var name = "@fedify/fedify";
|
14
|
-
var version = "1.9.0-pr.
|
13
|
+
var version = "1.9.0-pr.439.1643+fd55a982";
|
15
14
|
var license = "MIT";
|
16
15
|
var exports$1 = {
|
17
16
|
".": "./src/mod.ts",
|
@@ -31,7 +30,6 @@ var exports$1 = {
|
|
31
30
|
};
|
32
31
|
var imports = {
|
33
32
|
"@cfworker/json-schema": "npm:@cfworker/json-schema@^4.1.1",
|
34
|
-
"@hugoalh/http-header-link": "jsr:@hugoalh/http-header-link@^1.0.2",
|
35
33
|
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
36
34
|
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
|
37
35
|
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
@@ -4279,6 +4277,188 @@ const preloadedContexts = {
|
|
4279
4277
|
};
|
4280
4278
|
var contexts_default = preloadedContexts;
|
4281
4279
|
|
4280
|
+
//#endregion
|
4281
|
+
//#region src/runtime/link.ts
|
4282
|
+
const parametersNeedLowerCase = ["rel", "type"];
|
4283
|
+
const regexpLinkWhitespace = /[\n\r\s\t]/;
|
4284
|
+
function validateURI(uri) {
|
4285
|
+
if (uri.includes("\n") || regexpLinkWhitespace.test(uri)) throw new SyntaxError(`\`${uri}\` is not a valid URI!`);
|
4286
|
+
}
|
4287
|
+
function* parseLinkFromString(input) {
|
4288
|
+
const inputFmt = input.replaceAll("\xA0", "").replaceAll("", "");
|
4289
|
+
for (let cursor = 0; cursor < inputFmt.length; cursor += 1) {
|
4290
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4291
|
+
if (inputFmt.charAt(cursor) !== "<") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`<\`!`);
|
4292
|
+
cursor += 1;
|
4293
|
+
const cursorEndUri = inputFmt.indexOf(">", cursor);
|
4294
|
+
if (cursorEndUri === -1) throw new SyntaxError(`Missing end of URI delimiter character \`>\` after position ${cursor}!`);
|
4295
|
+
if (cursorEndUri === cursor) throw new SyntaxError(`Missing URI at position ${cursor}!`);
|
4296
|
+
const uriSlice = inputFmt.slice(cursor, cursorEndUri);
|
4297
|
+
validateURI(uriSlice);
|
4298
|
+
const uri = decodeURI(uriSlice);
|
4299
|
+
const parameters = {};
|
4300
|
+
cursor = cursorEndUri + 1;
|
4301
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4302
|
+
if (cursor === inputFmt.length || inputFmt.charAt(cursor) === ",") {
|
4303
|
+
yield [uri, parameters];
|
4304
|
+
continue;
|
4305
|
+
}
|
4306
|
+
if (inputFmt.charAt(cursor) !== ";") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`;\`!`);
|
4307
|
+
cursor += 1;
|
4308
|
+
while (cursor < inputFmt.length) {
|
4309
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4310
|
+
const parameterKey = inputFmt.slice(cursor).match(/^[\w-]+\*?/)?.[0].toLowerCase();
|
4311
|
+
if (typeof parameterKey === "undefined") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect a valid parameter key!`);
|
4312
|
+
cursor += parameterKey.length;
|
4313
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4314
|
+
if (cursor === inputFmt.length || inputFmt.charAt(cursor) === ",") {
|
4315
|
+
parameters[parameterKey] = "";
|
4316
|
+
break;
|
4317
|
+
}
|
4318
|
+
if (inputFmt.charAt(cursor) === ";") {
|
4319
|
+
parameters[parameterKey] = "";
|
4320
|
+
cursor += 1;
|
4321
|
+
continue;
|
4322
|
+
}
|
4323
|
+
if (inputFmt.charAt(cursor) !== "=") throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`=\`!`);
|
4324
|
+
cursor += 1;
|
4325
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4326
|
+
let parameterValue = "";
|
4327
|
+
if (inputFmt.charAt(cursor) === "\"") {
|
4328
|
+
cursor += 1;
|
4329
|
+
while (cursor < inputFmt.length) {
|
4330
|
+
if (inputFmt.charAt(cursor) === "\"") {
|
4331
|
+
cursor += 1;
|
4332
|
+
break;
|
4333
|
+
}
|
4334
|
+
if (inputFmt.charAt(cursor) === "\\") cursor += 1;
|
4335
|
+
parameterValue += inputFmt.charAt(cursor);
|
4336
|
+
cursor += 1;
|
4337
|
+
}
|
4338
|
+
} else {
|
4339
|
+
const cursorDiffParameterValue = inputFmt.slice(cursor).search(/[\s;,]/);
|
4340
|
+
if (cursorDiffParameterValue === -1) {
|
4341
|
+
parameterValue += inputFmt.slice(cursor);
|
4342
|
+
cursor += parameterValue.length;
|
4343
|
+
} else {
|
4344
|
+
parameterValue += inputFmt.slice(cursor, cursorDiffParameterValue);
|
4345
|
+
cursor += cursorDiffParameterValue;
|
4346
|
+
}
|
4347
|
+
}
|
4348
|
+
parameters[parameterKey] = parametersNeedLowerCase.includes(parameterKey) ? parameterValue.toLowerCase() : parameterValue;
|
4349
|
+
while (regexpLinkWhitespace.test(inputFmt.charAt(cursor))) cursor += 1;
|
4350
|
+
if (cursor === inputFmt.length || inputFmt.charAt(cursor) === ",") break;
|
4351
|
+
if (inputFmt.charAt(cursor) === ";") {
|
4352
|
+
cursor += 1;
|
4353
|
+
continue;
|
4354
|
+
}
|
4355
|
+
throw new SyntaxError(`Unexpected character \`${inputFmt.charAt(cursor)}\` at position ${cursor}; Expect character \`,\`, character \`;\`, or end of the string!`);
|
4356
|
+
}
|
4357
|
+
yield [uri, parameters];
|
4358
|
+
}
|
4359
|
+
}
|
4360
|
+
/**
|
4361
|
+
* Handle the HTTP header `Link` according to the specification RFC 8288.
|
4362
|
+
*/
|
4363
|
+
var HttpHeaderLink = class HttpHeaderLink {
|
4364
|
+
get [Symbol.toStringTag]() {
|
4365
|
+
return "HTTPHeaderLink";
|
4366
|
+
}
|
4367
|
+
#entries = [];
|
4368
|
+
/**
|
4369
|
+
* Handle the HTTP header `Link` according to the specification RFC 8288.
|
4370
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4371
|
+
*/
|
4372
|
+
constructor(...inputs) {
|
4373
|
+
if (inputs.length > 0) this.add(...inputs);
|
4374
|
+
}
|
4375
|
+
/**
|
4376
|
+
* Add entries.
|
4377
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4378
|
+
* @returns {this}
|
4379
|
+
*/
|
4380
|
+
add(...inputs) {
|
4381
|
+
for (const input of inputs) if (input instanceof HttpHeaderLink) this.#entries.push(...structuredClone(input.#entries));
|
4382
|
+
else if (Array.isArray(input)) this.#entries.push(...input.map(([uri, parameters]) => {
|
4383
|
+
validateURI(uri);
|
4384
|
+
Object.entries(parameters).forEach(([key, value]) => {
|
4385
|
+
if (key !== key.toLowerCase() || !/^[\w-]+\*?$/.test(key)) throw new SyntaxError(`\`${key}\` is not a valid parameter key!`);
|
4386
|
+
if (parametersNeedLowerCase.includes(key) && value !== value.toLowerCase()) throw new SyntaxError(`\`${value}\` is not a valid parameter value!`);
|
4387
|
+
});
|
4388
|
+
return [uri, structuredClone(parameters)];
|
4389
|
+
}));
|
4390
|
+
else for (const entry of parseLinkFromString((input instanceof Headers || input instanceof Response ? (input instanceof Headers ? input : input.headers).get("Link") : input) ?? "")) this.#entries.push(entry);
|
4391
|
+
return this;
|
4392
|
+
}
|
4393
|
+
/**
|
4394
|
+
* Return all of the entries.
|
4395
|
+
* @returns {HttpHeaderLinkEntry[]} Entries.
|
4396
|
+
*/
|
4397
|
+
entries() {
|
4398
|
+
return structuredClone(this.#entries);
|
4399
|
+
}
|
4400
|
+
/**
|
4401
|
+
* Get entries by parameter.
|
4402
|
+
* @param {string} key Key of the parameter.
|
4403
|
+
* @param {string} value Value of the parameter.
|
4404
|
+
* @returns {HttpHeaderLinkEntry[]} Entries which match the parameter.
|
4405
|
+
*/
|
4406
|
+
getByParameter(key, value) {
|
4407
|
+
if (key !== key.toLowerCase()) throw new SyntaxError(`\`${key}\` is not a valid parameter key!`);
|
4408
|
+
if (key === "rel") return this.getByRel(value);
|
4409
|
+
return structuredClone(this.#entries.filter((entry) => {
|
4410
|
+
return entry[1][key] === value;
|
4411
|
+
}));
|
4412
|
+
}
|
4413
|
+
/**
|
4414
|
+
* Get entries by parameter `rel`.
|
4415
|
+
* @param {string} value Value of the parameter `rel`.
|
4416
|
+
* @returns {HttpHeaderLinkEntry[]} Entries which match the parameter.
|
4417
|
+
*/
|
4418
|
+
getByRel(value) {
|
4419
|
+
if (value !== value.toLowerCase()) throw new SyntaxError(`\`${value}\` is not a valid parameter \`rel\` value!`);
|
4420
|
+
return structuredClone(this.#entries.filter((entity) => {
|
4421
|
+
return entity[1].rel?.toLowerCase() === value;
|
4422
|
+
}));
|
4423
|
+
}
|
4424
|
+
/**
|
4425
|
+
* Whether have entries that match parameter.
|
4426
|
+
* @param {string} key Key of the parameter.
|
4427
|
+
* @param {string} value Value of the parameter.
|
4428
|
+
* @returns {boolean} Determine result.
|
4429
|
+
*/
|
4430
|
+
hasParameter(key, value) {
|
4431
|
+
return this.getByParameter(key, value).length > 0;
|
4432
|
+
}
|
4433
|
+
/**
|
4434
|
+
* Stringify entries.
|
4435
|
+
* @returns {string} Stringified entries.
|
4436
|
+
*/
|
4437
|
+
toString() {
|
4438
|
+
return this.#entries.map(([uri, parameters]) => {
|
4439
|
+
return [`<${encodeURI(uri)}>`, ...Object.entries(parameters).map(([key, value]) => {
|
4440
|
+
return value.length > 0 ? `${key}="${value.replaceAll("\"", "\\\"")}"` : key;
|
4441
|
+
})].join("; ");
|
4442
|
+
}).join(", ");
|
4443
|
+
}
|
4444
|
+
/**
|
4445
|
+
* Parse the HTTP header `Link` according to the specification RFC 8288.
|
4446
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4447
|
+
* @returns {HttpHeaderLink}
|
4448
|
+
*/
|
4449
|
+
static parse(...inputs) {
|
4450
|
+
return new this(...inputs);
|
4451
|
+
}
|
4452
|
+
/**
|
4453
|
+
* Stringify as the HTTP header `Link` according to the specification RFC 8288.
|
4454
|
+
* @param {...(string | Headers | HttpHeaderLink | HttpHeaderLinkEntry[] | Response)} inputs Input.
|
4455
|
+
* @returns {string}
|
4456
|
+
*/
|
4457
|
+
static stringify(...inputs) {
|
4458
|
+
return new this(...inputs).toString();
|
4459
|
+
}
|
4460
|
+
};
|
4461
|
+
|
4282
4462
|
//#endregion
|
4283
4463
|
//#region src/runtime/url.ts
|
4284
4464
|
var UrlError = class extends Error {
|
@@ -4420,9 +4600,9 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
4420
4600
|
if (linkHeader != null) {
|
4421
4601
|
let link;
|
4422
4602
|
try {
|
4423
|
-
link = new
|
4603
|
+
link = new HttpHeaderLink(linkHeader);
|
4424
4604
|
} catch (e) {
|
4425
|
-
if (e instanceof SyntaxError) link = new
|
4605
|
+
if (e instanceof SyntaxError) link = new HttpHeaderLink();
|
4426
4606
|
else throw e;
|
4427
4607
|
}
|
4428
4608
|
if (jsonLd) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { __commonJS, __toESM } from "./type-
|
6
|
+
import { __commonJS, __toESM } from "./type-tt9Ec12R.js";
|
7
7
|
|
8
8
|
//#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
|
9
9
|
var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js"(exports, module) {
|
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Note, Person } from "../type-
|
6
|
+
import { Activity, Note, Person } from "../type-tt9Ec12R.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
11
|
import { parseSemVer } from "../semver-dArNLkR9.js";
|
12
|
-
import "../lookup-
|
13
|
-
import "../inbox-
|
14
|
-
import { createFederationBuilder } from "../builder-
|
15
|
-
import { test } from "../testing-
|
12
|
+
import "../lookup-BV-RYejn.js";
|
13
|
+
import "../inbox-Cu7OAGkC.js";
|
14
|
+
import { createFederationBuilder } from "../builder-BP4aD50M.js";
|
15
|
+
import { test } from "../testing-DqxPhgD4.js";
|
16
16
|
import { assertExists } from "../std__assert-X-_kMxKM.js";
|
17
17
|
import "../assert_rejects-DiIiJbZn.js";
|
18
18
|
import "../assert_is_error-BPGph1Jx.js";
|
@@ -3,13 +3,13 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "../type-
|
6
|
+
import "../type-tt9Ec12R.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import "../lookup-
|
10
|
+
import "../lookup-BV-RYejn.js";
|
11
11
|
import { buildCollectionSynchronizationHeader, digest } from "../collection-CSzG2j1P.js";
|
12
|
-
import { test } from "../testing-
|
12
|
+
import { test } from "../testing-DqxPhgD4.js";
|
13
13
|
import "../std__assert-X-_kMxKM.js";
|
14
14
|
import "../assert_rejects-DiIiJbZn.js";
|
15
15
|
import "../assert_is_error-BPGph1Jx.js";
|