@fedify/vocab 2.4.0-dev.2219 → 2.4.0-dev.2233
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 +1 -1
- package/dist/mod.js +1 -1
- package/dist-tests/{actor-DzLs-X1G.mjs → actor-C8V9Eu9k.mjs} +1 -1
- package/dist-tests/actor.test.mjs +1 -1
- package/dist-tests/gateway.test.mjs +17 -2
- package/dist-tests/{lookup-DckWWZgA.mjs → lookup-2QrSuQR0.mjs} +1 -1
- package/dist-tests/lookup.test.mjs +1 -1
- package/dist-tests/portable-lookup.test.mjs +2 -2
- package/dist-tests/translation.test.mjs +2 -2
- package/dist-tests/vocab.test.mjs +3 -1
- package/package.json +4 -4
- package/src/gateway.test.ts +33 -0
- package/src/vocab.test.ts +2 -0
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -36,7 +36,7 @@ let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
|
|
|
36
36
|
let es_toolkit = require("es-toolkit");
|
|
37
37
|
//#region deno.json
|
|
38
38
|
var name = "@fedify/vocab";
|
|
39
|
-
var version = "2.4.0-dev.
|
|
39
|
+
var version = "2.4.0-dev.2233+abb4a6b2";
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/type.ts
|
|
42
42
|
function getTypeId(object) {
|
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.4.0-dev.
|
|
15
|
+
var version = "2.4.0-dev.2233+abb4a6b2";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/type.ts
|
|
18
18
|
function getTypeId(object) {
|
|
@@ -8,7 +8,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.4.0-dev.
|
|
11
|
+
var version = "2.4.0-dev.2233+abb4a6b2";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/actor.ts
|
|
14
14
|
const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
|
|
@@ -2,7 +2,7 @@ import "temporal-polyfill";
|
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { F as Person, P as Organization, Q as __exportAll, U as Service, a as Application, b as Group } from "./vocab-D3C791xF.mjs";
|
|
4
4
|
import { t as esm_default } from "./esm-2_Uqq_my.mjs";
|
|
5
|
-
import { a as normalizeActorHandle, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-
|
|
5
|
+
import { a as normalizeActorHandle, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-C8V9Eu9k.mjs";
|
|
6
6
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
7
7
|
import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
|
|
8
8
|
//#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
|
|
@@ -2,11 +2,11 @@ import "temporal-polyfill";
|
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { F as Person, M as OrderedCollection, S as Image, c as CollectionPage, k as Note, s as Collection, u as Create } from "./vocab-D3C791xF.mjs";
|
|
4
4
|
import { t as esm_default } from "./esm-2_Uqq_my.mjs";
|
|
5
|
-
import { n as traverseCollection, t as lookupObject } from "./lookup-
|
|
5
|
+
import { n as traverseCollection, t as lookupObject } from "./lookup-2QrSuQR0.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";
|
|
9
|
-
import { FetchError, getDocumentLoader, parseIri } from "@fedify/vocab-runtime";
|
|
9
|
+
import { FetchError, getDocumentLoader, parseIri, withGatewayHints } from "@fedify/vocab-runtime";
|
|
10
10
|
//#region src/gateway.test.ts
|
|
11
11
|
const did = "did:key:z6Mkabc";
|
|
12
12
|
const objectId = `ap+ef61://${did}/objects/1`;
|
|
@@ -1887,5 +1887,20 @@ test("accessors pass the verifier of a call on to the objects they fetch", async
|
|
|
1887
1887
|
for (const item of optedOut) ok(getDefaultVerifier(item) == null);
|
|
1888
1888
|
});
|
|
1889
1889
|
});
|
|
1890
|
+
test("getObject() follows location hints made by withGatewayHints()", async () => {
|
|
1891
|
+
const json = await new Create({
|
|
1892
|
+
id: parseIri(`ap://${did}/activities/1`),
|
|
1893
|
+
object: withGatewayHints(objectId, ["https://gw1.example", "https://gw2.example"])
|
|
1894
|
+
}).toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1895
|
+
deepStrictEqual(json.object, `${objectId}?@gateway=https%3A%2F%2Fgw1.example&@gateway=https%3A%2F%2Fgw2.example`);
|
|
1896
|
+
const parsed = await Create.fromJsonLd(json, { contextLoader: mockDocumentLoader });
|
|
1897
|
+
const documentLoader = createLoader({ [`https://gw2.example${gatewayPath}`]: note() });
|
|
1898
|
+
assertInstanceOf(await parsed.getObject({
|
|
1899
|
+
documentLoader,
|
|
1900
|
+
contextLoader: mockDocumentLoader,
|
|
1901
|
+
verifyPortableObject: createVerifier()
|
|
1902
|
+
}), Note);
|
|
1903
|
+
deepStrictEqual(documentLoader.fetched, [`https://gw1.example${gatewayPath}`, `https://gw2.example${gatewayPath}`]);
|
|
1904
|
+
});
|
|
1890
1905
|
//#endregion
|
|
1891
1906
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { A as Object$1 } from "./vocab-D3C791xF.mjs";
|
|
4
|
-
import { i as isActor, o as name, s as version } from "./actor-
|
|
4
|
+
import { i as isActor, o as name, s as version } from "./actor-C8V9Eu9k.mjs";
|
|
5
5
|
import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
|
|
6
6
|
import { canonicalizePortableUri, formatIri, getDocumentLoader, haveSameFe34Origin, haveSameIriOrigin, parseIri } from "@fedify/vocab-runtime";
|
|
7
7
|
import { lookupWebFinger } from "@fedify/webfinger";
|
|
@@ -2,7 +2,7 @@ import "temporal-polyfill";
|
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { A as Object$1, F as Person, k as Note, s as Collection } from "./vocab-D3C791xF.mjs";
|
|
4
4
|
import { t as esm_default } from "./esm-2_Uqq_my.mjs";
|
|
5
|
-
import { n as traverseCollection, t as lookupObject } from "./lookup-
|
|
5
|
+
import { n as traverseCollection, t as lookupObject } from "./lookup-2QrSuQR0.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";
|
|
@@ -2,8 +2,8 @@ import "temporal-polyfill";
|
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { F as Person } from "./vocab-D3C791xF.mjs";
|
|
4
4
|
import { t as esm_default } from "./esm-2_Uqq_my.mjs";
|
|
5
|
-
import { n as getActorHandle } from "./actor-
|
|
6
|
-
import { t as lookupObject } from "./lookup-
|
|
5
|
+
import { n as getActorHandle } from "./actor-C8V9Eu9k.mjs";
|
|
6
|
+
import { t as lookupObject } from "./lookup-2QrSuQR0.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";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
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-D3C791xF.mjs";
|
|
4
|
-
import "./actor-
|
|
5
|
-
import "./lookup-
|
|
4
|
+
import "./actor-C8V9Eu9k.mjs";
|
|
5
|
+
import "./lookup-2QrSuQR0.mjs";
|
|
6
6
|
import { test } from "@fedify/fixture";
|
|
7
7
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
8
8
|
import { LanguageString as LanguageString$1, getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
|
@@ -473,7 +473,9 @@ test("FEP-ef61: actor gateways must be HTTP(S) base URIs", async () => {
|
|
|
473
473
|
"https://user@server.example/",
|
|
474
474
|
"https://server.example/path",
|
|
475
475
|
"https://server.example/?x=1",
|
|
476
|
-
"https://server.example
|
|
476
|
+
"https://server.example/?",
|
|
477
|
+
"https://server.example/#fragment",
|
|
478
|
+
"https://server.example/#"
|
|
477
479
|
]) {
|
|
478
480
|
throws(() => new Person({
|
|
479
481
|
id: new URL("ap+ef61://did%3Akey%3Az6Mkabc/actor"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab",
|
|
3
|
-
"version": "2.4.0-dev.
|
|
3
|
+
"version": "2.4.0-dev.2233+abb4a6b2",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"jsonld": "^9.0.0",
|
|
44
44
|
"pkijs": "^3.3.3",
|
|
45
45
|
"temporal-polyfill": "^1.0.1",
|
|
46
|
-
"@fedify/
|
|
47
|
-
"@fedify/vocab-
|
|
48
|
-
"@fedify/
|
|
46
|
+
"@fedify/vocab-tools": "2.4.0-dev.2233+abb4a6b2",
|
|
47
|
+
"@fedify/vocab-runtime": "2.4.0-dev.2233+abb4a6b2",
|
|
48
|
+
"@fedify/webfinger": "2.4.0-dev.2233+abb4a6b2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^24.12.2",
|
package/src/gateway.test.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type PortableObjectVerifier,
|
|
13
13
|
type PortableObjectVerifierOptions,
|
|
14
14
|
type RemoteDocument,
|
|
15
|
+
withGatewayHints,
|
|
15
16
|
} from "@fedify/vocab-runtime";
|
|
16
17
|
import fetchMock from "fetch-mock";
|
|
17
18
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
@@ -2599,3 +2600,35 @@ test("accessors pass the verifier of a call on to the objects they fetch", async
|
|
|
2599
2600
|
for (const item of optedOut) ok(getDefaultVerifier(item) == null);
|
|
2600
2601
|
});
|
|
2601
2602
|
});
|
|
2603
|
+
|
|
2604
|
+
test("getObject() follows location hints made by withGatewayHints()", async () => {
|
|
2605
|
+
const activity = new Create({
|
|
2606
|
+
id: parseIri(`ap://${did}/activities/1`),
|
|
2607
|
+
object: withGatewayHints(objectId, [
|
|
2608
|
+
"https://gw1.example",
|
|
2609
|
+
"https://gw2.example",
|
|
2610
|
+
]),
|
|
2611
|
+
});
|
|
2612
|
+
const json = await activity.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
2613
|
+
deepStrictEqual(
|
|
2614
|
+
(json as Record<string, unknown>).object,
|
|
2615
|
+
`${objectId}?@gateway=https%3A%2F%2Fgw1.example` +
|
|
2616
|
+
"&@gateway=https%3A%2F%2Fgw2.example",
|
|
2617
|
+
);
|
|
2618
|
+
const parsed = await Create.fromJsonLd(json, {
|
|
2619
|
+
contextLoader: mockDocumentLoader,
|
|
2620
|
+
});
|
|
2621
|
+
const documentLoader = createLoader({
|
|
2622
|
+
[`https://gw2.example${gatewayPath}`]: note(),
|
|
2623
|
+
});
|
|
2624
|
+
const object = await parsed.getObject({
|
|
2625
|
+
documentLoader,
|
|
2626
|
+
contextLoader: mockDocumentLoader,
|
|
2627
|
+
verifyPortableObject: createVerifier(),
|
|
2628
|
+
});
|
|
2629
|
+
assertInstanceOf(object, Note);
|
|
2630
|
+
deepStrictEqual(documentLoader.fetched, [
|
|
2631
|
+
`https://gw1.example${gatewayPath}`,
|
|
2632
|
+
`https://gw2.example${gatewayPath}`,
|
|
2633
|
+
]);
|
|
2634
|
+
});
|
package/src/vocab.test.ts
CHANGED
|
@@ -763,7 +763,9 @@ test("FEP-ef61: actor gateways must be HTTP(S) base URIs", async () => {
|
|
|
763
763
|
"https://user@server.example/",
|
|
764
764
|
"https://server.example/path",
|
|
765
765
|
"https://server.example/?x=1",
|
|
766
|
+
"https://server.example/?",
|
|
766
767
|
"https://server.example/#fragment",
|
|
768
|
+
"https://server.example/#",
|
|
767
769
|
]
|
|
768
770
|
) {
|
|
769
771
|
throws(
|