@fedify/vocab 2.0.29-dev.2055 → 2.0.29-dev.2068

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.0.29-dev.2055+5e21857f",
3
+ "version": "2.0.29-dev.2068+bb645217",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
package/dist/mod.cjs CHANGED
@@ -33,7 +33,7 @@ let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
33
33
  let es_toolkit = require("es-toolkit");
34
34
  //#region deno.json
35
35
  var name = "@fedify/vocab";
36
- var version = "2.0.29-dev.2055+5e21857f";
36
+ var version = "2.0.29-dev.2068+bb645217";
37
37
  //#endregion
38
38
  //#region src/type.ts
39
39
  function getTypeId(object) {
@@ -42,6 +42,12 @@ function getTypeId(object) {
42
42
  }
43
43
  //#endregion
44
44
  //#region src/vocab.ts
45
+ function canDecodeIri(iri) {
46
+ return URL.canParse(iri) || iri.startsWith("at://");
47
+ }
48
+ function decodeIri(iri) {
49
+ return !URL.canParse(iri) && iri.startsWith("at://") ? new URL("at://" + encodeURIComponent(iri.substring(5))) : new URL(iri);
50
+ }
45
51
  function isValidLanguageTag(language) {
46
52
  try {
47
53
  new Intl.Locale(language);
@@ -6142,7 +6148,11 @@ var ChatMessage = class ChatMessage extends Object$1 {
6142
6148
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
6143
6149
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
6144
6150
  if (v == null) continue;
6145
- const decoded = new URL(v["@value"]);
6151
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
6152
+ if (typeof decoded === "undefined") {
6153
+ shouldCacheJsonLd = false;
6154
+ continue;
6155
+ }
6146
6156
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
6147
6157
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
6148
6158
  }
@@ -14350,7 +14360,11 @@ var Article = class Article extends Object$1 {
14350
14360
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
14351
14361
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
14352
14362
  if (v == null) continue;
14353
- const decoded = new URL(v["@value"]);
14363
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
14364
+ if (typeof decoded === "undefined") {
14365
+ shouldCacheJsonLd = false;
14366
+ continue;
14367
+ }
14354
14368
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
14355
14369
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
14356
14370
  }
@@ -25415,7 +25429,11 @@ var Note = class Note extends Object$1 {
25415
25429
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
25416
25430
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
25417
25431
  if (v == null) continue;
25418
- const decoded = new URL(v["@value"]);
25432
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
25433
+ if (typeof decoded === "undefined") {
25434
+ shouldCacheJsonLd = false;
25435
+ continue;
25436
+ }
25419
25437
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
25420
25438
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
25421
25439
  }
@@ -34535,7 +34553,11 @@ var Question = class Question extends IntransitiveActivity {
34535
34553
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
34536
34554
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
34537
34555
  if (v == null) continue;
34538
- const decoded = new URL(v["@value"]);
34556
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
34557
+ if (typeof decoded === "undefined") {
34558
+ shouldCacheJsonLd = false;
34559
+ continue;
34560
+ }
34539
34561
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
34540
34562
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
34541
34563
  }
package/dist/mod.js CHANGED
@@ -9,7 +9,7 @@ import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/tem
9
9
  import { delay } from "es-toolkit";
10
10
  //#region deno.json
11
11
  var name = "@fedify/vocab";
12
- var version = "2.0.29-dev.2055+5e21857f";
12
+ var version = "2.0.29-dev.2068+bb645217";
13
13
  //#endregion
14
14
  //#region src/type.ts
15
15
  function getTypeId(object) {
@@ -18,6 +18,12 @@ function getTypeId(object) {
18
18
  }
19
19
  //#endregion
20
20
  //#region src/vocab.ts
21
+ function canDecodeIri(iri) {
22
+ return URL.canParse(iri) || iri.startsWith("at://");
23
+ }
24
+ function decodeIri(iri) {
25
+ return !URL.canParse(iri) && iri.startsWith("at://") ? new URL("at://" + encodeURIComponent(iri.substring(5))) : new URL(iri);
26
+ }
21
27
  function isValidLanguageTag(language) {
22
28
  try {
23
29
  new Intl.Locale(language);
@@ -6118,7 +6124,11 @@ var ChatMessage = class ChatMessage extends Object$1 {
6118
6124
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
6119
6125
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
6120
6126
  if (v == null) continue;
6121
- const decoded = new URL(v["@value"]);
6127
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
6128
+ if (typeof decoded === "undefined") {
6129
+ shouldCacheJsonLd = false;
6130
+ continue;
6131
+ }
6122
6132
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
6123
6133
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
6124
6134
  }
@@ -14326,7 +14336,11 @@ var Article = class Article extends Object$1 {
14326
14336
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
14327
14337
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
14328
14338
  if (v == null) continue;
14329
- const decoded = new URL(v["@value"]);
14339
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
14340
+ if (typeof decoded === "undefined") {
14341
+ shouldCacheJsonLd = false;
14342
+ continue;
14343
+ }
14330
14344
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
14331
14345
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
14332
14346
  }
@@ -25391,7 +25405,11 @@ var Note = class Note extends Object$1 {
25391
25405
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
25392
25406
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
25393
25407
  if (v == null) continue;
25394
- const decoded = new URL(v["@value"]);
25408
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
25409
+ if (typeof decoded === "undefined") {
25410
+ shouldCacheJsonLd = false;
25411
+ continue;
25412
+ }
25395
25413
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
25396
25414
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
25397
25415
  }
@@ -34511,7 +34529,11 @@ var Question = class Question extends IntransitiveActivity {
34511
34529
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
34512
34530
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
34513
34531
  if (v == null) continue;
34514
- const decoded = new URL(v["@value"]);
34532
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
34533
+ if (typeof decoded === "undefined") {
34534
+ shouldCacheJsonLd = false;
34535
+ continue;
34536
+ }
34515
34537
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
34516
34538
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
34517
34539
  }
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { C as __exportAll, c as Group, h as Person, m as Organization, r as Application, y as Service } from "./vocab-CQpPUXBn.mjs";
4
- import { n as version, r as esm_default, t as name } from "./deno-DIs7GqqB.mjs";
3
+ import { C as __exportAll, c as Group, h as Person, m as Organization, r as Application, y as Service } from "./vocab-C_YFgzlY.mjs";
4
+ import { n as version, r as esm_default, t as name } from "./deno-BoH_-_YO.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { test } from "@fedify/fixture";
7
7
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
@@ -1,6 +1,6 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { S as __commonJSMin, w as __toESM } from "./vocab-CQpPUXBn.mjs";
3
+ import { S as __commonJSMin, w as __toESM } from "./vocab-C_YFgzlY.mjs";
4
4
  //#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
5
5
  var require_glob_to_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
6
  module.exports = function(glob, opts) {
@@ -1204,6 +1204,6 @@ var esm_default = new class FetchMock {
1204
1204
  //#endregion
1205
1205
  //#region deno.json
1206
1206
  var name = "@fedify/vocab";
1207
- var version = "2.0.29-dev.2055+5e21857f";
1207
+ var version = "2.0.29-dev.2068+bb645217";
1208
1208
  //#endregion
1209
1209
  export { version as n, esm_default as r, name as t };
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { d as Note, f as Object$1, h as Person, i as Collection } from "./vocab-CQpPUXBn.mjs";
4
- import { n as version, r as esm_default, t as name } from "./deno-DIs7GqqB.mjs";
3
+ import { d as Note, f as Object$1, h as Person, i as Collection } from "./vocab-C_YFgzlY.mjs";
4
+ import { n as version, r as esm_default, t as name } from "./deno-BoH_-_YO.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
7
7
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -1,6 +1,6 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { h as Person } from "./vocab-CQpPUXBn.mjs";
3
+ import { h as Person } from "./vocab-C_YFgzlY.mjs";
4
4
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual } from "node:assert/strict";
@@ -106,6 +106,12 @@ var vocab_exports = /* @__PURE__ */ __exportAll({
106
106
  Video: () => Video,
107
107
  View: () => View
108
108
  });
109
+ function canDecodeIri(iri) {
110
+ return URL.canParse(iri) || iri.startsWith("at://");
111
+ }
112
+ function decodeIri(iri) {
113
+ return !URL.canParse(iri) && iri.startsWith("at://") ? new URL("at://" + encodeURIComponent(iri.substring(5))) : new URL(iri);
114
+ }
109
115
  function isValidLanguageTag(language) {
110
116
  try {
111
117
  new Intl.Locale(language);
@@ -6206,7 +6212,11 @@ var ChatMessage = class ChatMessage extends Object$1 {
6206
6212
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
6207
6213
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
6208
6214
  if (v == null) continue;
6209
- const decoded = new URL(v["@value"]);
6215
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
6216
+ if (typeof decoded === "undefined") {
6217
+ shouldCacheJsonLd = false;
6218
+ continue;
6219
+ }
6210
6220
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
6211
6221
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
6212
6222
  }
@@ -14414,7 +14424,11 @@ var Article = class Article extends Object$1 {
14414
14424
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
14415
14425
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
14416
14426
  if (v == null) continue;
14417
- const decoded = new URL(v["@value"]);
14427
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
14428
+ if (typeof decoded === "undefined") {
14429
+ shouldCacheJsonLd = false;
14430
+ continue;
14431
+ }
14418
14432
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
14419
14433
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
14420
14434
  }
@@ -25479,7 +25493,11 @@ var Note = class Note extends Object$1 {
25479
25493
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
25480
25494
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
25481
25495
  if (v == null) continue;
25482
- const decoded = new URL(v["@value"]);
25496
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
25497
+ if (typeof decoded === "undefined") {
25498
+ shouldCacheJsonLd = false;
25499
+ continue;
25500
+ }
25483
25501
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
25484
25502
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
25485
25503
  }
@@ -34599,7 +34617,11 @@ var Question = class Question extends IntransitiveActivity {
34599
34617
  if (_K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null || _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length < 1) _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array = values["http://fedibird.com/ns#quoteUri"];
34600
34618
  for (const v of _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array == null ? [] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array.length === 1 && "@list" in _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0] ? _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array[0]["@list"] : _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl__array) {
34601
34619
  if (v == null) continue;
34602
- const decoded = new URL(v["@value"]);
34620
+ const decoded = typeof v === "object" && (typeof v["@id"] === "string" && canDecodeIri(v["@id"]) || typeof v["@value"] === "string" && canDecodeIri(v["@value"])) ? decodeIri(typeof v["@id"] === "string" ? v["@id"] : v["@value"]) : void 0;
34621
+ if (typeof decoded === "undefined") {
34622
+ shouldCacheJsonLd = false;
34623
+ continue;
34624
+ }
34603
34625
  if (!this._shouldCacheDecodedJsonLd(decoded)) shouldCacheJsonLd = false;
34604
34626
  _K1zrMQkQjmciFAmGdGLfaDbG925_quoteUrl.push(decoded);
34605
34627
  }
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { _ as PropertyValue, a as Create, b as Source, d as Note, f as Object$1, g as Place, h as Person, i as Collection, l as Hashtag, n as Announce, o as CryptographicKey, p as OrderedCollectionPage, s as Follow, t as Activity, u as Link, v as Question, x as vocab_exports } from "./vocab-CQpPUXBn.mjs";
3
+ import { _ as PropertyValue, a as Create, b as Source, d as Note, f as Object$1, g as Place, h as Person, i as Collection, l as Hashtag, n as Announce, o as CryptographicKey, p as OrderedCollectionPage, s as Follow, t as Activity, u as Link, v as Question, x as vocab_exports } from "./vocab-C_YFgzlY.mjs";
4
4
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
5
5
  import { mockDocumentLoader, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
@@ -527,6 +527,83 @@ test("Note.quoteUrl", async () => {
527
527
  delete jsonLd._misskey_quote;
528
528
  deepStrictEqual((await Note.fromJsonLd(jsonLd)).quoteUrl, new URL("https://example.com/object3"));
529
529
  });
530
+ test("Note.quoteUrl (IRI-typed alias terms)", async () => {
531
+ const jsonLd = {
532
+ "@context": ["https://www.w3.org/ns/activitystreams", {
533
+ fedibird: "http://fedibird.com/ns#",
534
+ misskey: "https://misskey-hub.net/ns#",
535
+ _misskey_quote: {
536
+ "@id": "misskey:_misskey_quote",
537
+ "@type": "@id"
538
+ },
539
+ quoteUri: {
540
+ "@id": "fedibird:quoteUri",
541
+ "@type": "@id"
542
+ }
543
+ }],
544
+ id: "https://example.com/notes/1",
545
+ type: "Note",
546
+ _misskey_quote: "https://example.com/notes/quoted",
547
+ quoteUri: "https://example.com/notes/quoted2"
548
+ };
549
+ deepStrictEqual((await Note.fromJsonLd(jsonLd)).quoteUrl, new URL("https://example.com/notes/quoted"));
550
+ delete jsonLd._misskey_quote;
551
+ deepStrictEqual((await Note.fromJsonLd(jsonLd)).quoteUrl, new URL("https://example.com/notes/quoted2"));
552
+ });
553
+ test("Note.quoteUrl (IRI-typed primary term)", async () => {
554
+ const context = ["https://www.w3.org/ns/activitystreams", {
555
+ misskey: "https://misskey-hub.net/ns#",
556
+ quoteUrl: {
557
+ "@id": "as:quoteUrl",
558
+ "@type": "@id"
559
+ },
560
+ _misskey_quote: "misskey:_misskey_quote"
561
+ }];
562
+ deepStrictEqual((await Note.fromJsonLd({
563
+ "@context": context,
564
+ type: "Note",
565
+ quoteUrl: "https://example.com/object"
566
+ })).quoteUrl, new URL("https://example.com/object"));
567
+ deepStrictEqual((await Note.fromJsonLd({
568
+ "@context": context,
569
+ type: "Note",
570
+ quoteUrl: "https://example.com/object",
571
+ _misskey_quote: "https://example.com/object2"
572
+ })).quoteUrl, new URL("https://example.com/object"));
573
+ });
574
+ test("Note.quoteUrl (unparsable IRI-valued terms)", async () => {
575
+ const context = ["https://www.w3.org/ns/activitystreams", {
576
+ misskey: "https://misskey-hub.net/ns#",
577
+ _misskey_quote: {
578
+ "@id": "misskey:_misskey_quote",
579
+ "@type": "@id"
580
+ }
581
+ }];
582
+ for (const quote of [
583
+ {
584
+ type: "Note",
585
+ content: "An inlined quote without an id"
586
+ },
587
+ "_:b0",
588
+ "",
589
+ "notes/relative"
590
+ ]) {
591
+ const loaded = await Note.fromJsonLd({
592
+ "@context": context,
593
+ id: "https://example.com/notes/1",
594
+ type: "Note",
595
+ content: "Hello",
596
+ _misskey_quote: quote
597
+ });
598
+ deepStrictEqual(loaded.quoteUrl, null, JSON.stringify(quote));
599
+ deepStrictEqual(loaded.content, "Hello");
600
+ }
601
+ deepStrictEqual((await Note.fromJsonLd({
602
+ "@context": context,
603
+ type: "Note",
604
+ _misskey_quote: "at://did:plc:abc/app.bsky.feed.post/xyz"
605
+ })).quoteUrl, new URL("at://" + encodeURIComponent("did:plc:abc/app.bsky.feed.post/xyz")));
606
+ });
530
607
  test("Key.publicKey", async () => {
531
608
  const jwk = {
532
609
  kty: "RSA",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.0.29-dev.2055+5e21857f",
3
+ "version": "2.0.29-dev.2068+bb645217",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,9 +46,9 @@
46
46
  "es-toolkit": "1.43.0",
47
47
  "jsonld": "^9.0.0",
48
48
  "pkijs": "^3.3.3",
49
- "@fedify/vocab-tools": "2.0.29-dev.2055+5e21857f",
50
- "@fedify/webfinger": "2.0.29-dev.2055+5e21857f",
51
- "@fedify/vocab-runtime": "2.0.29-dev.2055+5e21857f"
49
+ "@fedify/vocab-tools": "2.0.29-dev.2068+bb645217",
50
+ "@fedify/webfinger": "2.0.29-dev.2068+bb645217",
51
+ "@fedify/vocab-runtime": "2.0.29-dev.2068+bb645217"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^22.17.0",
package/src/vocab.test.ts CHANGED
@@ -809,6 +809,105 @@ test("Note.quoteUrl", async () => {
809
809
  deepStrictEqual(loaded3.quoteUrl, new URL("https://example.com/object3"));
810
810
  });
811
811
 
812
+ test("Note.quoteUrl (IRI-typed alias terms)", async () => {
813
+ const jsonLd: Record<string, unknown> = {
814
+ "@context": [
815
+ "https://www.w3.org/ns/activitystreams",
816
+ {
817
+ fedibird: "http://fedibird.com/ns#",
818
+ misskey: "https://misskey-hub.net/ns#",
819
+ _misskey_quote: {
820
+ "@id": "misskey:_misskey_quote",
821
+ "@type": "@id",
822
+ },
823
+ quoteUri: {
824
+ "@id": "fedibird:quoteUri",
825
+ "@type": "@id",
826
+ },
827
+ },
828
+ ],
829
+ id: "https://example.com/notes/1",
830
+ type: "Note",
831
+ _misskey_quote: "https://example.com/notes/quoted",
832
+ quoteUri: "https://example.com/notes/quoted2",
833
+ };
834
+
835
+ const loaded = await Note.fromJsonLd(jsonLd);
836
+ deepStrictEqual(loaded.quoteUrl, new URL("https://example.com/notes/quoted"));
837
+
838
+ delete jsonLd._misskey_quote;
839
+ const loaded2 = await Note.fromJsonLd(jsonLd);
840
+ deepStrictEqual(
841
+ loaded2.quoteUrl,
842
+ new URL("https://example.com/notes/quoted2"),
843
+ );
844
+ });
845
+
846
+ test("Note.quoteUrl (IRI-typed primary term)", async () => {
847
+ const context = [
848
+ "https://www.w3.org/ns/activitystreams",
849
+ {
850
+ misskey: "https://misskey-hub.net/ns#",
851
+ quoteUrl: { "@id": "as:quoteUrl", "@type": "@id" },
852
+ _misskey_quote: "misskey:_misskey_quote",
853
+ },
854
+ ];
855
+
856
+ const loaded = await Note.fromJsonLd({
857
+ "@context": context,
858
+ type: "Note",
859
+ quoteUrl: "https://example.com/object",
860
+ });
861
+ deepStrictEqual(loaded.quoteUrl, new URL("https://example.com/object"));
862
+
863
+ // An IRI-valued quoteUrl still takes precedence over a plain-string alias:
864
+ const loaded2 = await Note.fromJsonLd({
865
+ "@context": context,
866
+ type: "Note",
867
+ quoteUrl: "https://example.com/object",
868
+ _misskey_quote: "https://example.com/object2",
869
+ });
870
+ deepStrictEqual(loaded2.quoteUrl, new URL("https://example.com/object"));
871
+ });
872
+
873
+ test("Note.quoteUrl (unparsable IRI-valued terms)", async () => {
874
+ const context = [
875
+ "https://www.w3.org/ns/activitystreams",
876
+ {
877
+ misskey: "https://misskey-hub.net/ns#",
878
+ _misskey_quote: { "@id": "misskey:_misskey_quote", "@type": "@id" },
879
+ },
880
+ ];
881
+ for (
882
+ const quote of [
883
+ { type: "Note", content: "An inlined quote without an id" },
884
+ "_:b0",
885
+ "",
886
+ "notes/relative",
887
+ ]
888
+ ) {
889
+ const loaded = await Note.fromJsonLd({
890
+ "@context": context,
891
+ id: "https://example.com/notes/1",
892
+ type: "Note",
893
+ content: "Hello",
894
+ _misskey_quote: quote,
895
+ });
896
+ deepStrictEqual(loaded.quoteUrl, null, JSON.stringify(quote));
897
+ deepStrictEqual(loaded.content, "Hello");
898
+ }
899
+
900
+ const atUri = await Note.fromJsonLd({
901
+ "@context": context,
902
+ type: "Note",
903
+ _misskey_quote: "at://did:plc:abc/app.bsky.feed.post/xyz",
904
+ });
905
+ deepStrictEqual(
906
+ atUri.quoteUrl,
907
+ new URL("at://" + encodeURIComponent("did:plc:abc/app.bsky.feed.post/xyz")),
908
+ );
909
+ });
910
+
812
911
  test("Key.publicKey", async () => {
813
912
  const jwk = {
814
913
  kty: "RSA",