@fedify/vocab 2.4.0-dev.1508 → 2.4.0-dev.1531

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { E as Person, N as Service, T as Organization, V as __toESM, a as Application, m as Group, z as __commonJSMin } from "./vocab-XnSGFOqq.mjs";
3
+ import { E as Person, N as Service, T as Organization, V as __toESM, a as Application, m as Group, z as __commonJSMin } from "./vocab-CQX0Zq_l.mjs";
4
4
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
5
5
  import { lookupWebFinger } from "@fedify/webfinger";
6
6
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1206,7 +1206,7 @@ var esm_default = new class FetchMock {
1206
1206
  //#endregion
1207
1207
  //#region deno.json
1208
1208
  var name = "@fedify/vocab";
1209
- var version = "2.4.0-dev.1508+68519bf4";
1209
+ var version = "2.4.0-dev.1531+0896bc51";
1210
1210
  //#endregion
1211
1211
  //#region src/actor.ts
1212
1212
  const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { B as __exportAll, E as Person, N as Service, T as Organization, a as Application, m as Group } from "./vocab-XnSGFOqq.mjs";
4
- import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-DuYbpVhy.mjs";
3
+ import { B as __exportAll, E as Person, N as Service, T as Organization, a as Application, m as Group } from "./vocab-CQX0Zq_l.mjs";
4
+ import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-BNGWfRD2.mjs";
5
5
  import { createTestMeterProvider, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
7
7
  //#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { E as Person, S as Object$1, o as Collection, x as Note } from "./vocab-XnSGFOqq.mjs";
4
- import { c as esm_default, i as isActor, o as name, s as version } from "./actor-DuYbpVhy.mjs";
3
+ import { E as Person, S as Object$1, o as Collection, x as Note } from "./vocab-CQX0Zq_l.mjs";
4
+ import { c as esm_default, i as isActor, o as name, s as version } from "./actor-BNGWfRD2.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
7
7
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -9,7 +9,7 @@ import { deepStrictEqual, equal, ok, rejects } from "node:assert/strict";
9
9
  import { lookupWebFinger } from "@fedify/webfinger";
10
10
  import { SpanStatusCode, trace } from "@opentelemetry/api";
11
11
  import { getLogger } from "@logtape/logtape";
12
- import { getDocumentLoader } from "@fedify/vocab-runtime";
12
+ import { getDocumentLoader, haveSameIriOrigin, parseIri } from "@fedify/vocab-runtime";
13
13
  import { delay } from "es-toolkit";
14
14
  //#region src/handle.ts
15
15
  /**
@@ -204,12 +204,14 @@ async function lookupObjectInternal(identifier, options = {}) {
204
204
  }
205
205
  if (remoteDoc == null) return null;
206
206
  let object;
207
+ let documentUrl;
207
208
  try {
209
+ documentUrl = parseIri(remoteDoc.documentUrl);
208
210
  object = await Object$1.fromJsonLd(remoteDoc.document, {
209
211
  documentLoader,
210
212
  contextLoader: options.contextLoader,
211
213
  tracerProvider: options.tracerProvider,
212
- baseUrl: new URL(remoteDoc.documentUrl)
214
+ baseUrl: documentUrl
213
215
  });
214
216
  } catch (error) {
215
217
  if (error instanceof TypeError) {
@@ -221,7 +223,7 @@ async function lookupObjectInternal(identifier, options = {}) {
221
223
  }
222
224
  throw error;
223
225
  }
224
- if (options.crossOrigin !== "trust" && object.id != null && object.id.origin !== new URL(remoteDoc.documentUrl).origin) {
226
+ if (options.crossOrigin !== "trust" && object.id != null && !haveSameIriOrigin(object.id, documentUrl)) {
225
227
  if (options.crossOrigin === "throw") throw new Error(`The object's @id (${object.id.href}) has a different origin than the document URL (${remoteDoc.documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to "trust".`);
226
228
  logger.warn("The object's @id ({objectId}) has a different origin than the document URL ({documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
227
229
  ...remoteDoc,
@@ -1,6 +1,6 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { E as Person, I as getEntityTypeById, L as isEntityType, y as Link } from "./vocab-XnSGFOqq.mjs";
3
+ import { E as Person, I as getEntityTypeById, L as isEntityType, y as Link } from "./vocab-CQX0Zq_l.mjs";
4
4
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual } from "node:assert/strict";