@fedify/relay 2.0.31-dev.2297 → 2.0.31-dev.2308

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-D-q9oKXz.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-B9kfOGei.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-D-q9oKXz.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-B9kfOGei.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";
@@ -21349,6 +21349,34 @@ var cid_v1_default = { "@context": {
21349
21349
  }
21350
21350
  }
21351
21351
  } };
21352
+ var fep_22cd_default = { "@context": {
21353
+ "fep-22cd": "https://w3id.org/fep/22cd#",
21354
+ "schema": "https://schema.org/",
21355
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
21356
+ "translations": {
21357
+ "@id": "fep-22cd:translations",
21358
+ "@container": "@set"
21359
+ },
21360
+ "Translation": "fep-22cd:Translation",
21361
+ "sourceUpdated": {
21362
+ "@id": "fep-22cd:sourceUpdated",
21363
+ "@type": "xsd:dateTime"
21364
+ },
21365
+ "translator": {
21366
+ "@id": "schema:translator",
21367
+ "@type": "@id",
21368
+ "@container": "@set"
21369
+ },
21370
+ "inLanguage": "schema:inLanguage",
21371
+ "translationOfWork": {
21372
+ "@id": "schema:translationOfWork",
21373
+ "@type": "@id"
21374
+ },
21375
+ "isBasedOn": {
21376
+ "@id": "schema:isBasedOn",
21377
+ "@type": "@id"
21378
+ }
21379
+ } };
21352
21380
  var fep_6757_default = { "@context": {
21353
21381
  "license": {
21354
21382
  "@id": "http://purl.org/dc/terms/license",
@@ -25651,6 +25679,7 @@ const preloadedContexts = {
25651
25679
  "https://w3id.org/fep/ef61": fep_ef61_default,
25652
25680
  "https://w3id.org/fep/7aa9": fep_7aa9_default,
25653
25681
  "https://w3id.org/fep/6757": fep_6757_default,
25682
+ "https://w3id.org/fep/22cd": fep_22cd_default,
25654
25683
  "https://join-lemmy.org/context.json": join_lemmy_default,
25655
25684
  "http://joinmastodon.org/ns": { "@context": {
25656
25685
  "toot": "http://joinmastodon.org/ns#",
@@ -25681,7 +25710,7 @@ const preloadedContexts = {
25681
25710
  "https://purl.archive.org/miscellany": miscellany_default
25682
25711
  };
25683
25712
  var name = "@fedify/vocab-runtime";
25684
- var version = "2.0.31-dev.2297+58cbc917";
25713
+ var version = "2.0.31-dev.2308+34090b3a";
25685
25714
  /**
25686
25715
  * Error thrown when fetching a JSON-LD document failed.
25687
25716
  */
@@ -26314,6 +26343,7 @@ async function getRemoteDocument(url, response, fetch) {
26314
26343
  * - <https://w3id.org/fep/ef61>
26315
26344
  * - <https://w3id.org/fep/7aa9>
26316
26345
  * - <https://w3id.org/fep/6757>
26346
+ * - <https://w3id.org/fep/22cd>
26317
26347
  * - <https://purl.archive.org/socialweb/webfinger>
26318
26348
  * - <http://schema.org/>
26319
26349
  * @param options Options for the document loader.
@@ -26660,6 +26690,48 @@ async function exportSpki(key) {
26660
26690
  pem = (pem.match(/.{1,64}/g) || []).join("\n");
26661
26691
  return `-----BEGIN PUBLIC KEY-----\n${pem}\n-----END PUBLIC KEY-----\n`;
26662
26692
  }
26693
+ const EXTLANG_PAIRS = new Set(Object.entries({
26694
+ 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",
26695
+ kok: "gom knn",
26696
+ lv: "ltg lvs",
26697
+ 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",
26698
+ 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",
26699
+ sw: "swc swh",
26700
+ uz: "uzn uzs",
26701
+ zh: "cdo cjy cmn cnp cpx csp czh czo gan hak hnm hsn luh lzh mnp nan sjc wuu yue"
26702
+ }).flatMap(([prefix, extlangs]) => extlangs.split(" ").map((extlang) => `${prefix}-${extlang}`)));
26703
+ const PREFIX_PATTERN = /^[A-Za-z]{2,3}$/;
26704
+ const EXTLANG_PATTERN = /^[A-Za-z]{3}$/;
26705
+ /**
26706
+ * Normalizes a BCP 47 language tag that has an extended language subtag
26707
+ * (extlang), such as `zh-yue`, into its canonical form, such as `yue`, as
26708
+ * described in [RFC 5646, Section 4.5][1]. `Intl.Locale` rejects extlang
26709
+ * tags, so tags should be normalized before being passed to it.
26710
+ *
26711
+ * Only registered extlangs that follow their registered prefix are removed;
26712
+ * any other tag is returned unchanged, so the result still needs to be
26713
+ * validated, e.g., by `Intl.Locale`.
26714
+ *
26715
+ * NOTE: This function is marked as internal in the 2.0.x–2.4.x patch
26716
+ * releases. When merging it into the *main* branch, remove the `@internal`
26717
+ * tag, formalize it as a public API (`@since 2.5.0`), and add it to
26718
+ * the changelog fragment.
26719
+ *
26720
+ * [1]: https://www.rfc-editor.org/rfc/rfc5646.html#section-4.5
26721
+ *
26722
+ * @param tag The BCP 47 language tag to normalize.
26723
+ * @returns The normalized language tag.
26724
+ * @internal
26725
+ */
26726
+ function normalizeLanguageTag(tag) {
26727
+ const subtags = tag.split("-");
26728
+ if (subtags.length < 2) return tag;
26729
+ const [prefix, extlang, ...rest] = subtags;
26730
+ if (!PREFIX_PATTERN.test(prefix) || !EXTLANG_PATTERN.test(extlang)) return tag;
26731
+ const language = extlang.toLowerCase();
26732
+ if (!EXTLANG_PAIRS.has(`${prefix.toLowerCase()}-${language}`)) return tag;
26733
+ return [language, ...rest].join("-");
26734
+ }
26663
26735
  /**
26664
26736
  * A language-tagged string which corresponds to the `rdf:langString` type.
26665
26737
  */
@@ -26673,11 +26745,13 @@ var LanguageString = class extends String {
26673
26745
  * Constructs a new `LanguageString`.
26674
26746
  * @param value A string value written in the given language.
26675
26747
  * @param language The language of the string. If a string is given, it will
26676
- * be parsed as a `Intl.Locale` object.
26748
+ * be parsed as a `Intl.Locale` object. Extended language
26749
+ * subtags are normalized first, e.g., `zh-yue` is parsed as
26750
+ * `yue`.
26677
26751
  */
26678
26752
  constructor(value, language) {
26679
26753
  super(value);
26680
- this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
26754
+ this.locale = typeof language === "string" ? new Intl.Locale(normalizeLanguageTag(language)) : language;
26681
26755
  }
26682
26756
  };
26683
26757
  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.0.31-dev.2297+58cbc917",
3
+ "version": "2.0.31-dev.2308+34090b3a",
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.0",
53
- "@fedify/fedify": "^2.0.31-dev.2297+58cbc917",
54
- "@fedify/vocab": "2.0.31-dev.2297+58cbc917"
53
+ "@fedify/vocab": "2.0.31-dev.2308+34090b3a",
54
+ "@fedify/fedify": "^2.0.31-dev.2308+34090b3a"
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.0.31-dev.2297+58cbc917"
60
+ "@fedify/vocab-runtime": "^2.0.31-dev.2308+34090b3a"
61
61
  },
62
62
  "scripts": {
63
63
  "build:self": "tsdown",