@fedify/vocab-runtime 2.2.0-dev.613 → 2.2.0-dev.628
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/{chunk-CUT6urMc.cjs → chunk-CKQMccvm.cjs} +7 -9
- package/dist/jsonld.cjs +4 -5
- package/dist/jsonld.d.cts +3 -4
- package/dist/jsonld.d.ts +2 -2
- package/dist/jsonld.js +1 -3
- package/dist/mod.cjs +80 -170
- package/dist/mod.d.cts +1 -2
- package/dist/mod.d.ts +1 -2
- package/dist/mod.js +56 -149
- package/dist/tests/{chunk-DWy1uDak.cjs → chunk-Do9eywBl.cjs} +13 -17
- package/dist/tests/decimal.test.cjs +12 -21
- package/dist/tests/{decimal.test.js → decimal.test.mjs} +10 -18
- package/dist/tests/{docloader-DEi540Xh.js → docloader-OyxWpw3H.mjs} +35 -65
- package/dist/tests/{docloader-txRGFv1x.cjs → docloader-qks_ixwW.cjs} +51 -81
- package/dist/tests/docloader.test.cjs +53 -90
- package/dist/tests/{docloader.test.js → docloader.test.mjs} +53 -96
- package/dist/tests/internal/multicodec.test.cjs +5 -7
- package/dist/tests/internal/{multicodec.test.js → multicodec.test.mjs} +3 -4
- package/dist/tests/{key-ByCmSI2y.js → key-BeTHFQJK.mjs} +14 -25
- package/dist/tests/{key-CCPn6TEY.cjs → key-DTTIntwb.cjs} +60 -71
- package/dist/tests/key.test.cjs +23 -45
- package/dist/tests/{key.test.js → key.test.mjs} +21 -42
- package/dist/tests/{langstr-EPh86hXK.cjs → langstr-CbAxaeEZ.cjs} +6 -8
- package/dist/tests/{langstr-BsVE3s9u.js → langstr-Di5AvKpB.mjs} +1 -2
- package/dist/tests/langstr.test.cjs +7 -8
- package/dist/tests/{langstr.test.js → langstr.test.mjs} +3 -4
- package/dist/tests/{link-DYNFAdNu.cjs → link-FguCydMA.cjs} +6 -8
- package/dist/tests/{link-C3q2TC2G.js → link-NUUWCdnK.mjs} +1 -2
- package/dist/tests/link.test.cjs +5 -7
- package/dist/tests/{link.test.js → link.test.mjs} +3 -4
- package/dist/tests/multibase/multibase.test.cjs +10 -17
- package/dist/tests/multibase/{multibase.test.js → multibase.test.mjs} +10 -18
- package/dist/tests/{multibase-B4g8pz6F.js → multibase-BgU9XRf7.mjs} +5 -12
- package/dist/tests/{multibase-o_ovPHYJ.cjs → multibase-F7LtMMsK.cjs} +43 -49
- package/dist/tests/{multicodec--6hQ74zI.cjs → multicodec-CxGVGa91.cjs} +16 -18
- package/dist/tests/{multicodec-Dq3IiOV4.js → multicodec-CyFp54fI.mjs} +1 -2
- package/dist/tests/{request-BO6hGoBJ.js → request-Cx6B4KEl.mjs} +4 -45
- package/dist/tests/{request-73FIhAHw.cjs → request-D1_g3-fs.cjs} +38 -72
- package/dist/tests/request.test.cjs +23 -24
- package/dist/tests/request.test.mjs +42 -0
- package/dist/tests/{url-CWEP9Zs9.js → url-BQ_kgmCk.mjs} +3 -7
- package/dist/tests/{url-DIjOdK8Q.cjs → url-pFuSds44.cjs} +31 -35
- package/dist/tests/url.test.cjs +5 -7
- package/dist/tests/{url.test.js → url.test.mjs} +3 -4
- package/package.json +3 -3
- package/dist/tests/request.test.js +0 -43
- /package/dist/tests/{decimal.test.d.ts → decimal.test.d.mts} +0 -0
- /package/dist/tests/{docloader.test.d.ts → docloader.test.d.mts} +0 -0
- /package/dist/tests/internal/{multicodec.test.d.ts → multicodec.test.d.mts} +0 -0
- /package/dist/tests/{key.test.d.ts → key.test.d.mts} +0 -0
- /package/dist/tests/{langstr.test.d.ts → langstr.test.d.mts} +0 -0
- /package/dist/tests/{link.test.d.ts → link.test.d.mts} +0 -0
- /package/dist/tests/multibase/{multibase.test.d.ts → multibase.test.d.mts} +0 -0
- /package/dist/tests/{request.test.d.ts → request.test.d.mts} +0 -0
- /package/dist/tests/{url.test.d.ts → url.test.d.mts} +0 -0
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import "./docloader-
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "./multicodec-Dq3IiOV4.js";
|
|
6
|
-
import "./key-ByCmSI2y.js";
|
|
7
|
-
import "./multibase-B4g8pz6F.js";
|
|
8
|
-
import "./langstr-BsVE3s9u.js";
|
|
1
|
+
import "./docloader-OyxWpw3H.mjs";
|
|
2
|
+
import "./key-BeTHFQJK.mjs";
|
|
3
|
+
import "./multibase-BgU9XRf7.mjs";
|
|
4
|
+
import "./langstr-Di5AvKpB.mjs";
|
|
9
5
|
import { deepStrictEqual, throws } from "node:assert";
|
|
10
6
|
import { test } from "node:test";
|
|
11
|
-
|
|
12
7
|
//#region src/decimal.ts
|
|
13
8
|
const DECIMAL_PATTERN = /^(\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)$/;
|
|
14
9
|
const XML_SCHEMA_WHITESPACE_PATTERN = /[\t\n\r ]+/g;
|
|
@@ -83,11 +78,10 @@ function parseDecimal(value) {
|
|
|
83
78
|
if (!isDecimal(normalized)) throw new TypeError(`${JSON.stringify(value)} is not a valid xsd:decimal lexical form.`);
|
|
84
79
|
return normalized;
|
|
85
80
|
}
|
|
86
|
-
|
|
87
81
|
//#endregion
|
|
88
82
|
//#region src/decimal.test.ts
|
|
89
83
|
test("parseDecimal() accepts valid xsd:decimal lexical forms", () => {
|
|
90
|
-
const
|
|
84
|
+
for (const value of [
|
|
91
85
|
"-1.23",
|
|
92
86
|
"12678967.543233",
|
|
93
87
|
"+100000.00",
|
|
@@ -96,8 +90,7 @@ test("parseDecimal() accepts valid xsd:decimal lexical forms", () => {
|
|
|
96
90
|
"5.",
|
|
97
91
|
"0",
|
|
98
92
|
"-0.0"
|
|
99
|
-
];
|
|
100
|
-
for (const value of values) deepStrictEqual(parseDecimal(value), value);
|
|
93
|
+
]) deepStrictEqual(parseDecimal(value), value);
|
|
101
94
|
});
|
|
102
95
|
test("isDecimal() reports valid xsd:decimal lexical forms", () => {
|
|
103
96
|
deepStrictEqual(isDecimal("12.50"), true);
|
|
@@ -122,7 +115,7 @@ test("parseDecimal() normalizes XML Schema whitespace", () => {
|
|
|
122
115
|
deepStrictEqual(parseDecimal(" .5 "), ".5");
|
|
123
116
|
});
|
|
124
117
|
test("parseDecimal() rejects invalid xsd:decimal lexical forms", () => {
|
|
125
|
-
const
|
|
118
|
+
for (const value of [
|
|
126
119
|
"",
|
|
127
120
|
".",
|
|
128
121
|
"+",
|
|
@@ -134,8 +127,7 @@ test("parseDecimal() rejects invalid xsd:decimal lexical forms", () => {
|
|
|
134
127
|
"1..2",
|
|
135
128
|
"1 2.3",
|
|
136
129
|
"1 2.3"
|
|
137
|
-
]
|
|
138
|
-
for (const value of values) throws(() => parseDecimal(value), {
|
|
130
|
+
]) throws(() => parseDecimal(value), {
|
|
139
131
|
name: "TypeError",
|
|
140
132
|
message: `${JSON.stringify(value)} is not a valid xsd:decimal lexical form.`
|
|
141
133
|
});
|
|
@@ -149,5 +141,5 @@ test("canParseDecimal() is exported from the package root", () => {
|
|
|
149
141
|
test("isDecimal() is exported from the package root", () => {
|
|
150
142
|
deepStrictEqual(isDecimal("12.50"), true);
|
|
151
143
|
});
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
//#endregion
|
|
145
|
+
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HttpHeaderLink } from "./link-
|
|
3
|
-
import {
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-Cx6B4KEl.mjs";
|
|
2
|
+
import { t as HttpHeaderLink } from "./link-NUUWCdnK.mjs";
|
|
3
|
+
import { a as validatePublicUrl, t as UrlError } from "./url-BQ_kgmCk.mjs";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
6
|
-
|
|
7
6
|
//#region src/contexts/activitystreams.json
|
|
8
|
-
var
|
|
7
|
+
var activitystreams_default = { "@context": {
|
|
9
8
|
"@vocab": "_:",
|
|
10
9
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
11
10
|
"as": "https://www.w3.org/ns/activitystreams#",
|
|
@@ -381,12 +380,10 @@ var __context$11 = {
|
|
|
381
380
|
"@id": "as:alsoKnownAs",
|
|
382
381
|
"@type": "@id"
|
|
383
382
|
}
|
|
384
|
-
};
|
|
385
|
-
var activitystreams_default = { "@context": __context$11 };
|
|
386
|
-
|
|
383
|
+
} };
|
|
387
384
|
//#endregion
|
|
388
385
|
//#region src/contexts/did-v1.json
|
|
389
|
-
var
|
|
386
|
+
var did_v1_default = { "@context": {
|
|
390
387
|
"@protected": true,
|
|
391
388
|
"id": "@id",
|
|
392
389
|
"type": "@type",
|
|
@@ -440,12 +437,10 @@ var __context$10 = {
|
|
|
440
437
|
"@id": "https://w3id.org/security#verificationMethod",
|
|
441
438
|
"@type": "@id"
|
|
442
439
|
}
|
|
443
|
-
};
|
|
444
|
-
var did_v1_default = { "@context": __context$10 };
|
|
445
|
-
|
|
440
|
+
} };
|
|
446
441
|
//#endregion
|
|
447
442
|
//#region src/contexts/fep-5711.json
|
|
448
|
-
var
|
|
443
|
+
var fep_5711_default = { "@context": {
|
|
449
444
|
"likesOf": {
|
|
450
445
|
"@id": "https://w3id.org/fep/5711#likesOf",
|
|
451
446
|
"@type": "@id"
|
|
@@ -478,12 +473,10 @@ var __context$9 = {
|
|
|
478
473
|
"@id": "https://w3id.org/fep/5711#likedOf",
|
|
479
474
|
"@type": "@id"
|
|
480
475
|
}
|
|
481
|
-
};
|
|
482
|
-
var fep_5711_default = { "@context": __context$9 };
|
|
483
|
-
|
|
476
|
+
} };
|
|
484
477
|
//#endregion
|
|
485
478
|
//#region src/contexts/gotosocial.json
|
|
486
|
-
var
|
|
479
|
+
var gotosocial_default = { "@context": {
|
|
487
480
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
488
481
|
"gts": "https://gotosocial.org/ns#",
|
|
489
482
|
"LikeRequest": "gts:LikeRequest",
|
|
@@ -566,12 +559,10 @@ var __context$8 = {
|
|
|
566
559
|
"@id": "gts:approvedBy",
|
|
567
560
|
"@type": "@id"
|
|
568
561
|
}
|
|
569
|
-
};
|
|
570
|
-
var gotosocial_default = { "@context": __context$8 };
|
|
571
|
-
|
|
562
|
+
} };
|
|
572
563
|
//#endregion
|
|
573
564
|
//#region src/contexts/identity-v1.json
|
|
574
|
-
var
|
|
565
|
+
var identity_v1_default = { "@context": {
|
|
575
566
|
"id": "@id",
|
|
576
567
|
"type": "@type",
|
|
577
568
|
"cred": "https://w3id.org/credentials#",
|
|
@@ -720,12 +711,10 @@ var __context$7 = {
|
|
|
720
711
|
"@id": "perm:writePermission",
|
|
721
712
|
"@type": "@id"
|
|
722
713
|
}
|
|
723
|
-
};
|
|
724
|
-
var identity_v1_default = { "@context": __context$7 };
|
|
725
|
-
|
|
714
|
+
} };
|
|
726
715
|
//#endregion
|
|
727
716
|
//#region src/contexts/joinmastodon.json
|
|
728
|
-
var
|
|
717
|
+
var joinmastodon_default = { "@context": {
|
|
729
718
|
"toot": "http://joinmastodon.org/ns#",
|
|
730
719
|
"Emoji": "toot:Emoji",
|
|
731
720
|
"featured": {
|
|
@@ -750,12 +739,10 @@ var __context$6 = {
|
|
|
750
739
|
"@id": "toot:attributionDomains",
|
|
751
740
|
"@type": "@id"
|
|
752
741
|
}
|
|
753
|
-
};
|
|
754
|
-
var joinmastodon_default = { "@context": __context$6 };
|
|
755
|
-
|
|
742
|
+
} };
|
|
756
743
|
//#endregion
|
|
757
744
|
//#region src/contexts/schemaorg.json
|
|
758
|
-
var
|
|
745
|
+
var schemaorg_default = { "@context": {
|
|
759
746
|
"type": "@type",
|
|
760
747
|
"id": "@id",
|
|
761
748
|
"HTML": { "@id": "rdf:HTML" },
|
|
@@ -4057,12 +4044,10 @@ var __context$5 = {
|
|
|
4057
4044
|
"yearlyRevenue": { "@id": "schema:yearlyRevenue" },
|
|
4058
4045
|
"yearsInOperation": { "@id": "schema:yearsInOperation" },
|
|
4059
4046
|
"yield": { "@id": "schema:yield" }
|
|
4060
|
-
};
|
|
4061
|
-
var schemaorg_default = { "@context": __context$5 };
|
|
4062
|
-
|
|
4047
|
+
} };
|
|
4063
4048
|
//#endregion
|
|
4064
4049
|
//#region src/contexts/security-data-integrity-v1.json
|
|
4065
|
-
var
|
|
4050
|
+
var security_data_integrity_v1_default = { "@context": {
|
|
4066
4051
|
"id": "@id",
|
|
4067
4052
|
"type": "@type",
|
|
4068
4053
|
"@protected": true,
|
|
@@ -4137,12 +4122,10 @@ var __context$4 = {
|
|
|
4137
4122
|
}
|
|
4138
4123
|
}
|
|
4139
4124
|
}
|
|
4140
|
-
};
|
|
4141
|
-
var security_data_integrity_v1_default = { "@context": __context$4 };
|
|
4142
|
-
|
|
4125
|
+
} };
|
|
4143
4126
|
//#endregion
|
|
4144
4127
|
//#region src/contexts/security-data-integrity-v2.json
|
|
4145
|
-
var
|
|
4128
|
+
var security_data_integrity_v2_default = { "@context": {
|
|
4146
4129
|
"id": "@id",
|
|
4147
4130
|
"type": "@type",
|
|
4148
4131
|
"@protected": true,
|
|
@@ -4220,12 +4203,10 @@ var __context$3 = {
|
|
|
4220
4203
|
}
|
|
4221
4204
|
}
|
|
4222
4205
|
}
|
|
4223
|
-
};
|
|
4224
|
-
var security_data_integrity_v2_default = { "@context": __context$3 };
|
|
4225
|
-
|
|
4206
|
+
} };
|
|
4226
4207
|
//#endregion
|
|
4227
4208
|
//#region src/contexts/security-multikey-v1.json
|
|
4228
|
-
var
|
|
4209
|
+
var security_multikey_v1_default = { "@context": {
|
|
4229
4210
|
"id": "@id",
|
|
4230
4211
|
"type": "@type",
|
|
4231
4212
|
"@protected": true,
|
|
@@ -4257,12 +4238,10 @@ var __context$2 = {
|
|
|
4257
4238
|
}
|
|
4258
4239
|
}
|
|
4259
4240
|
}
|
|
4260
|
-
};
|
|
4261
|
-
var security_multikey_v1_default = { "@context": __context$2 };
|
|
4262
|
-
|
|
4241
|
+
} };
|
|
4263
4242
|
//#endregion
|
|
4264
4243
|
//#region src/contexts/security-v1.json
|
|
4265
|
-
var
|
|
4244
|
+
var security_v1_default = { "@context": {
|
|
4266
4245
|
"id": "@id",
|
|
4267
4246
|
"type": "@type",
|
|
4268
4247
|
"dc": "http://purl.org/dc/terms/",
|
|
@@ -4333,21 +4312,17 @@ var __context$1 = {
|
|
|
4333
4312
|
"signature": "sec:signature",
|
|
4334
4313
|
"signatureAlgorithm": "sec:signingAlgorithm",
|
|
4335
4314
|
"signatureValue": "sec:signatureValue"
|
|
4336
|
-
};
|
|
4337
|
-
var security_v1_default = { "@context": __context$1 };
|
|
4338
|
-
|
|
4315
|
+
} };
|
|
4339
4316
|
//#endregion
|
|
4340
4317
|
//#region src/contexts/webfinger.json
|
|
4341
|
-
var
|
|
4318
|
+
var webfinger_default = { "@context": {
|
|
4342
4319
|
"wf": "https://purl.archive.org/socialweb/webfinger#",
|
|
4343
4320
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
4344
4321
|
"webfinger": {
|
|
4345
4322
|
"@id": "wf:webfinger",
|
|
4346
4323
|
"@type": "xsd:string"
|
|
4347
4324
|
}
|
|
4348
|
-
};
|
|
4349
|
-
var webfinger_default = { "@context": __context };
|
|
4350
|
-
|
|
4325
|
+
} };
|
|
4351
4326
|
//#endregion
|
|
4352
4327
|
//#region src/contexts.ts
|
|
4353
4328
|
const preloadedContexts = {
|
|
@@ -4364,8 +4339,6 @@ const preloadedContexts = {
|
|
|
4364
4339
|
"https://w3id.org/fep/5711": fep_5711_default,
|
|
4365
4340
|
"http://joinmastodon.org/ns": joinmastodon_default
|
|
4366
4341
|
};
|
|
4367
|
-
var contexts_default = preloadedContexts;
|
|
4368
|
-
|
|
4369
4342
|
//#endregion
|
|
4370
4343
|
//#region src/docloader.ts
|
|
4371
4344
|
const logger = getLogger([
|
|
@@ -4383,7 +4356,7 @@ const DEFAULT_MAX_REDIRECTION = 20;
|
|
|
4383
4356
|
* @throws {FetchError} If the response is not OK.
|
|
4384
4357
|
* @internal
|
|
4385
4358
|
*/
|
|
4386
|
-
async function getRemoteDocument(url, response, fetch
|
|
4359
|
+
async function getRemoteDocument(url, response, fetch) {
|
|
4387
4360
|
const documentUrl = response.url === "" ? url : response.url;
|
|
4388
4361
|
const docUrl = new URL(documentUrl);
|
|
4389
4362
|
if (!response.ok) {
|
|
@@ -4421,7 +4394,7 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4421
4394
|
alternateUrl: altUri.href,
|
|
4422
4395
|
url: documentUrl
|
|
4423
4396
|
});
|
|
4424
|
-
return await fetch
|
|
4397
|
+
return await fetch(altUri.href);
|
|
4425
4398
|
}
|
|
4426
4399
|
}
|
|
4427
4400
|
}
|
|
@@ -4447,15 +4420,14 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4447
4420
|
attrPattern.lastIndex = 0;
|
|
4448
4421
|
while ((attrMatch = attrPattern.exec(tagContent)) !== null) {
|
|
4449
4422
|
const key = attrMatch[1].toLowerCase();
|
|
4450
|
-
|
|
4451
|
-
attribs[key] = value;
|
|
4423
|
+
attribs[key] = attrMatch[2] ?? attrMatch[3] ?? attrMatch[4] ?? "";
|
|
4452
4424
|
}
|
|
4453
4425
|
if (attribs.rel === "alternate" && "type" in attribs && (attribs.type === "application/activity+json" || attribs.type === "application/ld+json" || attribs.type.startsWith("application/ld+json;")) && "href" in attribs && new URL(attribs.href, docUrl).href !== docUrl.href) {
|
|
4454
4426
|
logger.debug("Found alternate document: {alternateUrl} from {url}", {
|
|
4455
4427
|
alternateUrl: attribs.href,
|
|
4456
4428
|
url: documentUrl
|
|
4457
4429
|
});
|
|
4458
|
-
return await fetch
|
|
4430
|
+
return await fetch(new URL(attribs.href, docUrl).href);
|
|
4459
4431
|
}
|
|
4460
4432
|
}
|
|
4461
4433
|
document = JSON.parse(html);
|
|
@@ -4490,17 +4462,16 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4490
4462
|
* @since 1.3.0
|
|
4491
4463
|
*/
|
|
4492
4464
|
function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedContexts, userAgent } = {}) {
|
|
4493
|
-
const
|
|
4494
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
4465
|
+
const tracer = trace.getTracerProvider().getTracer(name, version);
|
|
4495
4466
|
const maximumRedirection = maxRedirection ?? DEFAULT_MAX_REDIRECTION;
|
|
4496
4467
|
async function load(url, options, redirected = 0, visited = /* @__PURE__ */ new Set()) {
|
|
4497
4468
|
options?.signal?.throwIfAborted();
|
|
4498
4469
|
const currentUrl = new URL(url).href;
|
|
4499
|
-
if (!skipPreloadedContexts && currentUrl in
|
|
4470
|
+
if (!skipPreloadedContexts && currentUrl in preloadedContexts) {
|
|
4500
4471
|
logger.debug("Using preloaded context: {url}.", { url: currentUrl });
|
|
4501
4472
|
return {
|
|
4502
4473
|
contextUrl: null,
|
|
4503
|
-
document:
|
|
4474
|
+
document: preloadedContexts[currentUrl],
|
|
4504
4475
|
documentUrl: currentUrl
|
|
4505
4476
|
};
|
|
4506
4477
|
}
|
|
@@ -4563,6 +4534,5 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
4563
4534
|
}
|
|
4564
4535
|
return load;
|
|
4565
4536
|
}
|
|
4566
|
-
|
|
4567
4537
|
//#endregion
|
|
4568
|
-
export {
|
|
4538
|
+
export { preloadedContexts as n, getDocumentLoader as t };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
const require_request = require(
|
|
3
|
-
const require_link = require(
|
|
4
|
-
const require_url = require(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
require("./chunk-Do9eywBl.cjs");
|
|
2
|
+
const require_request = require("./request-D1_g3-fs.cjs");
|
|
3
|
+
const require_link = require("./link-FguCydMA.cjs");
|
|
4
|
+
const require_url = require("./url-pFuSds44.cjs");
|
|
5
|
+
let _logtape_logtape = require("@logtape/logtape");
|
|
6
|
+
let _opentelemetry_api = require("@opentelemetry/api");
|
|
8
7
|
//#region src/contexts/activitystreams.json
|
|
9
|
-
var
|
|
8
|
+
var activitystreams_default = { "@context": {
|
|
10
9
|
"@vocab": "_:",
|
|
11
10
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
12
11
|
"as": "https://www.w3.org/ns/activitystreams#",
|
|
@@ -382,12 +381,10 @@ var __context$11 = {
|
|
|
382
381
|
"@id": "as:alsoKnownAs",
|
|
383
382
|
"@type": "@id"
|
|
384
383
|
}
|
|
385
|
-
};
|
|
386
|
-
var activitystreams_default = { "@context": __context$11 };
|
|
387
|
-
|
|
384
|
+
} };
|
|
388
385
|
//#endregion
|
|
389
386
|
//#region src/contexts/did-v1.json
|
|
390
|
-
var
|
|
387
|
+
var did_v1_default = { "@context": {
|
|
391
388
|
"@protected": true,
|
|
392
389
|
"id": "@id",
|
|
393
390
|
"type": "@type",
|
|
@@ -441,12 +438,10 @@ var __context$10 = {
|
|
|
441
438
|
"@id": "https://w3id.org/security#verificationMethod",
|
|
442
439
|
"@type": "@id"
|
|
443
440
|
}
|
|
444
|
-
};
|
|
445
|
-
var did_v1_default = { "@context": __context$10 };
|
|
446
|
-
|
|
441
|
+
} };
|
|
447
442
|
//#endregion
|
|
448
443
|
//#region src/contexts/fep-5711.json
|
|
449
|
-
var
|
|
444
|
+
var fep_5711_default = { "@context": {
|
|
450
445
|
"likesOf": {
|
|
451
446
|
"@id": "https://w3id.org/fep/5711#likesOf",
|
|
452
447
|
"@type": "@id"
|
|
@@ -479,12 +474,10 @@ var __context$9 = {
|
|
|
479
474
|
"@id": "https://w3id.org/fep/5711#likedOf",
|
|
480
475
|
"@type": "@id"
|
|
481
476
|
}
|
|
482
|
-
};
|
|
483
|
-
var fep_5711_default = { "@context": __context$9 };
|
|
484
|
-
|
|
477
|
+
} };
|
|
485
478
|
//#endregion
|
|
486
479
|
//#region src/contexts/gotosocial.json
|
|
487
|
-
var
|
|
480
|
+
var gotosocial_default = { "@context": {
|
|
488
481
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
489
482
|
"gts": "https://gotosocial.org/ns#",
|
|
490
483
|
"LikeRequest": "gts:LikeRequest",
|
|
@@ -567,12 +560,10 @@ var __context$8 = {
|
|
|
567
560
|
"@id": "gts:approvedBy",
|
|
568
561
|
"@type": "@id"
|
|
569
562
|
}
|
|
570
|
-
};
|
|
571
|
-
var gotosocial_default = { "@context": __context$8 };
|
|
572
|
-
|
|
563
|
+
} };
|
|
573
564
|
//#endregion
|
|
574
565
|
//#region src/contexts/identity-v1.json
|
|
575
|
-
var
|
|
566
|
+
var identity_v1_default = { "@context": {
|
|
576
567
|
"id": "@id",
|
|
577
568
|
"type": "@type",
|
|
578
569
|
"cred": "https://w3id.org/credentials#",
|
|
@@ -721,12 +712,10 @@ var __context$7 = {
|
|
|
721
712
|
"@id": "perm:writePermission",
|
|
722
713
|
"@type": "@id"
|
|
723
714
|
}
|
|
724
|
-
};
|
|
725
|
-
var identity_v1_default = { "@context": __context$7 };
|
|
726
|
-
|
|
715
|
+
} };
|
|
727
716
|
//#endregion
|
|
728
717
|
//#region src/contexts/joinmastodon.json
|
|
729
|
-
var
|
|
718
|
+
var joinmastodon_default = { "@context": {
|
|
730
719
|
"toot": "http://joinmastodon.org/ns#",
|
|
731
720
|
"Emoji": "toot:Emoji",
|
|
732
721
|
"featured": {
|
|
@@ -751,12 +740,10 @@ var __context$6 = {
|
|
|
751
740
|
"@id": "toot:attributionDomains",
|
|
752
741
|
"@type": "@id"
|
|
753
742
|
}
|
|
754
|
-
};
|
|
755
|
-
var joinmastodon_default = { "@context": __context$6 };
|
|
756
|
-
|
|
743
|
+
} };
|
|
757
744
|
//#endregion
|
|
758
745
|
//#region src/contexts/schemaorg.json
|
|
759
|
-
var
|
|
746
|
+
var schemaorg_default = { "@context": {
|
|
760
747
|
"type": "@type",
|
|
761
748
|
"id": "@id",
|
|
762
749
|
"HTML": { "@id": "rdf:HTML" },
|
|
@@ -4058,12 +4045,10 @@ var __context$5 = {
|
|
|
4058
4045
|
"yearlyRevenue": { "@id": "schema:yearlyRevenue" },
|
|
4059
4046
|
"yearsInOperation": { "@id": "schema:yearsInOperation" },
|
|
4060
4047
|
"yield": { "@id": "schema:yield" }
|
|
4061
|
-
};
|
|
4062
|
-
var schemaorg_default = { "@context": __context$5 };
|
|
4063
|
-
|
|
4048
|
+
} };
|
|
4064
4049
|
//#endregion
|
|
4065
4050
|
//#region src/contexts/security-data-integrity-v1.json
|
|
4066
|
-
var
|
|
4051
|
+
var security_data_integrity_v1_default = { "@context": {
|
|
4067
4052
|
"id": "@id",
|
|
4068
4053
|
"type": "@type",
|
|
4069
4054
|
"@protected": true,
|
|
@@ -4138,12 +4123,10 @@ var __context$4 = {
|
|
|
4138
4123
|
}
|
|
4139
4124
|
}
|
|
4140
4125
|
}
|
|
4141
|
-
};
|
|
4142
|
-
var security_data_integrity_v1_default = { "@context": __context$4 };
|
|
4143
|
-
|
|
4126
|
+
} };
|
|
4144
4127
|
//#endregion
|
|
4145
4128
|
//#region src/contexts/security-data-integrity-v2.json
|
|
4146
|
-
var
|
|
4129
|
+
var security_data_integrity_v2_default = { "@context": {
|
|
4147
4130
|
"id": "@id",
|
|
4148
4131
|
"type": "@type",
|
|
4149
4132
|
"@protected": true,
|
|
@@ -4221,12 +4204,10 @@ var __context$3 = {
|
|
|
4221
4204
|
}
|
|
4222
4205
|
}
|
|
4223
4206
|
}
|
|
4224
|
-
};
|
|
4225
|
-
var security_data_integrity_v2_default = { "@context": __context$3 };
|
|
4226
|
-
|
|
4207
|
+
} };
|
|
4227
4208
|
//#endregion
|
|
4228
4209
|
//#region src/contexts/security-multikey-v1.json
|
|
4229
|
-
var
|
|
4210
|
+
var security_multikey_v1_default = { "@context": {
|
|
4230
4211
|
"id": "@id",
|
|
4231
4212
|
"type": "@type",
|
|
4232
4213
|
"@protected": true,
|
|
@@ -4258,12 +4239,10 @@ var __context$2 = {
|
|
|
4258
4239
|
}
|
|
4259
4240
|
}
|
|
4260
4241
|
}
|
|
4261
|
-
};
|
|
4262
|
-
var security_multikey_v1_default = { "@context": __context$2 };
|
|
4263
|
-
|
|
4242
|
+
} };
|
|
4264
4243
|
//#endregion
|
|
4265
4244
|
//#region src/contexts/security-v1.json
|
|
4266
|
-
var
|
|
4245
|
+
var security_v1_default = { "@context": {
|
|
4267
4246
|
"id": "@id",
|
|
4268
4247
|
"type": "@type",
|
|
4269
4248
|
"dc": "http://purl.org/dc/terms/",
|
|
@@ -4334,21 +4313,17 @@ var __context$1 = {
|
|
|
4334
4313
|
"signature": "sec:signature",
|
|
4335
4314
|
"signatureAlgorithm": "sec:signingAlgorithm",
|
|
4336
4315
|
"signatureValue": "sec:signatureValue"
|
|
4337
|
-
};
|
|
4338
|
-
var security_v1_default = { "@context": __context$1 };
|
|
4339
|
-
|
|
4316
|
+
} };
|
|
4340
4317
|
//#endregion
|
|
4341
4318
|
//#region src/contexts/webfinger.json
|
|
4342
|
-
var
|
|
4319
|
+
var webfinger_default = { "@context": {
|
|
4343
4320
|
"wf": "https://purl.archive.org/socialweb/webfinger#",
|
|
4344
4321
|
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
4345
4322
|
"webfinger": {
|
|
4346
4323
|
"@id": "wf:webfinger",
|
|
4347
4324
|
"@type": "xsd:string"
|
|
4348
4325
|
}
|
|
4349
|
-
};
|
|
4350
|
-
var webfinger_default = { "@context": __context };
|
|
4351
|
-
|
|
4326
|
+
} };
|
|
4352
4327
|
//#endregion
|
|
4353
4328
|
//#region src/contexts.ts
|
|
4354
4329
|
const preloadedContexts = {
|
|
@@ -4365,11 +4340,9 @@ const preloadedContexts = {
|
|
|
4365
4340
|
"https://w3id.org/fep/5711": fep_5711_default,
|
|
4366
4341
|
"http://joinmastodon.org/ns": joinmastodon_default
|
|
4367
4342
|
};
|
|
4368
|
-
var contexts_default = preloadedContexts;
|
|
4369
|
-
|
|
4370
4343
|
//#endregion
|
|
4371
4344
|
//#region src/docloader.ts
|
|
4372
|
-
const logger = (0,
|
|
4345
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
4373
4346
|
"fedify",
|
|
4374
4347
|
"runtime",
|
|
4375
4348
|
"docloader"
|
|
@@ -4384,7 +4357,7 @@ const DEFAULT_MAX_REDIRECTION = 20;
|
|
|
4384
4357
|
* @throws {FetchError} If the response is not OK.
|
|
4385
4358
|
* @internal
|
|
4386
4359
|
*/
|
|
4387
|
-
async function getRemoteDocument(url, response, fetch
|
|
4360
|
+
async function getRemoteDocument(url, response, fetch) {
|
|
4388
4361
|
const documentUrl = response.url === "" ? url : response.url;
|
|
4389
4362
|
const docUrl = new URL(documentUrl);
|
|
4390
4363
|
if (!response.ok) {
|
|
@@ -4422,7 +4395,7 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4422
4395
|
alternateUrl: altUri.href,
|
|
4423
4396
|
url: documentUrl
|
|
4424
4397
|
});
|
|
4425
|
-
return await fetch
|
|
4398
|
+
return await fetch(altUri.href);
|
|
4426
4399
|
}
|
|
4427
4400
|
}
|
|
4428
4401
|
}
|
|
@@ -4448,15 +4421,14 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4448
4421
|
attrPattern.lastIndex = 0;
|
|
4449
4422
|
while ((attrMatch = attrPattern.exec(tagContent)) !== null) {
|
|
4450
4423
|
const key = attrMatch[1].toLowerCase();
|
|
4451
|
-
|
|
4452
|
-
attribs[key] = value;
|
|
4424
|
+
attribs[key] = attrMatch[2] ?? attrMatch[3] ?? attrMatch[4] ?? "";
|
|
4453
4425
|
}
|
|
4454
4426
|
if (attribs.rel === "alternate" && "type" in attribs && (attribs.type === "application/activity+json" || attribs.type === "application/ld+json" || attribs.type.startsWith("application/ld+json;")) && "href" in attribs && new URL(attribs.href, docUrl).href !== docUrl.href) {
|
|
4455
4427
|
logger.debug("Found alternate document: {alternateUrl} from {url}", {
|
|
4456
4428
|
alternateUrl: attribs.href,
|
|
4457
4429
|
url: documentUrl
|
|
4458
4430
|
});
|
|
4459
|
-
return await fetch
|
|
4431
|
+
return await fetch(new URL(attribs.href, docUrl).href);
|
|
4460
4432
|
}
|
|
4461
4433
|
}
|
|
4462
4434
|
document = JSON.parse(html);
|
|
@@ -4491,17 +4463,16 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4491
4463
|
* @since 1.3.0
|
|
4492
4464
|
*/
|
|
4493
4465
|
function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedContexts, userAgent } = {}) {
|
|
4494
|
-
const
|
|
4495
|
-
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
|
4466
|
+
const tracer = _opentelemetry_api.trace.getTracerProvider().getTracer(require_request.name, require_request.version);
|
|
4496
4467
|
const maximumRedirection = maxRedirection ?? DEFAULT_MAX_REDIRECTION;
|
|
4497
4468
|
async function load(url, options, redirected = 0, visited = /* @__PURE__ */ new Set()) {
|
|
4498
4469
|
options?.signal?.throwIfAborted();
|
|
4499
4470
|
const currentUrl = new URL(url).href;
|
|
4500
|
-
if (!skipPreloadedContexts && currentUrl in
|
|
4471
|
+
if (!skipPreloadedContexts && currentUrl in preloadedContexts) {
|
|
4501
4472
|
logger.debug("Using preloaded context: {url}.", { url: currentUrl });
|
|
4502
4473
|
return {
|
|
4503
4474
|
contextUrl: null,
|
|
4504
|
-
document:
|
|
4475
|
+
document: preloadedContexts[currentUrl],
|
|
4505
4476
|
documentUrl: currentUrl
|
|
4506
4477
|
};
|
|
4507
4478
|
}
|
|
@@ -4516,7 +4487,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
4516
4487
|
}
|
|
4517
4488
|
visited.add(currentUrl);
|
|
4518
4489
|
return await tracer.startActiveSpan("activitypub.fetch_document", {
|
|
4519
|
-
kind:
|
|
4490
|
+
kind: _opentelemetry_api.SpanKind.CLIENT,
|
|
4520
4491
|
attributes: { "url.full": currentUrl }
|
|
4521
4492
|
}, async (span) => {
|
|
4522
4493
|
try {
|
|
@@ -4553,7 +4524,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
4553
4524
|
} catch (error) {
|
|
4554
4525
|
span.recordException(error);
|
|
4555
4526
|
span.setStatus({
|
|
4556
|
-
code:
|
|
4527
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
4557
4528
|
message: String(error)
|
|
4558
4529
|
});
|
|
4559
4530
|
throw error;
|
|
@@ -4564,17 +4535,16 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
4564
4535
|
}
|
|
4565
4536
|
return load;
|
|
4566
4537
|
}
|
|
4567
|
-
|
|
4568
4538
|
//#endregion
|
|
4569
|
-
Object.defineProperty(exports,
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4539
|
+
Object.defineProperty(exports, "getDocumentLoader", {
|
|
4540
|
+
enumerable: true,
|
|
4541
|
+
get: function() {
|
|
4542
|
+
return getDocumentLoader;
|
|
4543
|
+
}
|
|
4544
|
+
});
|
|
4545
|
+
Object.defineProperty(exports, "preloadedContexts", {
|
|
4546
|
+
enumerable: true,
|
|
4547
|
+
get: function() {
|
|
4548
|
+
return preloadedContexts;
|
|
4549
|
+
}
|
|
4574
4550
|
});
|
|
4575
|
-
Object.defineProperty(exports, 'getDocumentLoader', {
|
|
4576
|
-
enumerable: true,
|
|
4577
|
-
get: function () {
|
|
4578
|
-
return getDocumentLoader;
|
|
4579
|
-
}
|
|
4580
|
-
});
|