@fedify/relay 2.2.15 → 2.2.17

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.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-nYiTcBfq.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-COMSyumP.js";
5
5
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { Accept, Announce, Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-nYiTcBfq.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-COMSyumP.js";
5
5
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
@@ -21781,6 +21781,34 @@ var did_v1_default = { "@context": {
21781
21781
  "@type": "@id"
21782
21782
  }
21783
21783
  } };
21784
+ var fep_22cd_default = { "@context": {
21785
+ "fep-22cd": "https://w3id.org/fep/22cd#",
21786
+ "schema": "https://schema.org/",
21787
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
21788
+ "translations": {
21789
+ "@id": "fep-22cd:translations",
21790
+ "@container": "@set"
21791
+ },
21792
+ "Translation": "fep-22cd:Translation",
21793
+ "sourceUpdated": {
21794
+ "@id": "fep-22cd:sourceUpdated",
21795
+ "@type": "xsd:dateTime"
21796
+ },
21797
+ "translator": {
21798
+ "@id": "schema:translator",
21799
+ "@type": "@id",
21800
+ "@container": "@set"
21801
+ },
21802
+ "inLanguage": "schema:inLanguage",
21803
+ "translationOfWork": {
21804
+ "@id": "schema:translationOfWork",
21805
+ "@type": "@id"
21806
+ },
21807
+ "isBasedOn": {
21808
+ "@id": "schema:isBasedOn",
21809
+ "@type": "@id"
21810
+ }
21811
+ } };
21784
21812
  var fep_5711_default = { "@context": {
21785
21813
  "likesOf": {
21786
21814
  "@id": "https://w3id.org/fep/5711#likesOf",
@@ -21815,6 +21843,16 @@ var fep_5711_default = { "@context": {
21815
21843
  "@type": "@id"
21816
21844
  }
21817
21845
  } };
21846
+ var fep_6757_default = { "@context": {
21847
+ "license": {
21848
+ "@id": "http://purl.org/dc/terms/license",
21849
+ "@type": "@id"
21850
+ },
21851
+ "preferredLicense": {
21852
+ "@id": "https://w3id.org/fep/6757#preferredLicense",
21853
+ "@type": "@id"
21854
+ }
21855
+ } };
21818
21856
  var fep_7aa9_default = { "@context": {
21819
21857
  "FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
21820
21858
  "FeaturedItem": "https://w3id.org/fep/7aa9#FeaturedItem",
@@ -22130,7 +22168,7 @@ var joinmastodon_default = { "@context": {
22130
22168
  "suspended": "toot:suspended",
22131
22169
  "attributionDomains": {
22132
22170
  "@id": "toot:attributionDomains",
22133
- "@type": "@id"
22171
+ "@container": "@set"
22134
22172
  }
22135
22173
  } };
22136
22174
  var miscellany_default = { "@context": {
@@ -25730,12 +25768,14 @@ const preloadedContexts = {
25730
25768
  "https://www.w3.org/ns/cid/v1": cid_v1_default,
25731
25769
  "https://w3id.org/fep/ef61": fep_ef61_default,
25732
25770
  "https://w3id.org/fep/7aa9": fep_7aa9_default,
25771
+ "https://w3id.org/fep/6757": fep_6757_default,
25772
+ "https://w3id.org/fep/22cd": fep_22cd_default,
25733
25773
  "https://join-lemmy.org/context.json": join_lemmy_default,
25734
25774
  "http://joinmastodon.org/ns": joinmastodon_default,
25735
25775
  "https://purl.archive.org/miscellany": miscellany_default
25736
25776
  };
25737
25777
  var name = "@fedify/vocab-runtime";
25738
- var version = "2.2.15";
25778
+ var version = "2.2.17";
25739
25779
  /**
25740
25780
  * Error thrown when fetching a JSON-LD document failed.
25741
25781
  */
@@ -26373,6 +26413,8 @@ async function getRemoteDocument(url, response, fetch) {
26373
26413
  * - <https://w3id.org/security/multikey/v1>
26374
26414
  * - <https://w3id.org/fep/ef61>
26375
26415
  * - <https://w3id.org/fep/7aa9>
26416
+ * - <https://w3id.org/fep/6757>
26417
+ * - <https://w3id.org/fep/22cd>
26376
26418
  * - <https://purl.archive.org/socialweb/webfinger>
26377
26419
  * - <http://schema.org/>
26378
26420
  * @param options Options for the document loader.
@@ -26720,6 +26762,48 @@ async function exportSpki(key) {
26720
26762
  pem = (pem.match(/.{1,64}/g) || []).join("\n");
26721
26763
  return `-----BEGIN PUBLIC KEY-----\n${pem}\n-----END PUBLIC KEY-----\n`;
26722
26764
  }
26765
+ const EXTLANG_PAIRS = new Set(Object.entries({
26766
+ ar: "aao abh abv acm acq acw acx acy adf aeb aec afb ajp apc apd arb arq ars ary arz auz avl ayh ayl ayn ayp bbz pga shu ssh",
26767
+ kok: "gom knn",
26768
+ lv: "ltg lvs",
26769
+ ms: "bjn btj bve bvu coa dup hji jak jax kvb kvr kxd lce lcf liw max meo mfa mfb min mqg msi mui orn ors pel pse tmw urk vkk vkt xmm zlm zmi zsm",
26770
+ sgn: "ads aed aen afg ajs ase asf asp asq asw bfi bfk bog bqn bqy bvl bzs cds csc csd cse csf csg csl csn csq csr csx doq dse dsl dsz dyl ecs ehs esl esn eso eth fcs fse fsl fss gds gse gsg gsm gss gus hab haf hds hks hos hps hsh hsl icl iks ils inl ins ise isg isr jcs jhs jks jls jos jsl jus kgi kvk lbs lgs lls lsb lsc lsg lsl lsn lso lsp lst lsv lsw lsy lws mdl mfs mre msd msr mzc mzg mzy nbs ncs nsi nsl nsp nsr nzs okl pgz pks prl prz psc psd psg psl pso psp psr pys rib rms rnb rsi rsl rsm rsn sdl sfb sfs sgg sgx slf sls sqk sqs sqx ssp ssr svk swl syy szs tse tsm tsq tss tsy tza ugn ugy ukl uks vgt vsi vsl vsv wbs xki xml xms yds ygs yhs ysl ysm zhk zib zsl",
26771
+ sw: "swc swh",
26772
+ uz: "uzn uzs",
26773
+ zh: "cdo cjy cmn cnp cpx csp czh czo gan hak hnm hsn luh lzh mnp nan sjc wuu yue"
26774
+ }).flatMap(([prefix, extlangs]) => extlangs.split(" ").map((extlang) => `${prefix}-${extlang}`)));
26775
+ const PREFIX_PATTERN = /^[A-Za-z]{2,3}$/;
26776
+ const EXTLANG_PATTERN = /^[A-Za-z]{3}$/;
26777
+ /**
26778
+ * Normalizes a BCP 47 language tag that has an extended language subtag
26779
+ * (extlang), such as `zh-yue`, into its canonical form, such as `yue`, as
26780
+ * described in [RFC 5646, Section 4.5][1]. `Intl.Locale` rejects extlang
26781
+ * tags, so tags should be normalized before being passed to it.
26782
+ *
26783
+ * Only registered extlangs that follow their registered prefix are removed;
26784
+ * any other tag is returned unchanged, so the result still needs to be
26785
+ * validated, e.g., by `Intl.Locale`.
26786
+ *
26787
+ * NOTE: This function is marked as internal in the 2.0.x–2.4.x patch
26788
+ * releases. When merging it into the *main* branch, remove the `@internal`
26789
+ * tag, formalize it as a public API (`@since 2.5.0`), and add it to
26790
+ * the changelog fragment.
26791
+ *
26792
+ * [1]: https://www.rfc-editor.org/rfc/rfc5646.html#section-4.5
26793
+ *
26794
+ * @param tag The BCP 47 language tag to normalize.
26795
+ * @returns The normalized language tag.
26796
+ * @internal
26797
+ */
26798
+ function normalizeLanguageTag(tag) {
26799
+ const subtags = tag.split("-");
26800
+ if (subtags.length < 2) return tag;
26801
+ const [prefix, extlang, ...rest] = subtags;
26802
+ if (!PREFIX_PATTERN.test(prefix) || !EXTLANG_PATTERN.test(extlang)) return tag;
26803
+ const language = extlang.toLowerCase();
26804
+ if (!EXTLANG_PAIRS.has(`${prefix.toLowerCase()}-${language}`)) return tag;
26805
+ return [language, ...rest].join("-");
26806
+ }
26723
26807
  /**
26724
26808
  * A language-tagged string which corresponds to the `rdf:langString` type.
26725
26809
  */
@@ -26733,11 +26817,13 @@ var LanguageString = class extends String {
26733
26817
  * Constructs a new `LanguageString`.
26734
26818
  * @param value A string value written in the given language.
26735
26819
  * @param language The language of the string. If a string is given, it will
26736
- * be parsed as a `Intl.Locale` object.
26820
+ * be parsed as a `Intl.Locale` object. Extended language
26821
+ * subtags are normalized first, e.g., `zh-yue` is parsed as
26822
+ * `yue`.
26737
26823
  */
26738
26824
  constructor(value, language) {
26739
26825
  super(value);
26740
- this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
26826
+ this.locale = typeof language === "string" ? new Intl.Locale(normalizeLanguageTag(language)) : language;
26741
26827
  }
26742
26828
  };
26743
26829
  LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/relay",
3
- "version": "2.2.15",
3
+ "version": "2.2.17",
4
4
  "description": "ActivityPub relay support for Fedify",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -50,14 +50,14 @@
50
50
  "dependencies": {
51
51
  "@js-temporal/polyfill": "^0.5.1",
52
52
  "@logtape/logtape": "^2.0.5",
53
- "@fedify/fedify": "^2.2.15",
54
- "@fedify/vocab": "2.2.15"
53
+ "@fedify/fedify": "^2.2.17",
54
+ "@fedify/vocab": "2.2.17"
55
55
  },
56
56
  "devDependencies": {
57
57
  "tsdown": "^0.21.6",
58
58
  "typescript": "^6.0.0",
59
59
  "urlpattern-polyfill": "^10.1.0",
60
- "@fedify/vocab-runtime": "^2.2.15"
60
+ "@fedify/vocab-runtime": "^2.2.17"
61
61
  },
62
62
  "scripts": {
63
63
  "build:self": "tsdown",