@fedify/vocab 2.3.6 → 2.3.8
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 +219 -219
- package/dist/mod.js +219 -219
- package/dist-tests/{actor-C4X6yD9H.mjs → actor-BUJ-Peev.mjs} +2 -2
- package/dist-tests/actor.test.mjs +41 -41
- package/dist-tests/lookup.test.mjs +2 -2
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/{vocab-FEjLRx2a.mjs → vocab-BqrsACvD.mjs} +218 -218
- package/dist-tests/vocab.test.mjs +1 -1
- package/package.json +4 -4
- package/src/actor.test.ts +41 -40
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { B as __commonJSMin, E as Person, H as __toESM, P as Service, T as Organization, a as Application, m as Group } from "./vocab-
|
|
3
|
+
import { B as __commonJSMin, E as Person, H as __toESM, P as Service, T as Organization, a as Application, m as Group } from "./vocab-BqrsACvD.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.3.
|
|
1209
|
+
var version = "2.3.8";
|
|
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 { E as Person, P as Service, T as Organization, V as __exportAll, a as Application, m as Group } from "./vocab-
|
|
4
|
-
import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-
|
|
3
|
+
import { E as Person, P as Service, T as Organization, V as __exportAll, a as Application, m as Group } from "./vocab-BqrsACvD.mjs";
|
|
4
|
+
import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-BUJ-Peev.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
|
|
@@ -5643,50 +5643,50 @@ test({
|
|
|
5643
5643
|
},
|
|
5644
5644
|
async fn(t) {
|
|
5645
5645
|
esm_default.spyGlobal();
|
|
5646
|
-
esm_default.get("begin:https://
|
|
5647
|
-
body: { subject: "acct:johndoe@
|
|
5646
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5647
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5648
5648
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5649
5649
|
});
|
|
5650
|
-
const actorId = new URL("https://
|
|
5650
|
+
const actorId = new URL("https://1.1.1.1/@john");
|
|
5651
5651
|
const actor = new Person({
|
|
5652
5652
|
id: actorId,
|
|
5653
5653
|
preferredUsername: "john"
|
|
5654
5654
|
});
|
|
5655
5655
|
await t.step("WebFinger subject", async () => {
|
|
5656
|
-
deepStrictEqual(await getActorHandle(actor), "@johndoe@
|
|
5657
|
-
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@
|
|
5658
|
-
deepStrictEqual(await getActorHandle(actorId), "@johndoe@
|
|
5659
|
-
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@
|
|
5656
|
+
deepStrictEqual(await getActorHandle(actor), "@johndoe@1.1.1.1");
|
|
5657
|
+
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5658
|
+
deepStrictEqual(await getActorHandle(actorId), "@johndoe@1.1.1.1");
|
|
5659
|
+
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5660
5660
|
});
|
|
5661
5661
|
esm_default.removeRoutes();
|
|
5662
|
-
esm_default.get("begin:https://
|
|
5662
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5663
5663
|
body: {
|
|
5664
|
-
subject: "https://
|
|
5665
|
-
aliases: ["acct:john@
|
|
5664
|
+
subject: "https://1.1.1.1/@john",
|
|
5665
|
+
aliases: ["acct:john@8.8.8.8", "acct:johndoe@1.1.1.1"]
|
|
5666
5666
|
},
|
|
5667
5667
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5668
5668
|
});
|
|
5669
5669
|
await t.step("WebFinger aliases", async () => {
|
|
5670
|
-
deepStrictEqual(await getActorHandle(actor), "@johndoe@
|
|
5671
|
-
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@
|
|
5672
|
-
deepStrictEqual(await getActorHandle(actorId), "@johndoe@
|
|
5673
|
-
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@
|
|
5670
|
+
deepStrictEqual(await getActorHandle(actor), "@johndoe@1.1.1.1");
|
|
5671
|
+
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5672
|
+
deepStrictEqual(await getActorHandle(actorId), "@johndoe@1.1.1.1");
|
|
5673
|
+
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5674
5674
|
});
|
|
5675
|
-
esm_default.get("begin:https://
|
|
5675
|
+
esm_default.get("begin:https://8.8.8.8/.well-known/webfinger?", {
|
|
5676
5676
|
body: {
|
|
5677
|
-
subject: "acct:john@
|
|
5678
|
-
aliases: ["https://
|
|
5677
|
+
subject: "acct:john@8.8.8.8",
|
|
5678
|
+
aliases: ["https://1.1.1.1/@john"]
|
|
5679
5679
|
},
|
|
5680
5680
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5681
5681
|
});
|
|
5682
5682
|
await t.step("cross-origin WebFinger resources", async () => {
|
|
5683
|
-
deepStrictEqual(await getActorHandle(actor), "@john@
|
|
5683
|
+
deepStrictEqual(await getActorHandle(actor), "@john@8.8.8.8");
|
|
5684
5684
|
});
|
|
5685
5685
|
esm_default.removeRoutes();
|
|
5686
|
-
esm_default.get("begin:https://
|
|
5686
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", { status: 404 });
|
|
5687
5687
|
await t.step("no WebFinger", async () => {
|
|
5688
|
-
deepStrictEqual(await getActorHandle(actor), "@john@
|
|
5689
|
-
rejects(() => getActorHandle(actorId), TypeError);
|
|
5688
|
+
deepStrictEqual(await getActorHandle(actor), "@john@1.1.1.1");
|
|
5689
|
+
await rejects(() => getActorHandle(actorId), TypeError);
|
|
5690
5690
|
});
|
|
5691
5691
|
esm_default.hardReset();
|
|
5692
5692
|
}
|
|
@@ -5697,25 +5697,25 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5697
5697
|
} }, async (t) => {
|
|
5698
5698
|
esm_default.spyGlobal();
|
|
5699
5699
|
try {
|
|
5700
|
-
const actorId = new URL("https://
|
|
5700
|
+
const actorId = new URL("https://1.1.1.1/@john");
|
|
5701
5701
|
const actor = new Person({
|
|
5702
5702
|
id: actorId,
|
|
5703
5703
|
preferredUsername: "john"
|
|
5704
5704
|
});
|
|
5705
5705
|
await t.step("records result=resolved on a successful lookup", async () => {
|
|
5706
5706
|
esm_default.removeRoutes();
|
|
5707
|
-
esm_default.get("begin:https://
|
|
5708
|
-
body: { subject: "acct:johndoe@
|
|
5707
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5708
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5709
5709
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5710
5710
|
});
|
|
5711
5711
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5712
|
-
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@johndoe@
|
|
5712
|
+
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@johndoe@1.1.1.1");
|
|
5713
5713
|
const counters = recorder.getMeasurements("activitypub.actor.discovery");
|
|
5714
5714
|
deepStrictEqual(counters.length, 1);
|
|
5715
5715
|
deepStrictEqual(counters[0].type, "counter");
|
|
5716
5716
|
deepStrictEqual(counters[0].value, 1);
|
|
5717
5717
|
deepStrictEqual(counters[0].attributes["activitypub.actor.discovery.result"], "resolved");
|
|
5718
|
-
deepStrictEqual(counters[0].attributes["activitypub.remote.host"], "
|
|
5718
|
+
deepStrictEqual(counters[0].attributes["activitypub.remote.host"], "1.1.1.1");
|
|
5719
5719
|
const durations = recorder.getMeasurements("activitypub.actor.discovery.duration");
|
|
5720
5720
|
deepStrictEqual(durations.length, 1);
|
|
5721
5721
|
deepStrictEqual(durations[0].type, "histogram");
|
|
@@ -5724,40 +5724,40 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5724
5724
|
});
|
|
5725
5725
|
await t.step("records result=resolved when WebFinger is missing but preferredUsername fallback succeeds", async () => {
|
|
5726
5726
|
esm_default.removeRoutes();
|
|
5727
|
-
esm_default.get("begin:https://
|
|
5727
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", { status: 404 });
|
|
5728
5728
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5729
|
-
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@john@
|
|
5729
|
+
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@john@1.1.1.1");
|
|
5730
5730
|
const counter = recorder.getMeasurement("activitypub.actor.discovery");
|
|
5731
5731
|
ok(counter != null);
|
|
5732
5732
|
deepStrictEqual(counter.attributes["activitypub.actor.discovery.result"], "resolved");
|
|
5733
5733
|
});
|
|
5734
5734
|
await t.step("records result=not_found when neither WebFinger nor preferredUsername yields a handle", async () => {
|
|
5735
5735
|
esm_default.removeRoutes();
|
|
5736
|
-
esm_default.get("begin:https://
|
|
5736
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", { status: 404 });
|
|
5737
5737
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5738
5738
|
await rejects(() => getActorHandle(actorId, { meterProvider }), TypeError);
|
|
5739
5739
|
const counter = recorder.getMeasurement("activitypub.actor.discovery");
|
|
5740
5740
|
ok(counter != null);
|
|
5741
5741
|
deepStrictEqual(counter.attributes["activitypub.actor.discovery.result"], "not_found");
|
|
5742
|
-
deepStrictEqual(counter.attributes["activitypub.remote.host"], "
|
|
5742
|
+
deepStrictEqual(counter.attributes["activitypub.remote.host"], "1.1.1.1");
|
|
5743
5743
|
const duration = recorder.getMeasurement("activitypub.actor.discovery.duration");
|
|
5744
5744
|
ok(duration != null);
|
|
5745
5745
|
deepStrictEqual(duration.attributes["activitypub.actor.discovery.result"], "not_found");
|
|
5746
5746
|
});
|
|
5747
5747
|
await t.step("records non-default ports for actor IDs", async () => {
|
|
5748
5748
|
esm_default.removeRoutes();
|
|
5749
|
-
esm_default.get("begin:https://
|
|
5749
|
+
esm_default.get("begin:https://1.1.1.1:8443/.well-known/webfinger?", { status: 404 });
|
|
5750
5750
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5751
|
-
await rejects(() => getActorHandle(new URL("https://
|
|
5751
|
+
await rejects(() => getActorHandle(new URL("https://1.1.1.1:8443/@john"), { meterProvider }), TypeError);
|
|
5752
5752
|
const counter = recorder.getMeasurement("activitypub.actor.discovery");
|
|
5753
5753
|
ok(counter != null);
|
|
5754
|
-
deepStrictEqual(counter.attributes["activitypub.remote.host"], "
|
|
5754
|
+
deepStrictEqual(counter.attributes["activitypub.remote.host"], "1.1.1.1:8443");
|
|
5755
5755
|
});
|
|
5756
5756
|
await t.step("records result=error when a malformed WebFinger alias throws TypeError", async () => {
|
|
5757
5757
|
esm_default.removeRoutes();
|
|
5758
|
-
esm_default.get("begin:https://
|
|
5758
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5759
5759
|
body: {
|
|
5760
|
-
subject: "https://
|
|
5760
|
+
subject: "https://1.1.1.1/@john",
|
|
5761
5761
|
aliases: ["acct:john@["]
|
|
5762
5762
|
},
|
|
5763
5763
|
headers: { "Content-Type": "application/jrd+json" }
|
|
@@ -5770,8 +5770,8 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5770
5770
|
});
|
|
5771
5771
|
await t.step("propagates meterProvider into the nested webfinger.lookup", async () => {
|
|
5772
5772
|
esm_default.removeRoutes();
|
|
5773
|
-
esm_default.get("begin:https://
|
|
5774
|
-
body: { subject: "acct:johndoe@
|
|
5773
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5774
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5775
5775
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5776
5776
|
});
|
|
5777
5777
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
@@ -5782,8 +5782,8 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5782
5782
|
});
|
|
5783
5783
|
await t.step("omits measurements when no meterProvider is provided", async () => {
|
|
5784
5784
|
esm_default.removeRoutes();
|
|
5785
|
-
esm_default.get("begin:https://
|
|
5786
|
-
body: { subject: "acct:johndoe@
|
|
5785
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5786
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5787
5787
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5788
5788
|
});
|
|
5789
5789
|
const [_unused, recorder] = createTestMeterProvider();
|
|
@@ -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-
|
|
4
|
-
import { c as esm_default, i as isActor, o as name, s as version } from "./actor-
|
|
3
|
+
import { E as Person, S as Object$1, o as Collection, x as Note } from "./vocab-BqrsACvD.mjs";
|
|
4
|
+
import { c as esm_default, i as isActor, o as name, s as version } from "./actor-BUJ-Peev.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";
|
package/dist-tests/type.test.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { E as Person, L as getEntityTypeById, R as isEntityType, y as Link } from "./vocab-
|
|
3
|
+
import { E as Person, L as getEntityTypeById, R as isEntityType, y as Link } from "./vocab-BqrsACvD.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";
|