@fedify/vocab-runtime 2.0.31-dev.2297 → 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 +33 -1
- package/dist/mod.d.cts +1 -0
- package/dist/mod.d.ts +1 -0
- package/dist/mod.js +33 -1
- package/dist/tests/{body-DkPsw4D7.mjs → body-CGeu_wlY.mjs} +1 -1
- package/dist/tests/{body-B1TX2GGC.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 +113 -2
- package/dist/tests/docloader.test.mjs +113 -2
- package/dist/tests/{request-ClhOmVbs.cjs → request-75RoXeN4.cjs} +1 -1
- package/dist/tests/{request-DlZHvlsq.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.ts +8 -0
- package/src/docloader.test.ts +82 -0
- package/src/docloader.ts +1 -0
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -128,6 +128,36 @@ 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
|
|
131
161
|
//#region src/contexts/fep-6757.json
|
|
132
162
|
var fep_6757_default = { "@context": {
|
|
133
163
|
"license": {
|
|
@@ -4441,6 +4471,7 @@ const preloadedContexts = {
|
|
|
4441
4471
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4442
4472
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4443
4473
|
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4474
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
4444
4475
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4445
4476
|
"http://joinmastodon.org/ns": { "@context": {
|
|
4446
4477
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -4473,7 +4504,7 @@ const preloadedContexts = {
|
|
|
4473
4504
|
//#endregion
|
|
4474
4505
|
//#region deno.json
|
|
4475
4506
|
var name = "@fedify/vocab-runtime";
|
|
4476
|
-
var version = "2.0.31-dev.
|
|
4507
|
+
var version = "2.0.31-dev.2306+e775cf8c";
|
|
4477
4508
|
//#endregion
|
|
4478
4509
|
//#region src/request.ts
|
|
4479
4510
|
/**
|
|
@@ -5116,6 +5147,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5116
5147
|
* - <https://w3id.org/fep/ef61>
|
|
5117
5148
|
* - <https://w3id.org/fep/7aa9>
|
|
5118
5149
|
* - <https://w3id.org/fep/6757>
|
|
5150
|
+
* - <https://w3id.org/fep/22cd>
|
|
5119
5151
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5120
5152
|
* - <http://schema.org/>
|
|
5121
5153
|
* @param options Options for the document loader.
|
package/dist/mod.d.cts
CHANGED
|
@@ -184,6 +184,7 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
184
184
|
* - <https://w3id.org/fep/ef61>
|
|
185
185
|
* - <https://w3id.org/fep/7aa9>
|
|
186
186
|
* - <https://w3id.org/fep/6757>
|
|
187
|
+
* - <https://w3id.org/fep/22cd>
|
|
187
188
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
188
189
|
* - <http://schema.org/>
|
|
189
190
|
* @param options Options for the document loader.
|
package/dist/mod.d.ts
CHANGED
|
@@ -183,6 +183,7 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
183
183
|
* - <https://w3id.org/fep/ef61>
|
|
184
184
|
* - <https://w3id.org/fep/7aa9>
|
|
185
185
|
* - <https://w3id.org/fep/6757>
|
|
186
|
+
* - <https://w3id.org/fep/22cd>
|
|
186
187
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
187
188
|
* - <http://schema.org/>
|
|
188
189
|
* @param options Options for the document loader.
|
package/dist/mod.js
CHANGED
|
@@ -123,6 +123,36 @@ 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
|
|
126
156
|
//#region src/contexts/fep-6757.json
|
|
127
157
|
var fep_6757_default = { "@context": {
|
|
128
158
|
"license": {
|
|
@@ -4436,6 +4466,7 @@ const preloadedContexts = {
|
|
|
4436
4466
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4437
4467
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4438
4468
|
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4469
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
4439
4470
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4440
4471
|
"http://joinmastodon.org/ns": { "@context": {
|
|
4441
4472
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -4468,7 +4499,7 @@ const preloadedContexts = {
|
|
|
4468
4499
|
//#endregion
|
|
4469
4500
|
//#region deno.json
|
|
4470
4501
|
var name = "@fedify/vocab-runtime";
|
|
4471
|
-
var version = "2.0.31-dev.
|
|
4502
|
+
var version = "2.0.31-dev.2306+e775cf8c";
|
|
4472
4503
|
//#endregion
|
|
4473
4504
|
//#region src/request.ts
|
|
4474
4505
|
/**
|
|
@@ -5111,6 +5142,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5111
5142
|
* - <https://w3id.org/fep/ef61>
|
|
5112
5143
|
* - <https://w3id.org/fep/7aa9>
|
|
5113
5144
|
* - <https://w3id.org/fep/6757>
|
|
5145
|
+
* - <https://w3id.org/fep/22cd>
|
|
5114
5146
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5115
5147
|
* - <http://schema.org/>
|
|
5116
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");
|
|
@@ -1327,6 +1327,36 @@ var cid_v1_default = { "@context": {
|
|
|
1327
1327
|
}
|
|
1328
1328
|
} };
|
|
1329
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
|
|
1330
1360
|
//#region src/contexts/fep-6757.json
|
|
1331
1361
|
var fep_6757_default = { "@context": {
|
|
1332
1362
|
"license": {
|
|
@@ -5640,6 +5670,7 @@ const preloadedContexts = {
|
|
|
5640
5670
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
5641
5671
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
5642
5672
|
"https://w3id.org/fep/6757": fep_6757_default,
|
|
5673
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
5643
5674
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
5644
5675
|
"http://joinmastodon.org/ns": { "@context": {
|
|
5645
5676
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -5782,6 +5813,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5782
5813
|
* - <https://w3id.org/fep/ef61>
|
|
5783
5814
|
* - <https://w3id.org/fep/7aa9>
|
|
5784
5815
|
* - <https://w3id.org/fep/6757>
|
|
5816
|
+
* - <https://w3id.org/fep/22cd>
|
|
5785
5817
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5786
5818
|
* - <http://schema.org/>
|
|
5787
5819
|
* @param options Options for the document loader.
|
|
@@ -6180,6 +6212,85 @@ var jsonld_default = jsonld_dist_jsonld_esm_js.default;
|
|
|
6180
6212
|
}]);
|
|
6181
6213
|
(0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
|
|
6182
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
|
+
});
|
|
6183
6294
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
6184
6295
|
await (0, node_assert.rejects)(() => fetchDocumentLoader("ftp://localhost"), require_url.UrlError);
|
|
6185
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";
|
|
@@ -1344,6 +1344,36 @@ var cid_v1_default = { "@context": {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
} };
|
|
1346
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
|
|
1347
1377
|
//#region src/contexts/fep-6757.json
|
|
1348
1378
|
var fep_6757_default = { "@context": {
|
|
1349
1379
|
"license": {
|
|
@@ -5657,6 +5687,7 @@ const preloadedContexts = {
|
|
|
5657
5687
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
5658
5688
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
5659
5689
|
"https://w3id.org/fep/6757": fep_6757_default,
|
|
5690
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
5660
5691
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
5661
5692
|
"http://joinmastodon.org/ns": { "@context": {
|
|
5662
5693
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -5799,6 +5830,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5799
5830
|
* - <https://w3id.org/fep/ef61>
|
|
5800
5831
|
* - <https://w3id.org/fep/7aa9>
|
|
5801
5832
|
* - <https://w3id.org/fep/6757>
|
|
5833
|
+
* - <https://w3id.org/fep/22cd>
|
|
5802
5834
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5803
5835
|
* - <http://schema.org/>
|
|
5804
5836
|
* @param options Options for the document loader.
|
|
@@ -6197,6 +6229,85 @@ test("getDocumentLoader()", async (t) => {
|
|
|
6197
6229
|
}]);
|
|
6198
6230
|
deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
|
|
6199
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
|
+
});
|
|
6200
6311
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
6201
6312
|
await rejects(() => fetchDocumentLoader("ftp://localhost"), UrlError);
|
|
6202
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,7 @@
|
|
|
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" };
|
|
6
7
|
import fep6757 from "./contexts/fep-6757.json" with { type: "json" };
|
|
7
8
|
import fep7aa9 from "./contexts/fep-7aa9.json" with { type: "json" };
|
|
8
9
|
import fepEf61 from "./contexts/fep-ef61.json" with { type: "json" };
|
|
@@ -4353,6 +4354,13 @@ const preloadedContexts: Record<string, unknown> = {
|
|
|
4353
4354
|
// https://github.com/fedify-dev/fedify/issues/1211
|
|
4354
4355
|
"https://w3id.org/fep/6757": fep6757,
|
|
4355
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
|
+
|
|
4356
4364
|
// Lemmy's context document is served as application/json without the JSON-LD
|
|
4357
4365
|
// context Link header. The default document loader treats that as a regular
|
|
4358
4366
|
// JSON response instead of a JSON-LD context, so every Lemmy activity that
|
package/src/docloader.test.ts
CHANGED
|
@@ -409,6 +409,88 @@ test("getDocumentLoader()", async (t) => {
|
|
|
409
409
|
deepStrictEqual(fetchMock.callHistory.calls(url).length, 0);
|
|
410
410
|
});
|
|
411
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
|
+
|
|
412
494
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
413
495
|
await rejects(
|
|
414
496
|
() => fetchDocumentLoader("ftp://localhost"),
|
package/src/docloader.ts
CHANGED
|
@@ -281,6 +281,7 @@ export interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
281
281
|
* - <https://w3id.org/fep/ef61>
|
|
282
282
|
* - <https://w3id.org/fep/7aa9>
|
|
283
283
|
* - <https://w3id.org/fep/6757>
|
|
284
|
+
* - <https://w3id.org/fep/22cd>
|
|
284
285
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
285
286
|
* - <http://schema.org/>
|
|
286
287
|
* @param options Options for the document loader.
|