@fedify/vocab-runtime 2.3.5-dev.1755 → 2.3.6
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 +124 -9
- package/dist/mod.d.cts +2 -0
- package/dist/mod.d.ts +2 -0
- package/dist/mod.js +124 -9
- package/dist/tests/decimal.test.cjs +1 -1
- package/dist/tests/decimal.test.mjs +1 -1
- package/dist/tests/{docloader-DDsGwBCn.mjs → docloader-CWKdF29U.mjs} +507 -387
- package/dist/tests/{docloader-WvrknBqC.cjs → docloader-DprR2N-C.cjs} +512 -386
- package/dist/tests/docloader.test.cjs +27 -2
- package/dist/tests/docloader.test.mjs +27 -2
- package/dist/tests/{request-NUwlfvDV.cjs → request-CfJdvXUH.cjs} +1 -1
- package/dist/tests/{request-DhaNCgci.mjs → request-D4Rca6WD.mjs} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.mjs +1 -1
- package/package.json +1 -1
- package/src/contexts/cid-v1.json +114 -0
- package/src/contexts/fep-ef61.json +10 -0
- package/src/contexts/miscellany.json +2 -4
- package/src/contexts.ts +19 -0
- package/src/docloader.test.ts +41 -0
- package/src/docloader.ts +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
const require_docloader = require("./docloader-
|
|
3
|
-
const require_request = require("./request-
|
|
2
|
+
const require_docloader = require("./docloader-DprR2N-C.cjs");
|
|
3
|
+
const require_request = require("./request-CfJdvXUH.cjs");
|
|
4
4
|
const require_url = require("./url-BF_Nb_Cu.cjs");
|
|
5
5
|
let node_assert = require("node:assert");
|
|
6
6
|
let node_test = require("node:test");
|
|
@@ -1431,6 +1431,31 @@ var esm_default = new class FetchMock {
|
|
|
1431
1431
|
document
|
|
1432
1432
|
});
|
|
1433
1433
|
});
|
|
1434
|
+
esm_default.get("https://www.w3.org/ns/cid/v1", { status: 503 });
|
|
1435
|
+
await t.test("preloaded CID v1 context", async () => {
|
|
1436
|
+
const url = "https://www.w3.org/ns/cid/v1";
|
|
1437
|
+
(0, node_assert.deepStrictEqual)(await fetchDocumentLoader(url), {
|
|
1438
|
+
contextUrl: null,
|
|
1439
|
+
documentUrl: url,
|
|
1440
|
+
document: require_docloader.cid_v1_default
|
|
1441
|
+
});
|
|
1442
|
+
});
|
|
1443
|
+
await t.test("preloaded FEP-ef61 context", async () => {
|
|
1444
|
+
const url = "https://w3id.org/fep/ef61";
|
|
1445
|
+
(0, node_assert.ok)(url in require_docloader.preloadedContexts);
|
|
1446
|
+
(0, node_assert.deepStrictEqual)(await fetchDocumentLoader(url), {
|
|
1447
|
+
contextUrl: null,
|
|
1448
|
+
documentUrl: url,
|
|
1449
|
+
document: { "@context": {
|
|
1450
|
+
gateways: {
|
|
1451
|
+
"@id": "https://w3id.org/fep/ef61/gateways",
|
|
1452
|
+
"@type": "@id",
|
|
1453
|
+
"@container": "@list"
|
|
1454
|
+
},
|
|
1455
|
+
digestMultibase: "https://www.w3.org/ns/credentials/v2#digestMultibase"
|
|
1456
|
+
} }
|
|
1457
|
+
});
|
|
1458
|
+
});
|
|
1434
1459
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
1435
1460
|
await (0, node_assert.rejects)(() => fetchDocumentLoader("ftp://localhost"), require_url.UrlError);
|
|
1436
1461
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as preloadedContexts, t as getDocumentLoader } from "./docloader-
|
|
2
|
-
import { t as FetchError } from "./request-
|
|
1
|
+
import { n as preloadedContexts, r as cid_v1_default, t as getDocumentLoader } from "./docloader-CWKdF29U.mjs";
|
|
2
|
+
import { t as FetchError } from "./request-D4Rca6WD.mjs";
|
|
3
3
|
import { t as UrlError } from "./url-o0e-aXQY.mjs";
|
|
4
4
|
import { deepStrictEqual, ok, rejects } from "node:assert";
|
|
5
5
|
import { test } from "node:test";
|
|
@@ -1450,6 +1450,31 @@ test("getDocumentLoader()", async (t) => {
|
|
|
1450
1450
|
document
|
|
1451
1451
|
});
|
|
1452
1452
|
});
|
|
1453
|
+
esm_default.get("https://www.w3.org/ns/cid/v1", { status: 503 });
|
|
1454
|
+
await t.test("preloaded CID v1 context", async () => {
|
|
1455
|
+
const url = "https://www.w3.org/ns/cid/v1";
|
|
1456
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
1457
|
+
contextUrl: null,
|
|
1458
|
+
documentUrl: url,
|
|
1459
|
+
document: cid_v1_default
|
|
1460
|
+
});
|
|
1461
|
+
});
|
|
1462
|
+
await t.test("preloaded FEP-ef61 context", async () => {
|
|
1463
|
+
const url = "https://w3id.org/fep/ef61";
|
|
1464
|
+
ok(url in preloadedContexts);
|
|
1465
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
1466
|
+
contextUrl: null,
|
|
1467
|
+
documentUrl: url,
|
|
1468
|
+
document: { "@context": {
|
|
1469
|
+
gateways: {
|
|
1470
|
+
"@id": "https://w3id.org/fep/ef61/gateways",
|
|
1471
|
+
"@type": "@id",
|
|
1472
|
+
"@container": "@list"
|
|
1473
|
+
},
|
|
1474
|
+
digestMultibase: "https://www.w3.org/ns/credentials/v2#digestMultibase"
|
|
1475
|
+
} }
|
|
1476
|
+
});
|
|
1477
|
+
});
|
|
1453
1478
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
1454
1479
|
await rejects(() => fetchDocumentLoader("ftp://localhost"), UrlError);
|
|
1455
1480
|
});
|
|
@@ -3,7 +3,7 @@ let node_process = require("node:process");
|
|
|
3
3
|
node_process = require_chunk.__toESM(node_process, 1);
|
|
4
4
|
//#region deno.json
|
|
5
5
|
var name = "@fedify/vocab-runtime";
|
|
6
|
-
var version = "2.3.
|
|
6
|
+
var version = "2.3.6";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/request.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-CfJdvXUH.cjs");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let node_process = require("node:process");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as version, r as getUserAgent } from "./request-
|
|
1
|
+
import { o as version, r as getUserAgent } from "./request-D4Rca6WD.mjs";
|
|
2
2
|
import { deepStrictEqual } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import process from "node:process";
|
package/package.json
CHANGED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"@protected": true,
|
|
4
|
+
"id": "@id",
|
|
5
|
+
"type": "@type",
|
|
6
|
+
|
|
7
|
+
"alsoKnownAs": {
|
|
8
|
+
"@id": "https://www.w3.org/ns/activitystreams#alsoKnownAs",
|
|
9
|
+
"@type": "@id"
|
|
10
|
+
},
|
|
11
|
+
"assertionMethod": {
|
|
12
|
+
"@id": "https://w3id.org/security#assertionMethod",
|
|
13
|
+
"@type": "@id",
|
|
14
|
+
"@container": "@set"
|
|
15
|
+
},
|
|
16
|
+
"authentication": {
|
|
17
|
+
"@id": "https://w3id.org/security#authenticationMethod",
|
|
18
|
+
"@type": "@id",
|
|
19
|
+
"@container": "@set"
|
|
20
|
+
},
|
|
21
|
+
"capabilityDelegation": {
|
|
22
|
+
"@id": "https://w3id.org/security#capabilityDelegationMethod",
|
|
23
|
+
"@type": "@id",
|
|
24
|
+
"@container": "@set"
|
|
25
|
+
},
|
|
26
|
+
"capabilityInvocation": {
|
|
27
|
+
"@id": "https://w3id.org/security#capabilityInvocationMethod",
|
|
28
|
+
"@type": "@id",
|
|
29
|
+
"@container": "@set"
|
|
30
|
+
},
|
|
31
|
+
"controller": {
|
|
32
|
+
"@id": "https://w3id.org/security#controller",
|
|
33
|
+
"@type": "@id"
|
|
34
|
+
},
|
|
35
|
+
"keyAgreement": {
|
|
36
|
+
"@id": "https://w3id.org/security#keyAgreementMethod",
|
|
37
|
+
"@type": "@id",
|
|
38
|
+
"@container": "@set"
|
|
39
|
+
},
|
|
40
|
+
"service": {
|
|
41
|
+
"@id": "https://www.w3.org/ns/did#service",
|
|
42
|
+
"@type": "@id",
|
|
43
|
+
"@context": {
|
|
44
|
+
"@protected": true,
|
|
45
|
+
"id": "@id",
|
|
46
|
+
"type": "@type",
|
|
47
|
+
"serviceEndpoint": {
|
|
48
|
+
"@id": "https://www.w3.org/ns/did#serviceEndpoint",
|
|
49
|
+
"@type": "@id"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"verificationMethod": {
|
|
54
|
+
"@id": "https://w3id.org/security#verificationMethod",
|
|
55
|
+
"@type": "@id"
|
|
56
|
+
},
|
|
57
|
+
"Multikey": {
|
|
58
|
+
"@id": "https://w3id.org/security#Multikey",
|
|
59
|
+
"@context": {
|
|
60
|
+
"@protected": true,
|
|
61
|
+
"id": "@id",
|
|
62
|
+
"type": "@type",
|
|
63
|
+
"controller": {
|
|
64
|
+
"@id": "https://w3id.org/security#controller",
|
|
65
|
+
"@type": "@id"
|
|
66
|
+
},
|
|
67
|
+
"revoked": {
|
|
68
|
+
"@id": "https://w3id.org/security#revoked",
|
|
69
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
70
|
+
},
|
|
71
|
+
"expires": {
|
|
72
|
+
"@id": "https://w3id.org/security#expiration",
|
|
73
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
74
|
+
},
|
|
75
|
+
"publicKeyMultibase": {
|
|
76
|
+
"@id": "https://w3id.org/security#publicKeyMultibase",
|
|
77
|
+
"@type": "https://w3id.org/security#multibase"
|
|
78
|
+
},
|
|
79
|
+
"secretKeyMultibase": {
|
|
80
|
+
"@id": "https://w3id.org/security#secretKeyMultibase",
|
|
81
|
+
"@type": "https://w3id.org/security#multibase"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"JsonWebKey": {
|
|
86
|
+
"@id": "https://w3id.org/security#JsonWebKey",
|
|
87
|
+
"@context": {
|
|
88
|
+
"@protected": true,
|
|
89
|
+
"id": "@id",
|
|
90
|
+
"type": "@type",
|
|
91
|
+
"controller": {
|
|
92
|
+
"@id": "https://w3id.org/security#controller",
|
|
93
|
+
"@type": "@id"
|
|
94
|
+
},
|
|
95
|
+
"revoked": {
|
|
96
|
+
"@id": "https://w3id.org/security#revoked",
|
|
97
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
98
|
+
},
|
|
99
|
+
"expires": {
|
|
100
|
+
"@id": "https://w3id.org/security#expiration",
|
|
101
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
102
|
+
},
|
|
103
|
+
"publicKeyJwk": {
|
|
104
|
+
"@id": "https://w3id.org/security#publicKeyJwk",
|
|
105
|
+
"@type": "@json"
|
|
106
|
+
},
|
|
107
|
+
"secretKeyJwk": {
|
|
108
|
+
"@id": "https://w3id.org/security#secretKeyJwk",
|
|
109
|
+
"@type": "@json"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
5
5
|
"Hashtag": "as:Hashtag",
|
|
6
6
|
"manuallyApprovesFollowers": {
|
|
7
|
-
"@id": "as:manuallyApprovesFollowers"
|
|
8
|
-
"@type": "xsd:boolean"
|
|
7
|
+
"@id": "as:manuallyApprovesFollowers"
|
|
9
8
|
},
|
|
10
9
|
"movedTo": {
|
|
11
10
|
"@id": "as:movedTo",
|
|
12
11
|
"@type": "@id"
|
|
13
12
|
},
|
|
14
13
|
"sensitive": {
|
|
15
|
-
"@id": "as:sensitive"
|
|
16
|
-
"@type": "xsd:boolean"
|
|
14
|
+
"@id": "as:sensitive"
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
}
|
package/src/contexts.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
import activitystreams from "./contexts/activitystreams.json" with {
|
|
6
6
|
type: "json",
|
|
7
7
|
};
|
|
8
|
+
import cidV1Context from "./contexts/cid-v1.json" with { type: "json" };
|
|
8
9
|
import didV1 from "./contexts/did-v1.json" with { type: "json" };
|
|
9
10
|
import fep5711 from "./contexts/fep-5711.json" with { type: "json" };
|
|
11
|
+
import fepEf61 from "./contexts/fep-ef61.json" with { type: "json" };
|
|
10
12
|
import gotosocial from "./contexts/gotosocial.json" with { type: "json" };
|
|
11
13
|
import identityV1 from "./contexts/identity-v1.json" with { type: "json" };
|
|
12
14
|
import joinLemmyContext from "./contexts/join-lemmy.json" with { type: "json" };
|
|
@@ -37,6 +39,23 @@ const preloadedContexts: Record<string, unknown> = {
|
|
|
37
39
|
"https://gotosocial.org/ns": gotosocial,
|
|
38
40
|
"https://w3id.org/fep/5711": fep5711,
|
|
39
41
|
|
|
42
|
+
// Controlled Identifiers v1.0 requires JSON-LD processors to treat this
|
|
43
|
+
// context URL as already resolved. We ship the official W3C context so that
|
|
44
|
+
// controlled identifier documents can be processed without depending on the
|
|
45
|
+
// availability of the remote context server.
|
|
46
|
+
// See: https://www.w3.org/TR/cid-1.0/#json-ld-context
|
|
47
|
+
// https://github.com/fedify-dev/fedify/issues/932
|
|
48
|
+
"https://www.w3.org/ns/cid/v1": cidV1Context,
|
|
49
|
+
|
|
50
|
+
// The FEP-ef61 context. The w3id.org URL redirects to Codeberg Pages, which
|
|
51
|
+
// suffers recurring outages; while it is unreachable, every document
|
|
52
|
+
// referencing this URL fails JSON-LD expansion before application handlers
|
|
53
|
+
// run. We ship a built-in copy so that portable objects can be processed
|
|
54
|
+
// without depending on the availability of the remote context server.
|
|
55
|
+
// See: https://w3id.org/fep/ef61
|
|
56
|
+
// https://github.com/fedify-dev/fedify/issues/982
|
|
57
|
+
"https://w3id.org/fep/ef61": fepEf61,
|
|
58
|
+
|
|
40
59
|
// Lemmy's context document is served as application/json without the JSON-LD
|
|
41
60
|
// context Link header. The default document loader treats that as a regular
|
|
42
61
|
// JSON response instead of a JSON-LD context, so every Lemmy activity that
|
package/src/docloader.test.ts
CHANGED
|
@@ -2,6 +2,7 @@ import fetchMock from "fetch-mock";
|
|
|
2
2
|
import { deepStrictEqual, ok, rejects } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import preloadedContexts from "./contexts.ts";
|
|
5
|
+
import cidV1Context from "./contexts/cid-v1.json" with { type: "json" };
|
|
5
6
|
import { getDocumentLoader } from "./docloader.ts";
|
|
6
7
|
import { FetchError } from "./request.ts";
|
|
7
8
|
import { UrlError } from "./url.ts";
|
|
@@ -293,6 +294,46 @@ test("getDocumentLoader()", async (t) => {
|
|
|
293
294
|
}
|
|
294
295
|
});
|
|
295
296
|
|
|
297
|
+
// Controlled Identifiers v1.0 requires JSON-LD processors to treat this
|
|
298
|
+
// context URL as already resolved. A temporary W3C outage must not prevent
|
|
299
|
+
// an otherwise valid document from being processed.
|
|
300
|
+
// See: https://www.w3.org/TR/cid-1.0/#json-ld-context
|
|
301
|
+
// https://github.com/fedify-dev/fedify/issues/932
|
|
302
|
+
fetchMock.get("https://www.w3.org/ns/cid/v1", { status: 503 });
|
|
303
|
+
await t.test("preloaded CID v1 context", async () => {
|
|
304
|
+
const url = "https://www.w3.org/ns/cid/v1";
|
|
305
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
306
|
+
contextUrl: null,
|
|
307
|
+
documentUrl: url,
|
|
308
|
+
document: cidV1Context,
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// The <https://w3id.org/fep/ef61> URL redirects to a Codeberg Pages host
|
|
313
|
+
// which suffers recurring outages; while it is unreachable, expanding any
|
|
314
|
+
// document referencing it fails before application handlers run. It has to
|
|
315
|
+
// be resolved from the built-in copy rather than over the network.
|
|
316
|
+
// See: https://github.com/fedify-dev/fedify/issues/982
|
|
317
|
+
await t.test("preloaded FEP-ef61 context", async () => {
|
|
318
|
+
const url = "https://w3id.org/fep/ef61";
|
|
319
|
+
ok(url in preloadedContexts);
|
|
320
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
321
|
+
contextUrl: null,
|
|
322
|
+
documentUrl: url,
|
|
323
|
+
document: {
|
|
324
|
+
"@context": {
|
|
325
|
+
gateways: {
|
|
326
|
+
"@id": "https://w3id.org/fep/ef61/gateways",
|
|
327
|
+
"@type": "@id",
|
|
328
|
+
"@container": "@list",
|
|
329
|
+
},
|
|
330
|
+
digestMultibase:
|
|
331
|
+
"https://www.w3.org/ns/credentials/v2#digestMultibase",
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
|
|
296
337
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
297
338
|
await rejects(
|
|
298
339
|
() => fetchDocumentLoader("ftp://localhost"),
|
package/src/docloader.ts
CHANGED
|
@@ -284,7 +284,9 @@ export interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
284
284
|
* - <https://w3id.org/security/v1>
|
|
285
285
|
* - <https://w3id.org/security/data-integrity/v1>
|
|
286
286
|
* - <https://www.w3.org/ns/did/v1>
|
|
287
|
+
* - <https://www.w3.org/ns/cid/v1>
|
|
287
288
|
* - <https://w3id.org/security/multikey/v1>
|
|
289
|
+
* - <https://w3id.org/fep/ef61>
|
|
288
290
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
289
291
|
* - <http://schema.org/>
|
|
290
292
|
* @param options Options for the document loader.
|