@fedify/relay 2.5.0-dev.2314 → 2.5.0-dev.2327

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 "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-C7AtHk_U.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-C-Wo6k82.js";
5
5
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { deepStrictEqual, ok, strictEqual } from "node:assert";
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-C7AtHk_U.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-C-Wo6k82.js";
5
5
  import { MemoryKvStore, signJsonLd, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { deepStrictEqual, ok, strictEqual } from "node:assert";
package/dist/mod.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Context, KvStore, MessageQueue } from "@fedify/fedify";
3
3
  import { Actor } from "@fedify/vocab";
4
- //#region ../vocab-runtime/dist/docloader-CYwqh5Df.d.ts
4
+ //#region ../vocab-runtime/dist/docloader-BMHljyYb.d.ts
5
5
  /**
6
6
  * Options for making `User-Agent` string.
7
7
  * @see {@link getUserAgent}
package/dist/mod.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Context, KvStore, MessageQueue } from "@fedify/fedify";
3
3
  import { Actor } from "@fedify/vocab";
4
- //#region ../vocab-runtime/dist/docloader-CYwqh5Df.d.ts
4
+ //#region ../vocab-runtime/dist/docloader-BMHljyYb.d.ts
5
5
  /**
6
6
  * Options for making `User-Agent` string.
7
7
  * @see {@link getUserAgent}
@@ -31,7 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  }) : target, mod));
32
32
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
33
33
  //#endregion
34
- //#region ../vocab-runtime/dist/contexts-DPuJ4UYL.js
34
+ //#region ../vocab-runtime/dist/contexts-DWrj4AGR.js
35
35
  const preloadedContexts = {
36
36
  "https://www.w3.org/ns/activitystreams": { "@context": {
37
37
  "@vocab": "_:",
@@ -4469,6 +4469,16 @@ const preloadedContexts = {
4469
4469
  "@type": "@id"
4470
4470
  }
4471
4471
  } },
4472
+ "https://w3id.org/fep/6757": { "@context": {
4473
+ "license": {
4474
+ "@id": "http://purl.org/dc/terms/license",
4475
+ "@type": "@id"
4476
+ },
4477
+ "preferredLicense": {
4478
+ "@id": "https://w3id.org/fep/6757#preferredLicense",
4479
+ "@type": "@id"
4480
+ }
4481
+ } },
4472
4482
  "https://join-lemmy.org/context.json": { "@context": ["https://w3id.org/security/v1", {
4473
4483
  "as": "https://www.w3.org/ns/activitystreams#",
4474
4484
  "lemmy": "https://join-lemmy.org/ns#",
@@ -4520,7 +4530,7 @@ const preloadedContexts = {
4520
4530
  "suspended": "toot:suspended",
4521
4531
  "attributionDomains": {
4522
4532
  "@id": "toot:attributionDomains",
4523
- "@type": "@id"
4533
+ "@container": "@set"
4524
4534
  }
4525
4535
  } },
4526
4536
  "https://purl.archive.org/miscellany": { "@context": {
@@ -26114,7 +26124,7 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26114
26124
  require_build();
26115
26125
  var import_src = /* @__PURE__ */ __toESM(require_src(), 1);
26116
26126
  var name = "@fedify/vocab-runtime";
26117
- var version = "2.5.0-dev.2314+d73be480";
26127
+ var version = "2.5.0-dev.2327+3a7ba490";
26118
26128
  /**
26119
26129
  * Error thrown when fetching a JSON-LD document failed.
26120
26130
  */
