@fedify/vocab 2.4.0-dev.2247 → 2.4.0-dev.2253

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,14 +1,15 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Object$1, B as QuoteAuthorization, C as Intent, D as Measure, E as Link, F as Person, G as Tombstone, H as Reject, I as Place, L as PropertyValue, N as OrderedCollectionPage, O as Multikey, P as Organization, R as Proposal, S as Image, T as InteractionRule, U as Service, V as QuoteRequest, W as Source, X as vocab_exports, _ as FeaturedCollection, a as Application, b as Group, d as CryptographicKey, f as Delete, g as FeatureRequest, h as FeatureAuthorization, i as Announce, j as Offer, k as Note, l as Commitment, m as Endpoints, n as Activity, p as Document, r as Agreement, s as Collection, t as Accept, u as Create, v as FeaturedItem, w as InteractionPolicy, x as Hashtag, y as Follow, z as Question } from "./vocab-D3C791xF.mjs";
4
- import { t as esm_default } from "./esm-2_Uqq_my.mjs";
3
+ import { A as Object$1, B as QuoteAuthorization, C as Intent, D as Measure, E as Link, F as Person, G as Tombstone, H as Reject, I as Place, L as PropertyValue, N as OrderedCollectionPage, O as Multikey, P as Organization, R as Proposal, S as Image, T as InteractionRule, U as Service, V as QuoteRequest, W as Source, X as vocab_exports, _ as FeaturedCollection, a as Application, b as Group, d as CryptographicKey, f as Delete, g as FeatureRequest, h as FeatureAuthorization, i as Announce, j as Offer, k as Note, l as Commitment, m as Endpoints, n as Activity, p as Document, r as Agreement, s as Collection, t as Accept, u as Create, v as FeaturedItem, w as InteractionPolicy, x as Hashtag, y as Follow, z as Question } from "./vocab-TRdTohG6.mjs";
4
+ import { t as esm_default } from "./esm-DV51XH1a.mjs";
5
5
  import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
6
6
  import { mockDocumentLoader, test } from "@fedify/fixture";
7
7
  import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
8
- import { FetchError, LanguageString, decodeMultibase, getDocumentLoader, parseDecimal } from "@fedify/vocab-runtime";
8
+ import { FetchError, LanguageString, decodeMultibase, getDocumentLoader, parseDecimal, parseIri } from "@fedify/vocab-runtime";
9
9
  import { configure, reset } from "@logtape/logtape";
10
10
  import { pascalCase } from "es-toolkit";
11
11
  import { areAllScalarTypes, loadSchemaFiles } from "@fedify/vocab-tools";
12
+ import { inspect } from "node:util";
12
13
  //#region src/vocab.test.ts
13
14
  const NOTE_QUOTE_CONTEXT = [
14
15
  "https://www.w3.org/ns/activitystreams",
@@ -1442,6 +1443,21 @@ test({
1442
1443
  }), "Deno" in globalThis ? "Object {\n attribution: URL \"https://example.com/foo\",\n contents: [\n <en> \"Hello\",\n <zh> \"你好\"\n ],\n id: URL \"https://example.com/\",\n name: \"Test\"\n}" : "Object {\n attribution: URL 'https://example.com/foo',\n contents: [\n <en> 'Hello',\n <zh> '你好'\n ],\n id: URL 'https://example.com/',\n name: 'Test'\n}");
1443
1444
  }
1444
1445
  });
1446
+ test("inspecting an object prints portable IRIs in their canonical form", () => {
1447
+ const did = "did:key:z6MkrJVnaZkeFzdQyMZu1cgjg7k1pZZ6pvBQ7XJPt4swbTQ2";
1448
+ const obj = new Object$1({
1449
+ id: parseIri(`ap://${did}/note`),
1450
+ attribution: parseIri(`ap://${did}/actor`)
1451
+ });
1452
+ const inspected = [inspect(obj, { colors: false })];
1453
+ if ("Deno" in globalThis) inspected.push(Deno.inspect(obj, { colors: false }));
1454
+ for (const text of inspected) {
1455
+ ok(text.includes(`ap+ef61://${did}/note`), text);
1456
+ ok(text.includes(`ap+ef61://${did}/actor`), text);
1457
+ ok(!text.includes("%3A"), text);
1458
+ }
1459
+ ok(inspect(new Object$1({ id: new URL("ap://not-a-did/note") })).includes("ap://not-a-did/note"));
1460
+ });
1445
1461
  test("Person.fromJsonLd()", async () => {
1446
1462
  const person = await Person.fromJsonLd({
1447
1463
  "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.4.0-dev.2247+4fe1b8c3",
3
+ "version": "2.4.0-dev.2253+f5212c33",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,9 +43,9 @@
43
43
  "jsonld": "^9.0.0",
44
44
  "pkijs": "^3.3.3",
45
45
  "temporal-polyfill": "^1.0.1",
46
- "@fedify/webfinger": "2.4.0-dev.2247+4fe1b8c3",
47
- "@fedify/vocab-tools": "2.4.0-dev.2247+4fe1b8c3",
48
- "@fedify/vocab-runtime": "2.4.0-dev.2247+4fe1b8c3"
46
+ "@fedify/webfinger": "2.4.0-dev.2253+f5212c33",
47
+ "@fedify/vocab-tools": "2.4.0-dev.2253+f5212c33",
48
+ "@fedify/vocab-runtime": "2.4.0-dev.2253+f5212c33"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^24.12.2",
package/src/vocab.test.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  getDocumentLoader,
7
7
  LanguageString,
8
8
  parseDecimal,
9
+ parseIri,
9
10
  type RemoteDocument,
10
11
  } from "@fedify/vocab-runtime";
11
12
  import {
@@ -24,6 +25,7 @@ import {
24
25
  rejects,
25
26
  throws,
26
27
  } from "node:assert/strict";
28
+ import { inspect } from "node:util";
27
29
  import { assertInstanceOf } from "./utils.ts";
28
30
  import * as vocab from "./vocab.ts";
29
31
  import {
@@ -2212,6 +2214,26 @@ test({
2212
2214
  },
2213
2215
  });
2214
2216
 
2217
+ test("inspecting an object prints portable IRIs in their canonical form", () => {
2218
+ const did = "did:key:z6MkrJVnaZkeFzdQyMZu1cgjg7k1pZZ6pvBQ7XJPt4swbTQ2";
2219
+ const obj = new Object({
2220
+ id: parseIri(`ap://${did}/note`),
2221
+ attribution: parseIri(`ap://${did}/actor`),
2222
+ });
2223
+ const inspected = [inspect(obj, { colors: false })];
2224
+ if ("Deno" in globalThis) {
2225
+ inspected.push(Deno.inspect(obj, { colors: false }));
2226
+ }
2227
+ for (const text of inspected) {
2228
+ ok(text.includes(`ap+ef61://${did}/note`), text);
2229
+ ok(text.includes(`ap+ef61://${did}/actor`), text);
2230
+ ok(!text.includes("%3A"), text);
2231
+ }
2232
+ // A URL that cannot be formatted as an IRI does not break inspection:
2233
+ const malformed = new Object({ id: new URL("ap://not-a-did/note") });
2234
+ ok(inspect(malformed).includes("ap://not-a-did/note"));
2235
+ });
2236
+
2215
2237
  test("Person.fromJsonLd()", async () => {
2216
2238
  const person = await Person.fromJsonLd({
2217
2239
  "@context": [