@fedify/vocab 2.4.0-dev.1599 → 2.4.0-dev.1634

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.
Files changed (41) hide show
  1. package/deno.json +1 -1
  2. package/dist/mod.cjs +472 -16
  3. package/dist/mod.d.cts +119 -1
  4. package/dist/mod.d.ts +119 -1
  5. package/dist/mod.js +473 -17
  6. package/dist-tests/{actor-NhcklZK0.mjs → actor-BQd8S953.mjs} +2 -2
  7. package/dist-tests/actor.test.mjs +2 -2
  8. package/dist-tests/application.yaml +15 -0
  9. package/dist-tests/audio.yaml +2 -1
  10. package/dist-tests/document.yaml +14 -1
  11. package/dist-tests/endpoints.yaml +14 -0
  12. package/dist-tests/group.yaml +15 -0
  13. package/dist-tests/image.yaml +2 -1
  14. package/dist-tests/link.yaml +14 -1
  15. package/dist-tests/lookup.test.mjs +71 -4
  16. package/dist-tests/organization.yaml +15 -0
  17. package/dist-tests/page.yaml +2 -1
  18. package/dist-tests/person.yaml +15 -0
  19. package/dist-tests/service.yaml +15 -0
  20. package/dist-tests/type.test.mjs +1 -1
  21. package/dist-tests/video.yaml +2 -1
  22. package/dist-tests/{vocab-BQ8y6QS7.mjs → vocab-Bjwctrxn.mjs} +472 -16
  23. package/dist-tests/vocab.test.mjs +232 -2
  24. package/package.json +4 -4
  25. package/src/__snapshots__/vocab.test.ts.snap +60 -18
  26. package/src/application.yaml +15 -0
  27. package/src/audio.yaml +2 -1
  28. package/src/document.yaml +14 -1
  29. package/src/endpoints.yaml +14 -0
  30. package/src/group.yaml +15 -0
  31. package/src/image.yaml +2 -1
  32. package/src/link.yaml +14 -1
  33. package/src/lookup.test.ts +121 -0
  34. package/src/lookup.ts +3 -1
  35. package/src/organization.yaml +15 -0
  36. package/src/page.yaml +2 -1
  37. package/src/person.yaml +15 -0
  38. package/src/preprocessors.ts +3 -1
  39. package/src/service.yaml +15 -0
  40. package/src/video.yaml +2 -1
  41. package/src/vocab.test.ts +372 -0
@@ -1,6 +1,6 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, G as __toESM, L as Service, U as __commonJSMin, a as Application, k as Organization, v as Group } from "./vocab-BQ8y6QS7.mjs";
3
+ import { G as __commonJSMin, M as Person, a as Application, j as Organization, q as __toESM, v as Group, z as Service } from "./vocab-Bjwctrxn.mjs";
4
4
  import { t as getTypeId } from "./type-_BlsfT3S.mjs";
5
5
  import { lookupWebFinger } from "@fedify/webfinger";
6
6
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1206,7 +1206,7 @@ var esm_default = new class FetchMock {
1206
1206
  //#endregion
1207
1207
  //#region deno.json
1208
1208
  var name = "@fedify/vocab";
1209
- var version = "2.4.0-dev.1599+7b19967f";
1209
+ var version = "2.4.0-dev.1634+3b4bfbb6";
1210
1210
  //#endregion
1211
1211
  //#region src/actor.ts
1212
1212
  const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, L as Service, W as __exportAll, a as Application, k as Organization, v as Group } from "./vocab-BQ8y6QS7.mjs";