@@ -26764,6 +26774,8 @@ function withDocumentLoaderTimeout(loader, timeout) {
26764
26774
  * - <https://w3id.org/security/multikey/v1>
26765
26775
  * - <https://w3id.org/fep/ef61>
26766
26776
  * - <https://w3id.org/fep/7aa9>
26777
+ * - <https://w3id.org/fep/6757>
26778
+ * - <https://w3id.org/fep/22cd>
26767
26779
  * - <https://purl.archive.org/socialweb/webfinger>
26768
26780
  * - <http://schema.org/>
26769
26781
  * @param options Options for the document loader.
@@ -27120,6 +27132,43 @@ async function exportSpki(key) {
27120
27132
  }
27121
27133
  new TextDecoder();
27122
27134
  Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")?.get;
27135
+ const EXTLANG_PAIRS = new Set(Object.entries({
27136
+ 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",
27137
+ kok: "gom knn",
27138
+ lv: "ltg lvs",
27139
+ 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",
27140
+ 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",
27141
+ sw: "swc swh",
27142
+ uz: "uzn uzs",
27143
+ zh: "cdo cjy cmn cnp cpx csp czh czo gan hak hnm hsn luh lzh mnp nan sjc wuu yue"
27144
+ }).flatMap(([prefix, extlangs]) => extlangs.split(" ").map((extlang) => `${prefix}-${extlang}`)));
27145
+ const PREFIX_PATTERN = /^[A-Za-z]{2,3}$/;
27146
+ const EXTLANG_PATTERN = /^[A-Za-z]{3}$/;
27147
+ /**
27148
+ * Normalizes a BCP 47 language tag that has an extended language subtag
27149
+ * (extlang), such as `zh-yue`, into its canonical form, such as `yue`, as
27150
+ * described in [RFC 5646, Section 4.5][1]. `Intl.Locale` rejects extlang
27151
+ * tags, so tags should be normalized before being passed to it.
27152
+ *
27153
+ * Only registered extlangs that follow their registered prefix are removed;
27154
+ * any other tag is returned unchanged, so the result still needs to be
27155
+ * validated, e.g., by `Intl.Locale`.
27156
+ *
27157
+ * [1]: https://www.rfc-editor.org/rfc/rfc5646.html#section-4.5
27158
+ *
27159
+ * @param tag The BCP 47 language tag to normalize.
27160
+ * @returns The normalized language tag.
27161
+ * @since 2.5.0
27162
+ */
27163
+ function normalizeLanguageTag(tag) {
27164
+ const subtags = tag.split("-");
27165
+ if (subtags.length < 2) return tag;
27166
+ const [prefix, extlang, ...rest] = subtags;
27167
+ if (!PREFIX_PATTERN.test(prefix) || !EXTLANG_PATTERN.test(extlang)) return tag;
27168
+ const language = extlang.toLowerCase();
27169
+ if (!EXTLANG_PAIRS.has(`${prefix.toLowerCase()}-${language}`)) return tag;
27170
+ return [language, ...rest].join("-");
27171
+ }
27123
27172
  /**
27124
27173
  * A language-tagged string which corresponds to the `rdf:langString` type.
27125
27174
  */
@@ -27133,11 +27182,13 @@ var LanguageString = class extends String {
27133
27182
  * Constructs a new `LanguageString`.
27134
27183
  * @param value A string value written in the given language.
27135
27184
  * @param language The language of the string. If a string is given, it will
27136
- * be parsed as a `Intl.Locale` object.
27185
+ * be parsed as a `Intl.Locale` object. Extended language
27186
+ * subtags are normalized first, e.g., `zh-yue` is parsed as
27187
+ * `yue`.
27137
27188
  */
27138
27189
  constructor(value, language) {
27139
27190
  super(value);
27140
- this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
27191
+ this.locale = typeof language === "string" ? new Intl.Locale(normalizeLanguageTag(language)) : language;
27141
27192
  }
27142
27193
  };
27143
27194
  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.5.0-dev.2314+d73be480",
3
+ "version": "2.5.0-dev.2327+3a7ba490",
4
4
  "description": "ActivityPub relay support for Fedify",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -47,14 +47,14 @@
47
47
  "dependencies": {
48
48
  "@logtape/logtape": "^2.2.0",
49
49
  "temporal-polyfill": "^1.0.1",
50
- "@fedify/fedify": "^2.5.0-dev.2314+d73be480",
51
- "@fedify/vocab": "2.5.0-dev.2314+d73be480"
50
+ "@fedify/fedify": "^2.5.0-dev.2327+3a7ba490",
51
+ "@fedify/vocab": "2.5.0-dev.2327+3a7ba490"
52
52
  },
53
53
  "devDependencies": {
54
54
  "tsdown": "^0.22.0",
55
55
  "typescript": "^6.0.0",
56
56
  "urlpattern-polyfill": "^10.1.0",
57
- "@fedify/vocab-runtime": "^2.5.0-dev.2314+d73be480"
57
+ "@fedify/vocab-runtime": "^2.5.0-dev.2327+3a7ba490"
58
58
  },
59
59
  "scripts": {
60
60
  "build:self": "tsdown",