@fedify/vocab-runtime 2.0.31-dev.2273 → 2.0.31-dev.2297
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 +15 -1
- package/dist/mod.d.cts +1 -0
- package/dist/mod.d.ts +1 -0
- package/dist/mod.js +15 -1
- package/dist/tests/{body-CwWI4-VY.cjs → body-B1TX2GGC.cjs} +1 -1
- package/dist/tests/{body-wOtDIud6.mjs → body-DkPsw4D7.mjs} +1 -1
- package/dist/tests/body.test.cjs +1 -1
- package/dist/tests/body.test.mjs +1 -1
- package/dist/tests/docloader.test.cjs +50 -2
- package/dist/tests/docloader.test.mjs +49 -2
- package/dist/tests/{request-DcF60AOA.cjs → request-ClhOmVbs.cjs} +1 -1
- package/dist/tests/{request-B112Mks-.mjs → request-DlZHvlsq.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-6757.json +12 -0
- package/src/contexts.ts +8 -0
- package/src/docloader.test.ts +42 -0
- package/src/docloader.ts +1 -0
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -128,6 +128,18 @@ var cid_v1_default = { "@context": {
|
|
|
128
128
|
}
|
|
129
129
|
} };
|
|
130
130
|
//#endregion
|
|
131
|
+
//#region src/contexts/fep-6757.json
|
|
132
|
+
var fep_6757_default = { "@context": {
|
|
133
|
+
"license": {
|
|
134
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
135
|
+
"@type": "@id"
|
|
136
|
+
},
|
|
137
|
+
"preferredLicense": {
|
|
138
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
139
|
+
"@type": "@id"
|
|
140
|
+
}
|
|
141
|
+
} };
|
|
142
|
+
//#endregion
|
|
131
143
|
//#region src/contexts/fep-7aa9.json
|
|
132
144
|
var fep_7aa9_default = { "@context": {
|
|
133
145
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -4428,6 +4440,7 @@ const preloadedContexts = {
|
|
|
4428
4440
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
4429
4441
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4430
4442
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4443
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4431
4444
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4432
4445
|
"http://joinmastodon.org/ns": { "@context": {
|
|
4433
4446
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -4460,7 +4473,7 @@ const preloadedContexts = {
|
|
|
4460
4473
|
//#endregion
|
|
4461
4474
|
//#region deno.json
|
|
4462
4475
|
var name = "@fedify/vocab-runtime";
|
|
4463
|
-
var version = "2.0.31-dev.
|
|
4476
|
+
var version = "2.0.31-dev.2297+58cbc917";
|
|
4464
4477
|
//#endregion
|
|
4465
4478
|
//#region src/request.ts
|
|
4466
4479
|
/**
|
|
@@ -5102,6 +5115,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5102
5115
|
* - <https://w3id.org/security/multikey/v1>
|
|
5103
5116
|
* - <https://w3id.org/fep/ef61>
|
|
5104
5117
|
* - <https://w3id.org/fep/7aa9>
|
|
5118
|
+
* - <https://w3id.org/fep/6757>
|
|
5105
5119
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5106
5120
|
* - <http://schema.org/>
|
|
5107
5121
|
* @param options Options for the document loader.
|
package/dist/mod.d.cts
CHANGED
|
@@ -183,6 +183,7 @@ 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>
|
|
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.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ 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>
|
|
185
186
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
186
187
|
* - <http://schema.org/>
|
|
187
188
|
* @param options Options for the document loader.
|
package/dist/mod.js
CHANGED
|
@@ -123,6 +123,18 @@ var cid_v1_default = { "@context": {
|
|
|
123
123
|
}
|
|
124
124
|
} };
|
|
125
125
|
//#endregion
|
|
126
|
+
//#region src/contexts/fep-6757.json
|
|
127
|
+
var fep_6757_default = { "@context": {
|
|
128
|
+
"license": {
|
|
129
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
130
|
+
"@type": "@id"
|
|
131
|
+
},
|
|
132
|
+
"preferredLicense": {
|
|
133
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
134
|
+
"@type": "@id"
|
|
135
|
+
}
|
|
136
|
+
} };
|
|
137
|
+
//#endregion
|
|
126
138
|
//#region src/contexts/fep-7aa9.json
|
|
127
139
|
var fep_7aa9_default = { "@context": {
|
|
128
140
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -4423,6 +4435,7 @@ const preloadedContexts = {
|
|
|
4423
4435
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
4424
4436
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4425
4437
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4438
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4426
4439
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4427
4440
|
"http://joinmastodon.org/ns": { "@context": {
|
|
4428
4441
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -4455,7 +4468,7 @@ const preloadedContexts = {
|
|
|
4455
4468
|
//#endregion
|
|
4456
4469
|
//#region deno.json
|
|
4457
4470
|
var name = "@fedify/vocab-runtime";
|
|
4458
|
-
var version = "2.0.31-dev.
|
|
4471
|
+
var version = "2.0.31-dev.2297+58cbc917";
|
|
4459
4472
|
//#endregion
|
|
4460
4473
|
//#region src/request.ts
|
|
4461
4474
|
/**
|
|
@@ -5097,6 +5110,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5097
5110
|
* - <https://w3id.org/security/multikey/v1>
|
|
5098
5111
|
* - <https://w3id.org/fep/ef61>
|
|
5099
5112
|
* - <https://w3id.org/fep/7aa9>
|
|
5113
|
+
* - <https://w3id.org/fep/6757>
|
|
5100
5114
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5101
5115
|
* - <http://schema.org/>
|
|
5102
5116
|
* @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-ClhOmVbs.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-B1TX2GGC.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-DkPsw4D7.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-ClhOmVbs.cjs");
|
|
3
|
+
const require_body = require("./body-B1TX2GGC.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,18 @@ var cid_v1_default = { "@context": {
|
|
|
1325
1327
|
}
|
|
1326
1328
|
} };
|
|
1327
1329
|
//#endregion
|
|
1330
|
+
//#region src/contexts/fep-6757.json
|
|
1331
|
+
var fep_6757_default = { "@context": {
|
|
1332
|
+
"license": {
|
|
1333
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
1334
|
+
"@type": "@id"
|
|
1335
|
+
},
|
|
1336
|
+
"preferredLicense": {
|
|
1337
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
1338
|
+
"@type": "@id"
|
|
1339
|
+
}
|
|
1340
|
+
} };
|
|
1341
|
+
//#endregion
|
|
1328
1342
|
//#region src/contexts/fep-7aa9.json
|
|
1329
1343
|
var fep_7aa9_default = { "@context": {
|
|
1330
1344
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -5625,6 +5639,7 @@ const preloadedContexts = {
|
|
|
5625
5639
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
5626
5640
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
5627
5641
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
5642
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
5628
5643
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
5629
5644
|
"http://joinmastodon.org/ns": { "@context": {
|
|
5630
5645
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -5766,6 +5781,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5766
5781
|
* - <https://w3id.org/security/multikey/v1>
|
|
5767
5782
|
* - <https://w3id.org/fep/ef61>
|
|
5768
5783
|
* - <https://w3id.org/fep/7aa9>
|
|
5784
|
+
* - <https://w3id.org/fep/6757>
|
|
5769
5785
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5770
5786
|
* - <http://schema.org/>
|
|
5771
5787
|
* @param options Options for the document loader.
|
|
@@ -5854,6 +5870,9 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
|
|
|
5854
5870
|
return (url, options) => load(url, options);
|
|
5855
5871
|
}
|
|
5856
5872
|
//#endregion
|
|
5873
|
+
//#region src/jsonld.ts
|
|
5874
|
+
var jsonld_default = jsonld_dist_jsonld_esm_js.default;
|
|
5875
|
+
//#endregion
|
|
5857
5876
|
//#region src/docloader.test.ts
|
|
5858
5877
|
(0, node_test.test)("new FetchError()", () => {
|
|
5859
5878
|
const e = new require_request.FetchError("https://example.com/", "An error message.");
|
|
@@ -6132,6 +6151,35 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
|
|
|
6132
6151
|
});
|
|
6133
6152
|
(0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
|
|
6134
6153
|
});
|
|
6154
|
+
esm_default.get("https://w3id.org/fep/6757", { status: 502 });
|
|
6155
|
+
await t.test("preloaded FEP-6757 context", async () => {
|
|
6156
|
+
const url = "https://w3id.org/fep/6757";
|
|
6157
|
+
(0, node_assert.deepStrictEqual)(await fetchDocumentLoader(url), {
|
|
6158
|
+
contextUrl: null,
|
|
6159
|
+
documentUrl: url,
|
|
6160
|
+
document: { "@context": {
|
|
6161
|
+
license: {
|
|
6162
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
6163
|
+
"@type": "@id"
|
|
6164
|
+
},
|
|
6165
|
+
preferredLicense: {
|
|
6166
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
6167
|
+
"@type": "@id"
|
|
6168
|
+
}
|
|
6169
|
+
} }
|
|
6170
|
+
});
|
|
6171
|
+
(0, node_assert.deepStrictEqual)(await jsonld_default.expand({
|
|
6172
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
6173
|
+
type: "Person",
|
|
6174
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
|
6175
|
+
preferredLicense: "https://creativecommons.org/licenses/by-nc/4.0/"
|
|
6176
|
+
}, { documentLoader: fetchDocumentLoader }), [{
|
|
6177
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Person"],
|
|
6178
|
+
"http://purl.org/dc/terms/license": [{ "@id": "https://creativecommons.org/licenses/by/4.0/" }],
|
|
6179
|
+
"https://w3id.org/fep/6757#preferredLicense": [{ "@id": "https://creativecommons.org/licenses/by-nc/4.0/" }]
|
|
6180
|
+
}]);
|
|
6181
|
+
(0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
|
|
6182
|
+
});
|
|
6135
6183
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
6136
6184
|
await (0, node_assert.rejects)(() => fetchDocumentLoader("ftp://localhost"), require_url.UrlError);
|
|
6137
6185
|
});
|
|
@@ -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-DlZHvlsq.mjs";
|
|
2
|
+
import { n as MAX_BODY_SIZE, r as readBoundedText } from "./body-DkPsw4D7.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,18 @@ var cid_v1_default = { "@context": {
|
|
|
1343
1344
|
}
|
|
1344
1345
|
} };
|
|
1345
1346
|
//#endregion
|
|
1347
|
+
//#region src/contexts/fep-6757.json
|
|
1348
|
+
var fep_6757_default = { "@context": {
|
|
1349
|
+
"license": {
|
|
1350
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
1351
|
+
"@type": "@id"
|
|
1352
|
+
},
|
|
1353
|
+
"preferredLicense": {
|
|
1354
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
1355
|
+
"@type": "@id"
|
|
1356
|
+
}
|
|
1357
|
+
} };
|
|
1358
|
+
//#endregion
|
|
1346
1359
|
//#region src/contexts/fep-7aa9.json
|
|
1347
1360
|
var fep_7aa9_default = { "@context": {
|
|
1348
1361
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -5643,6 +5656,7 @@ const preloadedContexts = {
|
|
|
5643
5656
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
5644
5657
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
5645
5658
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
5659
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
5646
5660
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
5647
5661
|
"http://joinmastodon.org/ns": { "@context": {
|
|
5648
5662
|
"toot": "http://joinmastodon.org/ns#",
|
|
@@ -5784,6 +5798,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5784
5798
|
* - <https://w3id.org/security/multikey/v1>
|
|
5785
5799
|
* - <https://w3id.org/fep/ef61>
|
|
5786
5800
|
* - <https://w3id.org/fep/7aa9>
|
|
5801
|
+
* - <https://w3id.org/fep/6757>
|
|
5787
5802
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5788
5803
|
* - <http://schema.org/>
|
|
5789
5804
|
* @param options Options for the document loader.
|
|
@@ -5872,6 +5887,9 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
|
|
|
5872
5887
|
return (url, options) => load(url, options);
|
|
5873
5888
|
}
|
|
5874
5889
|
//#endregion
|
|
5890
|
+
//#region src/jsonld.ts
|
|
5891
|
+
var jsonld_default = jsonld;
|
|
5892
|
+
//#endregion
|
|
5875
5893
|
//#region src/docloader.test.ts
|
|
5876
5894
|
test("new FetchError()", () => {
|
|
5877
5895
|
const e = new FetchError("https://example.com/", "An error message.");
|
|
@@ -6150,6 +6168,35 @@ test("getDocumentLoader()", async (t) => {
|
|
|
6150
6168
|
});
|
|
6151
6169
|
deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
|
|
6152
6170
|
});
|
|
6171
|
+
esm_default.get("https://w3id.org/fep/6757", { status: 502 });
|
|
6172
|
+
await t.test("preloaded FEP-6757 context", async () => {
|
|
6173
|
+
const url = "https://w3id.org/fep/6757";
|
|
6174
|
+
deepStrictEqual(await fetchDocumentLoader(url), {
|
|
6175
|
+
contextUrl: null,
|
|
6176
|
+
documentUrl: url,
|
|
6177
|
+
document: { "@context": {
|
|
6178
|
+
license: {
|
|
6179
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
6180
|
+
"@type": "@id"
|
|
6181
|
+
},
|
|
6182
|
+
preferredLicense: {
|
|
6183
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
6184
|
+
"@type": "@id"
|
|
6185
|
+
}
|
|
6186
|
+
} }
|
|
6187
|
+
});
|
|
6188
|
+
deepStrictEqual(await jsonld_default.expand({
|
|
6189
|
+
"@context": ["https://www.w3.org/ns/activitystreams", url],
|
|
6190
|
+
type: "Person",
|
|
6191
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
|
6192
|
+
preferredLicense: "https://creativecommons.org/licenses/by-nc/4.0/"
|
|
6193
|
+
}, { documentLoader: fetchDocumentLoader }), [{
|
|
6194
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Person"],
|
|
6195
|
+
"http://purl.org/dc/terms/license": [{ "@id": "https://creativecommons.org/licenses/by/4.0/" }],
|
|
6196
|
+
"https://w3id.org/fep/6757#preferredLicense": [{ "@id": "https://creativecommons.org/licenses/by-nc/4.0/" }]
|
|
6197
|
+
}]);
|
|
6198
|
+
deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
|
|
6199
|
+
});
|
|
6153
6200
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
6154
6201
|
await rejects(() => fetchDocumentLoader("ftp://localhost"), UrlError);
|
|
6155
6202
|
});
|
|
@@ -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.2297+58cbc917";
|
|
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-ClhOmVbs.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-DlZHvlsq.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
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 fep6757 from "./contexts/fep-6757.json" with { type: "json" };
|
|
6
7
|
import fep7aa9 from "./contexts/fep-7aa9.json" with { type: "json" };
|
|
7
8
|
import fepEf61 from "./contexts/fep-ef61.json" with { type: "json" };
|
|
8
9
|
import joinLemmyContext from "./contexts/join-lemmy.json" with { type: "json" };
|
|
@@ -4345,6 +4346,13 @@ const preloadedContexts: Record<string, unknown> = {
|
|
|
4345
4346
|
// https://github.com/fedify-dev/fedify/issues/1078
|
|
4346
4347
|
"https://w3id.org/fep/7aa9": fep7aa9,
|
|
4347
4348
|
|
|
4349
|
+
// The FEP-6757 context is hosted on Codeberg Pages, whose outages can
|
|
4350
|
+
// prevent documents with license metadata from being parsed. Resolve it
|
|
4351
|
+
// locally so parsing does not depend on the remote context server.
|
|
4352
|
+
// See: https://w3id.org/fep/6757
|
|
4353
|
+
// https://github.com/fedify-dev/fedify/issues/1211
|
|
4354
|
+
"https://w3id.org/fep/6757": fep6757,
|
|
4355
|
+
|
|
4348
4356
|
// Lemmy's context document is served as application/json without the JSON-LD
|
|
4349
4357
|
// context Link header. The default document loader treats that as a regular
|
|
4350
4358
|
// 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,47 @@ 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
|
+
|
|
370
412
|
await t.test("deny non-HTTP/HTTPS", async () => {
|
|
371
413
|
await rejects(
|
|
372
414
|
() => fetchDocumentLoader("ftp://localhost"),
|
package/src/docloader.ts
CHANGED
|
@@ -280,6 +280,7 @@ 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>
|
|
283
284
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
284
285
|
* - <http://schema.org/>
|
|
285
286
|
* @param options Options for the document loader.
|