4
- import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-NhcklZK0.mjs";
3
+ import { K as __exportAll, M as Person, a as Application, j as Organization, v as Group, z as Service } from "./vocab-Bjwctrxn.mjs";
4
+ import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-BQd8S953.mjs";
5
5
  import { createTestMeterProvider, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
7
7
  //#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Describes a software application.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/fep/ef61"
10
11
  - "https://w3id.org/security/v1"
11
12
  - "https://w3id.org/security/data-integrity/v1"
12
13
  - "https://www.w3.org/ns/did/v1"
@@ -78,6 +79,20 @@ properties:
78
79
  range:
79
80
  - "https://w3id.org/security#Multikey"
80
81
 
82
+ - pluralName: gateways
83
+ singularName: gateway
84
+ singularAccessor: true
85
+ compactName: gateways
86
+ uri: "https://w3id.org/fep/ef61/gateways"
87
+ container: list
88
+ description: |
89
+ Gateways where the latest version of this portable actor object can be
90
+ retrieved.
91
+
92
+ See [FEP-ef61](https://w3id.org/fep/ef61) for details.
93
+ range:
94
+ - "fedify:gatewayUrl"
95
+
81
96
  - singularName: manuallyApprovesFollowers
82
97
  functional: true
83
98
  compactName: manuallyApprovesFollowers
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Represents an audio document of any kind.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
- - "https://w3id.org/security/data-integrity/v1"
10
+ - "https://w3id.org/security/data-integrity/v2"
11
+ - digestMultibase: "https://www.w3.org/ns/credentials/v2#digestMultibase"
11
12
  - "https://gotosocial.org/ns"
12
13
  properties: []
@@ -7,7 +7,8 @@ entity: true
7
7
  description: Represents a document of any kind.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
- - "https://w3id.org/security/data-integrity/v1"
10
+ - "https://w3id.org/security/data-integrity/v2"
11
+ - digestMultibase: "https://www.w3.org/ns/credentials/v2#digestMultibase"
11
12
  - "https://gotosocial.org/ns"
12
13
 
13
14
  properties:
@@ -30,3 +31,15 @@ properties:
30
31
  device-independent pixels of the linked resource.
31
32
  range:
32
33
  - "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
34
+
35
+ - singularName: digestMultibase
36
+ functional: true
37
+ compactName: digestMultibase
38
+ uri: "https://www.w3.org/ns/credentials/v2#digestMultibase"
39
+ description: |
40
+ The multibase-encoded integrity digest of an external resource represented
41
+ by this document.
42
+
43
+ See [FEP-ef61](https://w3id.org/fep/ef61) for details.
44
+ range:
45
+ - "http://www.w3.org/2001/XMLSchema#string"
@@ -84,3 +84,17 @@ properties:
84
84
  objects which are not addressed to the `Public`` endpoint.
85
85
  range:
86
86
  - "http://www.w3.org/2001/XMLSchema#anyURI"
87
+
88
+ - singularName: uploadMedia
89
+ functional: true
90
+ compactName: uploadMedia
91
+ uri: "https://www.w3.org/ns/activitystreams#uploadMedia"
92
+ description: |
93
+ Upload endpoint URI for this user for binary data, such as an image or
94
+ video, as described in the [ActivityPub Media
95
+ Upload](https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload) extension.
96
+ Clients `POST` a `multipart/form-data` request containing a `file` part
97
+ (the binary payload) and an `object` part (an ActivityStreams object shell)
98
+ to this endpoint.
99
+ range:
100
+ - "http://www.w3.org/2001/XMLSchema#anyURI"
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Represents a formal or informal collective of Actors.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/fep/ef61"
10
11
  - "https://w3id.org/security/v1"
11
12
  - "https://w3id.org/security/data-integrity/v1"
12
13
  - "https://www.w3.org/ns/did/v1"
@@ -78,6 +79,20 @@ properties:
78
79
  range:
79
80
  - "https://w3id.org/security#Multikey"
80
81
 
82
+ - pluralName: gateways
83
+ singularName: gateway
84
+ singularAccessor: true
85
+ compactName: gateways
86
+ uri: "https://w3id.org/fep/ef61/gateways"
87
+ container: list
88
+ description: |
89
+ Gateways where the latest version of this portable actor object can be
90
+ retrieved.
91
+
92
+ See [FEP-ef61](https://w3id.org/fep/ef61) for details.
93
+ range:
94
+ - "fedify:gatewayUrl"
95
+
81
96
  - singularName: manuallyApprovesFollowers
82
97
  functional: true
83
98
  compactName: manuallyApprovesFollowers
@@ -7,6 +7,7 @@ entity: true
7
7
  description: An image document of any kind.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
- - "https://w3id.org/security/data-integrity/v1"
10
+ - "https://w3id.org/security/data-integrity/v2"
11
+ - digestMultibase: "https://www.w3.org/ns/credentials/v2#digestMultibase"
11
12
  - "https://gotosocial.org/ns"
12
13
  properties: []
@@ -12,7 +12,9 @@ description: |
12
12
  object) to the resource identified by the `href`. Properties of
13
13
  the {@link Link} are properties of the reference as opposed to properties of
14
14
  the resource.
15
- defaultContext: "https://www.w3.org/ns/activitystreams"
15
+ defaultContext:
16
+ - "https://www.w3.org/ns/activitystreams"
17
+ - "https://w3id.org/fep/ef61"
16
18
 
17
19
  properties:
18
20
  - singularName: href
@@ -48,6 +50,17 @@ properties:
48
50
  range:
49
51
  - "http://www.w3.org/2001/XMLSchema#string"
50
52
 
53
+ - singularName: digestMultibase
54
+ functional: true
55
+ compactName: digestMultibase
56
+ uri: "https://www.w3.org/ns/credentials/v2#digestMultibase"
57
+ description: |
58
+ The multibase-encoded integrity digest of the linked resource.
59
+
60
+ See [FEP-ef61](https://w3id.org/fep/ef61) for details.
61
+ range:
62
+ - "http://www.w3.org/2001/XMLSchema#string"
63
+
51
64
  - pluralName: names
52
65
  singularName: name
53
66
  singularAccessor: true
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, E as Object$1, T as Note, o as Collection } from "./vocab-BQ8y6QS7.mjs";
4
- import { c as esm_default, i as isActor, o as name, s as version } from "./actor-NhcklZK0.mjs";
3
+ import { D as Note, M as Person, O as Object$1, o as Collection } from "./vocab-Bjwctrxn.mjs";
4
+ import { c as esm_default, i as isActor, o as name, s as version } from "./actor-BQd8S953.mjs";
5
5
  import { t as getTypeId } from "./type-_BlsfT3S.mjs";
6
6
  import { t as assertInstanceOf } from "./utils-CQjrpUkt.mjs";
7
7
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -9,7 +9,7 @@ import { deepStrictEqual, equal, ok, rejects } from "node:assert/strict";
9
9
  import { lookupWebFinger } from "@fedify/webfinger";
10
10
  import { SpanStatusCode, trace } from "@opentelemetry/api";
11
11
  import { getLogger } from "@logtape/logtape";
12
- import { getDocumentLoader, haveSameIriOrigin, parseIri } from "@fedify/vocab-runtime";
12
+ import { getDocumentLoader, haveSameFe34Origin, haveSameIriOrigin, parseIri } from "@fedify/vocab-runtime";
13
13
  import { delay } from "es-toolkit";
14
14
  //#region src/handle.ts
15
15
  /**
@@ -223,7 +223,7 @@ async function lookupObjectInternal(identifier, options = {}) {
223
223
  }
224
224
  throw error;
225
225
  }
226
- if (options.crossOrigin !== "trust" && object.id != null && !haveSameIriOrigin(object.id, documentUrl)) {
226
+ if (options.crossOrigin !== "trust" && object.id != null && !haveSameIriOrigin(object.id, documentUrl) && !haveSameFe34Origin(object.id, documentUrl)) {
227
227
  if (options.crossOrigin === "throw") throw new Error(`The object's @id (${object.id.href}) has a different origin than the document URL (${remoteDoc.documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to "trust".`);
228
228
  logger.warn("The object's @id ({objectId}) has a different origin than the document URL ({documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
229
229
  ...remoteDoc,
@@ -538,6 +538,73 @@ test("FEP-fe34: lookupObject() cross-origin security", {
538
538
  deepStrictEqual(result.id, new URL("https://example.com/note"));
539
539
  deepStrictEqual(result.content, "This is a legitimate note from the same origin");
540
540
  });
541
+ await t.step("same-authority non-FE34 IRIs are still trusted", async () => {
542
+ const atProtoDocumentLoader = async (url) => {
543
+ if (url === "https://gateway.example/at-item") return {
544
+ documentUrl: "at://did%3Aplc%3Aexample/collection/item",
545
+ contextUrl: null,
546
+ document: {
547
+ "@context": "https://www.w3.org/ns/activitystreams",
548
+ type: "Note",
549
+ id: "at://did:plc:example/collection/reply",
550
+ content: "AT Protocol note"
551
+ }
552
+ };
553
+ throw new Error(`Unexpected URL: ${url}`);
554
+ };
555
+ const result = await lookupObject("https://gateway.example/at-item", {
556
+ documentLoader: atProtoDocumentLoader,
557
+ contextLoader: mockDocumentLoader
558
+ });
559
+ assertInstanceOf(result, Note);
560
+ deepStrictEqual(result.id, new URL("at://did%3Aplc%3Aexample/collection/reply"));
561
+ deepStrictEqual(result.content, "AT Protocol note");
562
+ });
563
+ await t.step("portable object IDs are trusted by DID cryptographic origin", async () => {
564
+ const portableDocumentLoader = async (url) => {
565
+ if (url === "https://gateway.example/.well-known/apgateway/did:key:z6Mkabc/note") return {
566
+ documentUrl: "ap+ef61://did:key:z6Mkabc/note",
567
+ contextUrl: null,
568
+ document: {
569
+ "@context": "https://www.w3.org/ns/activitystreams",
570
+ type: "Note",
571
+ id: "ap://did:key:z6Mkabc/note",
572
+ content: "Portable note"
573
+ }
574
+ };
575
+ throw new Error(`Unexpected URL: ${url}`);
576
+ };
577
+ const result = await lookupObject("https://gateway.example/.well-known/apgateway/did:key:z6Mkabc/note", {
578
+ documentLoader: portableDocumentLoader,
579
+ contextLoader: mockDocumentLoader
580
+ });
581
+ assertInstanceOf(result, Note);
582
+ deepStrictEqual(result.content, "Portable note");
583
+ });
584
+ await t.step("portable object IDs reject mismatched cryptographic origins", async () => {
585
+ const portableDocumentLoader = async (url) => {
586
+ if (url === "https://gateway.example/.well-known/apgateway/did:key:z6Mkabc/note") return {
587
+ documentUrl: "ap+ef61://did:key:z6Mkabc/note",
588
+ contextUrl: null,
589
+ document: {
590
+ "@context": "https://www.w3.org/ns/activitystreams",
591
+ type: "Note",
592
+ id: "ap://did:key:z6Mkdef/note",
593
+ content: "Spoofed portable note"
594
+ }
595
+ };
596
+ throw new Error(`Unexpected URL: ${url}`);
597
+ };
598
+ deepStrictEqual(await lookupObject("https://gateway.example/.well-known/apgateway/did:key:z6Mkabc/note", {
599
+ documentLoader: portableDocumentLoader,
600
+ contextLoader: mockDocumentLoader
601
+ }), null);
602
+ await rejects(() => lookupObject("https://gateway.example/.well-known/apgateway/did:key:z6Mkabc/note", {
603
+ documentLoader: portableDocumentLoader,
604
+ contextLoader: mockDocumentLoader,
605
+ crossOrigin: "throw"
606
+ }), Error, "The object's @id (ap+ef61://did%3Akey%3Az6Mkdef/note) has a different origin than the document URL (ap+ef61://did:key:z6Mkabc/note)");
607
+ });
541
608
  await t.step("objects without @id are trusted", async () => {
542
609
  const noIdDocumentLoader = async (url) => {
543
610
  if (url === "https://example.com/note") return {
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Represents an organization.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/fep/ef61"
10
11
  - "https://w3id.org/security/v1"
11
12
  - "https://w3id.org/security/data-integrity/v1"
12
13
  - "https://www.w3.org/ns/did/v1"
@@ -78,6 +79,20 @@ properties:
78
79
  range:
79
80
  - "https://w3id.org/security#Multikey"
80
81
 
82
+ - pluralName: gateways
83
+ singularName: gateway
84
+ singularAccessor: true
85
+ compactName: gateways
86
+ uri: "https://w3id.org/fep/ef61/gateways"
87
+ container: list
88
+ description: |
89
+ Gateways where the latest version of this portable actor object can be
90
+ retrieved.
91
+
92
+ See [FEP-ef61](https://w3id.org/fep/ef61) for details.
93
+ range:
94
+ - "fedify:gatewayUrl"
95
+
81
96
  - singularName: manuallyApprovesFollowers
82
97
  functional: true
83
98
  compactName: manuallyApprovesFollowers
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Represents a Web Page.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
- - "https://w3id.org/security/data-integrity/v1"
10
+ - "https://w3id.org/security/data-integrity/v2"
11
+ - digestMultibase: "https://www.w3.org/ns/credentials/v2#digestMultibase"
11
12
  - "https://gotosocial.org/ns"
12
13
  properties: []
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Represents an individual person.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/fep/ef61"
10
11
  - "https://w3id.org/security/v1"
11
12
  - "https://w3id.org/security/data-integrity/v1"
12
13
  - "https://www.w3.org/ns/did/v1"
@@ -78,6 +79,20 @@ properties:
78
79
  range:
79
80
  - "https://w3id.org/security#Multikey"
80
81
 
82
+ - pluralName: gateways
83
+ singularName: gateway
84
+ singularAccessor: true
85
+ compactName: gateways
86
+ uri: "https://w3id.org/fep/ef61/gateways"
87
+ container: list
88
+ description: |
89
+ Gateways where the latest version of this portable actor object can be
90
+ retrieved.
91
+
92
+ See [FEP-ef61](https://w3id.org/fep/ef61) for details.
93
+ range:
94
+ - "fedify:gatewayUrl"
95
+
81
96
  - singularName: manuallyApprovesFollowers
82
97
  functional: true
83
98
  compactName: manuallyApprovesFollowers
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Represents a service of any kind.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/fep/ef61"
10
11
  - "https://w3id.org/security/v1"
11
12
  - "https://w3id.org/security/data-integrity/v1"
12
13
  - "https://www.w3.org/ns/did/v1"
@@ -78,6 +79,20 @@ properties:
78
79
  range:
79
80
  - "https://w3id.org/security#Multikey"
80
81
 
82
+ - pluralName: gateways
83
+ singularName: gateway
84
+ singularAccessor: true
85
+ compactName: gateways
86
+ uri: "https://w3id.org/fep/ef61/gateways"
87
+ container: list
88
+ description: |
89
+ Gateways where the latest version of this portable actor object can be
90
+ retrieved.
91
+
92
+ See [FEP-ef61](https://w3id.org/fep/ef61) for details.
93
+ range:
94
+ - "fedify:gatewayUrl"
95
+
81
96
  - singularName: manuallyApprovesFollowers
82
97
  functional: true
83
98
  compactName: manuallyApprovesFollowers
@@ -1,6 +1,6 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { A as Person, B as getEntityTypeById, C as Link, V as isEntityType } from "./vocab-BQ8y6QS7.mjs";
3
+ import { H as getEntityTypeById, M as Person, U as isEntityType, w as Link } from "./vocab-Bjwctrxn.mjs";
4
4
  import { t as getTypeId } from "./type-_BlsfT3S.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual } from "node:assert/strict";
@@ -7,6 +7,7 @@ entity: true
7
7
  description: Represents a video document of any kind.
8
8
  defaultContext:
9
9
  - "https://www.w3.org/ns/activitystreams"
10
- - "https://w3id.org/security/data-integrity/v1"
10
+ - "https://w3id.org/security/data-integrity/v2"
11
+ - digestMultibase: "https://www.w3.org/ns/credentials/v2#digestMultibase"
11
12
  - "https://gotosocial.org/ns"
12
13
  properties: []