@fedify/vocab 2.0.7 → 2.0.9

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,15 +1,12 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- globalThis.addEventListener = () => {};
4
-
5
- import { Activity, Announce, Collection, Create, CryptographicKey, Follow, Hashtag, Link, Note, Object as Object$1, OrderedCollectionPage, Person, Place, Question, Source, vocab_exports } from "./vocab-BDW9_gZ_.js";
6
- import { assertInstanceOf } from "./utils-BSWXlrig.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ globalThis.addEventListener = () => {};
3
+ import { _ as Question, a as Create, b as vocab_exports, 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, y as Source } from "./vocab-B2Bh5Rdt.mjs";
4
+ import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
7
5
  import { mockDocumentLoader, test } from "@fedify/fixture";
8
6
  import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
9
7
  import { LanguageString, decodeMultibase } from "@fedify/vocab-runtime";
10
8
  import { pascalCase } from "es-toolkit";
11
9
  import { areAllScalarTypes, loadSchemaFiles } from "@fedify/vocab-tools";
12
-
13
10
  //#region src/vocab.test.ts
14
11
  test("new Object()", () => {
15
12
  const obj = new Object$1({
@@ -102,8 +99,7 @@ test("Object.fromJsonLd()", async () => {
102
99
  const note = await create.getObject();
103
100
  assertInstanceOf(note, Note);
104
101
  deepStrictEqual(note.content, "Content");
105
- const empty = await Object$1.fromJsonLd({});
106
- assertInstanceOf(empty, Object$1);
102
+ assertInstanceOf(await Object$1.fromJsonLd({}), Object$1);
107
103
  await rejects(() => Object$1.fromJsonLd(null), TypeError);
108
104
  await rejects(() => Object$1.fromJsonLd(void 0), TypeError);
109
105
  });
@@ -248,8 +244,7 @@ test({
248
244
  assertInstanceOf(object, Object$1);
249
245
  deepStrictEqual(object.id, new URL("https://example.com/object"));
250
246
  deepStrictEqual(object.name, "Fetched object");
251
- const jsonLd = await activity.toJsonLd();
252
- deepStrictEqual(jsonLd, {
247
+ deepStrictEqual(await activity.toJsonLd(), {
253
248
  "@context": [
254
249
  "https://w3id.org/identity/v1",
255
250
  "https://www.w3.org/ns/activitystreams",
@@ -267,9 +262,8 @@ test({
267
262
  }
268
263
  }
269
264
  });
270
- const activity2 = new Activity({ object: new URL("https://example.com/not-found") });
271
- deepStrictEqual(await activity2.getObject({ suppressError: true }), null);
272
- const activity3 = await Activity.fromJsonLd({
265
+ deepStrictEqual(await new Activity({ object: new URL("https://example.com/not-found") }).getObject({ suppressError: true }), null);
266
+ const object3 = await (await Activity.fromJsonLd({
273
267
  "@context": "https://www.w3.org/ns/activitystreams",
274
268
  type: "Create",
275
269
  object: {
@@ -277,8 +271,7 @@ test({
277
271
  type: "Note",
278
272
  content: "Hello world"
279
273
  }
280
- });
281
- const object3 = await activity3.getObject();
274
+ })).getObject();
282
275
  assertInstanceOf(object3, Note);
283
276
  deepStrictEqual(await object3.toJsonLd(), {
284
277
  "@context": "https://www.w3.org/ns/activitystreams",
@@ -337,8 +330,7 @@ test("Activity.clone()", async () => {
337
330
  }), TypeError);
338
331
  });
339
332
  test("Question.voters", async () => {
340
- const question = new Question({ voters: 123 });
341
- const json = await question.toJsonLd({ format: "compact" });
333
+ const json = await new Question({ voters: 123 }).toJsonLd({ format: "compact" });
342
334
  ok(typeof json === "object" && json != null);
343
335
  ok("votersCount" in json);
344
336
  deepStrictEqual(json["votersCount"], 123);
@@ -378,19 +370,17 @@ test("Person.fromJsonLd()", async () => {
378
370
  const publicKey = await person.getPublicKey({ documentLoader: mockDocumentLoader });
379
371
  assertInstanceOf(publicKey, CryptographicKey);
380
372
  deepStrictEqual(publicKey?.ownerId, new URL("https://todon.eu/users/hongminhee"));
381
- const person2 = await Person.fromJsonLd({
373
+ deepStrictEqual((await Person.fromJsonLd({
382
374
  "@context": ["https://www.w3.org/ns/activitystreams", { alsoKnownAs: {
383
375
  "@id": "as:alsoKnownAs",
384
376
  "@type": "@id"
385
377
  } }],
386
378
  "type": "Person",
387
379
  "alsoKnownAs": "at://did:plc:x7xdowahlhm5xulzqw4ehv6q"
388
- });
389
- deepStrictEqual(person2.aliasId, new URL("at://did%3Aplc%3Ax7xdowahlhm5xulzqw4ehv6q"));
380
+ })).aliasId, new URL("at://did%3Aplc%3Ax7xdowahlhm5xulzqw4ehv6q"));
390
381
  });
391
382
  test("Person.toJsonLd()", async () => {
392
- const person = new Person({ aliases: [new URL("https://example.com/alias")] });
393
- deepStrictEqual(await person.toJsonLd(), {
383
+ deepStrictEqual(await new Person({ aliases: [new URL("https://example.com/alias")] }).toJsonLd(), {
394
384
  "@context": [
395
385
  "https://www.w3.org/ns/activitystreams",
396
386
  "https://w3id.org/security/v1",
@@ -485,14 +475,11 @@ test("Note.quoteUrl", async () => {
485
475
  _misskey_quote: "https://example.com/object2",
486
476
  quoteUri: "https://example.com/object3"
487
477
  };
488
- const loaded = await Note.fromJsonLd(jsonLd);
489
- deepStrictEqual(loaded.quoteUrl, new URL("https://example.com/object"));
478
+ deepStrictEqual((await Note.fromJsonLd(jsonLd)).quoteUrl, new URL("https://example.com/object"));
490
479
  delete jsonLd.quoteUrl;
491
- const loaded2 = await Note.fromJsonLd(jsonLd);
492
- deepStrictEqual(loaded2.quoteUrl, new URL("https://example.com/object2"));
480
+ deepStrictEqual((await Note.fromJsonLd(jsonLd)).quoteUrl, new URL("https://example.com/object2"));
493
481
  delete jsonLd._misskey_quote;
494
- const loaded3 = await Note.fromJsonLd(jsonLd);
495
- deepStrictEqual(loaded3.quoteUrl, new URL("https://example.com/object3"));
482
+ deepStrictEqual((await Note.fromJsonLd(jsonLd)).quoteUrl, new URL("https://example.com/object3"));
496
483
  });
497
484
  test("Key.publicKey", async () => {
498
485
  const jwk = {
@@ -503,11 +490,10 @@ test("Key.publicKey", async () => {
503
490
  key_ops: ["verify"],
504
491
  ext: true
505
492
  };
506
- const key = new CryptographicKey({ publicKey: await crypto.subtle.importKey("jwk", jwk, {
493
+ const jsonLd = await new CryptographicKey({ publicKey: await crypto.subtle.importKey("jwk", jwk, {
507
494
  name: "RSASSA-PKCS1-v1_5",
508
495
  hash: "SHA-256"
509
- }, true, ["verify"]) });
510
- const jsonLd = await key.toJsonLd({ contextLoader: mockDocumentLoader });
496
+ }, true, ["verify"]) }).toJsonLd({ contextLoader: mockDocumentLoader });
511
497
  deepStrictEqual(jsonLd, {
512
498
  "@context": "https://w3id.org/security/v1",
513
499
  publicKeyPem: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxsRuvCkgJtflBTl4OVsm\nnt/J1mQfZasfJtN33dcZ3d1lJroxmgmMu69zjGEAwkNbMQaWNLqC4eogkJaeJ4RR\n5MHYXkL9nNilVoTkjX5BVit3puzs7XJ7WQnKQgQMI+ezn24GHsZ/v1JIo77lerX5\nk4HNwTNVt+yaZVQWaOMR3+6FwziQR6kd0VuG9/a9dgAnz2cEoORRC1i4W7IZaB1s\nZnh1WbHbevlGd72HSXll5rocPIHn8gq6xpBgpHwRphlRsgn4KHaJ6brXDIJjrnQh\nIe/YUBOGj/ImSEXhRwlFerKsoAVnZ0Hwbfa46qk44TAt8CyoPMWmpK6pt0ng4pQ2\nuwIDAQAB\n-----END PUBLIC KEY-----\n",
@@ -564,8 +550,7 @@ test("Place.fromJsonLd()", async () => {
564
550
  });
565
551
  });
566
552
  test("Actor.getOutbox()", async () => {
567
- const person = new Person({ outbox: new URL("https://example.com/orderedcollectionpage") });
568
- const outbox = await person.getOutbox({ documentLoader: mockDocumentLoader });
553
+ const outbox = await new Person({ outbox: new URL("https://example.com/orderedcollectionpage") }).getOutbox({ documentLoader: mockDocumentLoader });
569
554
  assertInstanceOf(outbox, OrderedCollectionPage);
570
555
  deepStrictEqual(outbox.totalItems, 1);
571
556
  });
@@ -578,21 +563,19 @@ test("Link.fromJsonLd()", async () => {
578
563
  });
579
564
  deepStrictEqual(link.rel, "canonical");
580
565
  deepStrictEqual(link.href, new URL("at://did%3Aplc%3Aia76kvnndjutgedggx2ibrem/app.bsky.feed.post/3lyxjjs27jkqg"));
581
- const link2 = await Link.fromJsonLd({
566
+ deepStrictEqual((await Link.fromJsonLd({
582
567
  "@context": "https://www.w3.org/ns/activitystreams",
583
568
  "type": "Link",
584
569
  "href": "at://bnewbold.bsky.team/app.bsky.feed.post/3jwdwj2ctlk26"
585
- });
586
- deepStrictEqual(link2.href, new URL("at://bnewbold.bsky.team/app.bsky.feed.post/3jwdwj2ctlk26"));
587
- const link3 = await Link.fromJsonLd({
570
+ })).href, new URL("at://bnewbold.bsky.team/app.bsky.feed.post/3jwdwj2ctlk26"));
571
+ deepStrictEqual((await Link.fromJsonLd({
588
572
  "@context": "https://www.w3.org/ns/activitystreams",
589
573
  "type": "Link",
590
574
  "href": "at://did:plc:ia76kvnndjutgedggx2ibrem"
591
- });
592
- deepStrictEqual(link3.href, new URL("at://did%3Aplc%3Aia76kvnndjutgedggx2ibrem"));
575
+ })).href, new URL("at://did%3Aplc%3Aia76kvnndjutgedggx2ibrem"));
593
576
  });
594
577
  test("Person.fromJsonLd() with relative URLs", async () => {
595
- const json = {
578
+ deepStrictEqual((await (await Person.fromJsonLd({
596
579
  "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
597
580
  id: "https://example.com/ap/actors/019382d3-63d7-7cf7-86e8-91e2551c306c",
598
581
  type: "Person",
@@ -601,14 +584,11 @@ test("Person.fromJsonLd() with relative URLs", async () => {
601
584
  type: "Image",
602
585
  url: "/avatars/test-avatar.jpg"
603
586
  }
604
- };
605
- const person = await Person.fromJsonLd(json, {
587
+ }, {
606
588
  documentLoader: mockDocumentLoader,
607
589
  contextLoader: mockDocumentLoader
608
- });
609
- const icon = await person.getIcon();
610
- deepStrictEqual(icon?.url, new URL("https://example.com/avatars/test-avatar.jpg"));
611
- const json2 = {
590
+ })).getIcon())?.url, new URL("https://example.com/avatars/test-avatar.jpg"));
591
+ deepStrictEqual((await (await Person.fromJsonLd({
612
592
  "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
613
593
  id: "https://example.com/ap/actors/019382d3-63d7-7cf7-86e8-91e2551c306c",
614
594
  type: "Person",
@@ -618,16 +598,13 @@ test("Person.fromJsonLd() with relative URLs", async () => {
618
598
  type: "Image",
619
599
  url: "/avatars/test-avatar.jpg"
620
600
  }
621
- };
622
- const person2 = await Person.fromJsonLd(json2, {
601
+ }, {
623
602
  documentLoader: mockDocumentLoader,
624
603
  contextLoader: mockDocumentLoader
625
- });
626
- const icon2 = await person2.getIcon();
627
- deepStrictEqual(icon2?.url, new URL("https://media.example.com/avatars/test-avatar.jpg"));
604
+ })).getIcon())?.url, new URL("https://media.example.com/avatars/test-avatar.jpg"));
628
605
  });
629
606
  test("Person.fromJsonLd() with relative URLs and baseUrl", async () => {
630
- const json = {
607
+ deepStrictEqual((await (await Person.fromJsonLd({
631
608
  "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
632
609
  "id": "https://example.com/ap/actors/019382d3-63d7-7cf7-86e8-91e2551c306c",
633
610
  "type": "Person",
@@ -636,14 +613,11 @@ test("Person.fromJsonLd() with relative URLs and baseUrl", async () => {
636
613
  "type": "Image",
637
614
  "url": "/avatars/test-avatar.jpg"
638
615
  }
639
- };
640
- const personWithBase = await Person.fromJsonLd(json, {
616
+ }, {
641
617
  documentLoader: mockDocumentLoader,
642
618
  contextLoader: mockDocumentLoader,
643
619
  baseUrl: new URL("https://example.com")
644
- });
645
- const icon = await personWithBase.getIcon();
646
- deepStrictEqual(icon?.url, new URL("https://example.com/avatars/test-avatar.jpg"));
620
+ })).getIcon())?.url, new URL("https://example.com/avatars/test-avatar.jpg"));
647
621
  });
648
622
  test("FEP-fe34: Trust tracking in object construction", async () => {
649
623
  const note = new Note({
@@ -674,8 +648,7 @@ test("FEP-fe34: Trust tracking in object cloning", () => {
674
648
  id: new URL("https://example.com/new-note"),
675
649
  content: "New content"
676
650
  });
677
- const clonedCreate = create.clone({ object: newNote });
678
- deepStrictEqual(clonedCreate.objectId, new URL("https://example.com/new-note"));
651
+ deepStrictEqual(create.clone({ object: newNote }).objectId, new URL("https://example.com/new-note"));
679
652
  });
680
653
  test("FEP-fe34: crossOrigin ignore behavior (default)", async () => {
681
654
  const crossOriginDocumentLoader = async (url) => {
@@ -691,13 +664,11 @@ test("FEP-fe34: crossOrigin ignore behavior (default)", async () => {
691
664
  };
692
665
  throw new Error("Document not found");
693
666
  };
694
- const create = new Create({
667
+ deepStrictEqual(await new Create({
695
668
  id: new URL("https://example.com/create"),
696
669
  actor: new URL("https://example.com/actor"),
697
670
  object: new URL("https://different-origin.com/note")
698
- });
699
- const result = await create.getObject({ documentLoader: crossOriginDocumentLoader });
700
- deepStrictEqual(result, null);
671
+ }).getObject({ documentLoader: crossOriginDocumentLoader }), null);
701
672
  });
702
673
  test("FEP-fe34: crossOrigin throw behavior", async () => {
703
674
  const crossOriginDocumentLoader = async (url) => {
@@ -737,12 +708,11 @@ test("FEP-fe34: crossOrigin trust behavior", async () => {
737
708
  };
738
709
  throw new Error("Document not found");
739
710
  };
740
- const create = new Create({
711
+ const result = await new Create({
741
712
  id: new URL("https://example.com/create"),
742
713
  actor: new URL("https://example.com/actor"),
743
714
  object: new URL("https://different-origin.com/note")
744
- });
745
- const result = await create.getObject({
715
+ }).getObject({
746
716
  documentLoader: crossOriginDocumentLoader,
747
717
  crossOrigin: "trust"
748
718
  });
@@ -764,12 +734,11 @@ test("FEP-fe34: Same origin objects are trusted", async () => {
764
734
  };
765
735
  throw new Error("Document not found");
766
736
  };
767
- const create = new Create({
737
+ const result = await new Create({
768
738
  id: new URL("https://example.com/create"),
769
739
  actor: new URL("https://example.com/actor"),
770
740
  object: new URL("https://example.com/note")
771
- });
772
- const result = await create.getObject({ documentLoader: sameOriginDocumentLoader });
741
+ }).getObject({ documentLoader: sameOriginDocumentLoader });
773
742
  assertInstanceOf(result, Note);
774
743
  deepStrictEqual(result?.id, new URL("https://example.com/note"));
775
744
  deepStrictEqual(result?.content, "This is a legitimate note");
@@ -812,16 +781,14 @@ test("FEP-fe34: Embedded cross-origin objects from JSON-LD are ignored by defaul
812
781
  deepStrictEqual(result?.content, "Legitimate note from origin");
813
782
  });
814
783
  test("FEP-fe34: Constructor vs JSON-LD parsing trust difference", async () => {
815
- const constructorCreate = new Create({
784
+ deepStrictEqual((await new Create({
816
785
  id: new URL("https://example.com/create"),
817
786
  actor: new URL("https://example.com/actor"),
818
787
  object: new Note({
819
788
  id: new URL("https://different-origin.com/note"),
820
789
  content: "Constructor embedded note"
821
790
  })
822
- });
823
- const constructorResult = await constructorCreate.getObject();
824
- deepStrictEqual(constructorResult?.content, "Constructor embedded note");
791
+ }).getObject())?.content, "Constructor embedded note");
825
792
  const jsonLdCreate = await Create.fromJsonLd({
826
793
  "@context": "https://www.w3.org/ns/activitystreams",
827
794
  "@type": "Create",
@@ -846,8 +813,7 @@ test("FEP-fe34: Constructor vs JSON-LD parsing trust difference", async () => {
846
813
  };
847
814
  throw new Error("Document not found");
848
815
  };
849
- const jsonLdResult = await jsonLdCreate.getObject({ documentLoader });
850
- deepStrictEqual(jsonLdResult?.content, "Fetched from origin");
816
+ deepStrictEqual((await jsonLdCreate.getObject({ documentLoader }))?.content, "Fetched from origin");
851
817
  });
852
818
  test("FEP-fe34: Array properties respect cross-origin policy", async () => {
853
819
  const crossOriginDocumentLoader = async (url) => {
@@ -976,9 +942,9 @@ test("FEP-fe34: Embedded objects in arrays from JSON-LD respect cross-origin pol
976
942
  assertInstanceOf(items[1], Note);
977
943
  deepStrictEqual(items[1].content, "Legitimate note from actual origin");
978
944
  });
979
- function getAllProperties(type, types$1) {
945
+ function getAllProperties(type, types) {
980
946
  const props = type.properties;
981
- if (type.extends != null) props.push(...getAllProperties(types$1[type.extends], types$1));
947
+ if (type.extends != null) props.push(...getAllProperties(types[type.extends], types));
982
948
  return props;
983
949
  }
984
950
  const ed25519PublicKey = new CryptographicKey({
@@ -1093,8 +1059,7 @@ const sampleValues = {
1093
1059
  };
1094
1060
  const types = navigator?.userAgent === "Cloudflare-Workers" ? {} : await loadSchemaFiles(import.meta.dirname);
1095
1061
  for (const typeUri in types) {
1096
- const type = types[typeUri];
1097
- const cls = vocab_exports[type.name];
1062
+ const cls = vocab_exports[types[typeUri].name];
1098
1063
  sampleValues[typeUri] = new cls({
1099
1064
  "@id": "https://example.com/",
1100
1065
  "@type": typeUri
@@ -1123,17 +1088,17 @@ for (const typeUri in types) {
1123
1088
  }
1124
1089
  }
1125
1090
  const empty = new cls({});
1126
- for (const property$1 of allProperties) if (areAllScalarTypes(property$1.range, types)) {
1127
- if (property$1.functional || property$1.singularAccessor) deepStrictEqual(empty[property$1.singularName], null);
1128
- if (!property$1.functional) deepStrictEqual(empty[property$1.pluralName], []);
1091
+ for (const property of allProperties) if (areAllScalarTypes(property.range, types)) {
1092
+ if (property.functional || property.singularAccessor) deepStrictEqual(empty[property.singularName], null);
1093
+ if (!property.functional) deepStrictEqual(empty[property.pluralName], []);
1129
1094
  } else {
1130
- if (property$1.functional || property$1.singularAccessor) {
1131
- deepStrictEqual(await empty[`get${pascalCase(property$1.singularName)}`].call(empty, { documentLoader: mockDocumentLoader }), null);
1132
- deepStrictEqual(empty[`${property$1.singularName}Id`], null);
1095
+ if (property.functional || property.singularAccessor) {
1096
+ deepStrictEqual(await empty[`get${pascalCase(property.singularName)}`].call(empty, { documentLoader: mockDocumentLoader }), null);
1097
+ deepStrictEqual(empty[`${property.singularName}Id`], null);
1133
1098
  }
1134
- if (!property$1.functional) {
1135
- deepStrictEqual(await Array.fromAsync(empty[`get${pascalCase(property$1.pluralName)}`].call(empty, { documentLoader: mockDocumentLoader })), []);
1136
- deepStrictEqual(empty[`${property$1.singularName}Ids`], []);
1099
+ if (!property.functional) {
1100
+ deepStrictEqual(await Array.fromAsync(empty[`get${pascalCase(property.pluralName)}`].call(empty, { documentLoader: mockDocumentLoader })), []);
1101
+ deepStrictEqual(empty[`${property.singularName}Ids`], []);
1137
1102
  }
1138
1103
  }
1139
1104
  }
@@ -1184,8 +1149,7 @@ for (const typeUri in types) {
1184
1149
  };
1185
1150
  if (property.functional || property.singularAccessor) test(`${type.name}.get${pascalCase(property.singularName)}() [auto]`, async () => {
1186
1151
  const instance = new cls({ [property.singularName]: new URL("https://example.com/test") });
1187
- const value = await instance[`get${pascalCase(property.singularName)}`].call(instance, { documentLoader: docLoader });
1188
- deepStrictEqual(value, sampleValues[property.range[0]]);
1152
+ deepStrictEqual(await instance[`get${pascalCase(property.singularName)}`].call(instance, { documentLoader: docLoader }), sampleValues[property.range[0]]);
1189
1153
  if (property.untyped) return;
1190
1154
  const wrongRef = new cls({ [property.singularName]: new URL("https://example.com/wrong-type") });
1191
1155
  await rejects(() => wrongRef[`get${pascalCase(property.singularName)}`].call(wrongRef, { documentLoader: mockDocumentLoader }), TypeError);
@@ -1249,31 +1213,28 @@ for (const typeUri in types) {
1249
1213
  });
1250
1214
  deepStrictEqual(jsonLd2["@context"], "https://www.w3.org/ns/activitystreams");
1251
1215
  deepStrictEqual(jsonLd2.id, "https://example.com/");
1252
- const restored2 = await cls.fromJsonLd(jsonLd2, {
1216
+ deepStrictEqual(await cls.fromJsonLd(jsonLd2, {
1253
1217
  documentLoader: mockDocumentLoader,
1254
1218
  contextLoader: mockDocumentLoader
1255
- });
1256
- deepStrictEqual(restored2, instance);
1219
+ }), instance);
1257
1220
  const expanded = await instance.toJsonLd({
1258
1221
  contextLoader: mockDocumentLoader,
1259
1222
  format: "expand"
1260
1223
  });
1261
- const restored3 = await cls.fromJsonLd(expanded, {
1224
+ deepStrictEqual(await cls.fromJsonLd(expanded, {
1262
1225
  documentLoader: mockDocumentLoader,
1263
1226
  contextLoader: mockDocumentLoader
1264
- });
1265
- deepStrictEqual(restored3, instance);
1227
+ }), instance);
1266
1228
  const instance2 = new cls({
1267
1229
  id: new URL("https://example.com/"),
1268
1230
  ...initValues,
1269
1231
  ...globalThis.Object.fromEntries(allProperties.filter((p) => !areAllScalarTypes(p.range, types)).map((p) => p.functional ? [p.singularName, new URL("https://example.com/test")] : [p.pluralName, [new URL("https://example.com/test")]]))
1270
1232
  });
1271
1233
  const jsonLd3 = await instance2.toJsonLd({ contextLoader: mockDocumentLoader });
1272
- const restored4 = await cls.fromJsonLd(jsonLd3, {
1234
+ deepStrictEqual(await cls.fromJsonLd(jsonLd3, {
1273
1235
  documentLoader: mockDocumentLoader,
1274
1236
  contextLoader: mockDocumentLoader
1275
- });
1276
- deepStrictEqual(restored4, instance2);
1237
+ }), instance2);
1277
1238
  rejects(() => instance.toJsonLd({ context: "https://www.w3.org/ns/activitystreams" }), TypeError);
1278
1239
  rejects(() => instance.toJsonLd({
1279
1240
  format: "expand",
@@ -1300,5 +1261,5 @@ for (const typeUri in types) {
1300
1261
  deepStrictEqual(cls.typeId, new URL(type.uri));
1301
1262
  });
1302
1263
  }
1303
-
1304
- //#endregion
1264
+ //#endregion
1265
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,16 +46,16 @@
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.7",
50
- "@fedify/webfinger": "2.0.7",
51
- "@fedify/vocab-runtime": "2.0.7"
49
+ "@fedify/vocab-runtime": "2.0.9",
50
+ "@fedify/vocab-tools": "2.0.9",
51
+ "@fedify/webfinger": "2.0.9"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^22.17.0",
55
55
  "fast-check": "^3.22.0",
56
56
  "fetch-mock": "^12.5.4",
57
- "tsdown": "^0.12.9",
58
- "typescript": "^5.9.3",
57
+ "tsdown": "^0.21.6",
58
+ "typescript": "^5.9.2",
59
59
  "@fedify/fixture": "2.0.0"
60
60
  },
61
61
  "keywords": [
@@ -1,13 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- globalThis.addEventListener = () => {};
4
-
5
- //#region src/type.ts
6
- function getTypeId(object) {
7
- if (object == null) return object;
8
- const cls = object.constructor;
9
- return cls.typeId;
10
- }
11
-
12
- //#endregion
13
- export { getTypeId };
@@ -1,24 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- globalThis.addEventListener = () => {};
4
-
5
- import { Person } from "./vocab-BDW9_gZ_.js";
6
- import { getTypeId } from "./type-CNuABalk.js";
7
- import { test } from "@fedify/fixture";
8
- import { deepStrictEqual } from "node:assert/strict";
9
-
10
- //#region src/type.test.ts
11
- test("getTypeId()", () => {
12
- const obj = new Person({});
13
- deepStrictEqual(getTypeId(obj), new URL("https://www.w3.org/ns/activitystreams#Person"));
14
- const obj2 = null;
15
- deepStrictEqual(getTypeId(obj2), null);
16
- const obj3 = void 0;
17
- deepStrictEqual(getTypeId(obj3), void 0);
18
- const obj4 = null;
19
- deepStrictEqual(getTypeId(obj4), null);
20
- const obj5 = void 0;
21
- deepStrictEqual(getTypeId(obj5), void 0);
22
- });
23
-
24
- //#endregion