@fedify/vocab-runtime 2.4.0-dev.2190 → 2.4.0-dev.2200
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.js +1 -1
- package/dist/internal/portable-dereference.cjs +1 -1
- package/dist/internal/portable-dereference.js +1 -1
- package/dist/mod.cjs +2 -2
- package/dist/mod.d.cts +4 -0
- package/dist/mod.d.ts +4 -0
- package/dist/mod.js +2 -2
- package/dist/tests/{body-CmZdqiw3.cjs → body-C7VkG5Rz.cjs} +1 -1
- package/dist/tests/{body-DMNbCBhz.mjs → body-DxnRZZTZ.mjs} +1 -1
- package/dist/tests/body.test.cjs +1 -1
- package/dist/tests/body.test.mjs +1 -1
- package/dist/tests/decimal.test.cjs +2 -2
- package/dist/tests/decimal.test.mjs +2 -2
- package/dist/tests/{docloader-B0omnjRS.cjs → docloader-DzUk-dX-.cjs} +3 -3
- package/dist/tests/{docloader-6iodlx7G.mjs → docloader-lhhaq3_J.mjs} +3 -3
- package/dist/tests/docloader.test.cjs +3 -3
- package/dist/tests/docloader.test.mjs +3 -3
- package/dist/tests/internal/portable-dereference.test.cjs +2 -2
- package/dist/tests/internal/portable-dereference.test.mjs +2 -2
- package/dist/tests/{jsonld-cache-BO-QXxIc.cjs → jsonld-cache-BQMn_ILF.cjs} +1 -1
- package/dist/tests/{jsonld-cache-B7PKo3Lu.mjs → jsonld-cache-DUmuWRwp.mjs} +1 -1
- package/dist/tests/jsonld-cache.test.cjs +2 -2
- package/dist/tests/jsonld-cache.test.mjs +2 -2
- package/dist/tests/{request-CGmX5n4v.mjs → request-AYfyUo0m.mjs} +1 -1
- package/dist/tests/{request-BU0mCgOL.cjs → request-D5KwMCcr.cjs} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.mjs +1 -1
- package/dist/tests/{url-gLKqAO1H.cjs → url-B8xyTwP-.cjs} +5 -1
- package/dist/tests/{url-D7qRF-dF.mjs → url-DfS-cvwr.mjs} +5 -1
- package/dist/tests/url.test.cjs +2 -2
- package/dist/tests/url.test.mjs +2 -2
- package/dist/{url-BHZYe8Vu.js → url-Be3moMor.js} +5 -1
- package/dist/{url-P6l9s9dN.cjs → url-DDVweCXr.cjs} +5 -1
- package/package.json +1 -1
- package/src/url.test.ts +7 -1
- package/src/url.ts +6 -2
package/deno.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_url = require("../url-
|
|
3
|
+
const require_url = require("../url-DDVweCXr.cjs");
|
|
4
4
|
const require_jsonld = require("../jsonld.cjs");
|
|
5
5
|
//#region src/internal/jsonld-cache.ts
|
|
6
6
|
const noJsonLdContext = Symbol("noJsonLdContext");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "../url-
|
|
2
|
+
import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "../url-Be3moMor.js";
|
|
3
3
|
import jsonld_default from "../jsonld.js";
|
|
4
4
|
//#region src/internal/jsonld-cache.ts
|
|
5
5
|
const noJsonLdContext = Symbol("noJsonLdContext");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_contexts = require("../contexts-BK1CqBR5.cjs");
|
|
4
|
-
const require_url = require("../url-
|
|
4
|
+
const require_url = require("../url-DDVweCXr.cjs");
|
|
5
5
|
const require_jsonld = require("../jsonld.cjs");
|
|
6
6
|
const require_internal_jsonld_cache = require("./jsonld-cache.cjs");
|
|
7
7
|
let _logtape_logtape = require("@logtape/logtape");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { t as preloadedContexts } from "../contexts-DPuJ4UYL.js";
|
|
3
|
-
import { a as formatIri, c as haveSameFe34Origin, g as toCompatibleEf61Id, m as parseIri, o as fromCompatibleEf61Id, r as canonicalizePortableUri } from "../url-
|
|
3
|
+
import { a as formatIri, c as haveSameFe34Origin, g as toCompatibleEf61Id, m as parseIri, o as fromCompatibleEf61Id, r as canonicalizePortableUri } from "../url-Be3moMor.js";
|
|
4
4
|
import jsonld_default from "../jsonld.js";
|
|
5
5
|
import { createScopedContextLoader, registerDocumentLoaderWrapper, unwrapReleasedDocumentLoader } from "./jsonld-cache.js";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
package/dist/mod.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_rolldown_runtime = require("./rolldown-runtime-B7lfambq.cjs");
|
|
4
4
|
const require_contexts = require("./contexts-BK1CqBR5.cjs");
|
|
5
|
-
const require_url = require("./url-
|
|
5
|
+
const require_url = require("./url-DDVweCXr.cjs");
|
|
6
6
|
let _logtape_logtape = require("@logtape/logtape");
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
8
8
|
let node_process = require("node:process");
|
|
@@ -16,7 +16,7 @@ let _multiformats_base_x = require("@multiformats/base-x");
|
|
|
16
16
|
_multiformats_base_x = require_rolldown_runtime.__toESM(_multiformats_base_x, 1);
|
|
17
17
|
//#region deno.json
|
|
18
18
|
var name = "@fedify/vocab-runtime";
|
|
19
|
-
var version = "2.4.0-dev.
|
|
19
|
+
var version = "2.4.0-dev.2200+e588a43c";
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/request.ts
|
|
22
22
|
/**
|
package/dist/mod.d.cts
CHANGED
|
@@ -484,6 +484,10 @@ declare function haveSameIriOrigin(left: URL, right: URL): boolean;
|
|
|
484
484
|
declare function isGatewayUrl(url: URL): boolean;
|
|
485
485
|
/**
|
|
486
486
|
* Parses and validates an FEP-ef61 gateway base URI.
|
|
487
|
+
* @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
|
|
488
|
+
* with no credentials, path, query, or fragment. In the
|
|
489
|
+
* latter case, the message starts with
|
|
490
|
+
* `Invalid FEP-ef61 gateway:`.
|
|
487
491
|
*/
|
|
488
492
|
declare function parseGatewayUrl(url: string): URL;
|
|
489
493
|
/**
|
package/dist/mod.d.ts
CHANGED
|
@@ -483,6 +483,10 @@ declare function haveSameIriOrigin(left: URL, right: URL): boolean;
|
|
|
483
483
|
declare function isGatewayUrl(url: URL): boolean;
|
|
484
484
|
/**
|
|
485
485
|
* Parses and validates an FEP-ef61 gateway base URI.
|
|
486
|
+
* @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
|
|
487
|
+
* with no credentials, path, query, or fragment. In the
|
|
488
|
+
* latter case, the message starts with
|
|
489
|
+
* `Invalid FEP-ef61 gateway:`.
|
|
486
490
|
*/
|
|
487
491
|
declare function parseGatewayUrl(url: string): URL;
|
|
488
492
|
/**
|
package/dist/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { t as preloadedContexts } from "./contexts-DPuJ4UYL.js";
|
|
3
|
-
import { _ as validatePublicUrl, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl } from "./url-
|
|
3
|
+
import { _ as validatePublicUrl, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl } from "./url-Be3moMor.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
6
6
|
import process from "node:process";
|
|
@@ -12,7 +12,7 @@ import { PublicKeyInfo } from "pkijs";
|
|
|
12
12
|
import baseX from "@multiformats/base-x";
|
|
13
13
|
//#region deno.json
|
|
14
14
|
var name = "@fedify/vocab-runtime";
|
|
15
|
-
var version = "2.4.0-dev.
|
|
15
|
+
var version = "2.4.0-dev.2200+e588a43c";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/request.ts
|
|
18
18
|
/**
|
package/dist/tests/body.test.cjs
CHANGED
package/dist/tests/body.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { i as readBoundedText, t as BodyTooLargeError } from "./body-DxnRZZTZ.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import { gunzipSync, gzipSync } from "node:zlib";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_request = require("./request-
|
|
2
|
-
const require_body = require("./body-
|
|
1
|
+
const require_request = require("./request-D5KwMCcr.cjs");
|
|
2
|
+
const require_body = require("./body-C7VkG5Rz.cjs");
|
|
3
3
|
const require_contexts = require("./contexts-DizzBjz4.cjs");
|
|
4
4
|
const require_link = require("./link-DlKm8bEr.cjs");
|
|
5
|
-
const require_url = require("./url-
|
|
5
|
+
const require_url = require("./url-B8xyTwP-.cjs");
|
|
6
6
|
let _logtape_logtape = require("@logtape/logtape");
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
8
8
|
//#region src/docloader.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-
|
|
2
|
-
import { i as readBoundedText, n as MAX_BODY_SIZE, r as readBoundedBytes, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-AYfyUo0m.mjs";
|
|
2
|
+
import { i as readBoundedText, n as MAX_BODY_SIZE, r as readBoundedBytes, t as BodyTooLargeError } from "./body-DxnRZZTZ.mjs";
|
|
3
3
|
import { t as preloadedContexts } from "./contexts-CIKsin4e.mjs";
|
|
4
4
|
import { t as HttpHeaderLink } from "./link-Cevmc87v.mjs";
|
|
5
|
-
import { t as UrlError, v as validatePublicUrl } from "./url-
|
|
5
|
+
import { t as UrlError, v as validatePublicUrl } from "./url-DfS-cvwr.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
//#region src/docloader.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-D5KwMCcr.cjs");
|
|
3
3
|
const require_contexts = require("./contexts-DizzBjz4.cjs");
|
|
4
|
-
const require_url = require("./url-
|
|
5
|
-
const require_docloader = require("./docloader-
|
|
4
|
+
const require_url = require("./url-B8xyTwP-.cjs");
|
|
5
|
+
const require_docloader = require("./docloader-DzUk-dX-.cjs");
|
|
6
6
|
let node_test = require("node:test");
|
|
7
7
|
let node_zlib = require("node:zlib");
|
|
8
8
|
let _logtape_logtape = require("@logtape/logtape");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FetchError } from "./request-
|
|
1
|
+
import { t as FetchError } from "./request-AYfyUo0m.mjs";
|
|
2
2
|
import { n as cid_v1_default, t as preloadedContexts } from "./contexts-CIKsin4e.mjs";
|
|
3
|
-
import { t as UrlError } from "./url-
|
|
4
|
-
import { i as withDocumentLoaderTimeout, n as getRemoteDocument, r as resolveDocumentLoaderTimeout, t as getDocumentLoader } from "./docloader-
|
|
3
|
+
import { t as UrlError } from "./url-DfS-cvwr.mjs";
|
|
4
|
+
import { i as withDocumentLoaderTimeout, n as getRemoteDocument, r as resolveDocumentLoaderTimeout, t as getDocumentLoader } from "./docloader-lhhaq3_J.mjs";
|
|
5
5
|
import { test } from "node:test";
|
|
6
6
|
import { gzipSync } from "node:zlib";
|
|
7
7
|
import { configure, reset } from "@logtape/logtape";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_contexts = require("../contexts-DizzBjz4.cjs");
|
|
2
|
-
const require_url = require("../url-
|
|
3
|
-
const require_jsonld_cache = require("../jsonld-cache-
|
|
2
|
+
const require_url = require("../url-B8xyTwP-.cjs");
|
|
3
|
+
const require_jsonld_cache = require("../jsonld-cache-BQMn_ILF.cjs");
|
|
4
4
|
let node_assert_strict = require("node:assert/strict");
|
|
5
5
|
let node_test = require("node:test");
|
|
6
6
|
let _logtape_logtape = require("@logtape/logtape");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as preloadedContexts } from "../contexts-CIKsin4e.mjs";
|
|
2
|
-
import { a as formatIri, m as parseIri } from "../url-
|
|
3
|
-
import { n as createScopedContextLoader, o as registerDocumentLoaderWrapper, s as unwrapReleasedDocumentLoader } from "../jsonld-cache-
|
|
2
|
+
import { a as formatIri, m as parseIri } from "../url-DfS-cvwr.mjs";
|
|
3
|
+
import { n as createScopedContextLoader, o as registerDocumentLoaderWrapper, s as unwrapReleasedDocumentLoader } from "../jsonld-cache-DUmuWRwp.mjs";
|
|
4
4
|
import { deepStrictEqual, ok, throws } from "node:assert/strict";
|
|
5
5
|
import { test } from "node:test";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
const require_url = require("./url-
|
|
2
|
+
const require_url = require("./url-B8xyTwP-.cjs");
|
|
3
3
|
let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
|
|
4
4
|
jsonld_dist_jsonld_esm_js = require_rolldown_runtime.__toESM(jsonld_dist_jsonld_esm_js, 1);
|
|
5
5
|
//#region src/jsonld.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "./url-
|
|
1
|
+
import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "./url-DfS-cvwr.mjs";
|
|
2
2
|
import jsonld from "jsonld/dist/jsonld.esm.js";
|
|
3
3
|
//#region src/jsonld.ts
|
|
4
4
|
var jsonld_default = jsonld;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_url = require("./url-
|
|
2
|
-
const require_jsonld_cache = require("./jsonld-cache-
|
|
1
|
+
const require_url = require("./url-B8xyTwP-.cjs");
|
|
2
|
+
const require_jsonld_cache = require("./jsonld-cache-BQMn_ILF.cjs");
|
|
3
3
|
let node_test = require("node:test");
|
|
4
4
|
let node_assert = require("node:assert");
|
|
5
5
|
//#region src/jsonld-cache.test.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as parseIri } from "./url-
|
|
2
|
-
import { a as normalizeJsonLdIris, c as jsonld_default, i as isTrustedIriOrigin, r as getJsonLdContext, t as compactJsonLdCache } from "./jsonld-cache-
|
|
1
|
+
import { m as parseIri } from "./url-DfS-cvwr.mjs";
|
|
2
|
+
import { a as normalizeJsonLdIris, c as jsonld_default, i as isTrustedIriOrigin, r as getJsonLdContext, t as compactJsonLdCache } from "./jsonld-cache-DUmuWRwp.mjs";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import { deepStrictEqual, ok, strictEqual } from "node:assert";
|
|
5
5
|
//#region src/jsonld-cache.test.ts
|
|
@@ -3,7 +3,7 @@ let node_process = require("node:process");
|
|
|
3
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.2200+e588a43c";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/request.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-D5KwMCcr.cjs");
|
|
3
3
|
let node_test = require("node:test");
|
|
4
4
|
let node_process = require("node:process");
|
|
5
5
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-
|
|
1
|
+
import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-AYfyUo0m.mjs";
|
|
2
2
|
import { test } from "node:test";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { deepStrictEqual } from "node:assert";
|
|
@@ -226,10 +226,14 @@ function isGatewayUrl(url) {
|
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Parses and validates an FEP-ef61 gateway base URI.
|
|
229
|
+
* @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
|
|
230
|
+
* with no credentials, path, query, or fragment. In the
|
|
231
|
+
* latter case, the message starts with
|
|
232
|
+
* `Invalid FEP-ef61 gateway:`.
|
|
229
233
|
*/
|
|
230
234
|
function parseGatewayUrl(url) {
|
|
231
235
|
const parsed = parseIri(url);
|
|
232
|
-
if (!isGatewayUrl(parsed)) throw new TypeError(
|
|
236
|
+
if (!isGatewayUrl(parsed)) throw new TypeError(`Invalid FEP-ef61 gateway: ${url}. FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.`);
|
|
233
237
|
return parsed;
|
|
234
238
|
}
|
|
235
239
|
const COMPATIBLE_ID_PATH_PREFIX = "/.well-known/apgateway/";
|
|
@@ -224,10 +224,14 @@ function isGatewayUrl(url) {
|
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* Parses and validates an FEP-ef61 gateway base URI.
|
|
227
|
+
* @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
|
|
228
|
+
* with no credentials, path, query, or fragment. In the
|
|
229
|
+
* latter case, the message starts with
|
|
230
|
+
* `Invalid FEP-ef61 gateway:`.
|
|
227
231
|
*/
|
|
228
232
|
function parseGatewayUrl(url) {
|
|
229
233
|
const parsed = parseIri(url);
|
|
230
|
-
if (!isGatewayUrl(parsed)) throw new TypeError(
|
|
234
|
+
if (!isGatewayUrl(parsed)) throw new TypeError(`Invalid FEP-ef61 gateway: ${url}. FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.`);
|
|
231
235
|
return parsed;
|
|
232
236
|
}
|
|
233
237
|
const COMPATIBLE_ID_PATH_PREFIX = "/.well-known/apgateway/";
|
package/dist/tests/url.test.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_url = require("./url-
|
|
1
|
+
const require_url = require("./url-B8xyTwP-.cjs");
|
|
2
2
|
let node_test = require("node:test");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
//#region src/url.test.ts
|
|
@@ -240,7 +240,7 @@ let node_assert = require("node:assert");
|
|
|
240
240
|
"https://server.example/?x=1",
|
|
241
241
|
"https://server.example/#fragment"
|
|
242
242
|
]) {
|
|
243
|
-
(0, node_assert.throws)(() => require_url.parseGatewayUrl(url), TypeError);
|
|
243
|
+
(0, node_assert.throws)(() => require_url.parseGatewayUrl(url), (error) => error instanceof TypeError && error.message.startsWith("Invalid FEP-ef61 gateway: "));
|
|
244
244
|
(0, node_assert.ok)(!require_url.isGatewayUrl(new URL(url)));
|
|
245
245
|
}
|
|
246
246
|
});
|
package/dist/tests/url.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as validateLookupAddresses, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl, v as validatePublicUrl } from "./url-
|
|
1
|
+
import { _ as validateLookupAddresses, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl, v as validatePublicUrl } from "./url-DfS-cvwr.mjs";
|
|
2
2
|
import { test } from "node:test";
|
|
3
3
|
import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert";
|
|
4
4
|
//#region src/url.test.ts
|
|
@@ -240,7 +240,7 @@ test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
|
|
|
240
240
|
"https://server.example/?x=1",
|
|
241
241
|
"https://server.example/#fragment"
|
|
242
242
|
]) {
|
|
243
|
-
throws(() => parseGatewayUrl(url), TypeError);
|
|
243
|
+
throws(() => parseGatewayUrl(url), (error) => error instanceof TypeError && error.message.startsWith("Invalid FEP-ef61 gateway: "));
|
|
244
244
|
ok(!isGatewayUrl(new URL(url)));
|
|
245
245
|
}
|
|
246
246
|
});
|
|
@@ -225,10 +225,14 @@ function isGatewayUrl(url) {
|
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
227
227
|
* Parses and validates an FEP-ef61 gateway base URI.
|
|
228
|
+
* @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
|
|
229
|
+
* with no credentials, path, query, or fragment. In the
|
|
230
|
+
* latter case, the message starts with
|
|
231
|
+
* `Invalid FEP-ef61 gateway:`.
|
|
228
232
|
*/
|
|
229
233
|
function parseGatewayUrl(url) {
|
|
230
234
|
const parsed = parseIri(url);
|
|
231
|
-
if (!isGatewayUrl(parsed)) throw new TypeError(
|
|
235
|
+
if (!isGatewayUrl(parsed)) throw new TypeError(`Invalid FEP-ef61 gateway: ${url}. FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.`);
|
|
232
236
|
return parsed;
|
|
233
237
|
}
|
|
234
238
|
const COMPATIBLE_ID_PATH_PREFIX = "/.well-known/apgateway/";
|
|
@@ -227,10 +227,14 @@ function isGatewayUrl(url) {
|
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Parses and validates an FEP-ef61 gateway base URI.
|
|
230
|
+
* @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
|
|
231
|
+
* with no credentials, path, query, or fragment. In the
|
|
232
|
+
* latter case, the message starts with
|
|
233
|
+
* `Invalid FEP-ef61 gateway:`.
|
|
230
234
|
*/
|
|
231
235
|
function parseGatewayUrl(url) {
|
|
232
236
|
const parsed = parseIri(url);
|
|
233
|
-
if (!isGatewayUrl(parsed)) throw new TypeError(
|
|
237
|
+
if (!isGatewayUrl(parsed)) throw new TypeError(`Invalid FEP-ef61 gateway: ${url}. FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.`);
|
|
234
238
|
return parsed;
|
|
235
239
|
}
|
|
236
240
|
const COMPATIBLE_ID_PATH_PREFIX = "/.well-known/apgateway/";
|
package/package.json
CHANGED
package/src/url.test.ts
CHANGED
|
@@ -659,7 +659,13 @@ test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
|
|
|
659
659
|
"https://server.example/#fragment",
|
|
660
660
|
]
|
|
661
661
|
) {
|
|
662
|
-
|
|
662
|
+
// Inboxes tell a malformed gateway from other errors by this prefix:
|
|
663
|
+
throws(
|
|
664
|
+
() => parseGatewayUrl(url),
|
|
665
|
+
(error) =>
|
|
666
|
+
error instanceof TypeError &&
|
|
667
|
+
error.message.startsWith("Invalid FEP-ef61 gateway: "),
|
|
668
|
+
);
|
|
663
669
|
ok(!isGatewayUrl(new URL(url)));
|
|
664
670
|
}
|
|
665
671
|
});
|
package/src/url.ts
CHANGED
|
@@ -348,13 +348,17 @@ export function isGatewayUrl(url: URL): boolean {
|
|
|
348
348
|
|
|
349
349
|
/**
|
|
350
350
|
* Parses and validates an FEP-ef61 gateway base URI.
|
|
351
|
+
* @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
|
|
352
|
+
* with no credentials, path, query, or fragment. In the
|
|
353
|
+
* latter case, the message starts with
|
|
354
|
+
* `Invalid FEP-ef61 gateway:`.
|
|
351
355
|
*/
|
|
352
356
|
export function parseGatewayUrl(url: string): URL {
|
|
353
357
|
const parsed = parseIri(url);
|
|
354
358
|
if (!isGatewayUrl(parsed)) {
|
|
355
359
|
throw new TypeError(
|
|
356
|
-
|
|
357
|
-
"path, query, or fragment.",
|
|
360
|
+
`Invalid FEP-ef61 gateway: ${url}. FEP-ef61 gateways must be HTTP(S) ` +
|
|
361
|
+
"base URIs with no credentials, path, query, or fragment.",
|
|
358
362
|
);
|
|
359
363
|
}
|
|
360
364
|
return parsed;
|