@fedify/vocab-runtime 2.0.31-dev.2273 → 2.0.31-dev.2306
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 +47 -1
- package/dist/mod.d.cts +2 -0
- package/dist/mod.d.ts +2 -0
- package/dist/mod.js +47 -1
- package/dist/tests/{body-wOtDIud6.mjs → body-CGeu_wlY.mjs} +1 -1
- package/dist/tests/{body-CwWI4-VY.cjs → body-KqP1lgFZ.cjs} +1 -1
- package/dist/tests/body.test.cjs +1 -1
- package/dist/tests/body.test.mjs +1 -1
- package/dist/tests/docloader.test.cjs +161 -2
- package/dist/tests/docloader.test.mjs +160 -2
- package/dist/tests/{request-DcF60AOA.cjs → request-75RoXeN4.cjs} +1 -1
- package/dist/tests/{request-B112Mks-.mjs → request-JVGlYdPG.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/fep-22cd.json +14 -0
- package/src/contexts/fep-6757.json +12 -0
- package/src/contexts.ts +16 -0
- package/src/docloader.test.ts +124 -0
- package/src/docloader.ts +2 -0
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -128,6 +128,48 @@ var cid_v1_default = { "@context": {
|
|
|
128
128
|
}
|
|
129
129
|
} };
|
|
130
130
|
//#endregion
|
|
131
|
+
//#region src/contexts/fep-22cd.json
|
|
132
|
+
var fep_22cd_default = { "@context": {
|
|
133
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
134
|
+
"schema": "https://schema.org/",
|
|
135
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
136
|
+
"translations": {
|
|
137
|
+
"@id": "fep-22cd:translations",
|
|
138
|
+
"@container": "@set"
|
|
139
|
+
},
|
|
140
|
+
"Translation": "fep-22cd:Translation",
|
|
141
|
+
"sourceUpdated": {
|
|
142
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
143
|
+
"@type": "xsd:dateTime"
|
|
144
|
+
},
|
|
145
|
+
"translator": {
|
|
146
|
+
"@id": "schema:translator",
|
|
147
|
+
"@type": "@id",
|
|
148
|
+
"@container": "@set"
|
|
149
|
+
},
|
|
150
|
+
"inLanguage": "schema:inLanguage",
|
|
151
|
+
"translationOfWork": {
|
|
152
|
+
"@id": "schema:translationOfWork",
|
|
153
|
+
"@type": "@id"
|
|
154
|
+
},
|
|
155
|
+
"isBasedOn": {
|
|
156
|
+
"@id": "schema:isBasedOn",
|
|
157
|
+
"@type": "@id"
|
|
158
|
+
}
|
|
159
|
+
} };
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/contexts/fep-6757.json
|
|
162
|
+
var fep_6757_default = { "@context": {
|
|
163
|
+
"license": {
|
|
164
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
165
|
+
"@type": "@id"
|
|
166
|
+
},
|
|
167
|
+
"preferredLicense": {
|
|
168
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
169
|
+
"@type": "@id"
|
|
170
|
+
}
|
|
171
|
+
} };
|
|
172
|
+
//#endregion
|
|
131
173
|
//#region src/contexts/fep-7aa9.json
|
|
132
174
|
var fep_7aa9_default = { "@context": {
|
|
133
175
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -4428,6 +4470,8 @@ const preloadedContexts = {
|
|
|
4428
4470
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
4429
4471
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4430
4472
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4473
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4474
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
4431
4475
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4432
4476
|
"http://joinmastodon.org/ns": { "@context": {
|
|
4433
4477
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -4460,7 +4504,7 @@ const preloadedContexts = {
|
|
|
4460
4504
|
//#endregion
|
|
4461
4505
|
//#region deno.json
|
|
4462
4506
|
var name = "@fedify/vocab-runtime";
|
|
4463
|
-
var version = "2.0.31-dev.
|
|
4507
|
+
var version = "2.0.31-dev.2306+e775cf8c";
|
|
4464
4508
|
//#endregion
|
|
4465
4509
|
//#region src/request.ts
|
|
4466
4510
|
/**
|
|
@@ -5102,6 +5146,8 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5102
5146
|
* - <https://w3id.org/security/multikey/v1>
|
|
5103
5147
|
* - <https://w3id.org/fep/ef61>
|
|
5104
5148
|
* - <https://w3id.org/fep/7aa9>
|
|
5149
|
+
* - <https://w3id.org/fep/6757>
|
|
5150
|
+
* - <https://w3id.org/fep/22cd>
|
|
5105
5151
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5106
5152
|
* - <http://schema.org/>
|
|
5107
5153
|
* @param options Options for the document loader.
|
package/dist/mod.d.cts
CHANGED
|
@@ -183,6 +183,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
183
183
|
* - <https://w3id.org/security/multikey/v1>
|
|
184
184
|
* - <https://w3id.org/fep/ef61>
|
|
185
185
|
* - <https://w3id.org/fep/7aa9>
|
|
186
|
+
* - <https://w3id.org/fep/6757>
|
|
187
|
+
* - <https://w3id.org/fep/22cd>
|
|
186
188
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
187
189
|
* - <http://schema.org/>
|
|
188
190
|
* @param options Options for the document loader.
|
package/dist/mod.d.ts
CHANGED
|
@@ -182,6 +182,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
182
182
|
* - <https://w3id.org/security/multikey/v1>
|
|
183
183
|
* - <https://w3id.org/fep/ef61>
|
|
184
184
|
* - <https://w3id.org/fep/7aa9>
|
|
185
|
+
* - <https://w3id.org/fep/6757>
|
|
186
|
+
* - <https://w3id.org/fep/22cd>
|
|
185
187
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
186
188
|
* - <http://schema.org/>
|
|
187
189
|
* @param options Options for the document loader.
|
package/dist/mod.js
CHANGED
|
@@ -123,6 +123,48 @@ var cid_v1_default = { "@context": {
|
|
|
123
123
|
}
|
|
124
124
|
} };
|
|
125
125
|
//#endregion
|
|
126
|
+
//#region src/contexts/fep-22cd.json
|
|
127
|
+
var fep_22cd_default = { "@context": {
|
|
128
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
129
|
+
"schema": "https://schema.org/",
|
|
130
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
131
|
+
"translations": {
|
|
132
|
+
"@id": "fep-22cd:translations",
|
|
133
|
+
"@container": "@set"
|
|
134
|
+
},
|
|
135
|
+
"Translation": "fep-22cd:Translation",
|
|
136
|
+
"sourceUpdated": {
|
|
137
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
138
|
+
"@type": "xsd:dateTime"
|
|
139
|
+
},
|
|
140
|
+
"translator": {
|
|
141
|
+
"@id": "schema:translator",
|
|
142
|
+
"@type": "@id",
|
|
143
|
+
"@container": "@set"
|
|
144
|
+
},
|
|
145
|
+
"inLanguage": "schema:inLanguage",
|
|
146
|
+
"translationOfWork": {
|
|
147
|
+
"@id": "schema:translationOfWork",
|
|
148
|
+
"@type": "@id"
|
|
149
|
+
},
|
|
150
|
+
"isBasedOn": {
|
|
151
|
+
"@id": "schema:isBasedOn",
|
|
152
|
+
"@type": "@id"
|
|
153
|
+
}
|
|
154
|
+
} };
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/contexts/fep-6757.json
|
|
157
|
+
var fep_6757_default = { "@context": {
|
|
158
|
+
"license": {
|
|
159
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
160
|
+
"@type": "@id"
|
|
161
|
+
},
|
|
162
|
+
"preferredLicense": {
|
|
163
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
164
|
+
"@type": "@id"
|
|
165
|
+
}
|
|
166
|
+
} };
|
|
167
|
+
//#endregion
|
|
126
168
|
//#region src/contexts/fep-7aa9.json
|
|
127
169
|
var fep_7aa9_default = { "@context": {
|
|
128
170
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -4423,6 +4465,8 @@ const preloadedContexts = {
|
|
|
4423
4465
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
4424
4466
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4425
4467
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4468
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4469
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
4426
4470
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4427
4471
|
"http://joinmastodon.org/ns": { "@context": {
|
|
4428
4472
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -4455,7 +4499,7 @@ const preloadedContexts = {
|
|
|
4455
4499
|
//#endregion
|
|
4456
4500
|
//#region deno.json
|
|
4457
4501
|
var name = "@fedify/vocab-runtime";
|
|
4458
|
-
var version = "2.0.31-dev.
|
|
4502
|
+
var version = "2.0.31-dev.2306+e775cf8c";
|
|
4459
4503
|
//#endregion
|
|
4460
4504
|
//#region src/request.ts
|
|
4461
4505
|
/**
|
|
@@ -5097,6 +5141,8 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5097
5141
|
* - <https://w3id.org/security/multikey/v1>
|
|
5098
5142
|
* - <https://w3id.org/fep/ef61>
|
|
5099
5143
|
* - <https://w3id.org/fep/7aa9>
|
|
5144
|
+
* - <https://w3id.org/fep/6757>
|
|
5145
|
+
* - <https://w3id.org/fep/22cd>
|
|
5100
5146
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5101
5147
|
* - <http://schema.org/>
|
|
5102
5148
|
* @param options Options for the document loader.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Do9eywBl.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-75RoXeN4.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
//#region src/body.ts
|
|
5
5
|
/** Decoded JSON body limit: 16 MiB. @internal */
|
package/dist/tests/body.test.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Do9eywBl.cjs");
|
|
2
|
-
const require_body = require("./body-
|
|
2
|
+
const require_body = require("./body-KqP1lgFZ.cjs");
|
|
3
3
|
let node_assert_strict = require("node:assert/strict");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let node_zlib = require("node:zlib");
|
package/dist/tests/body.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { r as readBoundedText, t as BodyTooLargeError } from "./body-CGeu_wlY.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import { gunzipSync, gzipSync } from "node:zlib";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Do9eywBl.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
3
|
-
const require_body = require("./body-
|
|
2
|
+
const require_request = require("./request-75RoXeN4.cjs");
|
|
3
|
+
const require_body = require("./body-KqP1lgFZ.cjs");
|
|
4
4
|
const require_link = require("./link-FguCydMA.cjs");
|
|
5
5
|
const require_url = require("./url-Qk1svKZU.cjs");
|
|
6
6
|
let node_test = require("node:test");
|
|
@@ -11,6 +11,8 @@ let node_dns_promises = require("node:dns/promises");
|
|
|
11
11
|
node_dns_promises = require_chunk.__toESM(node_dns_promises);
|
|
12
12
|
let node_http = require("node:http");
|
|
13
13
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
14
|
+
let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
|
|
15
|
+
jsonld_dist_jsonld_esm_js = require_chunk.__toESM(jsonld_dist_jsonld_esm_js);
|
|
14
16
|
//#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
|
|
15
17
|
var require_glob_to_regexp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
|
|
16
18
|
module.exports = function(glob, opts) {
|
|
@@ -1325,6 +1327,48 @@ var cid_v1_default = { "@context": {
|
|
|
1325
1327
|
}
|
|
1326
1328
|
} };
|
|
1327
1329
|
//#endregion
|
|
1330
|
+
//#region src/contexts/fep-22cd.json
|
|
1331
|
+
var fep_22cd_default = { "@context": {
|
|
1332
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
1333
|
+
"schema": "https://schema.org/",
|
|
1334
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
1335
|
+
"translations": {
|
|
1336
|
+
"@id": "fep-22cd:translations",
|
|
1337
|
+
"@container": "@set"
|
|
1338
|
+
},
|
|
1339
|
+
"Translation": "fep-22cd:Translation",
|
|
1340
|
+
"sourceUpdated": {
|
|
1341
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
1342
|
+
"@type": "xsd:dateTime"
|
|
1343
|
+
},
|
|
1344
|
+
"translator": {
|
|
1345
|
+
"@id": "schema:translator",
|
|
1346
|
+
"@type": "@id",
|
|
1347
|
+
"@container": "@set"
|
|
1348
|
+
},
|
|
1349
|
+
"inLanguage": "schema:inLanguage",
|
|
1350
|
+
"translationOfWork": {
|
|
1351
|
+
"@id": "schema:translationOfWork",
|
|
1352
|
+
"@type": "@id"
|
|
1353
|
+
},
|
|
1354
|
+
"isBasedOn": {
|
|
1355
|
+
"@id": "schema:isBasedOn",
|
|
1356
|
+
"@type": "@id"
|
|
1357
|
+
}
|
|
1358
|
+
} };
|
|
1359
|
+
//#endregion
|
|
1360
|
+
//#region src/contexts/fep-6757.json
|
|
1361
|
+
var fep_6757_default = { "@context": {
|
|
1362
|
+
"license": {
|
|
1363
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
1364
|
+
"@type": "@id"
|
|
1365
|
+
},
|
|
1366
|
+
"preferredLicense": {
|
|
1367
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
1368
|
+
"@type": "@id"
|
|
1369
|
+
}
|
|
1370
|
+
} };
|
|
1371
|
+
//#endregion
|
|
1328
1372
|
//#region src/contexts/fep-7aa9.json
|
|
1329
1373
|
var fep_7aa9_default = { "@context": {
|
|
1330
1374
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -5625,6 +5669,8 @@ const preloadedContexts = {
|
|
|
5625
5669
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
5626
5670
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
5627
5671
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
5672
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
5673
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
5628
5674
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
5629
5675
|
"http://joinmastodon.org/ns": { "@context": {
|
|
5630
5676
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -5766,6 +5812,8 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5766
5812
|
* - <https://w3id.org/security/multikey/v1>
|
|
5767
5813
|
* - <https://w3id.org/fep/ef61>
|
|
5768
5814
|
* - <https://w3id.org/fep/7aa9>
|
|
5815
|
+
* - <https://w3id.org/fep/6757>
|
|
5816
|
+
* - <https://w3id.org/fep/22cd>
|
|
5769
5817
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5770
5818
|
* - <http://schema.org/>
|
|
5771
5819
|
* @param options Options for the document loader.
|
|
@@ -5854,6 +5902,9 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
|
|
|
5854
5902
|
return (url, options) => load(url, options);
|
|
5855
5903
|
}
|
|
5856
5904
|
//#endregion
|
|
5905
|
+
//#region src/jsonld.ts
|
|
5906
|
+
var jsonld_default = jsonld_dist_jsonld_esm_js.default;
|
|
5907
|
+
//#endregion
|
|
5857
5908
|
//#region src/docloader.test.ts
|
|
5858
5909
|
(0, node_test.test)("new FetchError()", () => {
|
|
5859
5910
|
const e = new require_request.FetchError("https://example.com/", "An error message.");
|
|
@@ -6132,6 +6183,114 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
|
|
|
6132
6183
|
});
|
|
6133
6184
|
(0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
|
|
6134
6185
|
});
|
|
6186
|
+
esm_default.get("https://w3id.org/fep/6757", { status: 502 });
|
|
6187
|
+
await t.test("preloaded FEP-6757 context", async () => {
|
|
6188
|
+
const url = "https://w3id.org/fep/6757";
|
|
6189
|
+
(0, node_assert.deepStrictEqual)(await fetchDocumentLoader(url), {
|
|
6190
|
+
contextUrl: null,
|
|
6191
|
+
documentUrl: url,
|
|
6192
|
+
document: { "@context": {
|
|
6193
|
+
license: {
|
|
6194
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
6195
|
+
"@type": "@id"
|
|
6196
|
+
},
|
|
6197
|
+
preferredLicense: {
|
|
6198
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
6199
|
+
"@type": "@id"
|
|
6200
|
+
}
|
|
6201
|
+
} }
|
|
6202
|
+
});
|
|
6203
|
+
(0, node_assert.deepStrictEqual)(await jsonld_default.expand({
|
|
6204
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
6205
|
+
type: "Person",
|
|
6206
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
|
6207
|
+
preferredLicense: "https://creativecommons.org/licenses/by-nc/4.0/"
|
|
6208
|
+
}, { documentLoader: fetchDocumentLoader }), [{
|
|
6209
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Person"],
|
|
6210
|
+
"http://purl.org/dc/terms/license": [{ "@id": "https://creativecommons.org/licenses/by/4.0/" }],
|
|
6211
|
+
"https://w3id.org/fep/6757#preferredLicense": [{ "@id": "https://creativecommons.org/licenses/by-nc/4.0/" }]
|
|
6212
|
+
}]);
|
|
6213
|
+
(0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
|
|
6214
|
+
});
|
|
6215
|
+
esm_default.get("https://w3id.org/fep/22cd", { status: 502 });
|
|
6216
|
+
await t.test("preloaded FEP-22cd context", async () => {
|
|
6217
|
+
const url = "https://w3id.org/fep/22cd";
|
|
6218
|
+
const articleId = "https://example.com/articles/1";
|
|
6219
|
+
const translatorId = "https://example.com/users/alice";
|
|
6220
|
+
const revisionId = "https://example.com/articles/1/revisions/1";
|
|
6221
|
+
(0, node_assert.deepStrictEqual)(await fetchDocumentLoader(url), {
|
|
6222
|
+
contextUrl: null,
|
|
6223
|
+
documentUrl: url,
|
|
6224
|
+
document: { "@context": {
|
|
6225
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
6226
|
+
schema: "https://schema.org/",
|
|
6227
|
+
xsd: "http://www.w3.org/2001/XMLSchema#",
|
|
6228
|
+
translations: {
|
|
6229
|
+
"@id": "fep-22cd:translations",
|
|
6230
|
+
"@container": "@set"
|
|
6231
|
+
},
|
|
6232
|
+
Translation: "fep-22cd:Translation",
|
|
6233
|
+
sourceUpdated: {
|
|
6234
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
6235
|
+
"@type": "xsd:dateTime"
|
|
6236
|
+
},
|
|
6237
|
+
translator: {
|
|
6238
|
+
"@id": "schema:translator",
|
|
6239
|
+
"@type": "@id",
|
|
6240
|
+
"@container": "@set"
|
|
6241
|
+
},
|
|
6242
|
+
inLanguage: "schema:inLanguage",
|
|
6243
|
+
translationOfWork: {
|
|
6244
|
+
"@id": "schema:translationOfWork",
|
|
6245
|
+
"@type": "@id"
|
|
6246
|
+
},
|
|
6247
|
+
isBasedOn: {
|
|
6248
|
+
"@id": "schema:isBasedOn",
|
|
6249
|
+
"@type": "@id"
|
|
6250
|
+
}
|
|
6251
|
+
} }
|
|
6252
|
+
});
|
|
6253
|
+
(0, node_assert.deepStrictEqual)(await jsonld_default.expand({
|
|
6254
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
6255
|
+
id: articleId,
|
|
6256
|
+
type: "Article",
|
|
6257
|
+
contentMap: {
|
|
6258
|
+
en: "Original",
|
|
6259
|
+
ko: "Translation"
|
|
6260
|
+
},
|
|
6261
|
+
translations: [{
|
|
6262
|
+
type: "Translation",
|
|
6263
|
+
inLanguage: "ko",
|
|
6264
|
+
translator: [translatorId],
|
|
6265
|
+
translationOfWork: articleId,
|
|
6266
|
+
sourceUpdated: "2026-09-01T00:00:00Z",
|
|
6267
|
+
isBasedOn: revisionId
|
|
6268
|
+
}]
|
|
6269
|
+
}, { documentLoader: fetchDocumentLoader }), [{
|
|
6270
|
+
"@id": articleId,
|
|
6271
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Article"],
|
|
6272
|
+
"https://www.w3.org/ns/activitystreams#content": [{
|
|
6273
|
+
"@language": "en",
|
|
6274
|
+
"@value": "Original"
|
|
6275
|
+
}, {
|
|
6276
|
+
"@language": "ko",
|
|
6277
|
+
"@value": "Translation"
|
|
6278
|
+
}],
|
|
6279
|
+
"https://w3id.org/fep/22cd#translations": [{
|
|
6280
|
+
"@type": ["https://w3id.org/fep/22cd#Translation"],
|
|
6281
|
+
"https://schema.org/inLanguage": [{ "@value": "ko" }],
|
|
6282
|
+
"https://schema.org/translator": [{ "@id": translatorId }],
|
|
6283
|
+
"https://schema.org/translationOfWork": [{ "@id": articleId }],
|
|
6284
|
+
"https://w3id.org/fep/22cd#sourceUpdated": [{
|
|
6285
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
6286
|
+
"@value": "2026-09-01T00:00:00Z"
|
|
6287
|
+
}],
|
|
6288
|
+
"https://schema.org/isBasedOn": [{ "@id": revisionId }]
|
|
6289
|
+
}]
|
|
6290
|
+
}]);
|
|
6291
|
+
(0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
|
|
6292
|
+
(0, node_assert.deepStrictEqual)(esm_default.callHistory.calls("https://www.w3.org/ns/activitystreams").length, 0);
|
|
6293
|
+
});
|
|
6135
6294
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
6136
6295
|
await (0, node_assert.rejects)(() => fetchDocumentLoader("ftp://localhost"), require_url.UrlError);
|
|
6137
6296
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-
|
|
2
|
-
import { n as MAX_BODY_SIZE, r as readBoundedText } from "./body-
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-JVGlYdPG.mjs";
|
|
2
|
+
import { n as MAX_BODY_SIZE, r as readBoundedText } from "./body-CGeu_wlY.mjs";
|
|
3
3
|
import { t as HttpHeaderLink } from "./link-NUUWCdnK.mjs";
|
|
4
4
|
import { o as validatePublicUrl, t as UrlError } from "./url-DzlMS01z.mjs";
|
|
5
5
|
import { test } from "node:test";
|
|
@@ -9,6 +9,7 @@ import { deepStrictEqual, ok, rejects } from "node:assert";
|
|
|
9
9
|
import dns from "node:dns/promises";
|
|
10
10
|
import { createServer } from "node:http";
|
|
11
11
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
12
|
+
import jsonld from "jsonld/dist/jsonld.esm.js";
|
|
12
13
|
//#region \0rolldown/runtime.js
|
|
13
14
|
var __create = Object.create;
|
|
14
15
|
var __defProp = Object.defineProperty;
|
|
@@ -1343,6 +1344,48 @@ var cid_v1_default = { "@context": {
|
|
|
1343
1344
|
}
|
|
1344
1345
|
} };
|
|
1345
1346
|
//#endregion
|
|
1347
|
+
//#region src/contexts/fep-22cd.json
|
|
1348
|
+
var fep_22cd_default = { "@context": {
|
|
1349
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
1350
|
+
"schema": "https://schema.org/",
|
|
1351
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
1352
|
+
"translations": {
|
|
1353
|
+
"@id": "fep-22cd:translations",
|
|
1354
|
+
"@container": "@set"
|
|
1355
|
+
},
|
|
1356
|
+
"Translation": "fep-22cd:Translation",
|
|
1357
|
+
"sourceUpdated": {
|
|
1358
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
1359
|
+
"@type": "xsd:dateTime"
|
|
1360
|
+
},
|
|
1361
|
+
"translator": {
|
|
1362
|
+
"@id": "schema:translator",
|
|
1363
|
+
"@type": "@id",
|
|
1364
|
+
"@container": "@set"
|
|
1365
|
+
},
|
|
1366
|
+
"inLanguage": "schema:inLanguage",
|
|
1367
|
+
"translationOfWork": {
|
|
1368
|
+
"@id": "schema:translationOfWork",
|
|
1369
|
+
"@type": "@id"
|
|
1370
|
+
},
|
|
1371
|
+
"isBasedOn": {
|
|
1372
|
+
"@id": "schema:isBasedOn",
|
|
1373
|
+
"@type": "@id"
|
|
1374
|
+
}
|
|
1375
|
+
} };
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region src/contexts/fep-6757.json
|
|
1378
|
+
var fep_6757_default = { "@context": {
|
|
1379
|
+
"license": {
|
|
1380
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
1381
|
+
"@type": "@id"
|
|
1382
|
+
},
|
|
1383
|
+
"preferredLicense": {
|
|
1384
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
1385
|
+
"@type": "@id"
|
|
1386
|
+
}
|
|
1387
|
+
} };
|
|
1388
|
+
//#endregion
|
|
1346
1389
|
//#region src/contexts/fep-7aa9.json
|
|
1347
1390
|
var fep_7aa9_default = { "@context": {
|
|
1348
1391
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -5643,6 +5686,8 @@ const preloadedContexts = {
|
|
|
5643
5686
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
5644
5687
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
5645
5688
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
5689
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
5690
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
5646
5691
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
5647
5692
|
"http://joinmastodon.org/ns": { "@context": {
|
|
5648
5693
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -5784,6 +5829,8 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5784
5829
|
* - <https://w3id.org/security/multikey/v1>
|
|
5785
5830
|
* - <https://w3id.org/fep/ef61>
|
|
5786
5831
|
* - <https://w3id.org/fep/7aa9>
|
|
5832
|
+
* - <https://w3id.org/fep/6757>
|
|
5833
|
+
* - <https://w3id.org/fep/22cd>
|
|
5787
5834
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5788
5835
|
* - <http://schema.org/>
|
|
5789
5836
|
* @param options Options for the document loader.
|
|
@@ -5872,6 +5919,9 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
|
|
|
5872
5919
|
return (url, options) => load(url, options);
|
|
5873
5920
|
}
|
|
5874
5921
|
//#endregion
|
|
5922
|
+
//#region src/jsonld.ts
|
|
5923
|
+
var jsonld_default = jsonld;
|
|
5924
|
+
//#endregion
|
|
5875
5925
|
//#region src/docloader.test.ts
|
|
5876
5926
|
test("new FetchError()", () => {
|
|
5877
5927
|
const e = new FetchError("https://example.com/", "An error message.");
|
|
@@ -6150,6 +6200,114 @@ test("getDocumentLoader()", async (t) => {
|
|
|
6150
6200
|
});
|
|
6151
6201
|
deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
|
|
6152
6202
|
});
|
|
6203
|
+
esm_default.get("https://w3id.org/fep/6757", { status: 502 });
|
|
6204
|
+
await t.test("preloaded FEP-6757 context", async () => {
|
|
6205
|
+
const url = "https://w3id.org/fep/6757";
|
|
6206
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
6207
|
+
contextUrl: null,
|
|
6208
|
+
documentUrl: url,
|
|
6209
|
+
document: { "@context": {
|
|
6210
|
+
license: {
|
|
6211
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
6212
|
+
"@type": "@id"
|
|
6213
|
+
},
|
|
6214
|
+
preferredLicense: {
|
|
6215
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
6216
|
+
"@type": "@id"
|
|
6217
|
+
}
|
|
6218
|
+
} }
|
|
6219
|
+
});
|
|
6220
|
+
deepStrictEqual(await jsonld_default.expand({
|
|
6221
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
6222
|
+
type: "Person",
|
|
6223
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
|
6224
|
+
preferredLicense: "https://creativecommons.org/licenses/by-nc/4.0/"
|
|
6225
|
+
}, { documentLoader: fetchDocumentLoader }), [{
|
|
6226
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Person"],
|
|
6227
|
+
"http://purl.org/dc/terms/license": [{ "@id": "https://creativecommons.org/licenses/by/4.0/" }],
|
|
6228
|
+
"https://w3id.org/fep/6757#preferredLicense": [{ "@id": "https://creativecommons.org/licenses/by-nc/4.0/" }]
|
|
6229
|
+
}]);
|
|
6230
|
+
deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
|
|
6231
|
+
});
|
|
6232
|
+
esm_default.get("https://w3id.org/fep/22cd", { status: 502 });
|
|
6233
|
+
await t.test("preloaded FEP-22cd context", async () => {
|
|
6234
|
+
const url = "https://w3id.org/fep/22cd";
|
|
6235
|
+
const articleId = "https://example.com/articles/1";
|
|
6236
|
+
const translatorId = "https://example.com/users/alice";
|
|
6237
|
+
const revisionId = "https://example.com/articles/1/revisions/1";
|
|
6238
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
6239
|
+
contextUrl: null,
|
|
6240
|
+
documentUrl: url,
|
|
6241
|
+
document: { "@context": {
|
|
6242
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
6243
|
+
schema: "https://schema.org/",
|
|
6244
|
+
xsd: "http://www.w3.org/2001/XMLSchema#",
|
|
6245
|
+
translations: {
|
|
6246
|
+
"@id": "fep-22cd:translations",
|
|
6247
|
+
"@container": "@set"
|
|
6248
|
+
},
|
|
6249
|
+
Translation: "fep-22cd:Translation",
|
|
6250
|
+
sourceUpdated: {
|
|
6251
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
6252
|
+
"@type": "xsd:dateTime"
|
|
6253
|
+
},
|
|
6254
|
+
translator: {
|
|
6255
|
+
"@id": "schema:translator",
|
|
6256
|
+
"@type": "@id",
|
|
6257
|
+
"@container": "@set"
|
|
6258
|
+
},
|
|
6259
|
+
inLanguage: "schema:inLanguage",
|
|
6260
|
+
translationOfWork: {
|
|
6261
|
+
"@id": "schema:translationOfWork",
|
|
6262
|
+
"@type": "@id"
|
|
6263
|
+
},
|
|
6264
|
+
isBasedOn: {
|
|
6265
|
+
"@id": "schema:isBasedOn",
|
|
6266
|
+
"@type": "@id"
|
|
6267
|
+
}
|
|
6268
|
+
} }
|
|
6269
|
+
});
|
|
6270
|
+
deepStrictEqual(await jsonld_default.expand({
|
|
6271
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
6272
|
+
id: articleId,
|
|
6273
|
+
type: "Article",
|
|
6274
|
+
contentMap: {
|
|
6275
|
+
en: "Original",
|
|
6276
|
+
ko: "Translation"
|
|
6277
|
+
},
|
|
6278
|
+
translations: [{
|
|
6279
|
+
type: "Translation",
|
|
6280
|
+
inLanguage: "ko",
|
|
6281
|
+
translator: [translatorId],
|
|
6282
|
+
translationOfWork: articleId,
|
|
6283
|
+
sourceUpdated: "2026-09-01T00:00:00Z",
|
|
6284
|
+
isBasedOn: revisionId
|
|
6285
|
+
}]
|
|
6286
|
+
}, { documentLoader: fetchDocumentLoader }), [{
|
|
6287
|
+
"@id": articleId,
|
|
6288
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Article"],
|
|
6289
|
+
"https://www.w3.org/ns/activitystreams#content": [{
|
|
6290
|
+
"@language": "en",
|
|
6291
|
+
"@value": "Original"
|
|
6292
|
+
}, {
|
|
6293
|
+
"@language": "ko",
|
|
6294
|
+
"@value": "Translation"
|
|
6295
|
+
}],
|
|
6296
|
+
"https://w3id.org/fep/22cd#translations": [{
|
|
6297
|
+
"@type": ["https://w3id.org/fep/22cd#Translation"],
|
|
6298
|
+
"https://schema.org/inLanguage": [{ "@value": "ko" }],
|
|
6299
|
+
"https://schema.org/translator": [{ "@id": translatorId }],
|
|
6300
|
+
"https://schema.org/translationOfWork": [{ "@id": articleId }],
|
|
6301
|
+
"https://w3id.org/fep/22cd#sourceUpdated": [{
|
|
6302
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
6303
|
+
"@value": "2026-09-01T00:00:00Z"
|
|
6304
|
+
}],
|
|
6305
|
+
"https://schema.org/isBasedOn": [{ "@id": revisionId }]
|
|
6306
|
+
}]
|
|
6307
|
+
}]);
|
|
6308
|
+
deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
|
|
6309
|
+
deepStrictEqual(esm_default.callHistory.calls("https://www.w3.org/ns/activitystreams").length, 0);
|
|
6310
|
+
});
|
|
6153
6311
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
6154
6312
|
await rejects(() => fetchDocumentLoader("ftp://localhost"), UrlError);
|
|
6155
6313
|
});
|
|
@@ -3,7 +3,7 @@ let node_process = require("node:process");
|
|
|
3
3
|
node_process = require_chunk.__toESM(node_process);
|
|
4
4
|
//#region deno.json
|
|
5
5
|
var name = "@fedify/vocab-runtime";
|
|
6
|
-
var version = "2.0.31-dev.
|
|
6
|
+
var version = "2.0.31-dev.2306+e775cf8c";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/request.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Do9eywBl.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-75RoXeN4.cjs");
|
|
3
3
|
let node_test = require("node:test");
|
|
4
4
|
let node_process = require("node:process");
|
|
5
5
|
node_process = require_chunk.__toESM(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-JVGlYdPG.mjs";
|
|
2
2
|
import { test } from "node:test";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { deepStrictEqual } from "node:assert";
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
4
|
+
"schema": "https://schema.org/",
|
|
5
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
6
|
+
"translations": { "@id": "fep-22cd:translations", "@container": "@set" },
|
|
7
|
+
"Translation": "fep-22cd:Translation",
|
|
8
|
+
"sourceUpdated": { "@id": "fep-22cd:sourceUpdated", "@type": "xsd:dateTime" },
|
|
9
|
+
"translator": { "@id": "schema:translator", "@type": "@id", "@container": "@set" },
|
|
10
|
+
"inLanguage": "schema:inLanguage",
|
|
11
|
+
"translationOfWork": { "@id": "schema:translationOfWork", "@type": "@id" },
|
|
12
|
+
"isBasedOn": { "@id": "schema:isBasedOn", "@type": "@id" }
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/contexts.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// cSpell: disable
|
|
4
4
|
|
|
5
5
|
import cidV1Context from "./contexts/cid-v1.json" with { type: "json" };
|
|
6
|
+
import fep22cd from "./contexts/fep-22cd.json" with { type: "json" };
|
|
7
|
+
import fep6757 from "./contexts/fep-6757.json" with { type: "json" };
|
|
6
8
|
import fep7aa9 from "./contexts/fep-7aa9.json" with { type: "json" };
|
|
7
9
|
import fepEf61 from "./contexts/fep-ef61.json" with { type: "json" };
|
|
8
10
|
import joinLemmyContext from "./contexts/join-lemmy.json" with { type: "json" };
|
|
@@ -4345,6 +4347,20 @@ const preloadedContexts: Record<string, unknown> = {
|
|
|
4345
4347
|
// https://github.com/fedify-dev/fedify/issues/1078
|
|
4346
4348
|
"https://w3id.org/fep/7aa9": fep7aa9,
|
|
4347
4349
|
|
|
4350
|
+
// The FEP-6757 context is hosted on Codeberg Pages, whose outages can
|
|
4351
|
+
// prevent documents with license metadata from being parsed. Resolve it
|
|
4352
|
+
// locally so parsing does not depend on the remote context server.
|
|
4353
|
+
// See: https://w3id.org/fep/6757
|
|
4354
|
+
// https://github.com/fedify-dev/fedify/issues/1211
|
|
4355
|
+
"https://w3id.org/fep/6757": fep6757,
|
|
4356
|
+
|
|
4357
|
+
// Resolve translation metadata locally even on versions without Translation.
|
|
4358
|
+
// Copied verbatim from the upstream context at the pinned revision below.
|
|
4359
|
+
// See: https://w3id.org/fep/22cd
|
|
4360
|
+
// https://github.com/fedify-dev/fedify/issues/1214
|
|
4361
|
+
// Source: https://codeberg.org/fediverse/fep/src/commit/7526048b018ccc0a7d05597a8f1eb33518373066/fep/22cd/fep-22cd.jsonld
|
|
4362
|
+
"https://w3id.org/fep/22cd": fep22cd,
|
|
4363
|
+
|
|
4348
4364
|
// Lemmy's context document is served as application/json without the JSON-LD
|
|
4349
4365
|
// context Link header. The default document loader treats that as a regular
|
|
4350
4366
|
// JSON response instead of a JSON-LD context, so every Lemmy activity that
|
package/src/docloader.test.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { gzipSync } from "node:zlib";
|
|
|
8
8
|
import preloadedContexts from "./contexts.ts";
|
|
9
9
|
import cidV1Context from "./contexts/cid-v1.json" with { type: "json" };
|
|
10
10
|
import { getDocumentLoader, getRemoteDocument } from "./docloader.ts";
|
|
11
|
+
import jsonld from "./jsonld.ts";
|
|
11
12
|
import { FetchError } from "./request.ts";
|
|
12
13
|
import { UrlError } from "./url.ts";
|
|
13
14
|
|
|
@@ -367,6 +368,129 @@ test("getDocumentLoader()", async (t) => {
|
|
|
367
368
|
deepStrictEqual(fetchMock.callHistory.calls(url).length, 0);
|
|
368
369
|
});
|
|
369
370
|
|
|
371
|
+
// A Codeberg Pages outage must not prevent loading or expanding FEP-6757.
|
|
372
|
+
// See: https://github.com/fedify-dev/fedify/issues/1211
|
|
373
|
+
fetchMock.get("https://w3id.org/fep/6757", { status: 502 });
|
|
374
|
+
await t.test("preloaded FEP-6757 context", async () => {
|
|
375
|
+
const url = "https://w3id.org/fep/6757";
|
|
376
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
377
|
+
contextUrl: null,
|
|
378
|
+
documentUrl: url,
|
|
379
|
+
document: {
|
|
380
|
+
"@context": {
|
|
381
|
+
license: {
|
|
382
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
383
|
+
"@type": "@id",
|
|
384
|
+
},
|
|
385
|
+
preferredLicense: {
|
|
386
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
387
|
+
"@type": "@id",
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
deepStrictEqual(
|
|
393
|
+
await jsonld.expand({
|
|
394
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
395
|
+
type: "Person",
|
|
396
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
|
397
|
+
preferredLicense: "https://creativecommons.org/licenses/by-nc/4.0/",
|
|
398
|
+
}, { documentLoader: fetchDocumentLoader }),
|
|
399
|
+
[{
|
|
400
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Person"],
|
|
401
|
+
"http://purl.org/dc/terms/license": [{
|
|
402
|
+
"@id": "https://creativecommons.org/licenses/by/4.0/",
|
|
403
|
+
}],
|
|
404
|
+
"https://w3id.org/fep/6757#preferredLicense": [{
|
|
405
|
+
"@id": "https://creativecommons.org/licenses/by-nc/4.0/",
|
|
406
|
+
}],
|
|
407
|
+
}],
|
|
408
|
+
);
|
|
409
|
+
deepStrictEqual(fetchMock.callHistory.calls(url).length, 0);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// A Codeberg Pages outage must not prevent expanding translation metadata.
|
|
413
|
+
// See: https://github.com/fedify-dev/fedify/issues/1214
|
|
414
|
+
fetchMock.get("https://w3id.org/fep/22cd", { status: 502 });
|
|
415
|
+
await t.test("preloaded FEP-22cd context", async () => {
|
|
416
|
+
const url = "https://w3id.org/fep/22cd";
|
|
417
|
+
const articleId = "https://example.com/articles/1";
|
|
418
|
+
const translatorId = "https://example.com/users/alice";
|
|
419
|
+
const revisionId = "https://example.com/articles/1/revisions/1";
|
|
420
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
421
|
+
contextUrl: null,
|
|
422
|
+
documentUrl: url,
|
|
423
|
+
document: {
|
|
424
|
+
"@context": {
|
|
425
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
426
|
+
schema: "https://schema.org/",
|
|
427
|
+
xsd: "http://www.w3.org/2001/XMLSchema#",
|
|
428
|
+
translations: {
|
|
429
|
+
"@id": "fep-22cd:translations",
|
|
430
|
+
"@container": "@set",
|
|
431
|
+
},
|
|
432
|
+
Translation: "fep-22cd:Translation",
|
|
433
|
+
sourceUpdated: {
|
|
434
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
435
|
+
"@type": "xsd:dateTime",
|
|
436
|
+
},
|
|
437
|
+
translator: {
|
|
438
|
+
"@id": "schema:translator",
|
|
439
|
+
"@type": "@id",
|
|
440
|
+
"@container": "@set",
|
|
441
|
+
},
|
|
442
|
+
inLanguage: "schema:inLanguage",
|
|
443
|
+
translationOfWork: {
|
|
444
|
+
"@id": "schema:translationOfWork",
|
|
445
|
+
"@type": "@id",
|
|
446
|
+
},
|
|
447
|
+
isBasedOn: { "@id": "schema:isBasedOn", "@type": "@id" },
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
deepStrictEqual(
|
|
452
|
+
await jsonld.expand({
|
|
453
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
454
|
+
id: articleId,
|
|
455
|
+
type: "Article",
|
|
456
|
+
contentMap: { en: "Original", ko: "Translation" },
|
|
457
|
+
translations: [{
|
|
458
|
+
type: "Translation",
|
|
459
|
+
inLanguage: "ko",
|
|
460
|
+
translator: [translatorId],
|
|
461
|
+
translationOfWork: articleId,
|
|
462
|
+
sourceUpdated: "2026-09-01T00:00:00Z",
|
|
463
|
+
isBasedOn: revisionId,
|
|
464
|
+
}],
|
|
465
|
+
}, { documentLoader: fetchDocumentLoader }),
|
|
466
|
+
[{
|
|
467
|
+
"@id": articleId,
|
|
468
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Article"],
|
|
469
|
+
"https://www.w3.org/ns/activitystreams#content": [
|
|
470
|
+
{ "@language": "en", "@value": "Original" },
|
|
471
|
+
{ "@language": "ko", "@value": "Translation" },
|
|
472
|
+
],
|
|
473
|
+
"https://w3id.org/fep/22cd#translations": [{
|
|
474
|
+
"@type": ["https://w3id.org/fep/22cd#Translation"],
|
|
475
|
+
"https://schema.org/inLanguage": [{ "@value": "ko" }],
|
|
476
|
+
"https://schema.org/translator": [{ "@id": translatorId }],
|
|
477
|
+
"https://schema.org/translationOfWork": [{ "@id": articleId }],
|
|
478
|
+
"https://w3id.org/fep/22cd#sourceUpdated": [{
|
|
479
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
480
|
+
"@value": "2026-09-01T00:00:00Z",
|
|
481
|
+
}],
|
|
482
|
+
"https://schema.org/isBasedOn": [{ "@id": revisionId }],
|
|
483
|
+
}],
|
|
484
|
+
}],
|
|
485
|
+
);
|
|
486
|
+
deepStrictEqual(fetchMock.callHistory.calls(url).length, 0);
|
|
487
|
+
deepStrictEqual(
|
|
488
|
+
fetchMock.callHistory.calls("https://www.w3.org/ns/activitystreams")
|
|
489
|
+
.length,
|
|
490
|
+
0,
|
|
491
|
+
);
|
|
492
|
+
});
|
|
493
|
+
|
|
370
494
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
371
495
|
await rejects(
|
|
372
496
|
() => fetchDocumentLoader("ftp://localhost"),
|
package/src/docloader.ts
CHANGED
|
@@ -280,6 +280,8 @@ export interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
280
280
|
* - <https://w3id.org/security/multikey/v1>
|
|
281
281
|
* - <https://w3id.org/fep/ef61>
|
|
282
282
|
* - <https://w3id.org/fep/7aa9>
|
|
283
|
+
* - <https://w3id.org/fep/6757>
|
|
284
|
+
* - <https://w3id.org/fep/22cd>
|
|
283
285
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
284
286
|
* - <http://schema.org/>
|
|
285
287
|
* @param options Options for the document loader.
|