@fedify/vocab 2.5.0-dev.2448 → 2.5.0-dev.2492

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,14 +1,15 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { F as Person } from "./vocab-jHKm_LJ6.mjs";
4
- import { t as esm_default } from "./esm-DtAfYdqR.mjs";
5
- import { n as getActorHandle } from "./actor-C93GLWk5.mjs";
6
- import { t as lookupObject } from "./lookup-C4i0dNeY.mjs";
3
+ import { t as esm_default } from "./esm-BIqRhjGA.mjs";
4
+ import { n as getActorHandle } from "./actor-BjUFWXfi.mjs";
5
+ import { F as Person } from "./vocab-BMEyHiOV.mjs";
6
+ import { t as lookupObject } from "./lookup-BQqIkZ5j.mjs";
7
7
  import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
8
8
  import { mockDocumentLoader, test } from "@fedify/fixture";
9
9
  import { deepStrictEqual, equal, rejects } from "node:assert/strict";
10
10
  import { FetchError, parseIri } from "@fedify/vocab-runtime";
11
11
  //#region src/portable-lookup.test.ts
12
+ const allowPrivateAddress = { allowPrivateAddress: true };
12
13
  const did = "did:key:z6Mkabc";
13
14
  const actorId = `ap+ef61://${did}/actor`;
14
15
  const gatewayPath = `/.well-known/apgateway/${did}/actor`;
@@ -72,6 +73,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
72
73
  const actor = await lookupObject("@alice@example.com", {
73
74
  documentLoader,
74
75
  contextLoader: mockDocumentLoader,
76
+ ...allowPrivateAddress,
75
77
  verifyPortableObject
76
78
  });
77
79
  assertInstanceOf(actor, Person);
@@ -94,6 +96,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
94
96
  assertInstanceOf(await lookupObject("@alice@example.com", {
95
97
  documentLoader,
96
98
  contextLoader: mockDocumentLoader,
99
+ ...allowPrivateAddress,
97
100
  verifyPortableObject: createVerifier()
98
101
  }), Person);
99
102
  deepStrictEqual(documentLoader.fetched, [compatibleId, hinted]);
@@ -106,6 +109,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
106
109
  assertInstanceOf(await lookupObject("@alice@example.com", {
107
110
  documentLoader,
108
111
  contextLoader: mockDocumentLoader,
112
+ ...allowPrivateAddress,
109
113
  verifyPortableObject: createVerifier(),
110
114
  gateways: ["https://second.example"]
111
115
  }), Person);
@@ -118,6 +122,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
118
122
  equal(await lookupObject("@alice@example.com", {
119
123
  documentLoader,
120
124
  contextLoader: mockDocumentLoader,
125
+ ...allowPrivateAddress,
121
126
  verifyPortableObject: createVerifier(),
122
127
  gateways: Array.from({ length: 6 }, (_, i) => `https://g${i}.example`)
123
128
  }), null);
@@ -136,6 +141,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
136
141
  assertInstanceOf(await lookupObject("@alice@example.com", {
137
142
  documentLoader,
138
143
  contextLoader: mockDocumentLoader,
144
+ ...allowPrivateAddress,
139
145
  verifyPortableObject: createVerifier()
140
146
  }), Person);
141
147
  deepStrictEqual(documentLoader.fetched, [compatibleId, other]);
@@ -149,6 +155,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
149
155
  const actor = await lookupObject("@alice@example.com", {
150
156
  documentLoader,
151
157
  contextLoader: mockDocumentLoader,
158
+ ...allowPrivateAddress,
152
159
  verifyPortableObject
153
160
  });
154
161
  assertInstanceOf(actor, Person);
