@fedify/vocab-runtime 2.4.0-dev.1668 → 2.4.0-dev.1740
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/deno.json +1 -1
- package/dist/internal/jsonld-cache.cjs +1 -1
- package/dist/internal/jsonld-cache.d.cts +1 -1
- package/dist/internal/jsonld-cache.d.ts +1 -1
- package/dist/internal/jsonld-cache.js +1 -1
- package/dist/jsonld.cjs +2 -2
- package/dist/mod.cjs +26 -8
- package/dist/mod.d.cts +4 -2
- package/dist/mod.d.ts +4 -3
- package/dist/mod.js +23 -5
- package/dist/tests/decimal.test.cjs +6 -7
- package/dist/tests/decimal.test.mjs +6 -6
- package/dist/tests/{digest-DLwUyHCK.cjs → digest-3FeH2Y-Q.cjs} +6 -5
- package/dist/tests/{digest-BJlumPNJ.mjs → digest-COC7xDiQ.mjs} +6 -5
- package/dist/tests/digest.test.cjs +11 -12
- package/dist/tests/digest.test.mjs +11 -11
- package/dist/tests/{docloader-u_7i2eIZ.mjs → docloader-BWBddOkN.mjs} +20 -3
- package/dist/tests/{docloader-BLOFskDa.cjs → docloader-CS1O52ch.cjs} +20 -4
- package/dist/tests/docloader.test.cjs +19 -12
- package/dist/tests/docloader.test.mjs +16 -9
- package/dist/tests/internal/multicodec.test.cjs +1 -2
- package/dist/tests/internal/multicodec.test.mjs +1 -1
- package/dist/tests/jsonld-cache.test.cjs +17 -17
- package/dist/tests/jsonld-cache.test.mjs +15 -15
- package/dist/tests/{key-BcOWDLMm.cjs → key-8Qg2SbZi.cjs} +2 -3
- package/dist/tests/{key-Drbw_2tw.mjs → key-C7MNhlkO.mjs} +2 -2
- package/dist/tests/key.test.cjs +3 -4
- package/dist/tests/key.test.mjs +3 -3
- package/dist/tests/langstr.test.cjs +3 -3
- package/dist/tests/langstr.test.mjs +1 -1
- package/dist/tests/link.test.cjs +1 -2
- package/dist/tests/link.test.mjs +1 -1
- package/dist/tests/multibase/multibase.test.cjs +1 -2
- package/dist/tests/multibase/multibase.test.mjs +1 -1
- package/dist/tests/{multibase-DcDQDNnI.cjs → multibase-B5Mea7Ip.cjs} +2 -2
- package/dist/tests/{request-BCN6x611.cjs → request-D1rLeiIi.cjs} +3 -3
- package/dist/tests/{request-C7z-t67V.mjs → request-DpcxnLEa.mjs} +1 -1
- package/dist/tests/request.test.cjs +3 -3
- package/dist/tests/request.test.mjs +1 -1
- package/dist/tests/temporal.test.cjs +0 -1
- package/dist/tests/{url-Du7RQQgP.mjs → url-Basm1L_c.mjs} +33 -6
- package/dist/tests/{url-CsOV_B_P.cjs → url-CPfMatUL.cjs} +38 -6
- package/dist/tests/url.test.cjs +30 -2
- package/dist/tests/url.test.mjs +30 -1
- package/dist/{url-DGVbSVVi.js → url-BHAShw9J.js} +32 -5
- package/dist/{url-DD4F0ULf.cjs → url-i33c0US6.cjs} +32 -6
- package/package.json +1 -1
- package/src/contexts/miscellany.json +19 -0
- package/src/contexts.ts +13 -0
- package/src/url.test.ts +27 -0
- package/src/url.ts +35 -5
- /package/dist/{docloader-C_dir7Xb.d.ts → docloader-BK627tQQ.d.cts} +0 -0
- /package/dist/{docloader-D2DTRiyA.d.cts → docloader-BK627tQQ.d.ts} +0 -0
- /package/dist/{chunk-M78iaK0I.cjs → rolldown-runtime-B7lfambq.cjs} +0 -0
- /package/dist/tests/{langstr-BOQHfJDr.cjs → langstr-C4Fl80ae.cjs} +0 -0
- /package/dist/tests/{langstr-DDLc4833.mjs → langstr-CQ26J_L7.mjs} +0 -0
- /package/dist/tests/{link-NUUWCdnK.mjs → link-Cevmc87v.mjs} +0 -0
- /package/dist/tests/{link-FguCydMA.cjs → link-DlKm8bEr.cjs} +0 -0
- /package/dist/tests/{multibase-Cluwl8OM.mjs → multibase-BPnF_L4e.mjs} +0 -0
- /package/dist/tests/{multicodec-CxGVGa91.cjs → multicodec-CLRPeW4N.cjs} +0 -0
- /package/dist/tests/{multicodec-CyFp54fI.mjs → multicodec-CRIj_05H.mjs} +0 -0
- /package/dist/tests/{chunk-C2EiDwsr.cjs → rolldown-runtime-emK7D4bc.cjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getRemoteDocument, r as preloadedContexts, t as getDocumentLoader } from "./docloader-
|
|
2
|
-
import { t as FetchError } from "./request-
|
|
3
|
-
import { t as UrlError } from "./url-
|
|
1
|
+
import { n as getRemoteDocument, r as preloadedContexts, t as getDocumentLoader } from "./docloader-BWBddOkN.mjs";
|
|
2
|
+
import { t as FetchError } from "./request-DpcxnLEa.mjs";
|
|
3
|
+
import { t as UrlError } from "./url-Basm1L_c.mjs";
|
|
4
4
|
import { deepStrictEqual, ok, rejects } from "node:assert";
|
|
5
5
|
import { test } from "node:test";
|
|
6
6
|
//#region \0rolldown/runtime.js
|
|
@@ -130,27 +130,27 @@ function parse(input, loose) {
|
|
|
130
130
|
}
|
|
131
131
|
//#endregion
|
|
132
132
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/TypeDescriptor.js
|
|
133
|
-
const valueTypes = new Set([
|
|
133
|
+
const valueTypes = /* @__PURE__ */ new Set([
|
|
134
134
|
"boolean",
|
|
135
135
|
"number",
|
|
136
136
|
"null",
|
|
137
137
|
"string",
|
|
138
138
|
"undefined"
|
|
139
139
|
]);
|
|
140
|
-
const referenceTypes = new Set([
|
|
140
|
+
const referenceTypes = /* @__PURE__ */ new Set([
|
|
141
141
|
"array",
|
|
142
142
|
"function",
|
|
143
143
|
"object",
|
|
144
144
|
"symbol"
|
|
145
145
|
]);
|
|
146
|
-
const detectableTypes = new Set([
|
|
146
|
+
const detectableTypes = /* @__PURE__ */ new Set([
|
|
147
147
|
"boolean",
|
|
148
148
|
"function",
|
|
149
149
|
"number",
|
|
150
150
|
"string",
|
|
151
151
|
"symbol"
|
|
152
152
|
]);
|
|
153
|
-
const typeConstructors = new Set([
|
|
153
|
+
const typeConstructors = /* @__PURE__ */ new Set([
|
|
154
154
|
Boolean,
|
|
155
155
|
Number,
|
|
156
156
|
String
|
|
@@ -221,7 +221,7 @@ var TypeDescriptor = class TypeDescriptor {
|
|
|
221
221
|
};
|
|
222
222
|
//#endregion
|
|
223
223
|
//#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/IsSubsetOf.js
|
|
224
|
-
const allowedTypes = new Set([
|
|
224
|
+
const allowedTypes = /* @__PURE__ */ new Set([
|
|
225
225
|
"array",
|
|
226
226
|
"object",
|
|
227
227
|
"function",
|
|
@@ -713,7 +713,14 @@ var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
|
713
713
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
714
714
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
715
715
|
};
|
|
716
|
-
var _Route_instances
|
|
716
|
+
var _Route_instances;
|
|
717
|
+
var _a;
|
|
718
|
+
var _Route_responseSubscriptions;
|
|
719
|
+
var _Route_validate;
|
|
720
|
+
var _Route_sanitize;
|
|
721
|
+
var _Route_generateMatcher;
|
|
722
|
+
var _Route_limit;
|
|
723
|
+
var _Route_delayResponse;
|
|
717
724
|
var RouteConfigWrapper = class {
|
|
718
725
|
constructor(config) {
|
|
719
726
|
Object.assign(this, config);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
require("../
|
|
2
|
-
const require_multicodec = require("../multicodec-CxGVGa91.cjs");
|
|
1
|
+
const require_multicodec = require("../multicodec-CLRPeW4N.cjs");
|
|
3
2
|
let node_assert = require("node:assert");
|
|
4
3
|
let node_test = require("node:test");
|
|
5
4
|
//#region src/internal/multicodec.test.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getMulticodecPrefix, r as removeMulticodecPrefix, t as addMulticodecPrefix } from "../multicodec-
|
|
1
|
+
import { n as getMulticodecPrefix, r as removeMulticodecPrefix, t as addMulticodecPrefix } from "../multicodec-CRIj_05H.mjs";
|
|
2
2
|
import { deepStrictEqual, throws } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
//#region src/internal/multicodec.test.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_url = require("./url-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
+
const require_url = require("./url-CPfMatUL.cjs");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
|
|
6
|
-
jsonld_dist_jsonld_esm_js =
|
|
6
|
+
jsonld_dist_jsonld_esm_js = require_rolldown_runtime.__toESM(jsonld_dist_jsonld_esm_js, 1);
|
|
7
7
|
//#region src/jsonld.ts
|
|
8
8
|
var jsonld_default = jsonld_dist_jsonld_esm_js.default;
|
|
9
9
|
//#endregion
|
|
@@ -289,17 +289,17 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
289
289
|
"@id": "ap://did:key:z6Mkabc/object",
|
|
290
290
|
"https://example.com/ns#ref": [{ "@value": "ap://did:key:z6Mkabc/ref" }],
|
|
291
291
|
"https://example.com/ns#text": [{ "@value": "ap://did:key:z6Mkabc/not-an-iri-position" }]
|
|
292
|
-
}, new Set(["@id", "https://example.com/ns#ref"])), {
|
|
292
|
+
}, /* @__PURE__ */ new Set(["@id", "https://example.com/ns#ref"])), {
|
|
293
293
|
"@id": "ap+ef61://did:key:z6Mkabc/object",
|
|
294
294
|
"https://example.com/ns#ref": [{ "@value": "ap+ef61://did:key:z6Mkabc/ref" }],
|
|
295
295
|
"https://example.com/ns#text": [{ "@value": "ap://did:key:z6Mkabc/not-an-iri-position" }]
|
|
296
296
|
});
|
|
297
297
|
});
|
|
298
298
|
(0, node_test.test)("normalizeJsonLdIris() preserves IRI context in list/set wrappers", () => {
|
|
299
|
-
(0, node_assert.deepStrictEqual)(normalizeJsonLdIris({ "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap://did:key:z6Mkabc/set" }] }] }, new Set(["https://example.com/ns#ref"])), { "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap+ef61://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap+ef61://did:key:z6Mkabc/set" }] }] });
|
|
299
|
+
(0, node_assert.deepStrictEqual)(normalizeJsonLdIris({ "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap://did:key:z6Mkabc/set" }] }] }, /* @__PURE__ */ new Set(["https://example.com/ns#ref"])), { "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap+ef61://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap+ef61://did:key:z6Mkabc/set" }] }] });
|
|
300
300
|
});
|
|
301
301
|
(0, node_test.test)("normalizeJsonLdIris() defines prototype-like keys safely", () => {
|
|
302
|
-
const iriKeys = new Set(["__proto__"]);
|
|
302
|
+
const iriKeys = /* @__PURE__ */ new Set(["__proto__"]);
|
|
303
303
|
const value = {};
|
|
304
304
|
globalThis.Object.defineProperty(value, "__proto__", {
|
|
305
305
|
value: "ap://did:key:z6Mkabc/object",
|
|
@@ -322,7 +322,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
322
322
|
"https://www.w3.org/ns/activitystreams#attributedTo": [{ "@id": "ap://did:key:z6Mkabc/actor" }],
|
|
323
323
|
"https://www.w3.org/ns/activitystreams#content": [{ "@value": "No-context object shape should stay cached." }]
|
|
324
324
|
};
|
|
325
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id", "https://www.w3.org/ns/activitystreams#attributedTo"])), original), {
|
|
325
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#attributedTo"])), original), {
|
|
326
326
|
"@id": "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
327
327
|
"@type": ["https://www.w3.org/ns/activitystreams#Note"],
|
|
328
328
|
"https://www.w3.org/ns/activitystreams#attributedTo": [{ "@id": "ap+ef61://did:key:z6Mkabc/actor" }],
|
|
@@ -343,7 +343,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
343
343
|
name: "Nested object"
|
|
344
344
|
}]
|
|
345
345
|
};
|
|
346
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
346
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
347
347
|
"@id": "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
348
348
|
"@type": ["https://www.w3.org/ns/activitystreams#Note"],
|
|
349
349
|
"https://www.w3.org/ns/activitystreams#attachment": [{
|
|
@@ -390,7 +390,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
390
390
|
extra: "This nested unmapped property should stay cached."
|
|
391
391
|
}
|
|
392
392
|
};
|
|
393
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
393
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
394
394
|
"@context": context,
|
|
395
395
|
type: "as:Note",
|
|
396
396
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -422,7 +422,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
422
422
|
extra
|
|
423
423
|
}
|
|
424
424
|
};
|
|
425
|
-
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original);
|
|
425
|
+
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
|
|
426
426
|
(0, node_assert.strictEqual)(compacted.rootExtra, rootExtra);
|
|
427
427
|
(0, node_assert.strictEqual)(compacted.attachment.extra, extra);
|
|
428
428
|
});
|
|
@@ -443,7 +443,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
443
443
|
configurable: true,
|
|
444
444
|
writable: true
|
|
445
445
|
});
|
|
446
|
-
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original);
|
|
446
|
+
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
|
|
447
447
|
(0, node_assert.strictEqual)(globalThis.Object.getOwnPropertyDescriptor(compacted, "__proto__")?.value, protoValue);
|
|
448
448
|
(0, node_assert.strictEqual)(globalThis.Object.getPrototypeOf(compacted), Object.prototype);
|
|
449
449
|
});
|
|
@@ -470,7 +470,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
470
470
|
configurable: true,
|
|
471
471
|
writable: true
|
|
472
472
|
});
|
|
473
|
-
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original);
|
|
473
|
+
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
|
|
474
474
|
const protoDescriptor = globalThis.Object.getOwnPropertyDescriptor(compacted, "__proto__");
|
|
475
475
|
(0, node_assert.ok)(protoDescriptor?.value === "Alias represented by the compacted term." || Array.isArray(protoDescriptor?.value) && protoDescriptor.value.includes("Alias represented by the compacted term."));
|
|
476
476
|
(0, node_assert.strictEqual)(protoDescriptor?.enumerable, true);
|
|
@@ -500,7 +500,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
500
500
|
title: "Nested title."
|
|
501
501
|
}
|
|
502
502
|
};
|
|
503
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
503
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
504
504
|
"@context": context,
|
|
505
505
|
type: "as:Note",
|
|
506
506
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -532,7 +532,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
532
532
|
title: "Nested title."
|
|
533
533
|
}
|
|
534
534
|
};
|
|
535
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
535
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
536
536
|
"@context": context,
|
|
537
537
|
type: "as:Note",
|
|
538
538
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -560,7 +560,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
560
560
|
"https://example.com/ns#title": "Absolute title."
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
563
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
564
564
|
"@context": context,
|
|
565
565
|
type: "as:Note",
|
|
566
566
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -599,7 +599,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
599
599
|
actorRef: "ap://did:key:z6Mkabc/actor"
|
|
600
600
|
}
|
|
601
601
|
};
|
|
602
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id", "https://www.w3.org/ns/activitystreams#actor"])), original), {
|
|
602
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#actor"])), original), {
|
|
603
603
|
"@context": context,
|
|
604
604
|
type: "as:Note",
|
|
605
605
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -633,7 +633,7 @@ function combineContexts(inheritedContext, ownContext) {
|
|
|
633
633
|
key9: "Extension 9",
|
|
634
634
|
key10: "Alias represented by the compacted term."
|
|
635
635
|
};
|
|
636
|
-
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
636
|
+
(0, node_assert.deepStrictEqual)(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
637
637
|
"@context": context,
|
|
638
638
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
639
639
|
key0: "Extension 0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as formatIri, c as haveSameIriOrigin, p as parseIri, s as haveSameFe34Origin } from "./url-
|
|
1
|
+
import { a as formatIri, c as haveSameIriOrigin, p as parseIri, s as haveSameFe34Origin } from "./url-Basm1L_c.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, strictEqual } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import jsonld from "jsonld/dist/jsonld.esm.js";
|
|
@@ -287,17 +287,17 @@ test("normalizeJsonLdIris() normalizes selected JSON-LD IRI positions", () => {
|
|
|
287
287
|
"@id": "ap://did:key:z6Mkabc/object",
|
|
288
288
|
"https://example.com/ns#ref": [{ "@value": "ap://did:key:z6Mkabc/ref" }],
|
|
289
289
|
"https://example.com/ns#text": [{ "@value": "ap://did:key:z6Mkabc/not-an-iri-position" }]
|
|
290
|
-
}, new Set(["@id", "https://example.com/ns#ref"])), {
|
|
290
|
+
}, /* @__PURE__ */ new Set(["@id", "https://example.com/ns#ref"])), {
|
|
291
291
|
"@id": "ap+ef61://did:key:z6Mkabc/object",
|
|
292
292
|
"https://example.com/ns#ref": [{ "@value": "ap+ef61://did:key:z6Mkabc/ref" }],
|
|
293
293
|
"https://example.com/ns#text": [{ "@value": "ap://did:key:z6Mkabc/not-an-iri-position" }]
|
|
294
294
|
});
|
|
295
295
|
});
|
|
296
296
|
test("normalizeJsonLdIris() preserves IRI context in list/set wrappers", () => {
|
|
297
|
-
deepStrictEqual(normalizeJsonLdIris({ "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap://did:key:z6Mkabc/set" }] }] }, new Set(["https://example.com/ns#ref"])), { "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap+ef61://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap+ef61://did:key:z6Mkabc/set" }] }] });
|
|
297
|
+
deepStrictEqual(normalizeJsonLdIris({ "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap://did:key:z6Mkabc/set" }] }] }, /* @__PURE__ */ new Set(["https://example.com/ns#ref"])), { "https://example.com/ns#ref": [{ "@list": [{ "@value": "ap+ef61://did:key:z6Mkabc/listed" }] }, { "@set": [{ "@value": "ap+ef61://did:key:z6Mkabc/set" }] }] });
|
|
298
298
|
});
|
|
299
299
|
test("normalizeJsonLdIris() defines prototype-like keys safely", () => {
|
|
300
|
-
const iriKeys = new Set(["__proto__"]);
|
|
300
|
+
const iriKeys = /* @__PURE__ */ new Set(["__proto__"]);
|
|
301
301
|
const value = {};
|
|
302
302
|
globalThis.Object.defineProperty(value, "__proto__", {
|
|
303
303
|
value: "ap://did:key:z6Mkabc/object",
|
|
@@ -320,7 +320,7 @@ test("compactJsonLdCache() preserves no-context object shape", async () => {
|
|
|
320
320
|
"https://www.w3.org/ns/activitystreams#attributedTo": [{ "@id": "ap://did:key:z6Mkabc/actor" }],
|
|
321
321
|
"https://www.w3.org/ns/activitystreams#content": [{ "@value": "No-context object shape should stay cached." }]
|
|
322
322
|
};
|
|
323
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id", "https://www.w3.org/ns/activitystreams#attributedTo"])), original), {
|
|
323
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#attributedTo"])), original), {
|
|
324
324
|
"@id": "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
325
325
|
"@type": ["https://www.w3.org/ns/activitystreams#Note"],
|
|
326
326
|
"https://www.w3.org/ns/activitystreams#attributedTo": [{ "@id": "ap+ef61://did:key:z6Mkabc/actor" }],
|
|
@@ -341,7 +341,7 @@ test("compactJsonLdCache() ignores nested contexts for no-context parents", asyn
|
|
|
341
341
|
name: "Nested object"
|
|
342
342
|
}]
|
|
343
343
|
};
|
|
344
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
344
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
345
345
|
"@id": "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
346
346
|
"@type": ["https://www.w3.org/ns/activitystreams#Note"],
|
|
347
347
|
"https://www.w3.org/ns/activitystreams#attachment": [{
|
|
@@ -388,7 +388,7 @@ test("compactJsonLdCache() preserves nested unmapped terms", async () => {
|
|
|
388
388
|
extra: "This nested unmapped property should stay cached."
|
|
389
389
|
}
|
|
390
390
|
};
|
|
391
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
391
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
392
392
|
"@context": context,
|
|
393
393
|
type: "as:Note",
|
|
394
394
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -420,7 +420,7 @@ test("compactJsonLdCache() reuses unchanged unmapped values", async () => {
|
|
|
420
420
|
extra
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
|
-
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original);
|
|
423
|
+
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
|
|
424
424
|
strictEqual(compacted.rootExtra, rootExtra);
|
|
425
425
|
strictEqual(compacted.attachment.extra, extra);
|
|
426
426
|
});
|
|
@@ -441,7 +441,7 @@ test("compactJsonLdCache() defines prototype-like unmapped keys safely", async (
|
|
|
441
441
|
configurable: true,
|
|
442
442
|
writable: true
|
|
443
443
|
});
|
|
444
|
-
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original);
|
|
444
|
+
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
|
|
445
445
|
strictEqual(globalThis.Object.getOwnPropertyDescriptor(compacted, "__proto__")?.value, protoValue);
|
|
446
446
|
strictEqual(globalThis.Object.getPrototypeOf(compacted), Object.prototype);
|
|
447
447
|
});
|
|
@@ -468,7 +468,7 @@ test("compactJsonLdCache() checks prototype-like aliases safely", async () => {
|
|
|
468
468
|
configurable: true,
|
|
469
469
|
writable: true
|
|
470
470
|
});
|
|
471
|
-
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original);
|
|
471
|
+
const compacted = await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
|
|
472
472
|
const protoDescriptor = globalThis.Object.getOwnPropertyDescriptor(compacted, "__proto__");
|
|
473
473
|
ok(protoDescriptor?.value === "Alias represented by the compacted term." || Array.isArray(protoDescriptor?.value) && protoDescriptor.value.includes("Alias represented by the compacted term."));
|
|
474
474
|
strictEqual(protoDescriptor?.enumerable, true);
|
|
@@ -498,7 +498,7 @@ test("compactJsonLdCache() preserves nested contexts", async () => {
|
|
|
498
498
|
title: "Nested title."
|
|
499
499
|
}
|
|
500
500
|
};
|
|
501
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
501
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
502
502
|
"@context": context,
|
|
503
503
|
type: "as:Note",
|
|
504
504
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -530,7 +530,7 @@ test("compactJsonLdCache() preserves nested array contexts", async () => {
|
|
|
530
530
|
title: "Nested title."
|
|
531
531
|
}
|
|
532
532
|
};
|
|
533
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
533
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
534
534
|
"@context": context,
|
|
535
535
|
type: "as:Note",
|
|
536
536
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -558,7 +558,7 @@ test("compactJsonLdCache() preserves nested null contexts", async () => {
|
|
|
558
558
|
"https://example.com/ns#title": "Absolute title."
|
|
559
559
|
}
|
|
560
560
|
};
|
|
561
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
561
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
562
562
|
"@context": context,
|
|
563
563
|
type: "as:Note",
|
|
564
564
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -597,7 +597,7 @@ test("compactJsonLdCache() does not re-add represented nested aliases", async ()
|
|
|
597
597
|
actorRef: "ap://did:key:z6Mkabc/actor"
|
|
598
598
|
}
|
|
599
599
|
};
|
|
600
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id", "https://www.w3.org/ns/activitystreams#actor"])), original), {
|
|
600
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#actor"])), original), {
|
|
601
601
|
"@context": context,
|
|
602
602
|
type: "as:Note",
|
|
603
603
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
@@ -631,7 +631,7 @@ test("compactJsonLdCache() does not confuse dummy marker prefixes", async () =>
|
|
|
631
631
|
key9: "Extension 9",
|
|
632
632
|
key10: "Alias represented by the compacted term."
|
|
633
633
|
};
|
|
634
|
-
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), new Set(["@id"])), original), {
|
|
634
|
+
deepStrictEqual(await compactJsonLdCache(normalizeJsonLdIris(await jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
|
|
635
635
|
"@context": context,
|
|
636
636
|
id: "ap+ef61://did:key:z6Mkabc/objects/1",
|
|
637
637
|
key0: "Extension 0",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
require("./
|
|
2
|
-
const
|
|
3
|
-
const require_multibase = require("./multibase-DcDQDNnI.cjs");
|
|
1
|
+
const require_multicodec = require("./multicodec-CLRPeW4N.cjs");
|
|
2
|
+
const require_multibase = require("./multibase-B5Mea7Ip.cjs");
|
|
4
3
|
let asn1js = require("asn1js");
|
|
5
4
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
6
5
|
let byte_encodings_base64url = require("byte-encodings/base64url");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as getMulticodecPrefix, r as removeMulticodecPrefix, t as addMulticodecPrefix } from "./multicodec-
|
|
2
|
-
import { n as encodeMultibase, t as decodeMultibase } from "./multibase-
|
|
1
|
+
import { n as getMulticodecPrefix, r as removeMulticodecPrefix, t as addMulticodecPrefix } from "./multicodec-CRIj_05H.mjs";
|
|
2
|
+
import { n as encodeMultibase, t as decodeMultibase } from "./multibase-BPnF_L4e.mjs";
|
|
3
3
|
import { Integer, Sequence } from "asn1js";
|
|
4
4
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
5
5
|
import { decodeBase64Url } from "byte-encodings/base64url";
|
package/dist/tests/key.test.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
require("./
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_multibase = require("./multibase-DcDQDNnI.cjs");
|
|
1
|
+
const require_multicodec = require("./multicodec-CLRPeW4N.cjs");
|
|
2
|
+
const require_key = require("./key-8Qg2SbZi.cjs");
|
|
3
|
+
const require_multibase = require("./multibase-B5Mea7Ip.cjs");
|
|
5
4
|
let node_assert = require("node:assert");
|
|
6
5
|
let node_test = require("node:test");
|
|
7
6
|
//#region src/key.test.ts
|
package/dist/tests/key.test.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as addMulticodecPrefix } from "./multicodec-
|
|
2
|
-
import { a as importMultibaseKey, c as importSpki, d as importJwk, i as importDidKey, l as parseDidKeyVerificationMethod, n as exportMultibaseKey, o as importPem, r as exportSpki, s as importPkcs1, t as exportDidKey, u as exportJwk } from "./key-
|
|
3
|
-
import { n as encodeMultibase } from "./multibase-
|
|
1
|
+
import { t as addMulticodecPrefix } from "./multicodec-CRIj_05H.mjs";
|
|
2
|
+
import { a as importMultibaseKey, c as importSpki, d as importJwk, i as importDidKey, l as parseDidKeyVerificationMethod, n as exportMultibaseKey, o as importPem, r as exportSpki, s as importPkcs1, t as exportDidKey, u as exportJwk } from "./key-C7MNhlkO.mjs";
|
|
3
|
+
import { n as encodeMultibase } from "./multibase-BPnF_L4e.mjs";
|
|
4
4
|
import { deepStrictEqual, rejects } from "node:assert";
|
|
5
5
|
import { test } from "node:test";
|
|
6
6
|
//#region src/key.test.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_langstr = require("./langstr-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
+
const require_langstr = require("./langstr-C4Fl80ae.cjs");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let node_util = require("node:util");
|
|
6
|
-
node_util =
|
|
6
|
+
node_util = require_rolldown_runtime.__toESM(node_util, 1);
|
|
7
7
|
//#region src/langstr.test.ts
|
|
8
8
|
(0, node_test.test)("new LanguageString()", () => {
|
|
9
9
|
const langStr = new require_langstr.LanguageString("Hello", "en");
|
package/dist/tests/link.test.cjs
CHANGED
package/dist/tests/link.test.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
require("../
|
|
2
|
-
const require_multibase = require("../multibase-DcDQDNnI.cjs");
|
|
1
|
+
const require_multibase = require("../multibase-B5Mea7Ip.cjs");
|
|
3
2
|
let node_assert = require("node:assert");
|
|
4
3
|
let node_test = require("node:test");
|
|
5
4
|
//#region src/multibase/multibase.test.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as names, i as codes, n as encodeMultibase, o as decodeText, s as encodeText, t as decodeMultibase } from "../multibase-
|
|
1
|
+
import { a as names, i as codes, n as encodeMultibase, o as decodeText, s as encodeText, t as decodeMultibase } from "../multibase-BPnF_L4e.mjs";
|
|
2
2
|
import { deepStrictEqual } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
//#region src/multibase/multibase.test.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
2
|
let _multiformats_base_x = require("@multiformats/base-x");
|
|
3
|
-
_multiformats_base_x =
|
|
3
|
+
_multiformats_base_x = require_rolldown_runtime.__toESM(_multiformats_base_x, 1);
|
|
4
4
|
//#region src/multibase/util.ts
|
|
5
5
|
const textDecoder = new TextDecoder();
|
|
6
6
|
const decodeText = (bytes) => textDecoder.decode(bytes);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
2
|
let node_process = require("node:process");
|
|
3
|
-
node_process =
|
|
3
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
4
4
|
//#region deno.json
|
|
5
5
|
var name = "@fedify/vocab-runtime";
|
|
6
|
-
var version = "2.4.0-dev.
|
|
6
|
+
var version = "2.4.0-dev.1740+32e9952c";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/request.ts
|
|
9
9
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_request = require("./request-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
+
const require_request = require("./request-D1rLeiIi.cjs");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let node_process = require("node:process");
|
|
6
|
-
node_process =
|
|
6
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
7
7
|
//#region src/request.test.ts
|
|
8
8
|
(0, node_test.test)("getUserAgent()", () => {
|
|
9
9
|
if ("Deno" in globalThis) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as version, r as getUserAgent } from "./request-
|
|
1
|
+
import { o as version, r as getUserAgent } from "./request-DpcxnLEa.mjs";
|
|
2
2
|
import { deepStrictEqual } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import process from "node:process";
|
|
@@ -2,8 +2,8 @@ import { lookup } from "node:dns/promises";
|
|
|
2
2
|
import { isIP } from "node:net";
|
|
3
3
|
//#region src/url.ts
|
|
4
4
|
var UrlError = class extends Error {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
super(message);
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message, options);
|
|
7
7
|
this.name = "UrlError";
|
|
8
8
|
}
|
|
9
9
|
};
|
|
@@ -247,10 +247,37 @@ async function validatePublicUrl(url) {
|
|
|
247
247
|
let addresses;
|
|
248
248
|
try {
|
|
249
249
|
addresses = await lookup(hostname, { all: true });
|
|
250
|
-
} catch {
|
|
251
|
-
|
|
250
|
+
} catch (error) {
|
|
251
|
+
throw new UrlError("DNS lookup failed", { cause: error });
|
|
252
|
+
}
|
|
253
|
+
validateLookupAddresses(addresses);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Validates the IP addresses returned by `node:dns.lookup()`.
|
|
257
|
+
*
|
|
258
|
+
* Cloudflare Workers' `node:dns` implementation currently maps every record
|
|
259
|
+
* in a DNS-over-HTTPS `Answer` array—including CNAME records—to a
|
|
260
|
+
* `LookupAddress`, even though Node.js specifies that the `address` field must
|
|
261
|
+
* contain an IPv4 or IPv6 literal. See:
|
|
262
|
+
* https://github.com/cloudflare/workerd/issues/6886
|
|
263
|
+
*
|
|
264
|
+
* Work around that bug by ignoring non-IP entries only when the lookup also
|
|
265
|
+
* returns at least one actual IP address. This remains fail-closed: a result
|
|
266
|
+
* containing no IP addresses is rejected, and every returned IP address is
|
|
267
|
+
* still validated and must be public. This workaround can be revisited once
|
|
268
|
+
* the Workerd issue is fixed in supported Cloudflare Workers runtimes.
|
|
269
|
+
*
|
|
270
|
+
* @internal
|
|
271
|
+
*/
|
|
272
|
+
function validateLookupAddresses(addresses) {
|
|
273
|
+
let ipAddressCount = 0;
|
|
274
|
+
for (const { address } of addresses) {
|
|
275
|
+
const family = isIP(address);
|
|
276
|
+
if (family === 0) continue;
|
|
277
|
+
ipAddressCount++;
|
|
278
|
+
validatePublicIpAddress(address, family);
|
|
252
279
|
}
|
|
253
|
-
|
|
280
|
+
if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address");
|
|
254
281
|
}
|
|
255
282
|
function validatePublicIpAddress(address, family) {
|
|
256
283
|
if (family === 4 && isValidPublicIPv4Address(address) || family === 6 && isValidPublicIPv6Address(address)) return;
|
|
@@ -389,4 +416,4 @@ function matchesIPv6Prefix(address, prefixWords, prefixLength) {
|
|
|
389
416
|
return true;
|
|
390
417
|
}
|
|
391
418
|
//#endregion
|
|
392
|
-
export { formatIri as a, haveSameIriOrigin as c, isValidPublicIPv6Address as d, parseGatewayUrl as f, validatePublicUrl as h, expandIPv6Address as i, isGatewayUrl as l, parseJsonLdId as m, arePortableUrisEqual as n, getFe34Origin as o, parseIri as p, canonicalizePortableUri as r, haveSameFe34Origin as s, UrlError as t, isValidPublicIPv4Address as u };
|
|
419
|
+
export { formatIri as a, haveSameIriOrigin as c, isValidPublicIPv6Address as d, parseGatewayUrl as f, validatePublicUrl as g, validateLookupAddresses as h, expandIPv6Address as i, isGatewayUrl as l, parseJsonLdId as m, arePortableUrisEqual as n, getFe34Origin as o, parseIri as p, canonicalizePortableUri as r, haveSameFe34Origin as s, UrlError as t, isValidPublicIPv4Address as u };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
require("./chunk-C2EiDwsr.cjs");
|
|
2
1
|
let node_dns_promises = require("node:dns/promises");
|
|
3
2
|
let node_net = require("node:net");
|
|
4
3
|
//#region src/url.ts
|
|
5
4
|
var UrlError = class extends Error {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super(message);
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message, options);
|
|
8
7
|
this.name = "UrlError";
|
|
9
8
|
}
|
|
10
9
|
};
|
|
@@ -248,10 +247,37 @@ async function validatePublicUrl(url) {
|
|
|
248
247
|
let addresses;
|
|
249
248
|
try {
|
|
250
249
|
addresses = await (0, node_dns_promises.lookup)(hostname, { all: true });
|
|
251
|
-
} catch {
|
|
252
|
-
|
|
250
|
+
} catch (error) {
|
|
251
|
+
throw new UrlError("DNS lookup failed", { cause: error });
|
|
253
252
|
}
|
|
254
|
-
|
|
253
|
+
validateLookupAddresses(addresses);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Validates the IP addresses returned by `node:dns.lookup()`.
|
|
257
|
+
*
|
|
258
|
+
* Cloudflare Workers' `node:dns` implementation currently maps every record
|
|
259
|
+
* in a DNS-over-HTTPS `Answer` array—including CNAME records—to a
|
|
260
|
+
* `LookupAddress`, even though Node.js specifies that the `address` field must
|
|
261
|
+
* contain an IPv4 or IPv6 literal. See:
|
|
262
|
+
* https://github.com/cloudflare/workerd/issues/6886
|
|
263
|
+
*
|
|
264
|
+
* Work around that bug by ignoring non-IP entries only when the lookup also
|
|
265
|
+
* returns at least one actual IP address. This remains fail-closed: a result
|
|
266
|
+
* containing no IP addresses is rejected, and every returned IP address is
|
|
267
|
+
* still validated and must be public. This workaround can be revisited once
|
|
268
|
+
* the Workerd issue is fixed in supported Cloudflare Workers runtimes.
|
|
269
|
+
*
|
|
270
|
+
* @internal
|
|
271
|
+
*/
|
|
272
|
+
function validateLookupAddresses(addresses) {
|
|
273
|
+
let ipAddressCount = 0;
|
|
274
|
+
for (const { address } of addresses) {
|
|
275
|
+
const family = (0, node_net.isIP)(address);
|
|
276
|
+
if (family === 0) continue;
|
|
277
|
+
ipAddressCount++;
|
|
278
|
+
validatePublicIpAddress(address, family);
|
|
279
|
+
}
|
|
280
|
+
if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address");
|
|
255
281
|
}
|
|
256
282
|
function validatePublicIpAddress(address, family) {
|
|
257
283
|
if (family === 4 && isValidPublicIPv4Address(address) || family === 6 && isValidPublicIPv6Address(address)) return;
|
|
@@ -474,6 +500,12 @@ Object.defineProperty(exports, "parseJsonLdId", {
|
|
|
474
500
|
return parseJsonLdId;
|
|
475
501
|
}
|
|
476
502
|
});
|
|
503
|
+
Object.defineProperty(exports, "validateLookupAddresses", {
|
|
504
|
+
enumerable: true,
|
|
505
|
+
get: function() {
|
|
506
|
+
return validateLookupAddresses;
|
|
507
|
+
}
|
|
508
|
+
});
|
|
477
509
|
Object.defineProperty(exports, "validatePublicUrl", {
|
|
478
510
|
enumerable: true,
|
|
479
511
|
get: function() {
|