@fedify/vocab 2.5.0-dev.2448 → 2.5.0-dev.2494
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/mod.cjs +80 -3
- package/dist/mod.d.cts +75 -0
- package/dist/mod.d.ts +75 -0
- package/dist/mod.js +80 -3
- package/dist-tests/{actor-C93GLWk5.mjs → actor-CW4MtXG3.mjs} +6 -4
- package/dist-tests/actor.test.mjs +4 -3
- package/dist-tests/{esm-DtAfYdqR.mjs → esm-BIqRhjGA.mjs} +1 -1
- package/dist-tests/gateway.test.mjs +4 -4
- package/dist-tests/license.test.mjs +2 -2
- package/dist-tests/{lookup-C4i0dNeY.mjs → lookup-DFHFanoB.mjs} +2 -2
- package/dist-tests/lookup.test.mjs +35 -15
- package/dist-tests/portable-lookup.test.mjs +52 -13
- package/dist-tests/rolldown-runtime-BWJg4WE8.mjs +37 -0
- package/dist-tests/signed-representation.test.mjs +1 -1
- package/dist-tests/{src-Dn87CPDV.mjs → src-CiJ-s7w0.mjs} +3 -3
- package/dist-tests/translation.test.mjs +2 -2
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/undici-D88PC0XH.mjs +22898 -0
- package/dist-tests/{vocab-jHKm_LJ6.mjs → vocab-BMEyHiOV.mjs} +77 -34
- package/dist-tests/vocab.test.mjs +6064 -8
- package/package.json +5 -5
- package/src/actor.ts +4 -0
- package/src/gateway.test.ts +1 -1
- package/src/lookup.test.ts +37 -11
- package/src/portable-lookup.test.ts +72 -7
- package/src/vocab.test.ts +40 -5
package/dist/mod.js
CHANGED
|
@@ -12,7 +12,7 @@ import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/tem
|
|
|
12
12
|
import { delay } from "es-toolkit";
|
|
13
13
|
//#region deno.json
|
|
14
14
|
var name = "@fedify/vocab";
|
|
15
|
-
var version = "2.5.0-dev.
|
|
15
|
+
var version = "2.5.0-dev.2494+f2e9b5d3";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/type.ts
|
|
18
18
|
function getTypeId(object) {
|
|
@@ -352,6 +352,11 @@ var Object$1 = class Object$1 {
|
|
|
352
352
|
get _warning() {
|
|
353
353
|
return this.#warning;
|
|
354
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
357
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
358
|
+
* accessor name and its getter/setter semantics stable.
|
|
359
|
+
*/
|
|
355
360
|
get _cachedJsonLd() {
|
|
356
361
|
return this.#cachedJsonLd;
|
|
357
362
|
}
|
|
@@ -14036,6 +14041,11 @@ var PropertyValue = class {
|
|
|
14036
14041
|
get _warning() {
|
|
14037
14042
|
return this.#warning;
|
|
14038
14043
|
}
|
|
14044
|
+
/**
|
|
14045
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
14046
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
14047
|
+
* accessor name and its getter/setter semantics stable.
|
|
14048
|
+
*/
|
|
14039
14049
|
get _cachedJsonLd() {
|
|
14040
14050
|
return this.#cachedJsonLd;
|
|
14041
14051
|
}
|
|
@@ -14413,6 +14423,11 @@ var Measure = class {
|
|
|
14413
14423
|
get _warning() {
|
|
14414
14424
|
return this.#warning;
|
|
14415
14425
|
}
|
|
14426
|
+
/**
|
|
14427
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
14428
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
14429
|
+
* accessor name and its getter/setter semantics stable.
|
|
14430
|
+
*/
|
|
14416
14431
|
get _cachedJsonLd() {
|
|
14417
14432
|
return this.#cachedJsonLd;
|
|
14418
14433
|
}
|
|
@@ -15811,6 +15826,11 @@ var InteractionPolicy = class {
|
|
|
15811
15826
|
get _warning() {
|
|
15812
15827
|
return this.#warning;
|
|
15813
15828
|
}
|
|
15829
|
+
/**
|
|
15830
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
15831
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
15832
|
+
* accessor name and its getter/setter semantics stable.
|
|
15833
|
+
*/
|
|
15814
15834
|
get _cachedJsonLd() {
|
|
15815
15835
|
return this.#cachedJsonLd;
|
|
15816
15836
|
}
|
|
@@ -16324,6 +16344,11 @@ var InteractionRule = class {
|
|
|
16324
16344
|
get _warning() {
|
|
16325
16345
|
return this.#warning;
|
|
16326
16346
|
}
|
|
16347
|
+
/**
|
|
16348
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
16349
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
16350
|
+
* accessor name and its getter/setter semantics stable.
|
|
16351
|
+
*/
|
|
16327
16352
|
get _cachedJsonLd() {
|
|
16328
16353
|
return this.#cachedJsonLd;
|
|
16329
16354
|
}
|
|
@@ -19800,6 +19825,11 @@ var Translation = class {
|
|
|
19800
19825
|
get _warning() {
|
|
19801
19826
|
return this.#warning;
|
|
19802
19827
|
}
|
|
19828
|
+
/**
|
|
19829
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
19830
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
19831
|
+
* accessor name and its getter/setter semantics stable.
|
|
19832
|
+
*/
|
|
19803
19833
|
get _cachedJsonLd() {
|
|
19804
19834
|
return this.#cachedJsonLd;
|
|
19805
19835
|
}
|
|
@@ -27485,6 +27515,11 @@ var DidService = class {
|
|
|
27485
27515
|
get _warning() {
|
|
27486
27516
|
return this.#warning;
|
|
27487
27517
|
}
|
|
27518
|
+
/**
|
|
27519
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
27520
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
27521
|
+
* accessor name and its getter/setter semantics stable.
|
|
27522
|
+
*/
|
|
27488
27523
|
get _cachedJsonLd() {
|
|
27489
27524
|
return this.#cachedJsonLd;
|
|
27490
27525
|
}
|
|
@@ -28001,6 +28036,11 @@ var DataIntegrityProof = class {
|
|
|
28001
28036
|
get _warning() {
|
|
28002
28037
|
return this.#warning;
|
|
28003
28038
|
}
|
|
28039
|
+
/**
|
|
28040
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
28041
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
28042
|
+
* accessor name and its getter/setter semantics stable.
|
|
28043
|
+
*/
|
|
28004
28044
|
get _cachedJsonLd() {
|
|
28005
28045
|
return this.#cachedJsonLd;
|
|
28006
28046
|
}
|
|
@@ -28692,6 +28732,11 @@ var CryptographicKey = class {
|
|
|
28692
28732
|
get _warning() {
|
|
28693
28733
|
return this.#warning;
|
|
28694
28734
|
}
|
|
28735
|
+
/**
|
|
28736
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
28737
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
28738
|
+
* accessor name and its getter/setter semantics stable.
|
|
28739
|
+
*/
|
|
28695
28740
|
get _cachedJsonLd() {
|
|
28696
28741
|
return this.#cachedJsonLd;
|
|
28697
28742
|
}
|
|
@@ -29364,6 +29409,11 @@ var Multikey = class {
|
|
|
29364
29409
|
get _warning() {
|
|
29365
29410
|
return this.#warning;
|
|
29366
29411
|
}
|
|
29412
|
+
/**
|
|
29413
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
29414
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
29415
|
+
* accessor name and its getter/setter semantics stable.
|
|
29416
|
+
*/
|
|
29367
29417
|
get _cachedJsonLd() {
|
|
29368
29418
|
return this.#cachedJsonLd;
|
|
29369
29419
|
}
|
|
@@ -30436,6 +30486,11 @@ var Commitment = class {
|
|
|
30436
30486
|
get _warning() {
|
|
30437
30487
|
return this.#warning;
|
|
30438
30488
|
}
|
|
30489
|
+
/**
|
|
30490
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
30491
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
30492
|
+
* accessor name and its getter/setter semantics stable.
|
|
30493
|
+
*/
|
|
30439
30494
|
get _cachedJsonLd() {
|
|
30440
30495
|
return this.#cachedJsonLd;
|
|
30441
30496
|
}
|
|
@@ -30827,6 +30882,11 @@ var Intent = class {
|
|
|
30827
30882
|
get _warning() {
|
|
30828
30883
|
return this.#warning;
|
|
30829
30884
|
}
|
|
30885
|
+
/**
|
|
30886
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
30887
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
30888
|
+
* accessor name and its getter/setter semantics stable.
|
|
30889
|
+
*/
|
|
30830
30890
|
get _cachedJsonLd() {
|
|
30831
30891
|
return this.#cachedJsonLd;
|
|
30832
30892
|
}
|
|
@@ -42251,6 +42311,11 @@ var Endpoints = class {
|
|
|
42251
42311
|
get _warning() {
|
|
42252
42312
|
return this.#warning;
|
|
42253
42313
|
}
|
|
42314
|
+
/**
|
|
42315
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
42316
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
42317
|
+
* accessor name and its getter/setter semantics stable.
|
|
42318
|
+
*/
|
|
42254
42319
|
get _cachedJsonLd() {
|
|
42255
42320
|
return this.#cachedJsonLd;
|
|
42256
42321
|
}
|
|
@@ -49032,6 +49097,11 @@ var Link = class Link {
|
|
|
49032
49097
|
get _warning() {
|
|
49033
49098
|
return this.#warning;
|
|
49034
49099
|
}
|
|
49100
|
+
/**
|
|
49101
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
49102
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
49103
|
+
* accessor name and its getter/setter semantics stable.
|
|
49104
|
+
*/
|
|
49035
49105
|
get _cachedJsonLd() {
|
|
49036
49106
|
return this.#cachedJsonLd;
|
|
49037
49107
|
}
|
|
@@ -75152,6 +75222,11 @@ var Source = class {
|
|
|
75152
75222
|
get _warning() {
|
|
75153
75223
|
return this.#warning;
|
|
75154
75224
|
}
|
|
75225
|
+
/**
|
|
75226
|
+
* Internal cross-package contract with @fedify/testing, which copies this
|
|
75227
|
+
* cache when attaching document loaders to an activity clone. Keep this
|
|
75228
|
+
* accessor name and its getter/setter semantics stable.
|
|
75229
|
+
*/
|
|
75155
75230
|
get _cachedJsonLd() {
|
|
75156
75231
|
return this.#cachedJsonLd;
|
|
75157
75232
|
}
|
|
@@ -77784,7 +77859,8 @@ async function getPortableActorHandle(actor, actorId, options) {
|
|
|
77784
77859
|
const result = await lookupWebFinger(handle, {
|
|
77785
77860
|
userAgent: options.userAgent,
|
|
77786
77861
|
tracerProvider: options.tracerProvider,
|
|
77787
|
-
meterProvider: options.meterProvider
|
|
77862
|
+
meterProvider: options.meterProvider,
|
|
77863
|
+
allowPrivateAddress: "allowPrivateAddress" in options && options.allowPrivateAddress === true
|
|
77788
77864
|
});
|
|
77789
77865
|
if (result == null || !linksToPortableActor(result, canonicalId)) throw new ActorHandleNotFoundError();
|
|
77790
77866
|
const subject = result.subject?.match(/^acct:([^@]+)@([^@]+)$/);
|
|
@@ -77792,7 +77868,8 @@ async function getPortableActorHandle(actor, actorId, options) {
|
|
|
77792
77868
|
const subjectResult = await lookupWebFinger(result.subject, {
|
|
77793
77869
|
userAgent: options.userAgent,
|
|
77794
77870
|
tracerProvider: options.tracerProvider,
|
|
77795
|
-
meterProvider: options.meterProvider
|
|
77871
|
+
meterProvider: options.meterProvider,
|
|
77872
|
+
allowPrivateAddress: "allowPrivateAddress" in options && options.allowPrivateAddress === true
|
|
77796
77873
|
});
|
|
77797
77874
|
if (subjectResult != null && linksToPortableActor(subjectResult, canonicalId)) return normalizeActorHandle(`@${subject[1]}@${subject[2]}`, options);
|
|
77798
77875
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { F as Person, P as Organization, U as Service, a as Application, b as Group } from "./vocab-jHKm_LJ6.mjs";
|
|
4
3
|
import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
|
|
4
|
+
import { F as Person, P as Organization, U as Service, a as Application, b as Group } from "./vocab-BMEyHiOV.mjs";
|
|
5
5
|
import { canonicalizePortableUri, formatIri, fromCompatibleEf61Id, isGatewayUrl } from "@fedify/vocab-runtime";
|
|
6
6
|
import { lookupWebFinger } from "@fedify/webfinger";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { domainToASCII, domainToUnicode } from "node:url";
|
|
9
9
|
//#region deno.json
|
|
10
10
|
var name = "@fedify/vocab";
|
|
11
|
-
var version = "2.5.0-dev.
|
|
11
|
+
var version = "2.5.0-dev.2494+f2e9b5d3";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/actor.ts
|
|
14
14
|
const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
|
|
@@ -206,7 +206,8 @@ async function getPortableActorHandle(actor, actorId, options) {
|
|
|
206
206
|
const result = await lookupWebFinger(handle, {
|
|
207
207
|
userAgent: options.userAgent,
|
|
208
208
|
tracerProvider: options.tracerProvider,
|
|
209
|
-
meterProvider: options.meterProvider
|
|
209
|
+
meterProvider: options.meterProvider,
|
|
210
|
+
allowPrivateAddress: "allowPrivateAddress" in options && options.allowPrivateAddress === true
|
|
210
211
|
});
|
|
211
212
|
if (result == null || !linksToPortableActor(result, canonicalId)) throw new ActorHandleNotFoundError();
|
|
212
213
|
const subject = result.subject?.match(/^acct:([^@]+)@([^@]+)$/);
|
|
@@ -214,7 +215,8 @@ async function getPortableActorHandle(actor, actorId, options) {
|
|
|
214
215
|
const subjectResult = await lookupWebFinger(result.subject, {
|
|
215
216
|
userAgent: options.userAgent,
|
|
216
217
|
tracerProvider: options.tracerProvider,
|
|
217
|
-
meterProvider: options.meterProvider
|
|
218
|
+
meterProvider: options.meterProvider,
|
|
219
|
+
allowPrivateAddress: "allowPrivateAddress" in options && options.allowPrivateAddress === true
|
|
218
220
|
});
|
|
219
221
|
if (subjectResult != null && linksToPortableActor(subjectResult, canonicalId)) return normalizeActorHandle(`@${subject[1]}@${subject[2]}`, options);
|
|
220
222
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import {
|
|
4
|
-
import { t as esm_default } from "./esm-
|
|
5
|
-
import { a as normalizeActorHandle, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-
|
|
3
|
+
import { n as __exportAll } from "./rolldown-runtime-BWJg4WE8.mjs";
|
|
4
|
+
import { t as esm_default } from "./esm-BIqRhjGA.mjs";
|
|
5
|
+
import { a as normalizeActorHandle, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-CW4MtXG3.mjs";
|
|
6
|
+
import { F as Person, P as Organization, U as Service, a as Application, b as Group } from "./vocab-BMEyHiOV.mjs";
|
|
6
7
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
7
8
|
import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
|
|
8
9
|
//#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import {
|
|
3
|
+
import { i as __toESM, t as __commonJSMin } from "./rolldown-runtime-BWJg4WE8.mjs";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
|
|
6
6
|
var import_glob_to_regexp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as traverseCollection, t as lookupObject } from "./lookup-
|
|
3
|
+
import { t as esm_default } from "./esm-BIqRhjGA.mjs";
|
|
4
|
+
import { F as Person, M as OrderedCollection, S as Image, c as CollectionPage, k as Note, s as Collection, u as Create } from "./vocab-BMEyHiOV.mjs";
|
|
5
|
+
import { r as traverseCollection, t as lookupObject } from "./lookup-DFHFanoB.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
|
|
7
7
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
8
8
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
@@ -597,7 +597,7 @@ test("getObject() sends the ActivityStreams Accept header to gateways", {
|
|
|
597
597
|
});
|
|
598
598
|
try {
|
|
599
599
|
assertInstanceOf(await (await createActivity()).getObject({
|
|
600
|
-
documentLoader: getDocumentLoader(),
|
|
600
|
+
documentLoader: getDocumentLoader({ allowPrivateAddress: true }),
|
|
601
601
|
contextLoader: mockDocumentLoader,
|
|
602
602
|
gateways: ["https://example.com"],
|
|
603
603
|
verifyPortableObject: createVerifier()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { E as Link, F as Person, J as Video, P as Organization, S as Image, U as Service, a as Application, b as Group, k as Note, s as Collection, u as Create, z as Question } from "./vocab-
|
|
4
|
-
import "./src-
|
|
3
|
+
import { E as Link, F as Person, J as Video, P as Organization, S as Image, U as Service, a as Application, b as Group, k as Note, s as Collection, u as Create, z as Question } from "./vocab-BMEyHiOV.mjs";
|
|
4
|
+
import "./src-CiJ-s7w0.mjs";
|
|
5
5
|
import { test } from "@fedify/fixture";
|
|
6
6
|
import { deepStrictEqual, ok } from "node:assert/strict";
|
|
7
7
|
import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import {
|
|
4
|
-
import { i as isActor, o as name, s as version } from "./actor-C93GLWk5.mjs";
|
|
3
|
+
import { i as isActor, o as name, s as version } from "./actor-CW4MtXG3.mjs";
|
|
5
4
|
import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
|
|
5
|
+
import { A as Object$1 } from "./vocab-BMEyHiOV.mjs";
|
|
6
6
|
import { canonicalizePortableUri, formatIri, getDocumentLoader, haveSameFe34Origin, haveSameIriOrigin, parseIri } from "@fedify/vocab-runtime";
|
|
7
7
|
import { lookupWebFinger } from "@fedify/webfinger";
|
|
8
8
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as lookupObserver, r as traverseCollection, t as lookupObject } from "./lookup-
|
|
3
|
+
import { t as esm_default } from "./esm-BIqRhjGA.mjs";
|
|
4
|
+
import { A as Object$1, F as Person, k as Note, s as Collection } from "./vocab-BMEyHiOV.mjs";
|
|
5
|
+
import { n as lookupObserver, r as traverseCollection, t as lookupObject } from "./lookup-DFHFanoB.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
|
|
7
7
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
8
8
|
import { deepStrictEqual, equal, ok, rejects } from "node:assert/strict";
|
|
9
9
|
//#region src/lookup.test.ts
|
|
10
|
+
const allowPrivateAddress = { allowPrivateAddress: true };
|
|
10
11
|
test("lookupObject()", {
|
|
11
12
|
sanitizeResources: false,
|
|
12
13
|
sanitizeOps: false
|
|
13
14
|
}, async (t) => {
|
|
15
|
+
const responseTimers = [];
|
|
14
16
|
esm_default.spyGlobal();
|
|
15
17
|
esm_default.get("begin:https://example.com/.well-known/webfinger", {
|
|
16
18
|
subject: "acct:johndoe@example.com",
|
|
@@ -34,7 +36,8 @@ test("lookupObject()", {
|
|
|
34
36
|
});
|
|
35
37
|
const options = {
|
|
36
38
|
documentLoader: mockDocumentLoader,
|
|
37
|
-
contextLoader: mockDocumentLoader
|
|
39
|
+
contextLoader: mockDocumentLoader,
|
|
40
|
+
...allowPrivateAddress
|
|
38
41
|
};
|
|
39
42
|
await t.step("actor", async () => {
|
|
40
43
|
const person = await lookupObject("@johndoe@example.com", options);
|
|
@@ -73,7 +76,7 @@ test("lookupObject()", {
|
|
|
73
76
|
});
|
|
74
77
|
esm_default.removeRoutes({ includeFallback: false });
|
|
75
78
|
esm_default.get("begin:https://example.com/.well-known/webfinger", () => new Promise((resolve) => {
|
|
76
|
-
setTimeout(() => {
|
|
79
|
+
responseTimers.push(setTimeout(() => {
|
|
77
80
|
resolve({
|
|
78
81
|
subject: "acct:johndoe@example.com",
|
|
79
82
|
links: [{
|
|
@@ -82,7 +85,7 @@ test("lookupObject()", {
|
|
|
82
85
|
type: "application/activity+json"
|
|
83
86
|
}]
|
|
84
87
|
});
|
|
85
|
-
}, 1e3);
|
|
88
|
+
}, 1e3));
|
|
86
89
|
}));
|
|
87
90
|
await t.step("request cancellation", async () => {
|
|
88
91
|
const controller = new AbortController();
|
|
@@ -113,7 +116,7 @@ test("lookupObject()", {
|
|
|
113
116
|
});
|
|
114
117
|
esm_default.removeRoutes({ includeFallback: false });
|
|
115
118
|
esm_default.get("begin:https://example.com/.well-known/webfinger", () => new Promise((resolve) => {
|
|
116
|
-
setTimeout(() => {
|
|
119
|
+
responseTimers.push(setTimeout(() => {
|
|
117
120
|
resolve({
|
|
118
121
|
subject: "acct:johndoe@example.com",
|
|
119
122
|
links: [{
|
|
@@ -122,7 +125,7 @@ test("lookupObject()", {
|
|
|
122
125
|
type: "application/activity+json"
|
|
123
126
|
}]
|
|
124
127
|
});
|
|
125
|
-
}, 500);
|
|
128
|
+
}, 500));
|
|
126
129
|
}));
|
|
127
130
|
await t.step("cancellation with immediate abort", async () => {
|
|
128
131
|
const controller = new AbortController();
|
|
@@ -134,7 +137,7 @@ test("lookupObject()", {
|
|
|
134
137
|
});
|
|
135
138
|
esm_default.removeRoutes({ includeFallback: false });
|
|
136
139
|
esm_default.get("https://example.com/slow-object", () => new Promise((resolve) => {
|
|
137
|
-
setTimeout(() => {
|
|
140
|
+
responseTimers.push(setTimeout(() => {
|
|
138
141
|
resolve({
|
|
139
142
|
status: 200,
|
|
140
143
|
headers: { "Content-Type": "application/activity+json" },
|
|
@@ -144,7 +147,7 @@ test("lookupObject()", {
|
|
|
144
147
|
content: "Slow response"
|
|
145
148
|
}
|
|
146
149
|
});
|
|
147
|
-
}, 1e3);
|
|
150
|
+
}, 1e3));
|
|
148
151
|
}));
|
|
149
152
|
await t.step("direct object fetch cancellation", async () => {
|
|
150
153
|
const controller = new AbortController();
|
|
@@ -155,6 +158,7 @@ test("lookupObject()", {
|
|
|
155
158
|
controller.abort();
|
|
156
159
|
deepStrictEqual(await promise, null);
|
|
157
160
|
});
|
|
161
|
+
for (const timer of responseTimers) clearTimeout(timer);
|
|
158
162
|
esm_default.hardReset();
|
|
159
163
|
esm_default.removeRoutes();
|
|
160
164
|
});
|
|
@@ -392,15 +396,18 @@ test("FEP-fe34: lookupObject() cross-origin security", {
|
|
|
392
396
|
throw new Error(`Unexpected URL: ${url}`);
|
|
393
397
|
};
|
|
394
398
|
deepStrictEqual(await lookupObject("@user@example.com", {
|
|
399
|
+
...allowPrivateAddress,
|
|
395
400
|
documentLoader: webfingerDocumentLoader,
|
|
396
401
|
contextLoader: mockDocumentLoader
|
|
397
402
|
}), null);
|
|
398
403
|
await rejects(() => lookupObject("@user@example.com", {
|
|
404
|
+
...allowPrivateAddress,
|
|
399
405
|
documentLoader: webfingerDocumentLoader,
|
|
400
406
|
contextLoader: mockDocumentLoader,
|
|
401
407
|
crossOrigin: "throw"
|
|
402
408
|
}), Error, "The object's @id (https://malicious.com/fake-actor) has a different origin than the document URL (https://different-origin.com/actor)");
|
|
403
409
|
const result2 = await lookupObject("@user@example.com", {
|
|
410
|
+
...allowPrivateAddress,
|
|
404
411
|
documentLoader: webfingerDocumentLoader,
|
|
405
412
|
contextLoader: mockDocumentLoader,
|
|
406
413
|
crossOrigin: "trust"
|
|
@@ -471,11 +478,20 @@ test("FEP-fe34: lookupObject() cross-origin security", {
|
|
|
471
478
|
const errorDocumentLoader = async (_url) => {
|
|
472
479
|
throw new Error("Network error");
|
|
473
480
|
};
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
481
|
+
esm_default.spyGlobal();
|
|
482
|
+
esm_default.get("begin:https://example.com/.well-known/webfinger", 404);
|
|
483
|
+
let result;
|
|
484
|
+
try {
|
|
485
|
+
result = await lookupObject("https://example.com/note", {
|
|
486
|
+
...allowPrivateAddress,
|
|
487
|
+
documentLoader: errorDocumentLoader,
|
|
488
|
+
contextLoader: mockDocumentLoader,
|
|
489
|
+
crossOrigin: "throw"
|
|
490
|
+
});
|
|
491
|
+
} finally {
|
|
492
|
+
esm_default.hardReset();
|
|
493
|
+
}
|
|
494
|
+
deepStrictEqual(result, null);
|
|
479
495
|
});
|
|
480
496
|
await t.step("malformed JSON handling with cross-origin policy", async () => {
|
|
481
497
|
const malformedJsonDocumentLoader = async (url) => {
|
|
@@ -540,6 +556,7 @@ test("lookupObject() records activitypub.object.lookup counter", {
|
|
|
540
556
|
await t.step("records kind=actor for an actor result", async () => {
|
|
541
557
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
542
558
|
assertInstanceOf(await lookupObject("@johndoe@example.com", {
|
|
559
|
+
...allowPrivateAddress,
|
|
543
560
|
documentLoader: mockDocumentLoader,
|
|
544
561
|
contextLoader: mockDocumentLoader,
|
|
545
562
|
meterProvider
|
|
@@ -593,6 +610,7 @@ test("lookupObject() records activitypub.object.lookup counter", {
|
|
|
593
610
|
});
|
|
594
611
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
595
612
|
deepStrictEqual(await lookupObject("janedoe@example.com", {
|
|
613
|
+
...allowPrivateAddress,
|
|
596
614
|
documentLoader: mockDocumentLoader,
|
|
597
615
|
contextLoader: mockDocumentLoader,
|
|
598
616
|
meterProvider
|
|
@@ -622,6 +640,7 @@ test("lookupObject() records activitypub.object.lookup counter", {
|
|
|
622
640
|
});
|
|
623
641
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
624
642
|
await lookupObject("@johndoe@example.com", {
|
|
643
|
+
...allowPrivateAddress,
|
|
625
644
|
documentLoader: mockDocumentLoader,
|
|
626
645
|
contextLoader: mockDocumentLoader,
|
|
627
646
|
meterProvider
|
|
@@ -643,6 +662,7 @@ test("lookupObject() records activitypub.object.lookup counter", {
|
|
|
643
662
|
});
|
|
644
663
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
645
664
|
await lookupObject(new URL("acct:johndoe@example.com"), {
|
|
665
|
+
...allowPrivateAddress,
|
|
646
666
|
documentLoader: mockDocumentLoader,
|
|
647
667
|
contextLoader: mockDocumentLoader,
|
|
648
668
|
meterProvider
|