@@ -169,18 +176,21 @@ test("lookupObject() with FEP-ef61 portable actors", {
169
176
  equal(await lookupObject("@alice@example.com", {
170
177
  documentLoader,
171
178
  contextLoader: mockDocumentLoader,
179
+ ...allowPrivateAddress,
172
180
  verifyPortableObject
173
181
  }), null);
174
182
  deepStrictEqual(documentLoader.fetched, [compatibleId]);
175
183
  await rejects(() => lookupObject("@alice@example.com", {
176
184
  documentLoader,
177
185
  contextLoader: mockDocumentLoader,
186
+ ...allowPrivateAddress,
178
187
  verifyPortableObject,
179
188
  crossOrigin: "throw"
180
189
  }), { name: "PortableObjectRejectedError" });
181
190
  equal(await lookupObject("@alice@example.com", {
182
191
  documentLoader,
183
192
  contextLoader: mockDocumentLoader,
193
+ ...allowPrivateAddress,
184
194
  verifyPortableObject,
185
195
  crossOrigin: "trust"
186
196
  }), null);
@@ -193,17 +203,20 @@ test("lookupObject() with FEP-ef61 portable actors", {
193
203
  for (const crossOrigin of ["ignore", "trust"]) equal(await lookupObject("@alice@example.com", {
194
204
  documentLoader,
195
205
  contextLoader: mockDocumentLoader,
206
+ ...allowPrivateAddress,
196
207
  crossOrigin
197
208
  }), null);
198
209
  deepStrictEqual(documentLoader.fetched, [compatibleId, compatibleId]);
199
210
  await rejects(() => lookupObject("@alice@example.com", {
200
211
  documentLoader,
201
212
  contextLoader: mockDocumentLoader,
213
+ ...allowPrivateAddress,
202
214
  crossOrigin: "throw"
203
215
  }), /has a different origin than the document URL/);
204
216
  const actor = await lookupObject("@alice@example.com", {
205
217
  documentLoader: createLoader({ [compatibleId]: person(compatibleId) }),
206
- contextLoader: mockDocumentLoader
218
+ contextLoader: mockDocumentLoader,
219
+ ...allowPrivateAddress
207
220
  });
208
221
  assertInstanceOf(actor, Person);
209
222
  deepStrictEqual(actor.id, new URL(compatibleId));
@@ -211,7 +224,8 @@ test("lookupObject() with FEP-ef61 portable actors", {
211
224
  const ordinaryLoader = createLoader({ [malformed]: person(malformed) });
212
225
  assertInstanceOf(await lookupObject(malformed, {
213
226
  documentLoader: ordinaryLoader,
214
- contextLoader: mockDocumentLoader
227
+ contextLoader: mockDocumentLoader,
228
+ ...allowPrivateAddress
215
229
  }), Person);
216
230
  deepStrictEqual(ordinaryLoader.fetched, [malformed]);
217
231
  });
@@ -222,6 +236,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
222
236
  const options = {
223
237
  documentLoader,
224
238
  contextLoader: mockDocumentLoader,
239
+ ...allowPrivateAddress,
225
240
  verifyPortableObject: createVerifier()
226
241
  };
227
242
  equal(await lookupObject("@alice@example.com", options), null);
@@ -235,6 +250,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
235
250
  const options = {
236
251
  documentLoader,
237
252
  contextLoader: mockDocumentLoader,
253
+ ...allowPrivateAddress,
238
254
  verifyPortableObject: createVerifier()
239
255
  };
240
256
  equal(await lookupObject(dotted, options), null);
@@ -250,6 +266,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
250
266
  equal(await lookupObject("@alice@example.com", {
251
267
  documentLoader,
252
268
  contextLoader: mockDocumentLoader,
269
+ ...allowPrivateAddress,
253
270
  verifyPortableObject: createVerifier()
254
271
  }), null);
255
272
  deepStrictEqual(documentLoader.fetched, [compatibleId, ...[
@@ -271,6 +288,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
271
288
  equal(await lookupObject("@alice@example.com", {
272
289
  documentLoader,
273
290
  contextLoader: mockDocumentLoader,
291
+ ...allowPrivateAddress,
274
292
  verifyPortableObject,
275
293
  signal: controller.signal
276
294
  }), null);
@@ -405,12 +423,18 @@ test("getActorHandle() with FEP-ef61 portable actors", {
405
423
  await t.step("verified through the first gateway", async () => {
406
424
  esm_default.removeRoutes();
407
425
  esm_default.get("https://example.com/.well-known/webfinger?resource=acct%3Aalice%40example.com", selfLinks(compatibleId));
408
- deepStrictEqual(await getActorHandle(actor), "@alice@example.com");
426
+ deepStrictEqual(await getActorHandle(actor, {
427
+ ...allowPrivateAddress,
428
+ userAgent: void 0
429
+ }), "@alice@example.com");
409
430
  });
410
431
  await t.step("canonical self link", async () => {
411
432
  esm_default.removeRoutes();
412
433
  esm_default.get(webFingerPrefix, selfLinks(`ap://${did}/actor`));
413
- deepStrictEqual(await getActorHandle(actor), "@alice@example.com");
434
+ deepStrictEqual(await getActorHandle(actor, {
435
+ ...allowPrivateAddress,
436
+ userAgent: void 0
437
+ }), "@alice@example.com");
414
438
  });
415
439
  await t.step("follows a verified subject", async () => {
416
440
  esm_default.removeRoutes();
@@ -422,14 +446,20 @@ test("getActorHandle() with FEP-ef61 portable actors", {
422
446
  ...selfLinks(compatibleId),
423
447
  subject: "acct:alice@example.org"
424
448
  });
425
- deepStrictEqual(await getActorHandle(actor), "@alice@example.org");
449
+ deepStrictEqual(await getActorHandle(actor, {
450
+ ...allowPrivateAddress,
451
+ userAgent: void 0
452
+ }), "@alice@example.org");
426
453
  esm_default.removeRoutes();
427
454
  esm_default.get(webFingerPrefix, {
428
455
  ...selfLinks(compatibleId),
429
456
  subject: "acct:alice@example.org"
430
457
  });
431
458
  esm_default.get("begin:https://example.org/.well-known/webfinger", selfLinks(`ap://${did}/other`));
432
- deepStrictEqual(await getActorHandle(actor), "@alice@example.com");
459
+ deepStrictEqual(await getActorHandle(actor, {
460
+ ...allowPrivateAddress,
461
+ userAgent: void 0
462
+ }), "@alice@example.com");
433
463
  });
434
464
  await t.step("rejects a WebFinger response for another actor", async () => {
435
465
  for (const jrd of [
@@ -442,13 +472,19 @@ test("getActorHandle() with FEP-ef61 portable actors", {
442
472
  ]) {
443
473
  esm_default.removeRoutes();
444
474
  esm_default.get(webFingerPrefix, jrd);
445
- await rejects(() => getActorHandle(actor), TypeError);
475
+ await rejects(() => getActorHandle(actor, {
476
+ ...allowPrivateAddress,
477
+ userAgent: void 0
478
+ }), TypeError);
446
479
  }
447
480
  });
448
481
  await t.step("does not fall back when WebFinger fails", async () => {
449
482
  esm_default.removeRoutes();
450
483
  esm_default.get(webFingerPrefix, 404);
451
- await rejects(() => getActorHandle(actor), TypeError);
484
+ await rejects(() => getActorHandle(actor, {
485
+ ...allowPrivateAddress,
486
+ userAgent: void 0
487
+ }), TypeError);
452
488
  });
453
489
  await t.step("not enough information", async () => {
454
490
  esm_default.removeRoutes();
@@ -463,7 +499,10 @@ test("getActorHandle() with FEP-ef61 portable actors", {
463
499
  id: parseIri(actorId),
464
500
  gateways: [new URL("https://example.com")]
465
501
  })
466
- ]) await rejects(() => getActorHandle(target), TypeError);
502
+ ]) await rejects(() => getActorHandle(target, {
503
+ ...allowPrivateAddress,
504
+ userAgent: void 0
505
+ }), TypeError);
467
506
  deepStrictEqual(esm_default.callHistory.calls().length, 0);
468
507
  });
469
508
  } finally {
@@ -0,0 +1,37 @@
1
+ import "temporal-polyfill";
2
+ globalThis.addEventListener = () => {};
3
+ import { createRequire } from "node:module";
4
+ //#region \0rolldown/runtime.js
5
+ var __create = Object.create;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
12
+ var __exportAll = (all, no_symbols) => {
13
+ let target = {};
14
+ for (var name in all) __defProp(target, name, {
15
+ get: all[name],
16
+ enumerable: true
17
+ });
18
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
19
+ return target;
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
23
+ key = keys[i];
24
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
25
+ get: ((k) => from[k]).bind(null, key),
26
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
27
+ });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
32
+ value: mod,
33
+ enumerable: true
34
+ }) : target, mod));
35
+ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
36
+ //#endregion
37
+ export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
@@ -1,6 +1,6 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { M as OrderedCollection, Z as vocab_exports, i as Announce, k as Note, u as Create, z as Question } from "./vocab-jHKm_LJ6.mjs";
3
+ import { M as OrderedCollection, Z as vocab_exports, i as Announce, k as Note, u as Create, z as Question } from "./vocab-BMEyHiOV.mjs";
4
4
  import { mockDocumentLoader, test } from "@fedify/fixture";
5
5
  import { deepStrictEqual, ok } from "node:assert/strict";
6
6
  import { isMarkerSafeContext, retainSignedRepresentation } from "@fedify/vocab-runtime/internal/signed-representation";
@@ -1,8 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import "./vocab-jHKm_LJ6.mjs";
4
- import "./actor-C93GLWk5.mjs";
5
- import "./lookup-C4i0dNeY.mjs";
3
+ import "./actor-BjUFWXfi.mjs";
4
+ import "./vocab-BMEyHiOV.mjs";
5
+ import "./lookup-BQqIkZ5j.mjs";
6
6
  import { LanguageString as LanguageString$1 } from "@fedify/vocab-runtime";
7
7
  new URL("https://www.w3.org/ns/activitystreams#Public");
8
8
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Object$1, E as Link, F as Person, K as Translation, L as PropertyValue, P as Organization, U as Service, a as Application, b as Group, k as Note, o as Article, q as Update, s as Collection, u as Create } from "./vocab-jHKm_LJ6.mjs";
4
- import { t as LanguageString$1 } from "./src-Dn87CPDV.mjs";
3
+ import { A as Object$1, E as Link, F as Person, K as Translation, L as PropertyValue, P as Organization, U as Service, a as Application, b as Group, k as Note, o as Article, q as Update, s as Collection, u as Create } from "./vocab-BMEyHiOV.mjs";
4
+ import { t as LanguageString$1 } from "./src-DQiQQv6h.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, ok, rejects } from "node:assert/strict";
7
7
  import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { E as Link, F as Person, X as isEntityType, Y as getEntityTypeById } from "./vocab-jHKm_LJ6.mjs";
4
3
  import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
4
+ import { E as Link, F as Person, X as isEntityType, Y as getEntityTypeById } from "./vocab-BMEyHiOV.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual } from "node:assert/strict";
7
7
  //#region src/type.test.ts